Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Ehrke <dev@georgswebsite.de>2012-10-28 13:48:08 +0400
committerGeorg Ehrke <dev@georgswebsite.de>2012-10-28 13:48:08 +0400
commita2bbc1b3173d7e4106a27e7a99d61bea10ba6181 (patch)
tree777568a01b0c0a117cc2b89ee7c396f20eb7b49c /3rdparty
parent5245e2b6beb971842c9760476372cef41a5d9a17 (diff)
remove 3rdparty files
Diffstat (limited to '3rdparty')
-rw-r--r--3rdparty/Archive/Tar.php1973
-rw-r--r--3rdparty/Console/Getopt.php251
-rw-r--r--3rdparty/Crypt_Blowfish/Blowfish.php317
-rw-r--r--3rdparty/Crypt_Blowfish/Blowfish/DefaultKey.php327
-rw-r--r--3rdparty/Dropbox/API.php380
-rw-r--r--3rdparty/Dropbox/Exception.php15
-rw-r--r--3rdparty/Dropbox/Exception/Forbidden.php18
-rw-r--r--3rdparty/Dropbox/Exception/NotFound.php20
-rw-r--r--3rdparty/Dropbox/Exception/OverQuota.php20
-rw-r--r--3rdparty/Dropbox/Exception/RequestToken.php18
-rw-r--r--3rdparty/Dropbox/LICENSE.txt19
-rw-r--r--3rdparty/Dropbox/OAuth.php151
-rw-r--r--3rdparty/Dropbox/OAuth/Consumer/Dropbox.php37
-rw-r--r--3rdparty/Dropbox/OAuth/Curl.php282
-rw-r--r--3rdparty/Dropbox/README.md31
-rw-r--r--3rdparty/Dropbox/autoload.php29
-rw-r--r--3rdparty/Google/LICENSE.txt21
-rwxr-xr-x3rdparty/Google/OAuth.php751
-rwxr-xr-x3rdparty/Google/common.inc.php185
-rw-r--r--3rdparty/MDB2.php4587
-rw-r--r--3rdparty/MDB2/Date.php183
-rw-r--r--3rdparty/MDB2/Driver/Datatype/Common.php1842
-rw-r--r--3rdparty/MDB2/Driver/Datatype/mysql.php602
-rw-r--r--3rdparty/MDB2/Driver/Datatype/oci8.php499
-rw-r--r--3rdparty/MDB2/Driver/Datatype/pgsql.php579
-rw-r--r--3rdparty/MDB2/Driver/Datatype/sqlite.php418
-rw-r--r--3rdparty/MDB2/Driver/Function/Common.php293
-rw-r--r--3rdparty/MDB2/Driver/Function/mysql.php136
-rw-r--r--3rdparty/MDB2/Driver/Function/oci8.php187
-rw-r--r--3rdparty/MDB2/Driver/Function/pgsql.php132
-rw-r--r--3rdparty/MDB2/Driver/Function/sqlite.php162
-rw-r--r--3rdparty/MDB2/Driver/Manager/Common.php1038
-rw-r--r--3rdparty/MDB2/Driver/Manager/mysql.php1471
-rw-r--r--3rdparty/MDB2/Driver/Manager/oci8.php1340
-rw-r--r--3rdparty/MDB2/Driver/Manager/pgsql.php990
-rw-r--r--3rdparty/MDB2/Driver/Manager/sqlite.php1390
-rw-r--r--3rdparty/MDB2/Driver/Native/Common.php61
-rw-r--r--3rdparty/MDB2/Driver/Native/mysql.php60
-rw-r--r--3rdparty/MDB2/Driver/Native/oci8.php60
-rw-r--r--3rdparty/MDB2/Driver/Native/pgsql.php88
-rw-r--r--3rdparty/MDB2/Driver/Native/sqlite.php60
-rw-r--r--3rdparty/MDB2/Driver/Reverse/Common.php517
-rw-r--r--3rdparty/MDB2/Driver/Reverse/mysql.php546
-rw-r--r--3rdparty/MDB2/Driver/Reverse/oci8.php625
-rw-r--r--3rdparty/MDB2/Driver/Reverse/pgsql.php574
-rw-r--r--3rdparty/MDB2/Driver/Reverse/sqlite.php611
-rw-r--r--3rdparty/MDB2/Driver/mysql.php1729
-rw-r--r--3rdparty/MDB2/Driver/oci8.php1700
-rw-r--r--3rdparty/MDB2/Driver/pgsql.php1583
-rw-r--r--3rdparty/MDB2/Driver/sqlite.php1104
-rw-r--r--3rdparty/MDB2/Extended.php723
-rw-r--r--3rdparty/MDB2/Iterator.php262
-rw-r--r--3rdparty/MDB2/LOB.php264
-rw-r--r--3rdparty/MDB2/Schema.php2797
-rw-r--r--3rdparty/MDB2/Schema/Parser.php876
-rw-r--r--3rdparty/MDB2/Schema/Parser2.php802
-rw-r--r--3rdparty/MDB2/Schema/Reserved/ibase.php437
-rw-r--r--3rdparty/MDB2/Schema/Reserved/mssql.php260
-rw-r--r--3rdparty/MDB2/Schema/Reserved/mysql.php285
-rw-r--r--3rdparty/MDB2/Schema/Reserved/oci8.php173
-rw-r--r--3rdparty/MDB2/Schema/Reserved/pgsql.php148
-rw-r--r--3rdparty/MDB2/Schema/Tool.php583
-rw-r--r--3rdparty/MDB2/Schema/Tool/ParameterException.php61
-rw-r--r--3rdparty/MDB2/Schema/Validate.php1004
-rw-r--r--3rdparty/MDB2/Schema/Writer.php586
-rw-r--r--3rdparty/OS/Guess.php338
-rw-r--r--3rdparty/PEAR-LICENSE27
-rw-r--r--3rdparty/PEAR.php1063
-rw-r--r--3rdparty/PEAR/Autoloader.php218
-rw-r--r--3rdparty/PEAR/Builder.php489
-rw-r--r--3rdparty/PEAR/ChannelFile.php1559
-rw-r--r--3rdparty/PEAR/ChannelFile/Parser.php68
-rw-r--r--3rdparty/PEAR/Command.php414
-rw-r--r--3rdparty/PEAR/Command/Auth.php81
-rw-r--r--3rdparty/PEAR/Command/Auth.xml30
-rw-r--r--3rdparty/PEAR/Command/Build.php85
-rw-r--r--3rdparty/PEAR/Command/Build.xml10
-rw-r--r--3rdparty/PEAR/Command/Channels.php883
-rw-r--r--3rdparty/PEAR/Command/Channels.xml123
-rw-r--r--3rdparty/PEAR/Command/Common.php273
-rw-r--r--3rdparty/PEAR/Command/Config.php414
-rw-r--r--3rdparty/PEAR/Command/Config.xml92
-rw-r--r--3rdparty/PEAR/Command/Install.php1268
-rw-r--r--3rdparty/PEAR/Command/Install.xml276
-rw-r--r--3rdparty/PEAR/Command/Mirror.php139
-rw-r--r--3rdparty/PEAR/Command/Mirror.xml18
-rw-r--r--3rdparty/PEAR/Command/Package.php1124
-rw-r--r--3rdparty/PEAR/Command/Package.xml237
-rw-r--r--3rdparty/PEAR/Command/Pickle.php421
-rw-r--r--3rdparty/PEAR/Command/Pickle.xml36
-rw-r--r--3rdparty/PEAR/Command/Registry.php1145
-rw-r--r--3rdparty/PEAR/Command/Registry.xml58
-rw-r--r--3rdparty/PEAR/Command/Remote.php810
-rw-r--r--3rdparty/PEAR/Command/Remote.xml109
-rw-r--r--3rdparty/PEAR/Command/Test.php337
-rw-r--r--3rdparty/PEAR/Command/Test.xml54
-rw-r--r--3rdparty/PEAR/Common.php837
-rw-r--r--3rdparty/PEAR/Config.php2097
-rw-r--r--3rdparty/PEAR/Dependency.php487
-rw-r--r--3rdparty/PEAR/Dependency2.php1358
-rw-r--r--3rdparty/PEAR/DependencyDB.php769
-rw-r--r--3rdparty/PEAR/Downloader.php1766
-rw-r--r--3rdparty/PEAR/Downloader/Package.php1988
-rw-r--r--3rdparty/PEAR/ErrorStack.php985
-rw-r--r--3rdparty/PEAR/Exception.php389
-rw-r--r--3rdparty/PEAR/FixPHP5PEARWarnings.php7
-rw-r--r--3rdparty/PEAR/Frontend.php228
-rw-r--r--3rdparty/PEAR/Frontend/CLI.php751
-rw-r--r--3rdparty/PEAR/Installer.php1823
-rw-r--r--3rdparty/PEAR/Installer/Role.php276
-rw-r--r--3rdparty/PEAR/Installer/Role/Cfg.php106
-rw-r--r--3rdparty/PEAR/Installer/Role/Cfg.xml15
-rw-r--r--3rdparty/PEAR/Installer/Role/Common.php174
-rw-r--r--3rdparty/PEAR/Installer/Role/Data.php28
-rw-r--r--3rdparty/PEAR/Installer/Role/Data.xml15
-rw-r--r--3rdparty/PEAR/Installer/Role/Doc.php28
-rw-r--r--3rdparty/PEAR/Installer/Role/Doc.xml15
-rw-r--r--3rdparty/PEAR/Installer/Role/Ext.php28
-rw-r--r--3rdparty/PEAR/Installer/Role/Ext.xml12
-rw-r--r--3rdparty/PEAR/Installer/Role/Php.php28
-rw-r--r--3rdparty/PEAR/Installer/Role/Php.xml15
-rw-r--r--3rdparty/PEAR/Installer/Role/Script.php28
-rw-r--r--3rdparty/PEAR/Installer/Role/Script.xml15
-rw-r--r--3rdparty/PEAR/Installer/Role/Src.php34
-rw-r--r--3rdparty/PEAR/Installer/Role/Src.xml12
-rw-r--r--3rdparty/PEAR/Installer/Role/Test.php28
-rw-r--r--3rdparty/PEAR/Installer/Role/Test.xml15
-rw-r--r--3rdparty/PEAR/Installer/Role/Www.php28
-rw-r--r--3rdparty/PEAR/Installer/Role/Www.xml15
-rw-r--r--3rdparty/PEAR/PackageFile.php492
-rw-r--r--3rdparty/PEAR/PackageFile/Generator/v1.php1284
-rw-r--r--3rdparty/PEAR/PackageFile/Generator/v2.php893
-rw-r--r--3rdparty/PEAR/PackageFile/Parser/v1.php459
-rw-r--r--3rdparty/PEAR/PackageFile/Parser/v2.php113
-rw-r--r--3rdparty/PEAR/PackageFile/v1.php1612
-rw-r--r--3rdparty/PEAR/PackageFile/v2.php2049
-rw-r--r--3rdparty/PEAR/PackageFile/v2/Validator.php2154
-rw-r--r--3rdparty/PEAR/PackageFile/v2/rw.php1604
-rw-r--r--3rdparty/PEAR/Packager.php201
-rw-r--r--3rdparty/PEAR/REST.php483
-rw-r--r--3rdparty/PEAR/REST/10.php871
-rw-r--r--3rdparty/PEAR/REST/11.php341
-rw-r--r--3rdparty/PEAR/REST/13.php299
-rw-r--r--3rdparty/PEAR/Registry.php2395
-rw-r--r--3rdparty/PEAR/Remote.php394
-rw-r--r--3rdparty/PEAR/RunTest.php968
-rw-r--r--3rdparty/PEAR/Task/Common.php202
-rw-r--r--3rdparty/PEAR/Task/Postinstallscript.php323
-rw-r--r--3rdparty/PEAR/Task/Postinstallscript/rw.php169
-rw-r--r--3rdparty/PEAR/Task/Replace.php176
-rw-r--r--3rdparty/PEAR/Task/Replace/rw.php61
-rw-r--r--3rdparty/PEAR/Task/Unixeol.php77
-rw-r--r--3rdparty/PEAR/Task/Unixeol/rw.php56
-rw-r--r--3rdparty/PEAR/Task/Windowseol.php77
-rw-r--r--3rdparty/PEAR/Task/Windowseol/rw.php56
-rw-r--r--3rdparty/PEAR/Validate.php629
-rw-r--r--3rdparty/PEAR/Validator/PECL.php63
-rw-r--r--3rdparty/PEAR/XMLParser.php253
-rw-r--r--3rdparty/PEAR5.php33
-rw-r--r--3rdparty/Sabre/CalDAV/Backend/Abstract.php154
-rw-r--r--3rdparty/Sabre/CalDAV/Backend/BackendInterface.php231
-rw-r--r--3rdparty/Sabre/CalDAV/Backend/NotificationSupport.php47
-rw-r--r--3rdparty/Sabre/CalDAV/Backend/PDO.php687
-rw-r--r--3rdparty/Sabre/CalDAV/Backend/SharingSupport.php238
-rw-r--r--3rdparty/Sabre/CalDAV/Calendar.php378
-rw-r--r--3rdparty/Sabre/CalDAV/CalendarObject.php279
-rw-r--r--3rdparty/Sabre/CalDAV/CalendarQueryParser.php298
-rw-r--r--3rdparty/Sabre/CalDAV/CalendarQueryValidator.php372
-rw-r--r--3rdparty/Sabre/CalDAV/CalendarRootNode.php76
-rw-r--r--3rdparty/Sabre/CalDAV/Exception/InvalidComponentType.php32
-rw-r--r--3rdparty/Sabre/CalDAV/ICSExportPlugin.php141
-rw-r--r--3rdparty/Sabre/CalDAV/ICalendar.php35
-rw-r--r--3rdparty/Sabre/CalDAV/ICalendarObject.php20
-rw-r--r--3rdparty/Sabre/CalDAV/IShareableCalendar.php48
-rw-r--r--3rdparty/Sabre/CalDAV/ISharedCalendar.php22
-rw-r--r--3rdparty/Sabre/CalDAV/Notifications/Collection.php169
-rw-r--r--3rdparty/Sabre/CalDAV/Notifications/ICollection.php22
-rw-r--r--3rdparty/Sabre/CalDAV/Notifications/INode.php38
-rw-r--r--3rdparty/Sabre/CalDAV/Notifications/INotificationType.php43
-rw-r--r--3rdparty/Sabre/CalDAV/Notifications/Node.php188
-rw-r--r--3rdparty/Sabre/CalDAV/Notifications/Notification/Invite.php276
-rw-r--r--3rdparty/Sabre/CalDAV/Notifications/Notification/InviteReply.php216
-rw-r--r--3rdparty/Sabre/CalDAV/Notifications/Notification/SystemStatus.php179
-rw-r--r--3rdparty/Sabre/CalDAV/Plugin.php1312
-rw-r--r--3rdparty/Sabre/CalDAV/Principal/Collection.php31
-rw-r--r--3rdparty/Sabre/CalDAV/Principal/ProxyRead.php178
-rw-r--r--3rdparty/Sabre/CalDAV/Principal/ProxyWrite.php178
-rw-r--r--3rdparty/Sabre/CalDAV/Principal/User.php132
-rw-r--r--3rdparty/Sabre/CalDAV/Property/AllowedSharingModes.php72
-rw-r--r--3rdparty/Sabre/CalDAV/Property/Invite.php173
-rw-r--r--3rdparty/Sabre/CalDAV/Property/ScheduleCalendarTransp.php99
-rw-r--r--3rdparty/Sabre/CalDAV/Property/SupportedCalendarComponentSet.php85
-rw-r--r--3rdparty/Sabre/CalDAV/Property/SupportedCalendarData.php38
-rw-r--r--3rdparty/Sabre/CalDAV/Property/SupportedCollationSet.php44
-rw-r--r--3rdparty/Sabre/CalDAV/Schedule/IMip.php110
-rw-r--r--3rdparty/Sabre/CalDAV/Schedule/IOutbox.php16
-rw-r--r--3rdparty/Sabre/CalDAV/Schedule/Outbox.php160
-rw-r--r--3rdparty/Sabre/CalDAV/ShareableCalendar.php72
-rw-r--r--3rdparty/Sabre/CalDAV/SharedCalendar.php98
-rw-r--r--3rdparty/Sabre/CalDAV/SharingPlugin.php475
-rw-r--r--3rdparty/Sabre/CalDAV/UserCalendars.php348
-rw-r--r--3rdparty/Sabre/CalDAV/Version.php24
-rw-r--r--3rdparty/Sabre/CalDAV/includes.php62
-rw-r--r--3rdparty/Sabre/CardDAV/AddressBook.php312
-rw-r--r--3rdparty/Sabre/CardDAV/AddressBookQueryParser.php219
-rw-r--r--3rdparty/Sabre/CardDAV/AddressBookRoot.php78
-rw-r--r--3rdparty/Sabre/CardDAV/Backend/Abstract.php166
-rw-r--r--3rdparty/Sabre/CardDAV/Backend/PDO.php330
-rw-r--r--3rdparty/Sabre/CardDAV/Card.php256
-rw-r--r--3rdparty/Sabre/CardDAV/IAddressBook.php18
-rw-r--r--3rdparty/Sabre/CardDAV/ICard.php18
-rw-r--r--3rdparty/Sabre/CardDAV/IDirectory.php21
-rw-r--r--3rdparty/Sabre/CardDAV/Plugin.php702
-rw-r--r--3rdparty/Sabre/CardDAV/Property/SupportedAddressData.php69
-rw-r--r--3rdparty/Sabre/CardDAV/UserAddressBooks.php257
-rw-r--r--3rdparty/Sabre/CardDAV/VCFExportPlugin.php107
-rw-r--r--3rdparty/Sabre/CardDAV/Version.php26
-rw-r--r--3rdparty/Sabre/CardDAV/includes.php33
-rw-r--r--3rdparty/Sabre/DAV/Auth/Backend/AbstractBasic.php83
-rw-r--r--3rdparty/Sabre/DAV/Auth/Backend/AbstractDigest.php98
-rw-r--r--3rdparty/Sabre/DAV/Auth/Backend/Apache.php62
-rw-r--r--3rdparty/Sabre/DAV/Auth/Backend/File.php75
-rw-r--r--3rdparty/Sabre/DAV/Auth/Backend/PDO.php65
-rw-r--r--3rdparty/Sabre/DAV/Auth/IBackend.php36
-rw-r--r--3rdparty/Sabre/DAV/Auth/Plugin.php111
-rw-r--r--3rdparty/Sabre/DAV/Browser/GuessContentType.php97
-rw-r--r--3rdparty/Sabre/DAV/Browser/MapGetToPropFind.php55
-rw-r--r--3rdparty/Sabre/DAV/Browser/Plugin.php489
-rw-r--r--3rdparty/Sabre/DAV/Browser/assets/favicon.icobin4286 -> 0 bytes
-rw-r--r--3rdparty/Sabre/DAV/Browser/assets/icons/addressbook.pngbin7232 -> 0 bytes
-rw-r--r--3rdparty/Sabre/DAV/Browser/assets/icons/calendar.pngbin4388 -> 0 bytes
-rw-r--r--3rdparty/Sabre/DAV/Browser/assets/icons/card.pngbin5695 -> 0 bytes
-rw-r--r--3rdparty/Sabre/DAV/Browser/assets/icons/collection.pngbin3474 -> 0 bytes
-rw-r--r--3rdparty/Sabre/DAV/Browser/assets/icons/file.pngbin2837 -> 0 bytes
-rw-r--r--3rdparty/Sabre/DAV/Browser/assets/icons/parent.pngbin3474 -> 0 bytes
-rw-r--r--3rdparty/Sabre/DAV/Browser/assets/icons/principal.pngbin5480 -> 0 bytes
-rw-r--r--3rdparty/Sabre/DAV/Client.php541
-rw-r--r--3rdparty/Sabre/DAV/Collection.php110
-rw-r--r--3rdparty/Sabre/DAV/Exception.php64
-rw-r--r--3rdparty/Sabre/DAV/Exception/BadRequest.php28
-rw-r--r--3rdparty/Sabre/DAV/Exception/Conflict.php28
-rw-r--r--3rdparty/Sabre/DAV/Exception/ConflictingLock.php35
-rw-r--r--3rdparty/Sabre/DAV/Exception/FileNotFound.php19
-rw-r--r--3rdparty/Sabre/DAV/Exception/Forbidden.php27
-rw-r--r--3rdparty/Sabre/DAV/Exception/InsufficientStorage.php27
-rw-r--r--3rdparty/Sabre/DAV/Exception/InvalidResourceType.php33
-rw-r--r--3rdparty/Sabre/DAV/Exception/LockTokenMatchesRequestUri.php39
-rw-r--r--3rdparty/Sabre/DAV/Exception/Locked.php67
-rw-r--r--3rdparty/Sabre/DAV/Exception/MethodNotAllowed.php45
-rw-r--r--3rdparty/Sabre/DAV/Exception/NotAuthenticated.php28
-rw-r--r--3rdparty/Sabre/DAV/Exception/NotFound.php28
-rw-r--r--3rdparty/Sabre/DAV/Exception/NotImplemented.php27
-rw-r--r--3rdparty/Sabre/DAV/Exception/PaymentRequired.php28
-rw-r--r--3rdparty/Sabre/DAV/Exception/PreconditionFailed.php69
-rw-r--r--3rdparty/Sabre/DAV/Exception/ReportNotSupported.php30
-rw-r--r--3rdparty/Sabre/DAV/Exception/RequestedRangeNotSatisfiable.php29
-rw-r--r--3rdparty/Sabre/DAV/Exception/UnsupportedMediaType.php28
-rw-r--r--3rdparty/Sabre/DAV/FS/Directory.php139
-rw-r--r--3rdparty/Sabre/DAV/FS/File.php89
-rw-r--r--3rdparty/Sabre/DAV/FS/Node.php80
-rw-r--r--3rdparty/Sabre/DAV/FSExt/Directory.php157
-rw-r--r--3rdparty/Sabre/DAV/FSExt/File.php117
-rw-r--r--3rdparty/Sabre/DAV/FSExt/Node.php212
-rw-r--r--3rdparty/Sabre/DAV/File.php85
-rw-r--r--3rdparty/Sabre/DAV/ICollection.php77
-rw-r--r--3rdparty/Sabre/DAV/IExtendedCollection.php28
-rw-r--r--3rdparty/Sabre/DAV/IFile.php77
-rw-r--r--3rdparty/Sabre/DAV/INode.php46
-rw-r--r--3rdparty/Sabre/DAV/IProperties.php67
-rw-r--r--3rdparty/Sabre/DAV/IQuota.php27
-rw-r--r--3rdparty/Sabre/DAV/Locks/Backend/Abstract.php50
-rw-r--r--3rdparty/Sabre/DAV/Locks/Backend/FS.php191
-rw-r--r--3rdparty/Sabre/DAV/Locks/Backend/File.php181
-rw-r--r--3rdparty/Sabre/DAV/Locks/Backend/PDO.php165
-rw-r--r--3rdparty/Sabre/DAV/Locks/LockInfo.php81
-rw-r--r--3rdparty/Sabre/DAV/Locks/Plugin.php637
-rw-r--r--3rdparty/Sabre/DAV/Mount/Plugin.php80
-rw-r--r--3rdparty/Sabre/DAV/Node.php55
-rw-r--r--3rdparty/Sabre/DAV/ObjectTree.php159
-rw-r--r--3rdparty/Sabre/DAV/PartialUpdate/IFile.php38
-rw-r--r--3rdparty/Sabre/DAV/PartialUpdate/Plugin.php209
-rw-r--r--3rdparty/Sabre/DAV/Property.php31
-rw-r--r--3rdparty/Sabre/DAV/Property/GetLastModified.php75
-rw-r--r--3rdparty/Sabre/DAV/Property/Href.php91
-rw-r--r--3rdparty/Sabre/DAV/Property/HrefList.php96
-rw-r--r--3rdparty/Sabre/DAV/Property/IHref.php25
-rw-r--r--3rdparty/Sabre/DAV/Property/LockDiscovery.php102
-rw-r--r--3rdparty/Sabre/DAV/Property/ResourceType.php125
-rw-r--r--3rdparty/Sabre/DAV/Property/Response.php155
-rw-r--r--3rdparty/Sabre/DAV/Property/ResponseList.php57
-rw-r--r--3rdparty/Sabre/DAV/Property/SupportedLock.php76
-rw-r--r--3rdparty/Sabre/DAV/Property/SupportedReportSet.php109
-rw-r--r--3rdparty/Sabre/DAV/PropertyInterface.php21
-rw-r--r--3rdparty/Sabre/DAV/Server.php2135
-rw-r--r--3rdparty/Sabre/DAV/ServerPlugin.php90
-rw-r--r--3rdparty/Sabre/DAV/SimpleCollection.php108
-rw-r--r--3rdparty/Sabre/DAV/SimpleFile.php121
-rw-r--r--3rdparty/Sabre/DAV/StringUtil.php91
-rw-r--r--3rdparty/Sabre/DAV/TemporaryFileFilterPlugin.php289
-rw-r--r--3rdparty/Sabre/DAV/Tree.php193
-rw-r--r--3rdparty/Sabre/DAV/Tree/Filesystem.php123
-rw-r--r--3rdparty/Sabre/DAV/URLUtil.php121
-rw-r--r--3rdparty/Sabre/DAV/UUIDUtil.php64
-rw-r--r--3rdparty/Sabre/DAV/Version.php24
-rw-r--r--3rdparty/Sabre/DAV/XMLUtil.php165
-rw-r--r--3rdparty/Sabre/DAV/includes.php98
-rw-r--r--3rdparty/Sabre/DAVACL/AbstractPrincipalCollection.php154
-rw-r--r--3rdparty/Sabre/DAVACL/Exception/AceConflict.php32
-rw-r--r--3rdparty/Sabre/DAVACL/Exception/NeedPrivileges.php81
-rw-r--r--3rdparty/Sabre/DAVACL/Exception/NoAbstract.php32
-rw-r--r--3rdparty/Sabre/DAVACL/Exception/NotRecognizedPrincipal.php32
-rw-r--r--3rdparty/Sabre/DAVACL/Exception/NotSupportedPrivilege.php32
-rw-r--r--3rdparty/Sabre/DAVACL/IACL.php73
-rw-r--r--3rdparty/Sabre/DAVACL/IPrincipal.php75
-rw-r--r--3rdparty/Sabre/DAVACL/IPrincipalBackend.php153
-rw-r--r--3rdparty/Sabre/DAVACL/Plugin.php1382
-rw-r--r--3rdparty/Sabre/DAVACL/Principal.php279
-rw-r--r--3rdparty/Sabre/DAVACL/PrincipalBackend/PDO.php427
-rw-r--r--3rdparty/Sabre/DAVACL/PrincipalCollection.php35
-rw-r--r--3rdparty/Sabre/DAVACL/Property/Acl.php209
-rw-r--r--3rdparty/Sabre/DAVACL/Property/AclRestrictions.php32
-rw-r--r--3rdparty/Sabre/DAVACL/Property/CurrentUserPrivilegeSet.php75
-rw-r--r--3rdparty/Sabre/DAVACL/Property/Principal.php160
-rw-r--r--3rdparty/Sabre/DAVACL/Property/SupportedPrivilegeSet.php92
-rw-r--r--3rdparty/Sabre/DAVACL/Version.php24
-rw-r--r--3rdparty/Sabre/DAVACL/includes.php38
-rw-r--r--3rdparty/Sabre/HTTP/AWSAuth.php227
-rw-r--r--3rdparty/Sabre/HTTP/AbstractAuth.php111
-rw-r--r--3rdparty/Sabre/HTTP/BasicAuth.php67
-rw-r--r--3rdparty/Sabre/HTTP/DigestAuth.php240
-rw-r--r--3rdparty/Sabre/HTTP/Request.php268
-rw-r--r--3rdparty/Sabre/HTTP/Response.php162
-rw-r--r--3rdparty/Sabre/HTTP/Util.php82
-rw-r--r--3rdparty/Sabre/HTTP/Version.php24
-rw-r--r--3rdparty/Sabre/HTTP/includes.php27
-rw-r--r--3rdparty/Sabre/VObject/Component.php405
-rw-r--r--3rdparty/Sabre/VObject/Component/VAlarm.php108
-rw-r--r--3rdparty/Sabre/VObject/Component/VCalendar.php242
-rw-r--r--3rdparty/Sabre/VObject/Component/VCard.php105
-rw-r--r--3rdparty/Sabre/VObject/Component/VEvent.php70
-rw-r--r--3rdparty/Sabre/VObject/Component/VFreeBusy.php68
-rw-r--r--3rdparty/Sabre/VObject/Component/VJournal.php46
-rw-r--r--3rdparty/Sabre/VObject/Component/VTodo.php68
-rw-r--r--3rdparty/Sabre/VObject/DateTimeParser.php181
-rw-r--r--3rdparty/Sabre/VObject/ElementList.php172
-rw-r--r--3rdparty/Sabre/VObject/FreeBusyGenerator.php322
-rw-r--r--3rdparty/Sabre/VObject/Node.php187
-rw-r--r--3rdparty/Sabre/VObject/Parameter.php88
-rw-r--r--3rdparty/Sabre/VObject/ParseException.php12
-rw-r--r--3rdparty/Sabre/VObject/Property.php430
-rw-r--r--3rdparty/Sabre/VObject/Property/Compound.php129
-rw-r--r--3rdparty/Sabre/VObject/Property/DateTime.php233
-rw-r--r--3rdparty/Sabre/VObject/Property/MultiDateTime.php168
-rw-r--r--3rdparty/Sabre/VObject/Reader.php217
-rw-r--r--3rdparty/Sabre/VObject/RecurrenceIterator.php1061
-rw-r--r--3rdparty/Sabre/VObject/Splitter/ICalendar.php111
-rw-r--r--3rdparty/Sabre/VObject/Splitter/SplitterInterface.php39
-rw-r--r--3rdparty/Sabre/VObject/Splitter/VCard.php76
-rw-r--r--3rdparty/Sabre/VObject/StringUtil.php61
-rw-r--r--3rdparty/Sabre/VObject/TimeZoneUtil.php351
-rw-r--r--3rdparty/Sabre/VObject/Version.php24
-rw-r--r--3rdparty/Sabre/VObject/includes.php40
-rw-r--r--3rdparty/Sabre/autoload.php27
-rw-r--r--3rdparty/System.php629
-rw-r--r--3rdparty/XML/Parser.php754
-rw-r--r--3rdparty/XML/Parser/Simple.php326
-rw-r--r--3rdparty/aws-sdk/README.md136
-rw-r--r--3rdparty/aws-sdk/_compatibility_test/README.md37
-rw-r--r--3rdparty/aws-sdk/_compatibility_test/sdk_compatibility.inc.php75
-rw-r--r--3rdparty/aws-sdk/_compatibility_test/sdk_compatibility_test.php789
-rwxr-xr-x3rdparty/aws-sdk/_compatibility_test/sdk_compatibility_test_cli.php186
-rw-r--r--3rdparty/aws-sdk/_docs/CHANGELOG.md1405
-rw-r--r--3rdparty/aws-sdk/_docs/CONTRIBUTORS.md64
-rw-r--r--3rdparty/aws-sdk/_docs/DYNAMODBSESSIONHANDLER.html235
-rw-r--r--3rdparty/aws-sdk/_docs/KNOWNISSUES.md65
-rw-r--r--3rdparty/aws-sdk/_docs/LICENSE.md151
-rw-r--r--3rdparty/aws-sdk/_docs/NOTICE.md444
-rw-r--r--3rdparty/aws-sdk/_docs/STREAMWRAPPER_README.html243
-rw-r--r--3rdparty/aws-sdk/_docs/WHERE_IS_THE_API_REFERENCE.md2
-rw-r--r--3rdparty/aws-sdk/authentication/signable.interface.php48
-rw-r--r--3rdparty/aws-sdk/authentication/signature_v2query.class.php163
-rw-r--r--3rdparty/aws-sdk/authentication/signature_v3json.class.php235
-rw-r--r--3rdparty/aws-sdk/authentication/signature_v3query.class.php192
-rw-r--r--3rdparty/aws-sdk/authentication/signature_v4json.class.php353
-rw-r--r--3rdparty/aws-sdk/authentication/signature_v4query.class.php345
-rw-r--r--3rdparty/aws-sdk/authentication/signer.abstract.php68
-rwxr-xr-x3rdparty/aws-sdk/lib/cachecore/LICENSE25
-rwxr-xr-x3rdparty/aws-sdk/lib/cachecore/README1
-rwxr-xr-x3rdparty/aws-sdk/lib/cachecore/_sql/README5
-rwxr-xr-x3rdparty/aws-sdk/lib/cachecore/_sql/mysql.sql7
-rwxr-xr-x3rdparty/aws-sdk/lib/cachecore/_sql/pgsql.sql6
-rwxr-xr-x3rdparty/aws-sdk/lib/cachecore/_sql/sqlite3.sql2
-rwxr-xr-x3rdparty/aws-sdk/lib/cachecore/cacheapc.class.php126
-rwxr-xr-x3rdparty/aws-sdk/lib/cachecore/cachecore.class.php160
-rwxr-xr-x3rdparty/aws-sdk/lib/cachecore/cachefile.class.php189
-rwxr-xr-x3rdparty/aws-sdk/lib/cachecore/cachemc.class.php183
-rwxr-xr-x3rdparty/aws-sdk/lib/cachecore/cachepdo.class.php297
-rwxr-xr-x3rdparty/aws-sdk/lib/cachecore/cachexcache.class.php129
-rwxr-xr-x3rdparty/aws-sdk/lib/cachecore/icachecore.interface.php66
-rw-r--r--3rdparty/aws-sdk/lib/dom/ArrayToDOMDocument.php181
-rwxr-xr-x3rdparty/aws-sdk/lib/requestcore/LICENSE25
-rwxr-xr-x3rdparty/aws-sdk/lib/requestcore/README.md15
-rwxr-xr-x3rdparty/aws-sdk/lib/requestcore/cacert.pem3390
-rwxr-xr-x3rdparty/aws-sdk/lib/requestcore/requestcore.class.php1028
-rw-r--r--3rdparty/aws-sdk/lib/yaml/LICENSE19
-rw-r--r--3rdparty/aws-sdk/lib/yaml/README.markdown15
-rw-r--r--3rdparty/aws-sdk/lib/yaml/lib/sfYaml.php135
-rw-r--r--3rdparty/aws-sdk/lib/yaml/lib/sfYamlDumper.php60
-rw-r--r--3rdparty/aws-sdk/lib/yaml/lib/sfYamlInline.php442
-rw-r--r--3rdparty/aws-sdk/lib/yaml/lib/sfYamlParser.php612
-rwxr-xr-x3rdparty/aws-sdk/sdk.class.php1435
-rwxr-xr-x3rdparty/aws-sdk/services/s3.class.php3979
-rw-r--r--3rdparty/aws-sdk/utilities/array.class.php312
-rw-r--r--3rdparty/aws-sdk/utilities/batchrequest.class.php126
-rw-r--r--3rdparty/aws-sdk/utilities/complextype.class.php123
-rw-r--r--3rdparty/aws-sdk/utilities/credential.class.php157
-rw-r--r--3rdparty/aws-sdk/utilities/credentials.class.php125
-rw-r--r--3rdparty/aws-sdk/utilities/gzipdecode.class.php377
-rw-r--r--3rdparty/aws-sdk/utilities/hadoopbase.class.php67
-rw-r--r--3rdparty/aws-sdk/utilities/hadoopbootstrap.class.php127
-rw-r--r--3rdparty/aws-sdk/utilities/hadoopstep.class.php98
-rw-r--r--3rdparty/aws-sdk/utilities/info.class.php69
-rw-r--r--3rdparty/aws-sdk/utilities/json.class.php89
-rw-r--r--3rdparty/aws-sdk/utilities/manifest.class.php54
-rw-r--r--3rdparty/aws-sdk/utilities/mimetypes.class.php223
-rw-r--r--3rdparty/aws-sdk/utilities/policy.class.php134
-rw-r--r--3rdparty/aws-sdk/utilities/request.class.php70
-rw-r--r--3rdparty/aws-sdk/utilities/response.class.php29
-rw-r--r--3rdparty/aws-sdk/utilities/simplexml.class.php248
-rw-r--r--3rdparty/aws-sdk/utilities/stacktemplate.class.php52
-rw-r--r--3rdparty/aws-sdk/utilities/stepconfig.class.php91
-rwxr-xr-x3rdparty/aws-sdk/utilities/utilities.class.php399
-rw-r--r--3rdparty/class.phpmailer.php2532
-rw-r--r--3rdparty/class.smtp.php818
-rwxr-xr-x3rdparty/css/chosen-sprite.pngbin559 -> 0 bytes
-rwxr-xr-x3rdparty/css/chosen.css392
-rw-r--r--3rdparty/css/chosen/chosen-sprite.pngbin3998 -> 0 bytes
-rwxr-xr-x3rdparty/css/chosen/chosen.css392
-rw-r--r--3rdparty/fullcalendar/GPL-LICENSE.txt278
-rw-r--r--3rdparty/fullcalendar/MIT-LICENSE.txt20
-rw-r--r--3rdparty/fullcalendar/css/fullcalendar.css618
-rw-r--r--3rdparty/fullcalendar/css/fullcalendar.print.css61
-rw-r--r--3rdparty/fullcalendar/js/fullcalendar.js5220
-rw-r--r--3rdparty/fullcalendar/js/fullcalendar.min.js114
-rw-r--r--3rdparty/fullcalendar/js/gcal.js112
-rw-r--r--3rdparty/getid3/extension.cache.dbm.php211
-rw-r--r--3rdparty/getid3/extension.cache.mysql.php173
-rw-r--r--3rdparty/getid3/getid3.lib.php1317
-rw-r--r--3rdparty/getid3/getid3.php1744
-rw-r--r--3rdparty/getid3/license.txt340
-rw-r--r--3rdparty/getid3/module.archive.gzip.php280
-rw-r--r--3rdparty/getid3/module.archive.rar.php53
-rw-r--r--3rdparty/getid3/module.archive.szip.php96
-rw-r--r--3rdparty/getid3/module.archive.tar.php178
-rw-r--r--3rdparty/getid3/module.archive.zip.php424
-rw-r--r--3rdparty/getid3/module.audio-video.asf.php2021
-rw-r--r--3rdparty/getid3/module.audio-video.bink.php73
-rw-r--r--3rdparty/getid3/module.audio-video.flv.php731
-rw-r--r--3rdparty/getid3/module.audio-video.matroska.php1706
-rw-r--r--3rdparty/getid3/module.audio-video.mpeg.php299
-rw-r--r--3rdparty/getid3/module.audio-video.nsv.php226
-rw-r--r--3rdparty/getid3/module.audio-video.quicktime.php2134
-rw-r--r--3rdparty/getid3/module.audio-video.real.php530
-rw-r--r--3rdparty/getid3/module.audio-video.riff.php2409
-rw-r--r--3rdparty/getid3/module.audio-video.swf.php142
-rw-r--r--3rdparty/getid3/module.audio.aa.php59
-rw-r--r--3rdparty/getid3/module.audio.aac.php515
-rw-r--r--3rdparty/getid3/module.audio.ac3.php473
-rw-r--r--3rdparty/getid3/module.audio.au.php165
-rw-r--r--3rdparty/getid3/module.audio.avr.php127
-rw-r--r--3rdparty/getid3/module.audio.bonk.php230
-rw-r--r--3rdparty/getid3/module.audio.dss.php75
-rw-r--r--3rdparty/getid3/module.audio.dts.php246
-rw-r--r--3rdparty/getid3/module.audio.flac.php480
-rw-r--r--3rdparty/getid3/module.audio.la.php229
-rw-r--r--3rdparty/getid3/module.audio.lpac.php130
-rw-r--r--3rdparty/getid3/module.audio.midi.php526
-rw-r--r--3rdparty/getid3/module.audio.mod.php101
-rw-r--r--3rdparty/getid3/module.audio.monkey.php205
-rw-r--r--3rdparty/getid3/module.audio.mp3.php2011
-rw-r--r--3rdparty/getid3/module.audio.mpc.php509
-rw-r--r--3rdparty/getid3/module.audio.ogg.php705
-rw-r--r--3rdparty/getid3/module.audio.optimfrog.php429
-rw-r--r--3rdparty/getid3/module.audio.rkau.php94
-rw-r--r--3rdparty/getid3/module.audio.shorten.php183
-rw-r--r--3rdparty/getid3/module.audio.tta.php109
-rw-r--r--3rdparty/getid3/module.audio.voc.php207
-rw-r--r--3rdparty/getid3/module.audio.vqf.php162
-rw-r--r--3rdparty/getid3/module.audio.wavpack.php400
-rw-r--r--3rdparty/getid3/module.graphic.bmp.php690
-rw-r--r--3rdparty/getid3/module.graphic.efax.php53
-rw-r--r--3rdparty/getid3/module.graphic.gif.php184
-rw-r--r--3rdparty/getid3/module.graphic.jpg.php338
-rw-r--r--3rdparty/getid3/module.graphic.pcd.php134
-rw-r--r--3rdparty/getid3/module.graphic.png.php520
-rw-r--r--3rdparty/getid3/module.graphic.svg.php104
-rw-r--r--3rdparty/getid3/module.graphic.tiff.php227
-rw-r--r--3rdparty/getid3/module.misc.cue.php312
-rw-r--r--3rdparty/getid3/module.misc.exe.php61
-rw-r--r--3rdparty/getid3/module.misc.iso.php389
-rw-r--r--3rdparty/getid3/module.misc.msoffice.php40
-rw-r--r--3rdparty/getid3/module.misc.par2.php33
-rw-r--r--3rdparty/getid3/module.misc.pdf.php33
-rw-r--r--3rdparty/getid3/module.tag.apetag.php372
-rw-r--r--3rdparty/getid3/module.tag.id3v1.php362
-rw-r--r--3rdparty/getid3/module.tag.id3v2.php3327
-rw-r--r--3rdparty/getid3/module.tag.lyrics3.php297
-rw-r--r--3rdparty/getid3/module.tag.xmp.php766
-rw-r--r--3rdparty/getid3/write.apetag.php225
-rw-r--r--3rdparty/getid3/write.id3v1.php138
-rw-r--r--3rdparty/getid3/write.id3v2.php2050
-rw-r--r--3rdparty/getid3/write.lyrics3.php73
-rw-r--r--3rdparty/getid3/write.metaflac.php163
-rw-r--r--3rdparty/getid3/write.php615
-rw-r--r--3rdparty/getid3/write.real.php275
-rw-r--r--3rdparty/getid3/write.vorbiscomment.php121
-rw-r--r--3rdparty/js/chosen/LICENSE.md24
-rw-r--r--3rdparty/js/chosen/README.md46
-rw-r--r--3rdparty/js/chosen/VERSION1
-rwxr-xr-x3rdparty/js/chosen/chosen.jquery.js952
-rwxr-xr-x3rdparty/js/chosen/chosen.jquery.min.js10
-rw-r--r--3rdparty/mediawiki/CSSMin.php228
-rw-r--r--3rdparty/mediawiki/JavaScriptMinifier.php606
-rw-r--r--3rdparty/miniColors/GPL-LICENSE.txt278
-rw-r--r--3rdparty/miniColors/MIT-LICENSE.txt20
-rwxr-xr-x3rdparty/miniColors/css/images/colors.pngbin12973 -> 0 bytes
-rwxr-xr-x3rdparty/miniColors/css/images/trigger.pngbin706 -> 0 bytes
-rwxr-xr-x3rdparty/miniColors/css/jquery.miniColors.css125
-rwxr-xr-x3rdparty/miniColors/js/jquery.miniColors.js710
-rwxr-xr-x3rdparty/miniColors/js/jquery.miniColors.min.js9
-rw-r--r--3rdparty/openid/class.openid.v3.php326
-rw-r--r--3rdparty/openid/phpmyid.php1707
-rw-r--r--3rdparty/php-cloudfiles/.gitignore3
-rw-r--r--3rdparty/php-cloudfiles/AUTHORS11
-rw-r--r--3rdparty/php-cloudfiles/COPYING27
-rw-r--r--3rdparty/php-cloudfiles/Changelog93
-rw-r--r--3rdparty/php-cloudfiles/README73
-rw-r--r--3rdparty/php-cloudfiles/cloudfiles.php2599
-rw-r--r--3rdparty/php-cloudfiles/cloudfiles_exceptions.php41
-rw-r--r--3rdparty/php-cloudfiles/cloudfiles_http.php1488
-rw-r--r--3rdparty/phpass/PasswordHash.php253
-rw-r--r--3rdparty/phpass/c/Makefile21
-rw-r--r--3rdparty/phpass/c/crypt_private.c106
-rw-r--r--3rdparty/phpass/test.php72
-rw-r--r--3rdparty/smb4php/smb.php456
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/Annotation/Route.php103
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/CompiledRoute.php134
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/Exception/ExceptionInterface.php23
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/Exception/InvalidParameterException.php23
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/Exception/MethodNotAllowedException.php38
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/Exception/MissingMandatoryParametersException.php24
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/Exception/ResourceNotFoundException.php25
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/Exception/RouteNotFoundException.php23
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/Generator/Dumper/GeneratorDumper.php39
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/Generator/Dumper/GeneratorDumperInterface.php45
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/Generator/Dumper/PhpGeneratorDumper.php150
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/Generator/UrlGenerator.php176
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/Generator/UrlGeneratorInterface.php37
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/LICENSE19
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/Loader/AnnotationClassLoader.php213
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/Loader/AnnotationDirectoryLoader.php77
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/Loader/AnnotationFileLoader.php125
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/Loader/ClosureLoader.php54
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/Loader/PhpFileLoader.php64
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/Loader/XmlFileLoader.php224
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/Loader/YamlFileLoader.php142
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/Loader/schema/routing/routing-1.0.xsd38
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/Matcher/ApacheUrlMatcher.php76
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php155
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/MatcherDumper.php44
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/MatcherDumperInterface.php41
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php293
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/Matcher/RedirectableUrlMatcher.php53
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/Matcher/RedirectableUrlMatcherInterface.php35
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/Matcher/UrlMatcher.php151
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/Matcher/UrlMatcherInterface.php38
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/README.md32
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/RequestContext.php250
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/RequestContextAwareInterface.php27
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/Route.php312
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/RouteCollection.php259
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/RouteCompiler.php128
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/RouteCompilerInterface.php29
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/Router.php263
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/RouterInterface.php26
-rw-r--r--3rdparty/symfony/routing/Symfony/Component/Routing/composer.json29
-rwxr-xr-x3rdparty/timepicker/GPL-LICENSE.txt278
-rwxr-xr-x3rdparty/timepicker/MIT-LICENSE.txt20
-rwxr-xr-x3rdparty/timepicker/css/include/images/ui-bg_diagonals-thick_18_b81900_40x40.pngbin260 -> 0 bytes
-rwxr-xr-x3rdparty/timepicker/css/include/images/ui-bg_diagonals-thick_20_666666_40x40.pngbin251 -> 0 bytes
-rwxr-xr-x3rdparty/timepicker/css/include/images/ui-bg_flat_10_000000_40x100.pngbin178 -> 0 bytes
-rwxr-xr-x3rdparty/timepicker/css/include/images/ui-bg_glass_100_f6f6f6_1x400.pngbin104 -> 0 bytes
-rwxr-xr-x3rdparty/timepicker/css/include/images/ui-bg_glass_100_fdf5ce_1x400.pngbin125 -> 0 bytes
-rwxr-xr-x3rdparty/timepicker/css/include/images/ui-bg_glass_65_ffffff_1x400.pngbin105 -> 0 bytes
-rwxr-xr-x3rdparty/timepicker/css/include/images/ui-bg_gloss-wave_35_f6a828_500x100.pngbin3762 -> 0 bytes
-rwxr-xr-x3rdparty/timepicker/css/include/images/ui-bg_highlight-soft_100_eeeeee_1x100.pngbin90 -> 0 bytes
-rwxr-xr-x3rdparty/timepicker/css/include/images/ui-bg_highlight-soft_75_ffe45c_1x100.pngbin129 -> 0 bytes
-rwxr-xr-x3rdparty/timepicker/css/include/images/ui-icons_222222_256x240.pngbin4369 -> 0 bytes
-rwxr-xr-x3rdparty/timepicker/css/include/images/ui-icons_228ef1_256x240.pngbin4369 -> 0 bytes
-rwxr-xr-x3rdparty/timepicker/css/include/images/ui-icons_ef8c08_256x240.pngbin4369 -> 0 bytes
-rwxr-xr-x3rdparty/timepicker/css/include/images/ui-icons_ffd27a_256x240.pngbin4369 -> 0 bytes
-rwxr-xr-x3rdparty/timepicker/css/include/images/ui-icons_ffffff_256x240.pngbin4369 -> 0 bytes
-rwxr-xr-x3rdparty/timepicker/css/include/jquery-1.5.1.min.js16
-rwxr-xr-x3rdparty/timepicker/css/include/jquery-ui-1.8.14.custom.css568
-rwxr-xr-x3rdparty/timepicker/css/include/jquery.ui.core.min.js17
-rwxr-xr-x3rdparty/timepicker/css/include/jquery.ui.position.min.js16
-rwxr-xr-x3rdparty/timepicker/css/include/jquery.ui.tabs.min.js35
-rwxr-xr-x3rdparty/timepicker/css/include/jquery.ui.widget.min.js15
-rwxr-xr-x3rdparty/timepicker/css/include/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.pngbin260 -> 0 bytes
-rwxr-xr-x3rdparty/timepicker/css/include/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.pngbin251 -> 0 bytes
-rwxr-xr-x3rdparty/timepicker/css/include/ui-lightness/images/ui-bg_flat_10_000000_40x100.pngbin178 -> 0 bytes
-rwxr-xr-x3rdparty/timepicker/css/include/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.pngbin104 -> 0 bytes
-rwxr-xr-x3rdparty/timepicker/css/include/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.pngbin125 -> 0 bytes
-rwxr-xr-x3rdparty/timepicker/css/include/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.pngbin105 -> 0 bytes
-rwxr-xr-x3rdparty/timepicker/css/include/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.pngbin3762 -> 0 bytes
-rwxr-xr-x3rdparty/timepicker/css/include/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.pngbin90 -> 0 bytes
-rwxr-xr-x3rdparty/timepicker/css/include/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.pngbin129 -> 0 bytes
-rwxr-xr-x3rdparty/timepicker/css/include/ui-lightness/images/ui-icons_222222_256x240.pngbin4369 -> 0 bytes
-rwxr-xr-x3rdparty/timepicker/css/include/ui-lightness/images/ui-icons_228ef1_256x240.pngbin4369 -> 0 bytes
-rwxr-xr-x3rdparty/timepicker/css/include/ui-lightness/images/ui-icons_ef8c08_256x240.pngbin4369 -> 0 bytes
-rwxr-xr-x3rdparty/timepicker/css/include/ui-lightness/images/ui-icons_ffd27a_256x240.pngbin4369 -> 0 bytes
-rwxr-xr-x3rdparty/timepicker/css/include/ui-lightness/images/ui-icons_ffffff_256x240.pngbin4369 -> 0 bytes
-rwxr-xr-x3rdparty/timepicker/css/jquery.ui.timepicker.css69
-rwxr-xr-x3rdparty/timepicker/js/i18n/i18n.html147
-rwxr-xr-x3rdparty/timepicker/js/i18n/jquery.ui.timepicker-cs.js12
-rwxr-xr-x3rdparty/timepicker/js/i18n/jquery.ui.timepicker-de.js12
-rwxr-xr-x3rdparty/timepicker/js/i18n/jquery.ui.timepicker-es.js12
-rwxr-xr-x3rdparty/timepicker/js/i18n/jquery.ui.timepicker-fr.js13
-rwxr-xr-x3rdparty/timepicker/js/i18n/jquery.ui.timepicker-hr.js13
-rwxr-xr-x3rdparty/timepicker/js/i18n/jquery.ui.timepicker-it.js12
-rwxr-xr-x3rdparty/timepicker/js/i18n/jquery.ui.timepicker-ja.js12
-rwxr-xr-x3rdparty/timepicker/js/i18n/jquery.ui.timepicker-nl.js12
-rwxr-xr-x3rdparty/timepicker/js/i18n/jquery.ui.timepicker-pl.js12
-rwxr-xr-x3rdparty/timepicker/js/i18n/jquery.ui.timepicker-pt-BR.js12
-rwxr-xr-x3rdparty/timepicker/js/i18n/jquery.ui.timepicker-sl.js12
-rwxr-xr-x3rdparty/timepicker/js/i18n/jquery.ui.timepicker-sv.js12
-rwxr-xr-x3rdparty/timepicker/js/i18n/jquery.ui.timepicker-tr.js12
-rwxr-xr-x3rdparty/timepicker/js/jquery.ui.timepicker.js1406
-rwxr-xr-x3rdparty/timepicker/releases.txt115
639 files changed, 0 insertions, 200511 deletions
diff --git a/3rdparty/Archive/Tar.php b/3rdparty/Archive/Tar.php
deleted file mode 100644
index fd2d5d7d9b8..00000000000
--- a/3rdparty/Archive/Tar.php
+++ /dev/null
@@ -1,1973 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * File::CSV
- *
- * PHP versions 4 and 5
- *
- * Copyright (c) 1997-2008,
- * Vincent Blavet <vincent@phpconcept.net>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * @category File_Formats
- * @package Archive_Tar
- * @author Vincent Blavet <vincent@phpconcept.net>
- * @copyright 1997-2010 The Authors
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Tar.php 324840 2012-04-05 08:44:41Z mrook $
- * @link http://pear.php.net/package/Archive_Tar
- */
-
-require_once 'PEAR.php';
-
-define('ARCHIVE_TAR_ATT_SEPARATOR', 90001);
-define('ARCHIVE_TAR_END_BLOCK', pack("a512", ''));
-
-/**
-* Creates a (compressed) Tar archive
-*
-* @package Archive_Tar
-* @author Vincent Blavet <vincent@phpconcept.net>
-* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
-* @version $Revision: 324840 $
-*/
-class Archive_Tar extends PEAR
-{
- /**
- * @var string Name of the Tar
- */
- var $_tarname='';
-
- /**
- * @var boolean if true, the Tar file will be gzipped
- */
- var $_compress=false;
-
- /**
- * @var string Type of compression : 'none', 'gz' or 'bz2'
- */
- var $_compress_type='none';
-
- /**
- * @var string Explode separator
- */
- var $_separator=' ';
-
- /**
- * @var file descriptor
- */
- var $_file=0;
-
- /**
- * @var string Local Tar name of a remote Tar (http:// or ftp://)
- */
- var $_temp_tarname='';
-
- /**
- * @var string regular expression for ignoring files or directories
- */
- var $_ignore_regexp='';
-
- /**
- * @var object PEAR_Error object
- */
- var $error_object=null;
-
- // {{{ constructor
- /**
- * Archive_Tar Class constructor. This flavour of the constructor only
- * declare a new Archive_Tar object, identifying it by the name of the
- * tar file.
- * If the compress argument is set the tar will be read or created as a
- * gzip or bz2 compressed TAR file.
- *
- * @param string $p_tarname The name of the tar archive to create
- * @param string $p_compress can be null, 'gz' or 'bz2'. This
- * parameter indicates if gzip or bz2 compression
- * is required. For compatibility reason the
- * boolean value 'true' means 'gz'.
- *
- * @access public
- */
- function Archive_Tar($p_tarname, $p_compress = null)
- {
- $this->PEAR();
- $this->_compress = false;
- $this->_compress_type = 'none';
- if (($p_compress === null) || ($p_compress == '')) {
- if (@file_exists($p_tarname)) {
- if ($fp = @fopen($p_tarname, "rb")) {
- // look for gzip magic cookie
- $data = fread($fp, 2);
- fclose($fp);
- if ($data == "\37\213") {
- $this->_compress = true;
- $this->_compress_type = 'gz';
- // No sure it's enought for a magic code ....
- } elseif ($data == "BZ") {
- $this->_compress = true;
- $this->_compress_type = 'bz2';
- }
- }
- } else {
- // probably a remote file or some file accessible
- // through a stream interface
- if (substr($p_tarname, -2) == 'gz') {
- $this->_compress = true;
- $this->_compress_type = 'gz';
- } elseif ((substr($p_tarname, -3) == 'bz2') ||
- (substr($p_tarname, -2) == 'bz')) {
- $this->_compress = true;
- $this->_compress_type = 'bz2';
- }
- }
- } else {
- if (($p_compress === true) || ($p_compress == 'gz')) {
- $this->_compress = true;
- $this->_compress_type = 'gz';
- } else if ($p_compress == 'bz2') {
- $this->_compress = true;
- $this->_compress_type = 'bz2';
- } else {
- $this->_error("Unsupported compression type '$p_compress'\n".
- "Supported types are 'gz' and 'bz2'.\n");
- return false;
- }
- }
- $this->_tarname = $p_tarname;
- if ($this->_compress) { // assert zlib or bz2 extension support
- if ($this->_compress_type == 'gz')
- $extname = 'zlib';
- else if ($this->_compress_type == 'bz2')
- $extname = 'bz2';
-
- if (!extension_loaded($extname)) {
- PEAR::loadExtension($extname);
- }
- if (!extension_loaded($extname)) {
- $this->_error("The extension '$extname' couldn't be found.\n".
- "Please make sure your version of PHP was built ".
- "with '$extname' support.\n");
- return false;
- }
- }
- }
- // }}}
-
- // {{{ destructor
- function _Archive_Tar()
- {
- $this->_close();
- // ----- Look for a local copy to delete
- if ($this->_temp_tarname != '')
- @unlink($this->_temp_tarname);
- $this->_PEAR();
- }
- // }}}
-
- // {{{ create()
- /**
- * This method creates the archive file and add the files / directories
- * that are listed in $p_filelist.
- * If a file with the same name exist and is writable, it is replaced
- * by the new tar.
- * The method return false and a PEAR error text.
- * The $p_filelist parameter can be an array of string, each string
- * representing a filename or a directory name with their path if
- * needed. It can also be a single string with names separated by a
- * single blank.
- * For each directory added in the archive, the files and
- * sub-directories are also added.
- * See also createModify() method for more details.
- *
- * @param array $p_filelist An array of filenames and directory names, or a
- * single string with names separated by a single
- * blank space.
- *
- * @return true on success, false on error.
- * @see createModify()
- * @access public
- */
- function create($p_filelist)
- {
- return $this->createModify($p_filelist, '', '');
- }
- // }}}
-
- // {{{ add()
- /**
- * This method add the files / directories that are listed in $p_filelist in
- * the archive. If the archive does not exist it is created.
- * The method return false and a PEAR error text.
- * The files and directories listed are only added at the end of the archive,
- * even if a file with the same name is already archived.
- * See also createModify() method for more details.
- *
- * @param array $p_filelist An array of filenames and directory names, or a
- * single string with names separated by a single
- * blank space.
- *
- * @return true on success, false on error.
- * @see createModify()
- * @access public
- */
- function add($p_filelist)
- {
- return $this->addModify($p_filelist, '', '');
- }
- // }}}
-
- // {{{ extract()
- function extract($p_path='', $p_preserve=false)
- {
- return $this->extractModify($p_path, '', $p_preserve);
- }
- // }}}
-
- // {{{ listContent()
- function listContent()
- {
- $v_list_detail = array();
-
- if ($this->_openRead()) {
- if (!$this->_extractList('', $v_list_detail, "list", '', '')) {
- unset($v_list_detail);
- $v_list_detail = 0;
- }
- $this->_close();
- }
-
- return $v_list_detail;
- }
- // }}}
-
- // {{{ createModify()
- /**
- * This method creates the archive file and add the files / directories
- * that are listed in $p_filelist.
- * If the file already exists and is writable, it is replaced by the
- * new tar. It is a create and not an add. If the file exists and is
- * read-only or is a directory it is not replaced. The method return
- * false and a PEAR error text.
- * The $p_filelist parameter can be an array of string, each string
- * representing a filename or a directory name with their path if
- * needed. It can also be a single string with names separated by a
- * single blank.
- * The path indicated in $p_remove_dir will be removed from the
- * memorized path of each file / directory listed when this path
- * exists. By default nothing is removed (empty path '')
- * The path indicated in $p_add_dir will be added at the beginning of
- * the memorized path of each file / directory listed. However it can
- * be set to empty ''. The adding of a path is done after the removing
- * of path.
- * The path add/remove ability enables the user to prepare an archive
- * for extraction in a different path than the origin files are.
- * See also addModify() method for file adding properties.
- *
- * @param array $p_filelist An array of filenames and directory names,
- * or a single string with names separated by
- * a single blank space.
- * @param string $p_add_dir A string which contains a path to be added
- * to the memorized path of each element in
- * the list.
- * @param string $p_remove_dir A string which contains a path to be
- * removed from the memorized path of each
- * element in the list, when relevant.
- *
- * @return boolean true on success, false on error.
- * @access public
- * @see addModify()
- */
- function createModify($p_filelist, $p_add_dir, $p_remove_dir='')
- {
- $v_result = true;
-
- if (!$this->_openWrite())
- return false;
-
- if ($p_filelist != '') {
- if (is_array($p_filelist))
- $v_list = $p_filelist;
- elseif (is_string($p_filelist))
- $v_list = explode($this->_separator, $p_filelist);
- else {
- $this->_cleanFile();
- $this->_error('Invalid file list');
- return false;
- }
-
- $v_result = $this->_addList($v_list, $p_add_dir, $p_remove_dir);
- }
-
- if ($v_result) {
- $this->_writeFooter();
- $this->_close();
- } else
- $this->_cleanFile();
-
- return $v_result;
- }
- // }}}
-
- // {{{ addModify()
- /**
- * This method add the files / directories listed in $p_filelist at the
- * end of the existing archive. If the archive does not yet exists it
- * is created.
- * The $p_filelist parameter can be an array of string, each string
- * representing a filename or a directory name with their path if
- * needed. It can also be a single string with names separated by a
- * single blank.
- * The path indicated in $p_remove_dir will be removed from the
- * memorized path of each file / directory listed when this path
- * exists. By default nothing is removed (empty path '')
- * The path indicated in $p_add_dir will be added at the beginning of
- * the memorized path of each file / directory listed. However it can
- * be set to empty ''. The adding of a path is done after the removing
- * of path.
- * The path add/remove ability enables the user to prepare an archive
- * for extraction in a different path than the origin files are.
- * If a file/dir is already in the archive it will only be added at the
- * end of the archive. There is no update of the existing archived
- * file/dir. However while extracting the archive, the last file will
- * replace the first one. This results in a none optimization of the
- * archive size.
- * If a file/dir does not exist the file/dir is ignored. However an
- * error text is send to PEAR error.
- * If a file/dir is not readable the file/dir is ignored. However an
- * error text is send to PEAR error.
- *
- * @param array $p_filelist An array of filenames and directory
- * names, or a single string with names
- * separated by a single blank space.
- * @param string $p_add_dir A string which contains a path to be
- * added to the memorized path of each
- * element in the list.
- * @param string $p_remove_dir A string which contains a path to be
- * removed from the memorized path of
- * each element in the list, when
- * relevant.
- *
- * @return true on success, false on error.
- * @access public
- */
- function addModify($p_filelist, $p_add_dir, $p_remove_dir='')
- {
- $v_result = true;
-
- if (!$this->_isArchive())
- $v_result = $this->createModify($p_filelist, $p_add_dir,
- $p_remove_dir);
- else {
- if (is_array($p_filelist))
- $v_list = $p_filelist;
- elseif (is_string($p_filelist))
- $v_list = explode($this->_separator, $p_filelist);
- else {
- $this->_error('Invalid file list');
- return false;
- }
-
- $v_result = $this->_append($v_list, $p_add_dir, $p_remove_dir);
- }
-
- return $v_result;
- }
- // }}}
-
- // {{{ addString()
- /**
- * This method add a single string as a file at the
- * end of the existing archive. If the archive does not yet exists it
- * is created.
- *
- * @param string $p_filename A string which contains the full
- * filename path that will be associated
- * with the string.
- * @param string $p_string The content of the file added in
- * the archive.
- *
- * @return true on success, false on error.
- * @access public
- */
- function addString($p_filename, $p_string)
- {
- $v_result = true;
-
- if (!$this->_isArchive()) {
- if (!$this->_openWrite()) {
- return false;
- }
- $this->_close();
- }
-
- if (!$this->_openAppend())
- return false;
-
- // Need to check the get back to the temporary file ? ....
- $v_result = $this->_addString($p_filename, $p_string);
-
- $this->_writeFooter();
-
- $this->_close();
-
- return $v_result;
- }
- // }}}
-
- // {{{ extractModify()
- /**
- * This method extract all the content of the archive in the directory
- * indicated by $p_path. When relevant the memorized path of the
- * files/dir can be modified by removing the $p_remove_path path at the
- * beginning of the file/dir path.
- * While extracting a file, if the directory path does not exists it is
- * created.
- * While extracting a file, if the file already exists it is replaced
- * without looking for last modification date.
- * While extracting a file, if the file already exists and is write
- * protected, the extraction is aborted.
- * While extracting a file, if a directory with the same name already
- * exists, the extraction is aborted.
- * While extracting a directory, if a file with the same name already
- * exists, the extraction is aborted.
- * While extracting a file/directory if the destination directory exist
- * and is write protected, or does not exist but can not be created,
- * the extraction is aborted.
- * If after extraction an extracted file does not show the correct
- * stored file size, the extraction is aborted.
- * When the extraction is aborted, a PEAR error text is set and false
- * is returned. However the result can be a partial extraction that may
- * need to be manually cleaned.
- *
- * @param string $p_path The path of the directory where the
- * files/dir need to by extracted.
- * @param string $p_remove_path Part of the memorized path that can be
- * removed if present at the beginning of
- * the file/dir path.
- * @param boolean $p_preserve Preserve user/group ownership of files
- *
- * @return boolean true on success, false on error.
- * @access public
- * @see extractList()
- */
- function extractModify($p_path, $p_remove_path, $p_preserve=false)
- {
- $v_result = true;
- $v_list_detail = array();
-
- if ($v_result = $this->_openRead()) {
- $v_result = $this->_extractList($p_path, $v_list_detail,
- "complete", 0, $p_remove_path, $p_preserve);
- $this->_close();
- }
-
- return $v_result;
- }
- // }}}
-
- // {{{ extractInString()
- /**
- * This method extract from the archive one file identified by $p_filename.
- * The return value is a string with the file content, or NULL on error.
- *
- * @param string $p_filename The path of the file to extract in a string.
- *
- * @return a string with the file content or NULL.
- * @access public
- */
- function extractInString($p_filename)
- {
- if ($this->_openRead()) {
- $v_result = $this->_extractInString($p_filename);
- $this->_close();
- } else {
- $v_result = null;
- }
-
- return $v_result;
- }
- // }}}
-
- // {{{ extractList()
- /**
- * This method extract from the archive only the files indicated in the
- * $p_filelist. These files are extracted in the current directory or
- * in the directory indicated by the optional $p_path parameter.
- * If indicated the $p_remove_path can be used in the same way as it is
- * used in extractModify() method.
- *
- * @param array $p_filelist An array of filenames and directory names,
- * or a single string with names separated
- * by a single blank space.
- * @param string $p_path The path of the directory where the
- * files/dir need to by extracted.
- * @param string $p_remove_path Part of the memorized path that can be
- * removed if present at the beginning of
- * the file/dir path.
- * @param boolean $p_preserve Preserve user/group ownership of files
- *
- * @return true on success, false on error.
- * @access public
- * @see extractModify()
- */
- function extractList($p_filelist, $p_path='', $p_remove_path='', $p_preserve=false)
- {
- $v_result = true;
- $v_list_detail = array();
-
- if (is_array($p_filelist))
- $v_list = $p_filelist;
- elseif (is_string($p_filelist))
- $v_list = explode($this->_separator, $p_filelist);
- else {
- $this->_error('Invalid string list');
- return false;
- }
-
- if ($v_result = $this->_openRead()) {
- $v_result = $this->_extractList($p_path, $v_list_detail, "partial",
- $v_list, $p_remove_path, $p_preserve);
- $this->_close();
- }
-
- return $v_result;
- }
- // }}}
-
- // {{{ setAttribute()
- /**
- * This method set specific attributes of the archive. It uses a variable
- * list of parameters, in the format attribute code + attribute values :
- * $arch->setAttribute(ARCHIVE_TAR_ATT_SEPARATOR, ',');
- *
- * @param mixed $argv variable list of attributes and values
- *
- * @return true on success, false on error.
- * @access public
- */
- function setAttribute()
- {
- $v_result = true;
-
- // ----- Get the number of variable list of arguments
- if (($v_size = func_num_args()) == 0) {
- return true;
- }
-
- // ----- Get the arguments
- $v_att_list = &func_get_args();
-
- // ----- Read the attributes
- $i=0;
- while ($i<$v_size) {
-
- // ----- Look for next option
- switch ($v_att_list[$i]) {
- // ----- Look for options that request a string value
- case ARCHIVE_TAR_ATT_SEPARATOR :
- // ----- Check the number of parameters
- if (($i+1) >= $v_size) {
- $this->_error('Invalid number of parameters for '
- .'attribute ARCHIVE_TAR_ATT_SEPARATOR');
- return false;
- }
-
- // ----- Get the value
- $this->_separator = $v_att_list[$i+1];
- $i++;
- break;
-
- default :
- $this->_error('Unknow attribute code '.$v_att_list[$i].'');
- return false;
- }
-
- // ----- Next attribute
- $i++;
- }
-
- return $v_result;
- }
- // }}}
-
- // {{{ setIgnoreRegexp()
- /**
- * This method sets the regular expression for ignoring files and directories
- * at import, for example:
- * $arch->setIgnoreRegexp("#CVS|\.svn#");
- *
- * @param string $regexp regular expression defining which files or directories to ignore
- *
- * @access public
- */
- function setIgnoreRegexp($regexp)
- {
- $this->_ignore_regexp = $regexp;
- }
- // }}}
-
- // {{{ setIgnoreList()
- /**
- * This method sets the regular expression for ignoring all files and directories
- * matching the filenames in the array list at import, for example:
- * $arch->setIgnoreList(array('CVS', '.svn', 'bin/tool'));
- *
- * @param array $list a list of file or directory names to ignore
- *
- * @access public
- */
- function setIgnoreList($list)
- {
- $regexp = str_replace(array('#', '.', '^', '$'), array('\#', '\.', '\^', '\$'), $list);
- $regexp = '#/'.join('$|/', $list).'#';
- $this->setIgnoreRegexp($regexp);
- }
- // }}}
-
- // {{{ _error()
- function _error($p_message)
- {
- $this->error_object = &$this->raiseError($p_message);
- }
- // }}}
-
- // {{{ _warning()
- function _warning($p_message)
- {
- $this->error_object = &$this->raiseError($p_message);
- }
- // }}}
-
- // {{{ _isArchive()
- function _isArchive($p_filename=null)
- {
- if ($p_filename == null) {
- $p_filename = $this->_tarname;
- }
- clearstatcache();
- return @is_file($p_filename) && !@is_link($p_filename);
- }
- // }}}
-
- // {{{ _openWrite()
- function _openWrite()
- {
- if ($this->_compress_type == 'gz' && function_exists('gzopen'))
- $this->_file = @gzopen($this->_tarname, "wb9");
- else if ($this->_compress_type == 'bz2' && function_exists('bzopen'))
- $this->_file = @bzopen($this->_tarname, "w");
- else if ($this->_compress_type == 'none')
- $this->_file = @fopen($this->_tarname, "wb");
- else
- $this->_error('Unknown or missing compression type ('
- .$this->_compress_type.')');
-
- if ($this->_file == 0) {
- $this->_error('Unable to open in write mode \''
- .$this->_tarname.'\'');
- return false;
- }
-
- return true;
- }
- // }}}
-
- // {{{ _openRead()
- function _openRead()
- {
- if (strtolower(substr($this->_tarname, 0, 7)) == 'http://') {
-
- // ----- Look if a local copy need to be done
- if ($this->_temp_tarname == '') {
- $this->_temp_tarname = uniqid('tar').'.tmp';
- if (!$v_file_from = @fopen($this->_tarname, 'rb')) {
- $this->_error('Unable to open in read mode \''
- .$this->_tarname.'\'');
- $this->_temp_tarname = '';
- return false;
- }
- if (!$v_file_to = @fopen($this->_temp_tarname, 'wb')) {
- $this->_error('Unable to open in write mode \''
- .$this->_temp_tarname.'\'');
- $this->_temp_tarname = '';
- return false;
- }
- while ($v_data = @fread($v_file_from, 1024))
- @fwrite($v_file_to, $v_data);
- @fclose($v_file_from);
- @fclose($v_file_to);
- }
-
- // ----- File to open if the local copy
- $v_filename = $this->_temp_tarname;
-
- } else
- // ----- File to open if the normal Tar file
- $v_filename = $this->_tarname;
-
- if ($this->_compress_type == 'gz')
- $this->_file = @gzopen($v_filename, "rb");
- else if ($this->_compress_type == 'bz2')
- $this->_file = @bzopen($v_filename, "r");
- else if ($this->_compress_type == 'none')
- $this->_file = @fopen($v_filename, "rb");
- else
- $this->_error('Unknown or missing compression type ('
- .$this->_compress_type.')');
-
- if ($this->_file == 0) {
- $this->_error('Unable to open in read mode \''.$v_filename.'\'');
- return false;
- }
-
- return true;
- }
- // }}}
-
- // {{{ _openReadWrite()
- function _openReadWrite()
- {
- if ($this->_compress_type == 'gz')
- $this->_file = @gzopen($this->_tarname, "r+b");
- else if ($this->_compress_type == 'bz2') {
- $this->_error('Unable to open bz2 in read/write mode \''
- .$this->_tarname.'\' (limitation of bz2 extension)');
- return false;
- } else if ($this->_compress_type == 'none')
- $this->_file = @fopen($this->_tarname, "r+b");
- else
- $this->_error('Unknown or missing compression type ('
- .$this->_compress_type.')');
-
- if ($this->_file == 0) {
- $this->_error('Unable to open in read/write mode \''
- .$this->_tarname.'\'');
- return false;
- }
-
- return true;
- }
- // }}}
-
- // {{{ _close()
- function _close()
- {
- //if (isset($this->_file)) {
- if (is_resource($this->_file)) {
- if ($this->_compress_type == 'gz')
- @gzclose($this->_file);
- else if ($this->_compress_type == 'bz2')
- @bzclose($this->_file);
- else if ($this->_compress_type == 'none')
- @fclose($this->_file);
- else
- $this->_error('Unknown or missing compression type ('
- .$this->_compress_type.')');
-
- $this->_file = 0;
- }
-
- // ----- Look if a local copy need to be erase
- // Note that it might be interesting to keep the url for a time : ToDo
- if ($this->_temp_tarname != '') {
- @unlink($this->_temp_tarname);
- $this->_temp_tarname = '';
- }
-
- return true;
- }
- // }}}
-
- // {{{ _cleanFile()
- function _cleanFile()
- {
- $this->_close();
-
- // ----- Look for a local copy
- if ($this->_temp_tarname != '') {
- // ----- Remove the local copy but not the remote tarname
- @unlink($this->_temp_tarname);
- $this->_temp_tarname = '';
- } else {
- // ----- Remove the local tarname file
- @unlink($this->_tarname);
- }
- $this->_tarname = '';
-
- return true;
- }
- // }}}
-
- // {{{ _writeBlock()
- function _writeBlock($p_binary_data, $p_len=null)
- {
- if (is_resource($this->_file)) {
- if ($p_len === null) {
- if ($this->_compress_type == 'gz')
- @gzputs($this->_file, $p_binary_data);
- else if ($this->_compress_type == 'bz2')
- @bzwrite($this->_file, $p_binary_data);
- else if ($this->_compress_type == 'none')
- @fputs($this->_file, $p_binary_data);
- else
- $this->_error('Unknown or missing compression type ('
- .$this->_compress_type.')');
- } else {
- if ($this->_compress_type == 'gz')
- @gzputs($this->_file, $p_binary_data, $p_len);
- else if ($this->_compress_type == 'bz2')
- @bzwrite($this->_file, $p_binary_data, $p_len);
- else if ($this->_compress_type == 'none')
- @fputs($this->_file, $p_binary_data, $p_len);
- else
- $this->_error('Unknown or missing compression type ('
- .$this->_compress_type.')');
-
- }
- }
- return true;
- }
- // }}}
-
- // {{{ _readBlock()
- function _readBlock()
- {
- $v_block = null;
- if (is_resource($this->_file)) {
- if ($this->_compress_type == 'gz')
- $v_block = @gzread($this->_file, 512);
- else if ($this->_compress_type == 'bz2')
- $v_block = @bzread($this->_file, 512);
- else if ($this->_compress_type == 'none')
- $v_block = @fread($this->_file, 512);
- else
- $this->_error('Unknown or missing compression type ('
- .$this->_compress_type.')');
- }
- return $v_block;
- }
- // }}}
-
- // {{{ _jumpBlock()
- function _jumpBlock($p_len=null)
- {
- if (is_resource($this->_file)) {
- if ($p_len === null)
- $p_len = 1;
-
- if ($this->_compress_type == 'gz') {
- @gzseek($this->_file, gztell($this->_file)+($p_len*512));
- }
- else if ($this->_compress_type == 'bz2') {
- // ----- Replace missing bztell() and bzseek()
- for ($i=0; $i<$p_len; $i++)
- $this->_readBlock();
- } else if ($this->_compress_type == 'none')
- @fseek($this->_file, $p_len*512, SEEK_CUR);
- else
- $this->_error('Unknown or missing compression type ('
- .$this->_compress_type.')');
-
- }
- return true;
- }
- // }}}
-
- // {{{ _writeFooter()
- function _writeFooter()
- {
- if (is_resource($this->_file)) {
- // ----- Write the last 0 filled block for end of archive
- $v_binary_data = pack('a1024', '');
- $this->_writeBlock($v_binary_data);
- }
- return true;
- }
- // }}}
-
- // {{{ _addList()
- function _addList($p_list, $p_add_dir, $p_remove_dir)
- {
- $v_result=true;
- $v_header = array();
-
- // ----- Remove potential windows directory separator
- $p_add_dir = $this->_translateWinPath($p_add_dir);
- $p_remove_dir = $this->_translateWinPath($p_remove_dir, false);
-
- if (!$this->_file) {
- $this->_error('Invalid file descriptor');
- return false;
- }
-
- if (sizeof($p_list) == 0)
- return true;
-
- foreach ($p_list as $v_filename) {
- if (!$v_result) {
- break;
- }
-
- // ----- Skip the current tar name
- if ($v_filename == $this->_tarname)
- continue;
-
- if ($v_filename == '')
- continue;
-
- // ----- ignore files and directories matching the ignore regular expression
- if ($this->_ignore_regexp && preg_match($this->_ignore_regexp, '/'.$v_filename)) {
- $this->_warning("File '$v_filename' ignored");
- continue;
- }
-
- if (!file_exists($v_filename) && !is_link($v_filename)) {
- $this->_warning("File '$v_filename' does not exist");
- continue;
- }
-
- // ----- Add the file or directory header
- if (!$this->_addFile($v_filename, $v_header, $p_add_dir, $p_remove_dir))
- return false;
-
- if (@is_dir($v_filename) && !@is_link($v_filename)) {
- if (!($p_hdir = opendir($v_filename))) {
- $this->_warning("Directory '$v_filename' can not be read");
- continue;
- }
- while (false !== ($p_hitem = readdir($p_hdir))) {
- if (($p_hitem != '.') && ($p_hitem != '..')) {
- if ($v_filename != ".")
- $p_temp_list[0] = $v_filename.'/'.$p_hitem;
- else
- $p_temp_list[0] = $p_hitem;
-
- $v_result = $this->_addList($p_temp_list,
- $p_add_dir,
- $p_remove_dir);
- }
- }
-
- unset($p_temp_list);
- unset($p_hdir);
- unset($p_hitem);
- }
- }
-
- return $v_result;
- }
- // }}}
-
- // {{{ _addFile()
- function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir, $v_stored_filename=null)
- {
- if (!$this->_file) {
- $this->_error('Invalid file descriptor');
- return false;
- }
-
- if ($p_filename == '') {
- $this->_error('Invalid file name');
- return false;
- }
-
- // ownCloud change to make it possible to specify the filename to use
- if(is_null($v_stored_filename)) {
- // ----- Calculate the stored filename
- $p_filename = $this->_translateWinPath($p_filename, false);
- $v_stored_filename = $p_filename;
- if (strcmp($p_filename, $p_remove_dir) == 0) {
- return true;
- }
- if ($p_remove_dir != '') {
- if (substr($p_remove_dir, -1) != '/')
- $p_remove_dir .= '/';
-
- if (substr($p_filename, 0, strlen($p_remove_dir)) == $p_remove_dir)
- $v_stored_filename = substr($p_filename, strlen($p_remove_dir));
- }
- $v_stored_filename = $this->_translateWinPath($v_stored_filename);
- if ($p_add_dir != '') {
- if (substr($p_add_dir, -1) == '/')
- $v_stored_filename = $p_add_dir.$v_stored_filename;
- else
- $v_stored_filename = $p_add_dir.'/'.$v_stored_filename;
- }
-
- $v_stored_filename = $this->_pathReduction($v_stored_filename);
- }
-
- if ($this->_isArchive($p_filename)) {
- if (($v_file = @fopen($p_filename, "rb")) == 0) {
- $this->_warning("Unable to open file '".$p_filename
- ."' in binary read mode");
- return true;
- }
-
- if (!$this->_writeHeader($p_filename, $v_stored_filename))
- return false;
-
- while (($v_buffer = fread($v_file, 512)) != '') {
- $v_binary_data = pack("a512", "$v_buffer");
- $this->_writeBlock($v_binary_data);
- }
-
- fclose($v_file);
-
- } else {
- // ----- Only header for dir
- if (!$this->_writeHeader($p_filename, $v_stored_filename))
- return false;
- }
-
- return true;
- }
- // }}}
-
- // {{{ _addString()
- function _addString($p_filename, $p_string)
- {
- if (!$this->_file) {
- $this->_error('Invalid file descriptor');
- return false;
- }
-
- if ($p_filename == '') {
- $this->_error('Invalid file name');
- return false;
- }
-
- // ----- Calculate the stored filename
- $p_filename = $this->_translateWinPath($p_filename, false);;
-
- if (!$this->_writeHeaderBlock($p_filename, strlen($p_string),
- time(), 384, "", 0, 0))
- return false;
-
- $i=0;
- while (($v_buffer = substr($p_string, (($i++)*512), 512)) != '') {
- $v_binary_data = pack("a512", $v_buffer);
- $this->_writeBlock($v_binary_data);
- }
-
- return true;
- }
- // }}}
-
- // {{{ _writeHeader()
- function _writeHeader($p_filename, $p_stored_filename)
- {
- if ($p_stored_filename == '')
- $p_stored_filename = $p_filename;
- $v_reduce_filename = $this->_pathReduction($p_stored_filename);
-
- if (strlen($v_reduce_filename) > 99) {
- if (!$this->_writeLongHeader($v_reduce_filename))
- return false;
- }
-
- $v_info = lstat($p_filename);
- $v_uid = sprintf("%07s", DecOct($v_info[4]));
- $v_gid = sprintf("%07s", DecOct($v_info[5]));
- $v_perms = sprintf("%07s", DecOct($v_info['mode'] & 000777));
-
- $v_mtime = sprintf("%011s", DecOct($v_info['mtime']));
-
- $v_linkname = '';
-
- if (@is_link($p_filename)) {
- $v_typeflag = '2';
- $v_linkname = readlink($p_filename);
- $v_size = sprintf("%011s", DecOct(0));
- } elseif (@is_dir($p_filename)) {
- $v_typeflag = "5";
- $v_size = sprintf("%011s", DecOct(0));
- } else {
- $v_typeflag = '0';
- clearstatcache();
- $v_size = sprintf("%011s", DecOct($v_info['size']));
- }
-
- $v_magic = 'ustar ';
-
- $v_version = ' ';
-
- if (function_exists('posix_getpwuid'))
- {
- $userinfo = posix_getpwuid($v_info[4]);
- $groupinfo = posix_getgrgid($v_info[5]);
-
- $v_uname = $userinfo['name'];
- $v_gname = $groupinfo['name'];
- }
- else
- {
- $v_uname = '';
- $v_gname = '';
- }
-
- $v_devmajor = '';
-
- $v_devminor = '';
-
- $v_prefix = '';
-
- $v_binary_data_first = pack("a100a8a8a8a12a12",
- $v_reduce_filename, $v_perms, $v_uid,
- $v_gid, $v_size, $v_mtime);
- $v_binary_data_last = pack("a1a100a6a2a32a32a8a8a155a12",
- $v_typeflag, $v_linkname, $v_magic,
- $v_version, $v_uname, $v_gname,
- $v_devmajor, $v_devminor, $v_prefix, '');
-
- // ----- Calculate the checksum
- $v_checksum = 0;
- // ..... First part of the header
- for ($i=0; $i<148; $i++)
- $v_checksum += ord(substr($v_binary_data_first,$i,1));
- // ..... Ignore the checksum value and replace it by ' ' (space)
- for ($i=148; $i<156; $i++)
- $v_checksum += ord(' ');
- // ..... Last part of the header
- for ($i=156, $j=0; $i<512; $i++, $j++)
- $v_checksum += ord(substr($v_binary_data_last,$j,1));
-
- // ----- Write the first 148 bytes of the header in the archive
- $this->_writeBlock($v_binary_data_first, 148);
-
- // ----- Write the calculated checksum
- $v_checksum = sprintf("%06s ", DecOct($v_checksum));
- $v_binary_data = pack("a8", $v_checksum);
- $this->_writeBlock($v_binary_data, 8);
-
- // ----- Write the last 356 bytes of the header in the archive
- $this->_writeBlock($v_binary_data_last, 356);
-
- return true;
- }
- // }}}
-
- // {{{ _writeHeaderBlock()
- function _writeHeaderBlock($p_filename, $p_size, $p_mtime=0, $p_perms=0,
- $p_type='', $p_uid=0, $p_gid=0)
- {
- $p_filename = $this->_pathReduction($p_filename);
-
- if (strlen($p_filename) > 99) {
- if (!$this->_writeLongHeader($p_filename))
- return false;
- }
-
- if ($p_type == "5") {
- $v_size = sprintf("%011s", DecOct(0));
- } else {
- $v_size = sprintf("%011s", DecOct($p_size));
- }
-
- $v_uid = sprintf("%07s", DecOct($p_uid));
- $v_gid = sprintf("%07s", DecOct($p_gid));
- $v_perms = sprintf("%07s", DecOct($p_perms & 000777));
-
- $v_mtime = sprintf("%11s", DecOct($p_mtime));
-
- $v_linkname = '';
-
- $v_magic = 'ustar ';
-
- $v_version = ' ';
-
- if (function_exists('posix_getpwuid'))
- {
- $userinfo = posix_getpwuid($p_uid);
- $groupinfo = posix_getgrgid($p_gid);
-
- $v_uname = $userinfo['name'];
- $v_gname = $groupinfo['name'];
- }
- else
- {
- $v_uname = '';
- $v_gname = '';
- }
-
- $v_devmajor = '';
-
- $v_devminor = '';
-
- $v_prefix = '';
-
- $v_binary_data_first = pack("a100a8a8a8a12A12",
- $p_filename, $v_perms, $v_uid, $v_gid,
- $v_size, $v_mtime);
- $v_binary_data_last = pack("a1a100a6a2a32a32a8a8a155a12",
- $p_type, $v_linkname, $v_magic,
- $v_version, $v_uname, $v_gname,
- $v_devmajor, $v_devminor, $v_prefix, '');
-
- // ----- Calculate the checksum
- $v_checksum = 0;
- // ..... First part of the header
- for ($i=0; $i<148; $i++)
- $v_checksum += ord(substr($v_binary_data_first,$i,1));
- // ..... Ignore the checksum value and replace it by ' ' (space)
- for ($i=148; $i<156; $i++)
- $v_checksum += ord(' ');
- // ..... Last part of the header
- for ($i=156, $j=0; $i<512; $i++, $j++)
- $v_checksum += ord(substr($v_binary_data_last,$j,1));
-
- // ----- Write the first 148 bytes of the header in the archive
- $this->_writeBlock($v_binary_data_first, 148);
-
- // ----- Write the calculated checksum
- $v_checksum = sprintf("%06s ", DecOct($v_checksum));
- $v_binary_data = pack("a8", $v_checksum);
- $this->_writeBlock($v_binary_data, 8);
-
- // ----- Write the last 356 bytes of the header in the archive
- $this->_writeBlock($v_binary_data_last, 356);
-
- return true;
- }
- // }}}
-
- // {{{ _writeLongHeader()
- function _writeLongHeader($p_filename)
- {
- $v_size = sprintf("%11s ", DecOct(strlen($p_filename)));
-
- $v_typeflag = 'L';
-
- $v_linkname = '';
-
- $v_magic = '';
-
- $v_version = '';
-
- $v_uname = '';
-
- $v_gname = '';
-
- $v_devmajor = '';
-
- $v_devminor = '';
-
- $v_prefix = '';
-
- $v_binary_data_first = pack("a100a8a8a8a12a12",
- '././@LongLink', 0, 0, 0, $v_size, 0);
- $v_binary_data_last = pack("a1a100a6a2a32a32a8a8a155a12",
- $v_typeflag, $v_linkname, $v_magic,
- $v_version, $v_uname, $v_gname,
- $v_devmajor, $v_devminor, $v_prefix, '');
-
- // ----- Calculate the checksum
- $v_checksum = 0;
- // ..... First part of the header
- for ($i=0; $i<148; $i++)
- $v_checksum += ord(substr($v_binary_data_first,$i,1));
- // ..... Ignore the checksum value and replace it by ' ' (space)
- for ($i=148; $i<156; $i++)
- $v_checksum += ord(' ');
- // ..... Last part of the header
- for ($i=156, $j=0; $i<512; $i++, $j++)
- $v_checksum += ord(substr($v_binary_data_last,$j,1));
-
- // ----- Write the first 148 bytes of the header in the archive
- $this->_writeBlock($v_binary_data_first, 148);
-
- // ----- Write the calculated checksum
- $v_checksum = sprintf("%06s ", DecOct($v_checksum));
- $v_binary_data = pack("a8", $v_checksum);
- $this->_writeBlock($v_binary_data, 8);
-
- // ----- Write the last 356 bytes of the header in the archive
- $this->_writeBlock($v_binary_data_last, 356);
-
- // ----- Write the filename as content of the block
- $i=0;
- while (($v_buffer = substr($p_filename, (($i++)*512), 512)) != '') {
- $v_binary_data = pack("a512", "$v_buffer");
- $this->_writeBlock($v_binary_data);
- }
-
- return true;
- }
- // }}}
-
- // {{{ _readHeader()
- function _readHeader($v_binary_data, &$v_header)
- {
- if (strlen($v_binary_data)==0) {
- $v_header['filename'] = '';
- return true;
- }
-
- if (strlen($v_binary_data) != 512) {
- $v_header['filename'] = '';
- $this->_error('Invalid block size : '.strlen($v_binary_data));
- return false;
- }
-
- if (!is_array($v_header)) {
- $v_header = array();
- }
- // ----- Calculate the checksum
- $v_checksum = 0;
- // ..... First part of the header
- for ($i=0; $i<148; $i++)
- $v_checksum+=ord(substr($v_binary_data,$i,1));
- // ..... Ignore the checksum value and replace it by ' ' (space)
- for ($i=148; $i<156; $i++)
- $v_checksum += ord(' ');
- // ..... Last part of the header
- for ($i=156; $i<512; $i++)
- $v_checksum+=ord(substr($v_binary_data,$i,1));
-
- $v_data = unpack("a100filename/a8mode/a8uid/a8gid/a12size/a12mtime/" .
- "a8checksum/a1typeflag/a100link/a6magic/a2version/" .
- "a32uname/a32gname/a8devmajor/a8devminor/a131prefix",
- $v_binary_data);
-
- if (strlen($v_data["prefix"]) > 0) {
- $v_data["filename"] = "$v_data[prefix]/$v_data[filename]";
- }
-
- // ----- Extract the checksum
- $v_header['checksum'] = OctDec(trim($v_data['checksum']));
- if ($v_header['checksum'] != $v_checksum) {
- $v_header['filename'] = '';
-
- // ----- Look for last block (empty block)
- if (($v_checksum == 256) && ($v_header['checksum'] == 0))
- return true;
-
- $this->_error('Invalid checksum for file "'.$v_data['filename']
- .'" : '.$v_checksum.' calculated, '
- .$v_header['checksum'].' expected');
- return false;
- }
-
- // ----- Extract the properties
- $v_header['filename'] = $v_data['filename'];
- if ($this->_maliciousFilename($v_header['filename'])) {
- $this->_error('Malicious .tar detected, file "' . $v_header['filename'] .
- '" will not install in desired directory tree');
- return false;
- }
- $v_header['mode'] = OctDec(trim($v_data['mode']));
- $v_header['uid'] = OctDec(trim($v_data['uid']));
- $v_header['gid'] = OctDec(trim($v_data['gid']));
- $v_header['size'] = OctDec(trim($v_data['size']));
- $v_header['mtime'] = OctDec(trim($v_data['mtime']));
- if (($v_header['typeflag'] = $v_data['typeflag']) == "5") {
- $v_header['size'] = 0;
- }
- $v_header['link'] = trim($v_data['link']);
- /* ----- All these fields are removed form the header because
- they do not carry interesting info
- $v_header[magic] = trim($v_data[magic]);
- $v_header[version] = trim($v_data[version]);
- $v_header[uname] = trim($v_data[uname]);
- $v_header[gname] = trim($v_data[gname]);
- $v_header[devmajor] = trim($v_data[devmajor]);
- $v_header[devminor] = trim($v_data[devminor]);
- */
-
- return true;
- }
- // }}}
-
- // {{{ _maliciousFilename()
- /**
- * Detect and report a malicious file name
- *
- * @param string $file
- *
- * @return bool
- * @access private
- */
- function _maliciousFilename($file)
- {
- if (strpos($file, '/../') !== false) {
- return true;
- }
- if (strpos($file, '../') === 0) {
- return true;
- }
- return false;
- }
- // }}}
-
- // {{{ _readLongHeader()
- function _readLongHeader(&$v_header)
- {
- $v_filename = '';
- $n = floor($v_header['size']/512);
- for ($i=0; $i<$n; $i++) {
- $v_content = $this->_readBlock();
- $v_filename .= $v_content;
- }
- if (($v_header['size'] % 512) != 0) {
- $v_content = $this->_readBlock();
- $v_filename .= trim($v_content);
- }
-
- // ----- Read the next header
- $v_binary_data = $this->_readBlock();
-
- if (!$this->_readHeader($v_binary_data, $v_header))
- return false;
-
- $v_filename = trim($v_filename);
- $v_header['filename'] = $v_filename;
- if ($this->_maliciousFilename($v_filename)) {
- $this->_error('Malicious .tar detected, file "' . $v_filename .
- '" will not install in desired directory tree');
- return false;
- }
-
- return true;
- }
- // }}}
-
- // {{{ _extractInString()
- /**
- * This method extract from the archive one file identified by $p_filename.
- * The return value is a string with the file content, or null on error.
- *
- * @param string $p_filename The path of the file to extract in a string.
- *
- * @return a string with the file content or null.
- * @access private
- */
- function _extractInString($p_filename)
- {
- $v_result_str = "";
-
- While (strlen($v_binary_data = $this->_readBlock()) != 0)
- {
- if (!$this->_readHeader($v_binary_data, $v_header))
- return null;
-
- if ($v_header['filename'] == '')
- continue;
-
- // ----- Look for long filename
- if ($v_header['typeflag'] == 'L') {
- if (!$this->_readLongHeader($v_header))
- return null;
- }
-
- if ($v_header['filename'] == $p_filename) {
- if ($v_header['typeflag'] == "5") {
- $this->_error('Unable to extract in string a directory '
- .'entry {'.$v_header['filename'].'}');
- return null;
- } else {
- $n = floor($v_header['size']/512);
- for ($i=0; $i<$n; $i++) {
- $v_result_str .= $this->_readBlock();
- }
- if (($v_header['size'] % 512) != 0) {
- $v_content = $this->_readBlock();
- $v_result_str .= substr($v_content, 0,
- ($v_header['size'] % 512));
- }
- return $v_result_str;
- }
- } else {
- $this->_jumpBlock(ceil(($v_header['size']/512)));
- }
- }
-
- return null;
- }
- // }}}
-
- // {{{ _extractList()
- function _extractList($p_path, &$p_list_detail, $p_mode,
- $p_file_list, $p_remove_path, $p_preserve=false)
- {
- $v_result=true;
- $v_nb = 0;
- $v_extract_all = true;
- $v_listing = false;
-
- $p_path = $this->_translateWinPath($p_path, false);
- if ($p_path == '' || (substr($p_path, 0, 1) != '/'
- && substr($p_path, 0, 3) != "../" && !strpos($p_path, ':'))) {
- $p_path = "./".$p_path;
- }
- $p_remove_path = $this->_translateWinPath($p_remove_path);
-
- // ----- Look for path to remove format (should end by /)
- if (($p_remove_path != '') && (substr($p_remove_path, -1) != '/'))
- $p_remove_path .= '/';
- $p_remove_path_size = strlen($p_remove_path);
-
- switch ($p_mode) {
- case "complete" :
- $v_extract_all = true;
- $v_listing = false;
- break;
- case "partial" :
- $v_extract_all = false;
- $v_listing = false;
- break;
- case "list" :
- $v_extract_all = false;
- $v_listing = true;
- break;
- default :
- $this->_error('Invalid extract mode ('.$p_mode.')');
- return false;
- }
-
- clearstatcache();
-
- while (strlen($v_binary_data = $this->_readBlock()) != 0)
- {
- $v_extract_file = FALSE;
- $v_extraction_stopped = 0;
-
- if (!$this->_readHeader($v_binary_data, $v_header))
- return false;
-
- if ($v_header['filename'] == '') {
- continue;
- }
-
- // ----- Look for long filename
- if ($v_header['typeflag'] == 'L') {
- if (!$this->_readLongHeader($v_header))
- return false;
- }
-
- if ((!$v_extract_all) && (is_array($p_file_list))) {
- // ----- By default no unzip if the file is not found
- $v_extract_file = false;
-
- for ($i=0; $i<sizeof($p_file_list); $i++) {
- // ----- Look if it is a directory
- if (substr($p_file_list[$i], -1) == '/') {
- // ----- Look if the directory is in the filename path
- if ((strlen($v_header['filename']) > strlen($p_file_list[$i]))
- && (substr($v_header['filename'], 0, strlen($p_file_list[$i]))
- == $p_file_list[$i])) {
- $v_extract_file = true;
- break;
- }
- }
-
- // ----- It is a file, so compare the file names
- elseif ($p_file_list[$i] == $v_header['filename']) {
- $v_extract_file = true;
- break;
- }
- }
- } else {
- $v_extract_file = true;
- }
-
- // ----- Look if this file need to be extracted
- if (($v_extract_file) && (!$v_listing))
- {
- if (($p_remove_path != '')
- && (substr($v_header['filename'], 0, $p_remove_path_size)
- == $p_remove_path))
- $v_header['filename'] = substr($v_header['filename'],
- $p_remove_path_size);
- if (($p_path != './') && ($p_path != '/')) {
- while (substr($p_path, -1) == '/')
- $p_path = substr($p_path, 0, strlen($p_path)-1);
-
- if (substr($v_header['filename'], 0, 1) == '/')
- $v_header['filename'] = $p_path.$v_header['filename'];
- else
- $v_header['filename'] = $p_path.'/'.$v_header['filename'];
- }
- if (file_exists($v_header['filename'])) {
- if ( (@is_dir($v_header['filename']))
- && ($v_header['typeflag'] == '')) {
- $this->_error('File '.$v_header['filename']
- .' already exists as a directory');
- return false;
- }
- if ( ($this->_isArchive($v_header['filename']))
- && ($v_header['typeflag'] == "5")) {
- $this->_error('Directory '.$v_header['filename']
- .' already exists as a file');
- return false;
- }
- if (!is_writeable($v_header['filename'])) {
- $this->_error('File '.$v_header['filename']
- .' already exists and is write protected');
- return false;
- }
- if (filemtime($v_header['filename']) > $v_header['mtime']) {
- // To be completed : An error or silent no replace ?
- }
- }
-
- // ----- Check the directory availability and create it if necessary
- elseif (($v_result
- = $this->_dirCheck(($v_header['typeflag'] == "5"
- ?$v_header['filename']
- :dirname($v_header['filename'])))) != 1) {
- $this->_error('Unable to create path for '.$v_header['filename']);
- return false;
- }
-
- if ($v_extract_file) {
- if ($v_header['typeflag'] == "5") {
- if (!@file_exists($v_header['filename'])) {
- if (!@mkdir($v_header['filename'], 0777)) {
- $this->_error('Unable to create directory {'
- .$v_header['filename'].'}');
- return false;
- }
- }
- } elseif ($v_header['typeflag'] == "2") {
- if (@file_exists($v_header['filename'])) {
- @unlink($v_header['filename']);
- }
- if (!@symlink($v_header['link'], $v_header['filename'])) {
- $this->_error('Unable to extract symbolic link {'
- .$v_header['filename'].'}');
- return false;
- }
- } else {
- if (($v_dest_file = @fopen($v_header['filename'], "wb")) == 0) {
- $this->_error('Error while opening {'.$v_header['filename']
- .'} in write binary mode');
- return false;
- } else {
- $n = floor($v_header['size']/512);
- for ($i=0; $i<$n; $i++) {
- $v_content = $this->_readBlock();
- fwrite($v_dest_file, $v_content, 512);
- }
- if (($v_header['size'] % 512) != 0) {
- $v_content = $this->_readBlock();
- fwrite($v_dest_file, $v_content, ($v_header['size'] % 512));
- }
-
- @fclose($v_dest_file);
-
- if ($p_preserve) {
- @chown($v_header['filename'], $v_header['uid']);
- @chgrp($v_header['filename'], $v_header['gid']);
- }
-
- // ----- Change the file mode, mtime
- @touch($v_header['filename'], $v_header['mtime']);
- if ($v_header['mode'] & 0111) {
- // make file executable, obey umask
- $mode = fileperms($v_header['filename']) | (~umask() & 0111);
- @chmod($v_header['filename'], $mode);
- }
- }
-
- // ----- Check the file size
- clearstatcache();
- if (!is_file($v_header['filename'])) {
- $this->_error('Extracted file '.$v_header['filename']
- .'does not exist. Archive may be corrupted.');
- return false;
- }
-
- $filesize = filesize($v_header['filename']);
- if ($filesize != $v_header['size']) {
- $this->_error('Extracted file '.$v_header['filename']
- .' does not have the correct file size \''
- .$filesize
- .'\' ('.$v_header['size']
- .' expected). Archive may be corrupted.');
- return false;
- }
- }
- } else {
- $this->_jumpBlock(ceil(($v_header['size']/512)));
- }
- } else {
- $this->_jumpBlock(ceil(($v_header['size']/512)));
- }
-
- /* TBC : Seems to be unused ...
- if ($this->_compress)
- $v_end_of_file = @gzeof($this->_file);
- else
- $v_end_of_file = @feof($this->_file);
- */
-
- if ($v_listing || $v_extract_file || $v_extraction_stopped) {
- // ----- Log extracted files
- if (($v_file_dir = dirname($v_header['filename']))
- == $v_header['filename'])
- $v_file_dir = '';
- if ((substr($v_header['filename'], 0, 1) == '/') && ($v_file_dir == ''))
- $v_file_dir = '/';
-
- $p_list_detail[$v_nb++] = $v_header;
- if (is_array($p_file_list) && (count($p_list_detail) == count($p_file_list))) {
- return true;
- }
- }
- }
-
- return true;
- }
- // }}}
-
- // {{{ _openAppend()
- function _openAppend()
- {
- if (filesize($this->_tarname) == 0)
- return $this->_openWrite();
-
- if ($this->_compress) {
- $this->_close();
-
- if (!@rename($this->_tarname, $this->_tarname.".tmp")) {
- $this->_error('Error while renaming \''.$this->_tarname
- .'\' to temporary file \''.$this->_tarname
- .'.tmp\'');
- return false;
- }
-
- if ($this->_compress_type == 'gz')
- $v_temp_tar = @gzopen($this->_tarname.".tmp", "rb");
- elseif ($this->_compress_type == 'bz2')
- $v_temp_tar = @bzopen($this->_tarname.".tmp", "r");
-
- if ($v_temp_tar == 0) {
- $this->_error('Unable to open file \''.$this->_tarname
- .'.tmp\' in binary read mode');
- @rename($this->_tarname.".tmp", $this->_tarname);
- return false;
- }
-
- if (!$this->_openWrite()) {
- @rename($this->_tarname.".tmp", $this->_tarname);
- return false;
- }
-
- if ($this->_compress_type == 'gz') {
- $end_blocks = 0;
-
- while (!@gzeof($v_temp_tar)) {
- $v_buffer = @gzread($v_temp_tar, 512);
- if ($v_buffer == ARCHIVE_TAR_END_BLOCK || strlen($v_buffer) == 0) {
- $end_blocks++;
- // do not copy end blocks, we will re-make them
- // after appending
- continue;
- } elseif ($end_blocks > 0) {
- for ($i = 0; $i < $end_blocks; $i++) {
- $this->_writeBlock(ARCHIVE_TAR_END_BLOCK);
- }
- $end_blocks = 0;
- }
- $v_binary_data = pack("a512", $v_buffer);
- $this->_writeBlock($v_binary_data);
- }
-
- @gzclose($v_temp_tar);
- }
- elseif ($this->_compress_type == 'bz2') {
- $end_blocks = 0;
-
- while (strlen($v_buffer = @bzread($v_temp_tar, 512)) > 0) {
- if ($v_buffer == ARCHIVE_TAR_END_BLOCK || strlen($v_buffer) == 0) {
- $end_blocks++;
- // do not copy end blocks, we will re-make them
- // after appending
- continue;
- } elseif ($end_blocks > 0) {
- for ($i = 0; $i < $end_blocks; $i++) {
- $this->_writeBlock(ARCHIVE_TAR_END_BLOCK);
- }
- $end_blocks = 0;
- }
- $v_binary_data = pack("a512", $v_buffer);
- $this->_writeBlock($v_binary_data);
- }
-
- @bzclose($v_temp_tar);
- }
-
- if (!@unlink($this->_tarname.".tmp")) {
- $this->_error('Error while deleting temporary file \''
- .$this->_tarname.'.tmp\'');
- }
-
- } else {
- // ----- For not compressed tar, just add files before the last
- // one or two 512 bytes block
- if (!$this->_openReadWrite())
- return false;
-
- clearstatcache();
- $v_size = filesize($this->_tarname);
-
- // We might have zero, one or two end blocks.
- // The standard is two, but we should try to handle
- // other cases.
- fseek($this->_file, $v_size - 1024);
- if (fread($this->_file, 512) == ARCHIVE_TAR_END_BLOCK) {
- fseek($this->_file, $v_size - 1024);
- }
- elseif (fread($this->_file, 512) == ARCHIVE_TAR_END_BLOCK) {
- fseek($this->_file, $v_size - 512);
- }
- }
-
- return true;
- }
- // }}}
-
- // {{{ _append()
- function _append($p_filelist, $p_add_dir='', $p_remove_dir='')
- {
- if (!$this->_openAppend())
- return false;
-
- if ($this->_addList($p_filelist, $p_add_dir, $p_remove_dir))
- $this->_writeFooter();
-
- $this->_close();
-
- return true;
- }
- // }}}
-
- // {{{ _dirCheck()
-
- /**
- * Check if a directory exists and create it (including parent
- * dirs) if not.
- *
- * @param string $p_dir directory to check
- *
- * @return bool true if the directory exists or was created
- */
- function _dirCheck($p_dir)
- {
- clearstatcache();
- if ((@is_dir($p_dir)) || ($p_dir == ''))
- return true;
-
- $p_parent_dir = dirname($p_dir);
-
- if (($p_parent_dir != $p_dir) &&
- ($p_parent_dir != '') &&
- (!$this->_dirCheck($p_parent_dir)))
- return false;
-
- if (!@mkdir($p_dir, 0777)) {
- $this->_error("Unable to create directory '$p_dir'");
- return false;
- }
-
- return true;
- }
-
- // }}}
-
- // {{{ _pathReduction()
-
- /**
- * Compress path by changing for example "/dir/foo/../bar" to "/dir/bar",
- * rand emove double slashes.
- *
- * @param string $p_dir path to reduce
- *
- * @return string reduced path
- *
- * @access private
- *
- */
- function _pathReduction($p_dir)
- {
- $v_result = '';
-
- // ----- Look for not empty path
- if ($p_dir != '') {
- // ----- Explode path by directory names
- $v_list = explode('/', $p_dir);
-
- // ----- Study directories from last to first
- for ($i=sizeof($v_list)-1; $i>=0; $i--) {
- // ----- Look for current path
- if ($v_list[$i] == ".") {
- // ----- Ignore this directory
- // Should be the first $i=0, but no check is done
- }
- else if ($v_list[$i] == "..") {
- // ----- Ignore it and ignore the $i-1
- $i--;
- }
- else if ( ($v_list[$i] == '')
- && ($i!=(sizeof($v_list)-1))
- && ($i!=0)) {
- // ----- Ignore only the double '//' in path,
- // but not the first and last /
- } else {
- $v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?'/'
- .$v_result:'');
- }
- }
- }
-
- if (defined('OS_WINDOWS') && OS_WINDOWS) {
- $v_result = strtr($v_result, '\\', '/');
- }
-
- return $v_result;
- }
-
- // }}}
-
- // {{{ _translateWinPath()
- function _translateWinPath($p_path, $p_remove_disk_letter=true)
- {
- if (defined('OS_WINDOWS') && OS_WINDOWS) {
- // ----- Look for potential disk letter
- if ( ($p_remove_disk_letter)
- && (($v_position = strpos($p_path, ':')) != false)) {
- $p_path = substr($p_path, $v_position+1);
- }
- // ----- Change potential windows directory separator
- if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0,1) == '\\')) {
- $p_path = strtr($p_path, '\\', '/');
- }
- }
- return $p_path;
- }
- // }}}
-
-}
-?>
diff --git a/3rdparty/Console/Getopt.php b/3rdparty/Console/Getopt.php
deleted file mode 100644
index aec980b34d5..00000000000
--- a/3rdparty/Console/Getopt.php
+++ /dev/null
@@ -1,251 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4: */
-// +----------------------------------------------------------------------+
-// | PHP Version 4 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 3.0 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available through the world-wide-web at the following url: |
-// | http://www.php.net/license/3_0.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Author: Andrei Zmievski <andrei@php.net> |
-// +----------------------------------------------------------------------+
-//
-// $Id: Getopt.php,v 1.21.4.7 2003/12/05 21:57:01 andrei Exp $
-
-require_once( 'PEAR.php');
-
-/**
- * Command-line options parsing class.
- *
- * @author Andrei Zmievski <andrei@php.net>
- *
- */
-class Console_Getopt {
- /**
- * Parses the command-line options.
- *
- * The first parameter to this function should be the list of command-line
- * arguments without the leading reference to the running program.
- *
- * The second parameter is a string of allowed short options. Each of the
- * option letters can be followed by a colon ':' to specify that the option
- * requires an argument, or a double colon '::' to specify that the option
- * takes an optional argument.
- *
- * The third argument is an optional array of allowed long options. The
- * leading '--' should not be included in the option name. Options that
- * require an argument should be followed by '=', and options that take an
- * option argument should be followed by '=='.
- *
- * The return value is an array of two elements: the list of parsed
- * options and the list of non-option command-line arguments. Each entry in
- * the list of parsed options is a pair of elements - the first one
- * specifies the option, and the second one specifies the option argument,
- * if there was one.
- *
- * Long and short options can be mixed.
- *
- * Most of the semantics of this function are based on GNU getopt_long().
- *
- * @param array $args an array of command-line arguments
- * @param string $short_options specifies the list of allowed short options
- * @param array $long_options specifies the list of allowed long options
- *
- * @return array two-element array containing the list of parsed options and
- * the non-option arguments
- *
- * @access public
- *
- */
- function getopt2($args, $short_options, $long_options = null)
- {
- return Console_Getopt::doGetopt(2, $args, $short_options, $long_options);
- }
-
- /**
- * This function expects $args to start with the script name (POSIX-style).
- * Preserved for backwards compatibility.
- * @see getopt2()
- */
- function getopt($args, $short_options, $long_options = null)
- {
- return Console_Getopt::doGetopt(1, $args, $short_options, $long_options);
- }
-
- /**
- * The actual implementation of the argument parsing code.
- */
- function doGetopt($version, $args, $short_options, $long_options = null)
- {
- // in case you pass directly readPHPArgv() as the first arg
- if (PEAR::isError($args)) {
- return $args;
- }
- if (empty($args)) {
- return array(array(), array());
- }
- $opts = array();
- $non_opts = array();
-
- settype($args, 'array');
-
- if ($long_options) {
- sort($long_options);
- }
-
- /*
- * Preserve backwards compatibility with callers that relied on
- * erroneous POSIX fix.
- */
- if ($version < 2) {
- if (isset($args[0]{0}) && $args[0]{0} != '-') {
- array_shift($args);
- }
- }
-
- reset($args);
- while (list($i, $arg) = each($args)) {
-
- /* The special element '--' means explicit end of
- options. Treat the rest of the arguments as non-options
- and end the loop. */
- if ($arg == '--') {
- $non_opts = array_merge($non_opts, array_slice($args, $i + 1));
- break;
- }
-
- if ($arg{0} != '-' || (strlen($arg) > 1 && $arg{1} == '-' && !$long_options)) {
- $non_opts = array_merge($non_opts, array_slice($args, $i));
- break;
- } elseif (strlen($arg) > 1 && $arg{1} == '-') {
- $error = Console_Getopt::_parseLongOption(substr($arg, 2), $long_options, $opts, $args);
- if (PEAR::isError($error))
- return $error;
- } else {
- $error = Console_Getopt::_parseShortOption(substr($arg, 1), $short_options, $opts, $args);
- if (PEAR::isError($error))
- return $error;
- }
- }
-
- return array($opts, $non_opts);
- }
-
- /**
- * @access private
- *
- */
- function _parseShortOption($arg, $short_options, &$opts, &$args)
- {
- for ($i = 0; $i < strlen($arg); $i++) {
- $opt = $arg{$i};
- $opt_arg = null;
-
- /* Try to find the short option in the specifier string. */
- if (($spec = strstr($short_options, $opt)) === false || $arg{$i} == ':')
- {
- return PEAR::raiseError("Console_Getopt: unrecognized option -- $opt");
- }
-
- if (strlen($spec) > 1 && $spec{1} == ':') {
- if (strlen($spec) > 2 && $spec{2} == ':') {
- if ($i + 1 < strlen($arg)) {
- /* Option takes an optional argument. Use the remainder of
- the arg string if there is anything left. */
- $opts[] = array($opt, substr($arg, $i + 1));
- break;
- }
- } else {
- /* Option requires an argument. Use the remainder of the arg
- string if there is anything left. */
- if ($i + 1 < strlen($arg)) {
- $opts[] = array($opt, substr($arg, $i + 1));
- break;
- } else if (list(, $opt_arg) = each($args))
- /* Else use the next argument. */;
- else
- return PEAR::raiseError("Console_Getopt: option requires an argument -- $opt");
- }
- }
-
- $opts[] = array($opt, $opt_arg);
- }
- }
-
- /**
- * @access private
- *
- */
- function _parseLongOption($arg, $long_options, &$opts, &$args)
- {
- @list($opt, $opt_arg) = explode('=', $arg);
- $opt_len = strlen($opt);
-
- for ($i = 0; $i < count($long_options); $i++) {
- $long_opt = $long_options[$i];
- $opt_start = substr($long_opt, 0, $opt_len);
-
- /* Option doesn't match. Go on to the next one. */
- if ($opt_start != $opt)
- continue;
-
- $opt_rest = substr($long_opt, $opt_len);
-
- /* Check that the options uniquely matches one of the allowed
- options. */
- if ($opt_rest != '' && $opt{0} != '=' &&
- $i + 1 < count($long_options) &&
- $opt == substr($long_options[$i+1], 0, $opt_len)) {
- return PEAR::raiseError("Console_Getopt: option --$opt is ambiguous");
- }
-
- if (substr($long_opt, -1) == '=') {
- if (substr($long_opt, -2) != '==') {
- /* Long option requires an argument.
- Take the next argument if one wasn't specified. */;
- if (!strlen($opt_arg) && !(list(, $opt_arg) = each($args))) {
- return PEAR::raiseError("Console_Getopt: option --$opt requires an argument");
- }
- }
- } else if ($opt_arg) {
- return PEAR::raiseError("Console_Getopt: option --$opt doesn't allow an argument");
- }
-
- $opts[] = array('--' . $opt, $opt_arg);
- return;
- }
-
- return PEAR::raiseError("Console_Getopt: unrecognized option --$opt");
- }
-
- /**
- * Safely read the $argv PHP array across different PHP configurations.
- * Will take care on register_globals and register_argc_argv ini directives
- *
- * @access public
- * @return mixed the $argv PHP array or PEAR error if not registered
- */
- function readPHPArgv()
- {
- global $argv;
- if (!is_array($argv)) {
- if (!@is_array($_SERVER['argv'])) {
- if (!@is_array($GLOBALS['HTTP_SERVER_VARS']['argv'])) {
- return PEAR::raiseError("Console_Getopt: Could not read cmd args (register_argc_argv=Off?)");
- }
- return $GLOBALS['HTTP_SERVER_VARS']['argv'];
- }
- return $_SERVER['argv'];
- }
- return $argv;
- }
-
-}
-
-?>
diff --git a/3rdparty/Crypt_Blowfish/Blowfish.php b/3rdparty/Crypt_Blowfish/Blowfish.php
deleted file mode 100644
index 4ccacb963e3..00000000000
--- a/3rdparty/Crypt_Blowfish/Blowfish.php
+++ /dev/null
@@ -1,317 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Crypt_Blowfish allows for encryption and decryption on the fly using
- * the Blowfish algorithm. Crypt_Blowfish does not require the mcrypt
- * PHP extension, it uses only PHP.
- * Crypt_Blowfish support encryption/decryption with or without a secret key.
- *
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category Encryption
- * @package Crypt_Blowfish
- * @author Matthew Fonda <mfonda@php.net>
- * @copyright 2005 Matthew Fonda
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version CVS: $Id: Blowfish.php,v 1.81 2005/05/30 18:40:36 mfonda Exp $
- * @link http://pear.php.net/package/Crypt_Blowfish
- */
-
-
-require_once 'PEAR.php';
-
-
-/**
- *
- * Example usage:
- * $bf = new Crypt_Blowfish('some secret key!');
- * $encrypted = $bf->encrypt('this is some example plain text');
- * $plaintext = $bf->decrypt($encrypted);
- * echo "plain text: $plaintext";
- *
- *
- * @category Encryption
- * @package Crypt_Blowfish
- * @author Matthew Fonda <mfonda@php.net>
- * @copyright 2005 Matthew Fonda
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @link http://pear.php.net/package/Crypt_Blowfish
- * @version @package_version@
- * @access public
- */
-class Crypt_Blowfish
-{
- /**
- * P-Array contains 18 32-bit subkeys
- *
- * @var array
- * @access private
- */
- var $_P = array();
-
-
- /**
- * Array of four S-Blocks each containing 256 32-bit entries
- *
- * @var array
- * @access private
- */
- var $_S = array();
-
- /**
- * Mcrypt td resource
- *
- * @var resource
- * @access private
- */
- var $_td = null;
-
- /**
- * Initialization vector
- *
- * @var string
- * @access private
- */
- var $_iv = null;
-
-
- /**
- * Crypt_Blowfish Constructor
- * Initializes the Crypt_Blowfish object, and gives a sets
- * the secret key
- *
- * @param string $key
- * @access public
- */
- function Crypt_Blowfish($key)
- {
- if (extension_loaded('mcrypt')) {
- $this->_td = mcrypt_module_open(MCRYPT_BLOWFISH, '', 'ecb', '');
- $this->_iv = mcrypt_create_iv(8, MCRYPT_RAND);
- }
- $this->setKey($key);
- }
-
- /**
- * Deprecated isReady method
- *
- * @return bool
- * @access public
- * @deprecated
- */
- function isReady()
- {
- return true;
- }
-
- /**
- * Deprecated init method - init is now a private
- * method and has been replaced with _init
- *
- * @return bool
- * @access public
- * @deprecated
- * @see Crypt_Blowfish::_init()
- */
- function init()
- {
- $this->_init();
- }
-
- /**
- * Initializes the Crypt_Blowfish object
- *
- * @access private
- */
- function _init()
- {
- $defaults = new Crypt_Blowfish_DefaultKey();
- $this->_P = $defaults->P;
- $this->_S = $defaults->S;
- }
-
- /**
- * Enciphers a single 64 bit block
- *
- * @param int &$Xl
- * @param int &$Xr
- * @access private
- */
- function _encipher(&$Xl, &$Xr)
- {
- for ($i = 0; $i < 16; $i++) {
- $temp = $Xl ^ $this->_P[$i];
- $Xl = ((($this->_S[0][($temp>>24) & 255] +
- $this->_S[1][($temp>>16) & 255]) ^
- $this->_S[2][($temp>>8) & 255]) +
- $this->_S[3][$temp & 255]) ^ $Xr;
- $Xr = $temp;
- }
- $Xr = $Xl ^ $this->_P[16];
- $Xl = $temp ^ $this->_P[17];
- }
-
-
- /**
- * Deciphers a single 64 bit block
- *
- * @param int &$Xl
- * @param int &$Xr
- * @access private
- */
- function _decipher(&$Xl, &$Xr)
- {
- for ($i = 17; $i > 1; $i--) {
- $temp = $Xl ^ $this->_P[$i];
- $Xl = ((($this->_S[0][($temp>>24) & 255] +
- $this->_S[1][($temp>>16) & 255]) ^
- $this->_S[2][($temp>>8) & 255]) +
- $this->_S[3][$temp & 255]) ^ $Xr;
- $Xr = $temp;
- }
- $Xr = $Xl ^ $this->_P[1];
- $Xl = $temp ^ $this->_P[0];
- }
-
-
- /**
- * Encrypts a string
- *
- * @param string $plainText
- * @return string Returns cipher text on success, PEAR_Error on failure
- * @access public
- */
- function encrypt($plainText)
- {
- if (!is_string($plainText)) {
- PEAR::raiseError('Plain text must be a string', 0, PEAR_ERROR_DIE);
- }
-
- if (extension_loaded('mcrypt')) {
- return mcrypt_generic($this->_td, $plainText);
- }
-
- $cipherText = '';
- $len = strlen($plainText);
- $plainText .= str_repeat(chr(0),(8 - ($len%8))%8);
- for ($i = 0; $i < $len; $i += 8) {
- list(,$Xl,$Xr) = unpack("N2",substr($plainText,$i,8));
- $this->_encipher($Xl, $Xr);
- $cipherText .= pack("N2", $Xl, $Xr);
- }
- return $cipherText;
- }
-
-
- /**
- * Decrypts an encrypted string
- *
- * @param string $cipherText
- * @return string Returns plain text on success, PEAR_Error on failure
- * @access public
- */
- function decrypt($cipherText)
- {
- if (!is_string($cipherText)) {
- PEAR::raiseError('Cipher text must be a string', 1, PEAR_ERROR_DIE);
- }
-
- if (extension_loaded('mcrypt')) {
- return mdecrypt_generic($this->_td, $cipherText);
- }
-
- $plainText = '';
- $len = strlen($cipherText);
- $cipherText .= str_repeat(chr(0),(8 - ($len%8))%8);
- for ($i = 0; $i < $len; $i += 8) {
- list(,$Xl,$Xr) = unpack("N2",substr($cipherText,$i,8));
- $this->_decipher($Xl, $Xr);
- $plainText .= pack("N2", $Xl, $Xr);
- }
- return $plainText;
- }
-
-
- /**
- * Sets the secret key
- * The key must be non-zero, and less than or equal to
- * 56 characters in length.
- *
- * @param string $key
- * @return bool Returns true on success, PEAR_Error on failure
- * @access public
- */
- function setKey($key)
- {
- if (!is_string($key)) {
- PEAR::raiseError('Key must be a string', 2, PEAR_ERROR_DIE);
- }
-
- $len = strlen($key);
-
- if ($len > 56 || $len == 0) {
- PEAR::raiseError('Key must be less than 56 characters and non-zero. Supplied key length: ' . $len, 3, PEAR_ERROR_DIE);
- }
-
- if (extension_loaded('mcrypt')) {
- mcrypt_generic_init($this->_td, $key, $this->_iv);
- return true;
- }
-
- require_once 'Blowfish/DefaultKey.php';
- $this->_init();
-
- $k = 0;
- $data = 0;
- $datal = 0;
- $datar = 0;
-
- for ($i = 0; $i < 18; $i++) {
- $data = 0;
- for ($j = 4; $j > 0; $j--) {
- $data = $data << 8 | ord($key{$k});
- $k = ($k+1) % $len;
- }
- $this->_P[$i] ^= $data;
- }
-
- for ($i = 0; $i <= 16; $i += 2) {
- $this->_encipher($datal, $datar);
- $this->_P[$i] = $datal;
- $this->_P[$i+1] = $datar;
- }
- for ($i = 0; $i < 256; $i += 2) {
- $this->_encipher($datal, $datar);
- $this->_S[0][$i] = $datal;
- $this->_S[0][$i+1] = $datar;
- }
- for ($i = 0; $i < 256; $i += 2) {
- $this->_encipher($datal, $datar);
- $this->_S[1][$i] = $datal;
- $this->_S[1][$i+1] = $datar;
- }
- for ($i = 0; $i < 256; $i += 2) {
- $this->_encipher($datal, $datar);
- $this->_S[2][$i] = $datal;
- $this->_S[2][$i+1] = $datar;
- }
- for ($i = 0; $i < 256; $i += 2) {
- $this->_encipher($datal, $datar);
- $this->_S[3][$i] = $datal;
- $this->_S[3][$i+1] = $datar;
- }
-
- return true;
- }
-
-}
-
-?>
diff --git a/3rdparty/Crypt_Blowfish/Blowfish/DefaultKey.php b/3rdparty/Crypt_Blowfish/Blowfish/DefaultKey.php
deleted file mode 100644
index 2ff8ac788a6..00000000000
--- a/3rdparty/Crypt_Blowfish/Blowfish/DefaultKey.php
+++ /dev/null
@@ -1,327 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Crypt_Blowfish allows for encryption and decryption on the fly using
- * the Blowfish algorithm. Crypt_Blowfish does not require the mcrypt
- * PHP extension, it uses only PHP.
- * Crypt_Blowfish support encryption/decryption with or without a secret key.
- *
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt. If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category Encryption
- * @package Crypt_Blowfish
- * @author Matthew Fonda <mfonda@php.net>
- * @copyright 2005 Matthew Fonda
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version CVS: $Id: DefaultKey.php,v 1.81 2005/05/30 18:40:37 mfonda Exp $
- * @link http://pear.php.net/package/Crypt_Blowfish
- */
-
-
-/**
- * Class containing default key
- *
- * @category Encryption
- * @package Crypt_Blowfish
- * @author Matthew Fonda <mfonda@php.net>
- * @copyright 2005 Matthew Fonda
- * @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @link http://pear.php.net/package/Crypt_Blowfish
- * @version @package_version@
- * @access public
- */
-class Crypt_Blowfish_DefaultKey
-{
- var $P = array();
-
- var $S = array();
-
- function Crypt_Blowfish_DefaultKey()
- {
- $this->P = array(
- 0x243F6A88, 0x85A308D3, 0x13198A2E, 0x03707344,
- 0xA4093822, 0x299F31D0, 0x082EFA98, 0xEC4E6C89,
- 0x452821E6, 0x38D01377, 0xBE5466CF, 0x34E90C6C,
- 0xC0AC29B7, 0xC97C50DD, 0x3F84D5B5, 0xB5470917,
- 0x9216D5D9, 0x8979FB1B
- );
-
- $this->S = array(
- array(
- 0xD1310BA6, 0x98DFB5AC, 0x2FFD72DB, 0xD01ADFB7,
- 0xB8E1AFED, 0x6A267E96, 0xBA7C9045, 0xF12C7F99,
- 0x24A19947, 0xB3916CF7, 0x0801F2E2, 0x858EFC16,
- 0x636920D8, 0x71574E69, 0xA458FEA3, 0xF4933D7E,
- 0x0D95748F, 0x728EB658, 0x718BCD58, 0x82154AEE,
- 0x7B54A41D, 0xC25A59B5, 0x9C30D539, 0x2AF26013,
- 0xC5D1B023, 0x286085F0, 0xCA417918, 0xB8DB38EF,
- 0x8E79DCB0, 0x603A180E, 0x6C9E0E8B, 0xB01E8A3E,
- 0xD71577C1, 0xBD314B27, 0x78AF2FDA, 0x55605C60,
- 0xE65525F3, 0xAA55AB94, 0x57489862, 0x63E81440,
- 0x55CA396A, 0x2AAB10B6, 0xB4CC5C34, 0x1141E8CE,
- 0xA15486AF, 0x7C72E993, 0xB3EE1411, 0x636FBC2A,
- 0x2BA9C55D, 0x741831F6, 0xCE5C3E16, 0x9B87931E,
- 0xAFD6BA33, 0x6C24CF5C, 0x7A325381, 0x28958677,
- 0x3B8F4898, 0x6B4BB9AF, 0xC4BFE81B, 0x66282193,
- 0x61D809CC, 0xFB21A991, 0x487CAC60, 0x5DEC8032,
- 0xEF845D5D, 0xE98575B1, 0xDC262302, 0xEB651B88,
- 0x23893E81, 0xD396ACC5, 0x0F6D6FF3, 0x83F44239,
- 0x2E0B4482, 0xA4842004, 0x69C8F04A, 0x9E1F9B5E,
- 0x21C66842, 0xF6E96C9A, 0x670C9C61, 0xABD388F0,
- 0x6A51A0D2, 0xD8542F68, 0x960FA728, 0xAB5133A3,
- 0x6EEF0B6C, 0x137A3BE4, 0xBA3BF050, 0x7EFB2A98,
- 0xA1F1651D, 0x39AF0176, 0x66CA593E, 0x82430E88,
- 0x8CEE8619, 0x456F9FB4, 0x7D84A5C3, 0x3B8B5EBE,
- 0xE06F75D8, 0x85C12073, 0x401A449F, 0x56C16AA6,
- 0x4ED3AA62, 0x363F7706, 0x1BFEDF72, 0x429B023D,
- 0x37D0D724, 0xD00A1248, 0xDB0FEAD3, 0x49F1C09B,
- 0x075372C9, 0x80991B7B, 0x25D479D8, 0xF6E8DEF7,
- 0xE3FE501A, 0xB6794C3B, 0x976CE0BD, 0x04C006BA,
- 0xC1A94FB6, 0x409F60C4, 0x5E5C9EC2, 0x196A2463,
- 0x68FB6FAF, 0x3E6C53B5, 0x1339B2EB, 0x3B52EC6F,
- 0x6DFC511F, 0x9B30952C, 0xCC814544, 0xAF5EBD09,
- 0xBEE3D004, 0xDE334AFD, 0x660F2807, 0x192E4BB3,
- 0xC0CBA857, 0x45C8740F, 0xD20B5F39, 0xB9D3FBDB,
- 0x5579C0BD, 0x1A60320A, 0xD6A100C6, 0x402C7279,
- 0x679F25FE, 0xFB1FA3CC, 0x8EA5E9F8, 0xDB3222F8,
- 0x3C7516DF, 0xFD616B15, 0x2F501EC8, 0xAD0552AB,
- 0x323DB5FA, 0xFD238760, 0x53317B48, 0x3E00DF82,
- 0x9E5C57BB, 0xCA6F8CA0, 0x1A87562E, 0xDF1769DB,
- 0xD542A8F6, 0x287EFFC3, 0xAC6732C6, 0x8C4F5573,
- 0x695B27B0, 0xBBCA58C8, 0xE1FFA35D, 0xB8F011A0,
- 0x10FA3D98, 0xFD2183B8, 0x4AFCB56C, 0x2DD1D35B,
- 0x9A53E479, 0xB6F84565, 0xD28E49BC, 0x4BFB9790,
- 0xE1DDF2DA, 0xA4CB7E33, 0x62FB1341, 0xCEE4C6E8,
- 0xEF20CADA, 0x36774C01, 0xD07E9EFE, 0x2BF11FB4,
- 0x95DBDA4D, 0xAE909198, 0xEAAD8E71, 0x6B93D5A0,
- 0xD08ED1D0, 0xAFC725E0, 0x8E3C5B2F, 0x8E7594B7,
- 0x8FF6E2FB, 0xF2122B64, 0x8888B812, 0x900DF01C,
- 0x4FAD5EA0, 0x688FC31C, 0xD1CFF191, 0xB3A8C1AD,
- 0x2F2F2218, 0xBE0E1777, 0xEA752DFE, 0x8B021FA1,
- 0xE5A0CC0F, 0xB56F74E8, 0x18ACF3D6, 0xCE89E299,
- 0xB4A84FE0, 0xFD13E0B7, 0x7CC43B81, 0xD2ADA8D9,
- 0x165FA266, 0x80957705, 0x93CC7314, 0x211A1477,
- 0xE6AD2065, 0x77B5FA86, 0xC75442F5, 0xFB9D35CF,
- 0xEBCDAF0C, 0x7B3E89A0, 0xD6411BD3, 0xAE1E7E49,
- 0x00250E2D, 0x2071B35E, 0x226800BB, 0x57B8E0AF,
- 0x2464369B, 0xF009B91E, 0x5563911D, 0x59DFA6AA,
- 0x78C14389, 0xD95A537F, 0x207D5BA2, 0x02E5B9C5,
- 0x83260376, 0x6295CFA9, 0x11C81968, 0x4E734A41,
- 0xB3472DCA, 0x7B14A94A, 0x1B510052, 0x9A532915,
- 0xD60F573F, 0xBC9BC6E4, 0x2B60A476, 0x81E67400,
- 0x08BA6FB5, 0x571BE91F, 0xF296EC6B, 0x2A0DD915,
- 0xB6636521, 0xE7B9F9B6, 0xFF34052E, 0xC5855664,
- 0x53B02D5D, 0xA99F8FA1, 0x08BA4799, 0x6E85076A
- ),
- array(
- 0x4B7A70E9, 0xB5B32944, 0xDB75092E, 0xC4192623,
- 0xAD6EA6B0, 0x49A7DF7D, 0x9CEE60B8, 0x8FEDB266,
- 0xECAA8C71, 0x699A17FF, 0x5664526C, 0xC2B19EE1,
- 0x193602A5, 0x75094C29, 0xA0591340, 0xE4183A3E,
- 0x3F54989A, 0x5B429D65, 0x6B8FE4D6, 0x99F73FD6,
- 0xA1D29C07, 0xEFE830F5, 0x4D2D38E6, 0xF0255DC1,
- 0x4CDD2086, 0x8470EB26, 0x6382E9C6, 0x021ECC5E,
- 0x09686B3F, 0x3EBAEFC9, 0x3C971814, 0x6B6A70A1,
- 0x687F3584, 0x52A0E286, 0xB79C5305, 0xAA500737,
- 0x3E07841C, 0x7FDEAE5C, 0x8E7D44EC, 0x5716F2B8,
- 0xB03ADA37, 0xF0500C0D, 0xF01C1F04, 0x0200B3FF,
- 0xAE0CF51A, 0x3CB574B2, 0x25837A58, 0xDC0921BD,
- 0xD19113F9, 0x7CA92FF6, 0x94324773, 0x22F54701,
- 0x3AE5E581, 0x37C2DADC, 0xC8B57634, 0x9AF3DDA7,
- 0xA9446146, 0x0FD0030E, 0xECC8C73E, 0xA4751E41,
- 0xE238CD99, 0x3BEA0E2F, 0x3280BBA1, 0x183EB331,
- 0x4E548B38, 0x4F6DB908, 0x6F420D03, 0xF60A04BF,
- 0x2CB81290, 0x24977C79, 0x5679B072, 0xBCAF89AF,
- 0xDE9A771F, 0xD9930810, 0xB38BAE12, 0xDCCF3F2E,
- 0x5512721F, 0x2E6B7124, 0x501ADDE6, 0x9F84CD87,
- 0x7A584718, 0x7408DA17, 0xBC9F9ABC, 0xE94B7D8C,
- 0xEC7AEC3A, 0xDB851DFA, 0x63094366, 0xC464C3D2,
- 0xEF1C1847, 0x3215D908, 0xDD433B37, 0x24C2BA16,
- 0x12A14D43, 0x2A65C451, 0x50940002, 0x133AE4DD,
- 0x71DFF89E, 0x10314E55, 0x81AC77D6, 0x5F11199B,
- 0x043556F1, 0xD7A3C76B, 0x3C11183B, 0x5924A509,
- 0xF28FE6ED, 0x97F1FBFA, 0x9EBABF2C, 0x1E153C6E,
- 0x86E34570, 0xEAE96FB1, 0x860E5E0A, 0x5A3E2AB3,
- 0x771FE71C, 0x4E3D06FA, 0x2965DCB9, 0x99E71D0F,
- 0x803E89D6, 0x5266C825, 0x2E4CC978, 0x9C10B36A,
- 0xC6150EBA, 0x94E2EA78, 0xA5FC3C53, 0x1E0A2DF4,
- 0xF2F74EA7, 0x361D2B3D, 0x1939260F, 0x19C27960,
- 0x5223A708, 0xF71312B6, 0xEBADFE6E, 0xEAC31F66,
- 0xE3BC4595, 0xA67BC883, 0xB17F37D1, 0x018CFF28,
- 0xC332DDEF, 0xBE6C5AA5, 0x65582185, 0x68AB9802,
- 0xEECEA50F, 0xDB2F953B, 0x2AEF7DAD, 0x5B6E2F84,
- 0x1521B628, 0x29076170, 0xECDD4775, 0x619F1510,
- 0x13CCA830, 0xEB61BD96, 0x0334FE1E, 0xAA0363CF,
- 0xB5735C90, 0x4C70A239, 0xD59E9E0B, 0xCBAADE14,
- 0xEECC86BC, 0x60622CA7, 0x9CAB5CAB, 0xB2F3846E,
- 0x648B1EAF, 0x19BDF0CA, 0xA02369B9, 0x655ABB50,
- 0x40685A32, 0x3C2AB4B3, 0x319EE9D5, 0xC021B8F7,
- 0x9B540B19, 0x875FA099, 0x95F7997E, 0x623D7DA8,
- 0xF837889A, 0x97E32D77, 0x11ED935F, 0x16681281,
- 0x0E358829, 0xC7E61FD6, 0x96DEDFA1, 0x7858BA99,
- 0x57F584A5, 0x1B227263, 0x9B83C3FF, 0x1AC24696,
- 0xCDB30AEB, 0x532E3054, 0x8FD948E4, 0x6DBC3128,
- 0x58EBF2EF, 0x34C6FFEA, 0xFE28ED61, 0xEE7C3C73,
- 0x5D4A14D9, 0xE864B7E3, 0x42105D14, 0x203E13E0,
- 0x45EEE2B6, 0xA3AAABEA, 0xDB6C4F15, 0xFACB4FD0,
- 0xC742F442, 0xEF6ABBB5, 0x654F3B1D, 0x41CD2105,
- 0xD81E799E, 0x86854DC7, 0xE44B476A, 0x3D816250,
- 0xCF62A1F2, 0x5B8D2646, 0xFC8883A0, 0xC1C7B6A3,
- 0x7F1524C3, 0x69CB7492, 0x47848A0B, 0x5692B285,
- 0x095BBF00, 0xAD19489D, 0x1462B174, 0x23820E00,
- 0x58428D2A, 0x0C55F5EA, 0x1DADF43E, 0x233F7061,
- 0x3372F092, 0x8D937E41, 0xD65FECF1, 0x6C223BDB,
- 0x7CDE3759, 0xCBEE7460, 0x4085F2A7, 0xCE77326E,
- 0xA6078084, 0x19F8509E, 0xE8EFD855, 0x61D99735,
- 0xA969A7AA, 0xC50C06C2, 0x5A04ABFC, 0x800BCADC,
- 0x9E447A2E, 0xC3453484, 0xFDD56705, 0x0E1E9EC9,
- 0xDB73DBD3, 0x105588CD, 0x675FDA79, 0xE3674340,
- 0xC5C43465, 0x713E38D8, 0x3D28F89E, 0xF16DFF20,
- 0x153E21E7, 0x8FB03D4A, 0xE6E39F2B, 0xDB83ADF7
- ),
- array(
- 0xE93D5A68, 0x948140F7, 0xF64C261C, 0x94692934,
- 0x411520F7, 0x7602D4F7, 0xBCF46B2E, 0xD4A20068,
- 0xD4082471, 0x3320F46A, 0x43B7D4B7, 0x500061AF,
- 0x1E39F62E, 0x97244546, 0x14214F74, 0xBF8B8840,
- 0x4D95FC1D, 0x96B591AF, 0x70F4DDD3, 0x66A02F45,
- 0xBFBC09EC, 0x03BD9785, 0x7FAC6DD0, 0x31CB8504,
- 0x96EB27B3, 0x55FD3941, 0xDA2547E6, 0xABCA0A9A,
- 0x28507825, 0x530429F4, 0x0A2C86DA, 0xE9B66DFB,
- 0x68DC1462, 0xD7486900, 0x680EC0A4, 0x27A18DEE,
- 0x4F3FFEA2, 0xE887AD8C, 0xB58CE006, 0x7AF4D6B6,
- 0xAACE1E7C, 0xD3375FEC, 0xCE78A399, 0x406B2A42,
- 0x20FE9E35, 0xD9F385B9, 0xEE39D7AB, 0x3B124E8B,
- 0x1DC9FAF7, 0x4B6D1856, 0x26A36631, 0xEAE397B2,
- 0x3A6EFA74, 0xDD5B4332, 0x6841E7F7, 0xCA7820FB,
- 0xFB0AF54E, 0xD8FEB397, 0x454056AC, 0xBA489527,
- 0x55533A3A, 0x20838D87, 0xFE6BA9B7, 0xD096954B,
- 0x55A867BC, 0xA1159A58, 0xCCA92963, 0x99E1DB33,
- 0xA62A4A56, 0x3F3125F9, 0x5EF47E1C, 0x9029317C,
- 0xFDF8E802, 0x04272F70, 0x80BB155C, 0x05282CE3,
- 0x95C11548, 0xE4C66D22, 0x48C1133F, 0xC70F86DC,
- 0x07F9C9EE, 0x41041F0F, 0x404779A4, 0x5D886E17,
- 0x325F51EB, 0xD59BC0D1, 0xF2BCC18F, 0x41113564,
- 0x257B7834, 0x602A9C60, 0xDFF8E8A3, 0x1F636C1B,
- 0x0E12B4C2, 0x02E1329E, 0xAF664FD1, 0xCAD18115,
- 0x6B2395E0, 0x333E92E1, 0x3B240B62, 0xEEBEB922,
- 0x85B2A20E, 0xE6BA0D99, 0xDE720C8C, 0x2DA2F728,
- 0xD0127845, 0x95B794FD, 0x647D0862, 0xE7CCF5F0,
- 0x5449A36F, 0x877D48FA, 0xC39DFD27, 0xF33E8D1E,
- 0x0A476341, 0x992EFF74, 0x3A6F6EAB, 0xF4F8FD37,
- 0xA812DC60, 0xA1EBDDF8, 0x991BE14C, 0xDB6E6B0D,
- 0xC67B5510, 0x6D672C37, 0x2765D43B, 0xDCD0E804,
- 0xF1290DC7, 0xCC00FFA3, 0xB5390F92, 0x690FED0B,
- 0x667B9FFB, 0xCEDB7D9C, 0xA091CF0B, 0xD9155EA3,
- 0xBB132F88, 0x515BAD24, 0x7B9479BF, 0x763BD6EB,
- 0x37392EB3, 0xCC115979, 0x8026E297, 0xF42E312D,
- 0x6842ADA7, 0xC66A2B3B, 0x12754CCC, 0x782EF11C,
- 0x6A124237, 0xB79251E7, 0x06A1BBE6, 0x4BFB6350,
- 0x1A6B1018, 0x11CAEDFA, 0x3D25BDD8, 0xE2E1C3C9,
- 0x44421659, 0x0A121386, 0xD90CEC6E, 0xD5ABEA2A,
- 0x64AF674E, 0xDA86A85F, 0xBEBFE988, 0x64E4C3FE,
- 0x9DBC8057, 0xF0F7C086, 0x60787BF8, 0x6003604D,
- 0xD1FD8346, 0xF6381FB0, 0x7745AE04, 0xD736FCCC,
- 0x83426B33, 0xF01EAB71, 0xB0804187, 0x3C005E5F,
- 0x77A057BE, 0xBDE8AE24, 0x55464299, 0xBF582E61,
- 0x4E58F48F, 0xF2DDFDA2, 0xF474EF38, 0x8789BDC2,
- 0x5366F9C3, 0xC8B38E74, 0xB475F255, 0x46FCD9B9,
- 0x7AEB2661, 0x8B1DDF84, 0x846A0E79, 0x915F95E2,
- 0x466E598E, 0x20B45770, 0x8CD55591, 0xC902DE4C,
- 0xB90BACE1, 0xBB8205D0, 0x11A86248, 0x7574A99E,
- 0xB77F19B6, 0xE0A9DC09, 0x662D09A1, 0xC4324633,
- 0xE85A1F02, 0x09F0BE8C, 0x4A99A025, 0x1D6EFE10,
- 0x1AB93D1D, 0x0BA5A4DF, 0xA186F20F, 0x2868F169,
- 0xDCB7DA83, 0x573906FE, 0xA1E2CE9B, 0x4FCD7F52,
- 0x50115E01, 0xA70683FA, 0xA002B5C4, 0x0DE6D027,
- 0x9AF88C27, 0x773F8641, 0xC3604C06, 0x61A806B5,
- 0xF0177A28, 0xC0F586E0, 0x006058AA, 0x30DC7D62,
- 0x11E69ED7, 0x2338EA63, 0x53C2DD94, 0xC2C21634,
- 0xBBCBEE56, 0x90BCB6DE, 0xEBFC7DA1, 0xCE591D76,
- 0x6F05E409, 0x4B7C0188, 0x39720A3D, 0x7C927C24,
- 0x86E3725F, 0x724D9DB9, 0x1AC15BB4, 0xD39EB8FC,
- 0xED545578, 0x08FCA5B5, 0xD83D7CD3, 0x4DAD0FC4,
- 0x1E50EF5E, 0xB161E6F8, 0xA28514D9, 0x6C51133C,
- 0x6FD5C7E7, 0x56E14EC4, 0x362ABFCE, 0xDDC6C837,
- 0xD79A3234, 0x92638212, 0x670EFA8E, 0x406000E0
- ),
- array(
- 0x3A39CE37, 0xD3FAF5CF, 0xABC27737, 0x5AC52D1B,
- 0x5CB0679E, 0x4FA33742, 0xD3822740, 0x99BC9BBE,
- 0xD5118E9D, 0xBF0F7315, 0xD62D1C7E, 0xC700C47B,
- 0xB78C1B6B, 0x21A19045, 0xB26EB1BE, 0x6A366EB4,
- 0x5748AB2F, 0xBC946E79, 0xC6A376D2, 0x6549C2C8,
- 0x530FF8EE, 0x468DDE7D, 0xD5730A1D, 0x4CD04DC6,
- 0x2939BBDB, 0xA9BA4650, 0xAC9526E8, 0xBE5EE304,
- 0xA1FAD5F0, 0x6A2D519A, 0x63EF8CE2, 0x9A86EE22,
- 0xC089C2B8, 0x43242EF6, 0xA51E03AA, 0x9CF2D0A4,
- 0x83C061BA, 0x9BE96A4D, 0x8FE51550, 0xBA645BD6,
- 0x2826A2F9, 0xA73A3AE1, 0x4BA99586, 0xEF5562E9,
- 0xC72FEFD3, 0xF752F7DA, 0x3F046F69, 0x77FA0A59,
- 0x80E4A915, 0x87B08601, 0x9B09E6AD, 0x3B3EE593,
- 0xE990FD5A, 0x9E34D797, 0x2CF0B7D9, 0x022B8B51,
- 0x96D5AC3A, 0x017DA67D, 0xD1CF3ED6, 0x7C7D2D28,
- 0x1F9F25CF, 0xADF2B89B, 0x5AD6B472, 0x5A88F54C,
- 0xE029AC71, 0xE019A5E6, 0x47B0ACFD, 0xED93FA9B,
- 0xE8D3C48D, 0x283B57CC, 0xF8D56629, 0x79132E28,
- 0x785F0191, 0xED756055, 0xF7960E44, 0xE3D35E8C,
- 0x15056DD4, 0x88F46DBA, 0x03A16125, 0x0564F0BD,
- 0xC3EB9E15, 0x3C9057A2, 0x97271AEC, 0xA93A072A,
- 0x1B3F6D9B, 0x1E6321F5, 0xF59C66FB, 0x26DCF319,
- 0x7533D928, 0xB155FDF5, 0x03563482, 0x8ABA3CBB,
- 0x28517711, 0xC20AD9F8, 0xABCC5167, 0xCCAD925F,
- 0x4DE81751, 0x3830DC8E, 0x379D5862, 0x9320F991,
- 0xEA7A90C2, 0xFB3E7BCE, 0x5121CE64, 0x774FBE32,
- 0xA8B6E37E, 0xC3293D46, 0x48DE5369, 0x6413E680,
- 0xA2AE0810, 0xDD6DB224, 0x69852DFD, 0x09072166,
- 0xB39A460A, 0x6445C0DD, 0x586CDECF, 0x1C20C8AE,
- 0x5BBEF7DD, 0x1B588D40, 0xCCD2017F, 0x6BB4E3BB,
- 0xDDA26A7E, 0x3A59FF45, 0x3E350A44, 0xBCB4CDD5,
- 0x72EACEA8, 0xFA6484BB, 0x8D6612AE, 0xBF3C6F47,
- 0xD29BE463, 0x542F5D9E, 0xAEC2771B, 0xF64E6370,
- 0x740E0D8D, 0xE75B1357, 0xF8721671, 0xAF537D5D,
- 0x4040CB08, 0x4EB4E2CC, 0x34D2466A, 0x0115AF84,
- 0xE1B00428, 0x95983A1D, 0x06B89FB4, 0xCE6EA048,
- 0x6F3F3B82, 0x3520AB82, 0x011A1D4B, 0x277227F8,
- 0x611560B1, 0xE7933FDC, 0xBB3A792B, 0x344525BD,
- 0xA08839E1, 0x51CE794B, 0x2F32C9B7, 0xA01FBAC9,
- 0xE01CC87E, 0xBCC7D1F6, 0xCF0111C3, 0xA1E8AAC7,
- 0x1A908749, 0xD44FBD9A, 0xD0DADECB, 0xD50ADA38,
- 0x0339C32A, 0xC6913667, 0x8DF9317C, 0xE0B12B4F,
- 0xF79E59B7, 0x43F5BB3A, 0xF2D519FF, 0x27D9459C,
- 0xBF97222C, 0x15E6FC2A, 0x0F91FC71, 0x9B941525,
- 0xFAE59361, 0xCEB69CEB, 0xC2A86459, 0x12BAA8D1,
- 0xB6C1075E, 0xE3056A0C, 0x10D25065, 0xCB03A442,
- 0xE0EC6E0E, 0x1698DB3B, 0x4C98A0BE, 0x3278E964,
- 0x9F1F9532, 0xE0D392DF, 0xD3A0342B, 0x8971F21E,
- 0x1B0A7441, 0x4BA3348C, 0xC5BE7120, 0xC37632D8,
- 0xDF359F8D, 0x9B992F2E, 0xE60B6F47, 0x0FE3F11D,
- 0xE54CDA54, 0x1EDAD891, 0xCE6279CF, 0xCD3E7E6F,
- 0x1618B166, 0xFD2C1D05, 0x848FD2C5, 0xF6FB2299,
- 0xF523F357, 0xA6327623, 0x93A83531, 0x56CCCD02,
- 0xACF08162, 0x5A75EBB5, 0x6E163697, 0x88D273CC,
- 0xDE966292, 0x81B949D0, 0x4C50901B, 0x71C65614,
- 0xE6C6C7BD, 0x327A140A, 0x45E1D006, 0xC3F27B9A,
- 0xC9AA53FD, 0x62A80F00, 0xBB25BFE2, 0x35BDD2F6,
- 0x71126905, 0xB2040222, 0xB6CBCF7C, 0xCD769C2B,
- 0x53113EC0, 0x1640E3D3, 0x38ABBD60, 0x2547ADF0,
- 0xBA38209C, 0xF746CE76, 0x77AFA1C5, 0x20756060,
- 0x85CBFE4E, 0x8AE88DD8, 0x7AAAF9B0, 0x4CF9AA7E,
- 0x1948C25C, 0x02FB8A8C, 0x01C36AE4, 0xD6EBE1F9,
- 0x90D4F869, 0xA65CDEA0, 0x3F09252D, 0xC208E69F,
- 0xB74E6132, 0xCE77E25B, 0x578FDFE3, 0x3AC372E6
- )
- );
- }
-
-}
-
-?>
diff --git a/3rdparty/Dropbox/API.php b/3rdparty/Dropbox/API.php
deleted file mode 100644
index 8cdce678e1c..00000000000
--- a/3rdparty/Dropbox/API.php
+++ /dev/null
@@ -1,380 +0,0 @@
-<?php
-
-/**
- * Dropbox API class
- *
- * @package Dropbox
- * @copyright Copyright (C) 2010 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/dropbox-php/wiki/License MIT
- */
-class Dropbox_API {
-
- /**
- * Sandbox root-path
- */
- const ROOT_SANDBOX = 'sandbox';
-
- /**
- * Dropbox root-path
- */
- const ROOT_DROPBOX = 'dropbox';
-
- /**
- * API URl
- */
- protected $api_url = 'https://api.dropbox.com/1/';
-
- /**
- * Content API URl
- */
- protected $api_content_url = 'https://api-content.dropbox.com/1/';
-
- /**
- * OAuth object
- *
- * @var Dropbox_OAuth
- */
- protected $oauth;
-
- /**
- * Default root-path, this will most likely be 'sandbox' or 'dropbox'
- *
- * @var string
- */
- protected $root;
- protected $useSSL;
-
- /**
- * Constructor
- *
- * @param Dropbox_OAuth Dropbox_Auth object
- * @param string $root default root path (sandbox or dropbox)
- */
- public function __construct(Dropbox_OAuth $oauth, $root = self::ROOT_DROPBOX, $useSSL = true) {
-
- $this->oauth = $oauth;
- $this->root = $root;
- $this->useSSL = $useSSL;
- if (!$this->useSSL)
- {
- throw new Dropbox_Exception('Dropbox REST API now requires that all requests use SSL');
- }
-
- }
-
- /**
- * Returns information about the current dropbox account
- *
- * @return stdclass
- */
- public function getAccountInfo() {
-
- $data = $this->oauth->fetch($this->api_url . 'account/info');
- return json_decode($data['body'],true);
-
- }
-
- /**
- * Returns a file's contents
- *
- * @param string $path path
- * @param string $root Use this to override the default root path (sandbox/dropbox)
- * @return string
- */
- public function getFile($path = '', $root = null) {
-
- if (is_null($root)) $root = $this->root;
- $path = str_replace(array('%2F','~'), array('/','%7E'), rawurlencode($path));
- $result = $this->oauth->fetch($this->api_content_url . 'files/' . $root . '/' . ltrim($path,'/'));
- return $result['body'];
-
- }
-
- /**
- * Uploads a new file
- *
- * @param string $path Target path (including filename)
- * @param string $file Either a path to a file or a stream resource
- * @param string $root Use this to override the default root path (sandbox/dropbox)
- * @return bool
- */
- public function putFile($path, $file, $root = null) {
-
- $directory = dirname($path);
- $filename = basename($path);
-
- if($directory==='.') $directory = '';
- $directory = str_replace(array('%2F','~'), array('/','%7E'), rawurlencode($directory));
-// $filename = str_replace('~', '%7E', rawurlencode($filename));
- if (is_null($root)) $root = $this->root;
-
- if (is_string($file)) {
-
- $file = fopen($file,'rb');
-
- } elseif (!is_resource($file)) {
- throw new Dropbox_Exception('File must be a file-resource or a string');
- }
- $result=$this->multipartFetch($this->api_content_url . 'files/' .
- $root . '/' . trim($directory,'/'), $file, $filename);
-
- if(!isset($result["httpStatus"]) || $result["httpStatus"] != 200)
- throw new Dropbox_Exception("Uploading file to Dropbox failed");
-
- return true;
- }
-
-
- /**
- * Copies a file or directory from one location to another
- *
- * This method returns the file information of the newly created file.
- *
- * @param string $from source path
- * @param string $to destination path
- * @param string $root Use this to override the default root path (sandbox/dropbox)
- * @return stdclass
- */
- public function copy($from, $to, $root = null) {
-
- if (is_null($root)) $root = $this->root;
- $response = $this->oauth->fetch($this->api_url . 'fileops/copy', array('from_path' => $from, 'to_path' => $to, 'root' => $root), 'POST');
-
- return json_decode($response['body'],true);
-
- }
-
- /**
- * Creates a new folder
- *
- * This method returns the information from the newly created directory
- *
- * @param string $path
- * @param string $root Use this to override the default root path (sandbox/dropbox)
- * @return stdclass
- */
- public function createFolder($path, $root = null) {
-
- if (is_null($root)) $root = $this->root;
-
- // Making sure the path starts with a /
-// $path = '/' . ltrim($path,'/');
-
- $response = $this->oauth->fetch($this->api_url . 'fileops/create_folder', array('path' => $path, 'root' => $root),'POST');
- return json_decode($response['body'],true);
-
- }
-
- /**
- * Deletes a file or folder.
- *
- * This method will return the metadata information from the deleted file or folder, if successful.
- *
- * @param string $path Path to new folder
- * @param string $root Use this to override the default root path (sandbox/dropbox)
- * @return array
- */
- public function delete($path, $root = null) {
-
- if (is_null($root)) $root = $this->root;
- $response = $this->oauth->fetch($this->api_url . 'fileops/delete', array('path' => $path, 'root' => $root), 'POST');
- return json_decode($response['body']);
-
- }
-
- /**
- * Moves a file or directory to a new location
- *
- * This method returns the information from the newly created directory
- *
- * @param mixed $from Source path
- * @param mixed $to destination path
- * @param string $root Use this to override the default root path (sandbox/dropbox)
- * @return stdclass
- */
- public function move($from, $to, $root = null) {
-
- if (is_null($root)) $root = $this->root;
- $response = $this->oauth->fetch($this->api_url . 'fileops/move', array('from_path' => rawurldecode($from), 'to_path' => rawurldecode($to), 'root' => $root), 'POST');
-
- return json_decode($response['body'],true);
-
- }
-
- /**
- * Returns file and directory information
- *
- * @param string $path Path to receive information from
- * @param bool $list When set to true, this method returns information from all files in a directory. When set to false it will only return infromation from the specified directory.
- * @param string $hash If a hash is supplied, this method simply returns true if nothing has changed since the last request. Good for caching.
- * @param int $fileLimit Maximum number of file-information to receive
- * @param string $root Use this to override the default root path (sandbox/dropbox)
- * @return array|true
- */
- public function getMetaData($path, $list = true, $hash = null, $fileLimit = null, $root = null) {
-
- if (is_null($root)) $root = $this->root;
-
- $args = array(
- 'list' => $list,
- );
-
- if (!is_null($hash)) $args['hash'] = $hash;
- if (!is_null($fileLimit)) $args['file_limit'] = $fileLimit;
-
- $path = str_replace(array('%2F','~'), array('/','%7E'), rawurlencode($path));
- $response = $this->oauth->fetch($this->api_url . 'metadata/' . $root . '/' . ltrim($path,'/'), $args);
-
- /* 304 is not modified */
- if ($response['httpStatus']==304) {
- return true;
- } else {
- return json_decode($response['body'],true);
- }
-
- }
-
- /**
- * A way of letting you keep up with changes to files and folders in a user's Dropbox. You can periodically call /delta to get a list of "delta entries", which are instructions on how to update your local state to match the server's state.
- *
- * This method returns the information from the newly created directory
- *
- * @param string $cursor A string that is used to keep track of your current state. On the next call pass in this value to return delta entries that have been recorded since the cursor was returned.
- * @return stdclass
- */
- public function delta($cursor) {
-
- $arg['cursor'] = $cursor;
-
- $response = $this->oauth->fetch($this->api_url . 'delta', $arg, 'POST');
- return json_decode($response['body'],true);
-
- }
-
- /**
- * Returns a thumbnail (as a string) for a file path.
- *
- * @param string $path Path to file
- * @param string $size small, medium or large
- * @param string $root Use this to override the default root path (sandbox/dropbox)
- * @return string
- */
- public function getThumbnail($path, $size = 'small', $root = null) {
-
- if (is_null($root)) $root = $this->root;
- $path = str_replace(array('%2F','~'), array('/','%7E'), rawurlencode($path));
- $response = $this->oauth->fetch($this->api_content_url . 'thumbnails/' . $root . '/' . ltrim($path,'/'),array('size' => $size));
-
- return $response['body'];
-
- }
-
- /**
- * This method is used to generate multipart POST requests for file upload
- *
- * @param string $uri
- * @param array $arguments
- * @return bool
- */
- protected function multipartFetch($uri, $file, $filename) {
-
- /* random string */
- $boundary = 'R50hrfBj5JYyfR3vF3wR96GPCC9Fd2q2pVMERvEaOE3D8LZTgLLbRpNwXek3';
-
- $headers = array(
- 'Content-Type' => 'multipart/form-data; boundary=' . $boundary,
- );
-
- $body="--" . $boundary . "\r\n";
- $body.="Content-Disposition: form-data; name=file; filename=".rawurldecode($filename)."\r\n";
- $body.="Content-type: application/octet-stream\r\n";
- $body.="\r\n";
- $body.=stream_get_contents($file);
- $body.="\r\n";
- $body.="--" . $boundary . "--";
-
- // Dropbox requires the filename to also be part of the regular arguments, so it becomes
- // part of the signature.
- $uri.='?file=' . $filename;
-
- return $this->oauth->fetch($uri, $body, 'POST', $headers);
-
- }
-
-
- /**
- * Search
- *
- * Returns metadata for all files and folders that match the search query.
- *
- * @added by: diszo.sasil
- *
- * @param string $query
- * @param string $root Use this to override the default root path (sandbox/dropbox)
- * @param string $path
- * @return array
- */
- public function search($query = '', $root = null, $path = ''){
- if (is_null($root)) $root = $this->root;
- if(!empty($path)){
- $path = str_replace(array('%2F','~'), array('/','%7E'), rawurlencode($path));
- }
- $response = $this->oauth->fetch($this->api_url . 'search/' . $root . '/' . ltrim($path,'/'),array('query' => $query));
- return json_decode($response['body'],true);
- }
-
- /**
- * Creates and returns a shareable link to files or folders.
- *
- * Note: Links created by the /shares API call expire after thirty days.
- *
- * @param type $path
- * @param type $root
- * @return type
- */
- public function share($path, $root = null) {
- if (is_null($root)) $root = $this->root;
- $path = str_replace(array('%2F','~'), array('/','%7E'), rawurlencode($path));
- $response = $this->oauth->fetch($this->api_url. 'shares/'. $root . '/' . ltrim($path, '/'), array(), 'POST');
- return json_decode($response['body'],true);
-
- }
-
- /**
- * Returns a link directly to a file.
- * Similar to /shares. The difference is that this bypasses the Dropbox webserver, used to provide a preview of the file, so that you can effectively stream the contents of your media.
- *
- * Note: The /media link expires after four hours, allotting enough time to stream files, but not enough to leave a connection open indefinitely.
- *
- * @param type $path
- * @param type $root
- * @return type
- */
- public function media($path, $root = null) {
-
- if (is_null($root)) $root = $this->root;
- $path = str_replace(array('%2F','~'), array('/','%7E'), rawurlencode($path));
- $response = $this->oauth->fetch($this->api_url. 'media/'. $root . '/' . ltrim($path, '/'), array(), 'POST');
- return json_decode($response['body'],true);
-
- }
-
- /**
- * Creates and returns a copy_ref to a file. This reference string can be used to copy that file to another user's Dropbox by passing it in as the from_copy_ref parameter on /fileops/copy.
- *
- * @param type $path
- * @param type $root
- * @return type
- */
- public function copy_ref($path, $root = null) {
-
- if (is_null($root)) $root = $this->root;
- $path = str_replace(array('%2F','~'), array('/','%7E'), rawurlencode($path));
- $response = $this->oauth->fetch($this->api_url. 'copy_ref/'. $root . '/' . ltrim($path, '/'));
- return json_decode($response['body'],true);
-
- }
-
-
-}
diff --git a/3rdparty/Dropbox/Exception.php b/3rdparty/Dropbox/Exception.php
deleted file mode 100644
index 50cbc4c7915..00000000000
--- a/3rdparty/Dropbox/Exception.php
+++ /dev/null
@@ -1,15 +0,0 @@
-<?php
-
-/**
- * Dropbox base exception
- *
- * @package Dropbox
- * @copyright Copyright (C) 2010 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/dropbox-php/wiki/License MIT
- */
-
-/**
- * Base exception class
- */
-class Dropbox_Exception extends Exception { }
diff --git a/3rdparty/Dropbox/Exception/Forbidden.php b/3rdparty/Dropbox/Exception/Forbidden.php
deleted file mode 100644
index 5f0378cfc74..00000000000
--- a/3rdparty/Dropbox/Exception/Forbidden.php
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-
-/**
- * Dropbox Forbidden exception
- *
- * @package Dropbox
- * @copyright Copyright (C) 2010 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/dropbox-php/wiki/License MIT
- */
-
-/**
- * This exception is thrown when we receive the 403 forbidden response
- */
-class Dropbox_Exception_Forbidden extends Dropbox_Exception {
-
-
-}
diff --git a/3rdparty/Dropbox/Exception/NotFound.php b/3rdparty/Dropbox/Exception/NotFound.php
deleted file mode 100644
index 3deaf90d76b..00000000000
--- a/3rdparty/Dropbox/Exception/NotFound.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-
-/**
- * Dropbox Not Found exception
- *
- * @package Dropbox
- * @copyright Copyright (C) 2010 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/dropbox-php/wiki/License MIT
- */
-
-/**
- * This exception is thrown when a non-existant uri is accessed.
- *
- * Basically, this exception is used when we get back a 404.
- */
-class Dropbox_Exception_NotFound extends Dropbox_Exception {
-
-
-}
diff --git a/3rdparty/Dropbox/Exception/OverQuota.php b/3rdparty/Dropbox/Exception/OverQuota.php
deleted file mode 100644
index 86e5425dbd8..00000000000
--- a/3rdparty/Dropbox/Exception/OverQuota.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-
-/**
- * Dropbox Over Quota exception
- *
- * @package Dropbox
- * @copyright Copyright (C) 2010 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/dropbox-php/wiki/License MIT
- */
-
-/**
- * This exception is thrown when the operation required more space than the available quota.
- *
- * Basically, this exception is used when we get back a 507.
- */
-class Dropbox_Exception_OverQuota extends Dropbox_Exception {
-
-
-}
diff --git a/3rdparty/Dropbox/Exception/RequestToken.php b/3rdparty/Dropbox/Exception/RequestToken.php
deleted file mode 100644
index 5b117f2c6b0..00000000000
--- a/3rdparty/Dropbox/Exception/RequestToken.php
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-
-/**
- * Dropbox RequestToken exception
- *
- * @package Dropbox
- * @copyright Copyright (C) 2010 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/dropbox-php/wiki/License MIT
- */
-
-/**
- * This exception is thrown when an error occured during the request_token process.
- */
-class Dropbox_Exception_RequestToken extends Dropbox_Exception {
-
-
-}
diff --git a/3rdparty/Dropbox/LICENSE.txt b/3rdparty/Dropbox/LICENSE.txt
deleted file mode 100644
index cd3512acee6..00000000000
--- a/3rdparty/Dropbox/LICENSE.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (c) 2010 Rooftop Solutions
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/3rdparty/Dropbox/OAuth.php b/3rdparty/Dropbox/OAuth.php
deleted file mode 100644
index 905cc2da1c6..00000000000
--- a/3rdparty/Dropbox/OAuth.php
+++ /dev/null
@@ -1,151 +0,0 @@
-<?php
-
-/**
- * Dropbox OAuth
- *
- * @package Dropbox
- * @copyright Copyright (C) 2010 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/dropbox-php/wiki/License MIT
- */
-
-
-/**
- * This class is an abstract OAuth class.
- *
- * It must be extended by classes who wish to provide OAuth functionality
- * using different libraries.
- */
-abstract class Dropbox_OAuth {
-
- /**
- * After a user has authorized access, dropbox can redirect the user back
- * to this url.
- *
- * @var string
- */
- public $authorizeCallbackUrl = null;
-
- /**
- * Uri used to fetch request tokens
- *
- * @var string
- */
- const URI_REQUEST_TOKEN = 'https://api.dropbox.com/1/oauth/request_token';
-
- /**
- * Uri used to redirect the user to for authorization.
- *
- * @var string
- */
- const URI_AUTHORIZE = 'https://www.dropbox.com/1/oauth/authorize';
-
- /**
- * Uri used to
- *
- * @var string
- */
- const URI_ACCESS_TOKEN = 'https://api.dropbox.com/1/oauth/access_token';
-
- /**
- * An OAuth request token.
- *
- * @var string
- */
- protected $oauth_token = null;
-
- /**
- * OAuth token secret
- *
- * @var string
- */
- protected $oauth_token_secret = null;
-
-
- /**
- * Constructor
- *
- * @param string $consumerKey
- * @param string $consumerSecret
- */
- abstract public function __construct($consumerKey, $consumerSecret);
-
- /**
- * Sets the request token and secret.
- *
- * The tokens can also be passed as an array into the first argument.
- * The array must have the elements token and token_secret.
- *
- * @param string|array $token
- * @param string $token_secret
- * @return void
- */
- public function setToken($token, $token_secret = null) {
-
- if (is_array($token)) {
- $this->oauth_token = $token['token'];
- $this->oauth_token_secret = $token['token_secret'];
- } else {
- $this->oauth_token = $token;
- $this->oauth_token_secret = $token_secret;
- }
-
- }
-
- /**
- * Returns the oauth request tokens as an associative array.
- *
- * The array will contain the elements 'token' and 'token_secret'.
- *
- * @return array
- */
- public function getToken() {
-
- return array(
- 'token' => $this->oauth_token,
- 'token_secret' => $this->oauth_token_secret,
- );
-
- }
-
- /**
- * Returns the authorization url
- *
- * @param string $callBack Specify a callback url to automatically redirect the user back
- * @return string
- */
- public function getAuthorizeUrl($callBack = null) {
-
- // Building the redirect uri
- $token = $this->getToken();
- $uri = self::URI_AUTHORIZE . '?oauth_token=' . $token['token'];
- if ($callBack) $uri.='&oauth_callback=' . $callBack;
- return $uri;
- }
-
- /**
- * Fetches a secured oauth url and returns the response body.
- *
- * @param string $uri
- * @param mixed $arguments
- * @param string $method
- * @param array $httpHeaders
- * @return string
- */
- public abstract function fetch($uri, $arguments = array(), $method = 'GET', $httpHeaders = array());
-
- /**
- * Requests the OAuth request token.
- *
- * @return array
- */
- abstract public function getRequestToken();
-
- /**
- * Requests the OAuth access tokens.
- *
- * @return array
- */
- abstract public function getAccessToken();
-
-}
diff --git a/3rdparty/Dropbox/OAuth/Consumer/Dropbox.php b/3rdparty/Dropbox/OAuth/Consumer/Dropbox.php
deleted file mode 100644
index 204a659de00..00000000000
--- a/3rdparty/Dropbox/OAuth/Consumer/Dropbox.php
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-/**
- * HTTP OAuth Consumer
- *
- * Adapted from halldirector's code in
- * http://code.google.com/p/dropbox-php/issues/detail?id=36#c5
- *
- * @package Dropbox
- * @copyright Copyright (C) 2011 Joe Constant / halldirector. All rights reserved.
- * @author Joe Constant / halldirector
- * @license http://code.google.com/p/dropbox-php/wiki/License MIT
- */
-
-require_once 'HTTP/OAuth.php';
-require_once 'HTTP/OAuth/Consumer.php';
-
-/*
- * This class is to help work around aomw ssl issues.
- */
-class Dropbox_OAuth_Consumer_Dropbox extends HTTP_OAuth_Consumer
-{
- public function getOAuthConsumerRequest()
- {
- if (!$this->consumerRequest instanceof HTTP_OAuth_Consumer_Request) {
- $this->consumerRequest = new HTTP_OAuth_Consumer_Request;
- }
-
- // TODO: Change this and add in code to validate the SSL cert.
- // see https://github.com/bagder/curl/blob/master/lib/mk-ca-bundle.pl
- $this->consumerRequest->setConfig(array(
- 'ssl_verify_peer' => false,
- 'ssl_verify_host' => false
- ));
-
- return $this->consumerRequest;
- }
-}
diff --git a/3rdparty/Dropbox/OAuth/Curl.php b/3rdparty/Dropbox/OAuth/Curl.php
deleted file mode 100644
index b75b27bb363..00000000000
--- a/3rdparty/Dropbox/OAuth/Curl.php
+++ /dev/null
@@ -1,282 +0,0 @@
-<?php
-
-/**
- * Dropbox OAuth
- *
- * @package Dropbox
- * @copyright Copyright (C) 2011 Daniel Huesken
- * @author Daniel Huesken (http://www.danielhuesken.de/)
- * @license MIT
- */
-
-/**
- * This class is used to sign all requests to dropbox.
- *
- * This specific class uses WordPress WP_Http to authenticate.
- */
-class Dropbox_OAuth_Curl extends Dropbox_OAuth {
-
- /**
- *
- * @var string ConsumerKey
- */
- protected $consumerKey = null;
- /**
- *
- * @var string ConsumerSecret
- */
- protected $consumerSecret = null;
- /**
- *
- * @var string ProzessCallBack
- */
- public $ProgressFunction = false;
-
- /**
- * Constructor
- *
- * @param string $consumerKey
- * @param string $consumerSecret
- */
- public function __construct($consumerKey, $consumerSecret) {
- if (!function_exists('curl_exec'))
- throw new Dropbox_Exception('The PHP curl functions not available!');
-
- $this->consumerKey = $consumerKey;
- $this->consumerSecret = $consumerSecret;
- }
-
- /**
- * Fetches a secured oauth url and returns the response body.
- *
- * @param string $uri
- * @param mixed $arguments
- * @param string $method
- * @param array $httpHeaders
- * @return string
- */
- public function fetch($uri, $arguments = array(), $method = 'GET', $httpHeaders = array()) {
-
- $uri=str_replace('http://', 'https://', $uri); // all https, upload makes problems if not
- if (is_string($arguments) and strtoupper($method) == 'POST') {
- preg_match("/\?file=(.*)$/i", $uri, $matches);
- if (isset($matches[1])) {
- $uri = str_replace($matches[0], "", $uri);
- $filename = $matches[1];
- $httpHeaders=array_merge($httpHeaders,$this->getOAuthHeader($uri, array("file" => $filename), $method));
- }
- } else {
- $httpHeaders=array_merge($httpHeaders,$this->getOAuthHeader($uri, $arguments, $method));
- }
- $ch = curl_init();
- if (strtoupper($method) == 'POST') {
- curl_setopt($ch, CURLOPT_URL, $uri);
- curl_setopt($ch, CURLOPT_POST, true);
-// if (is_array($arguments))
-// $arguments=http_build_query($arguments);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $arguments);
-// $httpHeaders['Content-Length']=strlen($arguments);
- } else {
- curl_setopt($ch, CURLOPT_URL, $uri.'?'.http_build_query($arguments));
- curl_setopt($ch, CURLOPT_POST, false);
- }
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_TIMEOUT, 300);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
-// curl_setopt($ch, CURLOPT_CAINFO, "rootca");
- curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
- //Build header
- $headers = array();
- foreach ($httpHeaders as $name => $value) {
- $headers[] = "{$name}: $value";
- }
- curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
- if (!ini_get('safe_mode') && !ini_get('open_basedir'))
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true );
- if (function_exists($this->ProgressFunction) and defined('CURLOPT_PROGRESSFUNCTION')) {
- curl_setopt($ch, CURLOPT_NOPROGRESS, false);
- curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, $this->ProgressFunction);
- curl_setopt($ch, CURLOPT_BUFFERSIZE, 512);
- }
- $response=curl_exec($ch);
- $errorno=curl_errno($ch);
- $error=curl_error($ch);
- $status=curl_getinfo($ch,CURLINFO_HTTP_CODE);
- curl_close($ch);
-
-
- if (!empty($errorno))
- throw new Dropbox_Exception_NotFound('Curl error: ('.$errorno.') '.$error."\n");
-
- if ($status>=300) {
- $body = json_decode($response,true);
- switch ($status) {
- // Not modified
- case 304 :
- return array(
- 'httpStatus' => 304,
- 'body' => null,
- );
- break;
- case 403 :
- throw new Dropbox_Exception_Forbidden('Forbidden.
- This could mean a bad OAuth request, or a file or folder already existing at the target location.
- ' . $body["error"] . "\n");
- case 404 :
- throw new Dropbox_Exception_NotFound('Resource at uri: ' . $uri . ' could not be found. ' .
- $body["error"] . "\n");
- case 507 :
- throw new Dropbox_Exception_OverQuota('This dropbox is full. ' .
- $body["error"] . "\n");
- }
- if (!empty($body["error"]))
- throw new Dropbox_Exception_RequestToken('Error: ('.$status.') '.$body["error"]."\n");
- }
-
- return array(
- 'body' => $response,
- 'httpStatus' => $status
- );
- }
-
- /**
- * Returns named array with oauth parameters for further use
- * @return array Array with oauth_ parameters
- */
- private function getOAuthBaseParams() {
- $params['oauth_version'] = '1.0';
- $params['oauth_signature_method'] = 'HMAC-SHA1';
-
- $params['oauth_consumer_key'] = $this->consumerKey;
- $tokens = $this->getToken();
- if (isset($tokens['token']) && $tokens['token']) {
- $params['oauth_token'] = $tokens['token'];
- }
- $params['oauth_timestamp'] = time();
- $params['oauth_nonce'] = md5(microtime() . mt_rand());
- return $params;
- }
-
- /**
- * Creates valid Authorization header for OAuth, based on URI and Params
- *
- * @param string $uri
- * @param array $params
- * @param string $method GET or POST, standard is GET
- * @param array $oAuthParams optional, pass your own oauth_params here
- * @return array Array for request's headers section like
- * array('Authorization' => 'OAuth ...');
- */
- private function getOAuthHeader($uri, $params, $method = 'GET', $oAuthParams = null) {
- $oAuthParams = $oAuthParams ? $oAuthParams : $this->getOAuthBaseParams();
-
- // create baseString to encode for the sent parameters
- $baseString = $method . '&';
- $baseString .= $this->oauth_urlencode($uri) . "&";
-
- // OAuth header does not include GET-Parameters
- $signatureParams = array_merge($params, $oAuthParams);
-
- // sorting the parameters
- ksort($signatureParams);
-
- $encodedParams = array();
- foreach ($signatureParams as $key => $value) {
- $encodedParams[] = $this->oauth_urlencode($key) . '=' . $this->oauth_urlencode($value);
- }
-
- $baseString .= $this->oauth_urlencode(implode('&', $encodedParams));
-
- // encode the signature
- $tokens = $this->getToken();
- $hash = $this->hash_hmac_sha1($this->consumerSecret.'&'.$tokens['token_secret'], $baseString);
- $signature = base64_encode($hash);
-
- // add signature to oAuthParams
- $oAuthParams['oauth_signature'] = $signature;
-
- $oAuthEncoded = array();
- foreach ($oAuthParams as $key => $value) {
- $oAuthEncoded[] = $key . '="' . $this->oauth_urlencode($value) . '"';
- }
-
- return array('Authorization' => 'OAuth ' . implode(', ', $oAuthEncoded));
- }
-
- /**
- * Requests the OAuth request token.
- *
- * @return void
- */
- public function getRequestToken() {
- $result = $this->fetch(self::URI_REQUEST_TOKEN, array(), 'POST');
- if ($result['httpStatus'] == "200") {
- $tokens = array();
- parse_str($result['body'], $tokens);
- $this->setToken($tokens['oauth_token'], $tokens['oauth_token_secret']);
- return $this->getToken();
- } else {
- throw new Dropbox_Exception_RequestToken('We were unable to fetch request tokens. This likely means that your consumer key and/or secret are incorrect.');
- }
- }
-
- /**
- * Requests the OAuth access tokens.
- *
- * This method requires the 'unauthorized' request tokens
- * and, if successful will set the authorized request tokens.
- *
- * @return void
- */
- public function getAccessToken() {
- $result = $this->fetch(self::URI_ACCESS_TOKEN, array(), 'POST');
- if ($result['httpStatus'] == "200") {
- $tokens = array();
- parse_str($result['body'], $tokens);
- $this->setToken($tokens['oauth_token'], $tokens['oauth_token_secret']);
- return $this->getToken();
- } else {
- throw new Dropbox_Exception_RequestToken('We were unable to fetch request tokens. This likely means that your consumer key and/or secret are incorrect.');
- }
- }
-
- /**
- * Helper function to properly urlencode parameters.
- * See http://php.net/manual/en/function.oauth-urlencode.php
- *
- * @param string $string
- * @return string
- */
- private function oauth_urlencode($string) {
- return str_replace('%E7', '~', rawurlencode($string));
- }
-
- /**
- * Hash function for hmac_sha1; uses native function if available.
- *
- * @param string $key
- * @param string $data
- * @return string
- */
- private function hash_hmac_sha1($key, $data) {
- if (function_exists('hash_hmac') && in_array('sha1', hash_algos())) {
- return hash_hmac('sha1', $data, $key, true);
- } else {
- $blocksize = 64;
- $hashfunc = 'sha1';
- if (strlen($key) > $blocksize) {
- $key = pack('H*', $hashfunc($key));
- }
-
- $key = str_pad($key, $blocksize, chr(0x00));
- $ipad = str_repeat(chr(0x36), $blocksize);
- $opad = str_repeat(chr(0x5c), $blocksize);
- $hash = pack('H*', $hashfunc(( $key ^ $opad ) . pack('H*', $hashfunc(($key ^ $ipad) . $data))));
-
- return $hash;
- }
- }
-
-
-} \ No newline at end of file
diff --git a/3rdparty/Dropbox/README.md b/3rdparty/Dropbox/README.md
deleted file mode 100644
index 54e05db762b..00000000000
--- a/3rdparty/Dropbox/README.md
+++ /dev/null
@@ -1,31 +0,0 @@
-Dropbox-php
-===========
-
-This PHP library allows you to easily integrate dropbox with PHP.
-
-The following PHP extension is required:
-
-* json
-
-The library makes use of OAuth. At the moment you can use either of these libraries:
-
-[PHP OAuth extension](http://pecl.php.net/package/oauth)
-[PEAR's HTTP_OAUTH package](http://pear.php.net/package/http_oauth)
-
-The extension is recommended, but if you can't install php extensions you should go for the pear package.
-Installing
-----------
-
- pear channel-discover pear.dropbox-php.com
- pear install dropbox-php/Dropbox-alpha
-
-Documentation
--------------
-Check out the [documentation](http://www.dropbox-php.com/docs).
-
-Questions?
-----------
-
-[Dropbox-php Mailing list](http://groups.google.com/group/dropbox-php)
-[Official Dropbox developer forum](http://forums.dropbox.com/forum.php?id=5)
-
diff --git a/3rdparty/Dropbox/autoload.php b/3rdparty/Dropbox/autoload.php
deleted file mode 100644
index 5388ea6334a..00000000000
--- a/3rdparty/Dropbox/autoload.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-
-/**
- * This file registers a new autoload function using spl_autoload_register.
- *
- * @package Dropbox
- * @copyright Copyright (C) 2010 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/dropbox-php/wiki/License MIT
- */
-
-/**
- * Autoloader function
- *
- * @param $className string
- * @return void
- */
-function Dropbox_autoload($className) {
-
- if(strpos($className,'Dropbox_')===0) {
-
- include dirname(__FILE__) . '/' . str_replace('_','/',substr($className,8)) . '.php';
-
- }
-
-}
-
-spl_autoload_register('Dropbox_autoload');
-
diff --git a/3rdparty/Google/LICENSE.txt b/3rdparty/Google/LICENSE.txt
deleted file mode 100644
index 8891c7ddc90..00000000000
--- a/3rdparty/Google/LICENSE.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License
-
-Copyright (c) 2007 Andy Smith
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/3rdparty/Google/OAuth.php b/3rdparty/Google/OAuth.php
deleted file mode 100755
index c7e75dd8266..00000000000
--- a/3rdparty/Google/OAuth.php
+++ /dev/null
@@ -1,751 +0,0 @@
-<?php
-// vim: foldmethod=marker
-
-/* Generic exception class
- */
-class OAuthException extends Exception {/*{{{*/
- // pass
-}/*}}}*/
-
-class OAuthConsumer {/*{{{*/
- public $key;
- public $secret;
-
- public function __construct($key, $secret, $callback_url=NULL) {/*{{{*/
- $this->key = $key;
- $this->secret = $secret;
- $this->callback_url = $callback_url;
- }/*}}}*/
-}/*}}}*/
-
-class OAuthToken {/*{{{*/
- // access tokens and request tokens
- public $key;
- public $secret;
-
- /**
- * key = the token
- * secret = the token secret
- */
- function __construct($key, $secret) {/*{{{*/
- $this->key = $key;
- $this->secret = $secret;
- }/*}}}*/
-
- /**
- * generates the basic string serialization of a token that a server
- * would respond to request_token and access_token calls with
- */
- function to_string() {/*{{{*/
- return "oauth_token=" . OAuthUtil::urlencodeRFC3986($this->key) .
- "&oauth_token_secret=" . OAuthUtil::urlencodeRFC3986($this->secret);
- }/*}}}*/
-
- function __toString() {/*{{{*/
- return $this->to_string();
- }/*}}}*/
-}/*}}}*/
-
-class OAuthSignatureMethod {/*{{{*/
- public function check_signature(&$request, $consumer, $token, $signature) {
- $built = $this->build_signature($request, $consumer, $token);
- return $built == $signature;
- }
-}/*}}}*/
-
-class OAuthSignatureMethod_HMAC_SHA1 extends OAuthSignatureMethod {/*{{{*/
- function get_name() {/*{{{*/
- return "HMAC-SHA1";
- }/*}}}*/
-
- public function build_signature($request, $consumer, $token, $privKey=NULL) {/*{{{*/
- $base_string = $request->get_signature_base_string();
- $request->base_string = $base_string;
-
- $key_parts = array(
- $consumer->secret,
- ($token) ? $token->secret : ""
- );
-
- $key_parts = array_map(array('OAuthUtil','urlencodeRFC3986'), $key_parts);
- $key = implode('&', $key_parts);
-
- return base64_encode( hash_hmac('sha1', $base_string, $key, true));
- }/*}}}*/
-}/*}}}*/
-
-class OAuthSignatureMethod_RSA_SHA1 extends OAuthSignatureMethod {/*{{{*/
- public function get_name() {/*{{{*/
- return "RSA-SHA1";
- }/*}}}*/
-
- protected function fetch_public_cert(&$request) {/*{{{*/
- // not implemented yet, ideas are:
- // (1) do a lookup in a table of trusted certs keyed off of consumer
- // (2) fetch via http using a url provided by the requester
- // (3) some sort of specific discovery code based on request
- //
- // either way should return a string representation of the certificate
- throw Exception("fetch_public_cert not implemented");
- }/*}}}*/
-
- protected function fetch_private_cert($privKey) {//&$request) {/*{{{*/
- // not implemented yet, ideas are:
- // (1) do a lookup in a table of trusted certs keyed off of consumer
- //
- // either way should return a string representation of the certificate
- throw Exception("fetch_private_cert not implemented");
- }/*}}}*/
-
- public function build_signature(&$request, $consumer, $token, $privKey) {/*{{{*/
- $base_string = $request->get_signature_base_string();
-
- // Fetch the private key cert based on the request
- //$cert = $this->fetch_private_cert($consumer->privKey);
-
- //Pull the private key ID from the certificate
- //$privatekeyid = openssl_get_privatekey($cert);
-
- // hacked in
- if ($privKey == '') {
- $fp = fopen($GLOBALS['PRIV_KEY_FILE'], "r");
- $privKey = fread($fp, 8192);
- fclose($fp);
- }
- $privatekeyid = openssl_get_privatekey($privKey);
-
- //Check the computer signature against the one passed in the query
- $ok = openssl_sign($base_string, $signature, $privatekeyid);
-
- //Release the key resource
- openssl_free_key($privatekeyid);
-
- return base64_encode($signature);
- } /*}}}*/
-
- public function check_signature(&$request, $consumer, $token, $signature) {/*{{{*/
- $decoded_sig = base64_decode($signature);
-
- $base_string = $request->get_signature_base_string();
-
- // Fetch the public key cert based on the request
- $cert = $this->fetch_public_cert($request);
-
- //Pull the public key ID from the certificate
- $publickeyid = openssl_get_publickey($cert);
-
- //Check the computer signature against the one passed in the query
- $ok = openssl_verify($base_string, $decoded_sig, $publickeyid);
-
- //Release the key resource
- openssl_free_key($publickeyid);
-
- return $ok == 1;
- } /*}}}*/
-}/*}}}*/
-
-class OAuthRequest {/*{{{*/
- private $parameters;
- private $http_method;
- private $http_url;
- // for debug purposes
- public $base_string;
- public static $version = '1.0';
-
- function __construct($http_method, $http_url, $parameters=NULL) {/*{{{*/
- @$parameters or $parameters = array();
- $this->parameters = $parameters;
- $this->http_method = $http_method;
- $this->http_url = $http_url;
- }/*}}}*/
-
-
- /**
- * attempt to build up a request from what was passed to the server
- */
- public static function from_request($http_method=NULL, $http_url=NULL, $parameters=NULL) {/*{{{*/
- $scheme = (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != "on") ? 'http' : 'https';
- @$http_url or $http_url = $scheme . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
- @$http_method or $http_method = $_SERVER['REQUEST_METHOD'];
-
- $request_headers = OAuthRequest::get_headers();
-
- // let the library user override things however they'd like, if they know
- // which parameters to use then go for it, for example XMLRPC might want to
- // do this
- if ($parameters) {
- $req = new OAuthRequest($http_method, $http_url, $parameters);
- }
- // next check for the auth header, we need to do some extra stuff
- // if that is the case, namely suck in the parameters from GET or POST
- // so that we can include them in the signature
- else if (@substr($request_headers['Authorization'], 0, 5) == "OAuth") {
- $header_parameters = OAuthRequest::split_header($request_headers['Authorization']);
- if ($http_method == "GET") {
- $req_parameters = $_GET;
- }
- else if ($http_method = "POST") {
- $req_parameters = $_POST;
- }
- $parameters = array_merge($header_parameters, $req_parameters);
- $req = new OAuthRequest($http_method, $http_url, $parameters);
- }
- else if ($http_method == "GET") {
- $req = new OAuthRequest($http_method, $http_url, $_GET);
- }
- else if ($http_method == "POST") {
- $req = new OAuthRequest($http_method, $http_url, $_POST);
- }
- return $req;
- }/*}}}*/
-
- /**
- * pretty much a helper function to set up the request
- */
- public static function from_consumer_and_token($consumer, $token, $http_method, $http_url, $parameters=NULL) {/*{{{*/
- @$parameters or $parameters = array();
- $defaults = array("oauth_version" => OAuthRequest::$version,
- "oauth_nonce" => OAuthRequest::generate_nonce(),
- "oauth_timestamp" => OAuthRequest::generate_timestamp(),
- "oauth_consumer_key" => $consumer->key);
- $parameters = array_merge($defaults, $parameters);
-
- if ($token) {
- $parameters['oauth_token'] = $token->key;
- }
-
- // oauth v1.0a
- /*if (isset($_REQUEST['oauth_verifier'])) {
- $parameters['oauth_verifier'] = $_REQUEST['oauth_verifier'];
- }*/
-
-
- return new OAuthRequest($http_method, $http_url, $parameters);
- }/*}}}*/
-
- public function set_parameter($name, $value) {/*{{{*/
- $this->parameters[$name] = $value;
- }/*}}}*/
-
- public function get_parameter($name) {/*{{{*/
- return $this->parameters[$name];
- }/*}}}*/
-
- public function get_parameters() {/*{{{*/
- return $this->parameters;
- }/*}}}*/
-
- /**
- * Returns the normalized parameters of the request
- *
- * This will be all (except oauth_signature) parameters,
- * sorted first by key, and if duplicate keys, then by
- * value.
- *
- * The returned string will be all the key=value pairs
- * concated by &.
- *
- * @return string
- */
- public function get_signable_parameters() {/*{{{*/
- // Grab all parameters
- $params = $this->parameters;
-
- // Remove oauth_signature if present
- if (isset($params['oauth_signature'])) {
- unset($params['oauth_signature']);
- }
-
- // Urlencode both keys and values
- $keys = array_map(array('OAuthUtil', 'urlencodeRFC3986'), array_keys($params));
- $values = array_map(array('OAuthUtil', 'urlencodeRFC3986'), array_values($params));
- $params = array_combine($keys, $values);
-
- // Sort by keys (natsort)
- uksort($params, 'strnatcmp');
-
-if(isset($params['title']) && isset($params['title-exact'])) {
- $temp = $params['title-exact'];
- $title = $params['title'];
-
- unset($params['title']);
- unset($params['title-exact']);
-
- $params['title-exact'] = $temp;
- $params['title'] = $title;
-}
-
- // Generate key=value pairs
- $pairs = array();
- foreach ($params as $key=>$value ) {
- if (is_array($value)) {
- // If the value is an array, it's because there are multiple
- // with the same key, sort them, then add all the pairs
- natsort($value);
- foreach ($value as $v2) {
- $pairs[] = $key . '=' . $v2;
- }
- } else {
- $pairs[] = $key . '=' . $value;
- }
- }
-
- // Return the pairs, concated with &
- return implode('&', $pairs);
- }/*}}}*/
-
- /**
- * Returns the base string of this request
- *
- * The base string defined as the method, the url
- * and the parameters (normalized), each urlencoded
- * and the concated with &.
- */
- public function get_signature_base_string() {/*{{{*/
- $parts = array(
- $this->get_normalized_http_method(),
- $this->get_normalized_http_url(),
- $this->get_signable_parameters()
- );
-
- $parts = array_map(array('OAuthUtil', 'urlencodeRFC3986'), $parts);
-
- return implode('&', $parts);
- }/*}}}*/
-
- /**
- * just uppercases the http method
- */
- public function get_normalized_http_method() {/*{{{*/
- return strtoupper($this->http_method);
- }/*}}}*/
-
-/**
- * parses the url and rebuilds it to be
- * scheme://host/path
- */
- public function get_normalized_http_url() {
- $parts = parse_url($this->http_url);
-
- $scheme = (isset($parts['scheme'])) ? $parts['scheme'] : 'http';
- $port = (isset($parts['port'])) ? $parts['port'] : (($scheme == 'https') ? '443' : '80');
- $host = (isset($parts['host'])) ? strtolower($parts['host']) : '';
- $path = (isset($parts['path'])) ? $parts['path'] : '';
-
- if (($scheme == 'https' && $port != '443')
- || ($scheme == 'http' && $port != '80')) {
- $host = "$host:$port";
- }
- return "$scheme://$host$path";
- }
-
- /**
- * builds a url usable for a GET request
- */
- public function to_url() {/*{{{*/
- $out = $this->get_normalized_http_url() . "?";
- $out .= $this->to_postdata();
- return $out;
- }/*}}}*/
-
- /**
- * builds the data one would send in a POST request
- */
- public function to_postdata() {/*{{{*/
- $total = array();
- foreach ($this->parameters as $k => $v) {
- $total[] = OAuthUtil::urlencodeRFC3986($k) . "=" . OAuthUtil::urlencodeRFC3986($v);
- }
- $out = implode("&", $total);
- return $out;
- }/*}}}*/
-
- /**
- * builds the Authorization: header
- */
- public function to_header() {/*{{{*/
- $out ='Authorization: OAuth ';
- $total = array();
-
- /*
- $sig = $this->parameters['oauth_signature'];
- unset($this->parameters['oauth_signature']);
- uksort($this->parameters, 'strnatcmp');
- $this->parameters['oauth_signature'] = $sig;
- */
-
- foreach ($this->parameters as $k => $v) {
- if (substr($k, 0, 5) != "oauth") continue;
- $out .= OAuthUtil::urlencodeRFC3986($k) . '="' . OAuthUtil::urlencodeRFC3986($v) . '", ';
- }
- $out = substr_replace($out, '', strlen($out) - 2);
-
- return $out;
- }/*}}}*/
-
- public function __toString() {/*{{{*/
- return $this->to_url();
- }/*}}}*/
-
-
- public function sign_request($signature_method, $consumer, $token, $privKey=NULL) {/*{{{*/
- $this->set_parameter("oauth_signature_method", $signature_method->get_name());
- $signature = $this->build_signature($signature_method, $consumer, $token, $privKey);
- $this->set_parameter("oauth_signature", $signature);
- }/*}}}*/
-
- public function build_signature($signature_method, $consumer, $token, $privKey=NULL) {/*{{{*/
- $signature = $signature_method->build_signature($this, $consumer, $token, $privKey);
- return $signature;
- }/*}}}*/
-
- /**
- * util function: current timestamp
- */
- private static function generate_timestamp() {/*{{{*/
- return time();
- }/*}}}*/
-
- /**
- * util function: current nonce
- */
- private static function generate_nonce() {/*{{{*/
- $mt = microtime();
- $rand = mt_rand();
-
- return md5($mt . $rand); // md5s look nicer than numbers
- }/*}}}*/
-
- /**
- * util function for turning the Authorization: header into
- * parameters, has to do some unescaping
- */
- private static function split_header($header) {/*{{{*/
- // this should be a regex
- // error cases: commas in parameter values
- $parts = explode(",", $header);
- $out = array();
- foreach ($parts as $param) {
- $param = ltrim($param);
- // skip the "realm" param, nobody ever uses it anyway
- if (substr($param, 0, 5) != "oauth") continue;
-
- $param_parts = explode("=", $param);
-
- // rawurldecode() used because urldecode() will turn a "+" in the
- // value into a space
- $out[$param_parts[0]] = rawurldecode(substr($param_parts[1], 1, -1));
- }
- return $out;
- }/*}}}*/
-
- /**
- * helper to try to sort out headers for people who aren't running apache
- */
- private static function get_headers() {/*{{{*/
- if (function_exists('apache_request_headers')) {
- // we need this to get the actual Authorization: header
- // because apache tends to tell us it doesn't exist
- return apache_request_headers();
- }
- // otherwise we don't have apache and are just going to have to hope
- // that $_SERVER actually contains what we need
- $out = array();
- foreach ($_SERVER as $key => $value) {
- if (substr($key, 0, 5) == "HTTP_") {
- // this is chaos, basically it is just there to capitalize the first
- // letter of every word that is not an initial HTTP and strip HTTP
- // code from przemek
- $key = str_replace(" ", "-", ucwords(strtolower(str_replace("_", " ", substr($key, 5)))));
- $out[$key] = $value;
- }
- }
- return $out;
- }/*}}}*/
-}/*}}}*/
-
-class OAuthServer {/*{{{*/
- protected $timestamp_threshold = 300; // in seconds, five minutes
- protected $version = 1.0; // hi blaine
- protected $signature_methods = array();
-
- protected $data_store;
-
- function __construct($data_store) {/*{{{*/
- $this->data_store = $data_store;
- }/*}}}*/
-
- public function add_signature_method($signature_method) {/*{{{*/
- $this->signature_methods[$signature_method->get_name()] =
- $signature_method;
- }/*}}}*/
-
- // high level functions
-
- /**
- * process a request_token request
- * returns the request token on success
- */
- public function fetch_request_token(&$request) {/*{{{*/
- $this->get_version($request);
-
- $consumer = $this->get_consumer($request);
-
- // no token required for the initial token request
- $token = NULL;
-
- $this->check_signature($request, $consumer, $token);
-
- $new_token = $this->data_store->new_request_token($consumer);
-
- return $new_token;
- }/*}}}*/
-
- /**
- * process an access_token request
- * returns the access token on success
- */
- public function fetch_access_token(&$request) {/*{{{*/
- $this->get_version($request);
-
- $consumer = $this->get_consumer($request);
-
- // requires authorized request token
- $token = $this->get_token($request, $consumer, "request");
-
- $this->check_signature($request, $consumer, $token);
-
- $new_token = $this->data_store->new_access_token($token, $consumer);
-
- return $new_token;
- }/*}}}*/
-
- /**
- * verify an api call, checks all the parameters
- */
- public function verify_request(&$request) {/*{{{*/
- $this->get_version($request);
- $consumer = $this->get_consumer($request);
- $token = $this->get_token($request, $consumer, "access");
- $this->check_signature($request, $consumer, $token);
- return array($consumer, $token);
- }/*}}}*/
-
- // Internals from here
- /**
- * version 1
- */
- private function get_version(&$request) {/*{{{*/
- $version = $request->get_parameter("oauth_version");
- if (!$version) {
- $version = 1.0;
- }
- if ($version && $version != $this->version) {
- throw new OAuthException("OAuth version '$version' not supported");
- }
- return $version;
- }/*}}}*/
-
- /**
- * figure out the signature with some defaults
- */
- private function get_signature_method(&$request) {/*{{{*/
- $signature_method =
- @$request->get_parameter("oauth_signature_method");
- if (!$signature_method) {
- $signature_method = "PLAINTEXT";
- }
- if (!in_array($signature_method,
- array_keys($this->signature_methods))) {
- throw new OAuthException(
- "Signature method '$signature_method' not supported try one of the following: " . implode(", ", array_keys($this->signature_methods))
- );
- }
- return $this->signature_methods[$signature_method];
- }/*}}}*/
-
- /**
- * try to find the consumer for the provided request's consumer key
- */
- private function get_consumer(&$request) {/*{{{*/
- $consumer_key = @$request->get_parameter("oauth_consumer_key");
- if (!$consumer_key) {
- throw new OAuthException("Invalid consumer key");
- }
-
- $consumer = $this->data_store->lookup_consumer($consumer_key);
- if (!$consumer) {
- throw new OAuthException("Invalid consumer");
- }
-
- return $consumer;
- }/*}}}*/
-
- /**
- * try to find the token for the provided request's token key
- */
- private function get_token(&$request, $consumer, $token_type="access") {/*{{{*/
- $token_field = @$request->get_parameter('oauth_token');
- $token = $this->data_store->lookup_token(
- $consumer, $token_type, $token_field
- );
- if (!$token) {
- throw new OAuthException("Invalid $token_type token: $token_field");
- }
- return $token;
- }/*}}}*/
-
- /**
- * all-in-one function to check the signature on a request
- * should guess the signature method appropriately
- */
- private function check_signature(&$request, $consumer, $token) {/*{{{*/
- // this should probably be in a different method
- $timestamp = @$request->get_parameter('oauth_timestamp');
- $nonce = @$request->get_parameter('oauth_nonce');
-
- $this->check_timestamp($timestamp);
- $this->check_nonce($consumer, $token, $nonce, $timestamp);
-
- $signature_method = $this->get_signature_method($request);
-
- $signature = $request->get_parameter('oauth_signature');
- $valid_sig = $signature_method->check_signature(
- $request,
- $consumer,
- $token,
- $signature
- );
-
- if (!$valid_sig) {
- throw new OAuthException("Invalid signature");
- }
- }/*}}}*/
-
- /**
- * check that the timestamp is new enough
- */
- private function check_timestamp($timestamp) {/*{{{*/
- // verify that timestamp is recentish
- $now = time();
- if ($now - $timestamp > $this->timestamp_threshold) {
- throw new OAuthException("Expired timestamp, yours $timestamp, ours $now");
- }
- }/*}}}*/
-
- /**
- * check that the nonce is not repeated
- */
- private function check_nonce($consumer, $token, $nonce, $timestamp) {/*{{{*/
- // verify that the nonce is uniqueish
- $found = $this->data_store->lookup_nonce($consumer, $token, $nonce, $timestamp);
- if ($found) {
- throw new OAuthException("Nonce already used: $nonce");
- }
- }/*}}}*/
-
-
-
-}/*}}}*/
-
-class OAuthDataStore {/*{{{*/
- function lookup_consumer($consumer_key) {/*{{{*/
- // implement me
- }/*}}}*/
-
- function lookup_token($consumer, $token_type, $token) {/*{{{*/
- // implement me
- }/*}}}*/
-
- function lookup_nonce($consumer, $token, $nonce, $timestamp) {/*{{{*/
- // implement me
- }/*}}}*/
-
- function fetch_request_token($consumer) {/*{{{*/
- // return a new token attached to this consumer
- }/*}}}*/
-
- function fetch_access_token($token, $consumer) {/*{{{*/
- // return a new access token attached to this consumer
- // for the user associated with this token if the request token
- // is authorized
- // should also invalidate the request token
- }/*}}}*/
-
-}/*}}}*/
-
-
-/* A very naive dbm-based oauth storage
- */
-class SimpleOAuthDataStore extends OAuthDataStore {/*{{{*/
- private $dbh;
-
- function __construct($path = "oauth.gdbm") {/*{{{*/
- $this->dbh = dba_popen($path, 'c', 'gdbm');
- }/*}}}*/
-
- function __destruct() {/*{{{*/
- dba_close($this->dbh);
- }/*}}}*/
-
- function lookup_consumer($consumer_key) {/*{{{*/
- $rv = dba_fetch("consumer_$consumer_key", $this->dbh);
- if ($rv === FALSE) {
- return NULL;
- }
- $obj = unserialize($rv);
- if (!($obj instanceof OAuthConsumer)) {
- return NULL;
- }
- return $obj;
- }/*}}}*/
-
- function lookup_token($consumer, $token_type, $token) {/*{{{*/
- $rv = dba_fetch("${token_type}_${token}", $this->dbh);
- if ($rv === FALSE) {
- return NULL;
- }
- $obj = unserialize($rv);
- if (!($obj instanceof OAuthToken)) {
- return NULL;
- }
- return $obj;
- }/*}}}*/
-
- function lookup_nonce($consumer, $token, $nonce, $timestamp) {/*{{{*/
- return dba_exists("nonce_$nonce", $this->dbh);
- }/*}}}*/
-
- function new_token($consumer, $type="request") {/*{{{*/
- $key = md5(time());
- $secret = time() + time();
- $token = new OAuthToken($key, md5(md5($secret)));
- if (!dba_insert("${type}_$key", serialize($token), $this->dbh)) {
- throw new OAuthException("doooom!");
- }
- return $token;
- }/*}}}*/
-
- function new_request_token($consumer) {/*{{{*/
- return $this->new_token($consumer, "request");
- }/*}}}*/
-
- function new_access_token($token, $consumer) {/*{{{*/
-
- $token = $this->new_token($consumer, 'access');
- dba_delete("request_" . $token->key, $this->dbh);
- return $token;
- }/*}}}*/
-}/*}}}*/
-
-class OAuthUtil {/*{{{*/
- public static function urlencodeRFC3986($string) {/*{{{*/
- return str_replace('%7E', '~', rawurlencode($string));
- }/*}}}*/
-
- public static function urldecodeRFC3986($string) {/*{{{*/
- return rawurldecode($string);
- }/*}}}*/
-}/*}}}*/
-
-?> \ No newline at end of file
diff --git a/3rdparty/Google/common.inc.php b/3rdparty/Google/common.inc.php
deleted file mode 100755
index 57185cdc4d8..00000000000
--- a/3rdparty/Google/common.inc.php
+++ /dev/null
@@ -1,185 +0,0 @@
-<?php
-/* Copyright (c) 2009 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Author: Eric Bidelman <e.bidelman@google.com>
- */
-
-$PRIV_KEY_FILE = '/path/to/your/rsa_private_key.pem';
-
-// OAuth library - http://oauth.googlecode.com/svn/code/php/
-require_once('OAuth.php');
-
-// Google's accepted signature methods
-$hmac_method = new OAuthSignatureMethod_HMAC_SHA1();
-$rsa_method = new OAuthSignatureMethod_RSA_SHA1();
-$SIG_METHODS = array($rsa_method->get_name() => $rsa_method,
- $hmac_method->get_name() => $hmac_method);
-
-/**
- * Makes an HTTP request to the specified URL
- *
- * @param string $http_method The HTTP method (GET, POST, PUT, DELETE)
- * @param string $url Full URL of the resource to access
- * @param array $extraHeaders (optional) Additional headers to include in each
- * request. Elements are header/value pair strings ('Host: example.com')
- * @param string $postData (optional) POST/PUT request body
- * @param bool $returnResponseHeaders True if resp. headers should be returned.
- * @return string Response body from the server
- */
-function send_signed_request($http_method, $url, $extraHeaders=null,
- $postData=null, $returnResponseHeaders=true) {
- $curl = curl_init($url);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($curl, CURLOPT_FAILONERROR, false);
- curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
-
- // Return request headers in the reponse
-// curl_setopt($curl, CURLINFO_HEADER_OUT, true);
-
- // Return response headers ni the response?
- if ($returnResponseHeaders) {
- curl_setopt($curl, CURLOPT_HEADER, true);
- }
-
- $headers = array();
- //$headers[] = 'GData-Version: 2.0'; // use GData v2 by default
- if (is_array($extraHeaders)) {
- $headers = array_merge($headers, $extraHeaders);
- }
-
- // Setup default curl options for each type of HTTP request.
- // This is also a great place to add additional headers for each request.
- switch($http_method) {
- case 'GET':
- curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
- break;
- case 'POST':
- curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
- curl_setopt($curl, CURLOPT_POST, 1);
- curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
- break;
- case 'PUT':
- $headers[] = 'If-Match: *';
- curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
- curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $http_method);
- curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
- break;
- case 'DELETE':
- $headers[] = 'If-Match: *';
- curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
- curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $http_method);
- break;
- default:
- curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
- }
-
- // Execute the request. If an error occures, fill the response body with it.
- $response = curl_exec($curl);
- if (!$response) {
- $response = curl_error($curl);
- }
-
- // Add server's response headers to our response body
- $response = curl_getinfo($curl, CURLINFO_HEADER_OUT) . $response;
-
- curl_close($curl);
-
- return $response;
-}
-
-/**
-* Takes XML as a string and returns it nicely indented
-*
-* @param string $xml The xml to beautify
-* @param boolean $html_output True if returned XML should be escaped for HTML.
-* @return string The beautified xml
-*/
-function xml_pretty_printer($xml, $html_output=false) {
- $xml_obj = new SimpleXMLElement($xml);
- $level = 2;
-
- // Get an array containing each XML element
- $xml = explode("\n", preg_replace('/>\s*</', ">\n<", $xml_obj->asXML()));
-
- // Hold current indentation level
- $indent = 0;
-
- $pretty = array();
-
- // Shift off opening XML tag if present
- if (count($xml) && preg_match('/^<\?\s*xml/', $xml[0])) {
- $pretty[] = array_shift($xml);
- }
-
- foreach ($xml as $el) {
- if (preg_match('/^<([\w])+[^>\/]*>$/U', $el)) {
- // opening tag, increase indent
- $pretty[] = str_repeat(' ', $indent) . $el;
- $indent += $level;
- } else {
- if (preg_match('/^<\/.+>$/', $el)) {
- $indent -= $level; // closing tag, decrease indent
- }
- if ($indent < 0) {
- $indent += $level;
- }
- $pretty[] = str_repeat(' ', $indent) . $el;
- }
- }
-
- $xml = implode("\n", $pretty);
- return $html_output ? htmlentities($xml) : $xml;
-}
-
-/**
- * Joins key/value pairs by $inner_glue and each pair together by $outer_glue.
- *
- * Example: implode_assoc('=', '&', array('a' => 1, 'b' => 2)) === 'a=1&b=2'
- *
- * @param string $inner_glue What to implode each key/value pair with
- * @param string $outer_glue What to impode each key/value string subset with
- * @param array $array Associative array of query parameters
- * @return string Urlencoded string of query parameters
- */
-function implode_assoc($inner_glue, $outer_glue, $array) {
- $output = array();
- foreach($array as $key => $item) {
- $output[] = $key . $inner_glue . urlencode($item);
- }
- return implode($outer_glue, $output);
-}
-
-/**
- * Explodes a string of key/value url parameters into an associative array.
- * This method performs the compliment operations of implode_assoc().
- *
- * Example: explode_assoc('=', '&', 'a=1&b=2') === array('a' => 1, 'b' => 2)
- *
- * @param string $inner_glue What each key/value pair is joined with
- * @param string $outer_glue What each set of key/value pairs is joined with.
- * @param array $array Associative array of query parameters
- * @return array Urlencoded string of query parameters
- */
-function explode_assoc($inner_glue, $outer_glue, $params) {
- $tempArr = explode($outer_glue, $params);
- foreach($tempArr as $val) {
- $pos = strpos($val, $inner_glue);
- $key = substr($val, 0, $pos);
- $array2[$key] = substr($val, $pos + 1, strlen($val));
- }
- return $array2;
-}
-
-?> \ No newline at end of file
diff --git a/3rdparty/MDB2.php b/3rdparty/MDB2.php
deleted file mode 100644
index a0ead9b9bcf..00000000000
--- a/3rdparty/MDB2.php
+++ /dev/null
@@ -1,4587 +0,0 @@
-<?php
-// vim: set et ts=4 sw=4 fdm=marker:
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2007 Manuel Lemos, Tomas V.V.Cox, |
-// | Stig. S. Bakken, Lukas Smith |
-// | All rights reserved. |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
-// | API as well as database abstraction for PHP applications. |
-// | This LICENSE is in the BSD license style. |
-// | |
-// | Redistribution and use in source and binary forms, with or without |
-// | modification, are permitted provided that the following conditions |
-// | are met: |
-// | |
-// | Redistributions of source code must retain the above copyright |
-// | notice, this list of conditions and the following disclaimer. |
-// | |
-// | Redistributions in binary form must reproduce the above copyright |
-// | notice, this list of conditions and the following disclaimer in the |
-// | documentation and/or other materials provided with the distribution. |
-// | |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission. |
-// | |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-// | POSSIBILITY OF SUCH DAMAGE. |
-// +----------------------------------------------------------------------+
-// | Author: Lukas Smith <smith@pooteeweet.org> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-
-/**
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-
-require_once 'PEAR.php';
-
-// {{{ Error constants
-
-/**
- * The method mapErrorCode in each MDB2_dbtype implementation maps
- * native error codes to one of these.
- *
- * If you add an error code here, make sure you also add a textual
- * version of it in MDB2::errorMessage().
- */
-
-define('MDB2_OK', true);
-define('MDB2_ERROR', -1);
-define('MDB2_ERROR_SYNTAX', -2);
-define('MDB2_ERROR_CONSTRAINT', -3);
-define('MDB2_ERROR_NOT_FOUND', -4);
-define('MDB2_ERROR_ALREADY_EXISTS', -5);
-define('MDB2_ERROR_UNSUPPORTED', -6);
-define('MDB2_ERROR_MISMATCH', -7);
-define('MDB2_ERROR_INVALID', -8);
-define('MDB2_ERROR_NOT_CAPABLE', -9);
-define('MDB2_ERROR_TRUNCATED', -10);
-define('MDB2_ERROR_INVALID_NUMBER', -11);
-define('MDB2_ERROR_INVALID_DATE', -12);
-define('MDB2_ERROR_DIVZERO', -13);
-define('MDB2_ERROR_NODBSELECTED', -14);
-define('MDB2_ERROR_CANNOT_CREATE', -15);
-define('MDB2_ERROR_CANNOT_DELETE', -16);
-define('MDB2_ERROR_CANNOT_DROP', -17);
-define('MDB2_ERROR_NOSUCHTABLE', -18);
-define('MDB2_ERROR_NOSUCHFIELD', -19);
-define('MDB2_ERROR_NEED_MORE_DATA', -20);
-define('MDB2_ERROR_NOT_LOCKED', -21);
-define('MDB2_ERROR_VALUE_COUNT_ON_ROW', -22);
-define('MDB2_ERROR_INVALID_DSN', -23);
-define('MDB2_ERROR_CONNECT_FAILED', -24);
-define('MDB2_ERROR_EXTENSION_NOT_FOUND',-25);
-define('MDB2_ERROR_NOSUCHDB', -26);
-define('MDB2_ERROR_ACCESS_VIOLATION', -27);
-define('MDB2_ERROR_CANNOT_REPLACE', -28);
-define('MDB2_ERROR_CONSTRAINT_NOT_NULL',-29);
-define('MDB2_ERROR_DEADLOCK', -30);
-define('MDB2_ERROR_CANNOT_ALTER', -31);
-define('MDB2_ERROR_MANAGER', -32);
-define('MDB2_ERROR_MANAGER_PARSE', -33);
-define('MDB2_ERROR_LOADMODULE', -34);
-define('MDB2_ERROR_INSUFFICIENT_DATA', -35);
-define('MDB2_ERROR_NO_PERMISSION', -36);
-define('MDB2_ERROR_DISCONNECT_FAILED', -37);
-
-// }}}
-// {{{ Verbose constants
-/**
- * These are just helper constants to more verbosely express parameters to prepare()
- */
-
-define('MDB2_PREPARE_MANIP', false);
-define('MDB2_PREPARE_RESULT', null);
-
-// }}}
-// {{{ Fetchmode constants
-
-/**
- * This is a special constant that tells MDB2 the user hasn't specified
- * any particular get mode, so the default should be used.
- */
-define('MDB2_FETCHMODE_DEFAULT', 0);
-
-/**
- * Column data indexed by numbers, ordered from 0 and up
- */
-define('MDB2_FETCHMODE_ORDERED', 1);
-
-/**
- * Column data indexed by column names
- */
-define('MDB2_FETCHMODE_ASSOC', 2);
-
-/**
- * Column data as object properties
- */
-define('MDB2_FETCHMODE_OBJECT', 3);
-
-/**
- * For multi-dimensional results: normally the first level of arrays
- * is the row number, and the second level indexed by column number or name.
- * MDB2_FETCHMODE_FLIPPED switches this order, so the first level of arrays
- * is the column name, and the second level the row number.
- */
-define('MDB2_FETCHMODE_FLIPPED', 4);
-
-// }}}
-// {{{ Portability mode constants
-
-/**
- * Portability: turn off all portability features.
- * @see MDB2_Driver_Common::setOption()
- */
-define('MDB2_PORTABILITY_NONE', 0);
-
-/**
- * Portability: convert names of tables and fields to case defined in the
- * "field_case" option when using the query*(), fetch*() and tableInfo() methods.
- * @see MDB2_Driver_Common::setOption()
- */
-define('MDB2_PORTABILITY_FIX_CASE', 1);
-
-/**
- * Portability: right trim the data output by query*() and fetch*().
- * @see MDB2_Driver_Common::setOption()
- */
-define('MDB2_PORTABILITY_RTRIM', 2);
-
-/**
- * Portability: force reporting the number of rows deleted.
- * @see MDB2_Driver_Common::setOption()
- */
-define('MDB2_PORTABILITY_DELETE_COUNT', 4);
-
-/**
- * Portability: not needed in MDB2 (just left here for compatibility to DB)
- * @see MDB2_Driver_Common::setOption()
- */
-define('MDB2_PORTABILITY_NUMROWS', 8);
-
-/**
- * Portability: makes certain error messages in certain drivers compatible
- * with those from other DBMS's.
- *
- * + mysql, mysqli: change unique/primary key constraints
- * MDB2_ERROR_ALREADY_EXISTS -> MDB2_ERROR_CONSTRAINT
- *
- * + odbc(access): MS's ODBC driver reports 'no such field' as code
- * 07001, which means 'too few parameters.' When this option is on
- * that code gets mapped to MDB2_ERROR_NOSUCHFIELD.
- *
- * @see MDB2_Driver_Common::setOption()
- */
-define('MDB2_PORTABILITY_ERRORS', 16);
-
-/**
- * Portability: convert empty values to null strings in data output by
- * query*() and fetch*().
- * @see MDB2_Driver_Common::setOption()
- */
-define('MDB2_PORTABILITY_EMPTY_TO_NULL', 32);
-
-/**
- * Portability: removes database/table qualifiers from associative indexes
- * @see MDB2_Driver_Common::setOption()
- */
-define('MDB2_PORTABILITY_FIX_ASSOC_FIELD_NAMES', 64);
-
-/**
- * Portability: turn on all portability features.
- * @see MDB2_Driver_Common::setOption()
- */
-define('MDB2_PORTABILITY_ALL', 127);
-
-// }}}
-// {{{ Globals for class instance tracking
-
-/**
- * These are global variables that are used to track the various class instances
- */
-
-$GLOBALS['_MDB2_databases'] = array();
-$GLOBALS['_MDB2_dsninfo_default'] = array(
- 'phptype' => false,
- 'dbsyntax' => false,
- 'username' => false,
- 'password' => false,
- 'protocol' => false,
- 'hostspec' => false,
- 'port' => false,
- 'socket' => false,
- 'database' => false,
- 'mode' => false,
-);
-
-// }}}
-// {{{ class MDB2
-
-/**
- * The main 'MDB2' class is simply a container class with some static
- * methods for creating DB objects as well as some utility functions
- * common to all parts of DB.
- *
- * The object model of MDB2 is as follows (indentation means inheritance):
- *
- * MDB2 The main MDB2 class. This is simply a utility class
- * with some 'static' methods for creating MDB2 objects as
- * well as common utility functions for other MDB2 classes.
- *
- * MDB2_Driver_Common The base for each MDB2 implementation. Provides default
- * | implementations (in OO lingo virtual methods) for
- * | the actual DB implementations as well as a bunch of
- * | query utility functions.
- * |
- * +-MDB2_Driver_mysql The MDB2 implementation for MySQL. Inherits MDB2_Driver_Common.
- * When calling MDB2::factory or MDB2::connect for MySQL
- * connections, the object returned is an instance of this
- * class.
- * +-MDB2_Driver_pgsql The MDB2 implementation for PostGreSQL. Inherits MDB2_Driver_Common.
- * When calling MDB2::factory or MDB2::connect for PostGreSQL
- * connections, the object returned is an instance of this
- * class.
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2
-{
- // {{{ function setOptions($db, $options)
-
- /**
- * set option array in an exiting database object
- *
- * @param MDB2_Driver_Common MDB2 object
- * @param array An associative array of option names and their values.
- *
- * @return mixed MDB2_OK or a PEAR Error object
- *
- * @access public
- */
- static function setOptions($db, $options)
- {
- if (is_array($options)) {
- foreach ($options as $option => $value) {
- $test = $db->setOption($option, $value);
- if (MDB2::isError($test)) {
- return $test;
- }
- }
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ function classExists($classname)
-
- /**
- * Checks if a class exists without triggering __autoload
- *
- * @param string classname
- *
- * @return bool true success and false on error
- * @static
- * @access public
- */
- static function classExists($classname)
- {
- return class_exists($classname, false);
- }
-
- // }}}
- // {{{ function loadClass($class_name, $debug)
-
- /**
- * Loads a PEAR class.
- *
- * @param string classname to load
- * @param bool if errors should be suppressed
- *
- * @return mixed true success or PEAR_Error on failure
- *
- * @access public
- */
- static function loadClass($class_name, $debug)
- {
- if (!MDB2::classExists($class_name)) {
- $file_name = str_replace('_', DIRECTORY_SEPARATOR, $class_name).'.php';
- if ($debug) {
- $include = include_once($file_name);
- } else {
- $include = @include_once($file_name);
- }
- if (!$include) {
- if (!MDB2::fileExists($file_name)) {
- $msg = "unable to find package '$class_name' file '$file_name'";
- } else {
- $msg = "unable to load class '$class_name' from file '$file_name'";
- }
- $err = MDB2::raiseError(MDB2_ERROR_NOT_FOUND, null, null, $msg);
- return $err;
- }
- if (!MDB2::classExists($class_name)) {
- $msg = "unable to load class '$class_name' from file '$file_name'";
- $err = MDB2::raiseError(MDB2_ERROR_NOT_FOUND, null, null, $msg);
- return $err;
- }
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ function factory($dsn, $options = false)
-
- /**
- * Create a new MDB2 object for the specified database type
- *
- * @param mixed 'data source name', see the MDB2::parseDSN
- * method for a description of the dsn format.
- * Can also be specified as an array of the
- * format returned by MDB2::parseDSN.
- * @param array An associative array of option names and
- * their values.
- *
- * @return mixed a newly created MDB2 object, or false on error
- *
- * @access public
- */
- static function factory($dsn, $options = false)
- {
- $dsninfo = MDB2::parseDSN($dsn);
- if (empty($dsninfo['phptype'])) {
- $err = MDB2::raiseError(MDB2_ERROR_NOT_FOUND,
- null, null, 'no RDBMS driver specified');
- return $err;
- }
- $class_name = 'MDB2_Driver_'.$dsninfo['phptype'];
-
- $debug = (!empty($options['debug']));
- $err = MDB2::loadClass($class_name, $debug);
- if (MDB2::isError($err)) {
- return $err;
- }
-
- $db = new $class_name();
- $db->setDSN($dsninfo);
- $err = MDB2::setOptions($db, $options);
- if (MDB2::isError($err)) {
- return $err;
- }
-
- return $db;
- }
-
- // }}}
- // {{{ function connect($dsn, $options = false)
-
- /**
- * Create a new MDB2_Driver_* connection object and connect to the specified
- * database
- *
- * @param mixed $dsn 'data source name', see the MDB2::parseDSN
- * method for a description of the dsn format.
- * Can also be specified as an array of the
- * format returned by MDB2::parseDSN.
- * @param array $options An associative array of option names and
- * their values.
- *
- * @return mixed a newly created MDB2 connection object, or a MDB2
- * error object on error
- *
- * @access public
- * @see MDB2::parseDSN
- */
- static function connect($dsn, $options = false)
- {
- $db = MDB2::factory($dsn, $options);
- if (MDB2::isError($db)) {
- return $db;
- }
-
- $err = $db->connect();
- if (MDB2::isError($err)) {
- $dsn = $db->getDSN('string', 'xxx');
- $db->disconnect();
- $err->addUserInfo($dsn);
- return $err;
- }
-
- return $db;
- }
-
- // }}}
- // {{{ function singleton($dsn = null, $options = false)
-
- /**
- * Returns a MDB2 connection with the requested DSN.
- * A new MDB2 connection object is only created if no object with the
- * requested DSN exists yet.
- *
- * @param mixed 'data source name', see the MDB2::parseDSN
- * method for a description of the dsn format.
- * Can also be specified as an array of the
- * format returned by MDB2::parseDSN.
- * @param array An associative array of option names and
- * their values.
- *
- * @return mixed a newly created MDB2 connection object, or a MDB2
- * error object on error
- *
- * @access public
- * @see MDB2::parseDSN
- */
- static function singleton($dsn = null, $options = false)
- {
- if ($dsn) {
- $dsninfo = MDB2::parseDSN($dsn);
- $dsninfo = array_merge($GLOBALS['_MDB2_dsninfo_default'], $dsninfo);
- $keys = array_keys($GLOBALS['_MDB2_databases']);
- for ($i=0, $j=count($keys); $i<$j; ++$i) {
- if (isset($GLOBALS['_MDB2_databases'][$keys[$i]])) {
- $tmp_dsn = $GLOBALS['_MDB2_databases'][$keys[$i]]->getDSN('array');
- if (count(array_diff_assoc($tmp_dsn, $dsninfo)) == 0) {
- MDB2::setOptions($GLOBALS['_MDB2_databases'][$keys[$i]], $options);
- return $GLOBALS['_MDB2_databases'][$keys[$i]];
- }
- }
- }
- } elseif (is_array($GLOBALS['_MDB2_databases']) && reset($GLOBALS['_MDB2_databases'])) {
- return $GLOBALS['_MDB2_databases'][key($GLOBALS['_MDB2_databases'])];
- }
- $db = MDB2::factory($dsn, $options);
- return $db;
- }
-
- // }}}
- // {{{ function areEquals()
-
- /**
- * It looks like there's a memory leak in array_diff() in PHP 5.1.x,
- * so use this method instead.
- * @see http://pear.php.net/bugs/bug.php?id=11790
- *
- * @param array $arr1
- * @param array $arr2
- * @return boolean
- */
- static function areEquals($arr1, $arr2)
- {
- if (count($arr1) != count($arr2)) {
- return false;
- }
- foreach (array_keys($arr1) as $k) {
- if (!array_key_exists($k, $arr2) || $arr1[$k] != $arr2[$k]) {
- return false;
- }
- }
- return true;
- }
-
- // }}}
- // {{{ function loadFile($file)
-
- /**
- * load a file (like 'Date')
- *
- * @param string $file name of the file in the MDB2 directory (without '.php')
- *
- * @return string name of the file that was included
- *
- * @access public
- */
- static function loadFile($file)
- {
- $file_name = 'MDB2'.DIRECTORY_SEPARATOR.$file.'.php';
- if (!MDB2::fileExists($file_name)) {
- return MDB2::raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- 'unable to find: '.$file_name);
- }
- if (!include_once($file_name)) {
- return MDB2::raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- 'unable to load driver class: '.$file_name);
- }
- return $file_name;
- }
-
- // }}}
- // {{{ function apiVersion()
-
- /**
- * Return the MDB2 API version
- *
- * @return string the MDB2 API version number
- *
- * @access public
- */
- function apiVersion()
- {
- return '@package_version@';
- }
-
- // }}}
- // {{{ function &raiseError($code = null, $mode = null, $options = null, $userinfo = null)
-
- /**
- * This method is used to communicate an error and invoke error
- * callbacks etc. Basically a wrapper for PEAR::raiseError
- * without the message string.
- *
- * @param mixed int error code
- *
- * @param int error mode, see PEAR_Error docs
- *
- * @param mixed If error mode is PEAR_ERROR_TRIGGER, this is the
- * error level (E_USER_NOTICE etc). If error mode is
- * PEAR_ERROR_CALLBACK, this is the callback function,
- * either as a function name, or as an array of an
- * object and method name. For other error modes this
- * parameter is ignored.
- *
- * @param string Extra debug information. Defaults to the last
- * query and native error code.
- *
- * @return PEAR_Error instance of a PEAR Error object
- *
- * @access private
- * @see PEAR_Error
- */
- public static function &raiseError($code = null,
- $mode = null,
- $options = null,
- $userinfo = null,
- $dummy1 = null,
- $dummy2 = null,
- $dummy3 = false)
- {
- $pear = new PEAR;
- $err = $pear->raiseError(null, $code, $mode, $options, $userinfo, 'MDB2_Error', true);
- return $err;
- }
-
- // }}}
- // {{{ function isError($data, $code = null)
-
- /**
- * Tell whether a value is a MDB2 error.
- *
- * @param mixed the value to test
- * @param int if is an error object, return true
- * only if $code is a string and
- * $db->getMessage() == $code or
- * $code is an integer and $db->getCode() == $code
- *
- * @return bool true if parameter is an error
- *
- * @access public
- */
- static function isError($data, $code = null)
- {
- if ($data instanceof MDB2_Error) {
- if (null === $code) {
- return true;
- }
- if (is_string($code)) {
- return $data->getMessage() === $code;
- }
- return in_array($data->getCode(), (array)$code);
- }
- return false;
- }
-
- // }}}
- // {{{ function isConnection($value)
-
- /**
- * Tell whether a value is a MDB2 connection
- *
- * @param mixed value to test
- *
- * @return bool whether $value is a MDB2 connection
- * @access public
- */
- static function isConnection($value)
- {
- return ($value instanceof MDB2_Driver_Common);
- }
-
- // }}}
- // {{{ function isResult($value)
-
- /**
- * Tell whether a value is a MDB2 result
- *
- * @param mixed $value value to test
- *
- * @return bool whether $value is a MDB2 result
- *
- * @access public
- */
- function isResult($value)
- {
- return ($value instanceof MDB2_Result);
- }
-
- // }}}
- // {{{ function isResultCommon($value)
-
- /**
- * Tell whether a value is a MDB2 result implementing the common interface
- *
- * @param mixed $value value to test
- *
- * @return bool whether $value is a MDB2 result implementing the common interface
- *
- * @access public
- */
- static function isResultCommon($value)
- {
- return ($value instanceof MDB2_Result_Common);
- }
-
- // }}}
- // {{{ function isStatement($value)
-
- /**
- * Tell whether a value is a MDB2 statement interface
- *
- * @param mixed value to test
- *
- * @return bool whether $value is a MDB2 statement interface
- *
- * @access public
- */
- function isStatement($value)
- {
- return ($value instanceof MDB2_Statement_Common);
- }
-
- // }}}
- // {{{ function errorMessage($value = null)
-
- /**
- * Return a textual error message for a MDB2 error code
- *
- * @param int|array integer error code,
- null to get the current error code-message map,
- or an array with a new error code-message map
- *
- * @return string error message, or false if the error code was
- * not recognized
- *
- * @access public
- */
- static function errorMessage($value = null)
- {
- static $errorMessages;
-
- if (is_array($value)) {
- $errorMessages = $value;
- return MDB2_OK;
- }
-
- if (!isset($errorMessages)) {
- $errorMessages = array(
- MDB2_OK => 'no error',
- MDB2_ERROR => 'unknown error',
- MDB2_ERROR_ALREADY_EXISTS => 'already exists',
- MDB2_ERROR_CANNOT_CREATE => 'can not create',
- MDB2_ERROR_CANNOT_ALTER => 'can not alter',
- MDB2_ERROR_CANNOT_REPLACE => 'can not replace',
- MDB2_ERROR_CANNOT_DELETE => 'can not delete',
- MDB2_ERROR_CANNOT_DROP => 'can not drop',
- MDB2_ERROR_CONSTRAINT => 'constraint violation',
- MDB2_ERROR_CONSTRAINT_NOT_NULL=> 'null value violates not-null constraint',
- MDB2_ERROR_DIVZERO => 'division by zero',
- MDB2_ERROR_INVALID => 'invalid',
- MDB2_ERROR_INVALID_DATE => 'invalid date or time',
- MDB2_ERROR_INVALID_NUMBER => 'invalid number',
- MDB2_ERROR_MISMATCH => 'mismatch',
- MDB2_ERROR_NODBSELECTED => 'no database selected',
- MDB2_ERROR_NOSUCHFIELD => 'no such field',
- MDB2_ERROR_NOSUCHTABLE => 'no such table',
- MDB2_ERROR_NOT_CAPABLE => 'MDB2 backend not capable',
- MDB2_ERROR_NOT_FOUND => 'not found',
- MDB2_ERROR_NOT_LOCKED => 'not locked',
- MDB2_ERROR_SYNTAX => 'syntax error',
- MDB2_ERROR_UNSUPPORTED => 'not supported',
- MDB2_ERROR_VALUE_COUNT_ON_ROW => 'value count on row',
- MDB2_ERROR_INVALID_DSN => 'invalid DSN',
- MDB2_ERROR_CONNECT_FAILED => 'connect failed',
- MDB2_ERROR_NEED_MORE_DATA => 'insufficient data supplied',
- MDB2_ERROR_EXTENSION_NOT_FOUND=> 'extension not found',
- MDB2_ERROR_NOSUCHDB => 'no such database',
- MDB2_ERROR_ACCESS_VIOLATION => 'insufficient permissions',
- MDB2_ERROR_LOADMODULE => 'error while including on demand module',
- MDB2_ERROR_TRUNCATED => 'truncated',
- MDB2_ERROR_DEADLOCK => 'deadlock detected',
- MDB2_ERROR_NO_PERMISSION => 'no permission',
- MDB2_ERROR_DISCONNECT_FAILED => 'disconnect failed',
- );
- }
-
- if (null === $value) {
- return $errorMessages;
- }
-
- if (MDB2::isError($value)) {
- $value = $value->getCode();
- }
-
- return isset($errorMessages[$value]) ?
- $errorMessages[$value] : $errorMessages[MDB2_ERROR];
- }
-
- // }}}
- // {{{ function parseDSN($dsn)
-
- /**
- * Parse a data source name.
- *
- * Additional keys can be added by appending a URI query string to the
- * end of the DSN.
- *
- * The format of the supplied DSN is in its fullest form:
- * <code>
- * phptype(dbsyntax)://username:password@protocol+hostspec/database?option=8&another=true
- * </code>
- *
- * Most variations are allowed:
- * <code>
- * phptype://username:password@protocol+hostspec:110//usr/db_file.db?mode=0644
- * phptype://username:password@hostspec/database_name
- * phptype://username:password@hostspec
- * phptype://username@hostspec
- * phptype://hostspec/database
- * phptype://hostspec
- * phptype(dbsyntax)
- * phptype
- * </code>
- *
- * @param string Data Source Name to be parsed
- *
- * @return array an associative array with the following keys:
- * + phptype: Database backend used in PHP (mysql, odbc etc.)
- * + dbsyntax: Database used with regards to SQL syntax etc.
- * + protocol: Communication protocol to use (tcp, unix etc.)
- * + hostspec: Host specification (hostname[:port])
- * + database: Database to use on the DBMS server
- * + username: User name for login
- * + password: Password for login
- *
- * @access public
- * @author Tomas V.V.Cox <cox@idecnet.com>
- */
- static function parseDSN($dsn)
- {
- $parsed = $GLOBALS['_MDB2_dsninfo_default'];
-
- if (is_array($dsn)) {
- $dsn = array_merge($parsed, $dsn);
- if (!$dsn['dbsyntax']) {
- $dsn['dbsyntax'] = $dsn['phptype'];
- }
- return $dsn;
- }
-
- // Find phptype and dbsyntax
- if (($pos = strpos($dsn, '://')) !== false) {
- $str = substr($dsn, 0, $pos);
- $dsn = substr($dsn, $pos + 3);
- } else {
- $str = $dsn;
- $dsn = null;
- }
-
- // Get phptype and dbsyntax
- // $str => phptype(dbsyntax)
- if (preg_match('|^(.+?)\((.*?)\)$|', $str, $arr)) {
- $parsed['phptype'] = $arr[1];
- $parsed['dbsyntax'] = !$arr[2] ? $arr[1] : $arr[2];
- } else {
- $parsed['phptype'] = $str;
- $parsed['dbsyntax'] = $str;
- }
-
- if (!count($dsn)) {
- return $parsed;
- }
-
- // Get (if found): username and password
- // $dsn => username:password@protocol+hostspec/database
- if (($at = strrpos($dsn,'@')) !== false) {
- $str = substr($dsn, 0, $at);
- $dsn = substr($dsn, $at + 1);
- if (($pos = strpos($str, ':')) !== false) {
- $parsed['username'] = rawurldecode(substr($str, 0, $pos));
- $parsed['password'] = rawurldecode(substr($str, $pos + 1));
- } else {
- $parsed['username'] = rawurldecode($str);
- }
- }
-
- // Find protocol and hostspec
-
- // $dsn => proto(proto_opts)/database
- if (preg_match('|^([^(]+)\((.*?)\)/?(.*?)$|', $dsn, $match)) {
- $proto = $match[1];
- $proto_opts = $match[2] ? $match[2] : false;
- $dsn = $match[3];
-
- // $dsn => protocol+hostspec/database (old format)
- } else {
- if (strpos($dsn, '+') !== false) {
- list($proto, $dsn) = explode('+', $dsn, 2);
- }
- if ( strpos($dsn, '//') === 0
- && strpos($dsn, '/', 2) !== false
- && $parsed['phptype'] == 'oci8'
- ) {
- //oracle's "Easy Connect" syntax:
- //"username/password@[//]host[:port][/service_name]"
- //e.g. "scott/tiger@//mymachine:1521/oracle"
- $proto_opts = $dsn;
- $pos = strrpos($proto_opts, '/');
- $dsn = substr($proto_opts, $pos + 1);
- $proto_opts = substr($proto_opts, 0, $pos);
- } elseif (strpos($dsn, '/') !== false) {
- list($proto_opts, $dsn) = explode('/', $dsn, 2);
- } else {
- $proto_opts = $dsn;
- $dsn = null;
- }
- }
-
- // process the different protocol options
- $parsed['protocol'] = (!empty($proto)) ? $proto : 'tcp';
- $proto_opts = rawurldecode($proto_opts);
- if (strpos($proto_opts, ':') !== false) {
- list($proto_opts, $parsed['port']) = explode(':', $proto_opts);
- }
- if ($parsed['protocol'] == 'tcp') {
- $parsed['hostspec'] = $proto_opts;
- } elseif ($parsed['protocol'] == 'unix') {
- $parsed['socket'] = $proto_opts;
- }
-
- // Get dabase if any
- // $dsn => database
- if ($dsn) {
- // /database
- if (($pos = strpos($dsn, '?')) === false) {
- $parsed['database'] = rawurldecode($dsn);
- // /database?param1=value1&param2=value2
- } else {
- $parsed['database'] = rawurldecode(substr($dsn, 0, $pos));
- $dsn = substr($dsn, $pos + 1);
- if (strpos($dsn, '&') !== false) {
- $opts = explode('&', $dsn);
- } else { // database?param1=value1
- $opts = array($dsn);
- }
- foreach ($opts as $opt) {
- list($key, $value) = explode('=', $opt);
- if (!array_key_exists($key, $parsed) || false === $parsed[$key]) {
- // don't allow params overwrite
- $parsed[$key] = rawurldecode($value);
- }
- }
- }
- }
-
- return $parsed;
- }
-
- // }}}
- // {{{ function fileExists($file)
-
- /**
- * Checks if a file exists in the include path
- *
- * @param string filename
- *
- * @return bool true success and false on error
- *
- * @access public
- */
- static function fileExists($file)
- {
- // safe_mode does notwork with is_readable()
- if (!@ini_get('safe_mode')) {
- $dirs = explode(PATH_SEPARATOR, ini_get('include_path'));
- foreach ($dirs as $dir) {
- if (is_readable($dir . DIRECTORY_SEPARATOR . $file)) {
- return true;
- }
- }
- } else {
- $fp = @fopen($file, 'r', true);
- if (is_resource($fp)) {
- @fclose($fp);
- return true;
- }
- }
- return false;
- }
- // }}}
-}
-
-// }}}
-// {{{ class MDB2_Error extends PEAR_Error
-
-/**
- * MDB2_Error implements a class for reporting portable database error
- * messages.
- *
- * @package MDB2
- * @category Database
- * @author Stig Bakken <ssb@fast.no>
- */
-class MDB2_Error extends PEAR_Error
-{
- // {{{ constructor: function MDB2_Error($code = MDB2_ERROR, $mode = PEAR_ERROR_RETURN, $level = E_USER_NOTICE, $debuginfo = null)
-
- /**
- * MDB2_Error constructor.
- *
- * @param mixed MDB2 error code, or string with error message.
- * @param int what 'error mode' to operate in
- * @param int what error level to use for $mode & PEAR_ERROR_TRIGGER
- * @param mixed additional debug info, such as the last query
- */
- function __construct($code = MDB2_ERROR, $mode = PEAR_ERROR_RETURN,
- $level = E_USER_NOTICE, $debuginfo = null, $dummy = null)
- {
- if (null === $code) {
- $code = MDB2_ERROR;
- }
- $this->PEAR_Error('MDB2 Error: '.MDB2::errorMessage($code), $code,
- $mode, $level, $debuginfo);
- }
-
- // }}}
-}
-
-// }}}
-// {{{ class MDB2_Driver_Common extends PEAR
-
-/**
- * MDB2_Driver_Common: Base class that is extended by each MDB2 driver
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Driver_Common
-{
- // {{{ Variables (Properties)
-
- /**
- * @var MDB2_Driver_Datatype_Common
- */
- public $datatype;
-
- /**
- * @var MDB2_Extended
- */
- public $extended;
-
- /**
- * @var MDB2_Driver_Function_Common
- */
- public $function;
-
- /**
- * @var MDB2_Driver_Manager_Common
- */
- public $manager;
-
- /**
- * @var MDB2_Driver_Native_Commonn
- */
- public $native;
-
- /**
- * @var MDB2_Driver_Reverse_Common
- */
- public $reverse;
-
- /**
- * index of the MDB2 object within the $GLOBALS['_MDB2_databases'] array
- * @var int
- * @access public
- */
- public $db_index = 0;
-
- /**
- * DSN used for the next query
- * @var array
- * @access protected
- */
- public $dsn = array();
-
- /**
- * DSN that was used to create the current connection
- * @var array
- * @access protected
- */
- public $connected_dsn = array();
-
- /**
- * connection resource
- * @var mixed
- * @access protected
- */
- public $connection = 0;
-
- /**
- * if the current opened connection is a persistent connection
- * @var bool
- * @access protected
- */
- public $opened_persistent;
-
- /**
- * the name of the database for the next query
- * @var string
- * @access public
- */
- public $database_name = '';
-
- /**
- * the name of the database currently selected
- * @var string
- * @access protected
- */
- public $connected_database_name = '';
-
- /**
- * server version information
- * @var string
- * @access protected
- */
- public $connected_server_info = '';
-
- /**
- * list of all supported features of the given driver
- * @var array
- * @access public
- */
- public $supported = array(
- 'sequences' => false,
- 'indexes' => false,
- 'affected_rows' => false,
- 'summary_functions' => false,
- 'order_by_text' => false,
- 'transactions' => false,
- 'savepoints' => false,
- 'current_id' => false,
- 'limit_queries' => false,
- 'LOBs' => false,
- 'replace' => false,
- 'sub_selects' => false,
- 'triggers' => false,
- 'auto_increment' => false,
- 'primary_key' => false,
- 'result_introspection' => false,
- 'prepared_statements' => false,
- 'identifier_quoting' => false,
- 'pattern_escaping' => false,
- 'new_link' => false,
- );
-
- /**
- * Array of supported options that can be passed to the MDB2 instance.
- *
- * The options can be set during object creation, using
- * MDB2::connect(), MDB2::factory() or MDB2::singleton(). The options can
- * also be set after the object is created, using MDB2::setOptions() or
- * MDB2_Driver_Common::setOption().
- * The list of available option includes:
- * <ul>
- * <li>$options['ssl'] -> boolean: determines if ssl should be used for connections</li>
- * <li>$options['field_case'] -> CASE_LOWER|CASE_UPPER: determines what case to force on field/table names</li>
- * <li>$options['disable_query'] -> boolean: determines if queries should be executed</li>
- * <li>$options['result_class'] -> string: class used for result sets</li>
- * <li>$options['buffered_result_class'] -> string: class used for buffered result sets</li>
- * <li>$options['result_wrap_class'] -> string: class used to wrap result sets into</li>
- * <li>$options['result_buffering'] -> boolean should results be buffered or not?</li>
- * <li>$options['fetch_class'] -> string: class to use when fetch mode object is used</li>
- * <li>$options['persistent'] -> boolean: persistent connection?</li>
- * <li>$options['debug'] -> integer: numeric debug level</li>
- * <li>$options['debug_handler'] -> string: function/method that captures debug messages</li>
- * <li>$options['debug_expanded_output'] -> bool: BC option to determine if more context information should be send to the debug handler</li>
- * <li>$options['default_text_field_length'] -> integer: default text field length to use</li>
- * <li>$options['lob_buffer_length'] -> integer: LOB buffer length</li>
- * <li>$options['log_line_break'] -> string: line-break format</li>
- * <li>$options['idxname_format'] -> string: pattern for index name</li>
- * <li>$options['seqname_format'] -> string: pattern for sequence name</li>
- * <li>$options['savepoint_format'] -> string: pattern for auto generated savepoint names</li>
- * <li>$options['statement_format'] -> string: pattern for prepared statement names</li>
- * <li>$options['seqcol_name'] -> string: sequence column name</li>
- * <li>$options['quote_identifier'] -> boolean: if identifier quoting should be done when check_option is used</li>
- * <li>$options['use_transactions'] -> boolean: if transaction use should be enabled</li>
- * <li>$options['decimal_places'] -> integer: number of decimal places to handle</li>
- * <li>$options['portability'] -> integer: portability constant</li>
- * <li>$options['modules'] -> array: short to long module name mapping for __call()</li>
- * <li>$options['emulate_prepared'] -> boolean: force prepared statements to be emulated</li>
- * <li>$options['datatype_map'] -> array: map user defined datatypes to other primitive datatypes</li>
- * <li>$options['datatype_map_callback'] -> array: callback function/method that should be called</li>
- * <li>$options['bindname_format'] -> string: regular expression pattern for named parameters</li>
- * <li>$options['multi_query'] -> boolean: determines if queries returning multiple result sets should be executed</li>
- * <li>$options['max_identifiers_length'] -> integer: max identifier length</li>
- * <li>$options['default_fk_action_onupdate'] -> string: default FOREIGN KEY ON UPDATE action ['RESTRICT'|'NO ACTION'|'SET DEFAULT'|'SET NULL'|'CASCADE']</li>
- * <li>$options['default_fk_action_ondelete'] -> string: default FOREIGN KEY ON DELETE action ['RESTRICT'|'NO ACTION'|'SET DEFAULT'|'SET NULL'|'CASCADE']</li>
- * </ul>
- *
- * @var array
- * @access public
- * @see MDB2::connect()
- * @see MDB2::factory()
- * @see MDB2::singleton()
- * @see MDB2_Driver_Common::setOption()
- */
- public $options = array(
- 'ssl' => false,
- 'field_case' => CASE_LOWER,
- 'disable_query' => false,
- 'result_class' => 'MDB2_Result_%s',
- 'buffered_result_class' => 'MDB2_BufferedResult_%s',
- 'result_wrap_class' => false,
- 'result_buffering' => true,
- 'fetch_class' => 'stdClass',
- 'persistent' => false,
- 'debug' => 0,
- 'debug_handler' => 'MDB2_defaultDebugOutput',
- 'debug_expanded_output' => false,
- 'default_text_field_length' => 4096,
- 'lob_buffer_length' => 8192,
- 'log_line_break' => "\n",
- 'idxname_format' => '%s_idx',
- 'seqname_format' => '%s_seq',
- 'savepoint_format' => 'MDB2_SAVEPOINT_%s',
- 'statement_format' => 'MDB2_STATEMENT_%1$s_%2$s',
- 'seqcol_name' => 'sequence',
- 'quote_identifier' => false,
- 'use_transactions' => true,
- 'decimal_places' => 2,
- 'portability' => MDB2_PORTABILITY_ALL,
- 'modules' => array(
- 'ex' => 'Extended',
- 'dt' => 'Datatype',
- 'mg' => 'Manager',
- 'rv' => 'Reverse',
- 'na' => 'Native',
- 'fc' => 'Function',
- ),
- 'emulate_prepared' => false,
- 'datatype_map' => array(),
- 'datatype_map_callback' => array(),
- 'nativetype_map_callback' => array(),
- 'lob_allow_url_include' => false,
- 'bindname_format' => '(?:\d+)|(?:[a-zA-Z][a-zA-Z0-9_]*)',
- 'max_identifiers_length' => 30,
- 'default_fk_action_onupdate' => 'RESTRICT',
- 'default_fk_action_ondelete' => 'RESTRICT',
- );
-
- /**
- * string array
- * @var string
- * @access public
- */
- public $string_quoting = array(
- 'start' => "'",
- 'end' => "'",
- 'escape' => false,
- 'escape_pattern' => false,
- );
-
- /**
- * identifier quoting
- * @var array
- * @access public
- */
- public $identifier_quoting = array(
- 'start' => '"',
- 'end' => '"',
- 'escape' => '"',
- );
-
- /**
- * sql comments
- * @var array
- * @access protected
- */
- public $sql_comments = array(
- array('start' => '--', 'end' => "\n", 'escape' => false),
- array('start' => '/*', 'end' => '*/', 'escape' => false),
- );
-
- /**
- * comparision wildcards
- * @var array
- * @access protected
- */
- protected $wildcards = array('%', '_');
-
- /**
- * column alias keyword
- * @var string
- * @access protected
- */
- public $as_keyword = ' AS ';
-
- /**
- * warnings
- * @var array
- * @access protected
- */
- public $warnings = array();
-
- /**
- * string with the debugging information
- * @var string
- * @access public
- */
- public $debug_output = '';
-
- /**
- * determine if there is an open transaction
- * @var bool
- * @access protected
- */
- public $in_transaction = false;
-
- /**
- * the smart transaction nesting depth
- * @var int
- * @access protected
- */
- public $nested_transaction_counter = null;
-
- /**
- * the first error that occured inside a nested transaction
- * @var MDB2_Error|bool
- * @access protected
- */
- protected $has_transaction_error = false;
-
- /**
- * result offset used in the next query
- * @var int
- * @access public
- */
- public $offset = 0;
-
- /**
- * result limit used in the next query
- * @var int
- * @access public
- */
- public $limit = 0;
-
- /**
- * Database backend used in PHP (mysql, odbc etc.)
- * @var string
- * @access public
- */
- public $phptype;
-
- /**
- * Database used with regards to SQL syntax etc.
- * @var string
- * @access public
- */
- public $dbsyntax;
-
- /**
- * the last query sent to the driver
- * @var string
- * @access public
- */
- public $last_query;
-
- /**
- * the default fetchmode used
- * @var int
- * @access public
- */
- public $fetchmode = MDB2_FETCHMODE_ORDERED;
-
- /**
- * array of module instances
- * @var array
- * @access protected
- */
- protected $modules = array();
-
- /**
- * determines of the PHP4 destructor emulation has been enabled yet
- * @var array
- * @access protected
- */
- protected $destructor_registered = true;
-
- /**
- * @var PEAR
- */
- protected $pear;
-
- // }}}
- // {{{ constructor: function __construct()
-
- /**
- * Constructor
- */
- function __construct()
- {
- end($GLOBALS['_MDB2_databases']);
- $db_index = key($GLOBALS['_MDB2_databases']) + 1;
- $GLOBALS['_MDB2_databases'][$db_index] = &$this;
- $this->db_index = $db_index;
- $this->pear = new PEAR;
- }
-
- // }}}
- // {{{ destructor: function __destruct()
-
- /**
- * Destructor
- */
- function __destruct()
- {
- $this->disconnect(false);
- }
-
- // }}}
- // {{{ function free()
-
- /**
- * Free the internal references so that the instance can be destroyed
- *
- * @return bool true on success, false if result is invalid
- *
- * @access public
- */
- function free()
- {
- unset($GLOBALS['_MDB2_databases'][$this->db_index]);
- unset($this->db_index);
- return MDB2_OK;
- }
-
- // }}}
- // {{{ function __toString()
-
- /**
- * String conversation
- *
- * @return string representation of the object
- *
- * @access public
- */
- function __toString()
- {
- $info = get_class($this);
- $info.= ': (phptype = '.$this->phptype.', dbsyntax = '.$this->dbsyntax.')';
- if ($this->connection) {
- $info.= ' [connected]';
- }
- return $info;
- }
-
- // }}}
- // {{{ function errorInfo($error = null)
-
- /**
- * This method is used to collect information about an error
- *
- * @param mixed error code or resource
- *
- * @return array with MDB2 errorcode, native error code, native message
- *
- * @access public
- */
- function errorInfo($error = null)
- {
- return array($error, null, null);
- }
-
- // }}}
- // {{{ function &raiseError($code = null, $mode = null, $options = null, $userinfo = null)
-
- /**
- * This method is used to communicate an error and invoke error
- * callbacks etc. Basically a wrapper for PEAR::raiseError
- * without the message string.
- *
- * @param mixed $code integer error code, or a PEAR error object (all
- * other parameters are ignored if this parameter is
- * an object
- * @param int $mode error mode, see PEAR_Error docs
- * @param mixed $options If error mode is PEAR_ERROR_TRIGGER, this is the
- * error level (E_USER_NOTICE etc). If error mode is
- * PEAR_ERROR_CALLBACK, this is the callback function,
- * either as a function name, or as an array of an
- * object and method name. For other error modes this
- * parameter is ignored.
- * @param string $userinfo Extra debug information. Defaults to the last
- * query and native error code.
- * @param string $method name of the method that triggered the error
- * @param string $dummy1 not used
- * @param bool $dummy2 not used
- *
- * @return PEAR_Error instance of a PEAR Error object
- * @access public
- * @see PEAR_Error
- */
- function &raiseError($code = null,
- $mode = null,
- $options = null,
- $userinfo = null,
- $method = null,
- $dummy1 = null,
- $dummy2 = false
- ) {
- $userinfo = "[Error message: $userinfo]\n";
- // The error is yet a MDB2 error object
- if (MDB2::isError($code)) {
- // because we use the static PEAR::raiseError, our global
- // handler should be used if it is set
- if ((null === $mode) && !empty($this->_default_error_mode)) {
- $mode = $this->_default_error_mode;
- $options = $this->_default_error_options;
- }
- if (null === $userinfo) {
- $userinfo = $code->getUserinfo();
- }
- $code = $code->getCode();
- } elseif ($code == MDB2_ERROR_NOT_FOUND) {
- // extension not loaded: don't call $this->errorInfo() or the script
- // will die
- } elseif (isset($this->connection)) {
- if (!empty($this->last_query)) {
- $userinfo.= "[Last executed query: {$this->last_query}]\n";
- }
- $native_errno = $native_msg = null;
- list($code, $native_errno, $native_msg) = $this->errorInfo($code);
- if ((null !== $native_errno) && $native_errno !== '') {
- $userinfo.= "[Native code: $native_errno]\n";
- }
- if ((null !== $native_msg) && $native_msg !== '') {
- $userinfo.= "[Native message: ". strip_tags($native_msg) ."]\n";
- }
- if (null !== $method) {
- $userinfo = $method.': '.$userinfo;
- }
- }
-
- $err = $this->pear->raiseError(null, $code, $mode, $options, $userinfo, 'MDB2_Error', true);
- if ($err->getMode() !== PEAR_ERROR_RETURN
- && isset($this->nested_transaction_counter) && !$this->has_transaction_error) {
- $this->has_transaction_error = $err;
- }
- return $err;
- }
-
- // }}}
- // {{{ function resetWarnings()
-
- /**
- * reset the warning array
- *
- * @return void
- *
- * @access public
- */
- function resetWarnings()
- {
- $this->warnings = array();
- }
-
- // }}}
- // {{{ function getWarnings()
-
- /**
- * Get all warnings in reverse order.
- * This means that the last warning is the first element in the array
- *
- * @return array with warnings
- *
- * @access public
- * @see resetWarnings()
- */
- function getWarnings()
- {
- return array_reverse($this->warnings);
- }
-
- // }}}
- // {{{ function setFetchMode($fetchmode, $object_class = 'stdClass')
-
- /**
- * Sets which fetch mode should be used by default on queries
- * on this connection
- *
- * @param int MDB2_FETCHMODE_ORDERED, MDB2_FETCHMODE_ASSOC
- * or MDB2_FETCHMODE_OBJECT
- * @param string the class name of the object to be returned
- * by the fetch methods when the
- * MDB2_FETCHMODE_OBJECT mode is selected.
- * If no class is specified by default a cast
- * to object from the assoc array row will be
- * done. There is also the possibility to use
- * and extend the 'MDB2_row' class.
- *
- * @return mixed MDB2_OK or MDB2 Error Object
- *
- * @access public
- * @see MDB2_FETCHMODE_ORDERED, MDB2_FETCHMODE_ASSOC, MDB2_FETCHMODE_OBJECT
- */
- function setFetchMode($fetchmode, $object_class = 'stdClass')
- {
- switch ($fetchmode) {
- case MDB2_FETCHMODE_OBJECT:
- $this->options['fetch_class'] = $object_class;
- case MDB2_FETCHMODE_ORDERED:
- case MDB2_FETCHMODE_ASSOC:
- $this->fetchmode = $fetchmode;
- break;
- default:
- return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'invalid fetchmode mode', __FUNCTION__);
- }
-
- return MDB2_OK;
- }
-
- // }}}
- // {{{ function setOption($option, $value)
-
- /**
- * set the option for the db class
- *
- * @param string option name
- * @param mixed value for the option
- *
- * @return mixed MDB2_OK or MDB2 Error Object
- *
- * @access public
- */
- function setOption($option, $value)
- {
- if (array_key_exists($option, $this->options)) {
- $this->options[$option] = $value;
- return MDB2_OK;
- }
- return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- "unknown option $option", __FUNCTION__);
- }
-
- // }}}
- // {{{ function getOption($option)
-
- /**
- * Returns the value of an option
- *
- * @param string option name
- *
- * @return mixed the option value or error object
- *
- * @access public
- */
- function getOption($option)
- {
- if (array_key_exists($option, $this->options)) {
- return $this->options[$option];
- }
- return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- "unknown option $option", __FUNCTION__);
- }
-
- // }}}
- // {{{ function debug($message, $scope = '', $is_manip = null)
-
- /**
- * set a debug message
- *
- * @param string message that should be appended to the debug variable
- * @param string usually the method name that triggered the debug call:
- * for example 'query', 'prepare', 'execute', 'parameters',
- * 'beginTransaction', 'commit', 'rollback'
- * @param array contains context information about the debug() call
- * common keys are: is_manip, time, result etc.
- *
- * @return void
- *
- * @access public
- */
- function debug($message, $scope = '', $context = array())
- {
- if ($this->options['debug'] && $this->options['debug_handler']) {
- if (!$this->options['debug_expanded_output']) {
- if (!empty($context['when']) && $context['when'] !== 'pre') {
- return null;
- }
- $context = empty($context['is_manip']) ? false : $context['is_manip'];
- }
- return call_user_func_array($this->options['debug_handler'], array(&$this, $scope, $message, $context));
- }
- return null;
- }
-
- // }}}
- // {{{ function getDebugOutput()
-
- /**
- * output debug info
- *
- * @return string content of the debug_output class variable
- *
- * @access public
- */
- function getDebugOutput()
- {
- return $this->debug_output;
- }
-
- // }}}
- // {{{ function escape($text)
-
- /**
- * Quotes a string so it can be safely used in a query. It will quote
- * the text so it can safely be used within a query.
- *
- * @param string the input string to quote
- * @param bool escape wildcards
- *
- * @return string quoted string
- *
- * @access public
- */
- function escape($text, $escape_wildcards = false)
- {
- if ($escape_wildcards) {
- $text = $this->escapePattern($text);
- }
-
- $text = str_replace($this->string_quoting['end'], $this->string_quoting['escape'] . $this->string_quoting['end'], $text);
- return $text;
- }
-
- // }}}
- // {{{ function escapePattern($text)
-
- /**
- * Quotes pattern (% and _) characters in a string)
- *
- * @param string the input string to quote
- *
- * @return string quoted string
- *
- * @access public
- */
- function escapePattern($text)
- {
- if ($this->string_quoting['escape_pattern']) {
- $text = str_replace($this->string_quoting['escape_pattern'], $this->string_quoting['escape_pattern'] . $this->string_quoting['escape_pattern'], $text);
- foreach ($this->wildcards as $wildcard) {
- $text = str_replace($wildcard, $this->string_quoting['escape_pattern'] . $wildcard, $text);
- }
- }
- return $text;
- }
-
- // }}}
- // {{{ function quoteIdentifier($str, $check_option = false)
-
- /**
- * Quote a string so it can be safely used as a table or column name
- *
- * Delimiting style depends on which database driver is being used.
- *
- * NOTE: just because you CAN use delimited identifiers doesn't mean
- * you SHOULD use them. In general, they end up causing way more
- * problems than they solve.
- *
- * NOTE: if you have table names containing periods, don't use this method
- * (@see bug #11906)
- *
- * Portability is broken by using the following characters inside
- * delimited identifiers:
- * + backtick (<kbd>`</kbd>) -- due to MySQL
- * + double quote (<kbd>"</kbd>) -- due to Oracle
- * + brackets (<kbd>[</kbd> or <kbd>]</kbd>) -- due to Access
- *
- * Delimited identifiers are known to generally work correctly under
- * the following drivers:
- * + mssql
- * + mysql
- * + mysqli
- * + oci8
- * + pgsql
- * + sqlite
- *
- * InterBase doesn't seem to be able to use delimited identifiers
- * via PHP 4. They work fine under PHP 5.
- *
- * @param string identifier name to be quoted
- * @param bool check the 'quote_identifier' option
- *
- * @return string quoted identifier string
- *
- * @access public
- */
- function quoteIdentifier($str, $check_option = false)
- {
- if ($check_option && !$this->options['quote_identifier']) {
- return $str;
- }
- $str = str_replace($this->identifier_quoting['end'], $this->identifier_quoting['escape'] . $this->identifier_quoting['end'], $str);
- $parts = explode('.', $str);
- foreach (array_keys($parts) as $k) {
- $parts[$k] = $this->identifier_quoting['start'] . $parts[$k] . $this->identifier_quoting['end'];
- }
- return implode('.', $parts);
- }
-
- // }}}
- // {{{ function getAsKeyword()
-
- /**
- * Gets the string to alias column
- *
- * @return string to use when aliasing a column
- */
- function getAsKeyword()
- {
- return $this->as_keyword;
- }
-
- // }}}
- // {{{ function getConnection()
-
- /**
- * Returns a native connection
- *
- * @return mixed a valid MDB2 connection object,
- * or a MDB2 error object on error
- *
- * @access public
- */
- function getConnection()
- {
- $result = $this->connect();
- if (MDB2::isError($result)) {
- return $result;
- }
- return $this->connection;
- }
-
- // }}}
- // {{{ function _fixResultArrayValues(&$row, $mode)
-
- /**
- * Do all necessary conversions on result arrays to fix DBMS quirks
- *
- * @param array the array to be fixed (passed by reference)
- * @param array bit-wise addition of the required portability modes
- *
- * @return void
- *
- * @access protected
- */
- function _fixResultArrayValues(&$row, $mode)
- {
- switch ($mode) {
- case MDB2_PORTABILITY_EMPTY_TO_NULL:
- foreach ($row as $key => $value) {
- if ($value === '') {
- $row[$key] = null;
- }
- }
- break;
- case MDB2_PORTABILITY_RTRIM:
- foreach ($row as $key => $value) {
- if (is_string($value)) {
- $row[$key] = rtrim($value);
- }
- }
- break;
- case MDB2_PORTABILITY_FIX_ASSOC_FIELD_NAMES:
- $tmp_row = array();
- foreach ($row as $key => $value) {
- $tmp_row[preg_replace('/^(?:.*\.)?([^.]+)$/', '\\1', $key)] = $value;
- }
- $row = $tmp_row;
- break;
- case (MDB2_PORTABILITY_RTRIM + MDB2_PORTABILITY_EMPTY_TO_NULL):
- foreach ($row as $key => $value) {
- if ($value === '') {
- $row[$key] = null;
- } elseif (is_string($value)) {
- $row[$key] = rtrim($value);
- }
- }
- break;
- case (MDB2_PORTABILITY_RTRIM + MDB2_PORTABILITY_FIX_ASSOC_FIELD_NAMES):
- $tmp_row = array();
- foreach ($row as $key => $value) {
- if (is_string($value)) {
- $value = rtrim($value);
- }
- $tmp_row[preg_replace('/^(?:.*\.)?([^.]+)$/', '\\1', $key)] = $value;
- }
- $row = $tmp_row;
- break;
- case (MDB2_PORTABILITY_EMPTY_TO_NULL + MDB2_PORTABILITY_FIX_ASSOC_FIELD_NAMES):
- $tmp_row = array();
- foreach ($row as $key => $value) {
- if ($value === '') {
- $value = null;
- }
- $tmp_row[preg_replace('/^(?:.*\.)?([^.]+)$/', '\\1', $key)] = $value;
- }
- $row = $tmp_row;
- break;
- case (MDB2_PORTABILITY_RTRIM + MDB2_PORTABILITY_EMPTY_TO_NULL + MDB2_PORTABILITY_FIX_ASSOC_FIELD_NAMES):
- $tmp_row = array();
- foreach ($row as $key => $value) {
- if ($value === '') {
- $value = null;
- } elseif (is_string($value)) {
- $value = rtrim($value);
- }
- $tmp_row[preg_replace('/^(?:.*\.)?([^.]+)$/', '\\1', $key)] = $value;
- }
- $row = $tmp_row;
- break;
- }
- }
-
- // }}}
- // {{{ function loadModule($module, $property = null, $phptype_specific = null)
-
- /**
- * loads a module
- *
- * @param string name of the module that should be loaded
- * (only used for error messages)
- * @param string name of the property into which the class will be loaded
- * @param bool if the class to load for the module is specific to the
- * phptype
- *
- * @return object on success a reference to the given module is returned
- * and on failure a PEAR error
- *
- * @access public
- */
- function loadModule($module, $property = null, $phptype_specific = null)
- {
- if (!$property) {
- $property = strtolower($module);
- }
-
- if (!isset($this->{$property})) {
- $version = $phptype_specific;
- if ($phptype_specific !== false) {
- $version = true;
- $class_name = 'MDB2_Driver_'.$module.'_'.$this->phptype;
- $file_name = str_replace('_', DIRECTORY_SEPARATOR, $class_name).'.php';
- }
- if ($phptype_specific === false
- || (!MDB2::classExists($class_name) && !MDB2::fileExists($file_name))
- ) {
- $version = false;
- $class_name = 'MDB2_'.$module;
- $file_name = str_replace('_', DIRECTORY_SEPARATOR, $class_name).'.php';
- }
-
- $err = MDB2::loadClass($class_name, $this->getOption('debug'));
- if (MDB2::isError($err)) {
- return $err;
- }
-
- // load module in a specific version
- if ($version) {
- if (method_exists($class_name, 'getClassName')) {
- $class_name_new = call_user_func(array($class_name, 'getClassName'), $this->db_index);
- if ($class_name != $class_name_new) {
- $class_name = $class_name_new;
- $err = MDB2::loadClass($class_name, $this->getOption('debug'));
- if (MDB2::isError($err)) {
- return $err;
- }
- }
- }
- }
-
- if (!MDB2::classExists($class_name)) {
- $err = $this->raiseError(MDB2_ERROR_LOADMODULE, null, null,
- "unable to load module '$module' into property '$property'", __FUNCTION__);
- return $err;
- }
- $this->{$property} = new $class_name($this->db_index);
- $this->modules[$module] = $this->{$property};
- if ($version) {
- // this will be used in the connect method to determine if the module
- // needs to be loaded with a different version if the server
- // version changed in between connects
- $this->loaded_version_modules[] = $property;
- }
- }
-
- return $this->{$property};
- }
-
- // }}}
- // {{{ function __call($method, $params)
-
- /**
- * Calls a module method using the __call magic method
- *
- * @param string Method name.
- * @param array Arguments.
- *
- * @return mixed Returned value.
- */
- function __call($method, $params)
- {
- $module = null;
- if (preg_match('/^([a-z]+)([A-Z])(.*)$/', $method, $match)
- && isset($this->options['modules'][$match[1]])
- ) {
- $module = $this->options['modules'][$match[1]];
- $method = strtolower($match[2]).$match[3];
- if (!isset($this->modules[$module]) || !is_object($this->modules[$module])) {
- $result = $this->loadModule($module);
- if (MDB2::isError($result)) {
- return $result;
- }
- }
- } else {
- foreach ($this->modules as $key => $foo) {
- if (is_object($this->modules[$key])
- && method_exists($this->modules[$key], $method)
- ) {
- $module = $key;
- break;
- }
- }
- }
- if (null !== $module) {
- return call_user_func_array(array(&$this->modules[$module], $method), $params);
- }
- trigger_error(sprintf('Call to undefined function: %s::%s().', get_class($this), $method), E_USER_ERROR);
- }
-
- // }}}
- // {{{ function beginTransaction($savepoint = null)
-
- /**
- * Start a transaction or set a savepoint.
- *
- * @param string name of a savepoint to set
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- *
- * @access public
- */
- function beginTransaction($savepoint = null)
- {
- $this->debug('Starting transaction', __FUNCTION__, array('is_manip' => true, 'savepoint' => $savepoint));
- return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'transactions are not supported', __FUNCTION__);
- }
-
- // }}}
- // {{{ function commit($savepoint = null)
-
- /**
- * Commit the database changes done during a transaction that is in
- * progress or release a savepoint. This function may only be called when
- * auto-committing is disabled, otherwise it will fail. Therefore, a new
- * transaction is implicitly started after committing the pending changes.
- *
- * @param string name of a savepoint to release
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- *
- * @access public
- */
- function commit($savepoint = null)
- {
- $this->debug('Committing transaction/savepoint', __FUNCTION__, array('is_manip' => true, 'savepoint' => $savepoint));
- return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'commiting transactions is not supported', __FUNCTION__);
- }
-
- // }}}
- // {{{ function rollback($savepoint = null)
-
- /**
- * Cancel any database changes done during a transaction or since a specific
- * savepoint that is in progress. This function may only be called when
- * auto-committing is disabled, otherwise it will fail. Therefore, a new
- * transaction is implicitly started after canceling the pending changes.
- *
- * @param string name of a savepoint to rollback to
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- *
- * @access public
- */
- function rollback($savepoint = null)
- {
- $this->debug('Rolling back transaction/savepoint', __FUNCTION__, array('is_manip' => true, 'savepoint' => $savepoint));
- return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'rolling back transactions is not supported', __FUNCTION__);
- }
-
- // }}}
- // {{{ function inTransaction($ignore_nested = false)
-
- /**
- * If a transaction is currently open.
- *
- * @param bool if the nested transaction count should be ignored
- * @return int|bool - an integer with the nesting depth is returned if a
- * nested transaction is open
- * - true is returned for a normal open transaction
- * - false is returned if no transaction is open
- *
- * @access public
- */
- function inTransaction($ignore_nested = false)
- {
- if (!$ignore_nested && isset($this->nested_transaction_counter)) {
- return $this->nested_transaction_counter;
- }
- return $this->in_transaction;
- }
-
- // }}}
- // {{{ function setTransactionIsolation($isolation)
-
- /**
- * Set the transacton isolation level.
- *
- * @param string standard isolation level
- * READ UNCOMMITTED (allows dirty reads)
- * READ COMMITTED (prevents dirty reads)
- * REPEATABLE READ (prevents nonrepeatable reads)
- * SERIALIZABLE (prevents phantom reads)
- * @param array some transaction options:
- * 'wait' => 'WAIT' | 'NO WAIT'
- * 'rw' => 'READ WRITE' | 'READ ONLY'
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- *
- * @access public
- * @since 2.1.1
- */
- function setTransactionIsolation($isolation, $options = array())
- {
- $this->debug('Setting transaction isolation level', __FUNCTION__, array('is_manip' => true));
- return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'isolation level setting is not supported', __FUNCTION__);
- }
-
- // }}}
- // {{{ function beginNestedTransaction($savepoint = false)
-
- /**
- * Start a nested transaction.
- *
- * @return mixed MDB2_OK on success/savepoint name, a MDB2 error on failure
- *
- * @access public
- * @since 2.1.1
- */
- function beginNestedTransaction()
- {
- if ($this->in_transaction) {
- ++$this->nested_transaction_counter;
- $savepoint = sprintf($this->options['savepoint_format'], $this->nested_transaction_counter);
- if ($this->supports('savepoints') && $savepoint) {
- return $this->beginTransaction($savepoint);
- }
- return MDB2_OK;
- }
- $this->has_transaction_error = false;
- $result = $this->beginTransaction();
- $this->nested_transaction_counter = 1;
- return $result;
- }
-
- // }}}
- // {{{ function completeNestedTransaction($force_rollback = false, $release = false)
-
- /**
- * Finish a nested transaction by rolling back if an error occured or
- * committing otherwise.
- *
- * @param bool if the transaction should be rolled back regardless
- * even if no error was set within the nested transaction
- * @return mixed MDB_OK on commit/counter decrementing, false on rollback
- * and a MDB2 error on failure
- *
- * @access public
- * @since 2.1.1
- */
- function completeNestedTransaction($force_rollback = false)
- {
- if ($this->nested_transaction_counter > 1) {
- $savepoint = sprintf($this->options['savepoint_format'], $this->nested_transaction_counter);
- if ($this->supports('savepoints') && $savepoint) {
- if ($force_rollback || $this->has_transaction_error) {
- $result = $this->rollback($savepoint);
- if (!MDB2::isError($result)) {
- $result = false;
- $this->has_transaction_error = false;
- }
- } else {
- $result = $this->commit($savepoint);
- }
- } else {
- $result = MDB2_OK;
- }
- --$this->nested_transaction_counter;
- return $result;
- }
-
- $this->nested_transaction_counter = null;
- $result = MDB2_OK;
-
- // transaction has not yet been rolled back
- if ($this->in_transaction) {
- if ($force_rollback || $this->has_transaction_error) {
- $result = $this->rollback();
- if (!MDB2::isError($result)) {
- $result = false;
- }
- } else {
- $result = $this->commit();
- }
- }
- $this->has_transaction_error = false;
- return $result;
- }
-
- // }}}
- // {{{ function failNestedTransaction($error = null, $immediately = false)
-
- /**
- * Force setting nested transaction to failed.
- *
- * @param mixed value to return in getNestededTransactionError()
- * @param bool if the transaction should be rolled back immediately
- * @return bool MDB2_OK
- *
- * @access public
- * @since 2.1.1
- */
- function failNestedTransaction($error = null, $immediately = false)
- {
- if (null !== $error) {
- $error = $this->has_transaction_error ? $this->has_transaction_error : true;
- } elseif (!$error) {
- $error = true;
- }
- $this->has_transaction_error = $error;
- if (!$immediately) {
- return MDB2_OK;
- }
- return $this->rollback();
- }
-
- // }}}
- // {{{ function getNestedTransactionError()
-
- /**
- * The first error that occured since the transaction start.
- *
- * @return MDB2_Error|bool MDB2 error object if an error occured or false.
- *
- * @access public
- * @since 2.1.1
- */
- function getNestedTransactionError()
- {
- return $this->has_transaction_error;
- }
-
- // }}}
- // {{{ connect()
-
- /**
- * Connect to the database
- *
- * @return true on success, MDB2 Error Object on failure
- */
- function connect()
- {
- return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- }
-
- // }}}
- // {{{ databaseExists()
-
- /**
- * check if given database name is exists?
- *
- * @param string $name name of the database that should be checked
- *
- * @return mixed true/false on success, a MDB2 error on failure
- * @access public
- */
- function databaseExists($name)
- {
- return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- }
-
- // }}}
- // {{{ setCharset($charset, $connection = null)
-
- /**
- * Set the charset on the current connection
- *
- * @param string charset
- * @param resource connection handle
- *
- * @return true on success, MDB2 Error Object on failure
- */
- function setCharset($charset, $connection = null)
- {
- return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- }
-
- // }}}
- // {{{ function disconnect($force = true)
-
- /**
- * Log out and disconnect from the database.
- *
- * @param boolean $force whether the disconnect should be forced even if the
- * connection is opened persistently
- *
- * @return mixed true on success, false if not connected and error object on error
- *
- * @access public
- */
- function disconnect($force = true)
- {
- $this->connection = 0;
- $this->connected_dsn = array();
- $this->connected_database_name = '';
- $this->opened_persistent = null;
- $this->connected_server_info = '';
- $this->in_transaction = null;
- $this->nested_transaction_counter = null;
- return MDB2_OK;
- }
-
- // }}}
- // {{{ function setDatabase($name)
-
- /**
- * Select a different database
- *
- * @param string name of the database that should be selected
- *
- * @return string name of the database previously connected to
- *
- * @access public
- */
- function setDatabase($name)
- {
- $previous_database_name = (isset($this->database_name)) ? $this->database_name : '';
- $this->database_name = $name;
- if (!empty($this->connected_database_name) && ($this->connected_database_name != $this->database_name)) {
- $this->disconnect(false);
- }
- return $previous_database_name;
- }
-
- // }}}
- // {{{ function getDatabase()
-
- /**
- * Get the current database
- *
- * @return string name of the database
- *
- * @access public
- */
- function getDatabase()
- {
- return $this->database_name;
- }
-
- // }}}
- // {{{ function setDSN($dsn)
-
- /**
- * set the DSN
- *
- * @param mixed DSN string or array
- *
- * @return MDB2_OK
- *
- * @access public
- */
- function setDSN($dsn)
- {
- $dsn_default = $GLOBALS['_MDB2_dsninfo_default'];
- $dsn = MDB2::parseDSN($dsn);
- if (array_key_exists('database', $dsn)) {
- $this->database_name = $dsn['database'];
- unset($dsn['database']);
- }
- $this->dsn = array_merge($dsn_default, $dsn);
- return $this->disconnect(false);
- }
-
- // }}}
- // {{{ function getDSN($type = 'string', $hidepw = false)
-
- /**
- * return the DSN as a string
- *
- * @param string format to return ("array", "string")
- * @param string string to hide the password with
- *
- * @return mixed DSN in the chosen type
- *
- * @access public
- */
- function getDSN($type = 'string', $hidepw = false)
- {
- $dsn = array_merge($GLOBALS['_MDB2_dsninfo_default'], $this->dsn);
- $dsn['phptype'] = $this->phptype;
- $dsn['database'] = $this->database_name;
- if ($hidepw) {
- $dsn['password'] = $hidepw;
- }
- switch ($type) {
- // expand to include all possible options
- case 'string':
- $dsn = $dsn['phptype'].
- ($dsn['dbsyntax'] ? ('('.$dsn['dbsyntax'].')') : '').
- '://'.$dsn['username'].':'.
- $dsn['password'].'@'.$dsn['hostspec'].
- ($dsn['port'] ? (':'.$dsn['port']) : '').
- '/'.$dsn['database'];
- break;
- case 'array':
- default:
- break;
- }
- return $dsn;
- }
-
- // }}}
- // {{{ _isNewLinkSet()
-
- /**
- * Check if the 'new_link' option is set
- *
- * @return boolean
- *
- * @access protected
- */
- function _isNewLinkSet()
- {
- return (isset($this->dsn['new_link'])
- && ($this->dsn['new_link'] === true
- || (is_string($this->dsn['new_link']) && preg_match('/^true$/i', $this->dsn['new_link']))
- || (is_numeric($this->dsn['new_link']) && 0 != (int)$this->dsn['new_link'])
- )
- );
- }
-
- // }}}
- // {{{ function &standaloneQuery($query, $types = null, $is_manip = false)
-
- /**
- * execute a query as database administrator
- *
- * @param string the SQL query
- * @param mixed array that contains the types of the columns in
- * the result set
- * @param bool if the query is a manipulation query
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- *
- * @access public
- */
- function standaloneQuery($query, $types = null, $is_manip = false)
- {
- $offset = $this->offset;
- $limit = $this->limit;
- $this->offset = $this->limit = 0;
- $query = $this->_modifyQuery($query, $is_manip, $limit, $offset);
-
- $connection = $this->getConnection();
- if (MDB2::isError($connection)) {
- return $connection;
- }
-
- $result = $this->_doQuery($query, $is_manip, $connection, false);
- if (MDB2::isError($result)) {
- return $result;
- }
-
- if ($is_manip) {
- $affected_rows = $this->_affectedRows($connection, $result);
- return $affected_rows;
- }
- $result = $this->_wrapResult($result, $types, true, true, $limit, $offset);
- return $result;
- }
-
- // }}}
- // {{{ function _modifyQuery($query, $is_manip, $limit, $offset)
-
- /**
- * Changes a query string for various DBMS specific reasons
- *
- * @param string query to modify
- * @param bool if it is a DML query
- * @param int limit the number of rows
- * @param int start reading from given offset
- *
- * @return string modified query
- *
- * @access protected
- */
- function _modifyQuery($query, $is_manip, $limit, $offset)
- {
- return $query;
- }
-
- // }}}
- // {{{ function &_doQuery($query, $is_manip = false, $connection = null, $database_name = null)
-
- /**
- * Execute a query
- * @param string query
- * @param bool if the query is a manipulation query
- * @param resource connection handle
- * @param string database name
- *
- * @return result or error object
- *
- * @access protected
- */
- function _doQuery($query, $is_manip = false, $connection = null, $database_name = null)
- {
- $this->last_query = $query;
- $result = $this->debug($query, 'query', array('is_manip' => $is_manip, 'when' => 'pre'));
- if ($result) {
- if (MDB2::isError($result)) {
- return $result;
- }
- $query = $result;
- }
- $err = MDB2_Driver_Common::raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- return $err;
- }
-
- // }}}
- // {{{ function _affectedRows($connection, $result = null)
-
- /**
- * Returns the number of rows affected
- *
- * @param resource result handle
- * @param resource connection handle
- *
- * @return mixed MDB2 Error Object or the number of rows affected
- *
- * @access private
- */
- function _affectedRows($connection, $result = null)
- {
- return MDB2_Driver_Common::raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- }
-
- // }}}
- // {{{ function &exec($query)
-
- /**
- * Execute a manipulation query to the database and return the number of affected rows
- *
- * @param string the SQL query
- *
- * @return mixed number of affected rows on success, a MDB2 error on failure
- *
- * @access public
- */
- function exec($query)
- {
- $offset = $this->offset;
- $limit = $this->limit;
- $this->offset = $this->limit = 0;
- $query = $this->_modifyQuery($query, true, $limit, $offset);
-
- $connection = $this->getConnection();
- if (MDB2::isError($connection)) {
- return $connection;
- }
-
- $result = $this->_doQuery($query, true, $connection, $this->database_name);
- if (MDB2::isError($result)) {
- return $result;
- }
-
- $affectedRows = $this->_affectedRows($connection, $result);
- return $affectedRows;
- }
-
- // }}}
- // {{{ function &query($query, $types = null, $result_class = true, $result_wrap_class = false)
-
- /**
- * Send a query to the database and return any results
- *
- * @param string the SQL query
- * @param mixed array that contains the types of the columns in
- * the result set
- * @param mixed string which specifies which result class to use
- * @param mixed string which specifies which class to wrap results in
- *
- * @return mixed an MDB2_Result handle on success, a MDB2 error on failure
- *
- * @access public
- */
- function query($query, $types = null, $result_class = true, $result_wrap_class = true)
- {
- $offset = $this->offset;
- $limit = $this->limit;
- $this->offset = $this->limit = 0;
- $query = $this->_modifyQuery($query, false, $limit, $offset);
-
- $connection = $this->getConnection();
- if (MDB2::isError($connection)) {
- return $connection;
- }
-
- $result = $this->_doQuery($query, false, $connection, $this->database_name);
- if (MDB2::isError($result)) {
- return $result;
- }
-
- $result = $this->_wrapResult($result, $types, $result_class, $result_wrap_class, $limit, $offset);
- return $result;
- }
-
- // }}}
- // {{{ function _wrapResult($result_resource, $types = array(), $result_class = true, $result_wrap_class = false, $limit = null, $offset = null)
-
- /**
- * wrap a result set into the correct class
- *
- * @param resource result handle
- * @param mixed array that contains the types of the columns in
- * the result set
- * @param mixed string which specifies which result class to use
- * @param mixed string which specifies which class to wrap results in
- * @param string number of rows to select
- * @param string first row to select
- *
- * @return mixed an MDB2_Result, a MDB2 error on failure
- *
- * @access protected
- */
- function _wrapResult($result_resource, $types = array(), $result_class = true,
- $result_wrap_class = true, $limit = null, $offset = null)
- {
- if ($types === true) {
- if ($this->supports('result_introspection')) {
- $this->loadModule('Reverse', null, true);
- $tableInfo = $this->reverse->tableInfo($result_resource);
- if (MDB2::isError($tableInfo)) {
- return $tableInfo;
- }
- $types = array();
- $types_assoc = array();
- foreach ($tableInfo as $field) {
- $types[] = $field['mdb2type'];
- $types_assoc[$field['name']] = $field['mdb2type'];
- }
- } else {
- $types = null;
- }
- }
-
- if ($result_class === true) {
- $result_class = $this->options['result_buffering']
- ? $this->options['buffered_result_class'] : $this->options['result_class'];
- }
-
- if ($result_class) {
- $class_name = sprintf($result_class, $this->phptype);
- if (!MDB2::classExists($class_name)) {
- $err = MDB2_Driver_Common::raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- 'result class does not exist '.$class_name, __FUNCTION__);
- return $err;
- }
- $result = new $class_name($this, $result_resource, $limit, $offset);
- if (!MDB2::isResultCommon($result)) {
- $err = MDB2_Driver_Common::raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- 'result class is not extended from MDB2_Result_Common', __FUNCTION__);
- return $err;
- }
-
- if (!empty($types)) {
- $err = $result->setResultTypes($types);
- if (MDB2::isError($err)) {
- $result->free();
- return $err;
- }
- }
- if (!empty($types_assoc)) {
- $err = $result->setResultTypes($types_assoc);
- if (MDB2::isError($err)) {
- $result->free();
- return $err;
- }
- }
-
- if ($result_wrap_class === true) {
- $result_wrap_class = $this->options['result_wrap_class'];
- }
- if ($result_wrap_class) {
- if (!MDB2::classExists($result_wrap_class)) {
- $err = MDB2_Driver_Common::raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- 'result wrap class does not exist '.$result_wrap_class, __FUNCTION__);
- return $err;
- }
- $result = new $result_wrap_class($result, $this->fetchmode);
- }
-
- return $result;
- }
-
- return $result_resource;
- }
-
- // }}}
- // {{{ function getServerVersion($native = false)
-
- /**
- * return version information about the server
- *
- * @param bool determines if the raw version string should be returned
- *
- * @return mixed array with version information or row string
- *
- * @access public
- */
- function getServerVersion($native = false)
- {
- return MDB2_Driver_Common::raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- }
-
- // }}}
- // {{{ function setLimit($limit, $offset = null)
-
- /**
- * set the range of the next query
- *
- * @param string number of rows to select
- * @param string first row to select
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- *
- * @access public
- */
- function setLimit($limit, $offset = null)
- {
- if (!$this->supports('limit_queries')) {
- return MDB2_Driver_Common::raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'limit is not supported by this driver', __FUNCTION__);
- }
- $limit = (int)$limit;
- if ($limit < 0) {
- return MDB2_Driver_Common::raiseError(MDB2_ERROR_SYNTAX, null, null,
- 'it was not specified a valid selected range row limit', __FUNCTION__);
- }
- $this->limit = $limit;
- if (null !== $offset) {
- $offset = (int)$offset;
- if ($offset < 0) {
- return MDB2_Driver_Common::raiseError(MDB2_ERROR_SYNTAX, null, null,
- 'it was not specified a valid first selected range row', __FUNCTION__);
- }
- $this->offset = $offset;
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ function subSelect($query, $type = false)
-
- /**
- * simple subselect emulation: leaves the query untouched for all RDBMS
- * that support subselects
- *
- * @param string the SQL query for the subselect that may only
- * return a column
- * @param string determines type of the field
- *
- * @return string the query
- *
- * @access public
- */
- function subSelect($query, $type = false)
- {
- if ($this->supports('sub_selects') === true) {
- return $query;
- }
-
- if (!$this->supports('sub_selects')) {
- return MDB2_Driver_Common::raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- }
-
- $col = $this->queryCol($query, $type);
- if (MDB2::isError($col)) {
- return $col;
- }
- if (!is_array($col) || count($col) == 0) {
- return 'NULL';
- }
- if ($type) {
- $this->loadModule('Datatype', null, true);
- return $this->datatype->implodeArray($col, $type);
- }
- return implode(', ', $col);
- }
-
- // }}}
- // {{{ function replace($table, $fields)
-
- /**
- * Execute a SQL REPLACE query. A REPLACE query is identical to a INSERT
- * query, except that if there is already a row in the table with the same
- * key field values, the old row is deleted before the new row is inserted.
- *
- * The REPLACE type of query does not make part of the SQL standards. Since
- * practically only MySQL and SQLite implement it natively, this type of
- * query isemulated through this method for other DBMS using standard types
- * of queries inside a transaction to assure the atomicity of the operation.
- *
- * @param string name of the table on which the REPLACE query will
- * be executed.
- * @param array associative array that describes the fields and the
- * values that will be inserted or updated in the specified table. The
- * indexes of the array are the names of all the fields of the table.
- * The values of the array are also associative arrays that describe
- * the values and other properties of the table fields.
- *
- * Here follows a list of field properties that need to be specified:
- *
- * value
- * Value to be assigned to the specified field. This value may be
- * of specified in database independent type format as this
- * function can perform the necessary datatype conversions.
- *
- * Default: this property is required unless the Null property is
- * set to 1.
- *
- * type
- * Name of the type of the field. Currently, all types MDB2
- * are supported except for clob and blob.
- *
- * Default: no type conversion
- *
- * null
- * bool property that indicates that the value for this field
- * should be set to null.
- *
- * The default value for fields missing in INSERT queries may be
- * specified the definition of a table. Often, the default value
- * is already null, but since the REPLACE may be emulated using
- * an UPDATE query, make sure that all fields of the table are
- * listed in this function argument array.
- *
- * Default: 0
- *
- * key
- * bool property that indicates that this field should be
- * handled as a primary key or at least as part of the compound
- * unique index of the table that will determine the row that will
- * updated if it exists or inserted a new row otherwise.
- *
- * This function will fail if no key field is specified or if the
- * value of a key field is set to null because fields that are
- * part of unique index they may not be null.
- *
- * Default: 0
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- *
- * @access public
- */
- function replace($table, $fields)
- {
- if (!$this->supports('replace')) {
- return MDB2_Driver_Common::raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'replace query is not supported', __FUNCTION__);
- }
- $count = count($fields);
- $condition = $values = array();
- for ($colnum = 0, reset($fields); $colnum < $count; next($fields), $colnum++) {
- $name = key($fields);
- if (isset($fields[$name]['null']) && $fields[$name]['null']) {
- $value = 'NULL';
- } else {
- $type = isset($fields[$name]['type']) ? $fields[$name]['type'] : null;
- $value = $this->quote($fields[$name]['value'], $type);
- }
- $values[$name] = $value;
- if (isset($fields[$name]['key']) && $fields[$name]['key']) {
- if ($value === 'NULL') {
- return MDB2_Driver_Common::raiseError(MDB2_ERROR_CANNOT_REPLACE, null, null,
- 'key value '.$name.' may not be NULL', __FUNCTION__);
- }
- $condition[] = $this->quoteIdentifier($name, true) . '=' . $value;
- }
- }
- if (empty($condition)) {
- return MDB2_Driver_Common::raiseError(MDB2_ERROR_CANNOT_REPLACE, null, null,
- 'not specified which fields are keys', __FUNCTION__);
- }
-
- $result = null;
- $in_transaction = $this->in_transaction;
- if (!$in_transaction && MDB2::isError($result = $this->beginTransaction())) {
- return $result;
- }
-
- $connection = $this->getConnection();
- if (MDB2::isError($connection)) {
- return $connection;
- }
-
- $condition = ' WHERE '.implode(' AND ', $condition);
- $query = 'DELETE FROM ' . $this->quoteIdentifier($table, true) . $condition;
- $result = $this->_doQuery($query, true, $connection);
- if (!MDB2::isError($result)) {
- $affected_rows = $this->_affectedRows($connection, $result);
- $insert = '';
- foreach ($values as $key => $value) {
- $insert .= ($insert?', ':'') . $this->quoteIdentifier($key, true);
- }
- $values = implode(', ', $values);
- $query = 'INSERT INTO '. $this->quoteIdentifier($table, true) . "($insert) VALUES ($values)";
- $result = $this->_doQuery($query, true, $connection);
- if (!MDB2::isError($result)) {
- $affected_rows += $this->_affectedRows($connection, $result);;
- }
- }
-
- if (!$in_transaction) {
- if (MDB2::isError($result)) {
- $this->rollback();
- } else {
- $result = $this->commit();
- }
- }
-
- if (MDB2::isError($result)) {
- return $result;
- }
-
- return $affected_rows;
- }
-
- // }}}
- // {{{ function &prepare($query, $types = null, $result_types = null, $lobs = array())
-
- /**
- * Prepares a query for multiple execution with execute().
- * With some database backends, this is emulated.
- * prepare() requires a generic query as string like
- * 'INSERT INTO numbers VALUES(?,?)' or
- * 'INSERT INTO numbers VALUES(:foo,:bar)'.
- * The ? and :name and are placeholders which can be set using
- * bindParam() and the query can be sent off using the execute() method.
- * The allowed format for :name can be set with the 'bindname_format' option.
- *
- * @param string the query to prepare
- * @param mixed array that contains the types of the placeholders
- * @param mixed array that contains the types of the columns in
- * the result set or MDB2_PREPARE_RESULT, if set to
- * MDB2_PREPARE_MANIP the query is handled as a manipulation query
- * @param mixed key (field) value (parameter) pair for all lob placeholders
- *
- * @return mixed resource handle for the prepared query on success,
- * a MDB2 error on failure
- *
- * @access public
- * @see bindParam, execute
- */
- function prepare($query, $types = null, $result_types = null, $lobs = array())
- {
- $is_manip = ($result_types === MDB2_PREPARE_MANIP);
- $offset = $this->offset;
- $limit = $this->limit;
- $this->offset = $this->limit = 0;
- $result = $this->debug($query, __FUNCTION__, array('is_manip' => $is_manip, 'when' => 'pre'));
- if ($result) {
- if (MDB2::isError($result)) {
- return $result;
- }
- $query = $result;
- }
- $placeholder_type_guess = $placeholder_type = null;
- $question = '?';
- $colon = ':';
- $positions = array();
- $position = 0;
- while ($position < strlen($query)) {
- $q_position = strpos($query, $question, $position);
- $c_position = strpos($query, $colon, $position);
- if ($q_position && $c_position) {
- $p_position = min($q_position, $c_position);
- } elseif ($q_position) {
- $p_position = $q_position;
- } elseif ($c_position) {
- $p_position = $c_position;
- } else {
- break;
- }
- if (null === $placeholder_type) {
- $placeholder_type_guess = $query[$p_position];
- }
-
- $new_pos = $this->_skipDelimitedStrings($query, $position, $p_position);
- if (MDB2::isError($new_pos)) {
- return $new_pos;
- }
- if ($new_pos != $position) {
- $position = $new_pos;
- continue; //evaluate again starting from the new position
- }
-
- if ($query[$position] == $placeholder_type_guess) {
- if (null === $placeholder_type) {
- $placeholder_type = $query[$p_position];
- $question = $colon = $placeholder_type;
- if (!empty($types) && is_array($types)) {
- if ($placeholder_type == ':') {
- if (is_int(key($types))) {
- $types_tmp = $types;
- $types = array();
- $count = -1;
- }
- } else {
- $types = array_values($types);
- }
- }
- }
- if ($placeholder_type == ':') {
- $regexp = '/^.{'.($position+1).'}('.$this->options['bindname_format'].').*$/s';
- $parameter = preg_replace($regexp, '\\1', $query);
- if ($parameter === '') {
- $err = MDB2_Driver_Common::raiseError(MDB2_ERROR_SYNTAX, null, null,
- 'named parameter name must match "bindname_format" option', __FUNCTION__);
- return $err;
- }
- $positions[$p_position] = $parameter;
- $query = substr_replace($query, '?', $position, strlen($parameter)+1);
- // use parameter name in type array
- if (isset($count) && isset($types_tmp[++$count])) {
- $types[$parameter] = $types_tmp[$count];
- }
- } else {
- $positions[$p_position] = count($positions);
- }
- $position = $p_position + 1;
- } else {
- $position = $p_position;
- }
- }
- $class_name = 'MDB2_Statement_'.$this->phptype;
- $statement = null;
- $obj = new $class_name($this, $statement, $positions, $query, $types, $result_types, $is_manip, $limit, $offset);
- $this->debug($query, __FUNCTION__, array('is_manip' => $is_manip, 'when' => 'post', 'result' => $obj));
- return $obj;
- }
-
- // }}}
- // {{{ function _skipDelimitedStrings($query, $position, $p_position)
-
- /**
- * Utility method, used by prepare() to avoid replacing placeholders within delimited strings.
- * Check if the placeholder is contained within a delimited string.
- * If so, skip it and advance the position, otherwise return the current position,
- * which is valid
- *
- * @param string $query
- * @param integer $position current string cursor position
- * @param integer $p_position placeholder position
- *
- * @return mixed integer $new_position on success
- * MDB2_Error on failure
- *
- * @access protected
- */
- function _skipDelimitedStrings($query, $position, $p_position)
- {
- $ignores = array();
- $ignores[] = $this->string_quoting;
- $ignores[] = $this->identifier_quoting;
- $ignores = array_merge($ignores, $this->sql_comments);
-
- foreach ($ignores as $ignore) {
- if (!empty($ignore['start'])) {
- if (is_int($start_quote = strpos($query, $ignore['start'], $position)) && $start_quote < $p_position) {
- $end_quote = $start_quote;
- do {
- if (!is_int($end_quote = strpos($query, $ignore['end'], $end_quote + 1))) {
- if ($ignore['end'] === "\n") {
- $end_quote = strlen($query) - 1;
- } else {
- $err = MDB2_Driver_Common::raiseError(MDB2_ERROR_SYNTAX, null, null,
- 'query with an unterminated text string specified', __FUNCTION__);
- return $err;
- }
- }
- } while ($ignore['escape']
- && $end_quote-1 != $start_quote
- && $query[($end_quote - 1)] == $ignore['escape']
- && ( $ignore['escape_pattern'] !== $ignore['escape']
- || $query[($end_quote - 2)] != $ignore['escape'])
- );
-
- $position = $end_quote + 1;
- return $position;
- }
- }
- }
- return $position;
- }
-
- // }}}
- // {{{ function quote($value, $type = null, $quote = true)
-
- /**
- * Convert a text value into a DBMS specific format that is suitable to
- * compose query statements.
- *
- * @param string text string value that is intended to be converted.
- * @param string type to which the value should be converted to
- * @param bool quote
- * @param bool escape wildcards
- *
- * @return string text string that represents the given argument value in
- * a DBMS specific format.
- *
- * @access public
- */
- function quote($value, $type = null, $quote = true, $escape_wildcards = false)
- {
- $result = $this->loadModule('Datatype', null, true);
- if (MDB2::isError($result)) {
- return $result;
- }
-
- return $this->datatype->quote($value, $type, $quote, $escape_wildcards);
- }
-
- // }}}
- // {{{ function getDeclaration($type, $name, $field)
-
- /**
- * Obtain DBMS specific SQL code portion needed to declare
- * of the given type
- *
- * @param string type to which the value should be converted to
- * @param string name the field to be declared.
- * @param string definition of the field
- *
- * @return string DBMS specific SQL code portion that should be used to
- * declare the specified field.
- *
- * @access public
- */
- function getDeclaration($type, $name, $field)
- {
- $result = $this->loadModule('Datatype', null, true);
- if (MDB2::isError($result)) {
- return $result;
- }
- return $this->datatype->getDeclaration($type, $name, $field);
- }
-
- // }}}
- // {{{ function compareDefinition($current, $previous)
-
- /**
- * Obtain an array of changes that may need to applied
- *
- * @param array new definition
- * @param array old definition
- *
- * @return array containing all changes that will need to be applied
- *
- * @access public
- */
- function compareDefinition($current, $previous)
- {
- $result = $this->loadModule('Datatype', null, true);
- if (MDB2::isError($result)) {
- return $result;
- }
- return $this->datatype->compareDefinition($current, $previous);
- }
-
- // }}}
- // {{{ function supports($feature)
-
- /**
- * Tell whether a DB implementation or its backend extension
- * supports a given feature.
- *
- * @param string name of the feature (see the MDB2 class doc)
- *
- * @return bool|string if this DB implementation supports a given feature
- * false means no, true means native,
- * 'emulated' means emulated
- *
- * @access public
- */
- function supports($feature)
- {
- if (array_key_exists($feature, $this->supported)) {
- return $this->supported[$feature];
- }
- return MDB2_Driver_Common::raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- "unknown support feature $feature", __FUNCTION__);
- }
-
- // }}}
- // {{{ function getSequenceName($sqn)
-
- /**
- * adds sequence name formatting to a sequence name
- *
- * @param string name of the sequence
- *
- * @return string formatted sequence name
- *
- * @access public
- */
- function getSequenceName($sqn)
- {
- return sprintf($this->options['seqname_format'],
- preg_replace('/[^a-z0-9_\-\$.]/i', '_', $sqn));
- }
-
- // }}}
- // {{{ function getIndexName($idx)
-
- /**
- * adds index name formatting to a index name
- *
- * @param string name of the index
- *
- * @return string formatted index name
- *
- * @access public
- */
- function getIndexName($idx)
- {
- return sprintf($this->options['idxname_format'],
- preg_replace('/[^a-z0-9_\-\$.]/i', '_', $idx));
- }
-
- // }}}
- // {{{ function nextID($seq_name, $ondemand = true)
-
- /**
- * Returns the next free id of a sequence
- *
- * @param string name of the sequence
- * @param bool when true missing sequences are automatic created
- *
- * @return mixed MDB2 Error Object or id
- *
- * @access public
- */
- function nextID($seq_name, $ondemand = true)
- {
- return MDB2_Driver_Common::raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- }
-
- // }}}
- // {{{ function lastInsertID($table = null, $field = null)
-
- /**
- * Returns the autoincrement ID if supported or $id or fetches the current
- * ID in a sequence called: $table.(empty($field) ? '' : '_'.$field)
- *
- * @param string name of the table into which a new row was inserted
- * @param string name of the field into which a new row was inserted
- *
- * @return mixed MDB2 Error Object or id
- *
- * @access public
- */
- function lastInsertID($table = null, $field = null)
- {
- return MDB2_Driver_Common::raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- }
-
- // }}}
- // {{{ function currID($seq_name)
-
- /**
- * Returns the current id of a sequence
- *
- * @param string name of the sequence
- *
- * @return mixed MDB2 Error Object or id
- *
- * @access public
- */
- function currID($seq_name)
- {
- $this->warnings[] = 'database does not support getting current
- sequence value, the sequence value was incremented';
- return $this->nextID($seq_name);
- }
-
- // }}}
- // {{{ function queryOne($query, $type = null, $colnum = 0)
-
- /**
- * Execute the specified query, fetch the value from the first column of
- * the first row of the result set and then frees
- * the result set.
- *
- * @param string $query the SELECT query statement to be executed.
- * @param string $type optional argument that specifies the expected
- * datatype of the result set field, so that an eventual
- * conversion may be performed. The default datatype is
- * text, meaning that no conversion is performed
- * @param mixed $colnum the column number (or name) to fetch
- *
- * @return mixed MDB2_OK or field value on success, a MDB2 error on failure
- *
- * @access public
- */
- function queryOne($query, $type = null, $colnum = 0)
- {
- $result = $this->query($query, $type);
- if (!MDB2::isResultCommon($result)) {
- return $result;
- }
-
- $one = $result->fetchOne($colnum);
- $result->free();
- return $one;
- }
-
- // }}}
- // {{{ function queryRow($query, $types = null, $fetchmode = MDB2_FETCHMODE_DEFAULT)
-
- /**
- * Execute the specified query, fetch the values from the first
- * row of the result set into an array and then frees
- * the result set.
- *
- * @param string the SELECT query statement to be executed.
- * @param array optional array argument that specifies a list of
- * expected datatypes of the result set columns, so that the eventual
- * conversions may be performed. The default list of datatypes is
- * empty, meaning that no conversion is performed.
- * @param int how the array data should be indexed
- *
- * @return mixed MDB2_OK or data array on success, a MDB2 error on failure
- *
- * @access public
- */
- function queryRow($query, $types = null, $fetchmode = MDB2_FETCHMODE_DEFAULT)
- {
- $result = $this->query($query, $types);
- if (!MDB2::isResultCommon($result)) {
- return $result;
- }
-
- $row = $result->fetchRow($fetchmode);
- $result->free();
- return $row;
- }
-
- // }}}
- // {{{ function queryCol($query, $type = null, $colnum = 0)
-
- /**
- * Execute the specified query, fetch the value from the first column of
- * each row of the result set into an array and then frees the result set.
- *
- * @param string $query the SELECT query statement to be executed.
- * @param string $type optional argument that specifies the expected
- * datatype of the result set field, so that an eventual
- * conversion may be performed. The default datatype is text,
- * meaning that no conversion is performed
- * @param mixed $colnum the column number (or name) to fetch
- *
- * @return mixed MDB2_OK or data array on success, a MDB2 error on failure
- * @access public
- */
- function queryCol($query, $type = null, $colnum = 0)
- {
- $result = $this->query($query, $type);
- if (!MDB2::isResultCommon($result)) {
- return $result;
- }
-
- $col = $result->fetchCol($colnum);
- $result->free();
- return $col;
- }
-
- // }}}
- // {{{ function queryAll($query, $types = null, $fetchmode = MDB2_FETCHMODE_DEFAULT, $rekey = false, $force_array = false, $group = false)
-
- /**
- * Execute the specified query, fetch all the rows of the result set into
- * a two dimensional array and then frees the result set.
- *
- * @param string the SELECT query statement to be executed.
- * @param array optional array argument that specifies a list of
- * expected datatypes of the result set columns, so that the eventual
- * conversions may be performed. The default list of datatypes is
- * empty, meaning that no conversion is performed.
- * @param int how the array data should be indexed
- * @param bool if set to true, the $all will have the first
- * column as its first dimension
- * @param bool used only when the query returns exactly
- * two columns. If true, the values of the returned array will be
- * one-element arrays instead of scalars.
- * @param bool if true, the values of the returned array is
- * wrapped in another array. If the same key value (in the first
- * column) repeats itself, the values will be appended to this array
- * instead of overwriting the existing values.
- *
- * @return mixed MDB2_OK or data array on success, a MDB2 error on failure
- *
- * @access public
- */
- function queryAll($query, $types = null, $fetchmode = MDB2_FETCHMODE_DEFAULT,
- $rekey = false, $force_array = false, $group = false)
- {
- $result = $this->query($query, $types);
- if (!MDB2::isResultCommon($result)) {
- return $result;
- }
-
- $all = $result->fetchAll($fetchmode, $rekey, $force_array, $group);
- $result->free();
- return $all;
- }
-
- // }}}
- // {{{ function delExpect($error_code)
-
- /**
- * This method deletes all occurences of the specified element from
- * the expected error codes stack.
- *
- * @param mixed $error_code error code that should be deleted
- * @return mixed list of error codes that were deleted or error
- *
- * @uses PEAR::delExpect()
- */
- public function delExpect($error_code)
- {
- return $this->pear->delExpect($error_code);
- }
-
- // }}}
- // {{{ function expectError($code)
-
- /**
- * This method is used to tell which errors you expect to get.
- * Expected errors are always returned with error mode
- * PEAR_ERROR_RETURN. Expected error codes are stored in a stack,
- * and this method pushes a new element onto it. The list of
- * expected errors are in effect until they are popped off the
- * stack with the popExpect() method.
- *
- * Note that this method can not be called statically
- *
- * @param mixed $code a single error code or an array of error codes to expect
- *
- * @return int the new depth of the "expected errors" stack
- *
- * @uses PEAR::expectError()
- */
- public function expectError($code = '*')
- {
- return $this->pear->expectError($code);
- }
-
- // }}}
- // {{{ function getStaticProperty($class, $var)
-
- /**
- * If you have a class that's mostly/entirely static, and you need static
- * properties, you can use this method to simulate them. Eg. in your method(s)
- * do this: $myVar = &PEAR::getStaticProperty('myclass', 'myVar');
- * You MUST use a reference, or they will not persist!
- *
- * @param string $class The calling classname, to prevent clashes
- * @param string $var The variable to retrieve.
- * @return mixed A reference to the variable. If not set it will be
- * auto initialised to NULL.
- *
- * @uses PEAR::getStaticProperty()
- */
- public function &getStaticProperty($class, $var)
- {
- $tmp = $this->pear->getStaticProperty($class, $var);
- return $tmp;
- }
-
- // }}}
- // {{{ function loadExtension($ext)
-
- /**
- * OS independant PHP extension load. Remember to take care
- * on the correct extension name for case sensitive OSes.
- *
- * @param string $ext The extension name
- * @return bool Success or not on the dl() call
- *
- * @uses PEAR::loadExtension()
- */
- public function loadExtension($ext)
- {
- return $this->pear->loadExtension($ext);
- }
-
- // }}}
- // {{{ function popErrorHandling()
-
- /**
- * Pop the last error handler used
- *
- * @return bool Always true
- *
- * @see PEAR::pushErrorHandling
- * @uses PEAR::popErrorHandling()
- */
- public function popErrorHandling()
- {
- return $this->pear->popErrorHandling();
- }
-
- // }}}
- // {{{ function popExpect()
-
- /**
- * This method pops one element off the expected error codes
- * stack.
- *
- * @return array the list of error codes that were popped
- *
- * @uses PEAR::popExpect()
- */
- public function popExpect()
- {
- return $this->pear->popExpect();
- }
-
- // }}}
- // {{{ function pushErrorHandling($mode, $options = null)
-
- /**
- * Push a new error handler on top of the error handler options stack. With this
- * you can easily override the actual error handler for some code and restore
- * it later with popErrorHandling.
- *
- * @param mixed $mode (same as setErrorHandling)
- * @param mixed $options (same as setErrorHandling)
- *
- * @return bool Always true
- *
- * @see PEAR::setErrorHandling
- * @uses PEAR::pushErrorHandling()
- */
- public function pushErrorHandling($mode, $options = null)
- {
- return $this->pear->pushErrorHandling($mode, $options);
- }
-
- // }}}
- // {{{ function registerShutdownFunc($func, $args = array())
-
- /**
- * Use this function to register a shutdown method for static
- * classes.
- *
- * @param mixed $func The function name (or array of class/method) to call
- * @param mixed $args The arguments to pass to the function
- * @return void
- *
- * @uses PEAR::registerShutdownFunc()
- */
- public function registerShutdownFunc($func, $args = array())
- {
- return $this->pear->registerShutdownFunc($func, $args);
- }
-
- // }}}
- // {{{ function setErrorHandling($mode = null, $options = null)
-
- /**
- * Sets how errors generated by this object should be handled.
- * Can be invoked both in objects and statically. If called
- * statically, setErrorHandling sets the default behaviour for all
- * PEAR objects. If called in an object, setErrorHandling sets
- * the default behaviour for that object.
- *
- * @param int $mode
- * One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT,
- * PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE,
- * PEAR_ERROR_CALLBACK or PEAR_ERROR_EXCEPTION.
- *
- * @param mixed $options
- * When $mode is PEAR_ERROR_TRIGGER, this is the error level (one
- * of E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR).
- *
- * When $mode is PEAR_ERROR_CALLBACK, this parameter is expected
- * to be the callback function or method. A callback
- * function is a string with the name of the function, a
- * callback method is an array of two elements: the element
- * at index 0 is the object, and the element at index 1 is
- * the name of the method to call in the object.
- *
- * When $mode is PEAR_ERROR_PRINT or PEAR_ERROR_DIE, this is
- * a printf format string used when printing the error
- * message.
- *
- * @access public
- * @return void
- * @see PEAR_ERROR_RETURN
- * @see PEAR_ERROR_PRINT
- * @see PEAR_ERROR_TRIGGER
- * @see PEAR_ERROR_DIE
- * @see PEAR_ERROR_CALLBACK
- * @see PEAR_ERROR_EXCEPTION
- *
- * @since PHP 4.0.5
- * @uses PEAR::setErrorHandling($mode, $options)
- */
- public function setErrorHandling($mode = null, $options = null)
- {
- return $this->pear->setErrorHandling($mode, $options);
- }
-
- /**
- * @uses PEAR::staticPopErrorHandling()
- */
- public function staticPopErrorHandling()
- {
- return $this->pear->staticPopErrorHandling();
- }
-
- // }}}
- // {{{ function staticPushErrorHandling($mode, $options = null)
-
- /**
- * @uses PEAR::staticPushErrorHandling($mode, $options)
- */
- public function staticPushErrorHandling($mode, $options = null)
- {
- return $this->pear->staticPushErrorHandling($mode, $options);
- }
-
- // }}}
- // {{{ function &throwError($message = null, $code = null, $userinfo = null)
-
- /**
- * Simpler form of raiseError with fewer options. In most cases
- * message, code and userinfo are enough.
- *
- * @param mixed $message a text error message or a PEAR error object
- *
- * @param int $code a numeric error code (it is up to your class
- * to define these if you want to use codes)
- *
- * @param string $userinfo If you need to pass along for example debug
- * information, this parameter is meant for that.
- *
- * @return object a PEAR error object
- * @see PEAR::raiseError
- * @uses PEAR::&throwError()
- */
- public function &throwError($message = null, $code = null, $userinfo = null)
- {
- $tmp = $this->pear->throwError($message, $code, $userinfo);
- return $tmp;
- }
-
- // }}}
-}
-
-// }}}
-// {{{ class MDB2_Result
-
-/**
- * The dummy class that all user space result classes should extend from
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Result
-{
-}
-
-// }}}
-// {{{ class MDB2_Result_Common extends MDB2_Result
-
-/**
- * The common result class for MDB2 result objects
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Result_Common extends MDB2_Result
-{
- // {{{ Variables (Properties)
-
- public $db;
- public $result;
- public $rownum = -1;
- public $types = array();
- public $types_assoc = array();
- public $values = array();
- public $offset;
- public $offset_count = 0;
- public $limit;
- public $column_names;
-
- // }}}
- // {{{ constructor: function __construct($db, &$result, $limit = 0, $offset = 0)
-
- /**
- * Constructor
- */
- function __construct($db, &$result, $limit = 0, $offset = 0)
- {
- $this->db = $db;
- $this->result = $result;
- $this->offset = $offset;
- $this->limit = max(0, $limit - 1);
- }
-
- // }}}
- // {{{ function setResultTypes($types)
-
- /**
- * Define the list of types to be associated with the columns of a given
- * result set.
- *
- * This function may be called before invoking fetchRow(), fetchOne(),
- * fetchCol() and fetchAll() so that the necessary data type
- * conversions are performed on the data to be retrieved by them. If this
- * function is not called, the type of all result set columns is assumed
- * to be text, thus leading to not perform any conversions.
- *
- * @param array variable that lists the
- * data types to be expected in the result set columns. If this array
- * contains less types than the number of columns that are returned
- * in the result set, the remaining columns are assumed to be of the
- * type text. Currently, the types clob and blob are not fully
- * supported.
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- *
- * @access public
- */
- function setResultTypes($types)
- {
- $load = $this->db->loadModule('Datatype', null, true);
- if (MDB2::isError($load)) {
- return $load;
- }
- $types = $this->db->datatype->checkResultTypes($types);
- if (MDB2::isError($types)) {
- return $types;
- }
- foreach ($types as $key => $value) {
- if (is_numeric($key)) {
- $this->types[$key] = $value;
- } else {
- $this->types_assoc[$key] = $value;
- }
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ function seek($rownum = 0)
-
- /**
- * Seek to a specific row in a result set
- *
- * @param int number of the row where the data can be found
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- *
- * @access public
- */
- function seek($rownum = 0)
- {
- $target_rownum = $rownum - 1;
- if ($this->rownum > $target_rownum) {
- return MDB2::raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'seeking to previous rows not implemented', __FUNCTION__);
- }
- while ($this->rownum < $target_rownum) {
- $this->fetchRow();
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ function &fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null)
-
- /**
- * Fetch and return a row of data
- *
- * @param int how the array data should be indexed
- * @param int number of the row where the data can be found
- *
- * @return int data array on success, a MDB2 error on failure
- *
- * @access public
- */
- function fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null)
- {
- $err = MDB2::raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- return $err;
- }
-
- // }}}
- // {{{ function fetchOne($colnum = 0)
-
- /**
- * fetch single column from the next row from a result set
- *
- * @param int|string the column number (or name) to fetch
- * @param int number of the row where the data can be found
- *
- * @return string data on success, a MDB2 error on failure
- * @access public
- */
- function fetchOne($colnum = 0, $rownum = null)
- {
- $fetchmode = is_numeric($colnum) ? MDB2_FETCHMODE_ORDERED : MDB2_FETCHMODE_ASSOC;
- $row = $this->fetchRow($fetchmode, $rownum);
- if (!is_array($row) || MDB2::isError($row)) {
- return $row;
- }
- if (!array_key_exists($colnum, $row)) {
- return MDB2::raiseError(MDB2_ERROR_TRUNCATED, null, null,
- 'column is not defined in the result set: '.$colnum, __FUNCTION__);
- }
- return $row[$colnum];
- }
-
- // }}}
- // {{{ function fetchCol($colnum = 0)
-
- /**
- * Fetch and return a column from the current row pointer position
- *
- * @param int|string the column number (or name) to fetch
- *
- * @return mixed data array on success, a MDB2 error on failure
- * @access public
- */
- function fetchCol($colnum = 0)
- {
- $column = array();
- $fetchmode = is_numeric($colnum) ? MDB2_FETCHMODE_ORDERED : MDB2_FETCHMODE_ASSOC;
- $row = $this->fetchRow($fetchmode);
- if (is_array($row)) {
- if (!array_key_exists($colnum, $row)) {
- return MDB2::raiseError(MDB2_ERROR_TRUNCATED, null, null,
- 'column is not defined in the result set: '.$colnum, __FUNCTION__);
- }
- do {
- $column[] = $row[$colnum];
- } while (is_array($row = $this->fetchRow($fetchmode)));
- }
- if (MDB2::isError($row)) {
- return $row;
- }
- return $column;
- }
-
- // }}}
- // {{{ function fetchAll($fetchmode = MDB2_FETCHMODE_DEFAULT, $rekey = false, $force_array = false, $group = false)
-
- /**
- * Fetch and return all rows from the current row pointer position
- *
- * @param int $fetchmode the fetch mode to use:
- * + MDB2_FETCHMODE_ORDERED
- * + MDB2_FETCHMODE_ASSOC
- * + MDB2_FETCHMODE_ORDERED | MDB2_FETCHMODE_FLIPPED
- * + MDB2_FETCHMODE_ASSOC | MDB2_FETCHMODE_FLIPPED
- * @param bool if set to true, the $all will have the first
- * column as its first dimension
- * @param bool used only when the query returns exactly
- * two columns. If true, the values of the returned array will be
- * one-element arrays instead of scalars.
- * @param bool if true, the values of the returned array is
- * wrapped in another array. If the same key value (in the first
- * column) repeats itself, the values will be appended to this array
- * instead of overwriting the existing values.
- *
- * @return mixed data array on success, a MDB2 error on failure
- *
- * @access public
- * @see getAssoc()
- */
- function fetchAll($fetchmode = MDB2_FETCHMODE_DEFAULT, $rekey = false,
- $force_array = false, $group = false)
- {
- $all = array();
- $row = $this->fetchRow($fetchmode);
- if (MDB2::isError($row)) {
- return $row;
- } elseif (!$row) {
- return $all;
- }
-
- $shift_array = $rekey ? false : null;
- if (null !== $shift_array) {
- if (is_object($row)) {
- $colnum = count(get_object_vars($row));
- } else {
- $colnum = count($row);
- }
- if ($colnum < 2) {
- return MDB2::raiseError(MDB2_ERROR_TRUNCATED, null, null,
- 'rekey feature requires atleast 2 column', __FUNCTION__);
- }
- $shift_array = (!$force_array && $colnum == 2);
- }
-
- if ($rekey) {
- do {
- if (is_object($row)) {
- $arr = get_object_vars($row);
- $key = reset($arr);
- unset($row->{$key});
- } else {
- if ( $fetchmode == MDB2_FETCHMODE_ASSOC
- || $fetchmode == MDB2_FETCHMODE_OBJECT
- ) {
- $key = reset($row);
- unset($row[key($row)]);
- } else {
- $key = array_shift($row);
- }
- if ($shift_array) {
- $row = array_shift($row);
- }
- }
- if ($group) {
- $all[$key][] = $row;
- } else {
- $all[$key] = $row;
- }
- } while (($row = $this->fetchRow($fetchmode)));
- } elseif ($fetchmode == MDB2_FETCHMODE_FLIPPED) {
- do {
- foreach ($row as $key => $val) {
- $all[$key][] = $val;
- }
- } while (($row = $this->fetchRow($fetchmode)));
- } else {
- do {
- $all[] = $row;
- } while (($row = $this->fetchRow($fetchmode)));
- }
-
- return $all;
- }
-
- // }}}
- // {{{ function rowCount()
- /**
- * Returns the actual row number that was last fetched (count from 0)
- * @return int
- *
- * @access public
- */
- function rowCount()
- {
- return $this->rownum + 1;
- }
-
- // }}}
- // {{{ function numRows()
-
- /**
- * Returns the number of rows in a result object
- *
- * @return mixed MDB2 Error Object or the number of rows
- *
- * @access public
- */
- function numRows()
- {
- return MDB2::raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- }
-
- // }}}
- // {{{ function nextResult()
-
- /**
- * Move the internal result pointer to the next available result
- *
- * @return true on success, false if there is no more result set or an error object on failure
- *
- * @access public
- */
- function nextResult()
- {
- return MDB2::raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- }
-
- // }}}
- // {{{ function getColumnNames()
-
- /**
- * Retrieve the names of columns returned by the DBMS in a query result or
- * from the cache.
- *
- * @param bool If set to true the values are the column names,
- * otherwise the names of the columns are the keys.
- * @return mixed Array variable that holds the names of columns or an
- * MDB2 error on failure.
- * Some DBMS may not return any columns when the result set
- * does not contain any rows.
- *
- * @access public
- */
- function getColumnNames($flip = false)
- {
- if (!isset($this->column_names)) {
- $result = $this->_getColumnNames();
- if (MDB2::isError($result)) {
- return $result;
- }
- $this->column_names = $result;
- }
- if ($flip) {
- return array_flip($this->column_names);
- }
- return $this->column_names;
- }
-
- // }}}
- // {{{ function _getColumnNames()
-
- /**
- * Retrieve the names of columns returned by the DBMS in a query result.
- *
- * @return mixed Array variable that holds the names of columns as keys
- * or an MDB2 error on failure.
- * Some DBMS may not return any columns when the result set
- * does not contain any rows.
- *
- * @access private
- */
- function _getColumnNames()
- {
- return MDB2::raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- }
-
- // }}}
- // {{{ function numCols()
-
- /**
- * Count the number of columns returned by the DBMS in a query result.
- *
- * @return mixed integer value with the number of columns, a MDB2 error
- * on failure
- *
- * @access public
- */
- function numCols()
- {
- return MDB2::raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- }
-
- // }}}
- // {{{ function getResource()
-
- /**
- * return the resource associated with the result object
- *
- * @return resource
- *
- * @access public
- */
- function getResource()
- {
- return $this->result;
- }
-
- // }}}
- // {{{ function bindColumn($column, &$value, $type = null)
-
- /**
- * Set bind variable to a column.
- *
- * @param int column number or name
- * @param mixed variable reference
- * @param string specifies the type of the field
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- *
- * @access public
- */
- function bindColumn($column, &$value, $type = null)
- {
- if (!is_numeric($column)) {
- $column_names = $this->getColumnNames();
- if ($this->db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- if ($this->db->options['field_case'] == CASE_LOWER) {
- $column = strtolower($column);
- } else {
- $column = strtoupper($column);
- }
- }
- $column = $column_names[$column];
- }
- $this->values[$column] =& $value;
- if (null !== $type) {
- $this->types[$column] = $type;
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ function _assignBindColumns($row)
-
- /**
- * Bind a variable to a value in the result row.
- *
- * @param array row data
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- *
- * @access private
- */
- function _assignBindColumns($row)
- {
- $row = array_values($row);
- foreach ($row as $column => $value) {
- if (array_key_exists($column, $this->values)) {
- $this->values[$column] = $value;
- }
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ function free()
-
- /**
- * Free the internal resources associated with result.
- *
- * @return bool true on success, false if result is invalid
- *
- * @access public
- */
- function free()
- {
- $this->result = false;
- return MDB2_OK;
- }
-
- // }}}
-}
-
-// }}}
-// {{{ class MDB2_Row
-
-/**
- * The simple class that accepts row data as an array
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Row
-{
- // {{{ constructor: function __construct(&$row)
-
- /**
- * constructor
- *
- * @param resource row data as array
- */
- function __construct(&$row)
- {
- foreach ($row as $key => $value) {
- $this->$key = &$row[$key];
- }
- }
-
- // }}}
-}
-
-// }}}
-// {{{ class MDB2_Statement_Common
-
-/**
- * The common statement class for MDB2 statement objects
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Statement_Common
-{
- // {{{ Variables (Properties)
-
- var $db;
- var $statement;
- var $query;
- var $result_types;
- var $types;
- var $values = array();
- var $limit;
- var $offset;
- var $is_manip;
-
- // }}}
- // {{{ constructor: function __construct($db, $statement, $positions, $query, $types, $result_types, $is_manip = false, $limit = null, $offset = null)
-
- /**
- * Constructor
- */
- function __construct($db, $statement, $positions, $query, $types, $result_types, $is_manip = false, $limit = null, $offset = null)
- {
- $this->db = $db;
- $this->statement = $statement;
- $this->positions = $positions;
- $this->query = $query;
- $this->types = (array)$types;
- $this->result_types = (array)$result_types;
- $this->limit = $limit;
- $this->is_manip = $is_manip;
- $this->offset = $offset;
- }
-
- // }}}
- // {{{ function bindValue($parameter, &$value, $type = null)
-
- /**
- * Set the value of a parameter of a prepared query.
- *
- * @param int the order number of the parameter in the query
- * statement. The order number of the first parameter is 1.
- * @param mixed value that is meant to be assigned to specified
- * parameter. The type of the value depends on the $type argument.
- * @param string specifies the type of the field
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- *
- * @access public
- */
- function bindValue($parameter, $value, $type = null)
- {
- if (!is_numeric($parameter)) {
- if (strpos($parameter, ':') === 0) {
- $parameter = substr($parameter, 1);
- }
- }
- if (!in_array($parameter, $this->positions)) {
- return MDB2::raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- 'Unable to bind to missing placeholder: '.$parameter, __FUNCTION__);
- }
- $this->values[$parameter] = $value;
- if (null !== $type) {
- $this->types[$parameter] = $type;
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ function bindValueArray($values, $types = null)
-
- /**
- * Set the values of multiple a parameter of a prepared query in bulk.
- *
- * @param array specifies all necessary information
- * for bindValue() the array elements must use keys corresponding to
- * the number of the position of the parameter.
- * @param array specifies the types of the fields
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- *
- * @access public
- * @see bindParam()
- */
- function bindValueArray($values, $types = null)
- {
- $types = is_array($types) ? array_values($types) : array_fill(0, count($values), null);
- $parameters = array_keys($values);
- $this->db->pushErrorHandling(PEAR_ERROR_RETURN);
- $this->db->expectError(MDB2_ERROR_NOT_FOUND);
- foreach ($parameters as $key => $parameter) {
- $err = $this->bindValue($parameter, $values[$parameter], $types[$key]);
- if (MDB2::isError($err)) {
- if ($err->getCode() == MDB2_ERROR_NOT_FOUND) {
- //ignore (extra value for missing placeholder)
- continue;
- }
- $this->db->popExpect();
- $this->db->popErrorHandling();
- return $err;
- }
- }
- $this->db->popExpect();
- $this->db->popErrorHandling();
- return MDB2_OK;
- }
-
- // }}}
- // {{{ function bindParam($parameter, &$value, $type = null)
-
- /**
- * Bind a variable to a parameter of a prepared query.
- *
- * @param int the order number of the parameter in the query
- * statement. The order number of the first parameter is 1.
- * @param mixed variable that is meant to be bound to specified
- * parameter. The type of the value depends on the $type argument.
- * @param string specifies the type of the field
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- *
- * @access public
- */
- function bindParam($parameter, &$value, $type = null)
- {
- if (!is_numeric($parameter)) {
- if (strpos($parameter, ':') === 0) {
- $parameter = substr($parameter, 1);
- }
- }
- if (!in_array($parameter, $this->positions)) {
- return MDB2::raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- 'Unable to bind to missing placeholder: '.$parameter, __FUNCTION__);
- }
- $this->values[$parameter] =& $value;
- if (null !== $type) {
- $this->types[$parameter] = $type;
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ function bindParamArray(&$values, $types = null)
-
- /**
- * Bind the variables of multiple a parameter of a prepared query in bulk.
- *
- * @param array specifies all necessary information
- * for bindParam() the array elements must use keys corresponding to
- * the number of the position of the parameter.
- * @param array specifies the types of the fields
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- *
- * @access public
- * @see bindParam()
- */
- function bindParamArray(&$values, $types = null)
- {
- $types = is_array($types) ? array_values($types) : array_fill(0, count($values), null);
- $parameters = array_keys($values);
- foreach ($parameters as $key => $parameter) {
- $err = $this->bindParam($parameter, $values[$parameter], $types[$key]);
- if (MDB2::isError($err)) {
- return $err;
- }
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ function &execute($values = null, $result_class = true, $result_wrap_class = false)
-
- /**
- * Execute a prepared query statement.
- *
- * @param array specifies all necessary information
- * for bindParam() the array elements must use keys corresponding
- * to the number of the position of the parameter.
- * @param mixed specifies which result class to use
- * @param mixed specifies which class to wrap results in
- *
- * @return mixed MDB2_Result or integer (affected rows) on success,
- * a MDB2 error on failure
- * @access public
- */
- function execute($values = null, $result_class = true, $result_wrap_class = false)
- {
- if (null === $this->positions) {
- return MDB2::raiseError(MDB2_ERROR, null, null,
- 'Prepared statement has already been freed', __FUNCTION__);
- }
-
- $values = (array)$values;
- if (!empty($values)) {
- $err = $this->bindValueArray($values);
- if (MDB2::isError($err)) {
- return MDB2::raiseError(MDB2_ERROR, null, null,
- 'Binding Values failed with message: ' . $err->getMessage(), __FUNCTION__);
- }
- }
- $result = $this->_execute($result_class, $result_wrap_class);
- return $result;
- }
-
- // }}}
- // {{{ function _execute($result_class = true, $result_wrap_class = false)
-
- /**
- * Execute a prepared query statement helper method.
- *
- * @param mixed specifies which result class to use
- * @param mixed specifies which class to wrap results in
- *
- * @return mixed MDB2_Result or integer (affected rows) on success,
- * a MDB2 error on failure
- * @access private
- */
- function _execute($result_class = true, $result_wrap_class = false)
- {
- $this->last_query = $this->query;
- $query = '';
- $last_position = 0;
- foreach ($this->positions as $current_position => $parameter) {
- if (!array_key_exists($parameter, $this->values)) {
- return MDB2::raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- 'Unable to bind to missing placeholder: '.$parameter, __FUNCTION__);
- }
- $value = $this->values[$parameter];
- $query.= substr($this->query, $last_position, $current_position - $last_position);
- if (!isset($value)) {
- $value_quoted = 'NULL';
- } else {
- $type = !empty($this->types[$parameter]) ? $this->types[$parameter] : null;
- $value_quoted = $this->db->quote($value, $type);
- if (MDB2::isError($value_quoted)) {
- return $value_quoted;
- }
- }
- $query.= $value_quoted;
- $last_position = $current_position + 1;
- }
- $query.= substr($this->query, $last_position);
-
- $this->db->offset = $this->offset;
- $this->db->limit = $this->limit;
- if ($this->is_manip) {
- $result = $this->db->exec($query);
- } else {
- $result = $this->db->query($query, $this->result_types, $result_class, $result_wrap_class);
- }
- return $result;
- }
-
- // }}}
- // {{{ function free()
-
- /**
- * Release resources allocated for the specified prepared query.
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- *
- * @access public
- */
- function free()
- {
- if (null === $this->positions) {
- return MDB2::raiseError(MDB2_ERROR, null, null,
- 'Prepared statement has already been freed', __FUNCTION__);
- }
-
- $this->statement = null;
- $this->positions = null;
- $this->query = null;
- $this->types = null;
- $this->result_types = null;
- $this->limit = null;
- $this->is_manip = null;
- $this->offset = null;
- $this->values = null;
-
- return MDB2_OK;
- }
-
- // }}}
-}
-
-// }}}
-// {{{ class MDB2_Module_Common
-
-/**
- * The common modules class for MDB2 module objects
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Module_Common
-{
- // {{{ Variables (Properties)
-
- /**
- * contains the key to the global MDB2 instance array of the associated
- * MDB2 instance
- *
- * @var int
- * @access protected
- */
- protected $db_index;
-
- // }}}
- // {{{ constructor: function __construct($db_index)
-
- /**
- * Constructor
- */
- function __construct($db_index)
- {
- $this->db_index = $db_index;
- }
-
- // }}}
- // {{{ function getDBInstance()
-
- /**
- * Get the instance of MDB2 associated with the module instance
- *
- * @return object MDB2 instance or a MDB2 error on failure
- *
- * @access public
- */
- function getDBInstance()
- {
- if (isset($GLOBALS['_MDB2_databases'][$this->db_index])) {
- $result = $GLOBALS['_MDB2_databases'][$this->db_index];
- } else {
- $result = MDB2::raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- 'could not find MDB2 instance');
- }
- return $result;
- }
-
- // }}}
-}
-
-// }}}
-// {{{ function MDB2_closeOpenTransactions()
-
-/**
- * Close any open transactions form persistent connections
- *
- * @return void
- *
- * @access public
- */
-
-function MDB2_closeOpenTransactions()
-{
- reset($GLOBALS['_MDB2_databases']);
- while (next($GLOBALS['_MDB2_databases'])) {
- $key = key($GLOBALS['_MDB2_databases']);
- if ($GLOBALS['_MDB2_databases'][$key]->opened_persistent
- && $GLOBALS['_MDB2_databases'][$key]->in_transaction
- ) {
- $GLOBALS['_MDB2_databases'][$key]->rollback();
- }
- }
-}
-
-// }}}
-// {{{ function MDB2_defaultDebugOutput(&$db, $scope, $message, $is_manip = null)
-
-/**
- * default debug output handler
- *
- * @param object reference to an MDB2 database object
- * @param string usually the method name that triggered the debug call:
- * for example 'query', 'prepare', 'execute', 'parameters',
- * 'beginTransaction', 'commit', 'rollback'
- * @param string message that should be appended to the debug variable
- * @param array contains context information about the debug() call
- * common keys are: is_manip, time, result etc.
- *
- * @return void|string optionally return a modified message, this allows
- * rewriting a query before being issued or prepared
- *
- * @access public
- */
-function MDB2_defaultDebugOutput(&$db, $scope, $message, $context = array())
-{
- $db->debug_output.= $scope.'('.$db->db_index.'): ';
- $db->debug_output.= $message.$db->getOption('log_line_break');
- return $message;
-}
-
-// }}}
-?>
diff --git a/3rdparty/MDB2/Date.php b/3rdparty/MDB2/Date.php
deleted file mode 100644
index ca88eaa347e..00000000000
--- a/3rdparty/MDB2/Date.php
+++ /dev/null
@@ -1,183 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox, |
-// | Stig. S. Bakken, Lukas Smith |
-// | All rights reserved. |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
-// | API as well as database abstraction for PHP applications. |
-// | This LICENSE is in the BSD license style. |
-// | |
-// | Redistribution and use in source and binary forms, with or without |
-// | modification, are permitted provided that the following conditions |
-// | are met: |
-// | |
-// | Redistributions of source code must retain the above copyright |
-// | notice, this list of conditions and the following disclaimer. |
-// | |
-// | Redistributions in binary form must reproduce the above copyright |
-// | notice, this list of conditions and the following disclaimer in the |
-// | documentation and/or other materials provided with the distribution. |
-// | |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission. |
-// | |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-// | POSSIBILITY OF SUCH DAMAGE. |
-// +----------------------------------------------------------------------+
-// | Author: Lukas Smith <smith@pooteeweet.org> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-
-/**
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-
-/**
- * Several methods to convert the MDB2 native timestamp format (ISO based)
- * to and from data structures that are convenient to worth with in side of php.
- * For more complex date arithmetic please take a look at the Date package in PEAR
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Date
-{
- // {{{ mdbNow()
-
- /**
- * return the current datetime
- *
- * @return string current datetime in the MDB2 format
- * @access public
- */
- function mdbNow()
- {
- return date('Y-m-d H:i:s');
- }
- // }}}
-
- // {{{ mdbToday()
-
- /**
- * return the current date
- *
- * @return string current date in the MDB2 format
- * @access public
- */
- function mdbToday()
- {
- return date('Y-m-d');
- }
- // }}}
-
- // {{{ mdbTime()
-
- /**
- * return the current time
- *
- * @return string current time in the MDB2 format
- * @access public
- */
- function mdbTime()
- {
- return date('H:i:s');
- }
- // }}}
-
- // {{{ date2Mdbstamp()
-
- /**
- * convert a date into a MDB2 timestamp
- *
- * @param int hour of the date
- * @param int minute of the date
- * @param int second of the date
- * @param int month of the date
- * @param int day of the date
- * @param int year of the date
- *
- * @return string a valid MDB2 timestamp
- * @access public
- */
- function date2Mdbstamp($hour = null, $minute = null, $second = null,
- $month = null, $day = null, $year = null)
- {
- return MDB2_Date::unix2Mdbstamp(mktime($hour, $minute, $second, $month, $day, $year, -1));
- }
- // }}}
-
- // {{{ unix2Mdbstamp()
-
- /**
- * convert a unix timestamp into a MDB2 timestamp
- *
- * @param int a valid unix timestamp
- *
- * @return string a valid MDB2 timestamp
- * @access public
- */
- function unix2Mdbstamp($unix_timestamp)
- {
- return date('Y-m-d H:i:s', $unix_timestamp);
- }
- // }}}
-
- // {{{ mdbstamp2Unix()
-
- /**
- * convert a MDB2 timestamp into a unix timestamp
- *
- * @param int a valid MDB2 timestamp
- * @return string unix timestamp with the time stored in the MDB2 format
- *
- * @access public
- */
- function mdbstamp2Unix($mdb_timestamp)
- {
- $arr = MDB2_Date::mdbstamp2Date($mdb_timestamp);
-
- return mktime($arr['hour'], $arr['minute'], $arr['second'], $arr['month'], $arr['day'], $arr['year'], -1);
- }
- // }}}
-
- // {{{ mdbstamp2Date()
-
- /**
- * convert a MDB2 timestamp into an array containing all
- * values necessary to pass to php's date() function
- *
- * @param int a valid MDB2 timestamp
- *
- * @return array with the time split
- * @access public
- */
- function mdbstamp2Date($mdb_timestamp)
- {
- list($arr['year'], $arr['month'], $arr['day'], $arr['hour'], $arr['minute'], $arr['second']) =
- sscanf($mdb_timestamp, "%04u-%02u-%02u %02u:%02u:%02u");
- return $arr;
- }
- // }}}
-}
-
-?>
diff --git a/3rdparty/MDB2/Driver/Datatype/Common.php b/3rdparty/MDB2/Driver/Datatype/Common.php
deleted file mode 100644
index dd7f1c7e0a9..00000000000
--- a/3rdparty/MDB2/Driver/Datatype/Common.php
+++ /dev/null
@@ -1,1842 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2007 Manuel Lemos, Tomas V.V.Cox, |
-// | Stig. S. Bakken, Lukas Smith |
-// | All rights reserved. |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
-// | API as well as database abstraction for PHP applications. |
-// | This LICENSE is in the BSD license style. |
-// | |
-// | Redistribution and use in source and binary forms, with or without |
-// | modification, are permitted provided that the following conditions |
-// | are met: |
-// | |
-// | Redistributions of source code must retain the above copyright |
-// | notice, this list of conditions and the following disclaimer. |
-// | |
-// | Redistributions in binary form must reproduce the above copyright |
-// | notice, this list of conditions and the following disclaimer in the |
-// | documentation and/or other materials provided with the distribution. |
-// | |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission. |
-// | |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-// | POSSIBILITY OF SUCH DAMAGE. |
-// +----------------------------------------------------------------------+
-// | Author: Lukas Smith <smith@pooteeweet.org> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-require_once 'MDB2/LOB.php';
-
-/**
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-
-/**
- * MDB2_Driver_Common: Base class that is extended by each MDB2 driver
- *
- * To load this module in the MDB2 object:
- * $mdb->loadModule('Datatype');
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Driver_Datatype_Common extends MDB2_Module_Common
-{
- var $valid_default_values = array(
- 'text' => '',
- 'boolean' => true,
- 'integer' => 0,
- 'decimal' => 0.0,
- 'float' => 0.0,
- 'timestamp' => '1970-01-01 00:00:00',
- 'time' => '00:00:00',
- 'date' => '1970-01-01',
- 'clob' => '',
- 'blob' => '',
- );
-
- /**
- * contains all LOB objects created with this MDB2 instance
- * @var array
- * @access protected
- */
- var $lobs = array();
-
- // }}}
- // {{{ getValidTypes()
-
- /**
- * Get the list of valid types
- *
- * This function returns an array of valid types as keys with the values
- * being possible default values for all native datatypes and mapped types
- * for custom datatypes.
- *
- * @return mixed array on success, a MDB2 error on failure
- * @access public
- */
- function getValidTypes()
- {
- $types = $this->valid_default_values;
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
- if (!empty($db->options['datatype_map'])) {
- foreach ($db->options['datatype_map'] as $type => $mapped_type) {
- if (array_key_exists($mapped_type, $types)) {
- $types[$type] = $types[$mapped_type];
- } elseif (!empty($db->options['datatype_map_callback'][$type])) {
- $parameter = array('type' => $type, 'mapped_type' => $mapped_type);
- $default = call_user_func_array($db->options['datatype_map_callback'][$type], array(&$db, __FUNCTION__, $parameter));
- $types[$type] = $default;
- }
- }
- }
- return $types;
- }
-
- // }}}
- // {{{ checkResultTypes()
-
- /**
- * Define the list of types to be associated with the columns of a given
- * result set.
- *
- * This function may be called before invoking fetchRow(), fetchOne()
- * fetchCole() and fetchAll() so that the necessary data type
- * conversions are performed on the data to be retrieved by them. If this
- * function is not called, the type of all result set columns is assumed
- * to be text, thus leading to not perform any conversions.
- *
- * @param array $types array variable that lists the
- * data types to be expected in the result set columns. If this array
- * contains less types than the number of columns that are returned
- * in the result set, the remaining columns are assumed to be of the
- * type text. Currently, the types clob and blob are not fully
- * supported.
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function checkResultTypes($types)
- {
- $types = is_array($types) ? $types : array($types);
- foreach ($types as $key => $type) {
- if (!isset($this->valid_default_values[$type])) {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
- if (empty($db->options['datatype_map'][$type])) {
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- $type.' for '.$key.' is not a supported column type', __FUNCTION__);
- }
- }
- }
- return $types;
- }
-
- // }}}
- // {{{ _baseConvertResult()
-
- /**
- * General type conversion method
- *
- * @param mixed $value reference to a value to be converted
- * @param string $type specifies which type to convert to
- * @param boolean $rtrim [optional] when TRUE [default], apply rtrim() to text
- * @return object an MDB2 error on failure
- * @access protected
- */
- function _baseConvertResult($value, $type, $rtrim = true)
- {
- switch ($type) {
- case 'text':
- if ($rtrim) {
- $value = rtrim($value);
- }
- return $value;
- case 'integer':
- return intval($value);
- case 'boolean':
- return !empty($value);
- case 'decimal':
- return $value;
- case 'float':
- return doubleval($value);
- case 'date':
- return $value;
- case 'time':
- return $value;
- case 'timestamp':
- return $value;
- case 'clob':
- case 'blob':
- $this->lobs[] = array(
- 'buffer' => null,
- 'position' => 0,
- 'lob_index' => null,
- 'endOfLOB' => false,
- 'resource' => $value,
- 'value' => null,
- 'loaded' => false,
- );
- end($this->lobs);
- $lob_index = key($this->lobs);
- $this->lobs[$lob_index]['lob_index'] = $lob_index;
- return fopen('MDB2LOB://'.$lob_index.'@'.$this->db_index, 'r+');
- }
-
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- return $db->raiseError(MDB2_ERROR_INVALID, null, null,
- 'attempt to convert result value to an unknown type :' . $type, __FUNCTION__);
- }
-
- // }}}
- // {{{ convertResult()
-
- /**
- * Convert a value to a RDBMS indipendent MDB2 type
- *
- * @param mixed $value value to be converted
- * @param string $type specifies which type to convert to
- * @param boolean $rtrim [optional] when TRUE [default], apply rtrim() to text
- * @return mixed converted value
- * @access public
- */
- function convertResult($value, $type, $rtrim = true)
- {
- if (null === $value) {
- return null;
- }
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
- if (!empty($db->options['datatype_map'][$type])) {
- $type = $db->options['datatype_map'][$type];
- if (!empty($db->options['datatype_map_callback'][$type])) {
- $parameter = array('type' => $type, 'value' => $value, 'rtrim' => $rtrim);
- return call_user_func_array($db->options['datatype_map_callback'][$type], array(&$db, __FUNCTION__, $parameter));
- }
- }
- return $this->_baseConvertResult($value, $type, $rtrim);
- }
-
- // }}}
- // {{{ convertResultRow()
-
- /**
- * Convert a result row
- *
- * @param array $types
- * @param array $row specifies the types to convert to
- * @param boolean $rtrim [optional] when TRUE [default], apply rtrim() to text
- * @return mixed MDB2_OK on success, an MDB2 error on failure
- * @access public
- */
- function convertResultRow($types, $row, $rtrim = true)
- {
- //$types = $this->_sortResultFieldTypes(array_keys($row), $types);
- $keys = array_keys($row);
- if (is_int($keys[0])) {
- $types = $this->_sortResultFieldTypes($keys, $types);
- }
- foreach ($row as $key => $value) {
- if (empty($types[$key])) {
- continue;
- }
- $value = $this->convertResult($row[$key], $types[$key], $rtrim);
- if (PEAR::isError($value)) {
- return $value;
- }
- $row[$key] = $value;
- }
- return $row;
- }
-
- // }}}
- // {{{ _sortResultFieldTypes()
-
- /**
- * convert a result row
- *
- * @param array $types
- * @param array $row specifies the types to convert to
- * @param bool $rtrim if to rtrim text values or not
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function _sortResultFieldTypes($columns, $types)
- {
- $n_cols = count($columns);
- $n_types = count($types);
- if ($n_cols > $n_types) {
- for ($i= $n_cols - $n_types; $i >= 0; $i--) {
- $types[] = null;
- }
- }
- $sorted_types = array();
- foreach ($columns as $col) {
- $sorted_types[$col] = null;
- }
- foreach ($types as $name => $type) {
- if (array_key_exists($name, $sorted_types)) {
- $sorted_types[$name] = $type;
- unset($types[$name]);
- }
- }
- // if there are left types in the array, fill the null values of the
- // sorted array with them, in order.
- if (count($types)) {
- reset($types);
- foreach (array_keys($sorted_types) as $k) {
- if (null === $sorted_types[$k]) {
- $sorted_types[$k] = current($types);
- next($types);
- }
- }
- }
- return $sorted_types;
- }
-
- // }}}
- // {{{ getDeclaration()
-
- /**
- * Obtain DBMS specific SQL code portion needed to declare
- * of the given type
- *
- * @param string $type type to which the value should be converted to
- * @param string $name name the field to be declared.
- * @param string $field definition of the field
- * @return string DBMS specific SQL code portion that should be used to
- * declare the specified field.
- * @access public
- */
- function getDeclaration($type, $name, $field)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- if (!empty($db->options['datatype_map'][$type])) {
- $type = $db->options['datatype_map'][$type];
- if (!empty($db->options['datatype_map_callback'][$type])) {
- $parameter = array('type' => $type, 'name' => $name, 'field' => $field);
- return call_user_func_array($db->options['datatype_map_callback'][$type], array(&$db, __FUNCTION__, $parameter));
- }
- $field['type'] = $type;
- }
-
- if (!method_exists($this, "_get{$type}Declaration")) {
- return $db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- 'type not defined: '.$type, __FUNCTION__);
- }
- return $this->{"_get{$type}Declaration"}($name, $field);
- }
-
- // }}}
- // {{{ getTypeDeclaration()
-
- /**
- * Obtain DBMS specific SQL code portion needed to declare an text type
- * field to be used in statements like CREATE TABLE.
- *
- * @param array $field associative array with the name of the properties
- * of the field being declared as array indexes. Currently, the types
- * of supported field properties are as follows:
- *
- * length
- * Integer value that determines the maximum length of the text
- * field. If this argument is missing the field should be
- * declared to have the longest length allowed by the DBMS.
- *
- * default
- * Text value to be used as default for this field.
- *
- * notnull
- * Boolean flag that indicates whether this field is constrained
- * to not be set to null.
- * @return string DBMS specific SQL code portion that should be used to
- * declare the specified field.
- * @access public
- */
- function getTypeDeclaration($field)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- switch ($field['type']) {
- case 'text':
- $length = !empty($field['length']) ? $field['length'] : $db->options['default_text_field_length'];
- $fixed = !empty($field['fixed']) ? $field['fixed'] : false;
- return $fixed ? ($length ? 'CHAR('.$length.')' : 'CHAR('.$db->options['default_text_field_length'].')')
- : ($length ? 'VARCHAR('.$length.')' : 'TEXT');
- case 'clob':
- return 'TEXT';
- case 'blob':
- return 'TEXT';
- case 'integer':
- return 'INT';
- case 'boolean':
- return 'INT';
- case 'date':
- return 'CHAR ('.strlen('YYYY-MM-DD').')';
- case 'time':
- return 'CHAR ('.strlen('HH:MM:SS').')';
- case 'timestamp':
- return 'CHAR ('.strlen('YYYY-MM-DD HH:MM:SS').')';
- case 'float':
- return 'TEXT';
- case 'decimal':
- return 'TEXT';
- }
- return '';
- }
-
- // }}}
- // {{{ _getDeclaration()
-
- /**
- * Obtain DBMS specific SQL code portion needed to declare a generic type
- * field to be used in statements like CREATE TABLE.
- *
- * @param string $name name the field to be declared.
- * @param array $field associative array with the name of the properties
- * of the field being declared as array indexes. Currently, the types
- * of supported field properties are as follows:
- *
- * length
- * Integer value that determines the maximum length of the text
- * field. If this argument is missing the field should be
- * declared to have the longest length allowed by the DBMS.
- *
- * default
- * Text value to be used as default for this field.
- *
- * notnull
- * Boolean flag that indicates whether this field is constrained
- * to not be set to null.
- * charset
- * Text value with the default CHARACTER SET for this field.
- * collation
- * Text value with the default COLLATION for this field.
- * @return string DBMS specific SQL code portion that should be used to
- * declare the specified field, or a MDB2_Error on failure
- * @access protected
- */
- function _getDeclaration($name, $field)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $name = $db->quoteIdentifier($name, true);
- $declaration_options = $db->datatype->_getDeclarationOptions($field);
- if (PEAR::isError($declaration_options)) {
- return $declaration_options;
- }
- return $name.' '.$this->getTypeDeclaration($field).$declaration_options;
- }
-
- // }}}
- // {{{ _getDeclarationOptions()
-
- /**
- * Obtain DBMS specific SQL code portion needed to declare a generic type
- * field to be used in statement like CREATE TABLE, without the field name
- * and type values (ie. just the character set, default value, if the
- * field is permitted to be NULL or not, and the collation options).
- *
- * @param array $field associative array with the name of the properties
- * of the field being declared as array indexes. Currently, the types
- * of supported field properties are as follows:
- *
- * default
- * Text value to be used as default for this field.
- * notnull
- * Boolean flag that indicates whether this field is constrained
- * to not be set to null.
- * charset
- * Text value with the default CHARACTER SET for this field.
- * collation
- * Text value with the default COLLATION for this field.
- * @return string DBMS specific SQL code portion that should be used to
- * declare the specified field's options.
- * @access protected
- */
- function _getDeclarationOptions($field)
- {
- $charset = empty($field['charset']) ? '' :
- ' '.$this->_getCharsetFieldDeclaration($field['charset']);
-
- $notnull = empty($field['notnull']) ? '' : ' NOT NULL';
- $default = '';
- if (array_key_exists('default', $field)) {
- if ($field['default'] === '') {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
- $valid_default_values = $this->getValidTypes();
- $field['default'] = $valid_default_values[$field['type']];
- if ($field['default'] === '' && ($db->options['portability'] & MDB2_PORTABILITY_EMPTY_TO_NULL)) {
- $field['default'] = ' ';
- }
- }
- if (null !== $field['default']) {
- $default = ' DEFAULT ' . $this->quote($field['default'], $field['type']);
- }
- }
-
- $collation = empty($field['collation']) ? '' :
- ' '.$this->_getCollationFieldDeclaration($field['collation']);
-
- return $charset.$default.$notnull.$collation;
- }
-
- // }}}
- // {{{ _getCharsetFieldDeclaration()
-
- /**
- * Obtain DBMS specific SQL code portion needed to set the CHARACTER SET
- * of a field declaration to be used in statements like CREATE TABLE.
- *
- * @param string $charset name of the charset
- * @return string DBMS specific SQL code portion needed to set the CHARACTER SET
- * of a field declaration.
- */
- function _getCharsetFieldDeclaration($charset)
- {
- return '';
- }
-
- // }}}
- // {{{ _getCollationFieldDeclaration()
-
- /**
- * Obtain DBMS specific SQL code portion needed to set the COLLATION
- * of a field declaration to be used in statements like CREATE TABLE.
- *
- * @param string $collation name of the collation
- * @return string DBMS specific SQL code portion needed to set the COLLATION
- * of a field declaration.
- */
- function _getCollationFieldDeclaration($collation)
- {
- return '';
- }
-
- // }}}
- // {{{ _getIntegerDeclaration()
-
- /**
- * Obtain DBMS specific SQL code portion needed to declare an integer type
- * field to be used in statements like CREATE TABLE.
- *
- * @param string $name name the field to be declared.
- * @param array $field associative array with the name of the properties
- * of the field being declared as array indexes. Currently, the types
- * of supported field properties are as follows:
- *
- * unsigned
- * Boolean flag that indicates whether the field should be
- * declared as unsigned integer if possible.
- *
- * default
- * Integer value to be used as default for this field.
- *
- * notnull
- * Boolean flag that indicates whether this field is constrained
- * to not be set to null.
- * @return string DBMS specific SQL code portion that should be used to
- * declare the specified field.
- * @access protected
- */
- function _getIntegerDeclaration($name, $field)
- {
- if (!empty($field['unsigned'])) {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $db->warnings[] = "unsigned integer field \"$name\" is being declared as signed integer";
- }
- return $this->_getDeclaration($name, $field);
- }
-
- // }}}
- // {{{ _getTextDeclaration()
-
- /**
- * Obtain DBMS specific SQL code portion needed to declare an text type
- * field to be used in statements like CREATE TABLE.
- *
- * @param string $name name the field to be declared.
- * @param array $field associative array with the name of the properties
- * of the field being declared as array indexes. Currently, the types
- * of supported field properties are as follows:
- *
- * length
- * Integer value that determines the maximum length of the text
- * field. If this argument is missing the field should be
- * declared to have the longest length allowed by the DBMS.
- *
- * default
- * Text value to be used as default for this field.
- *
- * notnull
- * Boolean flag that indicates whether this field is constrained
- * to not be set to null.
- * @return string DBMS specific SQL code portion that should be used to
- * declare the specified field.
- * @access protected
- */
- function _getTextDeclaration($name, $field)
- {
- return $this->_getDeclaration($name, $field);
- }
-
- // }}}
- // {{{ _getCLOBDeclaration()
-
- /**
- * Obtain DBMS specific SQL code portion needed to declare an character
- * large object type field to be used in statements like CREATE TABLE.
- *
- * @param string $name name the field to be declared.
- * @param array $field associative array with the name of the properties
- * of the field being declared as array indexes. Currently, the types
- * of supported field properties are as follows:
- *
- * length
- * Integer value that determines the maximum length of the large
- * object field. If this argument is missing the field should be
- * declared to have the longest length allowed by the DBMS.
- *
- * notnull
- * Boolean flag that indicates whether this field is constrained
- * to not be set to null.
- * @return string DBMS specific SQL code portion that should be used to
- * declare the specified field.
- * @access public
- */
- function _getCLOBDeclaration($name, $field)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $notnull = empty($field['notnull']) ? '' : ' NOT NULL';
- $name = $db->quoteIdentifier($name, true);
- return $name.' '.$this->getTypeDeclaration($field).$notnull;
- }
-
- // }}}
- // {{{ _getBLOBDeclaration()
-
- /**
- * Obtain DBMS specific SQL code portion needed to declare an binary large
- * object type field to be used in statements like CREATE TABLE.
- *
- * @param string $name name the field to be declared.
- * @param array $field associative array with the name of the properties
- * of the field being declared as array indexes. Currently, the types
- * of supported field properties are as follows:
- *
- * length
- * Integer value that determines the maximum length of the large
- * object field. If this argument is missing the field should be
- * declared to have the longest length allowed by the DBMS.
- *
- * notnull
- * Boolean flag that indicates whether this field is constrained
- * to not be set to null.
- * @return string DBMS specific SQL code portion that should be used to
- * declare the specified field.
- * @access protected
- */
- function _getBLOBDeclaration($name, $field)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $notnull = empty($field['notnull']) ? '' : ' NOT NULL';
- $name = $db->quoteIdentifier($name, true);
- return $name.' '.$this->getTypeDeclaration($field).$notnull;
- }
-
- // }}}
- // {{{ _getBooleanDeclaration()
-
- /**
- * Obtain DBMS specific SQL code portion needed to declare a boolean type
- * field to be used in statements like CREATE TABLE.
- *
- * @param string $name name the field to be declared.
- * @param array $field associative array with the name of the properties
- * of the field being declared as array indexes. Currently, the types
- * of supported field properties are as follows:
- *
- * default
- * Boolean value to be used as default for this field.
- *
- * notnullL
- * Boolean flag that indicates whether this field is constrained
- * to not be set to null.
- * @return string DBMS specific SQL code portion that should be used to
- * declare the specified field.
- * @access protected
- */
- function _getBooleanDeclaration($name, $field)
- {
- return $this->_getDeclaration($name, $field);
- }
-
- // }}}
- // {{{ _getDateDeclaration()
-
- /**
- * Obtain DBMS specific SQL code portion needed to declare a date type
- * field to be used in statements like CREATE TABLE.
- *
- * @param string $name name the field to be declared.
- * @param array $field associative array with the name of the properties
- * of the field being declared as array indexes. Currently, the types
- * of supported field properties are as follows:
- *
- * default
- * Date value to be used as default for this field.
- *
- * notnull
- * Boolean flag that indicates whether this field is constrained
- * to not be set to null.
- * @return string DBMS specific SQL code portion that should be used to
- * declare the specified field.
- * @access protected
- */
- function _getDateDeclaration($name, $field)
- {
- return $this->_getDeclaration($name, $field);
- }
-
- // }}}
- // {{{ _getTimestampDeclaration()
-
- /**
- * Obtain DBMS specific SQL code portion needed to declare a timestamp
- * field to be used in statements like CREATE TABLE.
- *
- * @param string $name name the field to be declared.
- * @param array $field associative array with the name of the properties
- * of the field being declared as array indexes. Currently, the types
- * of supported field properties are as follows:
- *
- * default
- * Timestamp value to be used as default for this field.
- *
- * notnull
- * Boolean flag that indicates whether this field is constrained
- * to not be set to null.
- * @return string DBMS specific SQL code portion that should be used to
- * declare the specified field.
- * @access protected
- */
- function _getTimestampDeclaration($name, $field)
- {
- return $this->_getDeclaration($name, $field);
- }
-
- // }}}
- // {{{ _getTimeDeclaration()
-
- /**
- * Obtain DBMS specific SQL code portion needed to declare a time
- * field to be used in statements like CREATE TABLE.
- *
- * @param string $name name the field to be declared.
- * @param array $field associative array with the name of the properties
- * of the field being declared as array indexes. Currently, the types
- * of supported field properties are as follows:
- *
- * default
- * Time value to be used as default for this field.
- *
- * notnull
- * Boolean flag that indicates whether this field is constrained
- * to not be set to null.
- * @return string DBMS specific SQL code portion that should be used to
- * declare the specified field.
- * @access protected
- */
- function _getTimeDeclaration($name, $field)
- {
- return $this->_getDeclaration($name, $field);
- }
-
- // }}}
- // {{{ _getFloatDeclaration()
-
- /**
- * Obtain DBMS specific SQL code portion needed to declare a float type
- * field to be used in statements like CREATE TABLE.
- *
- * @param string $name name the field to be declared.
- * @param array $field associative array with the name of the properties
- * of the field being declared as array indexes. Currently, the types
- * of supported field properties are as follows:
- *
- * default
- * Float value to be used as default for this field.
- *
- * notnull
- * Boolean flag that indicates whether this field is constrained
- * to not be set to null.
- * @return string DBMS specific SQL code portion that should be used to
- * declare the specified field.
- * @access protected
- */
- function _getFloatDeclaration($name, $field)
- {
- return $this->_getDeclaration($name, $field);
- }
-
- // }}}
- // {{{ _getDecimalDeclaration()
-
- /**
- * Obtain DBMS specific SQL code portion needed to declare a decimal type
- * field to be used in statements like CREATE TABLE.
- *
- * @param string $name name the field to be declared.
- * @param array $field associative array with the name of the properties
- * of the field being declared as array indexes. Currently, the types
- * of supported field properties are as follows:
- *
- * default
- * Decimal value to be used as default for this field.
- *
- * notnull
- * Boolean flag that indicates whether this field is constrained
- * to not be set to null.
- * @return string DBMS specific SQL code portion that should be used to
- * declare the specified field.
- * @access protected
- */
- function _getDecimalDeclaration($name, $field)
- {
- return $this->_getDeclaration($name, $field);
- }
-
- // }}}
- // {{{ compareDefinition()
-
- /**
- * Obtain an array of changes that may need to applied
- *
- * @param array $current new definition
- * @param array $previous old definition
- * @return array containing all changes that will need to be applied
- * @access public
- */
- function compareDefinition($current, $previous)
- {
- $type = !empty($current['type']) ? $current['type'] : null;
-
- if (!method_exists($this, "_compare{$type}Definition")) {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
- if (!empty($db->options['datatype_map_callback'][$type])) {
- $parameter = array('current' => $current, 'previous' => $previous);
- $change = call_user_func_array($db->options['datatype_map_callback'][$type], array(&$db, __FUNCTION__, $parameter));
- return $change;
- }
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'type "'.$current['type'].'" is not yet supported', __FUNCTION__);
- }
-
- if (empty($previous['type']) || $previous['type'] != $type) {
- return $current;
- }
-
- $change = $this->{"_compare{$type}Definition"}($current, $previous);
-
- if ($previous['type'] != $type) {
- $change['type'] = true;
- }
-
- $previous_notnull = !empty($previous['notnull']) ? $previous['notnull'] : false;
- $notnull = !empty($current['notnull']) ? $current['notnull'] : false;
- if ($previous_notnull != $notnull) {
- $change['notnull'] = true;
- }
-
- $previous_default = array_key_exists('default', $previous) ? $previous['default'] :
- ($previous_notnull ? '' : null);
- $default = array_key_exists('default', $current) ? $current['default'] :
- ($notnull ? '' : null);
- if ($previous_default !== $default) {
- $change['default'] = true;
- }
-
- return $change;
- }
-
- // }}}
- // {{{ _compareIntegerDefinition()
-
- /**
- * Obtain an array of changes that may need to applied to an integer field
- *
- * @param array $current new definition
- * @param array $previous old definition
- * @return array containing all changes that will need to be applied
- * @access protected
- */
- function _compareIntegerDefinition($current, $previous)
- {
- $change = array();
- $previous_unsigned = !empty($previous['unsigned']) ? $previous['unsigned'] : false;
- $unsigned = !empty($current['unsigned']) ? $current['unsigned'] : false;
- if ($previous_unsigned != $unsigned) {
- $change['unsigned'] = true;
- }
- $previous_autoincrement = !empty($previous['autoincrement']) ? $previous['autoincrement'] : false;
- $autoincrement = !empty($current['autoincrement']) ? $current['autoincrement'] : false;
- if ($previous_autoincrement != $autoincrement) {
- $change['autoincrement'] = true;
- }
- return $change;
- }
-
- // }}}
- // {{{ _compareTextDefinition()
-
- /**
- * Obtain an array of changes that may need to applied to an text field
- *
- * @param array $current new definition
- * @param array $previous old definition
- * @return array containing all changes that will need to be applied
- * @access protected
- */
- function _compareTextDefinition($current, $previous)
- {
- $change = array();
- $previous_length = !empty($previous['length']) ? $previous['length'] : 0;
- $length = !empty($current['length']) ? $current['length'] : 0;
- if ($previous_length != $length) {
- $change['length'] = true;
- }
- $previous_fixed = !empty($previous['fixed']) ? $previous['fixed'] : 0;
- $fixed = !empty($current['fixed']) ? $current['fixed'] : 0;
- if ($previous_fixed != $fixed) {
- $change['fixed'] = true;
- }
- return $change;
- }
-
- // }}}
- // {{{ _compareCLOBDefinition()
-
- /**
- * Obtain an array of changes that may need to applied to an CLOB field
- *
- * @param array $current new definition
- * @param array $previous old definition
- * @return array containing all changes that will need to be applied
- * @access protected
- */
- function _compareCLOBDefinition($current, $previous)
- {
- return $this->_compareTextDefinition($current, $previous);
- }
-
- // }}}
- // {{{ _compareBLOBDefinition()
-
- /**
- * Obtain an array of changes that may need to applied to an BLOB field
- *
- * @param array $current new definition
- * @param array $previous old definition
- * @return array containing all changes that will need to be applied
- * @access protected
- */
- function _compareBLOBDefinition($current, $previous)
- {
- return $this->_compareTextDefinition($current, $previous);
- }
-
- // }}}
- // {{{ _compareDateDefinition()
-
- /**
- * Obtain an array of changes that may need to applied to an date field
- *
- * @param array $current new definition
- * @param array $previous old definition
- * @return array containing all changes that will need to be applied
- * @access protected
- */
- function _compareDateDefinition($current, $previous)
- {
- return array();
- }
-
- // }}}
- // {{{ _compareTimeDefinition()
-
- /**
- * Obtain an array of changes that may need to applied to an time field
- *
- * @param array $current new definition
- * @param array $previous old definition
- * @return array containing all changes that will need to be applied
- * @access protected
- */
- function _compareTimeDefinition($current, $previous)
- {
- return array();
- }
-
- // }}}
- // {{{ _compareTimestampDefinition()
-
- /**
- * Obtain an array of changes that may need to applied to an timestamp field
- *
- * @param array $current new definition
- * @param array $previous old definition
- * @return array containing all changes that will need to be applied
- * @access protected
- */
- function _compareTimestampDefinition($current, $previous)
- {
- return array();
- }
-
- // }}}
- // {{{ _compareBooleanDefinition()
-
- /**
- * Obtain an array of changes that may need to applied to an boolean field
- *
- * @param array $current new definition
- * @param array $previous old definition
- * @return array containing all changes that will need to be applied
- * @access protected
- */
- function _compareBooleanDefinition($current, $previous)
- {
- return array();
- }
-
- // }}}
- // {{{ _compareFloatDefinition()
-
- /**
- * Obtain an array of changes that may need to applied to an float field
- *
- * @param array $current new definition
- * @param array $previous old definition
- * @return array containing all changes that will need to be applied
- * @access protected
- */
- function _compareFloatDefinition($current, $previous)
- {
- return array();
- }
-
- // }}}
- // {{{ _compareDecimalDefinition()
-
- /**
- * Obtain an array of changes that may need to applied to an decimal field
- *
- * @param array $current new definition
- * @param array $previous old definition
- * @return array containing all changes that will need to be applied
- * @access protected
- */
- function _compareDecimalDefinition($current, $previous)
- {
- return array();
- }
-
- // }}}
- // {{{ quote()
-
- /**
- * Convert a text value into a DBMS specific format that is suitable to
- * compose query statements.
- *
- * @param string $value text string value that is intended to be converted.
- * @param string $type type to which the value should be converted to
- * @param bool $quote determines if the value should be quoted and escaped
- * @param bool $escape_wildcards if to escape escape wildcards
- * @return string text string that represents the given argument value in
- * a DBMS specific format.
- * @access public
- */
- function quote($value, $type = null, $quote = true, $escape_wildcards = false)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- if ((null === $value)
- || ($value === '' && $db->options['portability'] & MDB2_PORTABILITY_EMPTY_TO_NULL)
- ) {
- if (!$quote) {
- return null;
- }
- return 'NULL';
- }
-
- if (null === $type) {
- switch (gettype($value)) {
- case 'integer':
- $type = 'integer';
- break;
- case 'double':
- // todo: default to decimal as float is quite unusual
- // $type = 'float';
- $type = 'decimal';
- break;
- case 'boolean':
- $type = 'boolean';
- break;
- case 'array':
- $value = serialize($value);
- case 'object':
- $type = 'text';
- break;
- default:
- if (preg_match('/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}$/', $value)) {
- $type = 'timestamp';
- } elseif (preg_match('/^\d{2}:\d{2}$/', $value)) {
- $type = 'time';
- } elseif (preg_match('/^\d{4}-\d{2}-\d{2}$/', $value)) {
- $type = 'date';
- } else {
- $type = 'text';
- }
- break;
- }
- } elseif (!empty($db->options['datatype_map'][$type])) {
- $type = $db->options['datatype_map'][$type];
- if (!empty($db->options['datatype_map_callback'][$type])) {
- $parameter = array('type' => $type, 'value' => $value, 'quote' => $quote, 'escape_wildcards' => $escape_wildcards);
- return call_user_func_array($db->options['datatype_map_callback'][$type], array(&$db, __FUNCTION__, $parameter));
- }
- }
-
- if (!method_exists($this, "_quote{$type}")) {
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'type not defined: '.$type, __FUNCTION__);
- }
- $value = $this->{"_quote{$type}"}($value, $quote, $escape_wildcards);
- if ($quote && $escape_wildcards && $db->string_quoting['escape_pattern']
- && $db->string_quoting['escape'] !== $db->string_quoting['escape_pattern']
- ) {
- $value.= $this->patternEscapeString();
- }
- return $value;
- }
-
- // }}}
- // {{{ _quoteInteger()
-
- /**
- * Convert a text value into a DBMS specific format that is suitable to
- * compose query statements.
- *
- * @param string $value text string value that is intended to be converted.
- * @param bool $quote determines if the value should be quoted and escaped
- * @param bool $escape_wildcards if to escape escape wildcards
- * @return string text string that represents the given argument value in
- * a DBMS specific format.
- * @access protected
- */
- function _quoteInteger($value, $quote, $escape_wildcards)
- {
- return (int)$value;
- }
-
- // }}}
- // {{{ _quoteText()
-
- /**
- * Convert a text value into a DBMS specific format that is suitable to
- * compose query statements.
- *
- * @param string $value text string value that is intended to be converted.
- * @param bool $quote determines if the value should be quoted and escaped
- * @param bool $escape_wildcards if to escape escape wildcards
- * @return string text string that already contains any DBMS specific
- * escaped character sequences.
- * @access protected
- */
- function _quoteText($value, $quote, $escape_wildcards)
- {
- if (!$quote) {
- return $value;
- }
-
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $value = $db->escape($value, $escape_wildcards);
- if (PEAR::isError($value)) {
- return $value;
- }
- return "'".$value."'";
- }
-
- // }}}
- // {{{ _readFile()
-
- /**
- * Convert a text value into a DBMS specific format that is suitable to
- * compose query statements.
- *
- * @param string $value text string value that is intended to be converted.
- * @return string text string that represents the given argument value in
- * a DBMS specific format.
- * @access protected
- */
- function _readFile($value)
- {
- $close = false;
- if (preg_match('/^(\w+:\/\/)(.*)$/', $value, $match)) {
- $close = true;
- if (strtolower($match[1]) == 'file://') {
- $value = $match[2];
- }
- $value = @fopen($value, 'r');
- }
-
- if (is_resource($value)) {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $fp = $value;
- $value = '';
- while (!@feof($fp)) {
- $value.= @fread($fp, $db->options['lob_buffer_length']);
- }
- if ($close) {
- @fclose($fp);
- }
- }
-
- return $value;
- }
-
- // }}}
- // {{{ _quoteLOB()
-
- /**
- * Convert a text value into a DBMS specific format that is suitable to
- * compose query statements.
- *
- * @param string $value text string value that is intended to be converted.
- * @param bool $quote determines if the value should be quoted and escaped
- * @param bool $escape_wildcards if to escape escape wildcards
- * @return string text string that represents the given argument value in
- * a DBMS specific format.
- * @access protected
- */
- function _quoteLOB($value, $quote, $escape_wildcards)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
- if ($db->options['lob_allow_url_include']) {
- $value = $this->_readFile($value);
- if (PEAR::isError($value)) {
- return $value;
- }
- }
- return $this->_quoteText($value, $quote, $escape_wildcards);
- }
-
- // }}}
- // {{{ _quoteCLOB()
-
- /**
- * Convert a text value into a DBMS specific format that is suitable to
- * compose query statements.
- *
- * @param string $value text string value that is intended to be converted.
- * @param bool $quote determines if the value should be quoted and escaped
- * @param bool $escape_wildcards if to escape escape wildcards
- * @return string text string that represents the given argument value in
- * a DBMS specific format.
- * @access protected
- */
- function _quoteCLOB($value, $quote, $escape_wildcards)
- {
- return $this->_quoteLOB($value, $quote, $escape_wildcards);
- }
-
- // }}}
- // {{{ _quoteBLOB()
-
- /**
- * Convert a text value into a DBMS specific format that is suitable to
- * compose query statements.
- *
- * @param string $value text string value that is intended to be converted.
- * @param bool $quote determines if the value should be quoted and escaped
- * @param bool $escape_wildcards if to escape escape wildcards
- * @return string text string that represents the given argument value in
- * a DBMS specific format.
- * @access protected
- */
- function _quoteBLOB($value, $quote, $escape_wildcards)
- {
- return $this->_quoteLOB($value, $quote, $escape_wildcards);
- }
-
- // }}}
- // {{{ _quoteBoolean()
-
- /**
- * Convert a text value into a DBMS specific format that is suitable to
- * compose query statements.
- *
- * @param string $value text string value that is intended to be converted.
- * @param bool $quote determines if the value should be quoted and escaped
- * @param bool $escape_wildcards if to escape escape wildcards
- * @return string text string that represents the given argument value in
- * a DBMS specific format.
- * @access protected
- */
- function _quoteBoolean($value, $quote, $escape_wildcards)
- {
- return ($value ? 1 : 0);
- }
-
- // }}}
- // {{{ _quoteDate()
-
- /**
- * Convert a text value into a DBMS specific format that is suitable to
- * compose query statements.
- *
- * @param string $value text string value that is intended to be converted.
- * @param bool $quote determines if the value should be quoted and escaped
- * @param bool $escape_wildcards if to escape escape wildcards
- * @return string text string that represents the given argument value in
- * a DBMS specific format.
- * @access protected
- */
- function _quoteDate($value, $quote, $escape_wildcards)
- {
- if ($value === 'CURRENT_DATE') {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
- if (isset($db->function) && is_object($this->function) && is_a($db->function, 'MDB2_Driver_Function_Common')) {
- return $db->function->now('date');
- }
- return 'CURRENT_DATE';
- }
- return $this->_quoteText($value, $quote, $escape_wildcards);
- }
-
- // }}}
- // {{{ _quoteTimestamp()
-
- /**
- * Convert a text value into a DBMS specific format that is suitable to
- * compose query statements.
- *
- * @param string $value text string value that is intended to be converted.
- * @param bool $quote determines if the value should be quoted and escaped
- * @param bool $escape_wildcards if to escape escape wildcards
- * @return string text string that represents the given argument value in
- * a DBMS specific format.
- * @access protected
- */
- function _quoteTimestamp($value, $quote, $escape_wildcards)
- {
- if ($value === 'CURRENT_TIMESTAMP') {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
- if (isset($db->function) && is_object($db->function) && is_a($db->function, 'MDB2_Driver_Function_Common')) {
- return $db->function->now('timestamp');
- }
- return 'CURRENT_TIMESTAMP';
- }
- return $this->_quoteText($value, $quote, $escape_wildcards);
- }
-
- // }}}
- // {{{ _quoteTime()
-
- /**
- * Convert a text value into a DBMS specific format that is suitable to
- * compose query statements.
- *
- * @param string $value text string value that is intended to be converted.
- * @param bool $quote determines if the value should be quoted and escaped
- * @param bool $escape_wildcards if to escape escape wildcards
- * @return string text string that represents the given argument value in
- * a DBMS specific format.
- * @access protected
- */
- function _quoteTime($value, $quote, $escape_wildcards)
- {
- if ($value === 'CURRENT_TIME') {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
- if (isset($db->function) && is_object($this->function) && is_a($db->function, 'MDB2_Driver_Function_Common')) {
- return $db->function->now('time');
- }
- return 'CURRENT_TIME';
- }
- return $this->_quoteText($value, $quote, $escape_wildcards);
- }
-
- // }}}
- // {{{ _quoteFloat()
-
- /**
- * Convert a text value into a DBMS specific format that is suitable to
- * compose query statements.
- *
- * @param string $value text string value that is intended to be converted.
- * @param bool $quote determines if the value should be quoted and escaped
- * @param bool $escape_wildcards if to escape escape wildcards
- * @return string text string that represents the given argument value in
- * a DBMS specific format.
- * @access protected
- */
- function _quoteFloat($value, $quote, $escape_wildcards)
- {
- if (preg_match('/^(.*)e([-+])(\d+)$/i', $value, $matches)) {
- $decimal = $this->_quoteDecimal($matches[1], $quote, $escape_wildcards);
- $sign = $matches[2];
- $exponent = str_pad($matches[3], 2, '0', STR_PAD_LEFT);
- $value = $decimal.'E'.$sign.$exponent;
- } else {
- $value = $this->_quoteDecimal($value, $quote, $escape_wildcards);
- }
- return $value;
- }
-
- // }}}
- // {{{ _quoteDecimal()
-
- /**
- * Convert a text value into a DBMS specific format that is suitable to
- * compose query statements.
- *
- * @param string $value text string value that is intended to be converted.
- * @param bool $quote determines if the value should be quoted and escaped
- * @param bool $escape_wildcards if to escape escape wildcards
- * @return string text string that represents the given argument value in
- * a DBMS specific format.
- * @access protected
- */
- function _quoteDecimal($value, $quote, $escape_wildcards)
- {
- $value = (string)$value;
- $value = preg_replace('/[^\d\.,\-+eE]/', '', $value);
- if (preg_match('/[^\.\d]/', $value)) {
- if (strpos($value, ',')) {
- // 1000,00
- if (!strpos($value, '.')) {
- // convert the last "," to a "."
- $value = strrev(str_replace(',', '.', strrev($value)));
- // 1.000,00
- } elseif (strpos($value, '.') && strpos($value, '.') < strpos($value, ',')) {
- $value = str_replace('.', '', $value);
- // convert the last "," to a "."
- $value = strrev(str_replace(',', '.', strrev($value)));
- // 1,000.00
- } else {
- $value = str_replace(',', '', $value);
- }
- }
- }
- return $value;
- }
-
- // }}}
- // {{{ writeLOBToFile()
-
- /**
- * retrieve LOB from the database
- *
- * @param resource $lob stream handle
- * @param string $file name of the file into which the LOb should be fetched
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access protected
- */
- function writeLOBToFile($lob, $file)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- if (preg_match('/^(\w+:\/\/)(.*)$/', $file, $match)) {
- if ($match[1] == 'file://') {
- $file = $match[2];
- }
- }
-
- $fp = @fopen($file, 'wb');
- while (!@feof($lob)) {
- $result = @fread($lob, $db->options['lob_buffer_length']);
- $read = strlen($result);
- if (@fwrite($fp, $result, $read) != $read) {
- @fclose($fp);
- return $db->raiseError(MDB2_ERROR, null, null,
- 'could not write to the output file', __FUNCTION__);
- }
- }
- @fclose($fp);
- return MDB2_OK;
- }
-
- // }}}
- // {{{ _retrieveLOB()
-
- /**
- * retrieve LOB from the database
- *
- * @param array $lob array
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access protected
- */
- function _retrieveLOB(&$lob)
- {
- if (null === $lob['value']) {
- $lob['value'] = $lob['resource'];
- }
- $lob['loaded'] = true;
- return MDB2_OK;
- }
-
- // }}}
- // {{{ readLOB()
-
- /**
- * Read data from large object input stream.
- *
- * @param resource $lob stream handle
- * @param string $data reference to a variable that will hold data
- * to be read from the large object input stream
- * @param integer $length value that indicates the largest ammount ofdata
- * to be read from the large object input stream.
- * @return mixed the effective number of bytes read from the large object
- * input stream on sucess or an MDB2 error object.
- * @access public
- * @see endOfLOB()
- */
- function _readLOB($lob, $length)
- {
- return substr($lob['value'], $lob['position'], $length);
- }
-
- // }}}
- // {{{ _endOfLOB()
-
- /**
- * Determine whether it was reached the end of the large object and
- * therefore there is no more data to be read for the its input stream.
- *
- * @param array $lob array
- * @return mixed true or false on success, a MDB2 error on failure
- * @access protected
- */
- function _endOfLOB($lob)
- {
- return $lob['endOfLOB'];
- }
-
- // }}}
- // {{{ destroyLOB()
-
- /**
- * Free any resources allocated during the lifetime of the large object
- * handler object.
- *
- * @param resource $lob stream handle
- * @access public
- */
- function destroyLOB($lob)
- {
- $lob_data = stream_get_meta_data($lob);
- $lob_index = $lob_data['wrapper_data']->lob_index;
- fclose($lob);
- if (isset($this->lobs[$lob_index])) {
- $this->_destroyLOB($this->lobs[$lob_index]);
- unset($this->lobs[$lob_index]);
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ _destroyLOB()
-
- /**
- * Free any resources allocated during the lifetime of the large object
- * handler object.
- *
- * @param array $lob array
- * @access private
- */
- function _destroyLOB(&$lob)
- {
- return MDB2_OK;
- }
-
- // }}}
- // {{{ implodeArray()
-
- /**
- * apply a type to all values of an array and return as a comma seperated string
- * useful for generating IN statements
- *
- * @access public
- *
- * @param array $array data array
- * @param string $type determines type of the field
- *
- * @return string comma seperated values
- */
- function implodeArray($array, $type = false)
- {
- if (!is_array($array) || empty($array)) {
- return 'NULL';
- }
- if ($type) {
- foreach ($array as $value) {
- $return[] = $this->quote($value, $type);
- }
- } else {
- $return = $array;
- }
- return implode(', ', $return);
- }
-
- // }}}
- // {{{ matchPattern()
-
- /**
- * build a pattern matching string
- *
- * @access public
- *
- * @param array $pattern even keys are strings, odd are patterns (% and _)
- * @param string $operator optional pattern operator (LIKE, ILIKE and maybe others in the future)
- * @param string $field optional field name that is being matched against
- * (might be required when emulating ILIKE)
- *
- * @return string SQL pattern
- */
- function matchPattern($pattern, $operator = null, $field = null)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $match = '';
- if (null !== $operator) {
- $operator = strtoupper($operator);
- switch ($operator) {
- // case insensitive
- case 'ILIKE':
- if (null === $field) {
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'case insensitive LIKE matching requires passing the field name', __FUNCTION__);
- }
- $db->loadModule('Function', null, true);
- $match = $db->function->lower($field).' LIKE ';
- break;
- case 'NOT ILIKE':
- if (null === $field) {
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'case insensitive NOT ILIKE matching requires passing the field name', __FUNCTION__);
- }
- $db->loadModule('Function', null, true);
- $match = $db->function->lower($field).' NOT LIKE ';
- break;
- // case sensitive
- case 'LIKE':
- $match = (null === $field) ? 'LIKE ' : ($field.' LIKE ');
- break;
- case 'NOT LIKE':
- $match = (null === $field) ? 'NOT LIKE ' : ($field.' NOT LIKE ');
- break;
- default:
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'not a supported operator type:'. $operator, __FUNCTION__);
- }
- }
- $match.= "'";
- foreach ($pattern as $key => $value) {
- if ($key % 2) {
- $match.= $value;
- } else {
- $escaped = $db->escape($value);
- if (PEAR::isError($escaped)) {
- return $escaped;
- }
- $match.= $db->escapePattern($escaped);
- }
- }
- $match.= "'";
- $match.= $this->patternEscapeString();
- return $match;
- }
-
- // }}}
- // {{{ patternEscapeString()
-
- /**
- * build string to define pattern escape character
- *
- * @access public
- *
- * @return string define pattern escape character
- */
- function patternEscapeString()
- {
- return '';
- }
-
- // }}}
- // {{{ mapNativeDatatype()
-
- /**
- * Maps a native array description of a field to a MDB2 datatype and length
- *
- * @param array $field native field description
- * @return array containing the various possible types, length, sign, fixed
- * @access public
- */
- function mapNativeDatatype($field)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- // If the user has specified an option to map the native field
- // type to a custom MDB2 datatype...
- $db_type = strtok($field['type'], '(), ');
- if (!empty($db->options['nativetype_map_callback'][$db_type])) {
- return call_user_func_array($db->options['nativetype_map_callback'][$db_type], array($db, $field));
- }
-
- // Otherwise perform the built-in (i.e. normal) MDB2 native type to
- // MDB2 datatype conversion
- return $this->_mapNativeDatatype($field);
- }
-
- // }}}
- // {{{ _mapNativeDatatype()
-
- /**
- * Maps a native array description of a field to a MDB2 datatype and length
- *
- * @param array $field native field description
- * @return array containing the various possible types, length, sign, fixed
- * @access public
- */
- function _mapNativeDatatype($field)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- }
-
- // }}}
- // {{{ mapPrepareDatatype()
-
- /**
- * Maps an mdb2 datatype to mysqli prepare type
- *
- * @param string $type
- * @return string
- * @access public
- */
- function mapPrepareDatatype($type)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- if (!empty($db->options['datatype_map'][$type])) {
- $type = $db->options['datatype_map'][$type];
- if (!empty($db->options['datatype_map_callback'][$type])) {
- $parameter = array('type' => $type);
- return call_user_func_array($db->options['datatype_map_callback'][$type], array(&$db, __FUNCTION__, $parameter));
- }
- }
-
- return $type;
- }
-}
-?>
diff --git a/3rdparty/MDB2/Driver/Datatype/mysql.php b/3rdparty/MDB2/Driver/Datatype/mysql.php
deleted file mode 100644
index d23eed23ff7..00000000000
--- a/3rdparty/MDB2/Driver/Datatype/mysql.php
+++ /dev/null
@@ -1,602 +0,0 @@
-<?php
-// vim: set et ts=4 sw=4 fdm=marker:
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2008 Manuel Lemos, Tomas V.V.Cox, |
-// | Stig. S. Bakken, Lukas Smith |
-// | All rights reserved. |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
-// | API as well as database abstraction for PHP applications. |
-// | This LICENSE is in the BSD license style. |
-// | |
-// | Redistribution and use in source and binary forms, with or without |
-// | modification, are permitted provided that the following conditions |
-// | are met: |
-// | |
-// | Redistributions of source code must retain the above copyright |
-// | notice, this list of conditions and the following disclaimer. |
-// | |
-// | Redistributions in binary form must reproduce the above copyright |
-// | notice, this list of conditions and the following disclaimer in the |
-// | documentation and/or other materials provided with the distribution. |
-// | |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission. |
-// | |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-// | POSSIBILITY OF SUCH DAMAGE. |
-// +----------------------------------------------------------------------+
-// | Author: Lukas Smith <smith@pooteeweet.org> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-
-require_once 'MDB2/Driver/Datatype/Common.php';
-
-/**
- * MDB2 MySQL driver
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Driver_Datatype_mysql extends MDB2_Driver_Datatype_Common
-{
- // {{{ _getCharsetFieldDeclaration()
-
- /**
- * Obtain DBMS specific SQL code portion needed to set the CHARACTER SET
- * of a field declaration to be used in statements like CREATE TABLE.
- *
- * @param string $charset name of the charset
- * @return string DBMS specific SQL code portion needed to set the CHARACTER SET
- * of a field declaration.
- */
- function _getCharsetFieldDeclaration($charset)
- {
- return 'CHARACTER SET '.$charset;
- }
-
- // }}}
- // {{{ _getCollationFieldDeclaration()
-
- /**
- * Obtain DBMS specific SQL code portion needed to set the COLLATION
- * of a field declaration to be used in statements like CREATE TABLE.
- *
- * @param string $collation name of the collation
- * @return string DBMS specific SQL code portion needed to set the COLLATION
- * of a field declaration.
- */
- function _getCollationFieldDeclaration($collation)
- {
- return 'COLLATE '.$collation;
- }
-
- // }}}
- // {{{ getDeclaration()
-
- /**
- * Obtain DBMS specific SQL code portion needed to declare
- * of the given type
- *
- * @param string $type type to which the value should be converted to
- * @param string $name name the field to be declared.
- * @param string $field definition of the field
- *
- * @return string DBMS-specific SQL code portion that should be used to
- * declare the specified field.
- * @access public
- */
- function getDeclaration($type, $name, $field)
- {
- // MySQL DDL syntax forbids combining NOT NULL with DEFAULT NULL.
- // To get a default of NULL for NOT NULL columns, omit it.
- if ( isset($field['notnull'])
- && !empty($field['notnull'])
- && array_key_exists('default', $field) // do not use isset() here!
- && null === $field['default']
- ) {
- unset($field['default']);
- }
- return parent::getDeclaration($type, $name, $field);
- }
-
- // }}}
- // {{{ getTypeDeclaration()
-
- /**
- * Obtain DBMS specific SQL code portion needed to declare an text type
- * field to be used in statements like CREATE TABLE.
- *
- * @param array $field associative array with the name of the properties
- * of the field being declared as array indexes. Currently, the types
- * of supported field properties are as follows:
- *
- * length
- * Integer value that determines the maximum length of the text
- * field. If this argument is missing the field should be
- * declared to have the longest length allowed by the DBMS.
- *
- * default
- * Text value to be used as default for this field.
- *
- * notnull
- * Boolean flag that indicates whether this field is constrained
- * to not be set to null.
- * @return string DBMS specific SQL code portion that should be used to
- * declare the specified field.
- * @access public
- */
- function getTypeDeclaration($field)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- switch ($field['type']) {
- case 'text':
- if (empty($field['length']) && array_key_exists('default', $field)) {
- $field['length'] = $db->varchar_max_length;
- }
- $length = !empty($field['length']) ? $field['length'] : false;
- $fixed = !empty($field['fixed']) ? $field['fixed'] : false;
- return $fixed ? ($length ? 'CHAR('.$length.')' : 'CHAR(255)')
- : ($length ? 'VARCHAR('.$length.')' : 'TEXT');
- case 'clob':
- if (!empty($field['length'])) {
- $length = $field['length'];
- if ($length <= 255) {
- return 'TINYTEXT';
- } elseif ($length <= 65532) {
- return 'TEXT';
- } elseif ($length <= 16777215) {
- return 'MEDIUMTEXT';
- }
- }
- return 'LONGTEXT';
- case 'blob':
- if (!empty($field['length'])) {
- $length = $field['length'];
- if ($length <= 255) {
- return 'TINYBLOB';
- } elseif ($length <= 65532) {
- return 'BLOB';
- } elseif ($length <= 16777215) {
- return 'MEDIUMBLOB';
- }
- }
- return 'LONGBLOB';
- case 'integer':
- if (!empty($field['length'])) {
- $length = $field['length'];
- if ($length <= 1) {
- return 'TINYINT';
- } elseif ($length == 2) {
- return 'SMALLINT';
- } elseif ($length == 3) {
- return 'MEDIUMINT';
- } elseif ($length == 4) {
- return 'INT';
- } elseif ($length > 4) {
- return 'BIGINT';
- }
- }
- return 'INT';
- case 'boolean':
- return 'TINYINT(1)';
- case 'date':
- return 'DATE';
- case 'time':
- return 'TIME';
- case 'timestamp':
- return 'DATETIME';
- case 'float':
- $l = '';
- if (!empty($field['length'])) {
- $l = '(' . $field['length'];
- if (!empty($field['scale'])) {
- $l .= ',' . $field['scale'];
- }
- $l .= ')';
- }
- return 'DOUBLE' . $l;
- case 'decimal':
- $length = !empty($field['length']) ? $field['length'] : 18;
- $scale = !empty($field['scale']) ? $field['scale'] : $db->options['decimal_places'];
- return 'DECIMAL('.$length.','.$scale.')';
- }
- return '';
- }
-
- // }}}
- // {{{ _getIntegerDeclaration()
-
- /**
- * Obtain DBMS specific SQL code portion needed to declare an integer type
- * field to be used in statements like CREATE TABLE.
- *
- * @param string $name name the field to be declared.
- * @param string $field associative array with the name of the properties
- * of the field being declared as array indexes.
- * Currently, the types of supported field
- * properties are as follows:
- *
- * unsigned
- * Boolean flag that indicates whether the field
- * should be declared as unsigned integer if
- * possible.
- *
- * default
- * Integer value to be used as default for this
- * field.
- *
- * notnull
- * Boolean flag that indicates whether this field is
- * constrained to not be set to null.
- * @return string DBMS specific SQL code portion that should be used to
- * declare the specified field.
- * @access protected
- */
- function _getIntegerDeclaration($name, $field)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $default = $autoinc = '';
- if (!empty($field['autoincrement'])) {
- $autoinc = ' AUTO_INCREMENT PRIMARY KEY';
- } elseif (array_key_exists('default', $field)) {
- if ($field['default'] === '') {
- $field['default'] = empty($field['notnull']) ? null : 0;
- }
- $default = ' DEFAULT '.$this->quote($field['default'], 'integer');
- }
-
- $notnull = empty($field['notnull']) ? '' : ' NOT NULL';
- $unsigned = empty($field['unsigned']) ? '' : ' UNSIGNED';
- if (empty($default) && empty($notnull)) {
- $default = ' DEFAULT NULL';
- }
- $name = $db->quoteIdentifier($name, true);
- return $name.' '.$this->getTypeDeclaration($field).$unsigned.$default.$notnull.$autoinc;
- }
-
- // }}}
- // {{{ _getFloatDeclaration()
-
- /**
- * Obtain DBMS specific SQL code portion needed to declare an float type
- * field to be used in statements like CREATE TABLE.
- *
- * @param string $name name the field to be declared.
- * @param string $field associative array with the name of the properties
- * of the field being declared as array indexes.
- * Currently, the types of supported field
- * properties are as follows:
- *
- * unsigned
- * Boolean flag that indicates whether the field
- * should be declared as unsigned float if
- * possible.
- *
- * default
- * float value to be used as default for this
- * field.
- *
- * notnull
- * Boolean flag that indicates whether this field is
- * constrained to not be set to null.
- * @return string DBMS specific SQL code portion that should be used to
- * declare the specified field.
- * @access protected
- */
- function _getFloatDeclaration($name, $field)
- {
- // Since AUTO_INCREMENT can be used for integer or floating-point types,
- // reuse the INTEGER declaration
- // @see http://bugs.mysql.com/bug.php?id=31032
- return $this->_getIntegerDeclaration($name, $field);
- }
-
- // }}}
- // {{{ _getDecimalDeclaration()
-
- /**
- * Obtain DBMS specific SQL code portion needed to declare an decimal type
- * field to be used in statements like CREATE TABLE.
- *
- * @param string $name name the field to be declared.
- * @param string $field associative array with the name of the properties
- * of the field being declared as array indexes.
- * Currently, the types of supported field
- * properties are as follows:
- *
- * unsigned
- * Boolean flag that indicates whether the field
- * should be declared as unsigned integer if
- * possible.
- *
- * default
- * Decimal value to be used as default for this
- * field.
- *
- * notnull
- * Boolean flag that indicates whether this field is
- * constrained to not be set to null.
- * @return string DBMS specific SQL code portion that should be used to
- * declare the specified field.
- * @access protected
- */
- function _getDecimalDeclaration($name, $field)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $default = '';
- if (array_key_exists('default', $field)) {
- if ($field['default'] === '') {
- $field['default'] = empty($field['notnull']) ? null : 0;
- }
- $default = ' DEFAULT '.$this->quote($field['default'], 'integer');
- } elseif (empty($field['notnull'])) {
- $default = ' DEFAULT NULL';
- }
-
- $notnull = empty($field['notnull']) ? '' : ' NOT NULL';
- $unsigned = empty($field['unsigned']) ? '' : ' UNSIGNED';
- $name = $db->quoteIdentifier($name, true);
- return $name.' '.$this->getTypeDeclaration($field).$unsigned.$default.$notnull;
- }
-
- // }}}
- // {{{ matchPattern()
-
- /**
- * build a pattern matching string
- *
- * @access public
- *
- * @param array $pattern even keys are strings, odd are patterns (% and _)
- * @param string $operator optional pattern operator (LIKE, ILIKE and maybe others in the future)
- * @param string $field optional field name that is being matched against
- * (might be required when emulating ILIKE)
- *
- * @return string SQL pattern
- */
- function matchPattern($pattern, $operator = null, $field = null)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $match = '';
- if (null !== $operator) {
- $field = (null === $field) ? '' : $field.' ';
- $operator = strtoupper($operator);
- switch ($operator) {
- // case insensitive
- case 'ILIKE':
- $match = $field.'LIKE ';
- break;
- case 'NOT ILIKE':
- $match = $field.'NOT LIKE ';
- break;
- // case sensitive
- case 'LIKE':
- $match = $field.'LIKE BINARY ';
- break;
- case 'NOT LIKE':
- $match = $field.'NOT LIKE BINARY ';
- break;
- default:
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'not a supported operator type:'. $operator, __FUNCTION__);
- }
- }
- $match.= "'";
- foreach ($pattern as $key => $value) {
- if ($key % 2) {
- $match.= $value;
- } else {
- $match.= $db->escapePattern($db->escape($value));
- }
- }
- $match.= "'";
- $match.= $this->patternEscapeString();
- return $match;
- }
-
- // }}}
- // {{{ _mapNativeDatatype()
-
- /**
- * Maps a native array description of a field to a MDB2 datatype and length
- *
- * @param array $field native field description
- * @return array containing the various possible types, length, sign, fixed
- * @access public
- */
- function _mapNativeDatatype($field)
- {
- $db_type = strtolower($field['type']);
- $db_type = strtok($db_type, '(), ');
- if ($db_type == 'national') {
- $db_type = strtok('(), ');
- }
- if (!empty($field['length'])) {
- $length = strtok($field['length'], ', ');
- $decimal = strtok(', ');
- } else {
- $length = strtok('(), ');
- $decimal = strtok('(), ');
- }
- $type = array();
- $unsigned = $fixed = null;
- switch ($db_type) {
- case 'tinyint':
- $type[] = 'integer';
- $type[] = 'boolean';
- if (preg_match('/^(is|has)/', $field['name'])) {
- $type = array_reverse($type);
- }
- $unsigned = preg_match('/ unsigned/i', $field['type']);
- $length = 1;
- break;
- case 'smallint':
- $type[] = 'integer';
- $unsigned = preg_match('/ unsigned/i', $field['type']);
- $length = 2;
- break;
- case 'mediumint':
- $type[] = 'integer';
- $unsigned = preg_match('/ unsigned/i', $field['type']);
- $length = 3;
- break;
- case 'int':
- case 'integer':
- $type[] = 'integer';
- $unsigned = preg_match('/ unsigned/i', $field['type']);
- $length = 4;
- break;
- case 'bigint':
- $type[] = 'integer';
- $unsigned = preg_match('/ unsigned/i', $field['type']);
- $length = 8;
- break;
- case 'tinytext':
- case 'mediumtext':
- case 'longtext':
- case 'text':
- case 'varchar':
- $fixed = false;
- case 'string':
- case 'char':
- $type[] = 'text';
- if ($length == '1') {
- $type[] = 'boolean';
- if (preg_match('/^(is|has)/', $field['name'])) {
- $type = array_reverse($type);
- }
- } elseif (strstr($db_type, 'text')) {
- $type[] = 'clob';
- if ($decimal == 'binary') {
- $type[] = 'blob';
- }
- $type = array_reverse($type);
- }
- if ($fixed !== false) {
- $fixed = true;
- }
- break;
- case 'enum':
- $type[] = 'text';
- preg_match_all('/\'.+\'/U', $field['type'], $matches);
- $length = 0;
- $fixed = false;
- if (is_array($matches)) {
- foreach ($matches[0] as $value) {
- $length = max($length, strlen($value)-2);
- }
- if ($length == '1' && count($matches[0]) == 2) {
- $type[] = 'boolean';
- if (preg_match('/^(is|has)/', $field['name'])) {
- $type = array_reverse($type);
- }
- }
- }
- $type[] = 'integer';
- case 'set':
- $fixed = false;
- $type[] = 'text';
- $type[] = 'integer';
- break;
- case 'date':
- $type[] = 'date';
- $length = null;
- break;
- case 'datetime':
- case 'timestamp':
- $type[] = 'timestamp';
- $length = null;
- break;
- case 'time':
- $type[] = 'time';
- $length = null;
- break;
- case 'float':
- case 'double':
- case 'real':
- $type[] = 'float';
- $unsigned = preg_match('/ unsigned/i', $field['type']);
- if ($decimal !== false) {
- $length = $length.','.$decimal;
- }
- break;
- case 'unknown':
- case 'decimal':
- case 'numeric':
- $type[] = 'decimal';
- $unsigned = preg_match('/ unsigned/i', $field['type']);
- if ($decimal !== false) {
- $length = $length.','.$decimal;
- }
- break;
- case 'tinyblob':
- case 'mediumblob':
- case 'longblob':
- case 'blob':
- $type[] = 'blob';
- $length = null;
- break;
- case 'binary':
- case 'varbinary':
- $type[] = 'blob';
- break;
- case 'year':
- $type[] = 'integer';
- $type[] = 'date';
- $length = null;
- break;
- default:
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'unknown database attribute type: '.$db_type, __FUNCTION__);
- }
-
- if ((int)$length <= 0) {
- $length = null;
- }
-
- return array($type, $length, $unsigned, $fixed);
- }
-
- // }}}
-}
-
-?> \ No newline at end of file
diff --git a/3rdparty/MDB2/Driver/Datatype/oci8.php b/3rdparty/MDB2/Driver/Datatype/oci8.php
deleted file mode 100644
index 4d2e792a80e..00000000000
--- a/3rdparty/MDB2/Driver/Datatype/oci8.php
+++ /dev/null
@@ -1,499 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2007 Manuel Lemos, Tomas V.V.Cox, |
-// | Stig. S. Bakken, Lukas Smith |
-// | All rights reserved. |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
-// | API as well as database abstraction for PHP applications. |
-// | This LICENSE is in the BSD license style. |
-// | |
-// | Redistribution and use in source and binary forms, with or without |
-// | modification, are permitted provided that the following conditions |
-// | are met: |
-// | |
-// | Redistributions of source code must retain the above copyright |
-// | notice, this list of conditions and the following disclaimer. |
-// | |
-// | Redistributions in binary form must reproduce the above copyright |
-// | notice, this list of conditions and the following disclaimer in the |
-// | documentation and/or other materials provided with the distribution. |
-// | |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission. |
-// | |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-// | POSSIBILITY OF SUCH DAMAGE. |
-// +----------------------------------------------------------------------+
-// | Author: Lukas Smith <smith@pooteeweet.org> |
-// +----------------------------------------------------------------------+
-
-// $Id: oci8.php 295587 2010-02-28 17:16:38Z quipo $
-
-require_once 'MDB2/Driver/Datatype/Common.php';
-
-/**
- * MDB2 OCI8 driver
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Driver_Datatype_oci8 extends MDB2_Driver_Datatype_Common
-{
- // {{{ _baseConvertResult()
-
- /**
- * general type conversion method
- *
- * @param mixed $value refernce to a value to be converted
- * @param string $type specifies which type to convert to
- * @param boolean $rtrim [optional] when TRUE [default], apply rtrim() to text
- * @return object a MDB2 error on failure
- * @access protected
- */
- function _baseConvertResult($value, $type, $rtrim = true)
- {
- if (null === $value) {
- return null;
- }
- switch ($type) {
- case 'text':
- if (is_object($value) && is_a($value, 'OCI-Lob')) {
- //LOB => fetch into variable
- $clob = $this->_baseConvertResult($value, 'clob', $rtrim);
- if (!PEAR::isError($clob) && is_resource($clob)) {
- $clob_value = '';
- while (!feof($clob)) {
- $clob_value .= fread($clob, 8192);
- }
- $this->destroyLOB($clob);
- }
- $value = $clob_value;
- }
- if ($rtrim) {
- $value = rtrim($value);
- }
- return $value;
- case 'date':
- return substr($value, 0, strlen('YYYY-MM-DD'));
- case 'time':
- return substr($value, strlen('YYYY-MM-DD '), strlen('HH:MI:SS'));
- }
- return parent::_baseConvertResult($value, $type, $rtrim);
- }
-
- // }}}
- // {{{ getTypeDeclaration()
-
- /**
- * Obtain DBMS specific SQL code portion needed to declare an text type
- * field to be used in statements like CREATE TABLE.
- *
- * @param array $field associative array with the name of the properties
- * of the field being declared as array indexes. Currently, the types
- * of supported field properties are as follows:
- *
- * length
- * Integer value that determines the maximum length of the text
- * field. If this argument is missing the field should be
- * declared to have the longest length allowed by the DBMS.
- *
- * default
- * Text value to be used as default for this field.
- *
- * notnull
- * Boolean flag that indicates whether this field is constrained
- * to not be set to null.
- * @return string DBMS specific SQL code portion that should be used to
- * declare the specified field.
- * @access public
- */
- function getTypeDeclaration($field)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- switch ($field['type']) {
- case 'text':
- $length = !empty($field['length'])
- ? $field['length'] : $db->options['default_text_field_length'];
- $fixed = !empty($field['fixed']) ? $field['fixed'] : false;
- return $fixed ? 'CHAR('.$length.')' : 'VARCHAR2('.$length.')';
- case 'clob':
- return 'CLOB';
- case 'blob':
- return 'BLOB';
- case 'integer':
- if (!empty($field['length'])) {
- switch((int)$field['length']) {
- case 1: $digit = 3; break;
- case 2: $digit = 5; break;
- case 3: $digit = 8; break;
- case 4: $digit = 10; break;
- case 5: $digit = 13; break;
- case 6: $digit = 15; break;
- case 7: $digit = 17; break;
- case 8: $digit = 20; break;
- default: $digit = 10;
- }
- return 'NUMBER('.$digit.')';
- }
- return 'INT';
- case 'boolean':
- return 'NUMBER(1)';
- case 'date':
- case 'time':
- case 'timestamp':
- return 'DATE';
- case 'float':
- return 'NUMBER';
- case 'decimal':
- $scale = !empty($field['scale']) ? $field['scale'] : $db->options['decimal_places'];
- return 'NUMBER(*,'.$scale.')';
- }
- }
-
- // }}}
- // {{{ _quoteCLOB()
-
- /**
- * Convert a text value into a DBMS specific format that is suitable to
- * compose query statements.
- *
- * @param string $value text string value that is intended to be converted.
- * @param bool $quote determines if the value should be quoted and escaped
- * @param bool $escape_wildcards if to escape escape wildcards
- * @return string text string that represents the given argument value in
- * a DBMS specific format.
- * @access protected
- */
- function _quoteCLOB($value, $quote, $escape_wildcards)
- {
- return 'EMPTY_CLOB()';
- }
-
- // }}}
- // {{{ _quoteBLOB()
-
- /**
- * Convert a text value into a DBMS specific format that is suitable to
- * compose query statements.
- *
- * @param string $value text string value that is intended to be converted.
- * @param bool $quote determines if the value should be quoted and escaped
- * @param bool $escape_wildcards if to escape escape wildcards
- * @return string text string that represents the given argument value in
- * a DBMS specific format.
- * @access protected
- */
- function _quoteBLOB($value, $quote, $escape_wildcards)
- {
- return 'EMPTY_BLOB()';
- }
-
- // }}}
- // {{{ _quoteDate()
-
- /**
- * Convert a text value into a DBMS specific format that is suitable to
- * compose query statements.
- *
- * @param string $value text string value that is intended to be converted.
- * @param bool $quote determines if the value should be quoted and escaped
- * @param bool $escape_wildcards if to escape escape wildcards
- * @return string text string that represents the given argument value in
- * a DBMS specific format.
- * @access protected
- */
- function _quoteDate($value, $quote, $escape_wildcards)
- {
- return $this->_quoteText("$value 00:00:00", $quote, $escape_wildcards);
- }
-
- // }}}
- // {{{ _quoteTimestamp()
-
- /**
- * Convert a text value into a DBMS specific format that is suitable to
- * compose query statements.
- *
- * @param string $value text string value that is intended to be converted.
- * @param bool $quote determines if the value should be quoted and escaped
- * @param bool $escape_wildcards if to escape escape wildcards
- * @return string text string that represents the given argument value in
- * a DBMS specific format.
- * @access protected
- */
- //function _quoteTimestamp($value, $quote, $escape_wildcards)
- //{
- // return $this->_quoteText($value, $quote, $escape_wildcards);
- //}
-
- // }}}
- // {{{ _quoteTime()
-
- /**
- * Convert a text value into a DBMS specific format that is suitable to
- * compose query statements.
- *
- * @param string $value text string value that is intended to be converted.
- * @param bool $quote determines if the value should be quoted and escaped
- * @param bool $escape_wildcards if to escape escape wildcards
- * @return string text string that represents the given argument value in
- * a DBMS specific format.
- * @access protected
- */
- function _quoteTime($value, $quote, $escape_wildcards)
- {
- return $this->_quoteText("0001-01-01 $value", $quote, $escape_wildcards);
- }
-
- // }}}
- // {{{ writeLOBToFile()
-
- /**
- * retrieve LOB from the database
- *
- * @param array $lob array
- * @param string $file name of the file into which the LOb should be fetched
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access protected
- */
- function writeLOBToFile($lob, $file)
- {
- if (preg_match('/^(\w+:\/\/)(.*)$/', $file, $match)) {
- if ($match[1] == 'file://') {
- $file = $match[2];
- }
- }
- $lob_data = stream_get_meta_data($lob);
- $lob_index = $lob_data['wrapper_data']->lob_index;
- $result = $this->lobs[$lob_index]['resource']->writetofile($file);
- $this->lobs[$lob_index]['resource']->seek(0);
- if (!$result) {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- return $db->raiseError(null, null, null,
- 'Unable to write LOB to file', __FUNCTION__);
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ _retrieveLOB()
-
- /**
- * retrieve LOB from the database
- *
- * @param array $lob array
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access protected
- */
- function _retrieveLOB(&$lob)
- {
- if (!is_object($lob['resource'])) {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- return $db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- 'attemped to retrieve LOB from non existing or NULL column', __FUNCTION__);
- }
-
- if (!$lob['loaded']
-# && !method_exists($lob['resource'], 'read')
- ) {
- $lob['value'] = $lob['resource']->load();
- $lob['resource']->seek(0);
- }
- $lob['loaded'] = true;
- return MDB2_OK;
- }
-
- // }}}
- // {{{ _readLOB()
-
- /**
- * Read data from large object input stream.
- *
- * @param array $lob array
- * @param blob $data reference to a variable that will hold data to be
- * read from the large object input stream
- * @param int $length integer value that indicates the largest ammount of
- * data to be read from the large object input stream.
- * @return mixed length on success, a MDB2 error on failure
- * @access protected
- */
- function _readLOB($lob, $length)
- {
- if ($lob['loaded']) {
- return parent::_readLOB($lob, $length);
- }
-
- if (!is_object($lob['resource'])) {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- return $db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- 'attemped to retrieve LOB from non existing or NULL column', __FUNCTION__);
- }
-
- $data = $lob['resource']->read($length);
- if (!is_string($data)) {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- return $db->raiseError(null, null, null,
- 'Unable to read LOB', __FUNCTION__);
- }
- return $data;
- }
-
- // }}}
- // {{{ patternEscapeString()
-
- /**
- * build string to define escape pattern string
- *
- * @access public
- *
- *
- * @return string define escape pattern
- */
- function patternEscapeString()
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
- return " ESCAPE '". $db->string_quoting['escape_pattern'] ."'";
- }
-
- // }}}
- // {{{ _mapNativeDatatype()
-
- /**
- * Maps a native array description of a field to a MDB2 datatype and length
- *
- * @param array $field native field description
- * @return array containing the various possible types, length, sign, fixed
- * @access public
- */
- function _mapNativeDatatype($field)
- {
- $db_type = strtolower($field['type']);
- $type = array();
- $length = $unsigned = $fixed = null;
- if (!empty($field['length'])) {
- $length = $field['length'];
- }
- switch ($db_type) {
- case 'integer':
- case 'pls_integer':
- case 'binary_integer':
- $type[] = 'integer';
- if ($length == '1') {
- $type[] = 'boolean';
- if (preg_match('/^(is|has)/', $field['name'])) {
- $type = array_reverse($type);
- }
- }
- break;
- case 'varchar':
- case 'varchar2':
- case 'nvarchar2':
- $fixed = false;
- case 'char':
- case 'nchar':
- $type[] = 'text';
- if ($length == '1') {
- $type[] = 'boolean';
- if (preg_match('/^(is|has)/', $field['name'])) {
- $type = array_reverse($type);
- }
- }
- if ($fixed !== false) {
- $fixed = true;
- }
- break;
- case 'date':
- case 'timestamp':
- $type[] = 'timestamp';
- $length = null;
- break;
- case 'float':
- $type[] = 'float';
- break;
- case 'number':
- if (!empty($field['scale'])) {
- $type[] = 'decimal';
- $length = $length.','.$field['scale'];
- } else {
- $type[] = 'integer';
- if ($length == '1') {
- $type[] = 'boolean';
- if (preg_match('/^(is|has)/', $field['name'])) {
- $type = array_reverse($type);
- }
- }
- }
- break;
- case 'long':
- $type[] = 'text';
- case 'clob':
- case 'nclob':
- $type[] = 'clob';
- break;
- case 'blob':
- case 'raw':
- case 'long raw':
- case 'bfile':
- $type[] = 'blob';
- $length = null;
- break;
- case 'rowid':
- case 'urowid':
- default:
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'unknown database attribute type: '.$db_type, __FUNCTION__);
- }
-
- if ((int)$length <= 0) {
- $length = null;
- }
-
- return array($type, $length, $unsigned, $fixed);
- }
-}
-
-?> \ No newline at end of file
diff --git a/3rdparty/MDB2/Driver/Datatype/pgsql.php b/3rdparty/MDB2/Driver/Datatype/pgsql.php
deleted file mode 100644
index db2fa279024..00000000000
--- a/3rdparty/MDB2/Driver/Datatype/pgsql.php
+++ /dev/null
@@ -1,579 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2007 Manuel Lemos, Tomas V.V.Cox, |
-// | Stig. S. Bakken, Lukas Smith |
-// | All rights reserved. |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
-// | API as well as database abstraction for PHP applications. |
-// | This LICENSE is in the BSD license style. |
-// | |
-// | Redistribution and use in source and binary forms, with or without |
-// | modification, are permitted provided that the following conditions |
-// | are met: |
-// | |
-// | Redistributions of source code must retain the above copyright |
-// | notice, this list of conditions and the following disclaimer. |
-// | |
-// | Redistributions in binary form must reproduce the above copyright |
-// | notice, this list of conditions and the following disclaimer in the |
-// | documentation and/or other materials provided with the distribution. |
-// | |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission. |
-// | |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-// | POSSIBILITY OF SUCH DAMAGE. |
-// +----------------------------------------------------------------------+
-// | Author: Paul Cooper <pgc@ucecom.com> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-require_once 'MDB2/Driver/Datatype/Common.php';
-
-/**
- * MDB2 PostGreSQL driver
- *
- * @package MDB2
- * @category Database
- * @author Paul Cooper <pgc@ucecom.com>
- */
-class MDB2_Driver_Datatype_pgsql extends MDB2_Driver_Datatype_Common
-{
- // {{{ _baseConvertResult()
-
- /**
- * General type conversion method
- *
- * @param mixed $value refernce to a value to be converted
- * @param string $type specifies which type to convert to
- * @param boolean $rtrim [optional] when TRUE [default], apply rtrim() to text
- * @return object a MDB2 error on failure
- * @access protected
- */
- function _baseConvertResult($value, $type, $rtrim = true)
- {
- if (null === $value) {
- return null;
- }
- switch ($type) {
- case 'boolean':
- return $value == 't';
- case 'float':
- return doubleval($value);
- case 'date':
- return $value;
- case 'time':
- return substr($value, 0, strlen('HH:MM:SS'));
- case 'timestamp':
- return substr($value, 0, strlen('YYYY-MM-DD HH:MM:SS'));
- case 'blob':
- $value = pg_unescape_bytea($value);
- return parent::_baseConvertResult($value, $type, $rtrim);
- }
- return parent::_baseConvertResult($value, $type, $rtrim);
- }
-
- // }}}
- // {{{ getTypeDeclaration()
-
- /**
- * Obtain DBMS specific SQL code portion needed to declare an text type
- * field to be used in statements like CREATE TABLE.
- *
- * @param array $field associative array with the name of the properties
- * of the field being declared as array indexes. Currently, the types
- * of supported field properties are as follows:
- *
- * length
- * Integer value that determines the maximum length of the text
- * field. If this argument is missing the field should be
- * declared to have the longest length allowed by the DBMS.
- *
- * default
- * Text value to be used as default for this field.
- *
- * notnull
- * Boolean flag that indicates whether this field is constrained
- * to not be set to null.
- * @return string DBMS specific SQL code portion that should be used to
- * declare the specified field.
- * @access public
- */
- function getTypeDeclaration($field)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- switch ($field['type']) {
- case 'text':
- $length = !empty($field['length']) ? $field['length'] : false;
- $fixed = !empty($field['fixed']) ? $field['fixed'] : false;
- return $fixed ? ($length ? 'CHAR('.$length.')' : 'CHAR('.$db->options['default_text_field_length'].')')
- : ($length ? 'VARCHAR('.$length.')' : 'TEXT');
- case 'clob':
- return 'TEXT';
- case 'blob':
- return 'BYTEA';
- case 'integer':
- if (!empty($field['autoincrement'])) {
- if (!empty($field['length'])) {
- $length = $field['length'];
- if ($length > 4) {
- return 'BIGSERIAL PRIMARY KEY';
- }
- }
- return 'SERIAL PRIMARY KEY';
- }
- if (!empty($field['length'])) {
- $length = $field['length'];
- if ($length <= 2) {
- return 'SMALLINT';
- } elseif ($length == 3 || $length == 4) {
- return 'INT';
- } elseif ($length > 4) {
- return 'BIGINT';
- }
- }
- return 'INT';
- case 'boolean':
- return 'BOOLEAN';
- case 'date':
- return 'DATE';
- case 'time':
- return 'TIME without time zone';
- case 'timestamp':
- return 'TIMESTAMP without time zone';
- case 'float':
- return 'FLOAT8';
- case 'decimal':
- $length = !empty($field['length']) ? $field['length'] : 18;
- $scale = !empty($field['scale']) ? $field['scale'] : $db->options['decimal_places'];
- return 'NUMERIC('.$length.','.$scale.')';
- }
- }
-
- // }}}
- // {{{ _getIntegerDeclaration()
-
- /**
- * Obtain DBMS specific SQL code portion needed to declare an integer type
- * field to be used in statements like CREATE TABLE.
- *
- * @param string $name name the field to be declared.
- * @param array $field associative array with the name of the properties
- * of the field being declared as array indexes. Currently, the types
- * of supported field properties are as follows:
- *
- * unsigned
- * Boolean flag that indicates whether the field should be
- * declared as unsigned integer if possible.
- *
- * default
- * Integer value to be used as default for this field.
- *
- * notnull
- * Boolean flag that indicates whether this field is constrained
- * to not be set to null.
- * @return string DBMS specific SQL code portion that should be used to
- * declare the specified field.
- * @access protected
- */
- function _getIntegerDeclaration($name, $field)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- if (!empty($field['unsigned'])) {
- $db->warnings[] = "unsigned integer field \"$name\" is being declared as signed integer";
- }
- if (!empty($field['autoincrement'])) {
- $name = $db->quoteIdentifier($name, true);
- return $name.' '.$this->getTypeDeclaration($field);
- }
- $default = '';
- if (array_key_exists('default', $field)) {
- if ($field['default'] === '') {
- $field['default'] = empty($field['notnull']) ? null : 0;
- }
- $default = ' DEFAULT '.$this->quote($field['default'], 'integer');
- }
-
- $notnull = empty($field['notnull']) ? '' : ' NOT NULL';
- if (empty($default) && empty($notnull)) {
- $default = ' DEFAULT NULL';
- }
- $name = $db->quoteIdentifier($name, true);
- return $name.' '.$this->getTypeDeclaration($field).$default.$notnull;
- }
-
- // }}}
- // {{{ _quoteCLOB()
-
- /**
- * Convert a text value into a DBMS specific format that is suitable to
- * compose query statements.
- *
- * @param string $value text string value that is intended to be converted.
- * @param bool $quote determines if the value should be quoted and escaped
- * @param bool $escape_wildcards if to escape escape wildcards
- * @return string text string that represents the given argument value in
- * a DBMS specific format.
- * @access protected
- */
- function _quoteCLOB($value, $quote, $escape_wildcards)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
- if ($db->options['lob_allow_url_include']) {
- $value = $this->_readFile($value);
- if (PEAR::isError($value)) {
- return $value;
- }
- }
- return $this->_quoteText($value, $quote, $escape_wildcards);
- }
-
- // }}}
- // {{{ _quoteBLOB()
-
- /**
- * Convert a text value into a DBMS specific format that is suitable to
- * compose query statements.
- *
- * @param string $value text string value that is intended to be converted.
- * @param bool $quote determines if the value should be quoted and escaped
- * @param bool $escape_wildcards if to escape escape wildcards
- * @return string text string that represents the given argument value in
- * a DBMS specific format.
- * @access protected
- */
- function _quoteBLOB($value, $quote, $escape_wildcards)
- {
- if (!$quote) {
- return $value;
- }
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
- if ($db->options['lob_allow_url_include']) {
- $value = $this->_readFile($value);
- if (PEAR::isError($value)) {
- return $value;
- }
- }
- if (version_compare(PHP_VERSION, '5.2.0RC6', '>=')) {
- $connection = $db->getConnection();
- if (PEAR::isError($connection)) {
- return $connection;
- }
- $value = @pg_escape_bytea($connection, $value);
- } else {
- $value = @pg_escape_bytea($value);
- }
- return "'".$value."'";
- }
-
- // }}}
- // {{{ _quoteBoolean()
-
- /**
- * Convert a text value into a DBMS specific format that is suitable to
- * compose query statements.
- *
- * @param string $value text string value that is intended to be converted.
- * @param bool $quote determines if the value should be quoted and escaped
- * @param bool $escape_wildcards if to escape escape wildcards
- * @return string text string that represents the given argument value in
- * a DBMS specific format.
- * @access protected
- */
- function _quoteBoolean($value, $quote, $escape_wildcards)
- {
- $value = $value ? 't' : 'f';
- if (!$quote) {
- return $value;
- }
- return "'".$value."'";
- }
-
- // }}}
- // {{{ matchPattern()
-
- /**
- * build a pattern matching string
- *
- * @access public
- *
- * @param array $pattern even keys are strings, odd are patterns (% and _)
- * @param string $operator optional pattern operator (LIKE, ILIKE and maybe others in the future)
- * @param string $field optional field name that is being matched against
- * (might be required when emulating ILIKE)
- *
- * @return string SQL pattern
- */
- function matchPattern($pattern, $operator = null, $field = null)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $match = '';
- if (null !== $operator) {
- $field = (null === $field) ? '' : $field.' ';
- $operator = strtoupper($operator);
- switch ($operator) {
- // case insensitive
- case 'ILIKE':
- $match = $field.'ILIKE ';
- break;
- case 'NOT ILIKE':
- $match = $field.'NOT ILIKE ';
- break;
- // case sensitive
- case 'LIKE':
- $match = $field.'LIKE ';
- break;
- case 'NOT LIKE':
- $match = $field.'NOT LIKE ';
- break;
- default:
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'not a supported operator type:'. $operator, __FUNCTION__);
- }
- }
- $match.= "'";
- foreach ($pattern as $key => $value) {
- if ($key % 2) {
- $match.= $value;
- } else {
- $match.= $db->escapePattern($db->escape($value));
- }
- }
- $match.= "'";
- $match.= $this->patternEscapeString();
- return $match;
- }
-
- // }}}
- // {{{ patternEscapeString()
-
- /**
- * build string to define escape pattern string
- *
- * @access public
- *
- *
- * @return string define escape pattern
- */
- function patternEscapeString()
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
- return ' ESCAPE '.$this->quote($db->string_quoting['escape_pattern']);
- }
-
- // }}}
- // {{{ _mapNativeDatatype()
-
- /**
- * Maps a native array description of a field to a MDB2 datatype and length
- *
- * @param array $field native field description
- * @return array containing the various possible types, length, sign, fixed
- * @access public
- */
- function _mapNativeDatatype($field)
- {
- $db_type = strtolower($field['type']);
- $length = $field['length'];
- $type = array();
- $unsigned = $fixed = null;
- switch ($db_type) {
- case 'smallint':
- case 'int2':
- $type[] = 'integer';
- $unsigned = false;
- $length = 2;
- if ($length == '2') {
- $type[] = 'boolean';
- if (preg_match('/^(is|has)/', $field['name'])) {
- $type = array_reverse($type);
- }
- }
- break;
- case 'int':
- case 'int4':
- case 'integer':
- case 'serial':
- case 'serial4':
- $type[] = 'integer';
- $unsigned = false;
- $length = 4;
- break;
- case 'bigint':
- case 'int8':
- case 'bigserial':
- case 'serial8':
- $type[] = 'integer';
- $unsigned = false;
- $length = 8;
- break;
- case 'bool':
- case 'boolean':
- $type[] = 'boolean';
- $length = null;
- break;
- case 'text':
- case 'varchar':
- $fixed = false;
- case 'unknown':
- case 'char':
- case 'bpchar':
- $type[] = 'text';
- if ($length == '1') {
- $type[] = 'boolean';
- if (preg_match('/^(is|has)/', $field['name'])) {
- $type = array_reverse($type);
- }
- } elseif (strstr($db_type, 'text')) {
- $type[] = 'clob';
- $type = array_reverse($type);
- }
- if ($fixed !== false) {
- $fixed = true;
- }
- break;
- case 'date':
- $type[] = 'date';
- $length = null;
- break;
- case 'datetime':
- case 'timestamp':
- case 'timestamptz':
- $type[] = 'timestamp';
- $length = null;
- break;
- case 'time':
- $type[] = 'time';
- $length = null;
- break;
- case 'float':
- case 'float4':
- case 'float8':
- case 'double':
- case 'real':
- $type[] = 'float';
- break;
- case 'decimal':
- case 'money':
- case 'numeric':
- $type[] = 'decimal';
- if (isset($field['scale'])) {
- $length = $length.','.$field['scale'];
- }
- break;
- case 'tinyblob':
- case 'mediumblob':
- case 'longblob':
- case 'blob':
- case 'bytea':
- $type[] = 'blob';
- $length = null;
- break;
- case 'oid':
- $type[] = 'blob';
- $type[] = 'clob';
- $length = null;
- break;
- case 'year':
- $type[] = 'integer';
- $type[] = 'date';
- $length = null;
- break;
- default:
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'unknown database attribute type: '.$db_type, __FUNCTION__);
- }
-
- if ((int)$length <= 0) {
- $length = null;
- }
-
- return array($type, $length, $unsigned, $fixed);
- }
-
- // }}}
- // {{{ mapPrepareDatatype()
-
- /**
- * Maps an mdb2 datatype to native prepare type
- *
- * @param string $type
- * @return string
- * @access public
- */
- function mapPrepareDatatype($type)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- if (!empty($db->options['datatype_map'][$type])) {
- $type = $db->options['datatype_map'][$type];
- if (!empty($db->options['datatype_map_callback'][$type])) {
- $parameter = array('type' => $type);
- return call_user_func_array($db->options['datatype_map_callback'][$type], array(&$db, __FUNCTION__, $parameter));
- }
- }
-
- switch ($type) {
- case 'integer':
- return 'int';
- case 'boolean':
- return 'bool';
- case 'decimal':
- case 'float':
- return 'numeric';
- case 'clob':
- return 'text';
- case 'blob':
- return 'bytea';
- default:
- break;
- }
- return $type;
- }
- // }}}
-}
-?> \ No newline at end of file
diff --git a/3rdparty/MDB2/Driver/Datatype/sqlite.php b/3rdparty/MDB2/Driver/Datatype/sqlite.php
deleted file mode 100644
index 50475a36282..00000000000
--- a/3rdparty/MDB2/Driver/Datatype/sqlite.php
+++ /dev/null
@@ -1,418 +0,0 @@
-<?php
-// vim: set et ts=4 sw=4 fdm=marker:
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2007 Manuel Lemos, Tomas V.V.Cox, |
-// | Stig. S. Bakken, Lukas Smith |
-// | All rights reserved. |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
-// | API as well as database abstraction for PHP applications. |
-// | This LICENSE is in the BSD license style. |
-// | |
-// | Redistribution and use in source and binary forms, with or without |
-// | modification, are permitted provided that the following conditions |
-// | are met: |
-// | |
-// | Redistributions of source code must retain the above copyright |
-// | notice, this list of conditions and the following disclaimer. |
-// | |
-// | Redistributions in binary form must reproduce the above copyright |
-// | notice, this list of conditions and the following disclaimer in the |
-// | documentation and/or other materials provided with the distribution. |
-// | |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission. |
-// | |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-// | POSSIBILITY OF SUCH DAMAGE. |
-// +----------------------------------------------------------------------+
-// | Author: Lukas Smith <smith@pooteeweet.org> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-
-require_once 'MDB2/Driver/Datatype/Common.php';
-
-/**
- * MDB2 SQLite driver
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Driver_Datatype_sqlite extends MDB2_Driver_Datatype_Common
-{
- // {{{ _getCollationFieldDeclaration()
-
- /**
- * Obtain DBMS specific SQL code portion needed to set the COLLATION
- * of a field declaration to be used in statements like CREATE TABLE.
- *
- * @param string $collation name of the collation
- *
- * @return string DBMS specific SQL code portion needed to set the COLLATION
- * of a field declaration.
- */
- function _getCollationFieldDeclaration($collation)
- {
- return 'COLLATE '.$collation;
- }
-
- // }}}
- // {{{ getTypeDeclaration()
-
- /**
- * Obtain DBMS specific SQL code portion needed to declare an text type
- * field to be used in statements like CREATE TABLE.
- *
- * @param array $field associative array with the name of the properties
- * of the field being declared as array indexes. Currently, the types
- * of supported field properties are as follows:
- *
- * length
- * Integer value that determines the maximum length of the text
- * field. If this argument is missing the field should be
- * declared to have the longest length allowed by the DBMS.
- *
- * default
- * Text value to be used as default for this field.
- *
- * notnull
- * Boolean flag that indicates whether this field is constrained
- * to not be set to null.
- * @return string DBMS specific SQL code portion that should be used to
- * declare the specified field.
- * @access public
- */
- function getTypeDeclaration($field)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- switch ($field['type']) {
- case 'text':
- $length = !empty($field['length'])
- ? $field['length'] : false;
- $fixed = !empty($field['fixed']) ? $field['fixed'] : false;
- return $fixed ? ($length ? 'CHAR('.$length.')' : 'CHAR('.$db->options['default_text_field_length'].')')
- : ($length ? 'VARCHAR('.$length.')' : 'TEXT');
- case 'clob':
- if (!empty($field['length'])) {
- $length = $field['length'];
- if ($length <= 255) {
- return 'TINYTEXT';
- } elseif ($length <= 65532) {
- return 'TEXT';
- } elseif ($length <= 16777215) {
- return 'MEDIUMTEXT';
- }
- }
- return 'LONGTEXT';
- case 'blob':
- if (!empty($field['length'])) {
- $length = $field['length'];
- if ($length <= 255) {
- return 'TINYBLOB';
- } elseif ($length <= 65532) {
- return 'BLOB';
- } elseif ($length <= 16777215) {
- return 'MEDIUMBLOB';
- }
- }
- return 'LONGBLOB';
- case 'integer':
- if (!empty($field['length'])) {
- $length = $field['length'];
- if ($length <= 2) {
- return 'SMALLINT';
- } elseif ($length == 3 || $length == 4) {
- return 'INTEGER';
- } elseif ($length > 4) {
- return 'BIGINT';
- }
- }
- return 'INTEGER';
- case 'boolean':
- return 'BOOLEAN';
- case 'date':
- return 'DATE';
- case 'time':
- return 'TIME';
- case 'timestamp':
- return 'DATETIME';
- case 'float':
- return 'DOUBLE'.($db->options['fixed_float'] ? '('.
- ($db->options['fixed_float']+2).','.$db->options['fixed_float'].')' : '');
- case 'decimal':
- $length = !empty($field['length']) ? $field['length'] : 18;
- $scale = !empty($field['scale']) ? $field['scale'] : $db->options['decimal_places'];
- return 'DECIMAL('.$length.','.$scale.')';
- }
- return '';
- }
-
- // }}}
- // {{{ _getIntegerDeclaration()
-
- /**
- * Obtain DBMS specific SQL code portion needed to declare an integer type
- * field to be used in statements like CREATE TABLE.
- *
- * @param string $name name the field to be declared.
- * @param string $field associative array with the name of the properties
- * of the field being declared as array indexes.
- * Currently, the types of supported field
- * properties are as follows:
- *
- * unsigned
- * Boolean flag that indicates whether the field
- * should be declared as unsigned integer if
- * possible.
- *
- * default
- * Integer value to be used as default for this
- * field.
- *
- * notnull
- * Boolean flag that indicates whether this field is
- * constrained to not be set to null.
- * @return string DBMS specific SQL code portion that should be used to
- * declare the specified field.
- * @access protected
- */
- function _getIntegerDeclaration($name, $field)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $default = $autoinc = '';
- if (!empty($field['autoincrement'])) {
- $autoinc = ' PRIMARY KEY';
- } elseif (array_key_exists('default', $field)) {
- if ($field['default'] === '') {
- $field['default'] = empty($field['notnull']) ? null : 0;
- }
- $default = ' DEFAULT '.$this->quote($field['default'], 'integer');
- }
-
- $notnull = empty($field['notnull']) ? '' : ' NOT NULL';
- $unsigned = empty($field['unsigned']) ? '' : ' UNSIGNED';
- if (empty($default) && empty($notnull)) {
- $default = ' DEFAULT NULL';
- }
- $name = $db->quoteIdentifier($name, true);
- return $name.' '.$this->getTypeDeclaration($field).$unsigned.$default.$notnull.$autoinc;
- }
-
- // }}}
- // {{{ matchPattern()
-
- /**
- * build a pattern matching string
- *
- * @access public
- *
- * @param array $pattern even keys are strings, odd are patterns (% and _)
- * @param string $operator optional pattern operator (LIKE, ILIKE and maybe others in the future)
- * @param string $field optional field name that is being matched against
- * (might be required when emulating ILIKE)
- *
- * @return string SQL pattern
- */
- function matchPattern($pattern, $operator = null, $field = null)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $match = '';
- if (null !== $operator) {
- $field = (null === $field) ? '' : $field.' ';
- $operator = strtoupper($operator);
- switch ($operator) {
- // case insensitive
- case 'ILIKE':
- $match = $field.'LIKE ';
- break;
- case 'NOT ILIKE':
- $match = $field.'NOT LIKE ';
- break;
- // case sensitive
- case 'LIKE':
- $match = $field.'LIKE ';
- break;
- case 'NOT LIKE':
- $match = $field.'NOT LIKE ';
- break;
- default:
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'not a supported operator type:'. $operator, __FUNCTION__);
- }
- }
- $match.= "'";
- foreach ($pattern as $key => $value) {
- if ($key % 2) {
- $match.= $value;
- } else {
- $match.= $db->escapePattern($db->escape($value));
- }
- }
- $match.= "'";
- $match.= $this->patternEscapeString();
- return $match;
- }
-
- // }}}
- // {{{ _mapNativeDatatype()
-
- /**
- * Maps a native array description of a field to a MDB2 datatype and length
- *
- * @param array $field native field description
- * @return array containing the various possible types, length, sign, fixed
- * @access public
- */
- function _mapNativeDatatype($field)
- {
- $db_type = strtolower($field['type']);
- $length = !empty($field['length']) ? $field['length'] : null;
- $unsigned = !empty($field['unsigned']) ? $field['unsigned'] : null;
- $fixed = null;
- $type = array();
- switch ($db_type) {
- case 'boolean':
- $type[] = 'boolean';
- break;
- case 'tinyint':
- $type[] = 'integer';
- $type[] = 'boolean';
- if (preg_match('/^(is|has)/', $field['name'])) {
- $type = array_reverse($type);
- }
- $unsigned = preg_match('/ unsigned/i', $field['type']);
- $length = 1;
- break;
- case 'smallint':
- $type[] = 'integer';
- $unsigned = preg_match('/ unsigned/i', $field['type']);
- $length = 2;
- break;
- case 'mediumint':
- $type[] = 'integer';
- $unsigned = preg_match('/ unsigned/i', $field['type']);
- $length = 3;
- break;
- case 'int':
- case 'integer':
- case 'serial':
- $type[] = 'integer';
- $unsigned = preg_match('/ unsigned/i', $field['type']);
- $length = 4;
- break;
- case 'bigint':
- case 'bigserial':
- $type[] = 'integer';
- $unsigned = preg_match('/ unsigned/i', $field['type']);
- $length = 8;
- break;
- case 'clob':
- $type[] = 'clob';
- $fixed = false;
- break;
- case 'tinytext':
- case 'mediumtext':
- case 'longtext':
- case 'text':
- case 'varchar':
- case 'varchar2':
- $fixed = false;
- case 'char':
- $type[] = 'text';
- if ($length == '1') {
- $type[] = 'boolean';
- if (preg_match('/^(is|has)/', $field['name'])) {
- $type = array_reverse($type);
- }
- } elseif (strstr($db_type, 'text')) {
- $type[] = 'clob';
- $type = array_reverse($type);
- }
- if ($fixed !== false) {
- $fixed = true;
- }
- break;
- case 'date':
- $type[] = 'date';
- $length = null;
- break;
- case 'datetime':
- case 'timestamp':
- $type[] = 'timestamp';
- $length = null;
- break;
- case 'time':
- $type[] = 'time';
- $length = null;
- break;
- case 'float':
- case 'double':
- case 'real':
- $type[] = 'float';
- break;
- case 'decimal':
- case 'numeric':
- $type[] = 'decimal';
- $length = $length.','.$field['decimal'];
- break;
- case 'tinyblob':
- case 'mediumblob':
- case 'longblob':
- case 'blob':
- $type[] = 'blob';
- $length = null;
- break;
- case 'year':
- $type[] = 'integer';
- $type[] = 'date';
- $length = null;
- break;
- default:
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'unknown database attribute type: '.$db_type, __FUNCTION__);
- }
-
- if ((int)$length <= 0) {
- $length = null;
- }
-
- return array($type, $length, $unsigned, $fixed);
- }
-
- // }}}
-}
-
-?> \ No newline at end of file
diff --git a/3rdparty/MDB2/Driver/Function/Common.php b/3rdparty/MDB2/Driver/Function/Common.php
deleted file mode 100644
index 5a780fd48e8..00000000000
--- a/3rdparty/MDB2/Driver/Function/Common.php
+++ /dev/null
@@ -1,293 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox, |
-// | Stig. S. Bakken, Lukas Smith |
-// | All rights reserved. |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
-// | API as well as database abstraction for PHP applications. |
-// | This LICENSE is in the BSD license style. |
-// | |
-// | Redistribution and use in source and binary forms, with or without |
-// | modification, are permitted provided that the following conditions |
-// | are met: |
-// | |
-// | Redistributions of source code must retain the above copyright |
-// | notice, this list of conditions and the following disclaimer. |
-// | |
-// | Redistributions in binary form must reproduce the above copyright |
-// | notice, this list of conditions and the following disclaimer in the |
-// | documentation and/or other materials provided with the distribution. |
-// | |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission. |
-// | |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-// | POSSIBILITY OF SUCH DAMAGE. |
-// +----------------------------------------------------------------------+
-// | Author: Lukas Smith <smith@pooteeweet.org> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-
-/**
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-
-/**
- * Base class for the function modules that is extended by each MDB2 driver
- *
- * To load this module in the MDB2 object:
- * $mdb->loadModule('Function');
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Driver_Function_Common extends MDB2_Module_Common
-{
- // {{{ executeStoredProc()
-
- /**
- * Execute a stored procedure and return any results
- *
- * @param string $name string that identifies the function to execute
- * @param mixed $params array that contains the paramaters to pass the stored proc
- * @param mixed $types array that contains the types of the columns in
- * the result set
- * @param mixed $result_class string which specifies which result class to use
- * @param mixed $result_wrap_class string which specifies which class to wrap results in
- *
- * @return mixed a result handle or MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function executeStoredProc($name, $params = null, $types = null, $result_class = true, $result_wrap_class = false)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $error = $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- return $error;
- }
-
- // }}}
- // {{{ functionTable()
-
- /**
- * return string for internal table used when calling only a function
- *
- * @return string for internal table used when calling only a function
- * @access public
- */
- function functionTable()
- {
- return '';
- }
-
- // }}}
- // {{{ now()
-
- /**
- * Return string to call a variable with the current timestamp inside an SQL statement
- * There are three special variables for current date and time:
- * - CURRENT_TIMESTAMP (date and time, TIMESTAMP type)
- * - CURRENT_DATE (date, DATE type)
- * - CURRENT_TIME (time, TIME type)
- *
- * @param string $type 'timestamp' | 'time' | 'date'
- *
- * @return string to call a variable with the current timestamp
- * @access public
- */
- function now($type = 'timestamp')
- {
- switch ($type) {
- case 'time':
- return 'CURRENT_TIME';
- case 'date':
- return 'CURRENT_DATE';
- case 'timestamp':
- default:
- return 'CURRENT_TIMESTAMP';
- }
- }
-
- // }}}
- // {{{ unixtimestamp()
-
- /**
- * return string to call a function to get the unix timestamp from a iso timestamp
- *
- * @param string $expression
- *
- * @return string to call a variable with the timestamp
- * @access public
- */
- function unixtimestamp($expression)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $error = $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- return $error;
- }
-
- // }}}
- // {{{ substring()
-
- /**
- * return string to call a function to get a substring inside an SQL statement
- *
- * @return string to call a function to get a substring
- * @access public
- */
- function substring($value, $position = 1, $length = null)
- {
- if (null !== $length) {
- return "SUBSTRING($value FROM $position FOR $length)";
- }
- return "SUBSTRING($value FROM $position)";
- }
-
- // }}}
- // {{{ replace()
-
- /**
- * return string to call a function to get replace inside an SQL statement.
- *
- * @return string to call a function to get a replace
- * @access public
- */
- function replace($str, $from_str, $to_str)
- {
- return "REPLACE($str, $from_str , $to_str)";
- }
-
- // }}}
- // {{{ concat()
-
- /**
- * Returns string to concatenate two or more string parameters
- *
- * @param string $value1
- * @param string $value2
- * @param string $values...
- *
- * @return string to concatenate two strings
- * @access public
- */
- function concat($value1, $value2)
- {
- $args = func_get_args();
- return "(".implode(' || ', $args).")";
- }
-
- // }}}
- // {{{ random()
-
- /**
- * return string to call a function to get random value inside an SQL statement
- *
- * @return return string to generate float between 0 and 1
- * @access public
- */
- function random()
- {
- return 'RAND()';
- }
-
- // }}}
- // {{{ lower()
-
- /**
- * return string to call a function to lower the case of an expression
- *
- * @param string $expression
- *
- * @return return string to lower case of an expression
- * @access public
- */
- function lower($expression)
- {
- return "LOWER($expression)";
- }
-
- // }}}
- // {{{ upper()
-
- /**
- * return string to call a function to upper the case of an expression
- *
- * @param string $expression
- *
- * @return return string to upper case of an expression
- * @access public
- */
- function upper($expression)
- {
- return "UPPER($expression)";
- }
-
- // }}}
- // {{{ length()
-
- /**
- * return string to call a function to get the length of a string expression
- *
- * @param string $expression
- *
- * @return return string to get the string expression length
- * @access public
- */
- function length($expression)
- {
- return "LENGTH($expression)";
- }
-
- // }}}
- // {{{ guid()
-
- /**
- * Returns global unique identifier
- *
- * @return string to get global unique identifier
- * @access public
- */
- function guid()
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $error = $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- return $error;
- }
-
- // }}}
-}
-?> \ No newline at end of file
diff --git a/3rdparty/MDB2/Driver/Function/mysql.php b/3rdparty/MDB2/Driver/Function/mysql.php
deleted file mode 100644
index 90fdafc973c..00000000000
--- a/3rdparty/MDB2/Driver/Function/mysql.php
+++ /dev/null
@@ -1,136 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2008 Manuel Lemos, Tomas V.V.Cox, |
-// | Stig. S. Bakken, Lukas Smith |
-// | All rights reserved. |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
-// | API as well as database abstraction for PHP applications. |
-// | This LICENSE is in the BSD license style. |
-// | |
-// | Redistribution and use in source and binary forms, with or without |
-// | modification, are permitted provided that the following conditions |
-// | are met: |
-// | |
-// | Redistributions of source code must retain the above copyright |
-// | notice, this list of conditions and the following disclaimer. |
-// | |
-// | Redistributions in binary form must reproduce the above copyright |
-// | notice, this list of conditions and the following disclaimer in the |
-// | documentation and/or other materials provided with the distribution. |
-// | |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission. |
-// | |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-// | POSSIBILITY OF SUCH DAMAGE. |
-// +----------------------------------------------------------------------+
-// | Author: Lukas Smith <smith@pooteeweet.org> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-
-require_once 'MDB2/Driver/Function/Common.php';
-
-/**
- * MDB2 MySQL driver for the function modules
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Driver_Function_mysql extends MDB2_Driver_Function_Common
-{
- // }}}
- // {{{ executeStoredProc()
-
- /**
- * Execute a stored procedure and return any results
- *
- * @param string $name string that identifies the function to execute
- * @param mixed $params array that contains the paramaters to pass the stored proc
- * @param mixed $types array that contains the types of the columns in
- * the result set
- * @param mixed $result_class string which specifies which result class to use
- * @param mixed $result_wrap_class string which specifies which class to wrap results in
- * @return mixed a result handle or MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function executeStoredProc($name, $params = null, $types = null, $result_class = true, $result_wrap_class = false)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $query = 'CALL '.$name;
- $query .= $params ? '('.implode(', ', $params).')' : '()';
- return $db->query($query, $types, $result_class, $result_wrap_class);
- }
-
- // }}}
- // {{{ unixtimestamp()
-
- /**
- * return string to call a function to get the unix timestamp from a iso timestamp
- *
- * @param string $expression
- *
- * @return string to call a variable with the timestamp
- * @access public
- */
- function unixtimestamp($expression)
- {
- return 'UNIX_TIMESTAMP('. $expression.')';
- }
-
- // }}}
- // {{{ concat()
-
- /**
- * Returns string to concatenate two or more string parameters
- *
- * @param string $value1
- * @param string $value2
- * @param string $values...
- * @return string to concatenate two strings
- * @access public
- **/
- function concat($value1, $value2)
- {
- $args = func_get_args();
- return "CONCAT(".implode(', ', $args).")";
- }
-
- // }}}
- // {{{ guid()
-
- /**
- * Returns global unique identifier
- *
- * @return string to get global unique identifier
- * @access public
- */
- function guid()
- {
- return 'UUID()';
- }
-
- // }}}
-}
-?> \ No newline at end of file
diff --git a/3rdparty/MDB2/Driver/Function/oci8.php b/3rdparty/MDB2/Driver/Function/oci8.php
deleted file mode 100644
index 757d17fcb8b..00000000000
--- a/3rdparty/MDB2/Driver/Function/oci8.php
+++ /dev/null
@@ -1,187 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2008 Manuel Lemos, Tomas V.V.Cox, |
-// | Stig. S. Bakken, Lukas Smith |
-// | All rights reserved. |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
-// | API as well as database abstraction for PHP applications. |
-// | This LICENSE is in the BSD license style. |
-// | |
-// | Redistribution and use in source and binary forms, with or without |
-// | modification, are permitted provided that the following conditions |
-// | are met: |
-// | |
-// | Redistributions of source code must retain the above copyright |
-// | notice, this list of conditions and the following disclaimer. |
-// | |
-// | Redistributions in binary form must reproduce the above copyright |
-// | notice, this list of conditions and the following disclaimer in the |
-// | documentation and/or other materials provided with the distribution. |
-// | |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission. |
-// | |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-// | POSSIBILITY OF SUCH DAMAGE. |
-// +----------------------------------------------------------------------+
-// | Author: Lukas Smith <smith@pooteeweet.org> |
-// +----------------------------------------------------------------------+
-
-// $Id: oci8.php 295587 2010-02-28 17:16:38Z quipo $
-
-require_once 'MDB2/Driver/Function/Common.php';
-
-/**
- * MDB2 oci8 driver for the function modules
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Driver_Function_oci8 extends MDB2_Driver_Function_Common
-{
- // {{{ executeStoredProc()
-
- /**
- * Execute a stored procedure and return any results
- *
- * @param string $name string that identifies the function to execute
- * @param mixed $params array that contains the paramaters to pass the stored proc
- * @param mixed $types array that contains the types of the columns in
- * the result set
- * @param mixed $result_class string which specifies which result class to use
- * @param mixed $result_wrap_class string which specifies which class to wrap results in
- * @return mixed a result handle or MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function executeStoredProc($name, $params = null, $types = null, $result_class = true, $result_wrap_class = false)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $query = 'EXEC '.$name;
- $query .= $params ? '('.implode(', ', $params).')' : '()';
- return $db->query($query, $types, $result_class, $result_wrap_class);
- }
-
- // }}}
- // {{{ functionTable()
-
- /**
- * return string for internal table used when calling only a function
- *
- * @return string for internal table used when calling only a function
- * @access public
- */
- function functionTable()
- {
- return ' FROM dual';
- }
-
- // }}}
- // {{{ now()
-
- /**
- * Return string to call a variable with the current timestamp inside an SQL statement
- * There are three special variables for current date and time:
- * - CURRENT_TIMESTAMP (date and time, TIMESTAMP type)
- * - CURRENT_DATE (date, DATE type)
- * - CURRENT_TIME (time, TIME type)
- *
- * @return string to call a variable with the current timestamp
- * @access public
- */
- function now($type = 'timestamp')
- {
- switch ($type) {
- case 'date':
- case 'time':
- case 'timestamp':
- default:
- return 'TO_CHAR(CURRENT_TIMESTAMP, \'YYYY-MM-DD HH24:MI:SS\')';
- }
- }
-
- // }}}
- // {{{ unixtimestamp()
-
- /**
- * return string to call a function to get the unix timestamp from a iso timestamp
- *
- * @param string $expression
- *
- * @return string to call a variable with the timestamp
- * @access public
- */
- function unixtimestamp($expression)
- {
- $utc_offset = 'CAST(SYS_EXTRACT_UTC(SYSTIMESTAMP) AS DATE) - CAST(SYSTIMESTAMP AS DATE)';
- $epoch_date = 'to_date(\'19700101\', \'YYYYMMDD\')';
- return '(CAST('.$expression.' AS DATE) - '.$epoch_date.' + '.$utc_offset.') * 86400 seconds';
- }
-
- // }}}
- // {{{ substring()
-
- /**
- * return string to call a function to get a substring inside an SQL statement
- *
- * @return string to call a function to get a substring
- * @access public
- */
- function substring($value, $position = 1, $length = null)
- {
- if (null !== $length) {
- return "SUBSTR($value, $position, $length)";
- }
- return "SUBSTR($value, $position)";
- }
-
- // }}}
- // {{{ random()
-
- /**
- * return string to call a function to get random value inside an SQL statement
- *
- * @return return string to generate float between 0 and 1
- * @access public
- */
- function random()
- {
- return 'dbms_random.value';
- }
-
- // }}}}
- // {{{ guid()
-
- /**
- * Returns global unique identifier
- *
- * @return string to get global unique identifier
- * @access public
- */
- function guid()
- {
- return 'SYS_GUID()';
- }
-
- // }}}}
-}
-?> \ No newline at end of file
diff --git a/3rdparty/MDB2/Driver/Function/pgsql.php b/3rdparty/MDB2/Driver/Function/pgsql.php
deleted file mode 100644
index 7cc34a2d704..00000000000
--- a/3rdparty/MDB2/Driver/Function/pgsql.php
+++ /dev/null
@@ -1,132 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2008 Manuel Lemos, Tomas V.V.Cox, |
-// | Stig. S. Bakken, Lukas Smith |
-// | All rights reserved. |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
-// | API as well as database abstraction for PHP applications. |
-// | This LICENSE is in the BSD license style. |
-// | |
-// | Redistribution and use in source and binary forms, with or without |
-// | modification, are permitted provided that the following conditions |
-// | are met: |
-// | |
-// | Redistributions of source code must retain the above copyright |
-// | notice, this list of conditions and the following disclaimer. |
-// | |
-// | Redistributions in binary form must reproduce the above copyright |
-// | notice, this list of conditions and the following disclaimer in the |
-// | documentation and/or other materials provided with the distribution. |
-// | |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission. |
-// | |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-// | POSSIBILITY OF SUCH DAMAGE. |
-// +----------------------------------------------------------------------+
-// | Author: Paul Cooper <pgc@ucecom.com> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-require_once 'MDB2/Driver/Function/Common.php';
-
-/**
- * MDB2 MySQL driver for the function modules
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Driver_Function_pgsql extends MDB2_Driver_Function_Common
-{
- // {{{ executeStoredProc()
-
- /**
- * Execute a stored procedure and return any results
- *
- * @param string $name string that identifies the function to execute
- * @param mixed $params array that contains the paramaters to pass the stored proc
- * @param mixed $types array that contains the types of the columns in
- * the result set
- * @param mixed $result_class string which specifies which result class to use
- * @param mixed $result_wrap_class string which specifies which class to wrap results in
- * @return mixed a result handle or MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function executeStoredProc($name, $params = null, $types = null, $result_class = true, $result_wrap_class = false)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $query = 'SELECT * FROM '.$name;
- $query .= $params ? '('.implode(', ', $params).')' : '()';
- return $db->query($query, $types, $result_class, $result_wrap_class);
- }
- // }}}
- // {{{ unixtimestamp()
-
- /**
- * return string to call a function to get the unix timestamp from a iso timestamp
- *
- * @param string $expression
- *
- * @return string to call a variable with the timestamp
- * @access public
- */
- function unixtimestamp($expression)
- {
- return 'EXTRACT(EPOCH FROM DATE_TRUNC(\'seconds\', CAST ((' . $expression . ') AS TIMESTAMP)))';
- }
-
- // }}}
- // {{{ substring()
-
- /**
- * return string to call a function to get a substring inside an SQL statement
- *
- * @return string to call a function to get a substring
- * @access public
- */
- function substring($value, $position = 1, $length = null)
- {
- if (null !== $length) {
- return "SUBSTRING(CAST($value AS VARCHAR) FROM $position FOR $length)";
- }
- return "SUBSTRING(CAST($value AS VARCHAR) FROM $position)";
- }
-
- // }}}
- // {{{ random()
-
- /**
- * return string to call a function to get random value inside an SQL statement
- *
- * @return return string to generate float between 0 and 1
- * @access public
- */
- function random()
- {
- return 'RANDOM()';
- }
-
- // }}}
-}
-?> \ No newline at end of file
diff --git a/3rdparty/MDB2/Driver/Function/sqlite.php b/3rdparty/MDB2/Driver/Function/sqlite.php
deleted file mode 100644
index 65ade4fec07..00000000000
--- a/3rdparty/MDB2/Driver/Function/sqlite.php
+++ /dev/null
@@ -1,162 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2008 Manuel Lemos, Tomas V.V.Cox, |
-// | Stig. S. Bakken, Lukas Smith |
-// | All rights reserved. |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
-// | API as well as database abstraction for PHP applications. |
-// | This LICENSE is in the BSD license style. |
-// | |
-// | Redistribution and use in source and binary forms, with or without |
-// | modification, are permitted provided that the following conditions |
-// | are met: |
-// | |
-// | Redistributions of source code must retain the above copyright |
-// | notice, this list of conditions and the following disclaimer. |
-// | |
-// | Redistributions in binary form must reproduce the above copyright |
-// | notice, this list of conditions and the following disclaimer in the |
-// | documentation and/or other materials provided with the distribution. |
-// | |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission. |
-// | |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-// | POSSIBILITY OF SUCH DAMAGE. |
-// +----------------------------------------------------------------------+
-// | Author: Lukas Smith <smith@pooteeweet.org> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-
-require_once 'MDB2/Driver/Function/Common.php';
-
-/**
- * MDB2 SQLite driver for the function modules
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Driver_Function_sqlite extends MDB2_Driver_Function_Common
-{
- // {{{ constructor
-
- /**
- * Constructor
- */
- function __construct($db_index)
- {
- parent::__construct($db_index);
- // create all sorts of UDFs
- }
-
- // {{{ now()
-
- /**
- * Return string to call a variable with the current timestamp inside an SQL statement
- * There are three special variables for current date and time.
- *
- * @return string to call a variable with the current timestamp
- * @access public
- */
- function now($type = 'timestamp')
- {
- switch ($type) {
- case 'time':
- return 'time(\'now\')';
- case 'date':
- return 'date(\'now\')';
- case 'timestamp':
- default:
- return 'datetime(\'now\')';
- }
- }
-
- // }}}
- // {{{ unixtimestamp()
-
- /**
- * return string to call a function to get the unix timestamp from a iso timestamp
- *
- * @param string $expression
- *
- * @return string to call a variable with the timestamp
- * @access public
- */
- function unixtimestamp($expression)
- {
- return 'strftime("%s",'. $expression.', "utc")';
- }
-
- // }}}
- // {{{ substring()
-
- /**
- * return string to call a function to get a substring inside an SQL statement
- *
- * @return string to call a function to get a substring
- * @access public
- */
- function substring($value, $position = 1, $length = null)
- {
- if (null !== $length) {
- return "substr($value, $position, $length)";
- }
- return "substr($value, $position, length($value))";
- }
-
- // }}}
- // {{{ random()
-
- /**
- * return string to call a function to get random value inside an SQL statement
- *
- * @return return string to generate float between 0 and 1
- * @access public
- */
- function random()
- {
- return '((RANDOM()+2147483648)/4294967296)';
- }
-
- // }}}
- // {{{ replace()
-
- /**
- * return string to call a function to get a replacement inside an SQL statement.
- *
- * @return string to call a function to get a replace
- * @access public
- */
- function replace($str, $from_str, $to_str)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $error = $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- return $error;
- }
-
- // }}}
-}
-?>
diff --git a/3rdparty/MDB2/Driver/Manager/Common.php b/3rdparty/MDB2/Driver/Manager/Common.php
deleted file mode 100644
index 2e99c332a23..00000000000
--- a/3rdparty/MDB2/Driver/Manager/Common.php
+++ /dev/null
@@ -1,1038 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2008 Manuel Lemos, Tomas V.V.Cox, |
-// | Stig. S. Bakken, Lukas Smith |
-// | All rights reserved. |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
-// | API as well as database abstraction for PHP applications. |
-// | This LICENSE is in the BSD license style. |
-// | |
-// | Redistribution and use in source and binary forms, with or without |
-// | modification, are permitted provided that the following conditions |
-// | are met: |
-// | |
-// | Redistributions of source code must retain the above copyright |
-// | notice, this list of conditions and the following disclaimer. |
-// | |
-// | Redistributions in binary form must reproduce the above copyright |
-// | notice, this list of conditions and the following disclaimer in the |
-// | documentation and/or other materials provided with the distribution. |
-// | |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission. |
-// | |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-// | POSSIBILITY OF SUCH DAMAGE. |
-// +----------------------------------------------------------------------+
-// | Authors: Lukas Smith <smith@pooteeweet.org> |
-// | Lorenzo Alberton <l.alberton@quipo.it> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-
-/**
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- * @author Lorenzo Alberton <l.alberton@quipo.it>
- */
-
-/**
- * Base class for the management modules that is extended by each MDB2 driver
- *
- * To load this module in the MDB2 object:
- * $mdb->loadModule('Manager');
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Driver_Manager_Common extends MDB2_Module_Common
-{
- // {{{ splitTableSchema()
-
- /**
- * Split the "[owner|schema].table" notation into an array
- *
- * @param string $table [schema and] table name
- *
- * @return array array(schema, table)
- * @access private
- */
- function splitTableSchema($table)
- {
- $ret = array();
- if (strpos($table, '.') !== false) {
- return explode('.', $table);
- }
- return array(null, $table);
- }
-
- // }}}
- // {{{ getFieldDeclarationList()
-
- /**
- * Get declaration of a number of field in bulk
- *
- * @param array $fields a multidimensional associative array.
- * The first dimension determines the field name, while the second
- * dimension is keyed with the name of the properties
- * of the field being declared as array indexes. Currently, the types
- * of supported field properties are as follows:
- *
- * default
- * Boolean value to be used as default for this field.
- *
- * notnull
- * Boolean flag that indicates whether this field is constrained
- * to not be set to null.
- *
- * @return mixed string on success, a MDB2 error on failure
- * @access public
- */
- function getFieldDeclarationList($fields)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- if (!is_array($fields) || empty($fields)) {
- return $db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
- 'missing any fields', __FUNCTION__);
- }
- foreach ($fields as $field_name => $field) {
- $query = $db->getDeclaration($field['type'], $field_name, $field);
- if (PEAR::isError($query)) {
- return $query;
- }
- $query_fields[] = $query;
- }
- return implode(', ', $query_fields);
- }
-
- // }}}
- // {{{ _fixSequenceName()
-
- /**
- * Removes any formatting in an sequence name using the 'seqname_format' option
- *
- * @param string $sqn string that containts name of a potential sequence
- * @param bool $check if only formatted sequences should be returned
- * @return string name of the sequence with possible formatting removed
- * @access protected
- */
- function _fixSequenceName($sqn, $check = false)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $seq_pattern = '/^'.preg_replace('/%s/', '([a-z0-9_]+)', $db->options['seqname_format']).'$/i';
- $seq_name = preg_replace($seq_pattern, '\\1', $sqn);
- if ($seq_name && !strcasecmp($sqn, $db->getSequenceName($seq_name))) {
- return $seq_name;
- }
- if ($check) {
- return false;
- }
- return $sqn;
- }
-
- // }}}
- // {{{ _fixIndexName()
-
- /**
- * Removes any formatting in an index name using the 'idxname_format' option
- *
- * @param string $idx string that containts name of anl index
- * @return string name of the index with eventual formatting removed
- * @access protected
- */
- function _fixIndexName($idx)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $idx_pattern = '/^'.preg_replace('/%s/', '([a-z0-9_]+)', $db->options['idxname_format']).'$/i';
- $idx_name = preg_replace($idx_pattern, '\\1', $idx);
- if ($idx_name && !strcasecmp($idx, $db->getIndexName($idx_name))) {
- return $idx_name;
- }
- return $idx;
- }
-
- // }}}
- // {{{ createDatabase()
-
- /**
- * create a new database
- *
- * @param string $name name of the database that should be created
- * @param array $options array with charset, collation info
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function createDatabase($database, $options = array())
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- }
-
- // }}}
- // {{{ alterDatabase()
-
- /**
- * alter an existing database
- *
- * @param string $name name of the database that should be created
- * @param array $options array with charset, collation info
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function alterDatabase($database, $options = array())
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- }
-
- // }}}
- // {{{ dropDatabase()
-
- /**
- * drop an existing database
- *
- * @param string $name name of the database that should be dropped
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function dropDatabase($database)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- }
-
- // }}}
- // {{{ _getCreateTableQuery()
-
- /**
- * Create a basic SQL query for a new table creation
- *
- * @param string $name Name of the database that should be created
- * @param array $fields Associative array that contains the definition of each field of the new table
- * @param array $options An associative array of table options
- *
- * @return mixed string (the SQL query) on success, a MDB2 error on failure
- * @see createTable()
- */
- function _getCreateTableQuery($name, $fields, $options = array())
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- if (!$name) {
- return $db->raiseError(MDB2_ERROR_CANNOT_CREATE, null, null,
- 'no valid table name specified', __FUNCTION__);
- }
- if (empty($fields)) {
- return $db->raiseError(MDB2_ERROR_CANNOT_CREATE, null, null,
- 'no fields specified for table "'.$name.'"', __FUNCTION__);
- }
- $query_fields = $this->getFieldDeclarationList($fields);
- if (PEAR::isError($query_fields)) {
- return $query_fields;
- }
- if (!empty($options['primary'])) {
- $query_fields.= ', PRIMARY KEY ('.implode(', ', array_keys($options['primary'])).')';
- }
-
- $name = $db->quoteIdentifier($name, true);
- $result = 'CREATE ';
- if (!empty($options['temporary'])) {
- $result .= $this->_getTemporaryTableQuery();
- }
- $result .= " TABLE $name ($query_fields)";
- return $result;
- }
-
- // }}}
- // {{{ _getTemporaryTableQuery()
-
- /**
- * A method to return the required SQL string that fits between CREATE ... TABLE
- * to create the table as a temporary table.
- *
- * Should be overridden in driver classes to return the correct string for the
- * specific database type.
- *
- * The default is to return the string "TEMPORARY" - this will result in a
- * SQL error for any database that does not support temporary tables, or that
- * requires a different SQL command from "CREATE TEMPORARY TABLE".
- *
- * @return string The string required to be placed between "CREATE" and "TABLE"
- * to generate a temporary table, if possible.
- */
- function _getTemporaryTableQuery()
- {
- return 'TEMPORARY';
- }
-
- // }}}
- // {{{ createTable()
-
- /**
- * create a new table
- *
- * @param string $name Name of the database that should be created
- * @param array $fields Associative array that contains the definition of each field of the new table
- * The indexes of the array entries are the names of the fields of the table an
- * the array entry values are associative arrays like those that are meant to be
- * passed with the field definitions to get[Type]Declaration() functions.
- * array(
- * 'id' => array(
- * 'type' => 'integer',
- * 'unsigned' => 1
- * 'notnull' => 1
- * 'default' => 0
- * ),
- * 'name' => array(
- * 'type' => 'text',
- * 'length' => 12
- * ),
- * 'password' => array(
- * 'type' => 'text',
- * 'length' => 12
- * )
- * );
- * @param array $options An associative array of table options:
- * array(
- * 'comment' => 'Foo',
- * 'temporary' => true|false,
- * );
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function createTable($name, $fields, $options = array())
- {
- $query = $this->_getCreateTableQuery($name, $fields, $options);
- if (PEAR::isError($query)) {
- return $query;
- }
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
- $result = $db->exec($query);
- if (PEAR::isError($result)) {
- return $result;
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ dropTable()
-
- /**
- * drop an existing table
- *
- * @param string $name name of the table that should be dropped
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function dropTable($name)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $name = $db->quoteIdentifier($name, true);
- $result = $db->exec("DROP TABLE $name");
- if (MDB2::isError($result)) {
- return $result;
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ truncateTable()
-
- /**
- * Truncate an existing table (if the TRUNCATE TABLE syntax is not supported,
- * it falls back to a DELETE FROM TABLE query)
- *
- * @param string $name name of the table that should be truncated
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function truncateTable($name)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $name = $db->quoteIdentifier($name, true);
- $result = $db->exec("DELETE FROM $name");
- if (MDB2::isError($result)) {
- return $result;
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ vacuum()
-
- /**
- * Optimize (vacuum) all the tables in the db (or only the specified table)
- * and optionally run ANALYZE.
- *
- * @param string $table table name (all the tables if empty)
- * @param array $options an array with driver-specific options:
- * - timeout [int] (in seconds) [mssql-only]
- * - analyze [boolean] [pgsql and mysql]
- * - full [boolean] [pgsql-only]
- * - freeze [boolean] [pgsql-only]
- *
- * @return mixed MDB2_OK success, a MDB2 error on failure
- * @access public
- */
- function vacuum($table = null, $options = array())
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- }
-
- // }}}
- // {{{ alterTable()
-
- /**
- * alter an existing table
- *
- * @param string $name name of the table that is intended to be changed.
- * @param array $changes associative array that contains the details of each type
- * of change that is intended to be performed. The types of
- * changes that are currently supported are defined as follows:
- *
- * name
- *
- * New name for the table.
- *
- * add
- *
- * Associative array with the names of fields to be added as
- * indexes of the array. The value of each entry of the array
- * should be set to another associative array with the properties
- * of the fields to be added. The properties of the fields should
- * be the same as defined by the MDB2 parser.
- *
- *
- * remove
- *
- * Associative array with the names of fields to be removed as indexes
- * of the array. Currently the values assigned to each entry are ignored.
- * An empty array should be used for future compatibility.
- *
- * rename
- *
- * Associative array with the names of fields to be renamed as indexes
- * of the array. The value of each entry of the array should be set to
- * another associative array with the entry named name with the new
- * field name and the entry named Declaration that is expected to contain
- * the portion of the field declaration already in DBMS specific SQL code
- * as it is used in the CREATE TABLE statement.
- *
- * change
- *
- * Associative array with the names of the fields to be changed as indexes
- * of the array. Keep in mind that if it is intended to change either the
- * name of a field and any other properties, the change array entries
- * should have the new names of the fields as array indexes.
- *
- * The value of each entry of the array should be set to another associative
- * array with the properties of the fields to that are meant to be changed as
- * array entries. These entries should be assigned to the new values of the
- * respective properties. The properties of the fields should be the same
- * as defined by the MDB2 parser.
- *
- * Example
- * array(
- * 'name' => 'userlist',
- * 'add' => array(
- * 'quota' => array(
- * 'type' => 'integer',
- * 'unsigned' => 1
- * )
- * ),
- * 'remove' => array(
- * 'file_limit' => array(),
- * 'time_limit' => array()
- * ),
- * 'change' => array(
- * 'name' => array(
- * 'length' => '20',
- * 'definition' => array(
- * 'type' => 'text',
- * 'length' => 20,
- * ),
- * )
- * ),
- * 'rename' => array(
- * 'sex' => array(
- * 'name' => 'gender',
- * 'definition' => array(
- * 'type' => 'text',
- * 'length' => 1,
- * 'default' => 'M',
- * ),
- * )
- * )
- * )
- *
- * @param boolean $check indicates whether the function should just check if the DBMS driver
- * can perform the requested table alterations if the value is true or
- * actually perform them otherwise.
- * @access public
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- */
- function alterTable($name, $changes, $check)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- }
-
- // }}}
- // {{{ listDatabases()
-
- /**
- * list all databases
- *
- * @return mixed array of database names on success, a MDB2 error on failure
- * @access public
- */
- function listDatabases()
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implementedd', __FUNCTION__);
- }
-
- // }}}
- // {{{ listUsers()
-
- /**
- * list all users
- *
- * @return mixed array of user names on success, a MDB2 error on failure
- * @access public
- */
- function listUsers()
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- }
-
- // }}}
- // {{{ listViews()
-
- /**
- * list all views in the current database
- *
- * @param string database, the current is default
- * NB: not all the drivers can get the view names from
- * a database other than the current one
- * @return mixed array of view names on success, a MDB2 error on failure
- * @access public
- */
- function listViews($database = null)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- }
-
- // }}}
- // {{{ listTableViews()
-
- /**
- * list the views in the database that reference a given table
- *
- * @param string table for which all referenced views should be found
- * @return mixed array of view names on success, a MDB2 error on failure
- * @access public
- */
- function listTableViews($table)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- }
-
- // }}}
- // {{{ listTableTriggers()
-
- /**
- * list all triggers in the database that reference a given table
- *
- * @param string table for which all referenced triggers should be found
- * @return mixed array of trigger names on success, a MDB2 error on failure
- * @access public
- */
- function listTableTriggers($table = null)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- }
-
- // }}}
- // {{{ listFunctions()
-
- /**
- * list all functions in the current database
- *
- * @return mixed array of function names on success, a MDB2 error on failure
- * @access public
- */
- function listFunctions()
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- }
-
- // }}}
- // {{{ listTables()
-
- /**
- * list all tables in the current database
- *
- * @param string database, the current is default.
- * NB: not all the drivers can get the table names from
- * a database other than the current one
- * @return mixed array of table names on success, a MDB2 error on failure
- * @access public
- */
- function listTables($database = null)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- }
-
- // }}}
- // {{{ listTableFields()
-
- /**
- * list all fields in a table in the current database
- *
- * @param string $table name of table that should be used in method
- * @return mixed array of field names on success, a MDB2 error on failure
- * @access public
- */
- function listTableFields($table)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- }
-
- // }}}
- // {{{ createIndex()
-
- /**
- * Get the stucture of a field into an array
- *
- * @param string $table name of the table on which the index is to be created
- * @param string $name name of the index to be created
- * @param array $definition associative array that defines properties of the index to be created.
- * Currently, only one property named FIELDS is supported. This property
- * is also an associative with the names of the index fields as array
- * indexes. Each entry of this array is set to another type of associative
- * array that specifies properties of the index that are specific to
- * each field.
- *
- * Currently, only the sorting property is supported. It should be used
- * to define the sorting direction of the index. It may be set to either
- * ascending or descending.
- *
- * Not all DBMS support index sorting direction configuration. The DBMS
- * drivers of those that do not support it ignore this property. Use the
- * function supports() to determine whether the DBMS driver can manage indexes.
- *
- * Example
- * array(
- * 'fields' => array(
- * 'user_name' => array(
- * 'sorting' => 'ascending'
- * ),
- * 'last_login' => array()
- * )
- * )
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function createIndex($table, $name, $definition)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $table = $db->quoteIdentifier($table, true);
- $name = $db->quoteIdentifier($db->getIndexName($name), true);
- $query = "CREATE INDEX $name ON $table";
- $fields = array();
- foreach (array_keys($definition['fields']) as $field) {
- $fields[] = $db->quoteIdentifier($field, true);
- }
- $query .= ' ('. implode(', ', $fields) . ')';
- $result = $db->exec($query);
- if (MDB2::isError($result)) {
- return $result;
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ dropIndex()
-
- /**
- * drop existing index
- *
- * @param string $table name of table that should be used in method
- * @param string $name name of the index to be dropped
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function dropIndex($table, $name)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $name = $db->quoteIdentifier($db->getIndexName($name), true);
- $result = $db->exec("DROP INDEX $name");
- if (MDB2::isError($result)) {
- return $result;
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ listTableIndexes()
-
- /**
- * list all indexes in a table
- *
- * @param string $table name of table that should be used in method
- * @return mixed array of index names on success, a MDB2 error on failure
- * @access public
- */
- function listTableIndexes($table)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- }
-
- // }}}
- // {{{ _getAdvancedFKOptions()
-
- /**
- * Return the FOREIGN KEY query section dealing with non-standard options
- * as MATCH, INITIALLY DEFERRED, ON UPDATE, ...
- *
- * @param array $definition
- * @return string
- * @access protected
- */
- function _getAdvancedFKOptions($definition)
- {
- return '';
- }
-
- // }}}
- // {{{ createConstraint()
-
- /**
- * create a constraint on a table
- *
- * @param string $table name of the table on which the constraint is to be created
- * @param string $name name of the constraint to be created
- * @param array $definition associative array that defines properties of the constraint to be created.
- * The full structure of the array looks like this:
- * <pre>
- * array (
- * [primary] => 0
- * [unique] => 0
- * [foreign] => 1
- * [check] => 0
- * [fields] => array (
- * [field1name] => array() // one entry per each field covered
- * [field2name] => array() // by the index
- * [field3name] => array(
- * [sorting] => ascending
- * [position] => 3
- * )
- * )
- * [references] => array(
- * [table] => name
- * [fields] => array(
- * [field1name] => array( //one entry per each referenced field
- * [position] => 1
- * )
- * )
- * )
- * [deferrable] => 0
- * [initiallydeferred] => 0
- * [onupdate] => CASCADE|RESTRICT|SET NULL|SET DEFAULT|NO ACTION
- * [ondelete] => CASCADE|RESTRICT|SET NULL|SET DEFAULT|NO ACTION
- * [match] => SIMPLE|PARTIAL|FULL
- * );
- * </pre>
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function createConstraint($table, $name, $definition)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
- $table = $db->quoteIdentifier($table, true);
- $name = $db->quoteIdentifier($db->getIndexName($name), true);
- $query = "ALTER TABLE $table ADD CONSTRAINT $name";
- if (!empty($definition['primary'])) {
- $query.= ' PRIMARY KEY';
- } elseif (!empty($definition['unique'])) {
- $query.= ' UNIQUE';
- } elseif (!empty($definition['foreign'])) {
- $query.= ' FOREIGN KEY';
- }
- $fields = array();
- foreach (array_keys($definition['fields']) as $field) {
- $fields[] = $db->quoteIdentifier($field, true);
- }
- $query .= ' ('. implode(', ', $fields) . ')';
- if (!empty($definition['foreign'])) {
- $query.= ' REFERENCES ' . $db->quoteIdentifier($definition['references']['table'], true);
- $referenced_fields = array();
- foreach (array_keys($definition['references']['fields']) as $field) {
- $referenced_fields[] = $db->quoteIdentifier($field, true);
- }
- $query .= ' ('. implode(', ', $referenced_fields) . ')';
- $query .= $this->_getAdvancedFKOptions($definition);
- }
- $result = $db->exec($query);
- if (MDB2::isError($result)) {
- return $result;
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ dropConstraint()
-
- /**
- * drop existing constraint
- *
- * @param string $table name of table that should be used in method
- * @param string $name name of the constraint to be dropped
- * @param string $primary hint if the constraint is primary
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function dropConstraint($table, $name, $primary = false)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $table = $db->quoteIdentifier($table, true);
- $name = $db->quoteIdentifier($db->getIndexName($name), true);
- $result = $db->exec("ALTER TABLE $table DROP CONSTRAINT $name");
- if (MDB2::isError($result)) {
- return $result;
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ listTableConstraints()
-
- /**
- * list all constraints in a table
- *
- * @param string $table name of table that should be used in method
- * @return mixed array of constraint names on success, a MDB2 error on failure
- * @access public
- */
- function listTableConstraints($table)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- }
-
- // }}}
- // {{{ createSequence()
-
- /**
- * create sequence
- *
- * @param string $seq_name name of the sequence to be created
- * @param string $start start value of the sequence; default is 1
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function createSequence($seq_name, $start = 1)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- }
-
- // }}}
- // {{{ dropSequence()
-
- /**
- * drop existing sequence
- *
- * @param string $seq_name name of the sequence to be dropped
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function dropSequence($name)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- }
-
- // }}}
- // {{{ listSequences()
-
- /**
- * list all sequences in the current database
- *
- * @param string database, the current is default
- * NB: not all the drivers can get the sequence names from
- * a database other than the current one
- * @return mixed array of sequence names on success, a MDB2 error on failure
- * @access public
- */
- function listSequences($database = null)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- }
-
- // }}}
-}
-?>
diff --git a/3rdparty/MDB2/Driver/Manager/mysql.php b/3rdparty/MDB2/Driver/Manager/mysql.php
deleted file mode 100644
index c663c0c5d2b..00000000000
--- a/3rdparty/MDB2/Driver/Manager/mysql.php
+++ /dev/null
@@ -1,1471 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2008 Manuel Lemos, Tomas V.V.Cox, |
-// | Stig. S. Bakken, Lukas Smith |
-// | All rights reserved. |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
-// | API as well as database abstraction for PHP applications. |
-// | This LICENSE is in the BSD license style. |
-// | |
-// | Redistribution and use in source and binary forms, with or without |
-// | modification, are permitted provided that the following conditions |
-// | are met: |
-// | |
-// | Redistributions of source code must retain the above copyright |
-// | notice, this list of conditions and the following disclaimer. |
-// | |
-// | Redistributions in binary form must reproduce the above copyright |
-// | notice, this list of conditions and the following disclaimer in the |
-// | documentation and/or other materials provided with the distribution. |
-// | |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission. |
-// | |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-// | POSSIBILITY OF SUCH DAMAGE. |
-// +----------------------------------------------------------------------+
-// | Author: Lukas Smith <smith@pooteeweet.org> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-
-require_once 'MDB2/Driver/Manager/Common.php';
-
-/**
- * MDB2 MySQL driver for the management modules
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
-{
-
- // }}}
- // {{{ createDatabase()
-
- /**
- * create a new database
- *
- * @param string $name name of the database that should be created
- * @param array $options array with charset, collation info
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function createDatabase($name, $options = array())
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $name = $db->quoteIdentifier($name, true);
- $query = 'CREATE DATABASE ' . $name;
- if (!empty($options['charset'])) {
- $query .= ' DEFAULT CHARACTER SET ' . $db->quote($options['charset'], 'text');
- }
- if (!empty($options['collation'])) {
- $query .= ' COLLATE ' . $db->quote($options['collation'], 'text');
- }
- return $db->standaloneQuery($query, null, true);
- }
-
- // }}}
- // {{{ alterDatabase()
-
- /**
- * alter an existing database
- *
- * @param string $name name of the database that is intended to be changed
- * @param array $options array with charset, collation info
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function alterDatabase($name, $options = array())
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $query = 'ALTER DATABASE '. $db->quoteIdentifier($name, true);
- if (!empty($options['charset'])) {
- $query .= ' DEFAULT CHARACTER SET ' . $db->quote($options['charset'], 'text');
- }
- if (!empty($options['collation'])) {
- $query .= ' COLLATE ' . $db->quote($options['collation'], 'text');
- }
- return $db->standaloneQuery($query, null, true);
- }
-
- // }}}
- // {{{ dropDatabase()
-
- /**
- * drop an existing database
- *
- * @param string $name name of the database that should be dropped
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function dropDatabase($name)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $name = $db->quoteIdentifier($name, true);
- $query = "DROP DATABASE $name";
- return $db->standaloneQuery($query, null, true);
- }
-
- // }}}
- // {{{ _getAdvancedFKOptions()
-
- /**
- * Return the FOREIGN KEY query section dealing with non-standard options
- * as MATCH, INITIALLY DEFERRED, ON UPDATE, ...
- *
- * @param array $definition
- * @return string
- * @access protected
- */
- function _getAdvancedFKOptions($definition)
- {
- $query = '';
- if (!empty($definition['match'])) {
- $query .= ' MATCH '.$definition['match'];
- }
- if (!empty($definition['onupdate'])) {
- $query .= ' ON UPDATE '.$definition['onupdate'];
- }
- if (!empty($definition['ondelete'])) {
- $query .= ' ON DELETE '.$definition['ondelete'];
- }
- return $query;
- }
-
- // }}}
- // {{{ createTable()
-
- /**
- * create a new table
- *
- * @param string $name Name of the database that should be created
- * @param array $fields Associative array that contains the definition of each field of the new table
- * The indexes of the array entries are the names of the fields of the table an
- * the array entry values are associative arrays like those that are meant to be
- * passed with the field definitions to get[Type]Declaration() functions.
- * array(
- * 'id' => array(
- * 'type' => 'integer',
- * 'unsigned' => 1
- * 'notnull' => 1
- * 'default' => 0
- * ),
- * 'name' => array(
- * 'type' => 'text',
- * 'length' => 12
- * ),
- * 'password' => array(
- * 'type' => 'text',
- * 'length' => 12
- * )
- * );
- * @param array $options An associative array of table options:
- * array(
- * 'comment' => 'Foo',
- * 'charset' => 'utf8',
- * 'collate' => 'utf8_unicode_ci',
- * 'type' => 'innodb',
- * );
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function createTable($name, $fields, $options = array())
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- // if we have an AUTO_INCREMENT column and a PK on more than one field,
- // we have to handle it differently...
- $autoincrement = null;
- if (empty($options['primary'])) {
- $pk_fields = array();
- foreach ($fields as $fieldname => $def) {
- if (!empty($def['primary'])) {
- $pk_fields[$fieldname] = true;
- }
- if (!empty($def['autoincrement'])) {
- $autoincrement = $fieldname;
- }
- }
- if ((null !== $autoincrement) && count($pk_fields) > 1) {
- $options['primary'] = $pk_fields;
- } else {
- // the PK constraint is on max one field => OK
- $autoincrement = null;
- }
- }
-
- $query = $this->_getCreateTableQuery($name, $fields, $options);
- if (PEAR::isError($query)) {
- return $query;
- }
-
- if (null !== $autoincrement) {
- // we have to remove the PK clause added by _getIntegerDeclaration()
- $query = str_replace('AUTO_INCREMENT PRIMARY KEY', 'AUTO_INCREMENT', $query);
- }
-
- $options_strings = array();
-
- if (!empty($options['comment'])) {
- $options_strings['comment'] = 'COMMENT = '.$db->quote($options['comment'], 'text');
- }
-
- if (!empty($options['charset'])) {
- $options_strings['charset'] = 'DEFAULT CHARACTER SET '.$options['charset'];
- if (!empty($options['collate'])) {
- $options_strings['charset'].= ' COLLATE '.$options['collate'];
- }
- }
-
- $type = false;
- if (!empty($options['type'])) {
- $type = $options['type'];
- } elseif ($db->options['default_table_type']) {
- $type = $db->options['default_table_type'];
- }
- if ($type) {
- $options_strings[] = "ENGINE = $type";
- }
-
- if (!empty($options_strings)) {
- $query .= ' '.implode(' ', $options_strings);
- }
- $result = $db->exec($query);
- if (PEAR::isError($result)) {
- return $result;
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ dropTable()
-
- /**
- * drop an existing table
- *
- * @param string $name name of the table that should be dropped
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function dropTable($name)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- //delete the triggers associated to existing FK constraints
- $constraints = $this->listTableConstraints($name);
- if (!PEAR::isError($constraints) && !empty($constraints)) {
- $db->loadModule('Reverse', null, true);
- foreach ($constraints as $constraint) {
- $definition = $db->reverse->getTableConstraintDefinition($name, $constraint);
- if (!PEAR::isError($definition) && !empty($definition['foreign'])) {
- $result = $this->_dropFKTriggers($name, $constraint, $definition['references']['table']);
- if (PEAR::isError($result)) {
- return $result;
- }
- }
- }
- }
-
- return parent::dropTable($name);
- }
-
- // }}}
- // {{{ truncateTable()
-
- /**
- * Truncate an existing table (if the TRUNCATE TABLE syntax is not supported,
- * it falls back to a DELETE FROM TABLE query)
- *
- * @param string $name name of the table that should be truncated
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function truncateTable($name)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $name = $db->quoteIdentifier($name, true);
- $result = $db->exec("TRUNCATE TABLE $name");
- if (MDB2::isError($result)) {
- return $result;
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ vacuum()
-
- /**
- * Optimize (vacuum) all the tables in the db (or only the specified table)
- * and optionally run ANALYZE.
- *
- * @param string $table table name (all the tables if empty)
- * @param array $options an array with driver-specific options:
- * - timeout [int] (in seconds) [mssql-only]
- * - analyze [boolean] [pgsql and mysql]
- * - full [boolean] [pgsql-only]
- * - freeze [boolean] [pgsql-only]
- *
- * @return mixed MDB2_OK success, a MDB2 error on failure
- * @access public
- */
- function vacuum($table = null, $options = array())
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- if (empty($table)) {
- $table = $this->listTables();
- if (PEAR::isError($table)) {
- return $table;
- }
- }
- if (is_array($table)) {
- foreach (array_keys($table) as $k) {
- $table[$k] = $db->quoteIdentifier($table[$k], true);
- }
- $table = implode(', ', $table);
- } else {
- $table = $db->quoteIdentifier($table, true);
- }
-
- $result = $db->exec('OPTIMIZE TABLE '.$table);
- if (PEAR::isError($result)) {
- return $result;
- }
- if (!empty($options['analyze'])) {
- $result = $db->exec('ANALYZE TABLE '.$table);
- if (MDB2::isError($result)) {
- return $result;
- }
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ alterTable()
-
- /**
- * alter an existing table
- *
- * @param string $name name of the table that is intended to be changed.
- * @param array $changes associative array that contains the details of each type
- * of change that is intended to be performed. The types of
- * changes that are currently supported are defined as follows:
- *
- * name
- *
- * New name for the table.
- *
- * add
- *
- * Associative array with the names of fields to be added as
- * indexes of the array. The value of each entry of the array
- * should be set to another associative array with the properties
- * of the fields to be added. The properties of the fields should
- * be the same as defined by the MDB2 parser.
- *
- *
- * remove
- *
- * Associative array with the names of fields to be removed as indexes
- * of the array. Currently the values assigned to each entry are ignored.
- * An empty array should be used for future compatibility.
- *
- * rename
- *
- * Associative array with the names of fields to be renamed as indexes
- * of the array. The value of each entry of the array should be set to
- * another associative array with the entry named name with the new
- * field name and the entry named Declaration that is expected to contain
- * the portion of the field declaration already in DBMS specific SQL code
- * as it is used in the CREATE TABLE statement.
- *
- * change
- *
- * Associative array with the names of the fields to be changed as indexes
- * of the array. Keep in mind that if it is intended to change either the
- * name of a field and any other properties, the change array entries
- * should have the new names of the fields as array indexes.
- *
- * The value of each entry of the array should be set to another associative
- * array with the properties of the fields to that are meant to be changed as
- * array entries. These entries should be assigned to the new values of the
- * respective properties. The properties of the fields should be the same
- * as defined by the MDB2 parser.
- *
- * Example
- * array(
- * 'name' => 'userlist',
- * 'add' => array(
- * 'quota' => array(
- * 'type' => 'integer',
- * 'unsigned' => 1
- * )
- * ),
- * 'remove' => array(
- * 'file_limit' => array(),
- * 'time_limit' => array()
- * ),
- * 'change' => array(
- * 'name' => array(
- * 'length' => '20',
- * 'definition' => array(
- * 'type' => 'text',
- * 'length' => 20,
- * ),
- * )
- * ),
- * 'rename' => array(
- * 'sex' => array(
- * 'name' => 'gender',
- * 'definition' => array(
- * 'type' => 'text',
- * 'length' => 1,
- * 'default' => 'M',
- * ),
- * )
- * )
- * )
- *
- * @param boolean $check indicates whether the function should just check if the DBMS driver
- * can perform the requested table alterations if the value is true or
- * actually perform them otherwise.
- * @access public
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- */
- function alterTable($name, $changes, $check)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- foreach ($changes as $change_name => $change) {
- switch ($change_name) {
- case 'add':
- case 'remove':
- case 'change':
- case 'rename':
- case 'name':
- break;
- default:
- return $db->raiseError(MDB2_ERROR_CANNOT_ALTER, null, null,
- 'change type "'.$change_name.'" not yet supported', __FUNCTION__);
- }
- }
-
- if ($check) {
- return MDB2_OK;
- }
-
- $query = '';
- if (!empty($changes['name'])) {
- $change_name = $db->quoteIdentifier($changes['name'], true);
- $query .= 'RENAME TO ' . $change_name;
- }
-
- if (!empty($changes['add']) && is_array($changes['add'])) {
- foreach ($changes['add'] as $field_name => $field) {
- if ($query) {
- $query.= ', ';
- }
- $query.= 'ADD ' . $db->getDeclaration($field['type'], $field_name, $field);
- }
- }
-
- if (!empty($changes['remove']) && is_array($changes['remove'])) {
- foreach ($changes['remove'] as $field_name => $field) {
- if ($query) {
- $query.= ', ';
- }
- $field_name = $db->quoteIdentifier($field_name, true);
- $query.= 'DROP ' . $field_name;
- }
- }
-
- $rename = array();
- if (!empty($changes['rename']) && is_array($changes['rename'])) {
- foreach ($changes['rename'] as $field_name => $field) {
- $rename[$field['name']] = $field_name;
- }
- }
-
- if (!empty($changes['change']) && is_array($changes['change'])) {
- foreach ($changes['change'] as $field_name => $field) {
- if ($query) {
- $query.= ', ';
- }
- if (isset($rename[$field_name])) {
- $old_field_name = $rename[$field_name];
- unset($rename[$field_name]);
- } else {
- $old_field_name = $field_name;
- }
- $old_field_name = $db->quoteIdentifier($old_field_name, true);
- $query.= "CHANGE $old_field_name " . $db->getDeclaration($field['definition']['type'], $field_name, $field['definition']);
- }
- }
-
- if (!empty($rename) && is_array($rename)) {
- foreach ($rename as $rename_name => $renamed_field) {
- if ($query) {
- $query.= ', ';
- }
- $field = $changes['rename'][$renamed_field];
- $renamed_field = $db->quoteIdentifier($renamed_field, true);
- $query.= 'CHANGE ' . $renamed_field . ' ' . $db->getDeclaration($field['definition']['type'], $field['name'], $field['definition']);
- }
- }
-
- if (!$query) {
- return MDB2_OK;
- }
-
- $name = $db->quoteIdentifier($name, true);
- $result = $db->exec("ALTER TABLE $name $query");
- if (MDB2::isError($result)) {
- return $result;
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ listDatabases()
-
- /**
- * list all databases
- *
- * @return mixed array of database names on success, a MDB2 error on failure
- * @access public
- */
- function listDatabases()
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $result = $db->queryCol('SHOW DATABASES');
- if (PEAR::isError($result)) {
- return $result;
- }
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $result = array_map(($db->options['field_case'] == CASE_LOWER ? 'strtolower' : 'strtoupper'), $result);
- }
- return $result;
- }
-
- // }}}
- // {{{ listUsers()
-
- /**
- * list all users
- *
- * @return mixed array of user names on success, a MDB2 error on failure
- * @access public
- */
- function listUsers()
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- return $db->queryCol('SELECT DISTINCT USER FROM mysql.USER');
- }
-
- // }}}
- // {{{ listFunctions()
-
- /**
- * list all functions in the current database
- *
- * @return mixed array of function names on success, a MDB2 error on failure
- * @access public
- */
- function listFunctions()
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $query = "SELECT name FROM mysql.proc";
- /*
- SELECT ROUTINE_NAME
- FROM INFORMATION_SCHEMA.ROUTINES
- WHERE ROUTINE_TYPE = 'FUNCTION'
- */
- $result = $db->queryCol($query);
- if (PEAR::isError($result)) {
- return $result;
- }
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $result = array_map(($db->options['field_case'] == CASE_LOWER ? 'strtolower' : 'strtoupper'), $result);
- }
- return $result;
- }
-
- // }}}
- // {{{ listTableTriggers()
-
- /**
- * list all triggers in the database that reference a given table
- *
- * @param string table for which all referenced triggers should be found
- * @return mixed array of trigger names on success, a MDB2 error on failure
- * @access public
- */
- function listTableTriggers($table = null)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $query = 'SHOW TRIGGERS';
- if (null !== $table) {
- $table = $db->quote($table, 'text');
- $query .= " LIKE $table";
- }
- $result = $db->queryCol($query);
- if (PEAR::isError($result)) {
- return $result;
- }
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $result = array_map(($db->options['field_case'] == CASE_LOWER ? 'strtolower' : 'strtoupper'), $result);
- }
- return $result;
- }
-
- // }}}
- // {{{ listTables()
-
- /**
- * list all tables in the current database
- *
- * @param string database, the current is default
- * @return mixed array of table names on success, a MDB2 error on failure
- * @access public
- */
- function listTables($database = null)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $query = "SHOW /*!50002 FULL*/ TABLES";
- if (null !== $database) {
- $query .= " FROM $database";
- }
- $query.= "/*!50002 WHERE Table_type = 'BASE TABLE'*/";
-
- $table_names = $db->queryAll($query, null, MDB2_FETCHMODE_ORDERED);
- if (PEAR::isError($table_names)) {
- return $table_names;
- }
-
- $result = array();
- foreach ($table_names as $table) {
- if (!$this->_fixSequenceName($table[0], true)) {
- $result[] = $table[0];
- }
- }
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $result = array_map(($db->options['field_case'] == CASE_LOWER ? 'strtolower' : 'strtoupper'), $result);
- }
- return $result;
- }
-
- // }}}
- // {{{ listViews()
-
- /**
- * list all views in the current database
- *
- * @param string database, the current is default
- * @return mixed array of view names on success, a MDB2 error on failure
- * @access public
- */
- function listViews($database = null)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $query = 'SHOW FULL TABLES';
- if (null !== $database) {
- $query.= " FROM $database";
- }
- $query.= " WHERE Table_type = 'VIEW'";
-
- $result = $db->queryCol($query);
- if (PEAR::isError($result)) {
- return $result;
- }
-
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $result = array_map(($db->options['field_case'] == CASE_LOWER ? 'strtolower' : 'strtoupper'), $result);
- }
- return $result;
- }
-
- // }}}
- // {{{ listTableFields()
-
- /**
- * list all fields in a table in the current database
- *
- * @param string $table name of table that should be used in method
- * @return mixed array of field names on success, a MDB2 error on failure
- * @access public
- */
- function listTableFields($table)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $table = $db->quoteIdentifier($table, true);
- $result = $db->queryCol("SHOW COLUMNS FROM $table");
- if (PEAR::isError($result)) {
- return $result;
- }
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $result = array_map(($db->options['field_case'] == CASE_LOWER ? 'strtolower' : 'strtoupper'), $result);
- }
- return $result;
- }
-
- // }}}
- // {{{ createIndex()
-
- /**
- * Get the stucture of a field into an array
- *
- * @author Leoncx
- * @param string $table name of the table on which the index is to be created
- * @param string $name name of the index to be created
- * @param array $definition associative array that defines properties of the index to be created.
- * Currently, only one property named FIELDS is supported. This property
- * is also an associative with the names of the index fields as array
- * indexes. Each entry of this array is set to another type of associative
- * array that specifies properties of the index that are specific to
- * each field.
- *
- * Currently, only the sorting property is supported. It should be used
- * to define the sorting direction of the index. It may be set to either
- * ascending or descending.
- *
- * Not all DBMS support index sorting direction configuration. The DBMS
- * drivers of those that do not support it ignore this property. Use the
- * function supports() to determine whether the DBMS driver can manage indexes.
- *
- * Example
- * array(
- * 'fields' => array(
- * 'user_name' => array(
- * 'sorting' => 'ascending'
- * 'length' => 10
- * ),
- * 'last_login' => array()
- * )
- * )
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function createIndex($table, $name, $definition)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $table = $db->quoteIdentifier($table, true);
- $name = $db->quoteIdentifier($db->getIndexName($name), true);
- $query = "CREATE INDEX $name ON $table";
- $fields = array();
- foreach ($definition['fields'] as $field => $fieldinfo) {
- if (!empty($fieldinfo['length'])) {
- $fields[] = $db->quoteIdentifier($field, true) . '(' . $fieldinfo['length'] . ')';
- } else {
- $fields[] = $db->quoteIdentifier($field, true);
- }
- }
- $query .= ' ('. implode(', ', $fields) . ')';
- $result = $db->exec($query);
- if (MDB2::isError($result)) {
- return $result;
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ dropIndex()
-
- /**
- * drop existing index
- *
- * @param string $table name of table that should be used in method
- * @param string $name name of the index to be dropped
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function dropIndex($table, $name)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $table = $db->quoteIdentifier($table, true);
- $name = $db->quoteIdentifier($db->getIndexName($name), true);
- $result = $db->exec("DROP INDEX $name ON $table");
- if (MDB2::isError($result)) {
- return $result;
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ listTableIndexes()
-
- /**
- * list all indexes in a table
- *
- * @param string $table name of table that should be used in method
- * @return mixed array of index names on success, a MDB2 error on failure
- * @access public
- */
- function listTableIndexes($table)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $key_name = 'Key_name';
- $non_unique = 'Non_unique';
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- if ($db->options['field_case'] == CASE_LOWER) {
- $key_name = strtolower($key_name);
- $non_unique = strtolower($non_unique);
- } else {
- $key_name = strtoupper($key_name);
- $non_unique = strtoupper($non_unique);
- }
- }
-
- $table = $db->quoteIdentifier($table, true);
- $query = "SHOW INDEX FROM $table";
- $indexes = $db->queryAll($query, null, MDB2_FETCHMODE_ASSOC);
- if (PEAR::isError($indexes)) {
- return $indexes;
- }
-
- $result = array();
- foreach ($indexes as $index_data) {
- if ($index_data[$non_unique] && ($index = $this->_fixIndexName($index_data[$key_name]))) {
- $result[$index] = true;
- }
- }
-
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $result = array_change_key_case($result, $db->options['field_case']);
- }
- return array_keys($result);
- }
-
- // }}}
- // {{{ createConstraint()
-
- /**
- * create a constraint on a table
- *
- * @param string $table name of the table on which the constraint is to be created
- * @param string $name name of the constraint to be created
- * @param array $definition associative array that defines properties of the constraint to be created.
- * Currently, only one property named FIELDS is supported. This property
- * is also an associative with the names of the constraint fields as array
- * constraints. Each entry of this array is set to another type of associative
- * array that specifies properties of the constraint that are specific to
- * each field.
- *
- * Example
- * array(
- * 'fields' => array(
- * 'user_name' => array(),
- * 'last_login' => array()
- * )
- * )
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function createConstraint($table, $name, $definition)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $type = '';
- $idx_name = $db->quoteIdentifier($db->getIndexName($name), true);
- if (!empty($definition['primary'])) {
- $type = 'PRIMARY';
- $idx_name = 'KEY';
- } elseif (!empty($definition['unique'])) {
- $type = 'UNIQUE';
- } elseif (!empty($definition['foreign'])) {
- $type = 'CONSTRAINT';
- }
- if (empty($type)) {
- return $db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
- 'invalid definition, could not create constraint', __FUNCTION__);
- }
-
- $table_quoted = $db->quoteIdentifier($table, true);
- $query = "ALTER TABLE $table_quoted ADD $type $idx_name";
- if (!empty($definition['foreign'])) {
- $query .= ' FOREIGN KEY';
- }
- $fields = array();
- foreach ($definition['fields'] as $field => $fieldinfo) {
- $quoted = $db->quoteIdentifier($field, true);
- if (!empty($fieldinfo['length'])) {
- $quoted .= '(' . $fieldinfo['length'] . ')';
- }
- $fields[] = $quoted;
- }
- $query .= ' ('. implode(', ', $fields) . ')';
- if (!empty($definition['foreign'])) {
- $query.= ' REFERENCES ' . $db->quoteIdentifier($definition['references']['table'], true);
- $referenced_fields = array();
- foreach (array_keys($definition['references']['fields']) as $field) {
- $referenced_fields[] = $db->quoteIdentifier($field, true);
- }
- $query .= ' ('. implode(', ', $referenced_fields) . ')';
- $query .= $this->_getAdvancedFKOptions($definition);
-
- // add index on FK column(s) or we can't add a FK constraint
- // @see http://forums.mysql.com/read.php?22,19755,226009
- $result = $this->createIndex($table, $name.'_fkidx', $definition);
- if (PEAR::isError($result)) {
- return $result;
- }
- }
- $res = $db->exec($query);
- if (PEAR::isError($res)) {
- return $res;
- }
- if (!empty($definition['foreign'])) {
- return $this->_createFKTriggers($table, array($name => $definition));
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ dropConstraint()
-
- /**
- * drop existing constraint
- *
- * @param string $table name of table that should be used in method
- * @param string $name name of the constraint to be dropped
- * @param string $primary hint if the constraint is primary
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function dropConstraint($table, $name, $primary = false)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- if ($primary || strtolower($name) == 'primary') {
- $query = 'ALTER TABLE '. $db->quoteIdentifier($table, true) .' DROP PRIMARY KEY';
- $result = $db->exec($query);
- if (MDB2::isError($result)) {
- return $result;
- }
- return MDB2_OK;
- }
-
- //is it a FK constraint? If so, also delete the associated triggers
- $db->loadModule('Reverse', null, true);
- $definition = $db->reverse->getTableConstraintDefinition($table, $name);
- if (!PEAR::isError($definition) && !empty($definition['foreign'])) {
- //first drop the FK enforcing triggers
- $result = $this->_dropFKTriggers($table, $name, $definition['references']['table']);
- if (PEAR::isError($result)) {
- return $result;
- }
- //then drop the constraint itself
- $table = $db->quoteIdentifier($table, true);
- $name = $db->quoteIdentifier($db->getIndexName($name), true);
- $query = "ALTER TABLE $table DROP FOREIGN KEY $name";
- $result = $db->exec($query);
- if (MDB2::isError($result)) {
- return $result;
- }
- return MDB2_OK;
- }
-
- $table = $db->quoteIdentifier($table, true);
- $name = $db->quoteIdentifier($db->getIndexName($name), true);
- $query = "ALTER TABLE $table DROP INDEX $name";
- $result = $db->exec($query);
- if (MDB2::isError($result)) {
- return $result;
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ _createFKTriggers()
-
- /**
- * Create triggers to enforce the FOREIGN KEY constraint on the table
- *
- * NB: since there's no RAISE_APPLICATION_ERROR facility in mysql,
- * we call a non-existent procedure to raise the FK violation message.
- * @see http://forums.mysql.com/read.php?99,55108,71877#msg-71877
- *
- * @param string $table table name
- * @param array $foreign_keys FOREIGN KEY definitions
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access private
- */
- function _createFKTriggers($table, $foreign_keys)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
- // create triggers to enforce FOREIGN KEY constraints
- if ($db->supports('triggers') && !empty($foreign_keys)) {
- $table_quoted = $db->quoteIdentifier($table, true);
- foreach ($foreign_keys as $fkname => $fkdef) {
- if (empty($fkdef)) {
- continue;
- }
- //set actions to default if not set
- $fkdef['onupdate'] = empty($fkdef['onupdate']) ? $db->options['default_fk_action_onupdate'] : strtoupper($fkdef['onupdate']);
- $fkdef['ondelete'] = empty($fkdef['ondelete']) ? $db->options['default_fk_action_ondelete'] : strtoupper($fkdef['ondelete']);
-
- $trigger_names = array(
- 'insert' => $fkname.'_insert_trg',
- 'update' => $fkname.'_update_trg',
- 'pk_update' => $fkname.'_pk_update_trg',
- 'pk_delete' => $fkname.'_pk_delete_trg',
- );
- $table_fields = array_keys($fkdef['fields']);
- $referenced_fields = array_keys($fkdef['references']['fields']);
-
- //create the ON [UPDATE|DELETE] triggers on the primary table
- $restrict_action = ' IF (SELECT ';
- $aliased_fields = array();
- foreach ($table_fields as $field) {
- $aliased_fields[] = $table_quoted .'.'.$field .' AS '.$field;
- }
- $restrict_action .= implode(',', $aliased_fields)
- .' FROM '.$table_quoted
- .' WHERE ';
- $conditions = array();
- $new_values = array();
- $null_values = array();
- for ($i=0; $i<count($table_fields); $i++) {
- $conditions[] = $table_fields[$i] .' = OLD.'.$referenced_fields[$i];
- $new_values[] = $table_fields[$i] .' = NEW.'.$referenced_fields[$i];
- $null_values[] = $table_fields[$i] .' = NULL';
- }
- $conditions2 = array();
- for ($i=0; $i<count($referenced_fields); $i++) {
- $conditions2[] = 'NEW.'.$referenced_fields[$i] .' <> OLD.'.$referenced_fields[$i];
- }
-
- $restrict_action .= implode(' AND ', $conditions).') IS NOT NULL';
- $restrict_action2 = empty($conditions2) ? '' : ' AND (' .implode(' OR ', $conditions2) .')';
- $restrict_action3 = ' THEN CALL %s_ON_TABLE_'.$table.'_VIOLATES_FOREIGN_KEY_CONSTRAINT();'
- .' END IF;';
-
- $restrict_action_update = $restrict_action . $restrict_action2 . $restrict_action3;
- $restrict_action_delete = $restrict_action . $restrict_action3; // There is no NEW row in on DELETE trigger
-
- $cascade_action_update = 'UPDATE '.$table_quoted.' SET '.implode(', ', $new_values) .' WHERE '.implode(' AND ', $conditions). ';';
- $cascade_action_delete = 'DELETE FROM '.$table_quoted.' WHERE '.implode(' AND ', $conditions). ';';
- $setnull_action = 'UPDATE '.$table_quoted.' SET '.implode(', ', $null_values).' WHERE '.implode(' AND ', $conditions). ';';
-
- if ('SET DEFAULT' == $fkdef['onupdate'] || 'SET DEFAULT' == $fkdef['ondelete']) {
- $db->loadModule('Reverse', null, true);
- $default_values = array();
- foreach ($table_fields as $table_field) {
- $field_definition = $db->reverse->getTableFieldDefinition($table, $field);
- if (PEAR::isError($field_definition)) {
- return $field_definition;
- }
- $default_values[] = $table_field .' = '. $field_definition[0]['default'];
- }
- $setdefault_action = 'UPDATE '.$table_quoted.' SET '.implode(', ', $default_values).' WHERE '.implode(' AND ', $conditions). ';';
- }
-
- $query = 'CREATE TRIGGER %s'
- .' %s ON '.$fkdef['references']['table']
- .' FOR EACH ROW BEGIN '
- .' SET FOREIGN_KEY_CHECKS = 0; '; //only really needed for ON UPDATE CASCADE
-
- if ('CASCADE' == $fkdef['onupdate']) {
- $sql_update = sprintf($query, $trigger_names['pk_update'], 'BEFORE UPDATE', 'update') . $cascade_action_update;
- } elseif ('SET NULL' == $fkdef['onupdate']) {
- $sql_update = sprintf($query, $trigger_names['pk_update'], 'BEFORE UPDATE', 'update') . $setnull_action;
- } elseif ('SET DEFAULT' == $fkdef['onupdate']) {
- $sql_update = sprintf($query, $trigger_names['pk_update'], 'BEFORE UPDATE', 'update') . $setdefault_action;
- } elseif ('NO ACTION' == $fkdef['onupdate']) {
- $sql_update = sprintf($query.$restrict_action_update, $trigger_names['pk_update'], 'AFTER UPDATE', 'update');
- } elseif ('RESTRICT' == $fkdef['onupdate']) {
- $sql_update = sprintf($query.$restrict_action_update, $trigger_names['pk_update'], 'BEFORE UPDATE', 'update');
- }
- if ('CASCADE' == $fkdef['ondelete']) {
- $sql_delete = sprintf($query, $trigger_names['pk_delete'], 'BEFORE DELETE', 'delete') . $cascade_action_delete;
- } elseif ('SET NULL' == $fkdef['ondelete']) {
- $sql_delete = sprintf($query, $trigger_names['pk_delete'], 'BEFORE DELETE', 'delete') . $setnull_action;
- } elseif ('SET DEFAULT' == $fkdef['ondelete']) {
- $sql_delete = sprintf($query, $trigger_names['pk_delete'], 'BEFORE DELETE', 'delete') . $setdefault_action;
- } elseif ('NO ACTION' == $fkdef['ondelete']) {
- $sql_delete = sprintf($query.$restrict_action_delete, $trigger_names['pk_delete'], 'AFTER DELETE', 'delete');
- } elseif ('RESTRICT' == $fkdef['ondelete']) {
- $sql_delete = sprintf($query.$restrict_action_delete, $trigger_names['pk_delete'], 'BEFORE DELETE', 'delete');
- }
- $sql_update .= ' SET FOREIGN_KEY_CHECKS = 1; END;';
- $sql_delete .= ' SET FOREIGN_KEY_CHECKS = 1; END;';
-
- $db->pushErrorHandling(PEAR_ERROR_RETURN);
- $db->expectError(MDB2_ERROR_CANNOT_CREATE);
- $result = $db->exec($sql_delete);
- $expected_errmsg = 'This MySQL version doesn\'t support multiple triggers with the same action time and event for one table';
- $db->popExpect();
- $db->popErrorHandling();
- if (PEAR::isError($result)) {
- if ($result->getCode() != MDB2_ERROR_CANNOT_CREATE) {
- return $result;
- }
- $db->warnings[] = $expected_errmsg;
- }
- $db->pushErrorHandling(PEAR_ERROR_RETURN);
- $db->expectError(MDB2_ERROR_CANNOT_CREATE);
- $result = $db->exec($sql_update);
- $db->popExpect();
- $db->popErrorHandling();
- if (PEAR::isError($result) && $result->getCode() != MDB2_ERROR_CANNOT_CREATE) {
- if ($result->getCode() != MDB2_ERROR_CANNOT_CREATE) {
- return $result;
- }
- $db->warnings[] = $expected_errmsg;
- }
- }
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ _dropFKTriggers()
-
- /**
- * Drop the triggers created to enforce the FOREIGN KEY constraint on the table
- *
- * @param string $table table name
- * @param string $fkname FOREIGN KEY constraint name
- * @param string $referenced_table referenced table name
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access private
- */
- function _dropFKTriggers($table, $fkname, $referenced_table)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $triggers = $this->listTableTriggers($table);
- $triggers2 = $this->listTableTriggers($referenced_table);
- if (!PEAR::isError($triggers2) && !PEAR::isError($triggers)) {
- $triggers = array_merge($triggers, $triggers2);
- $pattern = '/^'.$fkname.'(_pk)?_(insert|update|delete)_trg$/i';
- foreach ($triggers as $trigger) {
- if (preg_match($pattern, $trigger)) {
- $result = $db->exec('DROP TRIGGER '.$trigger);
- if (PEAR::isError($result)) {
- return $result;
- }
- }
- }
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ listTableConstraints()
-
- /**
- * list all constraints in a table
- *
- * @param string $table name of table that should be used in method
- * @return mixed array of constraint names on success, a MDB2 error on failure
- * @access public
- */
- function listTableConstraints($table)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $key_name = 'Key_name';
- $non_unique = 'Non_unique';
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- if ($db->options['field_case'] == CASE_LOWER) {
- $key_name = strtolower($key_name);
- $non_unique = strtolower($non_unique);
- } else {
- $key_name = strtoupper($key_name);
- $non_unique = strtoupper($non_unique);
- }
- }
-
- $query = 'SHOW INDEX FROM ' . $db->quoteIdentifier($table, true);
- $indexes = $db->queryAll($query, null, MDB2_FETCHMODE_ASSOC);
- if (PEAR::isError($indexes)) {
- return $indexes;
- }
-
- $result = array();
- foreach ($indexes as $index_data) {
- if (!$index_data[$non_unique]) {
- if ($index_data[$key_name] !== 'PRIMARY') {
- $index = $this->_fixIndexName($index_data[$key_name]);
- } else {
- $index = 'PRIMARY';
- }
- if (!empty($index)) {
- $result[$index] = true;
- }
- }
- }
-
- //list FOREIGN KEY constraints...
- $query = 'SHOW CREATE TABLE '. $db->escape($table);
- $definition = $db->queryOne($query, 'text', 1);
- if (!PEAR::isError($definition) && !empty($definition)) {
- $pattern = '/\bCONSTRAINT\b\s+([^\s]+)\s+\bFOREIGN KEY\b/Uims';
- if (preg_match_all($pattern, str_replace('`', '', $definition), $matches) > 0) {
- foreach ($matches[1] as $constraint) {
- $result[$constraint] = true;
- }
- }
- }
-
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $result = array_change_key_case($result, $db->options['field_case']);
- }
- return array_keys($result);
- }
-
- // }}}
- // {{{ createSequence()
-
- /**
- * create sequence
- *
- * @param string $seq_name name of the sequence to be created
- * @param string $start start value of the sequence; default is 1
- * @param array $options An associative array of table options:
- * array(
- * 'comment' => 'Foo',
- * 'charset' => 'utf8',
- * 'collate' => 'utf8_unicode_ci',
- * 'type' => 'innodb',
- * );
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function createSequence($seq_name, $start = 1, $options = array())
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $sequence_name = $db->quoteIdentifier($db->getSequenceName($seq_name), true);
- $seqcol_name = $db->quoteIdentifier($db->options['seqcol_name'], true);
-
- $options_strings = array();
-
- if (!empty($options['comment'])) {
- $options_strings['comment'] = 'COMMENT = '.$db->quote($options['comment'], 'text');
- }
-
- if (!empty($options['charset'])) {
- $options_strings['charset'] = 'DEFAULT CHARACTER SET '.$options['charset'];
- if (!empty($options['collate'])) {
- $options_strings['charset'].= ' COLLATE '.$options['collate'];
- }
- }
-
- $type = false;
- if (!empty($options['type'])) {
- $type = $options['type'];
- } elseif ($db->options['default_table_type']) {
- $type = $db->options['default_table_type'];
- }
- if ($type) {
- $options_strings[] = "ENGINE = $type";
- }
-
- $query = "CREATE TABLE $sequence_name ($seqcol_name INT NOT NULL AUTO_INCREMENT, PRIMARY KEY ($seqcol_name))";
- if (!empty($options_strings)) {
- $query .= ' '.implode(' ', $options_strings);
- }
- $res = $db->exec($query);
- if (PEAR::isError($res)) {
- return $res;
- }
-
- if ($start == 1) {
- return MDB2_OK;
- }
-
- $query = "INSERT INTO $sequence_name ($seqcol_name) VALUES (".($start-1).')';
- $res = $db->exec($query);
- if (!PEAR::isError($res)) {
- return MDB2_OK;
- }
-
- // Handle error
- $result = $db->exec("DROP TABLE $sequence_name");
- if (PEAR::isError($result)) {
- return $db->raiseError($result, null, null,
- 'could not drop inconsistent sequence table', __FUNCTION__);
- }
-
- return $db->raiseError($res, null, null,
- 'could not create sequence table', __FUNCTION__);
- }
-
- // }}}
- // {{{ dropSequence()
-
- /**
- * drop existing sequence
- *
- * @param string $seq_name name of the sequence to be dropped
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function dropSequence($seq_name)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $sequence_name = $db->quoteIdentifier($db->getSequenceName($seq_name), true);
- $result = $db->exec("DROP TABLE $sequence_name");
- if (MDB2::isError($result)) {
- return $result;
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ listSequences()
-
- /**
- * list all sequences in the current database
- *
- * @param string database, the current is default
- * @return mixed array of sequence names on success, a MDB2 error on failure
- * @access public
- */
- function listSequences($database = null)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $query = "SHOW TABLES";
- if (null !== $database) {
- $query .= " FROM $database";
- }
- $table_names = $db->queryCol($query);
- if (PEAR::isError($table_names)) {
- return $table_names;
- }
-
- $result = array();
- foreach ($table_names as $table_name) {
- if ($sqn = $this->_fixSequenceName($table_name, true)) {
- $result[] = $sqn;
- }
- }
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $result = array_map(($db->options['field_case'] == CASE_LOWER ? 'strtolower' : 'strtoupper'), $result);
- }
- return $result;
- }
-
- // }}}
-}
-?>
diff --git a/3rdparty/MDB2/Driver/Manager/oci8.php b/3rdparty/MDB2/Driver/Manager/oci8.php
deleted file mode 100644
index 90ae8eb2302..00000000000
--- a/3rdparty/MDB2/Driver/Manager/oci8.php
+++ /dev/null
@@ -1,1340 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2008 Manuel Lemos, Tomas V.V.Cox, |
-// | Stig. S. Bakken, Lukas Smith |
-// | All rights reserved. |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
-// | API as well as database abstraction for PHP applications. |
-// | This LICENSE is in the BSD license style. |
-// | |
-// | Redistribution and use in source and binary forms, with or without |
-// | modification, are permitted provided that the following conditions |
-// | are met: |
-// | |
-// | Redistributions of source code must retain the above copyright |
-// | notice, this list of conditions and the following disclaimer. |
-// | |
-// | Redistributions in binary form must reproduce the above copyright |
-// | notice, this list of conditions and the following disclaimer in the |
-// | documentation and/or other materials provided with the distribution. |
-// | |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission. |
-// | |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-// | POSSIBILITY OF SUCH DAMAGE. |
-// +----------------------------------------------------------------------+
-// | Author: Lukas Smith <smith@pooteeweet.org> |
-// +----------------------------------------------------------------------+
-
-// $Id: oci8.php 295587 2010-02-28 17:16:38Z quipo $
-
-require_once 'MDB2/Driver/Manager/Common.php';
-
-/**
- * MDB2 oci8 driver for the management modules
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Driver_Manager_oci8 extends MDB2_Driver_Manager_Common
-{
- // {{{ createDatabase()
-
- /**
- * create a new database
- *
- * @param string $name name of the database that should be created
- * @param array $options array with charset, collation info
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function createDatabase($name, $options = array())
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $username = $db->options['database_name_prefix'].$name;
- $password = $db->dsn['password'] ? $db->dsn['password'] : $name;
- $tablespace = $db->options['default_tablespace']
- ? ' DEFAULT TABLESPACE '.$db->options['default_tablespace'] : '';
-
- $query = 'CREATE USER '.$username.' IDENTIFIED BY '.$password.$tablespace;
- $result = $db->standaloneQuery($query, null, true);
- if (PEAR::isError($result)) {
- return $result;
- }
- $query = 'GRANT CREATE SESSION, CREATE TABLE, UNLIMITED TABLESPACE, CREATE SEQUENCE, CREATE TRIGGER TO '.$username;
- $result = $db->standaloneQuery($query, null, true);
- if (PEAR::isError($result)) {
- $query = 'DROP USER '.$username.' CASCADE';
- $result2 = $db->standaloneQuery($query, null, true);
- if (PEAR::isError($result2)) {
- return $db->raiseError($result2, null, null,
- 'could not setup the database user', __FUNCTION__);
- }
- return $result;
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ alterDatabase()
-
- /**
- * alter an existing database
- *
- * IMPORTANT: the safe way to change the db charset is to do a full import/export!
- * If - and only if - the new character set is a strict superset of the current
- * character set, it is possible to use the ALTER DATABASE CHARACTER SET to
- * expedite the change in the database character set.
- *
- * @param string $name name of the database that is intended to be changed
- * @param array $options array with name, charset info
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function alterDatabase($name, $options = array())
- {
- //disabled
- //return parent::alterDatabase($name, $options);
-
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- if (!empty($options['name'])) {
- $query = 'ALTER DATABASE ' . $db->quoteIdentifier($name, true)
- .' RENAME GLOBAL_NAME TO ' . $db->quoteIdentifier($options['name'], true);
- $result = $db->standaloneQuery($query);
- if (PEAR::isError($result)) {
- return $result;
- }
- }
-
- if (!empty($options['charset'])) {
- $queries = array();
- $queries[] = 'SHUTDOWN IMMEDIATE'; //or NORMAL
- $queries[] = 'STARTUP MOUNT';
- $queries[] = 'ALTER SYSTEM ENABLE RESTRICTED SESSION';
- $queries[] = 'ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0';
- $queries[] = 'ALTER DATABASE OPEN';
- $queries[] = 'ALTER DATABASE CHARACTER SET ' . $options['charset'];
- $queries[] = 'ALTER DATABASE NATIONAL CHARACTER SET ' . $options['charset'];
- $queries[] = 'SHUTDOWN IMMEDIATE'; //or NORMAL
- $queries[] = 'STARTUP';
-
- foreach ($queries as $query) {
- $result = $db->standaloneQuery($query);
- if (PEAR::isError($result)) {
- return $result;
- }
- }
- }
-
- return MDB2_OK;
- }
-
- // }}}
- // {{{ dropDatabase()
-
- /**
- * drop an existing database
- *
- * @param object $db database object that is extended by this class
- * @param string $name name of the database that should be dropped
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function dropDatabase($name)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $username = $db->options['database_name_prefix'].$name;
- return $db->standaloneQuery('DROP USER '.$username.' CASCADE', null, true);
- }
-
-
- // }}}
- // {{{ _makeAutoincrement()
-
- /**
- * add an autoincrement sequence + trigger
- *
- * @param string $name name of the PK field
- * @param string $table name of the table
- * @param string $start start value for the sequence
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access private
- */
- function _makeAutoincrement($name, $table, $start = 1)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $table_uppercase = strtoupper($table);
- $index_name = $table_uppercase . '_AI_PK';
- $definition = array(
- 'primary' => true,
- 'fields' => array($name => true),
- );
- $idxname_format = $db->getOption('idxname_format');
- $db->setOption('idxname_format', '%s');
- $result = $this->createConstraint($table, $index_name, $definition);
- $db->setOption('idxname_format', $idxname_format);
- if (PEAR::isError($result)) {
- return $db->raiseError($result, null, null,
- 'primary key for autoincrement PK could not be created', __FUNCTION__);
- }
-
- if (null === $start) {
- $db->beginTransaction();
- $query = 'SELECT MAX(' . $db->quoteIdentifier($name, true) . ') FROM ' . $db->quoteIdentifier($table, true);
- $start = $this->db->queryOne($query, 'integer');
- if (PEAR::isError($start)) {
- return $start;
- }
- ++$start;
- $result = $this->createSequence($table, $start);
- $db->commit();
- } else {
- $result = $this->createSequence($table, $start);
- }
- if (PEAR::isError($result)) {
- return $db->raiseError($result, null, null,
- 'sequence for autoincrement PK could not be created', __FUNCTION__);
- }
- $seq_name = $db->getSequenceName($table);
- $trigger_name = $db->quoteIdentifier($table_uppercase . '_AI_PK', true);
- $seq_name_quoted = $db->quoteIdentifier($seq_name, true);
- $table = $db->quoteIdentifier($table, true);
- $name = $db->quoteIdentifier($name, true);
- $trigger_sql = '
-CREATE TRIGGER '.$trigger_name.'
- BEFORE INSERT
- ON '.$table.'
- FOR EACH ROW
-DECLARE
- last_Sequence NUMBER;
- last_InsertID NUMBER;
-BEGIN
- SELECT '.$seq_name_quoted.'.NEXTVAL INTO :NEW.'.$name.' FROM DUAL;
- IF (:NEW.'.$name.' IS NULL OR :NEW.'.$name.' = 0) THEN
- SELECT '.$seq_name_quoted.'.NEXTVAL INTO :NEW.'.$name.' FROM DUAL;
- ELSE
- SELECT NVL(Last_Number, 0) INTO last_Sequence
- FROM User_Sequences
- WHERE UPPER(Sequence_Name) = UPPER(\''.$seq_name.'\');
- SELECT :NEW.'.$name.' INTO last_InsertID FROM DUAL;
- WHILE (last_InsertID > last_Sequence) LOOP
- SELECT '.$seq_name_quoted.'.NEXTVAL INTO last_Sequence FROM DUAL;
- END LOOP;
- END IF;
-END;
-';
- $result = $db->exec($trigger_sql);
- if (PEAR::isError($result)) {
- return $result;
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ _dropAutoincrement()
-
- /**
- * drop an existing autoincrement sequence + trigger
- *
- * @param string $table name of the table
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access private
- */
- function _dropAutoincrement($table)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $table = strtoupper($table);
- $trigger_name = $table . '_AI_PK';
- $trigger_name_quoted = $db->quote($trigger_name, 'text');
- $query = 'SELECT trigger_name FROM user_triggers';
- $query.= ' WHERE trigger_name='.$trigger_name_quoted.' OR trigger_name='.strtoupper($trigger_name_quoted);
- $trigger = $db->queryOne($query);
- if (PEAR::isError($trigger)) {
- return $trigger;
- }
-
- if ($trigger) {
- $trigger_name = $db->quoteIdentifier($table . '_AI_PK', true);
- $trigger_sql = 'DROP TRIGGER ' . $trigger_name;
- $result = $db->exec($trigger_sql);
- if (PEAR::isError($result)) {
- return $db->raiseError($result, null, null,
- 'trigger for autoincrement PK could not be dropped', __FUNCTION__);
- }
-
- $result = $this->dropSequence($table);
- if (PEAR::isError($result)) {
- return $db->raiseError($result, null, null,
- 'sequence for autoincrement PK could not be dropped', __FUNCTION__);
- }
-
- $index_name = $table . '_AI_PK';
- $idxname_format = $db->getOption('idxname_format');
- $db->setOption('idxname_format', '%s');
- $result1 = $this->dropConstraint($table, $index_name);
- $db->setOption('idxname_format', $idxname_format);
- $result2 = $this->dropConstraint($table, $index_name);
- if (PEAR::isError($result1) && PEAR::isError($result2)) {
- return $db->raiseError($result1, null, null,
- 'primary key for autoincrement PK could not be dropped', __FUNCTION__);
- }
- }
-
- return MDB2_OK;
- }
-
- // }}}
- // {{{ _getTemporaryTableQuery()
-
- /**
- * A method to return the required SQL string that fits between CREATE ... TABLE
- * to create the table as a temporary table.
- *
- * @return string The string required to be placed between "CREATE" and "TABLE"
- * to generate a temporary table, if possible.
- */
- function _getTemporaryTableQuery()
- {
- return 'GLOBAL TEMPORARY';
- }
-
- // }}}
- // {{{ _getAdvancedFKOptions()
-
- /**
- * Return the FOREIGN KEY query section dealing with non-standard options
- * as MATCH, INITIALLY DEFERRED, ON UPDATE, ...
- *
- * @param array $definition
- * @return string
- * @access protected
- */
- function _getAdvancedFKOptions($definition)
- {
- $query = '';
- if (!empty($definition['ondelete']) && (strtoupper($definition['ondelete']) != 'NO ACTION')) {
- $query .= ' ON DELETE '.$definition['ondelete'];
- }
- if (!empty($definition['deferrable'])) {
- $query .= ' DEFERRABLE';
- } else {
- $query .= ' NOT DEFERRABLE';
- }
- if (!empty($definition['initiallydeferred'])) {
- $query .= ' INITIALLY DEFERRED';
- } else {
- $query .= ' INITIALLY IMMEDIATE';
- }
- return $query;
- }
-
- // }}}
- // {{{ createTable()
-
- /**
- * create a new table
- *
- * @param string $name Name of the database that should be created
- * @param array $fields Associative array that contains the definition of each field of the new table
- * The indexes of the array entries are the names of the fields of the table an
- * the array entry values are associative arrays like those that are meant to be
- * passed with the field definitions to get[Type]Declaration() functions.
- *
- * Example
- * array(
- *
- * 'id' => array(
- * 'type' => 'integer',
- * 'unsigned' => 1
- * 'notnull' => 1
- * 'default' => 0
- * ),
- * 'name' => array(
- * 'type' => 'text',
- * 'length' => 12
- * ),
- * 'password' => array(
- * 'type' => 'text',
- * 'length' => 12
- * )
- * );
- * @param array $options An associative array of table options:
- * array(
- * 'comment' => 'Foo',
- * 'temporary' => true|false,
- * );
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function createTable($name, $fields, $options = array())
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
- $db->beginNestedTransaction();
- $result = parent::createTable($name, $fields, $options);
- if (!PEAR::isError($result)) {
- foreach ($fields as $field_name => $field) {
- if (!empty($field['autoincrement'])) {
- $result = $this->_makeAutoincrement($field_name, $name);
- }
- }
- }
- $db->completeNestedTransaction();
- return $result;
- }
-
- // }}}
- // {{{ dropTable()
-
- /**
- * drop an existing table
- *
- * @param string $name name of the table that should be dropped
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function dropTable($name)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
- $db->beginNestedTransaction();
- $result = $this->_dropAutoincrement($name);
- if (!PEAR::isError($result)) {
- $result = parent::dropTable($name);
- }
- $db->completeNestedTransaction();
- return $result;
- }
-
- // }}}
- // {{{ truncateTable()
-
- /**
- * Truncate an existing table (if the TRUNCATE TABLE syntax is not supported,
- * it falls back to a DELETE FROM TABLE query)
- *
- * @param string $name name of the table that should be truncated
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function truncateTable($name)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $name = $db->quoteIdentifier($name, true);
- return $db->exec("TRUNCATE TABLE $name");
- }
-
- // }}}
- // {{{ vacuum()
-
- /**
- * Optimize (vacuum) all the tables in the db (or only the specified table)
- * and optionally run ANALYZE.
- *
- * @param string $table table name (all the tables if empty)
- * @param array $options an array with driver-specific options:
- * - timeout [int] (in seconds) [mssql-only]
- * - analyze [boolean] [pgsql and mysql]
- * - full [boolean] [pgsql-only]
- * - freeze [boolean] [pgsql-only]
- *
- * @return mixed MDB2_OK success, a MDB2 error on failure
- * @access public
- */
- function vacuum($table = null, $options = array())
- {
- // not needed in Oracle
- return MDB2_OK;
- }
-
- // }}}
- // {{{ alterTable()
-
- /**
- * alter an existing table
- *
- * @param string $name name of the table that is intended to be changed.
- * @param array $changes associative array that contains the details of each type
- * of change that is intended to be performed. The types of
- * changes that are currently supported are defined as follows:
- *
- * name
- *
- * New name for the table.
- *
- * add
- *
- * Associative array with the names of fields to be added as
- * indexes of the array. The value of each entry of the array
- * should be set to another associative array with the properties
- * of the fields to be added. The properties of the fields should
- * be the same as defined by the MDB2 parser.
- *
- *
- * remove
- *
- * Associative array with the names of fields to be removed as indexes
- * of the array. Currently the values assigned to each entry are ignored.
- * An empty array should be used for future compatibility.
- *
- * rename
- *
- * Associative array with the names of fields to be renamed as indexes
- * of the array. The value of each entry of the array should be set to
- * another associative array with the entry named name with the new
- * field name and the entry named Declaration that is expected to contain
- * the portion of the field declaration already in DBMS specific SQL code
- * as it is used in the CREATE TABLE statement.
- *
- * change
- *
- * Associative array with the names of the fields to be changed as indexes
- * of the array. Keep in mind that if it is intended to change either the
- * name of a field and any other properties, the change array entries
- * should have the new names of the fields as array indexes.
- *
- * The value of each entry of the array should be set to another associative
- * array with the properties of the fields to that are meant to be changed as
- * array entries. These entries should be assigned to the new values of the
- * respective properties. The properties of the fields should be the same
- * as defined by the MDB2 parser.
- *
- * Example
- * array(
- * 'name' => 'userlist',
- * 'add' => array(
- * 'quota' => array(
- * 'type' => 'integer',
- * 'unsigned' => 1
- * )
- * ),
- * 'remove' => array(
- * 'file_limit' => array(),
- * 'time_limit' => array()
- * ),
- * 'change' => array(
- * 'name' => array(
- * 'length' => '20',
- * 'definition' => array(
- * 'type' => 'text',
- * 'length' => 20,
- * ),
- * )
- * ),
- * 'rename' => array(
- * 'sex' => array(
- * 'name' => 'gender',
- * 'definition' => array(
- * 'type' => 'text',
- * 'length' => 1,
- * 'default' => 'M',
- * ),
- * )
- * )
- * )
- *
- * @param boolean $check indicates whether the function should just check if the DBMS driver
- * can perform the requested table alterations if the value is true or
- * actually perform them otherwise.
- * @access public
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- */
- function alterTable($name, $changes, $check)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- foreach ($changes as $change_name => $change) {
- switch ($change_name) {
- case 'add':
- case 'remove':
- case 'change':
- case 'name':
- case 'rename':
- break;
- default:
- return $db->raiseError(MDB2_ERROR_CANNOT_ALTER, null, null,
- 'change type "'.$change_name.'" not yet supported', __FUNCTION__);
- }
- }
-
- if ($check) {
- return MDB2_OK;
- }
-
- $name = $db->quoteIdentifier($name, true);
-
- if (!empty($changes['add']) && is_array($changes['add'])) {
- $fields = array();
- foreach ($changes['add'] as $field_name => $field) {
- $fields[] = $db->getDeclaration($field['type'], $field_name, $field);
- }
- $result = $db->exec("ALTER TABLE $name ADD (". implode(', ', $fields).')');
- if (PEAR::isError($result)) {
- return $result;
- }
- }
-
- if (!empty($changes['change']) && is_array($changes['change'])) {
- $fields = array();
- foreach ($changes['change'] as $field_name => $field) {
- //fix error "column to be modified to NOT NULL is already NOT NULL"
- if (!array_key_exists('notnull', $field)) {
- unset($field['definition']['notnull']);
- }
- $fields[] = $db->getDeclaration($field['definition']['type'], $field_name, $field['definition']);
- }
- $result = $db->exec("ALTER TABLE $name MODIFY (". implode(', ', $fields).')');
- if (PEAR::isError($result)) {
- return $result;
- }
- }
-
- if (!empty($changes['rename']) && is_array($changes['rename'])) {
- foreach ($changes['rename'] as $field_name => $field) {
- $field_name = $db->quoteIdentifier($field_name, true);
- $query = "ALTER TABLE $name RENAME COLUMN $field_name TO ".$db->quoteIdentifier($field['name']);
- $result = $db->exec($query);
- if (PEAR::isError($result)) {
- return $result;
- }
- }
- }
-
- if (!empty($changes['remove']) && is_array($changes['remove'])) {
- $fields = array();
- foreach ($changes['remove'] as $field_name => $field) {
- $fields[] = $db->quoteIdentifier($field_name, true);
- }
- $result = $db->exec("ALTER TABLE $name DROP COLUMN ". implode(', ', $fields));
- if (PEAR::isError($result)) {
- return $result;
- }
- }
-
- if (!empty($changes['name'])) {
- $change_name = $db->quoteIdentifier($changes['name'], true);
- $result = $db->exec("ALTER TABLE $name RENAME TO ".$change_name);
- if (PEAR::isError($result)) {
- return $result;
- }
- }
-
- return MDB2_OK;
- }
-
- // }}}
- // {{{ _fetchCol()
-
- /**
- * Utility method to fetch and format a column from a resultset
- *
- * @param resource $result
- * @param boolean $fixname (used when listing indices or constraints)
- * @return mixed array of names on success, a MDB2 error on failure
- * @access private
- */
- function _fetchCol($result, $fixname = false)
- {
- if (PEAR::isError($result)) {
- return $result;
- }
- $col = $result->fetchCol();
- if (PEAR::isError($col)) {
- return $col;
- }
- $result->free();
-
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- if ($fixname) {
- foreach ($col as $k => $v) {
- $col[$k] = $this->_fixIndexName($v);
- }
- }
-
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE
- && $db->options['field_case'] == CASE_LOWER
- ) {
- $col = array_map(($db->options['field_case'] == CASE_LOWER ? 'strtolower' : 'strtoupper'), $col);
- }
- return $col;
- }
-
- // }}}
- // {{{ listDatabases()
-
- /**
- * list all databases
- *
- * @return mixed array of database names on success, a MDB2 error on failure
- * @access public
- */
- function listDatabases()
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- if (!$db->options['emulate_database']) {
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'database listing is only supported if the "emulate_database" option is enabled', __FUNCTION__);
- }
-
- if ($db->options['database_name_prefix']) {
- $query = 'SELECT SUBSTR(username, ';
- $query.= (strlen($db->options['database_name_prefix'])+1);
- $query.= ") FROM sys.dba_users WHERE username LIKE '";
- $query.= $db->options['database_name_prefix']."%'";
- } else {
- $query = 'SELECT username FROM sys.dba_users';
- }
- $result = $db->standaloneQuery($query, array('text'), false);
- return $this->_fetchCol($result);
- }
-
- // }}}
- // {{{ listUsers()
-
- /**
- * list all users
- *
- * @return mixed array of user names on success, a MDB2 error on failure
- * @access public
- */
- function listUsers()
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- if ($db->options['emulate_database'] && $db->options['database_name_prefix']) {
- $query = 'SELECT SUBSTR(username, ';
- $query.= (strlen($db->options['database_name_prefix'])+1);
- $query.= ") FROM sys.dba_users WHERE username NOT LIKE '";
- $query.= $db->options['database_name_prefix']."%'";
- } else {
- $query = 'SELECT username FROM sys.dba_users';
- }
- return $db->queryCol($query);
- }
-
- // }}}
- // {{{ listViews()
-
- /**
- * list all views in the current database
- *
- * @param string owner, the current is default
- * @return mixed array of view names on success, a MDB2 error on failure
- * @access public
- */
- function listViews($owner = null)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- if (empty($owner)) {
- $owner = $db->dsn['username'];
- }
-
- $query = 'SELECT view_name
- FROM sys.all_views
- WHERE owner=? OR owner=?';
- $stmt = $db->prepare($query);
- if (PEAR::isError($stmt)) {
- return $stmt;
- }
- $result = $stmt->execute(array($owner, strtoupper($owner)));
- return $this->_fetchCol($result);
- }
-
- // }}}
- // {{{ listFunctions()
-
- /**
- * list all functions in the current database
- *
- * @param string owner, the current is default
- * @return mixed array of function names on success, a MDB2 error on failure
- * @access public
- */
- function listFunctions($owner = null)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- if (empty($owner)) {
- $owner = $db->dsn['username'];
- }
-
- $query = "SELECT name
- FROM sys.all_source
- WHERE line = 1
- AND type = 'FUNCTION'
- AND (owner=? OR owner=?)";
- $stmt = $db->prepare($query);
- if (PEAR::isError($stmt)) {
- return $stmt;
- }
- $result = $stmt->execute(array($owner, strtoupper($owner)));
- return $this->_fetchCol($result);
- }
-
- // }}}
- // {{{ listTableTriggers()
-
- /**
- * list all triggers in the database that reference a given table
- *
- * @param string table for which all referenced triggers should be found
- * @return mixed array of trigger names on success, a MDB2 error on failure
- * @access public
- */
- function listTableTriggers($table = null)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- if (empty($owner)) {
- $owner = $db->dsn['username'];
- }
-
- $query = "SELECT trigger_name
- FROM sys.all_triggers
- WHERE (table_name=? OR table_name=?)
- AND (owner=? OR owner=?)";
- $stmt = $db->prepare($query);
- if (PEAR::isError($stmt)) {
- return $stmt;
- }
- $args = array(
- $table,
- strtoupper($table),
- $owner,
- strtoupper($owner),
- );
- $result = $stmt->execute($args);
- return $this->_fetchCol($result);
- }
-
- // }}}
- // {{{ listTables()
-
- /**
- * list all tables in the database
- *
- * @param string owner, the current is default
- * @return mixed array of table names on success, a MDB2 error on failure
- * @access public
- */
- function listTables($owner = null)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- if (empty($owner)) {
- $owner = $db->dsn['username'];
- }
-
- $query = 'SELECT table_name
- FROM sys.all_tables
- WHERE owner=? OR owner=?';
- $stmt = $db->prepare($query);
- if (PEAR::isError($stmt)) {
- return $stmt;
- }
- $result = $stmt->execute(array($owner, strtoupper($owner)));
- return $this->_fetchCol($result);
- }
-
- // }}}
- // {{{ listTableFields()
-
- /**
- * list all fields in a table in the current database
- *
- * @param string $table name of table that should be used in method
- * @return mixed array of field names on success, a MDB2 error on failure
- * @access public
- */
- function listTableFields($table)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- list($owner, $table) = $this->splitTableSchema($table);
- if (empty($owner)) {
- $owner = $db->dsn['username'];
- }
-
- $query = 'SELECT column_name
- FROM all_tab_columns
- WHERE (table_name=? OR table_name=?)
- AND (owner=? OR owner=?)
- ORDER BY column_id';
- $stmt = $db->prepare($query);
- if (PEAR::isError($stmt)) {
- return $stmt;
- }
- $args = array(
- $table,
- strtoupper($table),
- $owner,
- strtoupper($owner),
- );
- $result = $stmt->execute($args);
- return $this->_fetchCol($result);
- }
-
- // }}}
- // {{{ listTableIndexes()
-
- /**
- * list all indexes in a table
- *
- * @param string $table name of table that should be used in method
- * @return mixed array of index names on success, a MDB2 error on failure
- * @access public
- */
- function listTableIndexes($table)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- list($owner, $table) = $this->splitTableSchema($table);
- if (empty($owner)) {
- $owner = $db->dsn['username'];
- }
-
- $query = 'SELECT i.index_name name
- FROM all_indexes i
- LEFT JOIN all_constraints c
- ON c.index_name = i.index_name
- AND c.owner = i.owner
- AND c.table_name = i.table_name
- WHERE (i.table_name=? OR i.table_name=?)
- AND (i.owner=? OR i.owner=?)
- AND c.index_name IS NULL
- AND i.generated=' .$db->quote('N', 'text');
- $stmt = $db->prepare($query);
- if (PEAR::isError($stmt)) {
- return $stmt;
- }
- $args = array(
- $table,
- strtoupper($table),
- $owner,
- strtoupper($owner),
- );
- $result = $stmt->execute($args);
- return $this->_fetchCol($result, true);
- }
-
- // }}}
- // {{{ createConstraint()
-
- /**
- * create a constraint on a table
- *
- * @param string $table name of the table on which the constraint is to be created
- * @param string $name name of the constraint to be created
- * @param array $definition associative array that defines properties of the constraint to be created.
- * Currently, only one property named FIELDS is supported. This property
- * is also an associative with the names of the constraint fields as array
- * constraints. Each entry of this array is set to another type of associative
- * array that specifies properties of the constraint that are specific to
- * each field.
- *
- * Example
- * array(
- * 'fields' => array(
- * 'user_name' => array(),
- * 'last_login' => array()
- * )
- * )
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function createConstraint($table, $name, $definition)
- {
- $result = parent::createConstraint($table, $name, $definition);
- if (PEAR::isError($result)) {
- return $result;
- }
- if (!empty($definition['foreign'])) {
- return $this->_createFKTriggers($table, array($name => $definition));
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ dropConstraint()
-
- /**
- * drop existing constraint
- *
- * @param string $table name of table that should be used in method
- * @param string $name name of the constraint to be dropped
- * @param string $primary hint if the constraint is primary
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function dropConstraint($table, $name, $primary = false)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- //is it a FK constraint? If so, also delete the associated triggers
- $db->loadModule('Reverse', null, true);
- $definition = $db->reverse->getTableConstraintDefinition($table, $name);
- if (!PEAR::isError($definition) && !empty($definition['foreign'])) {
- //first drop the FK enforcing triggers
- $result = $this->_dropFKTriggers($table, $name, $definition['references']['table']);
- if (PEAR::isError($result)) {
- return $result;
- }
- }
-
- return parent::dropConstraint($table, $name, $primary);
- }
-
- // }}}
- // {{{ _createFKTriggers()
-
- /**
- * Create triggers to enforce the FOREIGN KEY constraint on the table
- *
- * @param string $table table name
- * @param array $foreign_keys FOREIGN KEY definitions
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access private
- */
- function _createFKTriggers($table, $foreign_keys)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
- // create triggers to enforce FOREIGN KEY constraints
- if ($db->supports('triggers') && !empty($foreign_keys)) {
- $table = $db->quoteIdentifier($table, true);
- foreach ($foreign_keys as $fkname => $fkdef) {
- if (empty($fkdef)) {
- continue;
- }
- $fkdef['onupdate'] = empty($fkdef['onupdate']) ? $db->options['default_fk_action_onupdate'] : strtoupper($fkdef['onupdate']);
- if ('RESTRICT' == $fkdef['onupdate'] || 'NO ACTION' == $fkdef['onupdate']) {
- // already handled by default
- continue;
- }
-
- $trigger_name = substr(strtolower($fkname.'_pk_upd_trg'), 0, $db->options['max_identifiers_length']);
- $table_fields = array_keys($fkdef['fields']);
- $referenced_fields = array_keys($fkdef['references']['fields']);
-
- //create the ON UPDATE trigger on the primary table
- $restrict_action = ' IF (SELECT ';
- $aliased_fields = array();
- foreach ($table_fields as $field) {
- $aliased_fields[] = $table .'.'.$field .' AS '.$field;
- }
- $restrict_action .= implode(',', $aliased_fields)
- .' FROM '.$table
- .' WHERE ';
- $conditions = array();
- $new_values = array();
- $null_values = array();
- for ($i=0; $i<count($table_fields); $i++) {
- $conditions[] = $table_fields[$i] .' = :OLD.'.$referenced_fields[$i];
- $new_values[] = $table_fields[$i] .' = :NEW.'.$referenced_fields[$i];
- $null_values[] = $table_fields[$i] .' = NULL';
- }
-
- $cascade_action = 'UPDATE '.$table.' SET '.implode(', ', $new_values) .' WHERE '.implode(' AND ', $conditions). ';';
- $setnull_action = 'UPDATE '.$table.' SET '.implode(', ', $null_values).' WHERE '.implode(' AND ', $conditions). ';';
-
- if ('SET DEFAULT' == $fkdef['onupdate'] || 'SET DEFAULT' == $fkdef['ondelete']) {
- $db->loadModule('Reverse', null, true);
- $default_values = array();
- foreach ($table_fields as $table_field) {
- $field_definition = $db->reverse->getTableFieldDefinition($table, $field);
- if (PEAR::isError($field_definition)) {
- return $field_definition;
- }
- $default_values[] = $table_field .' = '. $field_definition[0]['default'];
- }
- $setdefault_action = 'UPDATE '.$table.' SET '.implode(', ', $default_values).' WHERE '.implode(' AND ', $conditions). ';';
- }
-
- $query = 'CREATE TRIGGER %s'
- .' %s ON '.$fkdef['references']['table']
- .' FOR EACH ROW '
- .' BEGIN ';
-
- if ('CASCADE' == $fkdef['onupdate']) {
- $sql_update = sprintf($query, $trigger_name, 'BEFORE UPDATE', 'update') . $cascade_action;
- } elseif ('SET NULL' == $fkdef['onupdate']) {
- $sql_update = sprintf($query, $trigger_name, 'BEFORE UPDATE', 'update') . $setnull_action;
- } elseif ('SET DEFAULT' == $fkdef['onupdate']) {
- $sql_update = sprintf($query, $trigger_name, 'BEFORE UPDATE', 'update') . $setdefault_action;
- }
- $sql_update .= ' END;';
- $result = $db->exec($sql_update);
- if (PEAR::isError($result)) {
- if ($result->getCode() === MDB2_ERROR_ALREADY_EXISTS) {
- return MDB2_OK;
- }
- return $result;
- }
- }
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ _dropFKTriggers()
-
- /**
- * Drop the triggers created to enforce the FOREIGN KEY constraint on the table
- *
- * @param string $table table name
- * @param string $fkname FOREIGN KEY constraint name
- * @param string $referenced_table referenced table name
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access private
- */
- function _dropFKTriggers($table, $fkname, $referenced_table)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $triggers = $this->listTableTriggers($table);
- $triggers2 = $this->listTableTriggers($referenced_table);
- if (!PEAR::isError($triggers2) && !PEAR::isError($triggers)) {
- $triggers = array_merge($triggers, $triggers2);
- $trigger_name = substr(strtolower($fkname.'_pk_upd_trg'), 0, $db->options['max_identifiers_length']);
- $pattern = '/^'.$trigger_name.'$/i';
- foreach ($triggers as $trigger) {
- if (preg_match($pattern, $trigger)) {
- $result = $db->exec('DROP TRIGGER '.$trigger);
- if (PEAR::isError($result)) {
- return $result;
- }
- }
- }
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ listTableConstraints()
-
- /**
- * list all constraints in a table
- *
- * @param string $table name of table that should be used in method
- * @return mixed array of constraint names on success, a MDB2 error on failure
- * @access public
- */
- function listTableConstraints($table)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- list($owner, $table) = $this->splitTableSchema($table);
- if (empty($owner)) {
- $owner = $db->dsn['username'];
- }
-
- $query = 'SELECT constraint_name
- FROM all_constraints
- WHERE (table_name=? OR table_name=?)
- AND (owner=? OR owner=?)';
- $stmt = $db->prepare($query);
- if (PEAR::isError($stmt)) {
- return $stmt;
- }
- $args = array(
- $table,
- strtoupper($table),
- $owner,
- strtoupper($owner),
- );
- $result = $stmt->execute($args);
- return $this->_fetchCol($result, true);
- }
-
- // }}}
- // {{{ createSequence()
-
- /**
- * create sequence
- *
- * @param object $db database object that is extended by this class
- * @param string $seq_name name of the sequence to be created
- * @param string $start start value of the sequence; default is 1
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function createSequence($seq_name, $start = 1)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $sequence_name = $db->quoteIdentifier($db->getSequenceName($seq_name), true);
- $query = "CREATE SEQUENCE $sequence_name START WITH $start INCREMENT BY 1 NOCACHE";
- $query.= ($start < 1 ? " MINVALUE $start" : '');
- return $db->exec($query);
- }
-
- // }}}
- // {{{ dropSequence()
-
- /**
- * drop existing sequence
- *
- * @param object $db database object that is extended by this class
- * @param string $seq_name name of the sequence to be dropped
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function dropSequence($seq_name)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $sequence_name = $db->quoteIdentifier($db->getSequenceName($seq_name), true);
- return $db->exec("DROP SEQUENCE $sequence_name");
- }
-
- // }}}
- // {{{ listSequences()
-
- /**
- * list all sequences in the current database
- *
- * @param string owner, the current is default
- * @return mixed array of sequence names on success, a MDB2 error on failure
- * @access public
- */
- function listSequences($owner = null)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- if (empty($owner)) {
- $owner = $db->dsn['username'];
- }
-
- $query = 'SELECT sequence_name
- FROM sys.all_sequences
- WHERE (sequence_owner=? OR sequence_owner=?)';
- $stmt = $db->prepare($query);
- if (PEAR::isError($stmt)) {
- return $stmt;
- }
- $result = $stmt->execute(array($owner, strtoupper($owner)));
- if (PEAR::isError($result)) {
- return $result;
- }
- $col = $result->fetchCol();
- if (PEAR::isError($col)) {
- return $col;
- }
- $result->free();
-
- foreach ($col as $k => $v) {
- $col[$k] = $this->_fixSequenceName($v);
- }
-
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE
- && $db->options['field_case'] == CASE_LOWER
- ) {
- $col = array_map(($db->options['field_case'] == CASE_LOWER ? 'strtolower' : 'strtoupper'), $col);
- }
- return $col;
- }
-}
-?> \ No newline at end of file
diff --git a/3rdparty/MDB2/Driver/Manager/pgsql.php b/3rdparty/MDB2/Driver/Manager/pgsql.php
deleted file mode 100644
index 3e70f3a3b25..00000000000
--- a/3rdparty/MDB2/Driver/Manager/pgsql.php
+++ /dev/null
@@ -1,990 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2008 Manuel Lemos, Tomas V.V.Cox, |
-// | Stig. S. Bakken, Lukas Smith |
-// | All rights reserved. |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
-// | API as well as database abstraction for PHP applications. |
-// | This LICENSE is in the BSD license style. |
-// | |
-// | Redistribution and use in source and binary forms, with or without |
-// | modification, are permitted provided that the following conditions |
-// | are met: |
-// | |
-// | Redistributions of source code must retain the above copyright |
-// | notice, this list of conditions and the following disclaimer. |
-// | |
-// | Redistributions in binary form must reproduce the above copyright |
-// | notice, this list of conditions and the following disclaimer in the |
-// | documentation and/or other materials provided with the distribution. |
-// | |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission. |
-// | |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-// | POSSIBILITY OF SUCH DAMAGE. |
-// +----------------------------------------------------------------------+
-// | Author: Paul Cooper <pgc@ucecom.com> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-require_once 'MDB2/Driver/Manager/Common.php';
-
-/**
- * MDB2 MySQL driver for the management modules
- *
- * @package MDB2
- * @category Database
- * @author Paul Cooper <pgc@ucecom.com>
- */
-class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common
-{
- // {{{ createDatabase()
-
- /**
- * create a new database
- *
- * @param string $name name of the database that should be created
- * @param array $options array with charset info
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function createDatabase($name, $options = array())
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $name = $db->quoteIdentifier($name, true);
- $query = 'CREATE DATABASE ' . $name;
- if (!empty($options['charset'])) {
- $query .= ' WITH ENCODING ' . $db->quote($options['charset'], 'text');
- }
- return $db->standaloneQuery($query, null, true);
- }
-
- // }}}
- // {{{ alterDatabase()
-
- /**
- * alter an existing database
- *
- * @param string $name name of the database that is intended to be changed
- * @param array $options array with name, owner info
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function alterDatabase($name, $options = array())
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $query = '';
- if (!empty($options['name'])) {
- $query .= ' RENAME TO ' . $options['name'];
- }
- if (!empty($options['owner'])) {
- $query .= ' OWNER TO ' . $options['owner'];
- }
-
- if (empty($query)) {
- return MDB2_OK;
- }
-
- $query = 'ALTER DATABASE '. $db->quoteIdentifier($name, true) . $query;
- return $db->standaloneQuery($query, null, true);
- }
-
- // }}}
- // {{{ dropDatabase()
-
- /**
- * drop an existing database
- *
- * @param string $name name of the database that should be dropped
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function dropDatabase($name)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $name = $db->quoteIdentifier($name, true);
- $query = "DROP DATABASE $name";
- return $db->standaloneQuery($query, null, true);
- }
-
- // }}}
- // {{{ _getAdvancedFKOptions()
-
- /**
- * Return the FOREIGN KEY query section dealing with non-standard options
- * as MATCH, INITIALLY DEFERRED, ON UPDATE, ...
- *
- * @param array $definition
- * @return string
- * @access protected
- */
- function _getAdvancedFKOptions($definition)
- {
- $query = '';
- if (!empty($definition['match'])) {
- $query .= ' MATCH '.$definition['match'];
- }
- if (!empty($definition['onupdate'])) {
- $query .= ' ON UPDATE '.$definition['onupdate'];
- }
- if (!empty($definition['ondelete'])) {
- $query .= ' ON DELETE '.$definition['ondelete'];
- }
- if (!empty($definition['deferrable'])) {
- $query .= ' DEFERRABLE';
- } else {
- $query .= ' NOT DEFERRABLE';
- }
- if (!empty($definition['initiallydeferred'])) {
- $query .= ' INITIALLY DEFERRED';
- } else {
- $query .= ' INITIALLY IMMEDIATE';
- }
- return $query;
- }
-
- // }}}
- // {{{ truncateTable()
-
- /**
- * Truncate an existing table (if the TRUNCATE TABLE syntax is not supported,
- * it falls back to a DELETE FROM TABLE query)
- *
- * @param string $name name of the table that should be truncated
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function truncateTable($name)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $name = $db->quoteIdentifier($name, true);
- $result = $db->exec("TRUNCATE TABLE $name");
- if (MDB2::isError($result)) {
- return $result;
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ vacuum()
-
- /**
- * Optimize (vacuum) all the tables in the db (or only the specified table)
- * and optionally run ANALYZE.
- *
- * @param string $table table name (all the tables if empty)
- * @param array $options an array with driver-specific options:
- * - timeout [int] (in seconds) [mssql-only]
- * - analyze [boolean] [pgsql and mysql]
- * - full [boolean] [pgsql-only]
- * - freeze [boolean] [pgsql-only]
- *
- * @return mixed MDB2_OK success, a MDB2 error on failure
- * @access public
- */
- function vacuum($table = null, $options = array())
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
- $query = 'VACUUM';
-
- if (!empty($options['full'])) {
- $query .= ' FULL';
- }
- if (!empty($options['freeze'])) {
- $query .= ' FREEZE';
- }
- if (!empty($options['analyze'])) {
- $query .= ' ANALYZE';
- }
-
- if (!empty($table)) {
- $query .= ' '.$db->quoteIdentifier($table, true);
- }
- $result = $db->exec($query);
- if (MDB2::isError($result)) {
- return $result;
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ alterTable()
-
- /**
- * alter an existing table
- *
- * @param string $name name of the table that is intended to be changed.
- * @param array $changes associative array that contains the details of each type
- * of change that is intended to be performed. The types of
- * changes that are currently supported are defined as follows:
- *
- * name
- *
- * New name for the table.
- *
- * add
- *
- * Associative array with the names of fields to be added as
- * indexes of the array. The value of each entry of the array
- * should be set to another associative array with the properties
- * of the fields to be added. The properties of the fields should
- * be the same as defined by the MDB2 parser.
- *
- *
- * remove
- *
- * Associative array with the names of fields to be removed as indexes
- * of the array. Currently the values assigned to each entry are ignored.
- * An empty array should be used for future compatibility.
- *
- * rename
- *
- * Associative array with the names of fields to be renamed as indexes
- * of the array. The value of each entry of the array should be set to
- * another associative array with the entry named name with the new
- * field name and the entry named Declaration that is expected to contain
- * the portion of the field declaration already in DBMS specific SQL code
- * as it is used in the CREATE TABLE statement.
- *
- * change
- *
- * Associative array with the names of the fields to be changed as indexes
- * of the array. Keep in mind that if it is intended to change either the
- * name of a field and any other properties, the change array entries
- * should have the new names of the fields as array indexes.
- *
- * The value of each entry of the array should be set to another associative
- * array with the properties of the fields to that are meant to be changed as
- * array entries. These entries should be assigned to the new values of the
- * respective properties. The properties of the fields should be the same
- * as defined by the MDB2 parser.
- *
- * Example
- * array(
- * 'name' => 'userlist',
- * 'add' => array(
- * 'quota' => array(
- * 'type' => 'integer',
- * 'unsigned' => 1
- * )
- * ),
- * 'remove' => array(
- * 'file_limit' => array(),
- * 'time_limit' => array()
- * ),
- * 'change' => array(
- * 'name' => array(
- * 'length' => '20',
- * 'definition' => array(
- * 'type' => 'text',
- * 'length' => 20,
- * ),
- * )
- * ),
- * 'rename' => array(
- * 'sex' => array(
- * 'name' => 'gender',
- * 'definition' => array(
- * 'type' => 'text',
- * 'length' => 1,
- * 'default' => 'M',
- * ),
- * )
- * )
- * )
- *
- * @param boolean $check indicates whether the function should just check if the DBMS driver
- * can perform the requested table alterations if the value is true or
- * actually perform them otherwise.
- * @access public
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- */
- function alterTable($name, $changes, $check)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- foreach ($changes as $change_name => $change) {
- switch ($change_name) {
- case 'add':
- case 'remove':
- case 'change':
- case 'name':
- case 'rename':
- break;
- default:
- return $db->raiseError(MDB2_ERROR_CANNOT_ALTER, null, null,
- 'change type "'.$change_name.'\" not yet supported', __FUNCTION__);
- }
- }
-
- if ($check) {
- return MDB2_OK;
- }
-
- $unquoted_name = $name;
- $name = $db->quoteIdentifier($name, true);
-
- if (!empty($changes['remove']) && is_array($changes['remove'])) {
- foreach ($changes['remove'] as $field_name => $field) {
- $field_name = $db->quoteIdentifier($field_name, true);
- $query = 'DROP ' . $field_name;
- $result = $db->exec("ALTER TABLE $name $query");
- if (PEAR::isError($result)) {
- return $result;
- }
- }
- }
-
- if (!empty($changes['rename']) && is_array($changes['rename'])) {
- foreach ($changes['rename'] as $field_name => $field) {
- $field_name = $db->quoteIdentifier($field_name, true);
- $result = $db->exec("ALTER TABLE $name RENAME COLUMN $field_name TO ".$db->quoteIdentifier($field['name'], true));
- if (PEAR::isError($result)) {
- return $result;
- }
- }
- }
-
- if (!empty($changes['add']) && is_array($changes['add'])) {
- foreach ($changes['add'] as $field_name => $field) {
- $query = 'ADD ' . $db->getDeclaration($field['type'], $field_name, $field);
- $result = $db->exec("ALTER TABLE $name $query");
- if (PEAR::isError($result)) {
- return $result;
- }
- }
- }
-
- if (!empty($changes['change']) && is_array($changes['change'])) {
- foreach ($changes['change'] as $field_name => $field) {
- $unquoted_field_name = $field_name;
- $field_name = $db->quoteIdentifier($field_name, true);
- if (!empty($field['definition']['type'])) {
- $server_info = $db->getServerVersion();
- if (PEAR::isError($server_info)) {
- return $server_info;
- }
- if (is_array($server_info) && $server_info['major'] < 8) {
- return $db->raiseError(MDB2_ERROR_CANNOT_ALTER, null, null,
- 'changing column type for "'.$change_name.'\" requires PostgreSQL 8.0 or above', __FUNCTION__);
- }
- $db->loadModule('Datatype', null, true);
- $type = $db->datatype->getTypeDeclaration($field['definition']);
- if($type=='SERIAL PRIMARY KEY'){//not correct when altering a table, since serials arent a real type
- $type='INTEGER';//use integer instead
- }
- $query = "ALTER $field_name TYPE $type USING CAST($field_name AS $type)";
- $result = $db->exec("ALTER TABLE $name $query");
- if (PEAR::isError($result)) {
- return $result;
- }
- }
- if (array_key_exists('autoincrement', $field['definition'])) {
- $query = "ALTER $field_name SET DEFAULT nextval(".$db->quote($unquoted_name.'_'.$unquoted_field_name.'_seq', 'text').")";
- $result = $db->exec("ALTER TABLE $name $query");
- if (PEAR::isError($result)) {
- return $result;
- }
- }
- elseif (array_key_exists('default', $field['definition'])) {
- $query = "ALTER $field_name SET DEFAULT ".$db->quote($field['definition']['default'], $field['definition']['type']);
- $result = $db->exec("ALTER TABLE $name $query");
- if (PEAR::isError($result)) {
- return $result;
- }
- }
- if (array_key_exists('notnull', $field['definition'])) {
- $query = "ALTER $field_name ".($field['definition']['notnull'] ? 'SET' : 'DROP').' NOT NULL';
- $result = $db->exec("ALTER TABLE $name $query");
- if (PEAR::isError($result)) {
- return $result;
- }
- }
- }
- }
-
- if (!empty($changes['name'])) {
- $change_name = $db->quoteIdentifier($changes['name'], true);
- $result = $db->exec("ALTER TABLE $name RENAME TO ".$change_name);
- if (PEAR::isError($result)) {
- return $result;
- }
- }
-
- return MDB2_OK;
- }
-
- // }}}
- // {{{ listDatabases()
-
- /**
- * list all databases
- *
- * @return mixed array of database names on success, a MDB2 error on failure
- * @access public
- */
- function listDatabases()
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $query = 'SELECT datname FROM pg_database';
- $result2 = $db->standaloneQuery($query, array('text'), false);
- if (!MDB2::isResultCommon($result2)) {
- return $result2;
- }
-
- $result = $result2->fetchCol();
- $result2->free();
- if (PEAR::isError($result)) {
- return $result;
- }
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $result = array_map(($db->options['field_case'] == CASE_LOWER ? 'strtolower' : 'strtoupper'), $result);
- }
- return $result;
- }
-
- // }}}
- // {{{ listUsers()
-
- /**
- * list all users
- *
- * @return mixed array of user names on success, a MDB2 error on failure
- * @access public
- */
- function listUsers()
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $query = 'SELECT usename FROM pg_user';
- $result2 = $db->standaloneQuery($query, array('text'), false);
- if (!MDB2::isResultCommon($result2)) {
- return $result2;
- }
-
- $result = $result2->fetchCol();
- $result2->free();
- return $result;
- }
-
- // }}}
- // {{{ listViews()
-
- /**
- * list all views in the current database
- *
- * @return mixed array of view names on success, a MDB2 error on failure
- * @access public
- */
- function listViews($database = null)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $query = "SELECT viewname
- FROM pg_views
- WHERE schemaname NOT IN ('pg_catalog', 'information_schema')
- AND viewname !~ '^pg_'";
- $result = $db->queryCol($query);
- if (PEAR::isError($result)) {
- return $result;
- }
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $result = array_map(($db->options['field_case'] == CASE_LOWER ? 'strtolower' : 'strtoupper'), $result);
- }
- return $result;
- }
-
- // }}}
- // {{{ listTableViews()
-
- /**
- * list the views in the database that reference a given table
- *
- * @param string table for which all referenced views should be found
- * @return mixed array of view names on success, a MDB2 error on failure
- * @access public
- */
- function listTableViews($table)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $query = 'SELECT viewname FROM pg_views NATURAL JOIN pg_tables';
- $query.= ' WHERE tablename ='.$db->quote($table, 'text');
- $result = $db->queryCol($query);
- if (PEAR::isError($result)) {
- return $result;
- }
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $result = array_map(($db->options['field_case'] == CASE_LOWER ? 'strtolower' : 'strtoupper'), $result);
- }
- return $result;
- }
-
- // }}}
- // {{{ listFunctions()
-
- /**
- * list all functions in the current database
- *
- * @return mixed array of function names on success, a MDB2 error on failure
- * @access public
- */
- function listFunctions()
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $query = "
- SELECT
- proname
- FROM
- pg_proc pr,
- pg_type tp
- WHERE
- tp.oid = pr.prorettype
- AND pr.proisagg = FALSE
- AND tp.typname <> 'trigger'
- AND pr.pronamespace IN
- (SELECT oid FROM pg_namespace WHERE nspname NOT LIKE 'pg_%' AND nspname != 'information_schema')";
- $result = $db->queryCol($query);
- if (PEAR::isError($result)) {
- return $result;
- }
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $result = array_map(($db->options['field_case'] == CASE_LOWER ? 'strtolower' : 'strtoupper'), $result);
- }
- return $result;
- }
-
- // }}}
- // {{{ listTableTriggers()
-
- /**
- * list all triggers in the database that reference a given table
- *
- * @param string table for which all referenced triggers should be found
- * @return mixed array of trigger names on success, a MDB2 error on failure
- * @access public
- */
- function listTableTriggers($table = null)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $query = 'SELECT trg.tgname AS trigger_name
- FROM pg_trigger trg,
- pg_class tbl
- WHERE trg.tgrelid = tbl.oid';
- if (null !== $table) {
- $table = $db->quote(strtoupper($table), 'text');
- $query .= " AND UPPER(tbl.relname) = $table";
- }
- $result = $db->queryCol($query);
- if (PEAR::isError($result)) {
- return $result;
- }
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $result = array_map(($db->options['field_case'] == CASE_LOWER ? 'strtolower' : 'strtoupper'), $result);
- }
- return $result;
- }
-
- // }}}
- // {{{ listTables()
-
- /**
- * list all tables in the current database
- *
- * @return mixed array of table names on success, a MDB2 error on failure
- * @access public
- */
- function listTables($database = null)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- // gratuitously stolen from PEAR DB _getSpecialQuery in pgsql.php
- $query = 'SELECT c.relname AS "Name"'
- . ' FROM pg_class c, pg_user u'
- . ' WHERE c.relowner = u.usesysid'
- . " AND c.relkind = 'r'"
- . ' AND NOT EXISTS'
- . ' (SELECT 1 FROM pg_views'
- . ' WHERE viewname = c.relname)'
- . " AND c.relname !~ '^(pg_|sql_)'"
- . ' UNION'
- . ' SELECT c.relname AS "Name"'
- . ' FROM pg_class c'
- . " WHERE c.relkind = 'r'"
- . ' AND NOT EXISTS'
- . ' (SELECT 1 FROM pg_views'
- . ' WHERE viewname = c.relname)'
- . ' AND NOT EXISTS'
- . ' (SELECT 1 FROM pg_user'
- . ' WHERE usesysid = c.relowner)'
- . " AND c.relname !~ '^pg_'";
- $result = $db->queryCol($query);
- if (PEAR::isError($result)) {
- return $result;
- }
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $result = array_map(($db->options['field_case'] == CASE_LOWER ? 'strtolower' : 'strtoupper'), $result);
- }
- return $result;
- }
-
- // }}}
- // {{{ listTableFields()
-
- /**
- * list all fields in a table in the current database
- *
- * @param string $table name of table that should be used in method
- * @return mixed array of field names on success, a MDB2 error on failure
- * @access public
- */
- function listTableFields($table)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- list($schema, $table) = $this->splitTableSchema($table);
-
- $table = $db->quoteIdentifier($table, true);
- if (!empty($schema)) {
- $table = $db->quoteIdentifier($schema, true) . '.' .$table;
- }
- $db->setLimit(1);
- $result2 = $db->query("SELECT * FROM $table");
- if (PEAR::isError($result2)) {
- return $result2;
- }
- $result = $result2->getColumnNames();
- $result2->free();
- if (PEAR::isError($result)) {
- return $result;
- }
- return array_flip($result);
- }
-
- // }}}
- // {{{ listTableIndexes()
-
- /**
- * list all indexes in a table
- *
- * @param string $table name of table that should be used in method
- * @return mixed array of index names on success, a MDB2 error on failure
- * @access public
- */
- function listTableIndexes($table)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- list($schema, $table) = $this->splitTableSchema($table);
-
- $table = $db->quote($table, 'text');
- $subquery = "SELECT indexrelid
- FROM pg_index
- LEFT JOIN pg_class ON pg_class.oid = pg_index.indrelid
- LEFT JOIN pg_namespace ON pg_class.relnamespace = pg_namespace.oid
- WHERE pg_class.relname = $table
- AND indisunique != 't'
- AND indisprimary != 't'";
- if (!empty($schema)) {
- $subquery .= ' AND pg_namespace.nspname = '.$db->quote($schema, 'text');
- }
- $query = "SELECT relname FROM pg_class WHERE oid IN ($subquery)";
- $indexes = $db->queryCol($query, 'text');
- if (PEAR::isError($indexes)) {
- return $indexes;
- }
-
- $result = array();
- foreach ($indexes as $index) {
- $index = $this->_fixIndexName($index);
- if (!empty($index)) {
- $result[$index] = true;
- }
- }
-
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $result = array_change_key_case($result, $db->options['field_case']);
- }
- return array_keys($result);
- }
-
- // }}}
- // {{{ dropConstraint()
-
- /**
- * drop existing constraint
- *
- * @param string $table name of table that should be used in method
- * @param string $name name of the constraint to be dropped
- * @param string $primary hint if the constraint is primary
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function dropConstraint($table, $name, $primary = false)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- // is it an UNIQUE index?
- $query = 'SELECT relname
- FROM pg_class
- WHERE oid IN (
- SELECT indexrelid
- FROM pg_index, pg_class
- WHERE pg_class.relname = '.$db->quote($table, 'text').'
- AND pg_class.oid = pg_index.indrelid
- AND indisunique = \'t\')
- EXCEPT
- SELECT conname
- FROM pg_constraint, pg_class
- WHERE pg_constraint.conrelid = pg_class.oid
- AND relname = '. $db->quote($table, 'text');
- $unique = $db->queryCol($query, 'text');
- if (PEAR::isError($unique) || empty($unique)) {
- // not an UNIQUE index, maybe a CONSTRAINT
- return parent::dropConstraint($table, $name, $primary);
- }
-
- if (in_array($name, $unique)) {
- $result = $db->exec('DROP INDEX '.$db->quoteIdentifier($name, true));
- if (MDB2::isError($result)) {
- return $result;
- }
- return MDB2_OK;
- }
- $idxname = $db->getIndexName($name);
- if (in_array($idxname, $unique)) {
- $result = $db->exec('DROP INDEX '.$db->quoteIdentifier($idxname, true));
- if (MDB2::isError($result)) {
- return $result;
- }
- return MDB2_OK;
- }
- return $db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- $name . ' is not an existing constraint for table ' . $table, __FUNCTION__);
- }
-
- // }}}
- // {{{ listTableConstraints()
-
- /**
- * list all constraints in a table
- *
- * @param string $table name of table that should be used in method
- * @return mixed array of constraint names on success, a MDB2 error on failure
- * @access public
- */
- function listTableConstraints($table)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- list($schema, $table) = $this->splitTableSchema($table);
-
- $table = $db->quote($table, 'text');
- $query = 'SELECT conname
- FROM pg_constraint
- LEFT JOIN pg_class ON pg_constraint.conrelid = pg_class.oid
- LEFT JOIN pg_namespace ON pg_class.relnamespace = pg_namespace.oid
- WHERE relname = ' .$table;
- if (!empty($schema)) {
- $query .= ' AND pg_namespace.nspname = ' . $db->quote($schema, 'text');
- }
- $query .= '
- UNION DISTINCT
- SELECT relname
- FROM pg_class
- WHERE oid IN (
- SELECT indexrelid
- FROM pg_index
- LEFT JOIN pg_class ON pg_class.oid = pg_index.indrelid
- LEFT JOIN pg_namespace ON pg_class.relnamespace = pg_namespace.oid
- WHERE pg_class.relname = '.$table.'
- AND indisunique = \'t\'';
- if (!empty($schema)) {
- $query .= ' AND pg_namespace.nspname = ' . $db->quote($schema, 'text');
- }
- $query .= ')';
- $constraints = $db->queryCol($query);
- if (PEAR::isError($constraints)) {
- return $constraints;
- }
-
- $result = array();
- foreach ($constraints as $constraint) {
- $constraint = $this->_fixIndexName($constraint);
- if (!empty($constraint)) {
- $result[$constraint] = true;
- }
- }
-
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE
- && $db->options['field_case'] == CASE_LOWER
- ) {
- $result = array_change_key_case($result, $db->options['field_case']);
- }
- return array_keys($result);
- }
-
- // }}}
- // {{{ createSequence()
-
- /**
- * create sequence
- *
- * @param string $seq_name name of the sequence to be created
- * @param string $start start value of the sequence; default is 1
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function createSequence($seq_name, $start = 1)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $sequence_name = $db->quoteIdentifier($db->getSequenceName($seq_name), true);
- $result = $db->exec("CREATE SEQUENCE $sequence_name INCREMENT 1".
- ($start < 1 ? " MINVALUE $start" : '')." START $start");
- if (MDB2::isError($result)) {
- return $result;
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ dropSequence()
-
- /**
- * drop existing sequence
- *
- * @param string $seq_name name of the sequence to be dropped
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function dropSequence($seq_name)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $sequence_name = $db->quoteIdentifier($db->getSequenceName($seq_name), true);
- $result = $db->exec("DROP SEQUENCE $sequence_name");
- if (MDB2::isError($result)) {
- return $result;
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ listSequences()
-
- /**
- * list all sequences in the current database
- *
- * @return mixed array of sequence names on success, a MDB2 error on failure
- * @access public
- */
- function listSequences($database = null)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $query = "SELECT relname FROM pg_class WHERE relkind = 'S' AND relnamespace IN";
- $query.= "(SELECT oid FROM pg_namespace WHERE nspname NOT LIKE 'pg_%' AND nspname != 'information_schema')";
- $table_names = $db->queryCol($query);
- if (PEAR::isError($table_names)) {
- return $table_names;
- }
- $result = array();
- foreach ($table_names as $table_name) {
- $result[] = $this->_fixSequenceName($table_name);
- }
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $result = array_map(($db->options['field_case'] == CASE_LOWER ? 'strtolower' : 'strtoupper'), $result);
- }
- return $result;
- }
-}
-?>
diff --git a/3rdparty/MDB2/Driver/Manager/sqlite.php b/3rdparty/MDB2/Driver/Manager/sqlite.php
deleted file mode 100644
index 1e7efe3e743..00000000000
--- a/3rdparty/MDB2/Driver/Manager/sqlite.php
+++ /dev/null
@@ -1,1390 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2008 Manuel Lemos, Tomas V.V.Cox, |
-// | Stig. S. Bakken, Lukas Smith, Lorenzo Alberton |
-// | All rights reserved. |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
-// | API as well as database abstraction for PHP applications. |
-// | This LICENSE is in the BSD license style. |
-// | |
-// | Redistribution and use in source and binary forms, with or without |
-// | modification, are permitted provided that the following conditions |
-// | are met: |
-// | |
-// | Redistributions of source code must retain the above copyright |
-// | notice, this list of conditions and the following disclaimer. |
-// | |
-// | Redistributions in binary form must reproduce the above copyright |
-// | notice, this list of conditions and the following disclaimer in the |
-// | documentation and/or other materials provided with the distribution. |
-// | |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission. |
-// | |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-// | POSSIBILITY OF SUCH DAMAGE. |
-// +----------------------------------------------------------------------+
-// | Authors: Lukas Smith <smith@pooteeweet.org> |
-// | Lorenzo Alberton <l.alberton@quipo.it> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-
-require_once 'MDB2/Driver/Manager/Common.php';
-
-/**
- * MDB2 SQLite driver for the management modules
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- * @author Lorenzo Alberton <l.alberton@quipo.it>
- */
-class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
-{
- // {{{ createDatabase()
-
- /**
- * create a new database
- *
- * @param string $name name of the database that should be created
- * @param array $options array with charset info
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function createDatabase($name, $options = array())
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $database_file = $db->_getDatabaseFile($name);
- if (file_exists($database_file)) {
- return $db->raiseError(MDB2_ERROR_ALREADY_EXISTS, null, null,
- 'database already exists', __FUNCTION__);
- }
- $php_errormsg = '';
- $handle = @sqlite_open($database_file, $db->dsn['mode'], $php_errormsg);
- if (!$handle) {
- return $db->raiseError(MDB2_ERROR_CANNOT_CREATE, null, null,
- (isset($php_errormsg) ? $php_errormsg : 'could not create the database file'), __FUNCTION__);
- }
- if (!empty($options['charset'])) {
- $query = 'PRAGMA encoding = ' . $db->quote($options['charset'], 'text');
- @sqlite_query($query, $handle);
- }
- @sqlite_close($handle);
- return MDB2_OK;
- }
-
- // }}}
- // {{{ dropDatabase()
-
- /**
- * drop an existing database
- *
- * @param string $name name of the database that should be dropped
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function dropDatabase($name)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $database_file = $db->_getDatabaseFile($name);
- if (!@file_exists($database_file)) {
- return $db->raiseError(MDB2_ERROR_CANNOT_DROP, null, null,
- 'database does not exist', __FUNCTION__);
- }
- $result = @unlink($database_file);
- if (!$result) {
- return $db->raiseError(MDB2_ERROR_CANNOT_DROP, null, null,
- (isset($php_errormsg) ? $php_errormsg : 'could not remove the database file'), __FUNCTION__);
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ _getAdvancedFKOptions()
-
- /**
- * Return the FOREIGN KEY query section dealing with non-standard options
- * as MATCH, INITIALLY DEFERRED, ON UPDATE, ...
- *
- * @param array $definition
- * @return string
- * @access protected
- */
- function _getAdvancedFKOptions($definition)
- {
- $query = '';
- if (!empty($definition['match'])) {
- $query .= ' MATCH '.$definition['match'];
- }
- if (!empty($definition['onupdate']) && (strtoupper($definition['onupdate']) != 'NO ACTION')) {
- $query .= ' ON UPDATE '.$definition['onupdate'];
- }
- if (!empty($definition['ondelete']) && (strtoupper($definition['ondelete']) != 'NO ACTION')) {
- $query .= ' ON DELETE '.$definition['ondelete'];
- }
- if (!empty($definition['deferrable'])) {
- $query .= ' DEFERRABLE';
- } else {
- $query .= ' NOT DEFERRABLE';
- }
- if (!empty($definition['initiallydeferred'])) {
- $query .= ' INITIALLY DEFERRED';
- } else {
- $query .= ' INITIALLY IMMEDIATE';
- }
- return $query;
- }
-
- // }}}
- // {{{ _getCreateTableQuery()
-
- /**
- * Create a basic SQL query for a new table creation
- * @param string $name Name of the database that should be created
- * @param array $fields Associative array that contains the definition of each field of the new table
- * @param array $options An associative array of table options
- * @return mixed string (the SQL query) on success, a MDB2 error on failure
- * @see createTable()
- */
- function _getCreateTableQuery($name, $fields, $options = array())
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- if (!$name) {
- return $db->raiseError(MDB2_ERROR_CANNOT_CREATE, null, null,
- 'no valid table name specified', __FUNCTION__);
- }
- if (empty($fields)) {
- return $db->raiseError(MDB2_ERROR_CANNOT_CREATE, null, null,
- 'no fields specified for table "'.$name.'"', __FUNCTION__);
- }
- $query_fields = $this->getFieldDeclarationList($fields);
- if (PEAR::isError($query_fields)) {
- return $query_fields;
- }
- if (!empty($options['primary'])) {
- $query_fields.= ', PRIMARY KEY ('.implode(', ', array_keys($options['primary'])).')';
- }
- if (!empty($options['foreign_keys'])) {
- foreach ($options['foreign_keys'] as $fkname => $fkdef) {
- if (empty($fkdef)) {
- continue;
- }
- $query_fields.= ', CONSTRAINT '.$fkname.' FOREIGN KEY ('.implode(', ', array_keys($fkdef['fields'])).')';
- $query_fields.= ' REFERENCES '.$fkdef['references']['table'].' ('.implode(', ', array_keys($fkdef['references']['fields'])).')';
- $query_fields.= $this->_getAdvancedFKOptions($fkdef);
- }
- }
-
- $name = $db->quoteIdentifier($name, true);
- $result = 'CREATE ';
- if (!empty($options['temporary'])) {
- $result .= $this->_getTemporaryTableQuery();
- }
- $result .= " TABLE $name ($query_fields)";
- return $result;
- }
-
- // }}}
- // {{{ createTable()
-
- /**
- * create a new table
- *
- * @param string $name Name of the database that should be created
- * @param array $fields Associative array that contains the definition
- * of each field of the new table
- * @param array $options An associative array of table options
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function createTable($name, $fields, $options = array())
- {
- $result = parent::createTable($name, $fields, $options);
- if (PEAR::isError($result)) {
- return $result;
- }
- // create triggers to enforce FOREIGN KEY constraints
- if (!empty($options['foreign_keys'])) {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
- foreach ($options['foreign_keys'] as $fkname => $fkdef) {
- if (empty($fkdef)) {
- continue;
- }
- //set actions to default if not set
- $fkdef['onupdate'] = empty($fkdef['onupdate']) ? $db->options['default_fk_action_onupdate'] : strtoupper($fkdef['onupdate']);
- $fkdef['ondelete'] = empty($fkdef['ondelete']) ? $db->options['default_fk_action_ondelete'] : strtoupper($fkdef['ondelete']);
-
- $trigger_names = array(
- 'insert' => $fkname.'_insert_trg',
- 'update' => $fkname.'_update_trg',
- 'pk_update' => $fkname.'_pk_update_trg',
- 'pk_delete' => $fkname.'_pk_delete_trg',
- );
-
- //create the [insert|update] triggers on the FK table
- $table_fields = array_keys($fkdef['fields']);
- $referenced_fields = array_keys($fkdef['references']['fields']);
- $query = 'CREATE TRIGGER %s BEFORE %s ON '.$name
- .' FOR EACH ROW BEGIN'
- .' SELECT RAISE(ROLLBACK, \'%s on table "'.$name.'" violates FOREIGN KEY constraint "'.$fkname.'"\')'
- .' WHERE (SELECT ';
- $aliased_fields = array();
- foreach ($referenced_fields as $field) {
- $aliased_fields[] = $fkdef['references']['table'] .'.'.$field .' AS '.$field;
- }
- $query .= implode(',', $aliased_fields)
- .' FROM '.$fkdef['references']['table']
- .' WHERE ';
- $conditions = array();
- for ($i=0; $i<count($table_fields); $i++) {
- $conditions[] = $referenced_fields[$i] .' = NEW.'.$table_fields[$i];
- }
- $query .= implode(' AND ', $conditions).') IS NULL; END;';
- $result = $db->exec(sprintf($query, $trigger_names['insert'], 'INSERT', 'insert'));
- if (PEAR::isError($result)) {
- return $result;
- }
-
- $result = $db->exec(sprintf($query, $trigger_names['update'], 'UPDATE', 'update'));
- if (PEAR::isError($result)) {
- return $result;
- }
-
- //create the ON [UPDATE|DELETE] triggers on the primary table
- $restrict_action = 'SELECT RAISE(ROLLBACK, \'%s on table "'.$name.'" violates FOREIGN KEY constraint "'.$fkname.'"\')'
- .' WHERE (SELECT ';
- $aliased_fields = array();
- foreach ($table_fields as $field) {
- $aliased_fields[] = $name .'.'.$field .' AS '.$field;
- }
- $restrict_action .= implode(',', $aliased_fields)
- .' FROM '.$name
- .' WHERE ';
- $conditions = array();
- $new_values = array();
- $null_values = array();
- for ($i=0; $i<count($table_fields); $i++) {
- $conditions[] = $table_fields[$i] .' = OLD.'.$referenced_fields[$i];
- $new_values[] = $table_fields[$i] .' = NEW.'.$referenced_fields[$i];
- $null_values[] = $table_fields[$i] .' = NULL';
- }
- $conditions2 = array();
- for ($i=0; $i<count($referenced_fields); $i++) {
- $conditions2[] = 'NEW.'.$referenced_fields[$i] .' <> OLD.'.$referenced_fields[$i];
- }
- $restrict_action .= implode(' AND ', $conditions).') IS NOT NULL'
- .' AND (' .implode(' OR ', $conditions2) .')';
-
- $cascade_action_update = 'UPDATE '.$name.' SET '.implode(', ', $new_values) .' WHERE '.implode(' AND ', $conditions);
- $cascade_action_delete = 'DELETE FROM '.$name.' WHERE '.implode(' AND ', $conditions);
- $setnull_action = 'UPDATE '.$name.' SET '.implode(', ', $null_values).' WHERE '.implode(' AND ', $conditions);
-
- if ('SET DEFAULT' == $fkdef['onupdate'] || 'SET DEFAULT' == $fkdef['ondelete']) {
- $db->loadModule('Reverse', null, true);
- $default_values = array();
- foreach ($table_fields as $table_field) {
- $field_definition = $db->reverse->getTableFieldDefinition($name, $field);
- if (PEAR::isError($field_definition)) {
- return $field_definition;
- }
- $default_values[] = $table_field .' = '. $field_definition[0]['default'];
- }
- $setdefault_action = 'UPDATE '.$name.' SET '.implode(', ', $default_values).' WHERE '.implode(' AND ', $conditions);
- }
-
- $query = 'CREATE TRIGGER %s'
- .' %s ON '.$fkdef['references']['table']
- .' FOR EACH ROW BEGIN ';
-
- if ('CASCADE' == $fkdef['onupdate']) {
- $sql_update = sprintf($query, $trigger_names['pk_update'], 'AFTER UPDATE', 'update') . $cascade_action_update. '; END;';
- } elseif ('SET NULL' == $fkdef['onupdate']) {
- $sql_update = sprintf($query, $trigger_names['pk_update'], 'BEFORE UPDATE', 'update') . $setnull_action. '; END;';
- } elseif ('SET DEFAULT' == $fkdef['onupdate']) {
- $sql_update = sprintf($query, $trigger_names['pk_update'], 'BEFORE UPDATE', 'update') . $setdefault_action. '; END;';
- } elseif ('NO ACTION' == $fkdef['onupdate']) {
- $sql_update = sprintf($query.$restrict_action, $trigger_names['pk_update'], 'AFTER UPDATE', 'update') . '; END;';
- } elseif ('RESTRICT' == $fkdef['onupdate']) {
- $sql_update = sprintf($query.$restrict_action, $trigger_names['pk_update'], 'BEFORE UPDATE', 'update') . '; END;';
- }
- if ('CASCADE' == $fkdef['ondelete']) {
- $sql_delete = sprintf($query, $trigger_names['pk_delete'], 'AFTER DELETE', 'delete') . $cascade_action_delete. '; END;';
- } elseif ('SET NULL' == $fkdef['ondelete']) {
- $sql_delete = sprintf($query, $trigger_names['pk_delete'], 'BEFORE DELETE', 'delete') . $setnull_action. '; END;';
- } elseif ('SET DEFAULT' == $fkdef['ondelete']) {
- $sql_delete = sprintf($query, $trigger_names['pk_delete'], 'BEFORE DELETE', 'delete') . $setdefault_action. '; END;';
- } elseif ('NO ACTION' == $fkdef['ondelete']) {
- $sql_delete = sprintf($query.$restrict_action, $trigger_names['pk_delete'], 'AFTER DELETE', 'delete') . '; END;';
- } elseif ('RESTRICT' == $fkdef['ondelete']) {
- $sql_delete = sprintf($query.$restrict_action, $trigger_names['pk_delete'], 'BEFORE DELETE', 'delete') . '; END;';
- }
-
- if (PEAR::isError($result)) {
- return $result;
- }
- $result = $db->exec($sql_delete);
- if (PEAR::isError($result)) {
- return $result;
- }
- $result = $db->exec($sql_update);
- if (PEAR::isError($result)) {
- return $result;
- }
- }
- }
- if (PEAR::isError($result)) {
- return $result;
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ dropTable()
-
- /**
- * drop an existing table
- *
- * @param string $name name of the table that should be dropped
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function dropTable($name)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- //delete the triggers associated to existing FK constraints
- $constraints = $this->listTableConstraints($name);
- if (!PEAR::isError($constraints) && !empty($constraints)) {
- $db->loadModule('Reverse', null, true);
- foreach ($constraints as $constraint) {
- $definition = $db->reverse->getTableConstraintDefinition($name, $constraint);
- if (!PEAR::isError($definition) && !empty($definition['foreign'])) {
- $result = $this->_dropFKTriggers($name, $constraint, $definition['references']['table']);
- if (PEAR::isError($result)) {
- return $result;
- }
- }
- }
- }
-
- $name = $db->quoteIdentifier($name, true);
- $result = $db->exec("DROP TABLE $name");
- if (MDB2::isError($result)) {
- return $result;
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ vacuum()
-
- /**
- * Optimize (vacuum) all the tables in the db (or only the specified table)
- * and optionally run ANALYZE.
- *
- * @param string $table table name (all the tables if empty)
- * @param array $options an array with driver-specific options:
- * - timeout [int] (in seconds) [mssql-only]
- * - analyze [boolean] [pgsql and mysql]
- * - full [boolean] [pgsql-only]
- * - freeze [boolean] [pgsql-only]
- *
- * @return mixed MDB2_OK success, a MDB2 error on failure
- * @access public
- */
- function vacuum($table = null, $options = array())
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $query = 'VACUUM';
- if (!empty($table)) {
- $query .= ' '.$db->quoteIdentifier($table, true);
- }
- $result = $db->exec($query);
- if (MDB2::isError($result)) {
- return $result;
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ alterTable()
-
- /**
- * alter an existing table
- *
- * @param string $name name of the table that is intended to be changed.
- * @param array $changes associative array that contains the details of each type
- * of change that is intended to be performed. The types of
- * changes that are currently supported are defined as follows:
- *
- * name
- *
- * New name for the table.
- *
- * add
- *
- * Associative array with the names of fields to be added as
- * indexes of the array. The value of each entry of the array
- * should be set to another associative array with the properties
- * of the fields to be added. The properties of the fields should
- * be the same as defined by the MDB2 parser.
- *
- *
- * remove
- *
- * Associative array with the names of fields to be removed as indexes
- * of the array. Currently the values assigned to each entry are ignored.
- * An empty array should be used for future compatibility.
- *
- * rename
- *
- * Associative array with the names of fields to be renamed as indexes
- * of the array. The value of each entry of the array should be set to
- * another associative array with the entry named name with the new
- * field name and the entry named Declaration that is expected to contain
- * the portion of the field declaration already in DBMS specific SQL code
- * as it is used in the CREATE TABLE statement.
- *
- * change
- *
- * Associative array with the names of the fields to be changed as indexes
- * of the array. Keep in mind that if it is intended to change either the
- * name of a field and any other properties, the change array entries
- * should have the new names of the fields as array indexes.
- *
- * The value of each entry of the array should be set to another associative
- * array with the properties of the fields to that are meant to be changed as
- * array entries. These entries should be assigned to the new values of the
- * respective properties. The properties of the fields should be the same
- * as defined by the MDB2 parser.
- *
- * Example
- * array(
- * 'name' => 'userlist',
- * 'add' => array(
- * 'quota' => array(
- * 'type' => 'integer',
- * 'unsigned' => 1
- * )
- * ),
- * 'remove' => array(
- * 'file_limit' => array(),
- * 'time_limit' => array()
- * ),
- * 'change' => array(
- * 'name' => array(
- * 'length' => '20',
- * 'definition' => array(
- * 'type' => 'text',
- * 'length' => 20,
- * ),
- * )
- * ),
- * 'rename' => array(
- * 'sex' => array(
- * 'name' => 'gender',
- * 'definition' => array(
- * 'type' => 'text',
- * 'length' => 1,
- * 'default' => 'M',
- * ),
- * )
- * )
- * )
- *
- * @param boolean $check indicates whether the function should just check if the DBMS driver
- * can perform the requested table alterations if the value is true or
- * actually perform them otherwise.
- * @access public
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- */
- function alterTable($name, $changes, $check, $options = array())
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- foreach ($changes as $change_name => $change) {
- switch ($change_name) {
- case 'add':
- case 'remove':
- case 'change':
- case 'name':
- case 'rename':
- break;
- default:
- return $db->raiseError(MDB2_ERROR_CANNOT_ALTER, null, null,
- 'change type "'.$change_name.'" not yet supported', __FUNCTION__);
- }
- }
-
- if ($check) {
- return MDB2_OK;
- }
-
- $db->loadModule('Reverse', null, true);
-
- // actually sqlite 2.x supports no ALTER TABLE at all .. so we emulate it
- $fields = $db->manager->listTableFields($name);
- if (PEAR::isError($fields)) {
- return $fields;
- }
-
- $fields = array_flip($fields);
- foreach ($fields as $field => $value) {
- $definition = $db->reverse->getTableFieldDefinition($name, $field);
- if (PEAR::isError($definition)) {
- return $definition;
- }
- $fields[$field] = $definition[0];
- }
-
- $indexes = $db->manager->listTableIndexes($name);
- if (PEAR::isError($indexes)) {
- return $indexes;
- }
-
- $indexes = array_flip($indexes);
- foreach ($indexes as $index => $value) {
- $definition = $db->reverse->getTableIndexDefinition($name, $index);
- if (PEAR::isError($definition)) {
- return $definition;
- }
- $indexes[$index] = $definition;
- }
-
- $constraints = $db->manager->listTableConstraints($name);
- if (PEAR::isError($constraints)) {
- return $constraints;
- }
-
- if (!array_key_exists('foreign_keys', $options)) {
- $options['foreign_keys'] = array();
- }
- $constraints = array_flip($constraints);
- foreach ($constraints as $constraint => $value) {
- if (!empty($definition['primary'])) {
- if (!array_key_exists('primary', $options)) {
- $options['primary'] = $definition['fields'];
- //remove from the $constraint array, it's already handled by createTable()
- unset($constraints[$constraint]);
- }
- } else {
- $c_definition = $db->reverse->getTableConstraintDefinition($name, $constraint);
- if (PEAR::isError($c_definition)) {
- return $c_definition;
- }
- if (!empty($c_definition['foreign'])) {
- if (!array_key_exists($constraint, $options['foreign_keys'])) {
- $options['foreign_keys'][$constraint] = $c_definition;
- }
- //remove from the $constraint array, it's already handled by createTable()
- unset($constraints[$constraint]);
- } else {
- $constraints[$constraint] = $c_definition;
- }
- }
- }
-
- $name_new = $name;
- $create_order = $select_fields = array_keys($fields);
- foreach ($changes as $change_name => $change) {
- switch ($change_name) {
- case 'add':
- foreach ($change as $field_name => $field) {
- $fields[$field_name] = $field;
- $create_order[] = $field_name;
- }
- break;
- case 'remove':
- foreach ($change as $field_name => $field) {
- unset($fields[$field_name]);
- $select_fields = array_diff($select_fields, array($field_name));
- $create_order = array_diff($create_order, array($field_name));
- }
- break;
- case 'change':
- foreach ($change as $field_name => $field) {
- $fields[$field_name] = $field['definition'];
- }
- break;
- case 'name':
- $name_new = $change;
- break;
- case 'rename':
- foreach ($change as $field_name => $field) {
- unset($fields[$field_name]);
- $fields[$field['name']] = $field['definition'];
- $create_order[array_search($field_name, $create_order)] = $field['name'];
- }
- break;
- default:
- return $db->raiseError(MDB2_ERROR_CANNOT_ALTER, null, null,
- 'change type "'.$change_name.'" not yet supported', __FUNCTION__);
- }
- }
-
- $data = null;
- if (!empty($select_fields)) {
- $query = 'SELECT '.implode(', ', $select_fields).' FROM '.$db->quoteIdentifier($name, true);
- $data = $db->queryAll($query, null, MDB2_FETCHMODE_ORDERED);
- }
-
- $result = $this->dropTable($name);
- if (PEAR::isError($result)) {
- return $result;
- }
-
- $result = $this->createTable($name_new, $fields, $options);
- if (PEAR::isError($result)) {
- return $result;
- }
-
- foreach ($indexes as $index => $definition) {
- $this->createIndex($name_new, $index, $definition);
- }
-
- foreach ($constraints as $constraint => $definition) {
- $this->createConstraint($name_new, $constraint, $definition);
- }
-
- if (!empty($select_fields) && !empty($data)) {
- $query = 'INSERT INTO '.$db->quoteIdentifier($name_new, true);
- $query.= '('.implode(', ', array_slice(array_keys($fields), 0, count($select_fields))).')';
- $query.=' VALUES (?'.str_repeat(', ?', (count($select_fields) - 1)).')';
- $stmt = $db->prepare($query, null, MDB2_PREPARE_MANIP);
- if (PEAR::isError($stmt)) {
- return $stmt;
- }
- foreach ($data as $row) {
- $result = $stmt->execute($row);
- if (PEAR::isError($result)) {
- return $result;
- }
- }
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ listDatabases()
-
- /**
- * list all databases
- *
- * @return mixed array of database names on success, a MDB2 error on failure
- * @access public
- */
- function listDatabases()
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'list databases is not supported', __FUNCTION__);
- }
-
- // }}}
- // {{{ listUsers()
-
- /**
- * list all users
- *
- * @return mixed array of user names on success, a MDB2 error on failure
- * @access public
- */
- function listUsers()
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'list databases is not supported', __FUNCTION__);
- }
-
- // }}}
- // {{{ listViews()
-
- /**
- * list all views in the current database
- *
- * @return mixed array of view names on success, a MDB2 error on failure
- * @access public
- */
- function listViews()
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $query = "SELECT name FROM sqlite_master WHERE type='view' AND sql NOT NULL";
- $result = $db->queryCol($query);
- if (PEAR::isError($result)) {
- return $result;
- }
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $result = array_map(($db->options['field_case'] == CASE_LOWER ? 'strtolower' : 'strtoupper'), $result);
- }
- return $result;
- }
-
- // }}}
- // {{{ listTableViews()
-
- /**
- * list the views in the database that reference a given table
- *
- * @param string table for which all referenced views should be found
- * @return mixed array of view names on success, a MDB2 error on failure
- * @access public
- */
- function listTableViews($table)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $query = "SELECT name, sql FROM sqlite_master WHERE type='view' AND sql NOT NULL";
- $views = $db->queryAll($query, array('text', 'text'), MDB2_FETCHMODE_ASSOC);
- if (PEAR::isError($views)) {
- return $views;
- }
- $result = array();
- foreach ($views as $row) {
- if (preg_match("/^create view .* \bfrom\b\s+\b{$table}\b /i", $row['sql'])) {
- if (!empty($row['name'])) {
- $result[$row['name']] = true;
- }
- }
- }
-
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $result = array_change_key_case($result, $db->options['field_case']);
- }
- return array_keys($result);
- }
-
- // }}}
- // {{{ listTables()
-
- /**
- * list all tables in the current database
- *
- * @return mixed array of table names on success, a MDB2 error on failure
- * @access public
- */
- function listTables()
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $query = "SELECT name FROM sqlite_master WHERE type='table' AND sql NOT NULL ORDER BY name";
- $table_names = $db->queryCol($query);
- if (PEAR::isError($table_names)) {
- return $table_names;
- }
- $result = array();
- foreach ($table_names as $table_name) {
- if (!$this->_fixSequenceName($table_name, true)) {
- $result[] = $table_name;
- }
- }
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $result = array_map(($db->options['field_case'] == CASE_LOWER ? 'strtolower' : 'strtoupper'), $result);
- }
- return $result;
- }
-
- // }}}
- // {{{ listTableFields()
-
- /**
- * list all fields in a table in the current database
- *
- * @param string $table name of table that should be used in method
- * @return mixed array of field names on success, a MDB2 error on failure
- * @access public
- */
- function listTableFields($table)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $result = $db->loadModule('Reverse', null, true);
- if (PEAR::isError($result)) {
- return $result;
- }
- $query = "SELECT sql FROM sqlite_master WHERE type='table' AND ";
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $query.= 'LOWER(name)='.$db->quote(strtolower($table), 'text');
- } else {
- $query.= 'name='.$db->quote($table, 'text');
- }
- $sql = $db->queryOne($query);
- if (PEAR::isError($sql)) {
- return $sql;
- }
- $columns = $db->reverse->_getTableColumns($sql);
- $fields = array();
- foreach ($columns as $column) {
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- if ($db->options['field_case'] == CASE_LOWER) {
- $column['name'] = strtolower($column['name']);
- } else {
- $column['name'] = strtoupper($column['name']);
- }
- } else {
- $column = array_change_key_case($column, $db->options['field_case']);
- }
- $fields[] = $column['name'];
- }
- return $fields;
- }
-
- // }}}
- // {{{ listTableTriggers()
-
- /**
- * list all triggers in the database that reference a given table
- *
- * @param string table for which all referenced triggers should be found
- * @return mixed array of trigger names on success, a MDB2 error on failure
- * @access public
- */
- function listTableTriggers($table = null)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $query = "SELECT name FROM sqlite_master WHERE type='trigger' AND sql NOT NULL";
- if (null !== $table) {
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $query.= ' AND LOWER(tbl_name)='.$db->quote(strtolower($table), 'text');
- } else {
- $query.= ' AND tbl_name='.$db->quote($table, 'text');
- }
- }
- $result = $db->queryCol($query);
- if (PEAR::isError($result)) {
- return $result;
- }
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $result = array_map(($db->options['field_case'] == CASE_LOWER ? 'strtolower' : 'strtoupper'), $result);
- }
- return $result;
- }
-
- // }}}
- // {{{ createIndex()
-
- /**
- * Get the stucture of a field into an array
- *
- * @param string $table name of the table on which the index is to be created
- * @param string $name name of the index to be created
- * @param array $definition associative array that defines properties of the index to be created.
- * Currently, only one property named FIELDS is supported. This property
- * is also an associative with the names of the index fields as array
- * indexes. Each entry of this array is set to another type of associative
- * array that specifies properties of the index that are specific to
- * each field.
- *
- * Currently, only the sorting property is supported. It should be used
- * to define the sorting direction of the index. It may be set to either
- * ascending or descending.
- *
- * Not all DBMS support index sorting direction configuration. The DBMS
- * drivers of those that do not support it ignore this property. Use the
- * function support() to determine whether the DBMS driver can manage indexes.
-
- * Example
- * array(
- * 'fields' => array(
- * 'user_name' => array(
- * 'sorting' => 'ascending'
- * ),
- * 'last_login' => array()
- * )
- * )
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function createIndex($table, $name, $definition)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $table = $db->quoteIdentifier($table, true);
- $name = $db->quoteIdentifier($db->getIndexName($name), true);
- $query = "CREATE INDEX $name ON $table";
- $fields = array();
- foreach ($definition['fields'] as $field_name => $field) {
- $field_string = $db->quoteIdentifier($field_name, true);
- if (!empty($field['sorting'])) {
- switch ($field['sorting']) {
- case 'ascending':
- $field_string.= ' ASC';
- break;
- case 'descending':
- $field_string.= ' DESC';
- break;
- }
- }
- $fields[] = $field_string;
- }
- $query .= ' ('.implode(', ', $fields) . ')';
- $result = $db->exec($query);
- if (MDB2::isError($result)) {
- return $result;
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ dropIndex()
-
- /**
- * drop existing index
- *
- * @param string $table name of table that should be used in method
- * @param string $name name of the index to be dropped
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function dropIndex($table, $name)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $name = $db->getIndexName($name);
- $result = $db->exec("DROP INDEX $name");
- if (MDB2::isError($result)) {
- return $result;
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ listTableIndexes()
-
- /**
- * list all indexes in a table
- *
- * @param string $table name of table that should be used in method
- * @return mixed array of index names on success, a MDB2 error on failure
- * @access public
- */
- function listTableIndexes($table)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $table = $db->quote($table, 'text');
- $query = "SELECT sql FROM sqlite_master WHERE type='index' AND ";
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $query.= 'LOWER(tbl_name)='.strtolower($table);
- } else {
- $query.= "tbl_name=$table";
- }
- $query.= " AND sql NOT NULL ORDER BY name";
- $indexes = $db->queryCol($query, 'text');
- if (PEAR::isError($indexes)) {
- return $indexes;
- }
-
- $result = array();
- foreach ($indexes as $sql) {
- if (preg_match("/^create index ([^ ]+) on /i", $sql, $tmp)) {
- $index = $this->_fixIndexName($tmp[1]);
- if (!empty($index)) {
- $result[$index] = true;
- }
- }
- }
-
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $result = array_change_key_case($result, $db->options['field_case']);
- }
- return array_keys($result);
- }
-
- // }}}
- // {{{ createConstraint()
-
- /**
- * create a constraint on a table
- *
- * @param string $table name of the table on which the constraint is to be created
- * @param string $name name of the constraint to be created
- * @param array $definition associative array that defines properties of the constraint to be created.
- * Currently, only one property named FIELDS is supported. This property
- * is also an associative with the names of the constraint fields as array
- * constraints. Each entry of this array is set to another type of associative
- * array that specifies properties of the constraint that are specific to
- * each field.
- *
- * Example
- * array(
- * 'fields' => array(
- * 'user_name' => array(),
- * 'last_login' => array()
- * )
- * )
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function createConstraint($table, $name, $definition)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- if (!empty($definition['primary'])) {
- return $db->manager->alterTable($table, array(), false, array('primary' => $definition['fields']));
- }
-
- if (!empty($definition['foreign'])) {
- return $db->manager->alterTable($table, array(), false, array('foreign_keys' => array($name => $definition)));
- }
-
- $table = $db->quoteIdentifier($table, true);
- $name = $db->getIndexName($name);
- $query = "CREATE UNIQUE INDEX $name ON $table";
- $fields = array();
- foreach ($definition['fields'] as $field_name => $field) {
- $field_string = $field_name;
- if (!empty($field['sorting'])) {
- switch ($field['sorting']) {
- case 'ascending':
- $field_string.= ' ASC';
- break;
- case 'descending':
- $field_string.= ' DESC';
- break;
- }
- }
- $fields[] = $field_string;
- }
- $query .= ' ('.implode(', ', $fields) . ')';
- $result = $db->exec($query);
- if (MDB2::isError($result)) {
- return $result;
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ dropConstraint()
-
- /**
- * drop existing constraint
- *
- * @param string $table name of table that should be used in method
- * @param string $name name of the constraint to be dropped
- * @param string $primary hint if the constraint is primary
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function dropConstraint($table, $name, $primary = false)
- {
- if ($primary || $name == 'PRIMARY') {
- return $this->alterTable($table, array(), false, array('primary' => null));
- }
-
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- //is it a FK constraint? If so, also delete the associated triggers
- $db->loadModule('Reverse', null, true);
- $definition = $db->reverse->getTableConstraintDefinition($table, $name);
- if (!PEAR::isError($definition) && !empty($definition['foreign'])) {
- //first drop the FK enforcing triggers
- $result = $this->_dropFKTriggers($table, $name, $definition['references']['table']);
- if (PEAR::isError($result)) {
- return $result;
- }
- //then drop the constraint itself
- return $this->alterTable($table, array(), false, array('foreign_keys' => array($name => null)));
- }
-
- $name = $db->getIndexName($name);
- $result = $db->exec("DROP INDEX $name");
- if (MDB2::isError($result)) {
- return $result;
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ _dropFKTriggers()
-
- /**
- * Drop the triggers created to enforce the FOREIGN KEY constraint on the table
- *
- * @param string $table table name
- * @param string $fkname FOREIGN KEY constraint name
- * @param string $referenced_table referenced table name
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access private
- */
- function _dropFKTriggers($table, $fkname, $referenced_table)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $triggers = $this->listTableTriggers($table);
- $triggers2 = $this->listTableTriggers($referenced_table);
- if (!PEAR::isError($triggers2) && !PEAR::isError($triggers)) {
- $triggers = array_merge($triggers, $triggers2);
- $pattern = '/^'.$fkname.'(_pk)?_(insert|update|delete)_trg$/i';
- foreach ($triggers as $trigger) {
- if (preg_match($pattern, $trigger)) {
- $result = $db->exec('DROP TRIGGER '.$trigger);
- if (PEAR::isError($result)) {
- return $result;
- }
- }
- }
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ listTableConstraints()
-
- /**
- * list all constraints in a table
- *
- * @param string $table name of table that should be used in method
- * @return mixed array of constraint names on success, a MDB2 error on failure
- * @access public
- */
- function listTableConstraints($table)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $table = $db->quote($table, 'text');
- $query = "SELECT sql FROM sqlite_master WHERE type='index' AND ";
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $query.= 'LOWER(tbl_name)='.strtolower($table);
- } else {
- $query.= "tbl_name=$table";
- }
- $query.= " AND sql NOT NULL ORDER BY name";
- $indexes = $db->queryCol($query, 'text');
- if (PEAR::isError($indexes)) {
- return $indexes;
- }
-
- $result = array();
- foreach ($indexes as $sql) {
- if (preg_match("/^create unique index ([^ ]+) on /i", $sql, $tmp)) {
- $index = $this->_fixIndexName($tmp[1]);
- if (!empty($index)) {
- $result[$index] = true;
- }
- }
- }
-
- // also search in table definition for PRIMARY KEYs...
- $query = "SELECT sql FROM sqlite_master WHERE type='table' AND ";
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $query.= 'LOWER(name)='.strtolower($table);
- } else {
- $query.= "name=$table";
- }
- $query.= " AND sql NOT NULL ORDER BY name";
- $table_def = $db->queryOne($query, 'text');
- if (PEAR::isError($table_def)) {
- return $table_def;
- }
- if (preg_match("/\bPRIMARY\s+KEY\b/i", $table_def, $tmp)) {
- $result['primary'] = true;
- }
-
- // ...and for FOREIGN KEYs
- if (preg_match_all("/\bCONSTRAINT\b\s+([^\s]+)\s+\bFOREIGN\s+KEY/imsx", $table_def, $tmp)) {
- foreach ($tmp[1] as $fk) {
- $result[$fk] = true;
- }
- }
-
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $result = array_change_key_case($result, $db->options['field_case']);
- }
- return array_keys($result);
- }
-
- // }}}
- // {{{ createSequence()
-
- /**
- * create sequence
- *
- * @param string $seq_name name of the sequence to be created
- * @param string $start start value of the sequence; default is 1
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function createSequence($seq_name, $start = 1)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $sequence_name = $db->quoteIdentifier($db->getSequenceName($seq_name), true);
- $seqcol_name = $db->quoteIdentifier($db->options['seqcol_name'], true);
- $query = "CREATE TABLE $sequence_name ($seqcol_name INTEGER PRIMARY KEY DEFAULT 0 NOT NULL)";
- $res = $db->exec($query);
- if (PEAR::isError($res)) {
- return $res;
- }
- if ($start == 1) {
- return MDB2_OK;
- }
- $res = $db->exec("INSERT INTO $sequence_name ($seqcol_name) VALUES (".($start-1).')');
- if (!PEAR::isError($res)) {
- return MDB2_OK;
- }
- // Handle error
- $result = $db->exec("DROP TABLE $sequence_name");
- if (PEAR::isError($result)) {
- return $db->raiseError($result, null, null,
- 'could not drop inconsistent sequence table', __FUNCTION__);
- }
- return $db->raiseError($res, null, null,
- 'could not create sequence table', __FUNCTION__);
- }
-
- // }}}
- // {{{ dropSequence()
-
- /**
- * drop existing sequence
- *
- * @param string $seq_name name of the sequence to be dropped
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function dropSequence($seq_name)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $sequence_name = $db->quoteIdentifier($db->getSequenceName($seq_name), true);
- $result = $db->exec("DROP TABLE $sequence_name");
- if (MDB2::isError($result)) {
- return $result;
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ listSequences()
-
- /**
- * list all sequences in the current database
- *
- * @return mixed array of sequence names on success, a MDB2 error on failure
- * @access public
- */
- function listSequences()
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $query = "SELECT name FROM sqlite_master WHERE type='table' AND sql NOT NULL ORDER BY name";
- $table_names = $db->queryCol($query);
- if (PEAR::isError($table_names)) {
- return $table_names;
- }
- $result = array();
- foreach ($table_names as $table_name) {
- if ($sqn = $this->_fixSequenceName($table_name, true)) {
- $result[] = $sqn;
- }
- }
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $result = array_map(($db->options['field_case'] == CASE_LOWER ? 'strtolower' : 'strtoupper'), $result);
- }
- return $result;
- }
-
- // }}}
-}
-?>
diff --git a/3rdparty/MDB2/Driver/Native/Common.php b/3rdparty/MDB2/Driver/Native/Common.php
deleted file mode 100644
index 67dc1bddd03..00000000000
--- a/3rdparty/MDB2/Driver/Native/Common.php
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox, |
-// | Stig. S. Bakken, Lukas Smith |
-// | All rights reserved. |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
-// | API as well as database abstraction for PHP applications. |
-// | This LICENSE is in the BSD license style. |
-// | |
-// | Redistribution and use in source and binary forms, with or without |
-// | modification, are permitted provided that the following conditions |
-// | are met: |
-// | |
-// | Redistributions of source code must retain the above copyright |
-// | notice, this list of conditions and the following disclaimer. |
-// | |
-// | Redistributions in binary form must reproduce the above copyright |
-// | notice, this list of conditions and the following disclaimer in the |
-// | documentation and/or other materials provided with the distribution. |
-// | |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission. |
-// | |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-// | POSSIBILITY OF SUCH DAMAGE. |
-// +----------------------------------------------------------------------+
-// | Author: Lukas Smith <smith@pooteeweet.org> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-
-/**
- * Base class for the natuve modules that is extended by each MDB2 driver
- *
- * To load this module in the MDB2 object:
- * $mdb->loadModule('Native');
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Driver_Native_Common extends MDB2_Module_Common
-{
-}
-?> \ No newline at end of file
diff --git a/3rdparty/MDB2/Driver/Native/mysql.php b/3rdparty/MDB2/Driver/Native/mysql.php
deleted file mode 100644
index 48e65a05fd2..00000000000
--- a/3rdparty/MDB2/Driver/Native/mysql.php
+++ /dev/null
@@ -1,60 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox, |
-// | Stig. S. Bakken, Lukas Smith |
-// | All rights reserved. |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
-// | API as well as database abstraction for PHP applications. |
-// | This LICENSE is in the BSD license style. |
-// | |
-// | Redistribution and use in source and binary forms, with or without |
-// | modification, are permitted provided that the following conditions |
-// | are met: |
-// | |
-// | Redistributions of source code must retain the above copyright |
-// | notice, this list of conditions and the following disclaimer. |
-// | |
-// | Redistributions in binary form must reproduce the above copyright |
-// | notice, this list of conditions and the following disclaimer in the |
-// | documentation and/or other materials provided with the distribution. |
-// | |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission. |
-// | |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-// | POSSIBILITY OF SUCH DAMAGE. |
-// +----------------------------------------------------------------------+
-// | Author: Lukas Smith <smith@pooteeweet.org> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-
-require_once 'MDB2/Driver/Native/Common.php';
-
-/**
- * MDB2 MySQL driver for the native module
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Driver_Native_mysql extends MDB2_Driver_Native_Common
-{
-}
-?> \ No newline at end of file
diff --git a/3rdparty/MDB2/Driver/Native/oci8.php b/3rdparty/MDB2/Driver/Native/oci8.php
deleted file mode 100644
index d198f9687a9..00000000000
--- a/3rdparty/MDB2/Driver/Native/oci8.php
+++ /dev/null
@@ -1,60 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox, |
-// | Stig. S. Bakken, Lukas Smith, Frank M. Kromann |
-// | All rights reserved. |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
-// | API as well as database abstraction for PHP applications. |
-// | This LICENSE is in the BSD license style. |
-// | |
-// | Redistribution and use in source and binary forms, with or without |
-// | modification, are permitted provided that the following conditions |
-// | are met: |
-// | |
-// | Redistributions of source code must retain the above copyright |
-// | notice, this list of conditions and the following disclaimer. |
-// | |
-// | Redistributions in binary form must reproduce the above copyright |
-// | notice, this list of conditions and the following disclaimer in the |
-// | documentation and/or other materials provided with the distribution. |
-// | |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission. |
-// | |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-// | POSSIBILITY OF SUCH DAMAGE. |
-// +----------------------------------------------------------------------+
-// | Author: Lukas Smith <smith@pooteeweet.org> |
-// +----------------------------------------------------------------------+
-//
-// $Id: oci8.php 215004 2006-06-18 21:59:05Z lsmith $
-//
-
-require_once 'MDB2/Driver/Native/Common.php';
-
-/**
- * MDB2 Oracle driver for the native module
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@dybnet.de>
- */
-class MDB2_Driver_Native_oci8 extends MDB2_Driver_Native_Common
-{
-}
-?> \ No newline at end of file
diff --git a/3rdparty/MDB2/Driver/Native/pgsql.php b/3rdparty/MDB2/Driver/Native/pgsql.php
deleted file mode 100644
index f4db5eae529..00000000000
--- a/3rdparty/MDB2/Driver/Native/pgsql.php
+++ /dev/null
@@ -1,88 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox, |
-// | Stig. S. Bakken, Lukas Smith |
-// | All rights reserved. |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
-// | API as well as database abstraction for PHP applications. |
-// | This LICENSE is in the BSD license style. |
-// | |
-// | Redistribution and use in source and binary forms, with or without |
-// | modification, are permitted provided that the following conditions |
-// | are met: |
-// | |
-// | Redistributions of source code must retain the above copyright |
-// | notice, this list of conditions and the following disclaimer. |
-// | |
-// | Redistributions in binary form must reproduce the above copyright |
-// | notice, this list of conditions and the following disclaimer in the |
-// | documentation and/or other materials provided with the distribution. |
-// | |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission. |
-// | |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-// | POSSIBILITY OF SUCH DAMAGE. |
-// +----------------------------------------------------------------------+
-// | Author: Paul Cooper <pgc@ucecom.com> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-require_once 'MDB2/Driver/Native/Common.php';
-
-/**
- * MDB2 PostGreSQL driver for the native module
- *
- * @package MDB2
- * @category Database
- * @author Paul Cooper <pgc@ucecom.com>
- */
-class MDB2_Driver_Native_pgsql extends MDB2_Driver_Native_Common
-{
- // }}}
- // {{{ deleteOID()
-
- /**
- * delete an OID
- *
- * @param integer $OID
- * @return mixed MDB2_OK on success or MDB2 Error Object on failure
- * @access public
- */
- function deleteOID($OID)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $connection = $db->getConnection();
- if (PEAR::isError($connection)) {
- return $connection;
- }
-
- if (!@pg_lo_unlink($connection, $OID)) {
- return $db->raiseError(null, null, null,
- 'Unable to unlink OID: '.$OID, __FUNCTION__);
- }
- return MDB2_OK;
- }
-
-}
-?> \ No newline at end of file
diff --git a/3rdparty/MDB2/Driver/Native/sqlite.php b/3rdparty/MDB2/Driver/Native/sqlite.php
deleted file mode 100644
index 4eb796dce7a..00000000000
--- a/3rdparty/MDB2/Driver/Native/sqlite.php
+++ /dev/null
@@ -1,60 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox, |
-// | Stig. S. Bakken, Lukas Smith |
-// | All rights reserved. |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
-// | API as well as database abstraction for PHP applications. |
-// | This LICENSE is in the BSD license style. |
-// | |
-// | Redistribution and use in source and binary forms, with or without |
-// | modification, are permitted provided that the following conditions |
-// | are met: |
-// | |
-// | Redistributions of source code must retain the above copyright |
-// | notice, this list of conditions and the following disclaimer. |
-// | |
-// | Redistributions in binary form must reproduce the above copyright |
-// | notice, this list of conditions and the following disclaimer in the |
-// | documentation and/or other materials provided with the distribution. |
-// | |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission. |
-// | |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-// | POSSIBILITY OF SUCH DAMAGE. |
-// +----------------------------------------------------------------------+
-// | Author: Lukas Smith <smith@pooteeweet.org> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-
-require_once 'MDB2/Driver/Native/Common.php';
-
-/**
- * MDB2 SQLite driver for the native module
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Driver_Native_sqlite extends MDB2_Driver_Native_Common
-{
-}
-?> \ No newline at end of file
diff --git a/3rdparty/MDB2/Driver/Reverse/Common.php b/3rdparty/MDB2/Driver/Reverse/Common.php
deleted file mode 100644
index 2260520835e..00000000000
--- a/3rdparty/MDB2/Driver/Reverse/Common.php
+++ /dev/null
@@ -1,517 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2007 Manuel Lemos, Tomas V.V.Cox, |
-// | Stig. S. Bakken, Lukas Smith |
-// | All rights reserved. |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
-// | API as well as database abstraction for PHP applications. |
-// | This LICENSE is in the BSD license style. |
-// | |
-// | Redistribution and use in source and binary forms, with or without |
-// | modification, are permitted provided that the following conditions |
-// | are met: |
-// | |
-// | Redistributions of source code must retain the above copyright |
-// | notice, this list of conditions and the following disclaimer. |
-// | |
-// | Redistributions in binary form must reproduce the above copyright |
-// | notice, this list of conditions and the following disclaimer in the |
-// | documentation and/or other materials provided with the distribution. |
-// | |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission. |
-// | |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-// | POSSIBILITY OF SUCH DAMAGE. |
-// +----------------------------------------------------------------------+
-// | Author: Lukas Smith <smith@pooteeweet.org> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-
-/**
- * @package MDB2
- * @category Database
- */
-
-/**
- * These are constants for the tableInfo-function
- * they are bitwised or'ed. so if there are more constants to be defined
- * in the future, adjust MDB2_TABLEINFO_FULL accordingly
- */
-
-define('MDB2_TABLEINFO_ORDER', 1);
-define('MDB2_TABLEINFO_ORDERTABLE', 2);
-define('MDB2_TABLEINFO_FULL', 3);
-
-/**
- * Base class for the schema reverse engineering module that is extended by each MDB2 driver
- *
- * To load this module in the MDB2 object:
- * $mdb->loadModule('Reverse');
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Driver_Reverse_Common extends MDB2_Module_Common
-{
- // {{{ splitTableSchema()
-
- /**
- * Split the "[owner|schema].table" notation into an array
- *
- * @param string $table [schema and] table name
- *
- * @return array array(schema, table)
- * @access private
- */
- function splitTableSchema($table)
- {
- $ret = array();
- if (strpos($table, '.') !== false) {
- return explode('.', $table);
- }
- return array(null, $table);
- }
-
- // }}}
- // {{{ getTableFieldDefinition()
-
- /**
- * Get the structure of a field into an array
- *
- * @param string $table name of table that should be used in method
- * @param string $field name of field that should be used in method
- * @return mixed data array on success, a MDB2 error on failure.
- * The returned array contains an array for each field definition,
- * with all or some of these indices, depending on the field data type:
- * [notnull] [nativetype] [length] [fixed] [default] [type] [mdb2type]
- * @access public
- */
- function getTableFieldDefinition($table, $field)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- }
-
- // }}}
- // {{{ getTableIndexDefinition()
-
- /**
- * Get the structure of an index into an array
- *
- * @param string $table name of table that should be used in method
- * @param string $index name of index that should be used in method
- * @return mixed data array on success, a MDB2 error on failure
- * The returned array has this structure:
- * </pre>
- * array (
- * [fields] => array (
- * [field1name] => array() // one entry per each field covered
- * [field2name] => array() // by the index
- * [field3name] => array(
- * [sorting] => ascending
- * )
- * )
- * );
- * </pre>
- * @access public
- */
- function getTableIndexDefinition($table, $index)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- }
-
- // }}}
- // {{{ getTableConstraintDefinition()
-
- /**
- * Get the structure of an constraints into an array
- *
- * @param string $table name of table that should be used in method
- * @param string $index name of index that should be used in method
- * @return mixed data array on success, a MDB2 error on failure
- * The returned array has this structure:
- * <pre>
- * array (
- * [primary] => 0
- * [unique] => 0
- * [foreign] => 1
- * [check] => 0
- * [fields] => array (
- * [field1name] => array() // one entry per each field covered
- * [field2name] => array() // by the index
- * [field3name] => array(
- * [sorting] => ascending
- * [position] => 3
- * )
- * )
- * [references] => array(
- * [table] => name
- * [fields] => array(
- * [field1name] => array( //one entry per each referenced field
- * [position] => 1
- * )
- * )
- * )
- * [deferrable] => 0
- * [initiallydeferred] => 0
- * [onupdate] => CASCADE|RESTRICT|SET NULL|SET DEFAULT|NO ACTION
- * [ondelete] => CASCADE|RESTRICT|SET NULL|SET DEFAULT|NO ACTION
- * [match] => SIMPLE|PARTIAL|FULL
- * );
- * </pre>
- * @access public
- */
- function getTableConstraintDefinition($table, $index)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- }
-
- // }}}
- // {{{ getSequenceDefinition()
-
- /**
- * Get the structure of a sequence into an array
- *
- * @param string $sequence name of sequence that should be used in method
- * @return mixed data array on success, a MDB2 error on failure
- * The returned array has this structure:
- * <pre>
- * array (
- * [start] => n
- * );
- * </pre>
- * @access public
- */
- function getSequenceDefinition($sequence)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $start = $db->currId($sequence);
- if (PEAR::isError($start)) {
- return $start;
- }
- if ($db->supports('current_id')) {
- $start++;
- } else {
- $db->warnings[] = 'database does not support getting current
- sequence value, the sequence value was incremented';
- }
- $definition = array();
- if ($start != 1) {
- $definition = array('start' => $start);
- }
- return $definition;
- }
-
- // }}}
- // {{{ getTriggerDefinition()
-
- /**
- * Get the structure of a trigger into an array
- *
- * EXPERIMENTAL
- *
- * WARNING: this function is experimental and may change the returned value
- * at any time until labelled as non-experimental
- *
- * @param string $trigger name of trigger that should be used in method
- * @return mixed data array on success, a MDB2 error on failure
- * The returned array has this structure:
- * <pre>
- * array (
- * [trigger_name] => 'trigger name',
- * [table_name] => 'table name',
- * [trigger_body] => 'trigger body definition',
- * [trigger_type] => 'BEFORE' | 'AFTER',
- * [trigger_event] => 'INSERT' | 'UPDATE' | 'DELETE'
- * //or comma separated list of multiple events, when supported
- * [trigger_enabled] => true|false
- * [trigger_comment] => 'trigger comment',
- * );
- * </pre>
- * The oci8 driver also returns a [when_clause] index.
- * @access public
- */
- function getTriggerDefinition($trigger)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- }
-
- // }}}
- // {{{ tableInfo()
-
- /**
- * Returns information about a table or a result set
- *
- * The format of the resulting array depends on which <var>$mode</var>
- * you select. The sample output below is based on this query:
- * <pre>
- * SELECT tblFoo.fldID, tblFoo.fldPhone, tblBar.fldId
- * FROM tblFoo
- * JOIN tblBar ON tblFoo.fldId = tblBar.fldId
- * </pre>
- *
- * <ul>
- * <li>
- *
- * <kbd>null</kbd> (default)
- * <pre>
- * [0] => Array (
- * [table] => tblFoo
- * [name] => fldId
- * [type] => int
- * [len] => 11
- * [flags] => primary_key not_null
- * )
- * [1] => Array (
- * [table] => tblFoo
- * [name] => fldPhone
- * [type] => string
- * [len] => 20
- * [flags] =>
- * )
- * [2] => Array (
- * [table] => tblBar
- * [name] => fldId
- * [type] => int
- * [len] => 11
- * [flags] => primary_key not_null
- * )
- * </pre>
- *
- * </li><li>
- *
- * <kbd>MDB2_TABLEINFO_ORDER</kbd>
- *
- * <p>In addition to the information found in the default output,
- * a notation of the number of columns is provided by the
- * <samp>num_fields</samp> element while the <samp>order</samp>
- * element provides an array with the column names as the keys and
- * their location index number (corresponding to the keys in the
- * the default output) as the values.</p>
- *
- * <p>If a result set has identical field names, the last one is
- * used.</p>
- *
- * <pre>
- * [num_fields] => 3
- * [order] => Array (
- * [fldId] => 2
- * [fldTrans] => 1
- * )
- * </pre>
- *
- * </li><li>
- *
- * <kbd>MDB2_TABLEINFO_ORDERTABLE</kbd>
- *
- * <p>Similar to <kbd>MDB2_TABLEINFO_ORDER</kbd> but adds more
- * dimensions to the array in which the table names are keys and
- * the field names are sub-keys. This is helpful for queries that
- * join tables which have identical field names.</p>
- *
- * <pre>
- * [num_fields] => 3
- * [ordertable] => Array (
- * [tblFoo] => Array (
- * [fldId] => 0
- * [fldPhone] => 1
- * )
- * [tblBar] => Array (
- * [fldId] => 2
- * )
- * )
- * </pre>
- *
- * </li>
- * </ul>
- *
- * The <samp>flags</samp> element contains a space separated list
- * of extra information about the field. This data is inconsistent
- * between DBMS's due to the way each DBMS works.
- * + <samp>primary_key</samp>
- * + <samp>unique_key</samp>
- * + <samp>multiple_key</samp>
- * + <samp>not_null</samp>
- *
- * Most DBMS's only provide the <samp>table</samp> and <samp>flags</samp>
- * elements if <var>$result</var> is a table name. The following DBMS's
- * provide full information from queries:
- * + fbsql
- * + mysql
- *
- * If the 'portability' option has <samp>MDB2_PORTABILITY_FIX_CASE</samp>
- * turned on, the names of tables and fields will be lower or upper cased.
- *
- * @param object|string $result MDB2_result object from a query or a
- * string containing the name of a table.
- * While this also accepts a query result
- * resource identifier, this behavior is
- * deprecated.
- * @param int $mode either unused or one of the tableInfo modes:
- * <kbd>MDB2_TABLEINFO_ORDERTABLE</kbd>,
- * <kbd>MDB2_TABLEINFO_ORDER</kbd> or
- * <kbd>MDB2_TABLEINFO_FULL</kbd> (which does both).
- * These are bitwise, so the first two can be
- * combined using <kbd>|</kbd>.
- *
- * @return array an associative array with the information requested.
- * A MDB2_Error object on failure.
- *
- * @see MDB2_Driver_Common::setOption()
- */
- function tableInfo($result, $mode = null)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- if (!is_string($result)) {
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'method not implemented', __FUNCTION__);
- }
-
- $db->loadModule('Manager', null, true);
- $fields = $db->manager->listTableFields($result);
- if (PEAR::isError($fields)) {
- return $fields;
- }
-
- $flags = array();
-
- $idxname_format = $db->getOption('idxname_format');
- $db->setOption('idxname_format', '%s');
-
- $indexes = $db->manager->listTableIndexes($result);
- if (PEAR::isError($indexes)) {
- $db->setOption('idxname_format', $idxname_format);
- return $indexes;
- }
-
- foreach ($indexes as $index) {
- $definition = $this->getTableIndexDefinition($result, $index);
- if (PEAR::isError($definition)) {
- $db->setOption('idxname_format', $idxname_format);
- return $definition;
- }
- if (count($definition['fields']) > 1) {
- foreach ($definition['fields'] as $field => $sort) {
- $flags[$field] = 'multiple_key';
- }
- }
- }
-
- $constraints = $db->manager->listTableConstraints($result);
- if (PEAR::isError($constraints)) {
- return $constraints;
- }
-
- foreach ($constraints as $constraint) {
- $definition = $this->getTableConstraintDefinition($result, $constraint);
- if (PEAR::isError($definition)) {
- $db->setOption('idxname_format', $idxname_format);
- return $definition;
- }
- $flag = !empty($definition['primary'])
- ? 'primary_key' : (!empty($definition['unique'])
- ? 'unique_key' : false);
- if ($flag) {
- foreach ($definition['fields'] as $field => $sort) {
- if (empty($flags[$field]) || $flags[$field] != 'primary_key') {
- $flags[$field] = $flag;
- }
- }
- }
- }
-
- $res = array();
-
- if ($mode) {
- $res['num_fields'] = count($fields);
- }
-
- foreach ($fields as $i => $field) {
- $definition = $this->getTableFieldDefinition($result, $field);
- if (PEAR::isError($definition)) {
- $db->setOption('idxname_format', $idxname_format);
- return $definition;
- }
- $res[$i] = $definition[0];
- $res[$i]['name'] = $field;
- $res[$i]['table'] = $result;
- $res[$i]['type'] = preg_replace('/^([a-z]+).*$/i', '\\1', trim($definition[0]['nativetype']));
- // 'primary_key', 'unique_key', 'multiple_key'
- $res[$i]['flags'] = empty($flags[$field]) ? '' : $flags[$field];
- // not_null', 'unsigned', 'auto_increment', 'default_[rawencodedvalue]'
- if (!empty($res[$i]['notnull'])) {
- $res[$i]['flags'].= ' not_null';
- }
- if (!empty($res[$i]['unsigned'])) {
- $res[$i]['flags'].= ' unsigned';
- }
- if (!empty($res[$i]['auto_increment'])) {
- $res[$i]['flags'].= ' autoincrement';
- }
- if (!empty($res[$i]['default'])) {
- $res[$i]['flags'].= ' default_'.rawurlencode($res[$i]['default']);
- }
-
- if ($mode & MDB2_TABLEINFO_ORDER) {
- $res['order'][$res[$i]['name']] = $i;
- }
- if ($mode & MDB2_TABLEINFO_ORDERTABLE) {
- $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
- }
- }
-
- $db->setOption('idxname_format', $idxname_format);
- return $res;
- }
-}
-?> \ No newline at end of file
diff --git a/3rdparty/MDB2/Driver/Reverse/mysql.php b/3rdparty/MDB2/Driver/Reverse/mysql.php
deleted file mode 100644
index 8ebdc9979bc..00000000000
--- a/3rdparty/MDB2/Driver/Reverse/mysql.php
+++ /dev/null
@@ -1,546 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2007 Manuel Lemos, Tomas V.V.Cox, |
-// | Stig. S. Bakken, Lukas Smith |
-// | All rights reserved. |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
-// | API as well as database abstraction for PHP applications. |
-// | This LICENSE is in the BSD license style. |
-// | |
-// | Redistribution and use in source and binary forms, with or without |
-// | modification, are permitted provided that the following conditions |
-// | are met: |
-// | |
-// | Redistributions of source code must retain the above copyright |
-// | notice, this list of conditions and the following disclaimer. |
-// | |
-// | Redistributions in binary form must reproduce the above copyright |
-// | notice, this list of conditions and the following disclaimer in the |
-// | documentation and/or other materials provided with the distribution. |
-// | |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission. |
-// | |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-// | POSSIBILITY OF SUCH DAMAGE. |
-// +----------------------------------------------------------------------+
-// | Author: Lukas Smith <smith@pooteeweet.org> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-
-require_once 'MDB2/Driver/Reverse/Common.php';
-
-/**
- * MDB2 MySQL driver for the schema reverse engineering module
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- * @author Lorenzo Alberton <l.alberton@quipo.it>
- */
-class MDB2_Driver_Reverse_mysql extends MDB2_Driver_Reverse_Common
-{
- // {{{ getTableFieldDefinition()
-
- /**
- * Get the structure of a field into an array
- *
- * @param string $table_name name of table that should be used in method
- * @param string $field_name name of field that should be used in method
- * @return mixed data array on success, a MDB2 error on failure
- * @access public
- */
- function getTableFieldDefinition($table_name, $field_name)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $result = $db->loadModule('Datatype', null, true);
- if (PEAR::isError($result)) {
- return $result;
- }
-
- list($schema, $table) = $this->splitTableSchema($table_name);
-
- $table = $db->quoteIdentifier($table, true);
- $query = "SHOW FULL COLUMNS FROM $table LIKE ".$db->quote($field_name);
- $columns = $db->queryAll($query, null, MDB2_FETCHMODE_ASSOC);
- if (PEAR::isError($columns)) {
- return $columns;
- }
- foreach ($columns as $column) {
- $column = array_change_key_case($column, CASE_LOWER);
- $column['name'] = $column['field'];
- unset($column['field']);
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- if ($db->options['field_case'] == CASE_LOWER) {
- $column['name'] = strtolower($column['name']);
- } else {
- $column['name'] = strtoupper($column['name']);
- }
- } else {
- $column = array_change_key_case($column, $db->options['field_case']);
- }
- if ($field_name == $column['name']) {
- $mapped_datatype = $db->datatype->mapNativeDatatype($column);
- if (PEAR::isError($mapped_datatype)) {
- return $mapped_datatype;
- }
- list($types, $length, $unsigned, $fixed) = $mapped_datatype;
- $notnull = false;
- if (empty($column['null']) || $column['null'] !== 'YES') {
- $notnull = true;
- }
- $default = false;
- if (array_key_exists('default', $column)) {
- $default = $column['default'];
- if ((null === $default) && $notnull) {
- $default = '';
- }
- }
- $definition[0] = array(
- 'notnull' => $notnull,
- 'nativetype' => preg_replace('/^([a-z]+)[^a-z].*/i', '\\1', $column['type'])
- );
- $autoincrement = false;
- if (!empty($column['extra'])) {
- if ($column['extra'] == 'auto_increment') {
- $autoincrement = true;
- } else {
- $definition[0]['extra'] = $column['extra'];
- }
- }
- $collate = null;
- if (!empty($column['collation'])) {
- $collate = $column['collation'];
- $charset = preg_replace('/(.+?)(_.+)?/', '$1', $collate);
- }
-
- if (null !== $length) {
- $definition[0]['length'] = $length;
- }
- if (null !== $unsigned) {
- $definition[0]['unsigned'] = $unsigned;
- }
- if (null !== $fixed) {
- $definition[0]['fixed'] = $fixed;
- }
- if ($default !== false) {
- $definition[0]['default'] = $default;
- }
- if ($autoincrement !== false) {
- $definition[0]['autoincrement'] = $autoincrement;
- }
- if (null !== $collate) {
- $definition[0]['collate'] = $collate;
- $definition[0]['charset'] = $charset;
- }
- foreach ($types as $key => $type) {
- $definition[$key] = $definition[0];
- if ($type == 'clob' || $type == 'blob') {
- unset($definition[$key]['default']);
- } elseif ($type == 'timestamp' && $notnull && empty($definition[$key]['default'])) {
- $definition[$key]['default'] = '0000-00-00 00:00:00';
- }
- $definition[$key]['type'] = $type;
- $definition[$key]['mdb2type'] = $type;
- }
- return $definition;
- }
- }
-
- return $db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- 'it was not specified an existing table column', __FUNCTION__);
- }
-
- // }}}
- // {{{ getTableIndexDefinition()
-
- /**
- * Get the structure of an index into an array
- *
- * @param string $table_name name of table that should be used in method
- * @param string $index_name name of index that should be used in method
- * @return mixed data array on success, a MDB2 error on failure
- * @access public
- */
- function getTableIndexDefinition($table_name, $index_name)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- list($schema, $table) = $this->splitTableSchema($table_name);
-
- $table = $db->quoteIdentifier($table, true);
- $query = "SHOW INDEX FROM $table /*!50002 WHERE Key_name = %s */";
- $index_name_mdb2 = $db->getIndexName($index_name);
- $result = $db->queryRow(sprintf($query, $db->quote($index_name_mdb2)));
- if (!PEAR::isError($result) && (null !== $result)) {
- // apply 'idxname_format' only if the query succeeded, otherwise
- // fallback to the given $index_name, without transformation
- $index_name = $index_name_mdb2;
- }
- $result = $db->query(sprintf($query, $db->quote($index_name)));
- if (PEAR::isError($result)) {
- return $result;
- }
- $colpos = 1;
- $definition = array();
- while (is_array($row = $result->fetchRow(MDB2_FETCHMODE_ASSOC))) {
- $row = array_change_key_case($row, CASE_LOWER);
- $key_name = $row['key_name'];
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- if ($db->options['field_case'] == CASE_LOWER) {
- $key_name = strtolower($key_name);
- } else {
- $key_name = strtoupper($key_name);
- }
- }
- if ($index_name == $key_name) {
- if (!$row['non_unique']) {
- return $db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- $index_name . ' is not an existing table index', __FUNCTION__);
- }
- $column_name = $row['column_name'];
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- if ($db->options['field_case'] == CASE_LOWER) {
- $column_name = strtolower($column_name);
- } else {
- $column_name = strtoupper($column_name);
- }
- }
- $definition['fields'][$column_name] = array(
- 'position' => $colpos++
- );
- if (!empty($row['collation'])) {
- $definition['fields'][$column_name]['sorting'] = ($row['collation'] == 'A'
- ? 'ascending' : 'descending');
- }
- }
- }
- $result->free();
- if (empty($definition['fields'])) {
- return $db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- $index_name . ' is not an existing table index', __FUNCTION__);
- }
- return $definition;
- }
-
- // }}}
- // {{{ getTableConstraintDefinition()
-
- /**
- * Get the structure of a constraint into an array
- *
- * @param string $table_name name of table that should be used in method
- * @param string $constraint_name name of constraint that should be used in method
- * @return mixed data array on success, a MDB2 error on failure
- * @access public
- */
- function getTableConstraintDefinition($table_name, $constraint_name)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- list($schema, $table) = $this->splitTableSchema($table_name);
- $constraint_name_original = $constraint_name;
-
- $table = $db->quoteIdentifier($table, true);
- $query = "SHOW INDEX FROM $table /*!50002 WHERE Key_name = %s */";
- if (strtolower($constraint_name) != 'primary') {
- $constraint_name_mdb2 = $db->getIndexName($constraint_name);
- $result = $db->queryRow(sprintf($query, $db->quote($constraint_name_mdb2)));
- if (!PEAR::isError($result) && (null !== $result)) {
- // apply 'idxname_format' only if the query succeeded, otherwise
- // fallback to the given $index_name, without transformation
- $constraint_name = $constraint_name_mdb2;
- }
- }
- $result = $db->query(sprintf($query, $db->quote($constraint_name)));
- if (PEAR::isError($result)) {
- return $result;
- }
- $colpos = 1;
- //default values, eventually overridden
- $definition = array(
- 'primary' => false,
- 'unique' => false,
- 'foreign' => false,
- 'check' => false,
- 'fields' => array(),
- 'references' => array(
- 'table' => '',
- 'fields' => array(),
- ),
- 'onupdate' => '',
- 'ondelete' => '',
- 'match' => '',
- 'deferrable' => false,
- 'initiallydeferred' => false,
- );
- while (is_array($row = $result->fetchRow(MDB2_FETCHMODE_ASSOC))) {
- $row = array_change_key_case($row, CASE_LOWER);
- $key_name = $row['key_name'];
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- if ($db->options['field_case'] == CASE_LOWER) {
- $key_name = strtolower($key_name);
- } else {
- $key_name = strtoupper($key_name);
- }
- }
- if ($constraint_name == $key_name) {
- if ($row['non_unique']) {
- //FOREIGN KEY?
- return $this->_getTableFKConstraintDefinition($table, $constraint_name_original, $definition);
- }
- if ($row['key_name'] == 'PRIMARY') {
- $definition['primary'] = true;
- } elseif (!$row['non_unique']) {
- $definition['unique'] = true;
- }
- $column_name = $row['column_name'];
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- if ($db->options['field_case'] == CASE_LOWER) {
- $column_name = strtolower($column_name);
- } else {
- $column_name = strtoupper($column_name);
- }
- }
- $definition['fields'][$column_name] = array(
- 'position' => $colpos++
- );
- if (!empty($row['collation'])) {
- $definition['fields'][$column_name]['sorting'] = ($row['collation'] == 'A'
- ? 'ascending' : 'descending');
- }
- }
- }
- $result->free();
- if (empty($definition['fields'])) {
- return $this->_getTableFKConstraintDefinition($table, $constraint_name_original, $definition);
- }
- return $definition;
- }
-
- // }}}
- // {{{ _getTableFKConstraintDefinition()
-
- /**
- * Get the FK definition from the CREATE TABLE statement
- *
- * @param string $table table name
- * @param string $constraint_name constraint name
- * @param array $definition default values for constraint definition
- *
- * @return array|PEAR_Error
- * @access private
- */
- function _getTableFKConstraintDefinition($table, $constraint_name, $definition)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
- //Use INFORMATION_SCHEMA instead?
- //SELECT *
- // FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS
- // WHERE CONSTRAINT_SCHEMA = '$dbname'
- // AND TABLE_NAME = '$table'
- // AND CONSTRAINT_NAME = '$constraint_name';
- $query = 'SHOW CREATE TABLE '. $db->escape($table);
- $constraint = $db->queryOne($query, 'text', 1);
- if (!PEAR::isError($constraint) && !empty($constraint)) {
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- if ($db->options['field_case'] == CASE_LOWER) {
- $constraint = strtolower($constraint);
- } else {
- $constraint = strtoupper($constraint);
- }
- }
- $constraint_name_original = $constraint_name;
- $constraint_name = $db->getIndexName($constraint_name);
- $pattern = '/\bCONSTRAINT\s+'.$constraint_name.'\s+FOREIGN KEY\s+\(([^\)]+)\) \bREFERENCES\b ([^\s]+) \(([^\)]+)\)(?: ON DELETE ([^\s]+))?(?: ON UPDATE ([^\s]+))?/i';
- if (!preg_match($pattern, str_replace('`', '', $constraint), $matches)) {
- //fallback to original constraint name
- $pattern = '/\bCONSTRAINT\s+'.$constraint_name_original.'\s+FOREIGN KEY\s+\(([^\)]+)\) \bREFERENCES\b ([^\s]+) \(([^\)]+)\)(?: ON DELETE ([^\s]+))?(?: ON UPDATE ([^\s]+))?/i';
- }
- if (preg_match($pattern, str_replace('`', '', $constraint), $matches)) {
- $definition['foreign'] = true;
- $column_names = explode(',', $matches[1]);
- $referenced_cols = explode(',', $matches[3]);
- $definition['references'] = array(
- 'table' => $matches[2],
- 'fields' => array(),
- );
- $colpos = 1;
- foreach ($column_names as $column_name) {
- $definition['fields'][trim($column_name)] = array(
- 'position' => $colpos++
- );
- }
- $colpos = 1;
- foreach ($referenced_cols as $column_name) {
- $definition['references']['fields'][trim($column_name)] = array(
- 'position' => $colpos++
- );
- }
- $definition['ondelete'] = empty($matches[4]) ? 'RESTRICT' : strtoupper($matches[4]);
- $definition['onupdate'] = empty($matches[5]) ? 'RESTRICT' : strtoupper($matches[5]);
- $definition['match'] = 'SIMPLE';
- return $definition;
- }
- }
- return $db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- $constraint_name . ' is not an existing table constraint', __FUNCTION__);
- }
-
- // }}}
- // {{{ getTriggerDefinition()
-
- /**
- * Get the structure of a trigger into an array
- *
- * EXPERIMENTAL
- *
- * WARNING: this function is experimental and may change the returned value
- * at any time until labelled as non-experimental
- *
- * @param string $trigger name of trigger that should be used in method
- * @return mixed data array on success, a MDB2 error on failure
- * @access public
- */
- function getTriggerDefinition($trigger)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $query = 'SELECT trigger_name,
- event_object_table AS table_name,
- action_statement AS trigger_body,
- action_timing AS trigger_type,
- event_manipulation AS trigger_event
- FROM information_schema.triggers
- WHERE trigger_name = '. $db->quote($trigger, 'text');
- $types = array(
- 'trigger_name' => 'text',
- 'table_name' => 'text',
- 'trigger_body' => 'text',
- 'trigger_type' => 'text',
- 'trigger_event' => 'text',
- );
- $def = $db->queryRow($query, $types, MDB2_FETCHMODE_ASSOC);
- if (PEAR::isError($def)) {
- return $def;
- }
- $def['trigger_comment'] = '';
- $def['trigger_enabled'] = true;
- return $def;
- }
-
- // }}}
- // {{{ tableInfo()
-
- /**
- * Returns information about a table or a result set
- *
- * @param object|string $result MDB2_result object from a query or a
- * string containing the name of a table.
- * While this also accepts a query result
- * resource identifier, this behavior is
- * deprecated.
- * @param int $mode a valid tableInfo mode
- *
- * @return array an associative array with the information requested.
- * A MDB2_Error object on failure.
- *
- * @see MDB2_Driver_Common::setOption()
- */
- function tableInfo($result, $mode = null)
- {
- if (is_string($result)) {
- return parent::tableInfo($result, $mode);
- }
-
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $resource = MDB2::isResultCommon($result) ? $result->getResource() : $result;
- if (!is_resource($resource)) {
- return $db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
- 'Could not generate result resource', __FUNCTION__);
- }
-
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- if ($db->options['field_case'] == CASE_LOWER) {
- $case_func = 'strtolower';
- } else {
- $case_func = 'strtoupper';
- }
- } else {
- $case_func = 'strval';
- }
-
- $count = @mysql_num_fields($resource);
- $res = array();
- if ($mode) {
- $res['num_fields'] = $count;
- }
-
- $db->loadModule('Datatype', null, true);
- for ($i = 0; $i < $count; $i++) {
- $res[$i] = array(
- 'table' => $case_func(@mysql_field_table($resource, $i)),
- 'name' => $case_func(@mysql_field_name($resource, $i)),
- 'type' => @mysql_field_type($resource, $i),
- 'length' => @mysql_field_len($resource, $i),
- 'flags' => @mysql_field_flags($resource, $i),
- );
- if ($res[$i]['type'] == 'string') {
- $res[$i]['type'] = 'char';
- } elseif ($res[$i]['type'] == 'unknown') {
- $res[$i]['type'] = 'decimal';
- }
- $mdb2type_info = $db->datatype->mapNativeDatatype($res[$i]);
- if (PEAR::isError($mdb2type_info)) {
- return $mdb2type_info;
- }
- $res[$i]['mdb2type'] = $mdb2type_info[0][0];
- if ($mode & MDB2_TABLEINFO_ORDER) {
- $res['order'][$res[$i]['name']] = $i;
- }
- if ($mode & MDB2_TABLEINFO_ORDERTABLE) {
- $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
- }
- }
-
- return $res;
- }
-}
-?> \ No newline at end of file
diff --git a/3rdparty/MDB2/Driver/Reverse/oci8.php b/3rdparty/MDB2/Driver/Reverse/oci8.php
deleted file mode 100644
index d89ad771374..00000000000
--- a/3rdparty/MDB2/Driver/Reverse/oci8.php
+++ /dev/null
@@ -1,625 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2007 Manuel Lemos, Tomas V.V.Cox, |
-// | Stig. S. Bakken, Lukas Smith, Frank M. Kromann, Lorenzo Alberton |
-// | All rights reserved. |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
-// | API as well as database abstraction for PHP applications. |
-// | This LICENSE is in the BSD license style. |
-// | |
-// | Redistribution and use in source and binary forms, with or without |
-// | modification, are permitted provided that the following conditions |
-// | are met: |
-// | |
-// | Redistributions of source code must retain the above copyright |
-// | notice, this list of conditions and the following disclaimer. |
-// | |
-// | Redistributions in binary form must reproduce the above copyright |
-// | notice, this list of conditions and the following disclaimer in the |
-// | documentation and/or other materials provided with the distribution. |
-// | |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission. |
-// | |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-// | POSSIBILITY OF SUCH DAMAGE. |
-// +----------------------------------------------------------------------+
-// | Authors: Lukas Smith <smith@pooteeweet.org> |
-// | Lorenzo Alberton <l.alberton@quipo.it> |
-// +----------------------------------------------------------------------+
-//
-// $Id: oci8.php 295587 2010-02-28 17:16:38Z quipo $
-//
-
-require_once 'MDB2/Driver/Reverse/Common.php';
-
-/**
- * MDB2 Oracle driver for the schema reverse engineering module
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@dybnet.de>
- */
-class MDB2_Driver_Reverse_oci8 extends MDB2_Driver_Reverse_Common
-{
- // {{{ getTableFieldDefinition()
-
- /**
- * Get the structure of a field into an array
- *
- * @param string $table_name name of table that should be used in method
- * @param string $field_name name of field that should be used in method
- * @return mixed data array on success, a MDB2 error on failure
- * @access public
- */
- function getTableFieldDefinition($table_name, $field_name)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $result = $db->loadModule('Datatype', null, true);
- if (PEAR::isError($result)) {
- return $result;
- }
-
- list($owner, $table) = $this->splitTableSchema($table_name);
- if (empty($owner)) {
- $owner = $db->dsn['username'];
- }
-
- $query = 'SELECT column_name AS "name",
- data_type AS "type",
- nullable AS "nullable",
- data_default AS "default",
- COALESCE(data_precision, data_length) AS "length",
- data_scale AS "scale"
- FROM all_tab_columns
- WHERE (table_name=? OR table_name=?)
- AND (owner=? OR owner=?)
- AND (column_name=? OR column_name=?)
- ORDER BY column_id';
- $stmt = $db->prepare($query);
- if (PEAR::isError($stmt)) {
- return $stmt;
- }
- $args = array(
- $table,
- strtoupper($table),
- $owner,
- strtoupper($owner),
- $field_name,
- strtoupper($field_name)
- );
- $result = $stmt->execute($args);
- if (PEAR::isError($result)) {
- return $result;
- }
- $column = $result->fetchRow(MDB2_FETCHMODE_ASSOC);
- if (PEAR::isError($column)) {
- return $column;
- }
- $stmt->free();
- $result->free();
-
- if (empty($column)) {
- return $db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- $field_name . ' is not a column in table ' . $table_name, __FUNCTION__);
- }
-
- $column = array_change_key_case($column, CASE_LOWER);
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- if ($db->options['field_case'] == CASE_LOWER) {
- $column['name'] = strtolower($column['name']);
- } else {
- $column['name'] = strtoupper($column['name']);
- }
- }
- $mapped_datatype = $db->datatype->mapNativeDatatype($column);
- if (PEAR::isError($mapped_datatype)) {
- return $mapped_datatype;
- }
- list($types, $length, $unsigned, $fixed) = $mapped_datatype;
- $notnull = false;
- if (!empty($column['nullable']) && $column['nullable'] == 'N') {
- $notnull = true;
- }
- $default = false;
- if (array_key_exists('default', $column)) {
- $default = $column['default'];
- if ($default === 'NULL') {
- $default = null;
- }
- //ugly hack, but works for the reverse direction
- if ($default == "''") {
- $default = '';
- }
- if ((null === $default) && $notnull) {
- $default = '';
- }
- }
-
- $definition[0] = array('notnull' => $notnull, 'nativetype' => $column['type']);
- if (null !== $length) {
- $definition[0]['length'] = $length;
- }
- if (null !== $unsigned) {
- $definition[0]['unsigned'] = $unsigned;
- }
- if (null !== $fixed) {
- $definition[0]['fixed'] = $fixed;
- }
- if ($default !== false) {
- $definition[0]['default'] = $default;
- }
- foreach ($types as $key => $type) {
- $definition[$key] = $definition[0];
- if ($type == 'clob' || $type == 'blob') {
- unset($definition[$key]['default']);
- }
- $definition[$key]['type'] = $type;
- $definition[$key]['mdb2type'] = $type;
- }
- if ($type == 'integer') {
- $query= "SELECT trigger_body
- FROM all_triggers
- WHERE table_name=?
- AND triggering_event='INSERT'
- AND trigger_type='BEFORE EACH ROW'";
- // ^^ pretty reasonable mimic for "auto_increment" in oracle?
- $stmt = $db->prepare($query);
- if (PEAR::isError($stmt)) {
- return $stmt;
- }
- $result = $stmt->execute(strtoupper($table));
- if (PEAR::isError($result)) {
- return $result;
- }
- while ($triggerstr = $result->fetchOne()) {
- if (preg_match('/.*SELECT\W+(.+)\.nextval +into +\:NEW\.'.$field_name.' +FROM +dual/im', $triggerstr, $matches)) {
- $definition[0]['autoincrement'] = $matches[1];
- }
- }
- $stmt->free();
- $result->free();
- }
- return $definition;
- }
-
- // }}}
- // {{{ getTableIndexDefinition()
-
- /**
- * Get the structure of an index into an array
- *
- * @param string $table_name name of table that should be used in method
- * @param string $index_name name of index that should be used in method
- * @return mixed data array on success, a MDB2 error on failure
- * @access public
- */
- function getTableIndexDefinition($table_name, $index_name)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- list($owner, $table) = $this->splitTableSchema($table_name);
- if (empty($owner)) {
- $owner = $db->dsn['username'];
- }
-
- $query = 'SELECT aic.column_name AS "column_name",
- aic.column_position AS "column_position",
- aic.descend AS "descend",
- aic.table_owner AS "table_owner",
- alc.constraint_type AS "constraint_type"
- FROM all_ind_columns aic
- LEFT JOIN all_constraints alc
- ON aic.index_name = alc.constraint_name
- AND aic.table_name = alc.table_name
- AND aic.table_owner = alc.owner
- WHERE (aic.table_name=? OR aic.table_name=?)
- AND (aic.index_name=? OR aic.index_name=?)
- AND (aic.table_owner=? OR aic.table_owner=?)
- ORDER BY column_position';
- $stmt = $db->prepare($query);
- if (PEAR::isError($stmt)) {
- return $stmt;
- }
- $indexnames = array_unique(array($db->getIndexName($index_name), $index_name));
- $i = 0;
- $row = null;
- while ((null === $row) && array_key_exists($i, $indexnames)) {
- $args = array(
- $table,
- strtoupper($table),
- $indexnames[$i],
- strtoupper($indexnames[$i]),
- $owner,
- strtoupper($owner)
- );
- $result = $stmt->execute($args);
- if (PEAR::isError($result)) {
- return $result;
- }
- $row = $result->fetchRow(MDB2_FETCHMODE_ASSOC);
- if (PEAR::isError($row)) {
- return $row;
- }
- $i++;
- }
- if (null === $row) {
- return $db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- $index_name. ' is not an index on table '. $table_name, __FUNCTION__);
- }
- if ($row['constraint_type'] == 'U' || $row['constraint_type'] == 'P') {
- return $db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- $index_name. ' is a constraint, not an index on table '. $table_name, __FUNCTION__);
- }
-
- $definition = array();
- while (null !== $row) {
- $row = array_change_key_case($row, CASE_LOWER);
- $column_name = $row['column_name'];
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- if ($db->options['field_case'] == CASE_LOWER) {
- $column_name = strtolower($column_name);
- } else {
- $column_name = strtoupper($column_name);
- }
- }
- $definition['fields'][$column_name] = array(
- 'position' => (int)$row['column_position'],
- );
- if (!empty($row['descend'])) {
- $definition['fields'][$column_name]['sorting'] =
- ($row['descend'] == 'ASC' ? 'ascending' : 'descending');
- }
- $row = $result->fetchRow(MDB2_FETCHMODE_ASSOC);
- }
- $result->free();
- if (empty($definition['fields'])) {
- return $db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- $index_name. ' is not an index on table '. $table_name, __FUNCTION__);
- }
- return $definition;
- }
-
- // }}}
- // {{{ getTableConstraintDefinition()
-
- /**
- * Get the structure of a constraint into an array
- *
- * @param string $table_name name of table that should be used in method
- * @param string $constraint_name name of constraint that should be used in method
- * @return mixed data array on success, a MDB2 error on failure
- * @access public
- */
- function getTableConstraintDefinition($table_name, $constraint_name)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- list($owner, $table) = $this->splitTableSchema($table_name);
- if (empty($owner)) {
- $owner = $db->dsn['username'];
- }
-
- $query = 'SELECT alc.constraint_name,
- CASE alc.constraint_type WHEN \'P\' THEN 1 ELSE 0 END "primary",
- CASE alc.constraint_type WHEN \'R\' THEN 1 ELSE 0 END "foreign",
- CASE alc.constraint_type WHEN \'U\' THEN 1 ELSE 0 END "unique",
- CASE alc.constraint_type WHEN \'C\' THEN 1 ELSE 0 END "check",
- alc.DELETE_RULE "ondelete",
- \'NO ACTION\' "onupdate",
- \'SIMPLE\' "match",
- CASE alc.deferrable WHEN \'NOT DEFERRABLE\' THEN 0 ELSE 1 END "deferrable",
- CASE alc.deferred WHEN \'IMMEDIATE\' THEN 0 ELSE 1 END "initiallydeferred",
- alc.search_condition AS "search_condition",
- alc.table_name,
- cols.column_name AS "column_name",
- cols.position,
- r_alc.table_name "references_table",
- r_cols.column_name "references_field",
- r_cols.position "references_field_position"
- FROM all_cons_columns cols
- LEFT JOIN all_constraints alc
- ON alc.constraint_name = cols.constraint_name
- AND alc.owner = cols.owner
- LEFT JOIN all_constraints r_alc
- ON alc.r_constraint_name = r_alc.constraint_name
- AND alc.r_owner = r_alc.owner
- LEFT JOIN all_cons_columns r_cols
- ON r_alc.constraint_name = r_cols.constraint_name
- AND r_alc.owner = r_cols.owner
- AND cols.position = r_cols.position
- WHERE (alc.constraint_name=? OR alc.constraint_name=?)
- AND alc.constraint_name = cols.constraint_name
- AND (alc.owner=? OR alc.owner=?)';
- $tablenames = array();
- if (!empty($table)) {
- $query.= ' AND (alc.table_name=? OR alc.table_name=?)';
- $tablenames = array($table, strtoupper($table));
- }
- $stmt = $db->prepare($query);
- if (PEAR::isError($stmt)) {
- return $stmt;
- }
-
- $constraintnames = array_unique(array($db->getIndexName($constraint_name), $constraint_name));
- $c = 0;
- $row = null;
- while ((null === $row) && array_key_exists($c, $constraintnames)) {
- $args = array(
- $constraintnames[$c],
- strtoupper($constraintnames[$c]),
- $owner,
- strtoupper($owner)
- );
- if (!empty($table)) {
- $args = array_merge($args, $tablenames);
- }
- $result = $stmt->execute($args);
- if (PEAR::isError($result)) {
- return $result;
- }
- $row = $result->fetchRow(MDB2_FETCHMODE_ASSOC);
- if (PEAR::isError($row)) {
- return $row;
- }
- $c++;
- }
-
- $definition = array(
- 'primary' => (boolean)$row['primary'],
- 'unique' => (boolean)$row['unique'],
- 'foreign' => (boolean)$row['foreign'],
- 'check' => (boolean)$row['check'],
- 'deferrable' => (boolean)$row['deferrable'],
- 'initiallydeferred' => (boolean)$row['initiallydeferred'],
- 'ondelete' => $row['ondelete'],
- 'onupdate' => $row['onupdate'],
- 'match' => $row['match'],
- );
-
- if ($definition['check']) {
- // pattern match constraint for check constraint values into enum-style output:
- $enumregex = '/'.$row['column_name'].' in \((.+?)\)/i';
- if (preg_match($enumregex, $row['search_condition'], $rangestr)) {
- $definition['fields'][$column_name] = array();
- $allowed = explode(',', $rangestr[1]);
- foreach ($allowed as $val) {
- $val = trim($val);
- $val = preg_replace('/^\'/', '', $val);
- $val = preg_replace('/\'$/', '', $val);
- array_push($definition['fields'][$column_name], $val);
- }
- }
- }
-
- while (null !== $row) {
- $row = array_change_key_case($row, CASE_LOWER);
- $column_name = $row['column_name'];
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- if ($db->options['field_case'] == CASE_LOWER) {
- $column_name = strtolower($column_name);
- } else {
- $column_name = strtoupper($column_name);
- }
- }
- $definition['fields'][$column_name] = array(
- 'position' => (int)$row['position']
- );
- if ($row['foreign']) {
- $ref_column_name = $row['references_field'];
- $ref_table_name = $row['references_table'];
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- if ($db->options['field_case'] == CASE_LOWER) {
- $ref_column_name = strtolower($ref_column_name);
- $ref_table_name = strtolower($ref_table_name);
- } else {
- $ref_column_name = strtoupper($ref_column_name);
- $ref_table_name = strtoupper($ref_table_name);
- }
- }
- $definition['references']['table'] = $ref_table_name;
- $definition['references']['fields'][$ref_column_name] = array(
- 'position' => (int)$row['references_field_position']
- );
- }
- $lastrow = $row;
- $row = $result->fetchRow(MDB2_FETCHMODE_ASSOC);
- }
- $result->free();
- if (empty($definition['fields'])) {
- return $db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- $constraint_name . ' is not a constraint on table '. $table_name, __FUNCTION__);
- }
-
- return $definition;
- }
-
- // }}}
- // {{{ getSequenceDefinition()
-
- /**
- * Get the structure of a sequence into an array
- *
- * @param string $sequence name of sequence that should be used in method
- * @return mixed data array on success, a MDB2 error on failure
- * @access public
- */
- function getSequenceDefinition($sequence)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $sequence_name = $db->getSequenceName($sequence);
- $query = 'SELECT last_number FROM user_sequences';
- $query.= ' WHERE sequence_name='.$db->quote($sequence_name, 'text');
- $query.= ' OR sequence_name='.$db->quote(strtoupper($sequence_name), 'text');
- $start = $db->queryOne($query, 'integer');
- if (PEAR::isError($start)) {
- return $start;
- }
- $definition = array();
- if ($start != 1) {
- $definition = array('start' => $start);
- }
- return $definition;
- }
-
- // }}}
- // {{{ getTriggerDefinition()
-
- /**
- * Get the structure of a trigger into an array
- *
- * EXPERIMENTAL
- *
- * WARNING: this function is experimental and may change the returned value
- * at any time until labelled as non-experimental
- *
- * @param string $trigger name of trigger that should be used in method
- * @return mixed data array on success, a MDB2 error on failure
- * @access public
- */
- function getTriggerDefinition($trigger)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $query = 'SELECT trigger_name AS "trigger_name",
- table_name AS "table_name",
- trigger_body AS "trigger_body",
- trigger_type AS "trigger_type",
- triggering_event AS "trigger_event",
- description AS "trigger_comment",
- 1 AS "trigger_enabled",
- when_clause AS "when_clause"
- FROM user_triggers
- WHERE trigger_name = \''. strtoupper($trigger).'\'';
- $types = array(
- 'trigger_name' => 'text',
- 'table_name' => 'text',
- 'trigger_body' => 'text',
- 'trigger_type' => 'text',
- 'trigger_event' => 'text',
- 'trigger_comment' => 'text',
- 'trigger_enabled' => 'boolean',
- 'when_clause' => 'text',
- );
- $result = $db->queryRow($query, $types, MDB2_FETCHMODE_ASSOC);
- if (PEAR::isError($result)) {
- return $result;
- }
- if (!empty($result['trigger_type'])) {
- //$result['trigger_type'] = array_shift(explode(' ', $result['trigger_type']));
- $result['trigger_type'] = preg_replace('/(\S+).*/', '\\1', $result['trigger_type']);
- }
- return $result;
- }
-
- // }}}
- // {{{ tableInfo()
-
- /**
- * Returns information about a table or a result set
- *
- * NOTE: only supports 'table' and 'flags' if <var>$result</var>
- * is a table name.
- *
- * NOTE: flags won't contain index information.
- *
- * @param object|string $result MDB2_result object from a query or a
- * string containing the name of a table.
- * While this also accepts a query result
- * resource identifier, this behavior is
- * deprecated.
- * @param int $mode a valid tableInfo mode
- *
- * @return array an associative array with the information requested.
- * A MDB2_Error object on failure.
- *
- * @see MDB2_Driver_Common::tableInfo()
- */
- function tableInfo($result, $mode = null)
- {
- if (is_string($result)) {
- return parent::tableInfo($result, $mode);
- }
-
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $resource = MDB2::isResultCommon($result) ? $result->getResource() : $result;
- if (!is_resource($resource)) {
- return $db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
- 'Could not generate result resource', __FUNCTION__);
- }
-
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- if ($db->options['field_case'] == CASE_LOWER) {
- $case_func = 'strtolower';
- } else {
- $case_func = 'strtoupper';
- }
- } else {
- $case_func = 'strval';
- }
-
- $count = @OCINumCols($resource);
- $res = array();
-
- if ($mode) {
- $res['num_fields'] = $count;
- }
-
- $db->loadModule('Datatype', null, true);
- for ($i = 0; $i < $count; $i++) {
- $column = array(
- 'table' => '',
- 'name' => $case_func(@OCIColumnName($resource, $i+1)),
- 'type' => @OCIColumnType($resource, $i+1),
- 'length' => @OCIColumnSize($resource, $i+1),
- 'flags' => '',
- );
- $res[$i] = $column;
- $res[$i]['mdb2type'] = $db->datatype->mapNativeDatatype($res[$i]);
- if ($mode & MDB2_TABLEINFO_ORDER) {
- $res['order'][$res[$i]['name']] = $i;
- }
- if ($mode & MDB2_TABLEINFO_ORDERTABLE) {
- $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
- }
- }
- return $res;
- }
-}
-?> \ No newline at end of file
diff --git a/3rdparty/MDB2/Driver/Reverse/pgsql.php b/3rdparty/MDB2/Driver/Reverse/pgsql.php
deleted file mode 100644
index eab02f9b998..00000000000
--- a/3rdparty/MDB2/Driver/Reverse/pgsql.php
+++ /dev/null
@@ -1,574 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2008 Manuel Lemos, Tomas V.V.Cox, |
-// | Stig. S. Bakken, Lukas Smith |
-// | All rights reserved. |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
-// | API as well as database abstraction for PHP applications. |
-// | This LICENSE is in the BSD license style. |
-// | |
-// | Redistribution and use in source and binary forms, with or without |
-// | modification, are permitted provided that the following conditions |
-// | are met: |
-// | |
-// | Redistributions of source code must retain the above copyright |
-// | notice, this list of conditions and the following disclaimer. |
-// | |
-// | Redistributions in binary form must reproduce the above copyright |
-// | notice, this list of conditions and the following disclaimer in the |
-// | documentation and/or other materials provided with the distribution. |
-// | |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission. |
-// | |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-// | POSSIBILITY OF SUCH DAMAGE. |
-// +----------------------------------------------------------------------+
-// | Authors: Paul Cooper <pgc@ucecom.com> |
-// | Lorenzo Alberton <l.alberton@quipo.it> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-require_once 'MDB2/Driver/Reverse/Common.php';
-
-/**
- * MDB2 PostGreSQL driver for the schema reverse engineering module
- *
- * @package MDB2
- * @category Database
- * @author Paul Cooper <pgc@ucecom.com>
- * @author Lorenzo Alberton <l.alberton@quipo.it>
- */
-class MDB2_Driver_Reverse_pgsql extends MDB2_Driver_Reverse_Common
-{
- // {{{ getTableFieldDefinition()
-
- /**
- * Get the structure of a field into an array
- *
- * @param string $table_name name of table that should be used in method
- * @param string $field_name name of field that should be used in method
- * @return mixed data array on success, a MDB2 error on failure
- * @access public
- */
- function getTableFieldDefinition($table_name, $field_name)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $result = $db->loadModule('Datatype', null, true);
- if (PEAR::isError($result)) {
- return $result;
- }
-
- list($schema, $table) = $this->splitTableSchema($table_name);
-
- $query = "SELECT a.attname AS name,
- t.typname AS type,
- CASE a.attlen
- WHEN -1 THEN
- CASE t.typname
- WHEN 'numeric' THEN (a.atttypmod / 65536)
- WHEN 'decimal' THEN (a.atttypmod / 65536)
- WHEN 'money' THEN (a.atttypmod / 65536)
- ELSE CASE a.atttypmod
- WHEN -1 THEN NULL
- ELSE a.atttypmod - 4
- END
- END
- ELSE a.attlen
- END AS length,
- CASE t.typname
- WHEN 'numeric' THEN (a.atttypmod % 65536) - 4
- WHEN 'decimal' THEN (a.atttypmod % 65536) - 4
- WHEN 'money' THEN (a.atttypmod % 65536) - 4
- ELSE 0
- END AS scale,
- a.attnotnull,
- a.atttypmod,
- a.atthasdef,
- (SELECT substring(pg_get_expr(d.adbin, d.adrelid) for 128)
- FROM pg_attrdef d
- WHERE d.adrelid = a.attrelid
- AND d.adnum = a.attnum
- AND a.atthasdef
- ) as default
- FROM pg_attribute a,
- pg_class c,
- pg_type t
- WHERE c.relname = ".$db->quote($table, 'text')."
- AND a.atttypid = t.oid
- AND c.oid = a.attrelid
- AND NOT a.attisdropped
- AND a.attnum > 0
- AND a.attname = ".$db->quote($field_name, 'text')."
- ORDER BY a.attnum";
- $column = $db->queryRow($query, null, MDB2_FETCHMODE_ASSOC);
- if (PEAR::isError($column)) {
- return $column;
- }
-
- if (empty($column)) {
- return $db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- 'it was not specified an existing table column', __FUNCTION__);
- }
-
- $column = array_change_key_case($column, CASE_LOWER);
- $mapped_datatype = $db->datatype->mapNativeDatatype($column);
- if (PEAR::isError($mapped_datatype)) {
- return $mapped_datatype;
- }
- list($types, $length, $unsigned, $fixed) = $mapped_datatype;
- $notnull = false;
- if (!empty($column['attnotnull']) && $column['attnotnull'] == 't') {
- $notnull = true;
- }
- $default = null;
- if ($column['atthasdef'] === 't'
- && strpos($column['default'], 'NULL') !== 0
- && !preg_match("/nextval\('([^']+)'/", $column['default'])
- ) {
- $pattern = '/^\'(.*)\'::[\w ]+$/i';
- $default = $column['default'];#substr($column['adsrc'], 1, -1);
- if ((null === $default) && $notnull) {
- $default = '';
- } elseif (!empty($default) && preg_match($pattern, $default)) {
- //remove data type cast
- $default = preg_replace ($pattern, '\\1', $default);
- }
- }
- $autoincrement = false;
- if (preg_match("/nextval\('([^']+)'/", $column['default'], $nextvals)) {
- $autoincrement = true;
- }
- $definition[0] = array('notnull' => $notnull, 'nativetype' => $column['type']);
- if (null !== $length) {
- $definition[0]['length'] = $length;
- }
- if (null !== $unsigned) {
- $definition[0]['unsigned'] = $unsigned;
- }
- if (null !== $fixed) {
- $definition[0]['fixed'] = $fixed;
- }
- if ($default !== false) {
- $definition[0]['default'] = $default;
- }
- if ($autoincrement !== false) {
- $definition[0]['autoincrement'] = $autoincrement;
- }
- foreach ($types as $key => $type) {
- $definition[$key] = $definition[0];
- if ($type == 'clob' || $type == 'blob') {
- unset($definition[$key]['default']);
- }
- $definition[$key]['type'] = $type;
- $definition[$key]['mdb2type'] = $type;
- }
- return $definition;
- }
-
- // }}}
- // {{{ getTableIndexDefinition()
-
- /**
- * Get the structure of an index into an array
- *
- * @param string $table_name name of table that should be used in method
- * @param string $index_name name of index that should be used in method
- * @return mixed data array on success, a MDB2 error on failure
- * @access public
- */
- function getTableIndexDefinition($table_name, $index_name)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- list($schema, $table) = $this->splitTableSchema($table_name);
-
- $query = 'SELECT relname, indkey FROM pg_index, pg_class';
- $query.= ' WHERE pg_class.oid = pg_index.indexrelid';
- $query.= " AND indisunique != 't' AND indisprimary != 't'";
- $query.= ' AND pg_class.relname = %s';
- $index_name_mdb2 = $db->getIndexName($index_name);
- $row = $db->queryRow(sprintf($query, $db->quote($index_name_mdb2, 'text')), null, MDB2_FETCHMODE_ASSOC);
- if (PEAR::isError($row) || empty($row)) {
- // fallback to the given $index_name, without transformation
- $row = $db->queryRow(sprintf($query, $db->quote($index_name, 'text')), null, MDB2_FETCHMODE_ASSOC);
- }
- if (PEAR::isError($row)) {
- return $row;
- }
-
- if (empty($row)) {
- return $db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- 'it was not specified an existing table index', __FUNCTION__);
- }
-
- $row = array_change_key_case($row, CASE_LOWER);
-
- $db->loadModule('Manager', null, true);
- $columns = $db->manager->listTableFields($table_name);
-
- $definition = array();
-
- $index_column_numbers = explode(' ', $row['indkey']);
-
- $colpos = 1;
- foreach ($index_column_numbers as $number) {
- $definition['fields'][$columns[($number - 1)]] = array(
- 'position' => $colpos++,
- 'sorting' => 'ascending',
- );
- }
- return $definition;
- }
-
- // }}}
- // {{{ getTableConstraintDefinition()
-
- /**
- * Get the structure of a constraint into an array
- *
- * @param string $table_name name of table that should be used in method
- * @param string $constraint_name name of constraint that should be used in method
- * @return mixed data array on success, a MDB2 error on failure
- * @access public
- */
- function getTableConstraintDefinition($table_name, $constraint_name)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- list($schema, $table) = $this->splitTableSchema($table_name);
-
- $query = "SELECT c.oid,
- c.conname AS constraint_name,
- CASE WHEN c.contype = 'c' THEN 1 ELSE 0 END AS \"check\",
- CASE WHEN c.contype = 'f' THEN 1 ELSE 0 END AS \"foreign\",
- CASE WHEN c.contype = 'p' THEN 1 ELSE 0 END AS \"primary\",
- CASE WHEN c.contype = 'u' THEN 1 ELSE 0 END AS \"unique\",
- CASE WHEN c.condeferrable = 'f' THEN 0 ELSE 1 END AS deferrable,
- CASE WHEN c.condeferred = 'f' THEN 0 ELSE 1 END AS initiallydeferred,
- --array_to_string(c.conkey, ' ') AS constraint_key,
- t.relname AS table_name,
- t2.relname AS references_table,
- CASE confupdtype
- WHEN 'a' THEN 'NO ACTION'
- WHEN 'r' THEN 'RESTRICT'
- WHEN 'c' THEN 'CASCADE'
- WHEN 'n' THEN 'SET NULL'
- WHEN 'd' THEN 'SET DEFAULT'
- END AS onupdate,
- CASE confdeltype
- WHEN 'a' THEN 'NO ACTION'
- WHEN 'r' THEN 'RESTRICT'
- WHEN 'c' THEN 'CASCADE'
- WHEN 'n' THEN 'SET NULL'
- WHEN 'd' THEN 'SET DEFAULT'
- END AS ondelete,
- CASE confmatchtype
- WHEN 'u' THEN 'UNSPECIFIED'
- WHEN 'f' THEN 'FULL'
- WHEN 'p' THEN 'PARTIAL'
- END AS match,
- --array_to_string(c.confkey, ' ') AS fk_constraint_key,
- consrc
- FROM pg_constraint c
- LEFT JOIN pg_class t ON c.conrelid = t.oid
- LEFT JOIN pg_class t2 ON c.confrelid = t2.oid
- WHERE c.conname = %s
- AND t.relname = " . $db->quote($table, 'text');
- $constraint_name_mdb2 = $db->getIndexName($constraint_name);
- $row = $db->queryRow(sprintf($query, $db->quote($constraint_name_mdb2, 'text')), null, MDB2_FETCHMODE_ASSOC);
- if (PEAR::isError($row) || empty($row)) {
- // fallback to the given $index_name, without transformation
- $constraint_name_mdb2 = $constraint_name;
- $row = $db->queryRow(sprintf($query, $db->quote($constraint_name_mdb2, 'text')), null, MDB2_FETCHMODE_ASSOC);
- }
- if (PEAR::isError($row)) {
- return $row;
- }
- $uniqueIndex = false;
- if (empty($row)) {
- // We might be looking for a UNIQUE index that was not created
- // as a constraint but should be treated as such.
- $query = 'SELECT relname AS constraint_name,
- indkey,
- 0 AS "check",
- 0 AS "foreign",
- 0 AS "primary",
- 1 AS "unique",
- 0 AS deferrable,
- 0 AS initiallydeferred,
- NULL AS references_table,
- NULL AS onupdate,
- NULL AS ondelete,
- NULL AS match
- FROM pg_index, pg_class
- WHERE pg_class.oid = pg_index.indexrelid
- AND indisunique = \'t\'
- AND pg_class.relname = %s';
- $constraint_name_mdb2 = $db->getIndexName($constraint_name);
- $row = $db->queryRow(sprintf($query, $db->quote($constraint_name_mdb2, 'text')), null, MDB2_FETCHMODE_ASSOC);
- if (PEAR::isError($row) || empty($row)) {
- // fallback to the given $index_name, without transformation
- $constraint_name_mdb2 = $constraint_name;
- $row = $db->queryRow(sprintf($query, $db->quote($constraint_name_mdb2, 'text')), null, MDB2_FETCHMODE_ASSOC);
- }
- if (PEAR::isError($row)) {
- return $row;
- }
- if (empty($row)) {
- return $db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- $constraint_name . ' is not an existing table constraint', __FUNCTION__);
- }
- $uniqueIndex = true;
- }
-
- $row = array_change_key_case($row, CASE_LOWER);
-
- $definition = array(
- 'primary' => (boolean)$row['primary'],
- 'unique' => (boolean)$row['unique'],
- 'foreign' => (boolean)$row['foreign'],
- 'check' => (boolean)$row['check'],
- 'fields' => array(),
- 'references' => array(
- 'table' => $row['references_table'],
- 'fields' => array(),
- ),
- 'deferrable' => (boolean)$row['deferrable'],
- 'initiallydeferred' => (boolean)$row['initiallydeferred'],
- 'onupdate' => $row['onupdate'],
- 'ondelete' => $row['ondelete'],
- 'match' => $row['match'],
- );
-
- if ($uniqueIndex) {
- $db->loadModule('Manager', null, true);
- $columns = $db->manager->listTableFields($table_name);
- $index_column_numbers = explode(' ', $row['indkey']);
- $colpos = 1;
- foreach ($index_column_numbers as $number) {
- $definition['fields'][$columns[($number - 1)]] = array(
- 'position' => $colpos++,
- 'sorting' => 'ascending',
- );
- }
- return $definition;
- }
-
- $query = 'SELECT a.attname
- FROM pg_constraint c
- LEFT JOIN pg_class t ON c.conrelid = t.oid
- LEFT JOIN pg_attribute a ON a.attrelid = t.oid AND a.attnum = ANY(c.conkey)
- WHERE c.conname = %s
- AND t.relname = ' . $db->quote($table, 'text');
- $fields = $db->queryCol(sprintf($query, $db->quote($constraint_name_mdb2, 'text')), null);
- if (PEAR::isError($fields)) {
- return $fields;
- }
- $colpos = 1;
- foreach ($fields as $field) {
- $definition['fields'][$field] = array(
- 'position' => $colpos++,
- 'sorting' => 'ascending',
- );
- }
-
- if ($definition['foreign']) {
- $query = 'SELECT a.attname
- FROM pg_constraint c
- LEFT JOIN pg_class t ON c.confrelid = t.oid
- LEFT JOIN pg_attribute a ON a.attrelid = t.oid AND a.attnum = ANY(c.confkey)
- WHERE c.conname = %s
- AND t.relname = ' . $db->quote($definition['references']['table'], 'text');
- $foreign_fields = $db->queryCol(sprintf($query, $db->quote($constraint_name_mdb2, 'text')), null);
- if (PEAR::isError($foreign_fields)) {
- return $foreign_fields;
- }
- $colpos = 1;
- foreach ($foreign_fields as $foreign_field) {
- $definition['references']['fields'][$foreign_field] = array(
- 'position' => $colpos++,
- );
- }
- }
-
- if ($definition['check']) {
- $check_def = $db->queryOne("SELECT pg_get_constraintdef(" . $row['oid'] . ", 't')");
- // ...
- }
- return $definition;
- }
-
- // }}}
- // {{{ getTriggerDefinition()
-
- /**
- * Get the structure of a trigger into an array
- *
- * EXPERIMENTAL
- *
- * WARNING: this function is experimental and may change the returned value
- * at any time until labelled as non-experimental
- *
- * @param string $trigger name of trigger that should be used in method
- * @return mixed data array on success, a MDB2 error on failure
- * @access public
- *
- * @TODO: add support for plsql functions and functions with args
- */
- function getTriggerDefinition($trigger)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $query = "SELECT trg.tgname AS trigger_name,
- tbl.relname AS table_name,
- CASE
- WHEN p.proname IS NOT NULL THEN 'EXECUTE PROCEDURE ' || p.proname || '();'
- ELSE ''
- END AS trigger_body,
- CASE trg.tgtype & cast(2 as int2)
- WHEN 0 THEN 'AFTER'
- ELSE 'BEFORE'
- END AS trigger_type,
- CASE trg.tgtype & cast(28 as int2)
- WHEN 16 THEN 'UPDATE'
- WHEN 8 THEN 'DELETE'
- WHEN 4 THEN 'INSERT'
- WHEN 20 THEN 'INSERT, UPDATE'
- WHEN 28 THEN 'INSERT, UPDATE, DELETE'
- WHEN 24 THEN 'UPDATE, DELETE'
- WHEN 12 THEN 'INSERT, DELETE'
- END AS trigger_event,
- CASE trg.tgenabled
- WHEN 'O' THEN 't'
- ELSE trg.tgenabled
- END AS trigger_enabled,
- obj_description(trg.oid, 'pg_trigger') AS trigger_comment
- FROM pg_trigger trg,
- pg_class tbl,
- pg_proc p
- WHERE trg.tgrelid = tbl.oid
- AND trg.tgfoid = p.oid
- AND trg.tgname = ". $db->quote($trigger, 'text');
- $types = array(
- 'trigger_name' => 'text',
- 'table_name' => 'text',
- 'trigger_body' => 'text',
- 'trigger_type' => 'text',
- 'trigger_event' => 'text',
- 'trigger_comment' => 'text',
- 'trigger_enabled' => 'boolean',
- );
- return $db->queryRow($query, $types, MDB2_FETCHMODE_ASSOC);
- }
-
- // }}}
- // {{{ tableInfo()
-
- /**
- * Returns information about a table or a result set
- *
- * NOTE: only supports 'table' and 'flags' if <var>$result</var>
- * is a table name.
- *
- * @param object|string $result MDB2_result object from a query or a
- * string containing the name of a table.
- * While this also accepts a query result
- * resource identifier, this behavior is
- * deprecated.
- * @param int $mode a valid tableInfo mode
- *
- * @return array an associative array with the information requested.
- * A MDB2_Error object on failure.
- *
- * @see MDB2_Driver_Common::tableInfo()
- */
- function tableInfo($result, $mode = null)
- {
- if (is_string($result)) {
- return parent::tableInfo($result, $mode);
- }
-
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $resource = MDB2::isResultCommon($result) ? $result->getResource() : $result;
- if (!is_resource($resource)) {
- return $db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
- 'Could not generate result resource', __FUNCTION__);
- }
-
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- if ($db->options['field_case'] == CASE_LOWER) {
- $case_func = 'strtolower';
- } else {
- $case_func = 'strtoupper';
- }
- } else {
- $case_func = 'strval';
- }
-
- $count = @pg_num_fields($resource);
- $res = array();
-
- if ($mode) {
- $res['num_fields'] = $count;
- }
-
- $db->loadModule('Datatype', null, true);
- for ($i = 0; $i < $count; $i++) {
- $res[$i] = array(
- 'table' => function_exists('pg_field_table') ? @pg_field_table($resource, $i) : '',
- 'name' => $case_func(@pg_field_name($resource, $i)),
- 'type' => @pg_field_type($resource, $i),
- 'length' => @pg_field_size($resource, $i),
- 'flags' => '',
- );
- $mdb2type_info = $db->datatype->mapNativeDatatype($res[$i]);
- if (PEAR::isError($mdb2type_info)) {
- return $mdb2type_info;
- }
- $res[$i]['mdb2type'] = $mdb2type_info[0][0];
- if ($mode & MDB2_TABLEINFO_ORDER) {
- $res['order'][$res[$i]['name']] = $i;
- }
- if ($mode & MDB2_TABLEINFO_ORDERTABLE) {
- $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
- }
- }
-
- return $res;
- }
-}
-?> \ No newline at end of file
diff --git a/3rdparty/MDB2/Driver/Reverse/sqlite.php b/3rdparty/MDB2/Driver/Reverse/sqlite.php
deleted file mode 100644
index 811400480fe..00000000000
--- a/3rdparty/MDB2/Driver/Reverse/sqlite.php
+++ /dev/null
@@ -1,611 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2007 Manuel Lemos, Tomas V.V.Cox, |
-// | Stig. S. Bakken, Lukas Smith, Lorenzo Alberton |
-// | All rights reserved. |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
-// | API as well as database abstraction for PHP applications. |
-// | This LICENSE is in the BSD license style. |
-// | |
-// | Redistribution and use in source and binary forms, with or without |
-// | modification, are permitted provided that the following conditions |
-// | are met: |
-// | |
-// | Redistributions of source code must retain the above copyright |
-// | notice, this list of conditions and the following disclaimer. |
-// | |
-// | Redistributions in binary form must reproduce the above copyright |
-// | notice, this list of conditions and the following disclaimer in the |
-// | documentation and/or other materials provided with the distribution. |
-// | |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission. |
-// | |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-// | POSSIBILITY OF SUCH DAMAGE. |
-// +----------------------------------------------------------------------+
-// | Authors: Lukas Smith <smith@pooteeweet.org> |
-// | Lorenzo Alberton <l.alberton@quipo.it> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-
-require_once 'MDB2/Driver/Reverse/Common.php';
-
-/**
- * MDB2 SQlite driver for the schema reverse engineering module
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common
-{
- /**
- * Remove SQL comments from the field definition
- *
- * @access private
- */
- function _removeComments($sql) {
- $lines = explode("\n", $sql);
- foreach ($lines as $k => $line) {
- $pieces = explode('--', $line);
- if (count($pieces) > 1 && (substr_count($pieces[0], '\'') % 2) == 0) {
- $lines[$k] = substr($line, 0, strpos($line, '--'));
- }
- }
- return implode("\n", $lines);
- }
-
- /**
- *
- */
- function _getTableColumns($sql)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
- $start_pos = strpos($sql, '(');
- $end_pos = strrpos($sql, ')');
- $column_def = substr($sql, $start_pos+1, $end_pos-$start_pos-1);
- // replace the decimal length-places-separator with a colon
- $column_def = preg_replace('/(\d),(\d)/', '\1:\2', $column_def);
- $column_def = $this->_removeComments($column_def);
- $column_sql = explode(',', $column_def);
- $columns = array();
- $count = count($column_sql);
- if ($count == 0) {
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'unexpected empty table column definition list', __FUNCTION__);
- }
- $regexp = '/^\s*([^\s]+) +(CHAR|VARCHAR|VARCHAR2|TEXT|BOOLEAN|SMALLINT|INT|INTEGER|DECIMAL|TINYINT|BIGINT|DOUBLE|FLOAT|DATETIME|DATE|TIME|LONGTEXT|LONGBLOB)( ?\(([1-9][0-9]*)(:([1-9][0-9]*))?\))?( NULL| NOT NULL)?( UNSIGNED)?( NULL| NOT NULL)?( PRIMARY KEY)?( DEFAULT (\'[^\']*\'|[^ ]+))?( NULL| NOT NULL)?( PRIMARY KEY)?(\s*\-\-.*)?$/i';
- $regexp2 = '/^\s*([^ ]+) +(PRIMARY|UNIQUE|CHECK)$/i';
- for ($i=0, $j=0; $i<$count; ++$i) {
- if (!preg_match($regexp, trim($column_sql[$i]), $matches)) {
- if (!preg_match($regexp2, trim($column_sql[$i]))) {
- continue;
- }
- return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'unexpected table column SQL definition: "'.$column_sql[$i].'"', __FUNCTION__);
- }
- $columns[$j]['name'] = trim($matches[1], implode('', $db->identifier_quoting));
- $columns[$j]['type'] = strtolower($matches[2]);
- if (isset($matches[4]) && strlen($matches[4])) {
- $columns[$j]['length'] = $matches[4];
- }
- if (isset($matches[6]) && strlen($matches[6])) {
- $columns[$j]['decimal'] = $matches[6];
- }
- if (isset($matches[8]) && strlen($matches[8])) {
- $columns[$j]['unsigned'] = true;
- }
- if (isset($matches[9]) && strlen($matches[9])) {
- $columns[$j]['autoincrement'] = true;
- }
- if (isset($matches[12]) && strlen($matches[12])) {
- $default = $matches[12];
- if (strlen($default) && $default[0]=="'") {
- $default = str_replace("''", "'", substr($default, 1, strlen($default)-2));
- }
- if ($default === 'NULL') {
- $default = null;
- }
- $columns[$j]['default'] = $default;
- } else {
- $columns[$j]['default'] = null;
- }
- if (isset($matches[7]) && strlen($matches[7])) {
- $columns[$j]['notnull'] = ($matches[7] === ' NOT NULL');
- } else if (isset($matches[9]) && strlen($matches[9])) {
- $columns[$j]['notnull'] = ($matches[9] === ' NOT NULL');
- } else if (isset($matches[13]) && strlen($matches[13])) {
- $columns[$j]['notnull'] = ($matches[13] === ' NOT NULL');
- }
- ++$j;
- }
- return $columns;
- }
-
- // {{{ getTableFieldDefinition()
-
- /**
- * Get the stucture of a field into an array
- *
- * @param string $table_name name of table that should be used in method
- * @param string $field_name name of field that should be used in method
- * @return mixed data array on success, a MDB2 error on failure.
- * The returned array contains an array for each field definition,
- * with (some of) these indices:
- * [notnull] [nativetype] [length] [fixed] [default] [type] [mdb2type]
- * @access public
- */
- function getTableFieldDefinition($table_name, $field_name)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- list($schema, $table) = $this->splitTableSchema($table_name);
-
- $result = $db->loadModule('Datatype', null, true);
- if (PEAR::isError($result)) {
- return $result;
- }
- $query = "SELECT sql FROM sqlite_master WHERE type='table' AND ";
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $query.= 'LOWER(name)='.$db->quote(strtolower($table), 'text');
- } else {
- $query.= 'name='.$db->quote($table, 'text');
- }
- $sql = $db->queryOne($query);
- if (PEAR::isError($sql)) {
- return $sql;
- }
- $columns = $this->_getTableColumns($sql);
- foreach ($columns as $column) {
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- if ($db->options['field_case'] == CASE_LOWER) {
- $column['name'] = strtolower($column['name']);
- } else {
- $column['name'] = strtoupper($column['name']);
- }
- } else {
- $column = array_change_key_case($column, $db->options['field_case']);
- }
- if ($field_name == $column['name']) {
- $mapped_datatype = $db->datatype->mapNativeDatatype($column);
- if (PEAR::isError($mapped_datatype)) {
- return $mapped_datatype;
- }
- list($types, $length, $unsigned, $fixed) = $mapped_datatype;
- $notnull = false;
- if (!empty($column['notnull'])) {
- $notnull = $column['notnull'];
- }
- $default = false;
- if (array_key_exists('default', $column)) {
- $default = $column['default'];
- if ((null === $default) && $notnull) {
- $default = '';
- }
- }
- $autoincrement = false;
- if (!empty($column['autoincrement'])) {
- $autoincrement = true;
- }
-
- $definition[0] = array(
- 'notnull' => $notnull,
- 'nativetype' => preg_replace('/^([a-z]+)[^a-z].*/i', '\\1', $column['type'])
- );
- if (null !== $length) {
- $definition[0]['length'] = $length;
- }
- if (null !== $unsigned) {
- $definition[0]['unsigned'] = $unsigned;
- }
- if (null !== $fixed) {
- $definition[0]['fixed'] = $fixed;
- }
- if ($default !== false) {
- $definition[0]['default'] = $default;
- }
- if ($autoincrement !== false) {
- $definition[0]['autoincrement'] = $autoincrement;
- }
- foreach ($types as $key => $type) {
- $definition[$key] = $definition[0];
- if ($type == 'clob' || $type == 'blob') {
- unset($definition[$key]['default']);
- }
- $definition[$key]['type'] = $type;
- $definition[$key]['mdb2type'] = $type;
- }
- return $definition;
- }
- }
-
- return $db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- 'it was not specified an existing table column', __FUNCTION__);
- }
-
- // }}}
- // {{{ getTableIndexDefinition()
-
- /**
- * Get the stucture of an index into an array
- *
- * @param string $table_name name of table that should be used in method
- * @param string $index_name name of index that should be used in method
- * @return mixed data array on success, a MDB2 error on failure
- * @access public
- */
- function getTableIndexDefinition($table_name, $index_name)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- list($schema, $table) = $this->splitTableSchema($table_name);
-
- $query = "SELECT sql FROM sqlite_master WHERE type='index' AND ";
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $query.= 'LOWER(name)=%s AND LOWER(tbl_name)=' . $db->quote(strtolower($table), 'text');
- } else {
- $query.= 'name=%s AND tbl_name=' . $db->quote($table, 'text');
- }
- $query.= ' AND sql NOT NULL ORDER BY name';
- $index_name_mdb2 = $db->getIndexName($index_name);
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $qry = sprintf($query, $db->quote(strtolower($index_name_mdb2), 'text'));
- } else {
- $qry = sprintf($query, $db->quote($index_name_mdb2, 'text'));
- }
- $sql = $db->queryOne($qry, 'text');
- if (PEAR::isError($sql) || empty($sql)) {
- // fallback to the given $index_name, without transformation
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $qry = sprintf($query, $db->quote(strtolower($index_name), 'text'));
- } else {
- $qry = sprintf($query, $db->quote($index_name, 'text'));
- }
- $sql = $db->queryOne($qry, 'text');
- }
- if (PEAR::isError($sql)) {
- return $sql;
- }
- if (!$sql) {
- return $db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- 'it was not specified an existing table index', __FUNCTION__);
- }
-
- $sql = strtolower($sql);
- $start_pos = strpos($sql, '(');
- $end_pos = strrpos($sql, ')');
- $column_names = substr($sql, $start_pos+1, $end_pos-$start_pos-1);
- $column_names = explode(',', $column_names);
-
- if (preg_match("/^create unique/", $sql)) {
- return $db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- 'it was not specified an existing table index', __FUNCTION__);
- }
-
- $definition = array();
- $count = count($column_names);
- for ($i=0; $i<$count; ++$i) {
- $column_name = strtok($column_names[$i], ' ');
- $collation = strtok(' ');
- $definition['fields'][$column_name] = array(
- 'position' => $i+1
- );
- if (!empty($collation)) {
- $definition['fields'][$column_name]['sorting'] =
- ($collation=='ASC' ? 'ascending' : 'descending');
- }
- }
-
- if (empty($definition['fields'])) {
- return $db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- 'it was not specified an existing table index', __FUNCTION__);
- }
- return $definition;
- }
-
- // }}}
- // {{{ getTableConstraintDefinition()
-
- /**
- * Get the stucture of a constraint into an array
- *
- * @param string $table_name name of table that should be used in method
- * @param string $constraint_name name of constraint that should be used in method
- * @return mixed data array on success, a MDB2 error on failure
- * @access public
- */
- function getTableConstraintDefinition($table_name, $constraint_name)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- list($schema, $table) = $this->splitTableSchema($table_name);
-
- $query = "SELECT sql FROM sqlite_master WHERE type='index' AND ";
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $query.= 'LOWER(name)=%s AND LOWER(tbl_name)=' . $db->quote(strtolower($table), 'text');
- } else {
- $query.= 'name=%s AND tbl_name=' . $db->quote($table, 'text');
- }
- $query.= ' AND sql NOT NULL ORDER BY name';
- $constraint_name_mdb2 = $db->getIndexName($constraint_name);
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $qry = sprintf($query, $db->quote(strtolower($constraint_name_mdb2), 'text'));
- } else {
- $qry = sprintf($query, $db->quote($constraint_name_mdb2, 'text'));
- }
- $sql = $db->queryOne($qry, 'text');
- if (PEAR::isError($sql) || empty($sql)) {
- // fallback to the given $index_name, without transformation
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $qry = sprintf($query, $db->quote(strtolower($constraint_name), 'text'));
- } else {
- $qry = sprintf($query, $db->quote($constraint_name, 'text'));
- }
- $sql = $db->queryOne($qry, 'text');
- }
- if (PEAR::isError($sql)) {
- return $sql;
- }
- //default values, eventually overridden
- $definition = array(
- 'primary' => false,
- 'unique' => false,
- 'foreign' => false,
- 'check' => false,
- 'fields' => array(),
- 'references' => array(
- 'table' => '',
- 'fields' => array(),
- ),
- 'onupdate' => '',
- 'ondelete' => '',
- 'match' => '',
- 'deferrable' => false,
- 'initiallydeferred' => false,
- );
- if (!$sql) {
- $query = "SELECT sql FROM sqlite_master WHERE type='table' AND ";
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $query.= 'LOWER(name)='.$db->quote(strtolower($table), 'text');
- } else {
- $query.= 'name='.$db->quote($table, 'text');
- }
- $query.= " AND sql NOT NULL ORDER BY name";
- $sql = $db->queryOne($query, 'text');
- if (PEAR::isError($sql)) {
- return $sql;
- }
- if ($constraint_name == 'primary') {
- // search in table definition for PRIMARY KEYs
- if (preg_match("/\bPRIMARY\s+KEY\b\s*\(([^)]+)/i", $sql, $tmp)) {
- $definition['primary'] = true;
- $definition['fields'] = array();
- $column_names = explode(',', $tmp[1]);
- $colpos = 1;
- foreach ($column_names as $column_name) {
- $definition['fields'][trim($column_name)] = array(
- 'position' => $colpos++
- );
- }
- return $definition;
- }
- if (preg_match("/\"([^\"]+)\"[^\,\"]+\bPRIMARY\s+KEY\b[^\,\)]*/i", $sql, $tmp)) {
- $definition['primary'] = true;
- $definition['fields'] = array();
- $column_names = explode(',', $tmp[1]);
- $colpos = 1;
- foreach ($column_names as $column_name) {
- $definition['fields'][trim($column_name)] = array(
- 'position' => $colpos++
- );
- }
- return $definition;
- }
- } else {
- // search in table definition for FOREIGN KEYs
- $pattern = "/\bCONSTRAINT\b\s+%s\s+
- \bFOREIGN\s+KEY\b\s*\(([^\)]+)\)\s*
- \bREFERENCES\b\s+([^\s]+)\s*\(([^\)]+)\)\s*
- (?:\bMATCH\s*([^\s]+))?\s*
- (?:\bON\s+UPDATE\s+([^\s,\)]+))?\s*
- (?:\bON\s+DELETE\s+([^\s,\)]+))?\s*
- /imsx";
- $found_fk = false;
- if (preg_match(sprintf($pattern, $constraint_name_mdb2), $sql, $tmp)) {
- $found_fk = true;
- } elseif (preg_match(sprintf($pattern, $constraint_name), $sql, $tmp)) {
- $found_fk = true;
- }
- if ($found_fk) {
- $definition['foreign'] = true;
- $definition['match'] = 'SIMPLE';
- $definition['onupdate'] = 'NO ACTION';
- $definition['ondelete'] = 'NO ACTION';
- $definition['references']['table'] = $tmp[2];
- $column_names = explode(',', $tmp[1]);
- $colpos = 1;
- foreach ($column_names as $column_name) {
- $definition['fields'][trim($column_name)] = array(
- 'position' => $colpos++
- );
- }
- $referenced_cols = explode(',', $tmp[3]);
- $colpos = 1;
- foreach ($referenced_cols as $column_name) {
- $definition['references']['fields'][trim($column_name)] = array(
- 'position' => $colpos++
- );
- }
- if (isset($tmp[4])) {
- $definition['match'] = $tmp[4];
- }
- if (isset($tmp[5])) {
- $definition['onupdate'] = $tmp[5];
- }
- if (isset($tmp[6])) {
- $definition['ondelete'] = $tmp[6];
- }
- return $definition;
- }
- }
- $sql = false;
- }
- if (!$sql) {
- return $db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- $constraint_name . ' is not an existing table constraint', __FUNCTION__);
- }
-
- $sql = strtolower($sql);
- $start_pos = strpos($sql, '(');
- $end_pos = strrpos($sql, ')');
- $column_names = substr($sql, $start_pos+1, $end_pos-$start_pos-1);
- $column_names = explode(',', $column_names);
-
- if (!preg_match("/^create unique/", $sql)) {
- return $db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- $constraint_name . ' is not an existing table constraint', __FUNCTION__);
- }
-
- $definition['unique'] = true;
- $count = count($column_names);
- for ($i=0; $i<$count; ++$i) {
- $column_name = strtok($column_names[$i]," ");
- $collation = strtok(" ");
- $definition['fields'][$column_name] = array(
- 'position' => $i+1
- );
- if (!empty($collation)) {
- $definition['fields'][$column_name]['sorting'] =
- ($collation=='ASC' ? 'ascending' : 'descending');
- }
- }
-
- if (empty($definition['fields'])) {
- return $db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- $constraint_name . ' is not an existing table constraint', __FUNCTION__);
- }
- return $definition;
- }
-
- // }}}
- // {{{ getTriggerDefinition()
-
- /**
- * Get the structure of a trigger into an array
- *
- * EXPERIMENTAL
- *
- * WARNING: this function is experimental and may change the returned value
- * at any time until labelled as non-experimental
- *
- * @param string $trigger name of trigger that should be used in method
- * @return mixed data array on success, a MDB2 error on failure
- * @access public
- */
- function getTriggerDefinition($trigger)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $query = "SELECT name as trigger_name,
- tbl_name AS table_name,
- sql AS trigger_body,
- NULL AS trigger_type,
- NULL AS trigger_event,
- NULL AS trigger_comment,
- 1 AS trigger_enabled
- FROM sqlite_master
- WHERE type='trigger'";
- if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $query.= ' AND LOWER(name)='.$db->quote(strtolower($trigger), 'text');
- } else {
- $query.= ' AND name='.$db->quote($trigger, 'text');
- }
- $types = array(
- 'trigger_name' => 'text',
- 'table_name' => 'text',
- 'trigger_body' => 'text',
- 'trigger_type' => 'text',
- 'trigger_event' => 'text',
- 'trigger_comment' => 'text',
- 'trigger_enabled' => 'boolean',
- );
- $def = $db->queryRow($query, $types, MDB2_FETCHMODE_ASSOC);
- if (PEAR::isError($def)) {
- return $def;
- }
- if (empty($def)) {
- return $db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- 'it was not specified an existing trigger', __FUNCTION__);
- }
- if (preg_match("/^create\s+(?:temp|temporary)?trigger\s+(?:if\s+not\s+exists\s+)?.*(before|after)?\s+(insert|update|delete)/Uims", $def['trigger_body'], $tmp)) {
- $def['trigger_type'] = strtoupper($tmp[1]);
- $def['trigger_event'] = strtoupper($tmp[2]);
- }
- return $def;
- }
-
- // }}}
- // {{{ tableInfo()
-
- /**
- * Returns information about a table
- *
- * @param string $result a string containing the name of a table
- * @param int $mode a valid tableInfo mode
- *
- * @return array an associative array with the information requested.
- * A MDB2_Error object on failure.
- *
- * @see MDB2_Driver_Common::tableInfo()
- * @since Method available since Release 1.7.0
- */
- function tableInfo($result, $mode = null)
- {
- if (is_string($result)) {
- return parent::tableInfo($result, $mode);
- }
-
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- return $db->raiseError(MDB2_ERROR_NOT_CAPABLE, null, null,
- 'This DBMS can not obtain tableInfo from result sets', __FUNCTION__);
- }
-}
-
-?> \ No newline at end of file
diff --git a/3rdparty/MDB2/Driver/mysql.php b/3rdparty/MDB2/Driver/mysql.php
deleted file mode 100644
index 1d22e61f460..00000000000
--- a/3rdparty/MDB2/Driver/mysql.php
+++ /dev/null
@@ -1,1729 +0,0 @@
-<?php
-// vim: set et ts=4 sw=4 fdm=marker:
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2008 Manuel Lemos, Tomas V.V.Cox, |
-// | Stig. S. Bakken, Lukas Smith |
-// | All rights reserved. |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
-// | API as well as database abstraction for PHP applications. |
-// | This LICENSE is in the BSD license style. |
-// | |
-// | Redistribution and use in source and binary forms, with or without |
-// | modification, are permitted provided that the following conditions |
-// | are met: |
-// | |
-// | Redistributions of source code must retain the above copyright |
-// | notice, this list of conditions and the following disclaimer. |
-// | |
-// | Redistributions in binary form must reproduce the above copyright |
-// | notice, this list of conditions and the following disclaimer in the |
-// | documentation and/or other materials provided with the distribution. |
-// | |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission. |
-// | |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-// | POSSIBILITY OF SUCH DAMAGE. |
-// +----------------------------------------------------------------------+
-// | Author: Lukas Smith <smith@pooteeweet.org> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-
-/**
- * MDB2 MySQL driver
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Driver_mysql extends MDB2_Driver_Common
-{
- // {{{ properties
-
- public $string_quoting = array(
- 'start' => "'",
- 'end' => "'",
- 'escape' => '\\',
- 'escape_pattern' => '\\',
- );
-
- public $identifier_quoting = array(
- 'start' => '`',
- 'end' => '`',
- 'escape' => '`',
- );
-
- public $sql_comments = array(
- array('start' => '-- ', 'end' => "\n", 'escape' => false),
- array('start' => '#', 'end' => "\n", 'escape' => false),
- array('start' => '/*', 'end' => '*/', 'escape' => false),
- );
-
- protected $server_capabilities_checked = false;
-
- protected $start_transaction = false;
-
- public $varchar_max_length = 255;
-
- // }}}
- // {{{ constructor
-
- /**
- * Constructor
- */
- function __construct()
- {
- parent::__construct();
-
- $this->phptype = 'mysql';
- $this->dbsyntax = 'mysql';
-
- $this->supported['sequences'] = 'emulated';
- $this->supported['indexes'] = true;
- $this->supported['affected_rows'] = true;
- $this->supported['transactions'] = false;
- $this->supported['savepoints'] = false;
- $this->supported['summary_functions'] = true;
- $this->supported['order_by_text'] = true;
- $this->supported['current_id'] = 'emulated';
- $this->supported['limit_queries'] = true;
- $this->supported['LOBs'] = true;
- $this->supported['replace'] = true;
- $this->supported['sub_selects'] = 'emulated';
- $this->supported['triggers'] = false;
- $this->supported['auto_increment'] = true;
- $this->supported['primary_key'] = true;
- $this->supported['result_introspection'] = true;
- $this->supported['prepared_statements'] = 'emulated';
- $this->supported['identifier_quoting'] = true;
- $this->supported['pattern_escaping'] = true;
- $this->supported['new_link'] = true;
-
- $this->options['DBA_username'] = false;
- $this->options['DBA_password'] = false;
- $this->options['default_table_type'] = '';
- $this->options['max_identifiers_length'] = 64;
-
- $this->_reCheckSupportedOptions();
- }
-
- // }}}
- // {{{ _reCheckSupportedOptions()
-
- /**
- * If the user changes certain options, other capabilities may depend
- * on the new settings, so we need to check them (again).
- *
- * @access private
- */
- function _reCheckSupportedOptions()
- {
- $this->supported['transactions'] = $this->options['use_transactions'];
- $this->supported['savepoints'] = $this->options['use_transactions'];
- if ($this->options['default_table_type']) {
- switch (strtoupper($this->options['default_table_type'])) {
- case 'BLACKHOLE':
- case 'MEMORY':
- case 'ARCHIVE':
- case 'CSV':
- case 'HEAP':
- case 'ISAM':
- case 'MERGE':
- case 'MRG_ISAM':
- case 'ISAM':
- case 'MRG_MYISAM':
- case 'MYISAM':
- $this->supported['savepoints'] = false;
- $this->supported['transactions'] = false;
- $this->warnings[] = $this->options['default_table_type'] .
- ' is not a supported default table type';
- break;
- }
- }
- }
-
- // }}}
- // {{{ function setOption($option, $value)
-
- /**
- * set the option for the db class
- *
- * @param string option name
- * @param mixed value for the option
- *
- * @return mixed MDB2_OK or MDB2 Error Object
- *
- * @access public
- */
- function setOption($option, $value)
- {
- $res = parent::setOption($option, $value);
- $this->_reCheckSupportedOptions();
- }
-
- // }}}
- // {{{ errorInfo()
-
- /**
- * This method is used to collect information about an error
- *
- * @param integer $error
- * @return array
- * @access public
- */
- function errorInfo($error = null)
- {
- if ($this->connection) {
- $native_code = @mysql_errno($this->connection);
- $native_msg = @mysql_error($this->connection);
- } else {
- $native_code = @mysql_errno();
- $native_msg = @mysql_error();
- }
- if (is_null($error)) {
- static $ecode_map;
- if (empty($ecode_map)) {
- $ecode_map = array(
- 1000 => MDB2_ERROR_INVALID, //hashchk
- 1001 => MDB2_ERROR_INVALID, //isamchk
- 1004 => MDB2_ERROR_CANNOT_CREATE,
- 1005 => MDB2_ERROR_CANNOT_CREATE,
- 1006 => MDB2_ERROR_CANNOT_CREATE,
- 1007 => MDB2_ERROR_ALREADY_EXISTS,
- 1008 => MDB2_ERROR_CANNOT_DROP,
- 1009 => MDB2_ERROR_CANNOT_DROP,
- 1010 => MDB2_ERROR_CANNOT_DROP,
- 1011 => MDB2_ERROR_CANNOT_DELETE,
- 1022 => MDB2_ERROR_ALREADY_EXISTS,
- 1029 => MDB2_ERROR_NOT_FOUND,
- 1032 => MDB2_ERROR_NOT_FOUND,
- 1044 => MDB2_ERROR_ACCESS_VIOLATION,
- 1045 => MDB2_ERROR_ACCESS_VIOLATION,
- 1046 => MDB2_ERROR_NODBSELECTED,
- 1048 => MDB2_ERROR_CONSTRAINT,
- 1049 => MDB2_ERROR_NOSUCHDB,
- 1050 => MDB2_ERROR_ALREADY_EXISTS,
- 1051 => MDB2_ERROR_NOSUCHTABLE,
- 1054 => MDB2_ERROR_NOSUCHFIELD,
- 1060 => MDB2_ERROR_ALREADY_EXISTS,
- 1061 => MDB2_ERROR_ALREADY_EXISTS,
- 1062 => MDB2_ERROR_ALREADY_EXISTS,
- 1064 => MDB2_ERROR_SYNTAX,
- 1067 => MDB2_ERROR_INVALID,
- 1072 => MDB2_ERROR_NOT_FOUND,
- 1086 => MDB2_ERROR_ALREADY_EXISTS,
- 1091 => MDB2_ERROR_NOT_FOUND,
- 1100 => MDB2_ERROR_NOT_LOCKED,
- 1109 => MDB2_ERROR_NOT_FOUND,
- 1125 => MDB2_ERROR_ALREADY_EXISTS,
- 1136 => MDB2_ERROR_VALUE_COUNT_ON_ROW,
- 1138 => MDB2_ERROR_INVALID,
- 1142 => MDB2_ERROR_ACCESS_VIOLATION,
- 1143 => MDB2_ERROR_ACCESS_VIOLATION,
- 1146 => MDB2_ERROR_NOSUCHTABLE,
- 1149 => MDB2_ERROR_SYNTAX,
- 1169 => MDB2_ERROR_CONSTRAINT,
- 1176 => MDB2_ERROR_NOT_FOUND,
- 1177 => MDB2_ERROR_NOSUCHTABLE,
- 1213 => MDB2_ERROR_DEADLOCK,
- 1216 => MDB2_ERROR_CONSTRAINT,
- 1217 => MDB2_ERROR_CONSTRAINT,
- 1227 => MDB2_ERROR_ACCESS_VIOLATION,
- 1235 => MDB2_ERROR_CANNOT_CREATE,
- 1299 => MDB2_ERROR_INVALID_DATE,
- 1300 => MDB2_ERROR_INVALID,
- 1304 => MDB2_ERROR_ALREADY_EXISTS,
- 1305 => MDB2_ERROR_NOT_FOUND,
- 1306 => MDB2_ERROR_CANNOT_DROP,
- 1307 => MDB2_ERROR_CANNOT_CREATE,
- 1334 => MDB2_ERROR_CANNOT_ALTER,
- 1339 => MDB2_ERROR_NOT_FOUND,
- 1356 => MDB2_ERROR_INVALID,
- 1359 => MDB2_ERROR_ALREADY_EXISTS,
- 1360 => MDB2_ERROR_NOT_FOUND,
- 1363 => MDB2_ERROR_NOT_FOUND,
- 1365 => MDB2_ERROR_DIVZERO,
- 1451 => MDB2_ERROR_CONSTRAINT,
- 1452 => MDB2_ERROR_CONSTRAINT,
- 1542 => MDB2_ERROR_CANNOT_DROP,
- 1546 => MDB2_ERROR_CONSTRAINT,
- 1582 => MDB2_ERROR_CONSTRAINT,
- 2003 => MDB2_ERROR_CONNECT_FAILED,
- 2019 => MDB2_ERROR_INVALID,
- );
- }
- if ($this->options['portability'] & MDB2_PORTABILITY_ERRORS) {
- $ecode_map[1022] = MDB2_ERROR_CONSTRAINT;
- $ecode_map[1048] = MDB2_ERROR_CONSTRAINT_NOT_NULL;
- $ecode_map[1062] = MDB2_ERROR_CONSTRAINT;
- } else {
- // Doing this in case mode changes during runtime.
- $ecode_map[1022] = MDB2_ERROR_ALREADY_EXISTS;
- $ecode_map[1048] = MDB2_ERROR_CONSTRAINT;
- $ecode_map[1062] = MDB2_ERROR_ALREADY_EXISTS;
- }
- if (isset($ecode_map[$native_code])) {
- $error = $ecode_map[$native_code];
- }
- }
- return array($error, $native_code, $native_msg);
- }
-
- // }}}
- // {{{ escape()
-
- /**
- * Quotes a string so it can be safely used in a query. It will quote
- * the text so it can safely be used within a query.
- *
- * @param string the input string to quote
- * @param bool escape wildcards
- *
- * @return string quoted string
- *
- * @access public
- */
- function escape($text, $escape_wildcards = false)
- {
- if ($escape_wildcards) {
- $text = $this->escapePattern($text);
- }
- $connection = $this->getConnection();
- if (PEAR::isError($connection)) {
- return $connection;
- }
- $text = @mysql_real_escape_string($text, $connection);
- return $text;
- }
-
- // }}}
- // {{{ beginTransaction()
-
- /**
- * Start a transaction or set a savepoint.
- *
- * @param string name of a savepoint to set
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- *
- * @access public
- */
- function beginTransaction($savepoint = null)
- {
- $this->debug('Starting transaction/savepoint', __FUNCTION__, array('is_manip' => true, 'savepoint' => $savepoint));
- $this->_getServerCapabilities();
- if (!is_null($savepoint)) {
- if (!$this->supports('savepoints')) {
- return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'savepoints are not supported', __FUNCTION__);
- }
- if (!$this->in_transaction) {
- return $this->raiseError(MDB2_ERROR_INVALID, null, null,
- 'savepoint cannot be released when changes are auto committed', __FUNCTION__);
- }
- $query = 'SAVEPOINT '.$savepoint;
- return $this->_doQuery($query, true);
- } elseif ($this->in_transaction) {
- return MDB2_OK; //nothing to do
- }
- if (!$this->destructor_registered && $this->opened_persistent) {
- $this->destructor_registered = true;
- register_shutdown_function('MDB2_closeOpenTransactions');
- }
- $query = $this->start_transaction ? 'START TRANSACTION' : 'SET AUTOCOMMIT = 0';
- $result = $this->_doQuery($query, true);
- if (PEAR::isError($result)) {
- return $result;
- }
- $this->in_transaction = true;
- return MDB2_OK;
- }
-
- // }}}
- // {{{ commit()
-
- /**
- * Commit the database changes done during a transaction that is in
- * progress or release a savepoint. This function may only be called when
- * auto-committing is disabled, otherwise it will fail. Therefore, a new
- * transaction is implicitly started after committing the pending changes.
- *
- * @param string name of a savepoint to release
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- *
- * @access public
- */
- function commit($savepoint = null)
- {
- $this->debug('Committing transaction/savepoint', __FUNCTION__, array('is_manip' => true, 'savepoint' => $savepoint));
- if (!$this->in_transaction) {
- return $this->raiseError(MDB2_ERROR_INVALID, null, null,
- 'commit/release savepoint cannot be done changes are auto committed', __FUNCTION__);
- }
- if (!is_null($savepoint)) {
- if (!$this->supports('savepoints')) {
- return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'savepoints are not supported', __FUNCTION__);
- }
- $server_info = $this->getServerVersion();
- if (version_compare($server_info['major'].'.'.$server_info['minor'].'.'.$server_info['patch'], '5.0.3', '<')) {
- return MDB2_OK;
- }
- $query = 'RELEASE SAVEPOINT '.$savepoint;
- return $this->_doQuery($query, true);
- }
-
- if (!$this->supports('transactions')) {
- return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'transactions are not supported', __FUNCTION__);
- }
-
- $result = $this->_doQuery('COMMIT', true);
- if (PEAR::isError($result)) {
- return $result;
- }
- if (!$this->start_transaction) {
- $query = 'SET AUTOCOMMIT = 1';
- $result = $this->_doQuery($query, true);
- if (PEAR::isError($result)) {
- return $result;
- }
- }
- $this->in_transaction = false;
- return MDB2_OK;
- }
-
- // }}}
- // {{{ rollback()
-
- /**
- * Cancel any database changes done during a transaction or since a specific
- * savepoint that is in progress. This function may only be called when
- * auto-committing is disabled, otherwise it will fail. Therefore, a new
- * transaction is implicitly started after canceling the pending changes.
- *
- * @param string name of a savepoint to rollback to
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- *
- * @access public
- */
- function rollback($savepoint = null)
- {
- $this->debug('Rolling back transaction/savepoint', __FUNCTION__, array('is_manip' => true, 'savepoint' => $savepoint));
- if (!$this->in_transaction) {
- return $this->raiseError(MDB2_ERROR_INVALID, null, null,
- 'rollback cannot be done changes are auto committed', __FUNCTION__);
- }
- if (!is_null($savepoint)) {
- if (!$this->supports('savepoints')) {
- return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'savepoints are not supported', __FUNCTION__);
- }
- $query = 'ROLLBACK TO SAVEPOINT '.$savepoint;
- return $this->_doQuery($query, true);
- }
-
- $query = 'ROLLBACK';
- $result = $this->_doQuery($query, true);
- if (PEAR::isError($result)) {
- return $result;
- }
- if (!$this->start_transaction) {
- $query = 'SET AUTOCOMMIT = 1';
- $result = $this->_doQuery($query, true);
- if (PEAR::isError($result)) {
- return $result;
- }
- }
- $this->in_transaction = false;
- return MDB2_OK;
- }
-
- // }}}
- // {{{ function setTransactionIsolation()
-
- /**
- * Set the transacton isolation level.
- *
- * @param string standard isolation level
- * READ UNCOMMITTED (allows dirty reads)
- * READ COMMITTED (prevents dirty reads)
- * REPEATABLE READ (prevents nonrepeatable reads)
- * SERIALIZABLE (prevents phantom reads)
- * @param array some transaction options:
- * 'wait' => 'WAIT' | 'NO WAIT'
- * 'rw' => 'READ WRITE' | 'READ ONLY'
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- *
- * @access public
- * @since 2.1.1
- */
- function setTransactionIsolation($isolation, $options = array())
- {
- $this->debug('Setting transaction isolation level', __FUNCTION__, array('is_manip' => true));
- if (!$this->supports('transactions')) {
- return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'transactions are not supported', __FUNCTION__);
- }
- switch ($isolation) {
- case 'READ UNCOMMITTED':
- case 'READ COMMITTED':
- case 'REPEATABLE READ':
- case 'SERIALIZABLE':
- break;
- default:
- return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'isolation level is not supported: '.$isolation, __FUNCTION__);
- }
-
- $query = "SET SESSION TRANSACTION ISOLATION LEVEL $isolation";
- return $this->_doQuery($query, true);
- }
-
- // }}}
- // {{{ _doConnect()
-
- /**
- * do the grunt work of the connect
- *
- * @return connection on success or MDB2 Error Object on failure
- * @access protected
- */
- function _doConnect($username, $password, $persistent = false)
- {
- if (!PEAR::loadExtension($this->phptype)) {
- return $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- 'extension '.$this->phptype.' is not compiled into PHP', __FUNCTION__);
- }
-
- $params = array();
- $unix = ($this->dsn['protocol'] && $this->dsn['protocol'] == 'unix');
- if (empty($this->dsn['hostspec'])) {
- $this->dsn['hostspec'] = $unix ? '' : 'localhost';
- }
- if ($this->dsn['hostspec']) {
- $params[0] = $this->dsn['hostspec'] . ($this->dsn['port'] ? ':' . $this->dsn['port'] : '');
- } else {
- $params[0] = ':' . $this->dsn['socket'];
- }
- $params[] = $username ? $username : null;
- $params[] = $password ? $password : null;
- if (!$persistent) {
- if ($this->_isNewLinkSet()) {
- $params[] = true;
- } else {
- $params[] = false;
- }
- }
- if (version_compare(phpversion(), '4.3.0', '>=')) {
- $params[] = isset($this->dsn['client_flags'])
- ? $this->dsn['client_flags'] : null;
- }
- $connect_function = $persistent ? 'mysql_pconnect' : 'mysql_connect';
-
- $connection = @call_user_func_array($connect_function, $params);
- if (!$connection) {
- if (($err = @mysql_error()) != '') {
- return $this->raiseError(MDB2_ERROR_CONNECT_FAILED, null, null,
- $err, __FUNCTION__);
- } else {
- return $this->raiseError(MDB2_ERROR_CONNECT_FAILED, null, null,
- 'unable to establish a connection', __FUNCTION__);
- }
- }
-
- if (!empty($this->dsn['charset'])) {
- $result = $this->setCharset($this->dsn['charset'], $connection);
- if (PEAR::isError($result)) {
- $this->disconnect(false);
- return $result;
- }
- }
-
- return $connection;
- }
-
- // }}}
- // {{{ connect()
-
- /**
- * Connect to the database
- *
- * @return MDB2_OK on success, MDB2 Error Object on failure
- * @access public
- */
- function connect()
- {
- if (is_resource($this->connection)) {
- //if (count(array_diff($this->connected_dsn, $this->dsn)) == 0
- if (MDB2::areEquals($this->connected_dsn, $this->dsn)
- && $this->opened_persistent == $this->options['persistent']
- ) {
- return MDB2_OK;
- }
- $this->disconnect(false);
- }
-
- $connection = $this->_doConnect(
- $this->dsn['username'],
- $this->dsn['password'],
- $this->options['persistent']
- );
- if (PEAR::isError($connection)) {
- return $connection;
- }
-
- $this->connection = $connection;
- $this->connected_dsn = $this->dsn;
- $this->connected_database_name = '';
- $this->opened_persistent = $this->options['persistent'];
- $this->dbsyntax = $this->dsn['dbsyntax'] ? $this->dsn['dbsyntax'] : $this->phptype;
-
- if ($this->database_name) {
- if ($this->database_name != $this->connected_database_name) {
- if (!@mysql_select_db($this->database_name, $connection)) {
- $err = $this->raiseError(null, null, null,
- 'Could not select the database: '.$this->database_name, __FUNCTION__);
- return $err;
- }
- $this->connected_database_name = $this->database_name;
- }
- }
-
- $this->_getServerCapabilities();
-
- return MDB2_OK;
- }
-
- // }}}
- // {{{ setCharset()
-
- /**
- * Set the charset on the current connection
- *
- * @param string charset (or array(charset, collation))
- * @param resource connection handle
- *
- * @return true on success, MDB2 Error Object on failure
- */
- function setCharset($charset, $connection = null)
- {
- if (is_null($connection)) {
- $connection = $this->getConnection();
- if (PEAR::isError($connection)) {
- return $connection;
- }
- }
- $collation = null;
- if (is_array($charset) && 2 == count($charset)) {
- $collation = array_pop($charset);
- $charset = array_pop($charset);
- }
- $client_info = mysql_get_client_info();
- if (function_exists('mysql_set_charset') && version_compare($client_info, '5.0.6')) {
- if (!$result = mysql_set_charset($charset, $connection)) {
- $err = $this->raiseError(null, null, null,
- 'Could not set client character set', __FUNCTION__);
- return $err;
- }
- return $result;
- }
- $query = "SET NAMES '".mysql_real_escape_string($charset, $connection)."'";
- if (!is_null($collation)) {
- $query .= " COLLATE '".mysql_real_escape_string($collation, $connection)."'";
- }
- return $this->_doQuery($query, true, $connection);
- }
-
- // }}}
- // {{{ databaseExists()
-
- /**
- * check if given database name is exists?
- *
- * @param string $name name of the database that should be checked
- *
- * @return mixed true/false on success, a MDB2 error on failure
- * @access public
- */
- function databaseExists($name)
- {
- $connection = $this->_doConnect($this->dsn['username'],
- $this->dsn['password'],
- $this->options['persistent']);
- if (PEAR::isError($connection)) {
- return $connection;
- }
-
- $result = @mysql_select_db($name, $connection);
- @mysql_close($connection);
-
- return $result;
- }
-
- // }}}
- // {{{ disconnect()
-
- /**
- * Log out and disconnect from the database.
- *
- * @param boolean $force if the disconnect should be forced even if the
- * connection is opened persistently
- * @return mixed true on success, false if not connected and error
- * object on error
- * @access public
- */
- function disconnect($force = true)
- {
- if (is_resource($this->connection)) {
- if ($this->in_transaction) {
- $dsn = $this->dsn;
- $database_name = $this->database_name;
- $persistent = $this->options['persistent'];
- $this->dsn = $this->connected_dsn;
- $this->database_name = $this->connected_database_name;
- $this->options['persistent'] = $this->opened_persistent;
- $this->rollback();
- $this->dsn = $dsn;
- $this->database_name = $database_name;
- $this->options['persistent'] = $persistent;
- }
-
- if (!$this->opened_persistent || $force) {
- $ok = @mysql_close($this->connection);
- if (!$ok) {
- return $this->raiseError(MDB2_ERROR_DISCONNECT_FAILED,
- null, null, null, __FUNCTION__);
- }
- }
- } else {
- return false;
- }
- return parent::disconnect($force);
- }
-
- // }}}
- // {{{ standaloneQuery()
-
- /**
- * execute a query as DBA
- *
- * @param string $query the SQL query
- * @param mixed $types array that contains the types of the columns in
- * the result set
- * @param boolean $is_manip if the query is a manipulation query
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function standaloneQuery($query, $types = null, $is_manip = false)
- {
- $user = $this->options['DBA_username']? $this->options['DBA_username'] : $this->dsn['username'];
- $pass = $this->options['DBA_password']? $this->options['DBA_password'] : $this->dsn['password'];
- $connection = $this->_doConnect($user, $pass, $this->options['persistent']);
- if (PEAR::isError($connection)) {
- return $connection;
- }
-
- $offset = $this->offset;
- $limit = $this->limit;
- $this->offset = $this->limit = 0;
- $query = $this->_modifyQuery($query, $is_manip, $limit, $offset);
-
- $result = $this->_doQuery($query, $is_manip, $connection, $this->database_name);
- if (!PEAR::isError($result)) {
- $result = $this->_affectedRows($connection, $result);
- }
-
- @mysql_close($connection);
- return $result;
- }
-
- // }}}
- // {{{ _doQuery()
-
- /**
- * Execute a query
- * @param string $query query
- * @param boolean $is_manip if the query is a manipulation query
- * @param resource $connection
- * @param string $database_name
- * @return result or error object
- * @access protected
- */
- function _doQuery($query, $is_manip = false, $connection = null, $database_name = null)
- {
- $this->last_query = $query;
- $result = $this->debug($query, 'query', array('is_manip' => $is_manip, 'when' => 'pre'));
- if ($result) {
- if (PEAR::isError($result)) {
- return $result;
- }
- $query = $result;
- }
- if ($this->options['disable_query']) {
- $result = $is_manip ? 0 : null;
- return $result;
- }
-
- if (is_null($connection)) {
- $connection = $this->getConnection();
- if (PEAR::isError($connection)) {
- return $connection;
- }
- }
- if (is_null($database_name)) {
- $database_name = $this->database_name;
- }
-
- if ($database_name) {
- if ($database_name != $this->connected_database_name) {
- if (!@mysql_select_db($database_name, $connection)) {
- $err = $this->raiseError(null, null, null,
- 'Could not select the database: '.$database_name, __FUNCTION__);
- return $err;
- }
- $this->connected_database_name = $database_name;
- }
- }
-
- $function = $this->options['result_buffering']
- ? 'mysql_query' : 'mysql_unbuffered_query';
- $result = @$function($query, $connection);
- if (!$result && 0 !== mysql_errno($connection)) {
- $err = $this->raiseError(null, null, null,
- 'Could not execute statement', __FUNCTION__);
- return $err;
- }
-
- $this->debug($query, 'query', array('is_manip' => $is_manip, 'when' => 'post', 'result' => $result));
- return $result;
- }
-
- // }}}
- // {{{ _affectedRows()
-
- /**
- * Returns the number of rows affected
- *
- * @param resource $result
- * @param resource $connection
- * @return mixed MDB2 Error Object or the number of rows affected
- * @access private
- */
- function _affectedRows($connection, $result = null)
- {
- if (is_null($connection)) {
- $connection = $this->getConnection();
- if (PEAR::isError($connection)) {
- return $connection;
- }
- }
- return @mysql_affected_rows($connection);
- }
-
- // }}}
- // {{{ _modifyQuery()
-
- /**
- * Changes a query string for various DBMS specific reasons
- *
- * @param string $query query to modify
- * @param boolean $is_manip if it is a DML query
- * @param integer $limit limit the number of rows
- * @param integer $offset start reading from given offset
- * @return string modified query
- * @access protected
- */
- function _modifyQuery($query, $is_manip, $limit, $offset)
- {
- if ($this->options['portability'] & MDB2_PORTABILITY_DELETE_COUNT) {
- // "DELETE FROM table" gives 0 affected rows in MySQL.
- // This little hack lets you know how many rows were deleted.
- if (preg_match('/^\s*DELETE\s+FROM\s+(\S+)\s*$/i', $query)) {
- $query = preg_replace('/^\s*DELETE\s+FROM\s+(\S+)\s*$/',
- 'DELETE FROM \1 WHERE 1=1', $query);
- }
- }
- if ($limit > 0
- && !preg_match('/LIMIT\s*\d(?:\s*(?:,|OFFSET)\s*\d+)?(?:[^\)]*)?$/i', $query)
- ) {
- $query = rtrim($query);
- if (substr($query, -1) == ';') {
- $query = substr($query, 0, -1);
- }
-
- // LIMIT doesn't always come last in the query
- // @see http://dev.mysql.com/doc/refman/5.0/en/select.html
- $after = '';
- if (preg_match('/(\s+INTO\s+(?:OUT|DUMP)FILE\s.*)$/ims', $query, $matches)) {
- $after = $matches[0];
- $query = preg_replace('/(\s+INTO\s+(?:OUT|DUMP)FILE\s.*)$/ims', '', $query);
- } elseif (preg_match('/(\s+FOR\s+UPDATE\s*)$/i', $query, $matches)) {
- $after = $matches[0];
- $query = preg_replace('/(\s+FOR\s+UPDATE\s*)$/im', '', $query);
- } elseif (preg_match('/(\s+LOCK\s+IN\s+SHARE\s+MODE\s*)$/im', $query, $matches)) {
- $after = $matches[0];
- $query = preg_replace('/(\s+LOCK\s+IN\s+SHARE\s+MODE\s*)$/im', '', $query);
- }
-
- if ($is_manip) {
- return $query . " LIMIT $limit" . $after;
- } else {
- return $query . " LIMIT $offset, $limit" . $after;
- }
- }
- return $query;
- }
-
- // }}}
- // {{{ getServerVersion()
-
- /**
- * return version information about the server
- *
- * @param bool $native determines if the raw version string should be returned
- * @return mixed array/string with version information or MDB2 error object
- * @access public
- */
- function getServerVersion($native = false)
- {
- $connection = $this->getConnection();
- if (PEAR::isError($connection)) {
- return $connection;
- }
- if ($this->connected_server_info) {
- $server_info = $this->connected_server_info;
- } else {
- $server_info = @mysql_get_server_info($connection);
- }
- if (!$server_info) {
- return $this->raiseError(null, null, null,
- 'Could not get server information', __FUNCTION__);
- }
- // cache server_info
- $this->connected_server_info = $server_info;
- if (!$native) {
- $tmp = explode('.', $server_info, 3);
- if (isset($tmp[2]) && strpos($tmp[2], '-')) {
- $tmp2 = explode('-', @$tmp[2], 2);
- } else {
- $tmp2[0] = isset($tmp[2]) ? $tmp[2] : null;
- $tmp2[1] = null;
- }
- $server_info = array(
- 'major' => isset($tmp[0]) ? $tmp[0] : null,
- 'minor' => isset($tmp[1]) ? $tmp[1] : null,
- 'patch' => $tmp2[0],
- 'extra' => $tmp2[1],
- 'native' => $server_info,
- );
- }
- return $server_info;
- }
-
- // }}}
- // {{{ _getServerCapabilities()
-
- /**
- * Fetch some information about the server capabilities
- * (transactions, subselects, prepared statements, etc).
- *
- * @access private
- */
- function _getServerCapabilities()
- {
- if (!$this->server_capabilities_checked) {
- $this->server_capabilities_checked = true;
-
- //set defaults
- $this->supported['sub_selects'] = 'emulated';
- $this->supported['prepared_statements'] = 'emulated';
- $this->supported['triggers'] = false;
- $this->start_transaction = false;
- $this->varchar_max_length = 255;
-
- $server_info = $this->getServerVersion();
- if (is_array($server_info)) {
- $server_version = $server_info['major'].'.'.$server_info['minor'].'.'.$server_info['patch'];
-
- if (!version_compare($server_version, '4.1.0', '<')) {
- $this->supported['sub_selects'] = true;
- $this->supported['prepared_statements'] = true;
- }
-
- // SAVEPOINTs were introduced in MySQL 4.0.14 and 4.1.1 (InnoDB)
- if (version_compare($server_version, '4.1.0', '>=')) {
- if (version_compare($server_version, '4.1.1', '<')) {
- $this->supported['savepoints'] = false;
- }
- } elseif (version_compare($server_version, '4.0.14', '<')) {
- $this->supported['savepoints'] = false;
- }
-
- if (!version_compare($server_version, '4.0.11', '<')) {
- $this->start_transaction = true;
- }
-
- if (!version_compare($server_version, '5.0.3', '<')) {
- $this->varchar_max_length = 65532;
- }
-
- if (!version_compare($server_version, '5.0.2', '<')) {
- $this->supported['triggers'] = true;
- }
- }
- }
- }
-
- // }}}
- // {{{ function _skipUserDefinedVariable($query, $position)
-
- /**
- * Utility method, used by prepare() to avoid misinterpreting MySQL user
- * defined variables (SELECT @x:=5) for placeholders.
- * Check if the placeholder is a false positive, i.e. if it is an user defined
- * variable instead. If so, skip it and advance the position, otherwise
- * return the current position, which is valid
- *
- * @param string $query
- * @param integer $position current string cursor position
- * @return integer $new_position
- * @access protected
- */
- function _skipUserDefinedVariable($query, $position)
- {
- $found = strpos(strrev(substr($query, 0, $position)), '@');
- if ($found === false) {
- return $position;
- }
- $pos = strlen($query) - strlen(substr($query, $position)) - $found - 1;
- $substring = substr($query, $pos, $position - $pos + 2);
- if (preg_match('/^@\w+\s*:=$/', $substring)) {
- return $position + 1; //found an user defined variable: skip it
- }
- return $position;
- }
-
- // }}}
- // {{{ prepare()
-
- /**
- * Prepares a query for multiple execution with execute().
- * With some database backends, this is emulated.
- * prepare() requires a generic query as string like
- * 'INSERT INTO numbers VALUES(?,?)' or
- * 'INSERT INTO numbers VALUES(:foo,:bar)'.
- * The ? and :name and are placeholders which can be set using
- * bindParam() and the query can be sent off using the execute() method.
- * The allowed format for :name can be set with the 'bindname_format' option.
- *
- * @param string $query the query to prepare
- * @param mixed $types array that contains the types of the placeholders
- * @param mixed $result_types array that contains the types of the columns in
- * the result set or MDB2_PREPARE_RESULT, if set to
- * MDB2_PREPARE_MANIP the query is handled as a manipulation query
- * @param mixed $lobs key (field) value (parameter) pair for all lob placeholders
- * @return mixed resource handle for the prepared query on success, a MDB2
- * error on failure
- * @access public
- * @see bindParam, execute
- */
- function prepare($query, $types = null, $result_types = null, $lobs = array())
- {
- // connect to get server capabilities (http://pear.php.net/bugs/16147)
- $connection = $this->getConnection();
- if (PEAR::isError($connection)) {
- return $connection;
- }
-
- if ($this->options['emulate_prepared']
- || $this->supported['prepared_statements'] !== true
- ) {
- return parent::prepare($query, $types, $result_types, $lobs);
- }
- $is_manip = ($result_types === MDB2_PREPARE_MANIP);
- $offset = $this->offset;
- $limit = $this->limit;
- $this->offset = $this->limit = 0;
- $query = $this->_modifyQuery($query, $is_manip, $limit, $offset);
- $result = $this->debug($query, __FUNCTION__, array('is_manip' => $is_manip, 'when' => 'pre'));
- if ($result) {
- if (PEAR::isError($result)) {
- return $result;
- }
- $query = $result;
- }
- $placeholder_type_guess = $placeholder_type = null;
- $question = '?';
- $colon = ':';
- $positions = array();
- $position = 0;
- while ($position < strlen($query)) {
- $q_position = strpos($query, $question, $position);
- $c_position = strpos($query, $colon, $position);
- if ($q_position && $c_position) {
- $p_position = min($q_position, $c_position);
- } elseif ($q_position) {
- $p_position = $q_position;
- } elseif ($c_position) {
- $p_position = $c_position;
- } else {
- break;
- }
- if (is_null($placeholder_type)) {
- $placeholder_type_guess = $query[$p_position];
- }
-
- $new_pos = $this->_skipDelimitedStrings($query, $position, $p_position);
- if (PEAR::isError($new_pos)) {
- return $new_pos;
- }
- if ($new_pos != $position) {
- $position = $new_pos;
- continue; //evaluate again starting from the new position
- }
-
- //make sure this is not part of an user defined variable
- $new_pos = $this->_skipUserDefinedVariable($query, $position);
- if ($new_pos != $position) {
- $position = $new_pos;
- continue; //evaluate again starting from the new position
- }
-
- if ($query[$position] == $placeholder_type_guess) {
- if (is_null($placeholder_type)) {
- $placeholder_type = $query[$p_position];
- $question = $colon = $placeholder_type;
- }
- if ($placeholder_type == ':') {
- $regexp = '/^.{'.($position+1).'}('.$this->options['bindname_format'].').*$/s';
- $parameter = preg_replace($regexp, '\\1', $query);
- if ($parameter === '') {
- $err = $this->raiseError(MDB2_ERROR_SYNTAX, null, null,
- 'named parameter name must match "bindname_format" option', __FUNCTION__);
- return $err;
- }
- $positions[$p_position] = $parameter;
- $query = substr_replace($query, '?', $position, strlen($parameter)+1);
- } else {
- $positions[$p_position] = count($positions);
- }
- $position = $p_position + 1;
- } else {
- $position = $p_position;
- }
- }
-
- static $prep_statement_counter = 1;
- $statement_name = sprintf($this->options['statement_format'], $this->phptype, $prep_statement_counter++ . sha1(microtime() + mt_rand()));
- $statement_name = substr(strtolower($statement_name), 0, $this->options['max_identifiers_length']);
- $query = "PREPARE $statement_name FROM ".$this->quote($query, 'text');
- $statement = $this->_doQuery($query, true, $connection);
- if (PEAR::isError($statement)) {
- return $statement;
- }
-
- $class_name = 'MDB2_Statement_'.$this->phptype;
- $obj = new $class_name($this, $statement_name, $positions, $query, $types, $result_types, $is_manip, $limit, $offset);
- $this->debug($query, __FUNCTION__, array('is_manip' => $is_manip, 'when' => 'post', 'result' => $obj));
- return $obj;
- }
-
- // }}}
- // {{{ replace()
-
- /**
- * Execute a SQL REPLACE query. A REPLACE query is identical to a INSERT
- * query, except that if there is already a row in the table with the same
- * key field values, the old row is deleted before the new row is inserted.
- *
- * The REPLACE type of query does not make part of the SQL standards. Since
- * practically only MySQL implements it natively, this type of query is
- * emulated through this method for other DBMS using standard types of
- * queries inside a transaction to assure the atomicity of the operation.
- *
- * @access public
- *
- * @param string $table name of the table on which the REPLACE query will
- * be executed.
- * @param array $fields associative array that describes the fields and the
- * values that will be inserted or updated in the specified table. The
- * indexes of the array are the names of all the fields of the table. The
- * values of the array are also associative arrays that describe the
- * values and other properties of the table fields.
- *
- * Here follows a list of field properties that need to be specified:
- *
- * value:
- * Value to be assigned to the specified field. This value may be
- * of specified in database independent type format as this
- * function can perform the necessary datatype conversions.
- *
- * Default:
- * this property is required unless the Null property
- * is set to 1.
- *
- * type
- * Name of the type of the field. Currently, all types Metabase
- * are supported except for clob and blob.
- *
- * Default: no type conversion
- *
- * null
- * Boolean property that indicates that the value for this field
- * should be set to null.
- *
- * The default value for fields missing in INSERT queries may be
- * specified the definition of a table. Often, the default value
- * is already null, but since the REPLACE may be emulated using
- * an UPDATE query, make sure that all fields of the table are
- * listed in this function argument array.
- *
- * Default: 0
- *
- * key
- * Boolean property that indicates that this field should be
- * handled as a primary key or at least as part of the compound
- * unique index of the table that will determine the row that will
- * updated if it exists or inserted a new row otherwise.
- *
- * This function will fail if no key field is specified or if the
- * value of a key field is set to null because fields that are
- * part of unique index they may not be null.
- *
- * Default: 0
- *
- * @see http://dev.mysql.com/doc/refman/5.0/en/replace.html
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- */
- function replace($table, $fields)
- {
- $count = count($fields);
- $query = $values = '';
- $keys = $colnum = 0;
- for (reset($fields); $colnum < $count; next($fields), $colnum++) {
- $name = key($fields);
- if ($colnum > 0) {
- $query .= ',';
- $values.= ',';
- }
- $query.= $this->quoteIdentifier($name, true);
- if (isset($fields[$name]['null']) && $fields[$name]['null']) {
- $value = 'NULL';
- } else {
- $type = isset($fields[$name]['type']) ? $fields[$name]['type'] : null;
- $value = $this->quote($fields[$name]['value'], $type);
- if (PEAR::isError($value)) {
- return $value;
- }
- }
- $values.= $value;
- if (isset($fields[$name]['key']) && $fields[$name]['key']) {
- if ($value === 'NULL') {
- return $this->raiseError(MDB2_ERROR_CANNOT_REPLACE, null, null,
- 'key value '.$name.' may not be NULL', __FUNCTION__);
- }
- $keys++;
- }
- }
- if ($keys == 0) {
- return $this->raiseError(MDB2_ERROR_CANNOT_REPLACE, null, null,
- 'not specified which fields are keys', __FUNCTION__);
- }
-
- $connection = $this->getConnection();
- if (PEAR::isError($connection)) {
- return $connection;
- }
-
- $table = $this->quoteIdentifier($table, true);
- $query = "REPLACE INTO $table ($query) VALUES ($values)";
- $result = $this->_doQuery($query, true, $connection);
- if (PEAR::isError($result)) {
- return $result;
- }
- return $this->_affectedRows($connection, $result);
- }
-
- // }}}
- // {{{ nextID()
-
- /**
- * Returns the next free id of a sequence
- *
- * @param string $seq_name name of the sequence
- * @param boolean $ondemand when true the sequence is
- * automatic created, if it
- * not exists
- *
- * @return mixed MDB2 Error Object or id
- * @access public
- */
- function nextID($seq_name, $ondemand = true)
- {
- $sequence_name = $this->quoteIdentifier($this->getSequenceName($seq_name), true);
- $seqcol_name = $this->quoteIdentifier($this->options['seqcol_name'], true);
- $query = "INSERT INTO $sequence_name ($seqcol_name) VALUES (NULL)";
- $this->pushErrorHandling(PEAR_ERROR_RETURN);
- $this->expectError(MDB2_ERROR_NOSUCHTABLE);
- $result = $this->_doQuery($query, true);
- $this->popExpect();
- $this->popErrorHandling();
- if (PEAR::isError($result)) {
- if ($ondemand && $result->getCode() == MDB2_ERROR_NOSUCHTABLE) {
- $this->loadModule('Manager', null, true);
- $result = $this->manager->createSequence($seq_name);
- if (PEAR::isError($result)) {
- return $this->raiseError($result, null, null,
- 'on demand sequence '.$seq_name.' could not be created', __FUNCTION__);
- } else {
- return $this->nextID($seq_name, false);
- }
- }
- return $result;
- }
- $value = $this->lastInsertID();
- if (is_numeric($value)) {
- $query = "DELETE FROM $sequence_name WHERE $seqcol_name < $value";
- $result = $this->_doQuery($query, true);
- if (PEAR::isError($result)) {
- $this->warnings[] = 'nextID: could not delete previous sequence table values from '.$seq_name;
- }
- }
- return $value;
- }
-
- // }}}
- // {{{ lastInsertID()
-
- /**
- * Returns the autoincrement ID if supported or $id or fetches the current
- * ID in a sequence called: $table.(empty($field) ? '' : '_'.$field)
- *
- * @param string $table name of the table into which a new row was inserted
- * @param string $field name of the field into which a new row was inserted
- * @return mixed MDB2 Error Object or id
- * @access public
- */
- function lastInsertID($table = null, $field = null)
- {
- // not using mysql_insert_id() due to http://pear.php.net/bugs/bug.php?id=8051
- // not casting to integer to handle BIGINT http://pear.php.net/bugs/bug.php?id=17650
- return $this->queryOne('SELECT LAST_INSERT_ID()');
- }
-
- // }}}
- // {{{ currID()
-
- /**
- * Returns the current id of a sequence
- *
- * @param string $seq_name name of the sequence
- * @return mixed MDB2 Error Object or id
- * @access public
- */
- function currID($seq_name)
- {
- $sequence_name = $this->quoteIdentifier($this->getSequenceName($seq_name), true);
- $seqcol_name = $this->quoteIdentifier($this->options['seqcol_name'], true);
- $query = "SELECT MAX($seqcol_name) FROM $sequence_name";
- return $this->queryOne($query, 'integer');
- }
-}
-
-/**
- * MDB2 MySQL result driver
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Result_mysql extends MDB2_Result_Common
-{
- // }}}
- // {{{ fetchRow()
-
- /**
- * Fetch a row and insert the data into an existing array.
- *
- * @param int $fetchmode how the array data should be indexed
- * @param int $rownum number of the row where the data can be found
- * @return int data array on success, a MDB2 error on failure
- * @access public
- */
- function fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null)
- {
- if (!is_null($rownum)) {
- $seek = $this->seek($rownum);
- if (PEAR::isError($seek)) {
- return $seek;
- }
- }
- if ($fetchmode == MDB2_FETCHMODE_DEFAULT) {
- $fetchmode = $this->db->fetchmode;
- }
- if ( $fetchmode == MDB2_FETCHMODE_ASSOC
- || $fetchmode == MDB2_FETCHMODE_OBJECT
- ) {
- $row = @mysql_fetch_assoc($this->result);
- if (is_array($row)
- && $this->db->options['portability'] & MDB2_PORTABILITY_FIX_CASE
- ) {
- $row = array_change_key_case($row, $this->db->options['field_case']);
- }
- } else {
- $row = @mysql_fetch_row($this->result);
- }
-
- if (!$row) {
- if ($this->result === false) {
- $err = $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
- 'resultset has already been freed', __FUNCTION__);
- return $err;
- }
- return null;
- }
- $mode = $this->db->options['portability'] & MDB2_PORTABILITY_EMPTY_TO_NULL;
- $rtrim = false;
- if ($this->db->options['portability'] & MDB2_PORTABILITY_RTRIM) {
- if (empty($this->types)) {
- $mode += MDB2_PORTABILITY_RTRIM;
- } else {
- $rtrim = true;
- }
- }
- if ($mode) {
- $this->db->_fixResultArrayValues($row, $mode);
- }
- if ( ( $fetchmode != MDB2_FETCHMODE_ASSOC
- && $fetchmode != MDB2_FETCHMODE_OBJECT)
- && !empty($this->types)
- ) {
- $row = $this->db->datatype->convertResultRow($this->types, $row, $rtrim);
- } elseif (($fetchmode == MDB2_FETCHMODE_ASSOC
- || $fetchmode == MDB2_FETCHMODE_OBJECT)
- && !empty($this->types_assoc)
- ) {
- $row = $this->db->datatype->convertResultRow($this->types_assoc, $row, $rtrim);
- }
- if (!empty($this->values)) {
- $this->_assignBindColumns($row);
- }
- if ($fetchmode === MDB2_FETCHMODE_OBJECT) {
- $object_class = $this->db->options['fetch_class'];
- if ($object_class == 'stdClass') {
- $row = (object) $row;
- } else {
- $rowObj = new $object_class($row);
- $row = $rowObj;
- }
- }
- ++$this->rownum;
- return $row;
- }
-
- // }}}
- // {{{ _getColumnNames()
-
- /**
- * Retrieve the names of columns returned by the DBMS in a query result.
- *
- * @return mixed Array variable that holds the names of columns as keys
- * or an MDB2 error on failure.
- * Some DBMS may not return any columns when the result set
- * does not contain any rows.
- * @access private
- */
- function _getColumnNames()
- {
- $columns = array();
- $numcols = $this->numCols();
- if (PEAR::isError($numcols)) {
- return $numcols;
- }
- for ($column = 0; $column < $numcols; $column++) {
- $column_name = @mysql_field_name($this->result, $column);
- $columns[$column_name] = $column;
- }
- if ($this->db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $columns = array_change_key_case($columns, $this->db->options['field_case']);
- }
- return $columns;
- }
-
- // }}}
- // {{{ numCols()
-
- /**
- * Count the number of columns returned by the DBMS in a query result.
- *
- * @return mixed integer value with the number of columns, a MDB2 error
- * on failure
- * @access public
- */
- function numCols()
- {
- $cols = @mysql_num_fields($this->result);
- if (is_null($cols)) {
- if ($this->result === false) {
- return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
- 'resultset has already been freed', __FUNCTION__);
- } elseif (is_null($this->result)) {
- return count($this->types);
- }
- return $this->db->raiseError(null, null, null,
- 'Could not get column count', __FUNCTION__);
- }
- return $cols;
- }
-
- // }}}
- // {{{ free()
-
- /**
- * Free the internal resources associated with result.
- *
- * @return boolean true on success, false if result is invalid
- * @access public
- */
- function free()
- {
- if (is_resource($this->result) && $this->db->connection) {
- $free = @mysql_free_result($this->result);
- if ($free === false) {
- return $this->db->raiseError(null, null, null,
- 'Could not free result', __FUNCTION__);
- }
- }
- $this->result = false;
- return MDB2_OK;
- }
-}
-
-/**
- * MDB2 MySQL buffered result driver
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_BufferedResult_mysql extends MDB2_Result_mysql
-{
- // }}}
- // {{{ seek()
-
- /**
- * Seek to a specific row in a result set
- *
- * @param int $rownum number of the row where the data can be found
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function seek($rownum = 0)
- {
- if ($this->rownum != ($rownum - 1) && !@mysql_data_seek($this->result, $rownum)) {
- if ($this->result === false) {
- return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
- 'resultset has already been freed', __FUNCTION__);
- } elseif (is_null($this->result)) {
- return MDB2_OK;
- }
- return $this->db->raiseError(MDB2_ERROR_INVALID, null, null,
- 'tried to seek to an invalid row number ('.$rownum.')', __FUNCTION__);
- }
- $this->rownum = $rownum - 1;
- return MDB2_OK;
- }
-
- // }}}
- // {{{ valid()
-
- /**
- * Check if the end of the result set has been reached
- *
- * @return mixed true or false on sucess, a MDB2 error on failure
- * @access public
- */
- function valid()
- {
- $numrows = $this->numRows();
- if (PEAR::isError($numrows)) {
- return $numrows;
- }
- return $this->rownum < ($numrows - 1);
- }
-
- // }}}
- // {{{ numRows()
-
- /**
- * Returns the number of rows in a result object
- *
- * @return mixed MDB2 Error Object or the number of rows
- * @access public
- */
- function numRows()
- {
- $rows = @mysql_num_rows($this->result);
- if (false === $rows) {
- if (false === $this->result) {
- return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
- 'resultset has already been freed', __FUNCTION__);
- } elseif (is_null($this->result)) {
- return 0;
- }
- return $this->db->raiseError(null, null, null,
- 'Could not get row count', __FUNCTION__);
- }
- return $rows;
- }
-
- // }}}
-}
-
-/**
- * MDB2 MySQL statement driver
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Statement_mysql extends MDB2_Statement_Common
-{
- // {{{ _execute()
-
- /**
- * Execute a prepared query statement helper method.
- *
- * @param mixed $result_class string which specifies which result class to use
- * @param mixed $result_wrap_class string which specifies which class to wrap results in
- *
- * @return mixed MDB2_Result or integer (affected rows) on success,
- * a MDB2 error on failure
- * @access private
- */
- function _execute($result_class = true, $result_wrap_class = true)
- {
- if (is_null($this->statement)) {
- $result = parent::_execute($result_class, $result_wrap_class);
- return $result;
- }
- $this->db->last_query = $this->query;
- $this->db->debug($this->query, 'execute', array('is_manip' => $this->is_manip, 'when' => 'pre', 'parameters' => $this->values));
- if ($this->db->getOption('disable_query')) {
- $result = $this->is_manip ? 0 : null;
- return $result;
- }
-
- $connection = $this->db->getConnection();
- if (PEAR::isError($connection)) {
- return $connection;
- }
-
- $query = 'EXECUTE '.$this->statement;
- if (!empty($this->positions)) {
- $parameters = array();
- foreach ($this->positions as $parameter) {
- if (!array_key_exists($parameter, $this->values)) {
- return $this->db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- 'Unable to bind to missing placeholder: '.$parameter, __FUNCTION__);
- }
- $close = false;
- $value = $this->values[$parameter];
- $type = array_key_exists($parameter, $this->types) ? $this->types[$parameter] : null;
- if (is_resource($value) || $type == 'clob' || $type == 'blob' && $this->db->options['lob_allow_url_include']) {
- if (!is_resource($value) && preg_match('/^(\w+:\/\/)(.*)$/', $value, $match)) {
- if ($match[1] == 'file://') {
- $value = $match[2];
- }
- $value = @fopen($value, 'r');
- $close = true;
- }
- if (is_resource($value)) {
- $data = '';
- while (!@feof($value)) {
- $data.= @fread($value, $this->db->options['lob_buffer_length']);
- }
- if ($close) {
- @fclose($value);
- }
- $value = $data;
- }
- }
- $quoted = $this->db->quote($value, $type);
- if (PEAR::isError($quoted)) {
- return $quoted;
- }
- $param_query = 'SET @'.$parameter.' = '.$quoted;
- $result = $this->db->_doQuery($param_query, true, $connection);
- if (PEAR::isError($result)) {
- return $result;
- }
- }
- $query.= ' USING @'.implode(', @', array_values($this->positions));
- }
-
- $result = $this->db->_doQuery($query, $this->is_manip, $connection);
- if (PEAR::isError($result)) {
- return $result;
- }
-
- if ($this->is_manip) {
- $affected_rows = $this->db->_affectedRows($connection, $result);
- return $affected_rows;
- }
-
- $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;
- }
-
- // }}}
- // {{{ free()
-
- /**
- * Release resources allocated for the specified prepared query.
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function free()
- {
- if (is_null($this->positions)) {
- return $this->db->raiseError(MDB2_ERROR, null, null,
- 'Prepared statement has already been freed', __FUNCTION__);
- }
- $result = MDB2_OK;
-
- if (!is_null($this->statement)) {
- $connection = $this->db->getConnection();
- if (PEAR::isError($connection)) {
- return $connection;
- }
- $query = 'DEALLOCATE PREPARE '.$this->statement;
- $result = $this->db->_doQuery($query, true, $connection);
- }
-
- parent::free();
- return $result;
- }
-}
-?>
diff --git a/3rdparty/MDB2/Driver/oci8.php b/3rdparty/MDB2/Driver/oci8.php
deleted file mode 100644
index a1eefc94d15..00000000000
--- a/3rdparty/MDB2/Driver/oci8.php
+++ /dev/null
@@ -1,1700 +0,0 @@
-<?php
-// vim: set et ts=4 sw=4 fdm=marker:
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2008 Manuel Lemos, Tomas V.V.Cox, |
-// | Stig. S. Bakken, Lukas Smith |
-// | All rights reserved. |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
-// | API as well as database abstraction for PHP applications. |
-// | This LICENSE is in the BSD license style. |
-// | |
-// | Redistribution and use in source and binary forms, with or without |
-// | modification, are permitted provided that the following conditions |
-// | are met: |
-// | |
-// | Redistributions of source code must retain the above copyright |
-// | notice, this list of conditions and the following disclaimer. |
-// | |
-// | Redistributions in binary form must reproduce the above copyright |
-// | notice, this list of conditions and the following disclaimer in the |
-// | documentation and/or other materials provided with the distribution. |
-// | |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission. |
-// | |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-// | POSSIBILITY OF SUCH DAMAGE. |
-// +----------------------------------------------------------------------+
-// | Author: Lukas Smith <smith@pooteeweet.org> |
-// +----------------------------------------------------------------------+
-
-// $Id: oci8.php 295587 2010-02-28 17:16:38Z quipo $
-
-/**
- * MDB2 OCI8 driver
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Driver_oci8 extends MDB2_Driver_Common
-{
- // {{{ properties
- var $string_quoting = array('start' => "'", 'end' => "'", 'escape' => "'", 'escape_pattern' => '@');
-
- var $identifier_quoting = array('start' => '"', 'end' => '"', 'escape' => '"');
-
- var $uncommitedqueries = 0;
- // }}}
- // {{{ constructor
-
- /**
- * Constructor
- */
- function __construct()
- {
- parent::__construct();
-
- $this->phptype = 'oci8';
- $this->dbsyntax = 'oci8';
-
- $this->supported['sequences'] = true;
- $this->supported['indexes'] = true;
- $this->supported['summary_functions'] = true;
- $this->supported['order_by_text'] = true;
- $this->supported['current_id'] = true;
- $this->supported['affected_rows'] = true;
- $this->supported['transactions'] = true;
- $this->supported['savepoints'] = true;
- $this->supported['limit_queries'] = true;
- $this->supported['LOBs'] = true;
- $this->supported['replace'] = 'emulated';
- $this->supported['sub_selects'] = true;
- $this->supported['triggers'] = true;
- $this->supported['auto_increment'] = false; // implementation is broken
- $this->supported['primary_key'] = true;
- $this->supported['result_introspection'] = true;
- $this->supported['prepared_statements'] = true;
- $this->supported['identifier_quoting'] = true;
- $this->supported['pattern_escaping'] = true;
- $this->supported['new_link'] = true;
-
- $this->options['DBA_username'] = false;
- $this->options['DBA_password'] = false;
- $this->options['database_name_prefix'] = false;
- $this->options['emulate_database'] = true;
- $this->options['default_tablespace'] = false;
- $this->options['default_text_field_length'] = 2000;
- $this->options['lob_allow_url_include'] = false;
- $this->options['result_prefetching'] = false;
- $this->options['max_identifiers_length'] = 30;
- }
-
- // }}}
- // {{{ errorInfo()
-
- /**
- * This method is used to collect information about an error
- *
- * @param integer $error
- * @return array
- * @access public
- */
- function errorInfo($error = null)
- {
- if (is_resource($error)) {
- $error_data = @OCIError($error);
- $error = null;
- } elseif ($this->connection) {
- $error_data = @OCIError($this->connection);
- } else {
- $error_data = @OCIError();
- }
- $native_code = $error_data['code'];
- $native_msg = $error_data['message'];
- if (null === $error) {
- static $ecode_map;
- if (empty($ecode_map)) {
- $ecode_map = array(
- 1 => MDB2_ERROR_CONSTRAINT,
- 900 => MDB2_ERROR_SYNTAX,
- 904 => MDB2_ERROR_NOSUCHFIELD,
- 911 => MDB2_ERROR_SYNTAX, //invalid character
- 913 => MDB2_ERROR_VALUE_COUNT_ON_ROW,
- 921 => MDB2_ERROR_SYNTAX,
- 923 => MDB2_ERROR_SYNTAX,
- 942 => MDB2_ERROR_NOSUCHTABLE,
- 955 => MDB2_ERROR_ALREADY_EXISTS,
- 1400 => MDB2_ERROR_CONSTRAINT_NOT_NULL,
- 1401 => MDB2_ERROR_INVALID,
- 1407 => MDB2_ERROR_CONSTRAINT_NOT_NULL,
- 1418 => MDB2_ERROR_NOT_FOUND,
- 1435 => MDB2_ERROR_NOT_FOUND,
- 1476 => MDB2_ERROR_DIVZERO,
- 1722 => MDB2_ERROR_INVALID_NUMBER,
- 2289 => MDB2_ERROR_NOSUCHTABLE,
- 2291 => MDB2_ERROR_CONSTRAINT,
- 2292 => MDB2_ERROR_CONSTRAINT,
- 2449 => MDB2_ERROR_CONSTRAINT,
- 4081 => MDB2_ERROR_ALREADY_EXISTS, //trigger already exists
- 24344 => MDB2_ERROR_SYNTAX, //success with compilation error
- );
- }
- if (isset($ecode_map[$native_code])) {
- $error = $ecode_map[$native_code];
- }
- }
- return array($error, $native_code, $native_msg);
- }
-
- // }}}
- // {{{ beginTransaction()
-
- /**
- * Start a transaction or set a savepoint.
- *
- * @param string name of a savepoint to set
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- *
- * @access public
- */
- function beginTransaction($savepoint = null)
- {
- $this->debug('Starting transaction/savepoint', __FUNCTION__, array('is_manip' => true, 'savepoint' => $savepoint));
- if (null !== $savepoint) {
- if (!$this->in_transaction) {
- return $this->raiseError(MDB2_ERROR_INVALID, null, null,
- 'savepoint cannot be released when changes are auto committed', __FUNCTION__);
- }
- $query = 'SAVEPOINT '.$savepoint;
- return $this->_doQuery($query, true);
- }
- if ($this->in_transaction) {
- return MDB2_OK; //nothing to do
- }
- if (!$this->destructor_registered && $this->opened_persistent) {
- $this->destructor_registered = true;
- register_shutdown_function('MDB2_closeOpenTransactions');
- }
- $this->in_transaction = true;
- ++$this->uncommitedqueries;
- return MDB2_OK;
- }
-
- // }}}
- // {{{ commit()
-
- /**
- * Commit the database changes done during a transaction that is in
- * progress or release a savepoint. This function may only be called when
- * auto-committing is disabled, otherwise it will fail. Therefore, a new
- * transaction is implicitly started after committing the pending changes.
- *
- * @param string name of a savepoint to release
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- *
- * @access public
- */
- function commit($savepoint = null)
- {
- $this->debug('Committing transaction/savepoint', __FUNCTION__, array('is_manip' => true, 'savepoint' => $savepoint));
- if (!$this->in_transaction) {
- return $this->raiseError(MDB2_ERROR_INVALID, null, null,
- 'commit/release savepoint cannot be done changes are auto committed', __FUNCTION__);
- }
- if (null !== $savepoint) {
- return MDB2_OK;
- }
-
- if ($this->uncommitedqueries) {
- $connection = $this->getConnection();
- if (PEAR::isError($connection)) {
- return $connection;
- }
- if (!@OCICommit($connection)) {
- return $this->raiseError(null, null, null,
- 'Unable to commit transaction', __FUNCTION__);
- }
- $this->uncommitedqueries = 0;
- }
- $this->in_transaction = false;
- return MDB2_OK;
- }
-
- // }}}
- // {{{ rollback()
-
- /**
- * Cancel any database changes done during a transaction or since a specific
- * savepoint that is in progress. This function may only be called when
- * auto-committing is disabled, otherwise it will fail. Therefore, a new
- * transaction is implicitly started after canceling the pending changes.
- *
- * @param string name of a savepoint to rollback to
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- *
- * @access public
- */
- function rollback($savepoint = null)
- {
- $this->debug('Rolling back transaction/savepoint', __FUNCTION__, array('is_manip' => true, 'savepoint' => $savepoint));
- if (!$this->in_transaction) {
- return $this->raiseError(MDB2_ERROR_INVALID, null, null,
- 'rollback cannot be done changes are auto committed', __FUNCTION__);
- }
- if (null !== $savepoint) {
- $query = 'ROLLBACK TO SAVEPOINT '.$savepoint;
- return $this->_doQuery($query, true);
- }
-
- if ($this->uncommitedqueries) {
- $connection = $this->getConnection();
- if (PEAR::isError($connection)) {
- return $connection;
- }
- if (!@OCIRollback($connection)) {
- return $this->raiseError(null, null, null,
- 'Unable to rollback transaction', __FUNCTION__);
- }
- $this->uncommitedqueries = 0;
- }
- $this->in_transaction = false;
- return MDB2_OK;
- }
-
- // }}}
- // {{{ function setTransactionIsolation()
-
- /**
- * Set the transacton isolation level.
- *
- * @param string standard isolation level
- * READ UNCOMMITTED (allows dirty reads)
- * READ COMMITTED (prevents dirty reads)
- * REPEATABLE READ (prevents nonrepeatable reads)
- * SERIALIZABLE (prevents phantom reads)
- * @param array some transaction options:
- * 'wait' => 'WAIT' | 'NO WAIT'
- * 'rw' => 'READ WRITE' | 'READ ONLY'
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- *
- * @access public
- * @since 2.1.1
- */
- function setTransactionIsolation($isolation, $options = array())
- {
- $this->debug('Setting transaction isolation level', __FUNCTION__, array('is_manip' => true));
- switch ($isolation) {
- case 'READ UNCOMMITTED':
- $isolation = 'READ COMMITTED';
- case 'READ COMMITTED':
- case 'REPEATABLE READ':
- $isolation = 'SERIALIZABLE';
- case 'SERIALIZABLE':
- break;
- default:
- return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'isolation level is not supported: '.$isolation, __FUNCTION__);
- }
-
- $query = "ALTER SESSION ISOLATION LEVEL $isolation";
- return $this->_doQuery($query, true);
- }
-
- // }}}
- // {{{ _doConnect()
-
- /**
- * do the grunt work of the connect
- *
- * @return connection on success or MDB2 Error Object on failure
- * @access protected
- */
- function _doConnect($username, $password, $persistent = false)
- {
- if (!PEAR::loadExtension($this->phptype)) {
- return $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- 'extension '.$this->phptype.' is not compiled into PHP', __FUNCTION__);
- }
-
- $sid = '';
-
- if (!empty($this->dsn['service']) && $this->dsn['hostspec']) {
- //oci8://username:password@foo.example.com[:port]/?service=service
- // service name is given, it is assumed that hostspec is really a
- // hostname, we try to construct an oracle connection string from this
- $port = $this->dsn['port'] ? $this->dsn['port'] : 1521;
- $sid = sprintf("(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)
- (HOST=%s) (PORT=%s)))
- (CONNECT_DATA=(SERVICE_NAME=%s)))",
- $this->dsn['hostspec'],
- $port,
- $this->dsn['service']
- );
- } elseif ($this->dsn['hostspec']) {
- // we are given something like 'oci8://username:password@foo/'
- // we have hostspec but not a service name, now we assume that
- // hostspec is a tnsname defined in tnsnames.ora
- $sid = $this->dsn['hostspec'];
- if (isset($this->dsn['port']) && $this->dsn['port']) {
- $sid = $sid.':'.$this->dsn['port'];
- }
- } else {
- // oci://username:password@
- // if everything fails, we have to rely on environment variables
- // not before a check to 'emulate_database'
- if (!$this->options['emulate_database'] && $this->database_name) {
- $sid = $this->database_name;
- } elseif (getenv('ORACLE_SID')) {
- $sid = getenv('ORACLE_SID');
- } elseif ($sid = getenv('TWO_TASK')) {
- $sid = getenv('TWO_TASK');
- } else {
- return $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- 'not a valid connection string or environment variable [ORACLE_SID|TWO_TASK] not set',
- __FUNCTION__);
- }
- }
-
- if (function_exists('oci_connect')) {
- if ($this->_isNewLinkSet()) {
- $connect_function = 'oci_new_connect';
- } else {
- $connect_function = $persistent ? 'oci_pconnect' : 'oci_connect';
- }
-
- $charset = empty($this->dsn['charset']) ? null : $this->dsn['charset'];
- $session_mode = empty($this->dsn['session_mode']) ? null : $this->dsn['session_mode'];
- $connection = @$connect_function($username, $password, $sid, $charset, $session_mode);
- $error = @OCIError();
- if (isset($error['code']) && $error['code'] == 12541) {
- // Couldn't find TNS listener. Try direct connection.
- $connection = @$connect_function($username, $password, null, $charset);
- }
- } else {
- $connect_function = $persistent ? 'OCIPLogon' : 'OCILogon';
- $connection = @$connect_function($username, $password, $sid);
-
- if (!empty($this->dsn['charset'])) {
- $result = $this->setCharset($this->dsn['charset'], $connection);
- if (PEAR::isError($result)) {
- return $result;
- }
- }
- }
-
- if (!$connection) {
- return $this->raiseError(MDB2_ERROR_CONNECT_FAILED, null, null,
- 'unable to establish a connection', __FUNCTION__);
- }
-
- if (empty($this->dsn['disable_iso_date'])) {
- $query = "ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'";
- $err = $this->_doQuery($query, true, $connection);
- if (PEAR::isError($err)) {
- $this->disconnect(false);
- return $err;
- }
- }
-
- $query = "ALTER SESSION SET NLS_NUMERIC_CHARACTERS='. '";
- $err = $this->_doQuery($query, true, $connection);
- if (PEAR::isError($err)) {
- $this->disconnect(false);
- return $err;
- }
-
- return $connection;
- }
-
- // }}}
- // {{{ connect()
-
- /**
- * Connect to the database
- *
- * @return MDB2_OK on success, MDB2 Error Object on failure
- * @access public
- */
- function connect()
- {
- if (is_resource($this->connection)) {
- //if (count(array_diff($this->connected_dsn, $this->dsn)) == 0
- if (MDB2::areEquals($this->connected_dsn, $this->dsn)
- && $this->opened_persistent == $this->options['persistent']
- ) {
- return MDB2_OK;
- }
- $this->disconnect(false);
- }
-
- if ($this->database_name && $this->options['emulate_database']) {
- $this->dsn['username'] = $this->options['database_name_prefix'].$this->database_name;
- }
-
- $connection = $this->_doConnect($this->dsn['username'],
- $this->dsn['password'],
- $this->options['persistent']);
- if (PEAR::isError($connection)) {
- return $connection;
- }
- $this->connection = $connection;
- $this->connected_dsn = $this->dsn;
- $this->connected_database_name = '';
- $this->opened_persistent = $this->options['persistent'];
- $this->dbsyntax = $this->dsn['dbsyntax'] ? $this->dsn['dbsyntax'] : $this->phptype;
-
- if ($this->database_name) {
- if ($this->database_name != $this->connected_database_name) {
- $query = 'ALTER SESSION SET CURRENT_SCHEMA = "' .strtoupper($this->database_name) .'"';
- $result = $this->_doQuery($query);
- if (PEAR::isError($result)) {
- $err = $this->raiseError($result, null, null,
- 'Could not select the database: '.$this->database_name, __FUNCTION__);
- return $err;
- }
- $this->connected_database_name = $this->database_name;
- }
- }
-
- $this->as_keyword = ' ';
- $server_info = $this->getServerVersion();
- if (is_array($server_info)) {
- if ($server_info['major'] >= '10') {
- $this->as_keyword = ' AS ';
- }
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ databaseExists()
-
- /**
- * check if given database name is exists?
- *
- * @param string $name name of the database that should be checked
- *
- * @return mixed true/false on success, a MDB2 error on failure
- * @access public
- */
- function databaseExists($name)
- {
- $connection = $this->_doConnect($this->dsn['username'],
- $this->dsn['password'],
- $this->options['persistent']);
- if (PEAR::isError($connection)) {
- return $connection;
- }
-
- $query = 'ALTER SESSION SET CURRENT_SCHEMA = "' .strtoupper($name) .'"';
- $result = $this->_doQuery($query, true, $connection, false);
- if (PEAR::isError($result)) {
- if (!MDB2::isError($result, MDB2_ERROR_NOT_FOUND)) {
- return $result;
- }
- return false;
- }
- return true;
- }
-
- // }}}
- // {{{ disconnect()
-
- /**
- * Log out and disconnect from the database.
- *
- * @param boolean $force if the disconnect should be forced even if the
- * connection is opened persistently
- * @return mixed true on success, false if not connected and error
- * object on error
- * @access public
- */
- function disconnect($force = true)
- {
- if (is_resource($this->connection)) {
- if ($this->in_transaction) {
- $dsn = $this->dsn;
- $database_name = $this->database_name;
- $persistent = $this->options['persistent'];
- $this->dsn = $this->connected_dsn;
- $this->database_name = $this->connected_database_name;
- $this->options['persistent'] = $this->opened_persistent;
- $this->rollback();
- $this->dsn = $dsn;
- $this->database_name = $database_name;
- $this->options['persistent'] = $persistent;
- }
-
- if (!$this->opened_persistent || $force) {
- $ok = false;
- if (function_exists('oci_close')) {
- $ok = @oci_close($this->connection);
- } else {
- $ok = @OCILogOff($this->connection);
- }
- if (!$ok) {
- return $this->raiseError(MDB2_ERROR_DISCONNECT_FAILED,
- null, null, null, __FUNCTION__);
- }
- }
- $this->uncommitedqueries = 0;
- } else {
- return false;
- }
- return parent::disconnect($force);
- }
-
- // }}}
- // {{{ standaloneQuery()
-
- /**
- * execute a query as DBA
- *
- * @param string $query the SQL query
- * @param mixed $types array containing the types of the columns in
- * the result set
- * @param boolean $is_manip if the query is a manipulation query
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function standaloneQuery($query, $types = null, $is_manip = false)
- {
- $user = $this->options['DBA_username']? $this->options['DBA_username'] : $this->dsn['username'];
- $pass = $this->options['DBA_password']? $this->options['DBA_password'] : $this->dsn['password'];
- $connection = $this->_doConnect($user, $pass, $this->options['persistent']);
- if (PEAR::isError($connection)) {
- return $connection;
- }
-
- $offset = $this->offset;
- $limit = $this->limit;
- $this->offset = $this->limit = 0;
- $query = $this->_modifyQuery($query, $is_manip, $limit, $offset);
-
- $result = $this->_doQuery($query, $is_manip, $connection, false);
- if (!PEAR::isError($result)) {
- if ($is_manip) {
- $result = $this->_affectedRows($connection, $result);
- } else {
- $result = $this->_wrapResult($result, $types, true, false, $limit, $offset);
- }
- }
-
- @OCILogOff($connection);
- return $result;
- }
-
- // }}}
- // {{{ _modifyQuery()
-
- /**
- * Changes a query string for various DBMS specific reasons
- *
- * @param string $query query to modify
- * @param boolean $is_manip if it is a DML query
- * @param integer $limit limit the number of rows
- * @param integer $offset start reading from given offset
- * @return string modified query
- * @access protected
- */
- function _modifyQuery($query, $is_manip, $limit, $offset)
- {
- if (preg_match('/^\s*SELECT/i', $query)) {
- if (!preg_match('/\sFROM\s/i', $query)) {
- $query.= " FROM dual";
- }
- if ($limit > 0) {
- // taken from http://svn.ez.no/svn/ezcomponents/packages/Database
- $max = $offset + $limit;
- if ($offset > 0) {
- $min = $offset + 1;
- $query = "SELECT * FROM (SELECT a.*, ROWNUM mdb2rn FROM ($query) a WHERE ROWNUM <= $max) WHERE mdb2rn >= $min";
- } else {
- $query = "SELECT a.* FROM ($query) a WHERE ROWNUM <= $max";
- }
- }
- }
- return $query;
- }
-
- /**
- * Obtain DBMS specific SQL code portion needed to declare a generic type
- * field to be used in statement like CREATE TABLE, without the field name
- * and type values (ie. just the character set, default value, if the
- * field is permitted to be NULL or not, and the collation options).
- *
- * @param array $field associative array with the name of the properties
- * of the field being declared as array indexes. Currently, the types
- * of supported field properties are as follows:
- *
- * default
- * Text value to be used as default for this field.
- * notnull
- * Boolean flag that indicates whether this field is constrained
- * to not be set to null.
- * charset
- * Text value with the default CHARACTER SET for this field.
- * collation
- * Text value with the default COLLATION for this field.
- * @return string DBMS specific SQL code portion that should be used to
- * declare the specified field's options.
- * @access protected
- */
- function _getDeclarationOptions($field)
- {
- $charset = empty($field['charset']) ? '' :
- ' '.$this->_getCharsetFieldDeclaration($field['charset']);
-
- $notnull = empty($field['notnull']) ? ' NULL' : ' NOT NULL';
- $default = '';
- if (array_key_exists('default', $field)) {
- if ($field['default'] === '') {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
- $valid_default_values = $this->getValidTypes();
- $field['default'] = $valid_default_values[$field['type']];
- if ($field['default'] === '' && ($db->options['portability'] & MDB2_PORTABILITY_EMPTY_TO_NULL)) {
- $field['default'] = ' ';
- }
- }
- if (null !== $field['default']) {
- $default = ' DEFAULT ' . $this->quote($field['default'], $field['type']);
- }
- }
-
- $collation = empty($field['collation']) ? '' :
- ' '.$this->_getCollationFieldDeclaration($field['collation']);
-
- return $charset.$default.$notnull.$collation;
- }
-
- // }}}
- // {{{ _doQuery()
-
- /**
- * Execute a query
- * @param string $query query
- * @param boolean $is_manip if the query is a manipulation query
- * @param resource $connection
- * @param string $database_name
- * @return result or error object
- * @access protected
- */
- function _doQuery($query, $is_manip = false, $connection = null, $database_name = null)
- {
- $this->last_query = $query;
- $result = $this->debug($query, 'query', array('is_manip' => $is_manip, 'when' => 'pre'));
- if ($result) {
- if (PEAR::isError($result)) {
- return $result;
- }
- $query = $result;
- }
- if ($this->getOption('disable_query')) {
- if ($is_manip) {
- return 0;
- }
- return null;
- }
-
- if (null === $connection) {
- $connection = $this->getConnection();
- if (PEAR::isError($connection)) {
- return $connection;
- }
- }
-
- $query = str_replace("\r\n", "\n", $query); //for fixing end-of-line character in the PL/SQL in windows
- $result = @OCIParse($connection, $query);
- if (!$result) {
- $err = $this->raiseError(null, null, null,
- 'Could not create statement', __FUNCTION__);
- return $err;
- }
-
- $mode = $this->in_transaction ? OCI_DEFAULT : OCI_COMMIT_ON_SUCCESS;
- if (!@OCIExecute($result, $mode)) {
- $err = $this->raiseError($result, null, null,
- 'Could not execute statement', __FUNCTION__);
- return $err;
- }
-
- if (is_numeric($this->options['result_prefetching'])) {
- @ocisetprefetch($result, $this->options['result_prefetching']);
- }
-
- $this->debug($query, 'query', array('is_manip' => $is_manip, 'when' => 'post', 'result' => $result));
- return $result;
- }
-
- // }}}
- // {{{ _affectedRows()
-
- /**
- * Returns the number of rows affected
- *
- * @param resource $result
- * @param resource $connection
- * @return mixed MDB2 Error Object or the number of rows affected
- * @access private
- */
- function _affectedRows($connection, $result = null)
- {
- if (null === $connection) {
- $connection = $this->getConnection();
- if (PEAR::isError($connection)) {
- return $connection;
- }
- }
- return @OCIRowCount($result);
- }
-
- // }}}
- // {{{ getServerVersion()
-
- /**
- * return version information about the server
- *
- * @param bool $native determines if the raw version string should be returned
- * @return mixed array/string with version information or MDB2 error object
- * @access public
- */
- function getServerVersion($native = false)
- {
- $connection = $this->getConnection();
- if (PEAR::isError($connection)) {
- return $connection;
- }
- if ($this->connected_server_info) {
- $server_info = $this->connected_server_info;
- } else {
- $server_info = @ociserverversion($connection);
- }
- if (!$server_info) {
- return $this->raiseError(null, null, null,
- 'Could not get server information', __FUNCTION__);
- }
- // cache server_info
- $this->connected_server_info = $server_info;
- if (!$native) {
- if (!preg_match('/ (\d+)\.(\d+)\.(\d+)\.([\d\.]+) /', $server_info, $tmp)) {
- return $this->raiseError(MDB2_ERROR_INVALID, null, null,
- 'Could not parse version information:'.$server_info, __FUNCTION__);
- }
- $server_info = array(
- 'major' => $tmp[1],
- 'minor' => $tmp[2],
- 'patch' => $tmp[3],
- 'extra' => $tmp[4],
- 'native' => $server_info,
- );
- }
- return $server_info;
- }
-
- // }}}
- // {{{ prepare()
-
- /**
- * Prepares a query for multiple execution with execute().
- * With some database backends, this is emulated.
- * prepare() requires a generic query as string like
- * 'INSERT INTO numbers VALUES(?,?)' or
- * 'INSERT INTO numbers VALUES(:foo,:bar)'.
- * The ? and :name and are placeholders which can be set using
- * bindParam() and the query can be sent off using the execute() method.
- * The allowed format for :name can be set with the 'bindname_format' option.
- *
- * @param string $query the query to prepare
- * @param mixed $types array that contains the types of the placeholders
- * @param mixed $result_types array that contains the types of the columns in
- * the result set or MDB2_PREPARE_RESULT, if set to
- * MDB2_PREPARE_MANIP the query is handled as a manipulation query
- * @param mixed $lobs key (field) value (parameter) pair for all lob placeholders
- * @return mixed resource handle for the prepared query on success, a MDB2
- * error on failure
- * @access public
- * @see bindParam, execute
- */
- function prepare($query, $types = null, $result_types = null, $lobs = array())
- {
- if ($this->options['emulate_prepared']) {
- return parent::prepare($query, $types, $result_types, $lobs);
- }
- $is_manip = ($result_types === MDB2_PREPARE_MANIP);
- $offset = $this->offset;
- $limit = $this->limit;
- $this->offset = $this->limit = 0;
- $result = $this->debug($query, __FUNCTION__, array('is_manip' => $is_manip, 'when' => 'pre'));
- if ($result) {
- if (PEAR::isError($result)) {
- return $result;
- }
- $query = $result;
- }
- $query = $this->_modifyQuery($query, $is_manip, $limit, $offset);
- $placeholder_type_guess = $placeholder_type = null;
- $question = '?';
- $colon = ':';
- $positions = array();
- $position = 0;
- $parameter = -1;
- while ($position < strlen($query)) {
- $q_position = strpos($query, $question, $position);
- $c_position = strpos($query, $colon, $position);
- if ($q_position && $c_position) {
- $p_position = min($q_position, $c_position);
- } elseif ($q_position) {
- $p_position = $q_position;
- } elseif ($c_position) {
- $p_position = $c_position;
- } else {
- break;
- }
- if (null === $placeholder_type) {
- $placeholder_type_guess = $query[$p_position];
- }
-
- $new_pos = $this->_skipDelimitedStrings($query, $position, $p_position);
- if (PEAR::isError($new_pos)) {
- return $new_pos;
- }
- if ($new_pos != $position) {
- $position = $new_pos;
- continue; //evaluate again starting from the new position
- }
-
- if ($query[$position] == $placeholder_type_guess) {
- if (null === $placeholder_type) {
- $placeholder_type = $query[$p_position];
- $question = $colon = $placeholder_type;
- if (!empty($types) && is_array($types)) {
- if ($placeholder_type == ':') {
- if (is_int(key($types))) {
- $types_tmp = $types;
- $types = array();
- $count = -1;
- }
- } else {
- $types = array_values($types);
- }
- }
- }
- if ($placeholder_type == ':') {
- $regexp = '/^.{'.($position+1).'}('.$this->options['bindname_format'].').*$/s';
- $parameter = preg_replace($regexp, '\\1', $query);
- if ($parameter === '') {
- $err = $this->raiseError(MDB2_ERROR_SYNTAX, null, null,
- 'named parameter name must match "bindname_format" option', __FUNCTION__);
- return $err;
- }
- // use parameter name in type array
- if (isset($count) && isset($types_tmp[++$count])) {
- $types[$parameter] = $types_tmp[$count];
- }
- $length = strlen($parameter) + 1;
- } else {
- ++$parameter;
- //$length = strlen($parameter);
- $length = 1; // strlen('?')
- }
- if (!in_array($parameter, $positions)) {
- $positions[] = $parameter;
- }
- if (isset($types[$parameter])
- && ($types[$parameter] == 'clob' || $types[$parameter] == 'blob')
- ) {
- if (!isset($lobs[$parameter])) {
- $lobs[$parameter] = $parameter;
- }
- $value = $this->quote(true, $types[$parameter]);
- if (PEAR::isError($value)) {
- return $value;
- }
- $query = substr_replace($query, $value, $p_position, $length);
- $position = $p_position + strlen($value) - 1;
- } elseif ($placeholder_type == '?') {
- $query = substr_replace($query, ':'.$parameter, $p_position, 1);
- $position = $p_position + $length;
- } else {
- $position = $p_position + 1;
- }
- } else {
- $position = $p_position;
- }
- }
- if (is_array($lobs)) {
- $columns = $variables = '';
- foreach ($lobs as $parameter => $field) {
- $columns.= ($columns ? ', ' : ' RETURNING ').$field;
- $variables.= ($variables ? ', ' : ' INTO ').':'.$parameter;
- }
- $query.= $columns.$variables;
- }
- $connection = $this->getConnection();
- if (PEAR::isError($connection)) {
- return $connection;
- }
- $statement = @OCIParse($connection, $query);
- if (!$statement) {
- $err = $this->raiseError(null, null, null,
- 'Could not create statement', __FUNCTION__);
- return $err;
- }
-
- $class_name = 'MDB2_Statement_'.$this->phptype;
- $obj = new $class_name($this, $statement, $positions, $query, $types, $result_types, $is_manip, $limit, $offset);
- $this->debug($query, __FUNCTION__, array('is_manip' => $is_manip, 'when' => 'post', 'result' => $obj));
- return $obj;
- }
-
- // }}}
- // {{{ nextID()
-
- /**
- * Returns the next free id of a sequence
- *
- * @param string $seq_name name of the sequence
- * @param boolean $ondemand when true the sequence is
- * automatic created, if it
- * not exists
- * @return mixed MDB2 Error Object or id
- * @access public
- */
- function nextID($seq_name, $ondemand = true)
- {
- $sequence_name = $this->quoteIdentifier($this->getSequenceName($seq_name), true);
- $query = "SELECT $sequence_name.nextval FROM DUAL";
- $this->pushErrorHandling(PEAR_ERROR_RETURN);
- $this->expectError(MDB2_ERROR_NOSUCHTABLE);
- $result = $this->queryOne($query, 'integer');
- $this->popExpect();
- $this->popErrorHandling();
- if (PEAR::isError($result)) {
- if ($ondemand && $result->getCode() == MDB2_ERROR_NOSUCHTABLE) {
- $this->loadModule('Manager', null, true);
- $result = $this->manager->createSequence($seq_name);
- if (PEAR::isError($result)) {
- return $result;
- }
- return $this->nextId($seq_name, false);
- }
- }
- return $result;
- }
-
- // }}}
- // {{{ lastInsertID()
-
- /**
- * Returns the autoincrement ID if supported or $id or fetches the current
- * ID in a sequence called: $table.(empty($field) ? '' : '_'.$field)
- *
- * @param string $table name of the table into which a new row was inserted
- * @param string $field name of the field into which a new row was inserted
- * @return mixed MDB2 Error Object or id
- * @access public
- */
- function lastInsertID($table = null, $field = null)
- {
- $old_seq = $table.(empty($field) ? '' : '_'.$field);
- $sequence_name = $this->quoteIdentifier($this->getSequenceName($table), true);
- $result = $this->queryOne("SELECT $sequence_name.currval", 'integer');
- if (PEAR::isError($result)) {
- $sequence_name = $this->quoteIdentifier($this->getSequenceName($old_seq), true);
- $result = $this->queryOne("SELECT $sequence_name.currval", 'integer');
- }
-
- return $result;
- }
-
- // }}}
- // {{{ currId()
-
- /**
- * Returns the current id of a sequence
- *
- * @param string $seq_name name of the sequence
- * @return mixed MDB2_Error or id
- * @access public
- */
- function currId($seq_name)
- {
- $sequence_name = $this->getSequenceName($seq_name);
- $query = 'SELECT (last_number-1) FROM all_sequences';
- $query.= ' WHERE sequence_name='.$this->quote($sequence_name, 'text');
- $query.= ' OR sequence_name='.$this->quote(strtoupper($sequence_name), 'text');
- return $this->queryOne($query, 'integer');
- }
-}
-
-/**
- * MDB2 OCI8 result driver
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Result_oci8 extends MDB2_Result_Common
-{
- // }}}
- // {{{ fetchRow()
-
- /**
- * Fetch a row and insert the data into an existing array.
- *
- * @param int $fetchmode how the array data should be indexed
- * @param int $rownum number of the row where the data can be found
- * @return int data array on success, a MDB2 error on failure
- * @access public
- */
- function fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null)
- {
- if (null !== $rownum) {
- $seek = $this->seek($rownum);
- if (PEAR::isError($seek)) {
- return $seek;
- }
- }
- if ($fetchmode == MDB2_FETCHMODE_DEFAULT) {
- $fetchmode = $this->db->fetchmode;
- }
- if ($fetchmode & MDB2_FETCHMODE_ASSOC) {
- @OCIFetchInto($this->result, $row, OCI_ASSOC+OCI_RETURN_NULLS);
- if (is_array($row)
- && $this->db->options['portability'] & MDB2_PORTABILITY_FIX_CASE
- ) {
- $row = array_change_key_case($row, $this->db->options['field_case']);
- }
- } else {
- @OCIFetchInto($this->result, $row, OCI_RETURN_NULLS);
- }
- if (!$row) {
- if (false === $this->result) {
- $err = $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
- 'resultset has already been freed', __FUNCTION__);
- return $err;
- }
- return null;
- }
- // remove additional column at the end
- if ($this->offset > 0) {
- array_pop($row);
- }
- $mode = 0;
- $rtrim = false;
- if ($this->db->options['portability'] & MDB2_PORTABILITY_RTRIM) {
- if (empty($this->types)) {
- $mode += MDB2_PORTABILITY_RTRIM;
- } else {
- $rtrim = true;
- }
- }
- if ($mode) {
- $this->db->_fixResultArrayValues($row, $mode);
- }
- if (!empty($this->types)) {
- $row = $this->db->datatype->convertResultRow($this->types, $row, $rtrim);
- }
- if (!empty($this->values)) {
- $this->_assignBindColumns($row);
- }
- if ($fetchmode === MDB2_FETCHMODE_OBJECT) {
- $object_class = $this->db->options['fetch_class'];
- if ($object_class == 'stdClass') {
- $row = (object) $row;
- } else {
- $rowObj = new $object_class($row);
- $row = $rowObj;
- }
- }
- ++$this->rownum;
- return $row;
- }
-
- // }}}
- // {{{ _getColumnNames()
-
- /**
- * Retrieve the names of columns returned by the DBMS in a query result.
- *
- * @return mixed Array variable that holds the names of columns as keys
- * or an MDB2 error on failure.
- * Some DBMS may not return any columns when the result set
- * does not contain any rows.
- * @access private
- */
- function _getColumnNames()
- {
- $columns = array();
- $numcols = $this->numCols();
- if (PEAR::isError($numcols)) {
- return $numcols;
- }
- for ($column = 0; $column < $numcols; $column++) {
- $column_name = @OCIColumnName($this->result, $column + 1);
- $columns[$column_name] = $column;
- }
- if ($this->db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $columns = array_change_key_case($columns, $this->db->options['field_case']);
- }
- return $columns;
- }
-
- // }}}
- // {{{ numCols()
-
- /**
- * Count the number of columns returned by the DBMS in a query result.
- *
- * @return mixed integer value with the number of columns, a MDB2 error
- * on failure
- * @access public
- */
- function numCols()
- {
- $cols = @OCINumCols($this->result);
- if (null === $cols) {
- if (false === $this->result) {
- return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
- 'resultset has already been freed', __FUNCTION__);
- }
- if (null === $this->result) {
- return count($this->types);
- }
- return $this->db->raiseError(null, null, null,
- 'Could not get column count', __FUNCTION__);
- }
- if ($this->offset > 0) {
- --$cols;
- }
- return $cols;
- }
-
- // }}}
- // {{{ free()
-
- /**
- * Free the internal resources associated with $result.
- *
- * @return boolean true on success, false if $result is invalid
- * @access public
- */
- function free()
- {
- if (is_resource($this->result) && $this->db->connection) {
- $free = @OCIFreeCursor($this->result);
- if (false === $free) {
- return $this->db->raiseError(null, null, null,
- 'Could not free result', __FUNCTION__);
- }
- }
- $this->result = false;
- return MDB2_OK;
-
- }
-}
-
-/**
- * MDB2 OCI8 buffered result driver
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_BufferedResult_oci8 extends MDB2_Result_oci8
-{
- var $buffer;
- var $buffer_rownum = - 1;
-
- // {{{ _fillBuffer()
-
- /**
- * Fill the row buffer
- *
- * @param int $rownum row number upto which the buffer should be filled
- if the row number is null all rows are ready into the buffer
- * @return boolean true on success, false on failure
- * @access protected
- */
- function _fillBuffer($rownum = null)
- {
- if (isset($this->buffer) && is_array($this->buffer)) {
- if (null === $rownum) {
- if (!end($this->buffer)) {
- return false;
- }
- } elseif (isset($this->buffer[$rownum])) {
- return (bool)$this->buffer[$rownum];
- }
- }
-
- $row = true;
- while (((null === $rownum) || $this->buffer_rownum < $rownum)
- && ($row = @OCIFetchInto($this->result, $buffer, OCI_RETURN_NULLS))
- ) {
- ++$this->buffer_rownum;
- // remove additional column at the end
- if ($this->offset > 0) {
- array_pop($buffer);
- }
- if (empty($this->types)) {
- foreach (array_keys($buffer) as $key) {
- if (is_a($buffer[$key], 'oci-lob')) {
- $buffer[$key] = $buffer[$key]->load();
- }
- }
- }
- $this->buffer[$this->buffer_rownum] = $buffer;
- }
-
- if (!$row) {
- ++$this->buffer_rownum;
- $this->buffer[$this->buffer_rownum] = false;
- return false;
- }
- return true;
- }
-
- // }}}
- // {{{ fetchRow()
-
- /**
- * Fetch a row and insert the data into an existing array.
- *
- * @param int $fetchmode how the array data should be indexed
- * @param int $rownum number of the row where the data can be found
- * @return int data array on success, a MDB2 error on failure
- * @access public
- */
- function fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null)
- {
- if (false === $this->result) {
- $err = $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
- 'resultset has already been freed', __FUNCTION__);
- return $err;
- }
- if (null === $this->result) {
- return null;
- }
- if (null !== $rownum) {
- $seek = $this->seek($rownum);
- if (PEAR::isError($seek)) {
- return $seek;
- }
- }
- $target_rownum = $this->rownum + 1;
- if ($fetchmode == MDB2_FETCHMODE_DEFAULT) {
- $fetchmode = $this->db->fetchmode;
- }
- if (!$this->_fillBuffer($target_rownum)) {
- return null;
- }
- $row = $this->buffer[$target_rownum];
- if ($fetchmode & MDB2_FETCHMODE_ASSOC) {
- $column_names = $this->getColumnNames();
- foreach ($column_names as $name => $i) {
- $column_names[$name] = $row[$i];
- }
- $row = $column_names;
- }
- $mode = 0;
- $rtrim = false;
- if ($this->db->options['portability'] & MDB2_PORTABILITY_RTRIM) {
- if (empty($this->types)) {
- $mode += MDB2_PORTABILITY_RTRIM;
- } else {
- $rtrim = true;
- }
- }
- if ($mode) {
- $this->db->_fixResultArrayValues($row, $mode);
- }
- if (!empty($this->types)) {
- $row = $this->db->datatype->convertResultRow($this->types, $row, $rtrim);
- }
- if (!empty($this->values)) {
- $this->_assignBindColumns($row);
- }
- if ($fetchmode === MDB2_FETCHMODE_OBJECT) {
- $object_class = $this->db->options['fetch_class'];
- if ($object_class == 'stdClass') {
- $row = (object) $row;
- } else {
- $rowObj = new $object_class($row);
- $row = $rowObj;
- }
- }
- ++$this->rownum;
- return $row;
- }
-
- // }}}
- // {{{ seek()
-
- /**
- * Seek to a specific row in a result set
- *
- * @param int $rownum number of the row where the data can be found
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function seek($rownum = 0)
- {
- if (false === $this->result) {
- return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
- 'resultset has already been freed', __FUNCTION__);
- }
- $this->rownum = $rownum - 1;
- return MDB2_OK;
- }
-
- // }}}
- // {{{ valid()
-
- /**
- * Check if the end of the result set has been reached
- *
- * @return mixed true or false on sucess, a MDB2 error on failure
- * @access public
- */
- function valid()
- {
- if (false === $this->result) {
- return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
- 'resultset has already been freed', __FUNCTION__);
- }
- if (null === $this->result) {
- return true;
- }
- if ($this->_fillBuffer($this->rownum + 1)) {
- return true;
- }
- return false;
- }
-
- // }}}
- // {{{ numRows()
-
- /**
- * Returns the number of rows in a result object
- *
- * @return mixed MDB2 Error Object or the number of rows
- * @access public
- */
- function numRows()
- {
- if (false === $this->result) {
- return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
- 'resultset has already been freed', __FUNCTION__);
- }
- if (null === $this->result) {
- return 0;
- }
- $this->_fillBuffer();
- return $this->buffer_rownum;
- }
-
- // }}}
- // {{{ free()
-
- /**
- * Free the internal resources associated with $result.
- *
- * @return boolean true on success, false if $result is invalid
- * @access public
- */
- function free()
- {
- $this->buffer = null;
- $this->buffer_rownum = null;
- return parent::free();
- }
-}
-
-/**
- * MDB2 OCI8 statement driver
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Statement_oci8 extends MDB2_Statement_Common
-{
- // {{{ Variables (Properties)
-
- var $type_maxlengths = array();
-
- // }}}
- // {{{ bindParam()
-
- /**
- * Bind a variable to a parameter of a prepared query.
- *
- * @param int $parameter the order number of the parameter in the query
- * statement. The order number of the first parameter is 1.
- * @param mixed &$value variable that is meant to be bound to specified
- * parameter. The type of the value depends on the $type argument.
- * @param string $type specifies the type of the field
- * @param int $maxlength specifies the maximum length of the field; if set to -1, the
- * current length of $value is used
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- *
- * @access public
- */
- function bindParam($parameter, &$value, $type = null, $maxlength = -1)
- {
- if (!is_numeric($parameter)) {
- $parameter = preg_replace('/^:(.*)$/', '\\1', $parameter);
- }
- if (MDB2_OK === ($ret = parent::bindParam($parameter, $value, $type))) {
- $this->type_maxlengths[$parameter] = $maxlength;
- }
-
- return $ret;
- }
-
- // }}}
- // {{{ _execute()
-
- /**
- * Execute a prepared query statement helper method.
- *
- * @param mixed $result_class string which specifies which result class to use
- * @param mixed $result_wrap_class string which specifies which class to wrap results in
- *
- * @return mixed MDB2_Result or integer (affected rows) on success,
- * a MDB2 error on failure
- * @access private
- */
- function _execute($result_class = true, $result_wrap_class = false)
- {
- if (null === $this->statement) {
- return parent::_execute($result_class, $result_wrap_class);
- }
- $this->db->last_query = $this->query;
- $this->db->debug($this->query, 'execute', array('is_manip' => $this->is_manip, 'when' => 'pre', 'parameters' => $this->values));
- if ($this->db->getOption('disable_query')) {
- $result = $this->is_manip ? 0 : null;
- return $result;
- }
-
- $connection = $this->db->getConnection();
- if (PEAR::isError($connection)) {
- return $connection;
- }
-
- $result = MDB2_OK;
- $lobs = $quoted_values = array();
- $i = 0;
- foreach ($this->positions as $parameter) {
- if (!array_key_exists($parameter, $this->values)) {
- return $this->db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- 'Unable to bind to missing placeholder: '.$parameter, __FUNCTION__);
- }
- $type = array_key_exists($parameter, $this->types) ? $this->types[$parameter] : null;
- if ($type == 'clob' || $type == 'blob') {
- $lobs[$i]['file'] = false;
- if (is_resource($this->values[$parameter])) {
- $fp = $this->values[$parameter];
- $this->values[$parameter] = '';
- while (!feof($fp)) {
- $this->values[$parameter] .= fread($fp, 8192);
- }
- } elseif (is_a($this->values[$parameter], 'OCI-Lob')) {
- //do nothing
- } elseif ($this->db->getOption('lob_allow_url_include')
- && preg_match('/^(\w+:\/\/)(.*)$/', $this->values[$parameter], $match)
- ) {
- $lobs[$i]['file'] = true;
- if ($match[1] == 'file://') {
- $this->values[$parameter] = $match[2];
- }
- }
- $lobs[$i]['value'] = $this->values[$parameter];
- $lobs[$i]['descriptor'] =& $this->values[$parameter];
- // Test to see if descriptor has already been created for this
- // variable (i.e. if it has been bound more than once):
- if (!is_a($this->values[$parameter], 'OCI-Lob')) {
- $this->values[$parameter] = @OCINewDescriptor($connection, OCI_D_LOB);
- if (false === $this->values[$parameter]) {
- $result = $this->db->raiseError(null, null, null,
- 'Unable to create descriptor for LOB in parameter: '.$parameter, __FUNCTION__);
- break;
- }
- }
- $lob_type = ($type == 'blob' ? OCI_B_BLOB : OCI_B_CLOB);
- if (!@OCIBindByName($this->statement, ':'.$parameter, $lobs[$i]['descriptor'], -1, $lob_type)) {
- $result = $this->db->raiseError($this->statement, null, null,
- 'could not bind LOB parameter', __FUNCTION__);
- break;
- }
- } else if ($type == OCI_B_BFILE) {
- // Test to see if descriptor has already been created for this
- // variable (i.e. if it has been bound more than once):
- if (!is_a($this->values[$parameter], "OCI-Lob")) {
- $this->values[$parameter] = @OCINewDescriptor($connection, OCI_D_FILE);
- if (false === $this->values[$parameter]) {
- $result = $this->db->raiseError(null, null, null,
- 'Unable to create descriptor for BFILE in parameter: '.$parameter, __FUNCTION__);
- break;
- }
- }
- if (!@OCIBindByName($this->statement, ':'.$parameter, $this->values[$parameter], -1, $type)) {
- $result = $this->db->raiseError($this->statement, null, null,
- 'Could not bind BFILE parameter', __FUNCTION__);
- break;
- }
- } else if ($type == OCI_B_ROWID) {
- // Test to see if descriptor has already been created for this
- // variable (i.e. if it has been bound more than once):
- if (!is_a($this->values[$parameter], "OCI-Lob")) {
- $this->values[$parameter] = @OCINewDescriptor($connection, OCI_D_ROWID);
- if (false === $this->values[$parameter]) {
- $result = $this->db->raiseError(null, null, null,
- 'Unable to create descriptor for ROWID in parameter: '.$parameter, __FUNCTION__);
- break;
- }
- }
- if (!@OCIBindByName($this->statement, ':'.$parameter, $this->values[$parameter], -1, $type)) {
- $result = $this->db->raiseError($this->statement, null, null,
- 'Could not bind ROWID parameter', __FUNCTION__);
- break;
- }
- } else if ($type == OCI_B_CURSOR) {
- // Test to see if cursor has already been allocated for this
- // variable (i.e. if it has been bound more than once):
- if (!is_resource($this->values[$parameter]) || !get_resource_type($this->values[$parameter]) == "oci8 statement") {
- $this->values[$parameter] = @OCINewCursor($connection);
- if (false === $this->values[$parameter]) {
- $result = $this->db->raiseError(null, null, null,
- 'Unable to allocate cursor for parameter: '.$parameter, __FUNCTION__);
- break;
- }
- }
- if (!@OCIBindByName($this->statement, ':'.$parameter, $this->values[$parameter], -1, $type)) {
- $result = $this->db->raiseError($this->statement, null, null,
- 'Could not bind CURSOR parameter', __FUNCTION__);
- break;
- }
- } else {
- $maxlength = array_key_exists($parameter, $this->type_maxlengths) ? $this->type_maxlengths[$parameter] : -1;
- $this->values[$parameter] = $this->db->quote($this->values[$parameter], $type, false);
- $quoted_values[$i] =& $this->values[$parameter];
- if (PEAR::isError($quoted_values[$i])) {
- return $quoted_values[$i];
- }
- if (!@OCIBindByName($this->statement, ':'.$parameter, $quoted_values[$i], $maxlength)) {
- $result = $this->db->raiseError($this->statement, null, null,
- 'could not bind non-abstract parameter', __FUNCTION__);
- break;
- }
- }
- ++$i;
- }
-
- $lob_keys = array_keys($lobs);
- if (!PEAR::isError($result)) {
- $mode = (!empty($lobs) || $this->db->in_transaction) ? OCI_DEFAULT : OCI_COMMIT_ON_SUCCESS;
- if (!@OCIExecute($this->statement, $mode)) {
- $err = $this->db->raiseError($this->statement, null, null,
- 'could not execute statement', __FUNCTION__);
- return $err;
- }
-
- if (!empty($lobs)) {
- foreach ($lob_keys as $i) {
- if ((null !== $lobs[$i]['value']) && $lobs[$i]['value'] !== '') {
- if (is_object($lobs[$i]['value'])) {
- // Probably a NULL LOB
- // @see http://bugs.php.net/bug.php?id=27485
- continue;
- }
- if ($lobs[$i]['file']) {
- $result = $lobs[$i]['descriptor']->savefile($lobs[$i]['value']);
- } else {
- $result = $lobs[$i]['descriptor']->save($lobs[$i]['value']);
- }
- if (!$result) {
- $result = $this->db->raiseError(null, null, null,
- 'Unable to save descriptor contents', __FUNCTION__);
- break;
- }
- }
- }
-
- if (!PEAR::isError($result)) {
- if (!$this->db->in_transaction) {
- if (!@OCICommit($connection)) {
- $result = $this->db->raiseError(null, null, null,
- 'Unable to commit transaction', __FUNCTION__);
- }
- } else {
- ++$this->db->uncommitedqueries;
- }
- }
- }
- }
-
- if (PEAR::isError($result)) {
- return $result;
- }
-
- if ($this->is_manip) {
- $affected_rows = $this->db->_affectedRows($connection, $this->statement);
- return $affected_rows;
- }
-
- $result = $this->db->_wrapResult($this->statement, $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;
- }
-
- // }}}
- // {{{ free()
-
- /**
- * Release resources allocated for the specified prepared query.
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function free()
- {
- if (null === $this->positions) {
- return $this->db->raiseError(MDB2_ERROR, null, null,
- 'Prepared statement has already been freed', __FUNCTION__);
- }
- $result = MDB2_OK;
-
- if ((null !== $this->statement) && !@OCIFreeStatement($this->statement)) {
- $result = $this->db->raiseError(null, null, null,
- 'Could not free statement', __FUNCTION__);
- }
-
- parent::free();
- return $result;
- }
-}
-?> \ No newline at end of file
diff --git a/3rdparty/MDB2/Driver/pgsql.php b/3rdparty/MDB2/Driver/pgsql.php
deleted file mode 100644
index 8a8b3f7c91d..00000000000
--- a/3rdparty/MDB2/Driver/pgsql.php
+++ /dev/null
@@ -1,1583 +0,0 @@
-<?php
-// vim: set et ts=4 sw=4 fdm=marker:
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2008 Manuel Lemos, Tomas V.V.Cox, |
-// | Stig. S. Bakken, Lukas Smith |
-// | All rights reserved. |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
-// | API as well as database abstraction for PHP applications. |
-// | This LICENSE is in the BSD license style. |
-// | |
-// | Redistribution and use in source and binary forms, with or without |
-// | modification, are permitted provided that the following conditions |
-// | are met: |
-// | |
-// | Redistributions of source code must retain the above copyright |
-// | notice, this list of conditions and the following disclaimer. |
-// | |
-// | Redistributions in binary form must reproduce the above copyright |
-// | notice, this list of conditions and the following disclaimer in the |
-// | documentation and/or other materials provided with the distribution. |
-// | |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission. |
-// | |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-// | POSSIBILITY OF SUCH DAMAGE. |
-// +----------------------------------------------------------------------+
-// | Author: Paul Cooper <pgc@ucecom.com> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-/**
- * MDB2 PostGreSQL driver
- *
- * @package MDB2
- * @category Database
- * @author Paul Cooper <pgc@ucecom.com>
- */
-class MDB2_Driver_pgsql extends MDB2_Driver_Common
-{
- // {{{ properties
- var $string_quoting = array('start' => "'", 'end' => "'", 'escape' => "'", 'escape_pattern' => '\\');
-
- var $identifier_quoting = array('start' => '"', 'end' => '"', 'escape' => '"');
- // }}}
- // {{{ constructor
-
- /**
- * Constructor
- */
- function __construct()
- {
- parent::__construct();
-
- $this->phptype = 'pgsql';
- $this->dbsyntax = 'pgsql';
-
- $this->supported['sequences'] = true;
- $this->supported['indexes'] = true;
- $this->supported['affected_rows'] = true;
- $this->supported['summary_functions'] = true;
- $this->supported['order_by_text'] = true;
- $this->supported['transactions'] = true;
- $this->supported['savepoints'] = true;
- $this->supported['current_id'] = true;
- $this->supported['limit_queries'] = true;
- $this->supported['LOBs'] = true;
- $this->supported['replace'] = 'emulated';
- $this->supported['sub_selects'] = true;
- $this->supported['triggers'] = true;
- $this->supported['auto_increment'] = 'emulated';
- $this->supported['primary_key'] = true;
- $this->supported['result_introspection'] = true;
- $this->supported['prepared_statements'] = true;
- $this->supported['identifier_quoting'] = true;
- $this->supported['pattern_escaping'] = true;
- $this->supported['new_link'] = true;
-
- $this->options['DBA_username'] = false;
- $this->options['DBA_password'] = false;
- $this->options['multi_query'] = false;
- $this->options['disable_smart_seqname'] = true;
- $this->options['max_identifiers_length'] = 63;
- }
-
- // }}}
- // {{{ errorInfo()
-
- /**
- * This method is used to collect information about an error
- *
- * @param integer $error
- * @return array
- * @access public
- */
- function errorInfo($error = null)
- {
- // Fall back to MDB2_ERROR if there was no mapping.
- $error_code = MDB2_ERROR;
-
- $native_msg = '';
- if (is_resource($error)) {
- $native_msg = @pg_result_error($error);
- } elseif ($this->connection) {
- $native_msg = @pg_last_error($this->connection);
- if (!$native_msg && @pg_connection_status($this->connection) === PGSQL_CONNECTION_BAD) {
- $native_msg = 'Database connection has been lost.';
- $error_code = MDB2_ERROR_CONNECT_FAILED;
- }
- } else {
- $native_msg = @pg_last_error();
- }
-
- static $error_regexps;
- if (empty($error_regexps)) {
- $error_regexps = array(
- '/column .* (of relation .*)?does not exist/i'
- => MDB2_ERROR_NOSUCHFIELD,
- '/(relation|sequence|table).*does not exist|class .* not found/i'
- => MDB2_ERROR_NOSUCHTABLE,
- '/database .* does not exist/'
- => MDB2_ERROR_NOT_FOUND,
- '/constraint .* does not exist/'
- => MDB2_ERROR_NOT_FOUND,
- '/index .* does not exist/'
- => MDB2_ERROR_NOT_FOUND,
- '/database .* already exists/i'
- => MDB2_ERROR_ALREADY_EXISTS,
- '/relation .* already exists/i'
- => MDB2_ERROR_ALREADY_EXISTS,
- '/(divide|division) by zero$/i'
- => MDB2_ERROR_DIVZERO,
- '/pg_atoi: error in .*: can\'t parse /i'
- => MDB2_ERROR_INVALID_NUMBER,
- '/invalid input syntax for( type)? (integer|numeric)/i'
- => MDB2_ERROR_INVALID_NUMBER,
- '/value .* is out of range for type \w*int/i'
- => MDB2_ERROR_INVALID_NUMBER,
- '/integer out of range/i'
- => MDB2_ERROR_INVALID_NUMBER,
- '/value too long for type character/i'
- => MDB2_ERROR_INVALID,
- '/attribute .* not found|relation .* does not have attribute/i'
- => MDB2_ERROR_NOSUCHFIELD,
- '/column .* specified in USING clause does not exist in (left|right) table/i'
- => MDB2_ERROR_NOSUCHFIELD,
- '/parser: parse error at or near/i'
- => MDB2_ERROR_SYNTAX,
- '/syntax error at/'
- => MDB2_ERROR_SYNTAX,
- '/column reference .* is ambiguous/i'
- => MDB2_ERROR_SYNTAX,
- '/permission denied/'
- => MDB2_ERROR_ACCESS_VIOLATION,
- '/violates not-null constraint/'
- => MDB2_ERROR_CONSTRAINT_NOT_NULL,
- '/violates [\w ]+ constraint/'
- => MDB2_ERROR_CONSTRAINT,
- '/referential integrity violation/'
- => MDB2_ERROR_CONSTRAINT,
- '/more expressions than target columns/i'
- => MDB2_ERROR_VALUE_COUNT_ON_ROW,
- );
- }
- if (is_numeric($error) && $error < 0) {
- $error_code = $error;
- } else {
- foreach ($error_regexps as $regexp => $code) {
- if (preg_match($regexp, $native_msg)) {
- $error_code = $code;
- break;
- }
- }
- }
- return array($error_code, null, $native_msg);
- }
-
- // }}}
- // {{{ escape()
-
- /**
- * Quotes a string so it can be safely used in a query. It will quote
- * the text so it can safely be used within a query.
- *
- * @param string the input string to quote
- * @param bool escape wildcards
- *
- * @return string quoted string
- *
- * @access public
- */
- function escape($text, $escape_wildcards = false)
- {
- if ($escape_wildcards) {
- $text = $this->escapePattern($text);
- }
- $connection = $this->getConnection();
- if (PEAR::isError($connection)) {
- return $connection;
- }
- if (is_resource($connection) && version_compare(PHP_VERSION, '5.2.0RC5', '>=')) {
- $text = @pg_escape_string($connection, $text);
- } else {
- $text = @pg_escape_string($text);
- }
- return $text;
- }
-
- // }}}
- // {{{ beginTransaction()
-
- /**
- * Start a transaction or set a savepoint.
- *
- * @param string name of a savepoint to set
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- *
- * @access public
- */
- function beginTransaction($savepoint = null)
- {
- $this->debug('Starting transaction/savepoint', __FUNCTION__, array('is_manip' => true, 'savepoint' => $savepoint));
- if (null !== $savepoint) {
- if (!$this->in_transaction) {
- return $this->raiseError(MDB2_ERROR_INVALID, null, null,
- 'savepoint cannot be released when changes are auto committed', __FUNCTION__);
- }
- $query = 'SAVEPOINT '.$savepoint;
- return $this->_doQuery($query, true);
- }
- if ($this->in_transaction) {
- return MDB2_OK; //nothing to do
- }
- if (!$this->destructor_registered && $this->opened_persistent) {
- $this->destructor_registered = true;
- register_shutdown_function('MDB2_closeOpenTransactions');
- }
- $result = $this->_doQuery('BEGIN', true);
- if (PEAR::isError($result)) {
- return $result;
- }
- $this->in_transaction = true;
- return MDB2_OK;
- }
-
- // }}}
- // {{{ commit()
-
- /**
- * Commit the database changes done during a transaction that is in
- * progress or release a savepoint. This function may only be called when
- * auto-committing is disabled, otherwise it will fail. Therefore, a new
- * transaction is implicitly started after committing the pending changes.
- *
- * @param string name of a savepoint to release
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- *
- * @access public
- */
- function commit($savepoint = null)
- {
- $this->debug('Committing transaction/savepoint', __FUNCTION__, array('is_manip' => true, 'savepoint' => $savepoint));
- if (!$this->in_transaction) {
- return $this->raiseError(MDB2_ERROR_INVALID, null, null,
- 'commit/release savepoint cannot be done changes are auto committed', __FUNCTION__);
- }
- if (null !== $savepoint) {
- $query = 'RELEASE SAVEPOINT '.$savepoint;
- return $this->_doQuery($query, true);
- }
-
- $result = $this->_doQuery('COMMIT', true);
- if (PEAR::isError($result)) {
- return $result;
- }
- $this->in_transaction = false;
- return MDB2_OK;
- }
-
- // }}}
- // {{{ rollback()
-
- /**
- * Cancel any database changes done during a transaction or since a specific
- * savepoint that is in progress. This function may only be called when
- * auto-committing is disabled, otherwise it will fail. Therefore, a new
- * transaction is implicitly started after canceling the pending changes.
- *
- * @param string name of a savepoint to rollback to
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- *
- * @access public
- */
- function rollback($savepoint = null)
- {
- $this->debug('Rolling back transaction/savepoint', __FUNCTION__, array('is_manip' => true, 'savepoint' => $savepoint));
- if (!$this->in_transaction) {
- return $this->raiseError(MDB2_ERROR_INVALID, null, null,
- 'rollback cannot be done changes are auto committed', __FUNCTION__);
- }
- if (null !== $savepoint) {
- $query = 'ROLLBACK TO SAVEPOINT '.$savepoint;
- return $this->_doQuery($query, true);
- }
-
- $query = 'ROLLBACK';
- $result = $this->_doQuery($query, true);
- if (PEAR::isError($result)) {
- return $result;
- }
- $this->in_transaction = false;
- return MDB2_OK;
- }
-
- // }}}
- // {{{ function setTransactionIsolation()
-
- /**
- * Set the transacton isolation level.
- *
- * @param string standard isolation level
- * READ UNCOMMITTED (allows dirty reads)
- * READ COMMITTED (prevents dirty reads)
- * REPEATABLE READ (prevents nonrepeatable reads)
- * SERIALIZABLE (prevents phantom reads)
- * @param array some transaction options:
- * 'wait' => 'WAIT' | 'NO WAIT'
- * 'rw' => 'READ WRITE' | 'READ ONLY'
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- *
- * @access public
- * @since 2.1.1
- */
- function setTransactionIsolation($isolation, $options = array())
- {
- $this->debug('Setting transaction isolation level', __FUNCTION__, array('is_manip' => true));
- switch ($isolation) {
- case 'READ UNCOMMITTED':
- case 'READ COMMITTED':
- case 'REPEATABLE READ':
- case 'SERIALIZABLE':
- break;
- default:
- return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'isolation level is not supported: '.$isolation, __FUNCTION__);
- }
-
- $query = "SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL $isolation";
- return $this->_doQuery($query, true);
- }
-
- // }}}
- // {{{ _doConnect()
-
- /**
- * Do the grunt work of connecting to the database
- *
- * @return mixed connection resource on success, MDB2 Error Object on failure
- * @access protected
- */
- function _doConnect($username, $password, $database_name, $persistent = false)
- {
- if (!PEAR::loadExtension($this->phptype)) {
- return $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- 'extension '.$this->phptype.' is not compiled into PHP', __FUNCTION__);
- }
-
- if ($database_name == '') {
- $database_name = 'template1';
- }
-
- $protocol = $this->dsn['protocol'] ? $this->dsn['protocol'] : 'tcp';
-
- $params = array('');
- if ($protocol == 'tcp') {
- if ($this->dsn['hostspec']) {
- $params[0].= 'host=' . $this->dsn['hostspec'];
- }
- if ($this->dsn['port']) {
- $params[0].= ' port=' . $this->dsn['port'];
- }
- } elseif ($protocol == 'unix') {
- // Allow for pg socket in non-standard locations.
- if ($this->dsn['socket']) {
- $params[0].= 'host=' . $this->dsn['socket'];
- }
- if ($this->dsn['port']) {
- $params[0].= ' port=' . $this->dsn['port'];
- }
- }
- if ($database_name) {
- $params[0].= ' dbname=\'' . addslashes($database_name) . '\'';
- }
- if ($username) {
- $params[0].= ' user=\'' . addslashes($username) . '\'';
- }
- if ($password) {
- $params[0].= ' password=\'' . addslashes($password) . '\'';
- }
- if (!empty($this->dsn['options'])) {
- $params[0].= ' options=' . $this->dsn['options'];
- }
- if (!empty($this->dsn['tty'])) {
- $params[0].= ' tty=' . $this->dsn['tty'];
- }
- if (!empty($this->dsn['connect_timeout'])) {
- $params[0].= ' connect_timeout=' . $this->dsn['connect_timeout'];
- }
- if (!empty($this->dsn['sslmode'])) {
- $params[0].= ' sslmode=' . $this->dsn['sslmode'];
- }
- if (!empty($this->dsn['service'])) {
- $params[0].= ' service=' . $this->dsn['service'];
- }
-
- if ($this->_isNewLinkSet()) {
- if (version_compare(phpversion(), '4.3.0', '>=')) {
- $params[] = PGSQL_CONNECT_FORCE_NEW;
- }
- }
-
- $connect_function = $persistent ? 'pg_pconnect' : 'pg_connect';
- $connection = @call_user_func_array($connect_function, $params);
- if (!$connection) {
- return $this->raiseError(MDB2_ERROR_CONNECT_FAILED, null, null,
- 'unable to establish a connection', __FUNCTION__);
- }
-
- if (empty($this->dsn['disable_iso_date'])) {
- if (!@pg_query($connection, "SET SESSION DATESTYLE = 'ISO'")) {
- return $this->raiseError(null, null, null,
- 'Unable to set date style to iso', __FUNCTION__);
- }
- }
-
- if (!empty($this->dsn['charset'])) {
- $result = $this->setCharset($this->dsn['charset'], $connection);
- if (PEAR::isError($result)) {
- return $result;
- }
- }
-
- // Enable extra compatibility settings on 8.2 and later
- if (function_exists('pg_parameter_status')) {
- $version = pg_parameter_status($connection, 'server_version');
- if ($version == false) {
- return $this->raiseError(null, null, null,
- 'Unable to retrieve server version', __FUNCTION__);
- }
- $version = explode ('.', $version);
- if ( $version['0'] > 8
- || ($version['0'] == 8 && $version['1'] >= 2)
- ) {
- if (!@pg_query($connection, "SET SESSION STANDARD_CONFORMING_STRINGS = OFF")) {
- return $this->raiseError(null, null, null,
- 'Unable to set standard_conforming_strings to off', __FUNCTION__);
- }
-
- if (!@pg_query($connection, "SET SESSION ESCAPE_STRING_WARNING = OFF")) {
- return $this->raiseError(null, null, null,
- 'Unable to set escape_string_warning to off', __FUNCTION__);
- }
- }
- }
-
- return $connection;
- }
-
- // }}}
- // {{{ connect()
-
- /**
- * Connect to the database
- *
- * @return true on success, MDB2 Error Object on failure
- * @access public
- */
- function connect()
- {
- if (is_resource($this->connection)) {
- //if (count(array_diff($this->connected_dsn, $this->dsn)) == 0
- if (MDB2::areEquals($this->connected_dsn, $this->dsn)
- && $this->connected_database_name == $this->database_name
- && ($this->opened_persistent == $this->options['persistent'])
- ) {
- return MDB2_OK;
- }
- $this->disconnect(false);
- }
-
- if ($this->database_name) {
- $connection = $this->_doConnect($this->dsn['username'],
- $this->dsn['password'],
- $this->database_name,
- $this->options['persistent']);
- if (PEAR::isError($connection)) {
- return $connection;
- }
-
- $this->connection = $connection;
- $this->connected_dsn = $this->dsn;
- $this->connected_database_name = $this->database_name;
- $this->opened_persistent = $this->options['persistent'];
- $this->dbsyntax = $this->dsn['dbsyntax'] ? $this->dsn['dbsyntax'] : $this->phptype;
- }
-
- return MDB2_OK;
- }
-
- // }}}
- // {{{ setCharset()
-
- /**
- * Set the charset on the current connection
- *
- * @param string charset
- * @param resource connection handle
- *
- * @return true on success, MDB2 Error Object on failure
- */
- function setCharset($charset, $connection = null)
- {
- if (null === $connection) {
- $connection = $this->getConnection();
- if (PEAR::isError($connection)) {
- return $connection;
- }
- }
- if (is_array($charset)) {
- $charset = array_shift($charset);
- $this->warnings[] = 'postgresql does not support setting client collation';
- }
- $result = @pg_set_client_encoding($connection, $charset);
- if ($result == -1) {
- return $this->raiseError(null, null, null,
- 'Unable to set client charset: '.$charset, __FUNCTION__);
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ databaseExists()
-
- /**
- * check if given database name is exists?
- *
- * @param string $name name of the database that should be checked
- *
- * @return mixed true/false on success, a MDB2 error on failure
- * @access public
- */
- function databaseExists($name)
- {
- $res = $this->_doConnect($this->dsn['username'],
- $this->dsn['password'],
- $this->escape($name),
- $this->options['persistent']);
- if (!PEAR::isError($res)) {
- return true;
- }
-
- return false;
- }
-
- // }}}
- // {{{ disconnect()
-
- /**
- * Log out and disconnect from the database.
- *
- * @param boolean $force if the disconnect should be forced even if the
- * connection is opened persistently
- * @return mixed true on success, false if not connected and error
- * object on error
- * @access public
- */
- function disconnect($force = true)
- {
- if (is_resource($this->connection)) {
- if ($this->in_transaction) {
- $dsn = $this->dsn;
- $database_name = $this->database_name;
- $persistent = $this->options['persistent'];
- $this->dsn = $this->connected_dsn;
- $this->database_name = $this->connected_database_name;
- $this->options['persistent'] = $this->opened_persistent;
- $this->rollback();
- $this->dsn = $dsn;
- $this->database_name = $database_name;
- $this->options['persistent'] = $persistent;
- }
-
- if (!$this->opened_persistent || $force) {
- $ok = @pg_close($this->connection);
- if (!$ok) {
- return $this->raiseError(MDB2_ERROR_DISCONNECT_FAILED,
- null, null, null, __FUNCTION__);
- }
- }
- } else {
- return false;
- }
- return parent::disconnect($force);
- }
-
- // }}}
- // {{{ standaloneQuery()
-
- /**
- * execute a query as DBA
- *
- * @param string $query the SQL query
- * @param mixed $types array that contains the types of the columns in
- * the result set
- * @param boolean $is_manip if the query is a manipulation query
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function standaloneQuery($query, $types = null, $is_manip = false)
- {
- $user = $this->options['DBA_username']? $this->options['DBA_username'] : $this->dsn['username'];
- $pass = $this->options['DBA_password']? $this->options['DBA_password'] : $this->dsn['password'];
- $connection = $this->_doConnect($user, $pass, $this->database_name, $this->options['persistent']);
- if (PEAR::isError($connection)) {
- return $connection;
- }
-
- $offset = $this->offset;
- $limit = $this->limit;
- $this->offset = $this->limit = 0;
- $query = $this->_modifyQuery($query, $is_manip, $limit, $offset);
-
- $result = $this->_doQuery($query, $is_manip, $connection, $this->database_name);
- if (!PEAR::isError($result)) {
- if ($is_manip) {
- $result = $this->_affectedRows($connection, $result);
- } else {
- $result = $this->_wrapResult($result, $types, true, true, $limit, $offset);
- }
- }
-
- @pg_close($connection);
- return $result;
- }
-
- // }}}
- // {{{ _doQuery()
-
- /**
- * Execute a query
- * @param string $query query
- * @param boolean $is_manip if the query is a manipulation query
- * @param resource $connection
- * @param string $database_name
- * @return result or error object
- * @access protected
- */
- function _doQuery($query, $is_manip = false, $connection = null, $database_name = null)
- {
- $this->last_query = $query;
- $result = $this->debug($query, 'query', array('is_manip' => $is_manip, 'when' => 'pre'));
- if ($result) {
- if (PEAR::isError($result)) {
- return $result;
- }
- $query = $result;
- }
- if ($this->options['disable_query']) {
- $result = $is_manip ? 0 : null;
- return $result;
- }
-
- if (null === $connection) {
- $connection = $this->getConnection();
- if (PEAR::isError($connection)) {
- return $connection;
- }
- }
-
- $function = $this->options['multi_query'] ? 'pg_send_query' : 'pg_query';
- $result = @$function($connection, $query);
- if (!$result) {
- $err = $this->raiseError(null, null, null,
- 'Could not execute statement', __FUNCTION__);
- return $err;
- } elseif ($this->options['multi_query']) {
- if (!($result = @pg_get_result($connection))) {
- $err = $this->raiseError(null, null, null,
- 'Could not get the first result from a multi query', __FUNCTION__);
- return $err;
- }
- }
-
- $this->debug($query, 'query', array('is_manip' => $is_manip, 'when' => 'post', 'result' => $result));
- return $result;
- }
-
- // }}}
- // {{{ _affectedRows()
-
- /**
- * Returns the number of rows affected
- *
- * @param resource $result
- * @param resource $connection
- * @return mixed MDB2 Error Object or the number of rows affected
- * @access private
- */
- function _affectedRows($connection, $result = null)
- {
- if (null === $connection) {
- $connection = $this->getConnection();
- if (PEAR::isError($connection)) {
- return $connection;
- }
- }
- return @pg_affected_rows($result);
- }
-
- // }}}
- // {{{ _modifyQuery()
-
- /**
- * Changes a query string for various DBMS specific reasons
- *
- * @param string $query query to modify
- * @param boolean $is_manip if it is a DML query
- * @param integer $limit limit the number of rows
- * @param integer $offset start reading from given offset
- * @return string modified query
- * @access protected
- */
- function _modifyQuery($query, $is_manip, $limit, $offset)
- {
- if ($limit > 0
- && !preg_match('/LIMIT\s*\d(?:\s*(?:,|OFFSET)\s*\d+)?(?:[^\)]*)?$/i', $query)
- ) {
- $query = rtrim($query);
- if (substr($query, -1) == ';') {
- $query = substr($query, 0, -1);
- }
- if ($is_manip) {
- $query = $this->_modifyManipQuery($query, $limit);
- } else {
- $query.= " LIMIT $limit OFFSET $offset";
- }
- }
- return $query;
- }
-
- // }}}
- // {{{ _modifyManipQuery()
-
- /**
- * Changes a manip query string for various DBMS specific reasons
- *
- * @param string $query query to modify
- * @param integer $limit limit the number of rows
- * @return string modified query
- * @access protected
- */
- function _modifyManipQuery($query, $limit)
- {
- $pos = strpos(strtolower($query), 'where');
- $where = $pos ? substr($query, $pos) : '';
-
- $manip_clause = '(\bDELETE\b\s+(?:\*\s+)?\bFROM\b|\bUPDATE\b)';
- $from_clause = '([\w\.]+)';
- $where_clause = '(?:(.*)\bWHERE\b\s+(.*))|(.*)';
- $pattern = '/^'. $manip_clause . '\s+' . $from_clause .'(?:\s)*(?:'. $where_clause .')?$/i';
- $matches = preg_match($pattern, $query, $match);
- if ($matches) {
- $manip = $match[1];
- $from = $match[2];
- $what = (count($matches) == 6) ? $match[5] : $match[3];
- return $manip.' '.$from.' '.$what.' WHERE ctid=(SELECT ctid FROM '.$from.' '.$where.' LIMIT '.$limit.')';
- }
- //return error?
- return $query;
- }
-
- // }}}
- // {{{ getServerVersion()
-
- /**
- * return version information about the server
- *
- * @param bool $native determines if the raw version string should be returned
- * @return mixed array/string with version information or MDB2 error object
- * @access public
- */
- function getServerVersion($native = false)
- {
- $query = 'SHOW SERVER_VERSION';
- if ($this->connected_server_info) {
- $server_info = $this->connected_server_info;
- } else {
- $server_info = $this->queryOne($query, 'text');
- if (PEAR::isError($server_info)) {
- return $server_info;
- }
- }
- // cache server_info
- $this->connected_server_info = $server_info;
- if (!$native && !PEAR::isError($server_info)) {
- $tmp = explode('.', $server_info, 3);
- if (empty($tmp[2])
- && isset($tmp[1])
- && preg_match('/(\d+)(.*)/', $tmp[1], $tmp2)
- ) {
- $server_info = array(
- 'major' => $tmp[0],
- 'minor' => $tmp2[1],
- 'patch' => null,
- 'extra' => $tmp2[2],
- 'native' => $server_info,
- );
- } else {
- $server_info = array(
- 'major' => isset($tmp[0]) ? $tmp[0] : null,
- 'minor' => isset($tmp[1]) ? $tmp[1] : null,
- 'patch' => isset($tmp[2]) ? $tmp[2] : null,
- 'extra' => null,
- 'native' => $server_info,
- );
- }
- }
- return $server_info;
- }
-
- // }}}
- // {{{ prepare()
-
- /**
- * Prepares a query for multiple execution with execute().
- * With some database backends, this is emulated.
- * prepare() requires a generic query as string like
- * 'INSERT INTO numbers VALUES(?,?)' or
- * 'INSERT INTO numbers VALUES(:foo,:bar)'.
- * The ? and :name and are placeholders which can be set using
- * bindParam() and the query can be sent off using the execute() method.
- * The allowed format for :name can be set with the 'bindname_format' option.
- *
- * @param string $query the query to prepare
- * @param mixed $types array that contains the types of the placeholders
- * @param mixed $result_types array that contains the types of the columns in
- * the result set or MDB2_PREPARE_RESULT, if set to
- * MDB2_PREPARE_MANIP the query is handled as a manipulation query
- * @param mixed $lobs key (field) value (parameter) pair for all lob placeholders
- * @return mixed resource handle for the prepared query on success, a MDB2
- * error on failure
- * @access public
- * @see bindParam, execute
- */
- function prepare($query, $types = null, $result_types = null, $lobs = array())
- {
- if ($this->options['emulate_prepared']) {
- return parent::prepare($query, $types, $result_types, $lobs);
- }
- $is_manip = ($result_types === MDB2_PREPARE_MANIP);
- $offset = $this->offset;
- $limit = $this->limit;
- $this->offset = $this->limit = 0;
- $result = $this->debug($query, __FUNCTION__, array('is_manip' => $is_manip, 'when' => 'pre'));
- if ($result) {
- if (PEAR::isError($result)) {
- return $result;
- }
- $query = $result;
- }
- $pgtypes = function_exists('pg_prepare') ? false : array();
- if ($pgtypes !== false && !empty($types)) {
- $this->loadModule('Datatype', null, true);
- }
- $query = $this->_modifyQuery($query, $is_manip, $limit, $offset);
- $placeholder_type_guess = $placeholder_type = null;
- $question = '?';
- $colon = ':';
- $positions = array();
- $position = $parameter = 0;
- while ($position < strlen($query)) {
- $q_position = strpos($query, $question, $position);
- $c_position = strpos($query, $colon, $position);
- //skip "::type" cast ("select id::varchar(20) from sometable where name=?")
- $doublecolon_position = strpos($query, '::', $position);
- if ($doublecolon_position !== false && $doublecolon_position == $c_position) {
- $c_position = strpos($query, $colon, $position+2);
- }
- if ($q_position && $c_position) {
- $p_position = min($q_position, $c_position);
- } elseif ($q_position) {
- $p_position = $q_position;
- } elseif ($c_position) {
- $p_position = $c_position;
- } else {
- break;
- }
- if (null === $placeholder_type) {
- $placeholder_type_guess = $query[$p_position];
- }
-
- $new_pos = $this->_skipDelimitedStrings($query, $position, $p_position);
- if (PEAR::isError($new_pos)) {
- return $new_pos;
- }
- if ($new_pos != $position) {
- $position = $new_pos;
- continue; //evaluate again starting from the new position
- }
-
- if ($query[$position] == $placeholder_type_guess) {
- if (null === $placeholder_type) {
- $placeholder_type = $query[$p_position];
- $question = $colon = $placeholder_type;
- if (!empty($types) && is_array($types)) {
- if ($placeholder_type == ':') {
- } else {
- $types = array_values($types);
- }
- }
- }
- if ($placeholder_type_guess == '?') {
- $length = 1;
- $name = $parameter;
- } else {
- $regexp = '/^.{'.($position+1).'}('.$this->options['bindname_format'].').*$/s';
- $param = preg_replace($regexp, '\\1', $query);
- if ($param === '') {
- $err = $this->raiseError(MDB2_ERROR_SYNTAX, null, null,
- 'named parameter name must match "bindname_format" option', __FUNCTION__);
- return $err;
- }
- $length = strlen($param) + 1;
- $name = $param;
- }
- if ($pgtypes !== false) {
- if (is_array($types) && array_key_exists($name, $types)) {
- $pgtypes[] = $this->datatype->mapPrepareDatatype($types[$name]);
- } elseif (is_array($types) && array_key_exists($parameter, $types)) {
- $pgtypes[] = $this->datatype->mapPrepareDatatype($types[$parameter]);
- } else {
- $pgtypes[] = 'text';
- }
- }
- if (($key_parameter = array_search($name, $positions)) !== false) {
- //$next_parameter = 1;
- $parameter = $key_parameter + 1;
- //foreach ($positions as $key => $value) {
- // if ($key_parameter == $key) {
- // break;
- // }
- // ++$next_parameter;
- //}
- } else {
- ++$parameter;
- //$next_parameter = $parameter;
- $positions[] = $name;
- }
- $query = substr_replace($query, '$'.$parameter, $position, $length);
- $position = $p_position + strlen($parameter);
- } else {
- $position = $p_position;
- }
- }
- $connection = $this->getConnection();
- if (PEAR::isError($connection)) {
- return $connection;
- }
- static $prep_statement_counter = 1;
- $statement_name = sprintf($this->options['statement_format'], $this->phptype, $prep_statement_counter++ . sha1(microtime() + mt_rand()));
- $statement_name = substr(strtolower($statement_name), 0, $this->options['max_identifiers_length']);
- if (false === $pgtypes) {
- $result = @pg_prepare($connection, $statement_name, $query);
- if (!$result) {
- $err = $this->raiseError(null, null, null,
- 'Unable to create prepared statement handle', __FUNCTION__);
- return $err;
- }
- } else {
- $types_string = '';
- if ($pgtypes) {
- $types_string = ' ('.implode(', ', $pgtypes).') ';
- }
- $query = 'PREPARE '.$statement_name.$types_string.' AS '.$query;
- $statement = $this->_doQuery($query, true, $connection);
- if (PEAR::isError($statement)) {
- return $statement;
- }
- }
-
- $class_name = 'MDB2_Statement_'.$this->phptype;
- $obj = new $class_name($this, $statement_name, $positions, $query, $types, $result_types, $is_manip, $limit, $offset);
- $this->debug($query, __FUNCTION__, array('is_manip' => $is_manip, 'when' => 'post', 'result' => $obj));
- return $obj;
- }
-
- // }}}
- // {{{ function getSequenceName($sqn)
-
- /**
- * adds sequence name formatting to a sequence name
- *
- * @param string name of the sequence
- *
- * @return string formatted sequence name
- *
- * @access public
- */
- function getSequenceName($sqn)
- {
- if (false === $this->options['disable_smart_seqname']) {
- if (strpos($sqn, '_') !== false) {
- list($table, $field) = explode('_', $sqn, 2);
- }
- $schema_list = $this->queryOne("SELECT array_to_string(current_schemas(false), ',')");
- if (PEAR::isError($schema_list) || empty($schema_list) || count($schema_list) < 2) {
- $order_by = ' a.attnum';
- $schema_clause = ' AND n.nspname=current_schema()';
- } else {
- $schemas = explode(',', $schema_list);
- $schema_clause = ' AND n.nspname IN ('.$schema_list.')';
- $counter = 1;
- $order_by = ' CASE ';
- foreach ($schemas as $schema) {
- $order_by .= ' WHEN n.nspname='.$schema.' THEN '.$counter++;
- }
- $order_by .= ' ELSE '.$counter.' END, a.attnum';
- }
-
- $query = "SELECT substring((SELECT substring(pg_get_expr(d.adbin, d.adrelid) for 128)
- FROM pg_attrdef d
- WHERE d.adrelid = a.attrelid
- AND d.adnum = a.attnum
- AND a.atthasdef
- ) FROM 'nextval[^'']*''([^'']*)')
- FROM pg_attribute a
- LEFT JOIN pg_class c ON c.oid = a.attrelid
- LEFT JOIN pg_attrdef d ON d.adrelid = a.attrelid AND d.adnum = a.attnum AND a.atthasdef
- LEFT JOIN pg_namespace n ON c.relnamespace = n.oid
- WHERE (c.relname = ".$this->quote($sqn, 'text');
- if (!empty($field)) {
- $query .= " OR (c.relname = ".$this->quote($table, 'text')." AND a.attname = ".$this->quote($field, 'text').")";
- }
- $query .= " )"
- .$schema_clause."
- AND NOT a.attisdropped
- AND a.attnum > 0
- AND pg_get_expr(d.adbin, d.adrelid) LIKE 'nextval%'
- ORDER BY ".$order_by;
- $seqname = $this->queryOne($query);
- if (!PEAR::isError($seqname) && !empty($seqname) && is_string($seqname)) {
- return $seqname;
- }
- }
-
- return parent::getSequenceName($sqn);
- }
-
- // }}}
- // {{{ nextID()
-
- /**
- * Returns the next free id of a sequence
- *
- * @param string $seq_name name of the sequence
- * @param boolean $ondemand when true the sequence is
- * automatic created, if it
- * not exists
- * @return mixed MDB2 Error Object or id
- * @access public
- */
- function nextID($seq_name, $ondemand = true)
- {
- $sequence_name = $this->quoteIdentifier($this->getSequenceName($seq_name), true);
- $query = "SELECT NEXTVAL('$sequence_name')";
- $this->pushErrorHandling(PEAR_ERROR_RETURN);
- $this->expectError(MDB2_ERROR_NOSUCHTABLE);
- $result = $this->queryOne($query, 'integer');
- $this->popExpect();
- $this->popErrorHandling();
- if (PEAR::isError($result)) {
- if ($ondemand && $result->getCode() == MDB2_ERROR_NOSUCHTABLE) {
- $this->loadModule('Manager', null, true);
- $result = $this->manager->createSequence($seq_name);
- if (PEAR::isError($result)) {
- return $this->raiseError($result, null, null,
- 'on demand sequence could not be created', __FUNCTION__);
- }
- return $this->nextId($seq_name, false);
- }
- }
- return $result;
- }
-
- // }}}
- // {{{ lastInsertID()
-
- /**
- * Returns the autoincrement ID if supported or $id or fetches the current
- * ID in a sequence called: $table.(empty($field) ? '' : '_'.$field)
- *
- * @param string $table name of the table into which a new row was inserted
- * @param string $field name of the field into which a new row was inserted
- * @return mixed MDB2 Error Object or id
- * @access public
- */
- function lastInsertID($table = null, $field = null)
- {
- if (empty($table) && empty($field)) {
- return $this->queryOne('SELECT lastval()', 'integer');
- }
- $seq = $table.(empty($field) ? '' : '_'.$field);
- $sequence_name = $this->quoteIdentifier($this->getSequenceName($seq), true);
- return $this->queryOne("SELECT currval('$sequence_name')", 'integer');
- }
-
- // }}}
- // {{{ currID()
-
- /**
- * Returns the current id of a sequence
- *
- * @param string $seq_name name of the sequence
- * @return mixed MDB2 Error Object or id
- * @access public
- */
- function currID($seq_name)
- {
- $sequence_name = $this->quoteIdentifier($this->getSequenceName($seq_name), true);
- return $this->queryOne("SELECT last_value FROM $sequence_name", 'integer');
- }
-}
-
-/**
- * MDB2 PostGreSQL result driver
- *
- * @package MDB2
- * @category Database
- * @author Paul Cooper <pgc@ucecom.com>
- */
-class MDB2_Result_pgsql extends MDB2_Result_Common
-{
- // }}}
- // {{{ fetchRow()
-
- /**
- * Fetch a row and insert the data into an existing array.
- *
- * @param int $fetchmode how the array data should be indexed
- * @param int $rownum number of the row where the data can be found
- * @return int data array on success, a MDB2 error on failure
- * @access public
- */
- function fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null)
- {
- if (null !== $rownum) {
- $seek = $this->seek($rownum);
- if (PEAR::isError($seek)) {
- return $seek;
- }
- }
- if ($fetchmode == MDB2_FETCHMODE_DEFAULT) {
- $fetchmode = $this->db->fetchmode;
- }
- if ( $fetchmode == MDB2_FETCHMODE_ASSOC
- || $fetchmode == MDB2_FETCHMODE_OBJECT
- ) {
- $row = @pg_fetch_array($this->result, null, PGSQL_ASSOC);
- if (is_array($row)
- && $this->db->options['portability'] & MDB2_PORTABILITY_FIX_CASE
- ) {
- $row = array_change_key_case($row, $this->db->options['field_case']);
- }
- } else {
- $row = @pg_fetch_row($this->result);
- }
- if (!$row) {
- if (false === $this->result) {
- $err = $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
- 'resultset has already been freed', __FUNCTION__);
- return $err;
- }
- return null;
- }
- $mode = $this->db->options['portability'] & MDB2_PORTABILITY_EMPTY_TO_NULL;
- $rtrim = false;
- if ($this->db->options['portability'] & MDB2_PORTABILITY_RTRIM) {
- if (empty($this->types)) {
- $mode += MDB2_PORTABILITY_RTRIM;
- } else {
- $rtrim = true;
- }
- }
- if ($mode) {
- $this->db->_fixResultArrayValues($row, $mode);
- }
- if ( ( $fetchmode != MDB2_FETCHMODE_ASSOC
- && $fetchmode != MDB2_FETCHMODE_OBJECT)
- && !empty($this->types)
- ) {
- $row = $this->db->datatype->convertResultRow($this->types, $row, $rtrim);
- } elseif (($fetchmode == MDB2_FETCHMODE_ASSOC
- || $fetchmode == MDB2_FETCHMODE_OBJECT)
- && !empty($this->types_assoc)
- ) {
- $row = $this->db->datatype->convertResultRow($this->types_assoc, $row, $rtrim);
- }
- if (!empty($this->values)) {
- $this->_assignBindColumns($row);
- }
- if ($fetchmode === MDB2_FETCHMODE_OBJECT) {
- $object_class = $this->db->options['fetch_class'];
- if ($object_class == 'stdClass') {
- $row = (object) $row;
- } else {
- $rowObj = new $object_class($row);
- $row = $rowObj;
- }
- }
- ++$this->rownum;
- return $row;
- }
-
- // }}}
- // {{{ _getColumnNames()
-
- /**
- * Retrieve the names of columns returned by the DBMS in a query result.
- *
- * @return mixed Array variable that holds the names of columns as keys
- * or an MDB2 error on failure.
- * Some DBMS may not return any columns when the result set
- * does not contain any rows.
- * @access private
- */
- function _getColumnNames()
- {
- $columns = array();
- $numcols = $this->numCols();
- if (PEAR::isError($numcols)) {
- return $numcols;
- }
- for ($column = 0; $column < $numcols; $column++) {
- $column_name = @pg_field_name($this->result, $column);
- $columns[$column_name] = $column;
- }
- if ($this->db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $columns = array_change_key_case($columns, $this->db->options['field_case']);
- }
- return $columns;
- }
-
- // }}}
- // {{{ numCols()
-
- /**
- * Count the number of columns returned by the DBMS in a query result.
- *
- * @access public
- * @return mixed integer value with the number of columns, a MDB2 error
- * on failure
- */
- function numCols()
- {
- $cols = @pg_num_fields($this->result);
- if (null === $cols) {
- if (false === $this->result) {
- return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
- 'resultset has already been freed', __FUNCTION__);
- }
- if (null === $this->result) {
- return count($this->types);
- }
- return $this->db->raiseError(null, null, null,
- 'Could not get column count', __FUNCTION__);
- }
- return $cols;
- }
-
- // }}}
- // {{{ nextResult()
-
- /**
- * Move the internal result pointer to the next available result
- *
- * @return true on success, false if there is no more result set or an error object on failure
- * @access public
- */
- function nextResult()
- {
- $connection = $this->db->getConnection();
- if (PEAR::isError($connection)) {
- return $connection;
- }
-
- if (!($this->result = @pg_get_result($connection))) {
- return false;
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ free()
-
- /**
- * Free the internal resources associated with result.
- *
- * @return boolean true on success, false if result is invalid
- * @access public
- */
- function free()
- {
- if (is_resource($this->result) && $this->db->connection) {
- $free = @pg_free_result($this->result);
- if (false === $free) {
- return $this->db->raiseError(null, null, null,
- 'Could not free result', __FUNCTION__);
- }
- }
- $this->result = false;
- return MDB2_OK;
- }
-}
-
-/**
- * MDB2 PostGreSQL buffered result driver
- *
- * @package MDB2
- * @category Database
- * @author Paul Cooper <pgc@ucecom.com>
- */
-class MDB2_BufferedResult_pgsql extends MDB2_Result_pgsql
-{
- // {{{ seek()
-
- /**
- * Seek to a specific row in a result set
- *
- * @param int $rownum number of the row where the data can be found
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function seek($rownum = 0)
- {
- if ($this->rownum != ($rownum - 1) && !@pg_result_seek($this->result, $rownum)) {
- if (false === $this->result) {
- return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
- 'resultset has already been freed', __FUNCTION__);
- }
- if (null === $this->result) {
- return MDB2_OK;
- }
- return $this->db->raiseError(MDB2_ERROR_INVALID, null, null,
- 'tried to seek to an invalid row number ('.$rownum.')', __FUNCTION__);
- }
- $this->rownum = $rownum - 1;
- return MDB2_OK;
- }
-
- // }}}
- // {{{ valid()
-
- /**
- * Check if the end of the result set has been reached
- *
- * @return mixed true or false on sucess, a MDB2 error on failure
- * @access public
- */
- function valid()
- {
- $numrows = $this->numRows();
- if (PEAR::isError($numrows)) {
- return $numrows;
- }
- return $this->rownum < ($numrows - 1);
- }
-
- // }}}
- // {{{ numRows()
-
- /**
- * Returns the number of rows in a result object
- *
- * @return mixed MDB2 Error Object or the number of rows
- * @access public
- */
- function numRows()
- {
- $rows = @pg_num_rows($this->result);
- if (null === $rows) {
- if (false === $this->result) {
- return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
- 'resultset has already been freed', __FUNCTION__);
- }
- if (null === $this->result) {
- return 0;
- }
- return $this->db->raiseError(null, null, null,
- 'Could not get row count', __FUNCTION__);
- }
- return $rows;
- }
-}
-
-/**
- * MDB2 PostGreSQL statement driver
- *
- * @package MDB2
- * @category Database
- * @author Paul Cooper <pgc@ucecom.com>
- */
-class MDB2_Statement_pgsql extends MDB2_Statement_Common
-{
- // {{{ _execute()
-
- /**
- * Execute a prepared query statement helper method.
- *
- * @param mixed $result_class string which specifies which result class to use
- * @param mixed $result_wrap_class string which specifies which class to wrap results in
- *
- * @return mixed MDB2_Result or integer (affected rows) on success,
- * a MDB2 error on failure
- * @access private
- */
- function _execute($result_class = true, $result_wrap_class = true)
- {
- if (null === $this->statement) {
- return parent::_execute($result_class, $result_wrap_class);
- }
- $this->db->last_query = $this->query;
- $this->db->debug($this->query, 'execute', array('is_manip' => $this->is_manip, 'when' => 'pre', 'parameters' => $this->values));
- if ($this->db->getOption('disable_query')) {
- $result = $this->is_manip ? 0 : null;
- return $result;
- }
-
- $connection = $this->db->getConnection();
- if (PEAR::isError($connection)) {
- return $connection;
- }
-
- $query = false;
- $parameters = array();
- // todo: disabled until pg_execute() bytea issues are cleared up
- if (true || !function_exists('pg_execute')) {
- $query = 'EXECUTE '.$this->statement;
- }
- if (!empty($this->positions)) {
- foreach ($this->positions as $parameter) {
- if (!array_key_exists($parameter, $this->values)) {
- return $this->db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- 'Unable to bind to missing placeholder: '.$parameter, __FUNCTION__);
- }
- $value = $this->values[$parameter];
- $type = array_key_exists($parameter, $this->types) ? $this->types[$parameter] : null;
- if (is_resource($value) || $type == 'clob' || $type == 'blob' || $this->db->options['lob_allow_url_include']) {
- if (!is_resource($value) && preg_match('/^(\w+:\/\/)(.*)$/', $value, $match)) {
- if ($match[1] == 'file://') {
- $value = $match[2];
- }
- $value = @fopen($value, 'r');
- $close = true;
- }
- if (is_resource($value)) {
- $data = '';
- while (!@feof($value)) {
- $data.= @fread($value, $this->db->options['lob_buffer_length']);
- }
- if ($close) {
- @fclose($value);
- }
- $value = $data;
- }
- }
- $quoted = $this->db->quote($value, $type, $query);
- if (PEAR::isError($quoted)) {
- return $quoted;
- }
- $parameters[] = $quoted;
- }
- if ($query) {
- $query.= ' ('.implode(', ', $parameters).')';
- }
- }
-
- if (!$query) {
- $result = @pg_execute($connection, $this->statement, $parameters);
- if (!$result) {
- $err = $this->db->raiseError(null, null, null,
- 'Unable to execute statement', __FUNCTION__);
- return $err;
- }
- } else {
- $result = $this->db->_doQuery($query, $this->is_manip, $connection);
- if (PEAR::isError($result)) {
- return $result;
- }
- }
-
- if ($this->is_manip) {
- $affected_rows = $this->db->_affectedRows($connection, $result);
- return $affected_rows;
- }
-
- $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;
- }
-
- // }}}
- // {{{ free()
-
- /**
- * Release resources allocated for the specified prepared query.
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function free()
- {
- if (null === $this->positions) {
- return $this->db->raiseError(MDB2_ERROR, null, null,
- 'Prepared statement has already been freed', __FUNCTION__);
- }
- $result = MDB2_OK;
-
- if (null !== $this->statement) {
- $connection = $this->db->getConnection();
- if (PEAR::isError($connection)) {
- return $connection;
- }
- $query = 'DEALLOCATE PREPARE '.$this->statement;
- $result = $this->db->_doQuery($query, true, $connection);
- }
-
- parent::free();
- return $result;
- }
-
- /**
- * drop an existing table
- *
- * @param string $name name of the table that should be dropped
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function dropTable($name)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $name = $db->quoteIdentifier($name, true);
- $result = $db->exec("DROP TABLE $name");
-
- if (PEAR::isError($result)) {
- $result = $db->exec("DROP TABLE $name CASCADE");
- }
-
- return $result;
- }
-}
-?>
diff --git a/3rdparty/MDB2/Driver/sqlite.php b/3rdparty/MDB2/Driver/sqlite.php
deleted file mode 100644
index 42363bb8c58..00000000000
--- a/3rdparty/MDB2/Driver/sqlite.php
+++ /dev/null
@@ -1,1104 +0,0 @@
-<?php
-// vim: set et ts=4 sw=4 fdm=marker:
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2008 Manuel Lemos, Tomas V.V.Cox, |
-// | Stig. S. Bakken, Lukas Smith |
-// | All rights reserved. |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
-// | API as well as database abstraction for PHP applications. |
-// | This LICENSE is in the BSD license style. |
-// | |
-// | Redistribution and use in source and binary forms, with or without |
-// | modification, are permitted provided that the following conditions |
-// | are met: |
-// | |
-// | Redistributions of source code must retain the above copyright |
-// | notice, this list of conditions and the following disclaimer. |
-// | |
-// | Redistributions in binary form must reproduce the above copyright |
-// | notice, this list of conditions and the following disclaimer in the |
-// | documentation and/or other materials provided with the distribution. |
-// | |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission. |
-// | |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-// | POSSIBILITY OF SUCH DAMAGE. |
-// +----------------------------------------------------------------------+
-// | Author: Lukas Smith <smith@pooteeweet.org> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-//
-
-/**
- * MDB2 SQLite driver
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Driver_sqlite extends MDB2_Driver_Common
-{
- // {{{ properties
- var $string_quoting = array('start' => "'", 'end' => "'", 'escape' => "'", 'escape_pattern' => false);
-
- var $identifier_quoting = array('start' => '"', 'end' => '"', 'escape' => '"');
-
- var $_lasterror = '';
-
- var $fix_assoc_fields_names = false;
-
- // }}}
- // {{{ constructor
-
- /**
- * Constructor
- */
- function __construct()
- {
- parent::__construct();
-
- $this->phptype = 'sqlite';
- $this->dbsyntax = 'sqlite';
-
- $this->supported['sequences'] = 'emulated';
- $this->supported['indexes'] = true;
- $this->supported['affected_rows'] = true;
- $this->supported['summary_functions'] = true;
- $this->supported['order_by_text'] = true;
- $this->supported['current_id'] = 'emulated';
- $this->supported['limit_queries'] = true;
- $this->supported['LOBs'] = true;
- $this->supported['replace'] = true;
- $this->supported['transactions'] = true;
- $this->supported['savepoints'] = false;
- $this->supported['sub_selects'] = true;
- $this->supported['triggers'] = true;
- $this->supported['auto_increment'] = true;
- $this->supported['primary_key'] = false; // requires alter table implementation
- $this->supported['result_introspection'] = false; // not implemented
- $this->supported['prepared_statements'] = 'emulated';
- $this->supported['identifier_quoting'] = true;
- $this->supported['pattern_escaping'] = false;
- $this->supported['new_link'] = false;
-
- $this->options['DBA_username'] = false;
- $this->options['DBA_password'] = false;
- $this->options['base_transaction_name'] = '___php_MDB2_sqlite_auto_commit_off';
- $this->options['fixed_float'] = 0;
- $this->options['database_path'] = '';
- $this->options['database_extension'] = '';
- $this->options['server_version'] = '';
- $this->options['max_identifiers_length'] = 128; //no real limit
- }
-
- // }}}
- // {{{ errorInfo()
-
- /**
- * This method is used to collect information about an error
- *
- * @param integer $error
- * @return array
- * @access public
- */
- function errorInfo($error = null)
- {
- $native_code = null;
- if ($this->connection) {
- $native_code = @sqlite_last_error($this->connection);
- }
- $native_msg = $this->_lasterror
- ? html_entity_decode($this->_lasterror) : @sqlite_error_string($native_code);
-
- // PHP 5.2+ prepends the function name to $php_errormsg, so we need
- // this hack to work around it, per bug #9599.
- $native_msg = preg_replace('/^sqlite[a-z_]+\(\)[^:]*: /', '', $native_msg);
-
- if (null === $error) {
- static $error_regexps;
- if (empty($error_regexps)) {
- $error_regexps = array(
- '/^no such table:/' => MDB2_ERROR_NOSUCHTABLE,
- '/^no such index:/' => MDB2_ERROR_NOT_FOUND,
- '/^(table|index) .* already exists$/' => MDB2_ERROR_ALREADY_EXISTS,
- '/PRIMARY KEY must be unique/i' => MDB2_ERROR_CONSTRAINT,
- '/is not unique/' => MDB2_ERROR_CONSTRAINT,
- '/columns .* are not unique/i' => MDB2_ERROR_CONSTRAINT,
- '/uniqueness constraint failed/' => MDB2_ERROR_CONSTRAINT,
- '/violates .*constraint/' => MDB2_ERROR_CONSTRAINT,
- '/may not be NULL/' => MDB2_ERROR_CONSTRAINT_NOT_NULL,
- '/^no such column:/' => MDB2_ERROR_NOSUCHFIELD,
- '/no column named/' => MDB2_ERROR_NOSUCHFIELD,
- '/column not present in both tables/i' => MDB2_ERROR_NOSUCHFIELD,
- '/^near ".*": syntax error$/' => MDB2_ERROR_SYNTAX,
- '/[0-9]+ values for [0-9]+ columns/i' => MDB2_ERROR_VALUE_COUNT_ON_ROW,
- );
- }
- foreach ($error_regexps as $regexp => $code) {
- if (preg_match($regexp, $native_msg)) {
- $error = $code;
- break;
- }
- }
- }
- return array($error, $native_code, $native_msg);
- }
-
- // }}}
- // {{{ escape()
-
- /**
- * Quotes a string so it can be safely used in a query. It will quote
- * the text so it can safely be used within a query.
- *
- * @param string the input string to quote
- * @param bool escape wildcards
- *
- * @return string quoted string
- *
- * @access public
- */
- function escape($text, $escape_wildcards = false)
- {
- $text = @sqlite_escape_string($text);
- return $text;
- }
-
- // }}}
- // {{{ beginTransaction()
-
- /**
- * Start a transaction or set a savepoint.
- *
- * @param string name of a savepoint to set
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- *
- * @access public
- */
- function beginTransaction($savepoint = null)
- {
- $this->debug('Starting transaction/savepoint', __FUNCTION__, array('is_manip' => true, 'savepoint' => $savepoint));
- if (null !== $savepoint) {
- return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'savepoints are not supported', __FUNCTION__);
- }
- if ($this->in_transaction) {
- return MDB2_OK; //nothing to do
- }
- if (!$this->destructor_registered && $this->opened_persistent) {
- $this->destructor_registered = true;
- register_shutdown_function('MDB2_closeOpenTransactions');
- }
- $query = 'BEGIN TRANSACTION '.$this->options['base_transaction_name'];
- $result = $this->_doQuery($query, true);
- if (PEAR::isError($result)) {
- return $result;
- }
- $this->in_transaction = true;
- return MDB2_OK;
- }
-
- // }}}
- // {{{ commit()
-
- /**
- * Commit the database changes done during a transaction that is in
- * progress or release a savepoint. This function may only be called when
- * auto-committing is disabled, otherwise it will fail. Therefore, a new
- * transaction is implicitly started after committing the pending changes.
- *
- * @param string name of a savepoint to release
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- *
- * @access public
- */
- function commit($savepoint = null)
- {
- $this->debug('Committing transaction/savepoint', __FUNCTION__, array('is_manip' => true, 'savepoint' => $savepoint));
- if (!$this->in_transaction) {
- return $this->raiseError(MDB2_ERROR_INVALID, null, null,
- 'commit/release savepoint cannot be done changes are auto committed', __FUNCTION__);
- }
- if (null !== $savepoint) {
- return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'savepoints are not supported', __FUNCTION__);
- }
-
- $query = 'COMMIT TRANSACTION '.$this->options['base_transaction_name'];
- $result = $this->_doQuery($query, true);
- if (PEAR::isError($result)) {
- return $result;
- }
- $this->in_transaction = false;
- return MDB2_OK;
- }
-
- // }}}
- // {{{
-
- /**
- * Cancel any database changes done during a transaction or since a specific
- * savepoint that is in progress. This function may only be called when
- * auto-committing is disabled, otherwise it will fail. Therefore, a new
- * transaction is implicitly started after canceling the pending changes.
- *
- * @param string name of a savepoint to rollback to
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- *
- * @access public
- */
- function rollback($savepoint = null)
- {
- $this->debug('Rolling back transaction/savepoint', __FUNCTION__, array('is_manip' => true, 'savepoint' => $savepoint));
- if (!$this->in_transaction) {
- return $this->raiseError(MDB2_ERROR_INVALID, null, null,
- 'rollback cannot be done changes are auto committed', __FUNCTION__);
- }
- if (null !== $savepoint) {
- return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'savepoints are not supported', __FUNCTION__);
- }
-
- $query = 'ROLLBACK TRANSACTION '.$this->options['base_transaction_name'];
- $result = $this->_doQuery($query, true);
- if (PEAR::isError($result)) {
- return $result;
- }
- $this->in_transaction = false;
- return MDB2_OK;
- }
-
- // }}}
- // {{{ function setTransactionIsolation()
-
- /**
- * Set the transacton isolation level.
- *
- * @param string standard isolation level
- * READ UNCOMMITTED (allows dirty reads)
- * READ COMMITTED (prevents dirty reads)
- * REPEATABLE READ (prevents nonrepeatable reads)
- * SERIALIZABLE (prevents phantom reads)
- * @param array some transaction options:
- * 'wait' => 'WAIT' | 'NO WAIT'
- * 'rw' => 'READ WRITE' | 'READ ONLY'
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- *
- * @access public
- * @since 2.1.1
- */
- function setTransactionIsolation($isolation, $options = array())
- {
- $this->debug('Setting transaction isolation level', __FUNCTION__, array('is_manip' => true));
- switch ($isolation) {
- case 'READ UNCOMMITTED':
- $isolation = 0;
- break;
- case 'READ COMMITTED':
- case 'REPEATABLE READ':
- case 'SERIALIZABLE':
- $isolation = 1;
- break;
- default:
- return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'isolation level is not supported: '.$isolation, __FUNCTION__);
- }
-
- $query = "PRAGMA read_uncommitted=$isolation";
- return $this->_doQuery($query, true);
- }
-
- // }}}
- // {{{ getDatabaseFile()
-
- /**
- * Builds the string with path+dbname+extension
- *
- * @return string full database path+file
- * @access protected
- */
- function _getDatabaseFile($database_name)
- {
- if ($database_name === '' || $database_name === ':memory:') {
- return $database_name;
- }
- return $this->options['database_path'].$database_name.$this->options['database_extension'];
- }
-
- // }}}
- // {{{ connect()
-
- /**
- * Connect to the database
- *
- * @return true on success, MDB2 Error Object on failure
- **/
- function connect()
- {
- $database_file = $this->_getDatabaseFile($this->database_name);
- if (is_resource($this->connection)) {
- //if (count(array_diff($this->connected_dsn, $this->dsn)) == 0
- if (MDB2::areEquals($this->connected_dsn, $this->dsn)
- && $this->connected_database_name == $database_file
- && $this->opened_persistent == $this->options['persistent']
- ) {
- return MDB2_OK;
- }
- $this->disconnect(false);
- }
-
- if (!PEAR::loadExtension($this->phptype)) {
- return $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- 'extension '.$this->phptype.' is not compiled into PHP', __FUNCTION__);
- }
-
- if (empty($this->database_name)) {
- return $this->raiseError(MDB2_ERROR_CONNECT_FAILED, null, null,
- 'unable to establish a connection', __FUNCTION__);
- }
-
- if ($database_file !== ':memory:') {
- if (!file_exists($database_file)) {
- if (!touch($database_file)) {
- return $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- 'Could not create database file', __FUNCTION__);
- }
- if (!isset($this->dsn['mode'])
- || !is_numeric($this->dsn['mode'])
- ) {
- $mode = 0644;
- } else {
- $mode = octdec($this->dsn['mode']);
- }
- if (!chmod($database_file, $mode)) {
- return $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- 'Could not be chmodded database file', __FUNCTION__);
- }
- if (!file_exists($database_file)) {
- return $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
- 'Could not be found database file', __FUNCTION__);
- }
- }
- if (!is_file($database_file)) {
- return $this->raiseError(MDB2_ERROR_INVALID, null, null,
- 'Database is a directory name', __FUNCTION__);
- }
- if (!is_readable($database_file)) {
- return $this->raiseError(MDB2_ERROR_ACCESS_VIOLATION, null, null,
- 'Could not read database file', __FUNCTION__);
- }
- }
-
- $connect_function = ($this->options['persistent'] ? 'sqlite_popen' : 'sqlite_open');
- $php_errormsg = '';
- if (version_compare('5.1.0', PHP_VERSION, '>')) {
- @ini_set('track_errors', true);
- $connection = @$connect_function($database_file);
- @ini_restore('track_errors');
- } else {
- $connection = @$connect_function($database_file, 0666, $php_errormsg);
- }
- $this->_lasterror = $php_errormsg;
- if (!$connection) {
- return $this->raiseError(MDB2_ERROR_CONNECT_FAILED, null, null,
- 'unable to establish a connection', __FUNCTION__);
- }
-
- if ($this->fix_assoc_fields_names ||
- $this->options['portability'] & MDB2_PORTABILITY_FIX_ASSOC_FIELD_NAMES)
- {
- @sqlite_query("PRAGMA short_column_names = 1", $connection);
- $this->fix_assoc_fields_names = true;
- }
-
- $this->connection = $connection;
- $this->connected_dsn = $this->dsn;
- $this->connected_database_name = $database_file;
- $this->opened_persistent = $this->getoption('persistent');
- $this->dbsyntax = $this->dsn['dbsyntax'] ? $this->dsn['dbsyntax'] : $this->phptype;
-
- return MDB2_OK;
- }
-
- // }}}
- // {{{ databaseExists()
-
- /**
- * check if given database name is exists?
- *
- * @param string $name name of the database that should be checked
- *
- * @return mixed true/false on success, a MDB2 error on failure
- * @access public
- */
- function databaseExists($name)
- {
- $database_file = $this->_getDatabaseFile($name);
- $result = file_exists($database_file);
- return $result;
- }
-
- // }}}
- // {{{ disconnect()
-
- /**
- * Log out and disconnect from the database.
- *
- * @param boolean $force if the disconnect should be forced even if the
- * connection is opened persistently
- * @return mixed true on success, false if not connected and error
- * object on error
- * @access public
- */
- function disconnect($force = true)
- {
- if (is_resource($this->connection)) {
- if ($this->in_transaction) {
- $dsn = $this->dsn;
- $database_name = $this->database_name;
- $persistent = $this->options['persistent'];
- $this->dsn = $this->connected_dsn;
- $this->database_name = $this->connected_database_name;
- $this->options['persistent'] = $this->opened_persistent;
- $this->rollback();
- $this->dsn = $dsn;
- $this->database_name = $database_name;
- $this->options['persistent'] = $persistent;
- }
-
- if (!$this->opened_persistent || $force) {
- @sqlite_close($this->connection);
- }
- } else {
- return false;
- }
- return parent::disconnect($force);
- }
-
- // }}}
- // {{{ _doQuery()
-
- /**
- * Execute a query
- * @param string $query query
- * @param boolean $is_manip if the query is a manipulation query
- * @param resource $connection
- * @param string $database_name
- * @return result or error object
- * @access protected
- */
- function _doQuery($query, $is_manip = false, $connection = null, $database_name = null)
- {
- $this->last_query = $query;
- $result = $this->debug($query, 'query', array('is_manip' => $is_manip, 'when' => 'pre'));
- if ($result) {
- if (PEAR::isError($result)) {
- return $result;
- }
- $query = $result;
- }
- if ($this->options['disable_query']) {
- $result = $is_manip ? 0 : null;
- return $result;
- }
-
- if (null === $connection) {
- $connection = $this->getConnection();
- if (PEAR::isError($connection)) {
- return $connection;
- }
- }
-
- $function = $this->options['result_buffering']
- ? 'sqlite_query' : 'sqlite_unbuffered_query';
- $php_errormsg = '';
- if (version_compare('5.1.0', PHP_VERSION, '>')) {
- @ini_set('track_errors', true);
- do {
- $result = @$function($query.';', $connection);
- } while (sqlite_last_error($connection) == SQLITE_SCHEMA);
- @ini_restore('track_errors');
- } else {
- do {
- $result = @$function($query.';', $connection, SQLITE_BOTH, $php_errormsg);
- } while (sqlite_last_error($connection) == SQLITE_SCHEMA);
- }
- $this->_lasterror = $php_errormsg;
-
- if (!$result) {
- $code = null;
- if (0 === strpos($this->_lasterror, 'no such table')) {
- $code = MDB2_ERROR_NOSUCHTABLE;
- }
- $err = $this->raiseError($code, null, null,
- 'Could not execute statement', __FUNCTION__);
- return $err;
- }
-
- $this->debug($query, 'query', array('is_manip' => $is_manip, 'when' => 'post', 'result' => $result));
- return $result;
- }
-
- // }}}
- // {{{ _affectedRows()
-
- /**
- * Returns the number of rows affected
- *
- * @param resource $result
- * @param resource $connection
- * @return mixed MDB2 Error Object or the number of rows affected
- * @access private
- */
- function _affectedRows($connection, $result = null)
- {
- if (null === $connection) {
- $connection = $this->getConnection();
- if (PEAR::isError($connection)) {
- return $connection;
- }
- }
- return @sqlite_changes($connection);
- }
-
- // }}}
- // {{{ _modifyQuery()
-
- /**
- * Changes a query string for various DBMS specific reasons
- *
- * @param string $query query to modify
- * @param boolean $is_manip if it is a DML query
- * @param integer $limit limit the number of rows
- * @param integer $offset start reading from given offset
- * @return string modified query
- * @access protected
- */
- function _modifyQuery($query, $is_manip, $limit, $offset)
- {
- if ($this->options['portability'] & MDB2_PORTABILITY_DELETE_COUNT) {
- if (preg_match('/^\s*DELETE\s+FROM\s+(\S+)\s*$/i', $query)) {
- $query = preg_replace('/^\s*DELETE\s+FROM\s+(\S+)\s*$/',
- 'DELETE FROM \1 WHERE 1=1', $query);
- }
- }
- if ($limit > 0
- && !preg_match('/LIMIT\s*\d(?:\s*(?:,|OFFSET)\s*\d+)?(?:[^\)]*)?$/i', $query)
- ) {
- $query = rtrim($query);
- if (substr($query, -1) == ';') {
- $query = substr($query, 0, -1);
- }
- if ($is_manip) {
- $query.= " LIMIT $limit";
- } else {
- $query.= " LIMIT $offset,$limit";
- }
- }
- return $query;
- }
-
- // }}}
- // {{{ getServerVersion()
-
- /**
- * return version information about the server
- *
- * @param bool $native determines if the raw version string should be returned
- * @return mixed array/string with version information or MDB2 error object
- * @access public
- */
- function getServerVersion($native = false)
- {
- $server_info = false;
- if ($this->connected_server_info) {
- $server_info = $this->connected_server_info;
- } elseif ($this->options['server_version']) {
- $server_info = $this->options['server_version'];
- } elseif (function_exists('sqlite_libversion')) {
- $server_info = @sqlite_libversion();
- }
- if (!$server_info) {
- return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
- 'Requires either the "server_version" option or the sqlite_libversion() function', __FUNCTION__);
- }
- // cache server_info
- $this->connected_server_info = $server_info;
- if (!$native) {
- $tmp = explode('.', $server_info, 3);
- $server_info = array(
- 'major' => isset($tmp[0]) ? $tmp[0] : null,
- 'minor' => isset($tmp[1]) ? $tmp[1] : null,
- 'patch' => isset($tmp[2]) ? $tmp[2] : null,
- 'extra' => null,
- 'native' => $server_info,
- );
- }
- return $server_info;
- }
-
- // }}}
- // {{{ replace()
-
- /**
- * Execute a SQL REPLACE query. A REPLACE query is identical to a INSERT
- * query, except that if there is already a row in the table with the same
- * key field values, the old row is deleted before the new row is inserted.
- *
- * The REPLACE type of query does not make part of the SQL standards. Since
- * practically only SQLite implements it natively, this type of query is
- * emulated through this method for other DBMS using standard types of
- * queries inside a transaction to assure the atomicity of the operation.
- *
- * @access public
- *
- * @param string $table name of the table on which the REPLACE query will
- * be executed.
- * @param array $fields associative array that describes the fields and the
- * values that will be inserted or updated in the specified table. The
- * indexes of the array are the names of all the fields of the table. The
- * values of the array are also associative arrays that describe the
- * values and other properties of the table fields.
- *
- * Here follows a list of field properties that need to be specified:
- *
- * value:
- * Value to be assigned to the specified field. This value may be
- * of specified in database independent type format as this
- * function can perform the necessary datatype conversions.
- *
- * Default:
- * this property is required unless the Null property
- * is set to 1.
- *
- * type
- * Name of the type of the field. Currently, all types Metabase
- * are supported except for clob and blob.
- *
- * Default: no type conversion
- *
- * null
- * Boolean property that indicates that the value for this field
- * should be set to null.
- *
- * The default value for fields missing in INSERT queries may be
- * specified the definition of a table. Often, the default value
- * is already null, but since the REPLACE may be emulated using
- * an UPDATE query, make sure that all fields of the table are
- * listed in this function argument array.
- *
- * Default: 0
- *
- * key
- * Boolean property that indicates that this field should be
- * handled as a primary key or at least as part of the compound
- * unique index of the table that will determine the row that will
- * updated if it exists or inserted a new row otherwise.
- *
- * This function will fail if no key field is specified or if the
- * value of a key field is set to null because fields that are
- * part of unique index they may not be null.
- *
- * Default: 0
- *
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- */
- function replace($table, $fields)
- {
- $count = count($fields);
- $query = $values = '';
- $keys = $colnum = 0;
- for (reset($fields); $colnum < $count; next($fields), $colnum++) {
- $name = key($fields);
- if ($colnum > 0) {
- $query .= ',';
- $values.= ',';
- }
- $query.= $this->quoteIdentifier($name, true);
- if (isset($fields[$name]['null']) && $fields[$name]['null']) {
- $value = 'NULL';
- } else {
- $type = isset($fields[$name]['type']) ? $fields[$name]['type'] : null;
- $value = $this->quote($fields[$name]['value'], $type);
- if (PEAR::isError($value)) {
- return $value;
- }
- }
- $values.= $value;
- if (isset($fields[$name]['key']) && $fields[$name]['key']) {
- if ($value === 'NULL') {
- return $this->raiseError(MDB2_ERROR_CANNOT_REPLACE, null, null,
- 'key value '.$name.' may not be NULL', __FUNCTION__);
- }
- $keys++;
- }
- }
- if ($keys == 0) {
- return $this->raiseError(MDB2_ERROR_CANNOT_REPLACE, null, null,
- 'not specified which fields are keys', __FUNCTION__);
- }
-
- $connection = $this->getConnection();
- if (PEAR::isError($connection)) {
- return $connection;
- }
-
- $table = $this->quoteIdentifier($table, true);
- $query = "REPLACE INTO $table ($query) VALUES ($values)";
- $result = $this->_doQuery($query, true, $connection);
- if (PEAR::isError($result)) {
- return $result;
- }
- return $this->_affectedRows($connection, $result);
- }
-
- // }}}
- // {{{ nextID()
-
- /**
- * Returns the next free id of a sequence
- *
- * @param string $seq_name name of the sequence
- * @param boolean $ondemand when true the sequence is
- * automatic created, if it
- * not exists
- *
- * @return mixed MDB2 Error Object or id
- * @access public
- */
- function nextID($seq_name, $ondemand = true)
- {
- $sequence_name = $this->quoteIdentifier($this->getSequenceName($seq_name), true);
- $seqcol_name = $this->options['seqcol_name'];
- $query = "INSERT INTO $sequence_name ($seqcol_name) VALUES (NULL)";
- $this->pushErrorHandling(PEAR_ERROR_RETURN);
- $this->expectError(MDB2_ERROR_NOSUCHTABLE);
- $result = $this->_doQuery($query, true);
- $this->popExpect();
- $this->popErrorHandling();
- if (PEAR::isError($result)) {
- if ($ondemand && $result->getCode() == MDB2_ERROR_NOSUCHTABLE) {
- $this->loadModule('Manager', null, true);
- $result = $this->manager->createSequence($seq_name);
- if (PEAR::isError($result)) {
- return $this->raiseError($result, null, null,
- 'on demand sequence '.$seq_name.' could not be created', __FUNCTION__);
- } else {
- return $this->nextID($seq_name, false);
- }
- }
- return $result;
- }
- $value = $this->lastInsertID();
- if (is_numeric($value)) {
- $query = "DELETE FROM $sequence_name WHERE $seqcol_name < $value";
- $result = $this->_doQuery($query, true);
- if (PEAR::isError($result)) {
- $this->warnings[] = 'nextID: could not delete previous sequence table values from '.$seq_name;
- }
- }
- return $value;
- }
-
- // }}}
- // {{{ lastInsertID()
-
- /**
- * Returns the autoincrement ID if supported or $id or fetches the current
- * ID in a sequence called: $table.(empty($field) ? '' : '_'.$field)
- *
- * @param string $table name of the table into which a new row was inserted
- * @param string $field name of the field into which a new row was inserted
- * @return mixed MDB2 Error Object or id
- * @access public
- */
- function lastInsertID($table = null, $field = null)
- {
- $connection = $this->getConnection();
- if (PEAR::isError($connection)) {
- return $connection;
- }
- $value = @sqlite_last_insert_rowid($connection);
- if (!$value) {
- return $this->raiseError(null, null, null,
- 'Could not get last insert ID', __FUNCTION__);
- }
- return $value;
- }
-
- // }}}
- // {{{ currID()
-
- /**
- * Returns the current id of a sequence
- *
- * @param string $seq_name name of the sequence
- * @return mixed MDB2 Error Object or id
- * @access public
- */
- function currID($seq_name)
- {
- $sequence_name = $this->quoteIdentifier($this->getSequenceName($seq_name), true);
- $seqcol_name = $this->quoteIdentifier($this->options['seqcol_name'], true);
- $query = "SELECT MAX($seqcol_name) FROM $sequence_name";
- return $this->queryOne($query, 'integer');
- }
-}
-
-/**
- * MDB2 SQLite result driver
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Result_sqlite extends MDB2_Result_Common
-{
- // }}}
- // {{{ fetchRow()
-
- /**
- * Fetch a row and insert the data into an existing array.
- *
- * @param int $fetchmode how the array data should be indexed
- * @param int $rownum number of the row where the data can be found
- * @return int data array on success, a MDB2 error on failure
- * @access public
- */
- function fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null)
- {
- if (null !== $rownum) {
- $seek = $this->seek($rownum);
- if (PEAR::isError($seek)) {
- return $seek;
- }
- }
- if ($fetchmode == MDB2_FETCHMODE_DEFAULT) {
- $fetchmode = $this->db->fetchmode;
- }
- if ( $fetchmode == MDB2_FETCHMODE_ASSOC
- || $fetchmode == MDB2_FETCHMODE_OBJECT
- ) {
- $row = @sqlite_fetch_array($this->result, SQLITE_ASSOC);
- if (is_array($row)
- && $this->db->options['portability'] & MDB2_PORTABILITY_FIX_CASE
- ) {
- $row = array_change_key_case($row, $this->db->options['field_case']);
- }
- } else {
- $row = @sqlite_fetch_array($this->result, SQLITE_NUM);
- }
- if (!$row) {
- if (false === $this->result) {
- $err = $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
- 'resultset has already been freed', __FUNCTION__);
- return $err;
- }
- return null;
- }
- $mode = $this->db->options['portability'] & MDB2_PORTABILITY_EMPTY_TO_NULL;
- $rtrim = false;
- if ($this->db->options['portability'] & MDB2_PORTABILITY_RTRIM) {
- if (empty($this->types)) {
- $mode += MDB2_PORTABILITY_RTRIM;
- } else {
- $rtrim = true;
- }
- }
- if ($mode) {
- $this->db->_fixResultArrayValues($row, $mode);
- }
- if ( ( $fetchmode != MDB2_FETCHMODE_ASSOC
- && $fetchmode != MDB2_FETCHMODE_OBJECT)
- && !empty($this->types)
- ) {
- $row = $this->db->datatype->convertResultRow($this->types, $row, $rtrim);
- } elseif (($fetchmode == MDB2_FETCHMODE_ASSOC
- || $fetchmode == MDB2_FETCHMODE_OBJECT)
- && !empty($this->types_assoc)
- ) {
- $row = $this->db->datatype->convertResultRow($this->types_assoc, $row, $rtrim);
- }
- if (!empty($this->values)) {
- $this->_assignBindColumns($row);
- }
- if ($fetchmode === MDB2_FETCHMODE_OBJECT) {
- $object_class = $this->db->options['fetch_class'];
- if ($object_class == 'stdClass') {
- $row = (object) $row;
- } else {
- $rowObj = new $object_class($row);
- $row = $rowObj;
- }
- }
- ++$this->rownum;
- return $row;
- }
-
- // }}}
- // {{{ _getColumnNames()
-
- /**
- * Retrieve the names of columns returned by the DBMS in a query result.
- *
- * @return mixed Array variable that holds the names of columns as keys
- * or an MDB2 error on failure.
- * Some DBMS may not return any columns when the result set
- * does not contain any rows.
- * @access private
- */
- function _getColumnNames()
- {
- $columns = array();
- $numcols = $this->numCols();
- if (PEAR::isError($numcols)) {
- return $numcols;
- }
- for ($column = 0; $column < $numcols; $column++) {
- $column_name = @sqlite_field_name($this->result, $column);
- $columns[$column_name] = $column;
- }
- if ($this->db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $columns = array_change_key_case($columns, $this->db->options['field_case']);
- }
- return $columns;
- }
-
- // }}}
- // {{{ numCols()
-
- /**
- * Count the number of columns returned by the DBMS in a query result.
- *
- * @access public
- * @return mixed integer value with the number of columns, a MDB2 error
- * on failure
- */
- function numCols()
- {
- $cols = @sqlite_num_fields($this->result);
- if (null === $cols) {
- if (false === $this->result) {
- return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
- 'resultset has already been freed', __FUNCTION__);
- }
- if (null === $this->result) {
- return count($this->types);
- }
- return $this->db->raiseError(null, null, null,
- 'Could not get column count', __FUNCTION__);
- }
- return $cols;
- }
-}
-
-/**
- * MDB2 SQLite buffered result driver
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_BufferedResult_sqlite extends MDB2_Result_sqlite
-{
- // {{{ seek()
-
- /**
- * Seek to a specific row in a result set
- *
- * @param int $rownum number of the row where the data can be found
- * @return mixed MDB2_OK on success, a MDB2 error on failure
- * @access public
- */
- function seek($rownum = 0)
- {
- if (!@sqlite_seek($this->result, $rownum)) {
- if (false === $this->result) {
- return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
- 'resultset has already been freed', __FUNCTION__);
- }
- if (null === $this->result) {
- return MDB2_OK;
- }
- return $this->db->raiseError(MDB2_ERROR_INVALID, null, null,
- 'tried to seek to an invalid row number ('.$rownum.')', __FUNCTION__);
- }
- $this->rownum = $rownum - 1;
- return MDB2_OK;
- }
-
- // }}}
- // {{{ valid()
-
- /**
- * Check if the end of the result set has been reached
- *
- * @return mixed true or false on sucess, a MDB2 error on failure
- * @access public
- */
- function valid()
- {
- $numrows = $this->numRows();
- if (PEAR::isError($numrows)) {
- return $numrows;
- }
- return $this->rownum < ($numrows - 1);
- }
-
- // }}}
- // {{{ numRows()
-
- /**
- * Returns the number of rows in a result object
- *
- * @return mixed MDB2 Error Object or the number of rows
- * @access public
- */
- function numRows()
- {
- $rows = @sqlite_num_rows($this->result);
- if (null === $rows) {
- if (false === $this->result) {
- return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
- 'resultset has already been freed', __FUNCTION__);
- }
- if (null === $this->result) {
- return 0;
- }
- return $this->db->raiseError(null, null, null,
- 'Could not get row count', __FUNCTION__);
- }
- return $rows;
- }
-}
-
-/**
- * MDB2 SQLite statement driver
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Statement_sqlite extends MDB2_Statement_Common
-{
-
-}
-?>
diff --git a/3rdparty/MDB2/Extended.php b/3rdparty/MDB2/Extended.php
deleted file mode 100644
index 5b0a5be34a0..00000000000
--- a/3rdparty/MDB2/Extended.php
+++ /dev/null
@@ -1,723 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP versions 4 and 5 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox, |
-// | Stig. S. Bakken, Lukas Smith |
-// | All rights reserved. |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
-// | API as well as database abstraction for PHP applications. |
-// | This LICENSE is in the BSD license style. |
-// | |
-// | Redistribution and use in source and binary forms, with or without |
-// | modification, are permitted provided that the following conditions |
-// | are met: |
-// | |
-// | Redistributions of source code must retain the above copyright |
-// | notice, this list of conditions and the following disclaimer. |
-// | |
-// | Redistributions in binary form must reproduce the above copyright |
-// | notice, this list of conditions and the following disclaimer in the |
-// | documentation and/or other materials provided with the distribution. |
-// | |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission. |
-// | |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-// | POSSIBILITY OF SUCH DAMAGE. |
-// +----------------------------------------------------------------------+
-// | Author: Lukas Smith <smith@pooteeweet.org> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-/**
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-
-/**
- * Used by autoPrepare()
- */
-define('MDB2_AUTOQUERY_INSERT', 1);
-define('MDB2_AUTOQUERY_UPDATE', 2);
-define('MDB2_AUTOQUERY_DELETE', 3);
-define('MDB2_AUTOQUERY_SELECT', 4);
-
-/**
- * MDB2_Extended: class which adds several high level methods to MDB2
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Extended extends MDB2_Module_Common
-{
- // {{{ autoPrepare()
-
- /**
- * Generate an insert, update or delete query and call prepare() on it
- *
- * @param string table
- * @param array the fields names
- * @param int type of query to build
- * MDB2_AUTOQUERY_INSERT
- * MDB2_AUTOQUERY_UPDATE
- * MDB2_AUTOQUERY_DELETE
- * MDB2_AUTOQUERY_SELECT
- * @param string (in case of update and delete queries, this string will be put after the sql WHERE statement)
- * @param array that contains the types of the placeholders
- * @param mixed array that contains the types of the columns in
- * the result set or MDB2_PREPARE_RESULT, if set to
- * MDB2_PREPARE_MANIP the query is handled as a manipulation query
- *
- * @return resource handle for the query
- * @see buildManipSQL
- * @access public
- */
- function autoPrepare($table, $table_fields, $mode = MDB2_AUTOQUERY_INSERT,
- $where = false, $types = null, $result_types = MDB2_PREPARE_MANIP)
- {
- $query = $this->buildManipSQL($table, $table_fields, $mode, $where);
- if (PEAR::isError($query)) {
- return $query;
- }
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
- $lobs = array();
- foreach ((array)$types as $param => $type) {
- if (($type == 'clob') || ($type == 'blob')) {
- $lobs[$param] = $table_fields[$param];
- }
- }
- return $db->prepare($query, $types, $result_types, $lobs);
- }
-
- // }}}
- // {{{ autoExecute()
-
- /**
- * Generate an insert, update or delete query and call prepare() and execute() on it
- *
- * @param string name of the table
- * @param array assoc ($key=>$value) where $key is a field name and $value its value
- * @param int type of query to build
- * MDB2_AUTOQUERY_INSERT
- * MDB2_AUTOQUERY_UPDATE
- * MDB2_AUTOQUERY_DELETE
- * MDB2_AUTOQUERY_SELECT
- * @param string (in case of update and delete queries, this string will be put after the sql WHERE statement)
- * @param array that contains the types of the placeholders
- * @param string which specifies which result class to use
- * @param mixed array that contains the types of the columns in
- * the result set or MDB2_PREPARE_RESULT, if set to
- * MDB2_PREPARE_MANIP the query is handled as a manipulation query
- *
- * @return bool|MDB2_Error true on success, a MDB2 error on failure
- * @see buildManipSQL
- * @see autoPrepare
- * @access public
- */
- function autoExecute($table, $fields_values, $mode = MDB2_AUTOQUERY_INSERT,
- $where = false, $types = null, $result_class = true, $result_types = MDB2_PREPARE_MANIP)
- {
- $fields_values = (array)$fields_values;
- if ($mode == MDB2_AUTOQUERY_SELECT) {
- if (is_array($result_types)) {
- $keys = array_keys($result_types);
- } elseif (!empty($fields_values)) {
- $keys = $fields_values;
- } else {
- $keys = array();
- }
- } else {
- $keys = array_keys($fields_values);
- }
- $params = array_values($fields_values);
- if (empty($params)) {
- $query = $this->buildManipSQL($table, $keys, $mode, $where);
-
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
- if ($mode == MDB2_AUTOQUERY_SELECT) {
- $result = $db->query($query, $result_types, $result_class);
- } else {
- $result = $db->exec($query);
- }
- } else {
- $stmt = $this->autoPrepare($table, $keys, $mode, $where, $types, $result_types);
- if (PEAR::isError($stmt)) {
- return $stmt;
- }
- $result = $stmt->execute($params, $result_class);
- $stmt->free();
- }
- return $result;
- }
-
- // }}}
- // {{{ buildManipSQL()
-
- /**
- * Make automaticaly an sql query for prepare()
- *
- * Example : buildManipSQL('table_sql', array('field1', 'field2', 'field3'), MDB2_AUTOQUERY_INSERT)
- * will return the string : INSERT INTO table_sql (field1,field2,field3) VALUES (?,?,?)
- * NB : - This belongs more to a SQL Builder class, but this is a simple facility
- * - Be carefull ! If you don't give a $where param with an UPDATE/DELETE query, all
- * the records of the table will be updated/deleted !
- *
- * @param string name of the table
- * @param ordered array containing the fields names
- * @param int type of query to build
- * MDB2_AUTOQUERY_INSERT
- * MDB2_AUTOQUERY_UPDATE
- * MDB2_AUTOQUERY_DELETE
- * MDB2_AUTOQUERY_SELECT
- * @param string (in case of update and delete queries, this string will be put after the sql WHERE statement)
- *
- * @return string sql query for prepare()
- * @access public
- */
- function buildManipSQL($table, $table_fields, $mode, $where = false)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- if ($db->options['quote_identifier']) {
- $table = $db->quoteIdentifier($table);
- }
-
- if (!empty($table_fields) && $db->options['quote_identifier']) {
- foreach ($table_fields as $key => $field) {
- $table_fields[$key] = $db->quoteIdentifier($field);
- }
- }
-
- if ((false !== $where) && (null !== $where)) {
- if (is_array($where)) {
- $where = implode(' AND ', $where);
- }
- $where = ' WHERE '.$where;
- }
-
- switch ($mode) {
- case MDB2_AUTOQUERY_INSERT:
- if (empty($table_fields)) {
- return $db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
- 'Insert requires table fields', __FUNCTION__);
- }
- $cols = implode(', ', $table_fields);
- $values = '?'.str_repeat(', ?', (count($table_fields) - 1));
- return 'INSERT INTO '.$table.' ('.$cols.') VALUES ('.$values.')';
- break;
- case MDB2_AUTOQUERY_UPDATE:
- if (empty($table_fields)) {
- return $db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
- 'Update requires table fields', __FUNCTION__);
- }
- $set = implode(' = ?, ', $table_fields).' = ?';
- $sql = 'UPDATE '.$table.' SET '.$set.$where;
- return $sql;
- break;
- case MDB2_AUTOQUERY_DELETE:
- $sql = 'DELETE FROM '.$table.$where;
- return $sql;
- break;
- case MDB2_AUTOQUERY_SELECT:
- $cols = !empty($table_fields) ? implode(', ', $table_fields) : '*';
- $sql = 'SELECT '.$cols.' FROM '.$table.$where;
- return $sql;
- break;
- }
- return $db->raiseError(MDB2_ERROR_SYNTAX, null, null,
- 'Non existant mode', __FUNCTION__);
- }
-
- // }}}
- // {{{ limitQuery()
-
- /**
- * Generates a limited query
- *
- * @param string query
- * @param array that contains the types of the columns in the result set
- * @param integer the numbers of rows to fetch
- * @param integer the row to start to fetching
- * @param string which specifies which result class to use
- * @param mixed string which specifies which class to wrap results in
- *
- * @return MDB2_Result|MDB2_Error result set on success, a MDB2 error on failure
- * @access public
- */
- function limitQuery($query, $types, $limit, $offset = 0, $result_class = true,
- $result_wrap_class = false)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $result = $db->setLimit($limit, $offset);
- if (PEAR::isError($result)) {
- return $result;
- }
- return $db->query($query, $types, $result_class, $result_wrap_class);
- }
-
- // }}}
- // {{{ execParam()
-
- /**
- * Execute a parameterized DML statement.
- *
- * @param string the SQL query
- * @param array if supplied, prepare/execute will be used
- * with this array as execute parameters
- * @param array that contains the types of the values defined in $params
- *
- * @return int|MDB2_Error affected rows on success, a MDB2 error on failure
- * @access public
- */
- function execParam($query, $params = array(), $param_types = null)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- settype($params, 'array');
- if (empty($params)) {
- return $db->exec($query);
- }
-
- $stmt = $db->prepare($query, $param_types, MDB2_PREPARE_MANIP);
- if (PEAR::isError($stmt)) {
- return $stmt;
- }
-
- $result = $stmt->execute($params);
- if (PEAR::isError($result)) {
- return $result;
- }
-
- $stmt->free();
- return $result;
- }
-
- // }}}
- // {{{ getOne()
-
- /**
- * Fetch the first column of the first row of data returned from a query.
- * Takes care of doing the query and freeing the results when finished.
- *
- * @param string the SQL query
- * @param string that contains the type of the column in the result set
- * @param array if supplied, prepare/execute will be used
- * with this array as execute parameters
- * @param array that contains the types of the values defined in $params
- * @param int|string which column to return
- *
- * @return scalar|MDB2_Error data on success, a MDB2 error on failure
- * @access public
- */
- function getOne($query, $type = null, $params = array(),
- $param_types = null, $colnum = 0)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- settype($params, 'array');
- settype($type, 'array');
- if (empty($params)) {
- return $db->queryOne($query, $type, $colnum);
- }
-
- $stmt = $db->prepare($query, $param_types, $type);
- if (PEAR::isError($stmt)) {
- return $stmt;
- }
-
- $result = $stmt->execute($params);
- if (!MDB2::isResultCommon($result)) {
- return $result;
- }
-
- $one = $result->fetchOne($colnum);
- $stmt->free();
- $result->free();
- return $one;
- }
-
- // }}}
- // {{{ getRow()
-
- /**
- * Fetch the first row of data returned from a query. Takes care
- * of doing the query and freeing the results when finished.
- *
- * @param string the SQL query
- * @param array that contains the types of the columns in the result set
- * @param array if supplied, prepare/execute will be used
- * with this array as execute parameters
- * @param array that contains the types of the values defined in $params
- * @param int the fetch mode to use
- *
- * @return array|MDB2_Error data on success, a MDB2 error on failure
- * @access public
- */
- function getRow($query, $types = null, $params = array(),
- $param_types = null, $fetchmode = MDB2_FETCHMODE_DEFAULT)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- settype($params, 'array');
- if (empty($params)) {
- return $db->queryRow($query, $types, $fetchmode);
- }
-
- $stmt = $db->prepare($query, $param_types, $types);
- if (PEAR::isError($stmt)) {
- return $stmt;
- }
-
- $result = $stmt->execute($params);
- if (!MDB2::isResultCommon($result)) {
- return $result;
- }
-
- $row = $result->fetchRow($fetchmode);
- $stmt->free();
- $result->free();
- return $row;
- }
-
- // }}}
- // {{{ getCol()
-
- /**
- * Fetch a single column from a result set and return it as an
- * indexed array.
- *
- * @param string the SQL query
- * @param string that contains the type of the column in the result set
- * @param array if supplied, prepare/execute will be used
- * with this array as execute parameters
- * @param array that contains the types of the values defined in $params
- * @param int|string which column to return
- *
- * @return array|MDB2_Error data on success, a MDB2 error on failure
- * @access public
- */
- function getCol($query, $type = null, $params = array(),
- $param_types = null, $colnum = 0)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- settype($params, 'array');
- settype($type, 'array');
- if (empty($params)) {
- return $db->queryCol($query, $type, $colnum);
- }
-
- $stmt = $db->prepare($query, $param_types, $type);
- if (PEAR::isError($stmt)) {
- return $stmt;
- }
-
- $result = $stmt->execute($params);
- if (!MDB2::isResultCommon($result)) {
- return $result;
- }
-
- $col = $result->fetchCol($colnum);
- $stmt->free();
- $result->free();
- return $col;
- }
-
- // }}}
- // {{{ getAll()
-
- /**
- * Fetch all the rows returned from a query.
- *
- * @param string the SQL query
- * @param array that contains the types of the columns in the result set
- * @param array if supplied, prepare/execute will be used
- * with this array as execute parameters
- * @param array that contains the types of the values defined in $params
- * @param int the fetch mode to use
- * @param bool if set to true, the $all will have the first
- * column as its first dimension
- * @param bool $force_array used only when the query returns exactly
- * two columns. If true, the values of the returned array will be
- * one-element arrays instead of scalars.
- * @param bool $group if true, the values of the returned array is
- * wrapped in another array. If the same key value (in the first
- * column) repeats itself, the values will be appended to this array
- * instead of overwriting the existing values.
- *
- * @return array|MDB2_Error data on success, a MDB2 error on failure
- * @access public
- */
- function getAll($query, $types = null, $params = array(),
- $param_types = null, $fetchmode = MDB2_FETCHMODE_DEFAULT,
- $rekey = false, $force_array = false, $group = false)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- settype($params, 'array');
- if (empty($params)) {
- return $db->queryAll($query, $types, $fetchmode, $rekey, $force_array, $group);
- }
-
- $stmt = $db->prepare($query, $param_types, $types);
- if (PEAR::isError($stmt)) {
- return $stmt;
- }
-
- $result = $stmt->execute($params);
- if (!MDB2::isResultCommon($result)) {
- return $result;
- }
-
- $all = $result->fetchAll($fetchmode, $rekey, $force_array, $group);
- $stmt->free();
- $result->free();
- return $all;
- }
-
- // }}}
- // {{{ getAssoc()
-
- /**
- * Fetch the entire result set of a query and return it as an
- * associative array using the first column as the key.
- *
- * If the result set contains more than two columns, the value
- * will be an array of the values from column 2-n. If the result
- * set contains only two columns, the returned value will be a
- * scalar with the value of the second column (unless forced to an
- * array with the $force_array parameter). A MDB2 error code is
- * returned on errors. If the result set contains fewer than two
- * columns, a MDB2_ERROR_TRUNCATED error is returned.
- *
- * For example, if the table 'mytable' contains:
- * <pre>
- * ID TEXT DATE
- * --------------------------------
- * 1 'one' 944679408
- * 2 'two' 944679408
- * 3 'three' 944679408
- * </pre>
- * Then the call getAssoc('SELECT id,text FROM mytable') returns:
- * <pre>
- * array(
- * '1' => 'one',
- * '2' => 'two',
- * '3' => 'three',
- * )
- * </pre>
- * ...while the call getAssoc('SELECT id,text,date FROM mytable') returns:
- * <pre>
- * array(
- * '1' => array('one', '944679408'),
- * '2' => array('two', '944679408'),
- * '3' => array('three', '944679408')
- * )
- * </pre>
- *
- * If the more than one row occurs with the same value in the
- * first column, the last row overwrites all previous ones by
- * default. Use the $group parameter if you don't want to
- * overwrite like this. Example:
- * <pre>
- * getAssoc('SELECT category,id,name FROM mytable', null, null
- * MDB2_FETCHMODE_ASSOC, false, true) returns:
- * array(
- * '1' => array(array('id' => '4', 'name' => 'number four'),
- * array('id' => '6', 'name' => 'number six')
- * ),
- * '9' => array(array('id' => '4', 'name' => 'number four'),
- * array('id' => '6', 'name' => 'number six')
- * )
- * )
- * </pre>
- *
- * Keep in mind that database functions in PHP usually return string
- * values for results regardless of the database's internal type.
- *
- * @param string the SQL query
- * @param array that contains the types of the columns in the result set
- * @param array if supplied, prepare/execute will be used
- * with this array as execute parameters
- * @param array that contains the types of the values defined in $params
- * @param bool $force_array used only when the query returns
- * exactly two columns. If TRUE, the values of the returned array
- * will be one-element arrays instead of scalars.
- * @param bool $group if TRUE, the values of the returned array
- * is wrapped in another array. If the same key value (in the first
- * column) repeats itself, the values will be appended to this array
- * instead of overwriting the existing values.
- *
- * @return array|MDB2_Error data on success, a MDB2 error on failure
- * @access public
- */
- function getAssoc($query, $types = null, $params = array(), $param_types = null,
- $fetchmode = MDB2_FETCHMODE_DEFAULT, $force_array = false, $group = false)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- settype($params, 'array');
- if (empty($params)) {
- return $db->queryAll($query, $types, $fetchmode, true, $force_array, $group);
- }
-
- $stmt = $db->prepare($query, $param_types, $types);
- if (PEAR::isError($stmt)) {
- return $stmt;
- }
-
- $result = $stmt->execute($params);
- if (!MDB2::isResultCommon($result)) {
- return $result;
- }
-
- $all = $result->fetchAll($fetchmode, true, $force_array, $group);
- $stmt->free();
- $result->free();
- return $all;
- }
-
- // }}}
- // {{{ executeMultiple()
-
- /**
- * This function does several execute() calls on the same statement handle.
- * $params must be an array indexed numerically from 0, one execute call is
- * done for every 'row' in the array.
- *
- * If an error occurs during execute(), executeMultiple() does not execute
- * the unfinished rows, but rather returns that error.
- *
- * @param resource query handle from prepare()
- * @param array numeric array containing the data to insert into the query
- *
- * @return bool|MDB2_Error true on success, a MDB2 error on failure
- * @access public
- * @see prepare(), execute()
- */
- function executeMultiple($stmt, $params = null)
- {
- if (MDB2::isError($stmt)) {
- return $stmt;
- }
- for ($i = 0, $j = count($params); $i < $j; $i++) {
- $result = $stmt->execute($params[$i]);
- if (PEAR::isError($result)) {
- return $result;
- }
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ getBeforeID()
-
- /**
- * Returns the next free id of a sequence if the RDBMS
- * does not support auto increment
- *
- * @param string name of the table into which a new row was inserted
- * @param string name of the field into which a new row was inserted
- * @param bool when true the sequence is automatic created, if it not exists
- * @param bool if the returned value should be quoted
- *
- * @return int|MDB2_Error id on success, a MDB2 error on failure
- * @access public
- */
- function getBeforeID($table, $field = null, $ondemand = true, $quote = true)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- if ($db->supports('auto_increment') !== true) {
- $seq = $table.(empty($field) ? '' : '_'.$field);
- $id = $db->nextID($seq, $ondemand);
- if (!$quote || PEAR::isError($id)) {
- return $id;
- }
- return $db->quote($id, 'integer');
- } elseif (!$quote) {
- return null;
- }
- return 'NULL';
- }
-
- // }}}
- // {{{ getAfterID()
-
- /**
- * Returns the autoincrement ID if supported or $id
- *
- * @param mixed value as returned by getBeforeId()
- * @param string name of the table into which a new row was inserted
- * @param string name of the field into which a new row was inserted
- *
- * @return int|MDB2_Error id on success, a MDB2 error on failure
- * @access public
- */
- function getAfterID($id, $table, $field = null)
- {
- $db = $this->getDBInstance();
- if (PEAR::isError($db)) {
- return $db;
- }
-
- if ($db->supports('auto_increment') !== true) {
- return $id;
- }
- return $db->lastInsertID($table, $field);
- }
-
- // }}}
-}
-?> \ No newline at end of file
diff --git a/3rdparty/MDB2/Iterator.php b/3rdparty/MDB2/Iterator.php
deleted file mode 100644
index 46feade3218..00000000000
--- a/3rdparty/MDB2/Iterator.php
+++ /dev/null
@@ -1,262 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP version 5 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox, |
-// | Stig. S. Bakken, Lukas Smith |
-// | All rights reserved. |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
-// | API as well as database abstraction for PHP applications. |
-// | This LICENSE is in the BSD license style. |
-// | |
-// | Redistribution and use in source and binary forms, with or without |
-// | modification, are permitted provided that the following conditions |
-// | are met: |
-// | |
-// | Redistributions of source code must retain the above copyright |
-// | notice, this list of conditions and the following disclaimer. |
-// | |
-// | Redistributions in binary form must reproduce the above copyright |
-// | notice, this list of conditions and the following disclaimer in the |
-// | documentation and/or other materials provided with the distribution. |
-// | |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission. |
-// | |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-// | POSSIBILITY OF SUCH DAMAGE. |
-// +----------------------------------------------------------------------+
-// | Author: Lukas Smith <smith@pooteeweet.org> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-/**
- * PHP5 Iterator
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_Iterator implements Iterator
-{
- protected $fetchmode;
- /**
- * @var MDB2_Result_Common
- */
- protected $result;
- protected $row;
-
- // {{{ constructor
-
- /**
- * Constructor
- */
- public function __construct(MDB2_Result_Common $result, $fetchmode = MDB2_FETCHMODE_DEFAULT)
- {
- $this->result = $result;
- $this->fetchmode = $fetchmode;
- }
- // }}}
-
- // {{{ seek()
-
- /**
- * Seek forward to a specific row in a result set
- *
- * @param int number of the row where the data can be found
- *
- * @return void
- * @access public
- */
- public function seek($rownum)
- {
- $this->row = null;
- if ($this->result) {
- $this->result->seek($rownum);
- }
- }
- // }}}
-
- // {{{ next()
-
- /**
- * Fetch next row of data
- *
- * @return void
- * @access public
- */
- public function next()
- {
- $this->row = null;
- }
- // }}}
-
- // {{{ current()
-
- /**
- * return a row of data
- *
- * @return void
- * @access public
- */
- public function current()
- {
- if (null === $this->row) {
- $row = $this->result->fetchRow($this->fetchmode);
- if (PEAR::isError($row)) {
- $row = false;
- }
- $this->row = $row;
- }
- return $this->row;
- }
- // }}}
-
- // {{{ valid()
-
- /**
- * Check if the end of the result set has been reached
- *
- * @return bool true/false, false is also returned on failure
- * @access public
- */
- public function valid()
- {
- return (bool)$this->current();
- }
- // }}}
-
- // {{{ free()
-
- /**
- * Free the internal resources associated with result.
- *
- * @return bool|MDB2_Error true on success, false|MDB2_Error if result is invalid
- * @access public
- */
- public function free()
- {
- if ($this->result) {
- return $this->result->free();
- }
- $this->result = false;
- $this->row = null;
- return false;
- }
- // }}}
-
- // {{{ key()
-
- /**
- * Returns the row number
- *
- * @return int|bool|MDB2_Error true on success, false|MDB2_Error if result is invalid
- * @access public
- */
- public function key()
- {
- if ($this->result) {
- return $this->result->rowCount();
- }
- return false;
- }
- // }}}
-
- // {{{ rewind()
-
- /**
- * Seek to the first row in a result set
- *
- * @return void
- * @access public
- */
- public function rewind()
- {
- }
- // }}}
-
- // {{{ destructor
-
- /**
- * Destructor
- */
- public function __destruct()
- {
- $this->free();
- }
- // }}}
-}
-
-/**
- * PHP5 buffered Iterator
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_BufferedIterator extends MDB2_Iterator implements SeekableIterator
-{
- // {{{ valid()
-
- /**
- * Check if the end of the result set has been reached
- *
- * @return bool|MDB2_Error true on success, false|MDB2_Error if result is invalid
- * @access public
- */
- public function valid()
- {
- if ($this->result) {
- return $this->result->valid();
- }
- return false;
- }
- // }}}
-
- // {{{count()
-
- /**
- * Returns the number of rows in a result object
- *
- * @return int|MDB2_Error number of rows, false|MDB2_Error if result is invalid
- * @access public
- */
- public function count()
- {
- if ($this->result) {
- return $this->result->numRows();
- }
- return false;
- }
- // }}}
-
- // {{{ rewind()
-
- /**
- * Seek to the first row in a result set
- *
- * @return void
- * @access public
- */
- public function rewind()
- {
- $this->seek(0);
- }
- // }}}
-}
-
-?> \ No newline at end of file
diff --git a/3rdparty/MDB2/LOB.php b/3rdparty/MDB2/LOB.php
deleted file mode 100644
index 537a77e546b..00000000000
--- a/3rdparty/MDB2/LOB.php
+++ /dev/null
@@ -1,264 +0,0 @@
-<?php
-// +----------------------------------------------------------------------+
-// | PHP version 5 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox, |
-// | Stig. S. Bakken, Lukas Smith |
-// | All rights reserved. |
-// +----------------------------------------------------------------------+
-// | MDB2 is a merge of PEAR DB and Metabases that provides a unified DB |
-// | API as well as database abstraction for PHP applications. |
-// | This LICENSE is in the BSD license style. |
-// | |
-// | Redistribution and use in source and binary forms, with or without |
-// | modification, are permitted provided that the following conditions |
-// | are met: |
-// | |
-// | Redistributions of source code must retain the above copyright |
-// | notice, this list of conditions and the following disclaimer. |
-// | |
-// | Redistributions in binary form must reproduce the above copyright |
-// | notice, this list of conditions and the following disclaimer in the |
-// | documentation and/or other materials provided with the distribution. |
-// | |
-// | Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken, |
-// | Lukas Smith nor the names of his contributors may be used to endorse |
-// | or promote products derived from this software without specific prior|
-// | written permission. |
-// | |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
-// | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
-// | REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
-// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
-// | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS|
-// | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
-// | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
-// | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY|
-// | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
-// | POSSIBILITY OF SUCH DAMAGE. |
-// +----------------------------------------------------------------------+
-// | Author: Lukas Smith <smith@pooteeweet.org> |
-// +----------------------------------------------------------------------+
-//
-// $Id$
-
-/**
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-
-require_once 'MDB2.php';
-
-/**
- * MDB2_LOB: user land stream wrapper implementation for LOB support
- *
- * @package MDB2
- * @category Database
- * @author Lukas Smith <smith@pooteeweet.org>
- */
-class MDB2_LOB
-{
- /**
- * contains the key to the global MDB2 instance array of the associated
- * MDB2 instance
- *
- * @var integer
- * @access protected
- */
- var $db_index;
-
- /**
- * contains the key to the global MDB2_LOB instance array of the associated
- * MDB2_LOB instance
- *
- * @var integer
- * @access protected
- */
- var $lob_index;
-
- // {{{ stream_open()
-
- /**
- * open stream
- *
- * @param string specifies the URL that was passed to fopen()
- * @param string the mode used to open the file
- * @param int holds additional flags set by the streams API
- * @param string not used
- *
- * @return bool
- * @access public
- */
- function stream_open($path, $mode, $options, &$opened_path)
- {
- if (!preg_match('/^rb?\+?$/', $mode)) {
- return false;
- }
- $url = parse_url($path);
- if (empty($url['host'])) {
- return false;
- }
- $this->db_index = (int)$url['host'];
- if (!isset($GLOBALS['_MDB2_databases'][$this->db_index])) {
- return false;
- }
- $db =& $GLOBALS['_MDB2_databases'][$this->db_index];
- $this->lob_index = (int)$url['user'];
- if (!isset($db->datatype->lobs[$this->lob_index])) {
- return false;
- }
- return true;
- }
- // }}}
-
- // {{{ stream_read()
-
- /**
- * read stream
- *
- * @param int number of bytes to read
- *
- * @return string
- * @access public
- */
- function stream_read($count)
- {
- if (isset($GLOBALS['_MDB2_databases'][$this->db_index])) {
- $db =& $GLOBALS['_MDB2_databases'][$this->db_index];
- $db->datatype->_retrieveLOB($db->datatype->lobs[$this->lob_index]);
-
- $data = $db->datatype->_readLOB($db->datatype->lobs[$this->lob_index], $count);
- $length = strlen($data);
- if ($length == 0) {
- $db->datatype->lobs[$this->lob_index]['endOfLOB'] = true;
- }
- $db->datatype->lobs[$this->lob_index]['position'] += $length;
- return $data;
- }
- }
- // }}}
-
- // {{{ stream_write()
-
- /**
- * write stream, note implemented
- *
- * @param string data
- *
- * @return int
- * @access public
- */
- function stream_write($data)
- {
- return 0;
- }
- // }}}
-
- // {{{ stream_tell()
-
- /**
- * return the current position
- *
- * @return int current position
- * @access public
- */
- function stream_tell()
- {
- if (isset($GLOBALS['_MDB2_databases'][$this->db_index])) {
- $db =& $GLOBALS['_MDB2_databases'][$this->db_index];
- return $db->datatype->lobs[$this->lob_index]['position'];
- }
- }
- // }}}
-
- // {{{ stream_eof()
-
- /**
- * Check if stream reaches EOF
- *
- * @return bool
- * @access public
- */
- function stream_eof()
- {
- if (!isset($GLOBALS['_MDB2_databases'][$this->db_index])) {
- return true;
- }
-
- $db =& $GLOBALS['_MDB2_databases'][$this->db_index];
- $result = $db->datatype->_endOfLOB($db->datatype->lobs[$this->lob_index]);
- if (version_compare(phpversion(), "5.0", ">=")
- && version_compare(phpversion(), "5.1", "<")
- ) {
- return !$result;
- }
- return $result;
- }
- // }}}
-
- // {{{ stream_seek()
-
- /**
- * Seek stream, not implemented
- *
- * @param int offset
- * @param int whence
- *
- * @return bool
- * @access public
- */
- function stream_seek($offset, $whence)
- {
- return false;
- }
- // }}}
-
- // {{{ stream_stat()
-
- /**
- * return information about stream
- *
- * @access public
- */
- function stream_stat()
- {
- if (isset($GLOBALS['_MDB2_databases'][$this->db_index])) {
- $db =& $GLOBALS['_MDB2_databases'][$this->db_index];
- return array(
- 'db_index' => $this->db_index,
- 'lob_index' => $this->lob_index,
- );
- }
- }
- // }}}
-
- // {{{ stream_close()
-
- /**
- * close stream
- *
- * @access public
- */
- function stream_close()
- {
- if (isset($GLOBALS['_MDB2_databases'][$this->db_index])) {
- $db =& $GLOBALS['_MDB2_databases'][$this->db_index];
- if (isset($db->datatype->lobs[$this->lob_index])) {
- $db->datatype->_destroyLOB($db->datatype->lobs[$this->lob_index]);
- unset($db->datatype->lobs[$this->lob_index]);
- }
- }
- }
- // }}}
-}
-
-// register streams wrapper
-if (!stream_wrapper_register("MDB2LOB", "MDB2_LOB")) {
- MDB2::raiseError();
- return false;
-}
-
-?>
diff --git a/3rdparty/MDB2/Schema.php b/3rdparty/MDB2/Schema.php
deleted file mode 100644
index 5eeb97b055b..00000000000
--- a/3rdparty/MDB2/Schema.php
+++ /dev/null
@@ -1,2797 +0,0 @@
-<?php /* vim: se et ts=4 sw=4 sts=4 fdm=marker tw=80: */
-/**
- * Copyright (c) 1998-2010 Manuel Lemos, Tomas V.V.Cox,
- * Stig. S. Bakken, Lukas Smith, Igor Feghali
- * All rights reserved.
- *
- * MDB2_Schema enables users to maintain RDBMS independant schema files
- * in XML that can be used to manipulate both data and database schemas
- * This LICENSE is in the BSD license style.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,
- * Lukas Smith, Igor Feghali nor the names of his contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
- * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * PHP version 5
- *
- * @category Database
- * @package MDB2_Schema
- * @author Lukas Smith <smith@pooteeweet.org>
- * @author Igor Feghali <ifeghali@php.net>
- * @license BSD http://www.opensource.org/licenses/bsd-license.php
- * @version SVN: $Id$
- * @link http://pear.php.net/packages/MDB2_Schema
- */
-
-require_once 'MDB2.php';
-
-define('MDB2_SCHEMA_DUMP_ALL', 0);
-define('MDB2_SCHEMA_DUMP_STRUCTURE', 1);
-define('MDB2_SCHEMA_DUMP_CONTENT', 2);
-
-/**
- * If you add an error code here, make sure you also add a textual
- * version of it in MDB2_Schema::errorMessage().
- */
-
-define('MDB2_SCHEMA_ERROR', -1);
-define('MDB2_SCHEMA_ERROR_PARSE', -2);
-define('MDB2_SCHEMA_ERROR_VALIDATE', -3);
-define('MDB2_SCHEMA_ERROR_UNSUPPORTED', -4); // Driver does not support this function
-define('MDB2_SCHEMA_ERROR_INVALID', -5); // Invalid attribute value
-define('MDB2_SCHEMA_ERROR_WRITER', -6);
-
-/**
- * The database manager is a class that provides a set of database
- * management services like installing, altering and dumping the data
- * structures of databases.
- *
- * @category Database
- * @package MDB2_Schema
- * @author Lukas Smith <smith@pooteeweet.org>
- * @license BSD http://www.opensource.org/licenses/bsd-license.php
- * @link http://pear.php.net/packages/MDB2_Schema
- */
-class MDB2_Schema extends PEAR
-{
- // {{{ properties
-
- var $db;
-
- var $warnings = array();
-
- var $options = array(
- 'fail_on_invalid_names' => true,
- 'dtd_file' => false,
- 'valid_types' => array(),
- 'force_defaults' => true,
- 'parser' => 'MDB2_Schema_Parser',
- 'writer' => 'MDB2_Schema_Writer',
- 'validate' => 'MDB2_Schema_Validate',
- 'drop_obsolete_objects' => false
- );
-
- // }}}
- // {{{ apiVersion()
-
- /**
- * Return the MDB2 API version
- *
- * @return string the MDB2 API version number
- * @access public
- */
- function apiVersion()
- {
- return '0.4.3';
- }
-
- // }}}
- // {{{ arrayMergeClobber()
-
- /**
- * Clobbers two arrays together
- *
- * @param array $a1 array that should be clobbered
- * @param array $a2 array that should be clobbered
- *
- * @return array|false array on success and false on error
- *
- * @access public
- * @author kc@hireability.com
- */
- function arrayMergeClobber($a1, $a2)
- {
- if (!is_array($a1) || !is_array($a2)) {
- return false;
- }
- foreach ($a2 as $key => $val) {
- if (is_array($val) && array_key_exists($key, $a1) && is_array($a1[$key])) {
- $a1[$key] = MDB2_Schema::arrayMergeClobber($a1[$key], $val);
- } else {
- $a1[$key] = $val;
- }
- }
- return $a1;
- }
-
- // }}}
- // {{{ resetWarnings()
-
- /**
- * reset the warning array
- *
- * @access public
- * @return void
- */
- function resetWarnings()
- {
- $this->warnings = array();
- }
-
- // }}}
- // {{{ getWarnings()
-
- /**
- * Get all warnings in reverse order
- *
- * This means that the last warning is the first element in the array
- *
- * @return array with warnings
- * @access public
- * @see resetWarnings()
- */
- function getWarnings()
- {
- return array_reverse($this->warnings);
- }
-
- // }}}
- // {{{ setOption()
-
- /**
- * Sets the option for the db class
- *
- * @param string $option option name
- * @param mixed $value value for the option
- *
- * @return bool|MDB2_Error MDB2_OK or error object
- * @access public
- */
- function setOption($option, $value)
- {
- if (isset($this->options[$option])) {
- if (is_null($value)) {
- return $this->raiseError(MDB2_SCHEMA_ERROR, null, null,
- 'may not set an option to value null');
- }
- $this->options[$option] = $value;
- return MDB2_OK;
- }
- return $this->raiseError(MDB2_SCHEMA_ERROR_UNSUPPORTED, null, null,
- "unknown option $option");
- }
-
- // }}}
- // {{{ getOption()
-
- /**
- * returns the value of an option
- *
- * @param string $option option name
- *
- * @return mixed the option value or error object
- * @access public
- */
- function getOption($option)
- {
- if (isset($this->options[$option])) {
- return $this->options[$option];
- }
- return $this->raiseError(MDB2_SCHEMA_ERROR_UNSUPPORTED,
- null, null, "unknown option $option");
- }
-
- // }}}
- // {{{ factory()
-
- /**
- * Create a new MDB2 object for the specified database type
- * type
- *
- * @param string|array|MDB2_Driver_Common &$db 'data source name', see the
- * MDB2::parseDSN method for a description of the dsn format.
- * Can also be specified as an array of the
- * format returned by @see MDB2::parseDSN.
- * Finally you can also pass an existing db object to be used.
- * @param array $options An associative array of option names and their values.
- *
- * @return bool|MDB2_Error MDB2_OK or error object
- * @access public
- * @see MDB2::parseDSN
- */
- static function &factory(&$db, $options = array())
- {
- $obj = new MDB2_Schema();
-
- $result = $obj->connect($db, $options);
- if (PEAR::isError($result)) {
- return $result;
- }
- return $obj;
- }
-
- // }}}
- // {{{ connect()
-
- /**
- * Create a new MDB2 connection object and connect to the specified
- * database
- *
- * @param string|array|MDB2_Driver_Common &$db 'data source name', see the
- * MDB2::parseDSN method for a description of the dsn format.
- * Can also be specified as an array of the
- * format returned by MDB2::parseDSN.
- * Finally you can also pass an existing db object to be used.
- * @param array $options An associative array of option names and their values.
- *
- * @return bool|MDB2_Error MDB2_OK or error object
- * @access public
- * @see MDB2::parseDSN
- */
- function connect(&$db, $options = array())
- {
- $db_options = array();
- if (is_array($options)) {
- foreach ($options as $option => $value) {
- if (array_key_exists($option, $this->options)) {
- $result = $this->setOption($option, $value);
- if (PEAR::isError($result)) {
- return $result;
- }
- } else {
- $db_options[$option] = $value;
- }
- }
- }
-
- $this->disconnect();
- if (!MDB2::isConnection($db)) {
- $db = MDB2::factory($db, $db_options);
- }
-
- if (PEAR::isError($db)) {
- return $db;
- }
-
- $this->db = $db;
- $this->db->loadModule('Datatype');
- $this->db->loadModule('Manager');
- $this->db->loadModule('Reverse');
- $this->db->loadModule('Function');
- if (empty($this->options['valid_types'])) {
- $this->options['valid_types'] = $this->db->datatype->getValidTypes();
- }
-
- return MDB2_OK;
- }
-
- // }}}
- // {{{ disconnect()
-
- /**
- * Log out and disconnect from the database.
- *
- * @access public
- * @return void
- */
- function disconnect()
- {
- if (MDB2::isConnection($this->db)) {
- $this->db->disconnect();
- unset($this->db);
- }
- }
-
- // }}}
- // {{{ parseDatabaseDefinition()
-
- /**
- * Parse a database definition from a file or an array
- *
- * @param string|array $schema the database schema array or file name
- * @param bool $skip_unreadable if non readable files should be skipped
- * @param array $variables associative array that the defines the text string values
- * that are meant to be used to replace the variables that are
- * used in the schema description.
- * @param bool $fail_on_invalid_names make function fail on invalid names
- * @param array $structure database structure definition
- *
- * @access public
- * @return array
- */
- function parseDatabaseDefinition($schema, $skip_unreadable = false, $variables = array(),
- $fail_on_invalid_names = true, $structure = false)
- {
- $database_definition = false;
- if (is_string($schema)) {
- // if $schema is not readable then we just skip it
- // and simply copy the $current_schema file to that file name
- if (is_readable($schema)) {
- $database_definition = $this->parseDatabaseDefinitionFile($schema, $variables, $fail_on_invalid_names, $structure);
- }
- } elseif (is_array($schema)) {
- $database_definition = $schema;
- }
- if (!$database_definition && !$skip_unreadable) {
- $database_definition = $this->raiseError(MDB2_SCHEMA_ERROR, null, null,
- 'invalid data type of schema or unreadable data source');
- }
- return $database_definition;
- }
-
- // }}}
- // {{{ parseDatabaseDefinitionFile()
-
- /**
- * Parse a database definition file by creating a schema format
- * parser object and passing the file contents as parser input data stream.
- *
- * @param string $input_file the database schema file.
- * @param array $variables associative array that the defines the text string values
- * that are meant to be used to replace the variables that are
- * used in the schema description.
- * @param bool $fail_on_invalid_names make function fail on invalid names
- * @param array $structure database structure definition
- *
- * @access public
- * @return array
- */
- function parseDatabaseDefinitionFile($input_file, $variables = array(),
- $fail_on_invalid_names = true, $structure = false)
- {
- $dtd_file = $this->options['dtd_file'];
- if ($dtd_file) {
- include_once 'XML/DTD/XmlValidator.php';
- $dtd = new XML_DTD_XmlValidator;
- if (!$dtd->isValid($dtd_file, $input_file)) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_PARSE, null, null, $dtd->getMessage());
- }
- }
-
- $class_name = $this->options['parser'];
-
- $result = MDB2::loadClass($class_name, $this->db->getOption('debug'));
- if (PEAR::isError($result)) {
- return $result;
- }
-
- $max_identifiers_length = null;
- if (isset($this->db->options['max_identifiers_length'])) {
- $max_identifiers_length = $this->db->options['max_identifiers_length'];
- }
-
- $parser = new $class_name($variables, $fail_on_invalid_names, $structure,
- $this->options['valid_types'], $this->options['force_defaults'],
- $max_identifiers_length
- );
-
- $result = $parser->setInputFile($input_file);
- if (PEAR::isError($result)) {
- return $result;
- }
-
- $result = $parser->parse();
- if (PEAR::isError($result)) {
- return $result;
- }
- if (PEAR::isError($parser->error)) {
- return $parser->error;
- }
-
- return $parser->database_definition;
- }
-
- // }}}
- // {{{ getDefinitionFromDatabase()
-
- /**
- * Attempt to reverse engineer a schema structure from an existing MDB2
- * This method can be used if no xml schema file exists yet.
- * The resulting xml schema file may need some manual adjustments.
- *
- * @return array|MDB2_Error array with definition or error object
- * @access public
- */
- function getDefinitionFromDatabase()
- {
- $database = $this->db->database_name;
- if (empty($database)) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_INVALID, null, null,
- 'it was not specified a valid database name');
- }
-
- $class_name = $this->options['validate'];
-
- $result = MDB2::loadClass($class_name, $this->db->getOption('debug'));
- if (PEAR::isError($result)) {
- return $result;
- }
-
- $max_identifiers_length = null;
- if (isset($this->db->options['max_identifiers_length'])) {
- $max_identifiers_length = $this->db->options['max_identifiers_length'];
- }
-
- $val = new $class_name(
- $this->options['fail_on_invalid_names'],
- $this->options['valid_types'],
- $this->options['force_defaults'],
- $max_identifiers_length
- );
-
- $database_definition = array(
- 'name' => $database,
- 'create' => true,
- 'overwrite' => false,
- 'charset' => 'utf8',
- 'description' => '',
- 'comments' => '',
- 'tables' => array(),
- 'sequences' => array(),
- );
-
- $tables = $this->db->manager->listTables();
- if (PEAR::isError($tables)) {
- return $tables;
- }
-
- foreach ($tables as $table_name) {
- $fields = $this->db->manager->listTableFields($table_name);
- if (PEAR::isError($fields)) {
- return $fields;
- }
-
- $database_definition['tables'][$table_name] = array(
- 'was' => '',
- 'description' => '',
- 'comments' => '',
- 'fields' => array(),
- 'indexes' => array(),
- 'constraints' => array(),
- 'initialization' => array()
- );
-
- $table_definition = $database_definition['tables'][$table_name];
- foreach ($fields as $field_name) {
- $definition = $this->db->reverse->getTableFieldDefinition($table_name, $field_name);
- if (PEAR::isError($definition)) {
- return $definition;
- }
-
- if (!empty($definition[0]['autoincrement'])) {
- $definition[0]['default'] = '0';
- }
-
- $table_definition['fields'][$field_name] = $definition[0];
-
- $field_choices = count($definition);
- if ($field_choices > 1) {
- $warning = "There are $field_choices type choices in the table $table_name field $field_name (#1 is the default): ";
-
- $field_choice_cnt = 1;
-
- $table_definition['fields'][$field_name]['choices'] = array();
- foreach ($definition as $field_choice) {
- $table_definition['fields'][$field_name]['choices'][] = $field_choice;
-
- $warning .= 'choice #'.($field_choice_cnt).': '.serialize($field_choice);
- $field_choice_cnt++;
- }
- $this->warnings[] = $warning;
- }
-
- /**
- * The first parameter is used to verify if there are duplicated
- * fields which we can guarantee that won't happen when reverse engineering
- */
- $result = $val->validateField(array(), $table_definition['fields'][$field_name], $field_name);
- if (PEAR::isError($result)) {
- return $result;
- }
- }
-
- $keys = array();
-
- $indexes = $this->db->manager->listTableIndexes($table_name);
- if (PEAR::isError($indexes)) {
- return $indexes;
- }
-
- if (is_array($indexes)) {
- foreach ($indexes as $index_name) {
- $this->db->expectError(MDB2_ERROR_NOT_FOUND);
- $definition = $this->db->reverse->getTableIndexDefinition($table_name, $index_name);
- $this->db->popExpect();
- if (PEAR::isError($definition)) {
- if (PEAR::isError($definition, MDB2_ERROR_NOT_FOUND)) {
- continue;
- }
- return $definition;
- }
-
- $keys[$index_name] = $definition;
- }
- }
-
- $constraints = $this->db->manager->listTableConstraints($table_name);
- if (PEAR::isError($constraints)) {
- return $constraints;
- }
-
- if (is_array($constraints)) {
- foreach ($constraints as $constraint_name) {
- $this->db->expectError(MDB2_ERROR_NOT_FOUND);
- $definition = $this->db->reverse->getTableConstraintDefinition($table_name, $constraint_name);
- $this->db->popExpect();
- if (PEAR::isError($definition)) {
- if (PEAR::isError($definition, MDB2_ERROR_NOT_FOUND)) {
- continue;
- }
- return $definition;
- }
-
- $keys[$constraint_name] = $definition;
- }
- }
-
- foreach ($keys as $key_name => $definition) {
- if (array_key_exists('foreign', $definition)
- && $definition['foreign']
- ) {
- /**
- * The first parameter is used to verify if there are duplicated
- * foreign keys which we can guarantee that won't happen when reverse engineering
- */
- $result = $val->validateConstraint(array(), $definition, $key_name);
- if (PEAR::isError($result)) {
- return $result;
- }
-
- foreach ($definition['fields'] as $field_name => $field) {
- /**
- * The first parameter is used to verify if there are duplicated
- * referencing fields which we can guarantee that won't happen when reverse engineering
- */
- $result = $val->validateConstraintField(array(), $field_name);
- if (PEAR::isError($result)) {
- return $result;
- }
-
- $definition['fields'][$field_name] = '';
- }
-
- foreach ($definition['references']['fields'] as $field_name => $field) {
- /**
- * The first parameter is used to verify if there are duplicated
- * referenced fields which we can guarantee that won't happen when reverse engineering
- */
- $result = $val->validateConstraintReferencedField(array(), $field_name);
- if (PEAR::isError($result)) {
- return $result;
- }
-
- $definition['references']['fields'][$field_name] = '';
- }
-
- $table_definition['constraints'][$key_name] = $definition;
- } else {
- /**
- * The first parameter is used to verify if there are duplicated
- * indices which we can guarantee that won't happen when reverse engineering
- */
- $result = $val->validateIndex(array(), $definition, $key_name);
- if (PEAR::isError($result)) {
- return $result;
- }
-
- foreach ($definition['fields'] as $field_name => $field) {
- /**
- * The first parameter is used to verify if there are duplicated
- * index fields which we can guarantee that won't happen when reverse engineering
- */
- $result = $val->validateIndexField(array(), $field, $field_name);
- if (PEAR::isError($result)) {
- return $result;
- }
-
- $definition['fields'][$field_name] = $field;
- }
-
- $table_definition['indexes'][$key_name] = $definition;
- }
- }
-
- /**
- * The first parameter is used to verify if there are duplicated
- * tables which we can guarantee that won't happen when reverse engineering
- */
- $result = $val->validateTable(array(), $table_definition, $table_name);
- if (PEAR::isError($result)) {
- return $result;
- }
- $database_definition['tables'][$table_name]=$table_definition;
-
- }
-
- $sequences = $this->db->manager->listSequences();
- if (PEAR::isError($sequences)) {
- return $sequences;
- }
-
- if (is_array($sequences)) {
- foreach ($sequences as $sequence_name) {
- $definition = $this->db->reverse->getSequenceDefinition($sequence_name);
- if (PEAR::isError($definition)) {
- return $definition;
- }
- if (isset($database_definition['tables'][$sequence_name])
- && isset($database_definition['tables'][$sequence_name]['indexes'])
- ) {
- foreach ($database_definition['tables'][$sequence_name]['indexes'] as $index) {
- if (isset($index['primary']) && $index['primary']
- && count($index['fields'] == 1)
- ) {
- $definition['on'] = array(
- 'table' => $sequence_name,
- 'field' => key($index['fields']),
- );
- break;
- }
- }
- }
-
- /**
- * The first parameter is used to verify if there are duplicated
- * sequences which we can guarantee that won't happen when reverse engineering
- */
- $result = $val->validateSequence(array(), $definition, $sequence_name);
- if (PEAR::isError($result)) {
- return $result;
- }
-
- $database_definition['sequences'][$sequence_name] = $definition;
- }
- }
-
- $result = $val->validateDatabase($database_definition);
- if (PEAR::isError($result)) {
- return $result;
- }
-
- return $database_definition;
- }
-
- // }}}
- // {{{ createTableIndexes()
-
- /**
- * A method to create indexes for an existing table
- *
- * @param string $table_name Name of the table
- * @param array $indexes An array of indexes to be created
- * @param boolean $overwrite If the table/index should be overwritten if it already exists
- *
- * @return mixed MDB2_Error if there is an error creating an index, MDB2_OK otherwise
- * @access public
- */
- function createTableIndexes($table_name, $indexes, $overwrite = false)
- {
- if (!$this->db->supports('indexes')) {
- $this->db->debug('Indexes are not supported', __FUNCTION__);
- return MDB2_OK;
- }
-
- $errorcodes = array(MDB2_ERROR_UNSUPPORTED, MDB2_ERROR_NOT_CAPABLE);
- foreach ($indexes as $index_name => $index) {
-
- // Does the index already exist, and if so, should it be overwritten?
- $create_index = true;
- $this->db->expectError($errorcodes);
- if (!empty($index['primary']) || !empty($index['unique'])) {
- $current_indexes = $this->db->manager->listTableConstraints($table_name);
- } else {
- $current_indexes = $this->db->manager->listTableIndexes($table_name);
- }
-
- $this->db->popExpect();
- if (PEAR::isError($current_indexes)) {
- if (!MDB2::isError($current_indexes, $errorcodes)) {
- return $current_indexes;
- }
- } elseif (is_array($current_indexes) && in_array($index_name, $current_indexes)) {
- if (!$overwrite) {
- $this->db->debug('Index already exists: '.$index_name, __FUNCTION__);
- $create_index = false;
- } else {
- $this->db->debug('Preparing to overwrite index: '.$index_name, __FUNCTION__);
-
- $this->db->expectError(MDB2_ERROR_NOT_FOUND);
- if (!empty($index['primary']) || !empty($index['unique'])) {
- $result = $this->db->manager->dropConstraint($table_name, $index_name);
- } else {
- $result = $this->db->manager->dropIndex($table_name, $index_name);
- }
- $this->db->popExpect();
- if (PEAR::isError($result) && !MDB2::isError($result, MDB2_ERROR_NOT_FOUND)) {
- return $result;
- }
- }
- }
-
- // Check if primary is being used and if it's supported
- if (!empty($index['primary']) && !$this->db->supports('primary_key')) {
-
- // Primary not supported so we fallback to UNIQUE and making the field NOT NULL
- $index['unique'] = true;
-
- $changes = array();
-
- foreach ($index['fields'] as $field => $empty) {
- $field_info = $this->db->reverse->getTableFieldDefinition($table_name, $field);
- if (PEAR::isError($field_info)) {
- return $field_info;
- }
- if (!$field_info[0]['notnull']) {
- $changes['change'][$field] = $field_info[0];
-
- $changes['change'][$field]['notnull'] = true;
- }
- }
- if (!empty($changes)) {
- $this->db->manager->alterTable($table_name, $changes, false);
- }
- }
-
- // Should the index be created?
- if ($create_index) {
- if (!empty($index['primary']) || !empty($index['unique'])) {
- $result = $this->db->manager->createConstraint($table_name, $index_name, $index);
- } else {
- $result = $this->db->manager->createIndex($table_name, $index_name, $index);
- }
- if (PEAR::isError($result)) {
- return $result;
- }
- }
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ createTableConstraints()
-
- /**
- * A method to create foreign keys for an existing table
- *
- * @param string $table_name Name of the table
- * @param array $constraints An array of foreign keys to be created
- * @param boolean $overwrite If the foreign key should be overwritten if it already exists
- *
- * @return mixed MDB2_Error if there is an error creating a foreign key, MDB2_OK otherwise
- * @access public
- */
- function createTableConstraints($table_name, $constraints, $overwrite = false)
- {
- if (!$this->db->supports('indexes')) {
- $this->db->debug('Indexes are not supported', __FUNCTION__);
- return MDB2_OK;
- }
-
- $errorcodes = array(MDB2_ERROR_UNSUPPORTED, MDB2_ERROR_NOT_CAPABLE);
- foreach ($constraints as $constraint_name => $constraint) {
-
- // Does the foreign key already exist, and if so, should it be overwritten?
- $create_constraint = true;
- $this->db->expectError($errorcodes);
- $current_constraints = $this->db->manager->listTableConstraints($table_name);
- $this->db->popExpect();
- if (PEAR::isError($current_constraints)) {
- if (!MDB2::isError($current_constraints, $errorcodes)) {
- return $current_constraints;
- }
- } elseif (is_array($current_constraints) && in_array($constraint_name, $current_constraints)) {
- if (!$overwrite) {
- $this->db->debug('Foreign key already exists: '.$constraint_name, __FUNCTION__);
- $create_constraint = false;
- } else {
- $this->db->debug('Preparing to overwrite foreign key: '.$constraint_name, __FUNCTION__);
- $result = $this->db->manager->dropConstraint($table_name, $constraint_name);
- if (PEAR::isError($result)) {
- return $result;
- }
- }
- }
-
- // Should the foreign key be created?
- if ($create_constraint) {
- $result = $this->db->manager->createConstraint($table_name, $constraint_name, $constraint);
- if (PEAR::isError($result)) {
- return $result;
- }
- }
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ createTable()
-
- /**
- * Create a table and inititialize the table if data is available
- *
- * @param string $table_name name of the table to be created
- * @param array $table multi dimensional array that contains the
- * structure and optional data of the table
- * @param bool $overwrite if the table/index should be overwritten if it already exists
- * @param array $options an array of options to be passed to the database specific driver
- * version of MDB2_Driver_Manager_Common::createTable().
- *
- * @return bool|MDB2_Error MDB2_OK or error object
- * @access public
- */
- function createTable($table_name, $table, $overwrite = false, $options = array())
- {
- $create = true;
-
- $errorcodes = array(MDB2_ERROR_UNSUPPORTED, MDB2_ERROR_NOT_CAPABLE);
-
- $this->db->expectError($errorcodes);
-
- $tables = $this->db->manager->listTables();
-
- $this->db->popExpect();
- if (PEAR::isError($tables)) {
- if (!MDB2::isError($tables, $errorcodes)) {
- return $tables;
- }
- } elseif (is_array($tables) && in_array($table_name, $tables)) {
- if (!$overwrite) {
- $create = false;
- $this->db->debug('Table already exists: '.$table_name, __FUNCTION__);
- } else {
- $result = $this->db->manager->dropTable($table_name);
- if (PEAR::isError($result)) {
- return $result;
- }
- $this->db->debug('Overwritting table: '.$table_name, __FUNCTION__);
- }
- }
-
- if ($create) {
- $result = $this->db->manager->createTable($table_name, $table['fields'], $options);
- if (PEAR::isError($result)) {
- return $result;
- }
- }
-
- if (!empty($table['initialization']) && is_array($table['initialization'])) {
- $result = $this->initializeTable($table_name, $table);
- if (PEAR::isError($result)) {
- return $result;
- }
- }
-
- if (!empty($table['indexes']) && is_array($table['indexes'])) {
- $result = $this->createTableIndexes($table_name, $table['indexes'], $overwrite);
- if (PEAR::isError($result)) {
- return $result;
- }
- }
-
- if (!empty($table['constraints']) && is_array($table['constraints'])) {
- $result = $this->createTableConstraints($table_name, $table['constraints'], $overwrite);
- if (PEAR::isError($result)) {
- return $result;
- }
- }
-
- return MDB2_OK;
- }
-
- // }}}
- // {{{ initializeTable()
-
- /**
- * Inititialize the table with data
- *
- * @param string $table_name name of the table
- * @param array $table multi dimensional array that contains the
- * structure and optional data of the table
- *
- * @return bool|MDB2_Error MDB2_OK or error object
- * @access public
- */
- function initializeTable($table_name, $table)
- {
- $query_insertselect = 'INSERT INTO %s (%s) (SELECT %s FROM %s %s)';
-
- $query_insert = 'INSERT INTO %s (%s) VALUES (%s)';
- $query_update = 'UPDATE %s SET %s %s';
- $query_delete = 'DELETE FROM %s %s';
-
- $table_name = $this->db->quoteIdentifier($table_name, true);
-
- $result = MDB2_OK;
-
- $support_transactions = $this->db->supports('transactions');
-
- foreach ($table['initialization'] as $instruction) {
- $query = '';
- switch ($instruction['type']) {
- case 'insert':
- if (!isset($instruction['data']['select'])) {
- $data = $this->getInstructionFields($instruction['data'], $table['fields']);
- if (!empty($data)) {
- $fields = implode(', ', array_keys($data));
- $values = implode(', ', array_values($data));
-
- $query = sprintf($query_insert, $table_name, $fields, $values);
- }
- } else {
- $data = $this->getInstructionFields($instruction['data']['select'], $table['fields']);
- $where = $this->getInstructionWhere($instruction['data']['select'], $table['fields']);
-
- $select_table_name = $this->db->quoteIdentifier($instruction['data']['select']['table'], true);
- if (!empty($data)) {
- $fields = implode(', ', array_keys($data));
- $values = implode(', ', array_values($data));
-
- $query = sprintf($query_insertselect, $table_name, $fields, $values, $select_table_name, $where);
- }
- }
- break;
- case 'update':
- $data = $this->getInstructionFields($instruction['data'], $table['fields']);
- $where = $this->getInstructionWhere($instruction['data'], $table['fields']);
- if (!empty($data)) {
- array_walk($data, array($this, 'buildFieldValue'));
- $fields_values = implode(', ', $data);
-
- $query = sprintf($query_update, $table_name, $fields_values, $where);
- }
- break;
- case 'delete':
- $where = $this->getInstructionWhere($instruction['data'], $table['fields']);
- $query = sprintf($query_delete, $table_name, $where);
- break;
- }
- if ($query) {
- if ($support_transactions && PEAR::isError($res = $this->db->beginNestedTransaction())) {
- return $res;
- }
-
- $result = $this->db->exec($query);
- if (PEAR::isError($result)) {
- return $result;
- }
-
- if ($support_transactions && PEAR::isError($res = $this->db->completeNestedTransaction())) {
- return $res;
- }
- }
- }
- return $result;
- }
-
- // }}}
- // {{{ buildFieldValue()
-
- /**
- * Appends the contents of second argument + '=' to the beginning of first
- * argument.
- *
- * Used with array_walk() in initializeTable() for UPDATEs.
- *
- * @param string &$element value of array's element
- * @param string $key key of array's element
- *
- * @return void
- *
- * @access public
- * @see MDB2_Schema::initializeTable()
- */
- function buildFieldValue(&$element, $key)
- {
- $element = $key."=$element";
- }
-
- // }}}
- // {{{ getExpression()
-
- /**
- * Generates a string that represents a value that would be associated
- * with a column in a DML instruction.
- *
- * @param array $element multi dimensional array that contains the
- * structure of the current DML instruction.
- * @param array $fields_definition multi dimensional array that contains the
- * definition for current table's fields
- * @param string $type type of given field
- *
- * @return string
- *
- * @access public
- * @see MDB2_Schema::getInstructionFields(), MDB2_Schema::getInstructionWhere()
- */
- function getExpression($element, $fields_definition = array(), $type = null)
- {
- $str = '';
- switch ($element['type']) {
- case 'null':
- $str .= 'NULL';
- break;
- case 'value':
- $str .= $this->db->quote($element['data'], $type);
- break;
- case 'column':
- $str .= $this->db->quoteIdentifier($element['data'], true);
- break;
- case 'function':
- $arguments = array();
- if (!empty($element['data']['arguments'])
- && is_array($element['data']['arguments'])
- ) {
- foreach ($element['data']['arguments'] as $v) {
- $arguments[] = $this->getExpression($v, $fields_definition);
- }
- }
- if (method_exists($this->db->function, $element['data']['name'])) {
- $user_func = array(&$this->db->function, $element['data']['name']);
-
- $str .= call_user_func_array($user_func, $arguments);
- } else {
- $str .= $element['data']['name'].'(';
- $str .= implode(', ', $arguments);
- $str .= ')';
- }
- break;
- case 'expression':
- $type0 = $type1 = null;
- if ($element['data']['operants'][0]['type'] == 'column'
- && array_key_exists($element['data']['operants'][0]['data'], $fields_definition)
- ) {
- $type0 = $fields_definition[$element['data']['operants'][0]['data']]['type'];
- }
-
- if ($element['data']['operants'][1]['type'] == 'column'
- && array_key_exists($element['data']['operants'][1]['data'], $fields_definition)
- ) {
- $type1 = $fields_definition[$element['data']['operants'][1]['data']]['type'];
- }
-
- $str .= '(';
- $str .= $this->getExpression($element['data']['operants'][0], $fields_definition, $type1);
- $str .= $this->getOperator($element['data']['operator']);
- $str .= $this->getExpression($element['data']['operants'][1], $fields_definition, $type0);
- $str .= ')';
- break;
- }
-
- return $str;
- }
-
- // }}}
- // {{{ getOperator()
-
- /**
- * Returns the matching SQL operator
- *
- * @param string $op parsed descriptive operator
- *
- * @return string matching SQL operator
- *
- * @access public
- * @static
- * @see MDB2_Schema::getExpression()
- */
- function getOperator($op)
- {
- switch ($op) {
- case 'PLUS':
- return ' + ';
- case 'MINUS':
- return ' - ';
- case 'TIMES':
- return ' * ';
- case 'DIVIDED':
- return ' / ';
- case 'EQUAL':
- return ' = ';
- case 'NOT EQUAL':
- return ' != ';
- case 'LESS THAN':
- return ' < ';
- case 'GREATER THAN':
- return ' > ';
- case 'LESS THAN OR EQUAL':
- return ' <= ';
- case 'GREATER THAN OR EQUAL':
- return ' >= ';
- default:
- return ' '.$op.' ';
- }
- }
-
- // }}}
- // {{{ getInstructionFields()
-
- /**
- * Walks the parsed DML instruction array, field by field,
- * storing them and their processed values inside a new array.
- *
- * @param array $instruction multi dimensional array that contains the
- * structure of the current DML instruction.
- * @param array $fields_definition multi dimensional array that contains the
- * definition for current table's fields
- *
- * @return array array of strings in the form 'field_name' => 'value'
- *
- * @access public
- * @static
- * @see MDB2_Schema::initializeTable()
- */
- function getInstructionFields($instruction, $fields_definition = array())
- {
- $fields = array();
- if (!empty($instruction['field']) && is_array($instruction['field'])) {
- foreach ($instruction['field'] as $field) {
- $field_name = $this->db->quoteIdentifier($field['name'], true);
-
- $fields[$field_name] = $this->getExpression($field['group'], $fields_definition);
- }
- }
- return $fields;
- }
-
- // }}}
- // {{{ getInstructionWhere()
-
- /**
- * Translates the parsed WHERE expression of a DML instruction
- * (array structure) to a SQL WHERE clause (string).
- *
- * @param array $instruction multi dimensional array that contains the
- * structure of the current DML instruction.
- * @param array $fields_definition multi dimensional array that contains the
- * definition for current table's fields.
- *
- * @return string SQL WHERE clause
- *
- * @access public
- * @static
- * @see MDB2_Schema::initializeTable()
- */
- function getInstructionWhere($instruction, $fields_definition = array())
- {
- $where = '';
- if (!empty($instruction['where'])) {
- $where = 'WHERE '.$this->getExpression($instruction['where'], $fields_definition);
- }
- return $where;
- }
-
- // }}}
- // {{{ createSequence()
-
- /**
- * Create a sequence
- *
- * @param string $sequence_name name of the sequence to be created
- * @param array $sequence multi dimensional array that contains the
- * structure and optional data of the table
- * @param bool $overwrite if the sequence should be overwritten if it already exists
- *
- * @return bool|MDB2_Error MDB2_OK or error object
- * @access public
- */
- function createSequence($sequence_name, $sequence, $overwrite = false)
- {
- if (!$this->db->supports('sequences')) {
- $this->db->debug('Sequences are not supported', __FUNCTION__);
- return MDB2_OK;
- }
-
- $errorcodes = array(MDB2_ERROR_UNSUPPORTED, MDB2_ERROR_NOT_CAPABLE);
- $this->db->expectError($errorcodes);
- $sequences = $this->db->manager->listSequences();
- $this->db->popExpect();
- if (PEAR::isError($sequences)) {
- if (!MDB2::isError($sequences, $errorcodes)) {
- return $sequences;
- }
- } elseif (is_array($sequence) && in_array($sequence_name, $sequences)) {
- if (!$overwrite) {
- $this->db->debug('Sequence already exists: '.$sequence_name, __FUNCTION__);
- return MDB2_OK;
- }
-
- $result = $this->db->manager->dropSequence($sequence_name);
- if (PEAR::isError($result)) {
- return $result;
- }
- $this->db->debug('Overwritting sequence: '.$sequence_name, __FUNCTION__);
- }
-
- $start = 1;
- $field = '';
- if (!empty($sequence['on'])) {
- $table = $sequence['on']['table'];
- $field = $sequence['on']['field'];
-
- $errorcodes = array(MDB2_ERROR_UNSUPPORTED, MDB2_ERROR_NOT_CAPABLE);
- $this->db->expectError($errorcodes);
- $tables = $this->db->manager->listTables();
- $this->db->popExpect();
- if (PEAR::isError($tables) && !MDB2::isError($tables, $errorcodes)) {
- return $tables;
- }
-
- if (!PEAR::isError($tables) && is_array($tables) && in_array($table, $tables)) {
- if ($this->db->supports('summary_functions')) {
- $query = "SELECT MAX($field) FROM ".$this->db->quoteIdentifier($table, true);
- } else {
- $query = "SELECT $field FROM ".$this->db->quoteIdentifier($table, true)." ORDER BY $field DESC";
- }
- $start = $this->db->queryOne($query, 'integer');
- if (PEAR::isError($start)) {
- return $start;
- }
- ++$start;
- } else {
- $this->warnings[] = 'Could not sync sequence: '.$sequence_name;
- }
- } elseif (!empty($sequence['start']) && is_numeric($sequence['start'])) {
- $start = $sequence['start'];
- $table = '';
- }
-
- $result = $this->db->manager->createSequence($sequence_name, $start);
- if (PEAR::isError($result)) {
- return $result;
- }
-
- return MDB2_OK;
- }
-
- // }}}
- // {{{ createDatabase()
-
- /**
- * Create a database space within which may be created database objects
- * like tables, indexes and sequences. The implementation of this function
- * is highly DBMS specific and may require special permissions to run
- * successfully. Consult the documentation or the DBMS drivers that you
- * use to be aware of eventual configuration requirements.
- *
- * @param array $database_definition multi dimensional array that contains the current definition
- * @param array $options an array of options to be passed to the
- * database specific driver version of
- * MDB2_Driver_Manager_Common::createTable().
- *
- * @return bool|MDB2_Error MDB2_OK or error object
- * @access public
- */
- function createDatabase($database_definition, $options = array())
- {
- if (!isset($database_definition['name']) || !$database_definition['name']) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_INVALID, null, null,
- 'no valid database name specified');
- }
-
- $create = (isset($database_definition['create']) && $database_definition['create']);
- $overwrite = (isset($database_definition['overwrite']) && $database_definition['overwrite']);
-
- /**
- *
- * We need to clean up database name before any query to prevent
- * database driver from using a inexistent database
- *
- */
- $previous_database_name = $this->db->setDatabase('');
-
- // Lower / Upper case the db name if the portability deems so.
- if ($this->db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
- $func = $this->db->options['field_case'] == CASE_LOWER ? 'strtolower' : 'strtoupper';
-
- $db_name = $func($database_definition['name']);
- } else {
- $db_name = $database_definition['name'];
- }
-
- if ($create) {
-
- $dbExists = $this->db->databaseExists($db_name);
- if (PEAR::isError($dbExists)) {
- return $dbExists;
- }
-
- if ($dbExists && $overwrite) {
- $this->db->expectError(MDB2_ERROR_CANNOT_DROP);
- $result = $this->db->manager->dropDatabase($db_name);
- $this->db->popExpect();
- if (PEAR::isError($result) && !MDB2::isError($result, MDB2_ERROR_CANNOT_DROP)) {
- return $result;
- }
- $dbExists = false;
- $this->db->debug('Overwritting database: ' . $db_name, __FUNCTION__);
- }
-
- $dbOptions = array();
- if (array_key_exists('charset', $database_definition)
- && !empty($database_definition['charset'])) {
- $dbOptions['charset'] = $database_definition['charset'];
- }
-
- if ($dbExists) {
- $this->db->debug('Database already exists: ' . $db_name, __FUNCTION__);
- if (!empty($dbOptions)) {
- $errorcodes = array(MDB2_ERROR_UNSUPPORTED, MDB2_ERROR_NO_PERMISSION);
- $this->db->expectError($errorcodes);
- $result = $this->db->manager->alterDatabase($db_name, $dbOptions);
- $this->db->popExpect();
- if (PEAR::isError($result) && !MDB2::isError($result, $errorcodes)) {
- return $result;
- }
- }
- $create = false;
- } else {
- $this->db->expectError(MDB2_ERROR_UNSUPPORTED);
- $result = $this->db->manager->createDatabase($db_name, $dbOptions);
- $this->db->popExpect();
- if (PEAR::isError($result) && !MDB2::isError($result, MDB2_ERROR_UNSUPPORTED)) {
- return $result;
- }
- $this->db->debug('Creating database: ' . $db_name, __FUNCTION__);
- }
- }
-
- $this->db->setDatabase($db_name);
- if (($support_transactions = $this->db->supports('transactions'))
- && PEAR::isError($result = $this->db->beginNestedTransaction())
- ) {
- return $result;
- }
-
- $created_objects = 0;
- if (isset($database_definition['tables'])
- && is_array($database_definition['tables'])
- ) {
- foreach ($database_definition['tables'] as $table_name => $table) {
- $result = $this->createTable($table_name, $table, $overwrite, $options);
- if (PEAR::isError($result)) {
- break;
- }
- $created_objects++;
- }
- }
- if (!PEAR::isError($result)
- && isset($database_definition['sequences'])
- && is_array($database_definition['sequences'])
- ) {
- foreach ($database_definition['sequences'] as $sequence_name => $sequence) {
- $result = $this->createSequence($sequence_name, $sequence, false, $overwrite);
-
- if (PEAR::isError($result)) {
- break;
- }
- $created_objects++;
- }
- }
-
- if ($support_transactions) {
- $res = $this->db->completeNestedTransaction();
- if (PEAR::isError($res)) {
- $result = $this->raiseError(MDB2_SCHEMA_ERROR, null, null,
- 'Could not end transaction ('.
- $res->getMessage().' ('.$res->getUserinfo().'))');
- }
- } elseif (PEAR::isError($result) && $created_objects) {
- $result = $this->raiseError(MDB2_SCHEMA_ERROR, null, null,
- 'the database was only partially created ('.
- $result->getMessage().' ('.$result->getUserinfo().'))');
- }
-
- $this->db->setDatabase($previous_database_name);
-
- if (PEAR::isError($result) && $create
- && PEAR::isError($result2 = $this->db->manager->dropDatabase($db_name))
- ) {
- if (!MDB2::isError($result2, MDB2_ERROR_UNSUPPORTED)) {
- return $this->raiseError(MDB2_SCHEMA_ERROR, null, null,
- 'Could not drop the created database after unsuccessful creation attempt ('.
- $result2->getMessage().' ('.$result2->getUserinfo().'))');
- }
- }
-
- return $result;
- }
-
- // }}}
- // {{{ compareDefinitions()
-
- /**
- * Compare a previous definition with the currently parsed definition
- *
- * @param array $current_definition multi dimensional array that contains the current definition
- * @param array $previous_definition multi dimensional array that contains the previous definition
- *
- * @return array|MDB2_Error array of changes on success, or a error object
- * @access public
- */
- function compareDefinitions($current_definition, $previous_definition)
- {
- $changes = array();
-
- if (!empty($current_definition['tables']) && is_array($current_definition['tables'])) {
- $changes['tables'] = $defined_tables = array();
- foreach ($current_definition['tables'] as $table_name => $table) {
- $previous_tables = array();
- if (!empty($previous_definition) && is_array($previous_definition)) {
- $previous_tables = $previous_definition['tables'];
- }
- $change = $this->compareTableDefinitions($table_name, $table, $previous_tables, $defined_tables);
- if (PEAR::isError($change)) {
- return $change;
- }
- if (!empty($change)) {
- $changes['tables'] = MDB2_Schema::arrayMergeClobber($changes['tables'], $change);
- }
- }
- }
- if (!empty($previous_definition['tables'])
- && is_array($previous_definition['tables'])
- ) {
- foreach ($previous_definition['tables'] as $table_name => $table) {
- if (empty($defined_tables[$table_name])) {
- $changes['tables']['remove'][$table_name] = true;
- }
- }
- }
-
- if (!empty($current_definition['sequences']) && is_array($current_definition['sequences'])) {
- $changes['sequences'] = $defined_sequences = array();
- foreach ($current_definition['sequences'] as $sequence_name => $sequence) {
- $previous_sequences = array();
- if (!empty($previous_definition) && is_array($previous_definition)) {
- $previous_sequences = $previous_definition['sequences'];
- }
-
- $change = $this->compareSequenceDefinitions($sequence_name,
- $sequence,
- $previous_sequences,
- $defined_sequences);
- if (PEAR::isError($change)) {
- return $change;
- }
- if (!empty($change)) {
- $changes['sequences'] = MDB2_Schema::arrayMergeClobber($changes['sequences'], $change);
- }
- }
- }
- if (!empty($previous_definition['sequences'])
- && is_array($previous_definition['sequences'])
- ) {
- foreach ($previous_definition['sequences'] as $sequence_name => $sequence) {
- if (empty($defined_sequences[$sequence_name])) {
- $changes['sequences']['remove'][$sequence_name] = true;
- }
- }
- }
-
- return $changes;
- }
-
- // }}}
- // {{{ compareTableFieldsDefinitions()
-
- /**
- * Compare a previous definition with the currently parsed definition
- *
- * @param string $table_name name of the table
- * @param array $current_definition multi dimensional array that contains the current definition
- * @param array $previous_definition multi dimensional array that contains the previous definition
- *
- * @return array|MDB2_Error array of changes on success, or a error object
- * @access public
- */
- function compareTableFieldsDefinitions($table_name, $current_definition,
- $previous_definition)
- {
- $changes = $defined_fields = array();
-
- if (is_array($current_definition)) {
- foreach ($current_definition as $field_name => $field) {
- $was_field_name = $field['was'];
- if (!empty($previous_definition[$field_name])
- && (
- (isset($previous_definition[$field_name]['was'])
- && $previous_definition[$field_name]['was'] == $was_field_name)
- || !isset($previous_definition[$was_field_name])
- )) {
- $was_field_name = $field_name;
- }
-
- if (!empty($previous_definition[$was_field_name])) {
- if ($was_field_name != $field_name) {
- $changes['rename'][$was_field_name] = array('name' => $field_name, 'definition' => $field);
- }
-
- if (!empty($defined_fields[$was_field_name])) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_INVALID, null, null,
- 'the field "'.$was_field_name.
- '" was specified for more than one field of table');
- }
-
- $defined_fields[$was_field_name] = true;
-
- $change = $this->db->compareDefinition($field, $previous_definition[$was_field_name]);
- if (PEAR::isError($change)) {
- return $change;
- }
-
- if (!empty($change)) {
- if (array_key_exists('default', $change)
- && $change['default']
- && !array_key_exists('default', $field)) {
- $field['default'] = null;
- }
-
- $change['definition'] = $field;
-
- $changes['change'][$field_name] = $change;
- }
- } else {
- if ($field_name != $was_field_name) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_INVALID, null, null,
- 'it was specified a previous field name ("'.
- $was_field_name.'") for field "'.$field_name.'" of table "'.
- $table_name.'" that does not exist');
- }
-
- $changes['add'][$field_name] = $field;
- }
- }
- }
-
- if (isset($previous_definition) && is_array($previous_definition)) {
- foreach ($previous_definition as $field_previous_name => $field_previous) {
- if (empty($defined_fields[$field_previous_name])) {
- $changes['remove'][$field_previous_name] = true;
- }
- }
- }
-
- return $changes;
- }
-
- // }}}
- // {{{ compareTableIndexesDefinitions()
-
- /**
- * Compare a previous definition with the currently parsed definition
- *
- * @param string $table_name name of the table
- * @param array $current_definition multi dimensional array that contains the current definition
- * @param array $previous_definition multi dimensional array that contains the previous definition
- *
- * @return array|MDB2_Error array of changes on success, or a error object
- * @access public
- */
- function compareTableIndexesDefinitions($table_name, $current_definition,
- $previous_definition)
- {
- $changes = $defined_indexes = array();
-
- if (is_array($current_definition)) {
- foreach ($current_definition as $index_name => $index) {
- $was_index_name = $index['was'];
- if (!empty($previous_definition[$index_name])
- && isset($previous_definition[$index_name]['was'])
- && $previous_definition[$index_name]['was'] == $was_index_name
- ) {
- $was_index_name = $index_name;
- }
- if (!empty($previous_definition[$was_index_name])) {
- $change = array();
- if ($was_index_name != $index_name) {
- $change['name'] = $was_index_name;
- }
-
- if (!empty($defined_indexes[$was_index_name])) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_INVALID, null, null,
- 'the index "'.$was_index_name.'" was specified for'.
- ' more than one index of table "'.$table_name.'"');
- }
- $defined_indexes[$was_index_name] = true;
-
- $previous_unique = array_key_exists('unique', $previous_definition[$was_index_name])
- ? $previous_definition[$was_index_name]['unique'] : false;
-
- $unique = array_key_exists('unique', $index) ? $index['unique'] : false;
- if ($previous_unique != $unique) {
- $change['unique'] = $unique;
- }
-
- $previous_primary = array_key_exists('primary', $previous_definition[$was_index_name])
- ? $previous_definition[$was_index_name]['primary'] : false;
-
- $primary = array_key_exists('primary', $index) ? $index['primary'] : false;
- if ($previous_primary != $primary) {
- $change['primary'] = $primary;
- }
-
- $defined_fields = array();
- $previous_fields = $previous_definition[$was_index_name]['fields'];
- if (!empty($index['fields']) && is_array($index['fields'])) {
- foreach ($index['fields'] as $field_name => $field) {
- if (!empty($previous_fields[$field_name])) {
- $defined_fields[$field_name] = true;
-
- $previous_sorting = array_key_exists('sorting', $previous_fields[$field_name])
- ? $previous_fields[$field_name]['sorting'] : '';
-
- $sorting = array_key_exists('sorting', $field) ? $field['sorting'] : '';
- if ($previous_sorting != $sorting) {
- $change['change'] = true;
- }
- } else {
- $change['change'] = true;
- }
- }
- }
- if (isset($previous_fields) && is_array($previous_fields)) {
- foreach ($previous_fields as $field_name => $field) {
- if (empty($defined_fields[$field_name])) {
- $change['change'] = true;
- }
- }
- }
- if (!empty($change)) {
- $changes['change'][$index_name] = $current_definition[$index_name];
- }
- } else {
- if ($index_name != $was_index_name) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_INVALID, null, null,
- 'it was specified a previous index name ("'.$was_index_name.
- ') for index "'.$index_name.'" of table "'.$table_name.'" that does not exist');
- }
- $changes['add'][$index_name] = $current_definition[$index_name];
- }
- }
- }
- foreach ($previous_definition as $index_previous_name => $index_previous) {
- if (empty($defined_indexes[$index_previous_name])) {
- $changes['remove'][$index_previous_name] = $index_previous;
- }
- }
- return $changes;
- }
-
- // }}}
- // {{{ compareTableDefinitions()
-
- /**
- * Compare a previous definition with the currently parsed definition
- *
- * @param string $table_name name of the table
- * @param array $current_definition multi dimensional array that contains the current definition
- * @param array $previous_definition multi dimensional array that contains the previous definition
- * @param array &$defined_tables table names in the schema
- *
- * @return array|MDB2_Error array of changes on success, or a error object
- * @access public
- */
- function compareTableDefinitions($table_name, $current_definition,
- $previous_definition, &$defined_tables)
- {
- $changes = array();
-
- if (is_array($current_definition)) {
- $was_table_name = $table_name;
- if (!empty($current_definition['was'])) {
- $was_table_name = $current_definition['was'];
- }
- if (!empty($previous_definition[$was_table_name])) {
- $changes['change'][$was_table_name] = array();
- if ($was_table_name != $table_name) {
- $changes['change'][$was_table_name] = array('name' => $table_name);
- }
- if (!empty($defined_tables[$was_table_name])) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_INVALID, null, null,
- 'the table "'.$was_table_name.
- '" was specified for more than one table of the database');
- }
- $defined_tables[$was_table_name] = true;
- if (!empty($current_definition['fields']) && is_array($current_definition['fields'])) {
- $previous_fields = array();
- if (isset($previous_definition[$was_table_name]['fields'])
- && is_array($previous_definition[$was_table_name]['fields'])) {
- $previous_fields = $previous_definition[$was_table_name]['fields'];
- }
-
- $change = $this->compareTableFieldsDefinitions($table_name,
- $current_definition['fields'],
- $previous_fields);
-
- if (PEAR::isError($change)) {
- return $change;
- }
- if (!empty($change)) {
- $changes['change'][$was_table_name] =
- MDB2_Schema::arrayMergeClobber($changes['change'][$was_table_name], $change);
- }
- }
- if (!empty($current_definition['indexes']) && is_array($current_definition['indexes'])) {
- $previous_indexes = array();
- if (isset($previous_definition[$was_table_name]['indexes'])
- && is_array($previous_definition[$was_table_name]['indexes'])) {
- $previous_indexes = $previous_definition[$was_table_name]['indexes'];
- }
- $change = $this->compareTableIndexesDefinitions($table_name,
- $current_definition['indexes'],
- $previous_indexes);
-
- if (PEAR::isError($change)) {
- return $change;
- }
- if (!empty($change)) {
- $changes['change'][$was_table_name]['indexes'] = $change;
- }
- }
- if (empty($changes['change'][$was_table_name])) {
- unset($changes['change'][$was_table_name]);
- }
- if (empty($changes['change'])) {
- unset($changes['change']);
- }
- } else {
- if ($table_name != $was_table_name) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_INVALID, null, null,
- 'it was specified a previous table name ("'.$was_table_name.
- '") for table "'.$table_name.'" that does not exist');
- }
- $changes['add'][$table_name] = true;
- }
- }
-
- return $changes;
- }
-
- // }}}
- // {{{ compareSequenceDefinitions()
-
- /**
- * Compare a previous definition with the currently parsed definition
- *
- * @param string $sequence_name name of the sequence
- * @param array $current_definition multi dimensional array that contains the current definition
- * @param array $previous_definition multi dimensional array that contains the previous definition
- * @param array &$defined_sequences names in the schema
- *
- * @return array|MDB2_Error array of changes on success, or a error object
- * @access public
- */
- function compareSequenceDefinitions($sequence_name, $current_definition,
- $previous_definition, &$defined_sequences)
- {
- $changes = array();
-
- if (is_array($current_definition)) {
- $was_sequence_name = $sequence_name;
- if (!empty($previous_definition[$sequence_name])
- && isset($previous_definition[$sequence_name]['was'])
- && $previous_definition[$sequence_name]['was'] == $was_sequence_name
- ) {
- $was_sequence_name = $sequence_name;
- } elseif (!empty($current_definition['was'])) {
- $was_sequence_name = $current_definition['was'];
- }
- if (!empty($previous_definition[$was_sequence_name])) {
- if ($was_sequence_name != $sequence_name) {
- $changes['change'][$was_sequence_name]['name'] = $sequence_name;
- }
-
- if (!empty($defined_sequences[$was_sequence_name])) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_INVALID, null, null,
- 'the sequence "'.$was_sequence_name.'" was specified as base'.
- ' of more than of sequence of the database');
- }
-
- $defined_sequences[$was_sequence_name] = true;
-
- $change = array();
- if (!empty($current_definition['start'])
- && isset($previous_definition[$was_sequence_name]['start'])
- && $current_definition['start'] != $previous_definition[$was_sequence_name]['start']
- ) {
- $change['start'] = $previous_definition[$sequence_name]['start'];
- }
- if (isset($current_definition['on']['table'])
- && isset($previous_definition[$was_sequence_name]['on']['table'])
- && $current_definition['on']['table'] != $previous_definition[$was_sequence_name]['on']['table']
- && isset($current_definition['on']['field'])
- && isset($previous_definition[$was_sequence_name]['on']['field'])
- && $current_definition['on']['field'] != $previous_definition[$was_sequence_name]['on']['field']
- ) {
- $change['on'] = $current_definition['on'];
- }
- if (!empty($change)) {
- $changes['change'][$was_sequence_name][$sequence_name] = $change;
- }
- } else {
- if ($sequence_name != $was_sequence_name) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_INVALID, null, null,
- 'it was specified a previous sequence name ("'.$was_sequence_name.
- '") for sequence "'.$sequence_name.'" that does not exist');
- }
- $changes['add'][$sequence_name] = true;
- }
- }
- return $changes;
- }
- // }}}
- // {{{ verifyAlterDatabase()
-
- /**
- * Verify that the changes requested are supported
- *
- * @param array $changes associative array that contains the definition of the changes
- * that are meant to be applied to the database structure.
- *
- * @return bool|MDB2_Error MDB2_OK or error object
- * @access public
- */
- function verifyAlterDatabase($changes)
- {
- if (!empty($changes['tables']['change']) && is_array($changes['tables']['change'])) {
- foreach ($changes['tables']['change'] as $table_name => $table) {
- if (!empty($table['indexes']) && is_array($table['indexes'])) {
- if (!$this->db->supports('indexes')) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_UNSUPPORTED, null, null,
- 'indexes are not supported');
- }
- $table_changes = count($table['indexes']);
- if (!empty($table['indexes']['add'])) {
- $table_changes--;
- }
- if (!empty($table['indexes']['remove'])) {
- $table_changes--;
- }
- if (!empty($table['indexes']['change'])) {
- $table_changes--;
- }
- if ($table_changes) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_UNSUPPORTED, null, null,
- 'index alteration not yet supported: '.implode(', ', array_keys($table['indexes'])));
- }
- }
- unset($table['indexes']);
- $result = $this->db->manager->alterTable($table_name, $table, true);
- if (PEAR::isError($result)) {
- return $result;
- }
- }
- }
- if (!empty($changes['sequences']) && is_array($changes['sequences'])) {
- if (!$this->db->supports('sequences')) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_UNSUPPORTED, null, null,
- 'sequences are not supported');
- }
- $sequence_changes = count($changes['sequences']);
- if (!empty($changes['sequences']['add'])) {
- $sequence_changes--;
- }
- if (!empty($changes['sequences']['remove'])) {
- $sequence_changes--;
- }
- if (!empty($changes['sequences']['change'])) {
- $sequence_changes--;
- }
- if ($sequence_changes) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_UNSUPPORTED, null, null,
- 'sequence alteration not yet supported: '.implode(', ', array_keys($changes['sequences'])));
- }
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ alterDatabaseIndexes()
-
- /**
- * Execute the necessary actions to implement the requested changes
- * in the indexes inside a database structure.
- *
- * @param string $table_name name of the table
- * @param array $changes associative array that contains the definition of the changes
- * that are meant to be applied to the database structure.
- *
- * @return bool|MDB2_Error MDB2_OK or error object
- * @access public
- */
- function alterDatabaseIndexes($table_name, $changes)
- {
- $alterations = 0;
- if (empty($changes)) {
- return $alterations;
- }
-
- if (!empty($changes['remove']) && is_array($changes['remove'])) {
- foreach ($changes['remove'] as $index_name => $index) {
- $this->db->expectError(MDB2_ERROR_NOT_FOUND);
- if (!empty($index['primary']) || !empty($index['unique'])) {
- $result = $this->db->manager->dropConstraint($table_name, $index_name, !empty($index['primary']));
- } else {
- $result = $this->db->manager->dropIndex($table_name, $index_name);
- }
- $this->db->popExpect();
- if (PEAR::isError($result) && !MDB2::isError($result, MDB2_ERROR_NOT_FOUND)) {
- return $result;
- }
- $alterations++;
- }
- }
- if (!empty($changes['change']) && is_array($changes['change'])) {
- foreach ($changes['change'] as $index_name => $index) {
- /**
- * Drop existing index/constraint first.
- * Since $changes doesn't tell us whether it's an index or a constraint before the change,
- * we have to find out and call the appropriate method.
- */
- if (in_array($index_name, $this->db->manager->listTableIndexes($table_name))) {
- $result = $this->db->manager->dropIndex($table_name, $index_name);
- } elseif (in_array($index_name, $this->db->manager->listTableConstraints($table_name))) {
- $result = $this->db->manager->dropConstraint($table_name, $index_name);
- }
- if (!empty($result) && PEAR::isError($result)) {
- return $result;
- }
-
- if (!empty($index['primary']) || !empty($index['unique'])) {
- $result = $this->db->manager->createConstraint($table_name, $index_name, $index);
- } else {
- $result = $this->db->manager->createIndex($table_name, $index_name, $index);
- }
- if (PEAR::isError($result)) {
- return $result;
- }
- $alterations++;
- }
- }
- if (!empty($changes['add']) && is_array($changes['add'])) {
- foreach ($changes['add'] as $index_name => $index) {
- if (!empty($index['primary']) || !empty($index['unique'])) {
- $result = $this->db->manager->createConstraint($table_name, $index_name, $index);
- } else {
- $result = $this->db->manager->createIndex($table_name, $index_name, $index);
- }
- if (PEAR::isError($result)) {
- return $result;
- }
- $alterations++;
- }
- }
-
- return $alterations;
- }
-
- // }}}
- // {{{ alterDatabaseTables()
-
- /**
- * Execute the necessary actions to implement the requested changes
- * in the tables inside a database structure.
- *
- * @param array $current_definition multi dimensional array that contains the current definition
- * @param array $previous_definition multi dimensional array that contains the previous definition
- * @param array $changes associative array that contains the definition of the changes
- * that are meant to be applied to the database structure.
- *
- * @return bool|MDB2_Error MDB2_OK or error object
- * @access public
- */
- function alterDatabaseTables($current_definition, $previous_definition, $changes)
- {
- /* FIXME: tables marked to be added are initialized by createTable(), others don't */
- $alterations = 0;
- if (empty($changes)) {
- return $alterations;
- }
-
- if (!empty($changes['add']) && is_array($changes['add'])) {
- foreach ($changes['add'] as $table_name => $table) {
- $result = $this->createTable($table_name, $current_definition[$table_name]);
- if (PEAR::isError($result)) {
- return $result;
- }
- $alterations++;
- }
- }
-
- if ($this->options['drop_obsolete_objects']
- && !empty($changes['remove'])
- && is_array($changes['remove'])
- ) {
- foreach ($changes['remove'] as $table_name => $table) {
- $result = $this->db->manager->dropTable($table_name);
- if (PEAR::isError($result)) {
- return $result;
- }
- $alterations++;
- }
- }
-
- if (!empty($changes['change']) && is_array($changes['change'])) {
- foreach ($changes['change'] as $table_name => $table) {
- $indexes = array();
- if (!empty($table['indexes'])) {
- $indexes = $table['indexes'];
- unset($table['indexes']);
- }
- if (!empty($indexes['remove'])) {
- $result = $this->alterDatabaseIndexes($table_name, array('remove' => $indexes['remove']));
- if (PEAR::isError($result)) {
- return $result;
- }
- unset($indexes['remove']);
- $alterations += $result;
- }
- $result = $this->db->manager->alterTable($table_name, $table, false);
- if (PEAR::isError($result)) {
- return $result;
- }
- $alterations++;
-
- // table may be renamed at this point
- if (!empty($table['name'])) {
- $table_name = $table['name'];
- }
-
- if (!empty($indexes)) {
- $result = $this->alterDatabaseIndexes($table_name, $indexes);
- if (PEAR::isError($result)) {
- return $result;
- }
- $alterations += $result;
- }
- }
- }
-
- return $alterations;
- }
-
- // }}}
- // {{{ alterDatabaseSequences()
-
- /**
- * Execute the necessary actions to implement the requested changes
- * in the sequences inside a database structure.
- *
- * @param array $current_definition multi dimensional array that contains the current definition
- * @param array $previous_definition multi dimensional array that contains the previous definition
- * @param array $changes associative array that contains the definition of the changes
- * that are meant to be applied to the database structure.
- *
- * @return bool|MDB2_Error MDB2_OK or error object
- * @access public
- */
- function alterDatabaseSequences($current_definition, $previous_definition, $changes)
- {
- $alterations = 0;
- if (empty($changes)) {
- return $alterations;
- }
-
- if (!empty($changes['add']) && is_array($changes['add'])) {
- foreach ($changes['add'] as $sequence_name => $sequence) {
- $result = $this->createSequence($sequence_name, $current_definition[$sequence_name]);
- if (PEAR::isError($result)) {
- return $result;
- }
- $alterations++;
- }
- }
-
- if ($this->options['drop_obsolete_objects']
- && !empty($changes['remove'])
- && is_array($changes['remove'])
- ) {
- foreach ($changes['remove'] as $sequence_name => $sequence) {
- $result = $this->db->manager->dropSequence($sequence_name);
- if (PEAR::isError($result)) {
- return $result;
- }
- $alterations++;
- }
- }
-
- if (!empty($changes['change']) && is_array($changes['change'])) {
- foreach ($changes['change'] as $sequence_name => $sequence) {
- $result = $this->db->manager->dropSequence($previous_definition[$sequence_name]['was']);
- if (PEAR::isError($result)) {
- return $result;
- }
- $result = $this->createSequence($sequence_name, $sequence);
- if (PEAR::isError($result)) {
- return $result;
- }
- $alterations++;
- }
- }
-
- return $alterations;
- }
-
- // }}}
- // {{{ alterDatabase()
-
- /**
- * Execute the necessary actions to implement the requested changes
- * in a database structure.
- *
- * @param array $current_definition multi dimensional array that contains the current definition
- * @param array $previous_definition multi dimensional array that contains the previous definition
- * @param array $changes associative array that contains the definition of the changes
- * that are meant to be applied to the database structure.
- *
- * @return bool|MDB2_Error MDB2_OK or error object
- * @access public
- */
- function alterDatabase($current_definition, $previous_definition, $changes)
- {
- $alterations = 0;
- if (empty($changes)) {
- return $alterations;
- }
-
- $result = $this->verifyAlterDatabase($changes);
- if (PEAR::isError($result)) {
- return $result;
- }
-
- if (!empty($current_definition['name'])) {
- $previous_database_name = $this->db->setDatabase($current_definition['name']);
- }
-
- if (($support_transactions = $this->db->supports('transactions'))
- && PEAR::isError($result = $this->db->beginNestedTransaction())
- ) {
- return $result;
- }
-
- if (!empty($changes['tables']) && !empty($current_definition['tables'])) {
- $current_tables = isset($current_definition['tables']) ? $current_definition['tables'] : array();
- $previous_tables = isset($previous_definition['tables']) ? $previous_definition['tables'] : array();
-
- $result = $this->alterDatabaseTables($current_tables, $previous_tables, $changes['tables']);
- if (is_numeric($result)) {
- $alterations += $result;
- }
- }
-
- if (!PEAR::isError($result) && !empty($changes['sequences'])) {
- $current_sequences = isset($current_definition['sequences']) ? $current_definition['sequences'] : array();
- $previous_sequences = isset($previous_definition['sequences']) ? $previous_definition['sequences'] : array();
-
- $result = $this->alterDatabaseSequences($current_sequences, $previous_sequences, $changes['sequences']);
- if (is_numeric($result)) {
- $alterations += $result;
- }
- }
-
- if ($support_transactions) {
- $res = $this->db->completeNestedTransaction();
- if (PEAR::isError($res)) {
- $result = $this->raiseError(MDB2_SCHEMA_ERROR, null, null,
- 'Could not end transaction ('.
- $res->getMessage().' ('.$res->getUserinfo().'))');
- }
- } elseif (PEAR::isError($result) && $alterations) {
- $result = $this->raiseError(MDB2_SCHEMA_ERROR, null, null,
- 'the requested database alterations were only partially implemented ('.
- $result->getMessage().' ('.$result->getUserinfo().'))');
- }
-
- if (isset($previous_database_name)) {
- $this->db->setDatabase($previous_database_name);
- }
- return $result;
- }
-
- // }}}
- // {{{ dumpDatabaseChanges()
-
- /**
- * Dump the changes between two database definitions.
- *
- * @param array $changes associative array that specifies the list of database
- * definitions changes as returned by the _compareDefinitions
- * manager class function.
- *
- * @return bool|MDB2_Error MDB2_OK or error object
- * @access public
- */
- function dumpDatabaseChanges($changes)
- {
- if (!empty($changes['tables'])) {
- if (!empty($changes['tables']['add']) && is_array($changes['tables']['add'])) {
- foreach ($changes['tables']['add'] as $table_name => $table) {
- $this->db->debug("$table_name:", __FUNCTION__);
- $this->db->debug("\tAdded table '$table_name'", __FUNCTION__);
- }
- }
-
- if (!empty($changes['tables']['remove']) && is_array($changes['tables']['remove'])) {
- if ($this->options['drop_obsolete_objects']) {
- foreach ($changes['tables']['remove'] as $table_name => $table) {
- $this->db->debug("$table_name:", __FUNCTION__);
- $this->db->debug("\tRemoved table '$table_name'", __FUNCTION__);
- }
- } else {
- foreach ($changes['tables']['remove'] as $table_name => $table) {
- $this->db->debug("\tObsolete table '$table_name' left as is", __FUNCTION__);
- }
- }
- }
-
- if (!empty($changes['tables']['change']) && is_array($changes['tables']['change'])) {
- foreach ($changes['tables']['change'] as $table_name => $table) {
- if (array_key_exists('name', $table)) {
- $this->db->debug("\tRenamed table '$table_name' to '".$table['name']."'", __FUNCTION__);
- }
- if (!empty($table['add']) && is_array($table['add'])) {
- foreach ($table['add'] as $field_name => $field) {
- $this->db->debug("\tAdded field '".$field_name."'", __FUNCTION__);
- }
- }
- if (!empty($table['remove']) && is_array($table['remove'])) {
- foreach ($table['remove'] as $field_name => $field) {
- $this->db->debug("\tRemoved field '".$field_name."'", __FUNCTION__);
- }
- }
- if (!empty($table['rename']) && is_array($table['rename'])) {
- foreach ($table['rename'] as $field_name => $field) {
- $this->db->debug("\tRenamed field '".$field_name."' to '".$field['name']."'", __FUNCTION__);
- }
- }
- if (!empty($table['change']) && is_array($table['change'])) {
- foreach ($table['change'] as $field_name => $field) {
- $field = $field['definition'];
- if (array_key_exists('type', $field)) {
- $this->db->debug("\tChanged field '$field_name' type to '".$field['type']."'", __FUNCTION__);
- }
-
- if (array_key_exists('unsigned', $field)) {
- $this->db->debug("\tChanged field '$field_name' type to '".
- (!empty($field['unsigned']) && $field['unsigned'] ? '' : 'not ')."unsigned'",
- __FUNCTION__);
- }
-
- if (array_key_exists('length', $field)) {
- $this->db->debug("\tChanged field '$field_name' length to '".
- (!empty($field['length']) ? $field['length']: 'no length')."'", __FUNCTION__);
- }
- if (array_key_exists('default', $field)) {
- $this->db->debug("\tChanged field '$field_name' default to ".
- (isset($field['default']) ? "'".$field['default']."'" : 'NULL'), __FUNCTION__);
- }
-
- if (array_key_exists('notnull', $field)) {
- $this->db->debug("\tChanged field '$field_name' notnull to ".
- (!empty($field['notnull']) && $field['notnull'] ? 'true' : 'false'),
- __FUNCTION__);
- }
- }
- }
- if (!empty($table['indexes']) && is_array($table['indexes'])) {
- if (!empty($table['indexes']['add']) && is_array($table['indexes']['add'])) {
- foreach ($table['indexes']['add'] as $index_name => $index) {
- $this->db->debug("\tAdded index '".$index_name.
- "' of table '$table_name'", __FUNCTION__);
- }
- }
- if (!empty($table['indexes']['remove']) && is_array($table['indexes']['remove'])) {
- foreach ($table['indexes']['remove'] as $index_name => $index) {
- $this->db->debug("\tRemoved index '".$index_name.
- "' of table '$table_name'", __FUNCTION__);
- }
- }
- if (!empty($table['indexes']['change']) && is_array($table['indexes']['change'])) {
- foreach ($table['indexes']['change'] as $index_name => $index) {
- if (array_key_exists('name', $index)) {
- $this->db->debug("\tRenamed index '".$index_name."' to '".$index['name'].
- "' on table '$table_name'", __FUNCTION__);
- }
- if (array_key_exists('unique', $index)) {
- $this->db->debug("\tChanged index '".$index_name."' unique to '".
- !empty($index['unique'])."' on table '$table_name'", __FUNCTION__);
- }
- if (array_key_exists('primary', $index)) {
- $this->db->debug("\tChanged index '".$index_name."' primary to '".
- !empty($index['primary'])."' on table '$table_name'", __FUNCTION__);
- }
- if (array_key_exists('change', $index)) {
- $this->db->debug("\tChanged index '".$index_name.
- "' on table '$table_name'", __FUNCTION__);
- }
- }
- }
- }
- }
- }
- }
- if (!empty($changes['sequences'])) {
- if (!empty($changes['sequences']['add']) && is_array($changes['sequences']['add'])) {
- foreach ($changes['sequences']['add'] as $sequence_name => $sequence) {
- $this->db->debug("$sequence_name:", __FUNCTION__);
- $this->db->debug("\tAdded sequence '$sequence_name'", __FUNCTION__);
- }
- }
- if (!empty($changes['sequences']['remove']) && is_array($changes['sequences']['remove'])) {
- if ($this->options['drop_obsolete_objects']) {
- foreach ($changes['sequences']['remove'] as $sequence_name => $sequence) {
- $this->db->debug("$sequence_name:", __FUNCTION__);
- $this->db->debug("\tRemoved sequence '$sequence_name'", __FUNCTION__);
- }
- } else {
- foreach ($changes['sequences']['remove'] as $sequence_name => $sequence) {
- $this->db->debug("\tObsolete sequence '$sequence_name' left as is", __FUNCTION__);
- }
- }
- }
- if (!empty($changes['sequences']['change']) && is_array($changes['sequences']['change'])) {
- foreach ($changes['sequences']['change'] as $sequence_name => $sequence) {
- if (array_key_exists('name', $sequence)) {
- $this->db->debug("\tRenamed sequence '$sequence_name' to '".
- $sequence['name']."'", __FUNCTION__);
- }
- if (!empty($sequence['change']) && is_array($sequence['change'])) {
- foreach ($sequence['change'] as $sequence_name => $sequence) {
- if (array_key_exists('start', $sequence)) {
- $this->db->debug("\tChanged sequence '$sequence_name' start to '".
- $sequence['start']."'", __FUNCTION__);
- }
- }
- }
- }
- }
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ dumpDatabase()
-
- /**
- * Dump a previously parsed database structure in the Metabase schema
- * XML based format suitable for the Metabase parser. This function
- * may optionally dump the database definition with initialization
- * commands that specify the data that is currently present in the tables.
- *
- * @param array $database_definition multi dimensional array that contains the current definition
- * @param array $arguments associative array that takes pairs of tag
- * names and values that define dump options.
- * <pre>array (
- * 'output_mode' => String
- * 'file' : dump into a file
- * default: dump using a function
- * 'output' => String
- * depending on the 'Output_Mode'
- * name of the file
- * name of the function
- * 'end_of_line' => String
- * end of line delimiter that should be used
- * default: "\n"
- * );</pre>
- * @param int $dump Int that determines what data to dump
- * + MDB2_SCHEMA_DUMP_ALL : the entire db
- * + MDB2_SCHEMA_DUMP_STRUCTURE : only the structure of the db
- * + MDB2_SCHEMA_DUMP_CONTENT : only the content of the db
- *
- * @return bool|MDB2_Error MDB2_OK or error object
- * @access public
- */
- function dumpDatabase($database_definition, $arguments, $dump = MDB2_SCHEMA_DUMP_ALL)
- {
- $class_name = $this->options['writer'];
-
- $result = MDB2::loadClass($class_name, $this->db->getOption('debug'));
- if (PEAR::isError($result)) {
- return $result;
- }
-
- // get initialization data
- if (isset($database_definition['tables']) && is_array($database_definition['tables'])
- && $dump == MDB2_SCHEMA_DUMP_ALL || $dump == MDB2_SCHEMA_DUMP_CONTENT
- ) {
- foreach ($database_definition['tables'] as $table_name => $table) {
- $fields = array();
- $fieldsq = array();
- foreach ($table['fields'] as $field_name => $field) {
- $fields[$field_name] = $field['type'];
-
- $fieldsq[] = $this->db->quoteIdentifier($field_name, true);
- }
-
- $query = 'SELECT '.implode(', ', $fieldsq).' FROM ';
- $query .= $this->db->quoteIdentifier($table_name, true);
-
- $data = $this->db->queryAll($query, $fields, MDB2_FETCHMODE_ASSOC);
-
- if (PEAR::isError($data)) {
- return $data;
- }
-
- if (!empty($data)) {
- $initialization = array();
- $lob_buffer_length = $this->db->getOption('lob_buffer_length');
- foreach ($data as $row) {
- $rows = array();
- foreach ($row as $key => $lob) {
- if (is_resource($lob)) {
- $value = '';
- while (!feof($lob)) {
- $value .= fread($lob, $lob_buffer_length);
- }
- $row[$key] = $value;
- }
- $rows[] = array('name' => $key, 'group' => array('type' => 'value', 'data' => $row[$key]));
- }
- $initialization[] = array('type' => 'insert', 'data' => array('field' => $rows));
- }
- $database_definition['tables'][$table_name]['initialization'] = $initialization;
- }
- }
- }
-
- $writer = new $class_name($this->options['valid_types']);
- return $writer->dumpDatabase($database_definition, $arguments, $dump);
- }
-
- // }}}
- // {{{ writeInitialization()
-
- /**
- * Write initialization and sequences
- *
- * @param string|array $data data file or data array
- * @param string|array $structure structure file or array
- * @param array $variables associative array that is passed to the argument
- * of the same name to the parseDatabaseDefinitionFile function. (there third
- * param)
- *
- * @return bool|MDB2_Error MDB2_OK or error object
- * @access public
- */
- function writeInitialization($data, $structure = false, $variables = array())
- {
- if ($structure) {
- $structure = $this->parseDatabaseDefinition($structure, false, $variables);
- if (PEAR::isError($structure)) {
- return $structure;
- }
- }
-
- $data = $this->parseDatabaseDefinition($data, false, $variables, false, $structure);
- if (PEAR::isError($data)) {
- return $data;
- }
-
- $previous_database_name = null;
- if (!empty($data['name'])) {
- $previous_database_name = $this->db->setDatabase($data['name']);
- } elseif (!empty($structure['name'])) {
- $previous_database_name = $this->db->setDatabase($structure['name']);
- }
-
- if (!empty($data['tables']) && is_array($data['tables'])) {
- foreach ($data['tables'] as $table_name => $table) {
- if (empty($table['initialization'])) {
- continue;
- }
- $result = $this->initializeTable($table_name, $table);
- if (PEAR::isError($result)) {
- return $result;
- }
- }
- }
-
- if (!empty($structure['sequences']) && is_array($structure['sequences'])) {
- foreach ($structure['sequences'] as $sequence_name => $sequence) {
- if (isset($data['sequences'][$sequence_name])
- || !isset($sequence['on']['table'])
- || !isset($data['tables'][$sequence['on']['table']])
- ) {
- continue;
- }
- $result = $this->createSequence($sequence_name, $sequence, true);
- if (PEAR::isError($result)) {
- return $result;
- }
- }
- }
- if (!empty($data['sequences']) && is_array($data['sequences'])) {
- foreach ($data['sequences'] as $sequence_name => $sequence) {
- $result = $this->createSequence($sequence_name, $sequence, true);
- if (PEAR::isError($result)) {
- return $result;
- }
- }
- }
-
- if (isset($previous_database_name)) {
- $this->db->setDatabase($previous_database_name);
- }
-
- return MDB2_OK;
- }
-
- // }}}
- // {{{ updateDatabase()
-
- /**
- * Compare the correspondent files of two versions of a database schema
- * definition: the previously installed and the one that defines the schema
- * that is meant to update the database.
- * If the specified previous definition file does not exist, this function
- * will create the database from the definition specified in the current
- * schema file.
- * If both files exist, the function assumes that the database was previously
- * installed based on the previous schema file and will update it by just
- * applying the changes.
- * If this function succeeds, the contents of the current schema file are
- * copied to replace the previous schema file contents. Any subsequent schema
- * changes should only be done on the file specified by the $current_schema_file
- * to let this function make a consistent evaluation of the exact changes that
- * need to be applied.
- *
- * @param string|array $current_schema filename or array of the updated database schema definition.
- * @param string|array $previous_schema filename or array of the previously installed database schema definition.
- * @param array $variables associative array that is passed to the argument of the same
- * name to the parseDatabaseDefinitionFile function. (there third param)
- * @param bool $disable_query determines if the disable_query option should be set to true
- * for the alterDatabase() or createDatabase() call
- * @param bool $overwrite_old_schema_file Overwrite?
- *
- * @return bool|MDB2_Error MDB2_OK or error object
- * @access public
- */
- function updateDatabase($current_schema, $previous_schema = false,
- $variables = array(), $disable_query = false,
- $overwrite_old_schema_file = false)
- {
- $current_definition = $this->parseDatabaseDefinition($current_schema, false, $variables,
- $this->options['fail_on_invalid_names']);
-
- if (PEAR::isError($current_definition)) {
- return $current_definition;
- }
-
- $previous_definition = false;
- if ($previous_schema) {
- $previous_definition = $this->parseDatabaseDefinition($previous_schema, true, $variables,
- $this->options['fail_on_invalid_names']);
- if (PEAR::isError($previous_definition)) {
- return $previous_definition;
- }
- }
-
- if ($previous_definition) {
- $dbExists = $this->db->databaseExists($current_definition['name']);
- if (PEAR::isError($dbExists)) {
- return $dbExists;
- }
-
- if (!$dbExists) {
- return $this->raiseError(MDB2_SCHEMA_ERROR, null, null,
- 'database to update does not exist: '.$current_definition['name']);
- }
-
- $changes = $this->compareDefinitions($current_definition, $previous_definition);
- if (PEAR::isError($changes)) {
- return $changes;
- }
-
- if (is_array($changes)) {
- $this->db->setOption('disable_query', $disable_query);
- $result = $this->alterDatabase($current_definition, $previous_definition, $changes);
- $this->db->setOption('disable_query', false);
- if (PEAR::isError($result)) {
- return $result;
- }
- $copy = true;
- if ($this->db->options['debug']) {
- $result = $this->dumpDatabaseChanges($changes);
- if (PEAR::isError($result)) {
- return $result;
- }
- }
- }
- } else {
- $this->db->setOption('disable_query', $disable_query);
- $result = $this->createDatabase($current_definition);
- $this->db->setOption('disable_query', false);
- if (PEAR::isError($result)) {
- return $result;
- }
- }
-
- if ($overwrite_old_schema_file
- && !$disable_query
- && is_string($previous_schema) && is_string($current_schema)
- && !copy($current_schema, $previous_schema)) {
-
- return $this->raiseError(MDB2_SCHEMA_ERROR, null, null,
- 'Could not copy the new database definition file to the current file');
- }
-
- return MDB2_OK;
- }
- // }}}
- // {{{ errorMessage()
-
- /**
- * Return a textual error message for a MDB2 error code
- *
- * @param int|array $value integer error code, <code>null</code> to get the
- * current error code-message map,
- * or an array with a new error code-message map
- *
- * @return string error message, or false if the error code was not recognized
- * @access public
- */
- function errorMessage($value = null)
- {
- static $errorMessages;
- if (is_array($value)) {
- $errorMessages = $value;
- return MDB2_OK;
- } elseif (!isset($errorMessages)) {
- $errorMessages = array(
- MDB2_SCHEMA_ERROR => 'unknown error',
- MDB2_SCHEMA_ERROR_PARSE => 'schema parse error',
- MDB2_SCHEMA_ERROR_VALIDATE => 'schema validation error',
- MDB2_SCHEMA_ERROR_INVALID => 'invalid',
- MDB2_SCHEMA_ERROR_UNSUPPORTED => 'not supported',
- MDB2_SCHEMA_ERROR_WRITER => 'schema writer error',
- );
- }
-
- if (is_null($value)) {
- return $errorMessages;
- }
-
- if (PEAR::isError($value)) {
- $value = $value->getCode();
- }
-
- return !empty($errorMessages[$value]) ?
- $errorMessages[$value] : $errorMessages[MDB2_SCHEMA_ERROR];
- }
-
- // }}}
- // {{{ raiseError()
-
- /**
- * This method is used to communicate an error and invoke error
- * callbacks etc. Basically a wrapper for PEAR::raiseError
- * without the message string.
- *
- * @param int|PEAR_Error $code integer error code or and PEAR_Error instance
- * @param int $mode error mode, see PEAR_Error docs
- * error level (E_USER_NOTICE etc). If error mode is
- * PEAR_ERROR_CALLBACK, this is the callback function,
- * either as a function name, or as an array of an
- * object and method name. For other error modes this
- * parameter is ignored.
- * @param array $options Options, depending on the mode, @see PEAR::setErrorHandling
- * @param string $userinfo Extra debug information. Defaults to the last
- * query and native error code.
- *
- * @return object a PEAR error object
- * @access public
- * @see PEAR_Error
- */
- static function &raiseError($code = null, $mode = null, $options = null, $userinfo = null, $dummy1 = null, $dummy2 = null, $dummy3 = false)
- {
- $err = PEAR::raiseError(null, $code, $mode, $options,
- $userinfo, 'MDB2_Schema_Error', true);
- return $err;
- }
-
- // }}}
- // {{{ isError()
-
- /**
- * Tell whether a value is an MDB2_Schema error.
- *
- * @param mixed $data the value to test
- * @param int $code if $data is an error object, return true only if $code is
- * a string and $db->getMessage() == $code or
- * $code is an integer and $db->getCode() == $code
- *
- * @return bool true if parameter is an error
- * @access public
- */
- static function isError($data, $code = null)
- {
- if (is_a($data, 'MDB2_Schema_Error')) {
- if (is_null($code)) {
- return true;
- } elseif (is_string($code)) {
- return $data->getMessage() === $code;
- } else {
- $code = (array)$code;
- return in_array($data->getCode(), $code);
- }
- }
- return false;
- }
-
- // }}}
-}
-
-/**
- * MDB2_Schema_Error implements a class for reporting portable database error
- * messages.
- *
- * @category Database
- * @package MDB2_Schema
- * @author Stig Bakken <ssb@fast.no>
- * @license BSD http://www.opensource.org/licenses/bsd-license.php
- * @link http://pear.php.net/packages/MDB2_Schema
- */
-class MDB2_Schema_Error extends PEAR_Error
-{
- /**
- * MDB2_Schema_Error constructor.
- *
- * @param mixed $code error code, or string with error message.
- * @param int $mode what 'error mode' to operate in
- * @param int $level what error level to use for $mode & PEAR_ERROR_TRIGGER
- * @param mixed $debuginfo additional debug info, such as the last query
- *
- * @access public
- */
- function MDB2_Schema_Error($code = MDB2_SCHEMA_ERROR, $mode = PEAR_ERROR_RETURN,
- $level = E_USER_NOTICE, $debuginfo = null)
- {
- $this->PEAR_Error('MDB2_Schema Error: ' . MDB2_Schema::errorMessage($code), $code,
- $mode, $level, $debuginfo);
- }
-}
diff --git a/3rdparty/MDB2/Schema/Parser.php b/3rdparty/MDB2/Schema/Parser.php
deleted file mode 100644
index 3c4345661b1..00000000000
--- a/3rdparty/MDB2/Schema/Parser.php
+++ /dev/null
@@ -1,876 +0,0 @@
-<?php /* vim: se et ts=4 sw=4 sts=4 fdm=marker tw=80: */
-/**
- * Copyright (c) 1998-2010 Manuel Lemos, Tomas V.V.Cox,
- * Stig. S. Bakken, Lukas Smith, Igor Feghali
- * All rights reserved.
- *
- * MDB2_Schema enables users to maintain RDBMS independant schema files
- * in XML that can be used to manipulate both data and database schemas
- * This LICENSE is in the BSD license style.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,
- * Lukas Smith, Igor Feghali nor the names of his contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
- * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * PHP version 5
- *
- * @category Database
- * @package MDB2_Schema
- * @author Christian Dickmann <dickmann@php.net>
- * @author Igor Feghali <ifeghali@php.net>
- * @license BSD http://www.opensource.org/licenses/bsd-license.php
- * @version SVN: $Id$
- * @link http://pear.php.net/packages/MDB2_Schema
- */
-
-require_once 'XML/Parser.php';
-require_once 'MDB2/Schema/Validate.php';
-
-/**
- * Parses an XML schema file
- *
- * @category Database
- * @package MDB2_Schema
- * @author Christian Dickmann <dickmann@php.net>
- * @license BSD http://www.opensource.org/licenses/bsd-license.php
- * @link http://pear.php.net/packages/MDB2_Schema
- */
-class MDB2_Schema_Parser extends XML_Parser
-{
- var $database_definition = array();
-
- var $elements = array();
-
- var $element = '';
-
- var $count = 0;
-
- var $table = array();
-
- var $table_name = '';
-
- var $field = array();
-
- var $field_name = '';
-
- var $init = array();
-
- var $init_function = array();
-
- var $init_expression = array();
-
- var $init_field = array();
-
- var $index = array();
-
- var $index_name = '';
-
- var $constraint = array();
-
- var $constraint_name = '';
-
- var $var_mode = false;
-
- var $variables = array();
-
- var $sequence = array();
-
- var $sequence_name = '';
-
- var $error;
-
- var $structure = false;
-
- var $val;
-
- /**
- * PHP 5 constructor
- *
- * @param array $variables mixed array with user defined schema
- * variables
- * @param bool $fail_on_invalid_names array with reserved words per RDBMS
- * @param array $structure multi dimensional array with
- * database schema and data
- * @param array $valid_types information of all valid fields
- * types
- * @param bool $force_defaults if true sets a default value to
- * field when not explicit
- * @param int $max_identifiers_length maximum allowed size for entities
- * name
- *
- * @return void
- *
- * @access public
- * @static
- */
- function __construct($variables, $fail_on_invalid_names = true,
- $structure = false, $valid_types = array(), $force_defaults = true,
- $max_identifiers_length = null
- ) {
- // force ISO-8859-1 due to different defaults for PHP4 and PHP5
- // todo: this probably needs to be investigated some more andcleaned up
- parent::__construct('ISO-8859-1');
-
- $this->variables = $variables;
- $this->structure = $structure;
- $this->val = new MDB2_Schema_Validate(
- $fail_on_invalid_names,
- $valid_types,
- $force_defaults,
- $max_identifiers_length
- );
- }
-
- /**
- * Triggered when reading a XML open tag <element>
- *
- * @param resource $xp xml parser resource
- * @param string $element element name
- * @param array $attribs attributes
- *
- * @return void
- * @access private
- * @static
- */
- function startHandler($xp, $element, &$attribs)
- {
- if (strtolower($element) == 'variable') {
- $this->var_mode = true;
- return;
- }
-
- $this->elements[$this->count++] = strtolower($element);
-
- $this->element = implode('-', $this->elements);
-
- switch ($this->element) {
- /* Initialization */
- case 'database-table-initialization':
- $this->table['initialization'] = array();
- break;
-
- /* Insert */
- /* insert: field+ */
- case 'database-table-initialization-insert':
- $this->init = array('type' => 'insert', 'data' => array('field' => array()));
- break;
- /* insert-select: field+, table, where? */
- case 'database-table-initialization-insert-select':
- $this->init['data']['table'] = '';
- break;
-
- /* Update */
- /* update: field+, where? */
- case 'database-table-initialization-update':
- $this->init = array('type' => 'update', 'data' => array('field' => array()));
- break;
-
- /* Delete */
- /* delete: where */
- case 'database-table-initialization-delete':
- $this->init = array('type' => 'delete', 'data' => array('where' => array()));
- break;
-
- /* Insert and Update */
- case 'database-table-initialization-insert-field':
- case 'database-table-initialization-insert-select-field':
- case 'database-table-initialization-update-field':
- $this->init_field = array('name' => '', 'group' => array());
- break;
- case 'database-table-initialization-insert-field-value':
- case 'database-table-initialization-insert-select-field-value':
- case 'database-table-initialization-update-field-value':
- /* if value tag is empty cdataHandler is not called so we must force value element creation here */
- $this->init_field['group'] = array('type' => 'value', 'data' => '');
- break;
- case 'database-table-initialization-insert-field-null':
- case 'database-table-initialization-insert-select-field-null':
- case 'database-table-initialization-update-field-null':
- $this->init_field['group'] = array('type' => 'null');
- break;
- case 'database-table-initialization-insert-field-function':
- case 'database-table-initialization-insert-select-field-function':
- case 'database-table-initialization-update-field-function':
- $this->init_function = array('name' => '');
- break;
- case 'database-table-initialization-insert-field-expression':
- case 'database-table-initialization-insert-select-field-expression':
- case 'database-table-initialization-update-field-expression':
- $this->init_expression = array();
- break;
-
- /* All */
- case 'database-table-initialization-insert-select-where':
- case 'database-table-initialization-update-where':
- case 'database-table-initialization-delete-where':
- $this->init['data']['where'] = array('type' => '', 'data' => array());
- break;
- case 'database-table-initialization-insert-select-where-expression':
- case 'database-table-initialization-update-where-expression':
- case 'database-table-initialization-delete-where-expression':
- $this->init_expression = array();
- break;
-
- /* One level simulation of expression-function recursion */
- case 'database-table-initialization-insert-field-expression-function':
- case 'database-table-initialization-insert-select-field-expression-function':
- case 'database-table-initialization-insert-select-where-expression-function':
- case 'database-table-initialization-update-field-expression-function':
- case 'database-table-initialization-update-where-expression-function':
- case 'database-table-initialization-delete-where-expression-function':
- $this->init_function = array('name' => '');
- break;
-
- /* One level simulation of function-expression recursion */
- case 'database-table-initialization-insert-field-function-expression':
- case 'database-table-initialization-insert-select-field-function-expression':
- case 'database-table-initialization-insert-select-where-function-expression':
- case 'database-table-initialization-update-field-function-expression':
- case 'database-table-initialization-update-where-function-expression':
- case 'database-table-initialization-delete-where-function-expression':
- $this->init_expression = array();
- break;
-
- /* Definition */
- case 'database':
- $this->database_definition = array(
- 'name' => '',
- 'create' => '',
- 'overwrite' => '',
- 'charset' => '',
- 'description' => '',
- 'comments' => '',
- 'tables' => array(),
- 'sequences' => array()
- );
- break;
- case 'database-table':
- $this->table_name = '';
-
- $this->table = array(
- 'was' => '',
- 'description' => '',
- 'comments' => '',
- 'fields' => array(),
- 'indexes' => array(),
- 'constraints' => array(),
- 'initialization' => array()
- );
- break;
- case 'database-table-declaration-field':
- case 'database-table-declaration-foreign-field':
- case 'database-table-declaration-foreign-references-field':
- $this->field_name = '';
-
- $this->field = array();
- break;
- case 'database-table-declaration-index-field':
- $this->field_name = '';
-
- $this->field = array('sorting' => '', 'length' => '');
- break;
- /* force field attributes to be initialized when the tag is empty in the XML */
- case 'database-table-declaration-field-was':
- $this->field['was'] = '';
- break;
- case 'database-table-declaration-field-type':
- $this->field['type'] = '';
- break;
- case 'database-table-declaration-field-fixed':
- $this->field['fixed'] = '';
- break;
- case 'database-table-declaration-field-default':
- $this->field['default'] = '';
- break;
- case 'database-table-declaration-field-notnull':
- $this->field['notnull'] = '';
- break;
- case 'database-table-declaration-field-autoincrement':
- $this->field['autoincrement'] = '';
- break;
- case 'database-table-declaration-field-unsigned':
- $this->field['unsigned'] = '';
- break;
- case 'database-table-declaration-field-length':
- $this->field['length'] = '';
- break;
- case 'database-table-declaration-field-description':
- $this->field['description'] = '';
- break;
- case 'database-table-declaration-field-comments':
- $this->field['comments'] = '';
- break;
- case 'database-table-declaration-index':
- $this->index_name = '';
-
- $this->index = array(
- 'was' => '',
- 'unique' =>'',
- 'primary' => '',
- 'fields' => array()
- );
- break;
- case 'database-table-declaration-foreign':
- $this->constraint_name = '';
-
- $this->constraint = array(
- 'was' => '',
- 'match' => '',
- 'ondelete' => '',
- 'onupdate' => '',
- 'deferrable' => '',
- 'initiallydeferred' => '',
- 'foreign' => true,
- 'fields' => array(),
- 'references' => array('table' => '', 'fields' => array())
- );
- break;
- case 'database-sequence':
- $this->sequence_name = '';
-
- $this->sequence = array(
- 'was' => '',
- 'start' => '',
- 'description' => '',
- 'comments' => '',
- );
- break;
- }
- }
-
- /**
- * Triggered when reading a XML close tag </element>
- *
- * @param resource $xp xml parser resource
- * @param string $element element name
- *
- * @return void
- * @access private
- * @static
- */
- function endHandler($xp, $element)
- {
- if (strtolower($element) == 'variable') {
- $this->var_mode = false;
- return;
- }
-
- switch ($this->element) {
- /* Initialization */
-
- /* Insert */
- case 'database-table-initialization-insert-select':
- $this->init['data'] = array('select' => $this->init['data']);
- break;
-
- /* Insert and Delete */
- case 'database-table-initialization-insert-field':
- case 'database-table-initialization-insert-select-field':
- case 'database-table-initialization-update-field':
- $result = $this->val->validateDataField($this->table['fields'], $this->init['data']['field'], $this->init_field);
- if (PEAR::isError($result)) {
- $this->raiseError($result->getUserinfo(), 0, $xp, $result->getCode());
- } else {
- $this->init['data']['field'][] = $this->init_field;
- }
- break;
- case 'database-table-initialization-insert-field-function':
- case 'database-table-initialization-insert-select-field-function':
- case 'database-table-initialization-update-field-function':
- $this->init_field['group'] = array('type' => 'function', 'data' => $this->init_function);
- break;
- case 'database-table-initialization-insert-field-expression':
- case 'database-table-initialization-insert-select-field-expression':
- case 'database-table-initialization-update-field-expression':
- $this->init_field['group'] = array('type' => 'expression', 'data' => $this->init_expression);
- break;
-
- /* All */
- case 'database-table-initialization-insert-select-where-expression':
- case 'database-table-initialization-update-where-expression':
- case 'database-table-initialization-delete-where-expression':
- $this->init['data']['where']['type'] = 'expression';
- $this->init['data']['where']['data'] = $this->init_expression;
- break;
- case 'database-table-initialization-insert':
- case 'database-table-initialization-delete':
- case 'database-table-initialization-update':
- $this->table['initialization'][] = $this->init;
- break;
-
- /* One level simulation of expression-function recursion */
- case 'database-table-initialization-insert-field-expression-function':
- case 'database-table-initialization-insert-select-field-expression-function':
- case 'database-table-initialization-insert-select-where-expression-function':
- case 'database-table-initialization-update-field-expression-function':
- case 'database-table-initialization-update-where-expression-function':
- case 'database-table-initialization-delete-where-expression-function':
- $this->init_expression['operants'][] = array('type' => 'function', 'data' => $this->init_function);
- break;
-
- /* One level simulation of function-expression recursion */
- case 'database-table-initialization-insert-field-function-expression':
- case 'database-table-initialization-insert-select-field-function-expression':
- case 'database-table-initialization-insert-select-where-function-expression':
- case 'database-table-initialization-update-field-function-expression':
- case 'database-table-initialization-update-where-function-expression':
- case 'database-table-initialization-delete-where-function-expression':
- $this->init_function['arguments'][] = array('type' => 'expression', 'data' => $this->init_expression);
- break;
-
- /* Table definition */
- case 'database-table':
- $result = $this->val->validateTable($this->database_definition['tables'], $this->table, $this->table_name);
- if (PEAR::isError($result)) {
- $this->raiseError($result->getUserinfo(), 0, $xp, $result->getCode());
- } else {
- $this->database_definition['tables'][$this->table_name] = $this->table;
- }
- break;
- case 'database-table-name':
- if (isset($this->structure['tables'][$this->table_name])) {
- $this->table = $this->structure['tables'][$this->table_name];
- }
- break;
-
- /* Field declaration */
- case 'database-table-declaration-field':
- $result = $this->val->validateField($this->table['fields'], $this->field, $this->field_name);
- if (PEAR::isError($result)) {
- $this->raiseError($result->getUserinfo(), 0, $xp, $result->getCode());
- } else {
- $this->table['fields'][$this->field_name] = $this->field;
- }
- break;
-
- /* Index declaration */
- case 'database-table-declaration-index':
- $result = $this->val->validateIndex($this->table['indexes'], $this->index, $this->index_name);
- if (PEAR::isError($result)) {
- $this->raiseError($result->getUserinfo(), 0, $xp, $result->getCode());
- } else {
- $this->table['indexes'][$this->index_name] = $this->index;
- }
- break;
- case 'database-table-declaration-index-field':
- $result = $this->val->validateIndexField($this->index['fields'], $this->field, $this->field_name);
- if (PEAR::isError($result)) {
- $this->raiseError($result->getUserinfo(), 0, $xp, $result->getCode());
- } else {
- $this->index['fields'][$this->field_name] = $this->field;
- }
- break;
-
- /* Foreign Key declaration */
- case 'database-table-declaration-foreign':
- $result = $this->val->validateConstraint($this->table['constraints'], $this->constraint, $this->constraint_name);
- if (PEAR::isError($result)) {
- $this->raiseError($result->getUserinfo(), 0, $xp, $result->getCode());
- } else {
- $this->table['constraints'][$this->constraint_name] = $this->constraint;
- }
- break;
- case 'database-table-declaration-foreign-field':
- $result = $this->val->validateConstraintField($this->constraint['fields'], $this->field_name);
- if (PEAR::isError($result)) {
- $this->raiseError($result->getUserinfo(), 0, $xp, $result->getCode());
- } else {
- $this->constraint['fields'][$this->field_name] = '';
- }
- break;
- case 'database-table-declaration-foreign-references-field':
- $result = $this->val->validateConstraintReferencedField($this->constraint['references']['fields'], $this->field_name);
- if (PEAR::isError($result)) {
- $this->raiseError($result->getUserinfo(), 0, $xp, $result->getCode());
- } else {
- $this->constraint['references']['fields'][$this->field_name] = '';
- }
- break;
-
- /* Sequence declaration */
- case 'database-sequence':
- $result = $this->val->validateSequence($this->database_definition['sequences'], $this->sequence, $this->sequence_name);
- if (PEAR::isError($result)) {
- $this->raiseError($result->getUserinfo(), 0, $xp, $result->getCode());
- } else {
- $this->database_definition['sequences'][$this->sequence_name] = $this->sequence;
- }
- break;
-
- /* End of File */
- case 'database':
- $result = $this->val->validateDatabase($this->database_definition);
- if (PEAR::isError($result)) {
- $this->raiseError($result->getUserinfo(), 0, $xp, $result->getCode());
- }
- break;
- }
-
- unset($this->elements[--$this->count]);
- $this->element = implode('-', $this->elements);
- }
-
- /**
- * Pushes a MDB2_Schema_Error into stack and returns it
- *
- * @param string $msg textual message
- * @param int $xmlecode PHP's XML parser error code
- * @param resource $xp xml parser resource
- * @param int $ecode MDB2_Schema's error code
- *
- * @return object
- * @access private
- * @static
- */
- static function &raiseError($msg = null, $xmlecode = 0, $xp = null, $ecode = MDB2_SCHEMA_ERROR_PARSE, $userinfo = null,
- $error_class = null,
- $skipmsg = false)
- {
- if (is_null($this->error)) {
- $error = '';
- if (is_resource($msg)) {
- $error .= 'Parser error: '.xml_error_string(xml_get_error_code($msg));
- $xp = $msg;
- } else {
- $error .= 'Parser error: '.$msg;
- if (!is_resource($xp)) {
- $xp = $this->parser;
- }
- }
-
- if ($error_string = xml_error_string($xmlecode)) {
- $error .= ' - '.$error_string;
- }
-
- if (is_resource($xp)) {
- $byte = @xml_get_current_byte_index($xp);
- $line = @xml_get_current_line_number($xp);
- $column = @xml_get_current_column_number($xp);
- $error .= " - Byte: $byte; Line: $line; Col: $column";
- }
-
- $error .= "\n";
-
- $this->error = MDB2_Schema::raiseError($ecode, null, null, $error);
- }
- return $this->error;
- }
-
- /**
- * Triggered when reading data in a XML element (text between tags)
- *
- * @param resource $xp xml parser resource
- * @param string $data text
- *
- * @return void
- * @access private
- * @static
- */
- function cdataHandler($xp, $data)
- {
- if ($this->var_mode == true) {
- if (!isset($this->variables[$data])) {
- $this->raiseError('variable "'.$data.'" not found', null, $xp);
- return;
- }
- $data = $this->variables[$data];
- }
-
- switch ($this->element) {
- /* Initialization */
-
- /* Insert */
- case 'database-table-initialization-insert-select-table':
- $this->init['data']['table'] = $data;
- break;
-
- /* Insert and Update */
- case 'database-table-initialization-insert-field-name':
- case 'database-table-initialization-insert-select-field-name':
- case 'database-table-initialization-update-field-name':
- $this->init_field['name'] .= $data;
- break;
- case 'database-table-initialization-insert-field-value':
- case 'database-table-initialization-insert-select-field-value':
- case 'database-table-initialization-update-field-value':
- $this->init_field['group']['data'] .= $data;
- break;
- case 'database-table-initialization-insert-field-function-name':
- case 'database-table-initialization-insert-select-field-function-name':
- case 'database-table-initialization-update-field-function-name':
- $this->init_function['name'] .= $data;
- break;
- case 'database-table-initialization-insert-field-function-value':
- case 'database-table-initialization-insert-select-field-function-value':
- case 'database-table-initialization-update-field-function-value':
- $this->init_function['arguments'][] = array('type' => 'value', 'data' => $data);
- break;
- case 'database-table-initialization-insert-field-function-column':
- case 'database-table-initialization-insert-select-field-function-column':
- case 'database-table-initialization-update-field-function-column':
- $this->init_function['arguments'][] = array('type' => 'column', 'data' => $data);
- break;
- case 'database-table-initialization-insert-field-column':
- case 'database-table-initialization-insert-select-field-column':
- case 'database-table-initialization-update-field-column':
- $this->init_field['group'] = array('type' => 'column', 'data' => $data);
- break;
-
- /* All */
- case 'database-table-initialization-insert-field-expression-operator':
- case 'database-table-initialization-insert-select-field-expression-operator':
- case 'database-table-initialization-insert-select-where-expression-operator':
- case 'database-table-initialization-update-field-expression-operator':
- case 'database-table-initialization-update-where-expression-operator':
- case 'database-table-initialization-delete-where-expression-operator':
- $this->init_expression['operator'] = $data;
- break;
- case 'database-table-initialization-insert-field-expression-value':
- case 'database-table-initialization-insert-select-field-expression-value':
- case 'database-table-initialization-insert-select-where-expression-value':
- case 'database-table-initialization-update-field-expression-value':
- case 'database-table-initialization-update-where-expression-value':
- case 'database-table-initialization-delete-where-expression-value':
- $this->init_expression['operants'][] = array('type' => 'value', 'data' => $data);
- break;
- case 'database-table-initialization-insert-field-expression-column':
- case 'database-table-initialization-insert-select-field-expression-column':
- case 'database-table-initialization-insert-select-where-expression-column':
- case 'database-table-initialization-update-field-expression-column':
- case 'database-table-initialization-update-where-expression-column':
- case 'database-table-initialization-delete-where-expression-column':
- $this->init_expression['operants'][] = array('type' => 'column', 'data' => $data);
- break;
-
- case 'database-table-initialization-insert-field-function-function':
- case 'database-table-initialization-insert-field-function-expression':
- case 'database-table-initialization-insert-field-expression-expression':
- case 'database-table-initialization-update-field-function-function':
- case 'database-table-initialization-update-field-function-expression':
- case 'database-table-initialization-update-field-expression-expression':
- case 'database-table-initialization-update-where-expression-expression':
- case 'database-table-initialization-delete-where-expression-expression':
- /* Recursion to be implemented yet */
- break;
-
- /* One level simulation of expression-function recursion */
- case 'database-table-initialization-insert-field-expression-function-name':
- case 'database-table-initialization-insert-select-field-expression-function-name':
- case 'database-table-initialization-insert-select-where-expression-function-name':
- case 'database-table-initialization-update-field-expression-function-name':
- case 'database-table-initialization-update-where-expression-function-name':
- case 'database-table-initialization-delete-where-expression-function-name':
- $this->init_function['name'] .= $data;
- break;
- case 'database-table-initialization-insert-field-expression-function-value':
- case 'database-table-initialization-insert-select-field-expression-function-value':
- case 'database-table-initialization-insert-select-where-expression-function-value':
- case 'database-table-initialization-update-field-expression-function-value':
- case 'database-table-initialization-update-where-expression-function-value':
- case 'database-table-initialization-delete-where-expression-function-value':
- $this->init_function['arguments'][] = array('type' => 'value', 'data' => $data);
- break;
- case 'database-table-initialization-insert-field-expression-function-column':
- case 'database-table-initialization-insert-select-field-expression-function-column':
- case 'database-table-initialization-insert-select-where-expression-function-column':
- case 'database-table-initialization-update-field-expression-function-column':
- case 'database-table-initialization-update-where-expression-function-column':
- case 'database-table-initialization-delete-where-expression-function-column':
- $this->init_function['arguments'][] = array('type' => 'column', 'data' => $data);
- break;
-
- /* One level simulation of function-expression recursion */
- case 'database-table-initialization-insert-field-function-expression-operator':
- case 'database-table-initialization-insert-select-field-function-expression-operator':
- case 'database-table-initialization-update-field-function-expression-operator':
- $this->init_expression['operator'] = $data;
- break;
- case 'database-table-initialization-insert-field-function-expression-value':
- case 'database-table-initialization-insert-select-field-function-expression-value':
- case 'database-table-initialization-update-field-function-expression-value':
- $this->init_expression['operants'][] = array('type' => 'value', 'data' => $data);
- break;
- case 'database-table-initialization-insert-field-function-expression-column':
- case 'database-table-initialization-insert-select-field-function-expression-column':
- case 'database-table-initialization-update-field-function-expression-column':
- $this->init_expression['operants'][] = array('type' => 'column', 'data' => $data);
- break;
-
- /* Database */
- case 'database-name':
- $this->database_definition['name'] .= $data;
- break;
- case 'database-create':
- $this->database_definition['create'] .= $data;
- break;
- case 'database-overwrite':
- $this->database_definition['overwrite'] .= $data;
- break;
- case 'database-charset':
- $this->database_definition['charset'] .= $data;
- break;
- case 'database-description':
- $this->database_definition['description'] .= $data;
- break;
- case 'database-comments':
- $this->database_definition['comments'] .= $data;
- break;
-
- /* Table declaration */
- case 'database-table-name':
- $this->table_name .= $data;
- break;
- case 'database-table-was':
- $this->table['was'] .= $data;
- break;
- case 'database-table-description':
- $this->table['description'] .= $data;
- break;
- case 'database-table-comments':
- $this->table['comments'] .= $data;
- break;
-
- /* Field declaration */
- case 'database-table-declaration-field-name':
- $this->field_name .= $data;
- break;
- case 'database-table-declaration-field-was':
- $this->field['was'] .= $data;
- break;
- case 'database-table-declaration-field-type':
- $this->field['type'] .= $data;
- break;
- case 'database-table-declaration-field-fixed':
- $this->field['fixed'] .= $data;
- break;
- case 'database-table-declaration-field-default':
- $this->field['default'] .= $data;
- break;
- case 'database-table-declaration-field-notnull':
- $this->field['notnull'] .= $data;
- break;
- case 'database-table-declaration-field-autoincrement':
- $this->field['autoincrement'] .= $data;
- break;
- case 'database-table-declaration-field-unsigned':
- $this->field['unsigned'] .= $data;
- break;
- case 'database-table-declaration-field-length':
- $this->field['length'] .= $data;
- break;
- case 'database-table-declaration-field-description':
- $this->field['description'] .= $data;
- break;
- case 'database-table-declaration-field-comments':
- $this->field['comments'] .= $data;
- break;
-
- /* Index declaration */
- case 'database-table-declaration-index-name':
- $this->index_name .= $data;
- break;
- case 'database-table-declaration-index-was':
- $this->index['was'] .= $data;
- break;
- case 'database-table-declaration-index-unique':
- $this->index['unique'] .= $data;
- break;
- case 'database-table-declaration-index-primary':
- $this->index['primary'] .= $data;
- break;
- case 'database-table-declaration-index-field-name':
- $this->field_name .= $data;
- break;
- case 'database-table-declaration-index-field-sorting':
- $this->field['sorting'] .= $data;
- break;
- /* Add by Leoncx */
- case 'database-table-declaration-index-field-length':
- $this->field['length'] .= $data;
- break;
-
- /* Foreign Key declaration */
- case 'database-table-declaration-foreign-name':
- $this->constraint_name .= $data;
- break;
- case 'database-table-declaration-foreign-was':
- $this->constraint['was'] .= $data;
- break;
- case 'database-table-declaration-foreign-match':
- $this->constraint['match'] .= $data;
- break;
- case 'database-table-declaration-foreign-ondelete':
- $this->constraint['ondelete'] .= $data;
- break;
- case 'database-table-declaration-foreign-onupdate':
- $this->constraint['onupdate'] .= $data;
- break;
- case 'database-table-declaration-foreign-deferrable':
- $this->constraint['deferrable'] .= $data;
- break;
- case 'database-table-declaration-foreign-initiallydeferred':
- $this->constraint['initiallydeferred'] .= $data;
- break;
- case 'database-table-declaration-foreign-field':
- $this->field_name .= $data;
- break;
- case 'database-table-declaration-foreign-references-table':
- $this->constraint['references']['table'] .= $data;
- break;
- case 'database-table-declaration-foreign-references-field':
- $this->field_name .= $data;
- break;
-
- /* Sequence declaration */
- case 'database-sequence-name':
- $this->sequence_name .= $data;
- break;
- case 'database-sequence-was':
- $this->sequence['was'] .= $data;
- break;
- case 'database-sequence-start':
- $this->sequence['start'] .= $data;
- break;
- case 'database-sequence-description':
- $this->sequence['description'] .= $data;
- break;
- case 'database-sequence-comments':
- $this->sequence['comments'] .= $data;
- break;
- case 'database-sequence-on':
- $this->sequence['on'] = array('table' => '', 'field' => '');
- break;
- case 'database-sequence-on-table':
- $this->sequence['on']['table'] .= $data;
- break;
- case 'database-sequence-on-field':
- $this->sequence['on']['field'] .= $data;
- break;
- }
- }
-}
diff --git a/3rdparty/MDB2/Schema/Parser2.php b/3rdparty/MDB2/Schema/Parser2.php
deleted file mode 100644
index f27dffbabf9..00000000000
--- a/3rdparty/MDB2/Schema/Parser2.php
+++ /dev/null
@@ -1,802 +0,0 @@
-<?php /* vim: se et ts=4 sw=4 sts=4 fdm=marker tw=80: */
-/**
- * Copyright (c) 1998-2010 Manuel Lemos, Tomas V.V.Cox,
- * Stig. S. Bakken, Lukas Smith, Igor Feghali
- * All rights reserved.
- *
- * MDB2_Schema enables users to maintain RDBMS independant schema files
- * in XML that can be used to manipulate both data and database schemas
- * This LICENSE is in the BSD license style.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,
- * Lukas Smith, Igor Feghali nor the names of his contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
- * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * PHP version 5
- *
- * @category Database
- * @package MDB2_Schema
- * @author Igor Feghali <ifeghali@php.net>
- * @license BSD http://www.opensource.org/licenses/bsd-license.php
- * @version SVN: $Id$
- * @link http://pear.php.net/packages/MDB2_Schema
- */
-
-require_once 'XML/Unserializer.php';
-require_once 'MDB2/Schema/Validate.php';
-
-/**
- * Parses an XML schema file
- *
- * @category Database
- * @package MDB2_Schema
- * @author Lukas Smith <smith@pooteeweet.org>
- * @author Igor Feghali <ifeghali@php.net>
- * @license BSD http://www.opensource.org/licenses/bsd-license.php
- * @link http://pear.php.net/packages/MDB2_Schema
- */
-class MDB2_Schema_Parser2 extends XML_Unserializer
-{
- var $database_definition = array();
-
- var $database_loaded = array();
-
- var $variables = array();
-
- var $error;
-
- var $structure = false;
-
- var $val;
-
- var $options = array();
-
- var $table = array();
-
- var $table_name = '';
-
- var $field = array();
-
- var $field_name = '';
-
- var $index = array();
-
- var $index_name = '';
-
- var $constraint = array();
-
- var $constraint_name = '';
-
- var $sequence = array();
-
- var $sequence_name = '';
-
- var $init = array();
-
- /**
- * PHP 5 constructor
- *
- * @param array $variables mixed array with user defined schema
- * variables
- * @param bool $fail_on_invalid_names array with reserved words per RDBMS
- * @param array $structure multi dimensional array with
- * database schema and data
- * @param array $valid_types information of all valid fields
- * types
- * @param bool $force_defaults if true sets a default value to
- * field when not explicit
- * @param int $max_identifiers_length maximum allowed size for entities
- * name
- *
- * @return void
- *
- * @access public
- * @static
- */
- function __construct($variables, $fail_on_invalid_names = true,
- $structure = false, $valid_types = array(), $force_defaults = true,
- $max_identifiers_length = null
- ) {
- // force ISO-8859-1 due to different defaults for PHP4 and PHP5
- // todo: this probably needs to be investigated some more and cleaned up
- $this->options['encoding'] = 'ISO-8859-1';
-
- $this->options['XML_UNSERIALIZER_OPTION_ATTRIBUTES_PARSE'] = true;
- $this->options['XML_UNSERIALIZER_OPTION_ATTRIBUTES_ARRAYKEY'] = false;
-
- $this->options['forceEnum'] = array('table', 'field', 'index', 'foreign', 'insert', 'update', 'delete', 'sequence');
-
- /*
- * todo: find a way to force the following items not to be parsed as arrays
- * as it cause problems in functions with multiple arguments
- */
- //$this->options['forceNEnum'] = array('value', 'column');
- $this->variables = $variables;
- $this->structure = $structure;
-
- $this->val = new MDB2_Schema_Validate($fail_on_invalid_names, $valid_types, $force_defaults);
- parent::XML_Unserializer($this->options);
- }
-
- /**
- * Main method. Parses XML Schema File.
- *
- * @return bool|error object
- *
- * @access public
- */
- function parse()
- {
- $result = $this->unserialize($this->filename, true);
-
- if (PEAR::isError($result)) {
- return $result;
- } else {
- $this->database_loaded = $this->getUnserializedData();
- return $this->fixDatabaseKeys($this->database_loaded);
- }
- }
-
- /**
- * Do the necessary stuff to set the input XML schema file
- *
- * @param string $filename full path to schema file
- *
- * @return boolean MDB2_OK on success
- *
- * @access public
- */
- function setInputFile($filename)
- {
- $this->filename = $filename;
- return MDB2_OK;
- }
-
- /**
- * Enforce the default values for mandatory keys and ensure everything goes
- * always in the same order (simulates the behaviour of the original
- * parser). Works at database level.
- *
- * @param array $database multi dimensional array with database definition
- * and data.
- *
- * @return bool|error MDB2_OK on success or error object
- *
- * @access private
- */
- function fixDatabaseKeys($database)
- {
- $this->database_definition = array(
- 'name' => '',
- 'create' => '',
- 'overwrite' => '',
- 'charset' => '',
- 'description' => '',
- 'comments' => '',
- 'tables' => array(),
- 'sequences' => array()
- );
-
- if (!empty($database['name'])) {
- $this->database_definition['name'] = $database['name'];
- }
- if (!empty($database['create'])) {
- $this->database_definition['create'] = $database['create'];
- }
- if (!empty($database['overwrite'])) {
- $this->database_definition['overwrite'] = $database['overwrite'];
- }
- if (!empty($database['charset'])) {
- $this->database_definition['charset'] = $database['charset'];
- }
- if (!empty($database['description'])) {
- $this->database_definition['description'] = $database['description'];
- }
- if (!empty($database['comments'])) {
- $this->database_definition['comments'] = $database['comments'];
- }
-
- if (!empty($database['table']) && is_array($database['table'])) {
- foreach ($database['table'] as $table) {
- $this->fixTableKeys($table);
- }
- }
-
- if (!empty($database['sequence']) && is_array($database['sequence'])) {
- foreach ($database['sequence'] as $sequence) {
- $this->fixSequenceKeys($sequence);
- }
- }
-
- $result = $this->val->validateDatabase($this->database_definition);
- if (PEAR::isError($result)) {
- return $this->raiseError($result->getUserinfo());
- }
-
- return MDB2_OK;
- }
-
- /**
- * Enforce the default values for mandatory keys and ensure everything goes
- * always in the same order (simulates the behaviour of the original
- * parser). Works at table level.
- *
- * @param array $table multi dimensional array with table definition
- * and data.
- *
- * @return bool|error MDB2_OK on success or error object
- *
- * @access private
- */
- function fixTableKeys($table)
- {
- $this->table = array(
- 'was' => '',
- 'description' => '',
- 'comments' => '',
- 'fields' => array(),
- 'indexes' => array(),
- 'constraints' => array(),
- 'initialization' => array()
- );
-
- if (!empty($table['name'])) {
- $this->table_name = $table['name'];
- } else {
- $this->table_name = '';
- }
- if (!empty($table['was'])) {
- $this->table['was'] = $table['was'];
- }
- if (!empty($table['description'])) {
- $this->table['description'] = $table['description'];
- }
- if (!empty($table['comments'])) {
- $this->table['comments'] = $table['comments'];
- }
-
- if (!empty($table['declaration']) && is_array($table['declaration'])) {
- if (!empty($table['declaration']['field']) && is_array($table['declaration']['field'])) {
- foreach ($table['declaration']['field'] as $field) {
- $this->fixTableFieldKeys($field);
- }
- }
-
- if (!empty($table['declaration']['index']) && is_array($table['declaration']['index'])) {
- foreach ($table['declaration']['index'] as $index) {
- $this->fixTableIndexKeys($index);
- }
- }
-
- if (!empty($table['declaration']['foreign']) && is_array($table['declaration']['foreign'])) {
- foreach ($table['declaration']['foreign'] as $constraint) {
- $this->fixTableConstraintKeys($constraint);
- }
- }
- }
-
- if (!empty($table['initialization']) && is_array($table['initialization'])) {
- if (!empty($table['initialization']['insert']) && is_array($table['initialization']['insert'])) {
- foreach ($table['initialization']['insert'] as $init) {
- $this->fixTableInitializationKeys($init, 'insert');
- }
- }
- if (!empty($table['initialization']['update']) && is_array($table['initialization']['update'])) {
- foreach ($table['initialization']['update'] as $init) {
- $this->fixTableInitializationKeys($init, 'update');
- }
- }
- if (!empty($table['initialization']['delete']) && is_array($table['initialization']['delete'])) {
- foreach ($table['initialization']['delete'] as $init) {
- $this->fixTableInitializationKeys($init, 'delete');
- }
- }
- }
-
- $result = $this->val->validateTable($this->database_definition['tables'], $this->table, $this->table_name);
- if (PEAR::isError($result)) {
- return $this->raiseError($result->getUserinfo());
- } else {
- $this->database_definition['tables'][$this->table_name] = $this->table;
- }
-
- return MDB2_OK;
- }
-
- /**
- * Enforce the default values for mandatory keys and ensure everything goes
- * always in the same order (simulates the behaviour of the original
- * parser). Works at table field level.
- *
- * @param array $field array with table field definition
- *
- * @return bool|error MDB2_OK on success or error object
- *
- * @access private
- */
- function fixTableFieldKeys($field)
- {
- $this->field = array();
- if (!empty($field['name'])) {
- $this->field_name = $field['name'];
- } else {
- $this->field_name = '';
- }
- if (!empty($field['was'])) {
- $this->field['was'] = $field['was'];
- }
- if (!empty($field['type'])) {
- $this->field['type'] = $field['type'];
- }
- if (!empty($field['fixed'])) {
- $this->field['fixed'] = $field['fixed'];
- }
- if (isset($field['default'])) {
- $this->field['default'] = $field['default'];
- }
- if (!empty($field['notnull'])) {
- $this->field['notnull'] = $field['notnull'];
- }
- if (!empty($field['autoincrement'])) {
- $this->field['autoincrement'] = $field['autoincrement'];
- }
- if (!empty($field['unsigned'])) {
- $this->field['unsigned'] = $field['unsigned'];
- }
- if (!empty($field['length'])) {
- $this->field['length'] = $field['length'];
- }
- if (!empty($field['description'])) {
- $this->field['description'] = $field['description'];
- }
- if (!empty($field['comments'])) {
- $this->field['comments'] = $field['comments'];
- }
-
- $result = $this->val->validateField($this->table['fields'], $this->field, $this->field_name);
- if (PEAR::isError($result)) {
- return $this->raiseError($result->getUserinfo());
- } else {
- $this->table['fields'][$this->field_name] = $this->field;
- }
-
- return MDB2_OK;
- }
-
- /**
- * Enforce the default values for mandatory keys and ensure everything goes
- * always in the same order (simulates the behaviour of the original
- * parser). Works at table index level.
- *
- * @param array $index array with table index definition
- *
- * @return bool|error MDB2_OK on success or error object
- *
- * @access private
- */
- function fixTableIndexKeys($index)
- {
- $this->index = array(
- 'was' => '',
- 'unique' =>'',
- 'primary' => '',
- 'fields' => array()
- );
-
- if (!empty($index['name'])) {
- $this->index_name = $index['name'];
- } else {
- $this->index_name = '';
- }
- if (!empty($index['was'])) {
- $this->index['was'] = $index['was'];
- }
- if (!empty($index['unique'])) {
- $this->index['unique'] = $index['unique'];
- }
- if (!empty($index['primary'])) {
- $this->index['primary'] = $index['primary'];
- }
- if (!empty($index['field'])) {
- foreach ($index['field'] as $field) {
- if (!empty($field['name'])) {
- $this->field_name = $field['name'];
- } else {
- $this->field_name = '';
- }
- $this->field = array(
- 'sorting' => '',
- 'length' => ''
- );
-
- if (!empty($field['sorting'])) {
- $this->field['sorting'] = $field['sorting'];
- }
- if (!empty($field['length'])) {
- $this->field['length'] = $field['length'];
- }
-
- $result = $this->val->validateIndexField($this->index['fields'], $this->field, $this->field_name);
- if (PEAR::isError($result)) {
- return $this->raiseError($result->getUserinfo());
- }
-
- $this->index['fields'][$this->field_name] = $this->field;
- }
- }
-
- $result = $this->val->validateIndex($this->table['indexes'], $this->index, $this->index_name);
- if (PEAR::isError($result)) {
- return $this->raiseError($result->getUserinfo());
- } else {
- $this->table['indexes'][$this->index_name] = $this->index;
- }
-
- return MDB2_OK;
- }
-
- /**
- * Enforce the default values for mandatory keys and ensure everything goes
- * always in the same order (simulates the behaviour of the original
- * parser). Works at table constraint level.
- *
- * @param array $constraint array with table index definition
- *
- * @return bool|error MDB2_OK on success or error object
- *
- * @access private
- */
- function fixTableConstraintKeys($constraint)
- {
- $this->constraint = array(
- 'was' => '',
- 'match' => '',
- 'ondelete' => '',
- 'onupdate' => '',
- 'deferrable' => '',
- 'initiallydeferred' => '',
- 'foreign' => true,
- 'fields' => array(),
- 'references' => array('table' => '', 'fields' => array())
- );
-
- if (!empty($constraint['name'])) {
- $this->constraint_name = $constraint['name'];
- } else {
- $this->constraint_name = '';
- }
- if (!empty($constraint['was'])) {
- $this->constraint['was'] = $constraint['was'];
- }
- if (!empty($constraint['match'])) {
- $this->constraint['match'] = $constraint['match'];
- }
- if (!empty($constraint['ondelete'])) {
- $this->constraint['ondelete'] = $constraint['ondelete'];
- }
- if (!empty($constraint['onupdate'])) {
- $this->constraint['onupdate'] = $constraint['onupdate'];
- }
- if (!empty($constraint['deferrable'])) {
- $this->constraint['deferrable'] = $constraint['deferrable'];
- }
- if (!empty($constraint['initiallydeferred'])) {
- $this->constraint['initiallydeferred'] = $constraint['initiallydeferred'];
- }
- if (!empty($constraint['field']) && is_array($constraint['field'])) {
- foreach ($constraint['field'] as $field) {
- $result = $this->val->validateConstraintField($this->constraint['fields'], $field);
- if (PEAR::isError($result)) {
- return $this->raiseError($result->getUserinfo());
- }
-
- $this->constraint['fields'][$field] = '';
- }
- }
-
- if (!empty($constraint['references']) && is_array($constraint['references'])) {
- /**
- * As we forced 'table' to be enumerated
- * we have to fix it on the foreign-references-table context
- */
- if (!empty($constraint['references']['table']) && is_array($constraint['references']['table'])) {
- $this->constraint['references']['table'] = $constraint['references']['table'][0];
- }
-
- if (!empty($constraint['references']['field']) && is_array($constraint['references']['field'])) {
- foreach ($constraint['references']['field'] as $field) {
- $result = $this->val->validateConstraintReferencedField($this->constraint['references']['fields'], $field);
- if (PEAR::isError($result)) {
- return $this->raiseError($result->getUserinfo());
- }
-
- $this->constraint['references']['fields'][$field] = '';
- }
- }
- }
-
- $result = $this->val->validateConstraint($this->table['constraints'], $this->constraint, $this->constraint_name);
- if (PEAR::isError($result)) {
- return $this->raiseError($result->getUserinfo());
- } else {
- $this->table['constraints'][$this->constraint_name] = $this->constraint;
- }
-
- return MDB2_OK;
- }
-
- /**
- * Enforce the default values for mandatory keys and ensure everything goes
- * always in the same order (simulates the behaviour of the original
- * parser). Works at table data level.
- *
- * @param array $element multi dimensional array with query definition
- * @param string $type whether its a insert|update|delete query
- *
- * @return bool|error MDB2_OK on success or error object
- *
- * @access private
- */
- function fixTableInitializationKeys($element, $type = '')
- {
- if (!empty($element['select']) && is_array($element['select'])) {
- $this->fixTableInitializationDataKeys($element['select']);
- $this->init = array( 'select' => $this->init );
- } else {
- $this->fixTableInitializationDataKeys($element);
- }
-
- $this->table['initialization'][] = array( 'type' => $type, 'data' => $this->init );
- }
-
- /**
- * Enforce the default values for mandatory keys and ensure everything goes
- * always in the same order (simulates the behaviour of the original
- * parser). Works deeper at the table initialization level (data). At this
- * point we are look at one of the below:
- *
- * <insert>
- * {field}+
- * </insert>
- *
- * <select> (this is a select extracted off a insert-select query)
- * <table/>
- * {field}+
- * <where>
- * {expression}
- * </where>?
- * </select>
- *
- * <update>
- * {field}+
- * <where>
- * {expression}
- * </where>?
- * </update>
- *
- * <delete>
- * <where>
- * {expression}
- * </where>
- * </delete>
- *
- * @param array $element multi dimensional array with query definition
- *
- * @return bool|error MDB2_OK on success or error object
- *
- * @access private
- */
- function fixTableInitializationDataKeys($element)
- {
- $this->init = array();
- if (!empty($element['field']) && is_array($element['field'])) {
- foreach ($element['field'] as $field) {
- $name = $field['name'];
- unset($field['name']);
-
- $this->setExpression($field);
- $this->init['field'][] = array( 'name' => $name, 'group' => $field );
- }
- }
- /**
- * As we forced 'table' to be enumerated
- * we have to fix it on the insert-select context
- */
- if (!empty($element['table']) && is_array($element['table'])) {
- $this->init['table'] = $element['table'][0];
- }
- if (!empty($element['where']) && is_array($element['where'])) {
- $this->init['where'] = $element['where'];
- $this->setExpression($this->init['where']);
- }
- }
-
- /**
- * Recursively diggs into an "expression" element. According to our
- * documentation an "expression" element is of the kind:
- *
- * <expression>
- * <null/> or <value/> or <column/> or {function} or {expression}
- * <operator/>
- * <null/> or <value/> or <column/> or {function} or {expression}
- * </expression>
- *
- * @param array &$arr reference to current element definition
- *
- * @return void
- *
- * @access private
- */
- function setExpression(&$arr)
- {
- $element = each($arr);
-
- $arr = array( 'type' => $element['key'] );
-
- $element = $element['value'];
-
- switch ($arr['type']) {
- case 'null':
- break;
- case 'value':
- case 'column':
- $arr['data'] = $element;
- break;
- case 'function':
- if (!empty($element)
- && is_array($element)
- ) {
- $arr['data'] = array( 'name' => $element['name'] );
- unset($element['name']);
-
- foreach ($element as $type => $value) {
- if (!empty($value)) {
- if (is_array($value)) {
- foreach ($value as $argument) {
- $argument = array( $type => $argument );
- $this->setExpression($argument);
- $arr['data']['arguments'][] = $argument;
- }
- } else {
- $arr['data']['arguments'][] = array( 'type' => $type, 'data' => $value );
- }
- }
- }
- }
- break;
- case 'expression':
- $arr['data'] = array( 'operants' => array(), 'operator' => $element['operator'] );
- unset($element['operator']);
-
- foreach ($element as $k => $v) {
- $argument = array( $k => $v );
- $this->setExpression($argument);
- $arr['data']['operants'][] = $argument;
- }
- break;
- }
- }
-
- /**
- * Enforce the default values for mandatory keys and ensure everything goes
- * always in the same order (simulates the behaviour of the original
- * parser). Works at database sequences level. A "sequence" element looks
- * like:
- *
- * <sequence>
- * <name/>
- * <was/>?
- * <start/>?
- * <description/>?
- * <comments/>?
- * <on>
- * <table/>
- * <field/>
- * </on>?
- * </sequence>
- *
- * @param array $sequence multi dimensional array with sequence definition
- *
- * @return bool|error MDB2_OK on success or error object
- *
- * @access private
- */
- function fixSequenceKeys($sequence)
- {
- $this->sequence = array(
- 'was' => '',
- 'start' => '',
- 'description' => '',
- 'comments' => '',
- );
-
- if (!empty($sequence['name'])) {
- $this->sequence_name = $sequence['name'];
- } else {
- $this->sequence_name = '';
- }
- if (!empty($sequence['was'])) {
- $this->sequence['was'] = $sequence['was'];
- }
- if (!empty($sequence['start'])) {
- $this->sequence['start'] = $sequence['start'];
- }
- if (!empty($sequence['description'])) {
- $this->sequence['description'] = $sequence['description'];
- }
- if (!empty($sequence['comments'])) {
- $this->sequence['comments'] = $sequence['comments'];
- }
- if (!empty($sequence['on']) && is_array($sequence['on'])) {
- /**
- * As we forced 'table' to be enumerated
- * we have to fix it on the sequence-on-table context
- */
- if (!empty($sequence['on']['table']) && is_array($sequence['on']['table'])) {
- $this->sequence['on']['table'] = $sequence['on']['table'][0];
- }
-
- /**
- * As we forced 'field' to be enumerated
- * we have to fix it on the sequence-on-field context
- */
- if (!empty($sequence['on']['field']) && is_array($sequence['on']['field'])) {
- $this->sequence['on']['field'] = $sequence['on']['field'][0];
- }
- }
-
- $result = $this->val->validateSequence($this->database_definition['sequences'], $this->sequence, $this->sequence_name);
- if (PEAR::isError($result)) {
- return $this->raiseError($result->getUserinfo());
- } else {
- $this->database_definition['sequences'][$this->sequence_name] = $this->sequence;
- }
-
- return MDB2_OK;
- }
-
- /**
- * Pushes a MDB2_Schema_Error into stack and returns it
- *
- * @param string $msg textual message
- * @param int $ecode MDB2_Schema's error code
- *
- * @return object
- * @access private
- * @static
- */
- function &raiseError($msg = null, $ecode = MDB2_SCHEMA_ERROR_PARSE)
- {
- if (is_null($this->error)) {
- $error = 'Parser error: '.$msg."\n";
-
- $this->error = MDB2_Schema::raiseError($ecode, null, null, $error);
- }
- return $this->error;
- }
-}
diff --git a/3rdparty/MDB2/Schema/Reserved/ibase.php b/3rdparty/MDB2/Schema/Reserved/ibase.php
deleted file mode 100644
index d797822a4b9..00000000000
--- a/3rdparty/MDB2/Schema/Reserved/ibase.php
+++ /dev/null
@@ -1,437 +0,0 @@
-<?php /* vim: se et ts=4 sw=4 sts=4 fdm=marker tw=80: */
-/**
- * Copyright (c) 1998-2010 Manuel Lemos, Tomas V.V.Cox,
- * Stig. S. Bakken, Lukas Smith, Igor Feghali
- * All rights reserved.
- *
- * MDB2_Schema enables users to maintain RDBMS independant schema files
- * in XML that can be used to manipulate both data and database schemas
- * This LICENSE is in the BSD license style.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,
- * Lukas Smith, Igor Feghali nor the names of his contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
- * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * PHP version 5
- *
- * @category Database
- * @package MDB2_Schema
- * @author Lorenzo Alberton <l.alberton@quipo.it>
- * @license BSD http://www.opensource.org/licenses/bsd-license.php
- * @version SVN: $Id$
- * @link http://pear.php.net/packages/MDB2_Schema
- */
-// {{{ $GLOBALS['_MDB2_Schema_Reserved']['ibase']
-/**
- * Has a list of reserved words of Interbase/Firebird
- *
- * @package MDB2_Schema
- * @category Database
- * @access protected
- * @author Lorenzo Alberton <l.alberton@quipo.it>
- */
-$GLOBALS['_MDB2_Schema_Reserved']['ibase'] = array(
- 'ABS',
- 'ABSOLUTE',
- 'ACTION',
- 'ACTIVE',
- 'ADD',
- 'ADMIN',
- 'AFTER',
- 'ALL',
- 'ALLOCATE',
- 'ALTER',
- 'AND',
- 'ANY',
- 'ARE',
- 'AS',
- 'ASC',
- 'ASCENDING',
- 'ASSERTION',
- 'AT',
- 'AUTHORIZATION',
- 'AUTO',
- 'AUTODDL',
- 'AVG',
- 'BACKUP',
- 'BASE_NAME',
- 'BASED',
- 'BASENAME',
- 'BEFORE',
- 'BEGIN',
- 'BETWEEN',
- 'BIGINT',
- 'BIT',
- 'BIT_LENGTH',
- 'BLOB',
- 'BLOCK',
- 'BLOBEDIT',
- 'BOOLEAN',
- 'BOTH',
- 'BOTH',
- 'BREAK',
- 'BUFFER',
- 'BY',
- 'CACHE',
- 'CASCADE',
- 'CASCADED',
- 'CASE',
- 'CASE',
- 'CAST',
- 'CATALOG',
- 'CHAR',
- 'CHAR_LENGTH',
- 'CHARACTER',
- 'CHARACTER_LENGTH',
- 'CHECK',
- 'CHECK_POINT_LEN',
- 'CHECK_POINT_LENGTH',
- 'CLOSE',
- 'COALESCE',
- 'COLLATE',
- 'COLLATION',
- 'COLUMN',
- 'COMMENT',
- 'COMMIT',
- 'COMMITTED',
- 'COMPILETIME',
- 'COMPUTED',
- 'CONDITIONAL',
- 'CONNECT',
- 'CONNECTION',
- 'CONSTRAINT',
- 'CONSTRAINTS',
- 'CONTAINING',
- 'CONTINUE',
- 'CONVERT',
- 'CORRESPONDING',
- 'COUNT',
- 'CREATE',
- 'CROSS',
- 'CSTRING',
- 'CURRENT',
- 'CURRENT_CONNECTION',
- 'CURRENT_DATE',
- 'CURRENT_ROLE',
- 'CURRENT_TIME',
- 'CURRENT_TIMESTAMP',
- 'CURRENT_TRANSACTION',
- 'CURRENT_USER',
- 'DATABASE',
- 'DATE',
- 'DAY',
- 'DB_KEY',
- 'DEALLOCATE',
- 'DEBUG',
- 'DEC',
- 'DECIMAL',
- 'DECLARE',
- 'DEFAULT',
- 'DEFERRABLE',
- 'DEFERRED',
- 'DELETE',
- 'DELETING',
- 'DESC',
- 'DESCENDING',
- 'DESCRIBE',
- 'DESCRIPTOR',
- 'DIAGNOSTICS',
- 'DIFFERENCE',
- 'DISCONNECT',
- 'DISPLAY',
- 'DISTINCT',
- 'DO',
- 'DOMAIN',
- 'DOUBLE',
- 'DROP',
- 'ECHO',
- 'EDIT',
- 'ELSE',
- 'END',
- 'END-EXEC',
- 'ENTRY_POINT',
- 'ESCAPE',
- 'EVENT',
- 'EXCEPT',
- 'EXCEPTION',
- 'EXEC',
- 'EXECUTE',
- 'EXISTS',
- 'EXIT',
- 'EXTERN',
- 'EXTERNAL',
- 'EXTRACT',
- 'FALSE',
- 'FETCH',
- 'FILE',
- 'FILTER',
- 'FIRST',
- 'FLOAT',
- 'FOR',
- 'FOREIGN',
- 'FOUND',
- 'FREE_IT',
- 'FROM',
- 'FULL',
- 'FUNCTION',
- 'GDSCODE',
- 'GEN_ID',
- 'GENERATOR',
- 'GET',
- 'GLOBAL',
- 'GO',
- 'GOTO',
- 'GRANT',
- 'GROUP',
- 'GROUP_COMMIT_WAIT',
- 'GROUP_COMMIT_WAIT_TIME',
- 'HAVING',
- 'HELP',
- 'HOUR',
- 'IDENTITY',
- 'IF',
- 'IIF',
- 'IMMEDIATE',
- 'IN',
- 'INACTIVE',
- 'INDEX',
- 'INDICATOR',
- 'INIT',
- 'INITIALLY',
- 'INNER',
- 'INPUT',
- 'INPUT_TYPE',
- 'INSENSITIVE',
- 'INSERT',
- 'INSERTING',
- 'INT',
- 'INTEGER',
- 'INTERSECT',
- 'INTERVAL',
- 'INTO',
- 'IS',
- 'ISOLATION',
- 'ISQL',
- 'JOIN',
- 'KEY',
- 'LANGUAGE',
- 'LAST',
- 'LC_MESSAGES',
- 'LC_TYPE',
- 'LEADING',
- 'LEADING',
- 'LEADING',
- 'LEAVE',
- 'LEFT',
- 'LENGTH',
- 'LEV',
- 'LEVEL',
- 'LIKE',
- 'LOCAL',
- 'LOCK',
- 'LOG_BUF_SIZE',
- 'LOG_BUFFER_SIZE',
- 'LOGFILE',
- 'LONG',
- 'LOWER',
- 'MANUAL',
- 'MATCH',
- 'MAX',
- 'MAX_SEGMENT',
- 'MAXIMUM',
- 'MAXIMUM_SEGMENT',
- 'MERGE',
- 'MESSAGE',
- 'MIN',
- 'MINIMUM',
- 'MINUTE',
- 'MODULE',
- 'MODULE_NAME',
- 'MONTH',
- 'NAMES',
- 'NATIONAL',
- 'NATURAL',
- 'NCHAR',
- 'NEXT',
- 'NO',
- 'NOAUTO',
- 'NOT',
- 'NULL',
- 'NULLIF',
- 'NULLS',
- 'NUM_LOG_BUFFERS',
- 'NUM_LOG_BUFS',
- 'NUMERIC',
- 'OCTET_LENGTH',
- 'OF',
- 'ON',
- 'ONLY',
- 'OPEN',
- 'OPTION',
- 'OR',
- 'ORDER',
- 'OUTER',
- 'OUTPUT',
- 'OUTPUT_TYPE',
- 'OVERFLOW',
- 'OVERLAPS',
- 'PAD',
- 'PAGE',
- 'PAGE_SIZE',
- 'PAGELENGTH',
- 'PAGES',
- 'PARAMETER',
- 'PARTIAL',
- 'PASSWORD',
- 'PERCENT',
- 'PLAN',
- 'POSITION',
- 'POST_EVENT',
- 'PRECISION',
- 'PREPARE',
- 'PRESERVE',
- 'PRIMARY',
- 'PRIOR',
- 'PRIVILEGES',
- 'PROCEDURE',
- 'PUBLIC',
- 'QUIT',
- 'RAW_PARTITIONS',
- 'RDB$DB_KEY',
- 'READ',
- 'REAL',
- 'RECORD_VERSION',
- 'RECREATE',
- 'RECREATE ROW_COUNT',
- 'REFERENCES',
- 'RELATIVE',
- 'RELEASE',
- 'RESERV',
- 'RESERVING',
- 'RESTART',
- 'RESTRICT',
- 'RETAIN',
- 'RETURN',
- 'RETURNING',
- 'RETURNING_VALUES',
- 'RETURNS',
- 'REVOKE',
- 'RIGHT',
- 'ROLE',
- 'ROLLBACK',
- 'ROW_COUNT',
- 'ROWS',
- 'RUNTIME',
- 'SAVEPOINT',
- 'SCALAR_ARRAY',
- 'SCHEMA',
- 'SCROLL',
- 'SECOND',
- 'SECTION',
- 'SELECT',
- 'SEQUENCE',
- 'SESSION',
- 'SESSION_USER',
- 'SET',
- 'SHADOW',
- 'SHARED',
- 'SHELL',
- 'SHOW',
- 'SINGULAR',
- 'SIZE',
- 'SKIP',
- 'SMALLINT',
- 'SNAPSHOT',
- 'SOME',
- 'SORT',
- 'SPACE',
- 'SQL',
- 'SQLCODE',
- 'SQLERROR',
- 'SQLSTATE',
- 'SQLWARNING',
- 'STABILITY',
- 'STARTING',
- 'STARTS',
- 'STATEMENT',
- 'STATIC',
- 'STATISTICS',
- 'SUB_TYPE',
- 'SUBSTRING',
- 'SUM',
- 'SUSPEND',
- 'SYSTEM_USER',
- 'TABLE',
- 'TEMPORARY',
- 'TERMINATOR',
- 'THEN',
- 'TIES',
- 'TIME',
- 'TIMESTAMP',
- 'TIMEZONE_HOUR',
- 'TIMEZONE_MINUTE',
- 'TO',
- 'TRAILING',
- 'TRANSACTION',
- 'TRANSLATE',
- 'TRANSLATION',
- 'TRIGGER',
- 'TRIM',
- 'TRUE',
- 'TYPE',
- 'UNCOMMITTED',
- 'UNION',
- 'UNIQUE',
- 'UNKNOWN',
- 'UPDATE',
- 'UPDATING',
- 'UPPER',
- 'USAGE',
- 'USER',
- 'USING',
- 'VALUE',
- 'VALUES',
- 'VARCHAR',
- 'VARIABLE',
- 'VARYING',
- 'VERSION',
- 'VIEW',
- 'WAIT',
- 'WEEKDAY',
- 'WHEN',
- 'WHENEVER',
- 'WHERE',
- 'WHILE',
- 'WITH',
- 'WORK',
- 'WRITE',
- 'YEAR',
- 'YEARDAY',
- 'ZONE',
-);
-// }}}
diff --git a/3rdparty/MDB2/Schema/Reserved/mssql.php b/3rdparty/MDB2/Schema/Reserved/mssql.php
deleted file mode 100644
index 7aa65f426f9..00000000000
--- a/3rdparty/MDB2/Schema/Reserved/mssql.php
+++ /dev/null
@@ -1,260 +0,0 @@
-<?php /* vim: se et ts=4 sw=4 sts=4 fdm=marker tw=80: */
-/**
- * Copyright (c) 1998-2010 Manuel Lemos, Tomas V.V.Cox,
- * Stig. S. Bakken, Lukas Smith, Igor Feghali
- * All rights reserved.
- *
- * MDB2_Schema enables users to maintain RDBMS independant schema files
- * in XML that can be used to manipulate both data and database schemas
- * This LICENSE is in the BSD license style.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,
- * Lukas Smith, Igor Feghali nor the names of his contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
- * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * PHP version 5
- *
- * @category Database
- * @package MDB2_Schema
- * @author David Coallier <davidc@php.net>
- * @license BSD http://www.opensource.org/licenses/bsd-license.php
- * @version SVN: $Id$
- * @link http://pear.php.net/packages/MDB2_Schema
- */
-
-// {{{ $GLOBALS['_MDB2_Schema_Reserved']['mssql']
-/**
- * Has a list of all the reserved words for mssql.
- *
- * @package MDB2_Schema
- * @category Database
- * @access protected
- * @author David Coallier <davidc@php.net>
- */
-$GLOBALS['_MDB2_Schema_Reserved']['mssql'] = array(
- 'ADD',
- 'CURRENT_TIMESTAMP',
- 'GROUP',
- 'OPENQUERY',
- 'SERIALIZABLE',
- 'ALL',
- 'CURRENT_USER',
- 'HAVING',
- 'OPENROWSET',
- 'SESSION_USER',
- 'ALTER',
- 'CURSOR',
- 'HOLDLOCK',
- 'OPTION',
- 'SET',
- 'AND',
- 'DATABASE',
- 'IDENTITY',
- 'OR',
- 'SETUSER',
- 'ANY',
- 'DBCC',
- 'IDENTITYCOL',
- 'ORDER',
- 'SHUTDOWN',
- 'AS',
- 'DEALLOCATE',
- 'IDENTITY_INSERT',
- 'OUTER',
- 'SOME',
- 'ASC',
- 'DECLARE',
- 'IF',
- 'OVER',
- 'STATISTICS',
- 'AUTHORIZATION',
- 'DEFAULT',
- 'IN',
- 'PERCENT',
- 'SUM',
- 'AVG',
- 'DELETE',
- 'INDEX',
- 'PERM',
- 'SYSTEM_USER',
- 'BACKUP',
- 'DENY',
- 'INNER',
- 'PERMANENT',
- 'TABLE',
- 'BEGIN',
- 'DESC',
- 'INSERT',
- 'PIPE',
- 'TAPE',
- 'BETWEEN',
- 'DISK',
- 'INTERSECT',
- 'PLAN',
- 'TEMP',
- 'BREAK',
- 'DISTINCT',
- 'INTO',
- 'PRECISION',
- 'TEMPORARY',
- 'BROWSE',
- 'DISTRIBUTED',
- 'IS',
- 'PREPARE',
- 'TEXTSIZE',
- 'BULK',
- 'DOUBLE',
- 'ISOLATION',
- 'PRIMARY',
- 'THEN',
- 'BY',
- 'DROP',
- 'JOIN',
- 'PRINT',
- 'TO',
- 'CASCADE',
- 'DUMMY',
- 'KEY',
- 'PRIVILEGES',
- 'TOP',
- 'CASE',
- 'DUMP',
- 'KILL',
- 'PROC',
- 'TRAN',
- 'CHECK',
- 'ELSE',
- 'LEFT',
- 'PROCEDURE',
- 'TRANSACTION',
- 'CHECKPOINT',
- 'END',
- 'LEVEL',
- 'PROCESSEXIT',
- 'TRIGGER',
- 'CLOSE',
- 'ERRLVL',
- 'LIKE',
- 'PUBLIC',
- 'TRUNCATE',
- 'CLUSTERED',
- 'ERROREXIT',
- 'LINENO',
- 'RAISERROR',
- 'TSEQUAL',
- 'COALESCE',
- 'ESCAPE',
- 'LOAD',
- 'READ',
- 'UNCOMMITTED',
- 'COLUMN',
- 'EXCEPT',
- 'MAX',
- 'READTEXT',
- 'UNION',
- 'COMMIT',
- 'EXEC',
- 'MIN',
- 'RECONFIGURE',
- 'UNIQUE',
- 'COMMITTED',
- 'EXECUTE',
- 'MIRROREXIT',
- 'REFERENCES',
- 'UPDATE',
- 'COMPUTE',
- 'EXISTS',
- 'NATIONAL',
- 'REPEATABLE',
- 'UPDATETEXT',
- 'CONFIRM',
- 'EXIT',
- 'NOCHECK',
- 'REPLICATION',
- 'USE',
- 'CONSTRAINT',
- 'FETCH',
- 'NONCLUSTERED',
- 'RESTORE',
- 'USER',
- 'CONTAINS',
- 'FILE',
- 'NOT',
- 'RESTRICT',
- 'VALUES',
- 'CONTAINSTABLE',
- 'FILLFACTOR',
- 'NULL',
- 'RETURN',
- 'VARYING',
- 'CONTINUE',
- 'FLOPPY',
- 'NULLIF',
- 'REVOKE',
- 'VIEW',
- 'CONTROLROW',
- 'FOR',
- 'OF',
- 'RIGHT',
- 'WAITFOR',
- 'CONVERT',
- 'FOREIGN',
- 'OFF',
- 'ROLLBACK',
- 'WHEN',
- 'COUNT',
- 'FREETEXT',
- 'OFFSETS',
- 'ROWCOUNT',
- 'WHERE',
- 'CREATE',
- 'FREETEXTTABLE',
- 'ON',
- 'ROWGUIDCOL',
- 'WHILE',
- 'CROSS',
- 'FROM',
- 'ONCE',
- 'RULE',
- 'WITH',
- 'CURRENT',
- 'FULL',
- 'ONLY',
- 'SAVE',
- 'WORK',
- 'CURRENT_DATE',
- 'GOTO',
- 'OPEN',
- 'SCHEMA',
- 'WRITETEXT',
- 'CURRENT_TIME',
- 'GRANT',
- 'OPENDATASOURCE',
- 'SELECT',
-);
-//}}}
diff --git a/3rdparty/MDB2/Schema/Reserved/mysql.php b/3rdparty/MDB2/Schema/Reserved/mysql.php
deleted file mode 100644
index 6a4338b261d..00000000000
--- a/3rdparty/MDB2/Schema/Reserved/mysql.php
+++ /dev/null
@@ -1,285 +0,0 @@
-<?php /* vim: se et ts=4 sw=4 sts=4 fdm=marker tw=80: */
-/**
- * Copyright (c) 1998-2010 Manuel Lemos, Tomas V.V.Cox,
- * Stig. S. Bakken, Lukas Smith, Igor Feghali
- * All rights reserved.
- *
- * MDB2_Schema enables users to maintain RDBMS independant schema files
- * in XML that can be used to manipulate both data and database schemas
- * This LICENSE is in the BSD license style.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,
- * Lukas Smith, Igor Feghali nor the names of his contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
- * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * PHP version 5
- *
- * @category Database
- * @package MDB2_Schema
- * @author David Coallier <davidc@php.net>
- * @license BSD http://www.opensource.org/licenses/bsd-license.php
- * @version SVN: $Id$
- * @link http://pear.php.net/packages/MDB2_Schema
- */
-
-// {{{ $GLOBALS['_MDB2_Schema_Reserved']['mysql']
-/**
- * Has a list of reserved words of mysql
- *
- * @package MDB2_Schema
- * @category Database
- * @access protected
- * @author David Coalier <davidc@php.net>
- */
-$GLOBALS['_MDB2_Schema_Reserved']['mysql'] = array(
- 'ADD',
- 'ALL',
- 'ALTER',
- 'ANALYZE',
- 'AND',
- 'AS',
- 'ASC',
- 'ASENSITIVE',
- 'BEFORE',
- 'BETWEEN',
- 'BIGINT',
- 'BINARY',
- 'BLOB',
- 'BOTH',
- 'BY',
- 'CALL',
- 'CASCADE',
- 'CASE',
- 'CHANGE',
- 'CHAR',
- 'CHARACTER',
- 'CHECK',
- 'COLLATE',
- 'COLUMN',
- 'CONDITION',
- 'CONNECTION',
- 'CONSTRAINT',
- 'CONTINUE',
- 'CONVERT',
- 'CREATE',
- 'CROSS',
- 'CURRENT_DATE',
- 'CURRENT_TIME',
- 'CURRENT_TIMESTAMP',
- 'CURRENT_USER',
- 'CURSOR',
- 'DATABASE',
- 'DATABASES',
- 'DAY_HOUR',
- 'DAY_MICROSECOND',
- 'DAY_MINUTE',
- 'DAY_SECOND',
- 'DEC',
- 'DECIMAL',
- 'DECLARE',
- 'DEFAULT',
- 'DELAYED',
- 'DELETE',
- 'DESC',
- 'DESCRIBE',
- 'DETERMINISTIC',
- 'DISTINCT',
- 'DISTINCTROW',
- 'DIV',
- 'DOUBLE',
- 'DROP',
- 'DUAL',
- 'EACH',
- 'ELSE',
- 'ELSEIF',
- 'ENCLOSED',
- 'ESCAPED',
- 'EXISTS',
- 'EXIT',
- 'EXPLAIN',
- 'FALSE',
- 'FETCH',
- 'FLOAT',
- 'FLOAT4',
- 'FLOAT8',
- 'FOR',
- 'FORCE',
- 'FOREIGN',
- 'FROM',
- 'FULLTEXT',
- 'GOTO',
- 'GRANT',
- 'GROUP',
- 'HAVING',
- 'HIGH_PRIORITY',
- 'HOUR_MICROSECOND',
- 'HOUR_MINUTE',
- 'HOUR_SECOND',
- 'IF',
- 'IGNORE',
- 'IN',
- 'INDEX',
- 'INFILE',
- 'INNER',
- 'INOUT',
- 'INSENSITIVE',
- 'INSERT',
- 'INT',
- 'INT1',
- 'INT2',
- 'INT3',
- 'INT4',
- 'INT8',
- 'INTEGER',
- 'INTERVAL',
- 'INTO',
- 'IS',
- 'ITERATE',
- 'JOIN',
- 'KEY',
- 'KEYS',
- 'KILL',
- 'LABEL',
- 'LEADING',
- 'LEAVE',
- 'LEFT',
- 'LIKE',
- 'LIMIT',
- 'LINES',
- 'LOAD',
- 'LOCALTIME',
- 'LOCALTIMESTAMP',
- 'LOCK',
- 'LONG',
- 'LONGBLOB',
- 'LONGTEXT',
- 'LOOP',
- 'LOW_PRIORITY',
- 'MATCH',
- 'MEDIUMBLOB',
- 'MEDIUMINT',
- 'MEDIUMTEXT',
- 'MIDDLEINT',
- 'MINUTE_MICROSECOND',
- 'MINUTE_SECOND',
- 'MOD',
- 'MODIFIES',
- 'NATURAL',
- 'NOT',
- 'NO_WRITE_TO_BINLOG',
- 'NULL',
- 'NUMERIC',
- 'ON',
- 'OPTIMIZE',
- 'OPTION',
- 'OPTIONALLY',
- 'OR',
- 'ORDER',
- 'OUT',
- 'OUTER',
- 'OUTFILE',
- 'PRECISION',
- 'PRIMARY',
- 'PROCEDURE',
- 'PURGE',
- 'RAID0',
- 'READ',
- 'READS',
- 'REAL',
- 'REFERENCES',
- 'REGEXP',
- 'RELEASE',
- 'RENAME',
- 'REPEAT',
- 'REPLACE',
- 'REQUIRE',
- 'RESTRICT',
- 'RETURN',
- 'REVOKE',
- 'RIGHT',
- 'RLIKE',
- 'SCHEMA',
- 'SCHEMAS',
- 'SECOND_MICROSECOND',
- 'SELECT',
- 'SENSITIVE',
- 'SEPARATOR',
- 'SET',
- 'SHOW',
- 'SMALLINT',
- 'SONAME',
- 'SPATIAL',
- 'SPECIFIC',
- 'SQL',
- 'SQLEXCEPTION',
- 'SQLSTATE',
- 'SQLWARNING',
- 'SQL_BIG_RESULT',
- 'SQL_CALC_FOUND_ROWS',
- 'SQL_SMALL_RESULT',
- 'SSL',
- 'STARTING',
- 'STRAIGHT_JOIN',
- 'TABLE',
- 'TERMINATED',
- 'THEN',
- 'TINYBLOB',
- 'TINYINT',
- 'TINYTEXT',
- 'TO',
- 'TRAILING',
- 'TRIGGER',
- 'TRUE',
- 'UNDO',
- 'UNION',
- 'UNIQUE',
- 'UNLOCK',
- 'UNSIGNED',
- 'UPDATE',
- 'USAGE',
- 'USE',
- 'USING',
- 'UTC_DATE',
- 'UTC_TIME',
- 'UTC_TIMESTAMP',
- 'VALUES',
- 'VARBINARY',
- 'VARCHAR',
- 'VARCHARACTER',
- 'VARYING',
- 'WHEN',
- 'WHERE',
- 'WHILE',
- 'WITH',
- 'WRITE',
- 'X509',
- 'XOR',
- 'YEAR_MONTH',
- 'ZEROFILL',
- );
- // }}}
diff --git a/3rdparty/MDB2/Schema/Reserved/oci8.php b/3rdparty/MDB2/Schema/Reserved/oci8.php
deleted file mode 100644
index 3cc898e1d68..00000000000
--- a/3rdparty/MDB2/Schema/Reserved/oci8.php
+++ /dev/null
@@ -1,173 +0,0 @@
-<?php /* vim: se et ts=4 sw=4 sts=4 fdm=marker tw=80: */
-/**
- * Copyright (c) 1998-2010 Manuel Lemos, Tomas V.V.Cox,
- * Stig. S. Bakken, Lukas Smith, Igor Feghali
- * All rights reserved.
- *
- * MDB2_Schema enables users to maintain RDBMS independant schema files
- * in XML that can be used to manipulate both data and database schemas
- * This LICENSE is in the BSD license style.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,
- * Lukas Smith, Igor Feghali nor the names of his contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
- * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * PHP version 5
- *
- * @category Database
- * @package MDB2_Schema
- * @author David Coallier <davidc@php.net>
- * @license BSD http://www.opensource.org/licenses/bsd-license.php
- * @version SVN: $Id$
- * @link http://pear.php.net/packages/MDB2_Schema
- */
-
-// {{{ $GLOBALS['_MDB2_Schema_Reserved']['oci8']
-/**
- * Has a list of all the reserved words for oracle.
- *
- * @package MDB2_Schema
- * @category Database
- * @access protected
- * @author David Coallier <davidc@php.net>
- */
-$GLOBALS['_MDB2_Schema_Reserved']['oci8'] = array(
- 'ACCESS',
- 'ELSE',
- 'MODIFY',
- 'START',
- 'ADD',
- 'EXCLUSIVE',
- 'NOAUDIT',
- 'SELECT',
- 'ALL',
- 'EXISTS',
- 'NOCOMPRESS',
- 'SESSION',
- 'ALTER',
- 'FILE',
- 'NOT',
- 'SET',
- 'AND',
- 'FLOAT',
- 'NOTFOUND ',
- 'SHARE',
- 'ANY',
- 'FOR',
- 'NOWAIT',
- 'SIZE',
- 'ARRAYLEN',
- 'FROM',
- 'NULL',
- 'SMALLINT',
- 'AS',
- 'GRANT',
- 'NUMBER',
- 'SQLBUF',
- 'ASC',
- 'GROUP',
- 'OF',
- 'SUCCESSFUL',
- 'AUDIT',
- 'HAVING',
- 'OFFLINE ',
- 'SYNONYM',
- 'BETWEEN',
- 'IDENTIFIED',
- 'ON',
- 'SYSDATE',
- 'BY',
- 'IMMEDIATE',
- 'ONLINE',
- 'TABLE',
- 'CHAR',
- 'IN',
- 'OPTION',
- 'THEN',
- 'CHECK',
- 'INCREMENT',
- 'OR',
- 'TO',
- 'CLUSTER',
- 'INDEX',
- 'ORDER',
- 'TRIGGER',
- 'COLUMN',
- 'INITIAL',
- 'PCTFREE',
- 'UID',
- 'COMMENT',
- 'INSERT',
- 'PRIOR',
- 'UNION',
- 'COMPRESS',
- 'INTEGER',
- 'PRIVILEGES',
- 'UNIQUE',
- 'CONNECT',
- 'INTERSECT',
- 'PUBLIC',
- 'UPDATE',
- 'CREATE',
- 'INTO',
- 'RAW',
- 'USER',
- 'CURRENT',
- 'IS',
- 'RENAME',
- 'VALIDATE',
- 'DATE',
- 'LEVEL',
- 'RESOURCE',
- 'VALUES',
- 'DECIMAL',
- 'LIKE',
- 'REVOKE',
- 'VARCHAR',
- 'DEFAULT',
- 'LOCK',
- 'ROW',
- 'VARCHAR2',
- 'DELETE',
- 'LONG',
- 'ROWID',
- 'VIEW',
- 'DESC',
- 'MAXEXTENTS',
- 'ROWLABEL',
- 'WHENEVER',
- 'DISTINCT',
- 'MINUS',
- 'ROWNUM',
- 'WHERE',
- 'DROP',
- 'MODE',
- 'ROWS',
- 'WITH',
-);
-// }}}
diff --git a/3rdparty/MDB2/Schema/Reserved/pgsql.php b/3rdparty/MDB2/Schema/Reserved/pgsql.php
deleted file mode 100644
index 84537685e0f..00000000000
--- a/3rdparty/MDB2/Schema/Reserved/pgsql.php
+++ /dev/null
@@ -1,148 +0,0 @@
-<?php /* vim: se et ts=4 sw=4 sts=4 fdm=marker tw=80: */
-/**
- * Copyright (c) 1998-2010 Manuel Lemos, Tomas V.V.Cox,
- * Stig. S. Bakken, Lukas Smith, Igor Feghali
- * All rights reserved.
- *
- * MDB2_Schema enables users to maintain RDBMS independant schema files
- * in XML that can be used to manipulate both data and database schemas
- * This LICENSE is in the BSD license style.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,
- * Lukas Smith, Igor Feghali nor the names of his contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
- * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * PHP version 5
- *
- * @category Database
- * @package MDB2_Schema
- * @author Marcelo Santos Araujo <msaraujo@php.net>
- * @license BSD http://www.opensource.org/licenses/bsd-license.php
- * @version SVN: $Id$
- * @link http://pear.php.net/packages/MDB2_Schema
- */
-
-// {{{ $GLOBALS['_MDB2_Schema_Reserved']['pgsql']
-/**
- * Has a list of reserved words of pgsql
- *
- * @package MDB2_Schema
- * @category Database
- * @access protected
- * @author Marcelo Santos Araujo <msaraujo@php.net>
- */
-$GLOBALS['_MDB2_Schema_Reserved']['pgsql'] = array(
- 'ALL',
- 'ANALYSE',
- 'ANALYZE',
- 'AND',
- 'ANY',
- 'AS',
- 'ASC',
- 'AUTHORIZATION',
- 'BETWEEN',
- 'BINARY',
- 'BOTH',
- 'CASE',
- 'CAST',
- 'CHECK',
- 'COLLATE',
- 'COLUMN',
- 'CONSTRAINT',
- 'CREATE',
- 'CURRENT_DATE',
- 'CURRENT_TIME',
- 'CURRENT_TIMESTAMP',
- 'CURRENT_USER',
- 'DEFAULT',
- 'DEFERRABLE',
- 'DESC',
- 'DISTINCT',
- 'DO',
- 'ELSE',
- 'END',
- 'EXCEPT',
- 'FALSE',
- 'FOR',
- 'FOREIGN',
- 'FREEZE',
- 'FROM',
- 'FULL',
- 'GRANT',
- 'GROUP',
- 'HAVING',
- 'ILIKE',
- 'IN',
- 'INITIALLY',
- 'INNER',
- 'INTERSECT',
- 'INTO',
- 'IS',
- 'ISNULL',
- 'JOIN',
- 'LEADING',
- 'LEFT',
- 'LIKE',
- 'LIMIT',
- 'LOCALTIME',
- 'LOCALTIMESTAMP',
- 'NATURAL',
- 'NEW',
- 'NOT',
- 'NOTNULL',
- 'NULL',
- 'OFF',
- 'OFFSET',
- 'OLD',
- 'ON',
- 'ONLY',
- 'OR',
- 'ORDER',
- 'OUTER',
- 'OVERLAPS',
- 'PLACING',
- 'PRIMARY',
- 'REFERENCES',
- 'SELECT',
- 'SESSION_USER',
- 'SIMILAR',
- 'SOME',
- 'TABLE',
- 'THEN',
- 'TO',
- 'TRAILING',
- 'TRUE',
- 'UNION',
- 'UNIQUE',
- 'USER',
- 'USING',
- 'VERBOSE',
- 'WHEN',
- 'WHERE'
-);
-// }}}
diff --git a/3rdparty/MDB2/Schema/Tool.php b/3rdparty/MDB2/Schema/Tool.php
deleted file mode 100644
index 3210c9173eb..00000000000
--- a/3rdparty/MDB2/Schema/Tool.php
+++ /dev/null
@@ -1,583 +0,0 @@
-<?php /* vim: se et ts=4 sw=4 sts=4 fdm=marker tw=80: */
-/**
- * Copyright (c) 1998-2010 Manuel Lemos, Tomas V.V.Cox,
- * Stig. S. Bakken, Lukas Smith, Igor Feghali
- * All rights reserved.
- *
- * MDB2_Schema enables users to maintain RDBMS independant schema files
- * in XML that can be used to manipulate both data and database schemas
- * This LICENSE is in the BSD license style.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,
- * Lukas Smith, Igor Feghali nor the names of his contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
- * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * PHP version 5
- *
- * @category Database
- * @package MDB2_Schema
- * @author Christian Weiske <cweiske@php.net>
- * @license BSD http://www.opensource.org/licenses/bsd-license.php
- * @version SVN: $Id$
- * @link http://pear.php.net/packages/MDB2_Schema
- */
-
-require_once 'MDB2/Schema.php';
-require_once 'MDB2/Schema/Tool/ParameterException.php';
-
-/**
-* Command line tool to work with database schemas
-*
-* Functionality:
-* - dump a database schema to stdout
-* - import schema into database
-* - create a diff between two schemas
-* - apply diff to database
-*
- * @category Database
- * @package MDB2_Schema
- * @author Christian Weiske <cweiske@php.net>
- * @license BSD http://www.opensource.org/licenses/bsd-license.php
- * @link http://pear.php.net/packages/MDB2_Schema
- */
-class MDB2_Schema_Tool
-{
- /**
- * Run the schema tool
- *
- * @param array $args Array of command line arguments
- */
- public function __construct($args)
- {
- $strAction = $this->getAction($args);
- try {
- $this->{'do' . ucfirst($strAction)}($args);
- } catch (MDB2_Schema_Tool_ParameterException $e) {
- $this->{'doHelp' . ucfirst($strAction)}($e->getMessage());
- }
- }//public function __construct($args)
-
-
-
- /**
- * Runs the tool with command line arguments
- *
- * @return void
- */
- public static function run()
- {
- $args = $GLOBALS['argv'];
- array_shift($args);
-
- try {
- $tool = new MDB2_Schema_Tool($args);
- } catch (Exception $e) {
- self::toStdErr($e->getMessage() . "\n");
- }
- }//public static function run()
-
-
-
- /**
- * Reads the first parameter from the argument array and
- * returns the action.
- *
- * @param array &$args Command line parameters
- *
- * @return string Action to execute
- */
- protected function getAction(&$args)
- {
- if (count($args) == 0) {
- return 'help';
- }
- $arg = array_shift($args);
- switch ($arg) {
- case 'h':
- case 'help':
- case '-h':
- case '--help':
- return 'help';
- case 'd':
- case 'dump':
- case '-d':
- case '--dump':
- return 'dump';
- case 'l':
- case 'load':
- case '-l':
- case '--load':
- return 'load';
- case 'i':
- case 'diff':
- case '-i':
- case '--diff':
- return 'diff';
- case 'a':
- case 'apply':
- case '-a':
- case '--apply':
- return 'apply';
- case 'n':
- case 'init':
- case '-i':
- case '--init':
- return 'init';
- default:
- throw new MDB2_Schema_Tool_ParameterException(
- "Unknown mode \"$arg\""
- );
- }
- }//protected function getAction(&$args)
-
-
-
- /**
- * Writes the message to stderr
- *
- * @param string $msg Message to print
- *
- * @return void
- */
- protected static function toStdErr($msg)
- {
- file_put_contents('php://stderr', $msg);
- }//protected static function toStdErr($msg)
-
-
-
- /**
- * Displays generic help to stdout
- *
- * @return void
- */
- protected function doHelp()
- {
- self::toStdErr(
-<<<EOH
-Usage: mdb2_schematool mode parameters
-
-Works with database schemas
-
-mode: (- and -- are optional)
- h, help Show this help screen
- d, dump Dump a schema to stdout
- l, load Load a schema into database
- i, diff Create a diff between two schemas and dump it to stdout
- a, apply Apply a diff to a database
- n, init Initialize a database with data
-
-EOH
- );
- }//protected function doHelp()
-
-
-
- /**
- * Displays the help screen for "dump" command
- *
- * @return void
- */
- protected function doHelpDump()
- {
- self::toStdErr(
-<<<EOH
-Usage: mdb2_schematool dump [all|data|schema] [-p] DSN
-
-Dumps a database schema to stdout
-
-If dump type is not specified, defaults to "schema".
-
-DSN: Data source name in the form of
- driver://user:password@host/database
-
-User and password may be omitted.
-Using -p reads password from stdin which is more secure than passing it in the
-parameter.
-
-EOH
- );
- }//protected function doHelpDump()
-
-
-
- /**
- * Displays the help screen for "init" command
- *
- * @return void
- */
- protected function doHelpInit()
- {
- self::toStdErr(
-<<<EOH
-Usage: mdb2_schematool init source [-p] destination
-
-Initializes a database with data
- (Inserts data on a previous created database at destination)
-
-source should be a schema file containing data,
-destination should be a DSN
-
-DSN: Data source name in the form of
- driver://user:password@host/database
-
-User and password may be omitted.
-Using -p reads password from stdin which is more secure than passing it in the
-parameter.
-
-EOH
- );
- }//protected function doHelpInit()
-
-
-
- /**
- * Displays the help screen for "load" command
- *
- * @return void
- */
- protected function doHelpLoad()
- {
- self::toStdErr(
-<<<EOH
-Usage: mdb2_schematool load [-p] source [-p] destination
-
-Loads a database schema from source to destination
- (Creates the database schema at destination)
-
-source can be a DSN or a schema file,
-destination should be a DSN
-
-DSN: Data source name in the form of
- driver://user:password@host/database
-
-User and password may be omitted.
-Using -p reads password from stdin which is more secure than passing it in the
-parameter.
-
-EOH
- );
- }//protected function doHelpLoad()
-
-
-
- /**
- * Returns an array of options for MDB2_Schema constructor
- *
- * @return array Options for MDB2_Schema constructor
- */
- protected function getSchemaOptions()
- {
- $options = array(
- 'log_line_break' => '<br>',
- 'idxname_format' => '%s',
- 'debug' => true,
- 'quote_identifier' => true,
- 'force_defaults' => false,
- 'portability' => true,
- 'use_transactions' => false,
- );
- return $options;
- }//protected function getSchemaOptions()
-
-
-
- /**
- * Checks if the passed parameter is a PEAR_Error object
- * and throws an exception in that case.
- *
- * @param mixed $object Some variable to check
- * @param string $location Where the error occured
- *
- * @return void
- */
- protected function throwExceptionOnError($object, $location = '')
- {
- if (PEAR::isError($object)) {
- //FIXME: exception class
- //debug_print_backtrace();
- throw new Exception('Error ' . $location
- . "\n" . $object->getMessage()
- . "\n" . $object->getUserInfo()
- );
- }
- }//protected function throwExceptionOnError($object, $location = '')
-
-
-
- /**
- * Loads a file or a dsn from the arguments
- *
- * @param array &$args Array of arguments to the program
- *
- * @return array Array of ('file'|'dsn', $value)
- */
- protected function getFileOrDsn(&$args)
- {
- if (count($args) == 0) {
- throw new MDB2_Schema_Tool_ParameterException(
- 'File or DSN expected'
- );
- }
-
- $arg = array_shift($args);
- if ($arg == '-p') {
- $bAskPassword = true;
- $arg = array_shift($args);
- } else {
- $bAskPassword = false;
- }
-
- if (strpos($arg, '://') === false) {
- if (file_exists($arg)) {
- //File
- return array('file', $arg);
- } else {
- throw new Exception('Schema file does not exist');
- }
- }
-
- //read password if necessary
- if ($bAskPassword) {
- $password = $this->readPasswordFromStdin($arg);
- $arg = self::setPasswordIntoDsn($arg, $password);
- self::toStdErr($arg);
- }
- return array('dsn', $arg);
- }//protected function getFileOrDsn(&$args)
-
-
-
- /**
- * Takes a DSN data source name and integrates the given
- * password into it.
- *
- * @param string $dsn Data source name
- * @param string $password Password
- *
- * @return string DSN with password
- */
- protected function setPasswordIntoDsn($dsn, $password)
- {
- //simple try to integrate password
- if (strpos($dsn, '@') === false) {
- //no @ -> no user and no password
- return str_replace('://', '://:' . $password . '@', $dsn);
- } else if (preg_match('|://[^:]+@|', $dsn)) {
- //user only, no password
- return str_replace('@', ':' . $password . '@', $dsn);
- } else if (strpos($dsn, ':@') !== false) {
- //abstract version
- return str_replace(':@', ':' . $password . '@', $dsn);
- }
-
- return $dsn;
- }//protected function setPasswordIntoDsn($dsn, $password)
-
-
-
- /**
- * Reads a password from stdin
- *
- * @param string $dsn DSN name to put into the message
- *
- * @return string Password
- */
- protected function readPasswordFromStdin($dsn)
- {
- $stdin = fopen('php://stdin', 'r');
- self::toStdErr('Please insert password for ' . $dsn . "\n");
- $password = '';
- $breakme = false;
- while (false !== ($char = fgetc($stdin))) {
- if (ord($char) == 10 || $char == "\n" || $char == "\r") {
- break;
- }
- $password .= $char;
- }
- fclose($stdin);
-
- return trim($password);
- }//protected function readPasswordFromStdin()
-
-
-
- /**
- * Creates a database schema dump and sends it to stdout
- *
- * @param array $args Command line arguments
- *
- * @return void
- */
- protected function doDump($args)
- {
- $dump_what = MDB2_SCHEMA_DUMP_STRUCTURE;
- $arg = '';
- if (count($args)) {
- $arg = $args[0];
- }
-
- switch (strtolower($arg)) {
- case 'all':
- $dump_what = MDB2_SCHEMA_DUMP_ALL;
- array_shift($args);
- break;
- case 'data':
- $dump_what = MDB2_SCHEMA_DUMP_CONTENT;
- array_shift($args);
- break;
- case 'schema':
- array_shift($args);
- }
-
- list($type, $dsn) = $this->getFileOrDsn($args);
- if ($type == 'file') {
- throw new MDB2_Schema_Tool_ParameterException(
- 'Dumping a schema file as a schema file does not make much ' .
- 'sense'
- );
- }
-
- $schema = MDB2_Schema::factory($dsn, $this->getSchemaOptions());
- $this->throwExceptionOnError($schema);
-
- $definition = $schema->getDefinitionFromDatabase();
- $this->throwExceptionOnError($definition);
-
-
- $dump_options = array(
- 'output_mode' => 'file',
- 'output' => 'php://stdout',
- 'end_of_line' => "\r\n"
- );
- $op = $schema->dumpDatabase(
- $definition, $dump_options, $dump_what
- );
- $this->throwExceptionOnError($op);
-
- $schema->disconnect();
- }//protected function doDump($args)
-
-
-
- /**
- * Loads a database schema
- *
- * @param array $args Command line arguments
- *
- * @return void
- */
- protected function doLoad($args)
- {
- list($typeSource, $dsnSource) = $this->getFileOrDsn($args);
- list($typeDest, $dsnDest) = $this->getFileOrDsn($args);
-
- if ($typeDest == 'file') {
- throw new MDB2_Schema_Tool_ParameterException(
- 'A schema can only be loaded into a database, not a file'
- );
- }
-
-
- $schemaDest = MDB2_Schema::factory($dsnDest, $this->getSchemaOptions());
- $this->throwExceptionOnError($schemaDest);
-
- //load definition
- if ($typeSource == 'file') {
- $definition = $schemaDest->parseDatabaseDefinitionFile($dsnSource);
- $where = 'loading schema file';
- } else {
- $schemaSource = MDB2_Schema::factory(
- $dsnSource,
- $this->getSchemaOptions()
- );
- $this->throwExceptionOnError(
- $schemaSource,
- 'connecting to source database'
- );
-
- $definition = $schemaSource->getDefinitionFromDatabase();
- $where = 'loading definition from database';
- }
- $this->throwExceptionOnError($definition, $where);
-
-
- //create destination database from definition
- $simulate = false;
- $op = $schemaDest->createDatabase(
- $definition,
- array(),
- $simulate
- );
- $this->throwExceptionOnError($op, 'creating the database');
- }//protected function doLoad($args)
-
-
-
- /**
- * Initializes a database with data
- *
- * @param array $args Command line arguments
- *
- * @return void
- */
- protected function doInit($args)
- {
- list($typeSource, $dsnSource) = $this->getFileOrDsn($args);
- list($typeDest, $dsnDest) = $this->getFileOrDsn($args);
-
- if ($typeSource != 'file') {
- throw new MDB2_Schema_Tool_ParameterException(
- 'Data must come from a source file'
- );
- }
-
- if ($typeDest != 'dsn') {
- throw new MDB2_Schema_Tool_ParameterException(
- 'A schema can only be loaded into a database, not a file'
- );
- }
-
- $schemaDest = MDB2_Schema::factory($dsnDest, $this->getSchemaOptions());
- $this->throwExceptionOnError(
- $schemaDest,
- 'connecting to destination database'
- );
-
- $definition = $schemaDest->getDefinitionFromDatabase();
- $this->throwExceptionOnError(
- $definition,
- 'loading definition from database'
- );
-
- $op = $schemaDest->writeInitialization($dsnSource, $definition);
- $this->throwExceptionOnError($op, 'initializing database');
- }//protected function doInit($args)
-
-
-}//class MDB2_Schema_Tool
diff --git a/3rdparty/MDB2/Schema/Tool/ParameterException.php b/3rdparty/MDB2/Schema/Tool/ParameterException.php
deleted file mode 100644
index 92bea693917..00000000000
--- a/3rdparty/MDB2/Schema/Tool/ParameterException.php
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php /* vim: se et ts=4 sw=4 sts=4 fdm=marker tw=80: */
-/**
- * Copyright (c) 1998-2010 Manuel Lemos, Tomas V.V.Cox,
- * Stig. S. Bakken, Lukas Smith, Igor Feghali
- * All rights reserved.
- *
- * MDB2_Schema enables users to maintain RDBMS independant schema files
- * in XML that can be used to manipulate both data and database schemas
- * This LICENSE is in the BSD license style.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,
- * Lukas Smith, Igor Feghali nor the names of his contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
- * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * PHP version 5
- *
- * @category Database
- * @package MDB2_Schema
- * @author Christian Weiske <cweiske@php.net>
- * @license BSD http://www.opensource.org/licenses/bsd-license.php
- * @version SVN: $Id$
- * @link http://pear.php.net/packages/MDB2_Schema
- */
-
-/**
- * To be implemented yet
- *
- * @category Database
- * @package MDB2_Schema
- * @author Christian Weiske <cweiske@php.net>
- * @license BSD http://www.opensource.org/licenses/bsd-license.php
- * @link http://pear.php.net/packages/MDB2_Schema
- */
-class MDB2_Schema_Tool_ParameterException extends Exception
-{
-}
diff --git a/3rdparty/MDB2/Schema/Validate.php b/3rdparty/MDB2/Schema/Validate.php
deleted file mode 100644
index 4a8e0d27bac..00000000000
--- a/3rdparty/MDB2/Schema/Validate.php
+++ /dev/null
@@ -1,1004 +0,0 @@
-<?php /* vim: se et ts=4 sw=4 sts=4 fdm=marker tw=80: */
-/**
- * Copyright (c) 1998-2010 Manuel Lemos, Tomas V.V.Cox,
- * Stig. S. Bakken, Lukas Smith, Igor Feghali
- * All rights reserved.
- *
- * MDB2_Schema enables users to maintain RDBMS independant schema files
- * in XML that can be used to manipulate both data and database schemas
- * This LICENSE is in the BSD license style.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,
- * Lukas Smith, Igor Feghali nor the names of his contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
- * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * PHP version 5
- *
- * @category Database
- * @package MDB2_Schema
- * @author Christian Dickmann <dickmann@php.net>
- * @author Igor Feghali <ifeghali@php.net>
- * @license BSD http://www.opensource.org/licenses/bsd-license.php
- * @version SVN: $Id$
- * @link http://pear.php.net/packages/MDB2_Schema
- */
-
-/**
- * Validates an XML schema file
- *
- * @category Database
- * @package MDB2_Schema
- * @author Igor Feghali <ifeghali@php.net>
- * @license BSD http://www.opensource.org/licenses/bsd-license.php
- * @link http://pear.php.net/packages/MDB2_Schema
- */
-class MDB2_Schema_Validate
-{
- // {{{ properties
-
- var $fail_on_invalid_names = true;
-
- var $valid_types = array();
-
- var $force_defaults = true;
-
- var $max_identifiers_length = null;
-
- // }}}
- // {{{ constructor
-
- /**
- * PHP 5 constructor
- *
- * @param bool $fail_on_invalid_names array with reserved words per RDBMS
- * @param array $valid_types information of all valid fields
- * types
- * @param bool $force_defaults if true sets a default value to
- * field when not explicit
- * @param int $max_identifiers_length maximum allowed size for entities
- * name
- *
- * @return void
- *
- * @access public
- * @static
- */
- function __construct($fail_on_invalid_names = true, $valid_types = array(),
- $force_defaults = true, $max_identifiers_length = null
- ) {
- if (empty($GLOBALS['_MDB2_Schema_Reserved'])) {
- $GLOBALS['_MDB2_Schema_Reserved'] = array();
- }
-
- if (is_array($fail_on_invalid_names)) {
- $this->fail_on_invalid_names = array_intersect($fail_on_invalid_names,
- array_keys($GLOBALS['_MDB2_Schema_Reserved']));
- } elseif ($fail_on_invalid_names === true) {
- $this->fail_on_invalid_names = array_keys($GLOBALS['_MDB2_Schema_Reserved']);
- } else {
- $this->fail_on_invalid_names = array();
- }
- $this->valid_types = $valid_types;
- $this->force_defaults = $force_defaults;
- $this->max_identifiers_length = $max_identifiers_length;
- }
-
- // }}}
- // {{{ raiseError()
-
- /**
- * Pushes a MDB2_Schema_Error into stack and returns it
- *
- * @param int $ecode MDB2_Schema's error code
- * @param string $msg textual message
- *
- * @return object
- * @access private
- * @static
- */
- function &raiseError($ecode, $msg = null)
- {
- $error = MDB2_Schema::raiseError($ecode, null, null, $msg);
- return $error;
- }
-
- // }}}
- // {{{ isBoolean()
-
- /**
- * Verifies if a given value can be considered boolean. If yes, set value
- * to true or false according to its actual contents and return true. If
- * not, keep its contents untouched and return false.
- *
- * @param mixed &$value value to be checked
- *
- * @return bool
- *
- * @access public
- * @static
- */
- function isBoolean(&$value)
- {
- if (is_bool($value)) {
- return true;
- }
-
- if ($value === 0 || $value === 1 || $value === '') {
- $value = (bool)$value;
- return true;
- }
-
- if (!is_string($value)) {
- return false;
- }
-
- switch ($value) {
- case '0':
- case 'N':
- case 'n':
- case 'no':
- case 'false':
- $value = false;
- break;
- case '1':
- case 'Y':
- case 'y':
- case 'yes':
- case 'true':
- $value = true;
- break;
- default:
- return false;
- }
- return true;
- }
-
- // }}}
- // {{{ validateTable()
-
- /* Definition */
- /**
- * Checks whether the definition of a parsed table is valid. Modify table
- * definition when necessary.
- *
- * @param array $tables multi dimensional array that contains the
- * tables of current database.
- * @param array &$table multi dimensional array that contains the
- * structure and optional data of the table.
- * @param string $table_name name of the parsed table
- *
- * @return bool|error object
- *
- * @access public
- */
- function validateTable($tables, &$table, $table_name)
- {
- /* Table name duplicated? */
- if (is_array($tables) && isset($tables[$table_name])) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'table "'.$table_name.'" already exists');
- }
-
- /**
- * Valid name ?
- */
- $result = $this->validateIdentifier($table_name, 'table');
- if (PEAR::isError($result)) {
- return $result;
- }
-
- /* Was */
- if (empty($table['was'])) {
- $table['was'] = $table_name;
- }
-
- /* Have we got fields? */
- if (empty($table['fields']) || !is_array($table['fields'])) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'tables need one or more fields');
- }
-
- /* Autoincrement */
- $autoinc = $primary = false;
- foreach ($table['fields'] as $field_name => $field) {
- if (!empty($field['autoincrement'])) {
- if ($autoinc) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'there was already an autoincrement field in "'.$table_name.'" before "'.$field_name.'"');
- }
- $autoinc = $field_name;
- }
- }
-
- /*
- * Checking Indexes
- * this have to be done here otherwise we can't
- * guarantee that all table fields were already
- * defined in the moment we are parsing indexes
- */
- if (!empty($table['indexes']) && is_array($table['indexes'])) {
- foreach ($table['indexes'] as $name => $index) {
- $skip_index = false;
- if (!empty($index['primary'])) {
- /*
- * Lets see if we should skip this index since there is
- * already an auto increment on this field this implying
- * a primary key index.
- */
- if (count($index['fields']) == '1'
- && $autoinc
- && array_key_exists($autoinc, $index['fields'])) {
- $skip_index = true;
- } elseif ($autoinc || $primary) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'there was already an primary index or autoincrement field in "'.$table_name.'" before "'.$name.'"');
- } else {
- $primary = true;
- }
- }
-
- if (!$skip_index && is_array($index['fields'])) {
- foreach ($index['fields'] as $field_name => $field) {
- if (!isset($table['fields'][$field_name])) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'index field "'.$field_name.'" does not exist');
- }
- if (!empty($index['primary'])
- && !$table['fields'][$field_name]['notnull']
- ) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'all primary key fields must be defined notnull in "'.$table_name.'"');
- }
- }
- } else {
- unset($table['indexes'][$name]);
- }
- }
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ validateField()
-
- /**
- * Checks whether the definition of a parsed field is valid. Modify field
- * definition when necessary.
- *
- * @param array $fields multi dimensional array that contains the
- * fields of current table.
- * @param array &$field multi dimensional array that contains the
- * structure of the parsed field.
- * @param string $field_name name of the parsed field
- *
- * @return bool|error object
- *
- * @access public
- */
- function validateField($fields, &$field, $field_name)
- {
- /**
- * Valid name ?
- */
- $result = $this->validateIdentifier($field_name, 'field');
- if (PEAR::isError($result)) {
- return $result;
- }
-
- /* Field name duplicated? */
- if (is_array($fields) && isset($fields[$field_name])) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'field "'.$field_name.'" already exists');
- }
-
- /* Type check */
- if (empty($field['type'])) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'no field type specified');
- }
- if (!empty($this->valid_types) && !array_key_exists($field['type'], $this->valid_types)) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'no valid field type ("'.$field['type'].'") specified');
- }
-
- /* Unsigned */
- if (array_key_exists('unsigned', $field) && !$this->isBoolean($field['unsigned'])) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'unsigned has to be a boolean value');
- }
-
- /* Fixed */
- if (array_key_exists('fixed', $field) && !$this->isBoolean($field['fixed'])) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'fixed has to be a boolean value');
- }
-
- /* Length */
- if (array_key_exists('length', $field) && $field['length'] <= 0) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'length has to be an integer greater 0');
- }
-
- // if it's a DECIMAL datatype, check if a 'scale' value is provided:
- // <length>8,4</length> should be translated to DECIMAL(8,4)
- if (is_float($this->valid_types[$field['type']])
- && !empty($field['length'])
- && strpos($field['length'], ',') !== false
- ) {
- list($field['length'], $field['scale']) = explode(',', $field['length']);
- }
-
- /* Was */
- if (empty($field['was'])) {
- $field['was'] = $field_name;
- }
-
- /* Notnull */
- if (empty($field['notnull'])) {
- $field['notnull'] = false;
- }
- if (!$this->isBoolean($field['notnull'])) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'field "notnull" has to be a boolean value');
- }
-
- /* Default */
- if ($this->force_defaults
- && !array_key_exists('default', $field)
- && $field['type'] != 'clob' && $field['type'] != 'blob'
- ) {
- $field['default'] = $this->valid_types[$field['type']];
- }
- if (array_key_exists('default', $field)) {
- if ($field['type'] == 'clob' || $field['type'] == 'blob') {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- '"'.$field['type'].'"-fields are not allowed to have a default value');
- }
- if ($field['default'] === '' && !$field['notnull']) {
- $field['default'] = null;
- }
- }
- if (isset($field['default'])
- && PEAR::isError($result = $this->validateDataFieldValue($field, $field['default'], $field_name))
- ) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'default value of "'.$field_name.'" is incorrect: '.$result->getUserinfo());
- }
-
- /* Autoincrement */
- if (!empty($field['autoincrement'])) {
- if (!$field['notnull']) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'all autoincrement fields must be defined notnull');
- }
-
- if (empty($field['default'])) {
- $field['default'] = '0';
- } elseif ($field['default'] !== '0' && $field['default'] !== 0) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'all autoincrement fields must be defined default "0"');
- }
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ validateIndex()
-
- /**
- * Checks whether a parsed index is valid. Modify index definition when
- * necessary.
- *
- * @param array $table_indexes multi dimensional array that contains the
- * indexes of current table.
- * @param array &$index multi dimensional array that contains the
- * structure of the parsed index.
- * @param string $index_name name of the parsed index
- *
- * @return bool|error object
- *
- * @access public
- */
- function validateIndex($table_indexes, &$index, $index_name)
- {
- /**
- * Valid name ?
- */
- $result = $this->validateIdentifier($index_name, 'index');
- if (PEAR::isError($result)) {
- return $result;
- }
-
- if (is_array($table_indexes) && isset($table_indexes[$index_name])) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'index "'.$index_name.'" already exists');
- }
- if (array_key_exists('unique', $index) && !$this->isBoolean($index['unique'])) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'field "unique" has to be a boolean value');
- }
- if (array_key_exists('primary', $index) && !$this->isBoolean($index['primary'])) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'field "primary" has to be a boolean value');
- }
-
- /* Have we got fields? */
- if (empty($index['fields']) || !is_array($index['fields'])) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'indexes need one or more fields');
- }
-
- if (empty($index['was'])) {
- $index['was'] = $index_name;
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ validateIndexField()
-
- /**
- * Checks whether a parsed index-field is valid. Modify its definition when
- * necessary.
- *
- * @param array $index_fields multi dimensional array that contains the
- * fields of current index.
- * @param array &$field multi dimensional array that contains the
- * structure of the parsed index-field.
- * @param string $field_name name of the parsed index-field
- *
- * @return bool|error object
- *
- * @access public
- */
- function validateIndexField($index_fields, &$field, $field_name)
- {
- /**
- * Valid name ?
- */
- $result = $this->validateIdentifier($field_name, 'index field');
- if (PEAR::isError($result)) {
- return $result;
- }
-
- if (is_array($index_fields) && isset($index_fields[$field_name])) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'index field "'.$field_name.'" already exists');
- }
- if (empty($field['sorting'])) {
- $field['sorting'] = 'ascending';
- } elseif ($field['sorting'] !== 'ascending' && $field['sorting'] !== 'descending') {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'sorting type unknown');
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ validateConstraint()
-
- /**
- * Checks whether a parsed foreign key is valid. Modify its definition when
- * necessary.
- *
- * @param array $table_constraints multi dimensional array that contains the
- * constraints of current table.
- * @param array &$constraint multi dimensional array that contains the
- * structure of the parsed foreign key.
- * @param string $constraint_name name of the parsed foreign key
- *
- * @return bool|error object
- *
- * @access public
- */
- function validateConstraint($table_constraints, &$constraint, $constraint_name)
- {
- /**
- * Valid name ?
- */
- $result = $this->validateIdentifier($constraint_name, 'foreign key');
- if (PEAR::isError($result)) {
- return $result;
- }
-
- if (is_array($table_constraints) && isset($table_constraints[$constraint_name])) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'foreign key "'.$constraint_name.'" already exists');
- }
-
- /* Have we got fields? */
- if (empty($constraint['fields']) || !is_array($constraint['fields'])) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'foreign key "'.$constraint_name.'" need one or more fields');
- }
-
- /* Have we got referenced fields? */
- if (empty($constraint['references']) || !is_array($constraint['references'])) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'foreign key "'.$constraint_name.'" need to reference one or more fields');
- }
-
- /* Have we got referenced table? */
- if (empty($constraint['references']['table'])) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'foreign key "'.$constraint_name.'" need to reference a table');
- }
-
- if (empty($constraint['was'])) {
- $constraint['was'] = $constraint_name;
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ validateConstraintField()
-
- /**
- * Checks whether a foreign-field is valid.
- *
- * @param array $constraint_fields multi dimensional array that contains the
- * fields of current foreign key.
- * @param string $field_name name of the parsed foreign-field
- *
- * @return bool|error object
- *
- * @access public
- */
- function validateConstraintField($constraint_fields, $field_name)
- {
- /**
- * Valid name ?
- */
- $result = $this->validateIdentifier($field_name, 'foreign key field');
- if (PEAR::isError($result)) {
- return $result;
- }
-
- if (is_array($constraint_fields) && isset($constraint_fields[$field_name])) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'foreign field "'.$field_name.'" already exists');
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ validateConstraintReferencedField()
-
- /**
- * Checks whether a foreign-referenced field is valid.
- *
- * @param array $referenced_fields multi dimensional array that contains the
- * fields of current foreign key.
- * @param string $field_name name of the parsed foreign-field
- *
- * @return bool|error object
- *
- * @access public
- */
- function validateConstraintReferencedField($referenced_fields, $field_name)
- {
- /**
- * Valid name ?
- */
- $result = $this->validateIdentifier($field_name, 'referenced foreign field');
- if (PEAR::isError($result)) {
- return $result;
- }
-
- if (is_array($referenced_fields) && isset($referenced_fields[$field_name])) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'foreign field "'.$field_name.'" already referenced');
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ validateSequence()
-
- /**
- * Checks whether the definition of a parsed sequence is valid. Modify
- * sequence definition when necessary.
- *
- * @param array $sequences multi dimensional array that contains the
- * sequences of current database.
- * @param array &$sequence multi dimensional array that contains the
- * structure of the parsed sequence.
- * @param string $sequence_name name of the parsed sequence
- *
- * @return bool|error object
- *
- * @access public
- */
- function validateSequence($sequences, &$sequence, $sequence_name)
- {
- /**
- * Valid name ?
- */
- $result = $this->validateIdentifier($sequence_name, 'sequence');
- if (PEAR::isError($result)) {
- return $result;
- }
-
- if (is_array($sequences) && isset($sequences[$sequence_name])) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'sequence "'.$sequence_name.'" already exists');
- }
-
- if (is_array($this->fail_on_invalid_names)) {
- $name = strtoupper($sequence_name);
- foreach ($this->fail_on_invalid_names as $rdbms) {
- if (in_array($name, $GLOBALS['_MDB2_Schema_Reserved'][$rdbms])) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'sequence name "'.$sequence_name.'" is a reserved word in: '.$rdbms);
- }
- }
- }
-
- if (empty($sequence['was'])) {
- $sequence['was'] = $sequence_name;
- }
-
- if (!empty($sequence['on'])
- && (empty($sequence['on']['table']) || empty($sequence['on']['field']))
- ) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'sequence "'.$sequence_name.'" on a table was not properly defined');
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ validateDatabase()
-
- /**
- * Checks whether a parsed database is valid. Modify its structure and
- * data when necessary.
- *
- * @param array &$database multi dimensional array that contains the
- * structure and optional data of the database.
- *
- * @return bool|error object
- *
- * @access public
- */
- function validateDatabase(&$database)
- {
- if (!is_array($database)) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'something wrong went with database definition');
- }
-
- /**
- * Valid name ?
- */
- $result = $this->validateIdentifier($database['name'], 'database');
- if (PEAR::isError($result)) {
- return $result;
- }
-
- /* Create */
- if (isset($database['create'])
- && !$this->isBoolean($database['create'])
- ) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'field "create" has to be a boolean value');
- }
-
- /* Overwrite */
- if (isset($database['overwrite'])
- && $database['overwrite'] !== ''
- && !$this->isBoolean($database['overwrite'])
- ) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'field "overwrite" has to be a boolean value');
- }
-
- /*
- * This have to be done here otherwise we can't guarantee that all
- * tables were already defined in the moment we are parsing constraints
- */
- if (isset($database['tables'])) {
- foreach ($database['tables'] as $table_name => $table) {
- if (!empty($table['constraints'])) {
- foreach ($table['constraints'] as $constraint_name => $constraint) {
- $referenced_table_name = $constraint['references']['table'];
-
- if (!isset($database['tables'][$referenced_table_name])) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'referenced table "'.$referenced_table_name.'" of foreign key "'.$constraint_name.'" of table "'.$table_name.'" does not exist');
- }
-
- if (empty($constraint['references']['fields'])) {
- $referenced_table = $database['tables'][$referenced_table_name];
-
- $primary = false;
-
- if (!empty($referenced_table['indexes'])) {
- foreach ($referenced_table['indexes'] as $index_name => $index) {
- if (array_key_exists('primary', $index)
- && $index['primary']
- ) {
- $primary = array();
- foreach ($index['fields'] as $field_name => $field) {
- $primary[$field_name] = '';
- }
- break;
- }
- }
- }
-
- if (!$primary) {
- foreach ($referenced_table['fields'] as $field_name => $field) {
- if (array_key_exists('autoincrement', $field)
- && $field['autoincrement']
- ) {
- $primary = array( $field_name => '' );
- break;
- }
- }
- }
-
- if (!$primary) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'referenced table "'.$referenced_table_name.'" has no primary key and no referenced field was specified for foreign key "'.$constraint_name.'" of table "'.$table_name.'"');
- }
-
- $constraint['references']['fields'] = $primary;
- }
-
- /* the same number of referencing and referenced fields ? */
- if (count($constraint['fields']) != count($constraint['references']['fields'])) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'The number of fields in the referenced key must match those of the foreign key "'.$constraint_name.'"');
- }
-
- $database['tables'][$table_name]['constraints'][$constraint_name]['references']['fields'] = $constraint['references']['fields'];
- }
- }
- }
- }
-
- /*
- * This have to be done here otherwise we can't guarantee that all
- * tables were already defined in the moment we are parsing sequences
- */
- if (isset($database['sequences'])) {
- foreach ($database['sequences'] as $seq_name => $seq) {
- if (!empty($seq['on'])
- && empty($database['tables'][$seq['on']['table']]['fields'][$seq['on']['field']])
- ) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'sequence "'.$seq_name.'" was assigned on unexisting field/table');
- }
- }
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ validateDataField()
-
- /* Data Manipulation */
- /**
- * Checks whether a parsed DML-field is valid. Modify its structure when
- * necessary. This is called when validating INSERT and
- * UPDATE.
- *
- * @param array $table_fields multi dimensional array that contains the
- * definition for current table's fields.
- * @param array $instruction_fields multi dimensional array that contains the
- * parsed fields of the current DML instruction.
- * @param string &$field array that contains the parsed instruction field
- *
- * @return bool|error object
- *
- * @access public
- */
- function validateDataField($table_fields, $instruction_fields, &$field)
- {
- /**
- * Valid name ?
- */
- $result = $this->validateIdentifier($field['name'], 'field');
- if (PEAR::isError($result)) {
- return $result;
- }
-
- if (is_array($instruction_fields) && isset($instruction_fields[$field['name']])) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'field "'.$field['name'].'" already initialized');
- }
-
- if (is_array($table_fields) && !isset($table_fields[$field['name']])) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- '"'.$field['name'].'" is not defined');
- }
-
- if (!isset($field['group']['type'])) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- '"'.$field['name'].'" has no initial value');
- }
-
- if (isset($field['group']['data'])
- && $field['group']['type'] == 'value'
- && $field['group']['data'] !== ''
- && PEAR::isError($result = $this->validateDataFieldValue($table_fields[$field['name']], $field['group']['data'], $field['name']))
- ) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- 'value of "'.$field['name'].'" is incorrect: '.$result->getUserinfo());
- }
-
- return MDB2_OK;
- }
-
- // }}}
- // {{{ validateDataFieldValue()
-
- /**
- * Checks whether a given value is compatible with a table field. This is
- * done when parsing a field for a INSERT or UPDATE instruction.
- *
- * @param array $field_def multi dimensional array that contains the
- * definition for current table's fields.
- * @param string &$field_value value to fill the parsed field
- * @param string $field_name name of the parsed field
- *
- * @return bool|error object
- *
- * @access public
- * @see MDB2_Schema_Validate::validateInsertField()
- */
- function validateDataFieldValue($field_def, &$field_value, $field_name)
- {
- switch ($field_def['type']) {
- case 'text':
- case 'clob':
- if (!empty($field_def['length']) && strlen($field_value) > $field_def['length']) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- '"'.$field_value.'" is larger than "'.$field_def['length'].'"');
- }
- break;
- case 'blob':
- $field_value = pack('H*', $field_value);
- if (!empty($field_def['length']) && strlen($field_value) > $field_def['length']) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- '"'.$field_value.'" is larger than "'.$field_def['type'].'"');
- }
- break;
- case 'integer':
- if ($field_value != ((int)$field_value)) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- '"'.$field_value.'" is not of type "'.$field_def['type'].'"');
- }
- //$field_value = (int)$field_value;
- if (!empty($field_def['unsigned']) && $field_def['unsigned'] && $field_value < 0) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- '"'.$field_value.'" signed instead of unsigned');
- }
- break;
- case 'boolean':
- if (!$this->isBoolean($field_value)) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- '"'.$field_value.'" is not of type "'.$field_def['type'].'"');
- }
- break;
- case 'date':
- if (!preg_match('/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})/', $field_value)
- && $field_value !== 'CURRENT_DATE'
- ) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- '"'.$field_value.'" is not of type "'.$field_def['type'].'"');
- }
- break;
- case 'timestamp':
- if (!preg_match('/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})/', $field_value)
- && strcasecmp($field_value, 'now()') != 0
- && $field_value !== 'CURRENT_TIMESTAMP'
- ) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- '"'.$field_value.'" is not of type "'.$field_def['type'].'"');
- }
- break;
- case 'time':
- if (!preg_match("/([0-9]{2}):([0-9]{2}):([0-9]{2})/", $field_value)
- && $field_value !== 'CURRENT_TIME'
- ) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- '"'.$field_value.'" is not of type "'.$field_def['type'].'"');
- }
- break;
- case 'float':
- case 'double':
- if ($field_value != (double)$field_value) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- '"'.$field_value.'" is not of type "'.$field_def['type'].'"');
- }
- //$field_value = (double)$field_value;
- break;
- }
- return MDB2_OK;
- }
-
- // }}}
- // {{{ validateIdentifier()
-
- /**
- * Checks whether a given identifier is valid for current driver.
- *
- * @param string $id identifier to check
- * @param string $type whether identifier represents a table name, index, etc.
- *
- * @return bool|error object
- *
- * @access public
- */
- function validateIdentifier($id, $type)
- {
- $max_length = $this->max_identifiers_length;
- $cur_length = strlen($id);
-
- /**
- * Have we got a name?
- */
- if (!$id) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- "a $type has to have a name");
- }
-
- /**
- * Supported length ?
- */
- if ($max_length !== null
- && $cur_length > $max_length
- ) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- "$type name '$id' is too long for current driver");
- } elseif ($cur_length > 30) {
- // FIXME: find a way to issue a warning in MDB2_Schema object
- /* $this->warnings[] = "$type name '$id' might not be
- portable to other drivers"; */
- }
-
- /**
- * Reserved ?
- */
- if (is_array($this->fail_on_invalid_names)) {
- $name = strtoupper($id);
- foreach ($this->fail_on_invalid_names as $rdbms) {
- if (in_array($name, $GLOBALS['_MDB2_Schema_Reserved'][$rdbms])) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE,
- "$type name '$id' is a reserved word in: $rdbms");
- }
- }
- }
-
- return MDB2_OK;
- }
-
- // }}}
-}
diff --git a/3rdparty/MDB2/Schema/Writer.php b/3rdparty/MDB2/Schema/Writer.php
deleted file mode 100644
index 3eaa39a2071..00000000000
--- a/3rdparty/MDB2/Schema/Writer.php
+++ /dev/null
@@ -1,586 +0,0 @@
-<?php /* vim: se et ts=4 sw=4 sts=4 fdm=marker tw=80: */
-/**
- * Copyright (c) 1998-2010 Manuel Lemos, Tomas V.V.Cox,
- * Stig. S. Bakken, Lukas Smith, Igor Feghali
- * All rights reserved.
- *
- * MDB2_Schema enables users to maintain RDBMS independant schema files
- * in XML that can be used to manipulate both data and database schemas
- * This LICENSE is in the BSD license style.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * Neither the name of Manuel Lemos, Tomas V.V.Cox, Stig. S. Bakken,
- * Lukas Smith, Igor Feghali nor the names of his contributors may be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
- * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * PHP version 5
- *
- * @category Database
- * @package MDB2_Schema
- * @author Lukas Smith <smith@pooteeweet.org>
- * @author Igor Feghali <ifeghali@php.net>
- * @license BSD http://www.opensource.org/licenses/bsd-license.php
- * @version SVN: $Id$
- * @link http://pear.php.net/packages/MDB2_Schema
- */
-
-/**
- * Writes an XML schema file
- *
- * @category Database
- * @package MDB2_Schema
- * @author Lukas Smith <smith@pooteeweet.org>
- * @license BSD http://www.opensource.org/licenses/bsd-license.php
- * @link http://pear.php.net/packages/MDB2_Schema
- */
-class MDB2_Schema_Writer
-{
- // {{{ properties
-
- var $valid_types = array();
-
- // }}}
- // {{{ constructor
-
- /**
- * PHP 5 constructor
- *
- * @param array $valid_types information of all valid fields
- * types
- *
- * @return void
- *
- * @access public
- * @static
- */
- function __construct($valid_types = array())
- {
- $this->valid_types = $valid_types;
- }
-
- // }}}
- // {{{ raiseError()
-
- /**
- * This method is used to communicate an error and invoke error
- * callbacks etc. Basically a wrapper for PEAR::raiseError
- * without the message string.
- *
- * @param int|PEAR_Error $code integer error code or and PEAR_Error
- * instance
- * @param int $mode error mode, see PEAR_Error docs error
- * level (E_USER_NOTICE etc). If error mode
- * is PEAR_ERROR_CALLBACK, this is the
- * callback function, either as a function
- * name, or as an array of an object and
- * method name. For other error modes this
- * parameter is ignored.
- * @param string $options Extra debug information. Defaults to the
- * last query and native error code.
- * @param string $userinfo User-friendly error message
- *
- * @return object a PEAR error object
- * @access public
- * @see PEAR_Error
- */
- function &raiseError($code = null, $mode = null, $options = null, $userinfo = null)
- {
- $error = MDB2_Schema::raiseError($code, $mode, $options, $userinfo);
- return $error;
- }
-
- // }}}
- // {{{ _escapeSpecialChars()
-
- /**
- * add escapecharacters to all special characters in a string
- *
- * @param string $string string that should be escaped
- *
- * @return string escaped string
- * @access protected
- */
- function _escapeSpecialChars($string)
- {
- if (!is_string($string)) {
- $string = strval($string);
- }
-
- $escaped = '';
- for ($char = 0, $count = strlen($string); $char < $count; $char++) {
- switch ($string[$char]) {
- case '&':
- $escaped .= '&amp;';
- break;
- case '>':
- $escaped .= '&gt;';
- break;
- case '<':
- $escaped .= '&lt;';
- break;
- case '"':
- $escaped .= '&quot;';
- break;
- case '\'':
- $escaped .= '&apos;';
- break;
- default:
- $code = ord($string[$char]);
- if ($code < 32 || $code > 127) {
- $escaped .= "&#$code;";
- } else {
- $escaped .= $string[$char];
- }
- break;
- }
- }
- return $escaped;
- }
-
- // }}}
- // {{{ _dumpBoolean()
-
- /**
- * dump the structure of a sequence
- *
- * @param string $boolean boolean value or variable definition
- *
- * @return string with xml boolea definition
- * @access private
- */
- function _dumpBoolean($boolean)
- {
- if (is_string($boolean)) {
- if ($boolean !== 'true' || $boolean !== 'false'
- || preg_match('/<variable>.*</variable>/', $boolean)
- ) {
- return $boolean;
- }
- }
- return $boolean ? 'true' : 'false';
- }
-
- // }}}
- // {{{ dumpSequence()
-
- /**
- * dump the structure of a sequence
- *
- * @param string $sequence_definition sequence definition
- * @param string $sequence_name sequence name
- * @param string $eol end of line characters
- * @param integer $dump determines what data to dump
- * MDB2_SCHEMA_DUMP_ALL : the entire db
- * MDB2_SCHEMA_DUMP_STRUCTURE : only the structure of the db
- * MDB2_SCHEMA_DUMP_CONTENT : only the content of the db
- *
- * @return mixed string xml sequence definition on success, or a error object
- * @access public
- */
- function dumpSequence($sequence_definition, $sequence_name, $eol, $dump = MDB2_SCHEMA_DUMP_ALL)
- {
- $buffer = "$eol <sequence>$eol <name>$sequence_name</name>$eol";
- if ($dump == MDB2_SCHEMA_DUMP_ALL || $dump == MDB2_SCHEMA_DUMP_CONTENT) {
- if (!empty($sequence_definition['start'])) {
- $start = $sequence_definition['start'];
- $buffer .= " <start>$start</start>$eol";
- }
- }
-
- if (!empty($sequence_definition['on'])) {
- $buffer .= " <on>$eol";
- $buffer .= " <table>".$sequence_definition['on']['table'];
- $buffer .= "</table>$eol <field>".$sequence_definition['on']['field'];
- $buffer .= "</field>$eol </on>$eol";
- }
- $buffer .= " </sequence>$eol";
-
- return $buffer;
- }
-
- // }}}
- // {{{ dumpDatabase()
-
- /**
- * Dump a previously parsed database structure in the Metabase schema
- * XML based format suitable for the Metabase parser. This function
- * may optionally dump the database definition with initialization
- * commands that specify the data that is currently present in the tables.
- *
- * @param array $database_definition unknown
- * @param array $arguments associative array that takes pairs of tag
- * names and values that define dump options.
- * array (
- * 'output_mode' => String
- * 'file' : dump into a file
- * default: dump using a function
- * 'output' => String
- * depending on the 'Output_Mode'
- * name of the file
- * name of the function
- * 'end_of_line' => String
- * end of line delimiter that should be used
- * default: "\n"
- * );
- * @param integer $dump determines what data to dump
- * MDB2_SCHEMA_DUMP_ALL : the entire db
- * MDB2_SCHEMA_DUMP_STRUCTURE : only the structure of the db
- * MDB2_SCHEMA_DUMP_CONTENT : only the content of the db
- *
- * @return mixed MDB2_OK on success, or a error object
- * @access public
- */
- function dumpDatabase($database_definition, $arguments, $dump = MDB2_SCHEMA_DUMP_ALL)
- {
- if (!empty($arguments['output'])) {
- if (!empty($arguments['output_mode']) && $arguments['output_mode'] == 'file') {
- $fp = fopen($arguments['output'], 'w');
- if ($fp === false) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_WRITER, null, null,
- 'it was not possible to open output file');
- }
-
- $output = false;
- } elseif (is_callable($arguments['output'])) {
- $output = $arguments['output'];
- } else {
- return $this->raiseError(MDB2_SCHEMA_ERROR_WRITER, null, null,
- 'no valid output function specified');
- }
- } else {
- return $this->raiseError(MDB2_SCHEMA_ERROR_WRITER, null, null,
- 'no output method specified');
- }
-
- $eol = isset($arguments['end_of_line']) ? $arguments['end_of_line'] : "\n";
-
- $sequences = array();
- if (!empty($database_definition['sequences'])
- && is_array($database_definition['sequences'])
- ) {
- foreach ($database_definition['sequences'] as $sequence_name => $sequence) {
- $table = !empty($sequence['on']) ? $sequence['on']['table'] :'';
-
- $sequences[$table][] = $sequence_name;
- }
- }
-
- $buffer = '<?xml version="1.0" encoding="ISO-8859-1" ?>'.$eol;
- $buffer .= "<database>$eol$eol <name>".$database_definition['name']."</name>";
- $buffer .= "$eol <create>".$this->_dumpBoolean($database_definition['create'])."</create>";
- $buffer .= "$eol <overwrite>".$this->_dumpBoolean($database_definition['overwrite'])."</overwrite>$eol";
- $buffer .= "$eol <charset>".$database_definition['charset']."</charset>$eol";
-
- if ($output) {
- call_user_func($output, $buffer);
- } else {
- fwrite($fp, $buffer);
- }
-
- if (!empty($database_definition['tables']) && is_array($database_definition['tables'])) {
- foreach ($database_definition['tables'] as $table_name => $table) {
- $buffer = "$eol <table>$eol$eol <name>$table_name</name>$eol";
- if ($dump == MDB2_SCHEMA_DUMP_ALL || $dump == MDB2_SCHEMA_DUMP_STRUCTURE) {
- $buffer .= "$eol <declaration>$eol";
- if (!empty($table['fields']) && is_array($table['fields'])) {
- foreach ($table['fields'] as $field_name => $field) {
- if (empty($field['type'])) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE, null, null,
- 'it was not specified the type of the field "'.
- $field_name.'" of the table "'.$table_name.'"');
- }
- if (!empty($this->valid_types) && !array_key_exists($field['type'], $this->valid_types)) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_UNSUPPORTED, null, null,
- 'type "'.$field['type'].'" is not yet supported');
- }
- $buffer .= "$eol <field>$eol <name>$field_name</name>$eol <type>";
- $buffer .= $field['type']."</type>$eol";
- if (!empty($field['fixed']) && $field['type'] === 'text') {
- $buffer .= " <fixed>".$this->_dumpBoolean($field['fixed'])."</fixed>$eol";
- }
- if (array_key_exists('default', $field)
- && $field['type'] !== 'clob' && $field['type'] !== 'blob'
- ) {
- $buffer .= ' <default>'.$this->_escapeSpecialChars($field['default'])."</default>$eol";
- }
- if (!empty($field['notnull'])) {
- $buffer .= " <notnull>".$this->_dumpBoolean($field['notnull'])."</notnull>$eol";
- } else {
- $buffer .= " <notnull>false</notnull>$eol";
- }
- if (!empty($field['autoincrement'])) {
- $buffer .= " <autoincrement>" . $field['autoincrement'] ."</autoincrement>$eol";
- }
- if (!empty($field['unsigned'])) {
- $buffer .= " <unsigned>".$this->_dumpBoolean($field['unsigned'])."</unsigned>$eol";
- }
- if (!empty($field['length'])) {
- $buffer .= ' <length>'.$field['length']."</length>$eol";
- }
- $buffer .= " </field>$eol";
- }
- }
-
- if (!empty($table['indexes']) && is_array($table['indexes'])) {
- foreach ($table['indexes'] as $index_name => $index) {
- if (strtolower($index_name) === 'primary') {
- $index_name = $table_name . '_pKey';
- }
- $buffer .= "$eol <index>$eol <name>$index_name</name>$eol";
- if (!empty($index['unique'])) {
- $buffer .= " <unique>".$this->_dumpBoolean($index['unique'])."</unique>$eol";
- }
-
- if (!empty($index['primary'])) {
- $buffer .= " <primary>".$this->_dumpBoolean($index['primary'])."</primary>$eol";
- }
-
- foreach ($index['fields'] as $field_name => $field) {
- $buffer .= " <field>$eol <name>$field_name</name>$eol";
- if (!empty($field) && is_array($field)) {
- $buffer .= ' <sorting>'.$field['sorting']."</sorting>$eol";
- }
- $buffer .= " </field>$eol";
- }
- $buffer .= " </index>$eol";
- }
- }
-
- if (!empty($table['constraints']) && is_array($table['constraints'])) {
- foreach ($table['constraints'] as $constraint_name => $constraint) {
- $buffer .= "$eol <foreign>$eol <name>$constraint_name</name>$eol";
- if (empty($constraint['fields']) || !is_array($constraint['fields'])) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE, null, null,
- 'it was not specified a field for the foreign key "'.
- $constraint_name.'" of the table "'.$table_name.'"');
- }
- if (!is_array($constraint['references']) || empty($constraint['references']['table'])) {
- return $this->raiseError(MDB2_SCHEMA_ERROR_VALIDATE, null, null,
- 'it was not specified the referenced table of the foreign key "'.
- $constraint_name.'" of the table "'.$table_name.'"');
- }
- if (!empty($constraint['match'])) {
- $buffer .= " <match>".$constraint['match']."</match>$eol";
- }
- if (!empty($constraint['ondelete'])) {
- $buffer .= " <ondelete>".$constraint['ondelete']."</ondelete>$eol";
- }
- if (!empty($constraint['onupdate'])) {
- $buffer .= " <onupdate>".$constraint['onupdate']."</onupdate>$eol";
- }
- if (!empty($constraint['deferrable'])) {
- $buffer .= " <deferrable>".$constraint['deferrable']."</deferrable>$eol";
- }
- if (!empty($constraint['initiallydeferred'])) {
- $buffer .= " <initiallydeferred>".$constraint['initiallydeferred']."</initiallydeferred>$eol";
- }
- foreach ($constraint['fields'] as $field_name => $field) {
- $buffer .= " <field>$field_name</field>$eol";
- }
- $buffer .= " <references>$eol <table>".$constraint['references']['table']."</table>$eol";
- foreach ($constraint['references']['fields'] as $field_name => $field) {
- $buffer .= " <field>$field_name</field>$eol";
- }
- $buffer .= " </references>$eol";
-
- $buffer .= " </foreign>$eol";
- }
- }
-
- $buffer .= "$eol </declaration>$eol";
- }
-
- if ($output) {
- call_user_func($output, $buffer);
- } else {
- fwrite($fp, $buffer);
- }
-
- $buffer = '';
- if ($dump == MDB2_SCHEMA_DUMP_ALL || $dump == MDB2_SCHEMA_DUMP_CONTENT) {
- if (!empty($table['initialization']) && is_array($table['initialization'])) {
- $buffer = "$eol <initialization>$eol";
- foreach ($table['initialization'] as $instruction) {
- switch ($instruction['type']) {
- case 'insert':
- $buffer .= "$eol <insert>$eol";
- foreach ($instruction['data']['field'] as $field) {
- $field_name = $field['name'];
-
- $buffer .= "$eol <field>$eol <name>$field_name</name>$eol";
- $buffer .= $this->writeExpression($field['group'], 5, $arguments);
- $buffer .= " </field>$eol";
- }
- $buffer .= "$eol </insert>$eol";
- break;
- case 'update':
- $buffer .= "$eol <update>$eol";
- foreach ($instruction['data']['field'] as $field) {
- $field_name = $field['name'];
-
- $buffer .= "$eol <field>$eol <name>$field_name</name>$eol";
- $buffer .= $this->writeExpression($field['group'], 5, $arguments);
- $buffer .= " </field>$eol";
- }
-
- if (!empty($instruction['data']['where'])
- && is_array($instruction['data']['where'])
- ) {
- $buffer .= " <where>$eol";
- $buffer .= $this->writeExpression($instruction['data']['where'], 5, $arguments);
- $buffer .= " </where>$eol";
- }
-
- $buffer .= "$eol </update>$eol";
- break;
- case 'delete':
- $buffer .= "$eol <delete>$eol$eol";
- if (!empty($instruction['data']['where'])
- && is_array($instruction['data']['where'])
- ) {
- $buffer .= " <where>$eol";
- $buffer .= $this->writeExpression($instruction['data']['where'], 5, $arguments);
- $buffer .= " </where>$eol";
- }
- $buffer .= "$eol </delete>$eol";
- break;
- }
- }
- $buffer .= "$eol </initialization>$eol";
- }
- }
- $buffer .= "$eol </table>$eol";
- if ($output) {
- call_user_func($output, $buffer);
- } else {
- fwrite($fp, $buffer);
- }
-
- if (isset($sequences[$table_name])) {
- foreach ($sequences[$table_name] as $sequence) {
- $result = $this->dumpSequence($database_definition['sequences'][$sequence],
- $sequence, $eol, $dump);
- if (PEAR::isError($result)) {
- return $result;
- }
-
- if ($output) {
- call_user_func($output, $result);
- } else {
- fwrite($fp, $result);
- }
- }
- }
- }
- }
-
- if (isset($sequences[''])) {
- foreach ($sequences[''] as $sequence) {
- $result = $this->dumpSequence($database_definition['sequences'][$sequence],
- $sequence, $eol, $dump);
- if (PEAR::isError($result)) {
- return $result;
- }
-
- if ($output) {
- call_user_func($output, $result);
- } else {
- fwrite($fp, $result);
- }
- }
- }
-
- $buffer = "$eol</database>$eol";
- if ($output) {
- call_user_func($output, $buffer);
- } else {
- fwrite($fp, $buffer);
- fclose($fp);
- }
-
- return MDB2_OK;
- }
-
- // }}}
- // {{{ writeExpression()
-
- /**
- * Dumps the structure of an element. Elements can be value, column,
- * function or expression.
- *
- * @param array $element multi dimensional array that represents the parsed element
- * of a DML instruction.
- * @param integer $offset base indentation width
- * @param array $arguments associative array that takes pairs of tag
- * names and values that define dump options.
- *
- * @return string
- *
- * @access public
- * @see MDB2_Schema_Writer::dumpDatabase()
- */
- function writeExpression($element, $offset = 0, $arguments = null)
- {
- $eol = isset($arguments['end_of_line']) ? $arguments['end_of_line'] : "\n";
- $str = '';
-
- $indent = str_repeat(' ', $offset);
- $noffset = $offset + 1;
-
- switch ($element['type']) {
- case 'value':
- $str .= "$indent<value>".$this->_escapeSpecialChars($element['data'])."</value>$eol";
- break;
- case 'column':
- $str .= "$indent<column>".$this->_escapeSpecialChars($element['data'])."</column>$eol";
- break;
- case 'function':
- $str .= "$indent<function>$eol$indent <name>".$this->_escapeSpecialChars($element['data']['name'])."</name>$eol";
-
- if (!empty($element['data']['arguments'])
- && is_array($element['data']['arguments'])
- ) {
- foreach ($element['data']['arguments'] as $v) {
- $str .= $this->writeExpression($v, $noffset, $arguments);
- }
- }
-
- $str .= "$indent</function>$eol";
- break;
- case 'expression':
- $str .= "$indent<expression>$eol";
- $str .= $this->writeExpression($element['data']['operants'][0], $noffset, $arguments);
- $str .= "$indent <operator>".$element['data']['operator']."</operator>$eol";
- $str .= $this->writeExpression($element['data']['operants'][1], $noffset, $arguments);
- $str .= "$indent</expression>$eol";
- break;
- }
- return $str;
- }
-
- // }}}
-}
diff --git a/3rdparty/OS/Guess.php b/3rdparty/OS/Guess.php
deleted file mode 100644
index d3f2cc764eb..00000000000
--- a/3rdparty/OS/Guess.php
+++ /dev/null
@@ -1,338 +0,0 @@
-<?php
-/**
- * The OS_Guess class
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Stig Bakken <ssb@php.net>
- * @author Gregory Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Guess.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since PEAR 0.1
- */
-
-// {{{ uname examples
-
-// php_uname() without args returns the same as 'uname -a', or a PHP-custom
-// string for Windows.
-// PHP versions prior to 4.3 return the uname of the host where PHP was built,
-// as of 4.3 it returns the uname of the host running the PHP code.
-//
-// PC RedHat Linux 7.1:
-// Linux host.example.com 2.4.2-2 #1 Sun Apr 8 20:41:30 EDT 2001 i686 unknown
-//
-// PC Debian Potato:
-// Linux host 2.4.17 #2 SMP Tue Feb 12 15:10:04 CET 2002 i686 unknown
-//
-// PC FreeBSD 3.3:
-// FreeBSD host.example.com 3.3-STABLE FreeBSD 3.3-STABLE #0: Mon Feb 21 00:42:31 CET 2000 root@example.com:/usr/src/sys/compile/CONFIG i386
-//
-// PC FreeBSD 4.3:
-// FreeBSD host.example.com 4.3-RELEASE FreeBSD 4.3-RELEASE #1: Mon Jun 25 11:19:43 EDT 2001 root@example.com:/usr/src/sys/compile/CONFIG i386
-//
-// PC FreeBSD 4.5:
-// FreeBSD host.example.com 4.5-STABLE FreeBSD 4.5-STABLE #0: Wed Feb 6 23:59:23 CET 2002 root@example.com:/usr/src/sys/compile/CONFIG i386
-//
-// PC FreeBSD 4.5 w/uname from GNU shellutils:
-// FreeBSD host.example.com 4.5-STABLE FreeBSD 4.5-STABLE #0: Wed Feb i386 unknown
-//
-// HP 9000/712 HP-UX 10:
-// HP-UX iq B.10.10 A 9000/712 2008429113 two-user license
-//
-// HP 9000/712 HP-UX 10 w/uname from GNU shellutils:
-// HP-UX host B.10.10 A 9000/712 unknown
-//
-// IBM RS6000/550 AIX 4.3:
-// AIX host 3 4 000003531C00
-//
-// AIX 4.3 w/uname from GNU shellutils:
-// AIX host 3 4 000003531C00 unknown
-//
-// SGI Onyx IRIX 6.5 w/uname from GNU shellutils:
-// IRIX64 host 6.5 01091820 IP19 mips
-//
-// SGI Onyx IRIX 6.5:
-// IRIX64 host 6.5 01091820 IP19
-//
-// SparcStation 20 Solaris 8 w/uname from GNU shellutils:
-// SunOS host.example.com 5.8 Generic_108528-12 sun4m sparc
-//
-// SparcStation 20 Solaris 8:
-// SunOS host.example.com 5.8 Generic_108528-12 sun4m sparc SUNW,SPARCstation-20
-//
-// Mac OS X (Darwin)
-// Darwin home-eden.local 7.5.0 Darwin Kernel Version 7.5.0: Thu Aug 5 19:26:16 PDT 2004; root:xnu/xnu-517.7.21.obj~3/RELEASE_PPC Power Macintosh
-//
-// Mac OS X early versions
-//
-
-// }}}
-
-/* TODO:
- * - define endianness, to allow matchSignature("bigend") etc.
- */
-
-/**
- * Retrieves information about the current operating system
- *
- * This class uses php_uname() to grok information about the current OS
- *
- * @category pear
- * @package PEAR
- * @author Stig Bakken <ssb@php.net>
- * @author Gregory Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 0.1
- */
-class OS_Guess
-{
- var $sysname;
- var $nodename;
- var $cpu;
- var $release;
- var $extra;
-
- function OS_Guess($uname = null)
- {
- list($this->sysname,
- $this->release,
- $this->cpu,
- $this->extra,
- $this->nodename) = $this->parseSignature($uname);
- }
-
- function parseSignature($uname = null)
- {
- static $sysmap = array(
- 'HP-UX' => 'hpux',
- 'IRIX64' => 'irix',
- );
- static $cpumap = array(
- 'i586' => 'i386',
- 'i686' => 'i386',
- 'ppc' => 'powerpc',
- );
- if ($uname === null) {
- $uname = php_uname();
- }
- $parts = preg_split('/\s+/', trim($uname));
- $n = count($parts);
-
- $release = $machine = $cpu = '';
- $sysname = $parts[0];
- $nodename = $parts[1];
- $cpu = $parts[$n-1];
- $extra = '';
- if ($cpu == 'unknown') {
- $cpu = $parts[$n - 2];
- }
-
- switch ($sysname) {
- case 'AIX' :
- $release = "$parts[3].$parts[2]";
- break;
- case 'Windows' :
- switch ($parts[1]) {
- case '95/98':
- $release = '9x';
- break;
- default:
- $release = $parts[1];
- break;
- }
- $cpu = 'i386';
- break;
- case 'Linux' :
- $extra = $this->_detectGlibcVersion();
- // use only the first two digits from the kernel version
- $release = preg_replace('/^([0-9]+\.[0-9]+).*/', '\1', $parts[2]);
- break;
- case 'Mac' :
- $sysname = 'darwin';
- $nodename = $parts[2];
- $release = $parts[3];
- if ($cpu == 'Macintosh') {
- if ($parts[$n - 2] == 'Power') {
- $cpu = 'powerpc';
- }
- }
- break;
- case 'Darwin' :
- if ($cpu == 'Macintosh') {
- if ($parts[$n - 2] == 'Power') {
- $cpu = 'powerpc';
- }
- }
- $release = preg_replace('/^([0-9]+\.[0-9]+).*/', '\1', $parts[2]);
- break;
- default:
- $release = preg_replace('/-.*/', '', $parts[2]);
- break;
- }
-
- if (isset($sysmap[$sysname])) {
- $sysname = $sysmap[$sysname];
- } else {
- $sysname = strtolower($sysname);
- }
- if (isset($cpumap[$cpu])) {
- $cpu = $cpumap[$cpu];
- }
- return array($sysname, $release, $cpu, $extra, $nodename);
- }
-
- function _detectGlibcVersion()
- {
- static $glibc = false;
- if ($glibc !== false) {
- return $glibc; // no need to run this multiple times
- }
- $major = $minor = 0;
- include_once "System.php";
- // Use glibc's <features.h> header file to
- // get major and minor version number:
- if (@file_exists('/usr/include/features.h') &&
- @is_readable('/usr/include/features.h')) {
- if (!@file_exists('/usr/bin/cpp') || !@is_executable('/usr/bin/cpp')) {
- $features_file = fopen('/usr/include/features.h', 'rb');
- while (!feof($features_file)) {
- $line = fgets($features_file, 8192);
- if (!$line || (strpos($line, '#define') === false)) {
- continue;
- }
- if (strpos($line, '__GLIBC__')) {
- // major version number #define __GLIBC__ version
- $line = preg_split('/\s+/', $line);
- $glibc_major = trim($line[2]);
- if (isset($glibc_minor)) {
- break;
- }
- continue;
- }
-
- if (strpos($line, '__GLIBC_MINOR__')) {
- // got the minor version number
- // #define __GLIBC_MINOR__ version
- $line = preg_split('/\s+/', $line);
- $glibc_minor = trim($line[2]);
- if (isset($glibc_major)) {
- break;
- }
- continue;
- }
- }
- fclose($features_file);
- if (!isset($glibc_major) || !isset($glibc_minor)) {
- return $glibc = '';
- }
- return $glibc = 'glibc' . trim($glibc_major) . "." . trim($glibc_minor) ;
- } // no cpp
-
- $tmpfile = System::mktemp("glibctest");
- $fp = fopen($tmpfile, "w");
- fwrite($fp, "#include <features.h>\n__GLIBC__ __GLIBC_MINOR__\n");
- fclose($fp);
- $cpp = popen("/usr/bin/cpp $tmpfile", "r");
- while ($line = fgets($cpp, 1024)) {
- if ($line{0} == '#' || trim($line) == '') {
- continue;
- }
-
- if (list($major, $minor) = explode(' ', trim($line))) {
- break;
- }
- }
- pclose($cpp);
- unlink($tmpfile);
- } // features.h
-
- if (!($major && $minor) && @is_link('/lib/libc.so.6')) {
- // Let's try reading the libc.so.6 symlink
- if (preg_match('/^libc-(.*)\.so$/', basename(readlink('/lib/libc.so.6')), $matches)) {
- list($major, $minor) = explode('.', $matches[1]);
- }
- }
-
- if (!($major && $minor)) {
- return $glibc = '';
- }
-
- return $glibc = "glibc{$major}.{$minor}";
- }
-
- function getSignature()
- {
- if (empty($this->extra)) {
- return "{$this->sysname}-{$this->release}-{$this->cpu}";
- }
- return "{$this->sysname}-{$this->release}-{$this->cpu}-{$this->extra}";
- }
-
- function getSysname()
- {
- return $this->sysname;
- }
-
- function getNodename()
- {
- return $this->nodename;
- }
-
- function getCpu()
- {
- return $this->cpu;
- }
-
- function getRelease()
- {
- return $this->release;
- }
-
- function getExtra()
- {
- return $this->extra;
- }
-
- function matchSignature($match)
- {
- $fragments = is_array($match) ? $match : explode('-', $match);
- $n = count($fragments);
- $matches = 0;
- if ($n > 0) {
- $matches += $this->_matchFragment($fragments[0], $this->sysname);
- }
- if ($n > 1) {
- $matches += $this->_matchFragment($fragments[1], $this->release);
- }
- if ($n > 2) {
- $matches += $this->_matchFragment($fragments[2], $this->cpu);
- }
- if ($n > 3) {
- $matches += $this->_matchFragment($fragments[3], $this->extra);
- }
- return ($matches == $n);
- }
-
- function _matchFragment($fragment, $value)
- {
- if (strcspn($fragment, '*?') < strlen($fragment)) {
- $reg = '/^' . str_replace(array('*', '?', '/'), array('.*', '.', '\\/'), $fragment) . '\\z/';
- return preg_match($reg, $value);
- }
- return ($fragment == '*' || !strcasecmp($fragment, $value));
- }
-
-}
-/*
- * Local Variables:
- * indent-tabs-mode: nil
- * c-basic-offset: 4
- * End:
- */ \ No newline at end of file
diff --git a/3rdparty/PEAR-LICENSE b/3rdparty/PEAR-LICENSE
deleted file mode 100644
index a00a2421fd8..00000000000
--- a/3rdparty/PEAR-LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c) 1997-2009,
- Stig Bakken <ssb@php.net>,
- Gregory Beaver <cellog@php.net>,
- Helgi Þormar Þorbjörnsson <helgi@php.net>,
- Tomas V.V.Cox <cox@idecnet.com>,
- Martin Jansen <mj@php.net>.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/3rdparty/PEAR.php b/3rdparty/PEAR.php
deleted file mode 100644
index 501f6a653d8..00000000000
--- a/3rdparty/PEAR.php
+++ /dev/null
@@ -1,1063 +0,0 @@
-<?php
-/**
- * PEAR, the PHP Extension and Application Repository
- *
- * PEAR class and PEAR_Error class
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Sterling Hughes <sterling@php.net>
- * @author Stig Bakken <ssb@php.net>
- * @author Tomas V.V.Cox <cox@idecnet.com>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2010 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: PEAR.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 0.1
- */
-
-/**#@+
- * ERROR constants
- */
-define('PEAR_ERROR_RETURN', 1);
-define('PEAR_ERROR_PRINT', 2);
-define('PEAR_ERROR_TRIGGER', 4);
-define('PEAR_ERROR_DIE', 8);
-define('PEAR_ERROR_CALLBACK', 16);
-/**
- * WARNING: obsolete
- * @deprecated
- */
-define('PEAR_ERROR_EXCEPTION', 32);
-/**#@-*/
-define('PEAR_ZE2', (function_exists('version_compare') &&
- version_compare(zend_version(), "2-dev", "ge")));
-
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- define('OS_WINDOWS', true);
- define('OS_UNIX', false);
- define('PEAR_OS', 'Windows');
-} else {
- define('OS_WINDOWS', false);
- define('OS_UNIX', true);
- define('PEAR_OS', 'Unix'); // blatant assumption
-}
-
-$GLOBALS['_PEAR_default_error_mode'] = PEAR_ERROR_RETURN;
-$GLOBALS['_PEAR_default_error_options'] = E_USER_NOTICE;
-$GLOBALS['_PEAR_destructor_object_list'] = array();
-$GLOBALS['_PEAR_shutdown_funcs'] = array();
-$GLOBALS['_PEAR_error_handler_stack'] = array();
-
-@ini_set('track_errors', true);
-
-/**
- * Base class for other PEAR classes. Provides rudimentary
- * emulation of destructors.
- *
- * If you want a destructor in your class, inherit PEAR and make a
- * destructor method called _yourclassname (same name as the
- * constructor, but with a "_" prefix). Also, in your constructor you
- * have to call the PEAR constructor: $this->PEAR();.
- * The destructor method will be called without parameters. Note that
- * at in some SAPI implementations (such as Apache), any output during
- * the request shutdown (in which destructors are called) seems to be
- * discarded. If you need to get any debug information from your
- * destructor, use error_log(), syslog() or something similar.
- *
- * IMPORTANT! To use the emulated destructors you need to create the
- * objects by reference: $obj =& new PEAR_child;
- *
- * @category pear
- * @package PEAR
- * @author Stig Bakken <ssb@php.net>
- * @author Tomas V.V. Cox <cox@idecnet.com>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2006 The PHP Group
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @see PEAR_Error
- * @since Class available since PHP 4.0.2
- * @link http://pear.php.net/manual/en/core.pear.php#core.pear.pear
- */
-class PEAR
-{
- /**
- * Whether to enable internal debug messages.
- *
- * @var bool
- * @access private
- */
- var $_debug = false;
-
- /**
- * Default error mode for this object.
- *
- * @var int
- * @access private
- */
- var $_default_error_mode = null;
-
- /**
- * Default error options used for this object when error mode
- * is PEAR_ERROR_TRIGGER.
- *
- * @var int
- * @access private
- */
- var $_default_error_options = null;
-
- /**
- * Default error handler (callback) for this object, if error mode is
- * PEAR_ERROR_CALLBACK.
- *
- * @var string
- * @access private
- */
- var $_default_error_handler = '';
-
- /**
- * Which class to use for error objects.
- *
- * @var string
- * @access private
- */
- var $_error_class = 'PEAR_Error';
-
- /**
- * An array of expected errors.
- *
- * @var array
- * @access private
- */
- var $_expected_errors = array();
-
- /**
- * Constructor. Registers this object in
- * $_PEAR_destructor_object_list for destructor emulation if a
- * destructor object exists.
- *
- * @param string $error_class (optional) which class to use for
- * error objects, defaults to PEAR_Error.
- * @access public
- * @return void
- */
- function PEAR($error_class = null)
- {
- $classname = strtolower(get_class($this));
- if ($this->_debug) {
- print "PEAR constructor called, class=$classname\n";
- }
-
- if ($error_class !== null) {
- $this->_error_class = $error_class;
- }
-
- while ($classname && strcasecmp($classname, "pear")) {
- $destructor = "_$classname";
- if (method_exists($this, $destructor)) {
- global $_PEAR_destructor_object_list;
- $_PEAR_destructor_object_list[] = &$this;
- if (!isset($GLOBALS['_PEAR_SHUTDOWN_REGISTERED'])) {
- register_shutdown_function("_PEAR_call_destructors");
- $GLOBALS['_PEAR_SHUTDOWN_REGISTERED'] = true;
- }
- break;
- } else {
- $classname = get_parent_class($classname);
- }
- }
- }
-
- /**
- * Destructor (the emulated type of...). Does nothing right now,
- * but is included for forward compatibility, so subclass
- * destructors should always call it.
- *
- * See the note in the class desciption about output from
- * destructors.
- *
- * @access public
- * @return void
- */
- function _PEAR() {
- if ($this->_debug) {
- printf("PEAR destructor called, class=%s\n", strtolower(get_class($this)));
- }
- }
-
- /**
- * If you have a class that's mostly/entirely static, and you need static
- * properties, you can use this method to simulate them. Eg. in your method(s)
- * do this: $myVar = &PEAR::getStaticProperty('myclass', 'myVar');
- * You MUST use a reference, or they will not persist!
- *
- * @access public
- * @param string $class The calling classname, to prevent clashes
- * @param string $var The variable to retrieve.
- * @return mixed A reference to the variable. If not set it will be
- * auto initialised to NULL.
- */
- function &getStaticProperty($class, $var)
- {
- static $properties;
- if (!isset($properties[$class])) {
- $properties[$class] = array();
- }
-
- if (!array_key_exists($var, $properties[$class])) {
- $properties[$class][$var] = null;
- }
-
- return $properties[$class][$var];
- }
-
- /**
- * Use this function to register a shutdown method for static
- * classes.
- *
- * @access public
- * @param mixed $func The function name (or array of class/method) to call
- * @param mixed $args The arguments to pass to the function
- * @return void
- */
- function registerShutdownFunc($func, $args = array())
- {
- // if we are called statically, there is a potential
- // that no shutdown func is registered. Bug #6445
- if (!isset($GLOBALS['_PEAR_SHUTDOWN_REGISTERED'])) {
- register_shutdown_function("_PEAR_call_destructors");
- $GLOBALS['_PEAR_SHUTDOWN_REGISTERED'] = true;
- }
- $GLOBALS['_PEAR_shutdown_funcs'][] = array($func, $args);
- }
-
- /**
- * Tell whether a value is a PEAR error.
- *
- * @param mixed $data the value to test
- * @param int $code if $data is an error object, return true
- * only if $code is a string and
- * $obj->getMessage() == $code or
- * $code is an integer and $obj->getCode() == $code
- * @access public
- * @return bool true if parameter is an error
- */
- static function isError($data, $code = null)
- {
- if (!is_a($data, 'PEAR_Error')) {
- return false;
- }
-
- if (is_null($code)) {
- return true;
- } elseif (is_string($code)) {
- return $data->getMessage() == $code;
- }
-
- return $data->getCode() == $code;
- }
-
- /**
- * Sets how errors generated by this object should be handled.
- * Can be invoked both in objects and statically. If called
- * statically, setErrorHandling sets the default behaviour for all
- * PEAR objects. If called in an object, setErrorHandling sets
- * the default behaviour for that object.
- *
- * @param int $mode
- * One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT,
- * PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE,
- * PEAR_ERROR_CALLBACK or PEAR_ERROR_EXCEPTION.
- *
- * @param mixed $options
- * When $mode is PEAR_ERROR_TRIGGER, this is the error level (one
- * of E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR).
- *
- * When $mode is PEAR_ERROR_CALLBACK, this parameter is expected
- * to be the callback function or method. A callback
- * function is a string with the name of the function, a
- * callback method is an array of two elements: the element
- * at index 0 is the object, and the element at index 1 is
- * the name of the method to call in the object.
- *
- * When $mode is PEAR_ERROR_PRINT or PEAR_ERROR_DIE, this is
- * a printf format string used when printing the error
- * message.
- *
- * @access public
- * @return void
- * @see PEAR_ERROR_RETURN
- * @see PEAR_ERROR_PRINT
- * @see PEAR_ERROR_TRIGGER
- * @see PEAR_ERROR_DIE
- * @see PEAR_ERROR_CALLBACK
- * @see PEAR_ERROR_EXCEPTION
- *
- * @since PHP 4.0.5
- */
- function setErrorHandling($mode = null, $options = null)
- {
- if (isset($this) && is_a($this, 'PEAR')) {
- $setmode = &$this->_default_error_mode;
- $setoptions = &$this->_default_error_options;
- } else {
- $setmode = &$GLOBALS['_PEAR_default_error_mode'];
- $setoptions = &$GLOBALS['_PEAR_default_error_options'];
- }
-
- switch ($mode) {
- case PEAR_ERROR_EXCEPTION:
- case PEAR_ERROR_RETURN:
- case PEAR_ERROR_PRINT:
- case PEAR_ERROR_TRIGGER:
- case PEAR_ERROR_DIE:
- case null:
- $setmode = $mode;
- $setoptions = $options;
- break;
-
- case PEAR_ERROR_CALLBACK:
- $setmode = $mode;
- // class/object method callback
- if (is_callable($options)) {
- $setoptions = $options;
- } else {
- trigger_error("invalid error callback", E_USER_WARNING);
- }
- break;
-
- default:
- trigger_error("invalid error mode", E_USER_WARNING);
- break;
- }
- }
-
- /**
- * This method is used to tell which errors you expect to get.
- * Expected errors are always returned with error mode
- * PEAR_ERROR_RETURN. Expected error codes are stored in a stack,
- * and this method pushes a new element onto it. The list of
- * expected errors are in effect until they are popped off the
- * stack with the popExpect() method.
- *
- * Note that this method can not be called statically
- *
- * @param mixed $code a single error code or an array of error codes to expect
- *
- * @return int the new depth of the "expected errors" stack
- * @access public
- */
- function expectError($code = '*')
- {
- if (is_array($code)) {
- array_push($this->_expected_errors, $code);
- } else {
- array_push($this->_expected_errors, array($code));
- }
- return count($this->_expected_errors);
- }
-
- /**
- * This method pops one element off the expected error codes
- * stack.
- *
- * @return array the list of error codes that were popped
- */
- function popExpect()
- {
- return array_pop($this->_expected_errors);
- }
-
- /**
- * This method checks unsets an error code if available
- *
- * @param mixed error code
- * @return bool true if the error code was unset, false otherwise
- * @access private
- * @since PHP 4.3.0
- */
- function _checkDelExpect($error_code)
- {
- $deleted = false;
- foreach ($this->_expected_errors as $key => $error_array) {
- if (in_array($error_code, $error_array)) {
- unset($this->_expected_errors[$key][array_search($error_code, $error_array)]);
- $deleted = true;
- }
-
- // clean up empty arrays
- if (0 == count($this->_expected_errors[$key])) {
- unset($this->_expected_errors[$key]);
- }
- }
-
- return $deleted;
- }
-
- /**
- * This method deletes all occurences of the specified element from
- * the expected error codes stack.
- *
- * @param mixed $error_code error code that should be deleted
- * @return mixed list of error codes that were deleted or error
- * @access public
- * @since PHP 4.3.0
- */
- function delExpect($error_code)
- {
- $deleted = false;
- if ((is_array($error_code) && (0 != count($error_code)))) {
- // $error_code is a non-empty array here; we walk through it trying
- // to unset all values
- foreach ($error_code as $key => $error) {
- $deleted = $this->_checkDelExpect($error) ? true : false;
- }
-
- return $deleted ? true : PEAR::raiseError("The expected error you submitted does not exist"); // IMPROVE ME
- } elseif (!empty($error_code)) {
- // $error_code comes alone, trying to unset it
- if ($this->_checkDelExpect($error_code)) {
- return true;
- }
-
- return PEAR::raiseError("The expected error you submitted does not exist"); // IMPROVE ME
- }
-
- // $error_code is empty
- return PEAR::raiseError("The expected error you submitted is empty"); // IMPROVE ME
- }
-
- /**
- * This method is a wrapper that returns an instance of the
- * configured error class with this object's default error
- * handling applied. If the $mode and $options parameters are not
- * specified, the object's defaults are used.
- *
- * @param mixed $message a text error message or a PEAR error object
- *
- * @param int $code a numeric error code (it is up to your class
- * to define these if you want to use codes)
- *
- * @param int $mode One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT,
- * PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE,
- * PEAR_ERROR_CALLBACK, PEAR_ERROR_EXCEPTION.
- *
- * @param mixed $options If $mode is PEAR_ERROR_TRIGGER, this parameter
- * specifies the PHP-internal error level (one of
- * E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR).
- * If $mode is PEAR_ERROR_CALLBACK, this
- * parameter specifies the callback function or
- * method. In other error modes this parameter
- * is ignored.
- *
- * @param string $userinfo If you need to pass along for example debug
- * information, this parameter is meant for that.
- *
- * @param string $error_class The returned error object will be
- * instantiated from this class, if specified.
- *
- * @param bool $skipmsg If true, raiseError will only pass error codes,
- * the error message parameter will be dropped.
- *
- * @access public
- * @return object a PEAR error object
- * @see PEAR::setErrorHandling
- * @since PHP 4.0.5
- */
- static function &raiseError($message = null,
- $code = null,
- $mode = null,
- $options = null,
- $userinfo = null,
- $error_class = null,
- $skipmsg = false)
- {
- // The error is yet a PEAR error object
- if (is_object($message)) {
- $code = $message->getCode();
- $userinfo = $message->getUserInfo();
- $error_class = $message->getType();
- $message->error_message_prefix = '';
- $message = $message->getMessage();
- }
-
- if (
- isset($this) &&
- isset($this->_expected_errors) &&
- count($this->_expected_errors) > 0 &&
- count($exp = end($this->_expected_errors))
- ) {
- if ($exp[0] == "*" ||
- (is_int(reset($exp)) && in_array($code, $exp)) ||
- (is_string(reset($exp)) && in_array($message, $exp))
- ) {
- $mode = PEAR_ERROR_RETURN;
- }
- }
-
- // No mode given, try global ones
- if ($mode === null) {
- // Class error handler
- if (isset($this) && isset($this->_default_error_mode)) {
- $mode = $this->_default_error_mode;
- $options = $this->_default_error_options;
- // Global error handler
- } elseif (isset($GLOBALS['_PEAR_default_error_mode'])) {
- $mode = $GLOBALS['_PEAR_default_error_mode'];
- $options = $GLOBALS['_PEAR_default_error_options'];
- }
- }
-
- if ($error_class !== null) {
- $ec = $error_class;
- } elseif (isset($this) && isset($this->_error_class)) {
- $ec = $this->_error_class;
- } else {
- $ec = 'PEAR_Error';
- }
-
- if (intval(PHP_VERSION) < 5) {
- // little non-eval hack to fix bug #12147
- include 'PEAR/FixPHP5PEARWarnings.php';
- return $a;
- }
-
- if ($skipmsg) {
- $a = new $ec($code, $mode, $options, $userinfo);
- } else {
- $a = new $ec($message, $code, $mode, $options, $userinfo);
- }
-
- return $a;
- }
-
- /**
- * Simpler form of raiseError with fewer options. In most cases
- * message, code and userinfo are enough.
- *
- * @param mixed $message a text error message or a PEAR error object
- *
- * @param int $code a numeric error code (it is up to your class
- * to define these if you want to use codes)
- *
- * @param string $userinfo If you need to pass along for example debug
- * information, this parameter is meant for that.
- *
- * @access public
- * @return object a PEAR error object
- * @see PEAR::raiseError
- */
- function &throwError($message = null, $code = null, $userinfo = null)
- {
- if (isset($this) && is_a($this, 'PEAR')) {
- $a = $this->raiseError($message, $code, null, null, $userinfo);
- return $a;
- }
-
- $a = PEAR::raiseError($message, $code, null, null, $userinfo);
- return $a;
- }
-
- function staticPushErrorHandling($mode, $options = null)
- {
- $stack = &$GLOBALS['_PEAR_error_handler_stack'];
- $def_mode = &$GLOBALS['_PEAR_default_error_mode'];
- $def_options = &$GLOBALS['_PEAR_default_error_options'];
- $stack[] = array($def_mode, $def_options);
- switch ($mode) {
- case PEAR_ERROR_EXCEPTION:
- case PEAR_ERROR_RETURN:
- case PEAR_ERROR_PRINT:
- case PEAR_ERROR_TRIGGER:
- case PEAR_ERROR_DIE:
- case null:
- $def_mode = $mode;
- $def_options = $options;
- break;
-
- case PEAR_ERROR_CALLBACK:
- $def_mode = $mode;
- // class/object method callback
- if (is_callable($options)) {
- $def_options = $options;
- } else {
- trigger_error("invalid error callback", E_USER_WARNING);
- }
- break;
-
- default:
- trigger_error("invalid error mode", E_USER_WARNING);
- break;
- }
- $stack[] = array($mode, $options);
- return true;
- }
-
- function staticPopErrorHandling()
- {
- $stack = &$GLOBALS['_PEAR_error_handler_stack'];
- $setmode = &$GLOBALS['_PEAR_default_error_mode'];
- $setoptions = &$GLOBALS['_PEAR_default_error_options'];
- array_pop($stack);
- list($mode, $options) = $stack[sizeof($stack) - 1];
- array_pop($stack);
- switch ($mode) {
- case PEAR_ERROR_EXCEPTION:
- case PEAR_ERROR_RETURN:
- case PEAR_ERROR_PRINT:
- case PEAR_ERROR_TRIGGER:
- case PEAR_ERROR_DIE:
- case null:
- $setmode = $mode;
- $setoptions = $options;
- break;
-
- case PEAR_ERROR_CALLBACK:
- $setmode = $mode;
- // class/object method callback
- if (is_callable($options)) {
- $setoptions = $options;
- } else {
- trigger_error("invalid error callback", E_USER_WARNING);
- }
- break;
-
- default:
- trigger_error("invalid error mode", E_USER_WARNING);
- break;
- }
- return true;
- }
-
- /**
- * Push a new error handler on top of the error handler options stack. With this
- * you can easily override the actual error handler for some code and restore
- * it later with popErrorHandling.
- *
- * @param mixed $mode (same as setErrorHandling)
- * @param mixed $options (same as setErrorHandling)
- *
- * @return bool Always true
- *
- * @see PEAR::setErrorHandling
- */
- function pushErrorHandling($mode, $options = null)
- {
- $stack = &$GLOBALS['_PEAR_error_handler_stack'];
- if (isset($this) && is_a($this, 'PEAR')) {
- $def_mode = &$this->_default_error_mode;
- $def_options = &$this->_default_error_options;
- } else {
- $def_mode = &$GLOBALS['_PEAR_default_error_mode'];
- $def_options = &$GLOBALS['_PEAR_default_error_options'];
- }
- $stack[] = array($def_mode, $def_options);
-
- if (isset($this) && is_a($this, 'PEAR')) {
- $this->setErrorHandling($mode, $options);
- } else {
- PEAR::setErrorHandling($mode, $options);
- }
- $stack[] = array($mode, $options);
- return true;
- }
-
- /**
- * Pop the last error handler used
- *
- * @return bool Always true
- *
- * @see PEAR::pushErrorHandling
- */
- function popErrorHandling()
- {
- $stack = &$GLOBALS['_PEAR_error_handler_stack'];
- array_pop($stack);
- list($mode, $options) = $stack[sizeof($stack) - 1];
- array_pop($stack);
- if (isset($this) && is_a($this, 'PEAR')) {
- $this->setErrorHandling($mode, $options);
- } else {
- PEAR::setErrorHandling($mode, $options);
- }
- return true;
- }
-
- /**
- * OS independant PHP extension load. Remember to take care
- * on the correct extension name for case sensitive OSes.
- *
- * @param string $ext The extension name
- * @return bool Success or not on the dl() call
- */
- static function loadExtension($ext)
- {
- if (extension_loaded($ext)) {
- return true;
- }
-
- // if either returns true dl() will produce a FATAL error, stop that
- if (
- function_exists('dl') === false ||
- ini_get('enable_dl') != 1 ||
- ini_get('safe_mode') == 1
- ) {
- return false;
- }
-
- if (OS_WINDOWS) {
- $suffix = '.dll';
- } elseif (PHP_OS == 'HP-UX') {
- $suffix = '.sl';
- } elseif (PHP_OS == 'AIX') {
- $suffix = '.a';
- } elseif (PHP_OS == 'OSX') {
- $suffix = '.bundle';
- } else {
- $suffix = '.so';
- }
-
- return @dl('php_'.$ext.$suffix) || @dl($ext.$suffix);
- }
-}
-
-if (PEAR_ZE2) {
- include_once 'PEAR5.php';
-}
-
-function _PEAR_call_destructors()
-{
- global $_PEAR_destructor_object_list;
- if (is_array($_PEAR_destructor_object_list) &&
- sizeof($_PEAR_destructor_object_list))
- {
- reset($_PEAR_destructor_object_list);
- if (PEAR_ZE2) {
- $destructLifoExists = PEAR5::getStaticProperty('PEAR', 'destructlifo');
- } else {
- $destructLifoExists = PEAR::getStaticProperty('PEAR', 'destructlifo');
- }
-
- if ($destructLifoExists) {
- $_PEAR_destructor_object_list = array_reverse($_PEAR_destructor_object_list);
- }
-
- while (list($k, $objref) = each($_PEAR_destructor_object_list)) {
- $classname = get_class($objref);
- while ($classname) {
- $destructor = "_$classname";
- if (method_exists($objref, $destructor)) {
- $objref->$destructor();
- break;
- } else {
- $classname = get_parent_class($classname);
- }
- }
- }
- // Empty the object list to ensure that destructors are
- // not called more than once.
- $_PEAR_destructor_object_list = array();
- }
-
- // Now call the shutdown functions
- if (
- isset($GLOBALS['_PEAR_shutdown_funcs']) &&
- is_array($GLOBALS['_PEAR_shutdown_funcs']) &&
- !empty($GLOBALS['_PEAR_shutdown_funcs'])
- ) {
- foreach ($GLOBALS['_PEAR_shutdown_funcs'] as $value) {
- call_user_func_array($value[0], $value[1]);
- }
- }
-}
-
-/**
- * Standard PEAR error class for PHP 4
- *
- * This class is supserseded by {@link PEAR_Exception} in PHP 5
- *
- * @category pear
- * @package PEAR
- * @author Stig Bakken <ssb@php.net>
- * @author Tomas V.V. Cox <cox@idecnet.com>
- * @author Gregory Beaver <cellog@php.net>
- * @copyright 1997-2006 The PHP Group
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/manual/en/core.pear.pear-error.php
- * @see PEAR::raiseError(), PEAR::throwError()
- * @since Class available since PHP 4.0.2
- */
-class PEAR_Error
-{
- var $error_message_prefix = '';
- var $mode = PEAR_ERROR_RETURN;
- var $level = E_USER_NOTICE;
- var $code = -1;
- var $message = '';
- var $userinfo = '';
- var $backtrace = null;
-
- /**
- * PEAR_Error constructor
- *
- * @param string $message message
- *
- * @param int $code (optional) error code
- *
- * @param int $mode (optional) error mode, one of: PEAR_ERROR_RETURN,
- * PEAR_ERROR_PRINT, PEAR_ERROR_DIE, PEAR_ERROR_TRIGGER,
- * PEAR_ERROR_CALLBACK or PEAR_ERROR_EXCEPTION
- *
- * @param mixed $options (optional) error level, _OR_ in the case of
- * PEAR_ERROR_CALLBACK, the callback function or object/method
- * tuple.
- *
- * @param string $userinfo (optional) additional user/debug info
- *
- * @access public
- *
- */
- function PEAR_Error($message = 'unknown error', $code = null,
- $mode = null, $options = null, $userinfo = null)
- {
- if ($mode === null) {
- $mode = PEAR_ERROR_RETURN;
- }
- $this->message = $message;
- $this->code = $code;
- $this->mode = $mode;
- $this->userinfo = $userinfo;
-
- if (PEAR_ZE2) {
- $skiptrace = PEAR5::getStaticProperty('PEAR_Error', 'skiptrace');
- } else {
- $skiptrace = PEAR::getStaticProperty('PEAR_Error', 'skiptrace');
- }
-
- if (!$skiptrace) {
- $this->backtrace = debug_backtrace();
- if (isset($this->backtrace[0]) && isset($this->backtrace[0]['object'])) {
- unset($this->backtrace[0]['object']);
- }
- }
-
- if ($mode & PEAR_ERROR_CALLBACK) {
- $this->level = E_USER_NOTICE;
- $this->callback = $options;
- } else {
- if ($options === null) {
- $options = E_USER_NOTICE;
- }
-
- $this->level = $options;
- $this->callback = null;
- }
-
- if ($this->mode & PEAR_ERROR_PRINT) {
- if (is_null($options) || is_int($options)) {
- $format = "%s";
- } else {
- $format = $options;
- }
-
- printf($format, $this->getMessage());
- }
-
- if ($this->mode & PEAR_ERROR_TRIGGER) {
- trigger_error($this->getMessage(), $this->level);
- }
-
- if ($this->mode & PEAR_ERROR_DIE) {
- $msg = $this->getMessage();
- if (is_null($options) || is_int($options)) {
- $format = "%s";
- if (substr($msg, -1) != "\n") {
- $msg .= "\n";
- }
- } else {
- $format = $options;
- }
- die(sprintf($format, $msg));
- }
-
- if ($this->mode & PEAR_ERROR_CALLBACK && is_callable($this->callback)) {
- call_user_func($this->callback, $this);
- }
-
- if ($this->mode & PEAR_ERROR_EXCEPTION) {
- trigger_error("PEAR_ERROR_EXCEPTION is obsolete, use class PEAR_Exception for exceptions", E_USER_WARNING);
- eval('$e = new Exception($this->message, $this->code);throw($e);');
- }
- }
-
- /**
- * Get the error mode from an error object.
- *
- * @return int error mode
- * @access public
- */
- function getMode()
- {
- return $this->mode;
- }
-
- /**
- * Get the callback function/method from an error object.
- *
- * @return mixed callback function or object/method array
- * @access public
- */
- function getCallback()
- {
- return $this->callback;
- }
-
- /**
- * Get the error message from an error object.
- *
- * @return string full error message
- * @access public
- */
- function getMessage()
- {
- return ($this->error_message_prefix . $this->message);
- }
-
- /**
- * Get error code from an error object
- *
- * @return int error code
- * @access public
- */
- function getCode()
- {
- return $this->code;
- }
-
- /**
- * Get the name of this error/exception.
- *
- * @return string error/exception name (type)
- * @access public
- */
- function getType()
- {
- return get_class($this);
- }
-
- /**
- * Get additional user-supplied information.
- *
- * @return string user-supplied information
- * @access public
- */
- function getUserInfo()
- {
- return $this->userinfo;
- }
-
- /**
- * Get additional debug information supplied by the application.
- *
- * @return string debug information
- * @access public
- */
- function getDebugInfo()
- {
- return $this->getUserInfo();
- }
-
- /**
- * Get the call backtrace from where the error was generated.
- * Supported with PHP 4.3.0 or newer.
- *
- * @param int $frame (optional) what frame to fetch
- * @return array Backtrace, or NULL if not available.
- * @access public
- */
- function getBacktrace($frame = null)
- {
- if (defined('PEAR_IGNORE_BACKTRACE')) {
- return null;
- }
- if ($frame === null) {
- return $this->backtrace;
- }
- return $this->backtrace[$frame];
- }
-
- function addUserInfo($info)
- {
- if (empty($this->userinfo)) {
- $this->userinfo = $info;
- } else {
- $this->userinfo .= " ** $info";
- }
- }
-
- function __toString()
- {
- return $this->getMessage();
- }
-
- /**
- * Make a string representation of this object.
- *
- * @return string a string with an object summary
- * @access public
- */
- function toString()
- {
- $modes = array();
- $levels = array(E_USER_NOTICE => 'notice',
- E_USER_WARNING => 'warning',
- E_USER_ERROR => 'error');
- if ($this->mode & PEAR_ERROR_CALLBACK) {
- if (is_array($this->callback)) {
- $callback = (is_object($this->callback[0]) ?
- strtolower(get_class($this->callback[0])) :
- $this->callback[0]) . '::' .
- $this->callback[1];
- } else {
- $callback = $this->callback;
- }
- return sprintf('[%s: message="%s" code=%d mode=callback '.
- 'callback=%s prefix="%s" info="%s"]',
- strtolower(get_class($this)), $this->message, $this->code,
- $callback, $this->error_message_prefix,
- $this->userinfo);
- }
- if ($this->mode & PEAR_ERROR_PRINT) {
- $modes[] = 'print';
- }
- if ($this->mode & PEAR_ERROR_TRIGGER) {
- $modes[] = 'trigger';
- }
- if ($this->mode & PEAR_ERROR_DIE) {
- $modes[] = 'die';
- }
- if ($this->mode & PEAR_ERROR_RETURN) {
- $modes[] = 'return';
- }
- return sprintf('[%s: message="%s" code=%d mode=%s level=%s '.
- 'prefix="%s" info="%s"]',
- strtolower(get_class($this)), $this->message, $this->code,
- implode("|", $modes), $levels[$this->level],
- $this->error_message_prefix,
- $this->userinfo);
- }
-}
-
-/*
- * Local Variables:
- * mode: php
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/3rdparty/PEAR/Autoloader.php b/3rdparty/PEAR/Autoloader.php
deleted file mode 100644
index 51620c7085f..00000000000
--- a/3rdparty/PEAR/Autoloader.php
+++ /dev/null
@@ -1,218 +0,0 @@
-<?php
-/**
- * Class auto-loader
- *
- * PHP versions 4
-
- *
- * @category pear
- * @package PEAR
- * @author Stig Bakken <ssb@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Autoloader.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/manual/en/core.ppm.php#core.ppm.pear-autoloader
- * @since File available since Release 0.1
- * @deprecated File deprecated in Release 1.4.0a1
- */
-
-// /* vim: set expandtab tabstop=4 shiftwidth=4: */
-
-if (!extension_loaded("overload")) {
- // die hard without ext/overload
- die("Rebuild PHP with the `overload' extension to use PEAR_Autoloader");
-}
-
-/**
- * Include for PEAR_Error and PEAR classes
- */
-require_once "PEAR.php";
-
-/**
- * This class is for objects where you want to separate the code for
- * some methods into separate classes. This is useful if you have a
- * class with not-frequently-used methods that contain lots of code
- * that you would like to avoid always parsing.
- *
- * The PEAR_Autoloader class provides autoloading and aggregation.
- * The autoloading lets you set up in which classes the separated
- * methods are found. Aggregation is the technique used to import new
- * methods, an instance of each class providing separated methods is
- * stored and called every time the aggregated method is called.
- *
- * @category pear
- * @package PEAR
- * @author Stig Bakken <ssb@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/manual/en/core.ppm.php#core.ppm.pear-autoloader
- * @since File available since Release 0.1
- * @deprecated File deprecated in Release 1.4.0a1
- */
-class PEAR_Autoloader extends PEAR
-{
- // {{{ properties
-
- /**
- * Map of methods and classes where they are defined
- *
- * @var array
- *
- * @access private
- */
- var $_autoload_map = array();
-
- /**
- * Map of methods and aggregate objects
- *
- * @var array
- *
- * @access private
- */
- var $_method_map = array();
-
- // }}}
- // {{{ addAutoload()
-
- /**
- * Add one or more autoload entries.
- *
- * @param string $method which method to autoload
- *
- * @param string $classname (optional) which class to find the method in.
- * If the $method parameter is an array, this
- * parameter may be omitted (and will be ignored
- * if not), and the $method parameter will be
- * treated as an associative array with method
- * names as keys and class names as values.
- *
- * @return void
- *
- * @access public
- */
- function addAutoload($method, $classname = null)
- {
- if (is_array($method)) {
- array_walk($method, create_function('$a,&$b', '$b = strtolower($b);'));
- $this->_autoload_map = array_merge($this->_autoload_map, $method);
- } else {
- $this->_autoload_map[strtolower($method)] = $classname;
- }
- }
-
- // }}}
- // {{{ removeAutoload()
-
- /**
- * Remove an autoload entry.
- *
- * @param string $method which method to remove the autoload entry for
- *
- * @return bool TRUE if an entry was removed, FALSE if not
- *
- * @access public
- */
- function removeAutoload($method)
- {
- $method = strtolower($method);
- $ok = isset($this->_autoload_map[$method]);
- unset($this->_autoload_map[$method]);
- return $ok;
- }
-
- // }}}
- // {{{ addAggregateObject()
-
- /**
- * Add an aggregate object to this object. If the specified class
- * is not defined, loading it will be attempted following PEAR's
- * file naming scheme. All the methods in the class will be
- * aggregated, except private ones (name starting with an
- * underscore) and constructors.
- *
- * @param string $classname what class to instantiate for the object.
- *
- * @return void
- *
- * @access public
- */
- function addAggregateObject($classname)
- {
- $classname = strtolower($classname);
- if (!class_exists($classname)) {
- $include_file = preg_replace('/[^a-z0-9]/i', '_', $classname);
- include_once $include_file;
- }
- $obj = new $classname;
- $methods = get_class_methods($classname);
- foreach ($methods as $method) {
- // don't import priviate methods and constructors
- if ($method{0} != '_' && $method != $classname) {
- $this->_method_map[$method] = $obj;
- }
- }
- }
-
- // }}}
- // {{{ removeAggregateObject()
-
- /**
- * Remove an aggregate object.
- *
- * @param string $classname the class of the object to remove
- *
- * @return bool TRUE if an object was removed, FALSE if not
- *
- * @access public
- */
- function removeAggregateObject($classname)
- {
- $ok = false;
- $classname = strtolower($classname);
- reset($this->_method_map);
- while (list($method, $obj) = each($this->_method_map)) {
- if (is_a($obj, $classname)) {
- unset($this->_method_map[$method]);
- $ok = true;
- }
- }
- return $ok;
- }
-
- // }}}
- // {{{ __call()
-
- /**
- * Overloaded object call handler, called each time an
- * undefined/aggregated method is invoked. This method repeats
- * the call in the right aggregate object and passes on the return
- * value.
- *
- * @param string $method which method that was called
- *
- * @param string $args An array of the parameters passed in the
- * original call
- *
- * @return mixed The return value from the aggregated method, or a PEAR
- * error if the called method was unknown.
- */
- function __call($method, $args, &$retval)
- {
- $method = strtolower($method);
- if (empty($this->_method_map[$method]) && isset($this->_autoload_map[$method])) {
- $this->addAggregateObject($this->_autoload_map[$method]);
- }
- if (isset($this->_method_map[$method])) {
- $retval = call_user_func_array(array($this->_method_map[$method], $method), $args);
- return true;
- }
- return false;
- }
-
- // }}}
-}
-
-overload("PEAR_Autoloader");
-
-?>
diff --git a/3rdparty/PEAR/Builder.php b/3rdparty/PEAR/Builder.php
deleted file mode 100644
index 90f3a145552..00000000000
--- a/3rdparty/PEAR/Builder.php
+++ /dev/null
@@ -1,489 +0,0 @@
-<?php
-/**
- * PEAR_Builder for building PHP extensions (PECL packages)
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Stig Bakken <ssb@php.net>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Builder.php 313024 2011-07-06 19:51:24Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 0.1
- *
- * TODO: log output parameters in PECL command line
- * TODO: msdev path in configuration
- */
-
-/**
- * Needed for extending PEAR_Builder
- */
-require_once 'PEAR/Common.php';
-require_once 'PEAR/PackageFile.php';
-
-/**
- * Class to handle building (compiling) extensions.
- *
- * @category pear
- * @package PEAR
- * @author Stig Bakken <ssb@php.net>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since PHP 4.0.2
- * @see http://pear.php.net/manual/en/core.ppm.pear-builder.php
- */
-class PEAR_Builder extends PEAR_Common
-{
- var $php_api_version = 0;
- var $zend_module_api_no = 0;
- var $zend_extension_api_no = 0;
-
- var $extensions_built = array();
-
- /**
- * @var string Used for reporting when it is not possible to pass function
- * via extra parameter, e.g. log, msdevCallback
- */
- var $current_callback = null;
-
- // used for msdev builds
- var $_lastline = null;
- var $_firstline = null;
-
- /**
- * PEAR_Builder constructor.
- *
- * @param object $ui user interface object (instance of PEAR_Frontend_*)
- *
- * @access public
- */
- function PEAR_Builder(&$ui)
- {
- parent::PEAR_Common();
- $this->setFrontendObject($ui);
- }
-
- /**
- * Build an extension from source on windows.
- * requires msdev
- */
- function _build_win32($descfile, $callback = null)
- {
- if (is_object($descfile)) {
- $pkg = $descfile;
- $descfile = $pkg->getPackageFile();
- } else {
- $pf = &new PEAR_PackageFile($this->config, $this->debug);
- $pkg = &$pf->fromPackageFile($descfile, PEAR_VALIDATE_NORMAL);
- if (PEAR::isError($pkg)) {
- return $pkg;
- }
- }
- $dir = dirname($descfile);
- $old_cwd = getcwd();
-
- if (!file_exists($dir) || !is_dir($dir) || !chdir($dir)) {
- return $this->raiseError("could not chdir to $dir");
- }
-
- // packages that were in a .tar have the packagefile in this directory
- $vdir = $pkg->getPackage() . '-' . $pkg->getVersion();
- if (file_exists($dir) && is_dir($vdir)) {
- if (!chdir($vdir)) {
- return $this->raiseError("could not chdir to " . realpath($vdir));
- }
-
- $dir = getcwd();
- }
-
- $this->log(2, "building in $dir");
-
- $dsp = $pkg->getPackage().'.dsp';
- if (!file_exists("$dir/$dsp")) {
- return $this->raiseError("The DSP $dsp does not exist.");
- }
- // XXX TODO: make release build type configurable
- $command = 'msdev '.$dsp.' /MAKE "'.$pkg->getPackage(). ' - Release"';
-
- $err = $this->_runCommand($command, array(&$this, 'msdevCallback'));
- if (PEAR::isError($err)) {
- return $err;
- }
-
- // figure out the build platform and type
- $platform = 'Win32';
- $buildtype = 'Release';
- if (preg_match('/.*?'.$pkg->getPackage().'\s-\s(\w+)\s(.*?)-+/i',$this->_firstline,$matches)) {
- $platform = $matches[1];
- $buildtype = $matches[2];
- }
-
- if (preg_match('/(.*)?\s-\s(\d+).*?(\d+)/', $this->_lastline, $matches)) {
- if ($matches[2]) {
- // there were errors in the build
- return $this->raiseError("There were errors during compilation.");
- }
- $out = $matches[1];
- } else {
- return $this->raiseError("Did not understand the completion status returned from msdev.exe.");
- }
-
- // msdev doesn't tell us the output directory :/
- // open the dsp, find /out and use that directory
- $dsptext = join(file($dsp),'');
-
- // this regex depends on the build platform and type having been
- // correctly identified above.
- $regex ='/.*?!IF\s+"\$\(CFG\)"\s+==\s+("'.
- $pkg->getPackage().'\s-\s'.
- $platform.'\s'.
- $buildtype.'").*?'.
- '\/out:"(.*?)"/is';
-
- if ($dsptext && preg_match($regex, $dsptext, $matches)) {
- // what we get back is a relative path to the output file itself.
- $outfile = realpath($matches[2]);
- } else {
- return $this->raiseError("Could not retrieve output information from $dsp.");
- }
- // realpath returns false if the file doesn't exist
- if ($outfile && copy($outfile, "$dir/$out")) {
- $outfile = "$dir/$out";
- }
-
- $built_files[] = array(
- 'file' => "$outfile",
- 'php_api' => $this->php_api_version,
- 'zend_mod_api' => $this->zend_module_api_no,
- 'zend_ext_api' => $this->zend_extension_api_no,
- );
-
- return $built_files;
- }
- // }}}
-
- // {{{ msdevCallback()
- function msdevCallback($what, $data)
- {
- if (!$this->_firstline)
- $this->_firstline = $data;
- $this->_lastline = $data;
- call_user_func($this->current_callback, $what, $data);
- }
-
- /**
- * @param string
- * @param string
- * @param array
- * @access private
- */
- function _harvestInstDir($dest_prefix, $dirname, &$built_files)
- {
- $d = opendir($dirname);
- if (!$d)
- return false;
-
- $ret = true;
- while (($ent = readdir($d)) !== false) {
- if ($ent{0} == '.')
- continue;
-
- $full = $dirname . DIRECTORY_SEPARATOR . $ent;
- if (is_dir($full)) {
- if (!$this->_harvestInstDir(
- $dest_prefix . DIRECTORY_SEPARATOR . $ent,
- $full, $built_files)) {
- $ret = false;
- break;
- }
- } else {
- $dest = $dest_prefix . DIRECTORY_SEPARATOR . $ent;
- $built_files[] = array(
- 'file' => $full,
- 'dest' => $dest,
- 'php_api' => $this->php_api_version,
- 'zend_mod_api' => $this->zend_module_api_no,
- 'zend_ext_api' => $this->zend_extension_api_no,
- );
- }
- }
- closedir($d);
- return $ret;
- }
-
- /**
- * Build an extension from source. Runs "phpize" in the source
- * directory, but compiles in a temporary directory
- * (TMPDIR/pear-build-USER/PACKAGE-VERSION).
- *
- * @param string|PEAR_PackageFile_v* $descfile path to XML package description file, or
- * a PEAR_PackageFile object
- *
- * @param mixed $callback callback function used to report output,
- * see PEAR_Builder::_runCommand for details
- *
- * @return array an array of associative arrays with built files,
- * format:
- * array( array( 'file' => '/path/to/ext.so',
- * 'php_api' => YYYYMMDD,
- * 'zend_mod_api' => YYYYMMDD,
- * 'zend_ext_api' => YYYYMMDD ),
- * ... )
- *
- * @access public
- *
- * @see PEAR_Builder::_runCommand
- */
- function build($descfile, $callback = null)
- {
- if (preg_match('/(\\/|\\\\|^)([^\\/\\\\]+)?php(.+)?$/',
- $this->config->get('php_bin'), $matches)) {
- if (isset($matches[2]) && strlen($matches[2]) &&
- trim($matches[2]) != trim($this->config->get('php_prefix'))) {
- $this->log(0, 'WARNING: php_bin ' . $this->config->get('php_bin') .
- ' appears to have a prefix ' . $matches[2] . ', but' .
- ' config variable php_prefix does not match');
- }
-
- if (isset($matches[3]) && strlen($matches[3]) &&
- trim($matches[3]) != trim($this->config->get('php_suffix'))) {
- $this->log(0, 'WARNING: php_bin ' . $this->config->get('php_bin') .
- ' appears to have a suffix ' . $matches[3] . ', but' .
- ' config variable php_suffix does not match');
- }
- }
-
- $this->current_callback = $callback;
- if (PEAR_OS == "Windows") {
- return $this->_build_win32($descfile, $callback);
- }
-
- if (PEAR_OS != 'Unix') {
- return $this->raiseError("building extensions not supported on this platform");
- }
-
- if (is_object($descfile)) {
- $pkg = $descfile;
- $descfile = $pkg->getPackageFile();
- if (is_a($pkg, 'PEAR_PackageFile_v1')) {
- $dir = dirname($descfile);
- } else {
- $dir = $pkg->_config->get('temp_dir') . '/' . $pkg->getName();
- // automatically delete at session end
- $this->addTempFile($dir);
- }
- } else {
- $pf = &new PEAR_PackageFile($this->config);
- $pkg = &$pf->fromPackageFile($descfile, PEAR_VALIDATE_NORMAL);
- if (PEAR::isError($pkg)) {
- return $pkg;
- }
- $dir = dirname($descfile);
- }
-
- // Find config. outside of normal path - e.g. config.m4
- foreach (array_keys($pkg->getInstallationFileList()) as $item) {
- if (stristr(basename($item), 'config.m4') && dirname($item) != '.') {
- $dir .= DIRECTORY_SEPARATOR . dirname($item);
- break;
- }
- }
-
- $old_cwd = getcwd();
- if (!file_exists($dir) || !is_dir($dir) || !chdir($dir)) {
- return $this->raiseError("could not chdir to $dir");
- }
-
- $vdir = $pkg->getPackage() . '-' . $pkg->getVersion();
- if (is_dir($vdir)) {
- chdir($vdir);
- }
-
- $dir = getcwd();
- $this->log(2, "building in $dir");
- putenv('PATH=' . $this->config->get('bin_dir') . ':' . getenv('PATH'));
- $err = $this->_runCommand($this->config->get('php_prefix')
- . "phpize" .
- $this->config->get('php_suffix'),
- array(&$this, 'phpizeCallback'));
- if (PEAR::isError($err)) {
- return $err;
- }
-
- if (!$err) {
- return $this->raiseError("`phpize' failed");
- }
-
- // {{{ start of interactive part
- $configure_command = "$dir/configure";
- $configure_options = $pkg->getConfigureOptions();
- if ($configure_options) {
- foreach ($configure_options as $o) {
- $default = array_key_exists('default', $o) ? $o['default'] : null;
- list($r) = $this->ui->userDialog('build',
- array($o['prompt']),
- array('text'),
- array($default));
- if (substr($o['name'], 0, 5) == 'with-' &&
- ($r == 'yes' || $r == 'autodetect')) {
- $configure_command .= " --$o[name]";
- } else {
- $configure_command .= " --$o[name]=".trim($r);
- }
- }
- }
- // }}} end of interactive part
-
- // FIXME make configurable
- if (!$user=getenv('USER')) {
- $user='defaultuser';
- }
-
- $tmpdir = $this->config->get('temp_dir');
- $build_basedir = System::mktemp(' -t "' . $tmpdir . '" -d "pear-build-' . $user . '"');
- $build_dir = "$build_basedir/$vdir";
- $inst_dir = "$build_basedir/install-$vdir";
- $this->log(1, "building in $build_dir");
- if (is_dir($build_dir)) {
- System::rm(array('-rf', $build_dir));
- }
-
- if (!System::mkDir(array('-p', $build_dir))) {
- return $this->raiseError("could not create build dir: $build_dir");
- }
-
- $this->addTempFile($build_dir);
- if (!System::mkDir(array('-p', $inst_dir))) {
- return $this->raiseError("could not create temporary install dir: $inst_dir");
- }
- $this->addTempFile($inst_dir);
-
- $make_command = getenv('MAKE') ? getenv('MAKE') : 'make';
-
- $to_run = array(
- $configure_command,
- $make_command,
- "$make_command INSTALL_ROOT=\"$inst_dir\" install",
- "find \"$inst_dir\" | xargs ls -dils"
- );
- if (!file_exists($build_dir) || !is_dir($build_dir) || !chdir($build_dir)) {
- return $this->raiseError("could not chdir to $build_dir");
- }
- putenv('PHP_PEAR_VERSION=1.9.4');
- foreach ($to_run as $cmd) {
- $err = $this->_runCommand($cmd, $callback);
- if (PEAR::isError($err)) {
- chdir($old_cwd);
- return $err;
- }
- if (!$err) {
- chdir($old_cwd);
- return $this->raiseError("`$cmd' failed");
- }
- }
- if (!($dp = opendir("modules"))) {
- chdir($old_cwd);
- return $this->raiseError("no `modules' directory found");
- }
- $built_files = array();
- $prefix = exec($this->config->get('php_prefix')
- . "php-config" .
- $this->config->get('php_suffix') . " --prefix");
- $this->_harvestInstDir($prefix, $inst_dir . DIRECTORY_SEPARATOR . $prefix, $built_files);
- chdir($old_cwd);
- return $built_files;
- }
-
- /**
- * Message callback function used when running the "phpize"
- * program. Extracts the API numbers used. Ignores other message
- * types than "cmdoutput".
- *
- * @param string $what the type of message
- * @param mixed $data the message
- *
- * @return void
- *
- * @access public
- */
- function phpizeCallback($what, $data)
- {
- if ($what != 'cmdoutput') {
- return;
- }
- $this->log(1, rtrim($data));
- if (preg_match('/You should update your .aclocal.m4/', $data)) {
- return;
- }
- $matches = array();
- if (preg_match('/^\s+(\S[^:]+):\s+(\d{8})/', $data, $matches)) {
- $member = preg_replace('/[^a-z]/', '_', strtolower($matches[1]));
- $apino = (int)$matches[2];
- if (isset($this->$member)) {
- $this->$member = $apino;
- //$msg = sprintf("%-22s : %d", $matches[1], $apino);
- //$this->log(1, $msg);
- }
- }
- }
-
- /**
- * Run an external command, using a message callback to report
- * output. The command will be run through popen and output is
- * reported for every line with a "cmdoutput" message with the
- * line string, including newlines, as payload.
- *
- * @param string $command the command to run
- *
- * @param mixed $callback (optional) function to use as message
- * callback
- *
- * @return bool whether the command was successful (exit code 0
- * means success, any other means failure)
- *
- * @access private
- */
- function _runCommand($command, $callback = null)
- {
- $this->log(1, "running: $command");
- $pp = popen("$command 2>&1", "r");
- if (!$pp) {
- return $this->raiseError("failed to run `$command'");
- }
- if ($callback && $callback[0]->debug == 1) {
- $olddbg = $callback[0]->debug;
- $callback[0]->debug = 2;
- }
-
- while ($line = fgets($pp, 1024)) {
- if ($callback) {
- call_user_func($callback, 'cmdoutput', $line);
- } else {
- $this->log(2, rtrim($line));
- }
- }
- if ($callback && isset($olddbg)) {
- $callback[0]->debug = $olddbg;
- }
-
- $exitcode = is_resource($pp) ? pclose($pp) : -1;
- return ($exitcode == 0);
- }
-
- function log($level, $msg)
- {
- if ($this->current_callback) {
- if ($this->debug >= $level) {
- call_user_func($this->current_callback, 'output', $msg);
- }
- return;
- }
- return PEAR_Common::log($level, $msg);
- }
-} \ No newline at end of file
diff --git a/3rdparty/PEAR/ChannelFile.php b/3rdparty/PEAR/ChannelFile.php
deleted file mode 100644
index f2c02ab42b7..00000000000
--- a/3rdparty/PEAR/ChannelFile.php
+++ /dev/null
@@ -1,1559 +0,0 @@
-<?php
-/**
- * PEAR_ChannelFile, the channel handling class
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: ChannelFile.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a1
- */
-
-/**
- * Needed for error handling
- */
-require_once 'PEAR/ErrorStack.php';
-require_once 'PEAR/XMLParser.php';
-require_once 'PEAR/Common.php';
-
-/**
- * Error code if the channel.xml <channel> tag does not contain a valid version
- */
-define('PEAR_CHANNELFILE_ERROR_NO_VERSION', 1);
-/**
- * Error code if the channel.xml <channel> tag version is not supported (version 1.0 is the only supported version,
- * currently
- */
-define('PEAR_CHANNELFILE_ERROR_INVALID_VERSION', 2);
-
-/**
- * Error code if parsing is attempted with no xml extension
- */
-define('PEAR_CHANNELFILE_ERROR_NO_XML_EXT', 3);
-
-/**
- * Error code if creating the xml parser resource fails
- */
-define('PEAR_CHANNELFILE_ERROR_CANT_MAKE_PARSER', 4);
-
-/**
- * Error code used for all sax xml parsing errors
- */
-define('PEAR_CHANNELFILE_ERROR_PARSER_ERROR', 5);
-
-/**#@+
- * Validation errors
- */
-/**
- * Error code when channel name is missing
- */
-define('PEAR_CHANNELFILE_ERROR_NO_NAME', 6);
-/**
- * Error code when channel name is invalid
- */
-define('PEAR_CHANNELFILE_ERROR_INVALID_NAME', 7);
-/**
- * Error code when channel summary is missing
- */
-define('PEAR_CHANNELFILE_ERROR_NO_SUMMARY', 8);
-/**
- * Error code when channel summary is multi-line
- */
-define('PEAR_CHANNELFILE_ERROR_MULTILINE_SUMMARY', 9);
-/**
- * Error code when channel server is missing for protocol
- */
-define('PEAR_CHANNELFILE_ERROR_NO_HOST', 10);
-/**
- * Error code when channel server is invalid for protocol
- */
-define('PEAR_CHANNELFILE_ERROR_INVALID_HOST', 11);
-/**
- * Error code when a mirror name is invalid
- */
-define('PEAR_CHANNELFILE_ERROR_INVALID_MIRROR', 21);
-/**
- * Error code when a mirror type is invalid
- */
-define('PEAR_CHANNELFILE_ERROR_INVALID_MIRRORTYPE', 22);
-/**
- * Error code when an attempt is made to generate xml, but the parsed content is invalid
- */
-define('PEAR_CHANNELFILE_ERROR_INVALID', 23);
-/**
- * Error code when an empty package name validate regex is passed in
- */
-define('PEAR_CHANNELFILE_ERROR_EMPTY_REGEX', 24);
-/**
- * Error code when a <function> tag has no version
- */
-define('PEAR_CHANNELFILE_ERROR_NO_FUNCTIONVERSION', 25);
-/**
- * Error code when a <function> tag has no name
- */
-define('PEAR_CHANNELFILE_ERROR_NO_FUNCTIONNAME', 26);
-/**
- * Error code when a <validatepackage> tag has no name
- */
-define('PEAR_CHANNELFILE_ERROR_NOVALIDATE_NAME', 27);
-/**
- * Error code when a <validatepackage> tag has no version attribute
- */
-define('PEAR_CHANNELFILE_ERROR_NOVALIDATE_VERSION', 28);
-/**
- * Error code when a mirror does not exist but is called for in one of the set*
- * methods.
- */
-define('PEAR_CHANNELFILE_ERROR_MIRROR_NOT_FOUND', 32);
-/**
- * Error code when a server port is not numeric
- */
-define('PEAR_CHANNELFILE_ERROR_INVALID_PORT', 33);
-/**
- * Error code when <static> contains no version attribute
- */
-define('PEAR_CHANNELFILE_ERROR_NO_STATICVERSION', 34);
-/**
- * Error code when <baseurl> contains no type attribute in a <rest> protocol definition
- */
-define('PEAR_CHANNELFILE_ERROR_NOBASEURLTYPE', 35);
-/**
- * Error code when a mirror is defined and the channel.xml represents the __uri pseudo-channel
- */
-define('PEAR_CHANNELFILE_URI_CANT_MIRROR', 36);
-/**
- * Error code when ssl attribute is present and is not "yes"
- */
-define('PEAR_CHANNELFILE_ERROR_INVALID_SSL', 37);
-/**#@-*/
-
-/**
- * Mirror types allowed. Currently only internet servers are recognized.
- */
-$GLOBALS['_PEAR_CHANNELS_MIRROR_TYPES'] = array('server');
-
-
-/**
- * The Channel handling class
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a1
- */
-class PEAR_ChannelFile
-{
- /**
- * @access private
- * @var PEAR_ErrorStack
- * @access private
- */
- var $_stack;
-
- /**
- * Supported channel.xml versions, for parsing
- * @var array
- * @access private
- */
- var $_supportedVersions = array('1.0');
-
- /**
- * Parsed channel information
- * @var array
- * @access private
- */
- var $_channelInfo;
-
- /**
- * index into the subchannels array, used for parsing xml
- * @var int
- * @access private
- */
- var $_subchannelIndex;
-
- /**
- * index into the mirrors array, used for parsing xml
- * @var int
- * @access private
- */
- var $_mirrorIndex;
-
- /**
- * Flag used to determine the validity of parsed content
- * @var boolean
- * @access private
- */
- var $_isValid = false;
-
- function PEAR_ChannelFile()
- {
- $this->_stack = &new PEAR_ErrorStack('PEAR_ChannelFile');
- $this->_stack->setErrorMessageTemplate($this->_getErrorMessage());
- $this->_isValid = false;
- }
-
- /**
- * @return array
- * @access protected
- */
- function _getErrorMessage()
- {
- return
- array(
- PEAR_CHANNELFILE_ERROR_INVALID_VERSION =>
- 'While parsing channel.xml, an invalid version number "%version% was passed in, expecting one of %versions%',
- PEAR_CHANNELFILE_ERROR_NO_VERSION =>
- 'No version number found in <channel> tag',
- PEAR_CHANNELFILE_ERROR_NO_XML_EXT =>
- '%error%',
- PEAR_CHANNELFILE_ERROR_CANT_MAKE_PARSER =>
- 'Unable to create XML parser',
- PEAR_CHANNELFILE_ERROR_PARSER_ERROR =>
- '%error%',
- PEAR_CHANNELFILE_ERROR_NO_NAME =>
- 'Missing channel name',
- PEAR_CHANNELFILE_ERROR_INVALID_NAME =>
- 'Invalid channel %tag% "%name%"',
- PEAR_CHANNELFILE_ERROR_NO_SUMMARY =>
- 'Missing channel summary',
- PEAR_CHANNELFILE_ERROR_MULTILINE_SUMMARY =>
- 'Channel summary should be on one line, but is multi-line',
- PEAR_CHANNELFILE_ERROR_NO_HOST =>
- 'Missing channel server for %type% server',
- PEAR_CHANNELFILE_ERROR_INVALID_HOST =>
- 'Server name "%server%" is invalid for %type% server',
- PEAR_CHANNELFILE_ERROR_INVALID_MIRROR =>
- 'Invalid mirror name "%name%", mirror type %type%',
- PEAR_CHANNELFILE_ERROR_INVALID_MIRRORTYPE =>
- 'Invalid mirror type "%type%"',
- PEAR_CHANNELFILE_ERROR_INVALID =>
- 'Cannot generate xml, contents are invalid',
- PEAR_CHANNELFILE_ERROR_EMPTY_REGEX =>
- 'packagenameregex cannot be empty',
- PEAR_CHANNELFILE_ERROR_NO_FUNCTIONVERSION =>
- '%parent% %protocol% function has no version',
- PEAR_CHANNELFILE_ERROR_NO_FUNCTIONNAME =>
- '%parent% %protocol% function has no name',
- PEAR_CHANNELFILE_ERROR_NOBASEURLTYPE =>
- '%parent% rest baseurl has no type',
- PEAR_CHANNELFILE_ERROR_NOVALIDATE_NAME =>
- 'Validation package has no name in <validatepackage> tag',
- PEAR_CHANNELFILE_ERROR_NOVALIDATE_VERSION =>
- 'Validation package "%package%" has no version',
- PEAR_CHANNELFILE_ERROR_MIRROR_NOT_FOUND =>
- 'Mirror "%mirror%" does not exist',
- PEAR_CHANNELFILE_ERROR_INVALID_PORT =>
- 'Port "%port%" must be numeric',
- PEAR_CHANNELFILE_ERROR_NO_STATICVERSION =>
- '<static> tag must contain version attribute',
- PEAR_CHANNELFILE_URI_CANT_MIRROR =>
- 'The __uri pseudo-channel cannot have mirrors',
- PEAR_CHANNELFILE_ERROR_INVALID_SSL =>
- '%server% has invalid ssl attribute "%ssl%" can only be yes or not present',
- );
- }
-
- /**
- * @param string contents of package.xml file
- * @return bool success of parsing
- */
- function fromXmlString($data)
- {
- if (preg_match('/<channel\s+version="([0-9]+\.[0-9]+)"/', $data, $channelversion)) {
- if (!in_array($channelversion[1], $this->_supportedVersions)) {
- $this->_stack->push(PEAR_CHANNELFILE_ERROR_INVALID_VERSION, 'error',
- array('version' => $channelversion[1]));
- return false;
- }
- $parser = new PEAR_XMLParser;
- $result = $parser->parse($data);
- if ($result !== true) {
- if ($result->getCode() == 1) {
- $this->_stack->push(PEAR_CHANNELFILE_ERROR_NO_XML_EXT, 'error',
- array('error' => $result->getMessage()));
- } else {
- $this->_stack->push(PEAR_CHANNELFILE_ERROR_CANT_MAKE_PARSER, 'error');
- }
- return false;
- }
- $this->_channelInfo = $parser->getData();
- return true;
- } else {
- $this->_stack->push(PEAR_CHANNELFILE_ERROR_NO_VERSION, 'error', array('xml' => $data));
- return false;
- }
- }
-
- /**
- * @return array
- */
- function toArray()
- {
- if (!$this->_isValid && !$this->validate()) {
- return false;
- }
- return $this->_channelInfo;
- }
-
- /**
- * @param array
- * @static
- * @return PEAR_ChannelFile|false false if invalid
- */
- function &fromArray($data, $compatibility = false, $stackClass = 'PEAR_ErrorStack')
- {
- $a = new PEAR_ChannelFile($compatibility, $stackClass);
- $a->_fromArray($data);
- if (!$a->validate()) {
- $a = false;
- return $a;
- }
- return $a;
- }
-
- /**
- * Unlike {@link fromArray()} this does not do any validation
- * @param array
- * @static
- * @return PEAR_ChannelFile
- */
- function &fromArrayWithErrors($data, $compatibility = false,
- $stackClass = 'PEAR_ErrorStack')
- {
- $a = new PEAR_ChannelFile($compatibility, $stackClass);
- $a->_fromArray($data);
- return $a;
- }
-
- /**
- * @param array
- * @access private
- */
- function _fromArray($data)
- {
- $this->_channelInfo = $data;
- }
-
- /**
- * Wrapper to {@link PEAR_ErrorStack::getErrors()}
- * @param boolean determines whether to purge the error stack after retrieving
- * @return array
- */
- function getErrors($purge = false)
- {
- return $this->_stack->getErrors($purge);
- }
-
- /**
- * Unindent given string (?)
- *
- * @param string $str The string that has to be unindented.
- * @return string
- * @access private
- */
- function _unIndent($str)
- {
- // remove leading newlines
- $str = preg_replace('/^[\r\n]+/', '', $str);
- // find whitespace at the beginning of the first line
- $indent_len = strspn($str, " \t");
- $indent = substr($str, 0, $indent_len);
- $data = '';
- // remove the same amount of whitespace from following lines
- foreach (explode("\n", $str) as $line) {
- if (substr($line, 0, $indent_len) == $indent) {
- $data .= substr($line, $indent_len) . "\n";
- }
- }
- return $data;
- }
-
- /**
- * Parse a channel.xml file. Expects the name of
- * a channel xml file as input.
- *
- * @param string $descfile name of channel xml file
- * @return bool success of parsing
- */
- function fromXmlFile($descfile)
- {
- if (!file_exists($descfile) || !is_file($descfile) || !is_readable($descfile) ||
- (!$fp = fopen($descfile, 'r'))) {
- require_once 'PEAR.php';
- return PEAR::raiseError("Unable to open $descfile");
- }
-
- // read the whole thing so we only get one cdata callback
- // for each block of cdata
- fclose($fp);
- $data = file_get_contents($descfile);
- return $this->fromXmlString($data);
- }
-
- /**
- * Parse channel information from different sources
- *
- * This method is able to extract information about a channel
- * from an .xml file or a string
- *
- * @access public
- * @param string Filename of the source or the source itself
- * @return bool
- */
- function fromAny($info)
- {
- if (is_string($info) && file_exists($info) && strlen($info) < 255) {
- $tmp = substr($info, -4);
- if ($tmp == '.xml') {
- $info = $this->fromXmlFile($info);
- } else {
- $fp = fopen($info, "r");
- $test = fread($fp, 5);
- fclose($fp);
- if ($test == "<?xml") {
- $info = $this->fromXmlFile($info);
- }
- }
- if (PEAR::isError($info)) {
- require_once 'PEAR.php';
- return PEAR::raiseError($info);
- }
- }
- if (is_string($info)) {
- $info = $this->fromXmlString($info);
- }
- return $info;
- }
-
- /**
- * Return an XML document based on previous parsing and modifications
- *
- * @return string XML data
- *
- * @access public
- */
- function toXml()
- {
- if (!$this->_isValid && !$this->validate()) {
- $this->_validateError(PEAR_CHANNELFILE_ERROR_INVALID);
- return false;
- }
- if (!isset($this->_channelInfo['attribs']['version'])) {
- $this->_channelInfo['attribs']['version'] = '1.0';
- }
- $channelInfo = $this->_channelInfo;
- $ret = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n";
- $ret .= "<channel version=\"" .
- $channelInfo['attribs']['version'] . "\" xmlns=\"http://pear.php.net/channel-1.0\"
- xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
- xsi:schemaLocation=\"http://pear.php.net/dtd/channel-"
- . $channelInfo['attribs']['version'] . " http://pear.php.net/dtd/channel-" .
- $channelInfo['attribs']['version'] . ".xsd\">
- <name>$channelInfo[name]</name>
- <summary>" . htmlspecialchars($channelInfo['summary'])."</summary>
-";
- if (isset($channelInfo['suggestedalias'])) {
- $ret .= ' <suggestedalias>' . $channelInfo['suggestedalias'] . "</suggestedalias>\n";
- }
- if (isset($channelInfo['validatepackage'])) {
- $ret .= ' <validatepackage version="' .
- $channelInfo['validatepackage']['attribs']['version']. '">' .
- htmlspecialchars($channelInfo['validatepackage']['_content']) .
- "</validatepackage>\n";
- }
- $ret .= " <servers>\n";
- $ret .= ' <primary';
- if (isset($channelInfo['servers']['primary']['attribs']['ssl'])) {
- $ret .= ' ssl="' . $channelInfo['servers']['primary']['attribs']['ssl'] . '"';
- }
- if (isset($channelInfo['servers']['primary']['attribs']['port'])) {
- $ret .= ' port="' . $channelInfo['servers']['primary']['attribs']['port'] . '"';
- }
- $ret .= ">\n";
- if (isset($channelInfo['servers']['primary']['rest'])) {
- $ret .= $this->_makeRestXml($channelInfo['servers']['primary']['rest'], ' ');
- }
- $ret .= " </primary>\n";
- if (isset($channelInfo['servers']['mirror'])) {
- $ret .= $this->_makeMirrorsXml($channelInfo);
- }
- $ret .= " </servers>\n";
- $ret .= "</channel>";
- return str_replace("\r", "\n", str_replace("\r\n", "\n", $ret));
- }
-
- /**
- * Generate the <rest> tag
- * @access private
- */
- function _makeRestXml($info, $indent)
- {
- $ret = $indent . "<rest>\n";
- if (isset($info['baseurl']) && !isset($info['baseurl'][0])) {
- $info['baseurl'] = array($info['baseurl']);
- }
-
- if (isset($info['baseurl'])) {
- foreach ($info['baseurl'] as $url) {
- $ret .= "$indent <baseurl type=\"" . $url['attribs']['type'] . "\"";
- $ret .= ">" . $url['_content'] . "</baseurl>\n";
- }
- }
- $ret .= $indent . "</rest>\n";
- return $ret;
- }
-
- /**
- * Generate the <mirrors> tag
- * @access private
- */
- function _makeMirrorsXml($channelInfo)
- {
- $ret = "";
- if (!isset($channelInfo['servers']['mirror'][0])) {
- $channelInfo['servers']['mirror'] = array($channelInfo['servers']['mirror']);
- }
- foreach ($channelInfo['servers']['mirror'] as $mirror) {
- $ret .= ' <mirror host="' . $mirror['attribs']['host'] . '"';
- if (isset($mirror['attribs']['port'])) {
- $ret .= ' port="' . $mirror['attribs']['port'] . '"';
- }
- if (isset($mirror['attribs']['ssl'])) {
- $ret .= ' ssl="' . $mirror['attribs']['ssl'] . '"';
- }
- $ret .= ">\n";
- if (isset($mirror['rest'])) {
- if (isset($mirror['rest'])) {
- $ret .= $this->_makeRestXml($mirror['rest'], ' ');
- }
- $ret .= " </mirror>\n";
- } else {
- $ret .= "/>\n";
- }
- }
- return $ret;
- }
-
- /**
- * Generate the <functions> tag
- * @access private
- */
- function _makeFunctionsXml($functions, $indent, $rest = false)
- {
- $ret = '';
- if (!isset($functions[0])) {
- $functions = array($functions);
- }
- foreach ($functions as $function) {
- $ret .= "$indent<function version=\"" . $function['attribs']['version'] . "\"";
- if ($rest) {
- $ret .= ' uri="' . $function['attribs']['uri'] . '"';
- }
- $ret .= ">" . $function['_content'] . "</function>\n";
- }
- return $ret;
- }
-
- /**
- * Validation error. Also marks the object contents as invalid
- * @param error code
- * @param array error information
- * @access private
- */
- function _validateError($code, $params = array())
- {
- $this->_stack->push($code, 'error', $params);
- $this->_isValid = false;
- }
-
- /**
- * Validation warning. Does not mark the object contents invalid.
- * @param error code
- * @param array error information
- * @access private
- */
- function _validateWarning($code, $params = array())
- {
- $this->_stack->push($code, 'warning', $params);
- }
-
- /**
- * Validate parsed file.
- *
- * @access public
- * @return boolean
- */
- function validate()
- {
- $this->_isValid = true;
- $info = $this->_channelInfo;
- if (empty($info['name'])) {
- $this->_validateError(PEAR_CHANNELFILE_ERROR_NO_NAME);
- } elseif (!$this->validChannelServer($info['name'])) {
- if ($info['name'] != '__uri') {
- $this->_validateError(PEAR_CHANNELFILE_ERROR_INVALID_NAME, array('tag' => 'name',
- 'name' => $info['name']));
- }
- }
- if (empty($info['summary'])) {
- $this->_validateError(PEAR_CHANNELFILE_ERROR_NO_SUMMARY);
- } elseif (strpos(trim($info['summary']), "\n") !== false) {
- $this->_validateWarning(PEAR_CHANNELFILE_ERROR_MULTILINE_SUMMARY,
- array('summary' => $info['summary']));
- }
- if (isset($info['suggestedalias'])) {
- if (!$this->validChannelServer($info['suggestedalias'])) {
- $this->_validateError(PEAR_CHANNELFILE_ERROR_INVALID_NAME,
- array('tag' => 'suggestedalias', 'name' =>$info['suggestedalias']));
- }
- }
- if (isset($info['localalias'])) {
- if (!$this->validChannelServer($info['localalias'])) {
- $this->_validateError(PEAR_CHANNELFILE_ERROR_INVALID_NAME,
- array('tag' => 'localalias', 'name' =>$info['localalias']));
- }
- }
- if (isset($info['validatepackage'])) {
- if (!isset($info['validatepackage']['_content'])) {
- $this->_validateError(PEAR_CHANNELFILE_ERROR_NOVALIDATE_NAME);
- }
- if (!isset($info['validatepackage']['attribs']['version'])) {
- $content = isset($info['validatepackage']['_content']) ?
- $info['validatepackage']['_content'] :
- null;
- $this->_validateError(PEAR_CHANNELFILE_ERROR_NOVALIDATE_VERSION,
- array('package' => $content));
- }
- }
-
- if (isset($info['servers']['primary']['attribs'], $info['servers']['primary']['attribs']['port']) &&
- !is_numeric($info['servers']['primary']['attribs']['port'])) {
- $this->_validateError(PEAR_CHANNELFILE_ERROR_INVALID_PORT,
- array('port' => $info['servers']['primary']['attribs']['port']));
- }
-
- if (isset($info['servers']['primary']['attribs'], $info['servers']['primary']['attribs']['ssl']) &&
- $info['servers']['primary']['attribs']['ssl'] != 'yes') {
- $this->_validateError(PEAR_CHANNELFILE_ERROR_INVALID_SSL,
- array('ssl' => $info['servers']['primary']['attribs']['ssl'],
- 'server' => $info['name']));
- }
-
- if (isset($info['servers']['primary']['rest']) &&
- isset($info['servers']['primary']['rest']['baseurl'])) {
- $this->_validateFunctions('rest', $info['servers']['primary']['rest']['baseurl']);
- }
- if (isset($info['servers']['mirror'])) {
- if ($this->_channelInfo['name'] == '__uri') {
- $this->_validateError(PEAR_CHANNELFILE_URI_CANT_MIRROR);
- }
- if (!isset($info['servers']['mirror'][0])) {
- $info['servers']['mirror'] = array($info['servers']['mirror']);
- }
- foreach ($info['servers']['mirror'] as $mirror) {
- if (!isset($mirror['attribs']['host'])) {
- $this->_validateError(PEAR_CHANNELFILE_ERROR_NO_HOST,
- array('type' => 'mirror'));
- } elseif (!$this->validChannelServer($mirror['attribs']['host'])) {
- $this->_validateError(PEAR_CHANNELFILE_ERROR_INVALID_HOST,
- array('server' => $mirror['attribs']['host'], 'type' => 'mirror'));
- }
- if (isset($mirror['attribs']['ssl']) && $mirror['attribs']['ssl'] != 'yes') {
- $this->_validateError(PEAR_CHANNELFILE_ERROR_INVALID_SSL,
- array('ssl' => $info['ssl'], 'server' => $mirror['attribs']['host']));
- }
- if (isset($mirror['rest'])) {
- $this->_validateFunctions('rest', $mirror['rest']['baseurl'],
- $mirror['attribs']['host']);
- }
- }
- }
- return $this->_isValid;
- }
-
- /**
- * @param string rest - protocol name this function applies to
- * @param array the functions
- * @param string the name of the parent element (mirror name, for instance)
- */
- function _validateFunctions($protocol, $functions, $parent = '')
- {
- if (!isset($functions[0])) {
- $functions = array($functions);
- }
-
- foreach ($functions as $function) {
- if (!isset($function['_content']) || empty($function['_content'])) {
- $this->_validateError(PEAR_CHANNELFILE_ERROR_NO_FUNCTIONNAME,
- array('parent' => $parent, 'protocol' => $protocol));
- }
-
- if ($protocol == 'rest') {
- if (!isset($function['attribs']['type']) ||
- empty($function['attribs']['type'])) {
- $this->_validateError(PEAR_CHANNELFILE_ERROR_NOBASEURLTYPE,
- array('parent' => $parent, 'protocol' => $protocol));
- }
- } else {
- if (!isset($function['attribs']['version']) ||
- empty($function['attribs']['version'])) {
- $this->_validateError(PEAR_CHANNELFILE_ERROR_NO_FUNCTIONVERSION,
- array('parent' => $parent, 'protocol' => $protocol));
- }
- }
- }
- }
-
- /**
- * Test whether a string contains a valid channel server.
- * @param string $ver the package version to test
- * @return bool
- */
- function validChannelServer($server)
- {
- if ($server == '__uri') {
- return true;
- }
- return (bool) preg_match(PEAR_CHANNELS_SERVER_PREG, $server);
- }
-
- /**
- * @return string|false
- */
- function getName()
- {
- if (isset($this->_channelInfo['name'])) {
- return $this->_channelInfo['name'];
- }
-
- return false;
- }
-
- /**
- * @return string|false
- */
- function getServer()
- {
- if (isset($this->_channelInfo['name'])) {
- return $this->_channelInfo['name'];
- }
-
- return false;
- }
-
- /**
- * @return int|80 port number to connect to
- */
- function getPort($mirror = false)
- {
- if ($mirror) {
- if ($mir = $this->getMirror($mirror)) {
- if (isset($mir['attribs']['port'])) {
- return $mir['attribs']['port'];
- }
-
- if ($this->getSSL($mirror)) {
- return 443;
- }
-
- return 80;
- }
-
- return false;
- }
-
- if (isset($this->_channelInfo['servers']['primary']['attribs']['port'])) {
- return $this->_channelInfo['servers']['primary']['attribs']['port'];
- }
-
- if ($this->getSSL()) {
- return 443;
- }
-
- return 80;
- }
-
- /**
- * @return bool Determines whether secure sockets layer (SSL) is used to connect to this channel
- */
- function getSSL($mirror = false)
- {
- if ($mirror) {
- if ($mir = $this->getMirror($mirror)) {
- if (isset($mir['attribs']['ssl'])) {
- return true;
- }
-
- return false;
- }
-
- return false;
- }
-
- if (isset($this->_channelInfo['servers']['primary']['attribs']['ssl'])) {
- return true;
- }
-
- return false;
- }
-
- /**
- * @return string|false
- */
- function getSummary()
- {
- if (isset($this->_channelInfo['summary'])) {
- return $this->_channelInfo['summary'];
- }
-
- return false;
- }
-
- /**
- * @param string protocol type
- * @param string Mirror name
- * @return array|false
- */
- function getFunctions($protocol, $mirror = false)
- {
- if ($this->getName() == '__uri') {
- return false;
- }
-
- $function = $protocol == 'rest' ? 'baseurl' : 'function';
- if ($mirror) {
- if ($mir = $this->getMirror($mirror)) {
- if (isset($mir[$protocol][$function])) {
- return $mir[$protocol][$function];
- }
- }
-
- return false;
- }
-
- if (isset($this->_channelInfo['servers']['primary'][$protocol][$function])) {
- return $this->_channelInfo['servers']['primary'][$protocol][$function];
- }
-
- return false;
- }
-
- /**
- * @param string Protocol type
- * @param string Function name (null to return the
- * first protocol of the type requested)
- * @param string Mirror name, if any
- * @return array
- */
- function getFunction($type, $name = null, $mirror = false)
- {
- $protocols = $this->getFunctions($type, $mirror);
- if (!$protocols) {
- return false;
- }
-
- foreach ($protocols as $protocol) {
- if ($name === null) {
- return $protocol;
- }
-
- if ($protocol['_content'] != $name) {
- continue;
- }
-
- return $protocol;
- }
-
- return false;
- }
-
- /**
- * @param string protocol type
- * @param string protocol name
- * @param string version
- * @param string mirror name
- * @return boolean
- */
- function supports($type, $name = null, $mirror = false, $version = '1.0')
- {
- $protocols = $this->getFunctions($type, $mirror);
- if (!$protocols) {
- return false;
- }
-
- foreach ($protocols as $protocol) {
- if ($protocol['attribs']['version'] != $version) {
- continue;
- }
-
- if ($name === null) {
- return true;
- }
-
- if ($protocol['_content'] != $name) {
- continue;
- }
-
- return true;
- }
-
- return false;
- }
-
- /**
- * Determines whether a channel supports Representational State Transfer (REST) protocols
- * for retrieving channel information
- * @param string
- * @return bool
- */
- function supportsREST($mirror = false)
- {
- if ($mirror == $this->_channelInfo['name']) {
- $mirror = false;
- }
-
- if ($mirror) {
- if ($mir = $this->getMirror($mirror)) {
- return isset($mir['rest']);
- }
-
- return false;
- }
-
- return isset($this->_channelInfo['servers']['primary']['rest']);
- }
-
- /**
- * Get the URL to access a base resource.
- *
- * Hyperlinks in the returned xml will be used to retrieve the proper information
- * needed. This allows extreme extensibility and flexibility in implementation
- * @param string Resource Type to retrieve
- */
- function getBaseURL($resourceType, $mirror = false)
- {
- if ($mirror == $this->_channelInfo['name']) {
- $mirror = false;
- }
-
- if ($mirror) {
- $mir = $this->getMirror($mirror);
- if (!$mir) {
- return false;
- }
-
- $rest = $mir['rest'];
- } else {
- $rest = $this->_channelInfo['servers']['primary']['rest'];
- }
-
- if (!isset($rest['baseurl'][0])) {
- $rest['baseurl'] = array($rest['baseurl']);
- }
-
- foreach ($rest['baseurl'] as $baseurl) {
- if (strtolower($baseurl['attribs']['type']) == strtolower($resourceType)) {
- return $baseurl['_content'];
- }
- }
-
- return false;
- }
-
- /**
- * Since REST does not implement RPC, provide this as a logical wrapper around
- * resetFunctions for REST
- * @param string|false mirror name, if any
- */
- function resetREST($mirror = false)
- {
- return $this->resetFunctions('rest', $mirror);
- }
-
- /**
- * Empty all protocol definitions
- * @param string protocol type
- * @param string|false mirror name, if any
- */
- function resetFunctions($type, $mirror = false)
- {
- if ($mirror) {
- if (isset($this->_channelInfo['servers']['mirror'])) {
- $mirrors = $this->_channelInfo['servers']['mirror'];
- if (!isset($mirrors[0])) {
- $mirrors = array($mirrors);
- }
-
- foreach ($mirrors as $i => $mir) {
- if ($mir['attribs']['host'] == $mirror) {
- if (isset($this->_channelInfo['servers']['mirror'][$i][$type])) {
- unset($this->_channelInfo['servers']['mirror'][$i][$type]);
- }
-
- return true;
- }
- }
-
- return false;
- }
-
- return false;
- }
-
- if (isset($this->_channelInfo['servers']['primary'][$type])) {
- unset($this->_channelInfo['servers']['primary'][$type]);
- }
-
- return true;
- }
-
- /**
- * Set a channel's protocols to the protocols supported by pearweb
- */
- function setDefaultPEARProtocols($version = '1.0', $mirror = false)
- {
- switch ($version) {
- case '1.0' :
- $this->resetREST($mirror);
-
- if (!isset($this->_channelInfo['servers'])) {
- $this->_channelInfo['servers'] = array('primary' =>
- array('rest' => array()));
- } elseif (!isset($this->_channelInfo['servers']['primary'])) {
- $this->_channelInfo['servers']['primary'] = array('rest' => array());
- }
-
- return true;
- break;
- default :
- return false;
- break;
- }
- }
-
- /**
- * @return array
- */
- function getMirrors()
- {
- if (isset($this->_channelInfo['servers']['mirror'])) {
- $mirrors = $this->_channelInfo['servers']['mirror'];
- if (!isset($mirrors[0])) {
- $mirrors = array($mirrors);
- }
-
- return $mirrors;
- }
-
- return array();
- }
-
- /**
- * Get the unserialized XML representing a mirror
- * @return array|false
- */
- function getMirror($server)
- {
- foreach ($this->getMirrors() as $mirror) {
- if ($mirror['attribs']['host'] == $server) {
- return $mirror;
- }
- }
-
- return false;
- }
-
- /**
- * @param string
- * @return string|false
- * @error PEAR_CHANNELFILE_ERROR_NO_NAME
- * @error PEAR_CHANNELFILE_ERROR_INVALID_NAME
- */
- function setName($name)
- {
- return $this->setServer($name);
- }
-
- /**
- * Set the socket number (port) that is used to connect to this channel
- * @param integer
- * @param string|false name of the mirror server, or false for the primary
- */
- function setPort($port, $mirror = false)
- {
- if ($mirror) {
- if (!isset($this->_channelInfo['servers']['mirror'])) {
- $this->_validateError(PEAR_CHANNELFILE_ERROR_MIRROR_NOT_FOUND,
- array('mirror' => $mirror));
- return false;
- }
-
- if (isset($this->_channelInfo['servers']['mirror'][0])) {
- foreach ($this->_channelInfo['servers']['mirror'] as $i => $mir) {
- if ($mirror == $mir['attribs']['host']) {
- $this->_channelInfo['servers']['mirror'][$i]['attribs']['port'] = $port;
- return true;
- }
- }
-
- return false;
- } elseif ($this->_channelInfo['servers']['mirror']['attribs']['host'] == $mirror) {
- $this->_channelInfo['servers']['mirror']['attribs']['port'] = $port;
- $this->_isValid = false;
- return true;
- }
- }
-
- $this->_channelInfo['servers']['primary']['attribs']['port'] = $port;
- $this->_isValid = false;
- return true;
- }
-
- /**
- * Set the socket number (port) that is used to connect to this channel
- * @param bool Determines whether to turn on SSL support or turn it off
- * @param string|false name of the mirror server, or false for the primary
- */
- function setSSL($ssl = true, $mirror = false)
- {
- if ($mirror) {
- if (!isset($this->_channelInfo['servers']['mirror'])) {
- $this->_validateError(PEAR_CHANNELFILE_ERROR_MIRROR_NOT_FOUND,
- array('mirror' => $mirror));
- return false;
- }
-
- if (isset($this->_channelInfo['servers']['mirror'][0])) {
- foreach ($this->_channelInfo['servers']['mirror'] as $i => $mir) {
- if ($mirror == $mir['attribs']['host']) {
- if (!$ssl) {
- if (isset($this->_channelInfo['servers']['mirror'][$i]
- ['attribs']['ssl'])) {
- unset($this->_channelInfo['servers']['mirror'][$i]['attribs']['ssl']);
- }
- } else {
- $this->_channelInfo['servers']['mirror'][$i]['attribs']['ssl'] = 'yes';
- }
-
- return true;
- }
- }
-
- return false;
- } elseif ($this->_channelInfo['servers']['mirror']['attribs']['host'] == $mirror) {
- if (!$ssl) {
- if (isset($this->_channelInfo['servers']['mirror']['attribs']['ssl'])) {
- unset($this->_channelInfo['servers']['mirror']['attribs']['ssl']);
- }
- } else {
- $this->_channelInfo['servers']['mirror']['attribs']['ssl'] = 'yes';
- }
-
- $this->_isValid = false;
- return true;
- }
- }
-
- if ($ssl) {
- $this->_channelInfo['servers']['primary']['attribs']['ssl'] = 'yes';
- } else {
- if (isset($this->_channelInfo['servers']['primary']['attribs']['ssl'])) {
- unset($this->_channelInfo['servers']['primary']['attribs']['ssl']);
- }
- }
-
- $this->_isValid = false;
- return true;
- }
-
- /**
- * @param string
- * @return string|false
- * @error PEAR_CHANNELFILE_ERROR_NO_SERVER
- * @error PEAR_CHANNELFILE_ERROR_INVALID_SERVER
- */
- function setServer($server, $mirror = false)
- {
- if (empty($server)) {
- $this->_validateError(PEAR_CHANNELFILE_ERROR_NO_SERVER);
- return false;
- } elseif (!$this->validChannelServer($server)) {
- $this->_validateError(PEAR_CHANNELFILE_ERROR_INVALID_NAME,
- array('tag' => 'name', 'name' => $server));
- return false;
- }
-
- if ($mirror) {
- $found = false;
- foreach ($this->_channelInfo['servers']['mirror'] as $i => $mir) {
- if ($mirror == $mir['attribs']['host']) {
- $found = true;
- break;
- }
- }
-
- if (!$found) {
- $this->_validateError(PEAR_CHANNELFILE_ERROR_MIRROR_NOT_FOUND,
- array('mirror' => $mirror));
- return false;
- }
-
- $this->_channelInfo['mirror'][$i]['attribs']['host'] = $server;
- return true;
- }
-
- $this->_channelInfo['name'] = $server;
- return true;
- }
-
- /**
- * @param string
- * @return boolean success
- * @error PEAR_CHANNELFILE_ERROR_NO_SUMMARY
- * @warning PEAR_CHANNELFILE_ERROR_MULTILINE_SUMMARY
- */
- function setSummary($summary)
- {
- if (empty($summary)) {
- $this->_validateError(PEAR_CHANNELFILE_ERROR_NO_SUMMARY);
- return false;
- } elseif (strpos(trim($summary), "\n") !== false) {
- $this->_validateWarning(PEAR_CHANNELFILE_ERROR_MULTILINE_SUMMARY,
- array('summary' => $summary));
- }
-
- $this->_channelInfo['summary'] = $summary;
- return true;
- }
-
- /**
- * @param string
- * @param boolean determines whether the alias is in channel.xml or local
- * @return boolean success
- */
- function setAlias($alias, $local = false)
- {
- if (!$this->validChannelServer($alias)) {
- $this->_validateError(PEAR_CHANNELFILE_ERROR_INVALID_NAME,
- array('tag' => 'suggestedalias', 'name' => $alias));
- return false;
- }
-
- if ($local) {
- $this->_channelInfo['localalias'] = $alias;
- } else {
- $this->_channelInfo['suggestedalias'] = $alias;
- }
-
- return true;
- }
-
- /**
- * @return string
- */
- function getAlias()
- {
- if (isset($this->_channelInfo['localalias'])) {
- return $this->_channelInfo['localalias'];
- }
- if (isset($this->_channelInfo['suggestedalias'])) {
- return $this->_channelInfo['suggestedalias'];
- }
- if (isset($this->_channelInfo['name'])) {
- return $this->_channelInfo['name'];
- }
- return '';
- }
-
- /**
- * Set the package validation object if it differs from PEAR's default
- * The class must be includeable via changing _ in the classname to path separator,
- * but no checking of this is made.
- * @param string|false pass in false to reset to the default packagename regex
- * @return boolean success
- */
- function setValidationPackage($validateclass, $version)
- {
- if (empty($validateclass)) {
- unset($this->_channelInfo['validatepackage']);
- }
- $this->_channelInfo['validatepackage'] = array('_content' => $validateclass);
- $this->_channelInfo['validatepackage']['attribs'] = array('version' => $version);
- }
-
- /**
- * Add a protocol to the provides section
- * @param string protocol type
- * @param string protocol version
- * @param string protocol name, if any
- * @param string mirror name, if this is a mirror's protocol
- * @return bool
- */
- function addFunction($type, $version, $name = '', $mirror = false)
- {
- if ($mirror) {
- return $this->addMirrorFunction($mirror, $type, $version, $name);
- }
-
- $set = array('attribs' => array('version' => $version), '_content' => $name);
- if (!isset($this->_channelInfo['servers']['primary'][$type]['function'])) {
- if (!isset($this->_channelInfo['servers'])) {
- $this->_channelInfo['servers'] = array('primary' =>
- array($type => array()));
- } elseif (!isset($this->_channelInfo['servers']['primary'])) {
- $this->_channelInfo['servers']['primary'] = array($type => array());
- }
-
- $this->_channelInfo['servers']['primary'][$type]['function'] = $set;
- $this->_isValid = false;
- return true;
- } elseif (!isset($this->_channelInfo['servers']['primary'][$type]['function'][0])) {
- $this->_channelInfo['servers']['primary'][$type]['function'] = array(
- $this->_channelInfo['servers']['primary'][$type]['function']);
- }
-
- $this->_channelInfo['servers']['primary'][$type]['function'][] = $set;
- return true;
- }
- /**
- * Add a protocol to a mirror's provides section
- * @param string mirror name (server)
- * @param string protocol type
- * @param string protocol version
- * @param string protocol name, if any
- */
- function addMirrorFunction($mirror, $type, $version, $name = '')
- {
- if (!isset($this->_channelInfo['servers']['mirror'])) {
- $this->_validateError(PEAR_CHANNELFILE_ERROR_MIRROR_NOT_FOUND,
- array('mirror' => $mirror));
- return false;
- }
-
- $setmirror = false;
- if (isset($this->_channelInfo['servers']['mirror'][0])) {
- foreach ($this->_channelInfo['servers']['mirror'] as $i => $mir) {
- if ($mirror == $mir['attribs']['host']) {
- $setmirror = &$this->_channelInfo['servers']['mirror'][$i];
- break;
- }
- }
- } else {
- if ($this->_channelInfo['servers']['mirror']['attribs']['host'] == $mirror) {
- $setmirror = &$this->_channelInfo['servers']['mirror'];
- }
- }
-
- if (!$setmirror) {
- $this->_validateError(PEAR_CHANNELFILE_ERROR_MIRROR_NOT_FOUND,
- array('mirror' => $mirror));
- return false;
- }
-
- $set = array('attribs' => array('version' => $version), '_content' => $name);
- if (!isset($setmirror[$type]['function'])) {
- $setmirror[$type]['function'] = $set;
- $this->_isValid = false;
- return true;
- } elseif (!isset($setmirror[$type]['function'][0])) {
- $setmirror[$type]['function'] = array($setmirror[$type]['function']);
- }
-
- $setmirror[$type]['function'][] = $set;
- $this->_isValid = false;
- return true;
- }
-
- /**
- * @param string Resource Type this url links to
- * @param string URL
- * @param string|false mirror name, if this is not a primary server REST base URL
- */
- function setBaseURL($resourceType, $url, $mirror = false)
- {
- if ($mirror) {
- if (!isset($this->_channelInfo['servers']['mirror'])) {
- $this->_validateError(PEAR_CHANNELFILE_ERROR_MIRROR_NOT_FOUND,
- array('mirror' => $mirror));
- return false;
- }
-
- $setmirror = false;
- if (isset($this->_channelInfo['servers']['mirror'][0])) {
- foreach ($this->_channelInfo['servers']['mirror'] as $i => $mir) {
- if ($mirror == $mir['attribs']['host']) {
- $setmirror = &$this->_channelInfo['servers']['mirror'][$i];
- break;
- }
- }
- } else {
- if ($this->_channelInfo['servers']['mirror']['attribs']['host'] == $mirror) {
- $setmirror = &$this->_channelInfo['servers']['mirror'];
- }
- }
- } else {
- $setmirror = &$this->_channelInfo['servers']['primary'];
- }
-
- $set = array('attribs' => array('type' => $resourceType), '_content' => $url);
- if (!isset($setmirror['rest'])) {
- $setmirror['rest'] = array();
- }
-
- if (!isset($setmirror['rest']['baseurl'])) {
- $setmirror['rest']['baseurl'] = $set;
- $this->_isValid = false;
- return true;
- } elseif (!isset($setmirror['rest']['baseurl'][0])) {
- $setmirror['rest']['baseurl'] = array($setmirror['rest']['baseurl']);
- }
-
- foreach ($setmirror['rest']['baseurl'] as $i => $url) {
- if ($url['attribs']['type'] == $resourceType) {
- $this->_isValid = false;
- $setmirror['rest']['baseurl'][$i] = $set;
- return true;
- }
- }
-
- $setmirror['rest']['baseurl'][] = $set;
- $this->_isValid = false;
- return true;
- }
-
- /**
- * @param string mirror server
- * @param int mirror http port
- * @return boolean
- */
- function addMirror($server, $port = null)
- {
- if ($this->_channelInfo['name'] == '__uri') {
- return false; // the __uri channel cannot have mirrors by definition
- }
-
- $set = array('attribs' => array('host' => $server));
- if (is_numeric($port)) {
- $set['attribs']['port'] = $port;
- }
-
- if (!isset($this->_channelInfo['servers']['mirror'])) {
- $this->_channelInfo['servers']['mirror'] = $set;
- return true;
- }
-
- if (!isset($this->_channelInfo['servers']['mirror'][0])) {
- $this->_channelInfo['servers']['mirror'] =
- array($this->_channelInfo['servers']['mirror']);
- }
-
- $this->_channelInfo['servers']['mirror'][] = $set;
- return true;
- }
-
- /**
- * Retrieve the name of the validation package for this channel
- * @return string|false
- */
- function getValidationPackage()
- {
- if (!$this->_isValid && !$this->validate()) {
- return false;
- }
-
- if (!isset($this->_channelInfo['validatepackage'])) {
- return array('attribs' => array('version' => 'default'),
- '_content' => 'PEAR_Validate');
- }
-
- return $this->_channelInfo['validatepackage'];
- }
-
- /**
- * Retrieve the object that can be used for custom validation
- * @param string|false the name of the package to validate. If the package is
- * the channel validation package, PEAR_Validate is returned
- * @return PEAR_Validate|false false is returned if the validation package
- * cannot be located
- */
- function &getValidationObject($package = false)
- {
- if (!class_exists('PEAR_Validate')) {
- require_once 'PEAR/Validate.php';
- }
-
- if (!$this->_isValid) {
- if (!$this->validate()) {
- $a = false;
- return $a;
- }
- }
-
- if (isset($this->_channelInfo['validatepackage'])) {
- if ($package == $this->_channelInfo['validatepackage']) {
- // channel validation packages are always validated by PEAR_Validate
- $val = &new PEAR_Validate;
- return $val;
- }
-
- if (!class_exists(str_replace('.', '_',
- $this->_channelInfo['validatepackage']['_content']))) {
- if ($this->isIncludeable(str_replace('_', '/',
- $this->_channelInfo['validatepackage']['_content']) . '.php')) {
- include_once str_replace('_', '/',
- $this->_channelInfo['validatepackage']['_content']) . '.php';
- $vclass = str_replace('.', '_',
- $this->_channelInfo['validatepackage']['_content']);
- $val = &new $vclass;
- } else {
- $a = false;
- return $a;
- }
- } else {
- $vclass = str_replace('.', '_',
- $this->_channelInfo['validatepackage']['_content']);
- $val = &new $vclass;
- }
- } else {
- $val = &new PEAR_Validate;
- }
-
- return $val;
- }
-
- function isIncludeable($path)
- {
- $possibilities = explode(PATH_SEPARATOR, ini_get('include_path'));
- foreach ($possibilities as $dir) {
- if (file_exists($dir . DIRECTORY_SEPARATOR . $path)
- && is_readable($dir . DIRECTORY_SEPARATOR . $path)) {
- return true;
- }
- }
-
- return false;
- }
-
- /**
- * This function is used by the channel updater and retrieves a value set by
- * the registry, or the current time if it has not been set
- * @return string
- */
- function lastModified()
- {
- if (isset($this->_channelInfo['_lastmodified'])) {
- return $this->_channelInfo['_lastmodified'];
- }
-
- return time();
- }
-} \ No newline at end of file
diff --git a/3rdparty/PEAR/ChannelFile/Parser.php b/3rdparty/PEAR/ChannelFile/Parser.php
deleted file mode 100644
index e630ace2245..00000000000
--- a/3rdparty/PEAR/ChannelFile/Parser.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-/**
- * PEAR_ChannelFile_Parser for parsing channel.xml
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Parser.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a1
- */
-
-/**
- * base xml parser class
- */
-require_once 'PEAR/XMLParser.php';
-require_once 'PEAR/ChannelFile.php';
-/**
- * Parser for channel.xml
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a1
- */
-class PEAR_ChannelFile_Parser extends PEAR_XMLParser
-{
- var $_config;
- var $_logger;
- var $_registry;
-
- function setConfig(&$c)
- {
- $this->_config = &$c;
- $this->_registry = &$c->getRegistry();
- }
-
- function setLogger(&$l)
- {
- $this->_logger = &$l;
- }
-
- function parse($data, $file)
- {
- if (PEAR::isError($err = parent::parse($data, $file))) {
- return $err;
- }
-
- $ret = new PEAR_ChannelFile;
- $ret->setConfig($this->_config);
- if (isset($this->_logger)) {
- $ret->setLogger($this->_logger);
- }
-
- $ret->fromArray($this->_unserializedData);
- // make sure the filelist is in the easy to read format needed
- $ret->flattenFilelist();
- $ret->setPackagefile($file, $archive);
- return $ret;
- }
-} \ No newline at end of file
diff --git a/3rdparty/PEAR/Command.php b/3rdparty/PEAR/Command.php
deleted file mode 100644
index 13518d4e4b2..00000000000
--- a/3rdparty/PEAR/Command.php
+++ /dev/null
@@ -1,414 +0,0 @@
-<?php
-/**
- * PEAR_Command, command pattern class
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Stig Bakken <ssb@php.net>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Command.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 0.1
- */
-
-/**
- * Needed for error handling
- */
-require_once 'PEAR.php';
-require_once 'PEAR/Frontend.php';
-require_once 'PEAR/XMLParser.php';
-
-/**
- * List of commands and what classes they are implemented in.
- * @var array command => implementing class
- */
-$GLOBALS['_PEAR_Command_commandlist'] = array();
-
-/**
- * List of commands and their descriptions
- * @var array command => description
- */
-$GLOBALS['_PEAR_Command_commanddesc'] = array();
-
-/**
- * List of shortcuts to common commands.
- * @var array shortcut => command
- */
-$GLOBALS['_PEAR_Command_shortcuts'] = array();
-
-/**
- * Array of command objects
- * @var array class => object
- */
-$GLOBALS['_PEAR_Command_objects'] = array();
-
-/**
- * PEAR command class, a simple factory class for administrative
- * commands.
- *
- * How to implement command classes:
- *
- * - The class must be called PEAR_Command_Nnn, installed in the
- * "PEAR/Common" subdir, with a method called getCommands() that
- * returns an array of the commands implemented by the class (see
- * PEAR/Command/Install.php for an example).
- *
- * - The class must implement a run() function that is called with three
- * params:
- *
- * (string) command name
- * (array) assoc array with options, freely defined by each
- * command, for example:
- * array('force' => true)
- * (array) list of the other parameters
- *
- * The run() function returns a PEAR_CommandResponse object. Use
- * these methods to get information:
- *
- * int getStatus() Returns PEAR_COMMAND_(SUCCESS|FAILURE|PARTIAL)
- * *_PARTIAL means that you need to issue at least
- * one more command to complete the operation
- * (used for example for validation steps).
- *
- * string getMessage() Returns a message for the user. Remember,
- * no HTML or other interface-specific markup.
- *
- * If something unexpected happens, run() returns a PEAR error.
- *
- * - DON'T OUTPUT ANYTHING! Return text for output instead.
- *
- * - DON'T USE HTML! The text you return will be used from both Gtk,
- * web and command-line interfaces, so for now, keep everything to
- * plain text.
- *
- * - DON'T USE EXIT OR DIE! Always use pear errors. From static
- * classes do PEAR::raiseError(), from other classes do
- * $this->raiseError().
- * @category pear
- * @package PEAR
- * @author Stig Bakken <ssb@php.net>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 0.1
- */
-class PEAR_Command
-{
- // {{{ factory()
-
- /**
- * Get the right object for executing a command.
- *
- * @param string $command The name of the command
- * @param object $config Instance of PEAR_Config object
- *
- * @return object the command object or a PEAR error
- *
- * @access public
- * @static
- */
- function &factory($command, &$config)
- {
- if (empty($GLOBALS['_PEAR_Command_commandlist'])) {
- PEAR_Command::registerCommands();
- }
- if (isset($GLOBALS['_PEAR_Command_shortcuts'][$command])) {
- $command = $GLOBALS['_PEAR_Command_shortcuts'][$command];
- }
- if (!isset($GLOBALS['_PEAR_Command_commandlist'][$command])) {
- $a = PEAR::raiseError("unknown command `$command'");
- return $a;
- }
- $class = $GLOBALS['_PEAR_Command_commandlist'][$command];
- if (!class_exists($class)) {
- require_once $GLOBALS['_PEAR_Command_objects'][$class];
- }
- if (!class_exists($class)) {
- $a = PEAR::raiseError("unknown command `$command'");
- return $a;
- }
- $ui = PEAR_Command::getFrontendObject();
- $obj = new $class($ui, $config);
- return $obj;
- }
-
- // }}}
- // {{{ & getObject()
- function &getObject($command)
- {
- $class = $GLOBALS['_PEAR_Command_commandlist'][$command];
- if (!class_exists($class)) {
- require_once $GLOBALS['_PEAR_Command_objects'][$class];
- }
- if (!class_exists($class)) {
- return PEAR::raiseError("unknown command `$command'");
- }
- $ui = PEAR_Command::getFrontendObject();
- $config = &PEAR_Config::singleton();
- $obj = &new $class($ui, $config);
- return $obj;
- }
-
- // }}}
- // {{{ & getFrontendObject()
-
- /**
- * Get instance of frontend object.
- *
- * @return object|PEAR_Error
- * @static
- */
- function &getFrontendObject()
- {
- $a = &PEAR_Frontend::singleton();
- return $a;
- }
-
- // }}}
- // {{{ & setFrontendClass()
-
- /**
- * Load current frontend class.
- *
- * @param string $uiclass Name of class implementing the frontend
- *
- * @return object the frontend object, or a PEAR error
- * @static
- */
- function &setFrontendClass($uiclass)
- {
- $a = &PEAR_Frontend::setFrontendClass($uiclass);
- return $a;
- }
-
- // }}}
- // {{{ setFrontendType()
-
- /**
- * Set current frontend.
- *
- * @param string $uitype Name of the frontend type (for example "CLI")
- *
- * @return object the frontend object, or a PEAR error
- * @static
- */
- function setFrontendType($uitype)
- {
- $uiclass = 'PEAR_Frontend_' . $uitype;
- return PEAR_Command::setFrontendClass($uiclass);
- }
-
- // }}}
- // {{{ registerCommands()
-
- /**
- * Scan through the Command directory looking for classes
- * and see what commands they implement.
- *
- * @param bool (optional) if FALSE (default), the new list of
- * commands should replace the current one. If TRUE,
- * new entries will be merged with old.
- *
- * @param string (optional) where (what directory) to look for
- * classes, defaults to the Command subdirectory of
- * the directory from where this file (__FILE__) is
- * included.
- *
- * @return bool TRUE on success, a PEAR error on failure
- *
- * @access public
- * @static
- */
- function registerCommands($merge = false, $dir = null)
- {
- $parser = new PEAR_XMLParser;
- if ($dir === null) {
- $dir = dirname(__FILE__) . '/Command';
- }
- if (!is_dir($dir)) {
- return PEAR::raiseError("registerCommands: opendir($dir) '$dir' does not exist or is not a directory");
- }
- $dp = @opendir($dir);
- if (empty($dp)) {
- return PEAR::raiseError("registerCommands: opendir($dir) failed");
- }
- if (!$merge) {
- $GLOBALS['_PEAR_Command_commandlist'] = array();
- }
-
- while ($file = readdir($dp)) {
- if ($file{0} == '.' || substr($file, -4) != '.xml') {
- continue;
- }
-
- $f = substr($file, 0, -4);
- $class = "PEAR_Command_" . $f;
- // List of commands
- if (empty($GLOBALS['_PEAR_Command_objects'][$class])) {
- $GLOBALS['_PEAR_Command_objects'][$class] = "$dir/" . $f . '.php';
- }
-
- $parser->parse(file_get_contents("$dir/$file"));
- $implements = $parser->getData();
- foreach ($implements as $command => $desc) {
- if ($command == 'attribs') {
- continue;
- }
-
- if (isset($GLOBALS['_PEAR_Command_commandlist'][$command])) {
- return PEAR::raiseError('Command "' . $command . '" already registered in ' .
- 'class "' . $GLOBALS['_PEAR_Command_commandlist'][$command] . '"');
- }
-
- $GLOBALS['_PEAR_Command_commandlist'][$command] = $class;
- $GLOBALS['_PEAR_Command_commanddesc'][$command] = $desc['summary'];
- if (isset($desc['shortcut'])) {
- $shortcut = $desc['shortcut'];
- if (isset($GLOBALS['_PEAR_Command_shortcuts'][$shortcut])) {
- return PEAR::raiseError('Command shortcut "' . $shortcut . '" already ' .
- 'registered to command "' . $command . '" in class "' .
- $GLOBALS['_PEAR_Command_commandlist'][$command] . '"');
- }
- $GLOBALS['_PEAR_Command_shortcuts'][$shortcut] = $command;
- }
-
- if (isset($desc['options']) && $desc['options']) {
- foreach ($desc['options'] as $oname => $option) {
- if (isset($option['shortopt']) && strlen($option['shortopt']) > 1) {
- return PEAR::raiseError('Option "' . $oname . '" short option "' .
- $option['shortopt'] . '" must be ' .
- 'only 1 character in Command "' . $command . '" in class "' .
- $class . '"');
- }
- }
- }
- }
- }
-
- ksort($GLOBALS['_PEAR_Command_shortcuts']);
- ksort($GLOBALS['_PEAR_Command_commandlist']);
- @closedir($dp);
- return true;
- }
-
- // }}}
- // {{{ getCommands()
-
- /**
- * Get the list of currently supported commands, and what
- * classes implement them.
- *
- * @return array command => implementing class
- *
- * @access public
- * @static
- */
- function getCommands()
- {
- if (empty($GLOBALS['_PEAR_Command_commandlist'])) {
- PEAR_Command::registerCommands();
- }
- return $GLOBALS['_PEAR_Command_commandlist'];
- }
-
- // }}}
- // {{{ getShortcuts()
-
- /**
- * Get the list of command shortcuts.
- *
- * @return array shortcut => command
- *
- * @access public
- * @static
- */
- function getShortcuts()
- {
- if (empty($GLOBALS['_PEAR_Command_shortcuts'])) {
- PEAR_Command::registerCommands();
- }
- return $GLOBALS['_PEAR_Command_shortcuts'];
- }
-
- // }}}
- // {{{ getGetoptArgs()
-
- /**
- * Compiles arguments for getopt.
- *
- * @param string $command command to get optstring for
- * @param string $short_args (reference) short getopt format
- * @param array $long_args (reference) long getopt format
- *
- * @return void
- *
- * @access public
- * @static
- */
- function getGetoptArgs($command, &$short_args, &$long_args)
- {
- if (empty($GLOBALS['_PEAR_Command_commandlist'])) {
- PEAR_Command::registerCommands();
- }
- if (isset($GLOBALS['_PEAR_Command_shortcuts'][$command])) {
- $command = $GLOBALS['_PEAR_Command_shortcuts'][$command];
- }
- if (!isset($GLOBALS['_PEAR_Command_commandlist'][$command])) {
- return null;
- }
- $obj = &PEAR_Command::getObject($command);
- return $obj->getGetoptArgs($command, $short_args, $long_args);
- }
-
- // }}}
- // {{{ getDescription()
-
- /**
- * Get description for a command.
- *
- * @param string $command Name of the command
- *
- * @return string command description
- *
- * @access public
- * @static
- */
- function getDescription($command)
- {
- if (!isset($GLOBALS['_PEAR_Command_commanddesc'][$command])) {
- return null;
- }
- return $GLOBALS['_PEAR_Command_commanddesc'][$command];
- }
-
- // }}}
- // {{{ getHelp()
-
- /**
- * Get help for command.
- *
- * @param string $command Name of the command to return help for
- *
- * @access public
- * @static
- */
- function getHelp($command)
- {
- $cmds = PEAR_Command::getCommands();
- if (isset($GLOBALS['_PEAR_Command_shortcuts'][$command])) {
- $command = $GLOBALS['_PEAR_Command_shortcuts'][$command];
- }
- if (isset($cmds[$command])) {
- $obj = &PEAR_Command::getObject($command);
- return $obj->getHelp($command);
- }
- return false;
- }
- // }}}
-} \ No newline at end of file
diff --git a/3rdparty/PEAR/Command/Auth.php b/3rdparty/PEAR/Command/Auth.php
deleted file mode 100644
index 63cd152b900..00000000000
--- a/3rdparty/PEAR/Command/Auth.php
+++ /dev/null
@@ -1,81 +0,0 @@
-<?php
-/**
- * PEAR_Command_Auth (login, logout commands)
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Stig Bakken <ssb@php.net>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Auth.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 0.1
- * @deprecated since 1.8.0alpha1
- */
-
-/**
- * base class
- */
-require_once 'PEAR/Command/Channels.php';
-
-/**
- * PEAR commands for login/logout
- *
- * @category pear
- * @package PEAR
- * @author Stig Bakken <ssb@php.net>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 0.1
- * @deprecated since 1.8.0alpha1
- */
-class PEAR_Command_Auth extends PEAR_Command_Channels
-{
- var $commands = array(
- 'login' => array(
- 'summary' => 'Connects and authenticates to remote server [Deprecated in favor of channel-login]',
- 'shortcut' => 'li',
- 'function' => 'doLogin',
- 'options' => array(),
- 'doc' => '<channel name>
-WARNING: This function is deprecated in favor of using channel-login
-
-Log in to a remote channel server. If <channel name> is not supplied,
-the default channel is used. To use remote functions in the installer
-that require any kind of privileges, you need to log in first. The
-username and password you enter here will be stored in your per-user
-PEAR configuration (~/.pearrc on Unix-like systems). After logging
-in, your username and password will be sent along in subsequent
-operations on the remote server.',
- ),
- 'logout' => array(
- 'summary' => 'Logs out from the remote server [Deprecated in favor of channel-logout]',
- 'shortcut' => 'lo',
- 'function' => 'doLogout',
- 'options' => array(),
- 'doc' => '
-WARNING: This function is deprecated in favor of using channel-logout
-
-Logs out from the remote server. This command does not actually
-connect to the remote server, it only deletes the stored username and
-password from your user configuration.',
- )
-
- );
-
- /**
- * PEAR_Command_Auth constructor.
- *
- * @access public
- */
- function PEAR_Command_Auth(&$ui, &$config)
- {
- parent::PEAR_Command_Channels($ui, $config);
- }
-} \ No newline at end of file
diff --git a/3rdparty/PEAR/Command/Auth.xml b/3rdparty/PEAR/Command/Auth.xml
deleted file mode 100644
index 590193d142a..00000000000
--- a/3rdparty/PEAR/Command/Auth.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<commands version="1.0">
- <login>
- <summary>Connects and authenticates to remote server [Deprecated in favor of channel-login]</summary>
- <function>doLogin</function>
- <shortcut>li</shortcut>
- <options />
- <doc>&lt;channel name&gt;
-WARNING: This function is deprecated in favor of using channel-login
-
-Log in to a remote channel server. If &lt;channel name&gt; is not supplied,
-the default channel is used. To use remote functions in the installer
-that require any kind of privileges, you need to log in first. The
-username and password you enter here will be stored in your per-user
-PEAR configuration (~/.pearrc on Unix-like systems). After logging
-in, your username and password will be sent along in subsequent
-operations on the remote server.</doc>
- </login>
- <logout>
- <summary>Logs out from the remote server [Deprecated in favor of channel-logout]</summary>
- <function>doLogout</function>
- <shortcut>lo</shortcut>
- <options />
- <doc>
-WARNING: This function is deprecated in favor of using channel-logout
-
-Logs out from the remote server. This command does not actually
-connect to the remote server, it only deletes the stored username and
-password from your user configuration.</doc>
- </logout>
-</commands> \ No newline at end of file
diff --git a/3rdparty/PEAR/Command/Build.php b/3rdparty/PEAR/Command/Build.php
deleted file mode 100644
index 1de7320246a..00000000000
--- a/3rdparty/PEAR/Command/Build.php
+++ /dev/null
@@ -1,85 +0,0 @@
-<?php
-/**
- * PEAR_Command_Auth (build command)
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Stig Bakken <ssb@php.net>
- * @author Tomas V.V.Cox <cox@idecnet.com>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Build.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 0.1
- */
-
-/**
- * base class
- */
-require_once 'PEAR/Command/Common.php';
-
-/**
- * PEAR commands for building extensions.
- *
- * @category pear
- * @package PEAR
- * @author Stig Bakken <ssb@php.net>
- * @author Tomas V.V.Cox <cox@idecnet.com>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 0.1
- */
-class PEAR_Command_Build extends PEAR_Command_Common
-{
- var $commands = array(
- 'build' => array(
- 'summary' => 'Build an Extension From C Source',
- 'function' => 'doBuild',
- 'shortcut' => 'b',
- 'options' => array(),
- 'doc' => '[package.xml]
-Builds one or more extensions contained in a package.'
- ),
- );
-
- /**
- * PEAR_Command_Build constructor.
- *
- * @access public
- */
- function PEAR_Command_Build(&$ui, &$config)
- {
- parent::PEAR_Command_Common($ui, $config);
- }
-
- function doBuild($command, $options, $params)
- {
- require_once 'PEAR/Builder.php';
- if (sizeof($params) < 1) {
- $params[0] = 'package.xml';
- }
-
- $builder = &new PEAR_Builder($this->ui);
- $this->debug = $this->config->get('verbose');
- $err = $builder->build($params[0], array(&$this, 'buildCallback'));
- if (PEAR::isError($err)) {
- return $err;
- }
-
- return true;
- }
-
- function buildCallback($what, $data)
- {
- if (($what == 'cmdoutput' && $this->debug > 1) ||
- ($what == 'output' && $this->debug > 0)) {
- $this->ui->outputData(rtrim($data), 'build');
- }
- }
-} \ No newline at end of file
diff --git a/3rdparty/PEAR/Command/Build.xml b/3rdparty/PEAR/Command/Build.xml
deleted file mode 100644
index ec4e6f554ca..00000000000
--- a/3rdparty/PEAR/Command/Build.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<commands version="1.0">
- <build>
- <summary>Build an Extension From C Source</summary>
- <function>doBuild</function>
- <shortcut>b</shortcut>
- <options />
- <doc>[package.xml]
-Builds one or more extensions contained in a package.</doc>
- </build>
-</commands> \ No newline at end of file
diff --git a/3rdparty/PEAR/Command/Channels.php b/3rdparty/PEAR/Command/Channels.php
deleted file mode 100644
index fcf01b50391..00000000000
--- a/3rdparty/PEAR/Command/Channels.php
+++ /dev/null
@@ -1,883 +0,0 @@
-<?php
-// /* vim: set expandtab tabstop=4 shiftwidth=4: */
-/**
- * PEAR_Command_Channels (list-channels, update-channels, channel-delete, channel-add,
- * channel-update, channel-info, channel-alias, channel-discover commands)
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Stig Bakken <ssb@php.net>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Channels.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a1
- */
-
-/**
- * base class
- */
-require_once 'PEAR/Command/Common.php';
-
-define('PEAR_COMMAND_CHANNELS_CHANNEL_EXISTS', -500);
-
-/**
- * PEAR commands for managing channels.
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a1
- */
-class PEAR_Command_Channels extends PEAR_Command_Common
-{
- var $commands = array(
- 'list-channels' => array(
- 'summary' => 'List Available Channels',
- 'function' => 'doList',
- 'shortcut' => 'lc',
- 'options' => array(),
- 'doc' => '
-List all available channels for installation.
-',
- ),
- 'update-channels' => array(
- 'summary' => 'Update the Channel List',
- 'function' => 'doUpdateAll',
- 'shortcut' => 'uc',
- 'options' => array(),
- 'doc' => '
-List all installed packages in all channels.
-'
- ),
- 'channel-delete' => array(
- 'summary' => 'Remove a Channel From the List',
- 'function' => 'doDelete',
- 'shortcut' => 'cde',
- 'options' => array(),
- 'doc' => '<channel name>
-Delete a channel from the registry. You may not
-remove any channel that has installed packages.
-'
- ),
- 'channel-add' => array(
- 'summary' => 'Add a Channel',
- 'function' => 'doAdd',
- 'shortcut' => 'ca',
- 'options' => array(),
- 'doc' => '<channel.xml>
-Add a private channel to the channel list. Note that all
-public channels should be synced using "update-channels".
-Parameter may be either a local file or remote URL to a
-channel.xml.
-'
- ),
- 'channel-update' => array(
- 'summary' => 'Update an Existing Channel',
- 'function' => 'doUpdate',
- 'shortcut' => 'cu',
- 'options' => array(
- 'force' => array(
- 'shortopt' => 'f',
- 'doc' => 'will force download of new channel.xml if an existing channel name is used',
- ),
- 'channel' => array(
- 'shortopt' => 'c',
- 'arg' => 'CHANNEL',
- 'doc' => 'will force download of new channel.xml if an existing channel name is used',
- ),
-),
- 'doc' => '[<channel.xml>|<channel name>]
-Update a channel in the channel list directly. Note that all
-public channels can be synced using "update-channels".
-Parameter may be a local or remote channel.xml, or the name of
-an existing channel.
-'
- ),
- 'channel-info' => array(
- 'summary' => 'Retrieve Information on a Channel',
- 'function' => 'doInfo',
- 'shortcut' => 'ci',
- 'options' => array(),
- 'doc' => '<package>
-List the files in an installed package.
-'
- ),
- 'channel-alias' => array(
- 'summary' => 'Specify an alias to a channel name',
- 'function' => 'doAlias',
- 'shortcut' => 'cha',
- 'options' => array(),
- 'doc' => '<channel> <alias>
-Specify a specific alias to use for a channel name.
-The alias may not be an existing channel name or
-alias.
-'
- ),
- 'channel-discover' => array(
- 'summary' => 'Initialize a Channel from its server',
- 'function' => 'doDiscover',
- 'shortcut' => 'di',
- 'options' => array(),
- 'doc' => '[<channel.xml>|<channel name>]
-Initialize a channel from its server and create a local channel.xml.
-If <channel name> is in the format "<username>:<password>@<channel>" then
-<username> and <password> will be set as the login username/password for
-<channel>. Use caution when passing the username/password in this way, as
-it may allow other users on your computer to briefly view your username/
-password via the system\'s process list.
-'
- ),
- 'channel-login' => array(
- 'summary' => 'Connects and authenticates to remote channel server',
- 'shortcut' => 'cli',
- 'function' => 'doLogin',
- 'options' => array(),
- 'doc' => '<channel name>
-Log in to a remote channel server. If <channel name> is not supplied,
-the default channel is used. To use remote functions in the installer
-that require any kind of privileges, you need to log in first. The
-username and password you enter here will be stored in your per-user
-PEAR configuration (~/.pearrc on Unix-like systems). After logging
-in, your username and password will be sent along in subsequent
-operations on the remote server.',
- ),
- 'channel-logout' => array(
- 'summary' => 'Logs out from the remote channel server',
- 'shortcut' => 'clo',
- 'function' => 'doLogout',
- 'options' => array(),
- 'doc' => '<channel name>
-Logs out from a remote channel server. If <channel name> is not supplied,
-the default channel is used. This command does not actually connect to the
-remote server, it only deletes the stored username and password from your user
-configuration.',
- ),
- );
-
- /**
- * PEAR_Command_Registry constructor.
- *
- * @access public
- */
- function PEAR_Command_Channels(&$ui, &$config)
- {
- parent::PEAR_Command_Common($ui, $config);
- }
-
- function _sortChannels($a, $b)
- {
- return strnatcasecmp($a->getName(), $b->getName());
- }
-
- function doList($command, $options, $params)
- {
- $reg = &$this->config->getRegistry();
- $registered = $reg->getChannels();
- usort($registered, array(&$this, '_sortchannels'));
- $i = $j = 0;
- $data = array(
- 'caption' => 'Registered Channels:',
- 'border' => true,
- 'headline' => array('Channel', 'Alias', 'Summary')
- );
- foreach ($registered as $channel) {
- $data['data'][] = array($channel->getName(),
- $channel->getAlias(),
- $channel->getSummary());
- }
-
- if (count($registered) === 0) {
- $data = '(no registered channels)';
- }
- $this->ui->outputData($data, $command);
- return true;
- }
-
- function doUpdateAll($command, $options, $params)
- {
- $reg = &$this->config->getRegistry();
- $channels = $reg->getChannels();
-
- $success = true;
- foreach ($channels as $channel) {
- if ($channel->getName() != '__uri') {
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- $err = $this->doUpdate('channel-update',
- $options,
- array($channel->getName()));
- if (PEAR::isError($err)) {
- $this->ui->outputData($err->getMessage(), $command);
- $success = false;
- } else {
- $success &= $err;
- }
- }
- }
- return $success;
- }
-
- function doInfo($command, $options, $params)
- {
- if (count($params) !== 1) {
- return $this->raiseError("No channel specified");
- }
-
- $reg = &$this->config->getRegistry();
- $channel = strtolower($params[0]);
- if ($reg->channelExists($channel)) {
- $chan = $reg->getChannel($channel);
- if (PEAR::isError($chan)) {
- return $this->raiseError($chan);
- }
- } else {
- if (strpos($channel, '://')) {
- $downloader = &$this->getDownloader();
- $tmpdir = $this->config->get('temp_dir');
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- $loc = $downloader->downloadHttp($channel, $this->ui, $tmpdir);
- PEAR::staticPopErrorHandling();
- if (PEAR::isError($loc)) {
- return $this->raiseError('Cannot open "' . $channel .
- '" (' . $loc->getMessage() . ')');
- } else {
- $contents = implode('', file($loc));
- }
- } else {
- if (!file_exists($params[0])) {
- return $this->raiseError('Unknown channel "' . $channel . '"');
- }
-
- $fp = fopen($params[0], 'r');
- if (!$fp) {
- return $this->raiseError('Cannot open "' . $params[0] . '"');
- }
-
- $contents = '';
- while (!feof($fp)) {
- $contents .= fread($fp, 1024);
- }
- fclose($fp);
- }
-
- if (!class_exists('PEAR_ChannelFile')) {
- require_once 'PEAR/ChannelFile.php';
- }
-
- $chan = new PEAR_ChannelFile;
- $chan->fromXmlString($contents);
- $chan->validate();
- if ($errs = $chan->getErrors(true)) {
- foreach ($errs as $err) {
- $this->ui->outputData($err['level'] . ': ' . $err['message']);
- }
- return $this->raiseError('Channel file "' . $params[0] . '" is not valid');
- }
- }
-
- if (!$chan) {
- return $this->raiseError('Serious error: Channel "' . $params[0] .
- '" has a corrupted registry entry');
- }
-
- $channel = $chan->getName();
- $caption = 'Channel ' . $channel . ' Information:';
- $data1 = array(
- 'caption' => $caption,
- 'border' => true);
- $data1['data']['server'] = array('Name and Server', $chan->getName());
- if ($chan->getAlias() != $chan->getName()) {
- $data1['data']['alias'] = array('Alias', $chan->getAlias());
- }
-
- $data1['data']['summary'] = array('Summary', $chan->getSummary());
- $validate = $chan->getValidationPackage();
- $data1['data']['vpackage'] = array('Validation Package Name', $validate['_content']);
- $data1['data']['vpackageversion'] =
- array('Validation Package Version', $validate['attribs']['version']);
- $d = array();
- $d['main'] = $data1;
-
- $data['data'] = array();
- $data['caption'] = 'Server Capabilities';
- $data['headline'] = array('Type', 'Version/REST type', 'Function Name/REST base');
- if ($chan->supportsREST()) {
- if ($chan->supportsREST()) {
- $funcs = $chan->getFunctions('rest');
- if (!isset($funcs[0])) {
- $funcs = array($funcs);
- }
- foreach ($funcs as $protocol) {
- $data['data'][] = array('rest', $protocol['attribs']['type'],
- $protocol['_content']);
- }
- }
- } else {
- $data['data'][] = array('No supported protocols');
- }
-
- $d['protocols'] = $data;
- $data['data'] = array();
- $mirrors = $chan->getMirrors();
- if ($mirrors) {
- $data['caption'] = 'Channel ' . $channel . ' Mirrors:';
- unset($data['headline']);
- foreach ($mirrors as $mirror) {
- $data['data'][] = array($mirror['attribs']['host']);
- $d['mirrors'] = $data;
- }
-
- foreach ($mirrors as $i => $mirror) {
- $data['data'] = array();
- $data['caption'] = 'Mirror ' . $mirror['attribs']['host'] . ' Capabilities';
- $data['headline'] = array('Type', 'Version/REST type', 'Function Name/REST base');
- if ($chan->supportsREST($mirror['attribs']['host'])) {
- if ($chan->supportsREST($mirror['attribs']['host'])) {
- $funcs = $chan->getFunctions('rest', $mirror['attribs']['host']);
- if (!isset($funcs[0])) {
- $funcs = array($funcs);
- }
-
- foreach ($funcs as $protocol) {
- $data['data'][] = array('rest', $protocol['attribs']['type'],
- $protocol['_content']);
- }
- }
- } else {
- $data['data'][] = array('No supported protocols');
- }
- $d['mirrorprotocols' . $i] = $data;
- }
- }
- $this->ui->outputData($d, 'channel-info');
- }
-
- // }}}
-
- function doDelete($command, $options, $params)
- {
- if (count($params) !== 1) {
- return $this->raiseError('channel-delete: no channel specified');
- }
-
- $reg = &$this->config->getRegistry();
- if (!$reg->channelExists($params[0])) {
- return $this->raiseError('channel-delete: channel "' . $params[0] . '" does not exist');
- }
-
- $channel = $reg->channelName($params[0]);
- if ($channel == 'pear.php.net') {
- return $this->raiseError('Cannot delete the pear.php.net channel');
- }
-
- if ($channel == 'pecl.php.net') {
- return $this->raiseError('Cannot delete the pecl.php.net channel');
- }
-
- if ($channel == 'doc.php.net') {
- return $this->raiseError('Cannot delete the doc.php.net channel');
- }
-
- if ($channel == '__uri') {
- return $this->raiseError('Cannot delete the __uri pseudo-channel');
- }
-
- if (PEAR::isError($err = $reg->listPackages($channel))) {
- return $err;
- }
-
- if (count($err)) {
- return $this->raiseError('Channel "' . $channel .
- '" has installed packages, cannot delete');
- }
-
- if (!$reg->deleteChannel($channel)) {
- return $this->raiseError('Channel "' . $channel . '" deletion failed');
- } else {
- $this->config->deleteChannel($channel);
- $this->ui->outputData('Channel "' . $channel . '" deleted', $command);
- }
- }
-
- function doAdd($command, $options, $params)
- {
- if (count($params) !== 1) {
- return $this->raiseError('channel-add: no channel file specified');
- }
-
- if (strpos($params[0], '://')) {
- $downloader = &$this->getDownloader();
- $tmpdir = $this->config->get('temp_dir');
- if (!file_exists($tmpdir)) {
- require_once 'System.php';
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- $err = System::mkdir(array('-p', $tmpdir));
- PEAR::staticPopErrorHandling();
- if (PEAR::isError($err)) {
- return $this->raiseError('channel-add: temp_dir does not exist: "' .
- $tmpdir .
- '" - You can change this location with "pear config-set temp_dir"');
- }
- }
-
- if (!is_writable($tmpdir)) {
- return $this->raiseError('channel-add: temp_dir is not writable: "' .
- $tmpdir .
- '" - You can change this location with "pear config-set temp_dir"');
- }
-
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- $loc = $downloader->downloadHttp($params[0], $this->ui, $tmpdir, null, false);
- PEAR::staticPopErrorHandling();
- if (PEAR::isError($loc)) {
- return $this->raiseError('channel-add: Cannot open "' . $params[0] .
- '" (' . $loc->getMessage() . ')');
- }
-
- list($loc, $lastmodified) = $loc;
- $contents = implode('', file($loc));
- } else {
- $lastmodified = $fp = false;
- if (file_exists($params[0])) {
- $fp = fopen($params[0], 'r');
- }
-
- if (!$fp) {
- return $this->raiseError('channel-add: cannot open "' . $params[0] . '"');
- }
-
- $contents = '';
- while (!feof($fp)) {
- $contents .= fread($fp, 1024);
- }
- fclose($fp);
- }
-
- if (!class_exists('PEAR_ChannelFile')) {
- require_once 'PEAR/ChannelFile.php';
- }
-
- $channel = new PEAR_ChannelFile;
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- $result = $channel->fromXmlString($contents);
- PEAR::staticPopErrorHandling();
- if (!$result) {
- $exit = false;
- if (count($errors = $channel->getErrors(true))) {
- foreach ($errors as $error) {
- $this->ui->outputData(ucfirst($error['level'] . ': ' . $error['message']));
- if (!$exit) {
- $exit = $error['level'] == 'error' ? true : false;
- }
- }
- if ($exit) {
- return $this->raiseError('channel-add: invalid channel.xml file');
- }
- }
- }
-
- $reg = &$this->config->getRegistry();
- if ($reg->channelExists($channel->getName())) {
- return $this->raiseError('channel-add: Channel "' . $channel->getName() .
- '" exists, use channel-update to update entry', PEAR_COMMAND_CHANNELS_CHANNEL_EXISTS);
- }
-
- $ret = $reg->addChannel($channel, $lastmodified);
- if (PEAR::isError($ret)) {
- return $ret;
- }
-
- if (!$ret) {
- return $this->raiseError('channel-add: adding Channel "' . $channel->getName() .
- '" to registry failed');
- }
-
- $this->config->setChannels($reg->listChannels());
- $this->config->writeConfigFile();
- $this->ui->outputData('Adding Channel "' . $channel->getName() . '" succeeded', $command);
- }
-
- function doUpdate($command, $options, $params)
- {
- if (count($params) !== 1) {
- return $this->raiseError("No channel file specified");
- }
-
- $tmpdir = $this->config->get('temp_dir');
- if (!file_exists($tmpdir)) {
- require_once 'System.php';
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- $err = System::mkdir(array('-p', $tmpdir));
- PEAR::staticPopErrorHandling();
- if (PEAR::isError($err)) {
- return $this->raiseError('channel-add: temp_dir does not exist: "' .
- $tmpdir .
- '" - You can change this location with "pear config-set temp_dir"');
- }
- }
-
- if (!is_writable($tmpdir)) {
- return $this->raiseError('channel-add: temp_dir is not writable: "' .
- $tmpdir .
- '" - You can change this location with "pear config-set temp_dir"');
- }
-
- $reg = &$this->config->getRegistry();
- $lastmodified = false;
- if ((!file_exists($params[0]) || is_dir($params[0]))
- && $reg->channelExists(strtolower($params[0]))) {
- $c = $reg->getChannel(strtolower($params[0]));
- if (PEAR::isError($c)) {
- return $this->raiseError($c);
- }
-
- $this->ui->outputData("Updating channel \"$params[0]\"", $command);
- $dl = &$this->getDownloader(array());
- // if force is specified, use a timestamp of "1" to force retrieval
- $lastmodified = isset($options['force']) ? false : $c->lastModified();
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- $contents = $dl->downloadHttp('http://' . $c->getName() . '/channel.xml',
- $this->ui, $tmpdir, null, $lastmodified);
- PEAR::staticPopErrorHandling();
- if (PEAR::isError($contents)) {
- // Attempt to fall back to https
- $this->ui->outputData("Channel \"$params[0]\" is not responding over http://, failed with message: " . $contents->getMessage());
- $this->ui->outputData("Trying channel \"$params[0]\" over https:// instead");
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- $contents = $dl->downloadHttp('https://' . $c->getName() . '/channel.xml',
- $this->ui, $tmpdir, null, $lastmodified);
- PEAR::staticPopErrorHandling();
- if (PEAR::isError($contents)) {
- return $this->raiseError('Cannot retrieve channel.xml for channel "' .
- $c->getName() . '" (' . $contents->getMessage() . ')');
- }
- }
-
- list($contents, $lastmodified) = $contents;
- if (!$contents) {
- $this->ui->outputData("Channel \"$params[0]\" is up to date");
- return;
- }
-
- $contents = implode('', file($contents));
- if (!class_exists('PEAR_ChannelFile')) {
- require_once 'PEAR/ChannelFile.php';
- }
-
- $channel = new PEAR_ChannelFile;
- $channel->fromXmlString($contents);
- if (!$channel->getErrors()) {
- // security check: is the downloaded file for the channel we got it from?
- if (strtolower($channel->getName()) != strtolower($c->getName())) {
- if (!isset($options['force'])) {
- return $this->raiseError('ERROR: downloaded channel definition file' .
- ' for channel "' . $channel->getName() . '" from channel "' .
- strtolower($c->getName()) . '"');
- }
-
- $this->ui->log(0, 'WARNING: downloaded channel definition file' .
- ' for channel "' . $channel->getName() . '" from channel "' .
- strtolower($c->getName()) . '"');
- }
- }
- } else {
- if (strpos($params[0], '://')) {
- $dl = &$this->getDownloader();
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- $loc = $dl->downloadHttp($params[0],
- $this->ui, $tmpdir, null, $lastmodified);
- PEAR::staticPopErrorHandling();
- if (PEAR::isError($loc)) {
- return $this->raiseError("Cannot open " . $params[0] .
- ' (' . $loc->getMessage() . ')');
- }
-
- list($loc, $lastmodified) = $loc;
- $contents = implode('', file($loc));
- } else {
- $fp = false;
- if (file_exists($params[0])) {
- $fp = fopen($params[0], 'r');
- }
-
- if (!$fp) {
- return $this->raiseError("Cannot open " . $params[0]);
- }
-
- $contents = '';
- while (!feof($fp)) {
- $contents .= fread($fp, 1024);
- }
- fclose($fp);
- }
-
- if (!class_exists('PEAR_ChannelFile')) {
- require_once 'PEAR/ChannelFile.php';
- }
-
- $channel = new PEAR_ChannelFile;
- $channel->fromXmlString($contents);
- }
-
- $exit = false;
- if (count($errors = $channel->getErrors(true))) {
- foreach ($errors as $error) {
- $this->ui->outputData(ucfirst($error['level'] . ': ' . $error['message']));
- if (!$exit) {
- $exit = $error['level'] == 'error' ? true : false;
- }
- }
- if ($exit) {
- return $this->raiseError('Invalid channel.xml file');
- }
- }
-
- if (!$reg->channelExists($channel->getName())) {
- return $this->raiseError('Error: Channel "' . $channel->getName() .
- '" does not exist, use channel-add to add an entry');
- }
-
- $ret = $reg->updateChannel($channel, $lastmodified);
- if (PEAR::isError($ret)) {
- return $ret;
- }
-
- if (!$ret) {
- return $this->raiseError('Updating Channel "' . $channel->getName() .
- '" in registry failed');
- }
-
- $this->config->setChannels($reg->listChannels());
- $this->config->writeConfigFile();
- $this->ui->outputData('Update of Channel "' . $channel->getName() . '" succeeded');
- }
-
- function &getDownloader()
- {
- if (!class_exists('PEAR_Downloader')) {
- require_once 'PEAR/Downloader.php';
- }
- $a = new PEAR_Downloader($this->ui, array(), $this->config);
- return $a;
- }
-
- function doAlias($command, $options, $params)
- {
- if (count($params) === 1) {
- return $this->raiseError('No channel alias specified');
- }
-
- if (count($params) !== 2 || (!empty($params[1]) && $params[1]{0} == '-')) {
- return $this->raiseError(
- 'Invalid format, correct is: channel-alias channel alias');
- }
-
- $reg = &$this->config->getRegistry();
- if (!$reg->channelExists($params[0], true)) {
- $extra = '';
- if ($reg->isAlias($params[0])) {
- $extra = ' (use "channel-alias ' . $reg->channelName($params[0]) . ' ' .
- strtolower($params[1]) . '")';
- }
-
- return $this->raiseError('"' . $params[0] . '" is not a valid channel' . $extra);
- }
-
- if ($reg->isAlias($params[1])) {
- return $this->raiseError('Channel "' . $reg->channelName($params[1]) . '" is ' .
- 'already aliased to "' . strtolower($params[1]) . '", cannot re-alias');
- }
-
- $chan = &$reg->getChannel($params[0]);
- if (PEAR::isError($chan)) {
- return $this->raiseError('Corrupt registry? Error retrieving channel "' . $params[0] .
- '" information (' . $chan->getMessage() . ')');
- }
-
- // make it a local alias
- if (!$chan->setAlias(strtolower($params[1]), true)) {
- return $this->raiseError('Alias "' . strtolower($params[1]) .
- '" is not a valid channel alias');
- }
-
- $reg->updateChannel($chan);
- $this->ui->outputData('Channel "' . $chan->getName() . '" aliased successfully to "' .
- strtolower($params[1]) . '"');
- }
-
- /**
- * The channel-discover command
- *
- * @param string $command command name
- * @param array $options option_name => value
- * @param array $params list of additional parameters.
- * $params[0] should contain a string with either:
- * - <channel name> or
- * - <username>:<password>@<channel name>
- * @return null|PEAR_Error
- */
- function doDiscover($command, $options, $params)
- {
- if (count($params) !== 1) {
- return $this->raiseError("No channel server specified");
- }
-
- // Look for the possible input format "<username>:<password>@<channel>"
- if (preg_match('/^(.+):(.+)@(.+)\\z/', $params[0], $matches)) {
- $username = $matches[1];
- $password = $matches[2];
- $channel = $matches[3];
- } else {
- $channel = $params[0];
- }
-
- $reg = &$this->config->getRegistry();
- if ($reg->channelExists($channel)) {
- if (!$reg->isAlias($channel)) {
- return $this->raiseError("Channel \"$channel\" is already initialized", PEAR_COMMAND_CHANNELS_CHANNEL_EXISTS);
- }
-
- return $this->raiseError("A channel alias named \"$channel\" " .
- 'already exists, aliasing channel "' . $reg->channelName($channel)
- . '"');
- }
-
- $this->pushErrorHandling(PEAR_ERROR_RETURN);
- $err = $this->doAdd($command, $options, array('http://' . $channel . '/channel.xml'));
- $this->popErrorHandling();
- if (PEAR::isError($err)) {
- if ($err->getCode() === PEAR_COMMAND_CHANNELS_CHANNEL_EXISTS) {
- return $this->raiseError("Discovery of channel \"$channel\" failed (" .
- $err->getMessage() . ')');
- }
- // Attempt fetch via https
- $this->ui->outputData("Discovering channel $channel over http:// failed with message: " . $err->getMessage());
- $this->ui->outputData("Trying to discover channel $channel over https:// instead");
- $this->pushErrorHandling(PEAR_ERROR_RETURN);
- $err = $this->doAdd($command, $options, array('https://' . $channel . '/channel.xml'));
- $this->popErrorHandling();
- if (PEAR::isError($err)) {
- return $this->raiseError("Discovery of channel \"$channel\" failed (" .
- $err->getMessage() . ')');
- }
- }
-
- // Store username/password if they were given
- // Arguably we should do a logintest on the channel here, but since
- // that's awkward on a REST-based channel (even "pear login" doesn't
- // do it for those), and XML-RPC is deprecated, it's fairly pointless.
- if (isset($username)) {
- $this->config->set('username', $username, 'user', $channel);
- $this->config->set('password', $password, 'user', $channel);
- $this->config->store();
- $this->ui->outputData("Stored login for channel \"$channel\" using username \"$username\"", $command);
- }
-
- $this->ui->outputData("Discovery of channel \"$channel\" succeeded", $command);
- }
-
- /**
- * Execute the 'login' command.
- *
- * @param string $command command name
- * @param array $options option_name => value
- * @param array $params list of additional parameters
- *
- * @return bool TRUE on success or
- * a PEAR error on failure
- *
- * @access public
- */
- function doLogin($command, $options, $params)
- {
- $reg = &$this->config->getRegistry();
-
- // If a parameter is supplied, use that as the channel to log in to
- $channel = isset($params[0]) ? $params[0] : $this->config->get('default_channel');
-
- $chan = $reg->getChannel($channel);
- if (PEAR::isError($chan)) {
- return $this->raiseError($chan);
- }
-
- $server = $this->config->get('preferred_mirror', null, $channel);
- $username = $this->config->get('username', null, $channel);
- if (empty($username)) {
- $username = isset($_ENV['USER']) ? $_ENV['USER'] : null;
- }
- $this->ui->outputData("Logging in to $server.", $command);
-
- list($username, $password) = $this->ui->userDialog(
- $command,
- array('Username', 'Password'),
- array('text', 'password'),
- array($username, '')
- );
- $username = trim($username);
- $password = trim($password);
-
- $ourfile = $this->config->getConfFile('user');
- if (!$ourfile) {
- $ourfile = $this->config->getConfFile('system');
- }
-
- $this->config->set('username', $username, 'user', $channel);
- $this->config->set('password', $password, 'user', $channel);
-
- if ($chan->supportsREST()) {
- $ok = true;
- }
-
- if ($ok !== true) {
- return $this->raiseError('Login failed!');
- }
-
- $this->ui->outputData("Logged in.", $command);
- // avoid changing any temporary settings changed with -d
- $ourconfig = new PEAR_Config($ourfile, $ourfile);
- $ourconfig->set('username', $username, 'user', $channel);
- $ourconfig->set('password', $password, 'user', $channel);
- $ourconfig->store();
-
- return true;
- }
-
- /**
- * Execute the 'logout' command.
- *
- * @param string $command command name
- * @param array $options option_name => value
- * @param array $params list of additional parameters
- *
- * @return bool TRUE on success or
- * a PEAR error on failure
- *
- * @access public
- */
- function doLogout($command, $options, $params)
- {
- $reg = &$this->config->getRegistry();
-
- // If a parameter is supplied, use that as the channel to log in to
- $channel = isset($params[0]) ? $params[0] : $this->config->get('default_channel');
-
- $chan = $reg->getChannel($channel);
- if (PEAR::isError($chan)) {
- return $this->raiseError($chan);
- }
-
- $server = $this->config->get('preferred_mirror', null, $channel);
- $this->ui->outputData("Logging out from $server.", $command);
- $this->config->remove('username', 'user', $channel);
- $this->config->remove('password', 'user', $channel);
- $this->config->store();
- return true;
- }
-} \ No newline at end of file
diff --git a/3rdparty/PEAR/Command/Channels.xml b/3rdparty/PEAR/Command/Channels.xml
deleted file mode 100644
index 47b72066abf..00000000000
--- a/3rdparty/PEAR/Command/Channels.xml
+++ /dev/null
@@ -1,123 +0,0 @@
-<commands version="1.0">
- <list-channels>
- <summary>List Available Channels</summary>
- <function>doList</function>
- <shortcut>lc</shortcut>
- <options />
- <doc>
-List all available channels for installation.
-</doc>
- </list-channels>
- <update-channels>
- <summary>Update the Channel List</summary>
- <function>doUpdateAll</function>
- <shortcut>uc</shortcut>
- <options />
- <doc>
-List all installed packages in all channels.
-</doc>
- </update-channels>
- <channel-delete>
- <summary>Remove a Channel From the List</summary>
- <function>doDelete</function>
- <shortcut>cde</shortcut>
- <options />
- <doc>&lt;channel name&gt;
-Delete a channel from the registry. You may not
-remove any channel that has installed packages.
-</doc>
- </channel-delete>
- <channel-add>
- <summary>Add a Channel</summary>
- <function>doAdd</function>
- <shortcut>ca</shortcut>
- <options />
- <doc>&lt;channel.xml&gt;
-Add a private channel to the channel list. Note that all
-public channels should be synced using &quot;update-channels&quot;.
-Parameter may be either a local file or remote URL to a
-channel.xml.
-</doc>
- </channel-add>
- <channel-update>
- <summary>Update an Existing Channel</summary>
- <function>doUpdate</function>
- <shortcut>cu</shortcut>
- <options>
- <force>
- <shortopt>f</shortopt>
- <doc>will force download of new channel.xml if an existing channel name is used</doc>
- </force>
- <channel>
- <shortopt>c</shortopt>
- <doc>will force download of new channel.xml if an existing channel name is used</doc>
- <arg>CHANNEL</arg>
- </channel>
- </options>
- <doc>[&lt;channel.xml&gt;|&lt;channel name&gt;]
-Update a channel in the channel list directly. Note that all
-public channels can be synced using &quot;update-channels&quot;.
-Parameter may be a local or remote channel.xml, or the name of
-an existing channel.
-</doc>
- </channel-update>
- <channel-info>
- <summary>Retrieve Information on a Channel</summary>
- <function>doInfo</function>
- <shortcut>ci</shortcut>
- <options />
- <doc>&lt;package&gt;
-List the files in an installed package.
-</doc>
- </channel-info>
- <channel-alias>
- <summary>Specify an alias to a channel name</summary>
- <function>doAlias</function>
- <shortcut>cha</shortcut>
- <options />
- <doc>&lt;channel&gt; &lt;alias&gt;
-Specify a specific alias to use for a channel name.
-The alias may not be an existing channel name or
-alias.
-</doc>
- </channel-alias>
- <channel-discover>
- <summary>Initialize a Channel from its server</summary>
- <function>doDiscover</function>
- <shortcut>di</shortcut>
- <options />
- <doc>[&lt;channel.xml&gt;|&lt;channel name&gt;]
-Initialize a channel from its server and create a local channel.xml.
-If &lt;channel name&gt; is in the format &quot;&lt;username&gt;:&lt;password&gt;@&lt;channel&gt;&quot; then
-&lt;username&gt; and &lt;password&gt; will be set as the login username/password for
-&lt;channel&gt;. Use caution when passing the username/password in this way, as
-it may allow other users on your computer to briefly view your username/
-password via the system&#039;s process list.
-</doc>
- </channel-discover>
- <channel-login>
- <summary>Connects and authenticates to remote channel server</summary>
- <function>doLogin</function>
- <shortcut>cli</shortcut>
- <options />
- <doc>&lt;channel name&gt;
-Log in to a remote channel server. If &lt;channel name&gt; is not supplied,
-the default channel is used. To use remote functions in the installer
-that require any kind of privileges, you need to log in first. The
-username and password you enter here will be stored in your per-user
-PEAR configuration (~/.pearrc on Unix-like systems). After logging
-in, your username and password will be sent along in subsequent
-operations on the remote server.</doc>
- </channel-login>
- <channel-logout>
- <summary>Logs out from the remote channel server</summary>
- <function>doLogout</function>
- <shortcut>clo</shortcut>
- <options />
- <doc>&lt;channel name&gt;
-Logs out from a remote channel server. If &lt;channel name&gt; is not supplied,
-the default channel is used. This command does not actually connect to the
-remote server, it only deletes the stored username and password from your user
-configuration.</doc>
- </channel-logout>
-</commands> \ No newline at end of file
diff --git a/3rdparty/PEAR/Command/Common.php b/3rdparty/PEAR/Command/Common.php
deleted file mode 100644
index 279a716623d..00000000000
--- a/3rdparty/PEAR/Command/Common.php
+++ /dev/null
@@ -1,273 +0,0 @@
-<?php
-/**
- * PEAR_Command_Common base class
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Stig Bakken <ssb@php.net>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Common.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 0.1
- */
-
-/**
- * base class
- */
-require_once 'PEAR.php';
-
-/**
- * PEAR commands base class
- *
- * @category pear
- * @package PEAR
- * @author Stig Bakken <ssb@php.net>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 0.1
- */
-class PEAR_Command_Common extends PEAR
-{
- /**
- * PEAR_Config object used to pass user system and configuration
- * on when executing commands
- *
- * @var PEAR_Config
- */
- var $config;
- /**
- * @var PEAR_Registry
- * @access protected
- */
- var $_registry;
-
- /**
- * User Interface object, for all interaction with the user.
- * @var object
- */
- var $ui;
-
- var $_deps_rel_trans = array(
- 'lt' => '<',
- 'le' => '<=',
- 'eq' => '=',
- 'ne' => '!=',
- 'gt' => '>',
- 'ge' => '>=',
- 'has' => '=='
- );
-
- var $_deps_type_trans = array(
- 'pkg' => 'package',
- 'ext' => 'extension',
- 'php' => 'PHP',
- 'prog' => 'external program',
- 'ldlib' => 'external library for linking',
- 'rtlib' => 'external runtime library',
- 'os' => 'operating system',
- 'websrv' => 'web server',
- 'sapi' => 'SAPI backend'
- );
-
- /**
- * PEAR_Command_Common constructor.
- *
- * @access public
- */
- function PEAR_Command_Common(&$ui, &$config)
- {
- parent::PEAR();
- $this->config = &$config;
- $this->ui = &$ui;
- }
-
- /**
- * Return a list of all the commands defined by this class.
- * @return array list of commands
- * @access public
- */
- function getCommands()
- {
- $ret = array();
- foreach (array_keys($this->commands) as $command) {
- $ret[$command] = $this->commands[$command]['summary'];
- }
-
- return $ret;
- }
-
- /**
- * Return a list of all the command shortcuts defined by this class.
- * @return array shortcut => command
- * @access public
- */
- function getShortcuts()
- {
- $ret = array();
- foreach (array_keys($this->commands) as $command) {
- if (isset($this->commands[$command]['shortcut'])) {
- $ret[$this->commands[$command]['shortcut']] = $command;
- }
- }
-
- return $ret;
- }
-
- function getOptions($command)
- {
- $shortcuts = $this->getShortcuts();
- if (isset($shortcuts[$command])) {
- $command = $shortcuts[$command];
- }
-
- if (isset($this->commands[$command]) &&
- isset($this->commands[$command]['options'])) {
- return $this->commands[$command]['options'];
- }
-
- return null;
- }
-
- function getGetoptArgs($command, &$short_args, &$long_args)
- {
- $short_args = '';
- $long_args = array();
- if (empty($this->commands[$command]) || empty($this->commands[$command]['options'])) {
- return;
- }
-
- reset($this->commands[$command]['options']);
- while (list($option, $info) = each($this->commands[$command]['options'])) {
- $larg = $sarg = '';
- if (isset($info['arg'])) {
- if ($info['arg']{0} == '(') {
- $larg = '==';
- $sarg = '::';
- $arg = substr($info['arg'], 1, -1);
- } else {
- $larg = '=';
- $sarg = ':';
- $arg = $info['arg'];
- }
- }
-
- if (isset($info['shortopt'])) {
- $short_args .= $info['shortopt'] . $sarg;
- }
-
- $long_args[] = $option . $larg;
- }
- }
-
- /**
- * Returns the help message for the given command
- *
- * @param string $command The command
- * @return mixed A fail string if the command does not have help or
- * a two elements array containing [0]=>help string,
- * [1]=> help string for the accepted cmd args
- */
- function getHelp($command)
- {
- $config = &PEAR_Config::singleton();
- if (!isset($this->commands[$command])) {
- return "No such command \"$command\"";
- }
-
- $help = null;
- if (isset($this->commands[$command]['doc'])) {
- $help = $this->commands[$command]['doc'];
- }
-
- if (empty($help)) {
- // XXX (cox) Fallback to summary if there is no doc (show both?)
- if (!isset($this->commands[$command]['summary'])) {
- return "No help for command \"$command\"";
- }
- $help = $this->commands[$command]['summary'];
- }
-
- if (preg_match_all('/{config\s+([^\}]+)}/e', $help, $matches)) {
- foreach($matches[0] as $k => $v) {
- $help = preg_replace("/$v/", $config->get($matches[1][$k]), $help);
- }
- }
-
- return array($help, $this->getHelpArgs($command));
- }
-
- /**
- * Returns the help for the accepted arguments of a command
- *
- * @param string $command
- * @return string The help string
- */
- function getHelpArgs($command)
- {
- if (isset($this->commands[$command]['options']) &&
- count($this->commands[$command]['options']))
- {
- $help = "Options:\n";
- foreach ($this->commands[$command]['options'] as $k => $v) {
- if (isset($v['arg'])) {
- if ($v['arg'][0] == '(') {
- $arg = substr($v['arg'], 1, -1);
- $sapp = " [$arg]";
- $lapp = "[=$arg]";
- } else {
- $sapp = " $v[arg]";
- $lapp = "=$v[arg]";
- }
- } else {
- $sapp = $lapp = "";
- }
-
- if (isset($v['shortopt'])) {
- $s = $v['shortopt'];
- $help .= " -$s$sapp, --$k$lapp\n";
- } else {
- $help .= " --$k$lapp\n";
- }
-
- $p = " ";
- $doc = rtrim(str_replace("\n", "\n$p", $v['doc']));
- $help .= " $doc\n";
- }
-
- return $help;
- }
-
- return null;
- }
-
- function run($command, $options, $params)
- {
- if (empty($this->commands[$command]['function'])) {
- // look for shortcuts
- foreach (array_keys($this->commands) as $cmd) {
- if (isset($this->commands[$cmd]['shortcut']) && $this->commands[$cmd]['shortcut'] == $command) {
- if (empty($this->commands[$cmd]['function'])) {
- return $this->raiseError("unknown command `$command'");
- } else {
- $func = $this->commands[$cmd]['function'];
- }
- $command = $cmd;
-
- //$command = $this->commands[$cmd]['function'];
- break;
- }
- }
- } else {
- $func = $this->commands[$command]['function'];
- }
-
- return $this->$func($command, $options, $params);
- }
-} \ No newline at end of file
diff --git a/3rdparty/PEAR/Command/Config.php b/3rdparty/PEAR/Command/Config.php
deleted file mode 100644
index a761b277f5f..00000000000
--- a/3rdparty/PEAR/Command/Config.php
+++ /dev/null
@@ -1,414 +0,0 @@
-<?php
-/**
- * PEAR_Command_Config (config-show, config-get, config-set, config-help, config-create commands)
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Stig Bakken <ssb@php.net>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Config.php 313024 2011-07-06 19:51:24Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 0.1
- */
-
-/**
- * base class
- */
-require_once 'PEAR/Command/Common.php';
-
-/**
- * PEAR commands for managing configuration data.
- *
- * @category pear
- * @package PEAR
- * @author Stig Bakken <ssb@php.net>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 0.1
- */
-class PEAR_Command_Config extends PEAR_Command_Common
-{
- var $commands = array(
- 'config-show' => array(
- 'summary' => 'Show All Settings',
- 'function' => 'doConfigShow',
- 'shortcut' => 'csh',
- 'options' => array(
- 'channel' => array(
- 'shortopt' => 'c',
- 'doc' => 'show configuration variables for another channel',
- 'arg' => 'CHAN',
- ),
-),
- 'doc' => '[layer]
-Displays all configuration values. An optional argument
-may be used to tell which configuration layer to display. Valid
-configuration layers are "user", "system" and "default". To display
-configurations for different channels, set the default_channel
-configuration variable and run config-show again.
-',
- ),
- 'config-get' => array(
- 'summary' => 'Show One Setting',
- 'function' => 'doConfigGet',
- 'shortcut' => 'cg',
- 'options' => array(
- 'channel' => array(
- 'shortopt' => 'c',
- 'doc' => 'show configuration variables for another channel',
- 'arg' => 'CHAN',
- ),
-),
- 'doc' => '<parameter> [layer]
-Displays the value of one configuration parameter. The
-first argument is the name of the parameter, an optional second argument
-may be used to tell which configuration layer to look in. Valid configuration
-layers are "user", "system" and "default". If no layer is specified, a value
-will be picked from the first layer that defines the parameter, in the order
-just specified. The configuration value will be retrieved for the channel
-specified by the default_channel configuration variable.
-',
- ),
- 'config-set' => array(
- 'summary' => 'Change Setting',
- 'function' => 'doConfigSet',
- 'shortcut' => 'cs',
- 'options' => array(
- 'channel' => array(
- 'shortopt' => 'c',
- 'doc' => 'show configuration variables for another channel',
- 'arg' => 'CHAN',
- ),
-),
- 'doc' => '<parameter> <value> [layer]
-Sets the value of one configuration parameter. The first argument is
-the name of the parameter, the second argument is the new value. Some
-parameters are subject to validation, and the command will fail with
-an error message if the new value does not make sense. An optional
-third argument may be used to specify in which layer to set the
-configuration parameter. The default layer is "user". The
-configuration value will be set for the current channel, which
-is controlled by the default_channel configuration variable.
-',
- ),
- 'config-help' => array(
- 'summary' => 'Show Information About Setting',
- 'function' => 'doConfigHelp',
- 'shortcut' => 'ch',
- 'options' => array(),
- 'doc' => '[parameter]
-Displays help for a configuration parameter. Without arguments it
-displays help for all configuration parameters.
-',
- ),
- 'config-create' => array(
- 'summary' => 'Create a Default configuration file',
- 'function' => 'doConfigCreate',
- 'shortcut' => 'coc',
- 'options' => array(
- 'windows' => array(
- 'shortopt' => 'w',
- 'doc' => 'create a config file for a windows install',
- ),
- ),
- 'doc' => '<root path> <filename>
-Create a default configuration file with all directory configuration
-variables set to subdirectories of <root path>, and save it as <filename>.
-This is useful especially for creating a configuration file for a remote
-PEAR installation (using the --remoteconfig option of install, upgrade,
-and uninstall).
-',
- ),
- );
-
- /**
- * PEAR_Command_Config constructor.
- *
- * @access public
- */
- function PEAR_Command_Config(&$ui, &$config)
- {
- parent::PEAR_Command_Common($ui, $config);
- }
-
- function doConfigShow($command, $options, $params)
- {
- $layer = null;
- if (is_array($params)) {
- $layer = isset($params[0]) ? $params[0] : null;
- }
-
- // $params[0] -> the layer
- if ($error = $this->_checkLayer($layer)) {
- return $this->raiseError("config-show:$error");
- }
-
- $keys = $this->config->getKeys();
- sort($keys);
- $channel = isset($options['channel']) ? $options['channel'] :
- $this->config->get('default_channel');
- $reg = &$this->config->getRegistry();
- if (!$reg->channelExists($channel)) {
- return $this->raiseError('Channel "' . $channel . '" does not exist');
- }
-
- $channel = $reg->channelName($channel);
- $data = array('caption' => 'Configuration (channel ' . $channel . '):');
- foreach ($keys as $key) {
- $type = $this->config->getType($key);
- $value = $this->config->get($key, $layer, $channel);
- if ($type == 'password' && $value) {
- $value = '********';
- }
-
- if ($value === false) {
- $value = 'false';
- } elseif ($value === true) {
- $value = 'true';
- }
-
- $data['data'][$this->config->getGroup($key)][] = array($this->config->getPrompt($key) , $key, $value);
- }
-
- foreach ($this->config->getLayers() as $layer) {
- $data['data']['Config Files'][] = array(ucfirst($layer) . ' Configuration File', 'Filename' , $this->config->getConfFile($layer));
- }
-
- $this->ui->outputData($data, $command);
- return true;
- }
-
- function doConfigGet($command, $options, $params)
- {
- $args_cnt = is_array($params) ? count($params) : 0;
- switch ($args_cnt) {
- case 1:
- $config_key = $params[0];
- $layer = null;
- break;
- case 2:
- $config_key = $params[0];
- $layer = $params[1];
- if ($error = $this->_checkLayer($layer)) {
- return $this->raiseError("config-get:$error");
- }
- break;
- case 0:
- default:
- return $this->raiseError("config-get expects 1 or 2 parameters");
- }
-
- $reg = &$this->config->getRegistry();
- $channel = isset($options['channel']) ? $options['channel'] : $this->config->get('default_channel');
- if (!$reg->channelExists($channel)) {
- return $this->raiseError('Channel "' . $channel . '" does not exist');
- }
-
- $channel = $reg->channelName($channel);
- $this->ui->outputData($this->config->get($config_key, $layer, $channel), $command);
- return true;
- }
-
- function doConfigSet($command, $options, $params)
- {
- // $param[0] -> a parameter to set
- // $param[1] -> the value for the parameter
- // $param[2] -> the layer
- $failmsg = '';
- if (count($params) < 2 || count($params) > 3) {
- $failmsg .= "config-set expects 2 or 3 parameters";
- return PEAR::raiseError($failmsg);
- }
-
- if (isset($params[2]) && ($error = $this->_checkLayer($params[2]))) {
- $failmsg .= $error;
- return PEAR::raiseError("config-set:$failmsg");
- }
-
- $channel = isset($options['channel']) ? $options['channel'] : $this->config->get('default_channel');
- $reg = &$this->config->getRegistry();
- if (!$reg->channelExists($channel)) {
- return $this->raiseError('Channel "' . $channel . '" does not exist');
- }
-
- $channel = $reg->channelName($channel);
- if ($params[0] == 'default_channel' && !$reg->channelExists($params[1])) {
- return $this->raiseError('Channel "' . $params[1] . '" does not exist');
- }
-
- if ($params[0] == 'preferred_mirror'
- && (
- !$reg->mirrorExists($channel, $params[1]) &&
- (!$reg->channelExists($params[1]) || $channel != $params[1])
- )
- ) {
- $msg = 'Channel Mirror "' . $params[1] . '" does not exist';
- $msg .= ' in your registry for channel "' . $channel . '".';
- $msg .= "\n" . 'Attempt to run "pear channel-update ' . $channel .'"';
- $msg .= ' if you believe this mirror should exist as you may';
- $msg .= ' have outdated channel information.';
- return $this->raiseError($msg);
- }
-
- if (count($params) == 2) {
- array_push($params, 'user');
- $layer = 'user';
- } else {
- $layer = $params[2];
- }
-
- array_push($params, $channel);
- if (!call_user_func_array(array(&$this->config, 'set'), $params)) {
- array_pop($params);
- $failmsg = "config-set (" . implode(", ", $params) . ") failed, channel $channel";
- } else {
- $this->config->store($layer);
- }
-
- if ($failmsg) {
- return $this->raiseError($failmsg);
- }
-
- $this->ui->outputData('config-set succeeded', $command);
- return true;
- }
-
- function doConfigHelp($command, $options, $params)
- {
- if (empty($params)) {
- $params = $this->config->getKeys();
- }
-
- $data['caption'] = "Config help" . ((count($params) == 1) ? " for $params[0]" : '');
- $data['headline'] = array('Name', 'Type', 'Description');
- $data['border'] = true;
- foreach ($params as $name) {
- $type = $this->config->getType($name);
- $docs = $this->config->getDocs($name);
- if ($type == 'set') {
- $docs = rtrim($docs) . "\nValid set: " .
- implode(' ', $this->config->getSetValues($name));
- }
-
- $data['data'][] = array($name, $type, $docs);
- }
-
- $this->ui->outputData($data, $command);
- }
-
- function doConfigCreate($command, $options, $params)
- {
- if (count($params) != 2) {
- return PEAR::raiseError('config-create: must have 2 parameters, root path and ' .
- 'filename to save as');
- }
-
- $root = $params[0];
- // Clean up the DIRECTORY_SEPARATOR mess
- $ds2 = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR;
- $root = preg_replace(array('!\\\\+!', '!/+!', "!$ds2+!"),
- array('/', '/', '/'),
- $root);
- if ($root{0} != '/') {
- if (!isset($options['windows'])) {
- return PEAR::raiseError('Root directory must be an absolute path beginning ' .
- 'with "/", was: "' . $root . '"');
- }
-
- if (!preg_match('/^[A-Za-z]:/', $root)) {
- return PEAR::raiseError('Root directory must be an absolute path beginning ' .
- 'with "\\" or "C:\\", was: "' . $root . '"');
- }
- }
-
- $windows = isset($options['windows']);
- if ($windows) {
- $root = str_replace('/', '\\', $root);
- }
-
- if (!file_exists($params[1]) && !@touch($params[1])) {
- return PEAR::raiseError('Could not create "' . $params[1] . '"');
- }
-
- $params[1] = realpath($params[1]);
- $config = &new PEAR_Config($params[1], '#no#system#config#', false, false);
- if ($root{strlen($root) - 1} == '/') {
- $root = substr($root, 0, strlen($root) - 1);
- }
-
- $config->noRegistry();
- $config->set('php_dir', $windows ? "$root\\pear\\php" : "$root/pear/php", 'user');
- $config->set('data_dir', $windows ? "$root\\pear\\data" : "$root/pear/data");
- $config->set('www_dir', $windows ? "$root\\pear\\www" : "$root/pear/www");
- $config->set('cfg_dir', $windows ? "$root\\pear\\cfg" : "$root/pear/cfg");
- $config->set('ext_dir', $windows ? "$root\\pear\\ext" : "$root/pear/ext");
- $config->set('doc_dir', $windows ? "$root\\pear\\docs" : "$root/pear/docs");
- $config->set('test_dir', $windows ? "$root\\pear\\tests" : "$root/pear/tests");
- $config->set('cache_dir', $windows ? "$root\\pear\\cache" : "$root/pear/cache");
- $config->set('download_dir', $windows ? "$root\\pear\\download" : "$root/pear/download");
- $config->set('temp_dir', $windows ? "$root\\pear\\temp" : "$root/pear/temp");
- $config->set('bin_dir', $windows ? "$root\\pear" : "$root/pear");
- $config->writeConfigFile();
- $this->_showConfig($config);
- $this->ui->outputData('Successfully created default configuration file "' . $params[1] . '"',
- $command);
- }
-
- function _showConfig(&$config)
- {
- $params = array('user');
- $keys = $config->getKeys();
- sort($keys);
- $channel = 'pear.php.net';
- $data = array('caption' => 'Configuration (channel ' . $channel . '):');
- foreach ($keys as $key) {
- $type = $config->getType($key);
- $value = $config->get($key, 'user', $channel);
- if ($type == 'password' && $value) {
- $value = '********';
- }
-
- if ($value === false) {
- $value = 'false';
- } elseif ($value === true) {
- $value = 'true';
- }
- $data['data'][$config->getGroup($key)][] =
- array($config->getPrompt($key) , $key, $value);
- }
-
- foreach ($config->getLayers() as $layer) {
- $data['data']['Config Files'][] =
- array(ucfirst($layer) . ' Configuration File', 'Filename' ,
- $config->getConfFile($layer));
- }
-
- $this->ui->outputData($data, 'config-show');
- return true;
- }
-
- /**
- * Checks if a layer is defined or not
- *
- * @param string $layer The layer to search for
- * @return mixed False on no error or the error message
- */
- function _checkLayer($layer = null)
- {
- if (!empty($layer) && $layer != 'default') {
- $layers = $this->config->getLayers();
- if (!in_array($layer, $layers)) {
- return " only the layers: \"" . implode('" or "', $layers) . "\" are supported";
- }
- }
-
- return false;
- }
-} \ No newline at end of file
diff --git a/3rdparty/PEAR/Command/Config.xml b/3rdparty/PEAR/Command/Config.xml
deleted file mode 100644
index f64a925f52c..00000000000
--- a/3rdparty/PEAR/Command/Config.xml
+++ /dev/null
@@ -1,92 +0,0 @@
-<commands version="1.0">
- <config-show>
- <summary>Show All Settings</summary>
- <function>doConfigShow</function>
- <shortcut>csh</shortcut>
- <options>
- <channel>
- <shortopt>c</shortopt>
- <doc>show configuration variables for another channel</doc>
- <arg>CHAN</arg>
- </channel>
- </options>
- <doc>[layer]
-Displays all configuration values. An optional argument
-may be used to tell which configuration layer to display. Valid
-configuration layers are &quot;user&quot;, &quot;system&quot; and &quot;default&quot;. To display
-configurations for different channels, set the default_channel
-configuration variable and run config-show again.
-</doc>
- </config-show>
- <config-get>
- <summary>Show One Setting</summary>
- <function>doConfigGet</function>
- <shortcut>cg</shortcut>
- <options>
- <channel>
- <shortopt>c</shortopt>
- <doc>show configuration variables for another channel</doc>
- <arg>CHAN</arg>
- </channel>
- </options>
- <doc>&lt;parameter&gt; [layer]
-Displays the value of one configuration parameter. The
-first argument is the name of the parameter, an optional second argument
-may be used to tell which configuration layer to look in. Valid configuration
-layers are &quot;user&quot;, &quot;system&quot; and &quot;default&quot;. If no layer is specified, a value
-will be picked from the first layer that defines the parameter, in the order
-just specified. The configuration value will be retrieved for the channel
-specified by the default_channel configuration variable.
-</doc>
- </config-get>
- <config-set>
- <summary>Change Setting</summary>
- <function>doConfigSet</function>
- <shortcut>cs</shortcut>
- <options>
- <channel>
- <shortopt>c</shortopt>
- <doc>show configuration variables for another channel</doc>
- <arg>CHAN</arg>
- </channel>
- </options>
- <doc>&lt;parameter&gt; &lt;value&gt; [layer]
-Sets the value of one configuration parameter. The first argument is
-the name of the parameter, the second argument is the new value. Some
-parameters are subject to validation, and the command will fail with
-an error message if the new value does not make sense. An optional
-third argument may be used to specify in which layer to set the
-configuration parameter. The default layer is &quot;user&quot;. The
-configuration value will be set for the current channel, which
-is controlled by the default_channel configuration variable.
-</doc>
- </config-set>
- <config-help>
- <summary>Show Information About Setting</summary>
- <function>doConfigHelp</function>
- <shortcut>ch</shortcut>
- <options />
- <doc>[parameter]
-Displays help for a configuration parameter. Without arguments it
-displays help for all configuration parameters.
-</doc>
- </config-help>
- <config-create>
- <summary>Create a Default configuration file</summary>
- <function>doConfigCreate</function>
- <shortcut>coc</shortcut>
- <options>
- <windows>
- <shortopt>w</shortopt>
- <doc>create a config file for a windows install</doc>
- </windows>
- </options>
- <doc>&lt;root path&gt; &lt;filename&gt;
-Create a default configuration file with all directory configuration
-variables set to subdirectories of &lt;root path&gt;, and save it as &lt;filename&gt;.
-This is useful especially for creating a configuration file for a remote
-PEAR installation (using the --remoteconfig option of install, upgrade,
-and uninstall).
-</doc>
- </config-create>
-</commands> \ No newline at end of file
diff --git a/3rdparty/PEAR/Command/Install.php b/3rdparty/PEAR/Command/Install.php
deleted file mode 100644
index c035f6d20de..00000000000
--- a/3rdparty/PEAR/Command/Install.php
+++ /dev/null
@@ -1,1268 +0,0 @@
-<?php
-/**
- * PEAR_Command_Install (install, upgrade, upgrade-all, uninstall, bundle, run-scripts commands)
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Stig Bakken <ssb@php.net>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Install.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 0.1
- */
-
-/**
- * base class
- */
-require_once 'PEAR/Command/Common.php';
-
-/**
- * PEAR commands for installation or deinstallation/upgrading of
- * packages.
- *
- * @category pear
- * @package PEAR
- * @author Stig Bakken <ssb@php.net>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 0.1
- */
-class PEAR_Command_Install extends PEAR_Command_Common
-{
- // {{{ properties
-
- var $commands = array(
- 'install' => array(
- 'summary' => 'Install Package',
- 'function' => 'doInstall',
- 'shortcut' => 'i',
- 'options' => array(
- 'force' => array(
- 'shortopt' => 'f',
- 'doc' => 'will overwrite newer installed packages',
- ),
- 'loose' => array(
- 'shortopt' => 'l',
- 'doc' => 'do not check for recommended dependency version',
- ),
- 'nodeps' => array(
- 'shortopt' => 'n',
- 'doc' => 'ignore dependencies, install anyway',
- ),
- 'register-only' => array(
- 'shortopt' => 'r',
- 'doc' => 'do not install files, only register the package as installed',
- ),
- 'soft' => array(
- 'shortopt' => 's',
- 'doc' => 'soft install, fail silently, or upgrade if already installed',
- ),
- 'nobuild' => array(
- 'shortopt' => 'B',
- 'doc' => 'don\'t build C extensions',
- ),
- 'nocompress' => array(
- 'shortopt' => 'Z',
- 'doc' => 'request uncompressed files when downloading',
- ),
- 'installroot' => array(
- 'shortopt' => 'R',
- 'arg' => 'DIR',
- 'doc' => 'root directory used when installing files (ala PHP\'s INSTALL_ROOT), use packagingroot for RPM',
- ),
- 'packagingroot' => array(
- 'shortopt' => 'P',
- 'arg' => 'DIR',
- 'doc' => 'root directory used when packaging files, like RPM packaging',
- ),
- 'ignore-errors' => array(
- 'doc' => 'force install even if there were errors',
- ),
- 'alldeps' => array(
- 'shortopt' => 'a',
- 'doc' => 'install all required and optional dependencies',
- ),
- 'onlyreqdeps' => array(
- 'shortopt' => 'o',
- 'doc' => 'install all required dependencies',
- ),
- 'offline' => array(
- 'shortopt' => 'O',
- 'doc' => 'do not attempt to download any urls or contact channels',
- ),
- 'pretend' => array(
- 'shortopt' => 'p',
- 'doc' => 'Only list the packages that would be downloaded',
- ),
- ),
- 'doc' => '[channel/]<package> ...
-Installs one or more PEAR packages. You can specify a package to
-install in four ways:
-
-"Package-1.0.tgz" : installs from a local file
-
-"http://example.com/Package-1.0.tgz" : installs from
-anywhere on the net.
-
-"package.xml" : installs the package described in
-package.xml. Useful for testing, or for wrapping a PEAR package in
-another package manager such as RPM.
-
-"Package[-version/state][.tar]" : queries your default channel\'s server
-({config master_server}) and downloads the newest package with
-the preferred quality/state ({config preferred_state}).
-
-To retrieve Package version 1.1, use "Package-1.1," to retrieve
-Package state beta, use "Package-beta." To retrieve an uncompressed
-file, append .tar (make sure there is no file by the same name first)
-
-To download a package from another channel, prefix with the channel name like
-"channel/Package"
-
-More than one package may be specified at once. It is ok to mix these
-four ways of specifying packages.
-'),
- 'upgrade' => array(
- 'summary' => 'Upgrade Package',
- 'function' => 'doInstall',
- 'shortcut' => 'up',
- 'options' => array(
- 'channel' => array(
- 'shortopt' => 'c',
- 'doc' => 'upgrade packages from a specific channel',
- 'arg' => 'CHAN',
- ),
- 'force' => array(
- 'shortopt' => 'f',
- 'doc' => 'overwrite newer installed packages',
- ),
- 'loose' => array(
- 'shortopt' => 'l',
- 'doc' => 'do not check for recommended dependency version',
- ),
- 'nodeps' => array(
- 'shortopt' => 'n',
- 'doc' => 'ignore dependencies, upgrade anyway',
- ),
- 'register-only' => array(
- 'shortopt' => 'r',
- 'doc' => 'do not install files, only register the package as upgraded',
- ),
- 'nobuild' => array(
- 'shortopt' => 'B',
- 'doc' => 'don\'t build C extensions',
- ),
- 'nocompress' => array(
- 'shortopt' => 'Z',
- 'doc' => 'request uncompressed files when downloading',
- ),
- 'installroot' => array(
- 'shortopt' => 'R',
- 'arg' => 'DIR',
- 'doc' => 'root directory used when installing files (ala PHP\'s INSTALL_ROOT)',
- ),
- 'ignore-errors' => array(
- 'doc' => 'force install even if there were errors',
- ),
- 'alldeps' => array(
- 'shortopt' => 'a',
- 'doc' => 'install all required and optional dependencies',
- ),
- 'onlyreqdeps' => array(
- 'shortopt' => 'o',
- 'doc' => 'install all required dependencies',
- ),
- 'offline' => array(
- 'shortopt' => 'O',
- 'doc' => 'do not attempt to download any urls or contact channels',
- ),
- 'pretend' => array(
- 'shortopt' => 'p',
- 'doc' => 'Only list the packages that would be downloaded',
- ),
- ),
- 'doc' => '<package> ...
-Upgrades one or more PEAR packages. See documentation for the
-"install" command for ways to specify a package.
-
-When upgrading, your package will be updated if the provided new
-package has a higher version number (use the -f option if you need to
-upgrade anyway).
-
-More than one package may be specified at once.
-'),
- 'upgrade-all' => array(
- 'summary' => 'Upgrade All Packages [Deprecated in favor of calling upgrade with no parameters]',
- 'function' => 'doUpgradeAll',
- 'shortcut' => 'ua',
- 'options' => array(
- 'channel' => array(
- 'shortopt' => 'c',
- 'doc' => 'upgrade packages from a specific channel',
- 'arg' => 'CHAN',
- ),
- 'nodeps' => array(
- 'shortopt' => 'n',
- 'doc' => 'ignore dependencies, upgrade anyway',
- ),
- 'register-only' => array(
- 'shortopt' => 'r',
- 'doc' => 'do not install files, only register the package as upgraded',
- ),
- 'nobuild' => array(
- 'shortopt' => 'B',
- 'doc' => 'don\'t build C extensions',
- ),
- 'nocompress' => array(
- 'shortopt' => 'Z',
- 'doc' => 'request uncompressed files when downloading',
- ),
- 'installroot' => array(
- 'shortopt' => 'R',
- 'arg' => 'DIR',
- 'doc' => 'root directory used when installing files (ala PHP\'s INSTALL_ROOT), use packagingroot for RPM',
- ),
- 'ignore-errors' => array(
- 'doc' => 'force install even if there were errors',
- ),
- 'loose' => array(
- 'doc' => 'do not check for recommended dependency version',
- ),
- ),
- 'doc' => '
-WARNING: This function is deprecated in favor of using the upgrade command with no params
-
-Upgrades all packages that have a newer release available. Upgrades are
-done only if there is a release available of the state specified in
-"preferred_state" (currently {config preferred_state}), or a state considered
-more stable.
-'),
- 'uninstall' => array(
- 'summary' => 'Un-install Package',
- 'function' => 'doUninstall',
- 'shortcut' => 'un',
- 'options' => array(
- 'nodeps' => array(
- 'shortopt' => 'n',
- 'doc' => 'ignore dependencies, uninstall anyway',
- ),
- 'register-only' => array(
- 'shortopt' => 'r',
- 'doc' => 'do not remove files, only register the packages as not installed',
- ),
- 'installroot' => array(
- 'shortopt' => 'R',
- 'arg' => 'DIR',
- 'doc' => 'root directory used when installing files (ala PHP\'s INSTALL_ROOT)',
- ),
- 'ignore-errors' => array(
- 'doc' => 'force install even if there were errors',
- ),
- 'offline' => array(
- 'shortopt' => 'O',
- 'doc' => 'do not attempt to uninstall remotely',
- ),
- ),
- 'doc' => '[channel/]<package> ...
-Uninstalls one or more PEAR packages. More than one package may be
-specified at once. Prefix with channel name to uninstall from a
-channel not in your default channel ({config default_channel})
-'),
- 'bundle' => array(
- 'summary' => 'Unpacks a Pecl Package',
- 'function' => 'doBundle',
- 'shortcut' => 'bun',
- 'options' => array(
- 'destination' => array(
- 'shortopt' => 'd',
- 'arg' => 'DIR',
- 'doc' => 'Optional destination directory for unpacking (defaults to current path or "ext" if exists)',
- ),
- 'force' => array(
- 'shortopt' => 'f',
- 'doc' => 'Force the unpacking even if there were errors in the package',
- ),
- ),
- 'doc' => '<package>
-Unpacks a Pecl Package into the selected location. It will download the
-package if needed.
-'),
- 'run-scripts' => array(
- 'summary' => 'Run Post-Install Scripts bundled with a package',
- 'function' => 'doRunScripts',
- 'shortcut' => 'rs',
- 'options' => array(
- ),
- 'doc' => '<package>
-Run post-installation scripts in package <package>, if any exist.
-'),
- );
-
- // }}}
- // {{{ constructor
-
- /**
- * PEAR_Command_Install constructor.
- *
- * @access public
- */
- function PEAR_Command_Install(&$ui, &$config)
- {
- parent::PEAR_Command_Common($ui, $config);
- }
-
- // }}}
-
- /**
- * For unit testing purposes
- */
- function &getDownloader(&$ui, $options, &$config)
- {
- if (!class_exists('PEAR_Downloader')) {
- require_once 'PEAR/Downloader.php';
- }
- $a = &new PEAR_Downloader($ui, $options, $config);
- return $a;
- }
-
- /**
- * For unit testing purposes
- */
- function &getInstaller(&$ui)
- {
- if (!class_exists('PEAR_Installer')) {
- require_once 'PEAR/Installer.php';
- }
- $a = &new PEAR_Installer($ui);
- return $a;
- }
-
- function enableExtension($binaries, $type)
- {
- if (!($phpini = $this->config->get('php_ini', null, 'pear.php.net'))) {
- return PEAR::raiseError('configuration option "php_ini" is not set to php.ini location');
- }
- $ini = $this->_parseIni($phpini);
- if (PEAR::isError($ini)) {
- return $ini;
- }
- $line = 0;
- if ($type == 'extsrc' || $type == 'extbin') {
- $search = 'extensions';
- $enable = 'extension';
- } else {
- $search = 'zend_extensions';
- ob_start();
- phpinfo(INFO_GENERAL);
- $info = ob_get_contents();
- ob_end_clean();
- $debug = function_exists('leak') ? '_debug' : '';
- $ts = preg_match('/Thread Safety.+enabled/', $info) ? '_ts' : '';
- $enable = 'zend_extension' . $debug . $ts;
- }
- foreach ($ini[$search] as $line => $extension) {
- if (in_array($extension, $binaries, true) || in_array(
- $ini['extension_dir'] . DIRECTORY_SEPARATOR . $extension, $binaries, true)) {
- // already enabled - assume if one is, all are
- return true;
- }
- }
- if ($line) {
- $newini = array_slice($ini['all'], 0, $line);
- } else {
- $newini = array();
- }
- foreach ($binaries as $binary) {
- if ($ini['extension_dir']) {
- $binary = basename($binary);
- }
- $newini[] = $enable . '="' . $binary . '"' . (OS_UNIX ? "\n" : "\r\n");
- }
- $newini = array_merge($newini, array_slice($ini['all'], $line));
- $fp = @fopen($phpini, 'wb');
- if (!$fp) {
- return PEAR::raiseError('cannot open php.ini "' . $phpini . '" for writing');
- }
- foreach ($newini as $line) {
- fwrite($fp, $line);
- }
- fclose($fp);
- return true;
- }
-
- function disableExtension($binaries, $type)
- {
- if (!($phpini = $this->config->get('php_ini', null, 'pear.php.net'))) {
- return PEAR::raiseError('configuration option "php_ini" is not set to php.ini location');
- }
- $ini = $this->_parseIni($phpini);
- if (PEAR::isError($ini)) {
- return $ini;
- }
- $line = 0;
- if ($type == 'extsrc' || $type == 'extbin') {
- $search = 'extensions';
- $enable = 'extension';
- } else {
- $search = 'zend_extensions';
- ob_start();
- phpinfo(INFO_GENERAL);
- $info = ob_get_contents();
- ob_end_clean();
- $debug = function_exists('leak') ? '_debug' : '';
- $ts = preg_match('/Thread Safety.+enabled/', $info) ? '_ts' : '';
- $enable = 'zend_extension' . $debug . $ts;
- }
- $found = false;
- foreach ($ini[$search] as $line => $extension) {
- if (in_array($extension, $binaries, true) || in_array(
- $ini['extension_dir'] . DIRECTORY_SEPARATOR . $extension, $binaries, true)) {
- $found = true;
- break;
- }
- }
- if (!$found) {
- // not enabled
- return true;
- }
- $fp = @fopen($phpini, 'wb');
- if (!$fp) {
- return PEAR::raiseError('cannot open php.ini "' . $phpini . '" for writing');
- }
- if ($line) {
- $newini = array_slice($ini['all'], 0, $line);
- // delete the enable line
- $newini = array_merge($newini, array_slice($ini['all'], $line + 1));
- } else {
- $newini = array_slice($ini['all'], 1);
- }
- foreach ($newini as $line) {
- fwrite($fp, $line);
- }
- fclose($fp);
- return true;
- }
-
- function _parseIni($filename)
- {
- if (!file_exists($filename)) {
- return PEAR::raiseError('php.ini "' . $filename . '" does not exist');
- }
-
- if (filesize($filename) > 300000) {
- return PEAR::raiseError('php.ini "' . $filename . '" is too large, aborting');
- }
-
- ob_start();
- phpinfo(INFO_GENERAL);
- $info = ob_get_contents();
- ob_end_clean();
- $debug = function_exists('leak') ? '_debug' : '';
- $ts = preg_match('/Thread Safety.+enabled/', $info) ? '_ts' : '';
- $zend_extension_line = 'zend_extension' . $debug . $ts;
- $all = @file($filename);
- if (!$all) {
- return PEAR::raiseError('php.ini "' . $filename .'" could not be read');
- }
- $zend_extensions = $extensions = array();
- // assume this is right, but pull from the php.ini if it is found
- $extension_dir = ini_get('extension_dir');
- foreach ($all as $linenum => $line) {
- $line = trim($line);
- if (!$line) {
- continue;
- }
- if ($line[0] == ';') {
- continue;
- }
- if (strtolower(substr($line, 0, 13)) == 'extension_dir') {
- $line = trim(substr($line, 13));
- if ($line[0] == '=') {
- $x = trim(substr($line, 1));
- $x = explode(';', $x);
- $extension_dir = str_replace('"', '', array_shift($x));
- continue;
- }
- }
- if (strtolower(substr($line, 0, 9)) == 'extension') {
- $line = trim(substr($line, 9));
- if ($line[0] == '=') {
- $x = trim(substr($line, 1));
- $x = explode(';', $x);
- $extensions[$linenum] = str_replace('"', '', array_shift($x));
- continue;
- }
- }
- if (strtolower(substr($line, 0, strlen($zend_extension_line))) ==
- $zend_extension_line) {
- $line = trim(substr($line, strlen($zend_extension_line)));
- if ($line[0] == '=') {
- $x = trim(substr($line, 1));
- $x = explode(';', $x);
- $zend_extensions[$linenum] = str_replace('"', '', array_shift($x));
- continue;
- }
- }
- }
- return array(
- 'extensions' => $extensions,
- 'zend_extensions' => $zend_extensions,
- 'extension_dir' => $extension_dir,
- 'all' => $all,
- );
- }
-
- // {{{ doInstall()
-
- function doInstall($command, $options, $params)
- {
- if (!class_exists('PEAR_PackageFile')) {
- require_once 'PEAR/PackageFile.php';
- }
-
- if (isset($options['installroot']) && isset($options['packagingroot'])) {
- return $this->raiseError('ERROR: cannot use both --installroot and --packagingroot');
- }
-
- $reg = &$this->config->getRegistry();
- $channel = isset($options['channel']) ? $options['channel'] : $this->config->get('default_channel');
- if (!$reg->channelExists($channel)) {
- return $this->raiseError('Channel "' . $channel . '" does not exist');
- }
-
- if (empty($this->installer)) {
- $this->installer = &$this->getInstaller($this->ui);
- }
-
- if ($command == 'upgrade' || $command == 'upgrade-all') {
- // If people run the upgrade command but pass nothing, emulate a upgrade-all
- if ($command == 'upgrade' && empty($params)) {
- return $this->doUpgradeAll($command, $options, $params);
- }
- $options['upgrade'] = true;
- } else {
- $packages = $params;
- }
-
- $instreg = &$reg; // instreg used to check if package is installed
- if (isset($options['packagingroot']) && !isset($options['upgrade'])) {
- $packrootphp_dir = $this->installer->_prependPath(
- $this->config->get('php_dir', null, 'pear.php.net'),
- $options['packagingroot']);
- $instreg = new PEAR_Registry($packrootphp_dir); // other instreg!
-
- if ($this->config->get('verbose') > 2) {
- $this->ui->outputData('using package root: ' . $options['packagingroot']);
- }
- }
-
- $abstractpackages = $otherpackages = array();
- // parse params
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
-
- foreach ($params as $param) {
- if (strpos($param, 'http://') === 0) {
- $otherpackages[] = $param;
- continue;
- }
-
- if (strpos($param, 'channel://') === false && @file_exists($param)) {
- if (isset($options['force'])) {
- $otherpackages[] = $param;
- continue;
- }
-
- $pkg = new PEAR_PackageFile($this->config);
- $pf = $pkg->fromAnyFile($param, PEAR_VALIDATE_DOWNLOADING);
- if (PEAR::isError($pf)) {
- $otherpackages[] = $param;
- continue;
- }
-
- $exists = $reg->packageExists($pf->getPackage(), $pf->getChannel());
- $pversion = $reg->packageInfo($pf->getPackage(), 'version', $pf->getChannel());
- $version_compare = version_compare($pf->getVersion(), $pversion, '<=');
- if ($exists && $version_compare) {
- if ($this->config->get('verbose')) {
- $this->ui->outputData('Ignoring installed package ' .
- $reg->parsedPackageNameToString(
- array('package' => $pf->getPackage(),
- 'channel' => $pf->getChannel()), true));
- }
- continue;
- }
- $otherpackages[] = $param;
- continue;
- }
-
- $e = $reg->parsePackageName($param, $channel);
- if (PEAR::isError($e)) {
- $otherpackages[] = $param;
- } else {
- $abstractpackages[] = $e;
- }
- }
- PEAR::staticPopErrorHandling();
-
- // if there are any local package .tgz or remote static url, we can't
- // filter. The filter only works for abstract packages
- if (count($abstractpackages) && !isset($options['force'])) {
- // when not being forced, only do necessary upgrades/installs
- if (isset($options['upgrade'])) {
- $abstractpackages = $this->_filterUptodatePackages($abstractpackages, $command);
- } else {
- $count = count($abstractpackages);
- foreach ($abstractpackages as $i => $package) {
- if (isset($package['group'])) {
- // do not filter out install groups
- continue;
- }
-
- if ($instreg->packageExists($package['package'], $package['channel'])) {
- if ($count > 1) {
- if ($this->config->get('verbose')) {
- $this->ui->outputData('Ignoring installed package ' .
- $reg->parsedPackageNameToString($package, true));
- }
- unset($abstractpackages[$i]);
- } elseif ($count === 1) {
- // Lets try to upgrade it since it's already installed
- $options['upgrade'] = true;
- }
- }
- }
- }
- $abstractpackages =
- array_map(array($reg, 'parsedPackageNameToString'), $abstractpackages);
- } elseif (count($abstractpackages)) {
- $abstractpackages =
- array_map(array($reg, 'parsedPackageNameToString'), $abstractpackages);
- }
-
- $packages = array_merge($abstractpackages, $otherpackages);
- if (!count($packages)) {
- $c = '';
- if (isset($options['channel'])){
- $c .= ' in channel "' . $options['channel'] . '"';
- }
- $this->ui->outputData('Nothing to ' . $command . $c);
- return true;
- }
-
- $this->downloader = &$this->getDownloader($this->ui, $options, $this->config);
- $errors = $downloaded = $binaries = array();
- $downloaded = &$this->downloader->download($packages);
- if (PEAR::isError($downloaded)) {
- return $this->raiseError($downloaded);
- }
-
- $errors = $this->downloader->getErrorMsgs();
- if (count($errors)) {
- $err = array();
- $err['data'] = array();
- foreach ($errors as $error) {
- if ($error !== null) {
- $err['data'][] = array($error);
- }
- }
-
- if (!empty($err['data'])) {
- $err['headline'] = 'Install Errors';
- $this->ui->outputData($err);
- }
-
- if (!count($downloaded)) {
- return $this->raiseError("$command failed");
- }
- }
-
- $data = array(
- 'headline' => 'Packages that would be Installed'
- );
-
- if (isset($options['pretend'])) {
- foreach ($downloaded as $package) {
- $data['data'][] = array($reg->parsedPackageNameToString($package->getParsedPackage()));
- }
- $this->ui->outputData($data, 'pretend');
- return true;
- }
-
- $this->installer->setOptions($options);
- $this->installer->sortPackagesForInstall($downloaded);
- if (PEAR::isError($err = $this->installer->setDownloadedPackages($downloaded))) {
- $this->raiseError($err->getMessage());
- return true;
- }
-
- $binaries = $extrainfo = array();
- foreach ($downloaded as $param) {
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- $info = $this->installer->install($param, $options);
- PEAR::staticPopErrorHandling();
- if (PEAR::isError($info)) {
- $oldinfo = $info;
- $pkg = &$param->getPackageFile();
- if ($info->getCode() != PEAR_INSTALLER_NOBINARY) {
- if (!($info = $pkg->installBinary($this->installer))) {
- $this->ui->outputData('ERROR: ' .$oldinfo->getMessage());
- continue;
- }
-
- // we just installed a different package than requested,
- // let's change the param and info so that the rest of this works
- $param = $info[0];
- $info = $info[1];
- }
- }
-
- if (!is_array($info)) {
- return $this->raiseError("$command failed");
- }
-
- if ($param->getPackageType() == 'extsrc' ||
- $param->getPackageType() == 'extbin' ||
- $param->getPackageType() == 'zendextsrc' ||
- $param->getPackageType() == 'zendextbin'
- ) {
- $pkg = &$param->getPackageFile();
- if ($instbin = $pkg->getInstalledBinary()) {
- $instpkg = &$instreg->getPackage($instbin, $pkg->getChannel());
- } else {
- $instpkg = &$instreg->getPackage($pkg->getPackage(), $pkg->getChannel());
- }
-
- foreach ($instpkg->getFilelist() as $name => $atts) {
- $pinfo = pathinfo($atts['installed_as']);
- if (!isset($pinfo['extension']) ||
- in_array($pinfo['extension'], array('c', 'h'))
- ) {
- continue; // make sure we don't match php_blah.h
- }
-
- if ((strpos($pinfo['basename'], 'php_') === 0 &&
- $pinfo['extension'] == 'dll') ||
- // most unices
- $pinfo['extension'] == 'so' ||
- // hp-ux
- $pinfo['extension'] == 'sl') {
- $binaries[] = array($atts['installed_as'], $pinfo);
- break;
- }
- }
-
- if (count($binaries)) {
- foreach ($binaries as $pinfo) {
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- $ret = $this->enableExtension(array($pinfo[0]), $param->getPackageType());
- PEAR::staticPopErrorHandling();
- if (PEAR::isError($ret)) {
- $extrainfo[] = $ret->getMessage();
- if ($param->getPackageType() == 'extsrc' ||
- $param->getPackageType() == 'extbin') {
- $exttype = 'extension';
- } else {
- ob_start();
- phpinfo(INFO_GENERAL);
- $info = ob_get_contents();
- ob_end_clean();
- $debug = function_exists('leak') ? '_debug' : '';
- $ts = preg_match('/Thread Safety.+enabled/', $info) ? '_ts' : '';
- $exttype = 'zend_extension' . $debug . $ts;
- }
- $extrainfo[] = 'You should add "' . $exttype . '=' .
- $pinfo[1]['basename'] . '" to php.ini';
- } else {
- $extrainfo[] = 'Extension ' . $instpkg->getProvidesExtension() .
- ' enabled in php.ini';
- }
- }
- }
- }
-
- if ($this->config->get('verbose') > 0) {
- $chan = $param->getChannel();
- $label = $reg->parsedPackageNameToString(
- array(
- 'channel' => $chan,
- 'package' => $param->getPackage(),
- 'version' => $param->getVersion(),
- ));
- $out = array('data' => "$command ok: $label");
- if (isset($info['release_warnings'])) {
- $out['release_warnings'] = $info['release_warnings'];
- }
- $this->ui->outputData($out, $command);
-
- if (!isset($options['register-only']) && !isset($options['offline'])) {
- if ($this->config->isDefinedLayer('ftp')) {
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- $info = $this->installer->ftpInstall($param);
- PEAR::staticPopErrorHandling();
- if (PEAR::isError($info)) {
- $this->ui->outputData($info->getMessage());
- $this->ui->outputData("remote install failed: $label");
- } else {
- $this->ui->outputData("remote install ok: $label");
- }
- }
- }
- }
-
- $deps = $param->getDeps();
- if ($deps) {
- if (isset($deps['group'])) {
- $groups = $deps['group'];
- if (!isset($groups[0])) {
- $groups = array($groups);
- }
-
- foreach ($groups as $group) {
- if ($group['attribs']['name'] == 'default') {
- // default group is always installed, unless the user
- // explicitly chooses to install another group
- continue;
- }
- $extrainfo[] = $param->getPackage() . ': Optional feature ' .
- $group['attribs']['name'] . ' available (' .
- $group['attribs']['hint'] . ')';
- }
-
- $extrainfo[] = $param->getPackage() .
- ': To install optional features use "pear install ' .
- $reg->parsedPackageNameToString(
- array('package' => $param->getPackage(),
- 'channel' => $param->getChannel()), true) .
- '#featurename"';
- }
- }
-
- $pkg = &$instreg->getPackage($param->getPackage(), $param->getChannel());
- // $pkg may be NULL if install is a 'fake' install via --packagingroot
- if (is_object($pkg)) {
- $pkg->setConfig($this->config);
- if ($list = $pkg->listPostinstallScripts()) {
- $pn = $reg->parsedPackageNameToString(array('channel' =>
- $param->getChannel(), 'package' => $param->getPackage()), true);
- $extrainfo[] = $pn . ' has post-install scripts:';
- foreach ($list as $file) {
- $extrainfo[] = $file;
- }
- $extrainfo[] = $param->getPackage() .
- ': Use "pear run-scripts ' . $pn . '" to finish setup.';
- $extrainfo[] = 'DO NOT RUN SCRIPTS FROM UNTRUSTED SOURCES';
- }
- }
- }
-
- if (count($extrainfo)) {
- foreach ($extrainfo as $info) {
- $this->ui->outputData($info);
- }
- }
-
- return true;
- }
-
- // }}}
- // {{{ doUpgradeAll()
-
- function doUpgradeAll($command, $options, $params)
- {
- $reg = &$this->config->getRegistry();
- $upgrade = array();
-
- if (isset($options['channel'])) {
- $channels = array($options['channel']);
- } else {
- $channels = $reg->listChannels();
- }
-
- foreach ($channels as $channel) {
- if ($channel == '__uri') {
- continue;
- }
-
- // parse name with channel
- foreach ($reg->listPackages($channel) as $name) {
- $upgrade[] = $reg->parsedPackageNameToString(array(
- 'channel' => $channel,
- 'package' => $name
- ));
- }
- }
-
- $err = $this->doInstall($command, $options, $upgrade);
- if (PEAR::isError($err)) {
- $this->ui->outputData($err->getMessage(), $command);
- }
- }
-
- // }}}
- // {{{ doUninstall()
-
- function doUninstall($command, $options, $params)
- {
- if (count($params) < 1) {
- return $this->raiseError("Please supply the package(s) you want to uninstall");
- }
-
- if (empty($this->installer)) {
- $this->installer = &$this->getInstaller($this->ui);
- }
-
- if (isset($options['remoteconfig'])) {
- $e = $this->config->readFTPConfigFile($options['remoteconfig']);
- if (!PEAR::isError($e)) {
- $this->installer->setConfig($this->config);
- }
- }
-
- $reg = &$this->config->getRegistry();
- $newparams = array();
- $binaries = array();
- $badparams = array();
- foreach ($params as $pkg) {
- $channel = $this->config->get('default_channel');
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- $parsed = $reg->parsePackageName($pkg, $channel);
- PEAR::staticPopErrorHandling();
- if (!$parsed || PEAR::isError($parsed)) {
- $badparams[] = $pkg;
- continue;
- }
- $package = $parsed['package'];
- $channel = $parsed['channel'];
- $info = &$reg->getPackage($package, $channel);
- if ($info === null &&
- ($channel == 'pear.php.net' || $channel == 'pecl.php.net')) {
- // make sure this isn't a package that has flipped from pear to pecl but
- // used a package.xml 1.0
- $testc = ($channel == 'pear.php.net') ? 'pecl.php.net' : 'pear.php.net';
- $info = &$reg->getPackage($package, $testc);
- if ($info !== null) {
- $channel = $testc;
- }
- }
- if ($info === null) {
- $badparams[] = $pkg;
- } else {
- $newparams[] = &$info;
- // check for binary packages (this is an alias for those packages if so)
- if ($installedbinary = $info->getInstalledBinary()) {
- $this->ui->log('adding binary package ' .
- $reg->parsedPackageNameToString(array('channel' => $channel,
- 'package' => $installedbinary), true));
- $newparams[] = &$reg->getPackage($installedbinary, $channel);
- }
- // add the contents of a dependency group to the list of installed packages
- if (isset($parsed['group'])) {
- $group = $info->getDependencyGroup($parsed['group']);
- if ($group) {
- $installed = $reg->getInstalledGroup($group);
- if ($installed) {
- foreach ($installed as $i => $p) {
- $newparams[] = &$installed[$i];
- }
- }
- }
- }
- }
- }
- $err = $this->installer->sortPackagesForUninstall($newparams);
- if (PEAR::isError($err)) {
- $this->ui->outputData($err->getMessage(), $command);
- return true;
- }
- $params = $newparams;
- // twist this to use it to check on whether dependent packages are also being uninstalled
- // for circular dependencies like subpackages
- $this->installer->setUninstallPackages($newparams);
- $params = array_merge($params, $badparams);
- $binaries = array();
- foreach ($params as $pkg) {
- $this->installer->pushErrorHandling(PEAR_ERROR_RETURN);
- if ($err = $this->installer->uninstall($pkg, $options)) {
- $this->installer->popErrorHandling();
- if (PEAR::isError($err)) {
- $this->ui->outputData($err->getMessage(), $command);
- continue;
- }
- if ($pkg->getPackageType() == 'extsrc' ||
- $pkg->getPackageType() == 'extbin' ||
- $pkg->getPackageType() == 'zendextsrc' ||
- $pkg->getPackageType() == 'zendextbin') {
- if ($instbin = $pkg->getInstalledBinary()) {
- continue; // this will be uninstalled later
- }
-
- foreach ($pkg->getFilelist() as $name => $atts) {
- $pinfo = pathinfo($atts['installed_as']);
- if (!isset($pinfo['extension']) ||
- in_array($pinfo['extension'], array('c', 'h'))) {
- continue; // make sure we don't match php_blah.h
- }
- if ((strpos($pinfo['basename'], 'php_') === 0 &&
- $pinfo['extension'] == 'dll') ||
- // most unices
- $pinfo['extension'] == 'so' ||
- // hp-ux
- $pinfo['extension'] == 'sl') {
- $binaries[] = array($atts['installed_as'], $pinfo);
- break;
- }
- }
- if (count($binaries)) {
- foreach ($binaries as $pinfo) {
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- $ret = $this->disableExtension(array($pinfo[0]), $pkg->getPackageType());
- PEAR::staticPopErrorHandling();
- if (PEAR::isError($ret)) {
- $extrainfo[] = $ret->getMessage();
- if ($pkg->getPackageType() == 'extsrc' ||
- $pkg->getPackageType() == 'extbin') {
- $exttype = 'extension';
- } else {
- ob_start();
- phpinfo(INFO_GENERAL);
- $info = ob_get_contents();
- ob_end_clean();
- $debug = function_exists('leak') ? '_debug' : '';
- $ts = preg_match('/Thread Safety.+enabled/', $info) ? '_ts' : '';
- $exttype = 'zend_extension' . $debug . $ts;
- }
- $this->ui->outputData('Unable to remove "' . $exttype . '=' .
- $pinfo[1]['basename'] . '" from php.ini', $command);
- } else {
- $this->ui->outputData('Extension ' . $pkg->getProvidesExtension() .
- ' disabled in php.ini', $command);
- }
- }
- }
- }
- $savepkg = $pkg;
- if ($this->config->get('verbose') > 0) {
- if (is_object($pkg)) {
- $pkg = $reg->parsedPackageNameToString($pkg);
- }
- $this->ui->outputData("uninstall ok: $pkg", $command);
- }
- if (!isset($options['offline']) && is_object($savepkg) &&
- defined('PEAR_REMOTEINSTALL_OK')) {
- if ($this->config->isDefinedLayer('ftp')) {
- $this->installer->pushErrorHandling(PEAR_ERROR_RETURN);
- $info = $this->installer->ftpUninstall($savepkg);
- $this->installer->popErrorHandling();
- if (PEAR::isError($info)) {
- $this->ui->outputData($info->getMessage());
- $this->ui->outputData("remote uninstall failed: $pkg");
- } else {
- $this->ui->outputData("remote uninstall ok: $pkg");
- }
- }
- }
- } else {
- $this->installer->popErrorHandling();
- if (!is_object($pkg)) {
- return $this->raiseError("uninstall failed: $pkg");
- }
- $pkg = $reg->parsedPackageNameToString($pkg);
- }
- }
-
- return true;
- }
-
- // }}}
-
-
- // }}}
- // {{{ doBundle()
- /*
- (cox) It just downloads and untars the package, does not do
- any check that the PEAR_Installer::_installFile() does.
- */
-
- function doBundle($command, $options, $params)
- {
- $opts = array(
- 'force' => true,
- 'nodeps' => true,
- 'soft' => true,
- 'downloadonly' => true
- );
- $downloader = &$this->getDownloader($this->ui, $opts, $this->config);
- $reg = &$this->config->getRegistry();
- if (count($params) < 1) {
- return $this->raiseError("Please supply the package you want to bundle");
- }
-
- if (isset($options['destination'])) {
- if (!is_dir($options['destination'])) {
- System::mkdir('-p ' . $options['destination']);
- }
- $dest = realpath($options['destination']);
- } else {
- $pwd = getcwd();
- $dir = $pwd . DIRECTORY_SEPARATOR . 'ext';
- $dest = is_dir($dir) ? $dir : $pwd;
- }
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- $err = $downloader->setDownloadDir($dest);
- PEAR::staticPopErrorHandling();
- if (PEAR::isError($err)) {
- return PEAR::raiseError('download directory "' . $dest .
- '" is not writeable.');
- }
- $result = &$downloader->download(array($params[0]));
- if (PEAR::isError($result)) {
- return $result;
- }
- if (!isset($result[0])) {
- return $this->raiseError('unable to unpack ' . $params[0]);
- }
- $pkgfile = &$result[0]->getPackageFile();
- $pkgname = $pkgfile->getName();
- $pkgversion = $pkgfile->getVersion();
-
- // Unpacking -------------------------------------------------
- $dest .= DIRECTORY_SEPARATOR . $pkgname;
- $orig = $pkgname . '-' . $pkgversion;
-
- $tar = &new Archive_Tar($pkgfile->getArchiveFile());
- if (!$tar->extractModify($dest, $orig)) {
- return $this->raiseError('unable to unpack ' . $pkgfile->getArchiveFile());
- }
- $this->ui->outputData("Package ready at '$dest'");
- // }}}
- }
-
- // }}}
-
- function doRunScripts($command, $options, $params)
- {
- if (!isset($params[0])) {
- return $this->raiseError('run-scripts expects 1 parameter: a package name');
- }
-
- $reg = &$this->config->getRegistry();
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- $parsed = $reg->parsePackageName($params[0], $this->config->get('default_channel'));
- PEAR::staticPopErrorHandling();
- if (PEAR::isError($parsed)) {
- return $this->raiseError($parsed);
- }
-
- $package = &$reg->getPackage($parsed['package'], $parsed['channel']);
- if (!is_object($package)) {
- return $this->raiseError('Could not retrieve package "' . $params[0] . '" from registry');
- }
-
- $package->setConfig($this->config);
- $package->runPostinstallScripts();
- $this->ui->outputData('Install scripts complete', $command);
- return true;
- }
-
- /**
- * Given a list of packages, filter out those ones that are already up to date
- *
- * @param $packages: packages, in parsed array format !
- * @return list of packages that can be upgraded
- */
- function _filterUptodatePackages($packages, $command)
- {
- $reg = &$this->config->getRegistry();
- $latestReleases = array();
-
- $ret = array();
- foreach ($packages as $package) {
- if (isset($package['group'])) {
- $ret[] = $package;
- continue;
- }
-
- $channel = $package['channel'];
- $name = $package['package'];
- if (!$reg->packageExists($name, $channel)) {
- $ret[] = $package;
- continue;
- }
-
- if (!isset($latestReleases[$channel])) {
- // fill in cache for this channel
- $chan = &$reg->getChannel($channel);
- if (PEAR::isError($chan)) {
- return $this->raiseError($chan);
- }
-
- $base2 = false;
- $preferred_mirror = $this->config->get('preferred_mirror', null, $channel);
- if ($chan->supportsREST($preferred_mirror) &&
- (
- //($base2 = $chan->getBaseURL('REST1.4', $preferred_mirror)) ||
- ($base = $chan->getBaseURL('REST1.0', $preferred_mirror))
- )
- ) {
- $dorest = true;
- }
-
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- if (!isset($package['state'])) {
- $state = $this->config->get('preferred_state', null, $channel);
- } else {
- $state = $package['state'];
- }
-
- if ($dorest) {
- if ($base2) {
- $rest = &$this->config->getREST('1.4', array());
- $base = $base2;
- } else {
- $rest = &$this->config->getREST('1.0', array());
- }
-
- $installed = array_flip($reg->listPackages($channel));
- $latest = $rest->listLatestUpgrades($base, $state, $installed, $channel, $reg);
- }
-
- PEAR::staticPopErrorHandling();
- if (PEAR::isError($latest)) {
- $this->ui->outputData('Error getting channel info from ' . $channel .
- ': ' . $latest->getMessage());
- continue;
- }
-
- $latestReleases[$channel] = array_change_key_case($latest);
- }
-
- // check package for latest release
- $name_lower = strtolower($name);
- if (isset($latestReleases[$channel][$name_lower])) {
- // if not set, up to date
- $inst_version = $reg->packageInfo($name, 'version', $channel);
- $channel_version = $latestReleases[$channel][$name_lower]['version'];
- if (version_compare($channel_version, $inst_version, 'le')) {
- // installed version is up-to-date
- continue;
- }
-
- // maintain BC
- if ($command == 'upgrade-all') {
- $this->ui->outputData(array('data' => 'Will upgrade ' .
- $reg->parsedPackageNameToString($package)), $command);
- }
- $ret[] = $package;
- }
- }
-
- return $ret;
- }
-} \ No newline at end of file
diff --git a/3rdparty/PEAR/Command/Install.xml b/3rdparty/PEAR/Command/Install.xml
deleted file mode 100644
index 1b1e933c22d..00000000000
--- a/3rdparty/PEAR/Command/Install.xml
+++ /dev/null
@@ -1,276 +0,0 @@
-<commands version="1.0">
- <install>
- <summary>Install Package</summary>
- <function>doInstall</function>
- <shortcut>i</shortcut>
- <options>
- <force>
- <shortopt>f</shortopt>
- <doc>will overwrite newer installed packages</doc>
- </force>
- <loose>
- <shortopt>l</shortopt>
- <doc>do not check for recommended dependency version</doc>
- </loose>
- <nodeps>
- <shortopt>n</shortopt>
- <doc>ignore dependencies, install anyway</doc>
- </nodeps>
- <register-only>
- <shortopt>r</shortopt>
- <doc>do not install files, only register the package as installed</doc>
- </register-only>
- <soft>
- <shortopt>s</shortopt>
- <doc>soft install, fail silently, or upgrade if already installed</doc>
- </soft>
- <nobuild>
- <shortopt>B</shortopt>
- <doc>don&#039;t build C extensions</doc>
- </nobuild>
- <nocompress>
- <shortopt>Z</shortopt>
- <doc>request uncompressed files when downloading</doc>
- </nocompress>
- <installroot>
- <shortopt>R</shortopt>
- <doc>root directory used when installing files (ala PHP&#039;s INSTALL_ROOT), use packagingroot for RPM</doc>
- <arg>DIR</arg>
- </installroot>
- <packagingroot>
- <shortopt>P</shortopt>
- <doc>root directory used when packaging files, like RPM packaging</doc>
- <arg>DIR</arg>
- </packagingroot>
- <ignore-errors>
- <shortopt></shortopt>
- <doc>force install even if there were errors</doc>
- </ignore-errors>
- <alldeps>
- <shortopt>a</shortopt>
- <doc>install all required and optional dependencies</doc>
- </alldeps>
- <onlyreqdeps>
- <shortopt>o</shortopt>
- <doc>install all required dependencies</doc>
- </onlyreqdeps>
- <offline>
- <shortopt>O</shortopt>
- <doc>do not attempt to download any urls or contact channels</doc>
- </offline>
- <pretend>
- <shortopt>p</shortopt>
- <doc>Only list the packages that would be downloaded</doc>
- </pretend>
- </options>
- <doc>[channel/]&lt;package&gt; ...
-Installs one or more PEAR packages. You can specify a package to
-install in four ways:
-
-&quot;Package-1.0.tgz&quot; : installs from a local file
-
-&quot;http://example.com/Package-1.0.tgz&quot; : installs from
-anywhere on the net.
-
-&quot;package.xml&quot; : installs the package described in
-package.xml. Useful for testing, or for wrapping a PEAR package in
-another package manager such as RPM.
-
-&quot;Package[-version/state][.tar]&quot; : queries your default channel&#039;s server
-({config master_server}) and downloads the newest package with
-the preferred quality/state ({config preferred_state}).
-
-To retrieve Package version 1.1, use &quot;Package-1.1,&quot; to retrieve
-Package state beta, use &quot;Package-beta.&quot; To retrieve an uncompressed
-file, append .tar (make sure there is no file by the same name first)
-
-To download a package from another channel, prefix with the channel name like
-&quot;channel/Package&quot;
-
-More than one package may be specified at once. It is ok to mix these
-four ways of specifying packages.
-</doc>
- </install>
- <upgrade>
- <summary>Upgrade Package</summary>
- <function>doInstall</function>
- <shortcut>up</shortcut>
- <options>
- <channel>
- <shortopt>c</shortopt>
- <doc>upgrade packages from a specific channel</doc>
- <arg>CHAN</arg>
- </channel>
- <force>
- <shortopt>f</shortopt>
- <doc>overwrite newer installed packages</doc>
- </force>
- <loose>
- <shortopt>l</shortopt>
- <doc>do not check for recommended dependency version</doc>
- </loose>
- <nodeps>
- <shortopt>n</shortopt>
- <doc>ignore dependencies, upgrade anyway</doc>
- </nodeps>
- <register-only>
- <shortopt>r</shortopt>
- <doc>do not install files, only register the package as upgraded</doc>
- </register-only>
- <nobuild>
- <shortopt>B</shortopt>
- <doc>don&#039;t build C extensions</doc>
- </nobuild>
- <nocompress>
- <shortopt>Z</shortopt>
- <doc>request uncompressed files when downloading</doc>
- </nocompress>
- <installroot>
- <shortopt>R</shortopt>
- <doc>root directory used when installing files (ala PHP&#039;s INSTALL_ROOT)</doc>
- <arg>DIR</arg>
- </installroot>
- <ignore-errors>
- <shortopt></shortopt>
- <doc>force install even if there were errors</doc>
- </ignore-errors>
- <alldeps>
- <shortopt>a</shortopt>
- <doc>install all required and optional dependencies</doc>
- </alldeps>
- <onlyreqdeps>
- <shortopt>o</shortopt>
- <doc>install all required dependencies</doc>
- </onlyreqdeps>
- <offline>
- <shortopt>O</shortopt>
- <doc>do not attempt to download any urls or contact channels</doc>
- </offline>
- <pretend>
- <shortopt>p</shortopt>
- <doc>Only list the packages that would be downloaded</doc>
- </pretend>
- </options>
- <doc>&lt;package&gt; ...
-Upgrades one or more PEAR packages. See documentation for the
-&quot;install&quot; command for ways to specify a package.
-
-When upgrading, your package will be updated if the provided new
-package has a higher version number (use the -f option if you need to
-upgrade anyway).
-
-More than one package may be specified at once.
-</doc>
- </upgrade>
- <upgrade-all>
- <summary>Upgrade All Packages [Deprecated in favor of calling upgrade with no parameters]</summary>
- <function>doUpgradeAll</function>
- <shortcut>ua</shortcut>
- <options>
- <channel>
- <shortopt>c</shortopt>
- <doc>upgrade packages from a specific channel</doc>
- <arg>CHAN</arg>
- </channel>
- <nodeps>
- <shortopt>n</shortopt>
- <doc>ignore dependencies, upgrade anyway</doc>
- </nodeps>
- <register-only>
- <shortopt>r</shortopt>
- <doc>do not install files, only register the package as upgraded</doc>
- </register-only>
- <nobuild>
- <shortopt>B</shortopt>
- <doc>don&#039;t build C extensions</doc>
- </nobuild>
- <nocompress>
- <shortopt>Z</shortopt>
- <doc>request uncompressed files when downloading</doc>
- </nocompress>
- <installroot>
- <shortopt>R</shortopt>
- <doc>root directory used when installing files (ala PHP&#039;s INSTALL_ROOT), use packagingroot for RPM</doc>
- <arg>DIR</arg>
- </installroot>
- <ignore-errors>
- <shortopt></shortopt>
- <doc>force install even if there were errors</doc>
- </ignore-errors>
- <loose>
- <shortopt></shortopt>
- <doc>do not check for recommended dependency version</doc>
- </loose>
- </options>
- <doc>
-WARNING: This function is deprecated in favor of using the upgrade command with no params
-
-Upgrades all packages that have a newer release available. Upgrades are
-done only if there is a release available of the state specified in
-&quot;preferred_state&quot; (currently {config preferred_state}), or a state considered
-more stable.
-</doc>
- </upgrade-all>
- <uninstall>
- <summary>Un-install Package</summary>
- <function>doUninstall</function>
- <shortcut>un</shortcut>
- <options>
- <nodeps>
- <shortopt>n</shortopt>
- <doc>ignore dependencies, uninstall anyway</doc>
- </nodeps>
- <register-only>
- <shortopt>r</shortopt>
- <doc>do not remove files, only register the packages as not installed</doc>
- </register-only>
- <installroot>
- <shortopt>R</shortopt>
- <doc>root directory used when installing files (ala PHP&#039;s INSTALL_ROOT)</doc>
- <arg>DIR</arg>
- </installroot>
- <ignore-errors>
- <shortopt></shortopt>
- <doc>force install even if there were errors</doc>
- </ignore-errors>
- <offline>
- <shortopt>O</shortopt>
- <doc>do not attempt to uninstall remotely</doc>
- </offline>
- </options>
- <doc>[channel/]&lt;package&gt; ...
-Uninstalls one or more PEAR packages. More than one package may be
-specified at once. Prefix with channel name to uninstall from a
-channel not in your default channel ({config default_channel})
-</doc>
- </uninstall>
- <bundle>
- <summary>Unpacks a Pecl Package</summary>
- <function>doBundle</function>
- <shortcut>bun</shortcut>
- <options>
- <destination>
- <shortopt>d</shortopt>
- <doc>Optional destination directory for unpacking (defaults to current path or &quot;ext&quot; if exists)</doc>
- <arg>DIR</arg>
- </destination>
- <force>
- <shortopt>f</shortopt>
- <doc>Force the unpacking even if there were errors in the package</doc>
- </force>
- </options>
- <doc>&lt;package&gt;
-Unpacks a Pecl Package into the selected location. It will download the
-package if needed.
-</doc>
- </bundle>
- <run-scripts>
- <summary>Run Post-Install Scripts bundled with a package</summary>
- <function>doRunScripts</function>
- <shortcut>rs</shortcut>
- <options />
- <doc>&lt;package&gt;
-Run post-installation scripts in package &lt;package&gt;, if any exist.
-</doc>
- </run-scripts>
-</commands> \ No newline at end of file
diff --git a/3rdparty/PEAR/Command/Mirror.php b/3rdparty/PEAR/Command/Mirror.php
deleted file mode 100644
index 4d157c6b888..00000000000
--- a/3rdparty/PEAR/Command/Mirror.php
+++ /dev/null
@@ -1,139 +0,0 @@
-<?php
-/**
- * PEAR_Command_Mirror (download-all command)
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Alexander Merz <alexmerz@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Mirror.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.2.0
- */
-
-/**
- * base class
- */
-require_once 'PEAR/Command/Common.php';
-
-/**
- * PEAR commands for providing file mirrors
- *
- * @category pear
- * @package PEAR
- * @author Alexander Merz <alexmerz@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.2.0
- */
-class PEAR_Command_Mirror extends PEAR_Command_Common
-{
- var $commands = array(
- 'download-all' => array(
- 'summary' => 'Downloads each available package from the default channel',
- 'function' => 'doDownloadAll',
- 'shortcut' => 'da',
- 'options' => array(
- 'channel' =>
- array(
- 'shortopt' => 'c',
- 'doc' => 'specify a channel other than the default channel',
- 'arg' => 'CHAN',
- ),
- ),
- 'doc' => '
-Requests a list of available packages from the default channel ({config default_channel})
-and downloads them to current working directory. Note: only
-packages within preferred_state ({config preferred_state}) will be downloaded'
- ),
- );
-
- /**
- * PEAR_Command_Mirror constructor.
- *
- * @access public
- * @param object PEAR_Frontend a reference to an frontend
- * @param object PEAR_Config a reference to the configuration data
- */
- function PEAR_Command_Mirror(&$ui, &$config)
- {
- parent::PEAR_Command_Common($ui, $config);
- }
-
- /**
- * For unit-testing
- */
- function &factory($a)
- {
- $a = &PEAR_Command::factory($a, $this->config);
- return $a;
- }
-
- /**
- * retrieves a list of avaible Packages from master server
- * and downloads them
- *
- * @access public
- * @param string $command the command
- * @param array $options the command options before the command
- * @param array $params the stuff after the command name
- * @return bool true if succesful
- * @throw PEAR_Error
- */
- function doDownloadAll($command, $options, $params)
- {
- $savechannel = $this->config->get('default_channel');
- $reg = &$this->config->getRegistry();
- $channel = isset($options['channel']) ? $options['channel'] :
- $this->config->get('default_channel');
- if (!$reg->channelExists($channel)) {
- $this->config->set('default_channel', $savechannel);
- return $this->raiseError('Channel "' . $channel . '" does not exist');
- }
- $this->config->set('default_channel', $channel);
-
- $this->ui->outputData('Using Channel ' . $this->config->get('default_channel'));
- $chan = $reg->getChannel($channel);
- if (PEAR::isError($chan)) {
- return $this->raiseError($chan);
- }
-
- if ($chan->supportsREST($this->config->get('preferred_mirror')) &&
- $base = $chan->getBaseURL('REST1.0', $this->config->get('preferred_mirror'))) {
- $rest = &$this->config->getREST('1.0', array());
- $remoteInfo = array_flip($rest->listPackages($base, $channel));
- }
-
- if (PEAR::isError($remoteInfo)) {
- return $remoteInfo;
- }
-
- $cmd = &$this->factory("download");
- if (PEAR::isError($cmd)) {
- return $cmd;
- }
-
- $this->ui->outputData('Using Preferred State of ' .
- $this->config->get('preferred_state'));
- $this->ui->outputData('Gathering release information, please wait...');
-
- /**
- * Error handling not necessary, because already done by
- * the download command
- */
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- $err = $cmd->run('download', array('downloadonly' => true), array_keys($remoteInfo));
- PEAR::staticPopErrorHandling();
- $this->config->set('default_channel', $savechannel);
- if (PEAR::isError($err)) {
- $this->ui->outputData($err->getMessage());
- }
-
- return true;
- }
-} \ No newline at end of file
diff --git a/3rdparty/PEAR/Command/Mirror.xml b/3rdparty/PEAR/Command/Mirror.xml
deleted file mode 100644
index fe8be9d03bf..00000000000
--- a/3rdparty/PEAR/Command/Mirror.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<commands version="1.0">
- <download-all>
- <summary>Downloads each available package from the default channel</summary>
- <function>doDownloadAll</function>
- <shortcut>da</shortcut>
- <options>
- <channel>
- <shortopt>c</shortopt>
- <doc>specify a channel other than the default channel</doc>
- <arg>CHAN</arg>
- </channel>
- </options>
- <doc>
-Requests a list of available packages from the default channel ({config default_channel})
-and downloads them to current working directory. Note: only
-packages within preferred_state ({config preferred_state}) will be downloaded</doc>
- </download-all>
-</commands> \ No newline at end of file
diff --git a/3rdparty/PEAR/Command/Package.php b/3rdparty/PEAR/Command/Package.php
deleted file mode 100644
index 81df7bf6945..00000000000
--- a/3rdparty/PEAR/Command/Package.php
+++ /dev/null
@@ -1,1124 +0,0 @@
-<?php
-/**
- * PEAR_Command_Package (package, package-validate, cvsdiff, cvstag, package-dependencies,
- * sign, makerpm, convert commands)
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Stig Bakken <ssb@php.net>
- * @author Martin Jansen <mj@php.net>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Package.php 313024 2011-07-06 19:51:24Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 0.1
- */
-
-/**
- * base class
- */
-require_once 'PEAR/Command/Common.php';
-
-/**
- * PEAR commands for login/logout
- *
- * @category pear
- * @package PEAR
- * @author Stig Bakken <ssb@php.net>
- * @author Martin Jansen <mj@php.net>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 0.1
- */
-
-class PEAR_Command_Package extends PEAR_Command_Common
-{
- var $commands = array(
- 'package' => array(
- 'summary' => 'Build Package',
- 'function' => 'doPackage',
- 'shortcut' => 'p',
- 'options' => array(
- 'nocompress' => array(
- 'shortopt' => 'Z',
- 'doc' => 'Do not gzip the package file'
- ),
- 'showname' => array(
- 'shortopt' => 'n',
- 'doc' => 'Print the name of the packaged file.',
- ),
- ),
- 'doc' => '[descfile] [descfile2]
-Creates a PEAR package from its description file (usually called
-package.xml). If a second packagefile is passed in, then
-the packager will check to make sure that one is a package.xml
-version 1.0, and the other is a package.xml version 2.0. The
-package.xml version 1.0 will be saved as "package.xml" in the archive,
-and the other as "package2.xml" in the archive"
-'
- ),
- 'package-validate' => array(
- 'summary' => 'Validate Package Consistency',
- 'function' => 'doPackageValidate',
- 'shortcut' => 'pv',
- 'options' => array(),
- 'doc' => '
-',
- ),
- 'cvsdiff' => array(
- 'summary' => 'Run a "cvs diff" for all files in a package',
- 'function' => 'doCvsDiff',
- 'shortcut' => 'cd',
- 'options' => array(
- 'quiet' => array(
- 'shortopt' => 'q',
- 'doc' => 'Be quiet',
- ),
- 'reallyquiet' => array(
- 'shortopt' => 'Q',
- 'doc' => 'Be really quiet',
- ),
- 'date' => array(
- 'shortopt' => 'D',
- 'doc' => 'Diff against revision of DATE',
- 'arg' => 'DATE',
- ),
- 'release' => array(
- 'shortopt' => 'R',
- 'doc' => 'Diff against tag for package release REL',
- 'arg' => 'REL',
- ),
- 'revision' => array(
- 'shortopt' => 'r',
- 'doc' => 'Diff against revision REV',
- 'arg' => 'REV',
- ),
- 'context' => array(
- 'shortopt' => 'c',
- 'doc' => 'Generate context diff',
- ),
- 'unified' => array(
- 'shortopt' => 'u',
- 'doc' => 'Generate unified diff',
- ),
- 'ignore-case' => array(
- 'shortopt' => 'i',
- 'doc' => 'Ignore case, consider upper- and lower-case letters equivalent',
- ),
- 'ignore-whitespace' => array(
- 'shortopt' => 'b',
- 'doc' => 'Ignore changes in amount of white space',
- ),
- 'ignore-blank-lines' => array(
- 'shortopt' => 'B',
- 'doc' => 'Ignore changes that insert or delete blank lines',
- ),
- 'brief' => array(
- 'doc' => 'Report only whether the files differ, no details',
- ),
- 'dry-run' => array(
- 'shortopt' => 'n',
- 'doc' => 'Don\'t do anything, just pretend',
- ),
- ),
- 'doc' => '<package.xml>
-Compares all the files in a package. Without any options, this
-command will compare the current code with the last checked-in code.
-Using the -r or -R option you may compare the current code with that
-of a specific release.
-',
- ),
- 'svntag' => array(
- 'summary' => 'Set SVN Release Tag',
- 'function' => 'doSvnTag',
- 'shortcut' => 'sv',
- 'options' => array(
- 'quiet' => array(
- 'shortopt' => 'q',
- 'doc' => 'Be quiet',
- ),
- 'slide' => array(
- 'shortopt' => 'F',
- 'doc' => 'Move (slide) tag if it exists',
- ),
- 'delete' => array(
- 'shortopt' => 'd',
- 'doc' => 'Remove tag',
- ),
- 'dry-run' => array(
- 'shortopt' => 'n',
- 'doc' => 'Don\'t do anything, just pretend',
- ),
- ),
- 'doc' => '<package.xml> [files...]
- Sets a SVN tag on all files in a package. Use this command after you have
- packaged a distribution tarball with the "package" command to tag what
- revisions of what files were in that release. If need to fix something
- after running svntag once, but before the tarball is released to the public,
- use the "slide" option to move the release tag.
-
- to include files (such as a second package.xml, or tests not included in the
- release), pass them as additional parameters.
- ',
- ),
- 'cvstag' => array(
- 'summary' => 'Set CVS Release Tag',
- 'function' => 'doCvsTag',
- 'shortcut' => 'ct',
- 'options' => array(
- 'quiet' => array(
- 'shortopt' => 'q',
- 'doc' => 'Be quiet',
- ),
- 'reallyquiet' => array(
- 'shortopt' => 'Q',
- 'doc' => 'Be really quiet',
- ),
- 'slide' => array(
- 'shortopt' => 'F',
- 'doc' => 'Move (slide) tag if it exists',
- ),
- 'delete' => array(
- 'shortopt' => 'd',
- 'doc' => 'Remove tag',
- ),
- 'dry-run' => array(
- 'shortopt' => 'n',
- 'doc' => 'Don\'t do anything, just pretend',
- ),
- ),
- 'doc' => '<package.xml> [files...]
-Sets a CVS tag on all files in a package. Use this command after you have
-packaged a distribution tarball with the "package" command to tag what
-revisions of what files were in that release. If need to fix something
-after running cvstag once, but before the tarball is released to the public,
-use the "slide" option to move the release tag.
-
-to include files (such as a second package.xml, or tests not included in the
-release), pass them as additional parameters.
-',
- ),
- 'package-dependencies' => array(
- 'summary' => 'Show package dependencies',
- 'function' => 'doPackageDependencies',
- 'shortcut' => 'pd',
- 'options' => array(),
- 'doc' => '<package-file> or <package.xml> or <install-package-name>
-List all dependencies the package has.
-Can take a tgz / tar file, package.xml or a package name of an installed package.'
- ),
- 'sign' => array(
- 'summary' => 'Sign a package distribution file',
- 'function' => 'doSign',
- 'shortcut' => 'si',
- 'options' => array(
- 'verbose' => array(
- 'shortopt' => 'v',
- 'doc' => 'Display GnuPG output',
- ),
- ),
- 'doc' => '<package-file>
-Signs a package distribution (.tar or .tgz) file with GnuPG.',
- ),
- 'makerpm' => array(
- 'summary' => 'Builds an RPM spec file from a PEAR package',
- 'function' => 'doMakeRPM',
- 'shortcut' => 'rpm',
- 'options' => array(
- 'spec-template' => array(
- 'shortopt' => 't',
- 'arg' => 'FILE',
- 'doc' => 'Use FILE as RPM spec file template'
- ),
- 'rpm-pkgname' => array(
- 'shortopt' => 'p',
- 'arg' => 'FORMAT',
- 'doc' => 'Use FORMAT as format string for RPM package name, %s is replaced
-by the PEAR package name, defaults to "PEAR::%s".',
- ),
- ),
- 'doc' => '<package-file>
-
-Creates an RPM .spec file for wrapping a PEAR package inside an RPM
-package. Intended to be used from the SPECS directory, with the PEAR
-package tarball in the SOURCES directory:
-
-$ pear makerpm ../SOURCES/Net_Socket-1.0.tgz
-Wrote RPM spec file PEAR::Net_Geo-1.0.spec
-$ rpm -bb PEAR::Net_Socket-1.0.spec
-...
-Wrote: /usr/src/redhat/RPMS/i386/PEAR::Net_Socket-1.0-1.i386.rpm
-',
- ),
- 'convert' => array(
- 'summary' => 'Convert a package.xml 1.0 to package.xml 2.0 format',
- 'function' => 'doConvert',
- 'shortcut' => 'c2',
- 'options' => array(
- 'flat' => array(
- 'shortopt' => 'f',
- 'doc' => 'do not beautify the filelist.',
- ),
- ),
- 'doc' => '[descfile] [descfile2]
-Converts a package.xml in 1.0 format into a package.xml
-in 2.0 format. The new file will be named package2.xml by default,
-and package.xml will be used as the old file by default.
-This is not the most intelligent conversion, and should only be
-used for automated conversion or learning the format.
-'
- ),
- );
-
- var $output;
-
- /**
- * PEAR_Command_Package constructor.
- *
- * @access public
- */
- function PEAR_Command_Package(&$ui, &$config)
- {
- parent::PEAR_Command_Common($ui, $config);
- }
-
- function _displayValidationResults($err, $warn, $strict = false)
- {
- foreach ($err as $e) {
- $this->output .= "Error: $e\n";
- }
- foreach ($warn as $w) {
- $this->output .= "Warning: $w\n";
- }
- $this->output .= sprintf('Validation: %d error(s), %d warning(s)'."\n",
- sizeof($err), sizeof($warn));
- if ($strict && count($err) > 0) {
- $this->output .= "Fix these errors and try again.";
- return false;
- }
- return true;
- }
-
- function &getPackager()
- {
- if (!class_exists('PEAR_Packager')) {
- require_once 'PEAR/Packager.php';
- }
- $a = &new PEAR_Packager;
- return $a;
- }
-
- function &getPackageFile($config, $debug = false)
- {
- if (!class_exists('PEAR_Common')) {
- require_once 'PEAR/Common.php';
- }
- if (!class_exists('PEAR_PackageFile')) {
- require_once 'PEAR/PackageFile.php';
- }
- $a = &new PEAR_PackageFile($config, $debug);
- $common = new PEAR_Common;
- $common->ui = $this->ui;
- $a->setLogger($common);
- return $a;
- }
-
- function doPackage($command, $options, $params)
- {
- $this->output = '';
- $pkginfofile = isset($params[0]) ? $params[0] : 'package.xml';
- $pkg2 = isset($params[1]) ? $params[1] : null;
- if (!$pkg2 && !isset($params[0]) && file_exists('package2.xml')) {
- $pkg2 = 'package2.xml';
- }
-
- $packager = &$this->getPackager();
- $compress = empty($options['nocompress']) ? true : false;
- $result = $packager->package($pkginfofile, $compress, $pkg2);
- if (PEAR::isError($result)) {
- return $this->raiseError($result);
- }
-
- // Don't want output, only the package file name just created
- if (isset($options['showname'])) {
- $this->output = $result;
- }
-
- if ($this->output) {
- $this->ui->outputData($this->output, $command);
- }
-
- return true;
- }
-
- function doPackageValidate($command, $options, $params)
- {
- $this->output = '';
- if (count($params) < 1) {
- $params[0] = 'package.xml';
- }
-
- $obj = &$this->getPackageFile($this->config, $this->_debug);
- $obj->rawReturn();
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- $info = $obj->fromTgzFile($params[0], PEAR_VALIDATE_NORMAL);
- if (PEAR::isError($info)) {
- $info = $obj->fromPackageFile($params[0], PEAR_VALIDATE_NORMAL);
- } else {
- $archive = $info->getArchiveFile();
- $tar = &new Archive_Tar($archive);
- $tar->extract(dirname($info->getPackageFile()));
- $info->setPackageFile(dirname($info->getPackageFile()) . DIRECTORY_SEPARATOR .
- $info->getPackage() . '-' . $info->getVersion() . DIRECTORY_SEPARATOR .
- basename($info->getPackageFile()));
- }
-
- PEAR::staticPopErrorHandling();
- if (PEAR::isError($info)) {
- return $this->raiseError($info);
- }
-
- $valid = false;
- if ($info->getPackagexmlVersion() == '2.0') {
- if ($valid = $info->validate(PEAR_VALIDATE_NORMAL)) {
- $info->flattenFileList();
- $valid = $info->validate(PEAR_VALIDATE_PACKAGING);
- }
- } else {
- $valid = $info->validate(PEAR_VALIDATE_PACKAGING);
- }
-
- $err = $warn = array();
- if ($errors = $info->getValidationWarnings()) {
- foreach ($errors as $error) {
- if ($error['level'] == 'warning') {
- $warn[] = $error['message'];
- } else {
- $err[] = $error['message'];
- }
- }
- }
-
- $this->_displayValidationResults($err, $warn);
- $this->ui->outputData($this->output, $command);
- return true;
- }
-
- function doSvnTag($command, $options, $params)
- {
- $this->output = '';
- $_cmd = $command;
- if (count($params) < 1) {
- $help = $this->getHelp($command);
- return $this->raiseError("$command: missing parameter: $help[0]");
- }
-
- $packageFile = realpath($params[0]);
- $dir = dirname($packageFile);
- $dir = substr($dir, strrpos($dir, DIRECTORY_SEPARATOR) + 1);
- $obj = &$this->getPackageFile($this->config, $this->_debug);
- $info = $obj->fromAnyFile($packageFile, PEAR_VALIDATE_NORMAL);
- if (PEAR::isError($info)) {
- return $this->raiseError($info);
- }
-
- $err = $warn = array();
- if (!$info->validate()) {
- foreach ($info->getValidationWarnings() as $error) {
- if ($error['level'] == 'warning') {
- $warn[] = $error['message'];
- } else {
- $err[] = $error['message'];
- }
- }
- }
-
- if (!$this->_displayValidationResults($err, $warn, true)) {
- $this->ui->outputData($this->output, $command);
- return $this->raiseError('SVN tag failed');
- }
-
- $version = $info->getVersion();
- $package = $info->getName();
- $svntag = "$package-$version";
-
- if (isset($options['delete'])) {
- return $this->_svnRemoveTag($version, $package, $svntag, $packageFile, $options);
- }
-
- $path = $this->_svnFindPath($packageFile);
-
- // Check if there are any modified files
- $fp = popen('svn st --xml ' . dirname($packageFile), "r");
- $out = '';
- while ($line = fgets($fp, 1024)) {
- $out .= rtrim($line)."\n";
- }
- pclose($fp);
-
- if (!isset($options['quiet']) && strpos($out, 'item="modified"')) {
- $params = array(array(
- 'name' => 'modified',
- 'type' => 'yesno',
- 'default' => 'no',
- 'prompt' => 'You have files in your SVN checkout (' . $path['from'] . ') that have been modified but not commited, do you still want to tag ' . $version . '?',
- ));
- $answers = $this->ui->confirmDialog($params);
-
- if (!in_array($answers['modified'], array('y', 'yes', 'on', '1'))) {
- return true;
- }
- }
-
- if (isset($options['slide'])) {
- $this->_svnRemoveTag($version, $package, $svntag, $packageFile, $options);
- }
-
- // Check if tag already exists
- $releaseTag = $path['local']['base'] . 'tags' . DIRECTORY_SEPARATOR . $svntag;
- $existsCommand = 'svn ls ' . $path['base'] . 'tags/';
-
- $fp = popen($existsCommand, "r");
- $out = '';
- while ($line = fgets($fp, 1024)) {
- $out .= rtrim($line)."\n";
- }
- pclose($fp);
-
- if (in_array($svntag . DIRECTORY_SEPARATOR, explode("\n", $out))) {
- $this->ui->outputData($this->output, $command);
- return $this->raiseError('SVN tag ' . $svntag . ' for ' . $package . ' already exists.');
- } elseif (file_exists($path['local']['base'] . 'tags') === false) {
- return $this->raiseError('Can not locate the tags directory at ' . $path['local']['base'] . 'tags');
- } elseif (is_writeable($path['local']['base'] . 'tags') === false) {
- return $this->raiseError('Can not write to the tag directory at ' . $path['local']['base'] . 'tags');
- } else {
- $makeCommand = 'svn mkdir ' . $releaseTag;
- $this->output .= "+ $makeCommand\n";
- if (empty($options['dry-run'])) {
- // We need to create the tag dir.
- $fp = popen($makeCommand, "r");
- $out = '';
- while ($line = fgets($fp, 1024)) {
- $out .= rtrim($line)."\n";
- }
- pclose($fp);
- $this->output .= "$out\n";
- }
- }
-
- $command = 'svn';
- if (isset($options['quiet'])) {
- $command .= ' -q';
- }
-
- $command .= ' copy --parents ';
-
- $dir = dirname($packageFile);
- $dir = substr($dir, strrpos($dir, DIRECTORY_SEPARATOR) + 1);
- $files = array_keys($info->getFilelist());
- if (!in_array(basename($packageFile), $files)) {
- $files[] = basename($packageFile);
- }
-
- array_shift($params);
- if (count($params)) {
- // add in additional files to be tagged (package files and such)
- $files = array_merge($files, $params);
- }
-
- $commands = array();
- foreach ($files as $file) {
- if (!file_exists($file)) {
- $file = $dir . DIRECTORY_SEPARATOR . $file;
- }
- $commands[] = $command . ' ' . escapeshellarg($file) . ' ' .
- escapeshellarg($releaseTag . DIRECTORY_SEPARATOR . $file);
- }
-
- $this->output .= implode("\n", $commands) . "\n";
- if (empty($options['dry-run'])) {
- foreach ($commands as $command) {
- $fp = popen($command, "r");
- while ($line = fgets($fp, 1024)) {
- $this->output .= rtrim($line)."\n";
- }
- pclose($fp);
- }
- }
-
- $command = 'svn ci -m "Tagging the ' . $version . ' release" ' . $releaseTag . "\n";
- $this->output .= "+ $command\n";
- if (empty($options['dry-run'])) {
- $fp = popen($command, "r");
- while ($line = fgets($fp, 1024)) {
- $this->output .= rtrim($line)."\n";
- }
- pclose($fp);
- }
-
- $this->ui->outputData($this->output, $_cmd);
- return true;
- }
-
- function _svnFindPath($file)
- {
- $xml = '';
- $command = "svn info --xml $file";
- $fp = popen($command, "r");
- while ($line = fgets($fp, 1024)) {
- $xml .= rtrim($line)."\n";
- }
- pclose($fp);
- $url_tag = strpos($xml, '<url>');
- $url = substr($xml, $url_tag + 5, strpos($xml, '</url>', $url_tag + 5) - ($url_tag + 5));
-
- $path = array();
- $path['from'] = substr($url, 0, strrpos($url, '/'));
- $path['base'] = substr($path['from'], 0, strrpos($path['from'], '/') + 1);
-
- // Figure out the local paths - see http://pear.php.net/bugs/17463
- $pos = strpos($file, DIRECTORY_SEPARATOR . 'trunk' . DIRECTORY_SEPARATOR);
- if ($pos === false) {
- $pos = strpos($file, DIRECTORY_SEPARATOR . 'branches' . DIRECTORY_SEPARATOR);
- }
- $path['local']['base'] = substr($file, 0, $pos + 1);
-
- return $path;
- }
-
- function _svnRemoveTag($version, $package, $tag, $packageFile, $options)
- {
- $command = 'svn';
-
- if (isset($options['quiet'])) {
- $command .= ' -q';
- }
-
- $command .= ' remove';
- $command .= ' -m "Removing tag for the ' . $version . ' release."';
-
- $path = $this->_svnFindPath($packageFile);
- $command .= ' ' . $path['base'] . 'tags/' . $tag;
-
-
- if ($this->config->get('verbose') > 1) {
- $this->output .= "+ $command\n";
- }
-
- $this->output .= "+ $command\n";
- if (empty($options['dry-run'])) {
- $fp = popen($command, "r");
- while ($line = fgets($fp, 1024)) {
- $this->output .= rtrim($line)."\n";
- }
- pclose($fp);
- }
-
- $this->ui->outputData($this->output, $command);
- return true;
- }
-
- function doCvsTag($command, $options, $params)
- {
- $this->output = '';
- $_cmd = $command;
- if (count($params) < 1) {
- $help = $this->getHelp($command);
- return $this->raiseError("$command: missing parameter: $help[0]");
- }
-
- $packageFile = realpath($params[0]);
- $obj = &$this->getPackageFile($this->config, $this->_debug);
- $info = $obj->fromAnyFile($packageFile, PEAR_VALIDATE_NORMAL);
- if (PEAR::isError($info)) {
- return $this->raiseError($info);
- }
-
- $err = $warn = array();
- if (!$info->validate()) {
- foreach ($info->getValidationWarnings() as $error) {
- if ($error['level'] == 'warning') {
- $warn[] = $error['message'];
- } else {
- $err[] = $error['message'];
- }
- }
- }
-
- if (!$this->_displayValidationResults($err, $warn, true)) {
- $this->ui->outputData($this->output, $command);
- return $this->raiseError('CVS tag failed');
- }
-
- $version = $info->getVersion();
- $cvsversion = preg_replace('/[^a-z0-9]/i', '_', $version);
- $cvstag = "RELEASE_$cvsversion";
- $files = array_keys($info->getFilelist());
- $command = 'cvs';
- if (isset($options['quiet'])) {
- $command .= ' -q';
- }
-
- if (isset($options['reallyquiet'])) {
- $command .= ' -Q';
- }
-
- $command .= ' tag';
- if (isset($options['slide'])) {
- $command .= ' -F';
- }
-
- if (isset($options['delete'])) {
- $command .= ' -d';
- }
-
- $command .= ' ' . $cvstag . ' ' . escapeshellarg($params[0]);
- array_shift($params);
- if (count($params)) {
- // add in additional files to be tagged
- $files = array_merge($files, $params);
- }
-
- $dir = dirname($packageFile);
- $dir = substr($dir, strrpos($dir, '/') + 1);
- foreach ($files as $file) {
- if (!file_exists($file)) {
- $file = $dir . DIRECTORY_SEPARATOR . $file;
- }
- $command .= ' ' . escapeshellarg($file);
- }
-
- if ($this->config->get('verbose') > 1) {
- $this->output .= "+ $command\n";
- }
-
- $this->output .= "+ $command\n";
- if (empty($options['dry-run'])) {
- $fp = popen($command, "r");
- while ($line = fgets($fp, 1024)) {
- $this->output .= rtrim($line)."\n";
- }
- pclose($fp);
- }
-
- $this->ui->outputData($this->output, $_cmd);
- return true;
- }
-
- function doCvsDiff($command, $options, $params)
- {
- $this->output = '';
- if (sizeof($params) < 1) {
- $help = $this->getHelp($command);
- return $this->raiseError("$command: missing parameter: $help[0]");
- }
-
- $file = realpath($params[0]);
- $obj = &$this->getPackageFile($this->config, $this->_debug);
- $info = $obj->fromAnyFile($file, PEAR_VALIDATE_NORMAL);
- if (PEAR::isError($info)) {
- return $this->raiseError($info);
- }
-
- $err = $warn = array();
- if (!$info->validate()) {
- foreach ($info->getValidationWarnings() as $error) {
- if ($error['level'] == 'warning') {
- $warn[] = $error['message'];
- } else {
- $err[] = $error['message'];
- }
- }
- }
-
- if (!$this->_displayValidationResults($err, $warn, true)) {
- $this->ui->outputData($this->output, $command);
- return $this->raiseError('CVS diff failed');
- }
-
- $info1 = $info->getFilelist();
- $files = $info1;
- $cmd = "cvs";
- if (isset($options['quiet'])) {
- $cmd .= ' -q';
- unset($options['quiet']);
- }
-
- if (isset($options['reallyquiet'])) {
- $cmd .= ' -Q';
- unset($options['reallyquiet']);
- }
-
- if (isset($options['release'])) {
- $cvsversion = preg_replace('/[^a-z0-9]/i', '_', $options['release']);
- $cvstag = "RELEASE_$cvsversion";
- $options['revision'] = $cvstag;
- unset($options['release']);
- }
-
- $execute = true;
- if (isset($options['dry-run'])) {
- $execute = false;
- unset($options['dry-run']);
- }
-
- $cmd .= ' diff';
- // the rest of the options are passed right on to "cvs diff"
- foreach ($options as $option => $optarg) {
- $arg = $short = false;
- if (isset($this->commands[$command]['options'][$option])) {
- $arg = $this->commands[$command]['options'][$option]['arg'];
- $short = $this->commands[$command]['options'][$option]['shortopt'];
- }
- $cmd .= $short ? " -$short" : " --$option";
- if ($arg && $optarg) {
- $cmd .= ($short ? '' : '=') . escapeshellarg($optarg);
- }
- }
-
- foreach ($files as $file) {
- $cmd .= ' ' . escapeshellarg($file['name']);
- }
-
- if ($this->config->get('verbose') > 1) {
- $this->output .= "+ $cmd\n";
- }
-
- if ($execute) {
- $fp = popen($cmd, "r");
- while ($line = fgets($fp, 1024)) {
- $this->output .= rtrim($line)."\n";
- }
- pclose($fp);
- }
-
- $this->ui->outputData($this->output, $command);
- return true;
- }
-
- function doPackageDependencies($command, $options, $params)
- {
- // $params[0] -> the PEAR package to list its information
- if (count($params) !== 1) {
- return $this->raiseError("bad parameter(s), try \"help $command\"");
- }
-
- $obj = &$this->getPackageFile($this->config, $this->_debug);
- if (is_file($params[0]) || strpos($params[0], '.xml') > 0) {
- $info = $obj->fromAnyFile($params[0], PEAR_VALIDATE_NORMAL);
- } else {
- $reg = $this->config->getRegistry();
- $info = $obj->fromArray($reg->packageInfo($params[0]));
- }
-
- if (PEAR::isError($info)) {
- return $this->raiseError($info);
- }
-
- $deps = $info->getDeps();
- if (is_array($deps)) {
- if ($info->getPackagexmlVersion() == '1.0') {
- $data = array(
- 'caption' => 'Dependencies for pear/' . $info->getPackage(),
- 'border' => true,
- 'headline' => array("Required?", "Type", "Name", "Relation", "Version"),
- );
-
- foreach ($deps as $d) {
- if (isset($d['optional'])) {
- if ($d['optional'] == 'yes') {
- $req = 'No';
- } else {
- $req = 'Yes';
- }
- } else {
- $req = 'Yes';
- }
-
- if (isset($this->_deps_rel_trans[$d['rel']])) {
- $rel = $this->_deps_rel_trans[$d['rel']];
- } else {
- $rel = $d['rel'];
- }
-
- if (isset($this->_deps_type_trans[$d['type']])) {
- $type = ucfirst($this->_deps_type_trans[$d['type']]);
- } else {
- $type = $d['type'];
- }
-
- if (isset($d['name'])) {
- $name = $d['name'];
- } else {
- $name = '';
- }
-
- if (isset($d['version'])) {
- $version = $d['version'];
- } else {
- $version = '';
- }
-
- $data['data'][] = array($req, $type, $name, $rel, $version);
- }
- } else { // package.xml 2.0 dependencies display
- require_once 'PEAR/Dependency2.php';
- $deps = $info->getDependencies();
- $reg = &$this->config->getRegistry();
- if (is_array($deps)) {
- $d = new PEAR_Dependency2($this->config, array(), '');
- $data = array(
- 'caption' => 'Dependencies for ' . $info->getPackage(),
- 'border' => true,
- 'headline' => array("Required?", "Type", "Name", 'Versioning', 'Group'),
- );
- foreach ($deps as $type => $subd) {
- $req = ($type == 'required') ? 'Yes' : 'No';
- if ($type == 'group') {
- $group = $subd['attribs']['name'];
- } else {
- $group = '';
- }
-
- if (!isset($subd[0])) {
- $subd = array($subd);
- }
-
- foreach ($subd as $groupa) {
- foreach ($groupa as $deptype => $depinfo) {
- if ($deptype == 'attribs') {
- continue;
- }
-
- if ($deptype == 'pearinstaller') {
- $deptype = 'pear Installer';
- }
-
- if (!isset($depinfo[0])) {
- $depinfo = array($depinfo);
- }
-
- foreach ($depinfo as $inf) {
- $name = '';
- if (isset($inf['channel'])) {
- $alias = $reg->channelAlias($inf['channel']);
- if (!$alias) {
- $alias = '(channel?) ' .$inf['channel'];
- }
- $name = $alias . '/';
-
- }
- if (isset($inf['name'])) {
- $name .= $inf['name'];
- } elseif (isset($inf['pattern'])) {
- $name .= $inf['pattern'];
- } else {
- $name .= '';
- }
-
- if (isset($inf['uri'])) {
- $name .= ' [' . $inf['uri'] . ']';
- }
-
- if (isset($inf['conflicts'])) {
- $ver = 'conflicts';
- } else {
- $ver = $d->_getExtraString($inf);
- }
-
- $data['data'][] = array($req, ucfirst($deptype), $name,
- $ver, $group);
- }
- }
- }
- }
- }
- }
-
- $this->ui->outputData($data, $command);
- return true;
- }
-
- // Fallback
- $this->ui->outputData("This package does not have any dependencies.", $command);
- }
-
- function doSign($command, $options, $params)
- {
- // should move most of this code into PEAR_Packager
- // so it'll be easy to implement "pear package --sign"
- if (count($params) !== 1) {
- return $this->raiseError("bad parameter(s), try \"help $command\"");
- }
-
- require_once 'System.php';
- require_once 'Archive/Tar.php';
-
- if (!file_exists($params[0])) {
- return $this->raiseError("file does not exist: $params[0]");
- }
-
- $obj = $this->getPackageFile($this->config, $this->_debug);
- $info = $obj->fromTgzFile($params[0], PEAR_VALIDATE_NORMAL);
- if (PEAR::isError($info)) {
- return $this->raiseError($info);
- }
-
- $tar = new Archive_Tar($params[0]);
-
- $tmpdir = $this->config->get('temp_dir');
- $tmpdir = System::mktemp(' -t "' . $tmpdir . '" -d pearsign');
- if (!$tar->extractList('package2.xml package.xml package.sig', $tmpdir)) {
- return $this->raiseError("failed to extract tar file");
- }
-
- if (file_exists("$tmpdir/package.sig")) {
- return $this->raiseError("package already signed");
- }
-
- $packagexml = 'package.xml';
- if (file_exists("$tmpdir/package2.xml")) {
- $packagexml = 'package2.xml';
- }
-
- if (file_exists("$tmpdir/package.sig")) {
- unlink("$tmpdir/package.sig");
- }
-
- if (!file_exists("$tmpdir/$packagexml")) {
- return $this->raiseError("Extracted file $tmpdir/$packagexml not found.");
- }
-
- $input = $this->ui->userDialog($command,
- array('GnuPG Passphrase'),
- array('password'));
- if (!isset($input[0])) {
- //use empty passphrase
- $input[0] = '';
- }
-
- $devnull = (isset($options['verbose'])) ? '' : ' 2>/dev/null';
- $gpg = popen("gpg --batch --passphrase-fd 0 --armor --detach-sign --output $tmpdir/package.sig $tmpdir/$packagexml" . $devnull, "w");
- if (!$gpg) {
- return $this->raiseError("gpg command failed");
- }
-
- fwrite($gpg, "$input[0]\n");
- if (pclose($gpg) || !file_exists("$tmpdir/package.sig")) {
- return $this->raiseError("gpg sign failed");
- }
-
- if (!$tar->addModify("$tmpdir/package.sig", '', $tmpdir)) {
- return $this->raiseError('failed adding signature to file');
- }
-
- $this->ui->outputData("Package signed.", $command);
- return true;
- }
-
- /**
- * For unit testing purposes
- */
- function &getInstaller(&$ui)
- {
- if (!class_exists('PEAR_Installer')) {
- require_once 'PEAR/Installer.php';
- }
- $a = &new PEAR_Installer($ui);
- return $a;
- }
-
- /**
- * For unit testing purposes
- */
- function &getCommandPackaging(&$ui, &$config)
- {
- if (!class_exists('PEAR_Command_Packaging')) {
- if ($fp = @fopen('PEAR/Command/Packaging.php', 'r', true)) {
- fclose($fp);
- include_once 'PEAR/Command/Packaging.php';
- }
- }
-
- if (class_exists('PEAR_Command_Packaging')) {
- $a = &new PEAR_Command_Packaging($ui, $config);
- } else {
- $a = null;
- }
-
- return $a;
- }
-
- function doMakeRPM($command, $options, $params)
- {
-
- // Check to see if PEAR_Command_Packaging is installed, and
- // transparently switch to use the "make-rpm-spec" command from it
- // instead, if it does. Otherwise, continue to use the old version
- // of "makerpm" supplied with this package (PEAR).
- $packaging_cmd = $this->getCommandPackaging($this->ui, $this->config);
- if ($packaging_cmd !== null) {
- $this->ui->outputData('PEAR_Command_Packaging is installed; using '.
- 'newer "make-rpm-spec" command instead');
- return $packaging_cmd->run('make-rpm-spec', $options, $params);
- }
-
- $this->ui->outputData('WARNING: "pear makerpm" is no longer available; an '.
- 'improved version is available via "pear make-rpm-spec", which '.
- 'is available by installing PEAR_Command_Packaging');
- return true;
- }
-
- function doConvert($command, $options, $params)
- {
- $packagexml = isset($params[0]) ? $params[0] : 'package.xml';
- $newpackagexml = isset($params[1]) ? $params[1] : dirname($packagexml) .
- DIRECTORY_SEPARATOR . 'package2.xml';
- $pkg = &$this->getPackageFile($this->config, $this->_debug);
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- $pf = $pkg->fromPackageFile($packagexml, PEAR_VALIDATE_NORMAL);
- PEAR::staticPopErrorHandling();
- if (PEAR::isError($pf)) {
- if (is_array($pf->getUserInfo())) {
- foreach ($pf->getUserInfo() as $warning) {
- $this->ui->outputData($warning['message']);
- }
- }
- return $this->raiseError($pf);
- }
-
- if (is_a($pf, 'PEAR_PackageFile_v2')) {
- $this->ui->outputData($packagexml . ' is already a package.xml version 2.0');
- return true;
- }
-
- $gen = &$pf->getDefaultGenerator();
- $newpf = &$gen->toV2();
- $newpf->setPackagefile($newpackagexml);
- $gen = &$newpf->getDefaultGenerator();
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- $state = (isset($options['flat']) ? PEAR_VALIDATE_PACKAGING : PEAR_VALIDATE_NORMAL);
- $saved = $gen->toPackageFile(dirname($newpackagexml), $state, basename($newpackagexml));
- PEAR::staticPopErrorHandling();
- if (PEAR::isError($saved)) {
- if (is_array($saved->getUserInfo())) {
- foreach ($saved->getUserInfo() as $warning) {
- $this->ui->outputData($warning['message']);
- }
- }
-
- $this->ui->outputData($saved->getMessage());
- return true;
- }
-
- $this->ui->outputData('Wrote new version 2.0 package.xml to "' . $saved . '"');
- return true;
- }
-} \ No newline at end of file
diff --git a/3rdparty/PEAR/Command/Package.xml b/3rdparty/PEAR/Command/Package.xml
deleted file mode 100644
index d1aff9d48de..00000000000
--- a/3rdparty/PEAR/Command/Package.xml
+++ /dev/null
@@ -1,237 +0,0 @@
-<commands version="1.0">
- <package>
- <summary>Build Package</summary>
- <function>doPackage</function>
- <shortcut>p</shortcut>
- <options>
- <nocompress>
- <shortopt>Z</shortopt>
- <doc>Do not gzip the package file</doc>
- </nocompress>
- <showname>
- <shortopt>n</shortopt>
- <doc>Print the name of the packaged file.</doc>
- </showname>
- </options>
- <doc>[descfile] [descfile2]
-Creates a PEAR package from its description file (usually called
-package.xml). If a second packagefile is passed in, then
-the packager will check to make sure that one is a package.xml
-version 1.0, and the other is a package.xml version 2.0. The
-package.xml version 1.0 will be saved as &quot;package.xml&quot; in the archive,
-and the other as &quot;package2.xml&quot; in the archive&quot;
-</doc>
- </package>
- <package-validate>
- <summary>Validate Package Consistency</summary>
- <function>doPackageValidate</function>
- <shortcut>pv</shortcut>
- <options />
- <doc>
-</doc>
- </package-validate>
- <cvsdiff>
- <summary>Run a &quot;cvs diff&quot; for all files in a package</summary>
- <function>doCvsDiff</function>
- <shortcut>cd</shortcut>
- <options>
- <quiet>
- <shortopt>q</shortopt>
- <doc>Be quiet</doc>
- </quiet>
- <reallyquiet>
- <shortopt>Q</shortopt>
- <doc>Be really quiet</doc>
- </reallyquiet>
- <date>
- <shortopt>D</shortopt>
- <doc>Diff against revision of DATE</doc>
- <arg>DATE</arg>
- </date>
- <release>
- <shortopt>R</shortopt>
- <doc>Diff against tag for package release REL</doc>
- <arg>REL</arg>
- </release>
- <revision>
- <shortopt>r</shortopt>
- <doc>Diff against revision REV</doc>
- <arg>REV</arg>
- </revision>
- <context>
- <shortopt>c</shortopt>
- <doc>Generate context diff</doc>
- </context>
- <unified>
- <shortopt>u</shortopt>
- <doc>Generate unified diff</doc>
- </unified>
- <ignore-case>
- <shortopt>i</shortopt>
- <doc>Ignore case, consider upper- and lower-case letters equivalent</doc>
- </ignore-case>
- <ignore-whitespace>
- <shortopt>b</shortopt>
- <doc>Ignore changes in amount of white space</doc>
- </ignore-whitespace>
- <ignore-blank-lines>
- <shortopt>B</shortopt>
- <doc>Ignore changes that insert or delete blank lines</doc>
- </ignore-blank-lines>
- <brief>
- <shortopt></shortopt>
- <doc>Report only whether the files differ, no details</doc>
- </brief>
- <dry-run>
- <shortopt>n</shortopt>
- <doc>Don&#039;t do anything, just pretend</doc>
- </dry-run>
- </options>
- <doc>&lt;package.xml&gt;
-Compares all the files in a package. Without any options, this
-command will compare the current code with the last checked-in code.
-Using the -r or -R option you may compare the current code with that
-of a specific release.
-</doc>
- </cvsdiff>
- <svntag>
- <summary>Set SVN Release Tag</summary>
- <function>doSvnTag</function>
- <shortcut>sv</shortcut>
- <options>
- <quiet>
- <shortopt>q</shortopt>
- <doc>Be quiet</doc>
- </quiet>
- <slide>
- <shortopt>F</shortopt>
- <doc>Move (slide) tag if it exists</doc>
- </slide>
- <delete>
- <shortopt>d</shortopt>
- <doc>Remove tag</doc>
- </delete>
- <dry-run>
- <shortopt>n</shortopt>
- <doc>Don&#039;t do anything, just pretend</doc>
- </dry-run>
- </options>
- <doc>&lt;package.xml&gt; [files...]
- Sets a SVN tag on all files in a package. Use this command after you have
- packaged a distribution tarball with the &quot;package&quot; command to tag what
- revisions of what files were in that release. If need to fix something
- after running svntag once, but before the tarball is released to the public,
- use the &quot;slide&quot; option to move the release tag.
-
- to include files (such as a second package.xml, or tests not included in the
- release), pass them as additional parameters.
- </doc>
- </svntag>
- <cvstag>
- <summary>Set CVS Release Tag</summary>
- <function>doCvsTag</function>
- <shortcut>ct</shortcut>
- <options>
- <quiet>
- <shortopt>q</shortopt>
- <doc>Be quiet</doc>
- </quiet>
- <reallyquiet>
- <shortopt>Q</shortopt>
- <doc>Be really quiet</doc>
- </reallyquiet>
- <slide>
- <shortopt>F</shortopt>
- <doc>Move (slide) tag if it exists</doc>
- </slide>
- <delete>
- <shortopt>d</shortopt>
- <doc>Remove tag</doc>
- </delete>
- <dry-run>
- <shortopt>n</shortopt>
- <doc>Don&#039;t do anything, just pretend</doc>
- </dry-run>
- </options>
- <doc>&lt;package.xml&gt; [files...]
-Sets a CVS tag on all files in a package. Use this command after you have
-packaged a distribution tarball with the &quot;package&quot; command to tag what
-revisions of what files were in that release. If need to fix something
-after running cvstag once, but before the tarball is released to the public,
-use the &quot;slide&quot; option to move the release tag.
-
-to include files (such as a second package.xml, or tests not included in the
-release), pass them as additional parameters.
-</doc>
- </cvstag>
- <package-dependencies>
- <summary>Show package dependencies</summary>
- <function>doPackageDependencies</function>
- <shortcut>pd</shortcut>
- <options />
- <doc>&lt;package-file&gt; or &lt;package.xml&gt; or &lt;install-package-name&gt;
-List all dependencies the package has.
-Can take a tgz / tar file, package.xml or a package name of an installed package.</doc>
- </package-dependencies>
- <sign>
- <summary>Sign a package distribution file</summary>
- <function>doSign</function>
- <shortcut>si</shortcut>
- <options>
- <verbose>
- <shortopt>v</shortopt>
- <doc>Display GnuPG output</doc>
- </verbose>
- </options>
- <doc>&lt;package-file&gt;
-Signs a package distribution (.tar or .tgz) file with GnuPG.</doc>
- </sign>
- <makerpm>
- <summary>Builds an RPM spec file from a PEAR package</summary>
- <function>doMakeRPM</function>
- <shortcut>rpm</shortcut>
- <options>
- <spec-template>
- <shortopt>t</shortopt>
- <doc>Use FILE as RPM spec file template</doc>
- <arg>FILE</arg>
- </spec-template>
- <rpm-pkgname>
- <shortopt>p</shortopt>
- <doc>Use FORMAT as format string for RPM package name, %s is replaced
-by the PEAR package name, defaults to &quot;PEAR::%s&quot;.</doc>
- <arg>FORMAT</arg>
- </rpm-pkgname>
- </options>
- <doc>&lt;package-file&gt;
-
-Creates an RPM .spec file for wrapping a PEAR package inside an RPM
-package. Intended to be used from the SPECS directory, with the PEAR
-package tarball in the SOURCES directory:
-
-$ pear makerpm ../SOURCES/Net_Socket-1.0.tgz
-Wrote RPM spec file PEAR::Net_Geo-1.0.spec
-$ rpm -bb PEAR::Net_Socket-1.0.spec
-...
-Wrote: /usr/src/redhat/RPMS/i386/PEAR::Net_Socket-1.0-1.i386.rpm
-</doc>
- </makerpm>
- <convert>
- <summary>Convert a package.xml 1.0 to package.xml 2.0 format</summary>
- <function>doConvert</function>
- <shortcut>c2</shortcut>
- <options>
- <flat>
- <shortopt>f</shortopt>
- <doc>do not beautify the filelist.</doc>
- </flat>
- </options>
- <doc>[descfile] [descfile2]
-Converts a package.xml in 1.0 format into a package.xml
-in 2.0 format. The new file will be named package2.xml by default,
-and package.xml will be used as the old file by default.
-This is not the most intelligent conversion, and should only be
-used for automated conversion or learning the format.
-</doc>
- </convert>
-</commands> \ No newline at end of file
diff --git a/3rdparty/PEAR/Command/Pickle.php b/3rdparty/PEAR/Command/Pickle.php
deleted file mode 100644
index 87aa25ea30c..00000000000
--- a/3rdparty/PEAR/Command/Pickle.php
+++ /dev/null
@@ -1,421 +0,0 @@
-<?php
-/**
- * PEAR_Command_Pickle (pickle command)
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 2005-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Pickle.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.1
- */
-
-/**
- * base class
- */
-require_once 'PEAR/Command/Common.php';
-
-/**
- * PEAR commands for login/logout
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 2005-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.1
- */
-
-class PEAR_Command_Pickle extends PEAR_Command_Common
-{
- var $commands = array(
- 'pickle' => array(
- 'summary' => 'Build PECL Package',
- 'function' => 'doPackage',
- 'shortcut' => 'pi',
- 'options' => array(
- 'nocompress' => array(
- 'shortopt' => 'Z',
- 'doc' => 'Do not gzip the package file'
- ),
- 'showname' => array(
- 'shortopt' => 'n',
- 'doc' => 'Print the name of the packaged file.',
- ),
- ),
- 'doc' => '[descfile]
-Creates a PECL package from its package2.xml file.
-
-An automatic conversion will be made to a package.xml 1.0 and written out to
-disk in the current directory as "package.xml". Note that
-only simple package.xml 2.0 will be converted. package.xml 2.0 with:
-
- - dependency types other than required/optional PECL package/ext/php/pearinstaller
- - more than one extsrcrelease or zendextsrcrelease
- - zendextbinrelease, extbinrelease, phprelease, or bundle release type
- - dependency groups
- - ignore tags in release filelist
- - tasks other than replace
- - custom roles
-
-will cause pickle to fail, and output an error message. If your package2.xml
-uses any of these features, you are best off using PEAR_PackageFileManager to
-generate both package.xml.
-'
- ),
- );
-
- /**
- * PEAR_Command_Package constructor.
- *
- * @access public
- */
- function PEAR_Command_Pickle(&$ui, &$config)
- {
- parent::PEAR_Command_Common($ui, $config);
- }
-
- /**
- * For unit-testing ease
- *
- * @return PEAR_Packager
- */
- function &getPackager()
- {
- if (!class_exists('PEAR_Packager')) {
- require_once 'PEAR/Packager.php';
- }
-
- $a = &new PEAR_Packager;
- return $a;
- }
-
- /**
- * For unit-testing ease
- *
- * @param PEAR_Config $config
- * @param bool $debug
- * @param string|null $tmpdir
- * @return PEAR_PackageFile
- */
- function &getPackageFile($config, $debug = false)
- {
- if (!class_exists('PEAR_Common')) {
- require_once 'PEAR/Common.php';
- }
-
- if (!class_exists('PEAR_PackageFile')) {
- require_once 'PEAR/PackageFile.php';
- }
-
- $a = &new PEAR_PackageFile($config, $debug);
- $common = new PEAR_Common;
- $common->ui = $this->ui;
- $a->setLogger($common);
- return $a;
- }
-
- function doPackage($command, $options, $params)
- {
- $this->output = '';
- $pkginfofile = isset($params[0]) ? $params[0] : 'package2.xml';
- $packager = &$this->getPackager();
- if (PEAR::isError($err = $this->_convertPackage($pkginfofile))) {
- return $err;
- }
-
- $compress = empty($options['nocompress']) ? true : false;
- $result = $packager->package($pkginfofile, $compress, 'package.xml');
- if (PEAR::isError($result)) {
- return $this->raiseError($result);
- }
-
- // Don't want output, only the package file name just created
- if (isset($options['showname'])) {
- $this->ui->outputData($result, $command);
- }
-
- return true;
- }
-
- function _convertPackage($packagexml)
- {
- $pkg = &$this->getPackageFile($this->config);
- $pf2 = &$pkg->fromPackageFile($packagexml, PEAR_VALIDATE_NORMAL);
- if (!is_a($pf2, 'PEAR_PackageFile_v2')) {
- return $this->raiseError('Cannot process "' .
- $packagexml . '", is not a package.xml 2.0');
- }
-
- require_once 'PEAR/PackageFile/v1.php';
- $pf = new PEAR_PackageFile_v1;
- $pf->setConfig($this->config);
- if ($pf2->getPackageType() != 'extsrc' && $pf2->getPackageType() != 'zendextsrc') {
- return $this->raiseError('Cannot safely convert "' . $packagexml .
- '", is not an extension source package. Using a PEAR_PackageFileManager-based ' .
- 'script is an option');
- }
-
- if (is_array($pf2->getUsesRole())) {
- return $this->raiseError('Cannot safely convert "' . $packagexml .
- '", contains custom roles. Using a PEAR_PackageFileManager-based script or ' .
- 'the convert command is an option');
- }
-
- if (is_array($pf2->getUsesTask())) {
- return $this->raiseError('Cannot safely convert "' . $packagexml .
- '", contains custom tasks. Using a PEAR_PackageFileManager-based script or ' .
- 'the convert command is an option');
- }
-
- $deps = $pf2->getDependencies();
- if (isset($deps['group'])) {
- return $this->raiseError('Cannot safely convert "' . $packagexml .
- '", contains dependency groups. Using a PEAR_PackageFileManager-based script ' .
- 'or the convert command is an option');
- }
-
- if (isset($deps['required']['subpackage']) ||
- isset($deps['optional']['subpackage'])) {
- return $this->raiseError('Cannot safely convert "' . $packagexml .
- '", contains subpackage dependencies. Using a PEAR_PackageFileManager-based '.
- 'script is an option');
- }
-
- if (isset($deps['required']['os'])) {
- return $this->raiseError('Cannot safely convert "' . $packagexml .
- '", contains os dependencies. Using a PEAR_PackageFileManager-based '.
- 'script is an option');
- }
-
- if (isset($deps['required']['arch'])) {
- return $this->raiseError('Cannot safely convert "' . $packagexml .
- '", contains arch dependencies. Using a PEAR_PackageFileManager-based '.
- 'script is an option');
- }
-
- $pf->setPackage($pf2->getPackage());
- $pf->setSummary($pf2->getSummary());
- $pf->setDescription($pf2->getDescription());
- foreach ($pf2->getMaintainers() as $maintainer) {
- $pf->addMaintainer($maintainer['role'], $maintainer['handle'],
- $maintainer['name'], $maintainer['email']);
- }
-
- $pf->setVersion($pf2->getVersion());
- $pf->setDate($pf2->getDate());
- $pf->setLicense($pf2->getLicense());
- $pf->setState($pf2->getState());
- $pf->setNotes($pf2->getNotes());
- $pf->addPhpDep($deps['required']['php']['min'], 'ge');
- if (isset($deps['required']['php']['max'])) {
- $pf->addPhpDep($deps['required']['php']['max'], 'le');
- }
-
- if (isset($deps['required']['package'])) {
- if (!isset($deps['required']['package'][0])) {
- $deps['required']['package'] = array($deps['required']['package']);
- }
-
- foreach ($deps['required']['package'] as $dep) {
- if (!isset($dep['channel'])) {
- return $this->raiseError('Cannot safely convert "' . $packagexml . '"' .
- ' contains uri-based dependency on a package. Using a ' .
- 'PEAR_PackageFileManager-based script is an option');
- }
-
- if ($dep['channel'] != 'pear.php.net'
- && $dep['channel'] != 'pecl.php.net'
- && $dep['channel'] != 'doc.php.net') {
- return $this->raiseError('Cannot safely convert "' . $packagexml . '"' .
- ' contains dependency on a non-standard channel package. Using a ' .
- 'PEAR_PackageFileManager-based script is an option');
- }
-
- if (isset($dep['conflicts'])) {
- return $this->raiseError('Cannot safely convert "' . $packagexml . '"' .
- ' contains conflicts dependency. Using a ' .
- 'PEAR_PackageFileManager-based script is an option');
- }
-
- if (isset($dep['exclude'])) {
- $this->ui->outputData('WARNING: exclude tags are ignored in conversion');
- }
-
- if (isset($dep['min'])) {
- $pf->addPackageDep($dep['name'], $dep['min'], 'ge');
- }
-
- if (isset($dep['max'])) {
- $pf->addPackageDep($dep['name'], $dep['max'], 'le');
- }
- }
- }
-
- if (isset($deps['required']['extension'])) {
- if (!isset($deps['required']['extension'][0])) {
- $deps['required']['extension'] = array($deps['required']['extension']);
- }
-
- foreach ($deps['required']['extension'] as $dep) {
- if (isset($dep['conflicts'])) {
- return $this->raiseError('Cannot safely convert "' . $packagexml . '"' .
- ' contains conflicts dependency. Using a ' .
- 'PEAR_PackageFileManager-based script is an option');
- }
-
- if (isset($dep['exclude'])) {
- $this->ui->outputData('WARNING: exclude tags are ignored in conversion');
- }
-
- if (isset($dep['min'])) {
- $pf->addExtensionDep($dep['name'], $dep['min'], 'ge');
- }
-
- if (isset($dep['max'])) {
- $pf->addExtensionDep($dep['name'], $dep['max'], 'le');
- }
- }
- }
-
- if (isset($deps['optional']['package'])) {
- if (!isset($deps['optional']['package'][0])) {
- $deps['optional']['package'] = array($deps['optional']['package']);
- }
-
- foreach ($deps['optional']['package'] as $dep) {
- if (!isset($dep['channel'])) {
- return $this->raiseError('Cannot safely convert "' . $packagexml . '"' .
- ' contains uri-based dependency on a package. Using a ' .
- 'PEAR_PackageFileManager-based script is an option');
- }
-
- if ($dep['channel'] != 'pear.php.net'
- && $dep['channel'] != 'pecl.php.net'
- && $dep['channel'] != 'doc.php.net') {
- return $this->raiseError('Cannot safely convert "' . $packagexml . '"' .
- ' contains dependency on a non-standard channel package. Using a ' .
- 'PEAR_PackageFileManager-based script is an option');
- }
-
- if (isset($dep['exclude'])) {
- $this->ui->outputData('WARNING: exclude tags are ignored in conversion');
- }
-
- if (isset($dep['min'])) {
- $pf->addPackageDep($dep['name'], $dep['min'], 'ge', 'yes');
- }
-
- if (isset($dep['max'])) {
- $pf->addPackageDep($dep['name'], $dep['max'], 'le', 'yes');
- }
- }
- }
-
- if (isset($deps['optional']['extension'])) {
- if (!isset($deps['optional']['extension'][0])) {
- $deps['optional']['extension'] = array($deps['optional']['extension']);
- }
-
- foreach ($deps['optional']['extension'] as $dep) {
- if (isset($dep['exclude'])) {
- $this->ui->outputData('WARNING: exclude tags are ignored in conversion');
- }
-
- if (isset($dep['min'])) {
- $pf->addExtensionDep($dep['name'], $dep['min'], 'ge', 'yes');
- }
-
- if (isset($dep['max'])) {
- $pf->addExtensionDep($dep['name'], $dep['max'], 'le', 'yes');
- }
- }
- }
-
- $contents = $pf2->getContents();
- $release = $pf2->getReleases();
- if (isset($releases[0])) {
- return $this->raiseError('Cannot safely process "' . $packagexml . '" contains '
- . 'multiple extsrcrelease/zendextsrcrelease tags. Using a PEAR_PackageFileManager-based script ' .
- 'or the convert command is an option');
- }
-
- if ($configoptions = $pf2->getConfigureOptions()) {
- foreach ($configoptions as $option) {
- $default = isset($option['default']) ? $option['default'] : false;
- $pf->addConfigureOption($option['name'], $option['prompt'], $default);
- }
- }
-
- if (isset($release['filelist']['ignore'])) {
- return $this->raiseError('Cannot safely process "' . $packagexml . '" contains '
- . 'ignore tags. Using a PEAR_PackageFileManager-based script or the convert' .
- ' command is an option');
- }
-
- if (isset($release['filelist']['install']) &&
- !isset($release['filelist']['install'][0])) {
- $release['filelist']['install'] = array($release['filelist']['install']);
- }
-
- if (isset($contents['dir']['attribs']['baseinstalldir'])) {
- $baseinstalldir = $contents['dir']['attribs']['baseinstalldir'];
- } else {
- $baseinstalldir = false;
- }
-
- if (!isset($contents['dir']['file'][0])) {
- $contents['dir']['file'] = array($contents['dir']['file']);
- }
-
- foreach ($contents['dir']['file'] as $file) {
- if ($baseinstalldir && !isset($file['attribs']['baseinstalldir'])) {
- $file['attribs']['baseinstalldir'] = $baseinstalldir;
- }
-
- $processFile = $file;
- unset($processFile['attribs']);
- if (count($processFile)) {
- foreach ($processFile as $name => $task) {
- if ($name != $pf2->getTasksNs() . ':replace') {
- return $this->raiseError('Cannot safely process "' . $packagexml .
- '" contains tasks other than replace. Using a ' .
- 'PEAR_PackageFileManager-based script is an option.');
- }
- $file['attribs']['replace'][] = $task;
- }
- }
-
- if (!in_array($file['attribs']['role'], PEAR_Common::getFileRoles())) {
- return $this->raiseError('Cannot safely convert "' . $packagexml .
- '", contains custom roles. Using a PEAR_PackageFileManager-based script ' .
- 'or the convert command is an option');
- }
-
- if (isset($release['filelist']['install'])) {
- foreach ($release['filelist']['install'] as $installas) {
- if ($installas['attribs']['name'] == $file['attribs']['name']) {
- $file['attribs']['install-as'] = $installas['attribs']['as'];
- }
- }
- }
-
- $pf->addFile('/', $file['attribs']['name'], $file['attribs']);
- }
-
- if ($pf2->getChangeLog()) {
- $this->ui->outputData('WARNING: changelog is not translated to package.xml ' .
- '1.0, use PEAR_PackageFileManager-based script if you need changelog-' .
- 'translation for package.xml 1.0');
- }
-
- $gen = &$pf->getDefaultGenerator();
- $gen->toPackageFile('.');
- }
-} \ No newline at end of file
diff --git a/3rdparty/PEAR/Command/Pickle.xml b/3rdparty/PEAR/Command/Pickle.xml
deleted file mode 100644
index 721ecea995e..00000000000
--- a/3rdparty/PEAR/Command/Pickle.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<commands version="1.0">
- <pickle>
- <summary>Build PECL Package</summary>
- <function>doPackage</function>
- <shortcut>pi</shortcut>
- <options>
- <nocompress>
- <shortopt>Z</shortopt>
- <doc>Do not gzip the package file</doc>
- </nocompress>
- <showname>
- <shortopt>n</shortopt>
- <doc>Print the name of the packaged file.</doc>
- </showname>
- </options>
- <doc>[descfile]
-Creates a PECL package from its package2.xml file.
-
-An automatic conversion will be made to a package.xml 1.0 and written out to
-disk in the current directory as &quot;package.xml&quot;. Note that
-only simple package.xml 2.0 will be converted. package.xml 2.0 with:
-
- - dependency types other than required/optional PECL package/ext/php/pearinstaller
- - more than one extsrcrelease or zendextsrcrelease
- - zendextbinrelease, extbinrelease, phprelease, or bundle release type
- - dependency groups
- - ignore tags in release filelist
- - tasks other than replace
- - custom roles
-
-will cause pickle to fail, and output an error message. If your package2.xml
-uses any of these features, you are best off using PEAR_PackageFileManager to
-generate both package.xml.
-</doc>
- </pickle>
-</commands> \ No newline at end of file
diff --git a/3rdparty/PEAR/Command/Registry.php b/3rdparty/PEAR/Command/Registry.php
deleted file mode 100644
index 4304db5ddf5..00000000000
--- a/3rdparty/PEAR/Command/Registry.php
+++ /dev/null
@@ -1,1145 +0,0 @@
-<?php
-/**
- * PEAR_Command_Registry (list, list-files, shell-test, info commands)
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Stig Bakken <ssb@php.net>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Registry.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 0.1
- */
-
-/**
- * base class
- */
-require_once 'PEAR/Command/Common.php';
-
-/**
- * PEAR commands for registry manipulation
- *
- * @category pear
- * @package PEAR
- * @author Stig Bakken <ssb@php.net>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 0.1
- */
-class PEAR_Command_Registry extends PEAR_Command_Common
-{
- var $commands = array(
- 'list' => array(
- 'summary' => 'List Installed Packages In The Default Channel',
- 'function' => 'doList',
- 'shortcut' => 'l',
- 'options' => array(
- 'channel' => array(
- 'shortopt' => 'c',
- 'doc' => 'list installed packages from this channel',
- 'arg' => 'CHAN',
- ),
- 'allchannels' => array(
- 'shortopt' => 'a',
- 'doc' => 'list installed packages from all channels',
- ),
- 'channelinfo' => array(
- 'shortopt' => 'i',
- 'doc' => 'output fully channel-aware data, even on failure',
- ),
- ),
- 'doc' => '<package>
-If invoked without parameters, this command lists the PEAR packages
-installed in your php_dir ({config php_dir}). With a parameter, it
-lists the files in a package.
-',
- ),
- 'list-files' => array(
- 'summary' => 'List Files In Installed Package',
- 'function' => 'doFileList',
- 'shortcut' => 'fl',
- 'options' => array(),
- 'doc' => '<package>
-List the files in an installed package.
-'
- ),
- 'shell-test' => array(
- 'summary' => 'Shell Script Test',
- 'function' => 'doShellTest',
- 'shortcut' => 'st',
- 'options' => array(),
- 'doc' => '<package> [[relation] version]
-Tests if a package is installed in the system. Will exit(1) if it is not.
- <relation> The version comparison operator. One of:
- <, lt, <=, le, >, gt, >=, ge, ==, =, eq, !=, <>, ne
- <version> The version to compare with
-'),
- 'info' => array(
- 'summary' => 'Display information about a package',
- 'function' => 'doInfo',
- 'shortcut' => 'in',
- 'options' => array(),
- 'doc' => '<package>
-Displays information about a package. The package argument may be a
-local package file, an URL to a package file, or the name of an
-installed package.'
- )
- );
-
- /**
- * PEAR_Command_Registry constructor.
- *
- * @access public
- */
- function PEAR_Command_Registry(&$ui, &$config)
- {
- parent::PEAR_Command_Common($ui, $config);
- }
-
- function _sortinfo($a, $b)
- {
- $apackage = isset($a['package']) ? $a['package'] : $a['name'];
- $bpackage = isset($b['package']) ? $b['package'] : $b['name'];
- return strcmp($apackage, $bpackage);
- }
-
- function doList($command, $options, $params)
- {
- $reg = &$this->config->getRegistry();
- $channelinfo = isset($options['channelinfo']);
- if (isset($options['allchannels']) && !$channelinfo) {
- return $this->doListAll($command, array(), $params);
- }
-
- if (isset($options['allchannels']) && $channelinfo) {
- // allchannels with $channelinfo
- unset($options['allchannels']);
- $channels = $reg->getChannels();
- $errors = array();
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- foreach ($channels as $channel) {
- $options['channel'] = $channel->getName();
- $ret = $this->doList($command, $options, $params);
-
- if (PEAR::isError($ret)) {
- $errors[] = $ret;
- }
- }
-
- PEAR::staticPopErrorHandling();
- if (count($errors)) {
- // for now, only give first error
- return PEAR::raiseError($errors[0]);
- }
-
- return true;
- }
-
- if (count($params) === 1) {
- return $this->doFileList($command, $options, $params);
- }
-
- if (isset($options['channel'])) {
- if (!$reg->channelExists($options['channel'])) {
- return $this->raiseError('Channel "' . $options['channel'] .'" does not exist');
- }
-
- $channel = $reg->channelName($options['channel']);
- } else {
- $channel = $this->config->get('default_channel');
- }
-
- $installed = $reg->packageInfo(null, null, $channel);
- usort($installed, array(&$this, '_sortinfo'));
-
- $data = array(
- 'caption' => 'Installed packages, channel ' .
- $channel . ':',
- 'border' => true,
- 'headline' => array('Package', 'Version', 'State'),
- 'channel' => $channel,
- );
- if ($channelinfo) {
- $data['headline'] = array('Channel', 'Package', 'Version', 'State');
- }
-
- if (count($installed) && !isset($data['data'])) {
- $data['data'] = array();
- }
-
- foreach ($installed as $package) {
- $pobj = $reg->getPackage(isset($package['package']) ?
- $package['package'] : $package['name'], $channel);
- if ($channelinfo) {
- $packageinfo = array($pobj->getChannel(), $pobj->getPackage(), $pobj->getVersion(),
- $pobj->getState() ? $pobj->getState() : null);
- } else {
- $packageinfo = array($pobj->getPackage(), $pobj->getVersion(),
- $pobj->getState() ? $pobj->getState() : null);
- }
- $data['data'][] = $packageinfo;
- }
-
- if (count($installed) === 0) {
- if (!$channelinfo) {
- $data = '(no packages installed from channel ' . $channel . ')';
- } else {
- $data = array(
- 'caption' => 'Installed packages, channel ' .
- $channel . ':',
- 'border' => true,
- 'channel' => $channel,
- 'data' => array(array('(no packages installed)')),
- );
- }
- }
-
- $this->ui->outputData($data, $command);
- return true;
- }
-
- function doListAll($command, $options, $params)
- {
- // This duplicate code is deprecated over
- // list --channelinfo, which gives identical
- // output for list and list --allchannels.
- $reg = &$this->config->getRegistry();
- $installed = $reg->packageInfo(null, null, null);
- foreach ($installed as $channel => $packages) {
- usort($packages, array($this, '_sortinfo'));
- $data = array(
- 'caption' => 'Installed packages, channel ' . $channel . ':',
- 'border' => true,
- 'headline' => array('Package', 'Version', 'State'),
- 'channel' => $channel
- );
-
- foreach ($packages as $package) {
- $p = isset($package['package']) ? $package['package'] : $package['name'];
- $pobj = $reg->getPackage($p, $channel);
- $data['data'][] = array($pobj->getPackage(), $pobj->getVersion(),
- $pobj->getState() ? $pobj->getState() : null);
- }
-
- // Adds a blank line after each section
- $data['data'][] = array();
-
- if (count($packages) === 0) {
- $data = array(
- 'caption' => 'Installed packages, channel ' . $channel . ':',
- 'border' => true,
- 'data' => array(array('(no packages installed)'), array()),
- 'channel' => $channel
- );
- }
- $this->ui->outputData($data, $command);
- }
- return true;
- }
-
- function doFileList($command, $options, $params)
- {
- if (count($params) !== 1) {
- return $this->raiseError('list-files expects 1 parameter');
- }
-
- $reg = &$this->config->getRegistry();
- $fp = false;
- if (!is_dir($params[0]) && (file_exists($params[0]) || $fp = @fopen($params[0], 'r'))) {
- if ($fp) {
- fclose($fp);
- }
-
- if (!class_exists('PEAR_PackageFile')) {
- require_once 'PEAR/PackageFile.php';
- }
-
- $pkg = &new PEAR_PackageFile($this->config, $this->_debug);
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- $info = &$pkg->fromAnyFile($params[0], PEAR_VALIDATE_NORMAL);
- PEAR::staticPopErrorHandling();
- $headings = array('Package File', 'Install Path');
- $installed = false;
- } else {
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- $parsed = $reg->parsePackageName($params[0], $this->config->get('default_channel'));
- PEAR::staticPopErrorHandling();
- if (PEAR::isError($parsed)) {
- return $this->raiseError($parsed);
- }
-
- $info = &$reg->getPackage($parsed['package'], $parsed['channel']);
- $headings = array('Type', 'Install Path');
- $installed = true;
- }
-
- if (PEAR::isError($info)) {
- return $this->raiseError($info);
- }
-
- if ($info === null) {
- return $this->raiseError("`$params[0]' not installed");
- }
-
- $list = ($info->getPackagexmlVersion() == '1.0' || $installed) ?
- $info->getFilelist() : $info->getContents();
- if ($installed) {
- $caption = 'Installed Files For ' . $params[0];
- } else {
- $caption = 'Contents of ' . basename($params[0]);
- }
-
- $data = array(
- 'caption' => $caption,
- 'border' => true,
- 'headline' => $headings);
- if ($info->getPackagexmlVersion() == '1.0' || $installed) {
- foreach ($list as $file => $att) {
- if ($installed) {
- if (empty($att['installed_as'])) {
- continue;
- }
- $data['data'][] = array($att['role'], $att['installed_as']);
- } else {
- if (isset($att['baseinstalldir']) && !in_array($att['role'],
- array('test', 'data', 'doc'))) {
- $dest = $att['baseinstalldir'] . DIRECTORY_SEPARATOR .
- $file;
- } else {
- $dest = $file;
- }
- switch ($att['role']) {
- case 'test':
- case 'data':
- case 'doc':
- $role = $att['role'];
- if ($role == 'test') {
- $role .= 's';
- }
- $dest = $this->config->get($role . '_dir') . DIRECTORY_SEPARATOR .
- $info->getPackage() . DIRECTORY_SEPARATOR . $dest;
- break;
- case 'php':
- default:
- $dest = $this->config->get('php_dir') . DIRECTORY_SEPARATOR .
- $dest;
- }
- $ds2 = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR;
- $dest = preg_replace(array('!\\\\+!', '!/!', "!$ds2+!"),
- array(DIRECTORY_SEPARATOR,
- DIRECTORY_SEPARATOR,
- DIRECTORY_SEPARATOR),
- $dest);
- $file = preg_replace('!/+!', '/', $file);
- $data['data'][] = array($file, $dest);
- }
- }
- } else { // package.xml 2.0, not installed
- if (!isset($list['dir']['file'][0])) {
- $list['dir']['file'] = array($list['dir']['file']);
- }
-
- foreach ($list['dir']['file'] as $att) {
- $att = $att['attribs'];
- $file = $att['name'];
- $role = &PEAR_Installer_Role::factory($info, $att['role'], $this->config);
- $role->setup($this, $info, $att, $file);
- if (!$role->isInstallable()) {
- $dest = '(not installable)';
- } else {
- $dest = $role->processInstallation($info, $att, $file, '');
- if (PEAR::isError($dest)) {
- $dest = '(Unknown role "' . $att['role'] . ')';
- } else {
- list(,, $dest) = $dest;
- }
- }
- $data['data'][] = array($file, $dest);
- }
- }
-
- $this->ui->outputData($data, $command);
- return true;
- }
-
- function doShellTest($command, $options, $params)
- {
- if (count($params) < 1) {
- return PEAR::raiseError('ERROR, usage: pear shell-test packagename [[relation] version]');
- }
-
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- $reg = &$this->config->getRegistry();
- $info = $reg->parsePackageName($params[0], $this->config->get('default_channel'));
- if (PEAR::isError($info)) {
- exit(1); // invalid package name
- }
-
- $package = $info['package'];
- $channel = $info['channel'];
- // "pear shell-test Foo"
- if (!$reg->packageExists($package, $channel)) {
- if ($channel == 'pecl.php.net') {
- if ($reg->packageExists($package, 'pear.php.net')) {
- $channel = 'pear.php.net'; // magically change channels for extensions
- }
- }
- }
-
- if (count($params) === 1) {
- if (!$reg->packageExists($package, $channel)) {
- exit(1);
- }
- // "pear shell-test Foo 1.0"
- } elseif (count($params) === 2) {
- $v = $reg->packageInfo($package, 'version', $channel);
- if (!$v || !version_compare("$v", "{$params[1]}", "ge")) {
- exit(1);
- }
- // "pear shell-test Foo ge 1.0"
- } elseif (count($params) === 3) {
- $v = $reg->packageInfo($package, 'version', $channel);
- if (!$v || !version_compare("$v", "{$params[2]}", $params[1])) {
- exit(1);
- }
- } else {
- PEAR::staticPopErrorHandling();
- $this->raiseError("$command: expects 1 to 3 parameters");
- exit(1);
- }
- }
-
- function doInfo($command, $options, $params)
- {
- if (count($params) !== 1) {
- return $this->raiseError('pear info expects 1 parameter');
- }
-
- $info = $fp = false;
- $reg = &$this->config->getRegistry();
- if (is_file($params[0]) && !is_dir($params[0]) &&
- (file_exists($params[0]) || $fp = @fopen($params[0], 'r'))
- ) {
- if ($fp) {
- fclose($fp);
- }
-
- if (!class_exists('PEAR_PackageFile')) {
- require_once 'PEAR/PackageFile.php';
- }
-
- $pkg = &new PEAR_PackageFile($this->config, $this->_debug);
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- $obj = &$pkg->fromAnyFile($params[0], PEAR_VALIDATE_NORMAL);
- PEAR::staticPopErrorHandling();
- if (PEAR::isError($obj)) {
- $uinfo = $obj->getUserInfo();
- if (is_array($uinfo)) {
- foreach ($uinfo as $message) {
- if (is_array($message)) {
- $message = $message['message'];
- }
- $this->ui->outputData($message);
- }
- }
-
- return $this->raiseError($obj);
- }
-
- if ($obj->getPackagexmlVersion() != '1.0') {
- return $this->_doInfo2($command, $options, $params, $obj, false);
- }
-
- $info = $obj->toArray();
- } else {
- $parsed = $reg->parsePackageName($params[0], $this->config->get('default_channel'));
- if (PEAR::isError($parsed)) {
- return $this->raiseError($parsed);
- }
-
- $package = $parsed['package'];
- $channel = $parsed['channel'];
- $info = $reg->packageInfo($package, null, $channel);
- if (isset($info['old'])) {
- $obj = $reg->getPackage($package, $channel);
- return $this->_doInfo2($command, $options, $params, $obj, true);
- }
- }
-
- if (PEAR::isError($info)) {
- return $info;
- }
-
- if (empty($info)) {
- $this->raiseError("No information found for `$params[0]'");
- return;
- }
-
- unset($info['filelist']);
- unset($info['dirtree']);
- unset($info['changelog']);
- if (isset($info['xsdversion'])) {
- $info['package.xml version'] = $info['xsdversion'];
- unset($info['xsdversion']);
- }
-
- if (isset($info['packagerversion'])) {
- $info['packaged with PEAR version'] = $info['packagerversion'];
- unset($info['packagerversion']);
- }
-
- $keys = array_keys($info);
- $longtext = array('description', 'summary');
- foreach ($keys as $key) {
- if (is_array($info[$key])) {
- switch ($key) {
- case 'maintainers': {
- $i = 0;
- $mstr = '';
- foreach ($info[$key] as $m) {
- if ($i++ > 0) {
- $mstr .= "\n";
- }
- $mstr .= $m['name'] . " <";
- if (isset($m['email'])) {
- $mstr .= $m['email'];
- } else {
- $mstr .= $m['handle'] . '@php.net';
- }
- $mstr .= "> ($m[role])";
- }
- $info[$key] = $mstr;
- break;
- }
- case 'release_deps': {
- $i = 0;
- $dstr = '';
- foreach ($info[$key] as $d) {
- if (isset($this->_deps_rel_trans[$d['rel']])) {
- $rel = $this->_deps_rel_trans[$d['rel']];
- } else {
- $rel = $d['rel'];
- }
- if (isset($this->_deps_type_trans[$d['type']])) {
- $type = ucfirst($this->_deps_type_trans[$d['type']]);
- } else {
- $type = $d['type'];
- }
- if (isset($d['name'])) {
- $name = $d['name'] . ' ';
- } else {
- $name = '';
- }
- if (isset($d['version'])) {
- $version = $d['version'] . ' ';
- } else {
- $version = '';
- }
- if (isset($d['optional']) && $d['optional'] == 'yes') {
- $optional = ' (optional)';
- } else {
- $optional = '';
- }
- $dstr .= "$type $name$rel $version$optional\n";
- }
- $info[$key] = $dstr;
- break;
- }
- case 'provides' : {
- $debug = $this->config->get('verbose');
- if ($debug < 2) {
- $pstr = 'Classes: ';
- } else {
- $pstr = '';
- }
- $i = 0;
- foreach ($info[$key] as $p) {
- if ($debug < 2 && $p['type'] != "class") {
- continue;
- }
- // Only print classes when verbosity mode is < 2
- if ($debug < 2) {
- if ($i++ > 0) {
- $pstr .= ", ";
- }
- $pstr .= $p['name'];
- } else {
- if ($i++ > 0) {
- $pstr .= "\n";
- }
- $pstr .= ucfirst($p['type']) . " " . $p['name'];
- if (isset($p['explicit']) && $p['explicit'] == 1) {
- $pstr .= " (explicit)";
- }
- }
- }
- $info[$key] = $pstr;
- break;
- }
- case 'configure_options' : {
- foreach ($info[$key] as $i => $p) {
- $info[$key][$i] = array_map(null, array_keys($p), array_values($p));
- $info[$key][$i] = array_map(create_function('$a',
- 'return join(" = ",$a);'), $info[$key][$i]);
- $info[$key][$i] = implode(', ', $info[$key][$i]);
- }
- $info[$key] = implode("\n", $info[$key]);
- break;
- }
- default: {
- $info[$key] = implode(", ", $info[$key]);
- break;
- }
- }
- }
-
- if ($key == '_lastmodified') {
- $hdate = date('Y-m-d', $info[$key]);
- unset($info[$key]);
- $info['Last Modified'] = $hdate;
- } elseif ($key == '_lastversion') {
- $info['Previous Installed Version'] = $info[$key] ? $info[$key] : '- None -';
- unset($info[$key]);
- } else {
- $info[$key] = trim($info[$key]);
- if (in_array($key, $longtext)) {
- $info[$key] = preg_replace('/ +/', ' ', $info[$key]);
- }
- }
- }
-
- $caption = 'About ' . $info['package'] . '-' . $info['version'];
- $data = array(
- 'caption' => $caption,
- 'border' => true);
- foreach ($info as $key => $value) {
- $key = ucwords(trim(str_replace('_', ' ', $key)));
- $data['data'][] = array($key, $value);
- }
- $data['raw'] = $info;
-
- $this->ui->outputData($data, 'package-info');
- }
-
- /**
- * @access private
- */
- function _doInfo2($command, $options, $params, &$obj, $installed)
- {
- $reg = &$this->config->getRegistry();
- $caption = 'About ' . $obj->getChannel() . '/' .$obj->getPackage() . '-' .
- $obj->getVersion();
- $data = array(
- 'caption' => $caption,
- 'border' => true);
- switch ($obj->getPackageType()) {
- case 'php' :
- $release = 'PEAR-style PHP-based Package';
- break;
- case 'extsrc' :
- $release = 'PECL-style PHP extension (source code)';
- break;
- case 'zendextsrc' :
- $release = 'PECL-style Zend extension (source code)';
- break;
- case 'extbin' :
- $release = 'PECL-style PHP extension (binary)';
- break;
- case 'zendextbin' :
- $release = 'PECL-style Zend extension (binary)';
- break;
- case 'bundle' :
- $release = 'Package bundle (collection of packages)';
- break;
- }
- $extends = $obj->getExtends();
- $extends = $extends ?
- $obj->getPackage() . ' (extends ' . $extends . ')' : $obj->getPackage();
- if ($src = $obj->getSourcePackage()) {
- $extends .= ' (source package ' . $src['channel'] . '/' . $src['package'] . ')';
- }
-
- $info = array(
- 'Release Type' => $release,
- 'Name' => $extends,
- 'Channel' => $obj->getChannel(),
- 'Summary' => preg_replace('/ +/', ' ', $obj->getSummary()),
- 'Description' => preg_replace('/ +/', ' ', $obj->getDescription()),
- );
- $info['Maintainers'] = '';
- foreach (array('lead', 'developer', 'contributor', 'helper') as $role) {
- $leads = $obj->{"get{$role}s"}();
- if (!$leads) {
- continue;
- }
-
- if (isset($leads['active'])) {
- $leads = array($leads);
- }
-
- foreach ($leads as $lead) {
- if (!empty($info['Maintainers'])) {
- $info['Maintainers'] .= "\n";
- }
-
- $active = $lead['active'] == 'no' ? ', inactive' : '';
- $info['Maintainers'] .= $lead['name'] . ' <';
- $info['Maintainers'] .= $lead['email'] . "> ($role$active)";
- }
- }
-
- $info['Release Date'] = $obj->getDate();
- if ($time = $obj->getTime()) {
- $info['Release Date'] .= ' ' . $time;
- }
-
- $info['Release Version'] = $obj->getVersion() . ' (' . $obj->getState() . ')';
- $info['API Version'] = $obj->getVersion('api') . ' (' . $obj->getState('api') . ')';
- $info['License'] = $obj->getLicense();
- $uri = $obj->getLicenseLocation();
- if ($uri) {
- if (isset($uri['uri'])) {
- $info['License'] .= ' (' . $uri['uri'] . ')';
- } else {
- $extra = $obj->getInstalledLocation($info['filesource']);
- if ($extra) {
- $info['License'] .= ' (' . $uri['filesource'] . ')';
- }
- }
- }
-
- $info['Release Notes'] = $obj->getNotes();
- if ($compat = $obj->getCompatible()) {
- if (!isset($compat[0])) {
- $compat = array($compat);
- }
-
- $info['Compatible with'] = '';
- foreach ($compat as $package) {
- $info['Compatible with'] .= $package['channel'] . '/' . $package['name'] .
- "\nVersions >= " . $package['min'] . ', <= ' . $package['max'];
- if (isset($package['exclude'])) {
- if (is_array($package['exclude'])) {
- $package['exclude'] = implode(', ', $package['exclude']);
- }
-
- if (!isset($info['Not Compatible with'])) {
- $info['Not Compatible with'] = '';
- } else {
- $info['Not Compatible with'] .= "\n";
- }
- $info['Not Compatible with'] .= $package['channel'] . '/' .
- $package['name'] . "\nVersions " . $package['exclude'];
- }
- }
- }
-
- $usesrole = $obj->getUsesrole();
- if ($usesrole) {
- if (!isset($usesrole[0])) {
- $usesrole = array($usesrole);
- }
-
- foreach ($usesrole as $roledata) {
- if (isset($info['Uses Custom Roles'])) {
- $info['Uses Custom Roles'] .= "\n";
- } else {
- $info['Uses Custom Roles'] = '';
- }
-
- if (isset($roledata['package'])) {
- $rolepackage = $reg->parsedPackageNameToString($roledata, true);
- } else {
- $rolepackage = $roledata['uri'];
- }
- $info['Uses Custom Roles'] .= $roledata['role'] . ' (' . $rolepackage . ')';
- }
- }
-
- $usestask = $obj->getUsestask();
- if ($usestask) {
- if (!isset($usestask[0])) {
- $usestask = array($usestask);
- }
-
- foreach ($usestask as $taskdata) {
- if (isset($info['Uses Custom Tasks'])) {
- $info['Uses Custom Tasks'] .= "\n";
- } else {
- $info['Uses Custom Tasks'] = '';
- }
-
- if (isset($taskdata['package'])) {
- $taskpackage = $reg->parsedPackageNameToString($taskdata, true);
- } else {
- $taskpackage = $taskdata['uri'];
- }
- $info['Uses Custom Tasks'] .= $taskdata['task'] . ' (' . $taskpackage . ')';
- }
- }
-
- $deps = $obj->getDependencies();
- $info['Required Dependencies'] = 'PHP version ' . $deps['required']['php']['min'];
- if (isset($deps['required']['php']['max'])) {
- $info['Required Dependencies'] .= '-' . $deps['required']['php']['max'] . "\n";
- } else {
- $info['Required Dependencies'] .= "\n";
- }
-
- if (isset($deps['required']['php']['exclude'])) {
- if (!isset($info['Not Compatible with'])) {
- $info['Not Compatible with'] = '';
- } else {
- $info['Not Compatible with'] .= "\n";
- }
-
- if (is_array($deps['required']['php']['exclude'])) {
- $deps['required']['php']['exclude'] =
- implode(', ', $deps['required']['php']['exclude']);
- }
- $info['Not Compatible with'] .= "PHP versions\n " .
- $deps['required']['php']['exclude'];
- }
-
- $info['Required Dependencies'] .= 'PEAR installer version';
- if (isset($deps['required']['pearinstaller']['max'])) {
- $info['Required Dependencies'] .= 's ' .
- $deps['required']['pearinstaller']['min'] . '-' .
- $deps['required']['pearinstaller']['max'];
- } else {
- $info['Required Dependencies'] .= ' ' .
- $deps['required']['pearinstaller']['min'] . ' or newer';
- }
-
- if (isset($deps['required']['pearinstaller']['exclude'])) {
- if (!isset($info['Not Compatible with'])) {
- $info['Not Compatible with'] = '';
- } else {
- $info['Not Compatible with'] .= "\n";
- }
-
- if (is_array($deps['required']['pearinstaller']['exclude'])) {
- $deps['required']['pearinstaller']['exclude'] =
- implode(', ', $deps['required']['pearinstaller']['exclude']);
- }
- $info['Not Compatible with'] .= "PEAR installer\n Versions " .
- $deps['required']['pearinstaller']['exclude'];
- }
-
- foreach (array('Package', 'Extension') as $type) {
- $index = strtolower($type);
- if (isset($deps['required'][$index])) {
- if (isset($deps['required'][$index]['name'])) {
- $deps['required'][$index] = array($deps['required'][$index]);
- }
-
- foreach ($deps['required'][$index] as $package) {
- if (isset($package['conflicts'])) {
- $infoindex = 'Not Compatible with';
- if (!isset($info['Not Compatible with'])) {
- $info['Not Compatible with'] = '';
- } else {
- $info['Not Compatible with'] .= "\n";
- }
- } else {
- $infoindex = 'Required Dependencies';
- $info[$infoindex] .= "\n";
- }
-
- if ($index == 'extension') {
- $name = $package['name'];
- } else {
- if (isset($package['channel'])) {
- $name = $package['channel'] . '/' . $package['name'];
- } else {
- $name = '__uri/' . $package['name'] . ' (static URI)';
- }
- }
-
- $info[$infoindex] .= "$type $name";
- if (isset($package['uri'])) {
- $info[$infoindex] .= "\n Download URI: $package[uri]";
- continue;
- }
-
- if (isset($package['max']) && isset($package['min'])) {
- $info[$infoindex] .= " \n Versions " .
- $package['min'] . '-' . $package['max'];
- } elseif (isset($package['min'])) {
- $info[$infoindex] .= " \n Version " .
- $package['min'] . ' or newer';
- } elseif (isset($package['max'])) {
- $info[$infoindex] .= " \n Version " .
- $package['max'] . ' or older';
- }
-
- if (isset($package['recommended'])) {
- $info[$infoindex] .= "\n Recommended version: $package[recommended]";
- }
-
- if (isset($package['exclude'])) {
- if (!isset($info['Not Compatible with'])) {
- $info['Not Compatible with'] = '';
- } else {
- $info['Not Compatible with'] .= "\n";
- }
-
- if (is_array($package['exclude'])) {
- $package['exclude'] = implode(', ', $package['exclude']);
- }
-
- $package['package'] = $package['name']; // for parsedPackageNameToString
- if (isset($package['conflicts'])) {
- $info['Not Compatible with'] .= '=> except ';
- }
- $info['Not Compatible with'] .= 'Package ' .
- $reg->parsedPackageNameToString($package, true);
- $info['Not Compatible with'] .= "\n Versions " . $package['exclude'];
- }
- }
- }
- }
-
- if (isset($deps['required']['os'])) {
- if (isset($deps['required']['os']['name'])) {
- $dep['required']['os']['name'] = array($dep['required']['os']['name']);
- }
-
- foreach ($dep['required']['os'] as $os) {
- if (isset($os['conflicts']) && $os['conflicts'] == 'yes') {
- if (!isset($info['Not Compatible with'])) {
- $info['Not Compatible with'] = '';
- } else {
- $info['Not Compatible with'] .= "\n";
- }
- $info['Not Compatible with'] .= "$os[name] Operating System";
- } else {
- $info['Required Dependencies'] .= "\n";
- $info['Required Dependencies'] .= "$os[name] Operating System";
- }
- }
- }
-
- if (isset($deps['required']['arch'])) {
- if (isset($deps['required']['arch']['pattern'])) {
- $dep['required']['arch']['pattern'] = array($dep['required']['os']['pattern']);
- }
-
- foreach ($dep['required']['arch'] as $os) {
- if (isset($os['conflicts']) && $os['conflicts'] == 'yes') {
- if (!isset($info['Not Compatible with'])) {
- $info['Not Compatible with'] = '';
- } else {
- $info['Not Compatible with'] .= "\n";
- }
- $info['Not Compatible with'] .= "OS/Arch matching pattern '/$os[pattern]/'";
- } else {
- $info['Required Dependencies'] .= "\n";
- $info['Required Dependencies'] .= "OS/Arch matching pattern '/$os[pattern]/'";
- }
- }
- }
-
- if (isset($deps['optional'])) {
- foreach (array('Package', 'Extension') as $type) {
- $index = strtolower($type);
- if (isset($deps['optional'][$index])) {
- if (isset($deps['optional'][$index]['name'])) {
- $deps['optional'][$index] = array($deps['optional'][$index]);
- }
-
- foreach ($deps['optional'][$index] as $package) {
- if (isset($package['conflicts']) && $package['conflicts'] == 'yes') {
- $infoindex = 'Not Compatible with';
- if (!isset($info['Not Compatible with'])) {
- $info['Not Compatible with'] = '';
- } else {
- $info['Not Compatible with'] .= "\n";
- }
- } else {
- $infoindex = 'Optional Dependencies';
- if (!isset($info['Optional Dependencies'])) {
- $info['Optional Dependencies'] = '';
- } else {
- $info['Optional Dependencies'] .= "\n";
- }
- }
-
- if ($index == 'extension') {
- $name = $package['name'];
- } else {
- if (isset($package['channel'])) {
- $name = $package['channel'] . '/' . $package['name'];
- } else {
- $name = '__uri/' . $package['name'] . ' (static URI)';
- }
- }
-
- $info[$infoindex] .= "$type $name";
- if (isset($package['uri'])) {
- $info[$infoindex] .= "\n Download URI: $package[uri]";
- continue;
- }
-
- if ($infoindex == 'Not Compatible with') {
- // conflicts is only used to say that all versions conflict
- continue;
- }
-
- if (isset($package['max']) && isset($package['min'])) {
- $info[$infoindex] .= " \n Versions " .
- $package['min'] . '-' . $package['max'];
- } elseif (isset($package['min'])) {
- $info[$infoindex] .= " \n Version " .
- $package['min'] . ' or newer';
- } elseif (isset($package['max'])) {
- $info[$infoindex] .= " \n Version " .
- $package['min'] . ' or older';
- }
-
- if (isset($package['recommended'])) {
- $info[$infoindex] .= "\n Recommended version: $package[recommended]";
- }
-
- if (isset($package['exclude'])) {
- if (!isset($info['Not Compatible with'])) {
- $info['Not Compatible with'] = '';
- } else {
- $info['Not Compatible with'] .= "\n";
- }
-
- if (is_array($package['exclude'])) {
- $package['exclude'] = implode(', ', $package['exclude']);
- }
-
- $info['Not Compatible with'] .= "Package $package\n Versions " .
- $package['exclude'];
- }
- }
- }
- }
- }
-
- if (isset($deps['group'])) {
- if (!isset($deps['group'][0])) {
- $deps['group'] = array($deps['group']);
- }
-
- foreach ($deps['group'] as $group) {
- $info['Dependency Group ' . $group['attribs']['name']] = $group['attribs']['hint'];
- $groupindex = $group['attribs']['name'] . ' Contents';
- $info[$groupindex] = '';
- foreach (array('Package', 'Extension') as $type) {
- $index = strtolower($type);
- if (isset($group[$index])) {
- if (isset($group[$index]['name'])) {
- $group[$index] = array($group[$index]);
- }
-
- foreach ($group[$index] as $package) {
- if (!empty($info[$groupindex])) {
- $info[$groupindex] .= "\n";
- }
-
- if ($index == 'extension') {
- $name = $package['name'];
- } else {
- if (isset($package['channel'])) {
- $name = $package['channel'] . '/' . $package['name'];
- } else {
- $name = '__uri/' . $package['name'] . ' (static URI)';
- }
- }
-
- if (isset($package['uri'])) {
- if (isset($package['conflicts']) && $package['conflicts'] == 'yes') {
- $info[$groupindex] .= "Not Compatible with $type $name";
- } else {
- $info[$groupindex] .= "$type $name";
- }
-
- $info[$groupindex] .= "\n Download URI: $package[uri]";
- continue;
- }
-
- if (isset($package['conflicts']) && $package['conflicts'] == 'yes') {
- $info[$groupindex] .= "Not Compatible with $type $name";
- continue;
- }
-
- $info[$groupindex] .= "$type $name";
- if (isset($package['max']) && isset($package['min'])) {
- $info[$groupindex] .= " \n Versions " .
- $package['min'] . '-' . $package['max'];
- } elseif (isset($package['min'])) {
- $info[$groupindex] .= " \n Version " .
- $package['min'] . ' or newer';
- } elseif (isset($package['max'])) {
- $info[$groupindex] .= " \n Version " .
- $package['min'] . ' or older';
- }
-
- if (isset($package['recommended'])) {
- $info[$groupindex] .= "\n Recommended version: $package[recommended]";
- }
-
- if (isset($package['exclude'])) {
- if (!isset($info['Not Compatible with'])) {
- $info['Not Compatible with'] = '';
- } else {
- $info[$groupindex] .= "Not Compatible with\n";
- }
-
- if (is_array($package['exclude'])) {
- $package['exclude'] = implode(', ', $package['exclude']);
- }
- $info[$groupindex] .= " Package $package\n Versions " .
- $package['exclude'];
- }
- }
- }
- }
- }
- }
-
- if ($obj->getPackageType() == 'bundle') {
- $info['Bundled Packages'] = '';
- foreach ($obj->getBundledPackages() as $package) {
- if (!empty($info['Bundled Packages'])) {
- $info['Bundled Packages'] .= "\n";
- }
-
- if (isset($package['uri'])) {
- $info['Bundled Packages'] .= '__uri/' . $package['name'];
- $info['Bundled Packages'] .= "\n (URI: $package[uri]";
- } else {
- $info['Bundled Packages'] .= $package['channel'] . '/' . $package['name'];
- }
- }
- }
-
- $info['package.xml version'] = '2.0';
- if ($installed) {
- if ($obj->getLastModified()) {
- $info['Last Modified'] = date('Y-m-d H:i', $obj->getLastModified());
- }
-
- $v = $obj->getLastInstalledVersion();
- $info['Previous Installed Version'] = $v ? $v : '- None -';
- }
-
- foreach ($info as $key => $value) {
- $data['data'][] = array($key, $value);
- }
-
- $data['raw'] = $obj->getArray(); // no validation needed
- $this->ui->outputData($data, 'package-info');
- }
-} \ No newline at end of file
diff --git a/3rdparty/PEAR/Command/Registry.xml b/3rdparty/PEAR/Command/Registry.xml
deleted file mode 100644
index 9f4e2149672..00000000000
--- a/3rdparty/PEAR/Command/Registry.xml
+++ /dev/null
@@ -1,58 +0,0 @@
-<commands version="1.0">
- <list>
- <summary>List Installed Packages In The Default Channel</summary>
- <function>doList</function>
- <shortcut>l</shortcut>
- <options>
- <channel>
- <shortopt>c</shortopt>
- <doc>list installed packages from this channel</doc>
- <arg>CHAN</arg>
- </channel>
- <allchannels>
- <shortopt>a</shortopt>
- <doc>list installed packages from all channels</doc>
- </allchannels>
- <channelinfo>
- <shortopt>i</shortopt>
- <doc>output fully channel-aware data, even on failure</doc>
- </channelinfo>
- </options>
- <doc>&lt;package&gt;
-If invoked without parameters, this command lists the PEAR packages
-installed in your php_dir ({config php_dir}). With a parameter, it
-lists the files in a package.
-</doc>
- </list>
- <list-files>
- <summary>List Files In Installed Package</summary>
- <function>doFileList</function>
- <shortcut>fl</shortcut>
- <options />
- <doc>&lt;package&gt;
-List the files in an installed package.
-</doc>
- </list-files>
- <shell-test>
- <summary>Shell Script Test</summary>
- <function>doShellTest</function>
- <shortcut>st</shortcut>
- <options />
- <doc>&lt;package&gt; [[relation] version]
-Tests if a package is installed in the system. Will exit(1) if it is not.
- &lt;relation&gt; The version comparison operator. One of:
- &lt;, lt, &lt;=, le, &gt;, gt, &gt;=, ge, ==, =, eq, !=, &lt;&gt;, ne
- &lt;version&gt; The version to compare with
-</doc>
- </shell-test>
- <info>
- <summary>Display information about a package</summary>
- <function>doInfo</function>
- <shortcut>in</shortcut>
- <options />
- <doc>&lt;package&gt;
-Displays information about a package. The package argument may be a
-local package file, an URL to a package file, or the name of an
-installed package.</doc>
- </info>
-</commands> \ No newline at end of file
diff --git a/3rdparty/PEAR/Command/Remote.php b/3rdparty/PEAR/Command/Remote.php
deleted file mode 100644
index 74478d83c7a..00000000000
--- a/3rdparty/PEAR/Command/Remote.php
+++ /dev/null
@@ -1,810 +0,0 @@
-<?php
-/**
- * PEAR_Command_Remote (remote-info, list-upgrades, remote-list, search, list-all, download,
- * clear-cache commands)
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Stig Bakken <ssb@php.net>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Remote.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 0.1
- */
-
-/**
- * base class
- */
-require_once 'PEAR/Command/Common.php';
-require_once 'PEAR/REST.php';
-
-/**
- * PEAR commands for remote server querying
- *
- * @category pear
- * @package PEAR
- * @author Stig Bakken <ssb@php.net>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 0.1
- */
-class PEAR_Command_Remote extends PEAR_Command_Common
-{
- var $commands = array(
- 'remote-info' => array(
- 'summary' => 'Information About Remote Packages',
- 'function' => 'doRemoteInfo',
- 'shortcut' => 'ri',
- 'options' => array(),
- 'doc' => '<package>
-Get details on a package from the server.',
- ),
- 'list-upgrades' => array(
- 'summary' => 'List Available Upgrades',
- 'function' => 'doListUpgrades',
- 'shortcut' => 'lu',
- 'options' => array(
- 'channelinfo' => array(
- 'shortopt' => 'i',
- 'doc' => 'output fully channel-aware data, even on failure',
- ),
- ),
- 'doc' => '[preferred_state]
-List releases on the server of packages you have installed where
-a newer version is available with the same release state (stable etc.)
-or the state passed as the second parameter.'
- ),
- 'remote-list' => array(
- 'summary' => 'List Remote Packages',
- 'function' => 'doRemoteList',
- 'shortcut' => 'rl',
- 'options' => array(
- 'channel' =>
- array(
- 'shortopt' => 'c',
- 'doc' => 'specify a channel other than the default channel',
- 'arg' => 'CHAN',
- )
- ),
- 'doc' => '
-Lists the packages available on the configured server along with the
-latest stable release of each package.',
- ),
- 'search' => array(
- 'summary' => 'Search remote package database',
- 'function' => 'doSearch',
- 'shortcut' => 'sp',
- 'options' => array(
- 'channel' =>
- array(
- 'shortopt' => 'c',
- 'doc' => 'specify a channel other than the default channel',
- 'arg' => 'CHAN',
- ),
- 'allchannels' => array(
- 'shortopt' => 'a',
- 'doc' => 'search packages from all known channels',
- ),
- 'channelinfo' => array(
- 'shortopt' => 'i',
- 'doc' => 'output fully channel-aware data, even on failure',
- ),
- ),
- 'doc' => '[packagename] [packageinfo]
-Lists all packages which match the search parameters. The first
-parameter is a fragment of a packagename. The default channel
-will be used unless explicitly overridden. The second parameter
-will be used to match any portion of the summary/description',
- ),
- 'list-all' => array(
- 'summary' => 'List All Packages',
- 'function' => 'doListAll',
- 'shortcut' => 'la',
- 'options' => array(
- 'channel' =>
- array(
- 'shortopt' => 'c',
- 'doc' => 'specify a channel other than the default channel',
- 'arg' => 'CHAN',
- ),
- 'channelinfo' => array(
- 'shortopt' => 'i',
- 'doc' => 'output fully channel-aware data, even on failure',
- ),
- ),
- 'doc' => '
-Lists the packages available on the configured server along with the
-latest stable release of each package.',
- ),
- 'download' => array(
- 'summary' => 'Download Package',
- 'function' => 'doDownload',
- 'shortcut' => 'd',
- 'options' => array(
- 'nocompress' => array(
- 'shortopt' => 'Z',
- 'doc' => 'download an uncompressed (.tar) file',
- ),
- ),
- 'doc' => '<package>...
-Download package tarballs. The files will be named as suggested by the
-server, for example if you download the DB package and the latest stable
-version of DB is 1.6.5, the downloaded file will be DB-1.6.5.tgz.',
- ),
- 'clear-cache' => array(
- 'summary' => 'Clear Web Services Cache',
- 'function' => 'doClearCache',
- 'shortcut' => 'cc',
- 'options' => array(),
- 'doc' => '
-Clear the REST cache. See also the cache_ttl configuration
-parameter.
-',
- ),
- );
-
- /**
- * PEAR_Command_Remote constructor.
- *
- * @access public
- */
- function PEAR_Command_Remote(&$ui, &$config)
- {
- parent::PEAR_Command_Common($ui, $config);
- }
-
- function _checkChannelForStatus($channel, $chan)
- {
- if (PEAR::isError($chan)) {
- $this->raiseError($chan);
- }
- if (!is_a($chan, 'PEAR_ChannelFile')) {
- return $this->raiseError('Internal corruption error: invalid channel "' .
- $channel . '"');
- }
- $rest = new PEAR_REST($this->config);
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- $mirror = $this->config->get('preferred_mirror', null,
- $channel);
- $a = $rest->downloadHttp('http://' . $channel .
- '/channel.xml', $chan->lastModified());
- PEAR::staticPopErrorHandling();
- if (!PEAR::isError($a) && $a) {
- $this->ui->outputData('WARNING: channel "' . $channel . '" has ' .
- 'updated its protocols, use "' . PEAR_RUNTYPE . ' channel-update ' . $channel .
- '" to update');
- }
- }
-
- function doRemoteInfo($command, $options, $params)
- {
- if (sizeof($params) != 1) {
- return $this->raiseError("$command expects one param: the remote package name");
- }
- $savechannel = $channel = $this->config->get('default_channel');
- $reg = &$this->config->getRegistry();
- $package = $params[0];
- $parsed = $reg->parsePackageName($package, $channel);
- if (PEAR::isError($parsed)) {
- return $this->raiseError('Invalid package name "' . $package . '"');
- }
-
- $channel = $parsed['channel'];
- $this->config->set('default_channel', $channel);
- $chan = $reg->getChannel($channel);
- if (PEAR::isError($e = $this->_checkChannelForStatus($channel, $chan))) {
- return $e;
- }
-
- $mirror = $this->config->get('preferred_mirror');
- if ($chan->supportsREST($mirror) && $base = $chan->getBaseURL('REST1.0', $mirror)) {
- $rest = &$this->config->getREST('1.0', array());
- $info = $rest->packageInfo($base, $parsed['package'], $channel);
- }
-
- if (!isset($info)) {
- return $this->raiseError('No supported protocol was found');
- }
-
- if (PEAR::isError($info)) {
- $this->config->set('default_channel', $savechannel);
- return $this->raiseError($info);
- }
-
- if (!isset($info['name'])) {
- return $this->raiseError('No remote package "' . $package . '" was found');
- }
-
- $installed = $reg->packageInfo($info['name'], null, $channel);
- $info['installed'] = $installed['version'] ? $installed['version'] : '- no -';
- if (is_array($info['installed'])) {
- $info['installed'] = $info['installed']['release'];
- }
-
- $this->ui->outputData($info, $command);
- $this->config->set('default_channel', $savechannel);
-
- return true;
- }
-
- function doRemoteList($command, $options, $params)
- {
- $savechannel = $channel = $this->config->get('default_channel');
- $reg = &$this->config->getRegistry();
- if (isset($options['channel'])) {
- $channel = $options['channel'];
- if (!$reg->channelExists($channel)) {
- return $this->raiseError('Channel "' . $channel . '" does not exist');
- }
-
- $this->config->set('default_channel', $channel);
- }
-
- $chan = $reg->getChannel($channel);
- if (PEAR::isError($e = $this->_checkChannelForStatus($channel, $chan))) {
- return $e;
- }
-
- $list_options = false;
- if ($this->config->get('preferred_state') == 'stable') {
- $list_options = true;
- }
-
- $available = array();
- if ($chan->supportsREST($this->config->get('preferred_mirror')) &&
- $base = $chan->getBaseURL('REST1.1', $this->config->get('preferred_mirror'))
- ) {
- // use faster list-all if available
- $rest = &$this->config->getREST('1.1', array());
- $available = $rest->listAll($base, $list_options, true, false, false, $chan->getName());
- } elseif ($chan->supportsREST($this->config->get('preferred_mirror')) &&
- $base = $chan->getBaseURL('REST1.0', $this->config->get('preferred_mirror'))) {
- $rest = &$this->config->getREST('1.0', array());
- $available = $rest->listAll($base, $list_options, true, false, false, $chan->getName());
- }
-
- if (PEAR::isError($available)) {
- $this->config->set('default_channel', $savechannel);
- return $this->raiseError($available);
- }
-
- $i = $j = 0;
- $data = array(
- 'caption' => 'Channel ' . $channel . ' Available packages:',
- 'border' => true,
- 'headline' => array('Package', 'Version'),
- 'channel' => $channel
- );
-
- if (count($available) == 0) {
- $data = '(no packages available yet)';
- } else {
- foreach ($available as $name => $info) {
- $version = (isset($info['stable']) && $info['stable']) ? $info['stable'] : '-n/a-';
- $data['data'][] = array($name, $version);
- }
- }
- $this->ui->outputData($data, $command);
- $this->config->set('default_channel', $savechannel);
- return true;
- }
-
- function doListAll($command, $options, $params)
- {
- $savechannel = $channel = $this->config->get('default_channel');
- $reg = &$this->config->getRegistry();
- if (isset($options['channel'])) {
- $channel = $options['channel'];
- if (!$reg->channelExists($channel)) {
- return $this->raiseError("Channel \"$channel\" does not exist");
- }
-
- $this->config->set('default_channel', $channel);
- }
-
- $list_options = false;
- if ($this->config->get('preferred_state') == 'stable') {
- $list_options = true;
- }
-
- $chan = $reg->getChannel($channel);
- if (PEAR::isError($e = $this->_checkChannelForStatus($channel, $chan))) {
- return $e;
- }
-
- if ($chan->supportsREST($this->config->get('preferred_mirror')) &&
- $base = $chan->getBaseURL('REST1.1', $this->config->get('preferred_mirror'))) {
- // use faster list-all if available
- $rest = &$this->config->getREST('1.1', array());
- $available = $rest->listAll($base, $list_options, false, false, false, $chan->getName());
- } elseif ($chan->supportsREST($this->config->get('preferred_mirror')) &&
- $base = $chan->getBaseURL('REST1.0', $this->config->get('preferred_mirror'))) {
- $rest = &$this->config->getREST('1.0', array());
- $available = $rest->listAll($base, $list_options, false, false, false, $chan->getName());
- }
-
- if (PEAR::isError($available)) {
- $this->config->set('default_channel', $savechannel);
- return $this->raiseError('The package list could not be fetched from the remote server. Please try again. (Debug info: "' . $available->getMessage() . '")');
- }
-
- $data = array(
- 'caption' => 'All packages [Channel ' . $channel . ']:',
- 'border' => true,
- 'headline' => array('Package', 'Latest', 'Local'),
- 'channel' => $channel,
- );
-
- if (isset($options['channelinfo'])) {
- // add full channelinfo
- $data['caption'] = 'Channel ' . $channel . ' All packages:';
- $data['headline'] = array('Channel', 'Package', 'Latest', 'Local',
- 'Description', 'Dependencies');
- }
- $local_pkgs = $reg->listPackages($channel);
-
- foreach ($available as $name => $info) {
- $installed = $reg->packageInfo($name, null, $channel);
- if (is_array($installed['version'])) {
- $installed['version'] = $installed['version']['release'];
- }
- $desc = $info['summary'];
- if (isset($params[$name])) {
- $desc .= "\n\n".$info['description'];
- }
- if (isset($options['mode']))
- {
- if ($options['mode'] == 'installed' && !isset($installed['version'])) {
- continue;
- }
- if ($options['mode'] == 'notinstalled' && isset($installed['version'])) {
- continue;
- }
- if ($options['mode'] == 'upgrades'
- && (!isset($installed['version']) || version_compare($installed['version'],
- $info['stable'], '>='))) {
- continue;
- }
- }
- $pos = array_search(strtolower($name), $local_pkgs);
- if ($pos !== false) {
- unset($local_pkgs[$pos]);
- }
-
- if (isset($info['stable']) && !$info['stable']) {
- $info['stable'] = null;
- }
-
- if (isset($options['channelinfo'])) {
- // add full channelinfo
- if ($info['stable'] === $info['unstable']) {
- $state = $info['state'];
- } else {
- $state = 'stable';
- }
- $latest = $info['stable'].' ('.$state.')';
- $local = '';
- if (isset($installed['version'])) {
- $inst_state = $reg->packageInfo($name, 'release_state', $channel);
- $local = $installed['version'].' ('.$inst_state.')';
- }
-
- $packageinfo = array(
- $channel,
- $name,
- $latest,
- $local,
- isset($desc) ? $desc : null,
- isset($info['deps']) ? $info['deps'] : null,
- );
- } else {
- $packageinfo = array(
- $reg->channelAlias($channel) . '/' . $name,
- isset($info['stable']) ? $info['stable'] : null,
- isset($installed['version']) ? $installed['version'] : null,
- isset($desc) ? $desc : null,
- isset($info['deps']) ? $info['deps'] : null,
- );
- }
- $data['data'][$info['category']][] = $packageinfo;
- }
-
- if (isset($options['mode']) && in_array($options['mode'], array('notinstalled', 'upgrades'))) {
- $this->config->set('default_channel', $savechannel);
- $this->ui->outputData($data, $command);
- return true;
- }
-
- foreach ($local_pkgs as $name) {
- $info = &$reg->getPackage($name, $channel);
- $data['data']['Local'][] = array(
- $reg->channelAlias($channel) . '/' . $info->getPackage(),
- '',
- $info->getVersion(),
- $info->getSummary(),
- $info->getDeps()
- );
- }
-
- $this->config->set('default_channel', $savechannel);
- $this->ui->outputData($data, $command);
- return true;
- }
-
- function doSearch($command, $options, $params)
- {
- if ((!isset($params[0]) || empty($params[0]))
- && (!isset($params[1]) || empty($params[1])))
- {
- return $this->raiseError('no valid search string supplied');
- }
-
- $channelinfo = isset($options['channelinfo']);
- $reg = &$this->config->getRegistry();
- if (isset($options['allchannels'])) {
- // search all channels
- unset($options['allchannels']);
- $channels = $reg->getChannels();
- $errors = array();
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- foreach ($channels as $channel) {
- if ($channel->getName() != '__uri') {
- $options['channel'] = $channel->getName();
- $ret = $this->doSearch($command, $options, $params);
- if (PEAR::isError($ret)) {
- $errors[] = $ret;
- }
- }
- }
-
- PEAR::staticPopErrorHandling();
- if (count($errors) !== 0) {
- // for now, only give first error
- return PEAR::raiseError($errors[0]);
- }
-
- return true;
- }
-
- $savechannel = $channel = $this->config->get('default_channel');
- $package = strtolower($params[0]);
- $summary = isset($params[1]) ? $params[1] : false;
- if (isset($options['channel'])) {
- $reg = &$this->config->getRegistry();
- $channel = $options['channel'];
- if (!$reg->channelExists($channel)) {
- return $this->raiseError('Channel "' . $channel . '" does not exist');
- }
-
- $this->config->set('default_channel', $channel);
- }
-
- $chan = $reg->getChannel($channel);
- if (PEAR::isError($e = $this->_checkChannelForStatus($channel, $chan))) {
- return $e;
- }
-
- if ($chan->supportsREST($this->config->get('preferred_mirror')) &&
- $base = $chan->getBaseURL('REST1.0', $this->config->get('preferred_mirror'))) {
- $rest = &$this->config->getREST('1.0', array());
- $available = $rest->listAll($base, false, false, $package, $summary, $chan->getName());
- }
-
- if (PEAR::isError($available)) {
- $this->config->set('default_channel', $savechannel);
- return $this->raiseError($available);
- }
-
- if (!$available && !$channelinfo) {
- // clean exit when not found, no error !
- $data = 'no packages found that match pattern "' . $package . '", for channel '.$channel.'.';
- $this->ui->outputData($data);
- $this->config->set('default_channel', $channel);
- return true;
- }
-
- if ($channelinfo) {
- $data = array(
- 'caption' => 'Matched packages, channel ' . $channel . ':',
- 'border' => true,
- 'headline' => array('Channel', 'Package', 'Stable/(Latest)', 'Local'),
- 'channel' => $channel
- );
- } else {
- $data = array(
- 'caption' => 'Matched packages, channel ' . $channel . ':',
- 'border' => true,
- 'headline' => array('Package', 'Stable/(Latest)', 'Local'),
- 'channel' => $channel
- );
- }
-
- if (!$available && $channelinfo) {
- unset($data['headline']);
- $data['data'] = 'No packages found that match pattern "' . $package . '".';
- $available = array();
- }
-
- foreach ($available as $name => $info) {
- $installed = $reg->packageInfo($name, null, $channel);
- $desc = $info['summary'];
- if (isset($params[$name]))
- $desc .= "\n\n".$info['description'];
-
- if (!isset($info['stable']) || !$info['stable']) {
- $version_remote = 'none';
- } else {
- if ($info['unstable']) {
- $version_remote = $info['unstable'];
- } else {
- $version_remote = $info['stable'];
- }
- $version_remote .= ' ('.$info['state'].')';
- }
- $version = is_array($installed['version']) ? $installed['version']['release'] :
- $installed['version'];
- if ($channelinfo) {
- $packageinfo = array(
- $channel,
- $name,
- $version_remote,
- $version,
- $desc,
- );
- } else {
- $packageinfo = array(
- $name,
- $version_remote,
- $version,
- $desc,
- );
- }
- $data['data'][$info['category']][] = $packageinfo;
- }
-
- $this->ui->outputData($data, $command);
- $this->config->set('default_channel', $channel);
- return true;
- }
-
- function &getDownloader($options)
- {
- if (!class_exists('PEAR_Downloader')) {
- require_once 'PEAR/Downloader.php';
- }
- $a = &new PEAR_Downloader($this->ui, $options, $this->config);
- return $a;
- }
-
- function doDownload($command, $options, $params)
- {
- // make certain that dependencies are ignored
- $options['downloadonly'] = 1;
-
- // eliminate error messages for preferred_state-related errors
- /* TODO: Should be an option, but until now download does respect
- prefered state */
- /* $options['ignorepreferred_state'] = 1; */
- // eliminate error messages for preferred_state-related errors
-
- $downloader = &$this->getDownloader($options);
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- $e = $downloader->setDownloadDir(getcwd());
- PEAR::staticPopErrorHandling();
- if (PEAR::isError($e)) {
- return $this->raiseError('Current directory is not writeable, cannot download');
- }
-
- $errors = array();
- $downloaded = array();
- $err = $downloader->download($params);
- if (PEAR::isError($err)) {
- return $err;
- }
-
- $errors = $downloader->getErrorMsgs();
- if (count($errors)) {
- foreach ($errors as $error) {
- if ($error !== null) {
- $this->ui->outputData($error);
- }
- }
-
- return $this->raiseError("$command failed");
- }
-
- $downloaded = $downloader->getDownloadedPackages();
- foreach ($downloaded as $pkg) {
- $this->ui->outputData("File $pkg[file] downloaded", $command);
- }
-
- return true;
- }
-
- function downloadCallback($msg, $params = null)
- {
- if ($msg == 'done') {
- $this->bytes_downloaded = $params;
- }
- }
-
- function doListUpgrades($command, $options, $params)
- {
- require_once 'PEAR/Common.php';
- if (isset($params[0]) && !is_array(PEAR_Common::betterStates($params[0]))) {
- return $this->raiseError($params[0] . ' is not a valid state (stable/beta/alpha/devel/etc.) try "pear help list-upgrades"');
- }
-
- $savechannel = $channel = $this->config->get('default_channel');
- $reg = &$this->config->getRegistry();
- foreach ($reg->listChannels() as $channel) {
- $inst = array_flip($reg->listPackages($channel));
- if (!count($inst)) {
- continue;
- }
-
- if ($channel == '__uri') {
- continue;
- }
-
- $this->config->set('default_channel', $channel);
- $state = empty($params[0]) ? $this->config->get('preferred_state') : $params[0];
-
- $caption = $channel . ' Available Upgrades';
- $chan = $reg->getChannel($channel);
- if (PEAR::isError($e = $this->_checkChannelForStatus($channel, $chan))) {
- return $e;
- }
-
- $latest = array();
- $base2 = false;
- $preferred_mirror = $this->config->get('preferred_mirror');
- if ($chan->supportsREST($preferred_mirror) &&
- (
- //($base2 = $chan->getBaseURL('REST1.4', $preferred_mirror)) ||
- ($base = $chan->getBaseURL('REST1.0', $preferred_mirror))
- )
-
- ) {
- if ($base2) {
- $rest = &$this->config->getREST('1.4', array());
- $base = $base2;
- } else {
- $rest = &$this->config->getREST('1.0', array());
- }
-
- if (empty($state) || $state == 'any') {
- $state = false;
- } else {
- $caption .= ' (' . implode(', ', PEAR_Common::betterStates($state, true)) . ')';
- }
-
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- $latest = $rest->listLatestUpgrades($base, $state, $inst, $channel, $reg);
- PEAR::staticPopErrorHandling();
- }
-
- if (PEAR::isError($latest)) {
- $this->ui->outputData($latest->getMessage());
- continue;
- }
-
- $caption .= ':';
- if (PEAR::isError($latest)) {
- $this->config->set('default_channel', $savechannel);
- return $latest;
- }
-
- $data = array(
- 'caption' => $caption,
- 'border' => 1,
- 'headline' => array('Channel', 'Package', 'Local', 'Remote', 'Size'),
- 'channel' => $channel
- );
-
- foreach ((array)$latest as $pkg => $info) {
- $package = strtolower($pkg);
- if (!isset($inst[$package])) {
- // skip packages we don't have installed
- continue;
- }
-
- extract($info);
- $inst_version = $reg->packageInfo($package, 'version', $channel);
- $inst_state = $reg->packageInfo($package, 'release_state', $channel);
- if (version_compare("$version", "$inst_version", "le")) {
- // installed version is up-to-date
- continue;
- }
-
- if ($filesize >= 20480) {
- $filesize += 1024 - ($filesize % 1024);
- $fs = sprintf("%dkB", $filesize / 1024);
- } elseif ($filesize > 0) {
- $filesize += 103 - ($filesize % 103);
- $fs = sprintf("%.1fkB", $filesize / 1024.0);
- } else {
- $fs = " -"; // XXX center instead
- }
-
- $data['data'][] = array($channel, $pkg, "$inst_version ($inst_state)", "$version ($state)", $fs);
- }
-
- if (isset($options['channelinfo'])) {
- if (empty($data['data'])) {
- unset($data['headline']);
- if (count($inst) == 0) {
- $data['data'] = '(no packages installed)';
- } else {
- $data['data'] = '(no upgrades available)';
- }
- }
- $this->ui->outputData($data, $command);
- } else {
- if (empty($data['data'])) {
- $this->ui->outputData('Channel ' . $channel . ': No upgrades available');
- } else {
- $this->ui->outputData($data, $command);
- }
- }
- }
-
- $this->config->set('default_channel', $savechannel);
- return true;
- }
-
- function doClearCache($command, $options, $params)
- {
- $cache_dir = $this->config->get('cache_dir');
- $verbose = $this->config->get('verbose');
- $output = '';
- if (!file_exists($cache_dir) || !is_dir($cache_dir)) {
- return $this->raiseError("$cache_dir does not exist or is not a directory");
- }
-
- if (!($dp = @opendir($cache_dir))) {
- return $this->raiseError("opendir($cache_dir) failed: $php_errormsg");
- }
-
- if ($verbose >= 1) {
- $output .= "reading directory $cache_dir\n";
- }
-
- $num = 0;
- while ($ent = readdir($dp)) {
- if (preg_match('/rest.cache(file|id)\\z/', $ent)) {
- $path = $cache_dir . DIRECTORY_SEPARATOR . $ent;
- if (file_exists($path)) {
- $ok = @unlink($path);
- } else {
- $ok = false;
- $php_errormsg = '';
- }
-
- if ($ok) {
- if ($verbose >= 2) {
- $output .= "deleted $path\n";
- }
- $num++;
- } elseif ($verbose >= 1) {
- $output .= "failed to delete $path $php_errormsg\n";
- }
- }
- }
-
- closedir($dp);
- if ($verbose >= 1) {
- $output .= "$num cache entries cleared\n";
- }
-
- $this->ui->outputData(rtrim($output), $command);
- return $num;
- }
-} \ No newline at end of file
diff --git a/3rdparty/PEAR/Command/Remote.xml b/3rdparty/PEAR/Command/Remote.xml
deleted file mode 100644
index b4f6100c793..00000000000
--- a/3rdparty/PEAR/Command/Remote.xml
+++ /dev/null
@@ -1,109 +0,0 @@
-<commands version="1.0">
- <remote-info>
- <summary>Information About Remote Packages</summary>
- <function>doRemoteInfo</function>
- <shortcut>ri</shortcut>
- <options />
- <doc>&lt;package&gt;
-Get details on a package from the server.</doc>
- </remote-info>
- <list-upgrades>
- <summary>List Available Upgrades</summary>
- <function>doListUpgrades</function>
- <shortcut>lu</shortcut>
- <options>
- <channelinfo>
- <shortopt>i</shortopt>
- <doc>output fully channel-aware data, even on failure</doc>
- </channelinfo>
- </options>
- <doc>[preferred_state]
-List releases on the server of packages you have installed where
-a newer version is available with the same release state (stable etc.)
-or the state passed as the second parameter.</doc>
- </list-upgrades>
- <remote-list>
- <summary>List Remote Packages</summary>
- <function>doRemoteList</function>
- <shortcut>rl</shortcut>
- <options>
- <channel>
- <shortopt>c</shortopt>
- <doc>specify a channel other than the default channel</doc>
- <arg>CHAN</arg>
- </channel>
- </options>
- <doc>
-Lists the packages available on the configured server along with the
-latest stable release of each package.</doc>
- </remote-list>
- <search>
- <summary>Search remote package database</summary>
- <function>doSearch</function>
- <shortcut>sp</shortcut>
- <options>
- <channel>
- <shortopt>c</shortopt>
- <doc>specify a channel other than the default channel</doc>
- <arg>CHAN</arg>
- </channel>
- <allchannels>
- <shortopt>a</shortopt>
- <doc>search packages from all known channels</doc>
- </allchannels>
- <channelinfo>
- <shortopt>i</shortopt>
- <doc>output fully channel-aware data, even on failure</doc>
- </channelinfo>
- </options>
- <doc>[packagename] [packageinfo]
-Lists all packages which match the search parameters. The first
-parameter is a fragment of a packagename. The default channel
-will be used unless explicitly overridden. The second parameter
-will be used to match any portion of the summary/description</doc>
- </search>
- <list-all>
- <summary>List All Packages</summary>
- <function>doListAll</function>
- <shortcut>la</shortcut>
- <options>
- <channel>
- <shortopt>c</shortopt>
- <doc>specify a channel other than the default channel</doc>
- <arg>CHAN</arg>
- </channel>
- <channelinfo>
- <shortopt>i</shortopt>
- <doc>output fully channel-aware data, even on failure</doc>
- </channelinfo>
- </options>
- <doc>
-Lists the packages available on the configured server along with the
-latest stable release of each package.</doc>
- </list-all>
- <download>
- <summary>Download Package</summary>
- <function>doDownload</function>
- <shortcut>d</shortcut>
- <options>
- <nocompress>
- <shortopt>Z</shortopt>
- <doc>download an uncompressed (.tar) file</doc>
- </nocompress>
- </options>
- <doc>&lt;package&gt;...
-Download package tarballs. The files will be named as suggested by the
-server, for example if you download the DB package and the latest stable
-version of DB is 1.6.5, the downloaded file will be DB-1.6.5.tgz.</doc>
- </download>
- <clear-cache>
- <summary>Clear Web Services Cache</summary>
- <function>doClearCache</function>
- <shortcut>cc</shortcut>
- <options />
- <doc>
-Clear the XML-RPC/REST cache. See also the cache_ttl configuration
-parameter.
-</doc>
- </clear-cache>
-</commands> \ No newline at end of file
diff --git a/3rdparty/PEAR/Command/Test.php b/3rdparty/PEAR/Command/Test.php
deleted file mode 100644
index a757d9e5790..00000000000
--- a/3rdparty/PEAR/Command/Test.php
+++ /dev/null
@@ -1,337 +0,0 @@
-<?php
-/**
- * PEAR_Command_Test (run-tests)
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Stig Bakken <ssb@php.net>
- * @author Martin Jansen <mj@php.net>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Test.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 0.1
- */
-
-/**
- * base class
- */
-require_once 'PEAR/Command/Common.php';
-
-/**
- * PEAR commands for login/logout
- *
- * @category pear
- * @package PEAR
- * @author Stig Bakken <ssb@php.net>
- * @author Martin Jansen <mj@php.net>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 0.1
- */
-
-class PEAR_Command_Test extends PEAR_Command_Common
-{
- var $commands = array(
- 'run-tests' => array(
- 'summary' => 'Run Regression Tests',
- 'function' => 'doRunTests',
- 'shortcut' => 'rt',
- 'options' => array(
- 'recur' => array(
- 'shortopt' => 'r',
- 'doc' => 'Run tests in child directories, recursively. 4 dirs deep maximum',
- ),
- 'ini' => array(
- 'shortopt' => 'i',
- 'doc' => 'actual string of settings to pass to php in format " -d setting=blah"',
- 'arg' => 'SETTINGS'
- ),
- 'realtimelog' => array(
- 'shortopt' => 'l',
- 'doc' => 'Log test runs/results as they are run',
- ),
- 'quiet' => array(
- 'shortopt' => 'q',
- 'doc' => 'Only display detail for failed tests',
- ),
- 'simple' => array(
- 'shortopt' => 's',
- 'doc' => 'Display simple output for all tests',
- ),
- 'package' => array(
- 'shortopt' => 'p',
- 'doc' => 'Treat parameters as installed packages from which to run tests',
- ),
- 'phpunit' => array(
- 'shortopt' => 'u',
- 'doc' => 'Search parameters for AllTests.php, and use that to run phpunit-based tests
-If none is found, all .phpt tests will be tried instead.',
- ),
- 'tapoutput' => array(
- 'shortopt' => 't',
- 'doc' => 'Output run-tests.log in TAP-compliant format',
- ),
- 'cgi' => array(
- 'shortopt' => 'c',
- 'doc' => 'CGI php executable (needed for tests with POST/GET section)',
- 'arg' => 'PHPCGI',
- ),
- 'coverage' => array(
- 'shortopt' => 'x',
- 'doc' => 'Generate a code coverage report (requires Xdebug 2.0.0+)',
- ),
- ),
- 'doc' => '[testfile|dir ...]
-Run regression tests with PHP\'s regression testing script (run-tests.php).',
- ),
- );
-
- var $output;
-
- /**
- * PEAR_Command_Test constructor.
- *
- * @access public
- */
- function PEAR_Command_Test(&$ui, &$config)
- {
- parent::PEAR_Command_Common($ui, $config);
- }
-
- function doRunTests($command, $options, $params)
- {
- if (isset($options['phpunit']) && isset($options['tapoutput'])) {
- return $this->raiseError('ERROR: cannot use both --phpunit and --tapoutput at the same time');
- }
-
- require_once 'PEAR/Common.php';
- require_once 'System.php';
- $log = new PEAR_Common;
- $log->ui = &$this->ui; // slightly hacky, but it will work
- $tests = array();
- $depth = isset($options['recur']) ? 14 : 1;
-
- if (!count($params)) {
- $params[] = '.';
- }
-
- if (isset($options['package'])) {
- $oldparams = $params;
- $params = array();
- $reg = &$this->config->getRegistry();
- foreach ($oldparams as $param) {
- $pname = $reg->parsePackageName($param, $this->config->get('default_channel'));
- if (PEAR::isError($pname)) {
- return $this->raiseError($pname);
- }
-
- $package = &$reg->getPackage($pname['package'], $pname['channel']);
- if (!$package) {
- return PEAR::raiseError('Unknown package "' .
- $reg->parsedPackageNameToString($pname) . '"');
- }
-
- $filelist = $package->getFilelist();
- foreach ($filelist as $name => $atts) {
- if (isset($atts['role']) && $atts['role'] != 'test') {
- continue;
- }
-
- if (isset($options['phpunit']) && preg_match('/AllTests\.php\\z/i', $name)) {
- $params[] = $atts['installed_as'];
- continue;
- } elseif (!preg_match('/\.phpt\\z/', $name)) {
- continue;
- }
- $params[] = $atts['installed_as'];
- }
- }
- }
-
- foreach ($params as $p) {
- if (is_dir($p)) {
- if (isset($options['phpunit'])) {
- $dir = System::find(array($p, '-type', 'f',
- '-maxdepth', $depth,
- '-name', 'AllTests.php'));
- if (count($dir)) {
- foreach ($dir as $p) {
- $p = realpath($p);
- if (!count($tests) ||
- (count($tests) && strlen($p) < strlen($tests[0]))) {
- // this is in a higher-level directory, use this one instead.
- $tests = array($p);
- }
- }
- }
- continue;
- }
-
- $args = array($p, '-type', 'f', '-name', '*.phpt');
- } else {
- if (isset($options['phpunit'])) {
- if (preg_match('/AllTests\.php\\z/i', $p)) {
- $p = realpath($p);
- if (!count($tests) ||
- (count($tests) && strlen($p) < strlen($tests[0]))) {
- // this is in a higher-level directory, use this one instead.
- $tests = array($p);
- }
- }
- continue;
- }
-
- if (file_exists($p) && preg_match('/\.phpt$/', $p)) {
- $tests[] = $p;
- continue;
- }
-
- if (!preg_match('/\.phpt\\z/', $p)) {
- $p .= '.phpt';
- }
-
- $args = array(dirname($p), '-type', 'f', '-name', $p);
- }
-
- if (!isset($options['recur'])) {
- $args[] = '-maxdepth';
- $args[] = 1;
- }
-
- $dir = System::find($args);
- $tests = array_merge($tests, $dir);
- }
-
- $ini_settings = '';
- if (isset($options['ini'])) {
- $ini_settings .= $options['ini'];
- }
-
- if (isset($_ENV['TEST_PHP_INCLUDE_PATH'])) {
- $ini_settings .= " -d include_path={$_ENV['TEST_PHP_INCLUDE_PATH']}";
- }
-
- if ($ini_settings) {
- $this->ui->outputData('Using INI settings: "' . $ini_settings . '"');
- }
-
- $skipped = $passed = $failed = array();
- $tests_count = count($tests);
- $this->ui->outputData('Running ' . $tests_count . ' tests', $command);
- $start = time();
- if (isset($options['realtimelog']) && file_exists('run-tests.log')) {
- unlink('run-tests.log');
- }
-
- if (isset($options['tapoutput'])) {
- $tap = '1..' . $tests_count . "\n";
- }
-
- require_once 'PEAR/RunTest.php';
- $run = new PEAR_RunTest($log, $options);
- $run->tests_count = $tests_count;
-
- if (isset($options['coverage']) && extension_loaded('xdebug')){
- $run->xdebug_loaded = true;
- } else {
- $run->xdebug_loaded = false;
- }
-
- $j = $i = 1;
- foreach ($tests as $t) {
- if (isset($options['realtimelog'])) {
- $fp = @fopen('run-tests.log', 'a');
- if ($fp) {
- fwrite($fp, "Running test [$i / $tests_count] $t...");
- fclose($fp);
- }
- }
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- if (isset($options['phpunit'])) {
- $result = $run->runPHPUnit($t, $ini_settings);
- } else {
- $result = $run->run($t, $ini_settings, $j);
- }
- PEAR::staticPopErrorHandling();
- if (PEAR::isError($result)) {
- $this->ui->log($result->getMessage());
- continue;
- }
-
- if (isset($options['tapoutput'])) {
- $tap .= $result[0] . ' ' . $i . $result[1] . "\n";
- continue;
- }
-
- if (isset($options['realtimelog'])) {
- $fp = @fopen('run-tests.log', 'a');
- if ($fp) {
- fwrite($fp, "$result\n");
- fclose($fp);
- }
- }
-
- if ($result == 'FAILED') {
- $failed[] = $t;
- }
- if ($result == 'PASSED') {
- $passed[] = $t;
- }
- if ($result == 'SKIPPED') {
- $skipped[] = $t;
- }
-
- $j++;
- }
-
- $total = date('i:s', time() - $start);
- if (isset($options['tapoutput'])) {
- $fp = @fopen('run-tests.log', 'w');
- if ($fp) {
- fwrite($fp, $tap, strlen($tap));
- fclose($fp);
- $this->ui->outputData('wrote TAP-format log to "' .realpath('run-tests.log') .
- '"', $command);
- }
- } else {
- if (count($failed)) {
- $output = "TOTAL TIME: $total\n";
- $output .= count($passed) . " PASSED TESTS\n";
- $output .= count($skipped) . " SKIPPED TESTS\n";
- $output .= count($failed) . " FAILED TESTS:\n";
- foreach ($failed as $failure) {
- $output .= $failure . "\n";
- }
-
- $mode = isset($options['realtimelog']) ? 'a' : 'w';
- $fp = @fopen('run-tests.log', $mode);
-
- if ($fp) {
- fwrite($fp, $output, strlen($output));
- fclose($fp);
- $this->ui->outputData('wrote log to "' . realpath('run-tests.log') . '"', $command);
- }
- } elseif (file_exists('run-tests.log') && !is_dir('run-tests.log')) {
- @unlink('run-tests.log');
- }
- }
- $this->ui->outputData('TOTAL TIME: ' . $total);
- $this->ui->outputData(count($passed) . ' PASSED TESTS', $command);
- $this->ui->outputData(count($skipped) . ' SKIPPED TESTS', $command);
- if (count($failed)) {
- $this->ui->outputData(count($failed) . ' FAILED TESTS:', $command);
- foreach ($failed as $failure) {
- $this->ui->outputData($failure, $command);
- }
- }
-
- return true;
- }
-} \ No newline at end of file
diff --git a/3rdparty/PEAR/Command/Test.xml b/3rdparty/PEAR/Command/Test.xml
deleted file mode 100644
index bbe9fcccc51..00000000000
--- a/3rdparty/PEAR/Command/Test.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<commands version="1.0">
- <run-tests>
- <summary>Run Regression Tests</summary>
- <function>doRunTests</function>
- <shortcut>rt</shortcut>
- <options>
- <recur>
- <shortopt>r</shortopt>
- <doc>Run tests in child directories, recursively. 4 dirs deep maximum</doc>
- </recur>
- <ini>
- <shortopt>i</shortopt>
- <doc>actual string of settings to pass to php in format &quot; -d setting=blah&quot;</doc>
- <arg>SETTINGS</arg>
- </ini>
- <realtimelog>
- <shortopt>l</shortopt>
- <doc>Log test runs/results as they are run</doc>
- </realtimelog>
- <quiet>
- <shortopt>q</shortopt>
- <doc>Only display detail for failed tests</doc>
- </quiet>
- <simple>
- <shortopt>s</shortopt>
- <doc>Display simple output for all tests</doc>
- </simple>
- <package>
- <shortopt>p</shortopt>
- <doc>Treat parameters as installed packages from which to run tests</doc>
- </package>
- <phpunit>
- <shortopt>u</shortopt>
- <doc>Search parameters for AllTests.php, and use that to run phpunit-based tests
-If none is found, all .phpt tests will be tried instead.</doc>
- </phpunit>
- <tapoutput>
- <shortopt>t</shortopt>
- <doc>Output run-tests.log in TAP-compliant format</doc>
- </tapoutput>
- <cgi>
- <shortopt>c</shortopt>
- <doc>CGI php executable (needed for tests with POST/GET section)</doc>
- <arg>PHPCGI</arg>
- </cgi>
- <coverage>
- <shortopt>x</shortopt>
- <doc>Generate a code coverage report (requires Xdebug 2.0.0+)</doc>
- </coverage>
- </options>
- <doc>[testfile|dir ...]
-Run regression tests with PHP&#039;s regression testing script (run-tests.php).</doc>
- </run-tests>
-</commands> \ No newline at end of file
diff --git a/3rdparty/PEAR/Common.php b/3rdparty/PEAR/Common.php
deleted file mode 100644
index 83f2de742ac..00000000000
--- a/3rdparty/PEAR/Common.php
+++ /dev/null
@@ -1,837 +0,0 @@
-<?php
-/**
- * PEAR_Common, the base class for the PEAR Installer
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Stig Bakken <ssb@php.net>
- * @author Tomas V. V. Cox <cox@idecnet.com>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Common.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 0.1.0
- * @deprecated File deprecated since Release 1.4.0a1
- */
-
-/**
- * Include error handling
- */
-require_once 'PEAR.php';
-
-/**
- * PEAR_Common error when an invalid PHP file is passed to PEAR_Common::analyzeSourceCode()
- */
-define('PEAR_COMMON_ERROR_INVALIDPHP', 1);
-define('_PEAR_COMMON_PACKAGE_NAME_PREG', '[A-Za-z][a-zA-Z0-9_]+');
-define('PEAR_COMMON_PACKAGE_NAME_PREG', '/^' . _PEAR_COMMON_PACKAGE_NAME_PREG . '\\z/');
-
-// this should allow: 1, 1.0, 1.0RC1, 1.0dev, 1.0dev123234234234, 1.0a1, 1.0b1, 1.0pl1
-define('_PEAR_COMMON_PACKAGE_VERSION_PREG', '\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?');
-define('PEAR_COMMON_PACKAGE_VERSION_PREG', '/^' . _PEAR_COMMON_PACKAGE_VERSION_PREG . '\\z/i');
-
-// XXX far from perfect :-)
-define('_PEAR_COMMON_PACKAGE_DOWNLOAD_PREG', '(' . _PEAR_COMMON_PACKAGE_NAME_PREG .
- ')(-([.0-9a-zA-Z]+))?');
-define('PEAR_COMMON_PACKAGE_DOWNLOAD_PREG', '/^' . _PEAR_COMMON_PACKAGE_DOWNLOAD_PREG .
- '\\z/');
-
-define('_PEAR_CHANNELS_NAME_PREG', '[A-Za-z][a-zA-Z0-9\.]+');
-define('PEAR_CHANNELS_NAME_PREG', '/^' . _PEAR_CHANNELS_NAME_PREG . '\\z/');
-
-// this should allow any dns or IP address, plus a path - NO UNDERSCORES ALLOWED
-define('_PEAR_CHANNELS_SERVER_PREG', '[a-zA-Z0-9\-]+(?:\.[a-zA-Z0-9\-]+)*(\/[a-zA-Z0-9\-]+)*');
-define('PEAR_CHANNELS_SERVER_PREG', '/^' . _PEAR_CHANNELS_SERVER_PREG . '\\z/i');
-
-define('_PEAR_CHANNELS_PACKAGE_PREG', '(' ._PEAR_CHANNELS_SERVER_PREG . ')\/('
- . _PEAR_COMMON_PACKAGE_NAME_PREG . ')');
-define('PEAR_CHANNELS_PACKAGE_PREG', '/^' . _PEAR_CHANNELS_PACKAGE_PREG . '\\z/i');
-
-define('_PEAR_COMMON_CHANNEL_DOWNLOAD_PREG', '(' . _PEAR_CHANNELS_NAME_PREG . ')::('
- . _PEAR_COMMON_PACKAGE_NAME_PREG . ')(-([.0-9a-zA-Z]+))?');
-define('PEAR_COMMON_CHANNEL_DOWNLOAD_PREG', '/^' . _PEAR_COMMON_CHANNEL_DOWNLOAD_PREG . '\\z/');
-
-/**
- * List of temporary files and directories registered by
- * PEAR_Common::addTempFile().
- * @var array
- */
-$GLOBALS['_PEAR_Common_tempfiles'] = array();
-
-/**
- * Valid maintainer roles
- * @var array
- */
-$GLOBALS['_PEAR_Common_maintainer_roles'] = array('lead','developer','contributor','helper');
-
-/**
- * Valid release states
- * @var array
- */
-$GLOBALS['_PEAR_Common_release_states'] = array('alpha','beta','stable','snapshot','devel');
-
-/**
- * Valid dependency types
- * @var array
- */
-$GLOBALS['_PEAR_Common_dependency_types'] = array('pkg','ext','php','prog','ldlib','rtlib','os','websrv','sapi');
-
-/**
- * Valid dependency relations
- * @var array
- */
-$GLOBALS['_PEAR_Common_dependency_relations'] = array('has','eq','lt','le','gt','ge','not', 'ne');
-
-/**
- * Valid file roles
- * @var array
- */
-$GLOBALS['_PEAR_Common_file_roles'] = array('php','ext','test','doc','data','src','script');
-
-/**
- * Valid replacement types
- * @var array
- */
-$GLOBALS['_PEAR_Common_replacement_types'] = array('php-const', 'pear-config', 'package-info');
-
-/**
- * Valid "provide" types
- * @var array
- */
-$GLOBALS['_PEAR_Common_provide_types'] = array('ext', 'prog', 'class', 'function', 'feature', 'api');
-
-/**
- * Valid "provide" types
- * @var array
- */
-$GLOBALS['_PEAR_Common_script_phases'] = array('pre-install', 'post-install', 'pre-uninstall', 'post-uninstall', 'pre-build', 'post-build', 'pre-configure', 'post-configure', 'pre-setup', 'post-setup');
-
-/**
- * Class providing common functionality for PEAR administration classes.
- * @category pear
- * @package PEAR
- * @author Stig Bakken <ssb@php.net>
- * @author Tomas V. V. Cox <cox@idecnet.com>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a1
- * @deprecated This class will disappear, and its components will be spread
- * into smaller classes, like the AT&T breakup, as of Release 1.4.0a1
- */
-class PEAR_Common extends PEAR
-{
- /**
- * User Interface object (PEAR_Frontend_* class). If null,
- * the log() method uses print.
- * @var object
- */
- var $ui = null;
-
- /**
- * Configuration object (PEAR_Config).
- * @var PEAR_Config
- */
- var $config = null;
-
- /** stack of elements, gives some sort of XML context */
- var $element_stack = array();
-
- /** name of currently parsed XML element */
- var $current_element;
-
- /** array of attributes of the currently parsed XML element */
- var $current_attributes = array();
-
- /** assoc with information about a package */
- var $pkginfo = array();
-
- var $current_path = null;
-
- /**
- * Flag variable used to mark a valid package file
- * @var boolean
- * @access private
- */
- var $_validPackageFile;
-
- /**
- * PEAR_Common constructor
- *
- * @access public
- */
- function PEAR_Common()
- {
- parent::PEAR();
- $this->config = PEAR_Config::singleton();
- $this->debug = $this->config->get('verbose');
- }
-
- /**
- * PEAR_Common destructor
- *
- * @access private
- */
- function _PEAR_Common()
- {
- // doesn't work due to bug #14744
- //$tempfiles = $this->_tempfiles;
- $tempfiles =& $GLOBALS['_PEAR_Common_tempfiles'];
- while ($file = array_shift($tempfiles)) {
- if (@is_dir($file)) {
- if (!class_exists('System')) {
- require_once 'System.php';
- }
-
- System::rm(array('-rf', $file));
- } elseif (file_exists($file)) {
- unlink($file);
- }
- }
- }
-
- /**
- * Register a temporary file or directory. When the destructor is
- * executed, all registered temporary files and directories are
- * removed.
- *
- * @param string $file name of file or directory
- *
- * @return void
- *
- * @access public
- */
- function addTempFile($file)
- {
- if (!class_exists('PEAR_Frontend')) {
- require_once 'PEAR/Frontend.php';
- }
- PEAR_Frontend::addTempFile($file);
- }
-
- /**
- * Wrapper to System::mkDir(), creates a directory as well as
- * any necessary parent directories.
- *
- * @param string $dir directory name
- *
- * @return bool TRUE on success, or a PEAR error
- *
- * @access public
- */
- function mkDirHier($dir)
- {
- // Only used in Installer - move it there ?
- $this->log(2, "+ create dir $dir");
- if (!class_exists('System')) {
- require_once 'System.php';
- }
- return System::mkDir(array('-p', $dir));
- }
-
- /**
- * Logging method.
- *
- * @param int $level log level (0 is quiet, higher is noisier)
- * @param string $msg message to write to the log
- *
- * @return void
- *
- * @access public
- * @static
- */
- function log($level, $msg, $append_crlf = true)
- {
- if ($this->debug >= $level) {
- if (!class_exists('PEAR_Frontend')) {
- require_once 'PEAR/Frontend.php';
- }
-
- $ui = &PEAR_Frontend::singleton();
- if (is_a($ui, 'PEAR_Frontend')) {
- $ui->log($msg, $append_crlf);
- } else {
- print "$msg\n";
- }
- }
- }
-
- /**
- * Create and register a temporary directory.
- *
- * @param string $tmpdir (optional) Directory to use as tmpdir.
- * Will use system defaults (for example
- * /tmp or c:\windows\temp) if not specified
- *
- * @return string name of created directory
- *
- * @access public
- */
- function mkTempDir($tmpdir = '')
- {
- $topt = $tmpdir ? array('-t', $tmpdir) : array();
- $topt = array_merge($topt, array('-d', 'pear'));
- if (!class_exists('System')) {
- require_once 'System.php';
- }
-
- if (!$tmpdir = System::mktemp($topt)) {
- return false;
- }
-
- $this->addTempFile($tmpdir);
- return $tmpdir;
- }
-
- /**
- * Set object that represents the frontend to be used.
- *
- * @param object Reference of the frontend object
- * @return void
- * @access public
- */
- function setFrontendObject(&$ui)
- {
- $this->ui = &$ui;
- }
-
- /**
- * Return an array containing all of the states that are more stable than
- * or equal to the passed in state
- *
- * @param string Release state
- * @param boolean Determines whether to include $state in the list
- * @return false|array False if $state is not a valid release state
- */
- function betterStates($state, $include = false)
- {
- static $states = array('snapshot', 'devel', 'alpha', 'beta', 'stable');
- $i = array_search($state, $states);
- if ($i === false) {
- return false;
- }
- if ($include) {
- $i--;
- }
- return array_slice($states, $i + 1);
- }
-
- /**
- * Get the valid roles for a PEAR package maintainer
- *
- * @return array
- * @static
- */
- function getUserRoles()
- {
- return $GLOBALS['_PEAR_Common_maintainer_roles'];
- }
-
- /**
- * Get the valid package release states of packages
- *
- * @return array
- * @static
- */
- function getReleaseStates()
- {
- return $GLOBALS['_PEAR_Common_release_states'];
- }
-
- /**
- * Get the implemented dependency types (php, ext, pkg etc.)
- *
- * @return array
- * @static
- */
- function getDependencyTypes()
- {
- return $GLOBALS['_PEAR_Common_dependency_types'];
- }
-
- /**
- * Get the implemented dependency relations (has, lt, ge etc.)
- *
- * @return array
- * @static
- */
- function getDependencyRelations()
- {
- return $GLOBALS['_PEAR_Common_dependency_relations'];
- }
-
- /**
- * Get the implemented file roles
- *
- * @return array
- * @static
- */
- function getFileRoles()
- {
- return $GLOBALS['_PEAR_Common_file_roles'];
- }
-
- /**
- * Get the implemented file replacement types in
- *
- * @return array
- * @static
- */
- function getReplacementTypes()
- {
- return $GLOBALS['_PEAR_Common_replacement_types'];
- }
-
- /**
- * Get the implemented file replacement types in
- *
- * @return array
- * @static
- */
- function getProvideTypes()
- {
- return $GLOBALS['_PEAR_Common_provide_types'];
- }
-
- /**
- * Get the implemented file replacement types in
- *
- * @return array
- * @static
- */
- function getScriptPhases()
- {
- return $GLOBALS['_PEAR_Common_script_phases'];
- }
-
- /**
- * Test whether a string contains a valid package name.
- *
- * @param string $name the package name to test
- *
- * @return bool
- *
- * @access public
- */
- function validPackageName($name)
- {
- return (bool)preg_match(PEAR_COMMON_PACKAGE_NAME_PREG, $name);
- }
-
- /**
- * Test whether a string contains a valid package version.
- *
- * @param string $ver the package version to test
- *
- * @return bool
- *
- * @access public
- */
- function validPackageVersion($ver)
- {
- return (bool)preg_match(PEAR_COMMON_PACKAGE_VERSION_PREG, $ver);
- }
-
- /**
- * @param string $path relative or absolute include path
- * @return boolean
- * @static
- */
- function isIncludeable($path)
- {
- if (file_exists($path) && is_readable($path)) {
- return true;
- }
-
- $ipath = explode(PATH_SEPARATOR, ini_get('include_path'));
- foreach ($ipath as $include) {
- $test = realpath($include . DIRECTORY_SEPARATOR . $path);
- if (file_exists($test) && is_readable($test)) {
- return true;
- }
- }
-
- return false;
- }
-
- function _postProcessChecks($pf)
- {
- if (!PEAR::isError($pf)) {
- return $this->_postProcessValidPackagexml($pf);
- }
-
- $errs = $pf->getUserinfo();
- if (is_array($errs)) {
- foreach ($errs as $error) {
- $e = $this->raiseError($error['message'], $error['code'], null, null, $error);
- }
- }
-
- return $pf;
- }
-
- /**
- * Returns information about a package file. Expects the name of
- * a gzipped tar file as input.
- *
- * @param string $file name of .tgz file
- *
- * @return array array with package information
- *
- * @access public
- * @deprecated use PEAR_PackageFile->fromTgzFile() instead
- *
- */
- function infoFromTgzFile($file)
- {
- $packagefile = &new PEAR_PackageFile($this->config);
- $pf = &$packagefile->fromTgzFile($file, PEAR_VALIDATE_NORMAL);
- return $this->_postProcessChecks($pf);
- }
-
- /**
- * Returns information about a package file. Expects the name of
- * a package xml file as input.
- *
- * @param string $descfile name of package xml file
- *
- * @return array array with package information
- *
- * @access public
- * @deprecated use PEAR_PackageFile->fromPackageFile() instead
- *
- */
- function infoFromDescriptionFile($descfile)
- {
- $packagefile = &new PEAR_PackageFile($this->config);
- $pf = &$packagefile->fromPackageFile($descfile, PEAR_VALIDATE_NORMAL);
- return $this->_postProcessChecks($pf);
- }
-
- /**
- * Returns information about a package file. Expects the contents
- * of a package xml file as input.
- *
- * @param string $data contents of package.xml file
- *
- * @return array array with package information
- *
- * @access public
- * @deprecated use PEAR_PackageFile->fromXmlstring() instead
- *
- */
- function infoFromString($data)
- {
- $packagefile = &new PEAR_PackageFile($this->config);
- $pf = &$packagefile->fromXmlString($data, PEAR_VALIDATE_NORMAL, false);
- return $this->_postProcessChecks($pf);
- }
-
- /**
- * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2
- * @return array
- */
- function _postProcessValidPackagexml(&$pf)
- {
- if (!is_a($pf, 'PEAR_PackageFile_v2')) {
- $this->pkginfo = $pf->toArray();
- return $this->pkginfo;
- }
-
- // sort of make this into a package.xml 1.0-style array
- // changelog is not converted to old format.
- $arr = $pf->toArray(true);
- $arr = array_merge($arr, $arr['old']);
- unset($arr['old'], $arr['xsdversion'], $arr['contents'], $arr['compatible'],
- $arr['channel'], $arr['uri'], $arr['dependencies'], $arr['phprelease'],
- $arr['extsrcrelease'], $arr['zendextsrcrelease'], $arr['extbinrelease'],
- $arr['zendextbinrelease'], $arr['bundle'], $arr['lead'], $arr['developer'],
- $arr['helper'], $arr['contributor']);
- $arr['filelist'] = $pf->getFilelist();
- $this->pkginfo = $arr;
- return $arr;
- }
-
- /**
- * Returns package information from different sources
- *
- * This method is able to extract information about a package
- * from a .tgz archive or from a XML package definition file.
- *
- * @access public
- * @param string Filename of the source ('package.xml', '<package>.tgz')
- * @return string
- * @deprecated use PEAR_PackageFile->fromAnyFile() instead
- */
- function infoFromAny($info)
- {
- if (is_string($info) && file_exists($info)) {
- $packagefile = &new PEAR_PackageFile($this->config);
- $pf = &$packagefile->fromAnyFile($info, PEAR_VALIDATE_NORMAL);
- if (PEAR::isError($pf)) {
- $errs = $pf->getUserinfo();
- if (is_array($errs)) {
- foreach ($errs as $error) {
- $e = $this->raiseError($error['message'], $error['code'], null, null, $error);
- }
- }
-
- return $pf;
- }
-
- return $this->_postProcessValidPackagexml($pf);
- }
-
- return $info;
- }
-
- /**
- * Return an XML document based on the package info (as returned
- * by the PEAR_Common::infoFrom* methods).
- *
- * @param array $pkginfo package info
- *
- * @return string XML data
- *
- * @access public
- * @deprecated use a PEAR_PackageFile_v* object's generator instead
- */
- function xmlFromInfo($pkginfo)
- {
- $config = &PEAR_Config::singleton();
- $packagefile = &new PEAR_PackageFile($config);
- $pf = &$packagefile->fromArray($pkginfo);
- $gen = &$pf->getDefaultGenerator();
- return $gen->toXml(PEAR_VALIDATE_PACKAGING);
- }
-
- /**
- * Validate XML package definition file.
- *
- * @param string $info Filename of the package archive or of the
- * package definition file
- * @param array $errors Array that will contain the errors
- * @param array $warnings Array that will contain the warnings
- * @param string $dir_prefix (optional) directory where source files
- * may be found, or empty if they are not available
- * @access public
- * @return boolean
- * @deprecated use the validation of PEAR_PackageFile objects
- */
- function validatePackageInfo($info, &$errors, &$warnings, $dir_prefix = '')
- {
- $config = &PEAR_Config::singleton();
- $packagefile = &new PEAR_PackageFile($config);
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- if (strpos($info, '<?xml') !== false) {
- $pf = &$packagefile->fromXmlString($info, PEAR_VALIDATE_NORMAL, '');
- } else {
- $pf = &$packagefile->fromAnyFile($info, PEAR_VALIDATE_NORMAL);
- }
-
- PEAR::staticPopErrorHandling();
- if (PEAR::isError($pf)) {
- $errs = $pf->getUserinfo();
- if (is_array($errs)) {
- foreach ($errs as $error) {
- if ($error['level'] == 'error') {
- $errors[] = $error['message'];
- } else {
- $warnings[] = $error['message'];
- }
- }
- }
-
- return false;
- }
-
- return true;
- }
-
- /**
- * Build a "provides" array from data returned by
- * analyzeSourceCode(). The format of the built array is like
- * this:
- *
- * array(
- * 'class;MyClass' => 'array('type' => 'class', 'name' => 'MyClass'),
- * ...
- * )
- *
- *
- * @param array $srcinfo array with information about a source file
- * as returned by the analyzeSourceCode() method.
- *
- * @return void
- *
- * @access public
- *
- */
- function buildProvidesArray($srcinfo)
- {
- $file = basename($srcinfo['source_file']);
- $pn = '';
- if (isset($this->_packageName)) {
- $pn = $this->_packageName;
- }
-
- $pnl = strlen($pn);
- foreach ($srcinfo['declared_classes'] as $class) {
- $key = "class;$class";
- if (isset($this->pkginfo['provides'][$key])) {
- continue;
- }
-
- $this->pkginfo['provides'][$key] =
- array('file'=> $file, 'type' => 'class', 'name' => $class);
- if (isset($srcinfo['inheritance'][$class])) {
- $this->pkginfo['provides'][$key]['extends'] =
- $srcinfo['inheritance'][$class];
- }
- }
-
- foreach ($srcinfo['declared_methods'] as $class => $methods) {
- foreach ($methods as $method) {
- $function = "$class::$method";
- $key = "function;$function";
- if ($method{0} == '_' || !strcasecmp($method, $class) ||
- isset($this->pkginfo['provides'][$key])) {
- continue;
- }
-
- $this->pkginfo['provides'][$key] =
- array('file'=> $file, 'type' => 'function', 'name' => $function);
- }
- }
-
- foreach ($srcinfo['declared_functions'] as $function) {
- $key = "function;$function";
- if ($function{0} == '_' || isset($this->pkginfo['provides'][$key])) {
- continue;
- }
-
- if (!strstr($function, '::') && strncasecmp($function, $pn, $pnl)) {
- $warnings[] = "in1 " . $file . ": function \"$function\" not prefixed with package name \"$pn\"";
- }
-
- $this->pkginfo['provides'][$key] =
- array('file'=> $file, 'type' => 'function', 'name' => $function);
- }
- }
-
- /**
- * Analyze the source code of the given PHP file
- *
- * @param string Filename of the PHP file
- * @return mixed
- * @access public
- */
- function analyzeSourceCode($file)
- {
- if (!class_exists('PEAR_PackageFile_v2_Validator')) {
- require_once 'PEAR/PackageFile/v2/Validator.php';
- }
-
- $a = new PEAR_PackageFile_v2_Validator;
- return $a->analyzeSourceCode($file);
- }
-
- function detectDependencies($any, $status_callback = null)
- {
- if (!function_exists("token_get_all")) {
- return false;
- }
-
- if (PEAR::isError($info = $this->infoFromAny($any))) {
- return $this->raiseError($info);
- }
-
- if (!is_array($info)) {
- return false;
- }
-
- $deps = array();
- $used_c = $decl_c = $decl_f = $decl_m = array();
- foreach ($info['filelist'] as $file => $fa) {
- $tmp = $this->analyzeSourceCode($file);
- $used_c = @array_merge($used_c, $tmp['used_classes']);
- $decl_c = @array_merge($decl_c, $tmp['declared_classes']);
- $decl_f = @array_merge($decl_f, $tmp['declared_functions']);
- $decl_m = @array_merge($decl_m, $tmp['declared_methods']);
- $inheri = @array_merge($inheri, $tmp['inheritance']);
- }
-
- $used_c = array_unique($used_c);
- $decl_c = array_unique($decl_c);
- $undecl_c = array_diff($used_c, $decl_c);
-
- return array('used_classes' => $used_c,
- 'declared_classes' => $decl_c,
- 'declared_methods' => $decl_m,
- 'declared_functions' => $decl_f,
- 'undeclared_classes' => $undecl_c,
- 'inheritance' => $inheri,
- );
- }
-
- /**
- * Download a file through HTTP. Considers suggested file name in
- * Content-disposition: header and can run a callback function for
- * different events. The callback will be called with two
- * parameters: the callback type, and parameters. The implemented
- * callback types are:
- *
- * 'setup' called at the very beginning, parameter is a UI object
- * that should be used for all output
- * 'message' the parameter is a string with an informational message
- * 'saveas' may be used to save with a different file name, the
- * parameter is the filename that is about to be used.
- * If a 'saveas' callback returns a non-empty string,
- * that file name will be used as the filename instead.
- * Note that $save_dir will not be affected by this, only
- * the basename of the file.
- * 'start' download is starting, parameter is number of bytes
- * that are expected, or -1 if unknown
- * 'bytesread' parameter is the number of bytes read so far
- * 'done' download is complete, parameter is the total number
- * of bytes read
- * 'connfailed' if the TCP connection fails, this callback is called
- * with array(host,port,errno,errmsg)
- * 'writefailed' if writing to disk fails, this callback is called
- * with array(destfile,errmsg)
- *
- * If an HTTP proxy has been configured (http_proxy PEAR_Config
- * setting), the proxy will be used.
- *
- * @param string $url the URL to download
- * @param object $ui PEAR_Frontend_* instance
- * @param object $config PEAR_Config instance
- * @param string $save_dir (optional) directory to save file in
- * @param mixed $callback (optional) function/method to call for status
- * updates
- *
- * @return string Returns the full path of the downloaded file or a PEAR
- * error on failure. If the error is caused by
- * socket-related errors, the error object will
- * have the fsockopen error code available through
- * getCode().
- *
- * @access public
- * @deprecated in favor of PEAR_Downloader::downloadHttp()
- */
- function downloadHttp($url, &$ui, $save_dir = '.', $callback = null)
- {
- if (!class_exists('PEAR_Downloader')) {
- require_once 'PEAR/Downloader.php';
- }
- return PEAR_Downloader::downloadHttp($url, $ui, $save_dir, $callback);
- }
-}
-
-require_once 'PEAR/Config.php';
-require_once 'PEAR/PackageFile.php'; \ No newline at end of file
diff --git a/3rdparty/PEAR/Config.php b/3rdparty/PEAR/Config.php
deleted file mode 100644
index 86a7db3f32f..00000000000
--- a/3rdparty/PEAR/Config.php
+++ /dev/null
@@ -1,2097 +0,0 @@
-<?php
-/**
- * PEAR_Config, customized configuration handling for the PEAR Installer
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Stig Bakken <ssb@php.net>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Config.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 0.1
- */
-
-/**
- * Required for error handling
- */
-require_once 'PEAR.php';
-require_once 'PEAR/Registry.php';
-require_once 'PEAR/Installer/Role.php';
-require_once 'System.php';
-
-/**
- * Last created PEAR_Config instance.
- * @var object
- */
-$GLOBALS['_PEAR_Config_instance'] = null;
-if (!defined('PEAR_INSTALL_DIR') || !PEAR_INSTALL_DIR) {
- $PEAR_INSTALL_DIR = PHP_LIBDIR . DIRECTORY_SEPARATOR . 'pear';
-} else {
- $PEAR_INSTALL_DIR = PEAR_INSTALL_DIR;
-}
-
-// Below we define constants with default values for all configuration
-// parameters except username/password. All of them can have their
-// defaults set through environment variables. The reason we use the
-// PHP_ prefix is for some security, PHP protects environment
-// variables starting with PHP_*.
-
-// default channel and preferred mirror is based on whether we are invoked through
-// the "pear" or the "pecl" command
-if (!defined('PEAR_RUNTYPE')) {
- define('PEAR_RUNTYPE', 'pear');
-}
-
-if (PEAR_RUNTYPE == 'pear') {
- define('PEAR_CONFIG_DEFAULT_CHANNEL', 'pear.php.net');
-} else {
- define('PEAR_CONFIG_DEFAULT_CHANNEL', 'pecl.php.net');
-}
-
-if (getenv('PHP_PEAR_SYSCONF_DIR')) {
- define('PEAR_CONFIG_SYSCONFDIR', getenv('PHP_PEAR_SYSCONF_DIR'));
-} elseif (getenv('SystemRoot')) {
- define('PEAR_CONFIG_SYSCONFDIR', getenv('SystemRoot'));
-} else {
- define('PEAR_CONFIG_SYSCONFDIR', PHP_SYSCONFDIR);
-}
-
-// Default for master_server
-if (getenv('PHP_PEAR_MASTER_SERVER')) {
- define('PEAR_CONFIG_DEFAULT_MASTER_SERVER', getenv('PHP_PEAR_MASTER_SERVER'));
-} else {
- define('PEAR_CONFIG_DEFAULT_MASTER_SERVER', 'pear.php.net');
-}
-
-// Default for http_proxy
-if (getenv('PHP_PEAR_HTTP_PROXY')) {
- define('PEAR_CONFIG_DEFAULT_HTTP_PROXY', getenv('PHP_PEAR_HTTP_PROXY'));
-} elseif (getenv('http_proxy')) {
- define('PEAR_CONFIG_DEFAULT_HTTP_PROXY', getenv('http_proxy'));
-} else {
- define('PEAR_CONFIG_DEFAULT_HTTP_PROXY', '');
-}
-
-// Default for php_dir
-if (getenv('PHP_PEAR_INSTALL_DIR')) {
- define('PEAR_CONFIG_DEFAULT_PHP_DIR', getenv('PHP_PEAR_INSTALL_DIR'));
-} else {
- if (@file_exists($PEAR_INSTALL_DIR) && is_dir($PEAR_INSTALL_DIR)) {
- define('PEAR_CONFIG_DEFAULT_PHP_DIR', $PEAR_INSTALL_DIR);
- } else {
- define('PEAR_CONFIG_DEFAULT_PHP_DIR', $PEAR_INSTALL_DIR);
- }
-}
-
-// Default for ext_dir
-if (getenv('PHP_PEAR_EXTENSION_DIR')) {
- define('PEAR_CONFIG_DEFAULT_EXT_DIR', getenv('PHP_PEAR_EXTENSION_DIR'));
-} else {
- if (ini_get('extension_dir')) {
- define('PEAR_CONFIG_DEFAULT_EXT_DIR', ini_get('extension_dir'));
- } elseif (defined('PEAR_EXTENSION_DIR') &&
- file_exists(PEAR_EXTENSION_DIR) && is_dir(PEAR_EXTENSION_DIR)) {
- define('PEAR_CONFIG_DEFAULT_EXT_DIR', PEAR_EXTENSION_DIR);
- } elseif (defined('PHP_EXTENSION_DIR')) {
- define('PEAR_CONFIG_DEFAULT_EXT_DIR', PHP_EXTENSION_DIR);
- } else {
- define('PEAR_CONFIG_DEFAULT_EXT_DIR', '.');
- }
-}
-
-// Default for doc_dir
-if (getenv('PHP_PEAR_DOC_DIR')) {
- define('PEAR_CONFIG_DEFAULT_DOC_DIR', getenv('PHP_PEAR_DOC_DIR'));
-} else {
- define('PEAR_CONFIG_DEFAULT_DOC_DIR',
- $PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'docs');
-}
-
-// Default for bin_dir
-if (getenv('PHP_PEAR_BIN_DIR')) {
- define('PEAR_CONFIG_DEFAULT_BIN_DIR', getenv('PHP_PEAR_BIN_DIR'));
-} else {
- define('PEAR_CONFIG_DEFAULT_BIN_DIR', PHP_BINDIR);
-}
-
-// Default for data_dir
-if (getenv('PHP_PEAR_DATA_DIR')) {
- define('PEAR_CONFIG_DEFAULT_DATA_DIR', getenv('PHP_PEAR_DATA_DIR'));
-} else {
- define('PEAR_CONFIG_DEFAULT_DATA_DIR',
- $PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'data');
-}
-
-// Default for cfg_dir
-if (getenv('PHP_PEAR_CFG_DIR')) {
- define('PEAR_CONFIG_DEFAULT_CFG_DIR', getenv('PHP_PEAR_CFG_DIR'));
-} else {
- define('PEAR_CONFIG_DEFAULT_CFG_DIR',
- $PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'cfg');
-}
-
-// Default for www_dir
-if (getenv('PHP_PEAR_WWW_DIR')) {
- define('PEAR_CONFIG_DEFAULT_WWW_DIR', getenv('PHP_PEAR_WWW_DIR'));
-} else {
- define('PEAR_CONFIG_DEFAULT_WWW_DIR',
- $PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'www');
-}
-
-// Default for test_dir
-if (getenv('PHP_PEAR_TEST_DIR')) {
- define('PEAR_CONFIG_DEFAULT_TEST_DIR', getenv('PHP_PEAR_TEST_DIR'));
-} else {
- define('PEAR_CONFIG_DEFAULT_TEST_DIR',
- $PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'tests');
-}
-
-// Default for temp_dir
-if (getenv('PHP_PEAR_TEMP_DIR')) {
- define('PEAR_CONFIG_DEFAULT_TEMP_DIR', getenv('PHP_PEAR_TEMP_DIR'));
-} else {
- define('PEAR_CONFIG_DEFAULT_TEMP_DIR',
- System::tmpdir() . DIRECTORY_SEPARATOR . 'pear' .
- DIRECTORY_SEPARATOR . 'temp');
-}
-
-// Default for cache_dir
-if (getenv('PHP_PEAR_CACHE_DIR')) {
- define('PEAR_CONFIG_DEFAULT_CACHE_DIR', getenv('PHP_PEAR_CACHE_DIR'));
-} else {
- define('PEAR_CONFIG_DEFAULT_CACHE_DIR',
- System::tmpdir() . DIRECTORY_SEPARATOR . 'pear' .
- DIRECTORY_SEPARATOR . 'cache');
-}
-
-// Default for download_dir
-if (getenv('PHP_PEAR_DOWNLOAD_DIR')) {
- define('PEAR_CONFIG_DEFAULT_DOWNLOAD_DIR', getenv('PHP_PEAR_DOWNLOAD_DIR'));
-} else {
- define('PEAR_CONFIG_DEFAULT_DOWNLOAD_DIR',
- System::tmpdir() . DIRECTORY_SEPARATOR . 'pear' .
- DIRECTORY_SEPARATOR . 'download');
-}
-
-// Default for php_bin
-if (getenv('PHP_PEAR_PHP_BIN')) {
- define('PEAR_CONFIG_DEFAULT_PHP_BIN', getenv('PHP_PEAR_PHP_BIN'));
-} else {
- define('PEAR_CONFIG_DEFAULT_PHP_BIN', PEAR_CONFIG_DEFAULT_BIN_DIR.
- DIRECTORY_SEPARATOR.'php'.(OS_WINDOWS ? '.exe' : ''));
-}
-
-// Default for verbose
-if (getenv('PHP_PEAR_VERBOSE')) {
- define('PEAR_CONFIG_DEFAULT_VERBOSE', getenv('PHP_PEAR_VERBOSE'));
-} else {
- define('PEAR_CONFIG_DEFAULT_VERBOSE', 1);
-}
-
-// Default for preferred_state
-if (getenv('PHP_PEAR_PREFERRED_STATE')) {
- define('PEAR_CONFIG_DEFAULT_PREFERRED_STATE', getenv('PHP_PEAR_PREFERRED_STATE'));
-} else {
- define('PEAR_CONFIG_DEFAULT_PREFERRED_STATE', 'stable');
-}
-
-// Default for umask
-if (getenv('PHP_PEAR_UMASK')) {
- define('PEAR_CONFIG_DEFAULT_UMASK', getenv('PHP_PEAR_UMASK'));
-} else {
- define('PEAR_CONFIG_DEFAULT_UMASK', decoct(umask()));
-}
-
-// Default for cache_ttl
-if (getenv('PHP_PEAR_CACHE_TTL')) {
- define('PEAR_CONFIG_DEFAULT_CACHE_TTL', getenv('PHP_PEAR_CACHE_TTL'));
-} else {
- define('PEAR_CONFIG_DEFAULT_CACHE_TTL', 3600);
-}
-
-// Default for sig_type
-if (getenv('PHP_PEAR_SIG_TYPE')) {
- define('PEAR_CONFIG_DEFAULT_SIG_TYPE', getenv('PHP_PEAR_SIG_TYPE'));
-} else {
- define('PEAR_CONFIG_DEFAULT_SIG_TYPE', 'gpg');
-}
-
-// Default for sig_bin
-if (getenv('PHP_PEAR_SIG_BIN')) {
- define('PEAR_CONFIG_DEFAULT_SIG_BIN', getenv('PHP_PEAR_SIG_BIN'));
-} else {
- define('PEAR_CONFIG_DEFAULT_SIG_BIN',
- System::which(
- 'gpg', OS_WINDOWS ? 'c:\gnupg\gpg.exe' : '/usr/local/bin/gpg'));
-}
-
-// Default for sig_keydir
-if (getenv('PHP_PEAR_SIG_KEYDIR')) {
- define('PEAR_CONFIG_DEFAULT_SIG_KEYDIR', getenv('PHP_PEAR_SIG_KEYDIR'));
-} else {
- define('PEAR_CONFIG_DEFAULT_SIG_KEYDIR',
- PEAR_CONFIG_SYSCONFDIR . DIRECTORY_SEPARATOR . 'pearkeys');
-}
-
-/**
- * This is a class for storing configuration data, keeping track of
- * which are system-defined, user-defined or defaulted.
- * @category pear
- * @package PEAR
- * @author Stig Bakken <ssb@php.net>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 0.1
- */
-class PEAR_Config extends PEAR
-{
- /**
- * Array of config files used.
- *
- * @var array layer => config file
- */
- var $files = array(
- 'system' => '',
- 'user' => '',
- );
-
- var $layers = array();
-
- /**
- * Configuration data, two-dimensional array where the first
- * dimension is the config layer ('user', 'system' and 'default'),
- * and the second dimension is keyname => value.
- *
- * The order in the first dimension is important! Earlier
- * layers will shadow later ones when a config value is
- * requested (if a 'user' value exists, it will be returned first,
- * then 'system' and finally 'default').
- *
- * @var array layer => array(keyname => value, ...)
- */
- var $configuration = array(
- 'user' => array(),
- 'system' => array(),
- 'default' => array(),
- );
-
- /**
- * Configuration values that can be set for a channel
- *
- * All other configuration values can only have a global value
- * @var array
- * @access private
- */
- var $_channelConfigInfo = array(
- 'php_dir', 'ext_dir', 'doc_dir', 'bin_dir', 'data_dir', 'cfg_dir',
- 'test_dir', 'www_dir', 'php_bin', 'php_prefix', 'php_suffix', 'username',
- 'password', 'verbose', 'preferred_state', 'umask', 'preferred_mirror', 'php_ini'
- );
-
- /**
- * Channels that can be accessed
- * @see setChannels()
- * @var array
- * @access private
- */
- var $_channels = array('pear.php.net', 'pecl.php.net', '__uri');
-
- /**
- * This variable is used to control the directory values returned
- * @see setInstallRoot();
- * @var string|false
- * @access private
- */
- var $_installRoot = false;
-
- /**
- * If requested, this will always refer to the registry
- * contained in php_dir
- * @var PEAR_Registry
- */
- var $_registry = array();
-
- /**
- * @var array
- * @access private
- */
- var $_regInitialized = array();
-
- /**
- * @var bool
- * @access private
- */
- var $_noRegistry = false;
-
- /**
- * amount of errors found while parsing config
- * @var integer
- * @access private
- */
- var $_errorsFound = 0;
- var $_lastError = null;
-
- /**
- * Information about the configuration data. Stores the type,
- * default value and a documentation string for each configuration
- * value.
- *
- * @var array layer => array(infotype => value, ...)
- */
- var $configuration_info = array(
- // Channels/Internet Access
- 'default_channel' => array(
- 'type' => 'string',
- 'default' => PEAR_CONFIG_DEFAULT_CHANNEL,
- 'doc' => 'the default channel to use for all non explicit commands',
- 'prompt' => 'Default Channel',
- 'group' => 'Internet Access',
- ),
- 'preferred_mirror' => array(
- 'type' => 'string',
- 'default' => PEAR_CONFIG_DEFAULT_CHANNEL,
- 'doc' => 'the default server or mirror to use for channel actions',
- 'prompt' => 'Default Channel Mirror',
- 'group' => 'Internet Access',
- ),
- 'remote_config' => array(
- 'type' => 'password',
- 'default' => '',
- 'doc' => 'ftp url of remote configuration file to use for synchronized install',
- 'prompt' => 'Remote Configuration File',
- 'group' => 'Internet Access',
- ),
- 'auto_discover' => array(
- 'type' => 'integer',
- 'default' => 0,
- 'doc' => 'whether to automatically discover new channels',
- 'prompt' => 'Auto-discover new Channels',
- 'group' => 'Internet Access',
- ),
- // Internet Access
- 'master_server' => array(
- 'type' => 'string',
- 'default' => 'pear.php.net',
- 'doc' => 'name of the main PEAR server [NOT USED IN THIS VERSION]',
- 'prompt' => 'PEAR server [DEPRECATED]',
- 'group' => 'Internet Access',
- ),
- 'http_proxy' => array(
- 'type' => 'string',
- 'default' => PEAR_CONFIG_DEFAULT_HTTP_PROXY,
- 'doc' => 'HTTP proxy (host:port) to use when downloading packages',
- 'prompt' => 'HTTP Proxy Server Address',
- 'group' => 'Internet Access',
- ),
- // File Locations
- 'php_dir' => array(
- 'type' => 'directory',
- 'default' => PEAR_CONFIG_DEFAULT_PHP_DIR,
- 'doc' => 'directory where .php files are installed',
- 'prompt' => 'PEAR directory',
- 'group' => 'File Locations',
- ),
- 'ext_dir' => array(
- 'type' => 'directory',
- 'default' => PEAR_CONFIG_DEFAULT_EXT_DIR,
- 'doc' => 'directory where loadable extensions are installed',
- 'prompt' => 'PHP extension directory',
- 'group' => 'File Locations',
- ),
- 'doc_dir' => array(
- 'type' => 'directory',
- 'default' => PEAR_CONFIG_DEFAULT_DOC_DIR,
- 'doc' => 'directory where documentation is installed',
- 'prompt' => 'PEAR documentation directory',
- 'group' => 'File Locations',
- ),
- 'bin_dir' => array(
- 'type' => 'directory',
- 'default' => PEAR_CONFIG_DEFAULT_BIN_DIR,
- 'doc' => 'directory where executables are installed',
- 'prompt' => 'PEAR executables directory',
- 'group' => 'File Locations',
- ),
- 'data_dir' => array(
- 'type' => 'directory',
- 'default' => PEAR_CONFIG_DEFAULT_DATA_DIR,
- 'doc' => 'directory where data files are installed',
- 'prompt' => 'PEAR data directory',
- 'group' => 'File Locations (Advanced)',
- ),
- 'cfg_dir' => array(
- 'type' => 'directory',
- 'default' => PEAR_CONFIG_DEFAULT_CFG_DIR,
- 'doc' => 'directory where modifiable configuration files are installed',
- 'prompt' => 'PEAR configuration file directory',
- 'group' => 'File Locations (Advanced)',
- ),
- 'www_dir' => array(
- 'type' => 'directory',
- 'default' => PEAR_CONFIG_DEFAULT_WWW_DIR,
- 'doc' => 'directory where www frontend files (html/js) are installed',
- 'prompt' => 'PEAR www files directory',
- 'group' => 'File Locations (Advanced)',
- ),
- 'test_dir' => array(
- 'type' => 'directory',
- 'default' => PEAR_CONFIG_DEFAULT_TEST_DIR,
- 'doc' => 'directory where regression tests are installed',
- 'prompt' => 'PEAR test directory',
- 'group' => 'File Locations (Advanced)',
- ),
- 'cache_dir' => array(
- 'type' => 'directory',
- 'default' => PEAR_CONFIG_DEFAULT_CACHE_DIR,
- 'doc' => 'directory which is used for web service cache',
- 'prompt' => 'PEAR Installer cache directory',
- 'group' => 'File Locations (Advanced)',
- ),
- 'temp_dir' => array(
- 'type' => 'directory',
- 'default' => PEAR_CONFIG_DEFAULT_TEMP_DIR,
- 'doc' => 'directory which is used for all temp files',
- 'prompt' => 'PEAR Installer temp directory',
- 'group' => 'File Locations (Advanced)',
- ),
- 'download_dir' => array(
- 'type' => 'directory',
- 'default' => PEAR_CONFIG_DEFAULT_DOWNLOAD_DIR,
- 'doc' => 'directory which is used for all downloaded files',
- 'prompt' => 'PEAR Installer download directory',
- 'group' => 'File Locations (Advanced)',
- ),
- 'php_bin' => array(
- 'type' => 'file',
- 'default' => PEAR_CONFIG_DEFAULT_PHP_BIN,
- 'doc' => 'PHP CLI/CGI binary for executing scripts',
- 'prompt' => 'PHP CLI/CGI binary',
- 'group' => 'File Locations (Advanced)',
- ),
- 'php_prefix' => array(
- 'type' => 'string',
- 'default' => '',
- 'doc' => '--program-prefix for php_bin\'s ./configure, used for pecl installs',
- 'prompt' => '--program-prefix passed to PHP\'s ./configure',
- 'group' => 'File Locations (Advanced)',
- ),
- 'php_suffix' => array(
- 'type' => 'string',
- 'default' => '',
- 'doc' => '--program-suffix for php_bin\'s ./configure, used for pecl installs',
- 'prompt' => '--program-suffix passed to PHP\'s ./configure',
- 'group' => 'File Locations (Advanced)',
- ),
- 'php_ini' => array(
- 'type' => 'file',
- 'default' => '',
- 'doc' => 'location of php.ini in which to enable PECL extensions on install',
- 'prompt' => 'php.ini location',
- 'group' => 'File Locations (Advanced)',
- ),
- // Maintainers
- 'username' => array(
- 'type' => 'string',
- 'default' => '',
- 'doc' => '(maintainers) your PEAR account name',
- 'prompt' => 'PEAR username (for maintainers)',
- 'group' => 'Maintainers',
- ),
- 'password' => array(
- 'type' => 'password',
- 'default' => '',
- 'doc' => '(maintainers) your PEAR account password',
- 'prompt' => 'PEAR password (for maintainers)',
- 'group' => 'Maintainers',
- ),
- // Advanced
- 'verbose' => array(
- 'type' => 'integer',
- 'default' => PEAR_CONFIG_DEFAULT_VERBOSE,
- 'doc' => 'verbosity level
-0: really quiet
-1: somewhat quiet
-2: verbose
-3: debug',
- 'prompt' => 'Debug Log Level',
- 'group' => 'Advanced',
- ),
- 'preferred_state' => array(
- 'type' => 'set',
- 'default' => PEAR_CONFIG_DEFAULT_PREFERRED_STATE,
- 'doc' => 'the installer will prefer releases with this state when installing packages without a version or state specified',
- 'valid_set' => array(
- 'stable', 'beta', 'alpha', 'devel', 'snapshot'),
- 'prompt' => 'Preferred Package State',
- 'group' => 'Advanced',
- ),
- 'umask' => array(
- 'type' => 'mask',
- 'default' => PEAR_CONFIG_DEFAULT_UMASK,
- 'doc' => 'umask used when creating files (Unix-like systems only)',
- 'prompt' => 'Unix file mask',
- 'group' => 'Advanced',
- ),
- 'cache_ttl' => array(
- 'type' => 'integer',
- 'default' => PEAR_CONFIG_DEFAULT_CACHE_TTL,
- 'doc' => 'amount of secs where the local cache is used and not updated',
- 'prompt' => 'Cache TimeToLive',
- 'group' => 'Advanced',
- ),
- 'sig_type' => array(
- 'type' => 'set',
- 'default' => PEAR_CONFIG_DEFAULT_SIG_TYPE,
- 'doc' => 'which package signature mechanism to use',
- 'valid_set' => array('gpg'),
- 'prompt' => 'Package Signature Type',
- 'group' => 'Maintainers',
- ),
- 'sig_bin' => array(
- 'type' => 'string',
- 'default' => PEAR_CONFIG_DEFAULT_SIG_BIN,
- 'doc' => 'which package signature mechanism to use',
- 'prompt' => 'Signature Handling Program',
- 'group' => 'Maintainers',
- ),
- 'sig_keyid' => array(
- 'type' => 'string',
- 'default' => '',
- 'doc' => 'which key to use for signing with',
- 'prompt' => 'Signature Key Id',
- 'group' => 'Maintainers',
- ),
- 'sig_keydir' => array(
- 'type' => 'directory',
- 'default' => PEAR_CONFIG_DEFAULT_SIG_KEYDIR,
- 'doc' => 'directory where signature keys are located',
- 'prompt' => 'Signature Key Directory',
- 'group' => 'Maintainers',
- ),
- // __channels is reserved - used for channel-specific configuration
- );
-
- /**
- * Constructor.
- *
- * @param string file to read user-defined options from
- * @param string file to read system-wide defaults from
- * @param bool determines whether a registry object "follows"
- * the value of php_dir (is automatically created
- * and moved when php_dir is changed)
- * @param bool if true, fails if configuration files cannot be loaded
- *
- * @access public
- *
- * @see PEAR_Config::singleton
- */
- function PEAR_Config($user_file = '', $system_file = '', $ftp_file = false,
- $strict = true)
- {
- $this->PEAR();
- PEAR_Installer_Role::initializeConfig($this);
- $sl = DIRECTORY_SEPARATOR;
- if (empty($user_file)) {
- if (OS_WINDOWS) {
- $user_file = PEAR_CONFIG_SYSCONFDIR . $sl . 'pear.ini';
- } else {
- $user_file = getenv('HOME') . $sl . '.pearrc';
- }
- }
-
- if (empty($system_file)) {
- $system_file = PEAR_CONFIG_SYSCONFDIR . $sl;
- if (OS_WINDOWS) {
- $system_file .= 'pearsys.ini';
- } else {
- $system_file .= 'pear.conf';
- }
- }
-
- $this->layers = array_keys($this->configuration);
- $this->files['user'] = $user_file;
- $this->files['system'] = $system_file;
- if ($user_file && file_exists($user_file)) {
- $this->pushErrorHandling(PEAR_ERROR_RETURN);
- $this->readConfigFile($user_file, 'user', $strict);
- $this->popErrorHandling();
- if ($this->_errorsFound > 0) {
- return;
- }
- }
-
- if ($system_file && @file_exists($system_file)) {
- $this->mergeConfigFile($system_file, false, 'system', $strict);
- if ($this->_errorsFound > 0) {
- return;
- }
-
- }
-
- if (!$ftp_file) {
- $ftp_file = $this->get('remote_config');
- }
-
- if ($ftp_file && defined('PEAR_REMOTEINSTALL_OK')) {
- $this->readFTPConfigFile($ftp_file);
- }
-
- foreach ($this->configuration_info as $key => $info) {
- $this->configuration['default'][$key] = $info['default'];
- }
-
- $this->_registry['default'] = &new PEAR_Registry($this->configuration['default']['php_dir']);
- $this->_registry['default']->setConfig($this, false);
- $this->_regInitialized['default'] = false;
- //$GLOBALS['_PEAR_Config_instance'] = &$this;
- }
-
- /**
- * Return the default locations of user and system configuration files
- * @static
- */
- function getDefaultConfigFiles()
- {
- $sl = DIRECTORY_SEPARATOR;
- if (OS_WINDOWS) {
- return array(
- 'user' => PEAR_CONFIG_SYSCONFDIR . $sl . 'pear.ini',
- 'system' => PEAR_CONFIG_SYSCONFDIR . $sl . 'pearsys.ini'
- );
- }
-
- return array(
- 'user' => getenv('HOME') . $sl . '.pearrc',
- 'system' => PEAR_CONFIG_SYSCONFDIR . $sl . 'pear.conf'
- );
- }
-
- /**
- * Static singleton method. If you want to keep only one instance
- * of this class in use, this method will give you a reference to
- * the last created PEAR_Config object if one exists, or create a
- * new object.
- *
- * @param string (optional) file to read user-defined options from
- * @param string (optional) file to read system-wide defaults from
- *
- * @return object an existing or new PEAR_Config instance
- *
- * @access public
- *
- * @see PEAR_Config::PEAR_Config
- */
- function &singleton($user_file = '', $system_file = '', $strict = true)
- {
- if (is_object($GLOBALS['_PEAR_Config_instance'])) {
- return $GLOBALS['_PEAR_Config_instance'];
- }
-
- $t_conf = &new PEAR_Config($user_file, $system_file, false, $strict);
- if ($t_conf->_errorsFound > 0) {
- return $t_conf->lastError;
- }
-
- $GLOBALS['_PEAR_Config_instance'] = &$t_conf;
- return $GLOBALS['_PEAR_Config_instance'];
- }
-
- /**
- * Determine whether any configuration files have been detected, and whether a
- * registry object can be retrieved from this configuration.
- * @return bool
- * @since PEAR 1.4.0a1
- */
- function validConfiguration()
- {
- if ($this->isDefinedLayer('user') || $this->isDefinedLayer('system')) {
- return true;
- }
-
- return false;
- }
-
- /**
- * Reads configuration data from a file. All existing values in
- * the config layer are discarded and replaced with data from the
- * file.
- * @param string file to read from, if NULL or not specified, the
- * last-used file for the same layer (second param) is used
- * @param string config layer to insert data into ('user' or 'system')
- * @return bool TRUE on success or a PEAR error on failure
- */
- function readConfigFile($file = null, $layer = 'user', $strict = true)
- {
- if (empty($this->files[$layer])) {
- return $this->raiseError("unknown config layer `$layer'");
- }
-
- if ($file === null) {
- $file = $this->files[$layer];
- }
-
- $data = $this->_readConfigDataFrom($file);
- if (PEAR::isError($data)) {
- if (!$strict) {
- return true;
- }
-
- $this->_errorsFound++;
- $this->lastError = $data;
-
- return $data;
- }
-
- $this->files[$layer] = $file;
- $this->_decodeInput($data);
- $this->configuration[$layer] = $data;
- $this->_setupChannels();
- if (!$this->_noRegistry && ($phpdir = $this->get('php_dir', $layer, 'pear.php.net'))) {
- $this->_registry[$layer] = &new PEAR_Registry($phpdir);
- $this->_registry[$layer]->setConfig($this, false);
- $this->_regInitialized[$layer] = false;
- } else {
- unset($this->_registry[$layer]);
- }
- return true;
- }
-
- /**
- * @param string url to the remote config file, like ftp://www.example.com/pear/config.ini
- * @return true|PEAR_Error
- */
- function readFTPConfigFile($path)
- {
- do { // poor man's try
- if (!class_exists('PEAR_FTP')) {
- if (!class_exists('PEAR_Common')) {
- require_once 'PEAR/Common.php';
- }
- if (PEAR_Common::isIncludeable('PEAR/FTP.php')) {
- require_once 'PEAR/FTP.php';
- }
- }
-
- if (!class_exists('PEAR_FTP')) {
- return PEAR::raiseError('PEAR_RemoteInstaller must be installed to use remote config');
- }
-
- $this->_ftp = &new PEAR_FTP;
- $this->_ftp->pushErrorHandling(PEAR_ERROR_RETURN);
- $e = $this->_ftp->init($path);
- if (PEAR::isError($e)) {
- $this->_ftp->popErrorHandling();
- return $e;
- }
-
- $tmp = System::mktemp('-d');
- PEAR_Common::addTempFile($tmp);
- $e = $this->_ftp->get(basename($path), $tmp . DIRECTORY_SEPARATOR .
- 'pear.ini', false, FTP_BINARY);
- if (PEAR::isError($e)) {
- $this->_ftp->popErrorHandling();
- return $e;
- }
-
- PEAR_Common::addTempFile($tmp . DIRECTORY_SEPARATOR . 'pear.ini');
- $this->_ftp->disconnect();
- $this->_ftp->popErrorHandling();
- $this->files['ftp'] = $tmp . DIRECTORY_SEPARATOR . 'pear.ini';
- $e = $this->readConfigFile(null, 'ftp');
- if (PEAR::isError($e)) {
- return $e;
- }
-
- $fail = array();
- foreach ($this->configuration_info as $key => $val) {
- if (in_array($this->getGroup($key),
- array('File Locations', 'File Locations (Advanced)')) &&
- $this->getType($key) == 'directory') {
- // any directory configs must be set for this to work
- if (!isset($this->configuration['ftp'][$key])) {
- $fail[] = $key;
- }
- }
- }
-
- if (!count($fail)) {
- return true;
- }
-
- $fail = '"' . implode('", "', $fail) . '"';
- unset($this->files['ftp']);
- unset($this->configuration['ftp']);
- return PEAR::raiseError('ERROR: Ftp configuration file must set all ' .
- 'directory configuration variables. These variables were not set: ' .
- $fail);
- } while (false); // poor man's catch
- unset($this->files['ftp']);
- return PEAR::raiseError('no remote host specified');
- }
-
- /**
- * Reads the existing configurations and creates the _channels array from it
- */
- function _setupChannels()
- {
- $set = array_flip(array_values($this->_channels));
- foreach ($this->configuration as $layer => $data) {
- $i = 1000;
- if (isset($data['__channels']) && is_array($data['__channels'])) {
- foreach ($data['__channels'] as $channel => $info) {
- $set[$channel] = $i++;
- }
- }
- }
- $this->_channels = array_values(array_flip($set));
- $this->setChannels($this->_channels);
- }
-
- function deleteChannel($channel)
- {
- $ch = strtolower($channel);
- foreach ($this->configuration as $layer => $data) {
- if (isset($data['__channels']) && isset($data['__channels'][$ch])) {
- unset($this->configuration[$layer]['__channels'][$ch]);
- }
- }
-
- $this->_channels = array_flip($this->_channels);
- unset($this->_channels[$ch]);
- $this->_channels = array_flip($this->_channels);
- }
-
- /**
- * Merges data into a config layer from a file. Does the same
- * thing as readConfigFile, except it does not replace all
- * existing values in the config layer.
- * @param string file to read from
- * @param bool whether to overwrite existing data (default TRUE)
- * @param string config layer to insert data into ('user' or 'system')
- * @param string if true, errors are returned if file opening fails
- * @return bool TRUE on success or a PEAR error on failure
- */
- function mergeConfigFile($file, $override = true, $layer = 'user', $strict = true)
- {
- if (empty($this->files[$layer])) {
- return $this->raiseError("unknown config layer `$layer'");
- }
-
- if ($file === null) {
- $file = $this->files[$layer];
- }
-
- $data = $this->_readConfigDataFrom($file);
- if (PEAR::isError($data)) {
- if (!$strict) {
- return true;
- }
-
- $this->_errorsFound++;
- $this->lastError = $data;
-
- return $data;
- }
-
- $this->_decodeInput($data);
- if ($override) {
- $this->configuration[$layer] =
- PEAR_Config::arrayMergeRecursive($this->configuration[$layer], $data);
- } else {
- $this->configuration[$layer] =
- PEAR_Config::arrayMergeRecursive($data, $this->configuration[$layer]);
- }
-
- $this->_setupChannels();
- if (!$this->_noRegistry && ($phpdir = $this->get('php_dir', $layer, 'pear.php.net'))) {
- $this->_registry[$layer] = &new PEAR_Registry($phpdir);
- $this->_registry[$layer]->setConfig($this, false);
- $this->_regInitialized[$layer] = false;
- } else {
- unset($this->_registry[$layer]);
- }
- return true;
- }
-
- /**
- * @param array
- * @param array
- * @return array
- * @static
- */
- function arrayMergeRecursive($arr2, $arr1)
- {
- $ret = array();
- foreach ($arr2 as $key => $data) {
- if (!isset($arr1[$key])) {
- $ret[$key] = $data;
- unset($arr1[$key]);
- continue;
- }
- if (is_array($data)) {
- if (!is_array($arr1[$key])) {
- $ret[$key] = $arr1[$key];
- unset($arr1[$key]);
- continue;
- }
- $ret[$key] = PEAR_Config::arrayMergeRecursive($arr1[$key], $arr2[$key]);
- unset($arr1[$key]);
- }
- }
-
- return array_merge($ret, $arr1);
- }
-
- /**
- * Writes data into a config layer from a file.
- *
- * @param string|null file to read from, or null for default
- * @param string config layer to insert data into ('user' or
- * 'system')
- * @param string|null data to write to config file or null for internal data [DEPRECATED]
- * @return bool TRUE on success or a PEAR error on failure
- */
- function writeConfigFile($file = null, $layer = 'user', $data = null)
- {
- $this->_lazyChannelSetup($layer);
- if ($layer == 'both' || $layer == 'all') {
- foreach ($this->files as $type => $file) {
- $err = $this->writeConfigFile($file, $type, $data);
- if (PEAR::isError($err)) {
- return $err;
- }
- }
- return true;
- }
-
- if (empty($this->files[$layer])) {
- return $this->raiseError("unknown config file type `$layer'");
- }
-
- if ($file === null) {
- $file = $this->files[$layer];
- }
-
- $data = ($data === null) ? $this->configuration[$layer] : $data;
- $this->_encodeOutput($data);
- $opt = array('-p', dirname($file));
- if (!@System::mkDir($opt)) {
- return $this->raiseError("could not create directory: " . dirname($file));
- }
-
- if (file_exists($file) && is_file($file) && !is_writeable($file)) {
- return $this->raiseError("no write access to $file!");
- }
-
- $fp = @fopen($file, "w");
- if (!$fp) {
- return $this->raiseError("PEAR_Config::writeConfigFile fopen('$file','w') failed ($php_errormsg)");
- }
-
- $contents = "#PEAR_Config 0.9\n" . serialize($data);
- if (!@fwrite($fp, $contents)) {
- return $this->raiseError("PEAR_Config::writeConfigFile: fwrite failed ($php_errormsg)");
- }
- return true;
- }
-
- /**
- * Reads configuration data from a file and returns the parsed data
- * in an array.
- *
- * @param string file to read from
- * @return array configuration data or a PEAR error on failure
- * @access private
- */
- function _readConfigDataFrom($file)
- {
- $fp = false;
- if (file_exists($file)) {
- $fp = @fopen($file, "r");
- }
-
- if (!$fp) {
- return $this->raiseError("PEAR_Config::readConfigFile fopen('$file','r') failed");
- }
-
- $size = filesize($file);
- $rt = get_magic_quotes_runtime();
- set_magic_quotes_runtime(0);
- fclose($fp);
- $contents = file_get_contents($file);
- if (empty($contents)) {
- return $this->raiseError('Configuration file "' . $file . '" is empty');
- }
-
- set_magic_quotes_runtime($rt);
-
- $version = false;
- if (preg_match('/^#PEAR_Config\s+(\S+)\s+/si', $contents, $matches)) {
- $version = $matches[1];
- $contents = substr($contents, strlen($matches[0]));
- } else {
- // Museum config file
- if (substr($contents,0,2) == 'a:') {
- $version = '0.1';
- }
- }
-
- if ($version && version_compare("$version", '1', '<')) {
- // no '@', it is possible that unserialize
- // raises a notice but it seems to block IO to
- // STDOUT if a '@' is used and a notice is raise
- $data = unserialize($contents);
-
- if (!is_array($data) && !$data) {
- if ($contents == serialize(false)) {
- $data = array();
- } else {
- $err = $this->raiseError("PEAR_Config: bad data in $file");
- return $err;
- }
- }
- if (!is_array($data)) {
- if (strlen(trim($contents)) > 0) {
- $error = "PEAR_Config: bad data in $file";
- $err = $this->raiseError($error);
- return $err;
- }
-
- $data = array();
- }
- // add parsing of newer formats here...
- } else {
- $err = $this->raiseError("$file: unknown version `$version'");
- return $err;
- }
-
- return $data;
- }
-
- /**
- * Gets the file used for storing the config for a layer
- *
- * @param string $layer 'user' or 'system'
- */
- function getConfFile($layer)
- {
- return $this->files[$layer];
- }
-
- /**
- * @param string Configuration class name, used for detecting duplicate calls
- * @param array information on a role as parsed from its xml file
- * @return true|PEAR_Error
- * @access private
- */
- function _addConfigVars($class, $vars)
- {
- static $called = array();
- if (isset($called[$class])) {
- return;
- }
-
- $called[$class] = 1;
- if (count($vars) > 3) {
- return $this->raiseError('Roles can only define 3 new config variables or less');
- }
-
- foreach ($vars as $name => $var) {
- if (!is_array($var)) {
- return $this->raiseError('Configuration information must be an array');
- }
-
- if (!isset($var['type'])) {
- return $this->raiseError('Configuration information must contain a type');
- } elseif (!in_array($var['type'],
- array('string', 'mask', 'password', 'directory', 'file', 'set'))) {
- return $this->raiseError(
- 'Configuration type must be one of directory, file, string, ' .
- 'mask, set, or password');
- }
- if (!isset($var['default'])) {
- return $this->raiseError(
- 'Configuration information must contain a default value ("default" index)');
- }
-
- if (is_array($var['default'])) {
- $real_default = '';
- foreach ($var['default'] as $config_var => $val) {
- if (strpos($config_var, 'text') === 0) {
- $real_default .= $val;
- } elseif (strpos($config_var, 'constant') === 0) {
- if (!defined($val)) {
- return $this->raiseError(
- 'Unknown constant "' . $val . '" requested in ' .
- 'default value for configuration variable "' .
- $name . '"');
- }
-
- $real_default .= constant($val);
- } elseif (isset($this->configuration_info[$config_var])) {
- $real_default .=
- $this->configuration_info[$config_var]['default'];
- } else {
- return $this->raiseError(
- 'Unknown request for "' . $config_var . '" value in ' .
- 'default value for configuration variable "' .
- $name . '"');
- }
- }
- $var['default'] = $real_default;
- }
-
- if ($var['type'] == 'integer') {
- $var['default'] = (integer) $var['default'];
- }
-
- if (!isset($var['doc'])) {
- return $this->raiseError(
- 'Configuration information must contain a summary ("doc" index)');
- }
-
- if (!isset($var['prompt'])) {
- return $this->raiseError(
- 'Configuration information must contain a simple prompt ("prompt" index)');
- }
-
- if (!isset($var['group'])) {
- return $this->raiseError(
- 'Configuration information must contain a simple group ("group" index)');
- }
-
- if (isset($this->configuration_info[$name])) {
- return $this->raiseError('Configuration variable "' . $name .
- '" already exists');
- }
-
- $this->configuration_info[$name] = $var;
- // fix bug #7351: setting custom config variable in a channel fails
- $this->_channelConfigInfo[] = $name;
- }
-
- return true;
- }
-
- /**
- * Encodes/scrambles configuration data before writing to files.
- * Currently, 'password' values will be base64-encoded as to avoid
- * that people spot cleartext passwords by accident.
- *
- * @param array (reference) array to encode values in
- * @return bool TRUE on success
- * @access private
- */
- function _encodeOutput(&$data)
- {
- foreach ($data as $key => $value) {
- if ($key == '__channels') {
- foreach ($data['__channels'] as $channel => $blah) {
- $this->_encodeOutput($data['__channels'][$channel]);
- }
- }
-
- if (!isset($this->configuration_info[$key])) {
- continue;
- }
-
- $type = $this->configuration_info[$key]['type'];
- switch ($type) {
- // we base64-encode passwords so they are at least
- // not shown in plain by accident
- case 'password': {
- $data[$key] = base64_encode($data[$key]);
- break;
- }
- case 'mask': {
- $data[$key] = octdec($data[$key]);
- break;
- }
- }
- }
-
- return true;
- }
-
- /**
- * Decodes/unscrambles configuration data after reading from files.
- *
- * @param array (reference) array to encode values in
- * @return bool TRUE on success
- * @access private
- *
- * @see PEAR_Config::_encodeOutput
- */
- function _decodeInput(&$data)
- {
- if (!is_array($data)) {
- return true;
- }
-
- foreach ($data as $key => $value) {
- if ($key == '__channels') {
- foreach ($data['__channels'] as $channel => $blah) {
- $this->_decodeInput($data['__channels'][$channel]);
- }
- }
-
- if (!isset($this->configuration_info[$key])) {
- continue;
- }
-
- $type = $this->configuration_info[$key]['type'];
- switch ($type) {
- case 'password': {
- $data[$key] = base64_decode($data[$key]);
- break;
- }
- case 'mask': {
- $data[$key] = decoct($data[$key]);
- break;
- }
- }
- }
-
- return true;
- }
-
- /**
- * Retrieve the default channel.
- *
- * On startup, channels are not initialized, so if the default channel is not
- * pear.php.net, then initialize the config.
- * @param string registry layer
- * @return string|false
- */
- function getDefaultChannel($layer = null)
- {
- $ret = false;
- if ($layer === null) {
- foreach ($this->layers as $layer) {
- if (isset($this->configuration[$layer]['default_channel'])) {
- $ret = $this->configuration[$layer]['default_channel'];
- break;
- }
- }
- } elseif (isset($this->configuration[$layer]['default_channel'])) {
- $ret = $this->configuration[$layer]['default_channel'];
- }
-
- if ($ret == 'pear.php.net' && defined('PEAR_RUNTYPE') && PEAR_RUNTYPE == 'pecl') {
- $ret = 'pecl.php.net';
- }
-
- if ($ret) {
- if ($ret != 'pear.php.net') {
- $this->_lazyChannelSetup();
- }
-
- return $ret;
- }
-
- return PEAR_CONFIG_DEFAULT_CHANNEL;
- }
-
- /**
- * Returns a configuration value, prioritizing layers as per the
- * layers property.
- *
- * @param string config key
- * @return mixed the config value, or NULL if not found
- * @access public
- */
- function get($key, $layer = null, $channel = false)
- {
- if (!isset($this->configuration_info[$key])) {
- return null;
- }
-
- if ($key == '__channels') {
- return null;
- }
-
- if ($key == 'default_channel') {
- return $this->getDefaultChannel($layer);
- }
-
- if (!$channel) {
- $channel = $this->getDefaultChannel();
- } elseif ($channel != 'pear.php.net') {
- $this->_lazyChannelSetup();
- }
- $channel = strtolower($channel);
-
- $test = (in_array($key, $this->_channelConfigInfo)) ?
- $this->_getChannelValue($key, $layer, $channel) :
- null;
- if ($test !== null) {
- if ($this->_installRoot) {
- if (in_array($this->getGroup($key),
- array('File Locations', 'File Locations (Advanced)')) &&
- $this->getType($key) == 'directory') {
- return $this->_prependPath($test, $this->_installRoot);
- }
- }
- return $test;
- }
-
- if ($layer === null) {
- foreach ($this->layers as $layer) {
- if (isset($this->configuration[$layer][$key])) {
- $test = $this->configuration[$layer][$key];
- if ($this->_installRoot) {
- if (in_array($this->getGroup($key),
- array('File Locations', 'File Locations (Advanced)')) &&
- $this->getType($key) == 'directory') {
- return $this->_prependPath($test, $this->_installRoot);
- }
- }
-
- if ($key == 'preferred_mirror') {
- $reg = &$this->getRegistry();
- if (is_object($reg)) {
- $chan = &$reg->getChannel($channel);
- if (PEAR::isError($chan)) {
- return $channel;
- }
-
- if (!$chan->getMirror($test) && $chan->getName() != $test) {
- return $channel; // mirror does not exist
- }
- }
- }
- return $test;
- }
- }
- } elseif (isset($this->configuration[$layer][$key])) {
- $test = $this->configuration[$layer][$key];
- if ($this->_installRoot) {
- if (in_array($this->getGroup($key),
- array('File Locations', 'File Locations (Advanced)')) &&
- $this->getType($key) == 'directory') {
- return $this->_prependPath($test, $this->_installRoot);
- }
- }
-
- if ($key == 'preferred_mirror') {
- $reg = &$this->getRegistry();
- if (is_object($reg)) {
- $chan = &$reg->getChannel($channel);
- if (PEAR::isError($chan)) {
- return $channel;
- }
-
- if (!$chan->getMirror($test) && $chan->getName() != $test) {
- return $channel; // mirror does not exist
- }
- }
- }
-
- return $test;
- }
-
- return null;
- }
-
- /**
- * Returns a channel-specific configuration value, prioritizing layers as per the
- * layers property.
- *
- * @param string config key
- * @return mixed the config value, or NULL if not found
- * @access private
- */
- function _getChannelValue($key, $layer, $channel)
- {
- if ($key == '__channels' || $channel == 'pear.php.net') {
- return null;
- }
-
- $ret = null;
- if ($layer === null) {
- foreach ($this->layers as $ilayer) {
- if (isset($this->configuration[$ilayer]['__channels'][$channel][$key])) {
- $ret = $this->configuration[$ilayer]['__channels'][$channel][$key];
- break;
- }
- }
- } elseif (isset($this->configuration[$layer]['__channels'][$channel][$key])) {
- $ret = $this->configuration[$layer]['__channels'][$channel][$key];
- }
-
- if ($key != 'preferred_mirror') {
- return $ret;
- }
-
-
- if ($ret !== null) {
- $reg = &$this->getRegistry($layer);
- if (is_object($reg)) {
- $chan = &$reg->getChannel($channel);
- if (PEAR::isError($chan)) {
- return $channel;
- }
-
- if (!$chan->getMirror($ret) && $chan->getName() != $ret) {
- return $channel; // mirror does not exist
- }
- }
-
- return $ret;
- }
-
- if ($channel != $this->getDefaultChannel($layer)) {
- return $channel; // we must use the channel name as the preferred mirror
- // if the user has not chosen an alternate
- }
-
- return $this->getDefaultChannel($layer);
- }
-
- /**
- * Set a config value in a specific layer (defaults to 'user').
- * Enforces the types defined in the configuration_info array. An
- * integer config variable will be cast to int, and a set config
- * variable will be validated against its legal values.
- *
- * @param string config key
- * @param string config value
- * @param string (optional) config layer
- * @param string channel to set this value for, or null for global value
- * @return bool TRUE on success, FALSE on failure
- */
- function set($key, $value, $layer = 'user', $channel = false)
- {
- if ($key == '__channels') {
- return false;
- }
-
- if (!isset($this->configuration[$layer])) {
- return false;
- }
-
- if ($key == 'default_channel') {
- // can only set this value globally
- $channel = 'pear.php.net';
- if ($value != 'pear.php.net') {
- $this->_lazyChannelSetup($layer);
- }
- }
-
- if ($key == 'preferred_mirror') {
- if ($channel == '__uri') {
- return false; // can't set the __uri pseudo-channel's mirror
- }
-
- $reg = &$this->getRegistry($layer);
- if (is_object($reg)) {
- $chan = &$reg->getChannel($channel ? $channel : 'pear.php.net');
- if (PEAR::isError($chan)) {
- return false;
- }
-
- if (!$chan->getMirror($value) && $chan->getName() != $value) {
- return false; // mirror does not exist
- }
- }
- }
-
- if (!isset($this->configuration_info[$key])) {
- return false;
- }
-
- extract($this->configuration_info[$key]);
- switch ($type) {
- case 'integer':
- $value = (int)$value;
- break;
- case 'set': {
- // If a valid_set is specified, require the value to
- // be in the set. If there is no valid_set, accept
- // any value.
- if ($valid_set) {
- reset($valid_set);
- if ((key($valid_set) === 0 && !in_array($value, $valid_set)) ||
- (key($valid_set) !== 0 && empty($valid_set[$value])))
- {
- return false;
- }
- }
- break;
- }
- }
-
- if (!$channel) {
- $channel = $this->get('default_channel', null, 'pear.php.net');
- }
-
- if (!in_array($channel, $this->_channels)) {
- $this->_lazyChannelSetup($layer);
- $reg = &$this->getRegistry($layer);
- if ($reg) {
- $channel = $reg->channelName($channel);
- }
-
- if (!in_array($channel, $this->_channels)) {
- return false;
- }
- }
-
- if ($channel != 'pear.php.net') {
- if (in_array($key, $this->_channelConfigInfo)) {
- $this->configuration[$layer]['__channels'][$channel][$key] = $value;
- return true;
- }
-
- return false;
- }
-
- if ($key == 'default_channel') {
- if (!isset($reg)) {
- $reg = &$this->getRegistry($layer);
- if (!$reg) {
- $reg = &$this->getRegistry();
- }
- }
-
- if ($reg) {
- $value = $reg->channelName($value);
- }
-
- if (!$value) {
- return false;
- }
- }
-
- $this->configuration[$layer][$key] = $value;
- if ($key == 'php_dir' && !$this->_noRegistry) {
- if (!isset($this->_registry[$layer]) ||
- $value != $this->_registry[$layer]->install_dir) {
- $this->_registry[$layer] = &new PEAR_Registry($value);
- $this->_regInitialized[$layer] = false;
- $this->_registry[$layer]->setConfig($this, false);
- }
- }
-
- return true;
- }
-
- function _lazyChannelSetup($uselayer = false)
- {
- if ($this->_noRegistry) {
- return;
- }
-
- $merge = false;
- foreach ($this->_registry as $layer => $p) {
- if ($uselayer && $uselayer != $layer) {
- continue;
- }
-
- if (!$this->_regInitialized[$layer]) {
- if ($layer == 'default' && isset($this->_registry['user']) ||
- isset($this->_registry['system'])) {
- // only use the default registry if there are no alternatives
- continue;
- }
-
- if (!is_object($this->_registry[$layer])) {
- if ($phpdir = $this->get('php_dir', $layer, 'pear.php.net')) {
- $this->_registry[$layer] = &new PEAR_Registry($phpdir);
- $this->_registry[$layer]->setConfig($this, false);
- $this->_regInitialized[$layer] = false;
- } else {
- unset($this->_registry[$layer]);
- return;
- }
- }
-
- $this->setChannels($this->_registry[$layer]->listChannels(), $merge);
- $this->_regInitialized[$layer] = true;
- $merge = true;
- }
- }
- }
-
- /**
- * Set the list of channels.
- *
- * This should be set via a call to {@link PEAR_Registry::listChannels()}
- * @param array
- * @param bool
- * @return bool success of operation
- */
- function setChannels($channels, $merge = false)
- {
- if (!is_array($channels)) {
- return false;
- }
-
- if ($merge) {
- $this->_channels = array_merge($this->_channels, $channels);
- } else {
- $this->_channels = $channels;
- }
-
- foreach ($channels as $channel) {
- $channel = strtolower($channel);
- if ($channel == 'pear.php.net') {
- continue;
- }
-
- foreach ($this->layers as $layer) {
- if (!isset($this->configuration[$layer]['__channels'])) {
- $this->configuration[$layer]['__channels'] = array();
- }
- if (!isset($this->configuration[$layer]['__channels'][$channel])
- || !is_array($this->configuration[$layer]['__channels'][$channel])) {
- $this->configuration[$layer]['__channels'][$channel] = array();
- }
- }
- }
-
- return true;
- }
-
- /**
- * Get the type of a config value.
- *
- * @param string config key
- *
- * @return string type, one of "string", "integer", "file",
- * "directory", "set" or "password".
- *
- * @access public
- *
- */
- function getType($key)
- {
- if (isset($this->configuration_info[$key])) {
- return $this->configuration_info[$key]['type'];
- }
- return false;
- }
-
- /**
- * Get the documentation for a config value.
- *
- * @param string config key
- * @return string documentation string
- *
- * @access public
- *
- */
- function getDocs($key)
- {
- if (isset($this->configuration_info[$key])) {
- return $this->configuration_info[$key]['doc'];
- }
-
- return false;
- }
-
- /**
- * Get the short documentation for a config value.
- *
- * @param string config key
- * @return string short documentation string
- *
- * @access public
- *
- */
- function getPrompt($key)
- {
- if (isset($this->configuration_info[$key])) {
- return $this->configuration_info[$key]['prompt'];
- }
-
- return false;
- }
-
- /**
- * Get the parameter group for a config key.
- *
- * @param string config key
- * @return string parameter group
- *
- * @access public
- *
- */
- function getGroup($key)
- {
- if (isset($this->configuration_info[$key])) {
- return $this->configuration_info[$key]['group'];
- }
-
- return false;
- }
-
- /**
- * Get the list of parameter groups.
- *
- * @return array list of parameter groups
- *
- * @access public
- *
- */
- function getGroups()
- {
- $tmp = array();
- foreach ($this->configuration_info as $key => $info) {
- $tmp[$info['group']] = 1;
- }
-
- return array_keys($tmp);
- }
-
- /**
- * Get the list of the parameters in a group.
- *
- * @param string $group parameter group
- * @return array list of parameters in $group
- *
- * @access public
- *
- */
- function getGroupKeys($group)
- {
- $keys = array();
- foreach ($this->configuration_info as $key => $info) {
- if ($info['group'] == $group) {
- $keys[] = $key;
- }
- }
-
- return $keys;
- }
-
- /**
- * Get the list of allowed set values for a config value. Returns
- * NULL for config values that are not sets.
- *
- * @param string config key
- * @return array enumerated array of set values, or NULL if the
- * config key is unknown or not a set
- *
- * @access public
- *
- */
- function getSetValues($key)
- {
- if (isset($this->configuration_info[$key]) &&
- isset($this->configuration_info[$key]['type']) &&
- $this->configuration_info[$key]['type'] == 'set')
- {
- $valid_set = $this->configuration_info[$key]['valid_set'];
- reset($valid_set);
- if (key($valid_set) === 0) {
- return $valid_set;
- }
-
- return array_keys($valid_set);
- }
-
- return null;
- }
-
- /**
- * Get all the current config keys.
- *
- * @return array simple array of config keys
- *
- * @access public
- */
- function getKeys()
- {
- $keys = array();
- foreach ($this->layers as $layer) {
- $test = $this->configuration[$layer];
- if (isset($test['__channels'])) {
- foreach ($test['__channels'] as $channel => $configs) {
- $keys = array_merge($keys, $configs);
- }
- }
-
- unset($test['__channels']);
- $keys = array_merge($keys, $test);
-
- }
- return array_keys($keys);
- }
-
- /**
- * Remove the a config key from a specific config layer.
- *
- * @param string config key
- * @param string (optional) config layer
- * @param string (optional) channel (defaults to default channel)
- * @return bool TRUE on success, FALSE on failure
- *
- * @access public
- */
- function remove($key, $layer = 'user', $channel = null)
- {
- if ($channel === null) {
- $channel = $this->getDefaultChannel();
- }
-
- if ($channel !== 'pear.php.net') {
- if (isset($this->configuration[$layer]['__channels'][$channel][$key])) {
- unset($this->configuration[$layer]['__channels'][$channel][$key]);
- return true;
- }
- }
-
- if (isset($this->configuration[$layer][$key])) {
- unset($this->configuration[$layer][$key]);
- return true;
- }
-
- return false;
- }
-
- /**
- * Temporarily remove an entire config layer. USE WITH CARE!
- *
- * @param string config key
- * @param string (optional) config layer
- * @return bool TRUE on success, FALSE on failure
- *
- * @access public
- */
- function removeLayer($layer)
- {
- if (isset($this->configuration[$layer])) {
- $this->configuration[$layer] = array();
- return true;
- }
-
- return false;
- }
-
- /**
- * Stores configuration data in a layer.
- *
- * @param string config layer to store
- * @return bool TRUE on success, or PEAR error on failure
- *
- * @access public
- */
- function store($layer = 'user', $data = null)
- {
- return $this->writeConfigFile(null, $layer, $data);
- }
-
- /**
- * Tells what config layer that gets to define a key.
- *
- * @param string config key
- * @param boolean return the defining channel
- *
- * @return string|array the config layer, or an empty string if not found.
- *
- * if $returnchannel, the return is an array array('layer' => layername,
- * 'channel' => channelname), or an empty string if not found
- *
- * @access public
- */
- function definedBy($key, $returnchannel = false)
- {
- foreach ($this->layers as $layer) {
- $channel = $this->getDefaultChannel();
- if ($channel !== 'pear.php.net') {
- if (isset($this->configuration[$layer]['__channels'][$channel][$key])) {
- if ($returnchannel) {
- return array('layer' => $layer, 'channel' => $channel);
- }
- return $layer;
- }
- }
-
- if (isset($this->configuration[$layer][$key])) {
- if ($returnchannel) {
- return array('layer' => $layer, 'channel' => 'pear.php.net');
- }
- return $layer;
- }
- }
-
- return '';
- }
-
- /**
- * Tells whether a given key exists as a config value.
- *
- * @param string config key
- * @return bool whether <config key> exists in this object
- *
- * @access public
- */
- function isDefined($key)
- {
- foreach ($this->layers as $layer) {
- if (isset($this->configuration[$layer][$key])) {
- return true;
- }
- }
-
- return false;
- }
-
- /**
- * Tells whether a given config layer exists.
- *
- * @param string config layer
- * @return bool whether <config layer> exists in this object
- *
- * @access public
- */
- function isDefinedLayer($layer)
- {
- return isset($this->configuration[$layer]);
- }
-
- /**
- * Returns the layers defined (except the 'default' one)
- *
- * @return array of the defined layers
- */
- function getLayers()
- {
- $cf = $this->configuration;
- unset($cf['default']);
- return array_keys($cf);
- }
-
- function apiVersion()
- {
- return '1.1';
- }
-
- /**
- * @return PEAR_Registry
- */
- function &getRegistry($use = null)
- {
- $layer = $use === null ? 'user' : $use;
- if (isset($this->_registry[$layer])) {
- return $this->_registry[$layer];
- } elseif ($use === null && isset($this->_registry['system'])) {
- return $this->_registry['system'];
- } elseif ($use === null && isset($this->_registry['default'])) {
- return $this->_registry['default'];
- } elseif ($use) {
- $a = false;
- return $a;
- }
-
- // only go here if null was passed in
- echo "CRITICAL ERROR: Registry could not be initialized from any value";
- exit(1);
- }
-
- /**
- * This is to allow customization like the use of installroot
- * @param PEAR_Registry
- * @return bool
- */
- function setRegistry(&$reg, $layer = 'user')
- {
- if ($this->_noRegistry) {
- return false;
- }
-
- if (!in_array($layer, array('user', 'system'))) {
- return false;
- }
-
- $this->_registry[$layer] = &$reg;
- if (is_object($reg)) {
- $this->_registry[$layer]->setConfig($this, false);
- }
-
- return true;
- }
-
- function noRegistry()
- {
- $this->_noRegistry = true;
- }
-
- /**
- * @return PEAR_REST
- */
- function &getREST($version, $options = array())
- {
- $version = str_replace('.', '', $version);
- if (!class_exists($class = 'PEAR_REST_' . $version)) {
- require_once 'PEAR/REST/' . $version . '.php';
- }
-
- $remote = &new $class($this, $options);
- return $remote;
- }
-
- /**
- * The ftp server is set in {@link readFTPConfigFile()}. It exists only if a
- * remote configuration file has been specified
- * @return PEAR_FTP|false
- */
- function &getFTP()
- {
- if (isset($this->_ftp)) {
- return $this->_ftp;
- }
-
- $a = false;
- return $a;
- }
-
- function _prependPath($path, $prepend)
- {
- if (strlen($prepend) > 0) {
- if (OS_WINDOWS && preg_match('/^[a-z]:/i', $path)) {
- if (preg_match('/^[a-z]:/i', $prepend)) {
- $prepend = substr($prepend, 2);
- } elseif ($prepend{0} != '\\') {
- $prepend = "\\$prepend";
- }
- $path = substr($path, 0, 2) . $prepend . substr($path, 2);
- } else {
- $path = $prepend . $path;
- }
- }
- return $path;
- }
-
- /**
- * @param string|false installation directory to prepend to all _dir variables, or false to
- * disable
- */
- function setInstallRoot($root)
- {
- if (substr($root, -1) == DIRECTORY_SEPARATOR) {
- $root = substr($root, 0, -1);
- }
- $old = $this->_installRoot;
- $this->_installRoot = $root;
- if (($old != $root) && !$this->_noRegistry) {
- foreach (array_keys($this->_registry) as $layer) {
- if ($layer == 'ftp' || !isset($this->_registry[$layer])) {
- continue;
- }
- $this->_registry[$layer] =
- &new PEAR_Registry($this->get('php_dir', $layer, 'pear.php.net'));
- $this->_registry[$layer]->setConfig($this, false);
- $this->_regInitialized[$layer] = false;
- }
- }
- }
-}
diff --git a/3rdparty/PEAR/Dependency.php b/3rdparty/PEAR/Dependency.php
deleted file mode 100644
index 705167aa70f..00000000000
--- a/3rdparty/PEAR/Dependency.php
+++ /dev/null
@@ -1,487 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 5 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2004 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 3.0 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available through the world-wide-web at the following url: |
-// | http://www.php.net/license/3_0.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Authors: Tomas V.V.Cox <cox@idecnet.com> |
-// | Stig Bakken <ssb@php.net> |
-// +----------------------------------------------------------------------+
-//
-// $Id: Dependency.php,v 1.36.4.1 2004/12/27 07:04:19 cellog Exp $
-
-require_once "PEAR.php";
-
-define('PEAR_DEPENDENCY_MISSING', -1);
-define('PEAR_DEPENDENCY_CONFLICT', -2);
-define('PEAR_DEPENDENCY_UPGRADE_MINOR', -3);
-define('PEAR_DEPENDENCY_UPGRADE_MAJOR', -4);
-define('PEAR_DEPENDENCY_BAD_DEPENDENCY', -5);
-define('PEAR_DEPENDENCY_MISSING_OPTIONAL', -6);
-define('PEAR_DEPENDENCY_CONFLICT_OPTIONAL', -7);
-define('PEAR_DEPENDENCY_UPGRADE_MINOR_OPTIONAL', -8);
-define('PEAR_DEPENDENCY_UPGRADE_MAJOR_OPTIONAL', -9);
-
-/**
- * Dependency check for PEAR packages
- *
- * The class is based on the dependency RFC that can be found at
- * http://cvs.php.net/cvs.php/pearweb/rfc. It requires PHP >= 4.1
- *
- * @author Tomas V.V.Vox <cox@idecnet.com>
- * @author Stig Bakken <ssb@php.net>
- */
-class PEAR_Dependency
-{
- // {{{ constructor
- /**
- * Constructor
- *
- * @access public
- * @param object Registry object
- * @return void
- */
- function PEAR_Dependency(&$registry)
- {
- $this->registry = &$registry;
- }
-
- // }}}
- // {{{ callCheckMethod()
-
- /**
- * This method maps the XML dependency definition to the
- * corresponding one from PEAR_Dependency
- *
- * <pre>
- * $opts => Array
- * (
- * [type] => pkg
- * [rel] => ge
- * [version] => 3.4
- * [name] => HTML_Common
- * [optional] => false
- * )
- * </pre>
- *
- * @param string Error message
- * @param array Options
- * @return boolean
- */
- function callCheckMethod(&$errmsg, $opts)
- {
- $rel = isset($opts['rel']) ? $opts['rel'] : 'has';
- $req = isset($opts['version']) ? $opts['version'] : null;
- $name = isset($opts['name']) ? $opts['name'] : null;
- $opt = (isset($opts['optional']) && $opts['optional'] == 'yes') ?
- $opts['optional'] : null;
- $errmsg = '';
- switch ($opts['type']) {
- case 'pkg':
- return $this->checkPackage($errmsg, $name, $req, $rel, $opt);
- break;
- case 'ext':
- return $this->checkExtension($errmsg, $name, $req, $rel, $opt);
- break;
- case 'php':
- return $this->checkPHP($errmsg, $req, $rel);
- break;
- case 'prog':
- return $this->checkProgram($errmsg, $name);
- break;
- case 'os':
- return $this->checkOS($errmsg, $name);
- break;
- case 'sapi':
- return $this->checkSAPI($errmsg, $name);
- break;
- case 'zend':
- return $this->checkZend($errmsg, $name);
- break;
- default:
- return "'{$opts['type']}' dependency type not supported";
- }
- }
-
- // }}}
- // {{{ checkPackage()
-
- /**
- * Package dependencies check method
- *
- * @param string $errmsg Empty string, it will be populated with an error message, if any
- * @param string $name Name of the package to test
- * @param string $req The package version required
- * @param string $relation How to compare versions with each other
- * @param bool $opt Whether the relationship is optional
- *
- * @return mixed bool false if no error or the error string
- */
- function checkPackage(&$errmsg, $name, $req = null, $relation = 'has',
- $opt = false)
- {
- if (is_string($req) && substr($req, 0, 2) == 'v.') {
- $req = substr($req, 2);
- }
- switch ($relation) {
- case 'has':
- if (!$this->registry->packageExists($name)) {
- if ($opt) {
- $errmsg = "package `$name' is recommended to utilize some features.";
- return PEAR_DEPENDENCY_MISSING_OPTIONAL;
- }
- $errmsg = "requires package `$name'";
- return PEAR_DEPENDENCY_MISSING;
- }
- return false;
- case 'not':
- if ($this->registry->packageExists($name)) {
- $errmsg = "conflicts with package `$name'";
- return PEAR_DEPENDENCY_CONFLICT;
- }
- return false;
- case 'lt':
- case 'le':
- case 'eq':
- case 'ne':
- case 'ge':
- case 'gt':
- $version = $this->registry->packageInfo($name, 'version');
- if (!$this->registry->packageExists($name)
- || !version_compare("$version", "$req", $relation))
- {
- $code = $this->codeFromRelation($relation, $version, $req, $opt);
- if ($opt) {
- $errmsg = "package `$name' version " . $this->signOperator($relation) .
- " $req is recommended to utilize some features.";
- if ($version) {
- $errmsg .= " Installed version is $version";
- }
- return $code;
- }
- $errmsg = "requires package `$name' " .
- $this->signOperator($relation) . " $req";
- return $code;
- }
- return false;
- }
- $errmsg = "relation '$relation' with requirement '$req' is not supported (name=$name)";
- return PEAR_DEPENDENCY_BAD_DEPENDENCY;
- }
-
- // }}}
- // {{{ checkPackageUninstall()
-
- /**
- * Check package dependencies on uninstall
- *
- * @param string $error The resultant error string
- * @param string $warning The resultant warning string
- * @param string $name Name of the package to test
- *
- * @return bool true if there were errors
- */
- function checkPackageUninstall(&$error, &$warning, $package)
- {
- $error = null;
- $packages = $this->registry->listPackages();
- foreach ($packages as $pkg) {
- if ($pkg == $package) {
- continue;
- }
- $deps = $this->registry->packageInfo($pkg, 'release_deps');
- if (empty($deps)) {
- continue;
- }
- foreach ($deps as $dep) {
- if ($dep['type'] == 'pkg' && strcasecmp($dep['name'], $package) == 0) {
- if ($dep['rel'] == 'ne' || $dep['rel'] == 'not') {
- continue;
- }
- if (isset($dep['optional']) && $dep['optional'] == 'yes') {
- $warning .= "\nWarning: Package '$pkg' optionally depends on '$package'";
- } else {
- $error .= "Package '$pkg' depends on '$package'\n";
- }
- }
- }
- }
- return ($error) ? true : false;
- }
-
- // }}}
- // {{{ checkExtension()
-
- /**
- * Extension dependencies check method
- *
- * @param string $name Name of the extension to test
- * @param string $req_ext_ver Required extension version to compare with
- * @param string $relation How to compare versions with eachother
- * @param bool $opt Whether the relationship is optional
- *
- * @return mixed bool false if no error or the error string
- */
- function checkExtension(&$errmsg, $name, $req = null, $relation = 'has',
- $opt = false)
- {
- if ($relation == 'not') {
- if (extension_loaded($name)) {
- $errmsg = "conflicts with PHP extension '$name'";
- return PEAR_DEPENDENCY_CONFLICT;
- } else {
- return false;
- }
- }
-
- if (!extension_loaded($name)) {
- if ($relation == 'not') {
- return false;
- }
- if ($opt) {
- $errmsg = "'$name' PHP extension is recommended to utilize some features";
- return PEAR_DEPENDENCY_MISSING_OPTIONAL;
- }
- $errmsg = "'$name' PHP extension is not installed";
- return PEAR_DEPENDENCY_MISSING;
- }
- if ($relation == 'has') {
- return false;
- }
- $code = false;
- if (is_string($req) && substr($req, 0, 2) == 'v.') {
- $req = substr($req, 2);
- }
- $ext_ver = phpversion($name);
- $operator = $relation;
- // Force params to be strings, otherwise the comparation will fail (ex. 0.9==0.90)
- if (!version_compare("$ext_ver", "$req", $operator)) {
- $errmsg = "'$name' PHP extension version " .
- $this->signOperator($operator) . " $req is required";
- $code = $this->codeFromRelation($relation, $ext_ver, $req, $opt);
- if ($opt) {
- $errmsg = "'$name' PHP extension version " . $this->signOperator($operator) .
- " $req is recommended to utilize some features";
- return $code;
- }
- }
- return $code;
- }
-
- // }}}
- // {{{ checkOS()
-
- /**
- * Operating system dependencies check method
- *
- * @param string $os Name of the operating system
- *
- * @return mixed bool false if no error or the error string
- */
- function checkOS(&$errmsg, $os)
- {
- // XXX Fixme: Implement a more flexible way, like
- // comma separated values or something similar to PEAR_OS
- static $myos;
- if (empty($myos)) {
- include_once "OS/Guess.php";
- $myos = new OS_Guess();
- }
- // only 'has' relation is currently supported
- if ($myos->matchSignature($os)) {
- return false;
- }
- $errmsg = "'$os' operating system not supported";
- return PEAR_DEPENDENCY_CONFLICT;
- }
-
- // }}}
- // {{{ checkPHP()
-
- /**
- * PHP version check method
- *
- * @param string $req which version to compare
- * @param string $relation how to compare the version
- *
- * @return mixed bool false if no error or the error string
- */
- function checkPHP(&$errmsg, $req, $relation = 'ge')
- {
- // this would be a bit stupid, but oh well :)
- if ($relation == 'has') {
- return false;
- }
- if ($relation == 'not') {
- $errmsg = 'Invalid dependency - "not" is not allowed for php dependencies, ' .
- 'php cannot conflict with itself';
- return PEAR_DEPENDENCY_BAD_DEPENDENCY;
- }
- if (substr($req, 0, 2) == 'v.') {
- $req = substr($req,2, strlen($req) - 2);
- }
- $php_ver = phpversion();
- $operator = $relation;
- if (!version_compare("$php_ver", "$req", $operator)) {
- $errmsg = "PHP version " . $this->signOperator($operator) .
- " $req is required";
- return PEAR_DEPENDENCY_CONFLICT;
- }
- return false;
- }
-
- // }}}
- // {{{ checkProgram()
-
- /**
- * External program check method. Looks for executable files in
- * directories listed in the PATH environment variable.
- *
- * @param string $program which program to look for
- *
- * @return mixed bool false if no error or the error string
- */
- function checkProgram(&$errmsg, $program)
- {
- // XXX FIXME honor safe mode
- $exe_suffix = OS_WINDOWS ? '.exe' : '';
- $path_elements = explode(PATH_SEPARATOR, getenv('PATH'));
- foreach ($path_elements as $dir) {
- $file = $dir . DIRECTORY_SEPARATOR . $program . $exe_suffix;
- if (@file_exists($file) && @is_executable($file)) {
- return false;
- }
- }
- $errmsg = "'$program' program is not present in the PATH";
- return PEAR_DEPENDENCY_MISSING;
- }
-
- // }}}
- // {{{ checkSAPI()
-
- /**
- * SAPI backend check method. Version comparison is not yet
- * available here.
- *
- * @param string $name name of SAPI backend
- * @param string $req which version to compare
- * @param string $relation how to compare versions (currently
- * hardcoded to 'has')
- * @return mixed bool false if no error or the error string
- */
- function checkSAPI(&$errmsg, $name, $req = null, $relation = 'has')
- {
- // XXX Fixme: There is no way to know if the user has or
- // not other SAPI backends installed than the installer one
-
- $sapi_backend = php_sapi_name();
- // Version comparisons not supported, sapi backends don't have
- // version information yet.
- if ($sapi_backend == $name) {
- return false;
- }
- $errmsg = "'$sapi_backend' SAPI backend not supported";
- return PEAR_DEPENDENCY_CONFLICT;
- }
-
- // }}}
- // {{{ checkZend()
-
- /**
- * Zend version check method
- *
- * @param string $req which version to compare
- * @param string $relation how to compare the version
- *
- * @return mixed bool false if no error or the error string
- */
- function checkZend(&$errmsg, $req, $relation = 'ge')
- {
- if (substr($req, 0, 2) == 'v.') {
- $req = substr($req,2, strlen($req) - 2);
- }
- $zend_ver = zend_version();
- $operator = substr($relation,0,2);
- if (!version_compare("$zend_ver", "$req", $operator)) {
- $errmsg = "Zend version " . $this->signOperator($operator) .
- " $req is required";
- return PEAR_DEPENDENCY_CONFLICT;
- }
- return false;
- }
-
- // }}}
- // {{{ signOperator()
-
- /**
- * Converts text comparing operators to them sign equivalents
- *
- * Example: 'ge' to '>='
- *
- * @access public
- * @param string Operator
- * @return string Sign equivalent
- */
- function signOperator($operator)
- {
- switch($operator) {
- case 'lt': return '<';
- case 'le': return '<=';
- case 'gt': return '>';
- case 'ge': return '>=';
- case 'eq': return '==';
- case 'ne': return '!=';
- default:
- return $operator;
- }
- }
-
- // }}}
- // {{{ codeFromRelation()
-
- /**
- * Convert relation into corresponding code
- *
- * @access public
- * @param string Relation
- * @param string Version
- * @param string Requirement
- * @param bool Optional dependency indicator
- * @return integer
- */
- function codeFromRelation($relation, $version, $req, $opt = false)
- {
- $code = PEAR_DEPENDENCY_BAD_DEPENDENCY;
- switch ($relation) {
- case 'gt': case 'ge': case 'eq':
- // upgrade
- $have_major = preg_replace('/\D.*/', '', $version);
- $need_major = preg_replace('/\D.*/', '', $req);
- if ($need_major > $have_major) {
- $code = $opt ? PEAR_DEPENDENCY_UPGRADE_MAJOR_OPTIONAL :
- PEAR_DEPENDENCY_UPGRADE_MAJOR;
- } else {
- $code = $opt ? PEAR_DEPENDENCY_UPGRADE_MINOR_OPTIONAL :
- PEAR_DEPENDENCY_UPGRADE_MINOR;
- }
- break;
- case 'lt': case 'le': case 'ne':
- $code = $opt ? PEAR_DEPENDENCY_CONFLICT_OPTIONAL :
- PEAR_DEPENDENCY_CONFLICT;
- break;
- }
- return $code;
- }
-
- // }}}
-}
-?>
diff --git a/3rdparty/PEAR/Dependency2.php b/3rdparty/PEAR/Dependency2.php
deleted file mode 100644
index f3ddeb1cf1b..00000000000
--- a/3rdparty/PEAR/Dependency2.php
+++ /dev/null
@@ -1,1358 +0,0 @@
-<?php
-/**
- * PEAR_Dependency2, advanced dependency validation
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Dependency2.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a1
- */
-
-/**
- * Required for the PEAR_VALIDATE_* constants
- */
-require_once 'PEAR/Validate.php';
-
-/**
- * Dependency check for PEAR packages
- *
- * This class handles both version 1.0 and 2.0 dependencies
- * WARNING: *any* changes to this class must be duplicated in the
- * test_PEAR_Dependency2 class found in tests/PEAR_Dependency2/setup.php.inc,
- * or unit tests will not actually validate the changes
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a1
- */
-class PEAR_Dependency2
-{
- /**
- * One of the PEAR_VALIDATE_* states
- * @see PEAR_VALIDATE_NORMAL
- * @var integer
- */
- var $_state;
-
- /**
- * Command-line options to install/upgrade/uninstall commands
- * @param array
- */
- var $_options;
-
- /**
- * @var OS_Guess
- */
- var $_os;
-
- /**
- * @var PEAR_Registry
- */
- var $_registry;
-
- /**
- * @var PEAR_Config
- */
- var $_config;
-
- /**
- * @var PEAR_DependencyDB
- */
- var $_dependencydb;
-
- /**
- * Output of PEAR_Registry::parsedPackageName()
- * @var array
- */
- var $_currentPackage;
-
- /**
- * @param PEAR_Config
- * @param array installation options
- * @param array format of PEAR_Registry::parsedPackageName()
- * @param int installation state (one of PEAR_VALIDATE_*)
- */
- function PEAR_Dependency2(&$config, $installoptions, $package,
- $state = PEAR_VALIDATE_INSTALLING)
- {
- $this->_config = &$config;
- if (!class_exists('PEAR_DependencyDB')) {
- require_once 'PEAR/DependencyDB.php';
- }
-
- if (isset($installoptions['packagingroot'])) {
- // make sure depdb is in the right location
- $config->setInstallRoot($installoptions['packagingroot']);
- }
-
- $this->_registry = &$config->getRegistry();
- $this->_dependencydb = &PEAR_DependencyDB::singleton($config);
- if (isset($installoptions['packagingroot'])) {
- $config->setInstallRoot(false);
- }
-
- $this->_options = $installoptions;
- $this->_state = $state;
- if (!class_exists('OS_Guess')) {
- require_once 'OS/Guess.php';
- }
-
- $this->_os = new OS_Guess;
- $this->_currentPackage = $package;
- }
-
- function _getExtraString($dep)
- {
- $extra = ' (';
- if (isset($dep['uri'])) {
- return '';
- }
-
- if (isset($dep['recommended'])) {
- $extra .= 'recommended version ' . $dep['recommended'];
- } else {
- if (isset($dep['min'])) {
- $extra .= 'version >= ' . $dep['min'];
- }
-
- if (isset($dep['max'])) {
- if ($extra != ' (') {
- $extra .= ', ';
- }
- $extra .= 'version <= ' . $dep['max'];
- }
-
- if (isset($dep['exclude'])) {
- if (!is_array($dep['exclude'])) {
- $dep['exclude'] = array($dep['exclude']);
- }
-
- if ($extra != ' (') {
- $extra .= ', ';
- }
-
- $extra .= 'excluded versions: ';
- foreach ($dep['exclude'] as $i => $exclude) {
- if ($i) {
- $extra .= ', ';
- }
- $extra .= $exclude;
- }
- }
- }
-
- $extra .= ')';
- if ($extra == ' ()') {
- $extra = '';
- }
-
- return $extra;
- }
-
- /**
- * This makes unit-testing a heck of a lot easier
- */
- function getPHP_OS()
- {
- return PHP_OS;
- }
-
- /**
- * This makes unit-testing a heck of a lot easier
- */
- function getsysname()
- {
- return $this->_os->getSysname();
- }
-
- /**
- * Specify a dependency on an OS. Use arch for detailed os/processor information
- *
- * There are two generic OS dependencies that will be the most common, unix and windows.
- * Other options are linux, freebsd, darwin (OS X), sunos, irix, hpux, aix
- */
- function validateOsDependency($dep)
- {
- if ($this->_state != PEAR_VALIDATE_INSTALLING && $this->_state != PEAR_VALIDATE_DOWNLOADING) {
- return true;
- }
-
- if ($dep['name'] == '*') {
- return true;
- }
-
- $not = isset($dep['conflicts']) ? true : false;
- switch (strtolower($dep['name'])) {
- case 'windows' :
- if ($not) {
- if (strtolower(substr($this->getPHP_OS(), 0, 3)) == 'win') {
- if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
- return $this->raiseError("Cannot install %s on Windows");
- }
-
- return $this->warning("warning: Cannot install %s on Windows");
- }
- } else {
- if (strtolower(substr($this->getPHP_OS(), 0, 3)) != 'win') {
- if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
- return $this->raiseError("Can only install %s on Windows");
- }
-
- return $this->warning("warning: Can only install %s on Windows");
- }
- }
- break;
- case 'unix' :
- $unices = array('linux', 'freebsd', 'darwin', 'sunos', 'irix', 'hpux', 'aix');
- if ($not) {
- if (in_array($this->getSysname(), $unices)) {
- if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
- return $this->raiseError("Cannot install %s on any Unix system");
- }
-
- return $this->warning( "warning: Cannot install %s on any Unix system");
- }
- } else {
- if (!in_array($this->getSysname(), $unices)) {
- if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
- return $this->raiseError("Can only install %s on a Unix system");
- }
-
- return $this->warning("warning: Can only install %s on a Unix system");
- }
- }
- break;
- default :
- if ($not) {
- if (strtolower($dep['name']) == strtolower($this->getSysname())) {
- if (!isset($this->_options['nodeps']) &&
- !isset($this->_options['force'])) {
- return $this->raiseError('Cannot install %s on ' . $dep['name'] .
- ' operating system');
- }
-
- return $this->warning('warning: Cannot install %s on ' .
- $dep['name'] . ' operating system');
- }
- } else {
- if (strtolower($dep['name']) != strtolower($this->getSysname())) {
- if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
- return $this->raiseError('Cannot install %s on ' .
- $this->getSysname() .
- ' operating system, can only install on ' . $dep['name']);
- }
-
- return $this->warning('warning: Cannot install %s on ' .
- $this->getSysname() .
- ' operating system, can only install on ' . $dep['name']);
- }
- }
- }
- return true;
- }
-
- /**
- * This makes unit-testing a heck of a lot easier
- */
- function matchSignature($pattern)
- {
- return $this->_os->matchSignature($pattern);
- }
-
- /**
- * Specify a complex dependency on an OS/processor/kernel version,
- * Use OS for simple operating system dependency.
- *
- * This is the only dependency that accepts an eregable pattern. The pattern
- * will be matched against the php_uname() output parsed by OS_Guess
- */
- function validateArchDependency($dep)
- {
- if ($this->_state != PEAR_VALIDATE_INSTALLING) {
- return true;
- }
-
- $not = isset($dep['conflicts']) ? true : false;
- if (!$this->matchSignature($dep['pattern'])) {
- if (!$not) {
- if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
- return $this->raiseError('%s Architecture dependency failed, does not ' .
- 'match "' . $dep['pattern'] . '"');
- }
-
- return $this->warning('warning: %s Architecture dependency failed, does ' .
- 'not match "' . $dep['pattern'] . '"');
- }
-
- return true;
- }
-
- if ($not) {
- if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
- return $this->raiseError('%s Architecture dependency failed, required "' .
- $dep['pattern'] . '"');
- }
-
- return $this->warning('warning: %s Architecture dependency failed, ' .
- 'required "' . $dep['pattern'] . '"');
- }
-
- return true;
- }
-
- /**
- * This makes unit-testing a heck of a lot easier
- */
- function extension_loaded($name)
- {
- return extension_loaded($name);
- }
-
- /**
- * This makes unit-testing a heck of a lot easier
- */
- function phpversion($name = null)
- {
- if ($name !== null) {
- return phpversion($name);
- }
-
- return phpversion();
- }
-
- function validateExtensionDependency($dep, $required = true)
- {
- if ($this->_state != PEAR_VALIDATE_INSTALLING &&
- $this->_state != PEAR_VALIDATE_DOWNLOADING) {
- return true;
- }
-
- $loaded = $this->extension_loaded($dep['name']);
- $extra = $this->_getExtraString($dep);
- if (isset($dep['exclude'])) {
- if (!is_array($dep['exclude'])) {
- $dep['exclude'] = array($dep['exclude']);
- }
- }
-
- if (!isset($dep['min']) && !isset($dep['max']) &&
- !isset($dep['recommended']) && !isset($dep['exclude'])
- ) {
- if ($loaded) {
- if (isset($dep['conflicts'])) {
- if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
- return $this->raiseError('%s conflicts with PHP extension "' .
- $dep['name'] . '"' . $extra);
- }
-
- return $this->warning('warning: %s conflicts with PHP extension "' .
- $dep['name'] . '"' . $extra);
- }
-
- return true;
- }
-
- if (isset($dep['conflicts'])) {
- return true;
- }
-
- if ($required) {
- if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
- return $this->raiseError('%s requires PHP extension "' .
- $dep['name'] . '"' . $extra);
- }
-
- return $this->warning('warning: %s requires PHP extension "' .
- $dep['name'] . '"' . $extra);
- }
-
- return $this->warning('%s can optionally use PHP extension "' .
- $dep['name'] . '"' . $extra);
- }
-
- if (!$loaded) {
- if (isset($dep['conflicts'])) {
- return true;
- }
-
- if (!$required) {
- return $this->warning('%s can optionally use PHP extension "' .
- $dep['name'] . '"' . $extra);
- }
-
- if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
- return $this->raiseError('%s requires PHP extension "' . $dep['name'] .
- '"' . $extra);
- }
-
- return $this->warning('warning: %s requires PHP extension "' . $dep['name'] .
- '"' . $extra);
- }
-
- $version = (string) $this->phpversion($dep['name']);
- if (empty($version)) {
- $version = '0';
- }
-
- $fail = false;
- if (isset($dep['min']) && !version_compare($version, $dep['min'], '>=')) {
- $fail = true;
- }
-
- if (isset($dep['max']) && !version_compare($version, $dep['max'], '<=')) {
- $fail = true;
- }
-
- if ($fail && !isset($dep['conflicts'])) {
- if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
- return $this->raiseError('%s requires PHP extension "' . $dep['name'] .
- '"' . $extra . ', installed version is ' . $version);
- }
-
- return $this->warning('warning: %s requires PHP extension "' . $dep['name'] .
- '"' . $extra . ', installed version is ' . $version);
- } elseif ((isset($dep['min']) || isset($dep['max'])) && !$fail && isset($dep['conflicts'])) {
- if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
- return $this->raiseError('%s conflicts with PHP extension "' .
- $dep['name'] . '"' . $extra . ', installed version is ' . $version);
- }
-
- return $this->warning('warning: %s conflicts with PHP extension "' .
- $dep['name'] . '"' . $extra . ', installed version is ' . $version);
- }
-
- if (isset($dep['exclude'])) {
- foreach ($dep['exclude'] as $exclude) {
- if (version_compare($version, $exclude, '==')) {
- if (isset($dep['conflicts'])) {
- continue;
- }
-
- if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
- return $this->raiseError('%s is not compatible with PHP extension "' .
- $dep['name'] . '" version ' .
- $exclude);
- }
-
- return $this->warning('warning: %s is not compatible with PHP extension "' .
- $dep['name'] . '" version ' .
- $exclude);
- } elseif (version_compare($version, $exclude, '!=') && isset($dep['conflicts'])) {
- if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
- return $this->raiseError('%s conflicts with PHP extension "' .
- $dep['name'] . '"' . $extra . ', installed version is ' . $version);
- }
-
- return $this->warning('warning: %s conflicts with PHP extension "' .
- $dep['name'] . '"' . $extra . ', installed version is ' . $version);
- }
- }
- }
-
- if (isset($dep['recommended'])) {
- if (version_compare($version, $dep['recommended'], '==')) {
- return true;
- }
-
- if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
- return $this->raiseError('%s dependency: PHP extension ' . $dep['name'] .
- ' version "' . $version . '"' .
- ' is not the recommended version "' . $dep['recommended'] .
- '", but may be compatible, use --force to install');
- }
-
- return $this->warning('warning: %s dependency: PHP extension ' .
- $dep['name'] . ' version "' . $version . '"' .
- ' is not the recommended version "' . $dep['recommended'].'"');
- }
-
- return true;
- }
-
- function validatePhpDependency($dep)
- {
- if ($this->_state != PEAR_VALIDATE_INSTALLING &&
- $this->_state != PEAR_VALIDATE_DOWNLOADING) {
- return true;
- }
-
- $version = $this->phpversion();
- $extra = $this->_getExtraString($dep);
- if (isset($dep['exclude'])) {
- if (!is_array($dep['exclude'])) {
- $dep['exclude'] = array($dep['exclude']);
- }
- }
-
- if (isset($dep['min'])) {
- if (!version_compare($version, $dep['min'], '>=')) {
- if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
- return $this->raiseError('%s requires PHP' .
- $extra . ', installed version is ' . $version);
- }
-
- return $this->warning('warning: %s requires PHP' .
- $extra . ', installed version is ' . $version);
- }
- }
-
- if (isset($dep['max'])) {
- if (!version_compare($version, $dep['max'], '<=')) {
- if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
- return $this->raiseError('%s requires PHP' .
- $extra . ', installed version is ' . $version);
- }
-
- return $this->warning('warning: %s requires PHP' .
- $extra . ', installed version is ' . $version);
- }
- }
-
- if (isset($dep['exclude'])) {
- foreach ($dep['exclude'] as $exclude) {
- if (version_compare($version, $exclude, '==')) {
- if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
- return $this->raiseError('%s is not compatible with PHP version ' .
- $exclude);
- }
-
- return $this->warning(
- 'warning: %s is not compatible with PHP version ' .
- $exclude);
- }
- }
- }
-
- return true;
- }
-
- /**
- * This makes unit-testing a heck of a lot easier
- */
- function getPEARVersion()
- {
- return '1.9.4';
- }
-
- function validatePearinstallerDependency($dep)
- {
- $pearversion = $this->getPEARVersion();
- $extra = $this->_getExtraString($dep);
- if (isset($dep['exclude'])) {
- if (!is_array($dep['exclude'])) {
- $dep['exclude'] = array($dep['exclude']);
- }
- }
-
- if (version_compare($pearversion, $dep['min'], '<')) {
- if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
- return $this->raiseError('%s requires PEAR Installer' . $extra .
- ', installed version is ' . $pearversion);
- }
-
- return $this->warning('warning: %s requires PEAR Installer' . $extra .
- ', installed version is ' . $pearversion);
- }
-
- if (isset($dep['max'])) {
- if (version_compare($pearversion, $dep['max'], '>')) {
- if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
- return $this->raiseError('%s requires PEAR Installer' . $extra .
- ', installed version is ' . $pearversion);
- }
-
- return $this->warning('warning: %s requires PEAR Installer' . $extra .
- ', installed version is ' . $pearversion);
- }
- }
-
- if (isset($dep['exclude'])) {
- if (!isset($dep['exclude'][0])) {
- $dep['exclude'] = array($dep['exclude']);
- }
-
- foreach ($dep['exclude'] as $exclude) {
- if (version_compare($exclude, $pearversion, '==')) {
- if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
- return $this->raiseError('%s is not compatible with PEAR Installer ' .
- 'version ' . $exclude);
- }
-
- return $this->warning('warning: %s is not compatible with PEAR ' .
- 'Installer version ' . $exclude);
- }
- }
- }
-
- return true;
- }
-
- function validateSubpackageDependency($dep, $required, $params)
- {
- return $this->validatePackageDependency($dep, $required, $params);
- }
-
- /**
- * @param array dependency information (2.0 format)
- * @param boolean whether this is a required dependency
- * @param array a list of downloaded packages to be installed, if any
- * @param boolean if true, then deps on pear.php.net that fail will also check
- * against pecl.php.net packages to accomodate extensions that have
- * moved to pecl.php.net from pear.php.net
- */
- function validatePackageDependency($dep, $required, $params, $depv1 = false)
- {
- if ($this->_state != PEAR_VALIDATE_INSTALLING &&
- $this->_state != PEAR_VALIDATE_DOWNLOADING) {
- return true;
- }
-
- if (isset($dep['providesextension'])) {
- if ($this->extension_loaded($dep['providesextension'])) {
- $save = $dep;
- $subdep = $dep;
- $subdep['name'] = $subdep['providesextension'];
- PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
- $ret = $this->validateExtensionDependency($subdep, $required);
- PEAR::popErrorHandling();
- if (!PEAR::isError($ret)) {
- return true;
- }
- }
- }
-
- if ($this->_state == PEAR_VALIDATE_INSTALLING) {
- return $this->_validatePackageInstall($dep, $required, $depv1);
- }
-
- if ($this->_state == PEAR_VALIDATE_DOWNLOADING) {
- return $this->_validatePackageDownload($dep, $required, $params, $depv1);
- }
- }
-
- function _validatePackageDownload($dep, $required, $params, $depv1 = false)
- {
- $dep['package'] = $dep['name'];
- if (isset($dep['uri'])) {
- $dep['channel'] = '__uri';
- }
-
- $depname = $this->_registry->parsedPackageNameToString($dep, true);
- $found = false;
- foreach ($params as $param) {
- if ($param->isEqual(
- array('package' => $dep['name'],
- 'channel' => $dep['channel']))) {
- $found = true;
- break;
- }
-
- if ($depv1 && $dep['channel'] == 'pear.php.net') {
- if ($param->isEqual(
- array('package' => $dep['name'],
- 'channel' => 'pecl.php.net'))) {
- $found = true;
- break;
- }
- }
- }
-
- if (!$found && isset($dep['providesextension'])) {
- foreach ($params as $param) {
- if ($param->isExtension($dep['providesextension'])) {
- $found = true;
- break;
- }
- }
- }
-
- if ($found) {
- $version = $param->getVersion();
- $installed = false;
- $downloaded = true;
- } else {
- if ($this->_registry->packageExists($dep['name'], $dep['channel'])) {
- $installed = true;
- $downloaded = false;
- $version = $this->_registry->packageinfo($dep['name'], 'version',
- $dep['channel']);
- } else {
- if ($dep['channel'] == 'pecl.php.net' && $this->_registry->packageExists($dep['name'],
- 'pear.php.net')) {
- $installed = true;
- $downloaded = false;
- $version = $this->_registry->packageinfo($dep['name'], 'version',
- 'pear.php.net');
- } else {
- $version = 'not installed or downloaded';
- $installed = false;
- $downloaded = false;
- }
- }
- }
-
- $extra = $this->_getExtraString($dep);
- if (isset($dep['exclude']) && !is_array($dep['exclude'])) {
- $dep['exclude'] = array($dep['exclude']);
- }
-
- if (!isset($dep['min']) && !isset($dep['max']) &&
- !isset($dep['recommended']) && !isset($dep['exclude'])
- ) {
- if ($installed || $downloaded) {
- $installed = $installed ? 'installed' : 'downloaded';
- if (isset($dep['conflicts'])) {
- $rest = '';
- if ($version) {
- $rest = ", $installed version is " . $version;
- }
-
- if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
- return $this->raiseError('%s conflicts with package "' . $depname . '"' . $extra . $rest);
- }
-
- return $this->warning('warning: %s conflicts with package "' . $depname . '"' . $extra . $rest);
- }
-
- return true;
- }
-
- if (isset($dep['conflicts'])) {
- return true;
- }
-
- if ($required) {
- if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
- return $this->raiseError('%s requires package "' . $depname . '"' . $extra);
- }
-
- return $this->warning('warning: %s requires package "' . $depname . '"' . $extra);
- }
-
- return $this->warning('%s can optionally use package "' . $depname . '"' . $extra);
- }
-
- if (!$installed && !$downloaded) {
- if (isset($dep['conflicts'])) {
- return true;
- }
-
- if ($required) {
- if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
- return $this->raiseError('%s requires package "' . $depname . '"' . $extra);
- }
-
- return $this->warning('warning: %s requires package "' . $depname . '"' . $extra);
- }
-
- return $this->warning('%s can optionally use package "' . $depname . '"' . $extra);
- }
-
- $fail = false;
- if (isset($dep['min']) && version_compare($version, $dep['min'], '<')) {
- $fail = true;
- }
-
- if (isset($dep['max']) && version_compare($version, $dep['max'], '>')) {
- $fail = true;
- }
-
- if ($fail && !isset($dep['conflicts'])) {
- $installed = $installed ? 'installed' : 'downloaded';
- $dep['package'] = $dep['name'];
- $dep = $this->_registry->parsedPackageNameToString($dep, true);
- if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
- return $this->raiseError('%s requires package "' . $depname . '"' .
- $extra . ", $installed version is " . $version);
- }
-
- return $this->warning('warning: %s requires package "' . $depname . '"' .
- $extra . ", $installed version is " . $version);
- } elseif ((isset($dep['min']) || isset($dep['max'])) && !$fail &&
- isset($dep['conflicts']) && !isset($dep['exclude'])) {
- $installed = $installed ? 'installed' : 'downloaded';
- if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
- return $this->raiseError('%s conflicts with package "' . $depname . '"' . $extra .
- ", $installed version is " . $version);
- }
-
- return $this->warning('warning: %s conflicts with package "' . $depname . '"' .
- $extra . ", $installed version is " . $version);
- }
-
- if (isset($dep['exclude'])) {
- $installed = $installed ? 'installed' : 'downloaded';
- foreach ($dep['exclude'] as $exclude) {
- if (version_compare($version, $exclude, '==') && !isset($dep['conflicts'])) {
- if (!isset($this->_options['nodeps']) &&
- !isset($this->_options['force'])
- ) {
- return $this->raiseError('%s is not compatible with ' .
- $installed . ' package "' .
- $depname . '" version ' .
- $exclude);
- }
-
- return $this->warning('warning: %s is not compatible with ' .
- $installed . ' package "' .
- $depname . '" version ' .
- $exclude);
- } elseif (version_compare($version, $exclude, '!=') && isset($dep['conflicts'])) {
- $installed = $installed ? 'installed' : 'downloaded';
- if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
- return $this->raiseError('%s conflicts with package "' . $depname . '"' .
- $extra . ", $installed version is " . $version);
- }
-
- return $this->warning('warning: %s conflicts with package "' . $depname . '"' .
- $extra . ", $installed version is " . $version);
- }
- }
- }
-
- if (isset($dep['recommended'])) {
- $installed = $installed ? 'installed' : 'downloaded';
- if (version_compare($version, $dep['recommended'], '==')) {
- return true;
- }
-
- if (!$found && $installed) {
- $param = $this->_registry->getPackage($dep['name'], $dep['channel']);
- }
-
- if ($param) {
- $found = false;
- foreach ($params as $parent) {
- if ($parent->isEqual($this->_currentPackage)) {
- $found = true;
- break;
- }
- }
-
- if ($found) {
- if ($param->isCompatible($parent)) {
- return true;
- }
- } else { // this is for validPackage() calls
- $parent = $this->_registry->getPackage($this->_currentPackage['package'],
- $this->_currentPackage['channel']);
- if ($parent !== null && $param->isCompatible($parent)) {
- return true;
- }
- }
- }
-
- if (!isset($this->_options['nodeps']) && !isset($this->_options['force']) &&
- !isset($this->_options['loose'])
- ) {
- return $this->raiseError('%s dependency package "' . $depname .
- '" ' . $installed . ' version ' . $version .
- ' is not the recommended version ' . $dep['recommended'] .
- ', but may be compatible, use --force to install');
- }
-
- return $this->warning('warning: %s dependency package "' . $depname .
- '" ' . $installed . ' version ' . $version .
- ' is not the recommended version ' . $dep['recommended']);
- }
-
- return true;
- }
-
- function _validatePackageInstall($dep, $required, $depv1 = false)
- {
- return $this->_validatePackageDownload($dep, $required, array(), $depv1);
- }
-
- /**
- * Verify that uninstalling packages passed in to command line is OK.
- *
- * @param PEAR_Installer $dl
- * @return PEAR_Error|true
- */
- function validatePackageUninstall(&$dl)
- {
- if (PEAR::isError($this->_dependencydb)) {
- return $this->_dependencydb;
- }
-
- $params = array();
- // construct an array of "downloaded" packages to fool the package dependency checker
- // into using these to validate uninstalls of circular dependencies
- $downloaded = &$dl->getUninstallPackages();
- foreach ($downloaded as $i => $pf) {
- if (!class_exists('PEAR_Downloader_Package')) {
- require_once 'PEAR/Downloader/Package.php';
- }
- $dp = &new PEAR_Downloader_Package($dl);
- $dp->setPackageFile($downloaded[$i]);
- $params[$i] = &$dp;
- }
-
- // check cache
- $memyselfandI = strtolower($this->_currentPackage['channel']) . '/' .
- strtolower($this->_currentPackage['package']);
- if (isset($dl->___uninstall_package_cache)) {
- $badpackages = $dl->___uninstall_package_cache;
- if (isset($badpackages[$memyselfandI]['warnings'])) {
- foreach ($badpackages[$memyselfandI]['warnings'] as $warning) {
- $dl->log(0, $warning[0]);
- }
- }
-
- if (isset($badpackages[$memyselfandI]['errors'])) {
- foreach ($badpackages[$memyselfandI]['errors'] as $error) {
- if (is_array($error)) {
- $dl->log(0, $error[0]);
- } else {
- $dl->log(0, $error->getMessage());
- }
- }
-
- if (isset($this->_options['nodeps']) || isset($this->_options['force'])) {
- return $this->warning(
- 'warning: %s should not be uninstalled, other installed packages depend ' .
- 'on this package');
- }
-
- return $this->raiseError(
- '%s cannot be uninstalled, other installed packages depend on this package');
- }
-
- return true;
- }
-
- // first, list the immediate parents of each package to be uninstalled
- $perpackagelist = array();
- $allparents = array();
- foreach ($params as $i => $param) {
- $a = array(
- 'channel' => strtolower($param->getChannel()),
- 'package' => strtolower($param->getPackage())
- );
-
- $deps = $this->_dependencydb->getDependentPackages($a);
- if ($deps) {
- foreach ($deps as $d) {
- $pardeps = $this->_dependencydb->getDependencies($d);
- foreach ($pardeps as $dep) {
- if (strtolower($dep['dep']['channel']) == $a['channel'] &&
- strtolower($dep['dep']['name']) == $a['package']) {
- if (!isset($perpackagelist[$a['channel'] . '/' . $a['package']])) {
- $perpackagelist[$a['channel'] . '/' . $a['package']] = array();
- }
- $perpackagelist[$a['channel'] . '/' . $a['package']][]
- = array($d['channel'] . '/' . $d['package'], $dep);
- if (!isset($allparents[$d['channel'] . '/' . $d['package']])) {
- $allparents[$d['channel'] . '/' . $d['package']] = array();
- }
- if (!isset($allparents[$d['channel'] . '/' . $d['package']][$a['channel'] . '/' . $a['package']])) {
- $allparents[$d['channel'] . '/' . $d['package']][$a['channel'] . '/' . $a['package']] = array();
- }
- $allparents[$d['channel'] . '/' . $d['package']]
- [$a['channel'] . '/' . $a['package']][]
- = array($d, $dep);
- }
- }
- }
- }
- }
-
- // next, remove any packages from the parents list that are not installed
- $remove = array();
- foreach ($allparents as $parent => $d1) {
- foreach ($d1 as $d) {
- if ($this->_registry->packageExists($d[0][0]['package'], $d[0][0]['channel'])) {
- continue;
- }
- $remove[$parent] = true;
- }
- }
-
- // next remove any packages from the parents list that are not passed in for
- // uninstallation
- foreach ($allparents as $parent => $d1) {
- foreach ($d1 as $d) {
- foreach ($params as $param) {
- if (strtolower($param->getChannel()) == $d[0][0]['channel'] &&
- strtolower($param->getPackage()) == $d[0][0]['package']) {
- // found it
- continue 3;
- }
- }
- $remove[$parent] = true;
- }
- }
-
- // remove all packages whose dependencies fail
- // save which ones failed for error reporting
- $badchildren = array();
- do {
- $fail = false;
- foreach ($remove as $package => $unused) {
- if (!isset($allparents[$package])) {
- continue;
- }
-
- foreach ($allparents[$package] as $kid => $d1) {
- foreach ($d1 as $depinfo) {
- if ($depinfo[1]['type'] != 'optional') {
- if (isset($badchildren[$kid])) {
- continue;
- }
- $badchildren[$kid] = true;
- $remove[$kid] = true;
- $fail = true;
- continue 2;
- }
- }
- }
- if ($fail) {
- // start over, we removed some children
- continue 2;
- }
- }
- } while ($fail);
-
- // next, construct the list of packages that can't be uninstalled
- $badpackages = array();
- $save = $this->_currentPackage;
- foreach ($perpackagelist as $package => $packagedeps) {
- foreach ($packagedeps as $parent) {
- if (!isset($remove[$parent[0]])) {
- continue;
- }
-
- $packagename = $this->_registry->parsePackageName($parent[0]);
- $packagename['channel'] = $this->_registry->channelAlias($packagename['channel']);
- $pa = $this->_registry->getPackage($packagename['package'], $packagename['channel']);
- $packagename['package'] = $pa->getPackage();
- $this->_currentPackage = $packagename;
- // parent is not present in uninstall list, make sure we can actually
- // uninstall it (parent dep is optional)
- $parentname['channel'] = $this->_registry->channelAlias($parent[1]['dep']['channel']);
- $pa = $this->_registry->getPackage($parent[1]['dep']['name'], $parent[1]['dep']['channel']);
- $parentname['package'] = $pa->getPackage();
- $parent[1]['dep']['package'] = $parentname['package'];
- $parent[1]['dep']['channel'] = $parentname['channel'];
- if ($parent[1]['type'] == 'optional') {
- $test = $this->_validatePackageUninstall($parent[1]['dep'], false, $dl);
- if ($test !== true) {
- $badpackages[$package]['warnings'][] = $test;
- }
- } else {
- $test = $this->_validatePackageUninstall($parent[1]['dep'], true, $dl);
- if ($test !== true) {
- $badpackages[$package]['errors'][] = $test;
- }
- }
- }
- }
-
- $this->_currentPackage = $save;
- $dl->___uninstall_package_cache = $badpackages;
- if (isset($badpackages[$memyselfandI])) {
- if (isset($badpackages[$memyselfandI]['warnings'])) {
- foreach ($badpackages[$memyselfandI]['warnings'] as $warning) {
- $dl->log(0, $warning[0]);
- }
- }
-
- if (isset($badpackages[$memyselfandI]['errors'])) {
- foreach ($badpackages[$memyselfandI]['errors'] as $error) {
- if (is_array($error)) {
- $dl->log(0, $error[0]);
- } else {
- $dl->log(0, $error->getMessage());
- }
- }
-
- if (isset($this->_options['nodeps']) || isset($this->_options['force'])) {
- return $this->warning(
- 'warning: %s should not be uninstalled, other installed packages depend ' .
- 'on this package');
- }
-
- return $this->raiseError(
- '%s cannot be uninstalled, other installed packages depend on this package');
- }
- }
-
- return true;
- }
-
- function _validatePackageUninstall($dep, $required, $dl)
- {
- $depname = $this->_registry->parsedPackageNameToString($dep, true);
- $version = $this->_registry->packageinfo($dep['package'], 'version', $dep['channel']);
- if (!$version) {
- return true;
- }
-
- $extra = $this->_getExtraString($dep);
- if (isset($dep['exclude']) && !is_array($dep['exclude'])) {
- $dep['exclude'] = array($dep['exclude']);
- }
-
- if (isset($dep['conflicts'])) {
- return true; // uninstall OK - these packages conflict (probably installed with --force)
- }
-
- if (!isset($dep['min']) && !isset($dep['max'])) {
- if (!$required) {
- return $this->warning('"' . $depname . '" can be optionally used by ' .
- 'installed package %s' . $extra);
- }
-
- if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
- return $this->raiseError('"' . $depname . '" is required by ' .
- 'installed package %s' . $extra);
- }
-
- return $this->warning('warning: "' . $depname . '" is required by ' .
- 'installed package %s' . $extra);
- }
-
- $fail = false;
- if (isset($dep['min']) && version_compare($version, $dep['min'], '>=')) {
- $fail = true;
- }
-
- if (isset($dep['max']) && version_compare($version, $dep['max'], '<=')) {
- $fail = true;
- }
-
- // we re-use this variable, preserve the original value
- $saverequired = $required;
- if (!$required) {
- return $this->warning($depname . $extra . ' can be optionally used by installed package' .
- ' "%s"');
- }
-
- if (!isset($this->_options['nodeps']) && !isset($this->_options['force'])) {
- return $this->raiseError($depname . $extra . ' is required by installed package' .
- ' "%s"');
- }
-
- return $this->raiseError('warning: ' . $depname . $extra .
- ' is required by installed package "%s"');
- }
-
- /**
- * validate a downloaded package against installed packages
- *
- * As of PEAR 1.4.3, this will only validate
- *
- * @param array|PEAR_Downloader_Package|PEAR_PackageFile_v1|PEAR_PackageFile_v2
- * $pkg package identifier (either
- * array('package' => blah, 'channel' => blah) or an array with
- * index 'info' referencing an object)
- * @param PEAR_Downloader $dl
- * @param array $params full list of packages to install
- * @return true|PEAR_Error
- */
- function validatePackage($pkg, &$dl, $params = array())
- {
- if (is_array($pkg) && isset($pkg['info'])) {
- $deps = $this->_dependencydb->getDependentPackageDependencies($pkg['info']);
- } else {
- $deps = $this->_dependencydb->getDependentPackageDependencies($pkg);
- }
-
- $fail = false;
- if ($deps) {
- if (!class_exists('PEAR_Downloader_Package')) {
- require_once 'PEAR/Downloader/Package.php';
- }
-
- $dp = &new PEAR_Downloader_Package($dl);
- if (is_object($pkg)) {
- $dp->setPackageFile($pkg);
- } else {
- $dp->setDownloadURL($pkg);
- }
-
- PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
- foreach ($deps as $channel => $info) {
- foreach ($info as $package => $ds) {
- foreach ($params as $packd) {
- if (strtolower($packd->getPackage()) == strtolower($package) &&
- $packd->getChannel() == $channel) {
- $dl->log(3, 'skipping installed package check of "' .
- $this->_registry->parsedPackageNameToString(
- array('channel' => $channel, 'package' => $package),
- true) .
- '", version "' . $packd->getVersion() . '" will be ' .
- 'downloaded and installed');
- continue 2; // jump to next package
- }
- }
-
- foreach ($ds as $d) {
- $checker = &new PEAR_Dependency2($this->_config, $this->_options,
- array('channel' => $channel, 'package' => $package), $this->_state);
- $dep = $d['dep'];
- $required = $d['type'] == 'required';
- $ret = $checker->_validatePackageDownload($dep, $required, array(&$dp));
- if (is_array($ret)) {
- $dl->log(0, $ret[0]);
- } elseif (PEAR::isError($ret)) {
- $dl->log(0, $ret->getMessage());
- $fail = true;
- }
- }
- }
- }
- PEAR::popErrorHandling();
- }
-
- if ($fail) {
- return $this->raiseError(
- '%s cannot be installed, conflicts with installed packages');
- }
-
- return true;
- }
-
- /**
- * validate a package.xml 1.0 dependency
- */
- function validateDependency1($dep, $params = array())
- {
- if (!isset($dep['optional'])) {
- $dep['optional'] = 'no';
- }
-
- list($newdep, $type) = $this->normalizeDep($dep);
- if (!$newdep) {
- return $this->raiseError("Invalid Dependency");
- }
-
- if (method_exists($this, "validate{$type}Dependency")) {
- return $this->{"validate{$type}Dependency"}($newdep, $dep['optional'] == 'no',
- $params, true);
- }
- }
-
- /**
- * Convert a 1.0 dep into a 2.0 dep
- */
- function normalizeDep($dep)
- {
- $types = array(
- 'pkg' => 'Package',
- 'ext' => 'Extension',
- 'os' => 'Os',
- 'php' => 'Php'
- );
-
- if (!isset($types[$dep['type']])) {
- return array(false, false);
- }
-
- $type = $types[$dep['type']];
-
- $newdep = array();
- switch ($type) {
- case 'Package' :
- $newdep['channel'] = 'pear.php.net';
- case 'Extension' :
- case 'Os' :
- $newdep['name'] = $dep['name'];
- break;
- }
-
- $dep['rel'] = PEAR_Dependency2::signOperator($dep['rel']);
- switch ($dep['rel']) {
- case 'has' :
- return array($newdep, $type);
- break;
- case 'not' :
- $newdep['conflicts'] = true;
- break;
- case '>=' :
- case '>' :
- $newdep['min'] = $dep['version'];
- if ($dep['rel'] == '>') {
- $newdep['exclude'] = $dep['version'];
- }
- break;
- case '<=' :
- case '<' :
- $newdep['max'] = $dep['version'];
- if ($dep['rel'] == '<') {
- $newdep['exclude'] = $dep['version'];
- }
- break;
- case 'ne' :
- case '!=' :
- $newdep['min'] = '0';
- $newdep['max'] = '100000';
- $newdep['exclude'] = $dep['version'];
- break;
- case '==' :
- $newdep['min'] = $dep['version'];
- $newdep['max'] = $dep['version'];
- break;
- }
- if ($type == 'Php') {
- if (!isset($newdep['min'])) {
- $newdep['min'] = '4.4.0';
- }
-
- if (!isset($newdep['max'])) {
- $newdep['max'] = '6.0.0';
- }
- }
- return array($newdep, $type);
- }
-
- /**
- * Converts text comparing operators to them sign equivalents
- *
- * Example: 'ge' to '>='
- *
- * @access public
- * @param string Operator
- * @return string Sign equivalent
- */
- function signOperator($operator)
- {
- switch($operator) {
- case 'lt': return '<';
- case 'le': return '<=';
- case 'gt': return '>';
- case 'ge': return '>=';
- case 'eq': return '==';
- case 'ne': return '!=';
- default:
- return $operator;
- }
- }
-
- function raiseError($msg)
- {
- if (isset($this->_options['ignore-errors'])) {
- return $this->warning($msg);
- }
-
- return PEAR::raiseError(sprintf($msg, $this->_registry->parsedPackageNameToString(
- $this->_currentPackage, true)));
- }
-
- function warning($msg)
- {
- return array(sprintf($msg, $this->_registry->parsedPackageNameToString(
- $this->_currentPackage, true)));
- }
-} \ No newline at end of file
diff --git a/3rdparty/PEAR/DependencyDB.php b/3rdparty/PEAR/DependencyDB.php
deleted file mode 100644
index 948f0c9d708..00000000000
--- a/3rdparty/PEAR/DependencyDB.php
+++ /dev/null
@@ -1,769 +0,0 @@
-<?php
-/**
- * PEAR_DependencyDB, advanced installed packages dependency database
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Tomas V. V. Cox <cox@idecnet.com>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: DependencyDB.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a1
- */
-
-/**
- * Needed for error handling
- */
-require_once 'PEAR.php';
-require_once 'PEAR/Config.php';
-
-$GLOBALS['_PEAR_DEPENDENCYDB_INSTANCE'] = array();
-/**
- * Track dependency relationships between installed packages
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @author Tomas V.V.Cox <cox@idec.net.com>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a1
- */
-class PEAR_DependencyDB
-{
- // {{{ properties
-
- /**
- * This is initialized by {@link setConfig()}
- * @var PEAR_Config
- * @access private
- */
- var $_config;
- /**
- * This is initialized by {@link setConfig()}
- * @var PEAR_Registry
- * @access private
- */
- var $_registry;
- /**
- * Filename of the dependency DB (usually .depdb)
- * @var string
- * @access private
- */
- var $_depdb = false;
- /**
- * File name of the lockfile (usually .depdblock)
- * @var string
- * @access private
- */
- var $_lockfile = false;
- /**
- * Open file resource for locking the lockfile
- * @var resource|false
- * @access private
- */
- var $_lockFp = false;
- /**
- * API version of this class, used to validate a file on-disk
- * @var string
- * @access private
- */
- var $_version = '1.0';
- /**
- * Cached dependency database file
- * @var array|null
- * @access private
- */
- var $_cache;
-
- // }}}
- // {{{ & singleton()
-
- /**
- * Get a raw dependency database. Calls setConfig() and assertDepsDB()
- * @param PEAR_Config
- * @param string|false full path to the dependency database, or false to use default
- * @return PEAR_DependencyDB|PEAR_Error
- * @static
- */
- function &singleton(&$config, $depdb = false)
- {
- $phpdir = $config->get('php_dir', null, 'pear.php.net');
- if (!isset($GLOBALS['_PEAR_DEPENDENCYDB_INSTANCE'][$phpdir])) {
- $a = new PEAR_DependencyDB;
- $GLOBALS['_PEAR_DEPENDENCYDB_INSTANCE'][$phpdir] = &$a;
- $a->setConfig($config, $depdb);
- $e = $a->assertDepsDB();
- if (PEAR::isError($e)) {
- return $e;
- }
- }
-
- return $GLOBALS['_PEAR_DEPENDENCYDB_INSTANCE'][$phpdir];
- }
-
- /**
- * Set up the registry/location of dependency DB
- * @param PEAR_Config|false
- * @param string|false full path to the dependency database, or false to use default
- */
- function setConfig(&$config, $depdb = false)
- {
- if (!$config) {
- $this->_config = &PEAR_Config::singleton();
- } else {
- $this->_config = &$config;
- }
-
- $this->_registry = &$this->_config->getRegistry();
- if (!$depdb) {
- $this->_depdb = $this->_config->get('php_dir', null, 'pear.php.net') .
- DIRECTORY_SEPARATOR . '.depdb';
- } else {
- $this->_depdb = $depdb;
- }
-
- $this->_lockfile = dirname($this->_depdb) . DIRECTORY_SEPARATOR . '.depdblock';
- }
- // }}}
-
- function hasWriteAccess()
- {
- if (!file_exists($this->_depdb)) {
- $dir = $this->_depdb;
- while ($dir && $dir != '.') {
- $dir = dirname($dir); // cd ..
- if ($dir != '.' && file_exists($dir)) {
- if (is_writeable($dir)) {
- return true;
- }
-
- return false;
- }
- }
-
- return false;
- }
-
- return is_writeable($this->_depdb);
- }
-
- // {{{ assertDepsDB()
-
- /**
- * Create the dependency database, if it doesn't exist. Error if the database is
- * newer than the code reading it.
- * @return void|PEAR_Error
- */
- function assertDepsDB()
- {
- if (!is_file($this->_depdb)) {
- $this->rebuildDB();
- return;
- }
-
- $depdb = $this->_getDepDB();
- // Datatype format has been changed, rebuild the Deps DB
- if ($depdb['_version'] < $this->_version) {
- $this->rebuildDB();
- }
-
- if ($depdb['_version']{0} > $this->_version{0}) {
- return PEAR::raiseError('Dependency database is version ' .
- $depdb['_version'] . ', and we are version ' .
- $this->_version . ', cannot continue');
- }
- }
-
- /**
- * Get a list of installed packages that depend on this package
- * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2|array
- * @return array|false
- */
- function getDependentPackages(&$pkg)
- {
- $data = $this->_getDepDB();
- if (is_object($pkg)) {
- $channel = strtolower($pkg->getChannel());
- $package = strtolower($pkg->getPackage());
- } else {
- $channel = strtolower($pkg['channel']);
- $package = strtolower($pkg['package']);
- }
-
- if (isset($data['packages'][$channel][$package])) {
- return $data['packages'][$channel][$package];
- }
-
- return false;
- }
-
- /**
- * Get a list of the actual dependencies of installed packages that depend on
- * a package.
- * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2|array
- * @return array|false
- */
- function getDependentPackageDependencies(&$pkg)
- {
- $data = $this->_getDepDB();
- if (is_object($pkg)) {
- $channel = strtolower($pkg->getChannel());
- $package = strtolower($pkg->getPackage());
- } else {
- $channel = strtolower($pkg['channel']);
- $package = strtolower($pkg['package']);
- }
-
- $depend = $this->getDependentPackages($pkg);
- if (!$depend) {
- return false;
- }
-
- $dependencies = array();
- foreach ($depend as $info) {
- $temp = $this->getDependencies($info);
- foreach ($temp as $dep) {
- if (
- isset($dep['dep'], $dep['dep']['channel'], $dep['dep']['name']) &&
- strtolower($dep['dep']['channel']) == $channel &&
- strtolower($dep['dep']['name']) == $package
- ) {
- if (!isset($dependencies[$info['channel']])) {
- $dependencies[$info['channel']] = array();
- }
-
- if (!isset($dependencies[$info['channel']][$info['package']])) {
- $dependencies[$info['channel']][$info['package']] = array();
- }
- $dependencies[$info['channel']][$info['package']][] = $dep;
- }
- }
- }
-
- return $dependencies;
- }
-
- /**
- * Get a list of dependencies of this installed package
- * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2|array
- * @return array|false
- */
- function getDependencies(&$pkg)
- {
- if (is_object($pkg)) {
- $channel = strtolower($pkg->getChannel());
- $package = strtolower($pkg->getPackage());
- } else {
- $channel = strtolower($pkg['channel']);
- $package = strtolower($pkg['package']);
- }
-
- $data = $this->_getDepDB();
- if (isset($data['dependencies'][$channel][$package])) {
- return $data['dependencies'][$channel][$package];
- }
-
- return false;
- }
-
- /**
- * Determine whether $parent depends on $child, near or deep
- * @param array|PEAR_PackageFile_v2|PEAR_PackageFile_v2
- * @param array|PEAR_PackageFile_v2|PEAR_PackageFile_v2
- */
- function dependsOn($parent, $child)
- {
- $c = array();
- $this->_getDepDB();
- return $this->_dependsOn($parent, $child, $c);
- }
-
- function _dependsOn($parent, $child, &$checked)
- {
- if (is_object($parent)) {
- $channel = strtolower($parent->getChannel());
- $package = strtolower($parent->getPackage());
- } else {
- $channel = strtolower($parent['channel']);
- $package = strtolower($parent['package']);
- }
-
- if (is_object($child)) {
- $depchannel = strtolower($child->getChannel());
- $deppackage = strtolower($child->getPackage());
- } else {
- $depchannel = strtolower($child['channel']);
- $deppackage = strtolower($child['package']);
- }
-
- if (isset($checked[$channel][$package][$depchannel][$deppackage])) {
- return false; // avoid endless recursion
- }
-
- $checked[$channel][$package][$depchannel][$deppackage] = true;
- if (!isset($this->_cache['dependencies'][$channel][$package])) {
- return false;
- }
-
- foreach ($this->_cache['dependencies'][$channel][$package] as $info) {
- if (isset($info['dep']['uri'])) {
- if (is_object($child)) {
- if ($info['dep']['uri'] == $child->getURI()) {
- return true;
- }
- } elseif (isset($child['uri'])) {
- if ($info['dep']['uri'] == $child['uri']) {
- return true;
- }
- }
- return false;
- }
-
- if (strtolower($info['dep']['channel']) == $depchannel &&
- strtolower($info['dep']['name']) == $deppackage) {
- return true;
- }
- }
-
- foreach ($this->_cache['dependencies'][$channel][$package] as $info) {
- if (isset($info['dep']['uri'])) {
- if ($this->_dependsOn(array(
- 'uri' => $info['dep']['uri'],
- 'package' => $info['dep']['name']), $child, $checked)) {
- return true;
- }
- } else {
- if ($this->_dependsOn(array(
- 'channel' => $info['dep']['channel'],
- 'package' => $info['dep']['name']), $child, $checked)) {
- return true;
- }
- }
- }
-
- return false;
- }
-
- /**
- * Register dependencies of a package that is being installed or upgraded
- * @param PEAR_PackageFile_v2|PEAR_PackageFile_v2
- */
- function installPackage(&$package)
- {
- $data = $this->_getDepDB();
- unset($this->_cache);
- $this->_setPackageDeps($data, $package);
- $this->_writeDepDB($data);
- }
-
- /**
- * Remove dependencies of a package that is being uninstalled, or upgraded.
- *
- * Upgraded packages first uninstall, then install
- * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2|array If an array, then it must have
- * indices 'channel' and 'package'
- */
- function uninstallPackage(&$pkg)
- {
- $data = $this->_getDepDB();
- unset($this->_cache);
- if (is_object($pkg)) {
- $channel = strtolower($pkg->getChannel());
- $package = strtolower($pkg->getPackage());
- } else {
- $channel = strtolower($pkg['channel']);
- $package = strtolower($pkg['package']);
- }
-
- if (!isset($data['dependencies'][$channel][$package])) {
- return true;
- }
-
- foreach ($data['dependencies'][$channel][$package] as $dep) {
- $found = false;
- $depchannel = isset($dep['dep']['uri']) ? '__uri' : strtolower($dep['dep']['channel']);
- $depname = strtolower($dep['dep']['name']);
- if (isset($data['packages'][$depchannel][$depname])) {
- foreach ($data['packages'][$depchannel][$depname] as $i => $info) {
- if ($info['channel'] == $channel && $info['package'] == $package) {
- $found = true;
- break;
- }
- }
- }
-
- if ($found) {
- unset($data['packages'][$depchannel][$depname][$i]);
- if (!count($data['packages'][$depchannel][$depname])) {
- unset($data['packages'][$depchannel][$depname]);
- if (!count($data['packages'][$depchannel])) {
- unset($data['packages'][$depchannel]);
- }
- } else {
- $data['packages'][$depchannel][$depname] =
- array_values($data['packages'][$depchannel][$depname]);
- }
- }
- }
-
- unset($data['dependencies'][$channel][$package]);
- if (!count($data['dependencies'][$channel])) {
- unset($data['dependencies'][$channel]);
- }
-
- if (!count($data['dependencies'])) {
- unset($data['dependencies']);
- }
-
- if (!count($data['packages'])) {
- unset($data['packages']);
- }
-
- $this->_writeDepDB($data);
- }
-
- /**
- * Rebuild the dependency DB by reading registry entries.
- * @return true|PEAR_Error
- */
- function rebuildDB()
- {
- $depdb = array('_version' => $this->_version);
- if (!$this->hasWriteAccess()) {
- // allow startup for read-only with older Registry
- return $depdb;
- }
-
- $packages = $this->_registry->listAllPackages();
- if (PEAR::isError($packages)) {
- return $packages;
- }
-
- foreach ($packages as $channel => $ps) {
- foreach ($ps as $package) {
- $package = $this->_registry->getPackage($package, $channel);
- if (PEAR::isError($package)) {
- return $package;
- }
- $this->_setPackageDeps($depdb, $package);
- }
- }
-
- $error = $this->_writeDepDB($depdb);
- if (PEAR::isError($error)) {
- return $error;
- }
-
- $this->_cache = $depdb;
- return true;
- }
-
- /**
- * Register usage of the dependency DB to prevent race conditions
- * @param int one of the LOCK_* constants
- * @return true|PEAR_Error
- * @access private
- */
- function _lock($mode = LOCK_EX)
- {
- if (stristr(php_uname(), 'Windows 9')) {
- return true;
- }
-
- if ($mode != LOCK_UN && is_resource($this->_lockFp)) {
- // XXX does not check type of lock (LOCK_SH/LOCK_EX)
- return true;
- }
-
- $open_mode = 'w';
- // XXX People reported problems with LOCK_SH and 'w'
- if ($mode === LOCK_SH) {
- if (!file_exists($this->_lockfile)) {
- touch($this->_lockfile);
- } elseif (!is_file($this->_lockfile)) {
- return PEAR::raiseError('could not create Dependency lock file, ' .
- 'it exists and is not a regular file');
- }
- $open_mode = 'r';
- }
-
- if (!is_resource($this->_lockFp)) {
- $this->_lockFp = @fopen($this->_lockfile, $open_mode);
- }
-
- if (!is_resource($this->_lockFp)) {
- return PEAR::raiseError("could not create Dependency lock file" .
- (isset($php_errormsg) ? ": " . $php_errormsg : ""));
- }
-
- if (!(int)flock($this->_lockFp, $mode)) {
- switch ($mode) {
- case LOCK_SH: $str = 'shared'; break;
- case LOCK_EX: $str = 'exclusive'; break;
- case LOCK_UN: $str = 'unlock'; break;
- default: $str = 'unknown'; break;
- }
-
- return PEAR::raiseError("could not acquire $str lock ($this->_lockfile)");
- }
-
- return true;
- }
-
- /**
- * Release usage of dependency DB
- * @return true|PEAR_Error
- * @access private
- */
- function _unlock()
- {
- $ret = $this->_lock(LOCK_UN);
- if (is_resource($this->_lockFp)) {
- fclose($this->_lockFp);
- }
- $this->_lockFp = null;
- return $ret;
- }
-
- /**
- * Load the dependency database from disk, or return the cache
- * @return array|PEAR_Error
- */
- function _getDepDB()
- {
- if (!$this->hasWriteAccess()) {
- return array('_version' => $this->_version);
- }
-
- if (isset($this->_cache)) {
- return $this->_cache;
- }
-
- if (!$fp = fopen($this->_depdb, 'r')) {
- $err = PEAR::raiseError("Could not open dependencies file `".$this->_depdb."'");
- return $err;
- }
-
- $rt = get_magic_quotes_runtime();
- set_magic_quotes_runtime(0);
- clearstatcache();
- fclose($fp);
- $data = unserialize(file_get_contents($this->_depdb));
- set_magic_quotes_runtime($rt);
- $this->_cache = $data;
- return $data;
- }
-
- /**
- * Write out the dependency database to disk
- * @param array the database
- * @return true|PEAR_Error
- * @access private
- */
- function _writeDepDB(&$deps)
- {
- if (PEAR::isError($e = $this->_lock(LOCK_EX))) {
- return $e;
- }
-
- if (!$fp = fopen($this->_depdb, 'wb')) {
- $this->_unlock();
- return PEAR::raiseError("Could not open dependencies file `".$this->_depdb."' for writing");
- }
-
- $rt = get_magic_quotes_runtime();
- set_magic_quotes_runtime(0);
- fwrite($fp, serialize($deps));
- set_magic_quotes_runtime($rt);
- fclose($fp);
- $this->_unlock();
- $this->_cache = $deps;
- return true;
- }
-
- /**
- * Register all dependencies from a package in the dependencies database, in essence
- * "installing" the package's dependency information
- * @param array the database
- * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2
- * @access private
- */
- function _setPackageDeps(&$data, &$pkg)
- {
- $pkg->setConfig($this->_config);
- if ($pkg->getPackagexmlVersion() == '1.0') {
- $gen = &$pkg->getDefaultGenerator();
- $deps = $gen->dependenciesToV2();
- } else {
- $deps = $pkg->getDeps(true);
- }
-
- if (!$deps) {
- return;
- }
-
- if (!is_array($data)) {
- $data = array();
- }
-
- if (!isset($data['dependencies'])) {
- $data['dependencies'] = array();
- }
-
- $channel = strtolower($pkg->getChannel());
- $package = strtolower($pkg->getPackage());
-
- if (!isset($data['dependencies'][$channel])) {
- $data['dependencies'][$channel] = array();
- }
-
- $data['dependencies'][$channel][$package] = array();
- if (isset($deps['required']['package'])) {
- if (!isset($deps['required']['package'][0])) {
- $deps['required']['package'] = array($deps['required']['package']);
- }
-
- foreach ($deps['required']['package'] as $dep) {
- $this->_registerDep($data, $pkg, $dep, 'required');
- }
- }
-
- if (isset($deps['optional']['package'])) {
- if (!isset($deps['optional']['package'][0])) {
- $deps['optional']['package'] = array($deps['optional']['package']);
- }
-
- foreach ($deps['optional']['package'] as $dep) {
- $this->_registerDep($data, $pkg, $dep, 'optional');
- }
- }
-
- if (isset($deps['required']['subpackage'])) {
- if (!isset($deps['required']['subpackage'][0])) {
- $deps['required']['subpackage'] = array($deps['required']['subpackage']);
- }
-
- foreach ($deps['required']['subpackage'] as $dep) {
- $this->_registerDep($data, $pkg, $dep, 'required');
- }
- }
-
- if (isset($deps['optional']['subpackage'])) {
- if (!isset($deps['optional']['subpackage'][0])) {
- $deps['optional']['subpackage'] = array($deps['optional']['subpackage']);
- }
-
- foreach ($deps['optional']['subpackage'] as $dep) {
- $this->_registerDep($data, $pkg, $dep, 'optional');
- }
- }
-
- if (isset($deps['group'])) {
- if (!isset($deps['group'][0])) {
- $deps['group'] = array($deps['group']);
- }
-
- foreach ($deps['group'] as $group) {
- if (isset($group['package'])) {
- if (!isset($group['package'][0])) {
- $group['package'] = array($group['package']);
- }
-
- foreach ($group['package'] as $dep) {
- $this->_registerDep($data, $pkg, $dep, 'optional',
- $group['attribs']['name']);
- }
- }
-
- if (isset($group['subpackage'])) {
- if (!isset($group['subpackage'][0])) {
- $group['subpackage'] = array($group['subpackage']);
- }
-
- foreach ($group['subpackage'] as $dep) {
- $this->_registerDep($data, $pkg, $dep, 'optional',
- $group['attribs']['name']);
- }
- }
- }
- }
-
- if ($data['dependencies'][$channel][$package] == array()) {
- unset($data['dependencies'][$channel][$package]);
- if (!count($data['dependencies'][$channel])) {
- unset($data['dependencies'][$channel]);
- }
- }
- }
-
- /**
- * @param array the database
- * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2
- * @param array the specific dependency
- * @param required|optional whether this is a required or an optional dep
- * @param string|false dependency group this dependency is from, or false for ordinary dep
- */
- function _registerDep(&$data, &$pkg, $dep, $type, $group = false)
- {
- $info = array(
- 'dep' => $dep,
- 'type' => $type,
- 'group' => $group
- );
-
- $dep = array_map('strtolower', $dep);
- $depchannel = isset($dep['channel']) ? $dep['channel'] : '__uri';
- if (!isset($data['dependencies'])) {
- $data['dependencies'] = array();
- }
-
- $channel = strtolower($pkg->getChannel());
- $package = strtolower($pkg->getPackage());
-
- if (!isset($data['dependencies'][$channel])) {
- $data['dependencies'][$channel] = array();
- }
-
- if (!isset($data['dependencies'][$channel][$package])) {
- $data['dependencies'][$channel][$package] = array();
- }
-
- $data['dependencies'][$channel][$package][] = $info;
- if (isset($data['packages'][$depchannel][$dep['name']])) {
- $found = false;
- foreach ($data['packages'][$depchannel][$dep['name']] as $i => $p) {
- if ($p['channel'] == $channel && $p['package'] == $package) {
- $found = true;
- break;
- }
- }
- } else {
- if (!isset($data['packages'])) {
- $data['packages'] = array();
- }
-
- if (!isset($data['packages'][$depchannel])) {
- $data['packages'][$depchannel] = array();
- }
-
- if (!isset($data['packages'][$depchannel][$dep['name']])) {
- $data['packages'][$depchannel][$dep['name']] = array();
- }
-
- $found = false;
- }
-
- if (!$found) {
- $data['packages'][$depchannel][$dep['name']][] = array(
- 'channel' => $channel,
- 'package' => $package
- );
- }
- }
-} \ No newline at end of file
diff --git a/3rdparty/PEAR/Downloader.php b/3rdparty/PEAR/Downloader.php
deleted file mode 100644
index 730df0b7387..00000000000
--- a/3rdparty/PEAR/Downloader.php
+++ /dev/null
@@ -1,1766 +0,0 @@
-<?php
-/**
- * PEAR_Downloader, the PEAR Installer's download utility class
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @author Stig Bakken <ssb@php.net>
- * @author Tomas V. V. Cox <cox@idecnet.com>
- * @author Martin Jansen <mj@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Downloader.php 313024 2011-07-06 19:51:24Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.3.0
- */
-
-/**
- * Needed for constants, extending
- */
-require_once 'PEAR/Common.php';
-
-define('PEAR_INSTALLER_OK', 1);
-define('PEAR_INSTALLER_FAILED', 0);
-define('PEAR_INSTALLER_SKIPPED', -1);
-define('PEAR_INSTALLER_ERROR_NO_PREF_STATE', 2);
-
-/**
- * Administration class used to download anything from the internet (PEAR Packages,
- * static URLs, xml files)
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @author Stig Bakken <ssb@php.net>
- * @author Tomas V. V. Cox <cox@idecnet.com>
- * @author Martin Jansen <mj@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.3.0
- */
-class PEAR_Downloader extends PEAR_Common
-{
- /**
- * @var PEAR_Registry
- * @access private
- */
- var $_registry;
-
- /**
- * Preferred Installation State (snapshot, devel, alpha, beta, stable)
- * @var string|null
- * @access private
- */
- var $_preferredState;
-
- /**
- * Options from command-line passed to Install.
- *
- * Recognized options:<br />
- * - onlyreqdeps : install all required dependencies as well
- * - alldeps : install all dependencies, including optional
- * - installroot : base relative path to install files in
- * - force : force a download even if warnings would prevent it
- * - nocompress : download uncompressed tarballs
- * @see PEAR_Command_Install
- * @access private
- * @var array
- */
- var $_options;
-
- /**
- * Downloaded Packages after a call to download().
- *
- * Format of each entry:
- *
- * <code>
- * array('pkg' => 'package_name', 'file' => '/path/to/local/file',
- * 'info' => array() // parsed package.xml
- * );
- * </code>
- * @access private
- * @var array
- */
- var $_downloadedPackages = array();
-
- /**
- * Packages slated for download.
- *
- * This is used to prevent downloading a package more than once should it be a dependency
- * for two packages to be installed.
- * Format of each entry:
- *
- * <pre>
- * array('package_name1' => parsed package.xml, 'package_name2' => parsed package.xml,
- * );
- * </pre>
- * @access private
- * @var array
- */
- var $_toDownload = array();
-
- /**
- * Array of every package installed, with names lower-cased.
- *
- * Format:
- * <code>
- * array('package1' => 0, 'package2' => 1, );
- * </code>
- * @var array
- */
- var $_installed = array();
-
- /**
- * @var array
- * @access private
- */
- var $_errorStack = array();
-
- /**
- * @var boolean
- * @access private
- */
- var $_internalDownload = false;
-
- /**
- * Temporary variable used in sorting packages by dependency in {@link sortPkgDeps()}
- * @var array
- * @access private
- */
- var $_packageSortTree;
-
- /**
- * Temporary directory, or configuration value where downloads will occur
- * @var string
- */
- var $_downloadDir;
-
- /**
- * @param PEAR_Frontend_*
- * @param array
- * @param PEAR_Config
- */
- function PEAR_Downloader(&$ui, $options, &$config)
- {
- parent::PEAR_Common();
- $this->_options = $options;
- $this->config = &$config;
- $this->_preferredState = $this->config->get('preferred_state');
- $this->ui = &$ui;
- if (!$this->_preferredState) {
- // don't inadvertantly use a non-set preferred_state
- $this->_preferredState = null;
- }
-
- if (isset($this->_options['installroot'])) {
- $this->config->setInstallRoot($this->_options['installroot']);
- }
- $this->_registry = &$config->getRegistry();
-
- if (isset($this->_options['alldeps']) || isset($this->_options['onlyreqdeps'])) {
- $this->_installed = $this->_registry->listAllPackages();
- foreach ($this->_installed as $key => $unused) {
- if (!count($unused)) {
- continue;
- }
- $strtolower = create_function('$a','return strtolower($a);');
- array_walk($this->_installed[$key], $strtolower);
- }
- }
- }
-
- /**
- * Attempt to discover a channel's remote capabilities from
- * its server name
- * @param string
- * @return boolean
- */
- function discover($channel)
- {
- $this->log(1, 'Attempting to discover channel "' . $channel . '"...');
- PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
- $callback = $this->ui ? array(&$this, '_downloadCallback') : null;
- if (!class_exists('System')) {
- require_once 'System.php';
- }
-
- $tmpdir = $this->config->get('temp_dir');
- $tmp = System::mktemp('-d -t "' . $tmpdir . '"');
- $a = $this->downloadHttp('http://' . $channel . '/channel.xml', $this->ui, $tmp, $callback, false);
- PEAR::popErrorHandling();
- if (PEAR::isError($a)) {
- // Attempt to fallback to https automatically.
- PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
- $this->log(1, 'Attempting fallback to https instead of http on channel "' . $channel . '"...');
- $a = $this->downloadHttp('https://' . $channel . '/channel.xml', $this->ui, $tmp, $callback, false);
- PEAR::popErrorHandling();
- if (PEAR::isError($a)) {
- return false;
- }
- }
-
- list($a, $lastmodified) = $a;
- if (!class_exists('PEAR_ChannelFile')) {
- require_once 'PEAR/ChannelFile.php';
- }
-
- $b = new PEAR_ChannelFile;
- if ($b->fromXmlFile($a)) {
- unlink($a);
- if ($this->config->get('auto_discover')) {
- $this->_registry->addChannel($b, $lastmodified);
- $alias = $b->getName();
- if ($b->getName() == $this->_registry->channelName($b->getAlias())) {
- $alias = $b->getAlias();
- }
-
- $this->log(1, 'Auto-discovered channel "' . $channel .
- '", alias "' . $alias . '", adding to registry');
- }
-
- return true;
- }
-
- unlink($a);
- return false;
- }
-
- /**
- * For simpler unit-testing
- * @param PEAR_Downloader
- * @return PEAR_Downloader_Package
- */
- function &newDownloaderPackage(&$t)
- {
- if (!class_exists('PEAR_Downloader_Package')) {
- require_once 'PEAR/Downloader/Package.php';
- }
- $a = &new PEAR_Downloader_Package($t);
- return $a;
- }
-
- /**
- * For simpler unit-testing
- * @param PEAR_Config
- * @param array
- * @param array
- * @param int
- */
- function &getDependency2Object(&$c, $i, $p, $s)
- {
- if (!class_exists('PEAR_Dependency2')) {
- require_once 'PEAR/Dependency2.php';
- }
- $z = &new PEAR_Dependency2($c, $i, $p, $s);
- return $z;
- }
-
- function &download($params)
- {
- if (!count($params)) {
- $a = array();
- return $a;
- }
-
- if (!isset($this->_registry)) {
- $this->_registry = &$this->config->getRegistry();
- }
-
- $channelschecked = array();
- // convert all parameters into PEAR_Downloader_Package objects
- foreach ($params as $i => $param) {
- $params[$i] = &$this->newDownloaderPackage($this);
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- $err = $params[$i]->initialize($param);
- PEAR::staticPopErrorHandling();
- if (!$err) {
- // skip parameters that were missed by preferred_state
- continue;
- }
-
- if (PEAR::isError($err)) {
- if (!isset($this->_options['soft']) && $err->getMessage() !== '') {
- $this->log(0, $err->getMessage());
- }
-
- $params[$i] = false;
- if (is_object($param)) {
- $param = $param->getChannel() . '/' . $param->getPackage();
- }
-
- if (!isset($this->_options['soft'])) {
- $this->log(2, 'Package "' . $param . '" is not valid');
- }
-
- // Message logged above in a specific verbose mode, passing null to not show up on CLI
- $this->pushError(null, PEAR_INSTALLER_SKIPPED);
- } else {
- do {
- if ($params[$i] && $params[$i]->getType() == 'local') {
- // bug #7090 skip channel.xml check for local packages
- break;
- }
-
- if ($params[$i] && !isset($channelschecked[$params[$i]->getChannel()]) &&
- !isset($this->_options['offline'])
- ) {
- $channelschecked[$params[$i]->getChannel()] = true;
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- if (!class_exists('System')) {
- require_once 'System.php';
- }
-
- $curchannel = &$this->_registry->getChannel($params[$i]->getChannel());
- if (PEAR::isError($curchannel)) {
- PEAR::staticPopErrorHandling();
- return $this->raiseError($curchannel);
- }
-
- if (PEAR::isError($dir = $this->getDownloadDir())) {
- PEAR::staticPopErrorHandling();
- break;
- }
-
- $mirror = $this->config->get('preferred_mirror', null, $params[$i]->getChannel());
- $url = 'http://' . $mirror . '/channel.xml';
- $a = $this->downloadHttp($url, $this->ui, $dir, null, $curchannel->lastModified());
-
- PEAR::staticPopErrorHandling();
- if (PEAR::isError($a) || !$a) {
- // Attempt fallback to https automatically
- PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
- $a = $this->downloadHttp('https://' . $mirror .
- '/channel.xml', $this->ui, $dir, null, $curchannel->lastModified());
-
- PEAR::staticPopErrorHandling();
- if (PEAR::isError($a) || !$a) {
- break;
- }
- }
- $this->log(0, 'WARNING: channel "' . $params[$i]->getChannel() . '" has ' .
- 'updated its protocols, use "' . PEAR_RUNTYPE . ' channel-update ' . $params[$i]->getChannel() .
- '" to update');
- }
- } while (false);
-
- if ($params[$i] && !isset($this->_options['downloadonly'])) {
- if (isset($this->_options['packagingroot'])) {
- $checkdir = $this->_prependPath(
- $this->config->get('php_dir', null, $params[$i]->getChannel()),
- $this->_options['packagingroot']);
- } else {
- $checkdir = $this->config->get('php_dir',
- null, $params[$i]->getChannel());
- }
-
- while ($checkdir && $checkdir != '/' && !file_exists($checkdir)) {
- $checkdir = dirname($checkdir);
- }
-
- if ($checkdir == '.') {
- $checkdir = '/';
- }
-
- if (!is_writeable($checkdir)) {
- return PEAR::raiseError('Cannot install, php_dir for channel "' .
- $params[$i]->getChannel() . '" is not writeable by the current user');
- }
- }
- }
- }
-
- unset($channelschecked);
- PEAR_Downloader_Package::removeDuplicates($params);
- if (!count($params)) {
- $a = array();
- return $a;
- }
-
- if (!isset($this->_options['nodeps']) && !isset($this->_options['offline'])) {
- $reverify = true;
- while ($reverify) {
- $reverify = false;
- foreach ($params as $i => $param) {
- //PHP Bug 40768 / PEAR Bug #10944
- //Nested foreaches fail in PHP 5.2.1
- key($params);
- $ret = $params[$i]->detectDependencies($params);
- if (PEAR::isError($ret)) {
- $reverify = true;
- $params[$i] = false;
- PEAR_Downloader_Package::removeDuplicates($params);
- if (!isset($this->_options['soft'])) {
- $this->log(0, $ret->getMessage());
- }
- continue 2;
- }
- }
- }
- }
-
- if (isset($this->_options['offline'])) {
- $this->log(3, 'Skipping dependency download check, --offline specified');
- }
-
- if (!count($params)) {
- $a = array();
- return $a;
- }
-
- while (PEAR_Downloader_Package::mergeDependencies($params));
- PEAR_Downloader_Package::removeDuplicates($params, true);
- $errorparams = array();
- if (PEAR_Downloader_Package::detectStupidDuplicates($params, $errorparams)) {
- if (count($errorparams)) {
- foreach ($errorparams as $param) {
- $name = $this->_registry->parsedPackageNameToString($param->getParsedPackage());
- $this->pushError('Duplicate package ' . $name . ' found', PEAR_INSTALLER_FAILED);
- }
- $a = array();
- return $a;
- }
- }
-
- PEAR_Downloader_Package::removeInstalled($params);
- if (!count($params)) {
- $this->pushError('No valid packages found', PEAR_INSTALLER_FAILED);
- $a = array();
- return $a;
- }
-
- PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
- $err = $this->analyzeDependencies($params);
- PEAR::popErrorHandling();
- if (!count($params)) {
- $this->pushError('No valid packages found', PEAR_INSTALLER_FAILED);
- $a = array();
- return $a;
- }
-
- $ret = array();
- $newparams = array();
- if (isset($this->_options['pretend'])) {
- return $params;
- }
-
- $somefailed = false;
- foreach ($params as $i => $package) {
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- $pf = &$params[$i]->download();
- PEAR::staticPopErrorHandling();
- if (PEAR::isError($pf)) {
- if (!isset($this->_options['soft'])) {
- $this->log(1, $pf->getMessage());
- $this->log(0, 'Error: cannot download "' .
- $this->_registry->parsedPackageNameToString($package->getParsedPackage(),
- true) .
- '"');
- }
- $somefailed = true;
- continue;
- }
-
- $newparams[] = &$params[$i];
- $ret[] = array(
- 'file' => $pf->getArchiveFile(),
- 'info' => &$pf,
- 'pkg' => $pf->getPackage()
- );
- }
-
- if ($somefailed) {
- // remove params that did not download successfully
- PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
- $err = $this->analyzeDependencies($newparams, true);
- PEAR::popErrorHandling();
- if (!count($newparams)) {
- $this->pushError('Download failed', PEAR_INSTALLER_FAILED);
- $a = array();
- return $a;
- }
- }
-
- $this->_downloadedPackages = $ret;
- return $newparams;
- }
-
- /**
- * @param array all packages to be installed
- */
- function analyzeDependencies(&$params, $force = false)
- {
- if (isset($this->_options['downloadonly'])) {
- return;
- }
-
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- $redo = true;
- $reset = $hasfailed = $failed = false;
- while ($redo) {
- $redo = false;
- foreach ($params as $i => $param) {
- $deps = $param->getDeps();
- if (!$deps) {
- $depchecker = &$this->getDependency2Object($this->config, $this->getOptions(),
- $param->getParsedPackage(), PEAR_VALIDATE_DOWNLOADING);
- $send = $param->getPackageFile();
-
- $installcheck = $depchecker->validatePackage($send, $this, $params);
- if (PEAR::isError($installcheck)) {
- if (!isset($this->_options['soft'])) {
- $this->log(0, $installcheck->getMessage());
- }
- $hasfailed = true;
- $params[$i] = false;
- $reset = true;
- $redo = true;
- $failed = false;
- PEAR_Downloader_Package::removeDuplicates($params);
- continue 2;
- }
- continue;
- }
-
- if (!$reset && $param->alreadyValidated() && !$force) {
- continue;
- }
-
- if (count($deps)) {
- $depchecker = &$this->getDependency2Object($this->config, $this->getOptions(),
- $param->getParsedPackage(), PEAR_VALIDATE_DOWNLOADING);
- $send = $param->getPackageFile();
- if ($send === null) {
- $send = $param->getDownloadURL();
- }
-
- $installcheck = $depchecker->validatePackage($send, $this, $params);
- if (PEAR::isError($installcheck)) {
- if (!isset($this->_options['soft'])) {
- $this->log(0, $installcheck->getMessage());
- }
- $hasfailed = true;
- $params[$i] = false;
- $reset = true;
- $redo = true;
- $failed = false;
- PEAR_Downloader_Package::removeDuplicates($params);
- continue 2;
- }
-
- $failed = false;
- if (isset($deps['required']) && is_array($deps['required'])) {
- foreach ($deps['required'] as $type => $dep) {
- // note: Dependency2 will never return a PEAR_Error if ignore-errors
- // is specified, so soft is needed to turn off logging
- if (!isset($dep[0])) {
- if (PEAR::isError($e = $depchecker->{"validate{$type}Dependency"}($dep,
- true, $params))) {
- $failed = true;
- if (!isset($this->_options['soft'])) {
- $this->log(0, $e->getMessage());
- }
- } elseif (is_array($e) && !$param->alreadyValidated()) {
- if (!isset($this->_options['soft'])) {
- $this->log(0, $e[0]);
- }
- }
- } else {
- foreach ($dep as $d) {
- if (PEAR::isError($e =
- $depchecker->{"validate{$type}Dependency"}($d,
- true, $params))) {
- $failed = true;
- if (!isset($this->_options['soft'])) {
- $this->log(0, $e->getMessage());
- }
- } elseif (is_array($e) && !$param->alreadyValidated()) {
- if (!isset($this->_options['soft'])) {
- $this->log(0, $e[0]);
- }
- }
- }
- }
- }
-
- if (isset($deps['optional']) && is_array($deps['optional'])) {
- foreach ($deps['optional'] as $type => $dep) {
- if (!isset($dep[0])) {
- if (PEAR::isError($e =
- $depchecker->{"validate{$type}Dependency"}($dep,
- false, $params))) {
- $failed = true;
- if (!isset($this->_options['soft'])) {
- $this->log(0, $e->getMessage());
- }
- } elseif (is_array($e) && !$param->alreadyValidated()) {
- if (!isset($this->_options['soft'])) {
- $this->log(0, $e[0]);
- }
- }
- } else {
- foreach ($dep as $d) {
- if (PEAR::isError($e =
- $depchecker->{"validate{$type}Dependency"}($d,
- false, $params))) {
- $failed = true;
- if (!isset($this->_options['soft'])) {
- $this->log(0, $e->getMessage());
- }
- } elseif (is_array($e) && !$param->alreadyValidated()) {
- if (!isset($this->_options['soft'])) {
- $this->log(0, $e[0]);
- }
- }
- }
- }
- }
- }
-
- $groupname = $param->getGroup();
- if (isset($deps['group']) && $groupname) {
- if (!isset($deps['group'][0])) {
- $deps['group'] = array($deps['group']);
- }
-
- $found = false;
- foreach ($deps['group'] as $group) {
- if ($group['attribs']['name'] == $groupname) {
- $found = true;
- break;
- }
- }
-
- if ($found) {
- unset($group['attribs']);
- foreach ($group as $type => $dep) {
- if (!isset($dep[0])) {
- if (PEAR::isError($e =
- $depchecker->{"validate{$type}Dependency"}($dep,
- false, $params))) {
- $failed = true;
- if (!isset($this->_options['soft'])) {
- $this->log(0, $e->getMessage());
- }
- } elseif (is_array($e) && !$param->alreadyValidated()) {
- if (!isset($this->_options['soft'])) {
- $this->log(0, $e[0]);
- }
- }
- } else {
- foreach ($dep as $d) {
- if (PEAR::isError($e =
- $depchecker->{"validate{$type}Dependency"}($d,
- false, $params))) {
- $failed = true;
- if (!isset($this->_options['soft'])) {
- $this->log(0, $e->getMessage());
- }
- } elseif (is_array($e) && !$param->alreadyValidated()) {
- if (!isset($this->_options['soft'])) {
- $this->log(0, $e[0]);
- }
- }
- }
- }
- }
- }
- }
- } else {
- foreach ($deps as $dep) {
- if (PEAR::isError($e = $depchecker->validateDependency1($dep, $params))) {
- $failed = true;
- if (!isset($this->_options['soft'])) {
- $this->log(0, $e->getMessage());
- }
- } elseif (is_array($e) && !$param->alreadyValidated()) {
- if (!isset($this->_options['soft'])) {
- $this->log(0, $e[0]);
- }
- }
- }
- }
- $params[$i]->setValidated();
- }
-
- if ($failed) {
- $hasfailed = true;
- $params[$i] = false;
- $reset = true;
- $redo = true;
- $failed = false;
- PEAR_Downloader_Package::removeDuplicates($params);
- continue 2;
- }
- }
- }
-
- PEAR::staticPopErrorHandling();
- if ($hasfailed && (isset($this->_options['ignore-errors']) ||
- isset($this->_options['nodeps']))) {
- // this is probably not needed, but just in case
- if (!isset($this->_options['soft'])) {
- $this->log(0, 'WARNING: dependencies failed');
- }
- }
- }
-
- /**
- * Retrieve the directory that downloads will happen in
- * @access private
- * @return string
- */
- function getDownloadDir()
- {
- if (isset($this->_downloadDir)) {
- return $this->_downloadDir;
- }
-
- $downloaddir = $this->config->get('download_dir');
- if (empty($downloaddir) || (is_dir($downloaddir) && !is_writable($downloaddir))) {
- if (is_dir($downloaddir) && !is_writable($downloaddir)) {
- $this->log(0, 'WARNING: configuration download directory "' . $downloaddir .
- '" is not writeable. Change download_dir config variable to ' .
- 'a writeable dir to avoid this warning');
- }
-
- if (!class_exists('System')) {
- require_once 'System.php';
- }
-
- if (PEAR::isError($downloaddir = System::mktemp('-d'))) {
- return $downloaddir;
- }
- $this->log(3, '+ tmp dir created at ' . $downloaddir);
- }
-
- if (!is_writable($downloaddir)) {
- if (PEAR::isError(System::mkdir(array('-p', $downloaddir))) ||
- !is_writable($downloaddir)) {
- return PEAR::raiseError('download directory "' . $downloaddir .
- '" is not writeable. Change download_dir config variable to ' .
- 'a writeable dir');
- }
- }
-
- return $this->_downloadDir = $downloaddir;
- }
-
- function setDownloadDir($dir)
- {
- if (!@is_writable($dir)) {
- if (PEAR::isError(System::mkdir(array('-p', $dir)))) {
- return PEAR::raiseError('download directory "' . $dir .
- '" is not writeable. Change download_dir config variable to ' .
- 'a writeable dir');
- }
- }
- $this->_downloadDir = $dir;
- }
-
- function configSet($key, $value, $layer = 'user', $channel = false)
- {
- $this->config->set($key, $value, $layer, $channel);
- $this->_preferredState = $this->config->get('preferred_state', null, $channel);
- if (!$this->_preferredState) {
- // don't inadvertantly use a non-set preferred_state
- $this->_preferredState = null;
- }
- }
-
- function setOptions($options)
- {
- $this->_options = $options;
- }
-
- function getOptions()
- {
- return $this->_options;
- }
-
-
- /**
- * @param array output of {@link parsePackageName()}
- * @access private
- */
- function _getPackageDownloadUrl($parr)
- {
- $curchannel = $this->config->get('default_channel');
- $this->configSet('default_channel', $parr['channel']);
- // getDownloadURL returns an array. On error, it only contains information
- // on the latest release as array(version, info). On success it contains
- // array(version, info, download url string)
- $state = isset($parr['state']) ? $parr['state'] : $this->config->get('preferred_state');
- if (!$this->_registry->channelExists($parr['channel'])) {
- do {
- if ($this->config->get('auto_discover') && $this->discover($parr['channel'])) {
- break;
- }
-
- $this->configSet('default_channel', $curchannel);
- return PEAR::raiseError('Unknown remote channel: ' . $parr['channel']);
- } while (false);
- }
-
- $chan = &$this->_registry->getChannel($parr['channel']);
- if (PEAR::isError($chan)) {
- return $chan;
- }
-
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- $version = $this->_registry->packageInfo($parr['package'], 'version', $parr['channel']);
- $stability = $this->_registry->packageInfo($parr['package'], 'stability', $parr['channel']);
- // package is installed - use the installed release stability level
- if (!isset($parr['state']) && $stability !== null) {
- $state = $stability['release'];
- }
- PEAR::staticPopErrorHandling();
- $base2 = false;
-
- $preferred_mirror = $this->config->get('preferred_mirror');
- if (!$chan->supportsREST($preferred_mirror) ||
- (
- !($base2 = $chan->getBaseURL('REST1.3', $preferred_mirror))
- &&
- !($base = $chan->getBaseURL('REST1.0', $preferred_mirror))
- )
- ) {
- return $this->raiseError($parr['channel'] . ' is using a unsupported protocol - This should never happen.');
- }
-
- if ($base2) {
- $rest = &$this->config->getREST('1.3', $this->_options);
- $base = $base2;
- } else {
- $rest = &$this->config->getREST('1.0', $this->_options);
- }
-
- $downloadVersion = false;
- if (!isset($parr['version']) && !isset($parr['state']) && $version
- && !PEAR::isError($version)
- && !isset($this->_options['downloadonly'])
- ) {
- $downloadVersion = $version;
- }
-
- $url = $rest->getDownloadURL($base, $parr, $state, $downloadVersion, $chan->getName());
- if (PEAR::isError($url)) {
- $this->configSet('default_channel', $curchannel);
- return $url;
- }
-
- if ($parr['channel'] != $curchannel) {
- $this->configSet('default_channel', $curchannel);
- }
-
- if (!is_array($url)) {
- return $url;
- }
-
- $url['raw'] = false; // no checking is necessary for REST
- if (!is_array($url['info'])) {
- return PEAR::raiseError('Invalid remote dependencies retrieved from REST - ' .
- 'this should never happen');
- }
-
- if (!isset($this->_options['force']) &&
- !isset($this->_options['downloadonly']) &&
- $version &&
- !PEAR::isError($version) &&
- !isset($parr['group'])
- ) {
- if (version_compare($version, $url['version'], '=')) {
- return PEAR::raiseError($this->_registry->parsedPackageNameToString(
- $parr, true) . ' is already installed and is the same as the ' .
- 'released version ' . $url['version'], -976);
- }
-
- if (version_compare($version, $url['version'], '>')) {
- return PEAR::raiseError($this->_registry->parsedPackageNameToString(
- $parr, true) . ' is already installed and is newer than detected ' .
- 'released version ' . $url['version'], -976);
- }
- }
-
- if (isset($url['info']['required']) || $url['compatible']) {
- require_once 'PEAR/PackageFile/v2.php';
- $pf = new PEAR_PackageFile_v2;
- $pf->setRawChannel($parr['channel']);
- if ($url['compatible']) {
- $pf->setRawCompatible($url['compatible']);
- }
- } else {
- require_once 'PEAR/PackageFile/v1.php';
- $pf = new PEAR_PackageFile_v1;
- }
-
- $pf->setRawPackage($url['package']);
- $pf->setDeps($url['info']);
- if ($url['compatible']) {
- $pf->setCompatible($url['compatible']);
- }
-
- $pf->setRawState($url['stability']);
- $url['info'] = &$pf;
- if (!extension_loaded("zlib") || isset($this->_options['nocompress'])) {
- $ext = '.tar';
- } else {
- $ext = '.tgz';
- }
-
- if (is_array($url) && isset($url['url'])) {
- $url['url'] .= $ext;
- }
-
- return $url;
- }
-
- /**
- * @param array dependency array
- * @access private
- */
- function _getDepPackageDownloadUrl($dep, $parr)
- {
- $xsdversion = isset($dep['rel']) ? '1.0' : '2.0';
- $curchannel = $this->config->get('default_channel');
- if (isset($dep['uri'])) {
- $xsdversion = '2.0';
- $chan = &$this->_registry->getChannel('__uri');
- if (PEAR::isError($chan)) {
- return $chan;
- }
-
- $version = $this->_registry->packageInfo($dep['name'], 'version', '__uri');
- $this->configSet('default_channel', '__uri');
- } else {
- if (isset($dep['channel'])) {
- $remotechannel = $dep['channel'];
- } else {
- $remotechannel = 'pear.php.net';
- }
-
- if (!$this->_registry->channelExists($remotechannel)) {
- do {
- if ($this->config->get('auto_discover')) {
- if ($this->discover($remotechannel)) {
- break;
- }
- }
- return PEAR::raiseError('Unknown remote channel: ' . $remotechannel);
- } while (false);
- }
-
- $chan = &$this->_registry->getChannel($remotechannel);
- if (PEAR::isError($chan)) {
- return $chan;
- }
-
- $version = $this->_registry->packageInfo($dep['name'], 'version', $remotechannel);
- $this->configSet('default_channel', $remotechannel);
- }
-
- $state = isset($parr['state']) ? $parr['state'] : $this->config->get('preferred_state');
- if (isset($parr['state']) && isset($parr['version'])) {
- unset($parr['state']);
- }
-
- if (isset($dep['uri'])) {
- $info = &$this->newDownloaderPackage($this);
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- $err = $info->initialize($dep);
- PEAR::staticPopErrorHandling();
- if (!$err) {
- // skip parameters that were missed by preferred_state
- return PEAR::raiseError('Cannot initialize dependency');
- }
-
- if (PEAR::isError($err)) {
- if (!isset($this->_options['soft'])) {
- $this->log(0, $err->getMessage());
- }
-
- if (is_object($info)) {
- $param = $info->getChannel() . '/' . $info->getPackage();
- }
- return PEAR::raiseError('Package "' . $param . '" is not valid');
- }
- return $info;
- } elseif ($chan->supportsREST($this->config->get('preferred_mirror'))
- &&
- (
- ($base2 = $chan->getBaseURL('REST1.3', $this->config->get('preferred_mirror')))
- ||
- ($base = $chan->getBaseURL('REST1.0', $this->config->get('preferred_mirror')))
- )
- ) {
- if ($base2) {
- $base = $base2;
- $rest = &$this->config->getREST('1.3', $this->_options);
- } else {
- $rest = &$this->config->getREST('1.0', $this->_options);
- }
-
- $url = $rest->getDepDownloadURL($base, $xsdversion, $dep, $parr,
- $state, $version, $chan->getName());
- if (PEAR::isError($url)) {
- return $url;
- }
-
- if ($parr['channel'] != $curchannel) {
- $this->configSet('default_channel', $curchannel);
- }
-
- if (!is_array($url)) {
- return $url;
- }
-
- $url['raw'] = false; // no checking is necessary for REST
- if (!is_array($url['info'])) {
- return PEAR::raiseError('Invalid remote dependencies retrieved from REST - ' .
- 'this should never happen');
- }
-
- if (isset($url['info']['required'])) {
- if (!class_exists('PEAR_PackageFile_v2')) {
- require_once 'PEAR/PackageFile/v2.php';
- }
- $pf = new PEAR_PackageFile_v2;
- $pf->setRawChannel($remotechannel);
- } else {
- if (!class_exists('PEAR_PackageFile_v1')) {
- require_once 'PEAR/PackageFile/v1.php';
- }
- $pf = new PEAR_PackageFile_v1;
-
- }
- $pf->setRawPackage($url['package']);
- $pf->setDeps($url['info']);
- if ($url['compatible']) {
- $pf->setCompatible($url['compatible']);
- }
-
- $pf->setRawState($url['stability']);
- $url['info'] = &$pf;
- if (!extension_loaded("zlib") || isset($this->_options['nocompress'])) {
- $ext = '.tar';
- } else {
- $ext = '.tgz';
- }
-
- if (is_array($url) && isset($url['url'])) {
- $url['url'] .= $ext;
- }
-
- return $url;
- }
-
- return $this->raiseError($parr['channel'] . ' is using a unsupported protocol - This should never happen.');
- }
-
- /**
- * @deprecated in favor of _getPackageDownloadUrl
- */
- function getPackageDownloadUrl($package, $version = null, $channel = false)
- {
- if ($version) {
- $package .= "-$version";
- }
- if ($this === null || $this->_registry === null) {
- $package = "http://pear.php.net/get/$package";
- } else {
- $chan = $this->_registry->getChannel($channel);
- if (PEAR::isError($chan)) {
- return '';
- }
- $package = "http://" . $chan->getServer() . "/get/$package";
- }
- if (!extension_loaded("zlib")) {
- $package .= '?uncompress=yes';
- }
- return $package;
- }
-
- /**
- * Retrieve a list of downloaded packages after a call to {@link download()}.
- *
- * Also resets the list of downloaded packages.
- * @return array
- */
- function getDownloadedPackages()
- {
- $ret = $this->_downloadedPackages;
- $this->_downloadedPackages = array();
- $this->_toDownload = array();
- return $ret;
- }
-
- function _downloadCallback($msg, $params = null)
- {
- switch ($msg) {
- case 'saveas':
- $this->log(1, "downloading $params ...");
- break;
- case 'done':
- $this->log(1, '...done: ' . number_format($params, 0, '', ',') . ' bytes');
- break;
- case 'bytesread':
- static $bytes;
- if (empty($bytes)) {
- $bytes = 0;
- }
- if (!($bytes % 10240)) {
- $this->log(1, '.', false);
- }
- $bytes += $params;
- break;
- case 'start':
- if($params[1] == -1) {
- $length = "Unknown size";
- } else {
- $length = number_format($params[1], 0, '', ',')." bytes";
- }
- $this->log(1, "Starting to download {$params[0]} ($length)");
- break;
- }
- if (method_exists($this->ui, '_downloadCallback'))
- $this->ui->_downloadCallback($msg, $params);
- }
-
- function _prependPath($path, $prepend)
- {
- if (strlen($prepend) > 0) {
- if (OS_WINDOWS && preg_match('/^[a-z]:/i', $path)) {
- if (preg_match('/^[a-z]:/i', $prepend)) {
- $prepend = substr($prepend, 2);
- } elseif ($prepend{0} != '\\') {
- $prepend = "\\$prepend";
- }
- $path = substr($path, 0, 2) . $prepend . substr($path, 2);
- } else {
- $path = $prepend . $path;
- }
- }
- return $path;
- }
-
- /**
- * @param string
- * @param integer
- */
- function pushError($errmsg, $code = -1)
- {
- array_push($this->_errorStack, array($errmsg, $code));
- }
-
- function getErrorMsgs()
- {
- $msgs = array();
- $errs = $this->_errorStack;
- foreach ($errs as $err) {
- $msgs[] = $err[0];
- }
- $this->_errorStack = array();
- return $msgs;
- }
-
- /**
- * for BC
- *
- * @deprecated
- */
- function sortPkgDeps(&$packages, $uninstall = false)
- {
- $uninstall ?
- $this->sortPackagesForUninstall($packages) :
- $this->sortPackagesForInstall($packages);
- }
-
- /**
- * Sort a list of arrays of array(downloaded packagefilename) by dependency.
- *
- * This uses the topological sort method from graph theory, and the
- * Structures_Graph package to properly sort dependencies for installation.
- * @param array an array of downloaded PEAR_Downloader_Packages
- * @return array array of array(packagefilename, package.xml contents)
- */
- function sortPackagesForInstall(&$packages)
- {
- require_once 'Structures/Graph.php';
- require_once 'Structures/Graph/Node.php';
- require_once 'Structures/Graph/Manipulator/TopologicalSorter.php';
- $depgraph = new Structures_Graph(true);
- $nodes = array();
- $reg = &$this->config->getRegistry();
- foreach ($packages as $i => $package) {
- $pname = $reg->parsedPackageNameToString(
- array(
- 'channel' => $package->getChannel(),
- 'package' => strtolower($package->getPackage()),
- ));
- $nodes[$pname] = new Structures_Graph_Node;
- $nodes[$pname]->setData($packages[$i]);
- $depgraph->addNode($nodes[$pname]);
- }
-
- $deplinks = array();
- foreach ($nodes as $package => $node) {
- $pf = &$node->getData();
- $pdeps = $pf->getDeps(true);
- if (!$pdeps) {
- continue;
- }
-
- if ($pf->getPackagexmlVersion() == '1.0') {
- foreach ($pdeps as $dep) {
- if ($dep['type'] != 'pkg' ||
- (isset($dep['optional']) && $dep['optional'] == 'yes')) {
- continue;
- }
-
- $dname = $reg->parsedPackageNameToString(
- array(
- 'channel' => 'pear.php.net',
- 'package' => strtolower($dep['name']),
- ));
-
- if (isset($nodes[$dname])) {
- if (!isset($deplinks[$dname])) {
- $deplinks[$dname] = array();
- }
-
- $deplinks[$dname][$package] = 1;
- // dependency is in installed packages
- continue;
- }
-
- $dname = $reg->parsedPackageNameToString(
- array(
- 'channel' => 'pecl.php.net',
- 'package' => strtolower($dep['name']),
- ));
-
- if (isset($nodes[$dname])) {
- if (!isset($deplinks[$dname])) {
- $deplinks[$dname] = array();
- }
-
- $deplinks[$dname][$package] = 1;
- // dependency is in installed packages
- continue;
- }
- }
- } else {
- // the only ordering we care about is:
- // 1) subpackages must be installed before packages that depend on them
- // 2) required deps must be installed before packages that depend on them
- if (isset($pdeps['required']['subpackage'])) {
- $t = $pdeps['required']['subpackage'];
- if (!isset($t[0])) {
- $t = array($t);
- }
-
- $this->_setupGraph($t, $reg, $deplinks, $nodes, $package);
- }
-
- if (isset($pdeps['group'])) {
- if (!isset($pdeps['group'][0])) {
- $pdeps['group'] = array($pdeps['group']);
- }
-
- foreach ($pdeps['group'] as $group) {
- if (isset($group['subpackage'])) {
- $t = $group['subpackage'];
- if (!isset($t[0])) {
- $t = array($t);
- }
-
- $this->_setupGraph($t, $reg, $deplinks, $nodes, $package);
- }
- }
- }
-
- if (isset($pdeps['optional']['subpackage'])) {
- $t = $pdeps['optional']['subpackage'];
- if (!isset($t[0])) {
- $t = array($t);
- }
-
- $this->_setupGraph($t, $reg, $deplinks, $nodes, $package);
- }
-
- if (isset($pdeps['required']['package'])) {
- $t = $pdeps['required']['package'];
- if (!isset($t[0])) {
- $t = array($t);
- }
-
- $this->_setupGraph($t, $reg, $deplinks, $nodes, $package);
- }
-
- if (isset($pdeps['group'])) {
- if (!isset($pdeps['group'][0])) {
- $pdeps['group'] = array($pdeps['group']);
- }
-
- foreach ($pdeps['group'] as $group) {
- if (isset($group['package'])) {
- $t = $group['package'];
- if (!isset($t[0])) {
- $t = array($t);
- }
-
- $this->_setupGraph($t, $reg, $deplinks, $nodes, $package);
- }
- }
- }
- }
- }
-
- $this->_detectDepCycle($deplinks);
- foreach ($deplinks as $dependent => $parents) {
- foreach ($parents as $parent => $unused) {
- $nodes[$dependent]->connectTo($nodes[$parent]);
- }
- }
-
- $installOrder = Structures_Graph_Manipulator_TopologicalSorter::sort($depgraph);
- $ret = array();
- for ($i = 0, $count = count($installOrder); $i < $count; $i++) {
- foreach ($installOrder[$i] as $index => $sortedpackage) {
- $data = &$installOrder[$i][$index]->getData();
- $ret[] = &$nodes[$reg->parsedPackageNameToString(
- array(
- 'channel' => $data->getChannel(),
- 'package' => strtolower($data->getPackage()),
- ))]->getData();
- }
- }
-
- $packages = $ret;
- return;
- }
-
- /**
- * Detect recursive links between dependencies and break the cycles
- *
- * @param array
- * @access private
- */
- function _detectDepCycle(&$deplinks)
- {
- do {
- $keepgoing = false;
- foreach ($deplinks as $dep => $parents) {
- foreach ($parents as $parent => $unused) {
- // reset the parent cycle detector
- $this->_testCycle(null, null, null);
- if ($this->_testCycle($dep, $deplinks, $parent)) {
- $keepgoing = true;
- unset($deplinks[$dep][$parent]);
- if (count($deplinks[$dep]) == 0) {
- unset($deplinks[$dep]);
- }
-
- continue 3;
- }
- }
- }
- } while ($keepgoing);
- }
-
- function _testCycle($test, $deplinks, $dep)
- {
- static $visited = array();
- if ($test === null) {
- $visited = array();
- return;
- }
-
- // this happens when a parent has a dep cycle on another dependency
- // but the child is not part of the cycle
- if (isset($visited[$dep])) {
- return false;
- }
-
- $visited[$dep] = 1;
- if ($test == $dep) {
- return true;
- }
-
- if (isset($deplinks[$dep])) {
- if (in_array($test, array_keys($deplinks[$dep]), true)) {
- return true;
- }
-
- foreach ($deplinks[$dep] as $parent => $unused) {
- if ($this->_testCycle($test, $deplinks, $parent)) {
- return true;
- }
- }
- }
-
- return false;
- }
-
- /**
- * Set up the dependency for installation parsing
- *
- * @param array $t dependency information
- * @param PEAR_Registry $reg
- * @param array $deplinks list of dependency links already established
- * @param array $nodes all existing package nodes
- * @param string $package parent package name
- * @access private
- */
- function _setupGraph($t, $reg, &$deplinks, &$nodes, $package)
- {
- foreach ($t as $dep) {
- $depchannel = !isset($dep['channel']) ? '__uri': $dep['channel'];
- $dname = $reg->parsedPackageNameToString(
- array(
- 'channel' => $depchannel,
- 'package' => strtolower($dep['name']),
- ));
-
- if (isset($nodes[$dname])) {
- if (!isset($deplinks[$dname])) {
- $deplinks[$dname] = array();
- }
- $deplinks[$dname][$package] = 1;
- }
- }
- }
-
- function _dependsOn($a, $b)
- {
- return $this->_checkDepTree(strtolower($a->getChannel()), strtolower($a->getPackage()), $b);
- }
-
- function _checkDepTree($channel, $package, $b, $checked = array())
- {
- $checked[$channel][$package] = true;
- if (!isset($this->_depTree[$channel][$package])) {
- return false;
- }
-
- if (isset($this->_depTree[$channel][$package][strtolower($b->getChannel())]
- [strtolower($b->getPackage())])) {
- return true;
- }
-
- foreach ($this->_depTree[$channel][$package] as $ch => $packages) {
- foreach ($packages as $pa => $true) {
- if ($this->_checkDepTree($ch, $pa, $b, $checked)) {
- return true;
- }
- }
- }
-
- return false;
- }
-
- function _sortInstall($a, $b)
- {
- if (!$a->getDeps() && !$b->getDeps()) {
- return 0; // neither package has dependencies, order is insignificant
- }
- if ($a->getDeps() && !$b->getDeps()) {
- return 1; // $a must be installed after $b because $a has dependencies
- }
- if (!$a->getDeps() && $b->getDeps()) {
- return -1; // $b must be installed after $a because $b has dependencies
- }
- // both packages have dependencies
- if ($this->_dependsOn($a, $b)) {
- return 1;
- }
- if ($this->_dependsOn($b, $a)) {
- return -1;
- }
- return 0;
- }
-
- /**
- * Download a file through HTTP. Considers suggested file name in
- * Content-disposition: header and can run a callback function for
- * different events. The callback will be called with two
- * parameters: the callback type, and parameters. The implemented
- * callback types are:
- *
- * 'setup' called at the very beginning, parameter is a UI object
- * that should be used for all output
- * 'message' the parameter is a string with an informational message
- * 'saveas' may be used to save with a different file name, the
- * parameter is the filename that is about to be used.
- * If a 'saveas' callback returns a non-empty string,
- * that file name will be used as the filename instead.
- * Note that $save_dir will not be affected by this, only
- * the basename of the file.
- * 'start' download is starting, parameter is number of bytes
- * that are expected, or -1 if unknown
- * 'bytesread' parameter is the number of bytes read so far
- * 'done' download is complete, parameter is the total number
- * of bytes read
- * 'connfailed' if the TCP/SSL connection fails, this callback is called
- * with array(host,port,errno,errmsg)
- * 'writefailed' if writing to disk fails, this callback is called
- * with array(destfile,errmsg)
- *
- * If an HTTP proxy has been configured (http_proxy PEAR_Config
- * setting), the proxy will be used.
- *
- * @param string $url the URL to download
- * @param object $ui PEAR_Frontend_* instance
- * @param object $config PEAR_Config instance
- * @param string $save_dir directory to save file in
- * @param mixed $callback function/method to call for status
- * updates
- * @param false|string|array $lastmodified header values to check against for caching
- * use false to return the header values from this download
- * @param false|array $accept Accept headers to send
- * @param false|string $channel Channel to use for retrieving authentication
- * @return string|array Returns the full path of the downloaded file or a PEAR
- * error on failure. If the error is caused by
- * socket-related errors, the error object will
- * have the fsockopen error code available through
- * getCode(). If caching is requested, then return the header
- * values.
- *
- * @access public
- */
- function downloadHttp($url, &$ui, $save_dir = '.', $callback = null, $lastmodified = null,
- $accept = false, $channel = false)
- {
- static $redirect = 0;
- // always reset , so we are clean case of error
- $wasredirect = $redirect;
- $redirect = 0;
- if ($callback) {
- call_user_func($callback, 'setup', array(&$ui));
- }
-
- $info = parse_url($url);
- if (!isset($info['scheme']) || !in_array($info['scheme'], array('http', 'https'))) {
- return PEAR::raiseError('Cannot download non-http URL "' . $url . '"');
- }
-
- if (!isset($info['host'])) {
- return PEAR::raiseError('Cannot download from non-URL "' . $url . '"');
- }
-
- $host = isset($info['host']) ? $info['host'] : null;
- $port = isset($info['port']) ? $info['port'] : null;
- $path = isset($info['path']) ? $info['path'] : null;
-
- if (isset($this)) {
- $config = &$this->config;
- } else {
- $config = &PEAR_Config::singleton();
- }
-
- $proxy_host = $proxy_port = $proxy_user = $proxy_pass = '';
- if ($config->get('http_proxy') &&
- $proxy = parse_url($config->get('http_proxy'))) {
- $proxy_host = isset($proxy['host']) ? $proxy['host'] : null;
- if (isset($proxy['scheme']) && $proxy['scheme'] == 'https') {
- $proxy_host = 'ssl://' . $proxy_host;
- }
- $proxy_port = isset($proxy['port']) ? $proxy['port'] : 8080;
- $proxy_user = isset($proxy['user']) ? urldecode($proxy['user']) : null;
- $proxy_pass = isset($proxy['pass']) ? urldecode($proxy['pass']) : null;
-
- if ($callback) {
- call_user_func($callback, 'message', "Using HTTP proxy $host:$port");
- }
- }
-
- if (empty($port)) {
- $port = (isset($info['scheme']) && $info['scheme'] == 'https') ? 443 : 80;
- }
-
- $scheme = (isset($info['scheme']) && $info['scheme'] == 'https') ? 'https' : 'http';
-
- if ($proxy_host != '') {
- $fp = @fsockopen($proxy_host, $proxy_port, $errno, $errstr);
- if (!$fp) {
- if ($callback) {
- call_user_func($callback, 'connfailed', array($proxy_host, $proxy_port,
- $errno, $errstr));
- }
- return PEAR::raiseError("Connection to `$proxy_host:$proxy_port' failed: $errstr", $errno);
- }
-
- if ($lastmodified === false || $lastmodified) {
- $request = "GET $url HTTP/1.1\r\n";
- $request .= "Host: $host\r\n";
- } else {
- $request = "GET $url HTTP/1.0\r\n";
- $request .= "Host: $host\r\n";
- }
- } else {
- $network_host = $host;
- if (isset($info['scheme']) && $info['scheme'] == 'https') {
- $network_host = 'ssl://' . $host;
- }
-
- $fp = @fsockopen($network_host, $port, $errno, $errstr);
- if (!$fp) {
- if ($callback) {
- call_user_func($callback, 'connfailed', array($host, $port,
- $errno, $errstr));
- }
- return PEAR::raiseError("Connection to `$host:$port' failed: $errstr", $errno);
- }
-
- if ($lastmodified === false || $lastmodified) {
- $request = "GET $path HTTP/1.1\r\n";
- $request .= "Host: $host\r\n";
- } else {
- $request = "GET $path HTTP/1.0\r\n";
- $request .= "Host: $host\r\n";
- }
- }
-
- $ifmodifiedsince = '';
- if (is_array($lastmodified)) {
- if (isset($lastmodified['Last-Modified'])) {
- $ifmodifiedsince = 'If-Modified-Since: ' . $lastmodified['Last-Modified'] . "\r\n";
- }
-
- if (isset($lastmodified['ETag'])) {
- $ifmodifiedsince .= "If-None-Match: $lastmodified[ETag]\r\n";
- }
- } else {
- $ifmodifiedsince = ($lastmodified ? "If-Modified-Since: $lastmodified\r\n" : '');
- }
-
- $request .= $ifmodifiedsince .
- "User-Agent: PEAR/1.9.4/PHP/" . PHP_VERSION . "\r\n";
-
- if (isset($this)) { // only pass in authentication for non-static calls
- $username = $config->get('username', null, $channel);
- $password = $config->get('password', null, $channel);
- if ($username && $password) {
- $tmp = base64_encode("$username:$password");
- $request .= "Authorization: Basic $tmp\r\n";
- }
- }
-
- if ($proxy_host != '' && $proxy_user != '') {
- $request .= 'Proxy-Authorization: Basic ' .
- base64_encode($proxy_user . ':' . $proxy_pass) . "\r\n";
- }
-
- if ($accept) {
- $request .= 'Accept: ' . implode(', ', $accept) . "\r\n";
- }
-
- $request .= "Connection: close\r\n";
- $request .= "\r\n";
- fwrite($fp, $request);
- $headers = array();
- $reply = 0;
- while (trim($line = fgets($fp, 1024))) {
- if (preg_match('/^([^:]+):\s+(.*)\s*\\z/', $line, $matches)) {
- $headers[strtolower($matches[1])] = trim($matches[2]);
- } elseif (preg_match('|^HTTP/1.[01] ([0-9]{3}) |', $line, $matches)) {
- $reply = (int)$matches[1];
- if ($reply == 304 && ($lastmodified || ($lastmodified === false))) {
- return false;
- }
-
- if (!in_array($reply, array(200, 301, 302, 303, 305, 307))) {
- return PEAR::raiseError("File $scheme://$host:$port$path not valid (received: $line)");
- }
- }
- }
-
- if ($reply != 200) {
- if (!isset($headers['location'])) {
- return PEAR::raiseError("File $scheme://$host:$port$path not valid (redirected but no location)");
- }
-
- if ($wasredirect > 4) {
- return PEAR::raiseError("File $scheme://$host:$port$path not valid (redirection looped more than 5 times)");
- }
-
- $redirect = $wasredirect + 1;
- return $this->downloadHttp($headers['location'],
- $ui, $save_dir, $callback, $lastmodified, $accept);
- }
-
- if (isset($headers['content-disposition']) &&
- preg_match('/\sfilename=\"([^;]*\S)\"\s*(;|\\z)/', $headers['content-disposition'], $matches)) {
- $save_as = basename($matches[1]);
- } else {
- $save_as = basename($url);
- }
-
- if ($callback) {
- $tmp = call_user_func($callback, 'saveas', $save_as);
- if ($tmp) {
- $save_as = $tmp;
- }
- }
-
- $dest_file = $save_dir . DIRECTORY_SEPARATOR . $save_as;
- if (is_link($dest_file)) {
- return PEAR::raiseError('SECURITY ERROR: Will not write to ' . $dest_file . ' as it is symlinked to ' . readlink($dest_file) . ' - Possible symlink attack');
- }
-
- if (!$wp = @fopen($dest_file, 'wb')) {
- fclose($fp);
- if ($callback) {
- call_user_func($callback, 'writefailed', array($dest_file, $php_errormsg));
- }
- return PEAR::raiseError("could not open $dest_file for writing");
- }
-
- $length = isset($headers['content-length']) ? $headers['content-length'] : -1;
-
- $bytes = 0;
- if ($callback) {
- call_user_func($callback, 'start', array(basename($dest_file), $length));
- }
-
- while ($data = fread($fp, 1024)) {
- $bytes += strlen($data);
- if ($callback) {
- call_user_func($callback, 'bytesread', $bytes);
- }
- if (!@fwrite($wp, $data)) {
- fclose($fp);
- if ($callback) {
- call_user_func($callback, 'writefailed', array($dest_file, $php_errormsg));
- }
- return PEAR::raiseError("$dest_file: write failed ($php_errormsg)");
- }
- }
-
- fclose($fp);
- fclose($wp);
- if ($callback) {
- call_user_func($callback, 'done', $bytes);
- }
-
- if ($lastmodified === false || $lastmodified) {
- if (isset($headers['etag'])) {
- $lastmodified = array('ETag' => $headers['etag']);
- }
-
- if (isset($headers['last-modified'])) {
- if (is_array($lastmodified)) {
- $lastmodified['Last-Modified'] = $headers['last-modified'];
- } else {
- $lastmodified = $headers['last-modified'];
- }
- }
- return array($dest_file, $lastmodified, $headers);
- }
- return $dest_file;
- }
-} \ No newline at end of file
diff --git a/3rdparty/PEAR/Downloader/Package.php b/3rdparty/PEAR/Downloader/Package.php
deleted file mode 100644
index 987c9656751..00000000000
--- a/3rdparty/PEAR/Downloader/Package.php
+++ /dev/null
@@ -1,1988 +0,0 @@
-<?php
-/**
- * PEAR_Downloader_Package
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Package.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a1
- */
-
-/**
- * Error code when parameter initialization fails because no releases
- * exist within preferred_state, but releases do exist
- */
-define('PEAR_DOWNLOADER_PACKAGE_STATE', -1003);
-/**
- * Error code when parameter initialization fails because no releases
- * exist that will work with the existing PHP version
- */
-define('PEAR_DOWNLOADER_PACKAGE_PHPVERSION', -1004);
-
-/**
- * Coordinates download parameters and manages their dependencies
- * prior to downloading them.
- *
- * Input can come from three sources:
- *
- * - local files (archives or package.xml)
- * - remote files (downloadable urls)
- * - abstract package names
- *
- * The first two elements are handled cleanly by PEAR_PackageFile, but the third requires
- * accessing pearweb's xml-rpc interface to determine necessary dependencies, and the
- * format returned of dependencies is slightly different from that used in package.xml.
- *
- * This class hides the differences between these elements, and makes automatic
- * dependency resolution a piece of cake. It also manages conflicts when
- * two classes depend on incompatible dependencies, or differing versions of the same
- * package dependency. In addition, download will not be attempted if the php version is
- * not supported, PEAR installer version is not supported, or non-PECL extensions are not
- * installed.
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a1
- */
-class PEAR_Downloader_Package
-{
- /**
- * @var PEAR_Downloader
- */
- var $_downloader;
- /**
- * @var PEAR_Config
- */
- var $_config;
- /**
- * @var PEAR_Registry
- */
- var $_registry;
- /**
- * Used to implement packagingroot properly
- * @var PEAR_Registry
- */
- var $_installRegistry;
- /**
- * @var PEAR_PackageFile_v1|PEAR_PackageFile|v2
- */
- var $_packagefile;
- /**
- * @var array
- */
- var $_parsedname;
- /**
- * @var array
- */
- var $_downloadURL;
- /**
- * @var array
- */
- var $_downloadDeps = array();
- /**
- * @var boolean
- */
- var $_valid = false;
- /**
- * @var boolean
- */
- var $_analyzed = false;
- /**
- * if this or a parent package was invoked with Package-state, this is set to the
- * state variable.
- *
- * This allows temporary reassignment of preferred_state for a parent package and all of
- * its dependencies.
- * @var string|false
- */
- var $_explicitState = false;
- /**
- * If this package is invoked with Package#group, this variable will be true
- */
- var $_explicitGroup = false;
- /**
- * Package type local|url
- * @var string
- */
- var $_type;
- /**
- * Contents of package.xml, if downloaded from a remote channel
- * @var string|false
- * @access private
- */
- var $_rawpackagefile;
- /**
- * @var boolean
- * @access private
- */
- var $_validated = false;
-
- /**
- * @param PEAR_Downloader
- */
- function PEAR_Downloader_Package(&$downloader)
- {
- $this->_downloader = &$downloader;
- $this->_config = &$this->_downloader->config;
- $this->_registry = &$this->_config->getRegistry();
- $options = $downloader->getOptions();
- if (isset($options['packagingroot'])) {
- $this->_config->setInstallRoot($options['packagingroot']);
- $this->_installRegistry = &$this->_config->getRegistry();
- $this->_config->setInstallRoot(false);
- } else {
- $this->_installRegistry = &$this->_registry;
- }
- $this->_valid = $this->_analyzed = false;
- }
-
- /**
- * Parse the input and determine whether this is a local file, a remote uri, or an
- * abstract package name.
- *
- * This is the heart of the PEAR_Downloader_Package(), and is used in
- * {@link PEAR_Downloader::download()}
- * @param string
- * @return bool|PEAR_Error
- */
- function initialize($param)
- {
- $origErr = $this->_fromFile($param);
- if ($this->_valid) {
- return true;
- }
-
- $options = $this->_downloader->getOptions();
- if (isset($options['offline'])) {
- if (PEAR::isError($origErr) && !isset($options['soft'])) {
- foreach ($origErr->getUserInfo() as $userInfo) {
- if (isset($userInfo['message'])) {
- $this->_downloader->log(0, $userInfo['message']);
- }
- }
-
- $this->_downloader->log(0, $origErr->getMessage());
- }
-
- return PEAR::raiseError('Cannot download non-local package "' . $param . '"');
- }
-
- $err = $this->_fromUrl($param);
- if (PEAR::isError($err) || !$this->_valid) {
- if ($this->_type == 'url') {
- if (PEAR::isError($err) && !isset($options['soft'])) {
- $this->_downloader->log(0, $err->getMessage());
- }
-
- return PEAR::raiseError("Invalid or missing remote package file");
- }
-
- $err = $this->_fromString($param);
- if (PEAR::isError($err) || !$this->_valid) {
- if (PEAR::isError($err) && $err->getCode() == PEAR_DOWNLOADER_PACKAGE_STATE) {
- return false; // instruct the downloader to silently skip
- }
-
- if (isset($this->_type) && $this->_type == 'local' && PEAR::isError($origErr)) {
- if (is_array($origErr->getUserInfo())) {
- foreach ($origErr->getUserInfo() as $err) {
- if (is_array($err)) {
- $err = $err['message'];
- }
-
- if (!isset($options['soft'])) {
- $this->_downloader->log(0, $err);
- }
- }
- }
-
- if (!isset($options['soft'])) {
- $this->_downloader->log(0, $origErr->getMessage());
- }
-
- if (is_array($param)) {
- $param = $this->_registry->parsedPackageNameToString($param, true);
- }
-
- if (!isset($options['soft'])) {
- $this->_downloader->log(2, "Cannot initialize '$param', invalid or missing package file");
- }
-
- // Passing no message back - already logged above
- return PEAR::raiseError();
- }
-
- if (PEAR::isError($err) && !isset($options['soft'])) {
- $this->_downloader->log(0, $err->getMessage());
- }
-
- if (is_array($param)) {
- $param = $this->_registry->parsedPackageNameToString($param, true);
- }
-
- if (!isset($options['soft'])) {
- $this->_downloader->log(2, "Cannot initialize '$param', invalid or missing package file");
- }
-
- // Passing no message back - already logged above
- return PEAR::raiseError();
- }
- }
-
- return true;
- }
-
- /**
- * Retrieve any non-local packages
- * @return PEAR_PackageFile_v1|PEAR_PackageFile_v2|PEAR_Error
- */
- function &download()
- {
- if (isset($this->_packagefile)) {
- return $this->_packagefile;
- }
-
- if (isset($this->_downloadURL['url'])) {
- $this->_isvalid = false;
- $info = $this->getParsedPackage();
- foreach ($info as $i => $p) {
- $info[$i] = strtolower($p);
- }
-
- $err = $this->_fromUrl($this->_downloadURL['url'],
- $this->_registry->parsedPackageNameToString($this->_parsedname, true));
- $newinfo = $this->getParsedPackage();
- foreach ($newinfo as $i => $p) {
- $newinfo[$i] = strtolower($p);
- }
-
- if ($info != $newinfo) {
- do {
- if ($info['channel'] == 'pecl.php.net' && $newinfo['channel'] == 'pear.php.net') {
- $info['channel'] = 'pear.php.net';
- if ($info == $newinfo) {
- // skip the channel check if a pecl package says it's a PEAR package
- break;
- }
- }
- if ($info['channel'] == 'pear.php.net' && $newinfo['channel'] == 'pecl.php.net') {
- $info['channel'] = 'pecl.php.net';
- if ($info == $newinfo) {
- // skip the channel check if a pecl package says it's a PEAR package
- break;
- }
- }
-
- return PEAR::raiseError('CRITICAL ERROR: We are ' .
- $this->_registry->parsedPackageNameToString($info) . ', but the file ' .
- 'downloaded claims to be ' .
- $this->_registry->parsedPackageNameToString($this->getParsedPackage()));
- } while (false);
- }
-
- if (PEAR::isError($err) || !$this->_valid) {
- return $err;
- }
- }
-
- $this->_type = 'local';
- return $this->_packagefile;
- }
-
- function &getPackageFile()
- {
- return $this->_packagefile;
- }
-
- function &getDownloader()
- {
- return $this->_downloader;
- }
-
- function getType()
- {
- return $this->_type;
- }
-
- /**
- * Like {@link initialize()}, but operates on a dependency
- */
- function fromDepURL($dep)
- {
- $this->_downloadURL = $dep;
- if (isset($dep['uri'])) {
- $options = $this->_downloader->getOptions();
- if (!extension_loaded("zlib") || isset($options['nocompress'])) {
- $ext = '.tar';
- } else {
- $ext = '.tgz';
- }
-
- PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
- $err = $this->_fromUrl($dep['uri'] . $ext);
- PEAR::popErrorHandling();
- if (PEAR::isError($err)) {
- if (!isset($options['soft'])) {
- $this->_downloader->log(0, $err->getMessage());
- }
-
- return PEAR::raiseError('Invalid uri dependency "' . $dep['uri'] . $ext . '", ' .
- 'cannot download');
- }
- } else {
- $this->_parsedname =
- array(
- 'package' => $dep['info']->getPackage(),
- 'channel' => $dep['info']->getChannel(),
- 'version' => $dep['version']
- );
- if (!isset($dep['nodefault'])) {
- $this->_parsedname['group'] = 'default'; // download the default dependency group
- $this->_explicitGroup = false;
- }
-
- $this->_rawpackagefile = $dep['raw'];
- }
- }
-
- function detectDependencies($params)
- {
- $options = $this->_downloader->getOptions();
- if (isset($options['downloadonly'])) {
- return;
- }
-
- if (isset($options['offline'])) {
- $this->_downloader->log(3, 'Skipping dependency download check, --offline specified');
- return;
- }
-
- $pname = $this->getParsedPackage();
- if (!$pname) {
- return;
- }
-
- $deps = $this->getDeps();
- if (!$deps) {
- return;
- }
-
- if (isset($deps['required'])) { // package.xml 2.0
- return $this->_detect2($deps, $pname, $options, $params);
- }
-
- return $this->_detect1($deps, $pname, $options, $params);
- }
-
- function setValidated()
- {
- $this->_validated = true;
- }
-
- function alreadyValidated()
- {
- return $this->_validated;
- }
-
- /**
- * Remove packages to be downloaded that are already installed
- * @param array of PEAR_Downloader_Package objects
- * @static
- */
- function removeInstalled(&$params)
- {
- if (!isset($params[0])) {
- return;
- }
-
- $options = $params[0]->_downloader->getOptions();
- if (!isset($options['downloadonly'])) {
- foreach ($params as $i => $param) {
- $package = $param->getPackage();
- $channel = $param->getChannel();
- // remove self if already installed with this version
- // this does not need any pecl magic - we only remove exact matches
- if ($param->_installRegistry->packageExists($package, $channel)) {
- $packageVersion = $param->_installRegistry->packageInfo($package, 'version', $channel);
- if (version_compare($packageVersion, $param->getVersion(), '==')) {
- if (!isset($options['force'])) {
- $info = $param->getParsedPackage();
- unset($info['version']);
- unset($info['state']);
- if (!isset($options['soft'])) {
- $param->_downloader->log(1, 'Skipping package "' .
- $param->getShortName() .
- '", already installed as version ' . $packageVersion);
- }
- $params[$i] = false;
- }
- } elseif (!isset($options['force']) && !isset($options['upgrade']) &&
- !isset($options['soft'])) {
- $info = $param->getParsedPackage();
- $param->_downloader->log(1, 'Skipping package "' .
- $param->getShortName() .
- '", already installed as version ' . $packageVersion);
- $params[$i] = false;
- }
- }
- }
- }
-
- PEAR_Downloader_Package::removeDuplicates($params);
- }
-
- function _detect2($deps, $pname, $options, $params)
- {
- $this->_downloadDeps = array();
- $groupnotfound = false;
- foreach (array('package', 'subpackage') as $packagetype) {
- // get required dependency group
- if (isset($deps['required'][$packagetype])) {
- if (isset($deps['required'][$packagetype][0])) {
- foreach ($deps['required'][$packagetype] as $dep) {
- if (isset($dep['conflicts'])) {
- // skip any package that this package conflicts with
- continue;
- }
- $ret = $this->_detect2Dep($dep, $pname, 'required', $params);
- if (is_array($ret)) {
- $this->_downloadDeps[] = $ret;
- } elseif (PEAR::isError($ret) && !isset($options['soft'])) {
- $this->_downloader->log(0, $ret->getMessage());
- }
- }
- } else {
- $dep = $deps['required'][$packagetype];
- if (!isset($dep['conflicts'])) {
- // skip any package that this package conflicts with
- $ret = $this->_detect2Dep($dep, $pname, 'required', $params);
- if (is_array($ret)) {
- $this->_downloadDeps[] = $ret;
- } elseif (PEAR::isError($ret) && !isset($options['soft'])) {
- $this->_downloader->log(0, $ret->getMessage());
- }
- }
- }
- }
-
- // get optional dependency group, if any
- if (isset($deps['optional'][$packagetype])) {
- $skipnames = array();
- if (!isset($deps['optional'][$packagetype][0])) {
- $deps['optional'][$packagetype] = array($deps['optional'][$packagetype]);
- }
-
- foreach ($deps['optional'][$packagetype] as $dep) {
- $skip = false;
- if (!isset($options['alldeps'])) {
- $dep['package'] = $dep['name'];
- if (!isset($options['soft'])) {
- $this->_downloader->log(3, 'Notice: package "' .
- $this->_registry->parsedPackageNameToString($this->getParsedPackage(),
- true) . '" optional dependency "' .
- $this->_registry->parsedPackageNameToString(array('package' =>
- $dep['name'], 'channel' => 'pear.php.net'), true) .
- '" will not be automatically downloaded');
- }
- $skipnames[] = $this->_registry->parsedPackageNameToString($dep, true);
- $skip = true;
- unset($dep['package']);
- }
-
- $ret = $this->_detect2Dep($dep, $pname, 'optional', $params);
- if (PEAR::isError($ret) && !isset($options['soft'])) {
- $this->_downloader->log(0, $ret->getMessage());
- }
-
- if (!$ret) {
- $dep['package'] = $dep['name'];
- $skip = count($skipnames) ?
- $skipnames[count($skipnames) - 1] : '';
- if ($skip ==
- $this->_registry->parsedPackageNameToString($dep, true)) {
- array_pop($skipnames);
- }
- }
-
- if (!$skip && is_array($ret)) {
- $this->_downloadDeps[] = $ret;
- }
- }
-
- if (count($skipnames)) {
- if (!isset($options['soft'])) {
- $this->_downloader->log(1, 'Did not download optional dependencies: ' .
- implode(', ', $skipnames) .
- ', use --alldeps to download automatically');
- }
- }
- }
-
- // get requested dependency group, if any
- $groupname = $this->getGroup();
- $explicit = $this->_explicitGroup;
- if (!$groupname) {
- if (!$this->canDefault()) {
- continue;
- }
-
- $groupname = 'default'; // try the default dependency group
- }
-
- if ($groupnotfound) {
- continue;
- }
-
- if (isset($deps['group'])) {
- if (isset($deps['group']['attribs'])) {
- if (strtolower($deps['group']['attribs']['name']) == strtolower($groupname)) {
- $group = $deps['group'];
- } elseif ($explicit) {
- if (!isset($options['soft'])) {
- $this->_downloader->log(0, 'Warning: package "' .
- $this->_registry->parsedPackageNameToString($pname, true) .
- '" has no dependency ' . 'group named "' . $groupname . '"');
- }
-
- $groupnotfound = true;
- continue;
- }
- } else {
- $found = false;
- foreach ($deps['group'] as $group) {
- if (strtolower($group['attribs']['name']) == strtolower($groupname)) {
- $found = true;
- break;
- }
- }
-
- if (!$found) {
- if ($explicit) {
- if (!isset($options['soft'])) {
- $this->_downloader->log(0, 'Warning: package "' .
- $this->_registry->parsedPackageNameToString($pname, true) .
- '" has no dependency ' . 'group named "' . $groupname . '"');
- }
- }
-
- $groupnotfound = true;
- continue;
- }
- }
- }
-
- if (isset($group) && isset($group[$packagetype])) {
- if (isset($group[$packagetype][0])) {
- foreach ($group[$packagetype] as $dep) {
- $ret = $this->_detect2Dep($dep, $pname, 'dependency group "' .
- $group['attribs']['name'] . '"', $params);
- if (is_array($ret)) {
- $this->_downloadDeps[] = $ret;
- } elseif (PEAR::isError($ret) && !isset($options['soft'])) {
- $this->_downloader->log(0, $ret->getMessage());
- }
- }
- } else {
- $ret = $this->_detect2Dep($group[$packagetype], $pname,
- 'dependency group "' .
- $group['attribs']['name'] . '"', $params);
- if (is_array($ret)) {
- $this->_downloadDeps[] = $ret;
- } elseif (PEAR::isError($ret) && !isset($options['soft'])) {
- $this->_downloader->log(0, $ret->getMessage());
- }
- }
- }
- }
- }
-
- function _detect2Dep($dep, $pname, $group, $params)
- {
- if (isset($dep['conflicts'])) {
- return true;
- }
-
- $options = $this->_downloader->getOptions();
- if (isset($dep['uri'])) {
- return array('uri' => $dep['uri'], 'dep' => $dep);;
- }
-
- $testdep = $dep;
- $testdep['package'] = $dep['name'];
- if (PEAR_Downloader_Package::willDownload($testdep, $params)) {
- $dep['package'] = $dep['name'];
- if (!isset($options['soft'])) {
- $this->_downloader->log(2, $this->getShortName() . ': Skipping ' . $group .
- ' dependency "' .
- $this->_registry->parsedPackageNameToString($dep, true) .
- '", will be installed');
- }
- return false;
- }
-
- $options = $this->_downloader->getOptions();
- PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
- if ($this->_explicitState) {
- $pname['state'] = $this->_explicitState;
- }
-
- $url = $this->_downloader->_getDepPackageDownloadUrl($dep, $pname);
- if (PEAR::isError($url)) {
- PEAR::popErrorHandling();
- return $url;
- }
-
- $dep['package'] = $dep['name'];
- $ret = $this->_analyzeDownloadURL($url, 'dependency', $dep, $params, $group == 'optional' &&
- !isset($options['alldeps']), true);
- PEAR::popErrorHandling();
- if (PEAR::isError($ret)) {
- if (!isset($options['soft'])) {
- $this->_downloader->log(0, $ret->getMessage());
- }
-
- return false;
- }
-
- // check to see if a dep is already installed and is the same or newer
- if (!isset($dep['min']) && !isset($dep['max']) && !isset($dep['recommended'])) {
- $oper = 'has';
- } else {
- $oper = 'gt';
- }
-
- // do not try to move this before getDepPackageDownloadURL
- // we can't determine whether upgrade is necessary until we know what
- // version would be downloaded
- if (!isset($options['force']) && $this->isInstalled($ret, $oper)) {
- $version = $this->_installRegistry->packageInfo($dep['name'], 'version', $dep['channel']);
- $dep['package'] = $dep['name'];
- if (!isset($options['soft'])) {
- $this->_downloader->log(3, $this->getShortName() . ': Skipping ' . $group .
- ' dependency "' .
- $this->_registry->parsedPackageNameToString($dep, true) .
- '" version ' . $url['version'] . ', already installed as version ' .
- $version);
- }
-
- return false;
- }
-
- if (isset($dep['nodefault'])) {
- $ret['nodefault'] = true;
- }
-
- return $ret;
- }
-
- function _detect1($deps, $pname, $options, $params)
- {
- $this->_downloadDeps = array();
- $skipnames = array();
- foreach ($deps as $dep) {
- $nodownload = false;
- if (isset ($dep['type']) && $dep['type'] === 'pkg') {
- $dep['channel'] = 'pear.php.net';
- $dep['package'] = $dep['name'];
- switch ($dep['rel']) {
- case 'not' :
- continue 2;
- case 'ge' :
- case 'eq' :
- case 'gt' :
- case 'has' :
- $group = (!isset($dep['optional']) || $dep['optional'] == 'no') ?
- 'required' :
- 'optional';
- if (PEAR_Downloader_Package::willDownload($dep, $params)) {
- $this->_downloader->log(2, $this->getShortName() . ': Skipping ' . $group
- . ' dependency "' .
- $this->_registry->parsedPackageNameToString($dep, true) .
- '", will be installed');
- continue 2;
- }
- $fakedp = new PEAR_PackageFile_v1;
- $fakedp->setPackage($dep['name']);
- // skip internet check if we are not upgrading (bug #5810)
- if (!isset($options['upgrade']) && $this->isInstalled(
- $fakedp, $dep['rel'])) {
- $this->_downloader->log(2, $this->getShortName() . ': Skipping ' . $group
- . ' dependency "' .
- $this->_registry->parsedPackageNameToString($dep, true) .
- '", is already installed');
- continue 2;
- }
- }
-
- PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
- if ($this->_explicitState) {
- $pname['state'] = $this->_explicitState;
- }
-
- $url = $this->_downloader->_getDepPackageDownloadUrl($dep, $pname);
- $chan = 'pear.php.net';
- if (PEAR::isError($url)) {
- // check to see if this is a pecl package that has jumped
- // from pear.php.net to pecl.php.net channel
- if (!class_exists('PEAR_Dependency2')) {
- require_once 'PEAR/Dependency2.php';
- }
-
- $newdep = PEAR_Dependency2::normalizeDep($dep);
- $newdep = $newdep[0];
- $newdep['channel'] = 'pecl.php.net';
- $chan = 'pecl.php.net';
- $url = $this->_downloader->_getDepPackageDownloadUrl($newdep, $pname);
- $obj = &$this->_installRegistry->getPackage($dep['name']);
- if (PEAR::isError($url)) {
- PEAR::popErrorHandling();
- if ($obj !== null && $this->isInstalled($obj, $dep['rel'])) {
- $group = (!isset($dep['optional']) || $dep['optional'] == 'no') ?
- 'required' :
- 'optional';
- $dep['package'] = $dep['name'];
- if (!isset($options['soft'])) {
- $this->_downloader->log(3, $this->getShortName() .
- ': Skipping ' . $group . ' dependency "' .
- $this->_registry->parsedPackageNameToString($dep, true) .
- '", already installed as version ' . $obj->getVersion());
- }
- $skip = count($skipnames) ?
- $skipnames[count($skipnames) - 1] : '';
- if ($skip ==
- $this->_registry->parsedPackageNameToString($dep, true)) {
- array_pop($skipnames);
- }
- continue;
- } else {
- if (isset($dep['optional']) && $dep['optional'] == 'yes') {
- $this->_downloader->log(2, $this->getShortName() .
- ': Skipping optional dependency "' .
- $this->_registry->parsedPackageNameToString($dep, true) .
- '", no releases exist');
- continue;
- } else {
- return $url;
- }
- }
- }
- }
-
- PEAR::popErrorHandling();
- if (!isset($options['alldeps'])) {
- if (isset($dep['optional']) && $dep['optional'] == 'yes') {
- if (!isset($options['soft'])) {
- $this->_downloader->log(3, 'Notice: package "' .
- $this->getShortName() .
- '" optional dependency "' .
- $this->_registry->parsedPackageNameToString(
- array('channel' => $chan, 'package' =>
- $dep['name']), true) .
- '" will not be automatically downloaded');
- }
- $skipnames[] = $this->_registry->parsedPackageNameToString(
- array('channel' => $chan, 'package' =>
- $dep['name']), true);
- $nodownload = true;
- }
- }
-
- if (!isset($options['alldeps']) && !isset($options['onlyreqdeps'])) {
- if (!isset($dep['optional']) || $dep['optional'] == 'no') {
- if (!isset($options['soft'])) {
- $this->_downloader->log(3, 'Notice: package "' .
- $this->getShortName() .
- '" required dependency "' .
- $this->_registry->parsedPackageNameToString(
- array('channel' => $chan, 'package' =>
- $dep['name']), true) .
- '" will not be automatically downloaded');
- }
- $skipnames[] = $this->_registry->parsedPackageNameToString(
- array('channel' => $chan, 'package' =>
- $dep['name']), true);
- $nodownload = true;
- }
- }
-
- // check to see if a dep is already installed
- // do not try to move this before getDepPackageDownloadURL
- // we can't determine whether upgrade is necessary until we know what
- // version would be downloaded
- if (!isset($options['force']) && $this->isInstalled(
- $url, $dep['rel'])) {
- $group = (!isset($dep['optional']) || $dep['optional'] == 'no') ?
- 'required' :
- 'optional';
- $dep['package'] = $dep['name'];
- if (isset($newdep)) {
- $version = $this->_installRegistry->packageInfo($newdep['name'], 'version', $newdep['channel']);
- } else {
- $version = $this->_installRegistry->packageInfo($dep['name'], 'version');
- }
-
- $dep['version'] = $url['version'];
- if (!isset($options['soft'])) {
- $this->_downloader->log(3, $this->getShortName() . ': Skipping ' . $group .
- ' dependency "' .
- $this->_registry->parsedPackageNameToString($dep, true) .
- '", already installed as version ' . $version);
- }
-
- $skip = count($skipnames) ?
- $skipnames[count($skipnames) - 1] : '';
- if ($skip ==
- $this->_registry->parsedPackageNameToString($dep, true)) {
- array_pop($skipnames);
- }
-
- continue;
- }
-
- if ($nodownload) {
- continue;
- }
-
- PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
- if (isset($newdep)) {
- $dep = $newdep;
- }
-
- $dep['package'] = $dep['name'];
- $ret = $this->_analyzeDownloadURL($url, 'dependency', $dep, $params,
- isset($dep['optional']) && $dep['optional'] == 'yes' &&
- !isset($options['alldeps']), true);
- PEAR::popErrorHandling();
- if (PEAR::isError($ret)) {
- if (!isset($options['soft'])) {
- $this->_downloader->log(0, $ret->getMessage());
- }
- continue;
- }
-
- $this->_downloadDeps[] = $ret;
- }
- }
-
- if (count($skipnames)) {
- if (!isset($options['soft'])) {
- $this->_downloader->log(1, 'Did not download dependencies: ' .
- implode(', ', $skipnames) .
- ', use --alldeps or --onlyreqdeps to download automatically');
- }
- }
- }
-
- function setDownloadURL($pkg)
- {
- $this->_downloadURL = $pkg;
- }
-
- /**
- * Set the package.xml object for this downloaded package
- *
- * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2 $pkg
- */
- function setPackageFile(&$pkg)
- {
- $this->_packagefile = &$pkg;
- }
-
- function getShortName()
- {
- return $this->_registry->parsedPackageNameToString(array('channel' => $this->getChannel(),
- 'package' => $this->getPackage()), true);
- }
-
- function getParsedPackage()
- {
- if (isset($this->_packagefile) || isset($this->_parsedname)) {
- return array('channel' => $this->getChannel(),
- 'package' => $this->getPackage(),
- 'version' => $this->getVersion());
- }
-
- return false;
- }
-
- function getDownloadURL()
- {
- return $this->_downloadURL;
- }
-
- function canDefault()
- {
- if (isset($this->_downloadURL) && isset($this->_downloadURL['nodefault'])) {
- return false;
- }
-
- return true;
- }
-
- function getPackage()
- {
- if (isset($this->_packagefile)) {
- return $this->_packagefile->getPackage();
- } elseif (isset($this->_downloadURL['info'])) {
- return $this->_downloadURL['info']->getPackage();
- }
-
- return false;
- }
-
- /**
- * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2
- */
- function isSubpackage(&$pf)
- {
- if (isset($this->_packagefile)) {
- return $this->_packagefile->isSubpackage($pf);
- } elseif (isset($this->_downloadURL['info'])) {
- return $this->_downloadURL['info']->isSubpackage($pf);
- }
-
- return false;
- }
-
- function getPackageType()
- {
- if (isset($this->_packagefile)) {
- return $this->_packagefile->getPackageType();
- } elseif (isset($this->_downloadURL['info'])) {
- return $this->_downloadURL['info']->getPackageType();
- }
-
- return false;
- }
-
- function isBundle()
- {
- if (isset($this->_packagefile)) {
- return $this->_packagefile->getPackageType() == 'bundle';
- }
-
- return false;
- }
-
- function getPackageXmlVersion()
- {
- if (isset($this->_packagefile)) {
- return $this->_packagefile->getPackagexmlVersion();
- } elseif (isset($this->_downloadURL['info'])) {
- return $this->_downloadURL['info']->getPackagexmlVersion();
- }
-
- return '1.0';
- }
-
- function getChannel()
- {
- if (isset($this->_packagefile)) {
- return $this->_packagefile->getChannel();
- } elseif (isset($this->_downloadURL['info'])) {
- return $this->_downloadURL['info']->getChannel();
- }
-
- return false;
- }
-
- function getURI()
- {
- if (isset($this->_packagefile)) {
- return $this->_packagefile->getURI();
- } elseif (isset($this->_downloadURL['info'])) {
- return $this->_downloadURL['info']->getURI();
- }
-
- return false;
- }
-
- function getVersion()
- {
- if (isset($this->_packagefile)) {
- return $this->_packagefile->getVersion();
- } elseif (isset($this->_downloadURL['version'])) {
- return $this->_downloadURL['version'];
- }
-
- return false;
- }
-
- function isCompatible($pf)
- {
- if (isset($this->_packagefile)) {
- return $this->_packagefile->isCompatible($pf);
- } elseif (isset($this->_downloadURL['info'])) {
- return $this->_downloadURL['info']->isCompatible($pf);
- }
-
- return true;
- }
-
- function setGroup($group)
- {
- $this->_parsedname['group'] = $group;
- }
-
- function getGroup()
- {
- if (isset($this->_parsedname['group'])) {
- return $this->_parsedname['group'];
- }
-
- return '';
- }
-
- function isExtension($name)
- {
- if (isset($this->_packagefile)) {
- return $this->_packagefile->isExtension($name);
- } elseif (isset($this->_downloadURL['info'])) {
- if ($this->_downloadURL['info']->getPackagexmlVersion() == '2.0') {
- return $this->_downloadURL['info']->getProvidesExtension() == $name;
- }
-
- return false;
- }
-
- return false;
- }
-
- function getDeps()
- {
- if (isset($this->_packagefile)) {
- $ver = $this->_packagefile->getPackagexmlVersion();
- if (version_compare($ver, '2.0', '>=')) {
- return $this->_packagefile->getDeps(true);
- }
-
- return $this->_packagefile->getDeps();
- } elseif (isset($this->_downloadURL['info'])) {
- $ver = $this->_downloadURL['info']->getPackagexmlVersion();
- if (version_compare($ver, '2.0', '>=')) {
- return $this->_downloadURL['info']->getDeps(true);
- }
-
- return $this->_downloadURL['info']->getDeps();
- }
-
- return array();
- }
-
- /**
- * @param array Parsed array from {@link PEAR_Registry::parsePackageName()} or a dependency
- * returned from getDepDownloadURL()
- */
- function isEqual($param)
- {
- if (is_object($param)) {
- $channel = $param->getChannel();
- $package = $param->getPackage();
- if ($param->getURI()) {
- $param = array(
- 'channel' => $param->getChannel(),
- 'package' => $param->getPackage(),
- 'version' => $param->getVersion(),
- 'uri' => $param->getURI(),
- );
- } else {
- $param = array(
- 'channel' => $param->getChannel(),
- 'package' => $param->getPackage(),
- 'version' => $param->getVersion(),
- );
- }
- } else {
- if (isset($param['uri'])) {
- if ($this->getChannel() != '__uri') {
- return false;
- }
- return $param['uri'] == $this->getURI();
- }
-
- $package = isset($param['package']) ? $param['package'] : $param['info']->getPackage();
- $channel = isset($param['channel']) ? $param['channel'] : $param['info']->getChannel();
- if (isset($param['rel'])) {
- if (!class_exists('PEAR_Dependency2')) {
- require_once 'PEAR/Dependency2.php';
- }
-
- $newdep = PEAR_Dependency2::normalizeDep($param);
- $newdep = $newdep[0];
- } elseif (isset($param['min'])) {
- $newdep = $param;
- }
- }
-
- if (isset($newdep)) {
- if (!isset($newdep['min'])) {
- $newdep['min'] = '0';
- }
-
- if (!isset($newdep['max'])) {
- $newdep['max'] = '100000000000000000000';
- }
-
- // use magic to support pecl packages suddenly jumping to the pecl channel
- // we need to support both dependency possibilities
- if ($channel == 'pear.php.net' && $this->getChannel() == 'pecl.php.net') {
- if ($package == $this->getPackage()) {
- $channel = 'pecl.php.net';
- }
- }
- if ($channel == 'pecl.php.net' && $this->getChannel() == 'pear.php.net') {
- if ($package == $this->getPackage()) {
- $channel = 'pear.php.net';
- }
- }
-
- return (strtolower($package) == strtolower($this->getPackage()) &&
- $channel == $this->getChannel() &&
- version_compare($newdep['min'], $this->getVersion(), '<=') &&
- version_compare($newdep['max'], $this->getVersion(), '>='));
- }
-
- // use magic to support pecl packages suddenly jumping to the pecl channel
- if ($channel == 'pecl.php.net' && $this->getChannel() == 'pear.php.net') {
- if (strtolower($package) == strtolower($this->getPackage())) {
- $channel = 'pear.php.net';
- }
- }
-
- if (isset($param['version'])) {
- return (strtolower($package) == strtolower($this->getPackage()) &&
- $channel == $this->getChannel() &&
- $param['version'] == $this->getVersion());
- }
-
- return strtolower($package) == strtolower($this->getPackage()) &&
- $channel == $this->getChannel();
- }
-
- function isInstalled($dep, $oper = '==')
- {
- if (!$dep) {
- return false;
- }
-
- if ($oper != 'ge' && $oper != 'gt' && $oper != 'has' && $oper != '==') {
- return false;
- }
-
- if (is_object($dep)) {
- $package = $dep->getPackage();
- $channel = $dep->getChannel();
- if ($dep->getURI()) {
- $dep = array(
- 'uri' => $dep->getURI(),
- 'version' => $dep->getVersion(),
- );
- } else {
- $dep = array(
- 'version' => $dep->getVersion(),
- );
- }
- } else {
- if (isset($dep['uri'])) {
- $channel = '__uri';
- $package = $dep['dep']['name'];
- } else {
- $channel = $dep['info']->getChannel();
- $package = $dep['info']->getPackage();
- }
- }
-
- $options = $this->_downloader->getOptions();
- $test = $this->_installRegistry->packageExists($package, $channel);
- if (!$test && $channel == 'pecl.php.net') {
- // do magic to allow upgrading from old pecl packages to new ones
- $test = $this->_installRegistry->packageExists($package, 'pear.php.net');
- $channel = 'pear.php.net';
- }
-
- if ($test) {
- if (isset($dep['uri'])) {
- if ($this->_installRegistry->packageInfo($package, 'uri', '__uri') == $dep['uri']) {
- return true;
- }
- }
-
- if (isset($options['upgrade'])) {
- $packageVersion = $this->_installRegistry->packageInfo($package, 'version', $channel);
- if (version_compare($packageVersion, $dep['version'], '>=')) {
- return true;
- }
-
- return false;
- }
-
- return true;
- }
-
- return false;
- }
-
- /**
- * Detect duplicate package names with differing versions
- *
- * If a user requests to install Date 1.4.6 and Date 1.4.7,
- * for instance, this is a logic error. This method
- * detects this situation.
- *
- * @param array $params array of PEAR_Downloader_Package objects
- * @param array $errorparams empty array
- * @return array array of stupid duplicated packages in PEAR_Downloader_Package obejcts
- */
- function detectStupidDuplicates($params, &$errorparams)
- {
- $existing = array();
- foreach ($params as $i => $param) {
- $package = $param->getPackage();
- $channel = $param->getChannel();
- $group = $param->getGroup();
- if (!isset($existing[$channel . '/' . $package])) {
- $existing[$channel . '/' . $package] = array();
- }
-
- if (!isset($existing[$channel . '/' . $package][$group])) {
- $existing[$channel . '/' . $package][$group] = array();
- }
-
- $existing[$channel . '/' . $package][$group][] = $i;
- }
-
- $indices = array();
- foreach ($existing as $package => $groups) {
- foreach ($groups as $group => $dupes) {
- if (count($dupes) > 1) {
- $indices = $indices + $dupes;
- }
- }
- }
-
- $indices = array_unique($indices);
- foreach ($indices as $index) {
- $errorparams[] = $params[$index];
- }
-
- return count($errorparams);
- }
-
- /**
- * @param array
- * @param bool ignore install groups - for final removal of dupe packages
- * @static
- */
- function removeDuplicates(&$params, $ignoreGroups = false)
- {
- $pnames = array();
- foreach ($params as $i => $param) {
- if (!$param) {
- continue;
- }
-
- if ($param->getPackage()) {
- $group = $ignoreGroups ? '' : $param->getGroup();
- $pnames[$i] = $param->getChannel() . '/' .
- $param->getPackage() . '-' . $param->getVersion() . '#' . $group;
- }
- }
-
- $pnames = array_unique($pnames);
- $unset = array_diff(array_keys($params), array_keys($pnames));
- $testp = array_flip($pnames);
- foreach ($params as $i => $param) {
- if (!$param) {
- $unset[] = $i;
- continue;
- }
-
- if (!is_a($param, 'PEAR_Downloader_Package')) {
- $unset[] = $i;
- continue;
- }
-
- $group = $ignoreGroups ? '' : $param->getGroup();
- if (!isset($testp[$param->getChannel() . '/' . $param->getPackage() . '-' .
- $param->getVersion() . '#' . $group])) {
- $unset[] = $i;
- }
- }
-
- foreach ($unset as $i) {
- unset($params[$i]);
- }
-
- $ret = array();
- foreach ($params as $i => $param) {
- $ret[] = &$params[$i];
- }
-
- $params = array();
- foreach ($ret as $i => $param) {
- $params[] = &$ret[$i];
- }
- }
-
- function explicitState()
- {
- return $this->_explicitState;
- }
-
- function setExplicitState($s)
- {
- $this->_explicitState = $s;
- }
-
- /**
- * @static
- */
- function mergeDependencies(&$params)
- {
- $bundles = $newparams = array();
- foreach ($params as $i => $param) {
- if (!$param->isBundle()) {
- continue;
- }
-
- $bundles[] = $i;
- $pf = &$param->getPackageFile();
- $newdeps = array();
- $contents = $pf->getBundledPackages();
- if (!is_array($contents)) {
- $contents = array($contents);
- }
-
- foreach ($contents as $file) {
- $filecontents = $pf->getFileContents($file);
- $dl = &$param->getDownloader();
- $options = $dl->getOptions();
- if (PEAR::isError($dir = $dl->getDownloadDir())) {
- return $dir;
- }
-
- $fp = @fopen($dir . DIRECTORY_SEPARATOR . $file, 'wb');
- if (!$fp) {
- continue;
- }
-
- // FIXME do symlink check
-
- fwrite($fp, $filecontents, strlen($filecontents));
- fclose($fp);
- if ($s = $params[$i]->explicitState()) {
- $obj->setExplicitState($s);
- }
-
- $obj = &new PEAR_Downloader_Package($params[$i]->getDownloader());
- PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
- if (PEAR::isError($dir = $dl->getDownloadDir())) {
- PEAR::popErrorHandling();
- return $dir;
- }
-
- $e = $obj->_fromFile($a = $dir . DIRECTORY_SEPARATOR . $file);
- PEAR::popErrorHandling();
- if (PEAR::isError($e)) {
- if (!isset($options['soft'])) {
- $dl->log(0, $e->getMessage());
- }
- continue;
- }
-
- $j = &$obj;
- if (!PEAR_Downloader_Package::willDownload($j,
- array_merge($params, $newparams)) && !$param->isInstalled($j)) {
- $newparams[] = &$j;
- }
- }
- }
-
- foreach ($bundles as $i) {
- unset($params[$i]); // remove bundles - only their contents matter for installation
- }
-
- PEAR_Downloader_Package::removeDuplicates($params); // strip any unset indices
- if (count($newparams)) { // add in bundled packages for install
- foreach ($newparams as $i => $unused) {
- $params[] = &$newparams[$i];
- }
- $newparams = array();
- }
-
- foreach ($params as $i => $param) {
- $newdeps = array();
- foreach ($param->_downloadDeps as $dep) {
- $merge = array_merge($params, $newparams);
- if (!PEAR_Downloader_Package::willDownload($dep, $merge)
- && !$param->isInstalled($dep)
- ) {
- $newdeps[] = $dep;
- } else {
- //var_dump($dep);
- // detect versioning conflicts here
- }
- }
-
- // convert the dependencies into PEAR_Downloader_Package objects for the next time around
- $params[$i]->_downloadDeps = array();
- foreach ($newdeps as $dep) {
- $obj = &new PEAR_Downloader_Package($params[$i]->getDownloader());
- if ($s = $params[$i]->explicitState()) {
- $obj->setExplicitState($s);
- }
-
- PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
- $e = $obj->fromDepURL($dep);
- PEAR::popErrorHandling();
- if (PEAR::isError($e)) {
- if (!isset($options['soft'])) {
- $obj->_downloader->log(0, $e->getMessage());
- }
- continue;
- }
-
- $e = $obj->detectDependencies($params);
- if (PEAR::isError($e)) {
- if (!isset($options['soft'])) {
- $obj->_downloader->log(0, $e->getMessage());
- }
- }
-
- $j = &$obj;
- $newparams[] = &$j;
- }
- }
-
- if (count($newparams)) {
- foreach ($newparams as $i => $unused) {
- $params[] = &$newparams[$i];
- }
- return true;
- }
-
- return false;
- }
-
-
- /**
- * @static
- */
- function willDownload($param, $params)
- {
- if (!is_array($params)) {
- return false;
- }
-
- foreach ($params as $obj) {
- if ($obj->isEqual($param)) {
- return true;
- }
- }
-
- return false;
- }
-
- /**
- * For simpler unit-testing
- * @param PEAR_Config
- * @param int
- * @param string
- */
- function &getPackagefileObject(&$c, $d)
- {
- $a = &new PEAR_PackageFile($c, $d);
- return $a;
- }
-
- /**
- * This will retrieve from a local file if possible, and parse out
- * a group name as well. The original parameter will be modified to reflect this.
- * @param string|array can be a parsed package name as well
- * @access private
- */
- function _fromFile(&$param)
- {
- $saveparam = $param;
- if (is_string($param)) {
- if (!@file_exists($param)) {
- $test = explode('#', $param);
- $group = array_pop($test);
- if (@file_exists(implode('#', $test))) {
- $this->setGroup($group);
- $param = implode('#', $test);
- $this->_explicitGroup = true;
- }
- }
-
- if (@is_file($param)) {
- $this->_type = 'local';
- $options = $this->_downloader->getOptions();
- $pkg = &$this->getPackagefileObject($this->_config, $this->_downloader->_debug);
- PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
- $pf = &$pkg->fromAnyFile($param, PEAR_VALIDATE_INSTALLING);
- PEAR::popErrorHandling();
- if (PEAR::isError($pf)) {
- $this->_valid = false;
- $param = $saveparam;
- return $pf;
- }
- $this->_packagefile = &$pf;
- if (!$this->getGroup()) {
- $this->setGroup('default'); // install the default dependency group
- }
- return $this->_valid = true;
- }
- }
- $param = $saveparam;
- return $this->_valid = false;
- }
-
- function _fromUrl($param, $saveparam = '')
- {
- if (!is_array($param) && (preg_match('#^(http|https|ftp)://#', $param))) {
- $options = $this->_downloader->getOptions();
- $this->_type = 'url';
- $callback = $this->_downloader->ui ?
- array(&$this->_downloader, '_downloadCallback') : null;
- $this->_downloader->pushErrorHandling(PEAR_ERROR_RETURN);
- if (PEAR::isError($dir = $this->_downloader->getDownloadDir())) {
- $this->_downloader->popErrorHandling();
- return $dir;
- }
-
- $this->_downloader->log(3, 'Downloading "' . $param . '"');
- $file = $this->_downloader->downloadHttp($param, $this->_downloader->ui,
- $dir, $callback, null, false, $this->getChannel());
- $this->_downloader->popErrorHandling();
- if (PEAR::isError($file)) {
- if (!empty($saveparam)) {
- $saveparam = ", cannot download \"$saveparam\"";
- }
- $err = PEAR::raiseError('Could not download from "' . $param .
- '"' . $saveparam . ' (' . $file->getMessage() . ')');
- return $err;
- }
-
- if ($this->_rawpackagefile) {
- require_once 'Archive/Tar.php';
- $tar = &new Archive_Tar($file);
- $packagexml = $tar->extractInString('package2.xml');
- if (!$packagexml) {
- $packagexml = $tar->extractInString('package.xml');
- }
-
- if (str_replace(array("\n", "\r"), array('',''), $packagexml) !=
- str_replace(array("\n", "\r"), array('',''), $this->_rawpackagefile)) {
- if ($this->getChannel() != 'pear.php.net') {
- return PEAR::raiseError('CRITICAL ERROR: package.xml downloaded does ' .
- 'not match value returned from xml-rpc');
- }
-
- // be more lax for the existing PEAR packages that have not-ok
- // characters in their package.xml
- $this->_downloader->log(0, 'CRITICAL WARNING: The "' .
- $this->getPackage() . '" package has invalid characters in its ' .
- 'package.xml. The next version of PEAR may not be able to install ' .
- 'this package for security reasons. Please open a bug report at ' .
- 'http://pear.php.net/package/' . $this->getPackage() . '/bugs');
- }
- }
-
- // whew, download worked!
- $pkg = &$this->getPackagefileObject($this->_config, $this->_downloader->debug);
-
- PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
- $pf = &$pkg->fromAnyFile($file, PEAR_VALIDATE_INSTALLING);
- PEAR::popErrorHandling();
- if (PEAR::isError($pf)) {
- if (is_array($pf->getUserInfo())) {
- foreach ($pf->getUserInfo() as $err) {
- if (is_array($err)) {
- $err = $err['message'];
- }
-
- if (!isset($options['soft'])) {
- $this->_downloader->log(0, "Validation Error: $err");
- }
- }
- }
-
- if (!isset($options['soft'])) {
- $this->_downloader->log(0, $pf->getMessage());
- }
-
- ///FIXME need to pass back some error code that we can use to match with to cancel all further operations
- /// At least stop all deps of this package from being installed
- $out = $saveparam ? $saveparam : $param;
- $err = PEAR::raiseError('Download of "' . $out . '" succeeded, but it is not a valid package archive');
- $this->_valid = false;
- return $err;
- }
-
- $this->_packagefile = &$pf;
- $this->setGroup('default'); // install the default dependency group
- return $this->_valid = true;
- }
-
- return $this->_valid = false;
- }
-
- /**
- *
- * @param string|array pass in an array of format
- * array(
- * 'package' => 'pname',
- * ['channel' => 'channame',]
- * ['version' => 'version',]
- * ['state' => 'state',])
- * or a string of format [channame/]pname[-version|-state]
- */
- function _fromString($param)
- {
- $options = $this->_downloader->getOptions();
- $channel = $this->_config->get('default_channel');
- PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
- $pname = $this->_registry->parsePackageName($param, $channel);
- PEAR::popErrorHandling();
- if (PEAR::isError($pname)) {
- if ($pname->getCode() == 'invalid') {
- $this->_valid = false;
- return false;
- }
-
- if ($pname->getCode() == 'channel') {
- $parsed = $pname->getUserInfo();
- if ($this->_downloader->discover($parsed['channel'])) {
- if ($this->_config->get('auto_discover')) {
- PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
- $pname = $this->_registry->parsePackageName($param, $channel);
- PEAR::popErrorHandling();
- } else {
- if (!isset($options['soft'])) {
- $this->_downloader->log(0, 'Channel "' . $parsed['channel'] .
- '" is not initialized, use ' .
- '"pear channel-discover ' . $parsed['channel'] . '" to initialize' .
- 'or pear config-set auto_discover 1');
- }
- }
- }
-
- if (PEAR::isError($pname)) {
- if (!isset($options['soft'])) {
- $this->_downloader->log(0, $pname->getMessage());
- }
-
- if (is_array($param)) {
- $param = $this->_registry->parsedPackageNameToString($param);
- }
-
- $err = PEAR::raiseError('invalid package name/package file "' . $param . '"');
- $this->_valid = false;
- return $err;
- }
- } else {
- if (!isset($options['soft'])) {
- $this->_downloader->log(0, $pname->getMessage());
- }
-
- $err = PEAR::raiseError('invalid package name/package file "' . $param . '"');
- $this->_valid = false;
- return $err;
- }
- }
-
- if (!isset($this->_type)) {
- $this->_type = 'rest';
- }
-
- $this->_parsedname = $pname;
- $this->_explicitState = isset($pname['state']) ? $pname['state'] : false;
- $this->_explicitGroup = isset($pname['group']) ? true : false;
-
- $info = $this->_downloader->_getPackageDownloadUrl($pname);
- if (PEAR::isError($info)) {
- if ($info->getCode() != -976 && $pname['channel'] == 'pear.php.net') {
- // try pecl
- $pname['channel'] = 'pecl.php.net';
- if ($test = $this->_downloader->_getPackageDownloadUrl($pname)) {
- if (!PEAR::isError($test)) {
- $info = PEAR::raiseError($info->getMessage() . ' - package ' .
- $this->_registry->parsedPackageNameToString($pname, true) .
- ' can be installed with "pecl install ' . $pname['package'] .
- '"');
- } else {
- $pname['channel'] = 'pear.php.net';
- }
- } else {
- $pname['channel'] = 'pear.php.net';
- }
- }
-
- return $info;
- }
-
- $this->_rawpackagefile = $info['raw'];
- $ret = $this->_analyzeDownloadURL($info, $param, $pname);
- if (PEAR::isError($ret)) {
- return $ret;
- }
-
- if ($ret) {
- $this->_downloadURL = $ret;
- return $this->_valid = (bool) $ret;
- }
- }
-
- /**
- * @param array output of package.getDownloadURL
- * @param string|array|object information for detecting packages to be downloaded, and
- * for errors
- * @param array name information of the package
- * @param array|null packages to be downloaded
- * @param bool is this an optional dependency?
- * @param bool is this any kind of dependency?
- * @access private
- */
- function _analyzeDownloadURL($info, $param, $pname, $params = null, $optional = false,
- $isdependency = false)
- {
- if (!is_string($param) && PEAR_Downloader_Package::willDownload($param, $params)) {
- return false;
- }
-
- if ($info === false) {
- $saveparam = !is_string($param) ? ", cannot download \"$param\"" : '';
-
- // no releases exist
- return PEAR::raiseError('No releases for package "' .
- $this->_registry->parsedPackageNameToString($pname, true) . '" exist' . $saveparam);
- }
-
- if (strtolower($info['info']->getChannel()) != strtolower($pname['channel'])) {
- $err = false;
- if ($pname['channel'] == 'pecl.php.net') {
- if ($info['info']->getChannel() != 'pear.php.net') {
- $err = true;
- }
- } elseif ($info['info']->getChannel() == 'pecl.php.net') {
- if ($pname['channel'] != 'pear.php.net') {
- $err = true;
- }
- } else {
- $err = true;
- }
-
- if ($err) {
- return PEAR::raiseError('SECURITY ERROR: package in channel "' . $pname['channel'] .
- '" retrieved another channel\'s name for download! ("' .
- $info['info']->getChannel() . '")');
- }
- }
-
- $preferred_state = $this->_config->get('preferred_state');
- if (!isset($info['url'])) {
- $package_version = $this->_registry->packageInfo($info['info']->getPackage(),
- 'version', $info['info']->getChannel());
- if ($this->isInstalled($info)) {
- if ($isdependency && version_compare($info['version'], $package_version, '<=')) {
- // ignore bogus errors of "failed to download dependency"
- // if it is already installed and the one that would be
- // downloaded is older or the same version (Bug #7219)
- return false;
- }
- }
-
- if ($info['version'] === $package_version) {
- if (!isset($options['soft'])) {
- $this->_downloader->log(1, 'WARNING: failed to download ' . $pname['channel'] .
- '/' . $pname['package'] . '-' . $package_version. ', additionally the suggested version' .
- ' (' . $package_version . ') is the same as the locally installed one.');
- }
-
- return false;
- }
-
- if (version_compare($info['version'], $package_version, '<=')) {
- if (!isset($options['soft'])) {
- $this->_downloader->log(1, 'WARNING: failed to download ' . $pname['channel'] .
- '/' . $pname['package'] . '-' . $package_version . ', additionally the suggested version' .
- ' (' . $info['version'] . ') is a lower version than the locally installed one (' . $package_version . ').');
- }
-
- return false;
- }
-
- $instead = ', will instead download version ' . $info['version'] .
- ', stability "' . $info['info']->getState() . '"';
- // releases exist, but we failed to get any
- if (isset($this->_downloader->_options['force'])) {
- if (isset($pname['version'])) {
- $vs = ', version "' . $pname['version'] . '"';
- } elseif (isset($pname['state'])) {
- $vs = ', stability "' . $pname['state'] . '"';
- } elseif ($param == 'dependency') {
- if (!class_exists('PEAR_Common')) {
- require_once 'PEAR/Common.php';
- }
-
- if (!in_array($info['info']->getState(),
- PEAR_Common::betterStates($preferred_state, true))) {
- if ($optional) {
- // don't spit out confusing error message
- return $this->_downloader->_getPackageDownloadUrl(
- array('package' => $pname['package'],
- 'channel' => $pname['channel'],
- 'version' => $info['version']));
- }
- $vs = ' within preferred state "' . $preferred_state .
- '"';
- } else {
- if (!class_exists('PEAR_Dependency2')) {
- require_once 'PEAR/Dependency2.php';
- }
-
- if ($optional) {
- // don't spit out confusing error message
- return $this->_downloader->_getPackageDownloadUrl(
- array('package' => $pname['package'],
- 'channel' => $pname['channel'],
- 'version' => $info['version']));
- }
- $vs = PEAR_Dependency2::_getExtraString($pname);
- $instead = '';
- }
- } else {
- $vs = ' within preferred state "' . $preferred_state . '"';
- }
-
- if (!isset($options['soft'])) {
- $this->_downloader->log(1, 'WARNING: failed to download ' . $pname['channel'] .
- '/' . $pname['package'] . $vs . $instead);
- }
-
- // download the latest release
- return $this->_downloader->_getPackageDownloadUrl(
- array('package' => $pname['package'],
- 'channel' => $pname['channel'],
- 'version' => $info['version']));
- } else {
- if (isset($info['php']) && $info['php']) {
- $err = PEAR::raiseError('Failed to download ' .
- $this->_registry->parsedPackageNameToString(
- array('channel' => $pname['channel'],
- 'package' => $pname['package']),
- true) .
- ', latest release is version ' . $info['php']['v'] .
- ', but it requires PHP version "' .
- $info['php']['m'] . '", use "' .
- $this->_registry->parsedPackageNameToString(
- array('channel' => $pname['channel'], 'package' => $pname['package'],
- 'version' => $info['php']['v'])) . '" to install',
- PEAR_DOWNLOADER_PACKAGE_PHPVERSION);
- return $err;
- }
-
- // construct helpful error message
- if (isset($pname['version'])) {
- $vs = ', version "' . $pname['version'] . '"';
- } elseif (isset($pname['state'])) {
- $vs = ', stability "' . $pname['state'] . '"';
- } elseif ($param == 'dependency') {
- if (!class_exists('PEAR_Common')) {
- require_once 'PEAR/Common.php';
- }
-
- if (!in_array($info['info']->getState(),
- PEAR_Common::betterStates($preferred_state, true))) {
- if ($optional) {
- // don't spit out confusing error message, and don't die on
- // optional dep failure!
- return $this->_downloader->_getPackageDownloadUrl(
- array('package' => $pname['package'],
- 'channel' => $pname['channel'],
- 'version' => $info['version']));
- }
- $vs = ' within preferred state "' . $preferred_state . '"';
- } else {
- if (!class_exists('PEAR_Dependency2')) {
- require_once 'PEAR/Dependency2.php';
- }
-
- if ($optional) {
- // don't spit out confusing error message, and don't die on
- // optional dep failure!
- return $this->_downloader->_getPackageDownloadUrl(
- array('package' => $pname['package'],
- 'channel' => $pname['channel'],
- 'version' => $info['version']));
- }
- $vs = PEAR_Dependency2::_getExtraString($pname);
- }
- } else {
- $vs = ' within preferred state "' . $this->_downloader->config->get('preferred_state') . '"';
- }
-
- $options = $this->_downloader->getOptions();
- // this is only set by the "download-all" command
- if (isset($options['ignorepreferred_state'])) {
- $err = PEAR::raiseError(
- 'Failed to download ' . $this->_registry->parsedPackageNameToString(
- array('channel' => $pname['channel'], 'package' => $pname['package']),
- true)
- . $vs .
- ', latest release is version ' . $info['version'] .
- ', stability "' . $info['info']->getState() . '", use "' .
- $this->_registry->parsedPackageNameToString(
- array('channel' => $pname['channel'], 'package' => $pname['package'],
- 'version' => $info['version'])) . '" to install',
- PEAR_DOWNLOADER_PACKAGE_STATE);
- return $err;
- }
-
- // Checks if the user has a package installed already and checks the release against
- // the state against the installed package, this allows upgrades for packages
- // with lower stability than the preferred_state
- $stability = $this->_registry->packageInfo($pname['package'], 'stability', $pname['channel']);
- if (!$this->isInstalled($info)
- || !in_array($info['info']->getState(), PEAR_Common::betterStates($stability['release'], true))
- ) {
- $err = PEAR::raiseError(
- 'Failed to download ' . $this->_registry->parsedPackageNameToString(
- array('channel' => $pname['channel'], 'package' => $pname['package']),
- true)
- . $vs .
- ', latest release is version ' . $info['version'] .
- ', stability "' . $info['info']->getState() . '", use "' .
- $this->_registry->parsedPackageNameToString(
- array('channel' => $pname['channel'], 'package' => $pname['package'],
- 'version' => $info['version'])) . '" to install');
- return $err;
- }
- }
- }
-
- if (isset($info['deprecated']) && $info['deprecated']) {
- $this->_downloader->log(0,
- 'WARNING: "' .
- $this->_registry->parsedPackageNameToString(
- array('channel' => $info['info']->getChannel(),
- 'package' => $info['info']->getPackage()), true) .
- '" is deprecated in favor of "' .
- $this->_registry->parsedPackageNameToString($info['deprecated'], true) .
- '"');
- }
-
- return $info;
- }
-} \ No newline at end of file
diff --git a/3rdparty/PEAR/ErrorStack.php b/3rdparty/PEAR/ErrorStack.php
deleted file mode 100644
index 0303f5273ad..00000000000
--- a/3rdparty/PEAR/ErrorStack.php
+++ /dev/null
@@ -1,985 +0,0 @@
-<?php
-/**
- * Error Stack Implementation
- *
- * This is an incredibly simple implementation of a very complex error handling
- * facility. It contains the ability
- * to track multiple errors from multiple packages simultaneously. In addition,
- * it can track errors of many levels, save data along with the error, context
- * information such as the exact file, line number, class and function that
- * generated the error, and if necessary, it can raise a traditional PEAR_Error.
- * It has built-in support for PEAR::Log, to log errors as they occur
- *
- * Since version 0.2alpha, it is also possible to selectively ignore errors,
- * through the use of an error callback, see {@link pushCallback()}
- *
- * Since version 0.3alpha, it is possible to specify the exception class
- * returned from {@link push()}
- *
- * Since version PEAR1.3.2, ErrorStack no longer instantiates an exception class. This can
- * still be done quite handily in an error callback or by manipulating the returned array
- * @category Debugging
- * @package PEAR_ErrorStack
- * @author Greg Beaver <cellog@php.net>
- * @copyright 2004-2008 Greg Beaver
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: ErrorStack.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR_ErrorStack
- */
-
-/**
- * Singleton storage
- *
- * Format:
- * <pre>
- * array(
- * 'package1' => PEAR_ErrorStack object,
- * 'package2' => PEAR_ErrorStack object,
- * ...
- * )
- * </pre>
- * @access private
- * @global array $GLOBALS['_PEAR_ERRORSTACK_SINGLETON']
- */
-$GLOBALS['_PEAR_ERRORSTACK_SINGLETON'] = array();
-
-/**
- * Global error callback (default)
- *
- * This is only used if set to non-false. * is the default callback for
- * all packages, whereas specific packages may set a default callback
- * for all instances, regardless of whether they are a singleton or not.
- *
- * To exclude non-singletons, only set the local callback for the singleton
- * @see PEAR_ErrorStack::setDefaultCallback()
- * @access private
- * @global array $GLOBALS['_PEAR_ERRORSTACK_DEFAULT_CALLBACK']
- */
-$GLOBALS['_PEAR_ERRORSTACK_DEFAULT_CALLBACK'] = array(
- '*' => false,
-);
-
-/**
- * Global Log object (default)
- *
- * This is only used if set to non-false. Use to set a default log object for
- * all stacks, regardless of instantiation order or location
- * @see PEAR_ErrorStack::setDefaultLogger()
- * @access private
- * @global array $GLOBALS['_PEAR_ERRORSTACK_DEFAULT_LOGGER']
- */
-$GLOBALS['_PEAR_ERRORSTACK_DEFAULT_LOGGER'] = false;
-
-/**
- * Global Overriding Callback
- *
- * This callback will override any error callbacks that specific loggers have set.
- * Use with EXTREME caution
- * @see PEAR_ErrorStack::staticPushCallback()
- * @access private
- * @global array $GLOBALS['_PEAR_ERRORSTACK_DEFAULT_LOGGER']
- */
-$GLOBALS['_PEAR_ERRORSTACK_OVERRIDE_CALLBACK'] = array();
-
-/**#@+
- * One of four possible return values from the error Callback
- * @see PEAR_ErrorStack::_errorCallback()
- */
-/**
- * If this is returned, then the error will be both pushed onto the stack
- * and logged.
- */
-define('PEAR_ERRORSTACK_PUSHANDLOG', 1);
-/**
- * If this is returned, then the error will only be pushed onto the stack,
- * and not logged.
- */
-define('PEAR_ERRORSTACK_PUSH', 2);
-/**
- * If this is returned, then the error will only be logged, but not pushed
- * onto the error stack.
- */
-define('PEAR_ERRORSTACK_LOG', 3);
-/**
- * If this is returned, then the error is completely ignored.
- */
-define('PEAR_ERRORSTACK_IGNORE', 4);
-/**
- * If this is returned, then the error is logged and die() is called.
- */
-define('PEAR_ERRORSTACK_DIE', 5);
-/**#@-*/
-
-/**
- * Error code for an attempt to instantiate a non-class as a PEAR_ErrorStack in
- * the singleton method.
- */
-define('PEAR_ERRORSTACK_ERR_NONCLASS', 1);
-
-/**
- * Error code for an attempt to pass an object into {@link PEAR_ErrorStack::getMessage()}
- * that has no __toString() method
- */
-define('PEAR_ERRORSTACK_ERR_OBJTOSTRING', 2);
-/**
- * Error Stack Implementation
- *
- * Usage:
- * <code>
- * // global error stack
- * $global_stack = &PEAR_ErrorStack::singleton('MyPackage');
- * // local error stack
- * $local_stack = new PEAR_ErrorStack('MyPackage');
- * </code>
- * @author Greg Beaver <cellog@php.net>
- * @version 1.9.4
- * @package PEAR_ErrorStack
- * @category Debugging
- * @copyright 2004-2008 Greg Beaver
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: ErrorStack.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR_ErrorStack
- */
-class PEAR_ErrorStack {
- /**
- * Errors are stored in the order that they are pushed on the stack.
- * @since 0.4alpha Errors are no longer organized by error level.
- * This renders pop() nearly unusable, and levels could be more easily
- * handled in a callback anyway
- * @var array
- * @access private
- */
- var $_errors = array();
-
- /**
- * Storage of errors by level.
- *
- * Allows easy retrieval and deletion of only errors from a particular level
- * @since PEAR 1.4.0dev
- * @var array
- * @access private
- */
- var $_errorsByLevel = array();
-
- /**
- * Package name this error stack represents
- * @var string
- * @access protected
- */
- var $_package;
-
- /**
- * Determines whether a PEAR_Error is thrown upon every error addition
- * @var boolean
- * @access private
- */
- var $_compat = false;
-
- /**
- * If set to a valid callback, this will be used to generate the error
- * message from the error code, otherwise the message passed in will be
- * used
- * @var false|string|array
- * @access private
- */
- var $_msgCallback = false;
-
- /**
- * If set to a valid callback, this will be used to generate the error
- * context for an error. For PHP-related errors, this will be a file
- * and line number as retrieved from debug_backtrace(), but can be
- * customized for other purposes. The error might actually be in a separate
- * configuration file, or in a database query.
- * @var false|string|array
- * @access protected
- */
- var $_contextCallback = false;
-
- /**
- * If set to a valid callback, this will be called every time an error
- * is pushed onto the stack. The return value will be used to determine
- * whether to allow an error to be pushed or logged.
- *
- * The return value must be one an PEAR_ERRORSTACK_* constant
- * @see PEAR_ERRORSTACK_PUSHANDLOG, PEAR_ERRORSTACK_PUSH, PEAR_ERRORSTACK_LOG
- * @var false|string|array
- * @access protected
- */
- var $_errorCallback = array();
-
- /**
- * PEAR::Log object for logging errors
- * @var false|Log
- * @access protected
- */
- var $_logger = false;
-
- /**
- * Error messages - designed to be overridden
- * @var array
- * @abstract
- */
- var $_errorMsgs = array();
-
- /**
- * Set up a new error stack
- *
- * @param string $package name of the package this error stack represents
- * @param callback $msgCallback callback used for error message generation
- * @param callback $contextCallback callback used for context generation,
- * defaults to {@link getFileLine()}
- * @param boolean $throwPEAR_Error
- */
- function PEAR_ErrorStack($package, $msgCallback = false, $contextCallback = false,
- $throwPEAR_Error = false)
- {
- $this->_package = $package;
- $this->setMessageCallback($msgCallback);
- $this->setContextCallback($contextCallback);
- $this->_compat = $throwPEAR_Error;
- }
-
- /**
- * Return a single error stack for this package.
- *
- * Note that all parameters are ignored if the stack for package $package
- * has already been instantiated
- * @param string $package name of the package this error stack represents
- * @param callback $msgCallback callback used for error message generation
- * @param callback $contextCallback callback used for context generation,
- * defaults to {@link getFileLine()}
- * @param boolean $throwPEAR_Error
- * @param string $stackClass class to instantiate
- * @static
- * @return PEAR_ErrorStack
- */
- function &singleton($package, $msgCallback = false, $contextCallback = false,
- $throwPEAR_Error = false, $stackClass = 'PEAR_ErrorStack')
- {
- if (isset($GLOBALS['_PEAR_ERRORSTACK_SINGLETON'][$package])) {
- return $GLOBALS['_PEAR_ERRORSTACK_SINGLETON'][$package];
- }
- if (!class_exists($stackClass)) {
- if (function_exists('debug_backtrace')) {
- $trace = debug_backtrace();
- }
- PEAR_ErrorStack::staticPush('PEAR_ErrorStack', PEAR_ERRORSTACK_ERR_NONCLASS,
- 'exception', array('stackclass' => $stackClass),
- 'stack class "%stackclass%" is not a valid class name (should be like PEAR_ErrorStack)',
- false, $trace);
- }
- $GLOBALS['_PEAR_ERRORSTACK_SINGLETON'][$package] =
- new $stackClass($package, $msgCallback, $contextCallback, $throwPEAR_Error);
-
- return $GLOBALS['_PEAR_ERRORSTACK_SINGLETON'][$package];
- }
-
- /**
- * Internal error handler for PEAR_ErrorStack class
- *
- * Dies if the error is an exception (and would have died anyway)
- * @access private
- */
- function _handleError($err)
- {
- if ($err['level'] == 'exception') {
- $message = $err['message'];
- if (isset($_SERVER['REQUEST_URI'])) {
- echo '<br />';
- } else {
- echo "\n";
- }
- var_dump($err['context']);
- die($message);
- }
- }
-
- /**
- * Set up a PEAR::Log object for all error stacks that don't have one
- * @param Log $log
- * @static
- */
- function setDefaultLogger(&$log)
- {
- if (is_object($log) && method_exists($log, 'log') ) {
- $GLOBALS['_PEAR_ERRORSTACK_DEFAULT_LOGGER'] = &$log;
- } elseif (is_callable($log)) {
- $GLOBALS['_PEAR_ERRORSTACK_DEFAULT_LOGGER'] = &$log;
- }
- }
-
- /**
- * Set up a PEAR::Log object for this error stack
- * @param Log $log
- */
- function setLogger(&$log)
- {
- if (is_object($log) && method_exists($log, 'log') ) {
- $this->_logger = &$log;
- } elseif (is_callable($log)) {
- $this->_logger = &$log;
- }
- }
-
- /**
- * Set an error code => error message mapping callback
- *
- * This method sets the callback that can be used to generate error
- * messages for any instance
- * @param array|string Callback function/method
- */
- function setMessageCallback($msgCallback)
- {
- if (!$msgCallback) {
- $this->_msgCallback = array(&$this, 'getErrorMessage');
- } else {
- if (is_callable($msgCallback)) {
- $this->_msgCallback = $msgCallback;
- }
- }
- }
-
- /**
- * Get an error code => error message mapping callback
- *
- * This method returns the current callback that can be used to generate error
- * messages
- * @return array|string|false Callback function/method or false if none
- */
- function getMessageCallback()
- {
- return $this->_msgCallback;
- }
-
- /**
- * Sets a default callback to be used by all error stacks
- *
- * This method sets the callback that can be used to generate error
- * messages for a singleton
- * @param array|string Callback function/method
- * @param string Package name, or false for all packages
- * @static
- */
- function setDefaultCallback($callback = false, $package = false)
- {
- if (!is_callable($callback)) {
- $callback = false;
- }
- $package = $package ? $package : '*';
- $GLOBALS['_PEAR_ERRORSTACK_DEFAULT_CALLBACK'][$package] = $callback;
- }
-
- /**
- * Set a callback that generates context information (location of error) for an error stack
- *
- * This method sets the callback that can be used to generate context
- * information for an error. Passing in NULL will disable context generation
- * and remove the expensive call to debug_backtrace()
- * @param array|string|null Callback function/method
- */
- function setContextCallback($contextCallback)
- {
- if ($contextCallback === null) {
- return $this->_contextCallback = false;
- }
- if (!$contextCallback) {
- $this->_contextCallback = array(&$this, 'getFileLine');
- } else {
- if (is_callable($contextCallback)) {
- $this->_contextCallback = $contextCallback;
- }
- }
- }
-
- /**
- * Set an error Callback
- * If set to a valid callback, this will be called every time an error
- * is pushed onto the stack. The return value will be used to determine
- * whether to allow an error to be pushed or logged.
- *
- * The return value must be one of the ERRORSTACK_* constants.
- *
- * This functionality can be used to emulate PEAR's pushErrorHandling, and
- * the PEAR_ERROR_CALLBACK mode, without affecting the integrity of
- * the error stack or logging
- * @see PEAR_ERRORSTACK_PUSHANDLOG, PEAR_ERRORSTACK_PUSH, PEAR_ERRORSTACK_LOG
- * @see popCallback()
- * @param string|array $cb
- */
- function pushCallback($cb)
- {
- array_push($this->_errorCallback, $cb);
- }
-
- /**
- * Remove a callback from the error callback stack
- * @see pushCallback()
- * @return array|string|false
- */
- function popCallback()
- {
- if (!count($this->_errorCallback)) {
- return false;
- }
- return array_pop($this->_errorCallback);
- }
-
- /**
- * Set a temporary overriding error callback for every package error stack
- *
- * Use this to temporarily disable all existing callbacks (can be used
- * to emulate the @ operator, for instance)
- * @see PEAR_ERRORSTACK_PUSHANDLOG, PEAR_ERRORSTACK_PUSH, PEAR_ERRORSTACK_LOG
- * @see staticPopCallback(), pushCallback()
- * @param string|array $cb
- * @static
- */
- function staticPushCallback($cb)
- {
- array_push($GLOBALS['_PEAR_ERRORSTACK_OVERRIDE_CALLBACK'], $cb);
- }
-
- /**
- * Remove a temporary overriding error callback
- * @see staticPushCallback()
- * @return array|string|false
- * @static
- */
- function staticPopCallback()
- {
- $ret = array_pop($GLOBALS['_PEAR_ERRORSTACK_OVERRIDE_CALLBACK']);
- if (!is_array($GLOBALS['_PEAR_ERRORSTACK_OVERRIDE_CALLBACK'])) {
- $GLOBALS['_PEAR_ERRORSTACK_OVERRIDE_CALLBACK'] = array();
- }
- return $ret;
- }
-
- /**
- * Add an error to the stack
- *
- * If the message generator exists, it is called with 2 parameters.
- * - the current Error Stack object
- * - an array that is in the same format as an error. Available indices
- * are 'code', 'package', 'time', 'params', 'level', and 'context'
- *
- * Next, if the error should contain context information, this is
- * handled by the context grabbing method.
- * Finally, the error is pushed onto the proper error stack
- * @param int $code Package-specific error code
- * @param string $level Error level. This is NOT spell-checked
- * @param array $params associative array of error parameters
- * @param string $msg Error message, or a portion of it if the message
- * is to be generated
- * @param array $repackage If this error re-packages an error pushed by
- * another package, place the array returned from
- * {@link pop()} in this parameter
- * @param array $backtrace Protected parameter: use this to pass in the
- * {@link debug_backtrace()} that should be used
- * to find error context
- * @return PEAR_Error|array if compatibility mode is on, a PEAR_Error is also
- * thrown. If a PEAR_Error is returned, the userinfo
- * property is set to the following array:
- *
- * <code>
- * array(
- * 'code' => $code,
- * 'params' => $params,
- * 'package' => $this->_package,
- * 'level' => $level,
- * 'time' => time(),
- * 'context' => $context,
- * 'message' => $msg,
- * //['repackage' => $err] repackaged error array/Exception class
- * );
- * </code>
- *
- * Normally, the previous array is returned.
- */
- function push($code, $level = 'error', $params = array(), $msg = false,
- $repackage = false, $backtrace = false)
- {
- $context = false;
- // grab error context
- if ($this->_contextCallback) {
- if (!$backtrace) {
- $backtrace = debug_backtrace();
- }
- $context = call_user_func($this->_contextCallback, $code, $params, $backtrace);
- }
-
- // save error
- $time = explode(' ', microtime());
- $time = $time[1] + $time[0];
- $err = array(
- 'code' => $code,
- 'params' => $params,
- 'package' => $this->_package,
- 'level' => $level,
- 'time' => $time,
- 'context' => $context,
- 'message' => $msg,
- );
-
- if ($repackage) {
- $err['repackage'] = $repackage;
- }
-
- // set up the error message, if necessary
- if ($this->_msgCallback) {
- $msg = call_user_func_array($this->_msgCallback,
- array(&$this, $err));
- $err['message'] = $msg;
- }
- $push = $log = true;
- $die = false;
- // try the overriding callback first
- $callback = $this->staticPopCallback();
- if ($callback) {
- $this->staticPushCallback($callback);
- }
- if (!is_callable($callback)) {
- // try the local callback next
- $callback = $this->popCallback();
- if (is_callable($callback)) {
- $this->pushCallback($callback);
- } else {
- // try the default callback
- $callback = isset($GLOBALS['_PEAR_ERRORSTACK_DEFAULT_CALLBACK'][$this->_package]) ?
- $GLOBALS['_PEAR_ERRORSTACK_DEFAULT_CALLBACK'][$this->_package] :
- $GLOBALS['_PEAR_ERRORSTACK_DEFAULT_CALLBACK']['*'];
- }
- }
- if (is_callable($callback)) {
- switch(call_user_func($callback, $err)){
- case PEAR_ERRORSTACK_IGNORE:
- return $err;
- break;
- case PEAR_ERRORSTACK_PUSH:
- $log = false;
- break;
- case PEAR_ERRORSTACK_LOG:
- $push = false;
- break;
- case PEAR_ERRORSTACK_DIE:
- $die = true;
- break;
- // anything else returned has the same effect as pushandlog
- }
- }
- if ($push) {
- array_unshift($this->_errors, $err);
- if (!isset($this->_errorsByLevel[$err['level']])) {
- $this->_errorsByLevel[$err['level']] = array();
- }
- $this->_errorsByLevel[$err['level']][] = &$this->_errors[0];
- }
- if ($log) {
- if ($this->_logger || $GLOBALS['_PEAR_ERRORSTACK_DEFAULT_LOGGER']) {
- $this->_log($err);
- }
- }
- if ($die) {
- die();
- }
- if ($this->_compat && $push) {
- return $this->raiseError($msg, $code, null, null, $err);
- }
- return $err;
- }
-
- /**
- * Static version of {@link push()}
- *
- * @param string $package Package name this error belongs to
- * @param int $code Package-specific error code
- * @param string $level Error level. This is NOT spell-checked
- * @param array $params associative array of error parameters
- * @param string $msg Error message, or a portion of it if the message
- * is to be generated
- * @param array $repackage If this error re-packages an error pushed by
- * another package, place the array returned from
- * {@link pop()} in this parameter
- * @param array $backtrace Protected parameter: use this to pass in the
- * {@link debug_backtrace()} that should be used
- * to find error context
- * @return PEAR_Error|array if compatibility mode is on, a PEAR_Error is also
- * thrown. see docs for {@link push()}
- * @static
- */
- function staticPush($package, $code, $level = 'error', $params = array(),
- $msg = false, $repackage = false, $backtrace = false)
- {
- $s = &PEAR_ErrorStack::singleton($package);
- if ($s->_contextCallback) {
- if (!$backtrace) {
- if (function_exists('debug_backtrace')) {
- $backtrace = debug_backtrace();
- }
- }
- }
- return $s->push($code, $level, $params, $msg, $repackage, $backtrace);
- }
-
- /**
- * Log an error using PEAR::Log
- * @param array $err Error array
- * @param array $levels Error level => Log constant map
- * @access protected
- */
- function _log($err)
- {
- if ($this->_logger) {
- $logger = &$this->_logger;
- } else {
- $logger = &$GLOBALS['_PEAR_ERRORSTACK_DEFAULT_LOGGER'];
- }
- if (is_a($logger, 'Log')) {
- $levels = array(
- 'exception' => PEAR_LOG_CRIT,
- 'alert' => PEAR_LOG_ALERT,
- 'critical' => PEAR_LOG_CRIT,
- 'error' => PEAR_LOG_ERR,
- 'warning' => PEAR_LOG_WARNING,
- 'notice' => PEAR_LOG_NOTICE,
- 'info' => PEAR_LOG_INFO,
- 'debug' => PEAR_LOG_DEBUG);
- if (isset($levels[$err['level']])) {
- $level = $levels[$err['level']];
- } else {
- $level = PEAR_LOG_INFO;
- }
- $logger->log($err['message'], $level, $err);
- } else { // support non-standard logs
- call_user_func($logger, $err);
- }
- }
-
-
- /**
- * Pop an error off of the error stack
- *
- * @return false|array
- * @since 0.4alpha it is no longer possible to specify a specific error
- * level to return - the last error pushed will be returned, instead
- */
- function pop()
- {
- $err = @array_shift($this->_errors);
- if (!is_null($err)) {
- @array_pop($this->_errorsByLevel[$err['level']]);
- if (!count($this->_errorsByLevel[$err['level']])) {
- unset($this->_errorsByLevel[$err['level']]);
- }
- }
- return $err;
- }
-
- /**
- * Pop an error off of the error stack, static method
- *
- * @param string package name
- * @return boolean
- * @since PEAR1.5.0a1
- */
- function staticPop($package)
- {
- if ($package) {
- if (!isset($GLOBALS['_PEAR_ERRORSTACK_SINGLETON'][$package])) {
- return false;
- }
- return $GLOBALS['_PEAR_ERRORSTACK_SINGLETON'][$package]->pop();
- }
- }
-
- /**
- * Determine whether there are any errors on the stack
- * @param string|array Level name. Use to determine if any errors
- * of level (string), or levels (array) have been pushed
- * @return boolean
- */
- function hasErrors($level = false)
- {
- if ($level) {
- return isset($this->_errorsByLevel[$level]);
- }
- return count($this->_errors);
- }
-
- /**
- * Retrieve all errors since last purge
- *
- * @param boolean set in order to empty the error stack
- * @param string level name, to return only errors of a particular severity
- * @return array
- */
- function getErrors($purge = false, $level = false)
- {
- if (!$purge) {
- if ($level) {
- if (!isset($this->_errorsByLevel[$level])) {
- return array();
- } else {
- return $this->_errorsByLevel[$level];
- }
- } else {
- return $this->_errors;
- }
- }
- if ($level) {
- $ret = $this->_errorsByLevel[$level];
- foreach ($this->_errorsByLevel[$level] as $i => $unused) {
- // entries are references to the $_errors array
- $this->_errorsByLevel[$level][$i] = false;
- }
- // array_filter removes all entries === false
- $this->_errors = array_filter($this->_errors);
- unset($this->_errorsByLevel[$level]);
- return $ret;
- }
- $ret = $this->_errors;
- $this->_errors = array();
- $this->_errorsByLevel = array();
- return $ret;
- }
-
- /**
- * Determine whether there are any errors on a single error stack, or on any error stack
- *
- * The optional parameter can be used to test the existence of any errors without the need of
- * singleton instantiation
- * @param string|false Package name to check for errors
- * @param string Level name to check for a particular severity
- * @return boolean
- * @static
- */
- function staticHasErrors($package = false, $level = false)
- {
- if ($package) {
- if (!isset($GLOBALS['_PEAR_ERRORSTACK_SINGLETON'][$package])) {
- return false;
- }
- return $GLOBALS['_PEAR_ERRORSTACK_SINGLETON'][$package]->hasErrors($level);
- }
- foreach ($GLOBALS['_PEAR_ERRORSTACK_SINGLETON'] as $package => $obj) {
- if ($obj->hasErrors($level)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Get a list of all errors since last purge, organized by package
- * @since PEAR 1.4.0dev BC break! $level is now in the place $merge used to be
- * @param boolean $purge Set to purge the error stack of existing errors
- * @param string $level Set to a level name in order to retrieve only errors of a particular level
- * @param boolean $merge Set to return a flat array, not organized by package
- * @param array $sortfunc Function used to sort a merged array - default
- * sorts by time, and should be good for most cases
- * @static
- * @return array
- */
- function staticGetErrors($purge = false, $level = false, $merge = false,
- $sortfunc = array('PEAR_ErrorStack', '_sortErrors'))
- {
- $ret = array();
- if (!is_callable($sortfunc)) {
- $sortfunc = array('PEAR_ErrorStack', '_sortErrors');
- }
- foreach ($GLOBALS['_PEAR_ERRORSTACK_SINGLETON'] as $package => $obj) {
- $test = $GLOBALS['_PEAR_ERRORSTACK_SINGLETON'][$package]->getErrors($purge, $level);
- if ($test) {
- if ($merge) {
- $ret = array_merge($ret, $test);
- } else {
- $ret[$package] = $test;
- }
- }
- }
- if ($merge) {
- usort($ret, $sortfunc);
- }
- return $ret;
- }
-
- /**
- * Error sorting function, sorts by time
- * @access private
- */
- function _sortErrors($a, $b)
- {
- if ($a['time'] == $b['time']) {
- return 0;
- }
- if ($a['time'] < $b['time']) {
- return 1;
- }
- return -1;
- }
-
- /**
- * Standard file/line number/function/class context callback
- *
- * This function uses a backtrace generated from {@link debug_backtrace()}
- * and so will not work at all in PHP < 4.3.0. The frame should
- * reference the frame that contains the source of the error.
- * @return array|false either array('file' => file, 'line' => line,
- * 'function' => function name, 'class' => class name) or
- * if this doesn't work, then false
- * @param unused
- * @param integer backtrace frame.
- * @param array Results of debug_backtrace()
- * @static
- */
- function getFileLine($code, $params, $backtrace = null)
- {
- if ($backtrace === null) {
- return false;
- }
- $frame = 0;
- $functionframe = 1;
- if (!isset($backtrace[1])) {
- $functionframe = 0;
- } else {
- while (isset($backtrace[$functionframe]['function']) &&
- $backtrace[$functionframe]['function'] == 'eval' &&
- isset($backtrace[$functionframe + 1])) {
- $functionframe++;
- }
- }
- if (isset($backtrace[$frame])) {
- if (!isset($backtrace[$frame]['file'])) {
- $frame++;
- }
- $funcbacktrace = $backtrace[$functionframe];
- $filebacktrace = $backtrace[$frame];
- $ret = array('file' => $filebacktrace['file'],
- 'line' => $filebacktrace['line']);
- // rearrange for eval'd code or create function errors
- if (strpos($filebacktrace['file'], '(') &&
- preg_match(';^(.*?)\((\d+)\) : (.*?)\\z;', $filebacktrace['file'],
- $matches)) {
- $ret['file'] = $matches[1];
- $ret['line'] = $matches[2] + 0;
- }
- if (isset($funcbacktrace['function']) && isset($backtrace[1])) {
- if ($funcbacktrace['function'] != 'eval') {
- if ($funcbacktrace['function'] == '__lambda_func') {
- $ret['function'] = 'create_function() code';
- } else {
- $ret['function'] = $funcbacktrace['function'];
- }
- }
- }
- if (isset($funcbacktrace['class']) && isset($backtrace[1])) {
- $ret['class'] = $funcbacktrace['class'];
- }
- return $ret;
- }
- return false;
- }
-
- /**
- * Standard error message generation callback
- *
- * This method may also be called by a custom error message generator
- * to fill in template values from the params array, simply
- * set the third parameter to the error message template string to use
- *
- * The special variable %__msg% is reserved: use it only to specify
- * where a message passed in by the user should be placed in the template,
- * like so:
- *
- * Error message: %msg% - internal error
- *
- * If the message passed like so:
- *
- * <code>
- * $stack->push(ERROR_CODE, 'error', array(), 'server error 500');
- * </code>
- *
- * The returned error message will be "Error message: server error 500 -
- * internal error"
- * @param PEAR_ErrorStack
- * @param array
- * @param string|false Pre-generated error message template
- * @static
- * @return string
- */
- function getErrorMessage(&$stack, $err, $template = false)
- {
- if ($template) {
- $mainmsg = $template;
- } else {
- $mainmsg = $stack->getErrorMessageTemplate($err['code']);
- }
- $mainmsg = str_replace('%__msg%', $err['message'], $mainmsg);
- if (is_array($err['params']) && count($err['params'])) {
- foreach ($err['params'] as $name => $val) {
- if (is_array($val)) {
- // @ is needed in case $val is a multi-dimensional array
- $val = @implode(', ', $val);
- }
- if (is_object($val)) {
- if (method_exists($val, '__toString')) {
- $val = $val->__toString();
- } else {
- PEAR_ErrorStack::staticPush('PEAR_ErrorStack', PEAR_ERRORSTACK_ERR_OBJTOSTRING,
- 'warning', array('obj' => get_class($val)),
- 'object %obj% passed into getErrorMessage, but has no __toString() method');
- $val = 'Object';
- }
- }
- $mainmsg = str_replace('%' . $name . '%', $val, $mainmsg);
- }
- }
- return $mainmsg;
- }
-
- /**
- * Standard Error Message Template generator from code
- * @return string
- */
- function getErrorMessageTemplate($code)
- {
- if (!isset($this->_errorMsgs[$code])) {
- return '%__msg%';
- }
- return $this->_errorMsgs[$code];
- }
-
- /**
- * Set the Error Message Template array
- *
- * The array format must be:
- * <pre>
- * array(error code => 'message template',...)
- * </pre>
- *
- * Error message parameters passed into {@link push()} will be used as input
- * for the error message. If the template is 'message %foo% was %bar%', and the
- * parameters are array('foo' => 'one', 'bar' => 'six'), the error message returned will
- * be 'message one was six'
- * @return string
- */
- function setErrorMessageTemplate($template)
- {
- $this->_errorMsgs = $template;
- }
-
-
- /**
- * emulate PEAR::raiseError()
- *
- * @return PEAR_Error
- */
- function raiseError()
- {
- require_once 'PEAR.php';
- $args = func_get_args();
- return call_user_func_array(array('PEAR', 'raiseError'), $args);
- }
-}
-$stack = &PEAR_ErrorStack::singleton('PEAR_ErrorStack');
-$stack->pushCallback(array('PEAR_ErrorStack', '_handleError'));
-?>
diff --git a/3rdparty/PEAR/Exception.php b/3rdparty/PEAR/Exception.php
deleted file mode 100644
index 4a0e7b86fac..00000000000
--- a/3rdparty/PEAR/Exception.php
+++ /dev/null
@@ -1,389 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 foldmethod=marker: */
-/**
- * PEAR_Exception
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Tomas V. V. Cox <cox@idecnet.com>
- * @author Hans Lellelid <hans@velum.net>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Exception.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.3.3
- */
-
-
-/**
- * Base PEAR_Exception Class
- *
- * 1) Features:
- *
- * - Nestable exceptions (throw new PEAR_Exception($msg, $prev_exception))
- * - Definable triggers, shot when exceptions occur
- * - Pretty and informative error messages
- * - Added more context info available (like class, method or cause)
- * - cause can be a PEAR_Exception or an array of mixed
- * PEAR_Exceptions/PEAR_ErrorStack warnings
- * - callbacks for specific exception classes and their children
- *
- * 2) Ideas:
- *
- * - Maybe a way to define a 'template' for the output
- *
- * 3) Inherited properties from PHP Exception Class:
- *
- * protected $message
- * protected $code
- * protected $line
- * protected $file
- * private $trace
- *
- * 4) Inherited methods from PHP Exception Class:
- *
- * __clone
- * __construct
- * getMessage
- * getCode
- * getFile
- * getLine
- * getTraceSafe
- * getTraceSafeAsString
- * __toString
- *
- * 5) Usage example
- *
- * <code>
- * require_once 'PEAR/Exception.php';
- *
- * class Test {
- * function foo() {
- * throw new PEAR_Exception('Error Message', ERROR_CODE);
- * }
- * }
- *
- * function myLogger($pear_exception) {
- * echo $pear_exception->getMessage();
- * }
- * // each time a exception is thrown the 'myLogger' will be called
- * // (its use is completely optional)
- * PEAR_Exception::addObserver('myLogger');
- * $test = new Test;
- * try {
- * $test->foo();
- * } catch (PEAR_Exception $e) {
- * print $e;
- * }
- * </code>
- *
- * @category pear
- * @package PEAR
- * @author Tomas V.V.Cox <cox@idecnet.com>
- * @author Hans Lellelid <hans@velum.net>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.3.3
- *
- */
-class PEAR_Exception extends Exception
-{
- const OBSERVER_PRINT = -2;
- const OBSERVER_TRIGGER = -4;
- const OBSERVER_DIE = -8;
- protected $cause;
- private static $_observers = array();
- private static $_uniqueid = 0;
- private $_trace;
-
- /**
- * Supported signatures:
- * - PEAR_Exception(string $message);
- * - PEAR_Exception(string $message, int $code);
- * - PEAR_Exception(string $message, Exception $cause);
- * - PEAR_Exception(string $message, Exception $cause, int $code);
- * - PEAR_Exception(string $message, PEAR_Error $cause);
- * - PEAR_Exception(string $message, PEAR_Error $cause, int $code);
- * - PEAR_Exception(string $message, array $causes);
- * - PEAR_Exception(string $message, array $causes, int $code);
- * @param string exception message
- * @param int|Exception|PEAR_Error|array|null exception cause
- * @param int|null exception code or null
- */
- public function __construct($message, $p2 = null, $p3 = null)
- {
- if (is_int($p2)) {
- $code = $p2;
- $this->cause = null;
- } elseif (is_object($p2) || is_array($p2)) {
- // using is_object allows both Exception and PEAR_Error
- if (is_object($p2) && !($p2 instanceof Exception)) {
- if (!class_exists('PEAR_Error') || !($p2 instanceof PEAR_Error)) {
- throw new PEAR_Exception('exception cause must be Exception, ' .
- 'array, or PEAR_Error');
- }
- }
- $code = $p3;
- if (is_array($p2) && isset($p2['message'])) {
- // fix potential problem of passing in a single warning
- $p2 = array($p2);
- }
- $this->cause = $p2;
- } else {
- $code = null;
- $this->cause = null;
- }
- parent::__construct($message, $code);
- $this->signal();
- }
-
- /**
- * @param mixed $callback - A valid php callback, see php func is_callable()
- * - A PEAR_Exception::OBSERVER_* constant
- * - An array(const PEAR_Exception::OBSERVER_*,
- * mixed $options)
- * @param string $label The name of the observer. Use this if you want
- * to remove it later with removeObserver()
- */
- public static function addObserver($callback, $label = 'default')
- {
- self::$_observers[$label] = $callback;
- }
-
- public static function removeObserver($label = 'default')
- {
- unset(self::$_observers[$label]);
- }
-
- /**
- * @return int unique identifier for an observer
- */
- public static function getUniqueId()
- {
- return self::$_uniqueid++;
- }
-
- private function signal()
- {
- foreach (self::$_observers as $func) {
- if (is_callable($func)) {
- call_user_func($func, $this);
- continue;
- }
- settype($func, 'array');
- switch ($func[0]) {
- case self::OBSERVER_PRINT :
- $f = (isset($func[1])) ? $func[1] : '%s';
- printf($f, $this->getMessage());
- break;
- case self::OBSERVER_TRIGGER :
- $f = (isset($func[1])) ? $func[1] : E_USER_NOTICE;
- trigger_error($this->getMessage(), $f);
- break;
- case self::OBSERVER_DIE :
- $f = (isset($func[1])) ? $func[1] : '%s';
- die(printf($f, $this->getMessage()));
- break;
- default:
- trigger_error('invalid observer type', E_USER_WARNING);
- }
- }
- }
-
- /**
- * Return specific error information that can be used for more detailed
- * error messages or translation.
- *
- * This method may be overridden in child exception classes in order
- * to add functionality not present in PEAR_Exception and is a placeholder
- * to define API
- *
- * The returned array must be an associative array of parameter => value like so:
- * <pre>
- * array('name' => $name, 'context' => array(...))
- * </pre>
- * @return array
- */
- public function getErrorData()
- {
- return array();
- }
-
- /**
- * Returns the exception that caused this exception to be thrown
- * @access public
- * @return Exception|array The context of the exception
- */
- public function getCause()
- {
- return $this->cause;
- }
-
- /**
- * Function must be public to call on caused exceptions
- * @param array
- */
- public function getCauseMessage(&$causes)
- {
- $trace = $this->getTraceSafe();
- $cause = array('class' => get_class($this),
- 'message' => $this->message,
- 'file' => 'unknown',
- 'line' => 'unknown');
- if (isset($trace[0])) {
- if (isset($trace[0]['file'])) {
- $cause['file'] = $trace[0]['file'];
- $cause['line'] = $trace[0]['line'];
- }
- }
- $causes[] = $cause;
- if ($this->cause instanceof PEAR_Exception) {
- $this->cause->getCauseMessage($causes);
- } elseif ($this->cause instanceof Exception) {
- $causes[] = array('class' => get_class($this->cause),
- 'message' => $this->cause->getMessage(),
- 'file' => $this->cause->getFile(),
- 'line' => $this->cause->getLine());
- } elseif (class_exists('PEAR_Error') && $this->cause instanceof PEAR_Error) {
- $causes[] = array('class' => get_class($this->cause),
- 'message' => $this->cause->getMessage(),
- 'file' => 'unknown',
- 'line' => 'unknown');
- } elseif (is_array($this->cause)) {
- foreach ($this->cause as $cause) {
- if ($cause instanceof PEAR_Exception) {
- $cause->getCauseMessage($causes);
- } elseif ($cause instanceof Exception) {
- $causes[] = array('class' => get_class($cause),
- 'message' => $cause->getMessage(),
- 'file' => $cause->getFile(),
- 'line' => $cause->getLine());
- } elseif (class_exists('PEAR_Error') && $cause instanceof PEAR_Error) {
- $causes[] = array('class' => get_class($cause),
- 'message' => $cause->getMessage(),
- 'file' => 'unknown',
- 'line' => 'unknown');
- } elseif (is_array($cause) && isset($cause['message'])) {
- // PEAR_ErrorStack warning
- $causes[] = array(
- 'class' => $cause['package'],
- 'message' => $cause['message'],
- 'file' => isset($cause['context']['file']) ?
- $cause['context']['file'] :
- 'unknown',
- 'line' => isset($cause['context']['line']) ?
- $cause['context']['line'] :
- 'unknown',
- );
- }
- }
- }
- }
-
- public function getTraceSafe()
- {
- if (!isset($this->_trace)) {
- $this->_trace = $this->getTrace();
- if (empty($this->_trace)) {
- $backtrace = debug_backtrace();
- $this->_trace = array($backtrace[count($backtrace)-1]);
- }
- }
- return $this->_trace;
- }
-
- public function getErrorClass()
- {
- $trace = $this->getTraceSafe();
- return $trace[0]['class'];
- }
-
- public function getErrorMethod()
- {
- $trace = $this->getTraceSafe();
- return $trace[0]['function'];
- }
-
- public function __toString()
- {
- if (isset($_SERVER['REQUEST_URI'])) {
- return $this->toHtml();
- }
- return $this->toText();
- }
-
- public function toHtml()
- {
- $trace = $this->getTraceSafe();
- $causes = array();
- $this->getCauseMessage($causes);
- $html = '<table style="border: 1px" cellspacing="0">' . "\n";
- foreach ($causes as $i => $cause) {
- $html .= '<tr><td colspan="3" style="background: #ff9999">'
- . str_repeat('-', $i) . ' <b>' . $cause['class'] . '</b>: '
- . htmlspecialchars($cause['message']) . ' in <b>' . $cause['file'] . '</b> '
- . 'on line <b>' . $cause['line'] . '</b>'
- . "</td></tr>\n";
- }
- $html .= '<tr><td colspan="3" style="background-color: #aaaaaa; text-align: center; font-weight: bold;">Exception trace</td></tr>' . "\n"
- . '<tr><td style="text-align: center; background: #cccccc; width:20px; font-weight: bold;">#</td>'
- . '<td style="text-align: center; background: #cccccc; font-weight: bold;">Function</td>'
- . '<td style="text-align: center; background: #cccccc; font-weight: bold;">Location</td></tr>' . "\n";
-
- foreach ($trace as $k => $v) {
- $html .= '<tr><td style="text-align: center;">' . $k . '</td>'
- . '<td>';
- if (!empty($v['class'])) {
- $html .= $v['class'] . $v['type'];
- }
- $html .= $v['function'];
- $args = array();
- if (!empty($v['args'])) {
- foreach ($v['args'] as $arg) {
- if (is_null($arg)) $args[] = 'null';
- elseif (is_array($arg)) $args[] = 'Array';
- elseif (is_object($arg)) $args[] = 'Object('.get_class($arg).')';
- elseif (is_bool($arg)) $args[] = $arg ? 'true' : 'false';
- elseif (is_int($arg) || is_double($arg)) $args[] = $arg;
- else {
- $arg = (string)$arg;
- $str = htmlspecialchars(substr($arg, 0, 16));
- if (strlen($arg) > 16) $str .= '&hellip;';
- $args[] = "'" . $str . "'";
- }
- }
- }
- $html .= '(' . implode(', ',$args) . ')'
- . '</td>'
- . '<td>' . (isset($v['file']) ? $v['file'] : 'unknown')
- . ':' . (isset($v['line']) ? $v['line'] : 'unknown')
- . '</td></tr>' . "\n";
- }
- $html .= '<tr><td style="text-align: center;">' . ($k+1) . '</td>'
- . '<td>{main}</td>'
- . '<td>&nbsp;</td></tr>' . "\n"
- . '</table>';
- return $html;
- }
-
- public function toText()
- {
- $causes = array();
- $this->getCauseMessage($causes);
- $causeMsg = '';
- foreach ($causes as $i => $cause) {
- $causeMsg .= str_repeat(' ', $i) . $cause['class'] . ': '
- . $cause['message'] . ' in ' . $cause['file']
- . ' on line ' . $cause['line'] . "\n";
- }
- return $causeMsg . $this->getTraceAsString();
- }
-} \ No newline at end of file
diff --git a/3rdparty/PEAR/FixPHP5PEARWarnings.php b/3rdparty/PEAR/FixPHP5PEARWarnings.php
deleted file mode 100644
index be5dc3ce707..00000000000
--- a/3rdparty/PEAR/FixPHP5PEARWarnings.php
+++ /dev/null
@@ -1,7 +0,0 @@
-<?php
-if ($skipmsg) {
- $a = &new $ec($code, $mode, $options, $userinfo);
-} else {
- $a = &new $ec($message, $code, $mode, $options, $userinfo);
-}
-?> \ No newline at end of file
diff --git a/3rdparty/PEAR/Frontend.php b/3rdparty/PEAR/Frontend.php
deleted file mode 100644
index 531e541f9eb..00000000000
--- a/3rdparty/PEAR/Frontend.php
+++ /dev/null
@@ -1,228 +0,0 @@
-<?php
-/**
- * PEAR_Frontend, the singleton-based frontend for user input/output
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Frontend.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a1
- */
-
-/**
- * Include error handling
- */
-//require_once 'PEAR.php';
-
-/**
- * Which user interface class is being used.
- * @var string class name
- */
-$GLOBALS['_PEAR_FRONTEND_CLASS'] = 'PEAR_Frontend_CLI';
-
-/**
- * Instance of $_PEAR_Command_uiclass.
- * @var object
- */
-$GLOBALS['_PEAR_FRONTEND_SINGLETON'] = null;
-
-/**
- * Singleton-based frontend for PEAR user input/output
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a1
- */
-class PEAR_Frontend extends PEAR
-{
- /**
- * Retrieve the frontend object
- * @return PEAR_Frontend_CLI|PEAR_Frontend_Web|PEAR_Frontend_Gtk
- * @static
- */
- function &singleton($type = null)
- {
- if ($type === null) {
- if (!isset($GLOBALS['_PEAR_FRONTEND_SINGLETON'])) {
- $a = false;
- return $a;
- }
- return $GLOBALS['_PEAR_FRONTEND_SINGLETON'];
- }
-
- $a = PEAR_Frontend::setFrontendClass($type);
- return $a;
- }
-
- /**
- * Set the frontend class that will be used by calls to {@link singleton()}
- *
- * Frontends are expected to conform to the PEAR naming standard of
- * _ => DIRECTORY_SEPARATOR (PEAR_Frontend_CLI is in PEAR/Frontend/CLI.php)
- * @param string $uiclass full class name
- * @return PEAR_Frontend
- * @static
- */
- function &setFrontendClass($uiclass)
- {
- if (is_object($GLOBALS['_PEAR_FRONTEND_SINGLETON']) &&
- is_a($GLOBALS['_PEAR_FRONTEND_SINGLETON'], $uiclass)) {
- return $GLOBALS['_PEAR_FRONTEND_SINGLETON'];
- }
-
- if (!class_exists($uiclass)) {
- $file = str_replace('_', '/', $uiclass) . '.php';
- if (PEAR_Frontend::isIncludeable($file)) {
- include_once $file;
- }
- }
-
- if (class_exists($uiclass)) {
- $obj = &new $uiclass;
- // quick test to see if this class implements a few of the most
- // important frontend methods
- if (is_a($obj, 'PEAR_Frontend')) {
- $GLOBALS['_PEAR_FRONTEND_SINGLETON'] = &$obj;
- $GLOBALS['_PEAR_FRONTEND_CLASS'] = $uiclass;
- return $obj;
- }
-
- $err = PEAR::raiseError("not a frontend class: $uiclass");
- return $err;
- }
-
- $err = PEAR::raiseError("no such class: $uiclass");
- return $err;
- }
-
- /**
- * Set the frontend class that will be used by calls to {@link singleton()}
- *
- * Frontends are expected to be a descendant of PEAR_Frontend
- * @param PEAR_Frontend
- * @return PEAR_Frontend
- * @static
- */
- function &setFrontendObject($uiobject)
- {
- if (is_object($GLOBALS['_PEAR_FRONTEND_SINGLETON']) &&
- is_a($GLOBALS['_PEAR_FRONTEND_SINGLETON'], get_class($uiobject))) {
- return $GLOBALS['_PEAR_FRONTEND_SINGLETON'];
- }
-
- if (!is_a($uiobject, 'PEAR_Frontend')) {
- $err = PEAR::raiseError('not a valid frontend class: (' .
- get_class($uiobject) . ')');
- return $err;
- }
-
- $GLOBALS['_PEAR_FRONTEND_SINGLETON'] = &$uiobject;
- $GLOBALS['_PEAR_FRONTEND_CLASS'] = get_class($uiobject);
- return $uiobject;
- }
-
- /**
- * @param string $path relative or absolute include path
- * @return boolean
- * @static
- */
- function isIncludeable($path)
- {
- if (file_exists($path) && is_readable($path)) {
- return true;
- }
-
- $fp = @fopen($path, 'r', true);
- if ($fp) {
- fclose($fp);
- return true;
- }
-
- return false;
- }
-
- /**
- * @param PEAR_Config
- */
- function setConfig(&$config)
- {
- }
-
- /**
- * This can be overridden to allow session-based temporary file management
- *
- * By default, all files are deleted at the end of a session. The web installer
- * needs to be able to sustain a list over many sessions in order to support
- * user interaction with install scripts
- */
- function addTempFile($file)
- {
- $GLOBALS['_PEAR_Common_tempfiles'][] = $file;
- }
-
- /**
- * Log an action
- *
- * @param string $msg the message to log
- * @param boolean $append_crlf
- * @return boolean true
- * @abstract
- */
- function log($msg, $append_crlf = true)
- {
- }
-
- /**
- * Run a post-installation script
- *
- * @param array $scripts array of post-install scripts
- * @abstract
- */
- function runPostinstallScripts(&$scripts)
- {
- }
-
- /**
- * Display human-friendly output formatted depending on the
- * $command parameter.
- *
- * This should be able to handle basic output data with no command
- * @param mixed $data data structure containing the information to display
- * @param string $command command from which this method was called
- * @abstract
- */
- function outputData($data, $command = '_default')
- {
- }
-
- /**
- * Display a modal form dialog and return the given input
- *
- * A frontend that requires multiple requests to retrieve and process
- * data must take these needs into account, and implement the request
- * handling code.
- * @param string $command command from which this method was called
- * @param array $prompts associative array. keys are the input field names
- * and values are the description
- * @param array $types array of input field types (text, password,
- * etc.) keys have to be the same like in $prompts
- * @param array $defaults array of default values. again keys have
- * to be the same like in $prompts. Do not depend
- * on a default value being set.
- * @return array input sent by the user
- * @abstract
- */
- function userDialog($command, $prompts, $types = array(), $defaults = array())
- {
- }
-} \ No newline at end of file
diff --git a/3rdparty/PEAR/Frontend/CLI.php b/3rdparty/PEAR/Frontend/CLI.php
deleted file mode 100644
index 340b99b79b7..00000000000
--- a/3rdparty/PEAR/Frontend/CLI.php
+++ /dev/null
@@ -1,751 +0,0 @@
-<?php
-/**
- * PEAR_Frontend_CLI
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Stig Bakken <ssb@php.net>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: CLI.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 0.1
- */
-/**
- * base class
- */
-require_once 'PEAR/Frontend.php';
-
-/**
- * Command-line Frontend for the PEAR Installer
- * @category pear
- * @package PEAR
- * @author Stig Bakken <ssb@php.net>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 0.1
- */
-class PEAR_Frontend_CLI extends PEAR_Frontend
-{
- /**
- * What type of user interface this frontend is for.
- * @var string
- * @access public
- */
- var $type = 'CLI';
- var $lp = ''; // line prefix
-
- var $params = array();
- var $term = array(
- 'bold' => '',
- 'normal' => '',
- );
-
- function PEAR_Frontend_CLI()
- {
- parent::PEAR();
- $term = getenv('TERM'); //(cox) $_ENV is empty for me in 4.1.1
- if (function_exists('posix_isatty') && !posix_isatty(1)) {
- // output is being redirected to a file or through a pipe
- } elseif ($term) {
- if (preg_match('/^(xterm|vt220|linux)/', $term)) {
- $this->term['bold'] = sprintf("%c%c%c%c", 27, 91, 49, 109);
- $this->term['normal'] = sprintf("%c%c%c", 27, 91, 109);
- } elseif (preg_match('/^vt100/', $term)) {
- $this->term['bold'] = sprintf("%c%c%c%c%c%c", 27, 91, 49, 109, 0, 0);
- $this->term['normal'] = sprintf("%c%c%c%c%c", 27, 91, 109, 0, 0);
- }
- } elseif (OS_WINDOWS) {
- // XXX add ANSI codes here
- }
- }
-
- /**
- * @param object PEAR_Error object
- */
- function displayError($e)
- {
- return $this->_displayLine($e->getMessage());
- }
-
- /**
- * @param object PEAR_Error object
- */
- function displayFatalError($eobj)
- {
- $this->displayError($eobj);
- if (class_exists('PEAR_Config')) {
- $config = &PEAR_Config::singleton();
- if ($config->get('verbose') > 5) {
- if (function_exists('debug_print_backtrace')) {
- debug_print_backtrace();
- exit(1);
- }
-
- $raised = false;
- foreach (debug_backtrace() as $i => $frame) {
- if (!$raised) {
- if (isset($frame['class'])
- && strtolower($frame['class']) == 'pear'
- && strtolower($frame['function']) == 'raiseerror'
- ) {
- $raised = true;
- } else {
- continue;
- }
- }
-
- $frame['class'] = !isset($frame['class']) ? '' : $frame['class'];
- $frame['type'] = !isset($frame['type']) ? '' : $frame['type'];
- $frame['function'] = !isset($frame['function']) ? '' : $frame['function'];
- $frame['line'] = !isset($frame['line']) ? '' : $frame['line'];
- $this->_displayLine("#$i: $frame[class]$frame[type]$frame[function] $frame[line]");
- }
- }
- }
-
- exit(1);
- }
-
- /**
- * Instruct the runInstallScript method to skip a paramgroup that matches the
- * id value passed in.
- *
- * This method is useful for dynamically configuring which sections of a post-install script
- * will be run based on the user's setup, which is very useful for making flexible
- * post-install scripts without losing the cross-Frontend ability to retrieve user input
- * @param string
- */
- function skipParamgroup($id)
- {
- $this->_skipSections[$id] = true;
- }
-
- function runPostinstallScripts(&$scripts)
- {
- foreach ($scripts as $i => $script) {
- $this->runInstallScript($scripts[$i]->_params, $scripts[$i]->_obj);
- }
- }
-
- /**
- * @param array $xml contents of postinstallscript tag
- * @param object $script post-installation script
- * @param string install|upgrade
- */
- function runInstallScript($xml, &$script)
- {
- $this->_skipSections = array();
- if (!is_array($xml) || !isset($xml['paramgroup'])) {
- $script->run(array(), '_default');
- return;
- }
-
- $completedPhases = array();
- if (!isset($xml['paramgroup'][0])) {
- $xml['paramgroup'] = array($xml['paramgroup']);
- }
-
- foreach ($xml['paramgroup'] as $group) {
- if (isset($this->_skipSections[$group['id']])) {
- // the post-install script chose to skip this section dynamically
- continue;
- }
-
- if (isset($group['name'])) {
- $paramname = explode('::', $group['name']);
- if ($lastgroup['id'] != $paramname[0]) {
- continue;
- }
-
- $group['name'] = $paramname[1];
- if (!isset($answers)) {
- return;
- }
-
- if (isset($answers[$group['name']])) {
- switch ($group['conditiontype']) {
- case '=' :
- if ($answers[$group['name']] != $group['value']) {
- continue 2;
- }
- break;
- case '!=' :
- if ($answers[$group['name']] == $group['value']) {
- continue 2;
- }
- break;
- case 'preg_match' :
- if (!@preg_match('/' . $group['value'] . '/',
- $answers[$group['name']])) {
- continue 2;
- }
- break;
- default :
- return;
- }
- }
- }
-
- $lastgroup = $group;
- if (isset($group['instructions'])) {
- $this->_display($group['instructions']);
- }
-
- if (!isset($group['param'][0])) {
- $group['param'] = array($group['param']);
- }
-
- if (isset($group['param'])) {
- if (method_exists($script, 'postProcessPrompts')) {
- $prompts = $script->postProcessPrompts($group['param'], $group['id']);
- if (!is_array($prompts) || count($prompts) != count($group['param'])) {
- $this->outputData('postinstall', 'Error: post-install script did not ' .
- 'return proper post-processed prompts');
- $prompts = $group['param'];
- } else {
- foreach ($prompts as $i => $var) {
- if (!is_array($var) || !isset($var['prompt']) ||
- !isset($var['name']) ||
- ($var['name'] != $group['param'][$i]['name']) ||
- ($var['type'] != $group['param'][$i]['type'])
- ) {
- $this->outputData('postinstall', 'Error: post-install script ' .
- 'modified the variables or prompts, severe security risk. ' .
- 'Will instead use the defaults from the package.xml');
- $prompts = $group['param'];
- }
- }
- }
-
- $answers = $this->confirmDialog($prompts);
- } else {
- $answers = $this->confirmDialog($group['param']);
- }
- }
-
- if ((isset($answers) && $answers) || !isset($group['param'])) {
- if (!isset($answers)) {
- $answers = array();
- }
-
- array_unshift($completedPhases, $group['id']);
- if (!$script->run($answers, $group['id'])) {
- $script->run($completedPhases, '_undoOnError');
- return;
- }
- } else {
- $script->run($completedPhases, '_undoOnError');
- return;
- }
- }
- }
-
- /**
- * Ask for user input, confirm the answers and continue until the user is satisfied
- * @param array an array of arrays, format array('name' => 'paramname', 'prompt' =>
- * 'text to display', 'type' => 'string'[, default => 'default value'])
- * @return array
- */
- function confirmDialog($params)
- {
- $answers = $prompts = $types = array();
- foreach ($params as $param) {
- $prompts[$param['name']] = $param['prompt'];
- $types[$param['name']] = $param['type'];
- $answers[$param['name']] = isset($param['default']) ? $param['default'] : '';
- }
-
- $tried = false;
- do {
- if ($tried) {
- $i = 1;
- foreach ($answers as $var => $value) {
- if (!strlen($value)) {
- echo $this->bold("* Enter an answer for #" . $i . ": ({$prompts[$var]})\n");
- }
- $i++;
- }
- }
-
- $answers = $this->userDialog('', $prompts, $types, $answers);
- $tried = true;
- } while (is_array($answers) && count(array_filter($answers)) != count($prompts));
-
- return $answers;
- }
-
- function userDialog($command, $prompts, $types = array(), $defaults = array(), $screensize = 20)
- {
- if (!is_array($prompts)) {
- return array();
- }
-
- $testprompts = array_keys($prompts);
- $result = $defaults;
-
- reset($prompts);
- if (count($prompts) === 1) {
- foreach ($prompts as $key => $prompt) {
- $type = $types[$key];
- $default = @$defaults[$key];
- print "$prompt ";
- if ($default) {
- print "[$default] ";
- }
- print ": ";
-
- $line = fgets(STDIN, 2048);
- $result[$key] = ($default && trim($line) == '') ? $default : trim($line);
- }
-
- return $result;
- }
-
- $first_run = true;
- while (true) {
- $descLength = max(array_map('strlen', $prompts));
- $descFormat = "%-{$descLength}s";
- $last = count($prompts);
-
- $i = 0;
- foreach ($prompts as $n => $var) {
- $res = isset($result[$n]) ? $result[$n] : null;
- printf("%2d. $descFormat : %s\n", ++$i, $prompts[$n], $res);
- }
- print "\n1-$last, 'all', 'abort', or Enter to continue: ";
-
- $tmp = trim(fgets(STDIN, 1024));
- if (empty($tmp)) {
- break;
- }
-
- if ($tmp == 'abort') {
- return false;
- }
-
- if (isset($testprompts[(int)$tmp - 1])) {
- $var = $testprompts[(int)$tmp - 1];
- $desc = $prompts[$var];
- $current = @$result[$var];
- print "$desc [$current] : ";
- $tmp = trim(fgets(STDIN, 1024));
- if ($tmp !== '') {
- $result[$var] = $tmp;
- }
- } elseif ($tmp == 'all') {
- foreach ($prompts as $var => $desc) {
- $current = $result[$var];
- print "$desc [$current] : ";
- $tmp = trim(fgets(STDIN, 1024));
- if (trim($tmp) !== '') {
- $result[$var] = trim($tmp);
- }
- }
- }
-
- $first_run = false;
- }
-
- return $result;
- }
-
- function userConfirm($prompt, $default = 'yes')
- {
- trigger_error("PEAR_Frontend_CLI::userConfirm not yet converted", E_USER_ERROR);
- static $positives = array('y', 'yes', 'on', '1');
- static $negatives = array('n', 'no', 'off', '0');
- print "$this->lp$prompt [$default] : ";
- $fp = fopen("php://stdin", "r");
- $line = fgets($fp, 2048);
- fclose($fp);
- $answer = strtolower(trim($line));
- if (empty($answer)) {
- $answer = $default;
- }
- if (in_array($answer, $positives)) {
- return true;
- }
- if (in_array($answer, $negatives)) {
- return false;
- }
- if (in_array($default, $positives)) {
- return true;
- }
- return false;
- }
-
- function outputData($data, $command = '_default')
- {
- switch ($command) {
- case 'channel-info':
- foreach ($data as $type => $section) {
- if ($type == 'main') {
- $section['data'] = array_values($section['data']);
- }
-
- $this->outputData($section);
- }
- break;
- case 'install':
- case 'upgrade':
- case 'upgrade-all':
- if (is_array($data) && isset($data['release_warnings'])) {
- $this->_displayLine('');
- $this->_startTable(array(
- 'border' => false,
- 'caption' => 'Release Warnings'
- ));
- $this->_tableRow(array($data['release_warnings']), null, array(1 => array('wrap' => 55)));
- $this->_endTable();
- $this->_displayLine('');
- }
-
- $this->_displayLine(is_array($data) ? $data['data'] : $data);
- break;
- case 'search':
- $this->_startTable($data);
- if (isset($data['headline']) && is_array($data['headline'])) {
- $this->_tableRow($data['headline'], array('bold' => true), array(1 => array('wrap' => 55)));
- }
-
- $packages = array();
- foreach($data['data'] as $category) {
- foreach($category as $name => $pkg) {
- $packages[$pkg[0]] = $pkg;
- }
- }
-
- $p = array_keys($packages);
- natcasesort($p);
- foreach ($p as $name) {
- $this->_tableRow($packages[$name], null, array(1 => array('wrap' => 55)));
- }
-
- $this->_endTable();
- break;
- case 'list-all':
- if (!isset($data['data'])) {
- $this->_displayLine('No packages in channel');
- break;
- }
-
- $this->_startTable($data);
- if (isset($data['headline']) && is_array($data['headline'])) {
- $this->_tableRow($data['headline'], array('bold' => true), array(1 => array('wrap' => 55)));
- }
-
- $packages = array();
- foreach($data['data'] as $category) {
- foreach($category as $name => $pkg) {
- $packages[$pkg[0]] = $pkg;
- }
- }
-
- $p = array_keys($packages);
- natcasesort($p);
- foreach ($p as $name) {
- $pkg = $packages[$name];
- unset($pkg[4], $pkg[5]);
- $this->_tableRow($pkg, null, array(1 => array('wrap' => 55)));
- }
-
- $this->_endTable();
- break;
- case 'config-show':
- $data['border'] = false;
- $opts = array(
- 0 => array('wrap' => 30),
- 1 => array('wrap' => 20),
- 2 => array('wrap' => 35)
- );
-
- $this->_startTable($data);
- if (isset($data['headline']) && is_array($data['headline'])) {
- $this->_tableRow($data['headline'], array('bold' => true), $opts);
- }
-
- foreach ($data['data'] as $group) {
- foreach ($group as $value) {
- if ($value[2] == '') {
- $value[2] = "<not set>";
- }
-
- $this->_tableRow($value, null, $opts);
- }
- }
-
- $this->_endTable();
- break;
- case 'remote-info':
- $d = $data;
- $data = array(
- 'caption' => 'Package details:',
- 'border' => false,
- 'data' => array(
- array("Latest", $data['stable']),
- array("Installed", $data['installed']),
- array("Package", $data['name']),
- array("License", $data['license']),
- array("Category", $data['category']),
- array("Summary", $data['summary']),
- array("Description", $data['description']),
- ),
- );
-
- if (isset($d['deprecated']) && $d['deprecated']) {
- $conf = &PEAR_Config::singleton();
- $reg = $conf->getRegistry();
- $name = $reg->parsedPackageNameToString($d['deprecated'], true);
- $data['data'][] = array('Deprecated! use', $name);
- }
- default: {
- if (is_array($data)) {
- $this->_startTable($data);
- $count = count($data['data'][0]);
- if ($count == 2) {
- $opts = array(0 => array('wrap' => 25),
- 1 => array('wrap' => 48)
- );
- } elseif ($count == 3) {
- $opts = array(0 => array('wrap' => 30),
- 1 => array('wrap' => 20),
- 2 => array('wrap' => 35)
- );
- } else {
- $opts = null;
- }
- if (isset($data['headline']) && is_array($data['headline'])) {
- $this->_tableRow($data['headline'],
- array('bold' => true),
- $opts);
- }
-
- if (is_array($data['data'])) {
- foreach($data['data'] as $row) {
- $this->_tableRow($row, null, $opts);
- }
- } else {
- $this->_tableRow(array($data['data']), null, $opts);
- }
- $this->_endTable();
- } else {
- $this->_displayLine($data);
- }
- }
- }
- }
-
- function log($text, $append_crlf = true)
- {
- if ($append_crlf) {
- return $this->_displayLine($text);
- }
-
- return $this->_display($text);
- }
-
- function bold($text)
- {
- if (empty($this->term['bold'])) {
- return strtoupper($text);
- }
-
- return $this->term['bold'] . $text . $this->term['normal'];
- }
-
- function _displayHeading($title)
- {
- print $this->lp.$this->bold($title)."\n";
- print $this->lp.str_repeat("=", strlen($title))."\n";
- }
-
- function _startTable($params = array())
- {
- $params['table_data'] = array();
- $params['widest'] = array(); // indexed by column
- $params['highest'] = array(); // indexed by row
- $params['ncols'] = 0;
- $this->params = $params;
- }
-
- function _tableRow($columns, $rowparams = array(), $colparams = array())
- {
- $highest = 1;
- for ($i = 0; $i < count($columns); $i++) {
- $col = &$columns[$i];
- if (isset($colparams[$i]) && !empty($colparams[$i]['wrap'])) {
- $col = wordwrap($col, $colparams[$i]['wrap']);
- }
-
- if (strpos($col, "\n") !== false) {
- $multiline = explode("\n", $col);
- $w = 0;
- foreach ($multiline as $n => $line) {
- $len = strlen($line);
- if ($len > $w) {
- $w = $len;
- }
- }
- $lines = count($multiline);
- } else {
- $w = strlen($col);
- }
-
- if (isset($this->params['widest'][$i])) {
- if ($w > $this->params['widest'][$i]) {
- $this->params['widest'][$i] = $w;
- }
- } else {
- $this->params['widest'][$i] = $w;
- }
-
- $tmp = count_chars($columns[$i], 1);
- // handle unix, mac and windows formats
- $lines = (isset($tmp[10]) ? $tmp[10] : (isset($tmp[13]) ? $tmp[13] : 0)) + 1;
- if ($lines > $highest) {
- $highest = $lines;
- }
- }
-
- if (count($columns) > $this->params['ncols']) {
- $this->params['ncols'] = count($columns);
- }
-
- $new_row = array(
- 'data' => $columns,
- 'height' => $highest,
- 'rowparams' => $rowparams,
- 'colparams' => $colparams,
- );
- $this->params['table_data'][] = $new_row;
- }
-
- function _endTable()
- {
- extract($this->params);
- if (!empty($caption)) {
- $this->_displayHeading($caption);
- }
-
- if (count($table_data) === 0) {
- return;
- }
-
- if (!isset($width)) {
- $width = $widest;
- } else {
- for ($i = 0; $i < $ncols; $i++) {
- if (!isset($width[$i])) {
- $width[$i] = $widest[$i];
- }
- }
- }
-
- $border = false;
- if (empty($border)) {
- $cellstart = '';
- $cellend = ' ';
- $rowend = '';
- $padrowend = false;
- $borderline = '';
- } else {
- $cellstart = '| ';
- $cellend = ' ';
- $rowend = '|';
- $padrowend = true;
- $borderline = '+';
- foreach ($width as $w) {
- $borderline .= str_repeat('-', $w + strlen($cellstart) + strlen($cellend) - 1);
- $borderline .= '+';
- }
- }
-
- if ($borderline) {
- $this->_displayLine($borderline);
- }
-
- for ($i = 0; $i < count($table_data); $i++) {
- extract($table_data[$i]);
- if (!is_array($rowparams)) {
- $rowparams = array();
- }
-
- if (!is_array($colparams)) {
- $colparams = array();
- }
-
- $rowlines = array();
- if ($height > 1) {
- for ($c = 0; $c < count($data); $c++) {
- $rowlines[$c] = preg_split('/(\r?\n|\r)/', $data[$c]);
- if (count($rowlines[$c]) < $height) {
- $rowlines[$c] = array_pad($rowlines[$c], $height, '');
- }
- }
- } else {
- for ($c = 0; $c < count($data); $c++) {
- $rowlines[$c] = array($data[$c]);
- }
- }
-
- for ($r = 0; $r < $height; $r++) {
- $rowtext = '';
- for ($c = 0; $c < count($data); $c++) {
- if (isset($colparams[$c])) {
- $attribs = array_merge($rowparams, $colparams);
- } else {
- $attribs = $rowparams;
- }
-
- $w = isset($width[$c]) ? $width[$c] : 0;
- //$cell = $data[$c];
- $cell = $rowlines[$c][$r];
- $l = strlen($cell);
- if ($l > $w) {
- $cell = substr($cell, 0, $w);
- }
-
- if (isset($attribs['bold'])) {
- $cell = $this->bold($cell);
- }
-
- if ($l < $w) {
- // not using str_pad here because we may
- // add bold escape characters to $cell
- $cell .= str_repeat(' ', $w - $l);
- }
-
- $rowtext .= $cellstart . $cell . $cellend;
- }
-
- if (!$border) {
- $rowtext = rtrim($rowtext);
- }
-
- $rowtext .= $rowend;
- $this->_displayLine($rowtext);
- }
- }
-
- if ($borderline) {
- $this->_displayLine($borderline);
- }
- }
-
- function _displayLine($text)
- {
- print "$this->lp$text\n";
- }
-
- function _display($text)
- {
- print $text;
- }
-} \ No newline at end of file
diff --git a/3rdparty/PEAR/Installer.php b/3rdparty/PEAR/Installer.php
deleted file mode 100644
index eb17ca7914d..00000000000
--- a/3rdparty/PEAR/Installer.php
+++ /dev/null
@@ -1,1823 +0,0 @@
-<?php
-/**
- * PEAR_Installer
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Stig Bakken <ssb@php.net>
- * @author Tomas V.V. Cox <cox@idecnet.com>
- * @author Martin Jansen <mj@php.net>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Installer.php 313024 2011-07-06 19:51:24Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 0.1
- */
-
-/**
- * Used for installation groups in package.xml 2.0 and platform exceptions
- */
-require_once 'OS/Guess.php';
-require_once 'PEAR/Downloader.php';
-
-define('PEAR_INSTALLER_NOBINARY', -240);
-/**
- * Administration class used to install PEAR packages and maintain the
- * installed package database.
- *
- * @category pear
- * @package PEAR
- * @author Stig Bakken <ssb@php.net>
- * @author Tomas V.V. Cox <cox@idecnet.com>
- * @author Martin Jansen <mj@php.net>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 0.1
- */
-class PEAR_Installer extends PEAR_Downloader
-{
- // {{{ properties
-
- /** name of the package directory, for example Foo-1.0
- * @var string
- */
- var $pkgdir;
-
- /** directory where PHP code files go
- * @var string
- */
- var $phpdir;
-
- /** directory where PHP extension files go
- * @var string
- */
- var $extdir;
-
- /** directory where documentation goes
- * @var string
- */
- var $docdir;
-
- /** installation root directory (ala PHP's INSTALL_ROOT or
- * automake's DESTDIR
- * @var string
- */
- var $installroot = '';
-
- /** debug level
- * @var int
- */
- var $debug = 1;
-
- /** temporary directory
- * @var string
- */
- var $tmpdir;
-
- /**
- * PEAR_Registry object used by the installer
- * @var PEAR_Registry
- */
- var $registry;
-
- /**
- * array of PEAR_Downloader_Packages
- * @var array
- */
- var $_downloadedPackages;
-
- /** List of file transactions queued for an install/upgrade/uninstall.
- *
- * Format:
- * array(
- * 0 => array("rename => array("from-file", "to-file")),
- * 1 => array("delete" => array("file-to-delete")),
- * ...
- * )
- *
- * @var array
- */
- var $file_operations = array();
-
- // }}}
-
- // {{{ constructor
-
- /**
- * PEAR_Installer constructor.
- *
- * @param object $ui user interface object (instance of PEAR_Frontend_*)
- *
- * @access public
- */
- function PEAR_Installer(&$ui)
- {
- parent::PEAR_Common();
- $this->setFrontendObject($ui);
- $this->debug = $this->config->get('verbose');
- }
-
- function setOptions($options)
- {
- $this->_options = $options;
- }
-
- function setConfig(&$config)
- {
- $this->config = &$config;
- $this->_registry = &$config->getRegistry();
- }
-
- // }}}
-
- function _removeBackups($files)
- {
- foreach ($files as $path) {
- $this->addFileOperation('removebackup', array($path));
- }
- }
-
- // {{{ _deletePackageFiles()
-
- /**
- * Delete a package's installed files, does not remove empty directories.
- *
- * @param string package name
- * @param string channel name
- * @param bool if true, then files are backed up first
- * @return bool TRUE on success, or a PEAR error on failure
- * @access protected
- */
- function _deletePackageFiles($package, $channel = false, $backup = false)
- {
- if (!$channel) {
- $channel = 'pear.php.net';
- }
-
- if (!strlen($package)) {
- return $this->raiseError("No package to uninstall given");
- }
-
- if (strtolower($package) == 'pear' && $channel == 'pear.php.net') {
- // to avoid race conditions, include all possible needed files
- require_once 'PEAR/Task/Common.php';
- require_once 'PEAR/Task/Replace.php';
- require_once 'PEAR/Task/Unixeol.php';
- require_once 'PEAR/Task/Windowseol.php';
- require_once 'PEAR/PackageFile/v1.php';
- require_once 'PEAR/PackageFile/v2.php';
- require_once 'PEAR/PackageFile/Generator/v1.php';
- require_once 'PEAR/PackageFile/Generator/v2.php';
- }
-
- $filelist = $this->_registry->packageInfo($package, 'filelist', $channel);
- if ($filelist == null) {
- return $this->raiseError("$channel/$package not installed");
- }
-
- $ret = array();
- foreach ($filelist as $file => $props) {
- if (empty($props['installed_as'])) {
- continue;
- }
-
- $path = $props['installed_as'];
- if ($backup) {
- $this->addFileOperation('backup', array($path));
- $ret[] = $path;
- }
-
- $this->addFileOperation('delete', array($path));
- }
-
- if ($backup) {
- return $ret;
- }
-
- return true;
- }
-
- // }}}
- // {{{ _installFile()
-
- /**
- * @param string filename
- * @param array attributes from <file> tag in package.xml
- * @param string path to install the file in
- * @param array options from command-line
- * @access private
- */
- function _installFile($file, $atts, $tmp_path, $options)
- {
- // {{{ return if this file is meant for another platform
- static $os;
- if (!isset($this->_registry)) {
- $this->_registry = &$this->config->getRegistry();
- }
-
- if (isset($atts['platform'])) {
- if (empty($os)) {
- $os = new OS_Guess();
- }
-
- if (strlen($atts['platform']) && $atts['platform']{0} == '!') {
- $negate = true;
- $platform = substr($atts['platform'], 1);
- } else {
- $negate = false;
- $platform = $atts['platform'];
- }
-
- if ((bool) $os->matchSignature($platform) === $negate) {
- $this->log(3, "skipped $file (meant for $atts[platform], we are ".$os->getSignature().")");
- return PEAR_INSTALLER_SKIPPED;
- }
- }
- // }}}
-
- $channel = $this->pkginfo->getChannel();
- // {{{ assemble the destination paths
- switch ($atts['role']) {
- case 'src':
- case 'extsrc':
- $this->source_files++;
- return;
- case 'doc':
- case 'data':
- case 'test':
- $dest_dir = $this->config->get($atts['role'] . '_dir', null, $channel) .
- DIRECTORY_SEPARATOR . $this->pkginfo->getPackage();
- unset($atts['baseinstalldir']);
- break;
- case 'ext':
- case 'php':
- $dest_dir = $this->config->get($atts['role'] . '_dir', null, $channel);
- break;
- case 'script':
- $dest_dir = $this->config->get('bin_dir', null, $channel);
- break;
- default:
- return $this->raiseError("Invalid role `$atts[role]' for file $file");
- }
-
- $save_destdir = $dest_dir;
- if (!empty($atts['baseinstalldir'])) {
- $dest_dir .= DIRECTORY_SEPARATOR . $atts['baseinstalldir'];
- }
-
- if (dirname($file) != '.' && empty($atts['install-as'])) {
- $dest_dir .= DIRECTORY_SEPARATOR . dirname($file);
- }
-
- if (empty($atts['install-as'])) {
- $dest_file = $dest_dir . DIRECTORY_SEPARATOR . basename($file);
- } else {
- $dest_file = $dest_dir . DIRECTORY_SEPARATOR . $atts['install-as'];
- }
- $orig_file = $tmp_path . DIRECTORY_SEPARATOR . $file;
-
- // Clean up the DIRECTORY_SEPARATOR mess
- $ds2 = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR;
- list($dest_file, $orig_file) = preg_replace(array('!\\\\+!', '!/!', "!$ds2+!"),
- array(DIRECTORY_SEPARATOR,
- DIRECTORY_SEPARATOR,
- DIRECTORY_SEPARATOR),
- array($dest_file, $orig_file));
- $final_dest_file = $installed_as = $dest_file;
- if (isset($this->_options['packagingroot'])) {
- $installedas_dest_dir = dirname($final_dest_file);
- $installedas_dest_file = $dest_dir . DIRECTORY_SEPARATOR . '.tmp' . basename($final_dest_file);
- $final_dest_file = $this->_prependPath($final_dest_file, $this->_options['packagingroot']);
- } else {
- $installedas_dest_dir = dirname($final_dest_file);
- $installedas_dest_file = $installedas_dest_dir . DIRECTORY_SEPARATOR . '.tmp' . basename($final_dest_file);
- }
-
- $dest_dir = dirname($final_dest_file);
- $dest_file = $dest_dir . DIRECTORY_SEPARATOR . '.tmp' . basename($final_dest_file);
- if (preg_match('~/\.\.(/|\\z)|^\.\./~', str_replace('\\', '/', $dest_file))) {
- return $this->raiseError("SECURITY ERROR: file $file (installed to $dest_file) contains parent directory reference ..", PEAR_INSTALLER_FAILED);
- }
- // }}}
-
- if (empty($this->_options['register-only']) &&
- (!file_exists($dest_dir) || !is_dir($dest_dir))) {
- if (!$this->mkDirHier($dest_dir)) {
- return $this->raiseError("failed to mkdir $dest_dir",
- PEAR_INSTALLER_FAILED);
- }
- $this->log(3, "+ mkdir $dest_dir");
- }
-
- // pretty much nothing happens if we are only registering the install
- if (empty($this->_options['register-only'])) {
- if (empty($atts['replacements'])) {
- if (!file_exists($orig_file)) {
- return $this->raiseError("file $orig_file does not exist",
- PEAR_INSTALLER_FAILED);
- }
-
- if (!@copy($orig_file, $dest_file)) {
- return $this->raiseError("failed to write $dest_file: $php_errormsg",
- PEAR_INSTALLER_FAILED);
- }
-
- $this->log(3, "+ cp $orig_file $dest_file");
- if (isset($atts['md5sum'])) {
- $md5sum = md5_file($dest_file);
- }
- } else {
- // {{{ file with replacements
- if (!file_exists($orig_file)) {
- return $this->raiseError("file does not exist",
- PEAR_INSTALLER_FAILED);
- }
-
- $contents = file_get_contents($orig_file);
- if ($contents === false) {
- $contents = '';
- }
-
- if (isset($atts['md5sum'])) {
- $md5sum = md5($contents);
- }
-
- $subst_from = $subst_to = array();
- foreach ($atts['replacements'] as $a) {
- $to = '';
- if ($a['type'] == 'php-const') {
- if (preg_match('/^[a-z0-9_]+\\z/i', $a['to'])) {
- eval("\$to = $a[to];");
- } else {
- if (!isset($options['soft'])) {
- $this->log(0, "invalid php-const replacement: $a[to]");
- }
- continue;
- }
- } elseif ($a['type'] == 'pear-config') {
- if ($a['to'] == 'master_server') {
- $chan = $this->_registry->getChannel($channel);
- if (!PEAR::isError($chan)) {
- $to = $chan->getServer();
- } else {
- $to = $this->config->get($a['to'], null, $channel);
- }
- } else {
- $to = $this->config->get($a['to'], null, $channel);
- }
- if (is_null($to)) {
- if (!isset($options['soft'])) {
- $this->log(0, "invalid pear-config replacement: $a[to]");
- }
- continue;
- }
- } elseif ($a['type'] == 'package-info') {
- if ($t = $this->pkginfo->packageInfo($a['to'])) {
- $to = $t;
- } else {
- if (!isset($options['soft'])) {
- $this->log(0, "invalid package-info replacement: $a[to]");
- }
- continue;
- }
- }
- if (!is_null($to)) {
- $subst_from[] = $a['from'];
- $subst_to[] = $to;
- }
- }
-
- $this->log(3, "doing ".sizeof($subst_from)." substitution(s) for $final_dest_file");
- if (sizeof($subst_from)) {
- $contents = str_replace($subst_from, $subst_to, $contents);
- }
-
- $wp = @fopen($dest_file, "wb");
- if (!is_resource($wp)) {
- return $this->raiseError("failed to create $dest_file: $php_errormsg",
- PEAR_INSTALLER_FAILED);
- }
-
- if (@fwrite($wp, $contents) === false) {
- return $this->raiseError("failed writing to $dest_file: $php_errormsg",
- PEAR_INSTALLER_FAILED);
- }
-
- fclose($wp);
- // }}}
- }
-
- // {{{ check the md5
- if (isset($md5sum)) {
- if (strtolower($md5sum) === strtolower($atts['md5sum'])) {
- $this->log(2, "md5sum ok: $final_dest_file");
- } else {
- if (empty($options['force'])) {
- // delete the file
- if (file_exists($dest_file)) {
- unlink($dest_file);
- }
-
- if (!isset($options['ignore-errors'])) {
- return $this->raiseError("bad md5sum for file $final_dest_file",
- PEAR_INSTALLER_FAILED);
- }
-
- if (!isset($options['soft'])) {
- $this->log(0, "warning : bad md5sum for file $final_dest_file");
- }
- } else {
- if (!isset($options['soft'])) {
- $this->log(0, "warning : bad md5sum for file $final_dest_file");
- }
- }
- }
- }
- // }}}
- // {{{ set file permissions
- if (!OS_WINDOWS) {
- if ($atts['role'] == 'script') {
- $mode = 0777 & ~(int)octdec($this->config->get('umask'));
- $this->log(3, "+ chmod +x $dest_file");
- } else {
- $mode = 0666 & ~(int)octdec($this->config->get('umask'));
- }
-
- if ($atts['role'] != 'src') {
- $this->addFileOperation("chmod", array($mode, $dest_file));
- if (!@chmod($dest_file, $mode)) {
- if (!isset($options['soft'])) {
- $this->log(0, "failed to change mode of $dest_file: $php_errormsg");
- }
- }
- }
- }
- // }}}
-
- if ($atts['role'] == 'src') {
- rename($dest_file, $final_dest_file);
- $this->log(2, "renamed source file $dest_file to $final_dest_file");
- } else {
- $this->addFileOperation("rename", array($dest_file, $final_dest_file,
- $atts['role'] == 'ext'));
- }
- }
-
- // Store the full path where the file was installed for easy unistall
- if ($atts['role'] != 'script') {
- $loc = $this->config->get($atts['role'] . '_dir');
- } else {
- $loc = $this->config->get('bin_dir');
- }
-
- if ($atts['role'] != 'src') {
- $this->addFileOperation("installed_as", array($file, $installed_as,
- $loc,
- dirname(substr($installedas_dest_file, strlen($loc)))));
- }
-
- //$this->log(2, "installed: $dest_file");
- return PEAR_INSTALLER_OK;
- }
-
- // }}}
- // {{{ _installFile2()
-
- /**
- * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2
- * @param string filename
- * @param array attributes from <file> tag in package.xml
- * @param string path to install the file in
- * @param array options from command-line
- * @access private
- */
- function _installFile2(&$pkg, $file, &$real_atts, $tmp_path, $options)
- {
- $atts = $real_atts;
- if (!isset($this->_registry)) {
- $this->_registry = &$this->config->getRegistry();
- }
-
- $channel = $pkg->getChannel();
- // {{{ assemble the destination paths
- if (!in_array($atts['attribs']['role'],
- PEAR_Installer_Role::getValidRoles($pkg->getPackageType()))) {
- return $this->raiseError('Invalid role `' . $atts['attribs']['role'] .
- "' for file $file");
- }
-
- $role = &PEAR_Installer_Role::factory($pkg, $atts['attribs']['role'], $this->config);
- $err = $role->setup($this, $pkg, $atts['attribs'], $file);
- if (PEAR::isError($err)) {
- return $err;
- }
-
- if (!$role->isInstallable()) {
- return;
- }
-
- $info = $role->processInstallation($pkg, $atts['attribs'], $file, $tmp_path);
- if (PEAR::isError($info)) {
- return $info;
- }
-
- list($save_destdir, $dest_dir, $dest_file, $orig_file) = $info;
- if (preg_match('~/\.\.(/|\\z)|^\.\./~', str_replace('\\', '/', $dest_file))) {
- return $this->raiseError("SECURITY ERROR: file $file (installed to $dest_file) contains parent directory reference ..", PEAR_INSTALLER_FAILED);
- }
-
- $final_dest_file = $installed_as = $dest_file;
- if (isset($this->_options['packagingroot'])) {
- $final_dest_file = $this->_prependPath($final_dest_file,
- $this->_options['packagingroot']);
- }
-
- $dest_dir = dirname($final_dest_file);
- $dest_file = $dest_dir . DIRECTORY_SEPARATOR . '.tmp' . basename($final_dest_file);
- // }}}
-
- if (empty($this->_options['register-only'])) {
- if (!file_exists($dest_dir) || !is_dir($dest_dir)) {
- if (!$this->mkDirHier($dest_dir)) {
- return $this->raiseError("failed to mkdir $dest_dir",
- PEAR_INSTALLER_FAILED);
- }
- $this->log(3, "+ mkdir $dest_dir");
- }
- }
-
- $attribs = $atts['attribs'];
- unset($atts['attribs']);
- // pretty much nothing happens if we are only registering the install
- if (empty($this->_options['register-only'])) {
- if (!count($atts)) { // no tasks
- if (!file_exists($orig_file)) {
- return $this->raiseError("file $orig_file does not exist",
- PEAR_INSTALLER_FAILED);
- }
-
- if (!@copy($orig_file, $dest_file)) {
- return $this->raiseError("failed to write $dest_file: $php_errormsg",
- PEAR_INSTALLER_FAILED);
- }
-
- $this->log(3, "+ cp $orig_file $dest_file");
- if (isset($attribs['md5sum'])) {
- $md5sum = md5_file($dest_file);
- }
- } else { // file with tasks
- if (!file_exists($orig_file)) {
- return $this->raiseError("file $orig_file does not exist",
- PEAR_INSTALLER_FAILED);
- }
-
- $contents = file_get_contents($orig_file);
- if ($contents === false) {
- $contents = '';
- }
-
- if (isset($attribs['md5sum'])) {
- $md5sum = md5($contents);
- }
-
- foreach ($atts as $tag => $raw) {
- $tag = str_replace(array($pkg->getTasksNs() . ':', '-'), array('', '_'), $tag);
- $task = "PEAR_Task_$tag";
- $task = &new $task($this->config, $this, PEAR_TASK_INSTALL);
- if (!$task->isScript()) { // scripts are only handled after installation
- $task->init($raw, $attribs, $pkg->getLastInstalledVersion());
- $res = $task->startSession($pkg, $contents, $final_dest_file);
- if ($res === false) {
- continue; // skip this file
- }
-
- if (PEAR::isError($res)) {
- return $res;
- }
-
- $contents = $res; // save changes
- }
-
- $wp = @fopen($dest_file, "wb");
- if (!is_resource($wp)) {
- return $this->raiseError("failed to create $dest_file: $php_errormsg",
- PEAR_INSTALLER_FAILED);
- }
-
- if (fwrite($wp, $contents) === false) {
- return $this->raiseError("failed writing to $dest_file: $php_errormsg",
- PEAR_INSTALLER_FAILED);
- }
-
- fclose($wp);
- }
- }
-
- // {{{ check the md5
- if (isset($md5sum)) {
- // Make sure the original md5 sum matches with expected
- if (strtolower($md5sum) === strtolower($attribs['md5sum'])) {
- $this->log(2, "md5sum ok: $final_dest_file");
-
- if (isset($contents)) {
- // set md5 sum based on $content in case any tasks were run.
- $real_atts['attribs']['md5sum'] = md5($contents);
- }
- } else {
- if (empty($options['force'])) {
- // delete the file
- if (file_exists($dest_file)) {
- unlink($dest_file);
- }
-
- if (!isset($options['ignore-errors'])) {
- return $this->raiseError("bad md5sum for file $final_dest_file",
- PEAR_INSTALLER_FAILED);
- }
-
- if (!isset($options['soft'])) {
- $this->log(0, "warning : bad md5sum for file $final_dest_file");
- }
- } else {
- if (!isset($options['soft'])) {
- $this->log(0, "warning : bad md5sum for file $final_dest_file");
- }
- }
- }
- } else {
- $real_atts['attribs']['md5sum'] = md5_file($dest_file);
- }
-
- // }}}
- // {{{ set file permissions
- if (!OS_WINDOWS) {
- if ($role->isExecutable()) {
- $mode = 0777 & ~(int)octdec($this->config->get('umask'));
- $this->log(3, "+ chmod +x $dest_file");
- } else {
- $mode = 0666 & ~(int)octdec($this->config->get('umask'));
- }
-
- if ($attribs['role'] != 'src') {
- $this->addFileOperation("chmod", array($mode, $dest_file));
- if (!@chmod($dest_file, $mode)) {
- if (!isset($options['soft'])) {
- $this->log(0, "failed to change mode of $dest_file: $php_errormsg");
- }
- }
- }
- }
- // }}}
-
- if ($attribs['role'] == 'src') {
- rename($dest_file, $final_dest_file);
- $this->log(2, "renamed source file $dest_file to $final_dest_file");
- } else {
- $this->addFileOperation("rename", array($dest_file, $final_dest_file, $role->isExtension()));
- }
- }
-
- // Store the full path where the file was installed for easy uninstall
- if ($attribs['role'] != 'src') {
- $loc = $this->config->get($role->getLocationConfig(), null, $channel);
- $this->addFileOperation('installed_as', array($file, $installed_as,
- $loc,
- dirname(substr($installed_as, strlen($loc)))));
- }
-
- //$this->log(2, "installed: $dest_file");
- return PEAR_INSTALLER_OK;
- }
-
- // }}}
- // {{{ addFileOperation()
-
- /**
- * Add a file operation to the current file transaction.
- *
- * @see startFileTransaction()
- * @param string $type This can be one of:
- * - rename: rename a file ($data has 3 values)
- * - backup: backup an existing file ($data has 1 value)
- * - removebackup: clean up backups created during install ($data has 1 value)
- * - chmod: change permissions on a file ($data has 2 values)
- * - delete: delete a file ($data has 1 value)
- * - rmdir: delete a directory if empty ($data has 1 value)
- * - installed_as: mark a file as installed ($data has 4 values).
- * @param array $data For all file operations, this array must contain the
- * full path to the file or directory that is being operated on. For
- * the rename command, the first parameter must be the file to rename,
- * the second its new name, the third whether this is a PHP extension.
- *
- * The installed_as operation contains 4 elements in this order:
- * 1. Filename as listed in the filelist element from package.xml
- * 2. Full path to the installed file
- * 3. Full path from the php_dir configuration variable used in this
- * installation
- * 4. Relative path from the php_dir that this file is installed in
- */
- function addFileOperation($type, $data)
- {
- if (!is_array($data)) {
- return $this->raiseError('Internal Error: $data in addFileOperation'
- . ' must be an array, was ' . gettype($data));
- }
-
- if ($type == 'chmod') {
- $octmode = decoct($data[0]);
- $this->log(3, "adding to transaction: $type $octmode $data[1]");
- } else {
- $this->log(3, "adding to transaction: $type " . implode(" ", $data));
- }
- $this->file_operations[] = array($type, $data);
- }
-
- // }}}
- // {{{ startFileTransaction()
-
- function startFileTransaction($rollback_in_case = false)
- {
- if (count($this->file_operations) && $rollback_in_case) {
- $this->rollbackFileTransaction();
- }
- $this->file_operations = array();
- }
-
- // }}}
- // {{{ commitFileTransaction()
-
- function commitFileTransaction()
- {
- // {{{ first, check permissions and such manually
- $errors = array();
- foreach ($this->file_operations as $key => $tr) {
- list($type, $data) = $tr;
- switch ($type) {
- case 'rename':
- if (!file_exists($data[0])) {
- $errors[] = "cannot rename file $data[0], doesn't exist";
- }
-
- // check that dest dir. is writable
- if (!is_writable(dirname($data[1]))) {
- $errors[] = "permission denied ($type): $data[1]";
- }
- break;
- case 'chmod':
- // check that file is writable
- if (!is_writable($data[1])) {
- $errors[] = "permission denied ($type): $data[1] " . decoct($data[0]);
- }
- break;
- case 'delete':
- if (!file_exists($data[0])) {
- $this->log(2, "warning: file $data[0] doesn't exist, can't be deleted");
- }
- // check that directory is writable
- if (file_exists($data[0])) {
- if (!is_writable(dirname($data[0]))) {
- $errors[] = "permission denied ($type): $data[0]";
- } else {
- // make sure the file to be deleted can be opened for writing
- $fp = false;
- if (!is_dir($data[0]) &&
- (!is_writable($data[0]) || !($fp = @fopen($data[0], 'a')))) {
- $errors[] = "permission denied ($type): $data[0]";
- } elseif ($fp) {
- fclose($fp);
- }
- }
-
- /* Verify we are not deleting a file owned by another package
- * This can happen when a file moves from package A to B in
- * an upgrade ala http://pear.php.net/17986
- */
- $info = array(
- 'package' => strtolower($this->pkginfo->getName()),
- 'channel' => strtolower($this->pkginfo->getChannel()),
- );
- $result = $this->_registry->checkFileMap($data[0], $info, '1.1');
- if (is_array($result)) {
- $res = array_diff($result, $info);
- if (!empty($res)) {
- $new = $this->_registry->getPackage($result[1], $result[0]);
- $this->file_operations[$key] = false;
- $this->log(3, "file $data[0] was scheduled for removal from {$this->pkginfo->getName()} but is owned by {$new->getChannel()}/{$new->getName()}, removal has been cancelled.");
- }
- }
- }
- break;
- }
-
- }
- // }}}
-
- $n = count($this->file_operations);
- $this->log(2, "about to commit $n file operations for " . $this->pkginfo->getName());
-
- $m = count($errors);
- if ($m > 0) {
- foreach ($errors as $error) {
- if (!isset($this->_options['soft'])) {
- $this->log(1, $error);
- }
- }
-
- if (!isset($this->_options['ignore-errors'])) {
- return false;
- }
- }
-
- $this->_dirtree = array();
- // {{{ really commit the transaction
- foreach ($this->file_operations as $i => $tr) {
- if (!$tr) {
- // support removal of non-existing backups
- continue;
- }
-
- list($type, $data) = $tr;
- switch ($type) {
- case 'backup':
- if (!file_exists($data[0])) {
- $this->file_operations[$i] = false;
- break;
- }
-
- if (!@copy($data[0], $data[0] . '.bak')) {
- $this->log(1, 'Could not copy ' . $data[0] . ' to ' . $data[0] .
- '.bak ' . $php_errormsg);
- return false;
- }
- $this->log(3, "+ backup $data[0] to $data[0].bak");
- break;
- case 'removebackup':
- if (file_exists($data[0] . '.bak') && is_writable($data[0] . '.bak')) {
- unlink($data[0] . '.bak');
- $this->log(3, "+ rm backup of $data[0] ($data[0].bak)");
- }
- break;
- case 'rename':
- $test = file_exists($data[1]) ? @unlink($data[1]) : null;
- if (!$test && file_exists($data[1])) {
- if ($data[2]) {
- $extra = ', this extension must be installed manually. Rename to "' .
- basename($data[1]) . '"';
- } else {
- $extra = '';
- }
-
- if (!isset($this->_options['soft'])) {
- $this->log(1, 'Could not delete ' . $data[1] . ', cannot rename ' .
- $data[0] . $extra);
- }
-
- if (!isset($this->_options['ignore-errors'])) {
- return false;
- }
- }
-
- // permissions issues with rename - copy() is far superior
- $perms = @fileperms($data[0]);
- if (!@copy($data[0], $data[1])) {
- $this->log(1, 'Could not rename ' . $data[0] . ' to ' . $data[1] .
- ' ' . $php_errormsg);
- return false;
- }
-
- // copy over permissions, otherwise they are lost
- @chmod($data[1], $perms);
- @unlink($data[0]);
- $this->log(3, "+ mv $data[0] $data[1]");
- break;
- case 'chmod':
- if (!@chmod($data[1], $data[0])) {
- $this->log(1, 'Could not chmod ' . $data[1] . ' to ' .
- decoct($data[0]) . ' ' . $php_errormsg);
- return false;
- }
-
- $octmode = decoct($data[0]);
- $this->log(3, "+ chmod $octmode $data[1]");
- break;
- case 'delete':
- if (file_exists($data[0])) {
- if (!@unlink($data[0])) {
- $this->log(1, 'Could not delete ' . $data[0] . ' ' .
- $php_errormsg);
- return false;
- }
- $this->log(3, "+ rm $data[0]");
- }
- break;
- case 'rmdir':
- if (file_exists($data[0])) {
- do {
- $testme = opendir($data[0]);
- while (false !== ($entry = readdir($testme))) {
- if ($entry == '.' || $entry == '..') {
- continue;
- }
- closedir($testme);
- break 2; // this directory is not empty and can't be
- // deleted
- }
-
- closedir($testme);
- if (!@rmdir($data[0])) {
- $this->log(1, 'Could not rmdir ' . $data[0] . ' ' .
- $php_errormsg);
- return false;
- }
- $this->log(3, "+ rmdir $data[0]");
- } while (false);
- }
- break;
- case 'installed_as':
- $this->pkginfo->setInstalledAs($data[0], $data[1]);
- if (!isset($this->_dirtree[dirname($data[1])])) {
- $this->_dirtree[dirname($data[1])] = true;
- $this->pkginfo->setDirtree(dirname($data[1]));
-
- while(!empty($data[3]) && dirname($data[3]) != $data[3] &&
- $data[3] != '/' && $data[3] != '\\') {
- $this->pkginfo->setDirtree($pp =
- $this->_prependPath($data[3], $data[2]));
- $this->_dirtree[$pp] = true;
- $data[3] = dirname($data[3]);
- }
- }
- break;
- }
- }
- // }}}
- $this->log(2, "successfully committed $n file operations");
- $this->file_operations = array();
- return true;
- }
-
- // }}}
- // {{{ rollbackFileTransaction()
-
- function rollbackFileTransaction()
- {
- $n = count($this->file_operations);
- $this->log(2, "rolling back $n file operations");
- foreach ($this->file_operations as $tr) {
- list($type, $data) = $tr;
- switch ($type) {
- case 'backup':
- if (file_exists($data[0] . '.bak')) {
- if (file_exists($data[0] && is_writable($data[0]))) {
- unlink($data[0]);
- }
- @copy($data[0] . '.bak', $data[0]);
- $this->log(3, "+ restore $data[0] from $data[0].bak");
- }
- break;
- case 'removebackup':
- if (file_exists($data[0] . '.bak') && is_writable($data[0] . '.bak')) {
- unlink($data[0] . '.bak');
- $this->log(3, "+ rm backup of $data[0] ($data[0].bak)");
- }
- break;
- case 'rename':
- @unlink($data[0]);
- $this->log(3, "+ rm $data[0]");
- break;
- case 'mkdir':
- @rmdir($data[0]);
- $this->log(3, "+ rmdir $data[0]");
- break;
- case 'chmod':
- break;
- case 'delete':
- break;
- case 'installed_as':
- $this->pkginfo->setInstalledAs($data[0], false);
- break;
- }
- }
- $this->pkginfo->resetDirtree();
- $this->file_operations = array();
- }
-
- // }}}
- // {{{ mkDirHier($dir)
-
- function mkDirHier($dir)
- {
- $this->addFileOperation('mkdir', array($dir));
- return parent::mkDirHier($dir);
- }
-
- // }}}
- // {{{ download()
-
- /**
- * Download any files and their dependencies, if necessary
- *
- * @param array a mixed list of package names, local files, or package.xml
- * @param PEAR_Config
- * @param array options from the command line
- * @param array this is the array that will be populated with packages to
- * install. Format of each entry:
- *
- * <code>
- * array('pkg' => 'package_name', 'file' => '/path/to/local/file',
- * 'info' => array() // parsed package.xml
- * );
- * </code>
- * @param array this will be populated with any error messages
- * @param false private recursion variable
- * @param false private recursion variable
- * @param false private recursion variable
- * @deprecated in favor of PEAR_Downloader
- */
- function download($packages, $options, &$config, &$installpackages,
- &$errors, $installed = false, $willinstall = false, $state = false)
- {
- // trickiness: initialize here
- parent::PEAR_Downloader($this->ui, $options, $config);
- $ret = parent::download($packages);
- $errors = $this->getErrorMsgs();
- $installpackages = $this->getDownloadedPackages();
- trigger_error("PEAR Warning: PEAR_Installer::download() is deprecated " .
- "in favor of PEAR_Downloader class", E_USER_WARNING);
- return $ret;
- }
-
- // }}}
- // {{{ _parsePackageXml()
-
- function _parsePackageXml(&$descfile)
- {
- // Parse xml file -----------------------------------------------
- $pkg = new PEAR_PackageFile($this->config, $this->debug);
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- $p = &$pkg->fromAnyFile($descfile, PEAR_VALIDATE_INSTALLING);
- PEAR::staticPopErrorHandling();
- if (PEAR::isError($p)) {
- if (is_array($p->getUserInfo())) {
- foreach ($p->getUserInfo() as $err) {
- $loglevel = $err['level'] == 'error' ? 0 : 1;
- if (!isset($this->_options['soft'])) {
- $this->log($loglevel, ucfirst($err['level']) . ': ' . $err['message']);
- }
- }
- }
- return $this->raiseError('Installation failed: invalid package file');
- }
-
- $descfile = $p->getPackageFile();
- return $p;
- }
-
- // }}}
- /**
- * Set the list of PEAR_Downloader_Package objects to allow more sane
- * dependency validation
- * @param array
- */
- function setDownloadedPackages(&$pkgs)
- {
- PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
- $err = $this->analyzeDependencies($pkgs);
- PEAR::popErrorHandling();
- if (PEAR::isError($err)) {
- return $err;
- }
- $this->_downloadedPackages = &$pkgs;
- }
-
- /**
- * Set the list of PEAR_Downloader_Package objects to allow more sane
- * dependency validation
- * @param array
- */
- function setUninstallPackages(&$pkgs)
- {
- $this->_downloadedPackages = &$pkgs;
- }
-
- function getInstallPackages()
- {
- return $this->_downloadedPackages;
- }
-
- // {{{ install()
-
- /**
- * Installs the files within the package file specified.
- *
- * @param string|PEAR_Downloader_Package $pkgfile path to the package file,
- * or a pre-initialized packagefile object
- * @param array $options
- * recognized options:
- * - installroot : optional prefix directory for installation
- * - force : force installation
- * - register-only : update registry but don't install files
- * - upgrade : upgrade existing install
- * - soft : fail silently
- * - nodeps : ignore dependency conflicts/missing dependencies
- * - alldeps : install all dependencies
- * - onlyreqdeps : install only required dependencies
- *
- * @return array|PEAR_Error package info if successful
- */
- function install($pkgfile, $options = array())
- {
- $this->_options = $options;
- $this->_registry = &$this->config->getRegistry();
- if (is_object($pkgfile)) {
- $dlpkg = &$pkgfile;
- $pkg = $pkgfile->getPackageFile();
- $pkgfile = $pkg->getArchiveFile();
- $descfile = $pkg->getPackageFile();
- } else {
- $descfile = $pkgfile;
- $pkg = $this->_parsePackageXml($descfile);
- if (PEAR::isError($pkg)) {
- return $pkg;
- }
- }
-
- $tmpdir = dirname($descfile);
- if (realpath($descfile) != realpath($pkgfile)) {
- // Use the temp_dir since $descfile can contain the download dir path
- $tmpdir = $this->config->get('temp_dir', null, 'pear.php.net');
- $tmpdir = System::mktemp('-d -t "' . $tmpdir . '"');
-
- $tar = new Archive_Tar($pkgfile);
- if (!$tar->extract($tmpdir)) {
- return $this->raiseError("unable to unpack $pkgfile");
- }
- }
-
- $pkgname = $pkg->getName();
- $channel = $pkg->getChannel();
- if (isset($this->_options['packagingroot'])) {
- $regdir = $this->_prependPath(
- $this->config->get('php_dir', null, 'pear.php.net'),
- $this->_options['packagingroot']);
-
- $packrootphp_dir = $this->_prependPath(
- $this->config->get('php_dir', null, $channel),
- $this->_options['packagingroot']);
- }
-
- if (isset($options['installroot'])) {
- $this->config->setInstallRoot($options['installroot']);
- $this->_registry = &$this->config->getRegistry();
- $installregistry = &$this->_registry;
- $this->installroot = ''; // all done automagically now
- $php_dir = $this->config->get('php_dir', null, $channel);
- } else {
- $this->config->setInstallRoot(false);
- $this->_registry = &$this->config->getRegistry();
- if (isset($this->_options['packagingroot'])) {
- $installregistry = &new PEAR_Registry($regdir);
- if (!$installregistry->channelExists($channel, true)) {
- // we need to fake a channel-discover of this channel
- $chanobj = $this->_registry->getChannel($channel, true);
- $installregistry->addChannel($chanobj);
- }
- $php_dir = $packrootphp_dir;
- } else {
- $installregistry = &$this->_registry;
- $php_dir = $this->config->get('php_dir', null, $channel);
- }
- $this->installroot = '';
- }
-
- // {{{ checks to do when not in "force" mode
- if (empty($options['force']) &&
- (file_exists($this->config->get('php_dir')) &&
- is_dir($this->config->get('php_dir')))) {
- $testp = $channel == 'pear.php.net' ? $pkgname : array($channel, $pkgname);
- $instfilelist = $pkg->getInstallationFileList(true);
- if (PEAR::isError($instfilelist)) {
- return $instfilelist;
- }
-
- // ensure we have the most accurate registry
- $installregistry->flushFileMap();
- $test = $installregistry->checkFileMap($instfilelist, $testp, '1.1');
- if (PEAR::isError($test)) {
- return $test;
- }
-
- if (sizeof($test)) {
- $pkgs = $this->getInstallPackages();
- $found = false;
- foreach ($pkgs as $param) {
- if ($pkg->isSubpackageOf($param)) {
- $found = true;
- break;
- }
- }
-
- if ($found) {
- // subpackages can conflict with earlier versions of parent packages
- $parentreg = $installregistry->packageInfo($param->getPackage(), null, $param->getChannel());
- $tmp = $test;
- foreach ($tmp as $file => $info) {
- if (is_array($info)) {
- if (strtolower($info[1]) == strtolower($param->getPackage()) &&
- strtolower($info[0]) == strtolower($param->getChannel())
- ) {
- if (isset($parentreg['filelist'][$file])) {
- unset($parentreg['filelist'][$file]);
- } else{
- $pos = strpos($file, '/');
- $basedir = substr($file, 0, $pos);
- $file2 = substr($file, $pos + 1);
- if (isset($parentreg['filelist'][$file2]['baseinstalldir'])
- && $parentreg['filelist'][$file2]['baseinstalldir'] === $basedir
- ) {
- unset($parentreg['filelist'][$file2]);
- }
- }
-
- unset($test[$file]);
- }
- } else {
- if (strtolower($param->getChannel()) != 'pear.php.net') {
- continue;
- }
-
- if (strtolower($info) == strtolower($param->getPackage())) {
- if (isset($parentreg['filelist'][$file])) {
- unset($parentreg['filelist'][$file]);
- } else{
- $pos = strpos($file, '/');
- $basedir = substr($file, 0, $pos);
- $file2 = substr($file, $pos + 1);
- if (isset($parentreg['filelist'][$file2]['baseinstalldir'])
- && $parentreg['filelist'][$file2]['baseinstalldir'] === $basedir
- ) {
- unset($parentreg['filelist'][$file2]);
- }
- }
-
- unset($test[$file]);
- }
- }
- }
-
- $pfk = &new PEAR_PackageFile($this->config);
- $parentpkg = &$pfk->fromArray($parentreg);
- $installregistry->updatePackage2($parentpkg);
- }
-
- if ($param->getChannel() == 'pecl.php.net' && isset($options['upgrade'])) {
- $tmp = $test;
- foreach ($tmp as $file => $info) {
- if (is_string($info)) {
- // pear.php.net packages are always stored as strings
- if (strtolower($info) == strtolower($param->getPackage())) {
- // upgrading existing package
- unset($test[$file]);
- }
- }
- }
- }
-
- if (count($test)) {
- $msg = "$channel/$pkgname: conflicting files found:\n";
- $longest = max(array_map("strlen", array_keys($test)));
- $fmt = "%${longest}s (%s)\n";
- foreach ($test as $file => $info) {
- if (!is_array($info)) {
- $info = array('pear.php.net', $info);
- }
- $info = $info[0] . '/' . $info[1];
- $msg .= sprintf($fmt, $file, $info);
- }
-
- if (!isset($options['ignore-errors'])) {
- return $this->raiseError($msg);
- }
-
- if (!isset($options['soft'])) {
- $this->log(0, "WARNING: $msg");
- }
- }
- }
- }
- // }}}
-
- $this->startFileTransaction();
-
- $usechannel = $channel;
- if ($channel == 'pecl.php.net') {
- $test = $installregistry->packageExists($pkgname, $channel);
- if (!$test) {
- $test = $installregistry->packageExists($pkgname, 'pear.php.net');
- $usechannel = 'pear.php.net';
- }
- } else {
- $test = $installregistry->packageExists($pkgname, $channel);
- }
-
- if (empty($options['upgrade']) && empty($options['soft'])) {
- // checks to do only when installing new packages
- if (empty($options['force']) && $test) {
- return $this->raiseError("$channel/$pkgname is already installed");
- }
- } else {
- // Upgrade
- if ($test) {
- $v1 = $installregistry->packageInfo($pkgname, 'version', $usechannel);
- $v2 = $pkg->getVersion();
- $cmp = version_compare("$v1", "$v2", 'gt');
- if (empty($options['force']) && !version_compare("$v2", "$v1", 'gt')) {
- return $this->raiseError("upgrade to a newer version ($v2 is not newer than $v1)");
- }
- }
- }
-
- // Do cleanups for upgrade and install, remove old release's files first
- if ($test && empty($options['register-only'])) {
- // when upgrading, remove old release's files first:
- if (PEAR::isError($err = $this->_deletePackageFiles($pkgname, $usechannel,
- true))) {
- if (!isset($options['ignore-errors'])) {
- return $this->raiseError($err);
- }
-
- if (!isset($options['soft'])) {
- $this->log(0, 'WARNING: ' . $err->getMessage());
- }
- } else {
- $backedup = $err;
- }
- }
-
- // {{{ Copy files to dest dir ---------------------------------------
-
- // info from the package it self we want to access from _installFile
- $this->pkginfo = &$pkg;
- // used to determine whether we should build any C code
- $this->source_files = 0;
-
- $savechannel = $this->config->get('default_channel');
- if (empty($options['register-only']) && !is_dir($php_dir)) {
- if (PEAR::isError(System::mkdir(array('-p'), $php_dir))) {
- return $this->raiseError("no installation destination directory '$php_dir'\n");
- }
- }
-
- if (substr($pkgfile, -4) != '.xml') {
- $tmpdir .= DIRECTORY_SEPARATOR . $pkgname . '-' . $pkg->getVersion();
- }
-
- $this->configSet('default_channel', $channel);
- // {{{ install files
-
- $ver = $pkg->getPackagexmlVersion();
- if (version_compare($ver, '2.0', '>=')) {
- $filelist = $pkg->getInstallationFilelist();
- } else {
- $filelist = $pkg->getFileList();
- }
-
- if (PEAR::isError($filelist)) {
- return $filelist;
- }
-
- $p = &$installregistry->getPackage($pkgname, $channel);
- $dirtree = (empty($options['register-only']) && $p) ? $p->getDirTree() : false;
-
- $pkg->resetFilelist();
- $pkg->setLastInstalledVersion($installregistry->packageInfo($pkg->getPackage(),
- 'version', $pkg->getChannel()));
- foreach ($filelist as $file => $atts) {
- $this->expectError(PEAR_INSTALLER_FAILED);
- if ($pkg->getPackagexmlVersion() == '1.0') {
- $res = $this->_installFile($file, $atts, $tmpdir, $options);
- } else {
- $res = $this->_installFile2($pkg, $file, $atts, $tmpdir, $options);
- }
- $this->popExpect();
-
- if (PEAR::isError($res)) {
- if (empty($options['ignore-errors'])) {
- $this->rollbackFileTransaction();
- if ($res->getMessage() == "file does not exist") {
- $this->raiseError("file $file in package.xml does not exist");
- }
-
- return $this->raiseError($res);
- }
-
- if (!isset($options['soft'])) {
- $this->log(0, "Warning: " . $res->getMessage());
- }
- }
-
- $real = isset($atts['attribs']) ? $atts['attribs'] : $atts;
- if ($res == PEAR_INSTALLER_OK && $real['role'] != 'src') {
- // Register files that were installed
- $pkg->installedFile($file, $atts);
- }
- }
- // }}}
-
- // {{{ compile and install source files
- if ($this->source_files > 0 && empty($options['nobuild'])) {
- if (PEAR::isError($err =
- $this->_compileSourceFiles($savechannel, $pkg))) {
- return $err;
- }
- }
- // }}}
-
- if (isset($backedup)) {
- $this->_removeBackups($backedup);
- }
-
- if (!$this->commitFileTransaction()) {
- $this->rollbackFileTransaction();
- $this->configSet('default_channel', $savechannel);
- return $this->raiseError("commit failed", PEAR_INSTALLER_FAILED);
- }
- // }}}
-
- $ret = false;
- $installphase = 'install';
- $oldversion = false;
- // {{{ Register that the package is installed -----------------------
- if (empty($options['upgrade'])) {
- // if 'force' is used, replace the info in registry
- $usechannel = $channel;
- if ($channel == 'pecl.php.net') {
- $test = $installregistry->packageExists($pkgname, $channel);
- if (!$test) {
- $test = $installregistry->packageExists($pkgname, 'pear.php.net');
- $usechannel = 'pear.php.net';
- }
- } else {
- $test = $installregistry->packageExists($pkgname, $channel);
- }
-
- if (!empty($options['force']) && $test) {
- $oldversion = $installregistry->packageInfo($pkgname, 'version', $usechannel);
- $installregistry->deletePackage($pkgname, $usechannel);
- }
- $ret = $installregistry->addPackage2($pkg);
- } else {
- if ($dirtree) {
- $this->startFileTransaction();
- // attempt to delete empty directories
- uksort($dirtree, array($this, '_sortDirs'));
- foreach($dirtree as $dir => $notused) {
- $this->addFileOperation('rmdir', array($dir));
- }
- $this->commitFileTransaction();
- }
-
- $usechannel = $channel;
- if ($channel == 'pecl.php.net') {
- $test = $installregistry->packageExists($pkgname, $channel);
- if (!$test) {
- $test = $installregistry->packageExists($pkgname, 'pear.php.net');
- $usechannel = 'pear.php.net';
- }
- } else {
- $test = $installregistry->packageExists($pkgname, $channel);
- }
-
- // new: upgrade installs a package if it isn't installed
- if (!$test) {
- $ret = $installregistry->addPackage2($pkg);
- } else {
- if ($usechannel != $channel) {
- $installregistry->deletePackage($pkgname, $usechannel);
- $ret = $installregistry->addPackage2($pkg);
- } else {
- $ret = $installregistry->updatePackage2($pkg);
- }
- $installphase = 'upgrade';
- }
- }
-
- if (!$ret) {
- $this->configSet('default_channel', $savechannel);
- return $this->raiseError("Adding package $channel/$pkgname to registry failed");
- }
- // }}}
-
- $this->configSet('default_channel', $savechannel);
- if (class_exists('PEAR_Task_Common')) { // this is auto-included if any tasks exist
- if (PEAR_Task_Common::hasPostinstallTasks()) {
- PEAR_Task_Common::runPostinstallTasks($installphase);
- }
- }
-
- return $pkg->toArray(true);
- }
-
- // }}}
-
- // {{{ _compileSourceFiles()
- /**
- * @param string
- * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2
- */
- function _compileSourceFiles($savechannel, &$filelist)
- {
- require_once 'PEAR/Builder.php';
- $this->log(1, "$this->source_files source files, building");
- $bob = &new PEAR_Builder($this->ui);
- $bob->debug = $this->debug;
- $built = $bob->build($filelist, array(&$this, '_buildCallback'));
- if (PEAR::isError($built)) {
- $this->rollbackFileTransaction();
- $this->configSet('default_channel', $savechannel);
- return $built;
- }
-
- $this->log(1, "\nBuild process completed successfully");
- foreach ($built as $ext) {
- $bn = basename($ext['file']);
- list($_ext_name, $_ext_suff) = explode('.', $bn);
- if ($_ext_suff == '.so' || $_ext_suff == '.dll') {
- if (extension_loaded($_ext_name)) {
- $this->raiseError("Extension '$_ext_name' already loaded. " .
- 'Please unload it in your php.ini file ' .
- 'prior to install or upgrade');
- }
- $role = 'ext';
- } else {
- $role = 'src';
- }
-
- $dest = $ext['dest'];
- $packagingroot = '';
- if (isset($this->_options['packagingroot'])) {
- $packagingroot = $this->_options['packagingroot'];
- }
-
- $copyto = $this->_prependPath($dest, $packagingroot);
- $extra = $copyto != $dest ? " as '$copyto'" : '';
- $this->log(1, "Installing '$dest'$extra");
-
- $copydir = dirname($copyto);
- // pretty much nothing happens if we are only registering the install
- if (empty($this->_options['register-only'])) {
- if (!file_exists($copydir) || !is_dir($copydir)) {
- if (!$this->mkDirHier($copydir)) {
- return $this->raiseError("failed to mkdir $copydir",
- PEAR_INSTALLER_FAILED);
- }
-
- $this->log(3, "+ mkdir $copydir");
- }
-
- if (!@copy($ext['file'], $copyto)) {
- return $this->raiseError("failed to write $copyto ($php_errormsg)", PEAR_INSTALLER_FAILED);
- }
-
- $this->log(3, "+ cp $ext[file] $copyto");
- $this->addFileOperation('rename', array($ext['file'], $copyto));
- if (!OS_WINDOWS) {
- $mode = 0666 & ~(int)octdec($this->config->get('umask'));
- $this->addFileOperation('chmod', array($mode, $copyto));
- if (!@chmod($copyto, $mode)) {
- $this->log(0, "failed to change mode of $copyto ($php_errormsg)");
- }
- }
- }
-
-
- $data = array(
- 'role' => $role,
- 'name' => $bn,
- 'installed_as' => $dest,
- 'php_api' => $ext['php_api'],
- 'zend_mod_api' => $ext['zend_mod_api'],
- 'zend_ext_api' => $ext['zend_ext_api'],
- );
-
- if ($filelist->getPackageXmlVersion() == '1.0') {
- $filelist->installedFile($bn, $data);
- } else {
- $filelist->installedFile($bn, array('attribs' => $data));
- }
- }
- }
-
- // }}}
- function &getUninstallPackages()
- {
- return $this->_downloadedPackages;
- }
- // {{{ uninstall()
-
- /**
- * Uninstall a package
- *
- * This method removes all files installed by the application, and then
- * removes any empty directories.
- * @param string package name
- * @param array Command-line options. Possibilities include:
- *
- * - installroot: base installation dir, if not the default
- * - register-only : update registry but don't remove files
- * - nodeps: do not process dependencies of other packages to ensure
- * uninstallation does not break things
- */
- function uninstall($package, $options = array())
- {
- $installRoot = isset($options['installroot']) ? $options['installroot'] : '';
- $this->config->setInstallRoot($installRoot);
-
- $this->installroot = '';
- $this->_registry = &$this->config->getRegistry();
- if (is_object($package)) {
- $channel = $package->getChannel();
- $pkg = $package;
- $package = $pkg->getPackage();
- } else {
- $pkg = false;
- $info = $this->_registry->parsePackageName($package,
- $this->config->get('default_channel'));
- $channel = $info['channel'];
- $package = $info['package'];
- }
-
- $savechannel = $this->config->get('default_channel');
- $this->configSet('default_channel', $channel);
- if (!is_object($pkg)) {
- $pkg = $this->_registry->getPackage($package, $channel);
- }
-
- if (!$pkg) {
- $this->configSet('default_channel', $savechannel);
- return $this->raiseError($this->_registry->parsedPackageNameToString(
- array(
- 'channel' => $channel,
- 'package' => $package
- ), true) . ' not installed');
- }
-
- if ($pkg->getInstalledBinary()) {
- // this is just an alias for a binary package
- return $this->_registry->deletePackage($package, $channel);
- }
-
- $filelist = $pkg->getFilelist();
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- if (!class_exists('PEAR_Dependency2')) {
- require_once 'PEAR/Dependency2.php';
- }
-
- $depchecker = &new PEAR_Dependency2($this->config, $options,
- array('channel' => $channel, 'package' => $package),
- PEAR_VALIDATE_UNINSTALLING);
- $e = $depchecker->validatePackageUninstall($this);
- PEAR::staticPopErrorHandling();
- if (PEAR::isError($e)) {
- if (!isset($options['ignore-errors'])) {
- return $this->raiseError($e);
- }
-
- if (!isset($options['soft'])) {
- $this->log(0, 'WARNING: ' . $e->getMessage());
- }
- } elseif (is_array($e)) {
- if (!isset($options['soft'])) {
- $this->log(0, $e[0]);
- }
- }
-
- $this->pkginfo = &$pkg;
- // pretty much nothing happens if we are only registering the uninstall
- if (empty($options['register-only'])) {
- // {{{ Delete the files
- $this->startFileTransaction();
- PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
- if (PEAR::isError($err = $this->_deletePackageFiles($package, $channel))) {
- PEAR::popErrorHandling();
- $this->rollbackFileTransaction();
- $this->configSet('default_channel', $savechannel);
- if (!isset($options['ignore-errors'])) {
- return $this->raiseError($err);
- }
-
- if (!isset($options['soft'])) {
- $this->log(0, 'WARNING: ' . $err->getMessage());
- }
- } else {
- PEAR::popErrorHandling();
- }
-
- if (!$this->commitFileTransaction()) {
- $this->rollbackFileTransaction();
- if (!isset($options['ignore-errors'])) {
- return $this->raiseError("uninstall failed");
- }
-
- if (!isset($options['soft'])) {
- $this->log(0, 'WARNING: uninstall failed');
- }
- } else {
- $this->startFileTransaction();
- $dirtree = $pkg->getDirTree();
- if ($dirtree === false) {
- $this->configSet('default_channel', $savechannel);
- return $this->_registry->deletePackage($package, $channel);
- }
-
- // attempt to delete empty directories
- uksort($dirtree, array($this, '_sortDirs'));
- foreach($dirtree as $dir => $notused) {
- $this->addFileOperation('rmdir', array($dir));
- }
-
- if (!$this->commitFileTransaction()) {
- $this->rollbackFileTransaction();
- if (!isset($options['ignore-errors'])) {
- return $this->raiseError("uninstall failed");
- }
-
- if (!isset($options['soft'])) {
- $this->log(0, 'WARNING: uninstall failed');
- }
- }
- }
- // }}}
- }
-
- $this->configSet('default_channel', $savechannel);
- // Register that the package is no longer installed
- return $this->_registry->deletePackage($package, $channel);
- }
-
- /**
- * Sort a list of arrays of array(downloaded packagefilename) by dependency.
- *
- * It also removes duplicate dependencies
- * @param array an array of PEAR_PackageFile_v[1/2] objects
- * @return array|PEAR_Error array of array(packagefilename, package.xml contents)
- */
- function sortPackagesForUninstall(&$packages)
- {
- $this->_dependencyDB = &PEAR_DependencyDB::singleton($this->config);
- if (PEAR::isError($this->_dependencyDB)) {
- return $this->_dependencyDB;
- }
- usort($packages, array(&$this, '_sortUninstall'));
- }
-
- function _sortUninstall($a, $b)
- {
- if (!$a->getDeps() && !$b->getDeps()) {
- return 0; // neither package has dependencies, order is insignificant
- }
- if ($a->getDeps() && !$b->getDeps()) {
- return -1; // $a must be installed after $b because $a has dependencies
- }
- if (!$a->getDeps() && $b->getDeps()) {
- return 1; // $b must be installed after $a because $b has dependencies
- }
- // both packages have dependencies
- if ($this->_dependencyDB->dependsOn($a, $b)) {
- return -1;
- }
- if ($this->_dependencyDB->dependsOn($b, $a)) {
- return 1;
- }
- return 0;
- }
-
- // }}}
- // {{{ _sortDirs()
- function _sortDirs($a, $b)
- {
- if (strnatcmp($a, $b) == -1) return 1;
- if (strnatcmp($a, $b) == 1) return -1;
- return 0;
- }
-
- // }}}
-
- // {{{ _buildCallback()
-
- function _buildCallback($what, $data)
- {
- if (($what == 'cmdoutput' && $this->debug > 1) ||
- ($what == 'output' && $this->debug > 0)) {
- $this->ui->outputData(rtrim($data), 'build');
- }
- }
-
- // }}}
-} \ No newline at end of file
diff --git a/3rdparty/PEAR/Installer/Role.php b/3rdparty/PEAR/Installer/Role.php
deleted file mode 100644
index 0c50fa79c0c..00000000000
--- a/3rdparty/PEAR/Installer/Role.php
+++ /dev/null
@@ -1,276 +0,0 @@
-<?php
-/**
- * PEAR_Installer_Role
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Role.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a1
- */
-
-/**
- * base class for installer roles
- */
-require_once 'PEAR/Installer/Role/Common.php';
-require_once 'PEAR/XMLParser.php';
-/**
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a1
- */
-class PEAR_Installer_Role
-{
- /**
- * Set up any additional configuration variables that file roles require
- *
- * Never call this directly, it is called by the PEAR_Config constructor
- * @param PEAR_Config
- * @access private
- * @static
- */
- function initializeConfig(&$config)
- {
- if (!isset($GLOBALS['_PEAR_INSTALLER_ROLES'])) {
- PEAR_Installer_Role::registerRoles();
- }
-
- foreach ($GLOBALS['_PEAR_INSTALLER_ROLES'] as $class => $info) {
- if (!$info['config_vars']) {
- continue;
- }
-
- $config->_addConfigVars($class, $info['config_vars']);
- }
- }
-
- /**
- * @param PEAR_PackageFile_v2
- * @param string role name
- * @param PEAR_Config
- * @return PEAR_Installer_Role_Common
- * @static
- */
- function &factory($pkg, $role, &$config)
- {
- if (!isset($GLOBALS['_PEAR_INSTALLER_ROLES'])) {
- PEAR_Installer_Role::registerRoles();
- }
-
- if (!in_array($role, PEAR_Installer_Role::getValidRoles($pkg->getPackageType()))) {
- $a = false;
- return $a;
- }
-
- $a = 'PEAR_Installer_Role_' . ucfirst($role);
- if (!class_exists($a)) {
- require_once str_replace('_', '/', $a) . '.php';
- }
-
- $b = new $a($config);
- return $b;
- }
-
- /**
- * Get a list of file roles that are valid for the particular release type.
- *
- * For instance, src files serve no purpose in regular php releases.
- * @param string
- * @param bool clear cache
- * @return array
- * @static
- */
- function getValidRoles($release, $clear = false)
- {
- if (!isset($GLOBALS['_PEAR_INSTALLER_ROLES'])) {
- PEAR_Installer_Role::registerRoles();
- }
-
- static $ret = array();
- if ($clear) {
- $ret = array();
- }
-
- if (isset($ret[$release])) {
- return $ret[$release];
- }
-
- $ret[$release] = array();
- foreach ($GLOBALS['_PEAR_INSTALLER_ROLES'] as $role => $okreleases) {
- if (in_array($release, $okreleases['releasetypes'])) {
- $ret[$release][] = strtolower(str_replace('PEAR_Installer_Role_', '', $role));
- }
- }
-
- return $ret[$release];
- }
-
- /**
- * Get a list of roles that require their files to be installed
- *
- * Most roles must be installed, but src and package roles, for instance
- * are pseudo-roles. src files are compiled into a new extension. Package
- * roles are actually fully bundled releases of a package
- * @param bool clear cache
- * @return array
- * @static
- */
- function getInstallableRoles($clear = false)
- {
- if (!isset($GLOBALS['_PEAR_INSTALLER_ROLES'])) {
- PEAR_Installer_Role::registerRoles();
- }
-
- static $ret;
- if ($clear) {
- unset($ret);
- }
-
- if (isset($ret)) {
- return $ret;
- }
-
- $ret = array();
- foreach ($GLOBALS['_PEAR_INSTALLER_ROLES'] as $role => $okreleases) {
- if ($okreleases['installable']) {
- $ret[] = strtolower(str_replace('PEAR_Installer_Role_', '', $role));
- }
- }
-
- return $ret;
- }
-
- /**
- * Return an array of roles that are affected by the baseinstalldir attribute
- *
- * Most roles ignore this attribute, and instead install directly into:
- * PackageName/filepath
- * so a tests file tests/file.phpt is installed into PackageName/tests/filepath.php
- * @param bool clear cache
- * @return array
- * @static
- */
- function getBaseinstallRoles($clear = false)
- {
- if (!isset($GLOBALS['_PEAR_INSTALLER_ROLES'])) {
- PEAR_Installer_Role::registerRoles();
- }
-
- static $ret;
- if ($clear) {
- unset($ret);
- }
-
- if (isset($ret)) {
- return $ret;
- }
-
- $ret = array();
- foreach ($GLOBALS['_PEAR_INSTALLER_ROLES'] as $role => $okreleases) {
- if ($okreleases['honorsbaseinstall']) {
- $ret[] = strtolower(str_replace('PEAR_Installer_Role_', '', $role));
- }
- }
-
- return $ret;
- }
-
- /**
- * Return an array of file roles that should be analyzed for PHP content at package time,
- * like the "php" role.
- * @param bool clear cache
- * @return array
- * @static
- */
- function getPhpRoles($clear = false)
- {
- if (!isset($GLOBALS['_PEAR_INSTALLER_ROLES'])) {
- PEAR_Installer_Role::registerRoles();
- }
-
- static $ret;
- if ($clear) {
- unset($ret);
- }
-
- if (isset($ret)) {
- return $ret;
- }
-
- $ret = array();
- foreach ($GLOBALS['_PEAR_INSTALLER_ROLES'] as $role => $okreleases) {
- if ($okreleases['phpfile']) {
- $ret[] = strtolower(str_replace('PEAR_Installer_Role_', '', $role));
- }
- }
-
- return $ret;
- }
-
- /**
- * Scan through the Command directory looking for classes
- * and see what commands they implement.
- * @param string which directory to look for classes, defaults to
- * the Installer/Roles subdirectory of
- * the directory from where this file (__FILE__) is
- * included.
- *
- * @return bool TRUE on success, a PEAR error on failure
- * @access public
- * @static
- */
- function registerRoles($dir = null)
- {
- $GLOBALS['_PEAR_INSTALLER_ROLES'] = array();
- $parser = new PEAR_XMLParser;
- if ($dir === null) {
- $dir = dirname(__FILE__) . '/Role';
- }
-
- if (!file_exists($dir) || !is_dir($dir)) {
- return PEAR::raiseError("registerRoles: opendir($dir) failed: does not exist/is not directory");
- }
-
- $dp = @opendir($dir);
- if (empty($dp)) {
- return PEAR::raiseError("registerRoles: opendir($dir) failed: $php_errmsg");
- }
-
- while ($entry = readdir($dp)) {
- if ($entry{0} == '.' || substr($entry, -4) != '.xml') {
- continue;
- }
-
- $class = "PEAR_Installer_Role_".substr($entry, 0, -4);
- // List of roles
- if (!isset($GLOBALS['_PEAR_INSTALLER_ROLES'][$class])) {
- $file = "$dir/$entry";
- $parser->parse(file_get_contents($file));
- $data = $parser->getData();
- if (!is_array($data['releasetypes'])) {
- $data['releasetypes'] = array($data['releasetypes']);
- }
-
- $GLOBALS['_PEAR_INSTALLER_ROLES'][$class] = $data;
- }
- }
-
- closedir($dp);
- ksort($GLOBALS['_PEAR_INSTALLER_ROLES']);
- PEAR_Installer_Role::getBaseinstallRoles(true);
- PEAR_Installer_Role::getInstallableRoles(true);
- PEAR_Installer_Role::getPhpRoles(true);
- PEAR_Installer_Role::getValidRoles('****', true);
- return true;
- }
-} \ No newline at end of file
diff --git a/3rdparty/PEAR/Installer/Role/Cfg.php b/3rdparty/PEAR/Installer/Role/Cfg.php
deleted file mode 100644
index 762012248d2..00000000000
--- a/3rdparty/PEAR/Installer/Role/Cfg.php
+++ /dev/null
@@ -1,106 +0,0 @@
-<?php
-/**
- * PEAR_Installer_Role_Cfg
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 2007-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Cfg.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.7.0
- */
-
-/**
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 2007-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.7.0
- */
-class PEAR_Installer_Role_Cfg extends PEAR_Installer_Role_Common
-{
- /**
- * @var PEAR_Installer
- */
- var $installer;
-
- /**
- * the md5 of the original file
- *
- * @var unknown_type
- */
- var $md5 = null;
-
- /**
- * Do any unusual setup here
- * @param PEAR_Installer
- * @param PEAR_PackageFile_v2
- * @param array file attributes
- * @param string file name
- */
- function setup(&$installer, $pkg, $atts, $file)
- {
- $this->installer = &$installer;
- $reg = &$this->installer->config->getRegistry();
- $package = $reg->getPackage($pkg->getPackage(), $pkg->getChannel());
- if ($package) {
- $filelist = $package->getFilelist();
- if (isset($filelist[$file]) && isset($filelist[$file]['md5sum'])) {
- $this->md5 = $filelist[$file]['md5sum'];
- }
- }
- }
-
- function processInstallation($pkg, $atts, $file, $tmp_path, $layer = null)
- {
- $test = parent::processInstallation($pkg, $atts, $file, $tmp_path, $layer);
- if (@file_exists($test[2]) && @file_exists($test[3])) {
- $md5 = md5_file($test[2]);
- // configuration has already been installed, check for mods
- if ($md5 !== $this->md5 && $md5 !== md5_file($test[3])) {
- // configuration has been modified, so save our version as
- // configfile-version
- $old = $test[2];
- $test[2] .= '.new-' . $pkg->getVersion();
- // backup original and re-install it
- PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
- $tmpcfg = $this->config->get('temp_dir');
- $newloc = System::mkdir(array('-p', $tmpcfg));
- if (!$newloc) {
- // try temp_dir
- $newloc = System::mktemp(array('-d'));
- if (!$newloc || PEAR::isError($newloc)) {
- PEAR::popErrorHandling();
- return PEAR::raiseError('Could not save existing configuration file '.
- $old . ', unable to install. Please set temp_dir ' .
- 'configuration variable to a writeable location and try again');
- }
- } else {
- $newloc = $tmpcfg;
- }
-
- $temp_file = $newloc . DIRECTORY_SEPARATOR . uniqid('savefile');
- if (!@copy($old, $temp_file)) {
- PEAR::popErrorHandling();
- return PEAR::raiseError('Could not save existing configuration file '.
- $old . ', unable to install. Please set temp_dir ' .
- 'configuration variable to a writeable location and try again');
- }
-
- PEAR::popErrorHandling();
- $this->installer->log(0, "WARNING: configuration file $old is being installed as $test[2], you should manually merge in changes to the existing configuration file");
- $this->installer->addFileOperation('rename', array($temp_file, $old, false));
- $this->installer->addFileOperation('delete', array($temp_file));
- }
- }
-
- return $test;
- }
-} \ No newline at end of file
diff --git a/3rdparty/PEAR/Installer/Role/Cfg.xml b/3rdparty/PEAR/Installer/Role/Cfg.xml
deleted file mode 100644
index 7a415dc466a..00000000000
--- a/3rdparty/PEAR/Installer/Role/Cfg.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<role version="1.0">
- <releasetypes>php</releasetypes>
- <releasetypes>extsrc</releasetypes>
- <releasetypes>extbin</releasetypes>
- <releasetypes>zendextsrc</releasetypes>
- <releasetypes>zendextbin</releasetypes>
- <installable>1</installable>
- <locationconfig>cfg_dir</locationconfig>
- <honorsbaseinstall />
- <unusualbaseinstall>1</unusualbaseinstall>
- <phpfile />
- <executable />
- <phpextension />
- <config_vars />
-</role> \ No newline at end of file
diff --git a/3rdparty/PEAR/Installer/Role/Common.php b/3rdparty/PEAR/Installer/Role/Common.php
deleted file mode 100644
index 23e7348d70c..00000000000
--- a/3rdparty/PEAR/Installer/Role/Common.php
+++ /dev/null
@@ -1,174 +0,0 @@
-<?php
-/**
- * Base class for all installation roles.
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2006 The PHP Group
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Common.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a1
- */
-/**
- * Base class for all installation roles.
- *
- * This class allows extensibility of file roles. Packages with complex
- * customization can now provide custom file roles along with the possibility of
- * adding configuration values to match.
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2006 The PHP Group
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a1
- */
-class PEAR_Installer_Role_Common
-{
- /**
- * @var PEAR_Config
- * @access protected
- */
- var $config;
-
- /**
- * @param PEAR_Config
- */
- function PEAR_Installer_Role_Common(&$config)
- {
- $this->config = $config;
- }
-
- /**
- * Retrieve configuration information about a file role from its XML info
- *
- * @param string $role Role Classname, as in "PEAR_Installer_Role_Data"
- * @return array
- */
- function getInfo($role)
- {
- if (empty($GLOBALS['_PEAR_INSTALLER_ROLES'][$role])) {
- return PEAR::raiseError('Unknown Role class: "' . $role . '"');
- }
- return $GLOBALS['_PEAR_INSTALLER_ROLES'][$role];
- }
-
- /**
- * This is called for each file to set up the directories and files
- * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2
- * @param array attributes from the <file> tag
- * @param string file name
- * @return array an array consisting of:
- *
- * 1 the original, pre-baseinstalldir installation directory
- * 2 the final installation directory
- * 3 the full path to the final location of the file
- * 4 the location of the pre-installation file
- */
- function processInstallation($pkg, $atts, $file, $tmp_path, $layer = null)
- {
- $roleInfo = PEAR_Installer_Role_Common::getInfo('PEAR_Installer_Role_' .
- ucfirst(str_replace('pear_installer_role_', '', strtolower(get_class($this)))));
- if (PEAR::isError($roleInfo)) {
- return $roleInfo;
- }
- if (!$roleInfo['locationconfig']) {
- return false;
- }
- if ($roleInfo['honorsbaseinstall']) {
- $dest_dir = $save_destdir = $this->config->get($roleInfo['locationconfig'], $layer,
- $pkg->getChannel());
- if (!empty($atts['baseinstalldir'])) {
- $dest_dir .= DIRECTORY_SEPARATOR . $atts['baseinstalldir'];
- }
- } elseif ($roleInfo['unusualbaseinstall']) {
- $dest_dir = $save_destdir = $this->config->get($roleInfo['locationconfig'],
- $layer, $pkg->getChannel()) . DIRECTORY_SEPARATOR . $pkg->getPackage();
- if (!empty($atts['baseinstalldir'])) {
- $dest_dir .= DIRECTORY_SEPARATOR . $atts['baseinstalldir'];
- }
- } else {
- $dest_dir = $save_destdir = $this->config->get($roleInfo['locationconfig'],
- $layer, $pkg->getChannel()) . DIRECTORY_SEPARATOR . $pkg->getPackage();
- }
- if (dirname($file) != '.' && empty($atts['install-as'])) {
- $dest_dir .= DIRECTORY_SEPARATOR . dirname($file);
- }
- if (empty($atts['install-as'])) {
- $dest_file = $dest_dir . DIRECTORY_SEPARATOR . basename($file);
- } else {
- $dest_file = $dest_dir . DIRECTORY_SEPARATOR . $atts['install-as'];
- }
- $orig_file = $tmp_path . DIRECTORY_SEPARATOR . $file;
-
- // Clean up the DIRECTORY_SEPARATOR mess
- $ds2 = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR;
-
- list($dest_dir, $dest_file, $orig_file) = preg_replace(array('!\\\\+!', '!/!', "!$ds2+!"),
- array(DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR,
- DIRECTORY_SEPARATOR),
- array($dest_dir, $dest_file, $orig_file));
- return array($save_destdir, $dest_dir, $dest_file, $orig_file);
- }
-
- /**
- * Get the name of the configuration variable that specifies the location of this file
- * @return string|false
- */
- function getLocationConfig()
- {
- $roleInfo = PEAR_Installer_Role_Common::getInfo('PEAR_Installer_Role_' .
- ucfirst(str_replace('pear_installer_role_', '', strtolower(get_class($this)))));
- if (PEAR::isError($roleInfo)) {
- return $roleInfo;
- }
- return $roleInfo['locationconfig'];
- }
-
- /**
- * Do any unusual setup here
- * @param PEAR_Installer
- * @param PEAR_PackageFile_v2
- * @param array file attributes
- * @param string file name
- */
- function setup(&$installer, $pkg, $atts, $file)
- {
- }
-
- function isExecutable()
- {
- $roleInfo = PEAR_Installer_Role_Common::getInfo('PEAR_Installer_Role_' .
- ucfirst(str_replace('pear_installer_role_', '', strtolower(get_class($this)))));
- if (PEAR::isError($roleInfo)) {
- return $roleInfo;
- }
- return $roleInfo['executable'];
- }
-
- function isInstallable()
- {
- $roleInfo = PEAR_Installer_Role_Common::getInfo('PEAR_Installer_Role_' .
- ucfirst(str_replace('pear_installer_role_', '', strtolower(get_class($this)))));
- if (PEAR::isError($roleInfo)) {
- return $roleInfo;
- }
- return $roleInfo['installable'];
- }
-
- function isExtension()
- {
- $roleInfo = PEAR_Installer_Role_Common::getInfo('PEAR_Installer_Role_' .
- ucfirst(str_replace('pear_installer_role_', '', strtolower(get_class($this)))));
- if (PEAR::isError($roleInfo)) {
- return $roleInfo;
- }
- return $roleInfo['phpextension'];
- }
-}
-?> \ No newline at end of file
diff --git a/3rdparty/PEAR/Installer/Role/Data.php b/3rdparty/PEAR/Installer/Role/Data.php
deleted file mode 100644
index e3b7fa2fff2..00000000000
--- a/3rdparty/PEAR/Installer/Role/Data.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-/**
- * PEAR_Installer_Role_Data
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Data.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a1
- */
-
-/**
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a1
- */
-class PEAR_Installer_Role_Data extends PEAR_Installer_Role_Common {}
-?> \ No newline at end of file
diff --git a/3rdparty/PEAR/Installer/Role/Data.xml b/3rdparty/PEAR/Installer/Role/Data.xml
deleted file mode 100644
index eae63720d3b..00000000000
--- a/3rdparty/PEAR/Installer/Role/Data.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<role version="1.0">
- <releasetypes>php</releasetypes>
- <releasetypes>extsrc</releasetypes>
- <releasetypes>extbin</releasetypes>
- <releasetypes>zendextsrc</releasetypes>
- <releasetypes>zendextbin</releasetypes>
- <installable>1</installable>
- <locationconfig>data_dir</locationconfig>
- <honorsbaseinstall />
- <unusualbaseinstall />
- <phpfile />
- <executable />
- <phpextension />
- <config_vars />
-</role> \ No newline at end of file
diff --git a/3rdparty/PEAR/Installer/Role/Doc.php b/3rdparty/PEAR/Installer/Role/Doc.php
deleted file mode 100644
index d592ffff014..00000000000
--- a/3rdparty/PEAR/Installer/Role/Doc.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-/**
- * PEAR_Installer_Role_Doc
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Doc.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a1
- */
-
-/**
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a1
- */
-class PEAR_Installer_Role_Doc extends PEAR_Installer_Role_Common {}
-?> \ No newline at end of file
diff --git a/3rdparty/PEAR/Installer/Role/Doc.xml b/3rdparty/PEAR/Installer/Role/Doc.xml
deleted file mode 100644
index 173afba011a..00000000000
--- a/3rdparty/PEAR/Installer/Role/Doc.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<role version="1.0">
- <releasetypes>php</releasetypes>
- <releasetypes>extsrc</releasetypes>
- <releasetypes>extbin</releasetypes>
- <releasetypes>zendextsrc</releasetypes>
- <releasetypes>zendextbin</releasetypes>
- <installable>1</installable>
- <locationconfig>doc_dir</locationconfig>
- <honorsbaseinstall />
- <unusualbaseinstall />
- <phpfile />
- <executable />
- <phpextension />
- <config_vars />
-</role> \ No newline at end of file
diff --git a/3rdparty/PEAR/Installer/Role/Ext.php b/3rdparty/PEAR/Installer/Role/Ext.php
deleted file mode 100644
index eceb0279ff9..00000000000
--- a/3rdparty/PEAR/Installer/Role/Ext.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-/**
- * PEAR_Installer_Role_Ext
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Ext.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a1
- */
-
-/**
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a1
- */
-class PEAR_Installer_Role_Ext extends PEAR_Installer_Role_Common {}
-?> \ No newline at end of file
diff --git a/3rdparty/PEAR/Installer/Role/Ext.xml b/3rdparty/PEAR/Installer/Role/Ext.xml
deleted file mode 100644
index e2940fe1f22..00000000000
--- a/3rdparty/PEAR/Installer/Role/Ext.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<role version="1.0">
- <releasetypes>extbin</releasetypes>
- <releasetypes>zendextbin</releasetypes>
- <installable>1</installable>
- <locationconfig>ext_dir</locationconfig>
- <honorsbaseinstall>1</honorsbaseinstall>
- <unusualbaseinstall />
- <phpfile />
- <executable />
- <phpextension>1</phpextension>
- <config_vars />
-</role> \ No newline at end of file
diff --git a/3rdparty/PEAR/Installer/Role/Php.php b/3rdparty/PEAR/Installer/Role/Php.php
deleted file mode 100644
index e2abf44eed1..00000000000
--- a/3rdparty/PEAR/Installer/Role/Php.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-/**
- * PEAR_Installer_Role_Php
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Php.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a1
- */
-
-/**
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a1
- */
-class PEAR_Installer_Role_Php extends PEAR_Installer_Role_Common {}
-?> \ No newline at end of file
diff --git a/3rdparty/PEAR/Installer/Role/Php.xml b/3rdparty/PEAR/Installer/Role/Php.xml
deleted file mode 100644
index 6b9a0e67af9..00000000000
--- a/3rdparty/PEAR/Installer/Role/Php.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<role version="1.0">
- <releasetypes>php</releasetypes>
- <releasetypes>extsrc</releasetypes>
- <releasetypes>extbin</releasetypes>
- <releasetypes>zendextsrc</releasetypes>
- <releasetypes>zendextbin</releasetypes>
- <installable>1</installable>
- <locationconfig>php_dir</locationconfig>
- <honorsbaseinstall>1</honorsbaseinstall>
- <unusualbaseinstall />
- <phpfile>1</phpfile>
- <executable />
- <phpextension />
- <config_vars />
-</role> \ No newline at end of file
diff --git a/3rdparty/PEAR/Installer/Role/Script.php b/3rdparty/PEAR/Installer/Role/Script.php
deleted file mode 100644
index b31469e4b10..00000000000
--- a/3rdparty/PEAR/Installer/Role/Script.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-/**
- * PEAR_Installer_Role_Script
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Script.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a1
- */
-
-/**
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a1
- */
-class PEAR_Installer_Role_Script extends PEAR_Installer_Role_Common {}
-?> \ No newline at end of file
diff --git a/3rdparty/PEAR/Installer/Role/Script.xml b/3rdparty/PEAR/Installer/Role/Script.xml
deleted file mode 100644
index e732cf2af6f..00000000000
--- a/3rdparty/PEAR/Installer/Role/Script.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<role version="1.0">
- <releasetypes>php</releasetypes>
- <releasetypes>extsrc</releasetypes>
- <releasetypes>extbin</releasetypes>
- <releasetypes>zendextsrc</releasetypes>
- <releasetypes>zendextbin</releasetypes>
- <installable>1</installable>
- <locationconfig>bin_dir</locationconfig>
- <honorsbaseinstall>1</honorsbaseinstall>
- <unusualbaseinstall />
- <phpfile />
- <executable>1</executable>
- <phpextension />
- <config_vars />
-</role> \ No newline at end of file
diff --git a/3rdparty/PEAR/Installer/Role/Src.php b/3rdparty/PEAR/Installer/Role/Src.php
deleted file mode 100644
index 503705313d8..00000000000
--- a/3rdparty/PEAR/Installer/Role/Src.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-/**
- * PEAR_Installer_Role_Src
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Src.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a1
- */
-
-/**
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a1
- */
-class PEAR_Installer_Role_Src extends PEAR_Installer_Role_Common
-{
- function setup(&$installer, $pkg, $atts, $file)
- {
- $installer->source_files++;
- }
-}
-?> \ No newline at end of file
diff --git a/3rdparty/PEAR/Installer/Role/Src.xml b/3rdparty/PEAR/Installer/Role/Src.xml
deleted file mode 100644
index 103483402f0..00000000000
--- a/3rdparty/PEAR/Installer/Role/Src.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<role version="1.0">
- <releasetypes>extsrc</releasetypes>
- <releasetypes>zendextsrc</releasetypes>
- <installable>1</installable>
- <locationconfig>temp_dir</locationconfig>
- <honorsbaseinstall />
- <unusualbaseinstall />
- <phpfile />
- <executable />
- <phpextension />
- <config_vars />
-</role> \ No newline at end of file
diff --git a/3rdparty/PEAR/Installer/Role/Test.php b/3rdparty/PEAR/Installer/Role/Test.php
deleted file mode 100644
index 14c0e609192..00000000000
--- a/3rdparty/PEAR/Installer/Role/Test.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-/**
- * PEAR_Installer_Role_Test
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Test.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a1
- */
-
-/**
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a1
- */
-class PEAR_Installer_Role_Test extends PEAR_Installer_Role_Common {}
-?> \ No newline at end of file
diff --git a/3rdparty/PEAR/Installer/Role/Test.xml b/3rdparty/PEAR/Installer/Role/Test.xml
deleted file mode 100644
index 51d5b894e07..00000000000
--- a/3rdparty/PEAR/Installer/Role/Test.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<role version="1.0">
- <releasetypes>php</releasetypes>
- <releasetypes>extsrc</releasetypes>
- <releasetypes>extbin</releasetypes>
- <releasetypes>zendextsrc</releasetypes>
- <releasetypes>zendextbin</releasetypes>
- <installable>1</installable>
- <locationconfig>test_dir</locationconfig>
- <honorsbaseinstall />
- <unusualbaseinstall />
- <phpfile />
- <executable />
- <phpextension />
- <config_vars />
-</role> \ No newline at end of file
diff --git a/3rdparty/PEAR/Installer/Role/Www.php b/3rdparty/PEAR/Installer/Role/Www.php
deleted file mode 100644
index 11adeff8295..00000000000
--- a/3rdparty/PEAR/Installer/Role/Www.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-/**
- * PEAR_Installer_Role_Www
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 2007-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Www.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.7.0
- */
-
-/**
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 2007-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.7.0
- */
-class PEAR_Installer_Role_Www extends PEAR_Installer_Role_Common {}
-?> \ No newline at end of file
diff --git a/3rdparty/PEAR/Installer/Role/Www.xml b/3rdparty/PEAR/Installer/Role/Www.xml
deleted file mode 100644
index 7598be38892..00000000000
--- a/3rdparty/PEAR/Installer/Role/Www.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<role version="1.0">
- <releasetypes>php</releasetypes>
- <releasetypes>extsrc</releasetypes>
- <releasetypes>extbin</releasetypes>
- <releasetypes>zendextsrc</releasetypes>
- <releasetypes>zendextbin</releasetypes>
- <installable>1</installable>
- <locationconfig>www_dir</locationconfig>
- <honorsbaseinstall>1</honorsbaseinstall>
- <unusualbaseinstall />
- <phpfile />
- <executable />
- <phpextension />
- <config_vars />
-</role> \ No newline at end of file
diff --git a/3rdparty/PEAR/PackageFile.php b/3rdparty/PEAR/PackageFile.php
deleted file mode 100644
index 7ae33628441..00000000000
--- a/3rdparty/PEAR/PackageFile.php
+++ /dev/null
@@ -1,492 +0,0 @@
-<?php
-/**
- * PEAR_PackageFile, package.xml parsing utility class
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: PackageFile.php 313024 2011-07-06 19:51:24Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a1
- */
-
-/**
- * needed for PEAR_VALIDATE_* constants
- */
-require_once 'PEAR/Validate.php';
-/**
- * Error code if the package.xml <package> tag does not contain a valid version
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_PACKAGEVERSION', 1);
-/**
- * Error code if the package.xml <package> tag version is not supported (version 1.0 and 1.1 are the only supported versions,
- * currently
- */
-define('PEAR_PACKAGEFILE_ERROR_INVALID_PACKAGEVERSION', 2);
-/**
- * Abstraction for the package.xml package description file
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a1
- */
-class PEAR_PackageFile
-{
- /**
- * @var PEAR_Config
- */
- var $_config;
- var $_debug;
-
- var $_logger = false;
- /**
- * @var boolean
- */
- var $_rawReturn = false;
-
- /**
- * helper for extracting Archive_Tar errors
- * @var array
- * @access private
- */
- var $_extractErrors = array();
-
- /**
- *
- * @param PEAR_Config $config
- * @param ? $debug
- * @param string @tmpdir Optional temporary directory for uncompressing
- * files
- */
- function PEAR_PackageFile(&$config, $debug = false)
- {
- $this->_config = $config;
- $this->_debug = $debug;
- }
-
- /**
- * Turn off validation - return a parsed package.xml without checking it
- *
- * This is used by the package-validate command
- */
- function rawReturn()
- {
- $this->_rawReturn = true;
- }
-
- function setLogger(&$l)
- {
- $this->_logger = &$l;
- }
-
- /**
- * Create a PEAR_PackageFile_Parser_v* of a given version.
- * @param int $version
- * @return PEAR_PackageFile_Parser_v1|PEAR_PackageFile_Parser_v1
- */
- function &parserFactory($version)
- {
- if (!in_array($version{0}, array('1', '2'))) {
- $a = false;
- return $a;
- }
-
- include_once 'PEAR/PackageFile/Parser/v' . $version{0} . '.php';
- $version = $version{0};
- $class = "PEAR_PackageFile_Parser_v$version";
- $a = new $class;
- return $a;
- }
-
- /**
- * For simpler unit-testing
- * @return string
- */
- function getClassPrefix()
- {
- return 'PEAR_PackageFile_v';
- }
-
- /**
- * Create a PEAR_PackageFile_v* of a given version.
- * @param int $version
- * @return PEAR_PackageFile_v1|PEAR_PackageFile_v1
- */
- function &factory($version)
- {
- if (!in_array($version{0}, array('1', '2'))) {
- $a = false;
- return $a;
- }
-
- include_once 'PEAR/PackageFile/v' . $version{0} . '.php';
- $version = $version{0};
- $class = $this->getClassPrefix() . $version;
- $a = new $class;
- return $a;
- }
-
- /**
- * Create a PEAR_PackageFile_v* from its toArray() method
- *
- * WARNING: no validation is performed, the array is assumed to be valid,
- * always parse from xml if you want validation.
- * @param array $arr
- * @return PEAR_PackageFileManager_v1|PEAR_PackageFileManager_v2
- * @uses factory() to construct the returned object.
- */
- function &fromArray($arr)
- {
- if (isset($arr['xsdversion'])) {
- $obj = &$this->factory($arr['xsdversion']);
- if ($this->_logger) {
- $obj->setLogger($this->_logger);
- }
-
- $obj->setConfig($this->_config);
- $obj->fromArray($arr);
- return $obj;
- }
-
- if (isset($arr['package']['attribs']['version'])) {
- $obj = &$this->factory($arr['package']['attribs']['version']);
- } else {
- $obj = &$this->factory('1.0');
- }
-
- if ($this->_logger) {
- $obj->setLogger($this->_logger);
- }
-
- $obj->setConfig($this->_config);
- $obj->fromArray($arr);
- return $obj;
- }
-
- /**
- * Create a PEAR_PackageFile_v* from an XML string.
- * @access public
- * @param string $data contents of package.xml file
- * @param int $state package state (one of PEAR_VALIDATE_* constants)
- * @param string $file full path to the package.xml file (and the files
- * it references)
- * @param string $archive optional name of the archive that the XML was
- * extracted from, if any
- * @return PEAR_PackageFile_v1|PEAR_PackageFile_v2
- * @uses parserFactory() to construct a parser to load the package.
- */
- function &fromXmlString($data, $state, $file, $archive = false)
- {
- if (preg_match('/<package[^>]+version=[\'"]([0-9]+\.[0-9]+)[\'"]/', $data, $packageversion)) {
- if (!in_array($packageversion[1], array('1.0', '2.0', '2.1'))) {
- return PEAR::raiseError('package.xml version "' . $packageversion[1] .
- '" is not supported, only 1.0, 2.0, and 2.1 are supported.');
- }
-
- $object = &$this->parserFactory($packageversion[1]);
- if ($this->_logger) {
- $object->setLogger($this->_logger);
- }
-
- $object->setConfig($this->_config);
- $pf = $object->parse($data, $file, $archive);
- if (PEAR::isError($pf)) {
- return $pf;
- }
-
- if ($this->_rawReturn) {
- return $pf;
- }
-
- if (!$pf->validate($state)) {;
- if ($this->_config->get('verbose') > 0
- && $this->_logger && $pf->getValidationWarnings(false)
- ) {
- foreach ($pf->getValidationWarnings(false) as $warning) {
- $this->_logger->log(0, 'ERROR: ' . $warning['message']);
- }
- }
-
- $a = PEAR::raiseError('Parsing of package.xml from file "' . $file . '" failed',
- 2, null, null, $pf->getValidationWarnings());
- return $a;
- }
-
- if ($this->_logger && $pf->getValidationWarnings(false)) {
- foreach ($pf->getValidationWarnings() as $warning) {
- $this->_logger->log(0, 'WARNING: ' . $warning['message']);
- }
- }
-
- if (method_exists($pf, 'flattenFilelist')) {
- $pf->flattenFilelist(); // for v2
- }
-
- return $pf;
- } elseif (preg_match('/<package[^>]+version=[\'"]([^"\']+)[\'"]/', $data, $packageversion)) {
- $a = PEAR::raiseError('package.xml file "' . $file .
- '" has unsupported package.xml <package> version "' . $packageversion[1] . '"');
- return $a;
- } else {
- if (!class_exists('PEAR_ErrorStack')) {
- require_once 'PEAR/ErrorStack.php';
- }
-
- PEAR_ErrorStack::staticPush('PEAR_PackageFile',
- PEAR_PACKAGEFILE_ERROR_NO_PACKAGEVERSION,
- 'warning', array('xml' => $data), 'package.xml "' . $file .
- '" has no package.xml <package> version');
- $object = &$this->parserFactory('1.0');
- $object->setConfig($this->_config);
- $pf = $object->parse($data, $file, $archive);
- if (PEAR::isError($pf)) {
- return $pf;
- }
-
- if ($this->_rawReturn) {
- return $pf;
- }
-
- if (!$pf->validate($state)) {
- $a = PEAR::raiseError('Parsing of package.xml from file "' . $file . '" failed',
- 2, null, null, $pf->getValidationWarnings());
- return $a;
- }
-
- if ($this->_logger && $pf->getValidationWarnings(false)) {
- foreach ($pf->getValidationWarnings() as $warning) {
- $this->_logger->log(0, 'WARNING: ' . $warning['message']);
- }
- }
-
- if (method_exists($pf, 'flattenFilelist')) {
- $pf->flattenFilelist(); // for v2
- }
-
- return $pf;
- }
- }
-
- /**
- * Register a temporary file or directory. When the destructor is
- * executed, all registered temporary files and directories are
- * removed.
- *
- * @param string $file name of file or directory
- * @return void
- */
- function addTempFile($file)
- {
- $GLOBALS['_PEAR_Common_tempfiles'][] = $file;
- }
-
- /**
- * Create a PEAR_PackageFile_v* from a compresed Tar or Tgz file.
- * @access public
- * @param string contents of package.xml file
- * @param int package state (one of PEAR_VALIDATE_* constants)
- * @return PEAR_PackageFile_v1|PEAR_PackageFile_v2
- * @using Archive_Tar to extract the files
- * @using fromPackageFile() to load the package after the package.xml
- * file is extracted.
- */
- function &fromTgzFile($file, $state)
- {
- if (!class_exists('Archive_Tar')) {
- require_once 'Archive/Tar.php';
- }
-
- $tar = new Archive_Tar($file);
- if ($this->_debug <= 1) {
- $tar->pushErrorHandling(PEAR_ERROR_RETURN);
- }
-
- $content = $tar->listContent();
- if ($this->_debug <= 1) {
- $tar->popErrorHandling();
- }
-
- if (!is_array($content)) {
- if (is_string($file) && strlen($file < 255) &&
- (!file_exists($file) || !@is_file($file))) {
- $ret = PEAR::raiseError("could not open file \"$file\"");
- return $ret;
- }
-
- $file = realpath($file);
- $ret = PEAR::raiseError("Could not get contents of package \"$file\"".
- '. Invalid tgz file.');
- return $ret;
- }
-
- if (!count($content) && !@is_file($file)) {
- $ret = PEAR::raiseError("could not open file \"$file\"");
- return $ret;
- }
-
- $xml = null;
- $origfile = $file;
- foreach ($content as $file) {
- $name = $file['filename'];
- if ($name == 'package2.xml') { // allow a .tgz to distribute both versions
- $xml = $name;
- break;
- }
-
- if ($name == 'package.xml') {
- $xml = $name;
- break;
- } elseif (preg_match('/package.xml$/', $name, $match)) {
- $xml = $name;
- break;
- }
- }
-
- $tmpdir = System::mktemp('-t "' . $this->_config->get('temp_dir') . '" -d pear');
- if ($tmpdir === false) {
- $ret = PEAR::raiseError("there was a problem with getting the configured temp directory");
- return $ret;
- }
-
- PEAR_PackageFile::addTempFile($tmpdir);
-
- $this->_extractErrors();
- PEAR::staticPushErrorHandling(PEAR_ERROR_CALLBACK, array($this, '_extractErrors'));
-
- if (!$xml || !$tar->extractList(array($xml), $tmpdir)) {
- $extra = implode("\n", $this->_extractErrors());
- if ($extra) {
- $extra = ' ' . $extra;
- }
-
- PEAR::staticPopErrorHandling();
- $ret = PEAR::raiseError('could not extract the package.xml file from "' .
- $origfile . '"' . $extra);
- return $ret;
- }
-
- PEAR::staticPopErrorHandling();
- $ret = &PEAR_PackageFile::fromPackageFile("$tmpdir/$xml", $state, $origfile);
- return $ret;
- }
-
- /**
- * helper callback for extracting Archive_Tar errors
- *
- * @param PEAR_Error|null $err
- * @return array
- * @access private
- */
- function _extractErrors($err = null)
- {
- static $errors = array();
- if ($err === null) {
- $e = $errors;
- $errors = array();
- return $e;
- }
- $errors[] = $err->getMessage();
- }
-
- /**
- * Create a PEAR_PackageFile_v* from a package.xml file.
- *
- * @access public
- * @param string $descfile name of package xml file
- * @param int $state package state (one of PEAR_VALIDATE_* constants)
- * @param string|false $archive name of the archive this package.xml came
- * from, if any
- * @return PEAR_PackageFile_v1|PEAR_PackageFile_v2
- * @uses PEAR_PackageFile::fromXmlString to create the oject after the
- * XML is loaded from the package.xml file.
- */
- function &fromPackageFile($descfile, $state, $archive = false)
- {
- $fp = false;
- if (is_string($descfile) && strlen($descfile) < 255 &&
- (
- !file_exists($descfile) || !is_file($descfile) || !is_readable($descfile)
- || (!$fp = @fopen($descfile, 'r'))
- )
- ) {
- $a = PEAR::raiseError("Unable to open $descfile");
- return $a;
- }
-
- // read the whole thing so we only get one cdata callback
- // for each block of cdata
- fclose($fp);
- $data = file_get_contents($descfile);
- $ret = &PEAR_PackageFile::fromXmlString($data, $state, $descfile, $archive);
- return $ret;
- }
-
- /**
- * Create a PEAR_PackageFile_v* from a .tgz archive or package.xml file.
- *
- * This method is able to extract information about a package from a .tgz
- * archive or from a XML package definition file.
- *
- * @access public
- * @param string $info file name
- * @param int $state package state (one of PEAR_VALIDATE_* constants)
- * @return PEAR_PackageFile_v1|PEAR_PackageFile_v2
- * @uses fromPackageFile() if the file appears to be XML
- * @uses fromTgzFile() to load all non-XML files
- */
- function &fromAnyFile($info, $state)
- {
- if (is_dir($info)) {
- $dir_name = realpath($info);
- if (file_exists($dir_name . '/package.xml')) {
- $info = PEAR_PackageFile::fromPackageFile($dir_name . '/package.xml', $state);
- } elseif (file_exists($dir_name . '/package2.xml')) {
- $info = PEAR_PackageFile::fromPackageFile($dir_name . '/package2.xml', $state);
- } else {
- $info = PEAR::raiseError("No package definition found in '$info' directory");
- }
-
- return $info;
- }
-
- $fp = false;
- if (is_string($info) && strlen($info) < 255 &&
- (file_exists($info) || ($fp = @fopen($info, 'r')))
- ) {
-
- if ($fp) {
- fclose($fp);
- }
-
- $tmp = substr($info, -4);
- if ($tmp == '.xml') {
- $info = &PEAR_PackageFile::fromPackageFile($info, $state);
- } elseif ($tmp == '.tar' || $tmp == '.tgz') {
- $info = &PEAR_PackageFile::fromTgzFile($info, $state);
- } else {
- $fp = fopen($info, 'r');
- $test = fread($fp, 5);
- fclose($fp);
- if ($test == '<?xml') {
- $info = &PEAR_PackageFile::fromPackageFile($info, $state);
- } else {
- $info = &PEAR_PackageFile::fromTgzFile($info, $state);
- }
- }
-
- return $info;
- }
-
- $info = PEAR::raiseError("Cannot open '$info' for parsing");
- return $info;
- }
-} \ No newline at end of file
diff --git a/3rdparty/PEAR/PackageFile/Generator/v1.php b/3rdparty/PEAR/PackageFile/Generator/v1.php
deleted file mode 100644
index 69a4818799e..00000000000
--- a/3rdparty/PEAR/PackageFile/Generator/v1.php
+++ /dev/null
@@ -1,1284 +0,0 @@
-<?php
-/**
- * package.xml generation class, package.xml version 1.0
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: v1.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a1
- */
-/**
- * needed for PEAR_VALIDATE_* constants
- */
-require_once 'PEAR/Validate.php';
-require_once 'System.php';
-require_once 'PEAR/PackageFile/v2.php';
-/**
- * This class converts a PEAR_PackageFile_v1 object into any output format.
- *
- * Supported output formats include array, XML string, and a PEAR_PackageFile_v2
- * object, for converting package.xml 1.0 into package.xml 2.0 with no sweat.
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a1
- */
-class PEAR_PackageFile_Generator_v1
-{
- /**
- * @var PEAR_PackageFile_v1
- */
- var $_packagefile;
- function PEAR_PackageFile_Generator_v1(&$packagefile)
- {
- $this->_packagefile = &$packagefile;
- }
-
- function getPackagerVersion()
- {
- return '1.9.4';
- }
-
- /**
- * @param PEAR_Packager
- * @param bool if true, a .tgz is written, otherwise a .tar is written
- * @param string|null directory in which to save the .tgz
- * @return string|PEAR_Error location of package or error object
- */
- function toTgz(&$packager, $compress = true, $where = null)
- {
- require_once 'Archive/Tar.php';
- if ($where === null) {
- if (!($where = System::mktemp(array('-d')))) {
- return PEAR::raiseError('PEAR_Packagefile_v1::toTgz: mktemp failed');
- }
- } elseif (!@System::mkDir(array('-p', $where))) {
- return PEAR::raiseError('PEAR_Packagefile_v1::toTgz: "' . $where . '" could' .
- ' not be created');
- }
- if (file_exists($where . DIRECTORY_SEPARATOR . 'package.xml') &&
- !is_file($where . DIRECTORY_SEPARATOR . 'package.xml')) {
- return PEAR::raiseError('PEAR_Packagefile_v1::toTgz: unable to save package.xml as' .
- ' "' . $where . DIRECTORY_SEPARATOR . 'package.xml"');
- }
- if (!$this->_packagefile->validate(PEAR_VALIDATE_PACKAGING)) {
- return PEAR::raiseError('PEAR_Packagefile_v1::toTgz: invalid package file');
- }
- $pkginfo = $this->_packagefile->getArray();
- $ext = $compress ? '.tgz' : '.tar';
- $pkgver = $pkginfo['package'] . '-' . $pkginfo['version'];
- $dest_package = getcwd() . DIRECTORY_SEPARATOR . $pkgver . $ext;
- if (file_exists(getcwd() . DIRECTORY_SEPARATOR . $pkgver . $ext) &&
- !is_file(getcwd() . DIRECTORY_SEPARATOR . $pkgver . $ext)) {
- return PEAR::raiseError('PEAR_Packagefile_v1::toTgz: cannot create tgz file "' .
- getcwd() . DIRECTORY_SEPARATOR . $pkgver . $ext . '"');
- }
- if ($pkgfile = $this->_packagefile->getPackageFile()) {
- $pkgdir = dirname(realpath($pkgfile));
- $pkgfile = basename($pkgfile);
- } else {
- return PEAR::raiseError('PEAR_Packagefile_v1::toTgz: package file object must ' .
- 'be created from a real file');
- }
- // {{{ Create the package file list
- $filelist = array();
- $i = 0;
-
- foreach ($this->_packagefile->getFilelist() as $fname => $atts) {
- $file = $pkgdir . DIRECTORY_SEPARATOR . $fname;
- if (!file_exists($file)) {
- return PEAR::raiseError("File does not exist: $fname");
- } else {
- $filelist[$i++] = $file;
- if (!isset($atts['md5sum'])) {
- $this->_packagefile->setFileAttribute($fname, 'md5sum', md5_file($file));
- }
- $packager->log(2, "Adding file $fname");
- }
- }
- // }}}
- $packagexml = $this->toPackageFile($where, PEAR_VALIDATE_PACKAGING, 'package.xml', true);
- if ($packagexml) {
- $tar = new Archive_Tar($dest_package, $compress);
- $tar->setErrorHandling(PEAR_ERROR_RETURN); // XXX Don't print errors
- // ----- Creates with the package.xml file
- $ok = $tar->createModify(array($packagexml), '', $where);
- if (PEAR::isError($ok)) {
- return $ok;
- } elseif (!$ok) {
- return PEAR::raiseError('PEAR_Packagefile_v1::toTgz: tarball creation failed');
- }
- // ----- Add the content of the package
- if (!$tar->addModify($filelist, $pkgver, $pkgdir)) {
- return PEAR::raiseError('PEAR_Packagefile_v1::toTgz: tarball creation failed');
- }
- return $dest_package;
- }
- }
-
- /**
- * @param string|null directory to place the package.xml in, or null for a temporary dir
- * @param int one of the PEAR_VALIDATE_* constants
- * @param string name of the generated file
- * @param bool if true, then no analysis will be performed on role="php" files
- * @return string|PEAR_Error path to the created file on success
- */
- function toPackageFile($where = null, $state = PEAR_VALIDATE_NORMAL, $name = 'package.xml',
- $nofilechecking = false)
- {
- if (!$this->_packagefile->validate($state, $nofilechecking)) {
- return PEAR::raiseError('PEAR_Packagefile_v1::toPackageFile: invalid package.xml',
- null, null, null, $this->_packagefile->getValidationWarnings());
- }
- if ($where === null) {
- if (!($where = System::mktemp(array('-d')))) {
- return PEAR::raiseError('PEAR_Packagefile_v1::toPackageFile: mktemp failed');
- }
- } elseif (!@System::mkDir(array('-p', $where))) {
- return PEAR::raiseError('PEAR_Packagefile_v1::toPackageFile: "' . $where . '" could' .
- ' not be created');
- }
- $newpkgfile = $where . DIRECTORY_SEPARATOR . $name;
- $np = @fopen($newpkgfile, 'wb');
- if (!$np) {
- return PEAR::raiseError('PEAR_Packagefile_v1::toPackageFile: unable to save ' .
- "$name as $newpkgfile");
- }
- fwrite($np, $this->toXml($state, true));
- fclose($np);
- return $newpkgfile;
- }
-
- /**
- * fix both XML encoding to be UTF8, and replace standard XML entities < > " & '
- *
- * @param string $string
- * @return string
- * @access private
- */
- function _fixXmlEncoding($string)
- {
- if (version_compare(phpversion(), '5.0.0', 'lt')) {
- $string = utf8_encode($string);
- }
- return strtr($string, array(
- '&' => '&amp;',
- '>' => '&gt;',
- '<' => '&lt;',
- '"' => '&quot;',
- '\'' => '&apos;' ));
- }
-
- /**
- * Return an XML document based on the package info (as returned
- * by the PEAR_Common::infoFrom* methods).
- *
- * @return string XML data
- */
- function toXml($state = PEAR_VALIDATE_NORMAL, $nofilevalidation = false)
- {
- $this->_packagefile->setDate(date('Y-m-d'));
- if (!$this->_packagefile->validate($state, $nofilevalidation)) {
- return false;
- }
- $pkginfo = $this->_packagefile->getArray();
- static $maint_map = array(
- "handle" => "user",
- "name" => "name",
- "email" => "email",
- "role" => "role",
- );
- $ret = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n";
- $ret .= "<!DOCTYPE package SYSTEM \"http://pear.php.net/dtd/package-1.0\">\n";
- $ret .= "<package version=\"1.0\" packagerversion=\"1.9.4\">\n" .
-" <name>$pkginfo[package]</name>";
- if (isset($pkginfo['extends'])) {
- $ret .= "\n<extends>$pkginfo[extends]</extends>";
- }
- $ret .=
- "\n <summary>".$this->_fixXmlEncoding($pkginfo['summary'])."</summary>\n" .
-" <description>".trim($this->_fixXmlEncoding($pkginfo['description']))."\n </description>\n" .
-" <maintainers>\n";
- foreach ($pkginfo['maintainers'] as $maint) {
- $ret .= " <maintainer>\n";
- foreach ($maint_map as $idx => $elm) {
- $ret .= " <$elm>";
- $ret .= $this->_fixXmlEncoding($maint[$idx]);
- $ret .= "</$elm>\n";
- }
- $ret .= " </maintainer>\n";
- }
- $ret .= " </maintainers>\n";
- $ret .= $this->_makeReleaseXml($pkginfo, false, $state);
- if (isset($pkginfo['changelog']) && count($pkginfo['changelog']) > 0) {
- $ret .= " <changelog>\n";
- foreach ($pkginfo['changelog'] as $oldrelease) {
- $ret .= $this->_makeReleaseXml($oldrelease, true);
- }
- $ret .= " </changelog>\n";
- }
- $ret .= "</package>\n";
- return $ret;
- }
-
- // }}}
- // {{{ _makeReleaseXml()
-
- /**
- * Generate part of an XML description with release information.
- *
- * @param array $pkginfo array with release information
- * @param bool $changelog whether the result will be in a changelog element
- *
- * @return string XML data
- *
- * @access private
- */
- function _makeReleaseXml($pkginfo, $changelog = false, $state = PEAR_VALIDATE_NORMAL)
- {
- // XXX QUOTE ENTITIES IN PCDATA, OR EMBED IN CDATA BLOCKS!!
- $indent = $changelog ? " " : "";
- $ret = "$indent <release>\n";
- if (!empty($pkginfo['version'])) {
- $ret .= "$indent <version>$pkginfo[version]</version>\n";
- }
- if (!empty($pkginfo['release_date'])) {
- $ret .= "$indent <date>$pkginfo[release_date]</date>\n";
- }
- if (!empty($pkginfo['release_license'])) {
- $ret .= "$indent <license>$pkginfo[release_license]</license>\n";
- }
- if (!empty($pkginfo['release_state'])) {
- $ret .= "$indent <state>$pkginfo[release_state]</state>\n";
- }
- if (!empty($pkginfo['release_notes'])) {
- $ret .= "$indent <notes>".trim($this->_fixXmlEncoding($pkginfo['release_notes']))
- ."\n$indent </notes>\n";
- }
- if (!empty($pkginfo['release_warnings'])) {
- $ret .= "$indent <warnings>".$this->_fixXmlEncoding($pkginfo['release_warnings'])."</warnings>\n";
- }
- if (isset($pkginfo['release_deps']) && sizeof($pkginfo['release_deps']) > 0) {
- $ret .= "$indent <deps>\n";
- foreach ($pkginfo['release_deps'] as $dep) {
- $ret .= "$indent <dep type=\"$dep[type]\" rel=\"$dep[rel]\"";
- if (isset($dep['version'])) {
- $ret .= " version=\"$dep[version]\"";
- }
- if (isset($dep['optional'])) {
- $ret .= " optional=\"$dep[optional]\"";
- }
- if (isset($dep['name'])) {
- $ret .= ">$dep[name]</dep>\n";
- } else {
- $ret .= "/>\n";
- }
- }
- $ret .= "$indent </deps>\n";
- }
- if (isset($pkginfo['configure_options'])) {
- $ret .= "$indent <configureoptions>\n";
- foreach ($pkginfo['configure_options'] as $c) {
- $ret .= "$indent <configureoption name=\"".
- $this->_fixXmlEncoding($c['name']) . "\"";
- if (isset($c['default'])) {
- $ret .= " default=\"" . $this->_fixXmlEncoding($c['default']) . "\"";
- }
- $ret .= " prompt=\"" . $this->_fixXmlEncoding($c['prompt']) . "\"";
- $ret .= "/>\n";
- }
- $ret .= "$indent </configureoptions>\n";
- }
- if (isset($pkginfo['provides'])) {
- foreach ($pkginfo['provides'] as $key => $what) {
- $ret .= "$indent <provides type=\"$what[type]\" ";
- $ret .= "name=\"$what[name]\" ";
- if (isset($what['extends'])) {
- $ret .= "extends=\"$what[extends]\" ";
- }
- $ret .= "/>\n";
- }
- }
- if (isset($pkginfo['filelist'])) {
- $ret .= "$indent <filelist>\n";
- if ($state ^ PEAR_VALIDATE_PACKAGING) {
- $ret .= $this->recursiveXmlFilelist($pkginfo['filelist']);
- } else {
- foreach ($pkginfo['filelist'] as $file => $fa) {
- if (!isset($fa['role'])) {
- $fa['role'] = '';
- }
- $ret .= "$indent <file role=\"$fa[role]\"";
- if (isset($fa['baseinstalldir'])) {
- $ret .= ' baseinstalldir="' .
- $this->_fixXmlEncoding($fa['baseinstalldir']) . '"';
- }
- if (isset($fa['md5sum'])) {
- $ret .= " md5sum=\"$fa[md5sum]\"";
- }
- if (isset($fa['platform'])) {
- $ret .= " platform=\"$fa[platform]\"";
- }
- if (!empty($fa['install-as'])) {
- $ret .= ' install-as="' .
- $this->_fixXmlEncoding($fa['install-as']) . '"';
- }
- $ret .= ' name="' . $this->_fixXmlEncoding($file) . '"';
- if (empty($fa['replacements'])) {
- $ret .= "/>\n";
- } else {
- $ret .= ">\n";
- foreach ($fa['replacements'] as $r) {
- $ret .= "$indent <replace";
- foreach ($r as $k => $v) {
- $ret .= " $k=\"" . $this->_fixXmlEncoding($v) .'"';
- }
- $ret .= "/>\n";
- }
- $ret .= "$indent </file>\n";
- }
- }
- }
- $ret .= "$indent </filelist>\n";
- }
- $ret .= "$indent </release>\n";
- return $ret;
- }
-
- /**
- * @param array
- * @access protected
- */
- function recursiveXmlFilelist($list)
- {
- $this->_dirs = array();
- foreach ($list as $file => $attributes) {
- $this->_addDir($this->_dirs, explode('/', dirname($file)), $file, $attributes);
- }
- return $this->_formatDir($this->_dirs);
- }
-
- /**
- * @param array
- * @param array
- * @param string|null
- * @param array|null
- * @access private
- */
- function _addDir(&$dirs, $dir, $file = null, $attributes = null)
- {
- if ($dir == array() || $dir == array('.')) {
- $dirs['files'][basename($file)] = $attributes;
- return;
- }
- $curdir = array_shift($dir);
- if (!isset($dirs['dirs'][$curdir])) {
- $dirs['dirs'][$curdir] = array();
- }
- $this->_addDir($dirs['dirs'][$curdir], $dir, $file, $attributes);
- }
-
- /**
- * @param array
- * @param string
- * @param string
- * @access private
- */
- function _formatDir($dirs, $indent = '', $curdir = '')
- {
- $ret = '';
- if (!count($dirs)) {
- return '';
- }
- if (isset($dirs['dirs'])) {
- uksort($dirs['dirs'], 'strnatcasecmp');
- foreach ($dirs['dirs'] as $dir => $contents) {
- $usedir = "$curdir/$dir";
- $ret .= "$indent <dir name=\"$dir\">\n";
- $ret .= $this->_formatDir($contents, "$indent ", $usedir);
- $ret .= "$indent </dir> <!-- $usedir -->\n";
- }
- }
- if (isset($dirs['files'])) {
- uksort($dirs['files'], 'strnatcasecmp');
- foreach ($dirs['files'] as $file => $attribs) {
- $ret .= $this->_formatFile($file, $attribs, $indent);
- }
- }
- return $ret;
- }
-
- /**
- * @param string
- * @param array
- * @param string
- * @access private
- */
- function _formatFile($file, $attributes, $indent)
- {
- $ret = "$indent <file role=\"$attributes[role]\"";
- if (isset($attributes['baseinstalldir'])) {
- $ret .= ' baseinstalldir="' .
- $this->_fixXmlEncoding($attributes['baseinstalldir']) . '"';
- }
- if (isset($attributes['md5sum'])) {
- $ret .= " md5sum=\"$attributes[md5sum]\"";
- }
- if (isset($attributes['platform'])) {
- $ret .= " platform=\"$attributes[platform]\"";
- }
- if (!empty($attributes['install-as'])) {
- $ret .= ' install-as="' .
- $this->_fixXmlEncoding($attributes['install-as']) . '"';
- }
- $ret .= ' name="' . $this->_fixXmlEncoding($file) . '"';
- if (empty($attributes['replacements'])) {
- $ret .= "/>\n";
- } else {
- $ret .= ">\n";
- foreach ($attributes['replacements'] as $r) {
- $ret .= "$indent <replace";
- foreach ($r as $k => $v) {
- $ret .= " $k=\"" . $this->_fixXmlEncoding($v) .'"';
- }
- $ret .= "/>\n";
- }
- $ret .= "$indent </file>\n";
- }
- return $ret;
- }
-
- // {{{ _unIndent()
-
- /**
- * Unindent given string (?)
- *
- * @param string $str The string that has to be unindented.
- * @return string
- * @access private
- */
- function _unIndent($str)
- {
- // remove leading newlines
- $str = preg_replace('/^[\r\n]+/', '', $str);
- // find whitespace at the beginning of the first line
- $indent_len = strspn($str, " \t");
- $indent = substr($str, 0, $indent_len);
- $data = '';
- // remove the same amount of whitespace from following lines
- foreach (explode("\n", $str) as $line) {
- if (substr($line, 0, $indent_len) == $indent) {
- $data .= substr($line, $indent_len) . "\n";
- }
- }
- return $data;
- }
-
- /**
- * @return array
- */
- function dependenciesToV2()
- {
- $arr = array();
- $this->_convertDependencies2_0($arr);
- return $arr['dependencies'];
- }
-
- /**
- * Convert a package.xml version 1.0 into version 2.0
- *
- * Note that this does a basic conversion, to allow more advanced
- * features like bundles and multiple releases
- * @param string the classname to instantiate and return. This must be
- * PEAR_PackageFile_v2 or a descendant
- * @param boolean if true, only valid, deterministic package.xml 1.0 as defined by the
- * strictest parameters will be converted
- * @return PEAR_PackageFile_v2|PEAR_Error
- */
- function &toV2($class = 'PEAR_PackageFile_v2', $strict = false)
- {
- if ($strict) {
- if (!$this->_packagefile->validate()) {
- $a = PEAR::raiseError('invalid package.xml version 1.0 cannot be converted' .
- ' to version 2.0', null, null, null,
- $this->_packagefile->getValidationWarnings(true));
- return $a;
- }
- }
-
- $arr = array(
- 'attribs' => array(
- 'version' => '2.0',
- 'xmlns' => 'http://pear.php.net/dtd/package-2.0',
- 'xmlns:tasks' => 'http://pear.php.net/dtd/tasks-1.0',
- 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
- 'xsi:schemaLocation' => "http://pear.php.net/dtd/tasks-1.0\n" .
-"http://pear.php.net/dtd/tasks-1.0.xsd\n" .
-"http://pear.php.net/dtd/package-2.0\n" .
-'http://pear.php.net/dtd/package-2.0.xsd',
- ),
- 'name' => $this->_packagefile->getPackage(),
- 'channel' => 'pear.php.net',
- );
- $arr['summary'] = $this->_packagefile->getSummary();
- $arr['description'] = $this->_packagefile->getDescription();
- $maintainers = $this->_packagefile->getMaintainers();
- foreach ($maintainers as $maintainer) {
- if ($maintainer['role'] != 'lead') {
- continue;
- }
- $new = array(
- 'name' => $maintainer['name'],
- 'user' => $maintainer['handle'],
- 'email' => $maintainer['email'],
- 'active' => 'yes',
- );
- $arr['lead'][] = $new;
- }
-
- if (!isset($arr['lead'])) { // some people... you know?
- $arr['lead'] = array(
- 'name' => 'unknown',
- 'user' => 'unknown',
- 'email' => 'noleadmaintainer@example.com',
- 'active' => 'no',
- );
- }
-
- if (count($arr['lead']) == 1) {
- $arr['lead'] = $arr['lead'][0];
- }
-
- foreach ($maintainers as $maintainer) {
- if ($maintainer['role'] == 'lead') {
- continue;
- }
- $new = array(
- 'name' => $maintainer['name'],
- 'user' => $maintainer['handle'],
- 'email' => $maintainer['email'],
- 'active' => 'yes',
- );
- $arr[$maintainer['role']][] = $new;
- }
-
- if (isset($arr['developer']) && count($arr['developer']) == 1) {
- $arr['developer'] = $arr['developer'][0];
- }
-
- if (isset($arr['contributor']) && count($arr['contributor']) == 1) {
- $arr['contributor'] = $arr['contributor'][0];
- }
-
- if (isset($arr['helper']) && count($arr['helper']) == 1) {
- $arr['helper'] = $arr['helper'][0];
- }
-
- $arr['date'] = $this->_packagefile->getDate();
- $arr['version'] =
- array(
- 'release' => $this->_packagefile->getVersion(),
- 'api' => $this->_packagefile->getVersion(),
- );
- $arr['stability'] =
- array(
- 'release' => $this->_packagefile->getState(),
- 'api' => $this->_packagefile->getState(),
- );
- $licensemap =
- array(
- 'php' => 'http://www.php.net/license',
- 'php license' => 'http://www.php.net/license',
- 'lgpl' => 'http://www.gnu.org/copyleft/lesser.html',
- 'bsd' => 'http://www.opensource.org/licenses/bsd-license.php',
- 'bsd style' => 'http://www.opensource.org/licenses/bsd-license.php',
- 'bsd-style' => 'http://www.opensource.org/licenses/bsd-license.php',
- 'mit' => 'http://www.opensource.org/licenses/mit-license.php',
- 'gpl' => 'http://www.gnu.org/copyleft/gpl.html',
- 'apache' => 'http://www.opensource.org/licenses/apache2.0.php'
- );
-
- if (isset($licensemap[strtolower($this->_packagefile->getLicense())])) {
- $arr['license'] = array(
- 'attribs' => array('uri' =>
- $licensemap[strtolower($this->_packagefile->getLicense())]),
- '_content' => $this->_packagefile->getLicense()
- );
- } else {
- // don't use bogus uri
- $arr['license'] = $this->_packagefile->getLicense();
- }
-
- $arr['notes'] = $this->_packagefile->getNotes();
- $temp = array();
- $arr['contents'] = $this->_convertFilelist2_0($temp);
- $this->_convertDependencies2_0($arr);
- $release = ($this->_packagefile->getConfigureOptions() || $this->_isExtension) ?
- 'extsrcrelease' : 'phprelease';
- if ($release == 'extsrcrelease') {
- $arr['channel'] = 'pecl.php.net';
- $arr['providesextension'] = $arr['name']; // assumption
- }
-
- $arr[$release] = array();
- if ($this->_packagefile->getConfigureOptions()) {
- $arr[$release]['configureoption'] = $this->_packagefile->getConfigureOptions();
- foreach ($arr[$release]['configureoption'] as $i => $opt) {
- $arr[$release]['configureoption'][$i] = array('attribs' => $opt);
- }
- if (count($arr[$release]['configureoption']) == 1) {
- $arr[$release]['configureoption'] = $arr[$release]['configureoption'][0];
- }
- }
-
- $this->_convertRelease2_0($arr[$release], $temp);
- if ($release == 'extsrcrelease' && count($arr[$release]) > 1) {
- // multiple extsrcrelease tags added in PEAR 1.4.1
- $arr['dependencies']['required']['pearinstaller']['min'] = '1.4.1';
- }
-
- if ($cl = $this->_packagefile->getChangelog()) {
- foreach ($cl as $release) {
- $rel = array();
- $rel['version'] =
- array(
- 'release' => $release['version'],
- 'api' => $release['version'],
- );
- if (!isset($release['release_state'])) {
- $release['release_state'] = 'stable';
- }
-
- $rel['stability'] =
- array(
- 'release' => $release['release_state'],
- 'api' => $release['release_state'],
- );
- if (isset($release['release_date'])) {
- $rel['date'] = $release['release_date'];
- } else {
- $rel['date'] = date('Y-m-d');
- }
-
- if (isset($release['release_license'])) {
- if (isset($licensemap[strtolower($release['release_license'])])) {
- $uri = $licensemap[strtolower($release['release_license'])];
- } else {
- $uri = 'http://www.example.com';
- }
- $rel['license'] = array(
- 'attribs' => array('uri' => $uri),
- '_content' => $release['release_license']
- );
- } else {
- $rel['license'] = $arr['license'];
- }
-
- if (!isset($release['release_notes'])) {
- $release['release_notes'] = 'no release notes';
- }
-
- $rel['notes'] = $release['release_notes'];
- $arr['changelog']['release'][] = $rel;
- }
- }
-
- $ret = new $class;
- $ret->setConfig($this->_packagefile->_config);
- if (isset($this->_packagefile->_logger) && is_object($this->_packagefile->_logger)) {
- $ret->setLogger($this->_packagefile->_logger);
- }
-
- $ret->fromArray($arr);
- return $ret;
- }
-
- /**
- * @param array
- * @param bool
- * @access private
- */
- function _convertDependencies2_0(&$release, $internal = false)
- {
- $peardep = array('pearinstaller' =>
- array('min' => '1.4.0b1')); // this is a lot safer
- $required = $optional = array();
- $release['dependencies'] = array('required' => array());
- if ($this->_packagefile->hasDeps()) {
- foreach ($this->_packagefile->getDeps() as $dep) {
- if (!isset($dep['optional']) || $dep['optional'] == 'no') {
- $required[] = $dep;
- } else {
- $optional[] = $dep;
- }
- }
- foreach (array('required', 'optional') as $arr) {
- $deps = array();
- foreach ($$arr as $dep) {
- // organize deps by dependency type and name
- if (!isset($deps[$dep['type']])) {
- $deps[$dep['type']] = array();
- }
- if (isset($dep['name'])) {
- $deps[$dep['type']][$dep['name']][] = $dep;
- } else {
- $deps[$dep['type']][] = $dep;
- }
- }
- do {
- if (isset($deps['php'])) {
- $php = array();
- if (count($deps['php']) > 1) {
- $php = $this->_processPhpDeps($deps['php']);
- } else {
- if (!isset($deps['php'][0])) {
- list($key, $blah) = each ($deps['php']); // stupid buggy versions
- $deps['php'] = array($blah[0]);
- }
- $php = $this->_processDep($deps['php'][0]);
- if (!$php) {
- break; // poor mans throw
- }
- }
- $release['dependencies'][$arr]['php'] = $php;
- }
- } while (false);
- do {
- if (isset($deps['pkg'])) {
- $pkg = array();
- $pkg = $this->_processMultipleDepsName($deps['pkg']);
- if (!$pkg) {
- break; // poor mans throw
- }
- $release['dependencies'][$arr]['package'] = $pkg;
- }
- } while (false);
- do {
- if (isset($deps['ext'])) {
- $pkg = array();
- $pkg = $this->_processMultipleDepsName($deps['ext']);
- $release['dependencies'][$arr]['extension'] = $pkg;
- }
- } while (false);
- // skip sapi - it's not supported so nobody will have used it
- // skip os - it's not supported in 1.0
- }
- }
- if (isset($release['dependencies']['required'])) {
- $release['dependencies']['required'] =
- array_merge($peardep, $release['dependencies']['required']);
- } else {
- $release['dependencies']['required'] = $peardep;
- }
- if (!isset($release['dependencies']['required']['php'])) {
- $release['dependencies']['required']['php'] =
- array('min' => '4.0.0');
- }
- $order = array();
- $bewm = $release['dependencies']['required'];
- $order['php'] = $bewm['php'];
- $order['pearinstaller'] = $bewm['pearinstaller'];
- isset($bewm['package']) ? $order['package'] = $bewm['package'] :0;
- isset($bewm['extension']) ? $order['extension'] = $bewm['extension'] :0;
- $release['dependencies']['required'] = $order;
- }
-
- /**
- * @param array
- * @access private
- */
- function _convertFilelist2_0(&$package)
- {
- $ret = array('dir' =>
- array(
- 'attribs' => array('name' => '/'),
- 'file' => array()
- )
- );
- $package['platform'] =
- $package['install-as'] = array();
- $this->_isExtension = false;
- foreach ($this->_packagefile->getFilelist() as $name => $file) {
- $file['name'] = $name;
- if (isset($file['role']) && $file['role'] == 'src') {
- $this->_isExtension = true;
- }
- if (isset($file['replacements'])) {
- $repl = $file['replacements'];
- unset($file['replacements']);
- } else {
- unset($repl);
- }
- if (isset($file['install-as'])) {
- $package['install-as'][$name] = $file['install-as'];
- unset($file['install-as']);
- }
- if (isset($file['platform'])) {
- $package['platform'][$name] = $file['platform'];
- unset($file['platform']);
- }
- $file = array('attribs' => $file);
- if (isset($repl)) {
- foreach ($repl as $replace ) {
- $file['tasks:replace'][] = array('attribs' => $replace);
- }
- if (count($repl) == 1) {
- $file['tasks:replace'] = $file['tasks:replace'][0];
- }
- }
- $ret['dir']['file'][] = $file;
- }
- return $ret;
- }
-
- /**
- * Post-process special files with install-as/platform attributes and
- * make the release tag.
- *
- * This complex method follows this work-flow to create the release tags:
- *
- * <pre>
- * - if any install-as/platform exist, create a generic release and fill it with
- * o <install as=..> tags for <file name=... install-as=...>
- * o <install as=..> tags for <file name=... platform=!... install-as=..>
- * o <ignore> tags for <file name=... platform=...>
- * o <ignore> tags for <file name=... platform=... install-as=..>
- * - create a release for each platform encountered and fill with
- * o <install as..> tags for <file name=... install-as=...>
- * o <install as..> tags for <file name=... platform=this platform install-as=..>
- * o <install as..> tags for <file name=... platform=!other platform install-as=..>
- * o <ignore> tags for <file name=... platform=!this platform>
- * o <ignore> tags for <file name=... platform=other platform>
- * o <ignore> tags for <file name=... platform=other platform install-as=..>
- * o <ignore> tags for <file name=... platform=!this platform install-as=..>
- * </pre>
- *
- * It does this by accessing the $package parameter, which contains an array with
- * indices:
- *
- * - platform: mapping of file => OS the file should be installed on
- * - install-as: mapping of file => installed name
- * - osmap: mapping of OS => list of files that should be installed
- * on that OS
- * - notosmap: mapping of OS => list of files that should not be
- * installed on that OS
- *
- * @param array
- * @param array
- * @access private
- */
- function _convertRelease2_0(&$release, $package)
- {
- //- if any install-as/platform exist, create a generic release and fill it with
- if (count($package['platform']) || count($package['install-as'])) {
- $generic = array();
- $genericIgnore = array();
- foreach ($package['install-as'] as $file => $as) {
- //o <install as=..> tags for <file name=... install-as=...>
- if (!isset($package['platform'][$file])) {
- $generic[] = $file;
- continue;
- }
- //o <install as=..> tags for <file name=... platform=!... install-as=..>
- if (isset($package['platform'][$file]) &&
- $package['platform'][$file]{0} == '!') {
- $generic[] = $file;
- continue;
- }
- //o <ignore> tags for <file name=... platform=... install-as=..>
- if (isset($package['platform'][$file]) &&
- $package['platform'][$file]{0} != '!') {
- $genericIgnore[] = $file;
- continue;
- }
- }
- foreach ($package['platform'] as $file => $platform) {
- if (isset($package['install-as'][$file])) {
- continue;
- }
- if ($platform{0} != '!') {
- //o <ignore> tags for <file name=... platform=...>
- $genericIgnore[] = $file;
- }
- }
- if (count($package['platform'])) {
- $oses = $notplatform = $platform = array();
- foreach ($package['platform'] as $file => $os) {
- // get a list of oses
- if ($os{0} == '!') {
- if (isset($oses[substr($os, 1)])) {
- continue;
- }
- $oses[substr($os, 1)] = count($oses);
- } else {
- if (isset($oses[$os])) {
- continue;
- }
- $oses[$os] = count($oses);
- }
- }
- //- create a release for each platform encountered and fill with
- foreach ($oses as $os => $releaseNum) {
- $release[$releaseNum]['installconditions']['os']['name'] = $os;
- $release[$releaseNum]['filelist'] = array('install' => array(),
- 'ignore' => array());
- foreach ($package['install-as'] as $file => $as) {
- //o <install as=..> tags for <file name=... install-as=...>
- if (!isset($package['platform'][$file])) {
- $release[$releaseNum]['filelist']['install'][] =
- array(
- 'attribs' => array(
- 'name' => $file,
- 'as' => $as,
- ),
- );
- continue;
- }
- //o <install as..> tags for
- // <file name=... platform=this platform install-as=..>
- if (isset($package['platform'][$file]) &&
- $package['platform'][$file] == $os) {
- $release[$releaseNum]['filelist']['install'][] =
- array(
- 'attribs' => array(
- 'name' => $file,
- 'as' => $as,
- ),
- );
- continue;
- }
- //o <install as..> tags for
- // <file name=... platform=!other platform install-as=..>
- if (isset($package['platform'][$file]) &&
- $package['platform'][$file] != "!$os" &&
- $package['platform'][$file]{0} == '!') {
- $release[$releaseNum]['filelist']['install'][] =
- array(
- 'attribs' => array(
- 'name' => $file,
- 'as' => $as,
- ),
- );
- continue;
- }
- //o <ignore> tags for
- // <file name=... platform=!this platform install-as=..>
- if (isset($package['platform'][$file]) &&
- $package['platform'][$file] == "!$os") {
- $release[$releaseNum]['filelist']['ignore'][] =
- array(
- 'attribs' => array(
- 'name' => $file,
- ),
- );
- continue;
- }
- //o <ignore> tags for
- // <file name=... platform=other platform install-as=..>
- if (isset($package['platform'][$file]) &&
- $package['platform'][$file]{0} != '!' &&
- $package['platform'][$file] != $os) {
- $release[$releaseNum]['filelist']['ignore'][] =
- array(
- 'attribs' => array(
- 'name' => $file,
- ),
- );
- continue;
- }
- }
- foreach ($package['platform'] as $file => $platform) {
- if (isset($package['install-as'][$file])) {
- continue;
- }
- //o <ignore> tags for <file name=... platform=!this platform>
- if ($platform == "!$os") {
- $release[$releaseNum]['filelist']['ignore'][] =
- array(
- 'attribs' => array(
- 'name' => $file,
- ),
- );
- continue;
- }
- //o <ignore> tags for <file name=... platform=other platform>
- if ($platform{0} != '!' && $platform != $os) {
- $release[$releaseNum]['filelist']['ignore'][] =
- array(
- 'attribs' => array(
- 'name' => $file,
- ),
- );
- }
- }
- if (!count($release[$releaseNum]['filelist']['install'])) {
- unset($release[$releaseNum]['filelist']['install']);
- }
- if (!count($release[$releaseNum]['filelist']['ignore'])) {
- unset($release[$releaseNum]['filelist']['ignore']);
- }
- }
- if (count($generic) || count($genericIgnore)) {
- $release[count($oses)] = array();
- if (count($generic)) {
- foreach ($generic as $file) {
- if (isset($package['install-as'][$file])) {
- $installas = $package['install-as'][$file];
- } else {
- $installas = $file;
- }
- $release[count($oses)]['filelist']['install'][] =
- array(
- 'attribs' => array(
- 'name' => $file,
- 'as' => $installas,
- )
- );
- }
- }
- if (count($genericIgnore)) {
- foreach ($genericIgnore as $file) {
- $release[count($oses)]['filelist']['ignore'][] =
- array(
- 'attribs' => array(
- 'name' => $file,
- )
- );
- }
- }
- }
- // cleanup
- foreach ($release as $i => $rel) {
- if (isset($rel['filelist']['install']) &&
- count($rel['filelist']['install']) == 1) {
- $release[$i]['filelist']['install'] =
- $release[$i]['filelist']['install'][0];
- }
- if (isset($rel['filelist']['ignore']) &&
- count($rel['filelist']['ignore']) == 1) {
- $release[$i]['filelist']['ignore'] =
- $release[$i]['filelist']['ignore'][0];
- }
- }
- if (count($release) == 1) {
- $release = $release[0];
- }
- } else {
- // no platform atts, but some install-as atts
- foreach ($package['install-as'] as $file => $value) {
- $release['filelist']['install'][] =
- array(
- 'attribs' => array(
- 'name' => $file,
- 'as' => $value
- )
- );
- }
- if (count($release['filelist']['install']) == 1) {
- $release['filelist']['install'] = $release['filelist']['install'][0];
- }
- }
- }
- }
-
- /**
- * @param array
- * @return array
- * @access private
- */
- function _processDep($dep)
- {
- if ($dep['type'] == 'php') {
- if ($dep['rel'] == 'has') {
- // come on - everyone has php!
- return false;
- }
- }
- $php = array();
- if ($dep['type'] != 'php') {
- $php['name'] = $dep['name'];
- if ($dep['type'] == 'pkg') {
- $php['channel'] = 'pear.php.net';
- }
- }
- switch ($dep['rel']) {
- case 'gt' :
- $php['min'] = $dep['version'];
- $php['exclude'] = $dep['version'];
- break;
- case 'ge' :
- if (!isset($dep['version'])) {
- if ($dep['type'] == 'php') {
- if (isset($dep['name'])) {
- $dep['version'] = $dep['name'];
- }
- }
- }
- $php['min'] = $dep['version'];
- break;
- case 'lt' :
- $php['max'] = $dep['version'];
- $php['exclude'] = $dep['version'];
- break;
- case 'le' :
- $php['max'] = $dep['version'];
- break;
- case 'eq' :
- $php['min'] = $dep['version'];
- $php['max'] = $dep['version'];
- break;
- case 'ne' :
- $php['exclude'] = $dep['version'];
- break;
- case 'not' :
- $php['conflicts'] = 'yes';
- break;
- }
- return $php;
- }
-
- /**
- * @param array
- * @return array
- */
- function _processPhpDeps($deps)
- {
- $test = array();
- foreach ($deps as $dep) {
- $test[] = $this->_processDep($dep);
- }
- $min = array();
- $max = array();
- foreach ($test as $dep) {
- if (!$dep) {
- continue;
- }
- if (isset($dep['min'])) {
- $min[$dep['min']] = count($min);
- }
- if (isset($dep['max'])) {
- $max[$dep['max']] = count($max);
- }
- }
- if (count($min) > 0) {
- uksort($min, 'version_compare');
- }
- if (count($max) > 0) {
- uksort($max, 'version_compare');
- }
- if (count($min)) {
- // get the highest minimum
- $min = array_pop($a = array_flip($min));
- } else {
- $min = false;
- }
- if (count($max)) {
- // get the lowest maximum
- $max = array_shift($a = array_flip($max));
- } else {
- $max = false;
- }
- if ($min) {
- $php['min'] = $min;
- }
- if ($max) {
- $php['max'] = $max;
- }
- $exclude = array();
- foreach ($test as $dep) {
- if (!isset($dep['exclude'])) {
- continue;
- }
- $exclude[] = $dep['exclude'];
- }
- if (count($exclude)) {
- $php['exclude'] = $exclude;
- }
- return $php;
- }
-
- /**
- * process multiple dependencies that have a name, like package deps
- * @param array
- * @return array
- * @access private
- */
- function _processMultipleDepsName($deps)
- {
- $ret = $tests = array();
- foreach ($deps as $name => $dep) {
- foreach ($dep as $d) {
- $tests[$name][] = $this->_processDep($d);
- }
- }
-
- foreach ($tests as $name => $test) {
- $max = $min = $php = array();
- $php['name'] = $name;
- foreach ($test as $dep) {
- if (!$dep) {
- continue;
- }
- if (isset($dep['channel'])) {
- $php['channel'] = 'pear.php.net';
- }
- if (isset($dep['conflicts']) && $dep['conflicts'] == 'yes') {
- $php['conflicts'] = 'yes';
- }
- if (isset($dep['min'])) {
- $min[$dep['min']] = count($min);
- }
- if (isset($dep['max'])) {
- $max[$dep['max']] = count($max);
- }
- }
- if (count($min) > 0) {
- uksort($min, 'version_compare');
- }
- if (count($max) > 0) {
- uksort($max, 'version_compare');
- }
- if (count($min)) {
- // get the highest minimum
- $min = array_pop($a = array_flip($min));
- } else {
- $min = false;
- }
- if (count($max)) {
- // get the lowest maximum
- $max = array_shift($a = array_flip($max));
- } else {
- $max = false;
- }
- if ($min) {
- $php['min'] = $min;
- }
- if ($max) {
- $php['max'] = $max;
- }
- $exclude = array();
- foreach ($test as $dep) {
- if (!isset($dep['exclude'])) {
- continue;
- }
- $exclude[] = $dep['exclude'];
- }
- if (count($exclude)) {
- $php['exclude'] = $exclude;
- }
- $ret[] = $php;
- }
- return $ret;
- }
-}
-?> \ No newline at end of file
diff --git a/3rdparty/PEAR/PackageFile/Generator/v2.php b/3rdparty/PEAR/PackageFile/Generator/v2.php
deleted file mode 100644
index 8250e0ac4d0..00000000000
--- a/3rdparty/PEAR/PackageFile/Generator/v2.php
+++ /dev/null
@@ -1,893 +0,0 @@
-<?php
-/**
- * package.xml generation class, package.xml version 2.0
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @author Stephan Schmidt (original XML_Serializer code)
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: v2.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a1
- */
-/**
- * file/dir manipulation routines
- */
-require_once 'System.php';
-require_once 'XML/Util.php';
-
-/**
- * This class converts a PEAR_PackageFile_v2 object into any output format.
- *
- * Supported output formats include array, XML string (using S. Schmidt's
- * XML_Serializer, slightly customized)
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @author Stephan Schmidt (original XML_Serializer code)
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a1
- */
-class PEAR_PackageFile_Generator_v2
-{
- /**
- * default options for the serialization
- * @access private
- * @var array $_defaultOptions
- */
- var $_defaultOptions = array(
- 'indent' => ' ', // string used for indentation
- 'linebreak' => "\n", // string used for newlines
- 'typeHints' => false, // automatically add type hin attributes
- 'addDecl' => true, // add an XML declaration
- 'defaultTagName' => 'XML_Serializer_Tag', // tag used for indexed arrays or invalid names
- 'classAsTagName' => false, // use classname for objects in indexed arrays
- 'keyAttribute' => '_originalKey', // attribute where original key is stored
- 'typeAttribute' => '_type', // attribute for type (only if typeHints => true)
- 'classAttribute' => '_class', // attribute for class of objects (only if typeHints => true)
- 'scalarAsAttributes' => false, // scalar values (strings, ints,..) will be serialized as attribute
- 'prependAttributes' => '', // prepend string for attributes
- 'indentAttributes' => false, // indent the attributes, if set to '_auto', it will indent attributes so they all start at the same column
- 'mode' => 'simplexml', // use 'simplexml' to use parent name as tagname if transforming an indexed array
- 'addDoctype' => false, // add a doctype declaration
- 'doctype' => null, // supply a string or an array with id and uri ({@see XML_Util::getDoctypeDeclaration()}
- 'rootName' => 'package', // name of the root tag
- 'rootAttributes' => array(
- 'version' => '2.0',
- 'xmlns' => 'http://pear.php.net/dtd/package-2.0',
- 'xmlns:tasks' => 'http://pear.php.net/dtd/tasks-1.0',
- 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
- 'xsi:schemaLocation' => 'http://pear.php.net/dtd/tasks-1.0
-http://pear.php.net/dtd/tasks-1.0.xsd
-http://pear.php.net/dtd/package-2.0
-http://pear.php.net/dtd/package-2.0.xsd',
- ), // attributes of the root tag
- 'attributesArray' => 'attribs', // all values in this key will be treated as attributes
- 'contentName' => '_content', // this value will be used directly as content, instead of creating a new tag, may only be used in conjuction with attributesArray
- 'beautifyFilelist' => false,
- 'encoding' => 'UTF-8',
- );
-
- /**
- * options for the serialization
- * @access private
- * @var array $options
- */
- var $options = array();
-
- /**
- * current tag depth
- * @var integer $_tagDepth
- */
- var $_tagDepth = 0;
-
- /**
- * serilialized representation of the data
- * @var string $_serializedData
- */
- var $_serializedData = null;
- /**
- * @var PEAR_PackageFile_v2
- */
- var $_packagefile;
- /**
- * @param PEAR_PackageFile_v2
- */
- function PEAR_PackageFile_Generator_v2(&$packagefile)
- {
- $this->_packagefile = &$packagefile;
- if (isset($this->_packagefile->encoding)) {
- $this->_defaultOptions['encoding'] = $this->_packagefile->encoding;
- }
- }
-
- /**
- * @return string
- */
- function getPackagerVersion()
- {
- return '1.9.4';
- }
-
- /**
- * @param PEAR_Packager
- * @param bool generate a .tgz or a .tar
- * @param string|null temporary directory to package in
- */
- function toTgz(&$packager, $compress = true, $where = null)
- {
- $a = null;
- return $this->toTgz2($packager, $a, $compress, $where);
- }
-
- /**
- * Package up both a package.xml and package2.xml for the same release
- * @param PEAR_Packager
- * @param PEAR_PackageFile_v1
- * @param bool generate a .tgz or a .tar
- * @param string|null temporary directory to package in
- */
- function toTgz2(&$packager, &$pf1, $compress = true, $where = null)
- {
- require_once 'Archive/Tar.php';
- if (!$this->_packagefile->isEquivalent($pf1)) {
- return PEAR::raiseError('PEAR_Packagefile_v2::toTgz: "' .
- basename($pf1->getPackageFile()) .
- '" is not equivalent to "' . basename($this->_packagefile->getPackageFile())
- . '"');
- }
-
- if ($where === null) {
- if (!($where = System::mktemp(array('-d')))) {
- return PEAR::raiseError('PEAR_Packagefile_v2::toTgz: mktemp failed');
- }
- } elseif (!@System::mkDir(array('-p', $where))) {
- return PEAR::raiseError('PEAR_Packagefile_v2::toTgz: "' . $where . '" could' .
- ' not be created');
- }
-
- $file = $where . DIRECTORY_SEPARATOR . 'package.xml';
- if (file_exists($file) && !is_file($file)) {
- return PEAR::raiseError('PEAR_Packagefile_v2::toTgz: unable to save package.xml as' .
- ' "' . $file .'"');
- }
-
- if (!$this->_packagefile->validate(PEAR_VALIDATE_PACKAGING)) {
- return PEAR::raiseError('PEAR_Packagefile_v2::toTgz: invalid package.xml');
- }
-
- $ext = $compress ? '.tgz' : '.tar';
- $pkgver = $this->_packagefile->getPackage() . '-' . $this->_packagefile->getVersion();
- $dest_package = getcwd() . DIRECTORY_SEPARATOR . $pkgver . $ext;
- if (file_exists($dest_package) && !is_file($dest_package)) {
- return PEAR::raiseError('PEAR_Packagefile_v2::toTgz: cannot create tgz file "' .
- $dest_package . '"');
- }
-
- $pkgfile = $this->_packagefile->getPackageFile();
- if (!$pkgfile) {
- return PEAR::raiseError('PEAR_Packagefile_v2::toTgz: package file object must ' .
- 'be created from a real file');
- }
-
- $pkgdir = dirname(realpath($pkgfile));
- $pkgfile = basename($pkgfile);
-
- // {{{ Create the package file list
- $filelist = array();
- $i = 0;
- $this->_packagefile->flattenFilelist();
- $contents = $this->_packagefile->getContents();
- if (isset($contents['bundledpackage'])) { // bundles of packages
- $contents = $contents['bundledpackage'];
- if (!isset($contents[0])) {
- $contents = array($contents);
- }
-
- $packageDir = $where;
- foreach ($contents as $i => $package) {
- $fname = $package;
- $file = $pkgdir . DIRECTORY_SEPARATOR . $fname;
- if (!file_exists($file)) {
- return $packager->raiseError("File does not exist: $fname");
- }
-
- $tfile = $packageDir . DIRECTORY_SEPARATOR . $fname;
- System::mkdir(array('-p', dirname($tfile)));
- copy($file, $tfile);
- $filelist[$i++] = $tfile;
- $packager->log(2, "Adding package $fname");
- }
- } else { // normal packages
- $contents = $contents['dir']['file'];
- if (!isset($contents[0])) {
- $contents = array($contents);
- }
-
- $packageDir = $where;
- foreach ($contents as $i => $file) {
- $fname = $file['attribs']['name'];
- $atts = $file['attribs'];
- $orig = $file;
- $file = $pkgdir . DIRECTORY_SEPARATOR . $fname;
- if (!file_exists($file)) {
- return $packager->raiseError("File does not exist: $fname");
- }
-
- $origperms = fileperms($file);
- $tfile = $packageDir . DIRECTORY_SEPARATOR . $fname;
- unset($orig['attribs']);
- if (count($orig)) { // file with tasks
- // run any package-time tasks
- $contents = file_get_contents($file);
- foreach ($orig as $tag => $raw) {
- $tag = str_replace(
- array($this->_packagefile->getTasksNs() . ':', '-'),
- array('', '_'), $tag);
- $task = "PEAR_Task_$tag";
- $task = &new $task($this->_packagefile->_config,
- $this->_packagefile->_logger,
- PEAR_TASK_PACKAGE);
- $task->init($raw, $atts, null);
- $res = $task->startSession($this->_packagefile, $contents, $tfile);
- if (!$res) {
- continue; // skip this task
- }
-
- if (PEAR::isError($res)) {
- return $res;
- }
-
- $contents = $res; // save changes
- System::mkdir(array('-p', dirname($tfile)));
- $wp = fopen($tfile, "wb");
- fwrite($wp, $contents);
- fclose($wp);
- }
- }
-
- if (!file_exists($tfile)) {
- System::mkdir(array('-p', dirname($tfile)));
- copy($file, $tfile);
- }
-
- chmod($tfile, $origperms);
- $filelist[$i++] = $tfile;
- $this->_packagefile->setFileAttribute($fname, 'md5sum', md5_file($tfile), $i - 1);
- $packager->log(2, "Adding file $fname");
- }
- }
- // }}}
-
- $name = $pf1 !== null ? 'package2.xml' : 'package.xml';
- $packagexml = $this->toPackageFile($where, PEAR_VALIDATE_PACKAGING, $name);
- if ($packagexml) {
- $tar = new Archive_Tar($dest_package, $compress);
- $tar->setErrorHandling(PEAR_ERROR_RETURN); // XXX Don't print errors
- // ----- Creates with the package.xml file
- $ok = $tar->createModify(array($packagexml), '', $where);
- if (PEAR::isError($ok)) {
- return $packager->raiseError($ok);
- } elseif (!$ok) {
- return $packager->raiseError('PEAR_Packagefile_v2::toTgz(): adding ' . $name .
- ' failed');
- }
-
- // ----- Add the content of the package
- if (!$tar->addModify($filelist, $pkgver, $where)) {
- return $packager->raiseError(
- 'PEAR_Packagefile_v2::toTgz(): tarball creation failed');
- }
-
- // add the package.xml version 1.0
- if ($pf1 !== null) {
- $pfgen = &$pf1->getDefaultGenerator();
- $packagexml1 = $pfgen->toPackageFile($where, PEAR_VALIDATE_PACKAGING, 'package.xml', true);
- if (!$tar->addModify(array($packagexml1), '', $where)) {
- return $packager->raiseError(
- 'PEAR_Packagefile_v2::toTgz(): adding package.xml failed');
- }
- }
-
- return $dest_package;
- }
- }
-
- function toPackageFile($where = null, $state = PEAR_VALIDATE_NORMAL, $name = 'package.xml')
- {
- if (!$this->_packagefile->validate($state)) {
- return PEAR::raiseError('PEAR_Packagefile_v2::toPackageFile: invalid package.xml',
- null, null, null, $this->_packagefile->getValidationWarnings());
- }
-
- if ($where === null) {
- if (!($where = System::mktemp(array('-d')))) {
- return PEAR::raiseError('PEAR_Packagefile_v2::toPackageFile: mktemp failed');
- }
- } elseif (!@System::mkDir(array('-p', $where))) {
- return PEAR::raiseError('PEAR_Packagefile_v2::toPackageFile: "' . $where . '" could' .
- ' not be created');
- }
-
- $newpkgfile = $where . DIRECTORY_SEPARATOR . $name;
- $np = @fopen($newpkgfile, 'wb');
- if (!$np) {
- return PEAR::raiseError('PEAR_Packagefile_v2::toPackageFile: unable to save ' .
- "$name as $newpkgfile");
- }
- fwrite($np, $this->toXml($state));
- fclose($np);
- return $newpkgfile;
- }
-
- function &toV2()
- {
- return $this->_packagefile;
- }
-
- /**
- * Return an XML document based on the package info (as returned
- * by the PEAR_Common::infoFrom* methods).
- *
- * @return string XML data
- */
- function toXml($state = PEAR_VALIDATE_NORMAL, $options = array())
- {
- $this->_packagefile->setDate(date('Y-m-d'));
- $this->_packagefile->setTime(date('H:i:s'));
- if (!$this->_packagefile->validate($state)) {
- return false;
- }
-
- if (is_array($options)) {
- $this->options = array_merge($this->_defaultOptions, $options);
- } else {
- $this->options = $this->_defaultOptions;
- }
-
- $arr = $this->_packagefile->getArray();
- if (isset($arr['filelist'])) {
- unset($arr['filelist']);
- }
-
- if (isset($arr['_lastversion'])) {
- unset($arr['_lastversion']);
- }
-
- // Fix the notes a little bit
- if (isset($arr['notes'])) {
- // This trims out the indenting, needs fixing
- $arr['notes'] = "\n" . trim($arr['notes']) . "\n";
- }
-
- if (isset($arr['changelog']) && !empty($arr['changelog'])) {
- // Fix for inconsistency how the array is filled depending on the changelog release amount
- if (!isset($arr['changelog']['release'][0])) {
- $release = $arr['changelog']['release'];
- unset($arr['changelog']['release']);
-
- $arr['changelog']['release'] = array();
- $arr['changelog']['release'][0] = $release;
- }
-
- foreach (array_keys($arr['changelog']['release']) as $key) {
- $c =& $arr['changelog']['release'][$key];
- if (isset($c['notes'])) {
- // This trims out the indenting, needs fixing
- $c['notes'] = "\n" . trim($c['notes']) . "\n";
- }
- }
- }
-
- if ($state ^ PEAR_VALIDATE_PACKAGING && !isset($arr['bundle'])) {
- $use = $this->_recursiveXmlFilelist($arr['contents']['dir']['file']);
- unset($arr['contents']['dir']['file']);
- if (isset($use['dir'])) {
- $arr['contents']['dir']['dir'] = $use['dir'];
- }
- if (isset($use['file'])) {
- $arr['contents']['dir']['file'] = $use['file'];
- }
- $this->options['beautifyFilelist'] = true;
- }
-
- $arr['attribs']['packagerversion'] = '1.9.4';
- if ($this->serialize($arr, $options)) {
- return $this->_serializedData . "\n";
- }
-
- return false;
- }
-
-
- function _recursiveXmlFilelist($list)
- {
- $dirs = array();
- if (isset($list['attribs'])) {
- $file = $list['attribs']['name'];
- unset($list['attribs']['name']);
- $attributes = $list['attribs'];
- $this->_addDir($dirs, explode('/', dirname($file)), $file, $attributes);
- } else {
- foreach ($list as $a) {
- $file = $a['attribs']['name'];
- $attributes = $a['attribs'];
- unset($a['attribs']);
- $this->_addDir($dirs, explode('/', dirname($file)), $file, $attributes, $a);
- }
- }
- $this->_formatDir($dirs);
- $this->_deFormat($dirs);
- return $dirs;
- }
-
- function _addDir(&$dirs, $dir, $file = null, $attributes = null, $tasks = null)
- {
- if (!$tasks) {
- $tasks = array();
- }
- if ($dir == array() || $dir == array('.')) {
- $dirs['file'][basename($file)] = $tasks;
- $attributes['name'] = basename($file);
- $dirs['file'][basename($file)]['attribs'] = $attributes;
- return;
- }
- $curdir = array_shift($dir);
- if (!isset($dirs['dir'][$curdir])) {
- $dirs['dir'][$curdir] = array();
- }
- $this->_addDir($dirs['dir'][$curdir], $dir, $file, $attributes, $tasks);
- }
-
- function _formatDir(&$dirs)
- {
- if (!count($dirs)) {
- return array();
- }
- $newdirs = array();
- if (isset($dirs['dir'])) {
- $newdirs['dir'] = $dirs['dir'];
- }
- if (isset($dirs['file'])) {
- $newdirs['file'] = $dirs['file'];
- }
- $dirs = $newdirs;
- if (isset($dirs['dir'])) {
- uksort($dirs['dir'], 'strnatcasecmp');
- foreach ($dirs['dir'] as $dir => $contents) {
- $this->_formatDir($dirs['dir'][$dir]);
- }
- }
- if (isset($dirs['file'])) {
- uksort($dirs['file'], 'strnatcasecmp');
- };
- }
-
- function _deFormat(&$dirs)
- {
- if (!count($dirs)) {
- return array();
- }
- $newdirs = array();
- if (isset($dirs['dir'])) {
- foreach ($dirs['dir'] as $dir => $contents) {
- $newdir = array();
- $newdir['attribs']['name'] = $dir;
- $this->_deFormat($contents);
- foreach ($contents as $tag => $val) {
- $newdir[$tag] = $val;
- }
- $newdirs['dir'][] = $newdir;
- }
- if (count($newdirs['dir']) == 1) {
- $newdirs['dir'] = $newdirs['dir'][0];
- }
- }
- if (isset($dirs['file'])) {
- foreach ($dirs['file'] as $name => $file) {
- $newdirs['file'][] = $file;
- }
- if (count($newdirs['file']) == 1) {
- $newdirs['file'] = $newdirs['file'][0];
- }
- }
- $dirs = $newdirs;
- }
-
- /**
- * reset all options to default options
- *
- * @access public
- * @see setOption(), XML_Unserializer()
- */
- function resetOptions()
- {
- $this->options = $this->_defaultOptions;
- }
-
- /**
- * set an option
- *
- * You can use this method if you do not want to set all options in the constructor
- *
- * @access public
- * @see resetOption(), XML_Serializer()
- */
- function setOption($name, $value)
- {
- $this->options[$name] = $value;
- }
-
- /**
- * sets several options at once
- *
- * You can use this method if you do not want to set all options in the constructor
- *
- * @access public
- * @see resetOption(), XML_Unserializer(), setOption()
- */
- function setOptions($options)
- {
- $this->options = array_merge($this->options, $options);
- }
-
- /**
- * serialize data
- *
- * @access public
- * @param mixed $data data to serialize
- * @return boolean true on success, pear error on failure
- */
- function serialize($data, $options = null)
- {
- // if options have been specified, use them instead
- // of the previously defined ones
- if (is_array($options)) {
- $optionsBak = $this->options;
- if (isset($options['overrideOptions']) && $options['overrideOptions'] == true) {
- $this->options = array_merge($this->_defaultOptions, $options);
- } else {
- $this->options = array_merge($this->options, $options);
- }
- } else {
- $optionsBak = null;
- }
-
- // start depth is zero
- $this->_tagDepth = 0;
- $this->_serializedData = '';
- // serialize an array
- if (is_array($data)) {
- $tagName = isset($this->options['rootName']) ? $this->options['rootName'] : 'array';
- $this->_serializedData .= $this->_serializeArray($data, $tagName, $this->options['rootAttributes']);
- }
-
- // add doctype declaration
- if ($this->options['addDoctype'] === true) {
- $this->_serializedData = XML_Util::getDoctypeDeclaration($tagName, $this->options['doctype'])
- . $this->options['linebreak']
- . $this->_serializedData;
- }
-
- // build xml declaration
- if ($this->options['addDecl']) {
- $atts = array();
- $encoding = isset($this->options['encoding']) ? $this->options['encoding'] : null;
- $this->_serializedData = XML_Util::getXMLDeclaration('1.0', $encoding)
- . $this->options['linebreak']
- . $this->_serializedData;
- }
-
-
- if ($optionsBak !== null) {
- $this->options = $optionsBak;
- }
-
- return true;
- }
-
- /**
- * get the result of the serialization
- *
- * @access public
- * @return string serialized XML
- */
- function getSerializedData()
- {
- if ($this->_serializedData === null) {
- return $this->raiseError('No serialized data available. Use XML_Serializer::serialize() first.', XML_SERIALIZER_ERROR_NO_SERIALIZATION);
- }
- return $this->_serializedData;
- }
-
- /**
- * serialize any value
- *
- * This method checks for the type of the value and calls the appropriate method
- *
- * @access private
- * @param mixed $value
- * @param string $tagName
- * @param array $attributes
- * @return string
- */
- function _serializeValue($value, $tagName = null, $attributes = array())
- {
- if (is_array($value)) {
- $xml = $this->_serializeArray($value, $tagName, $attributes);
- } elseif (is_object($value)) {
- $xml = $this->_serializeObject($value, $tagName);
- } else {
- $tag = array(
- 'qname' => $tagName,
- 'attributes' => $attributes,
- 'content' => $value
- );
- $xml = $this->_createXMLTag($tag);
- }
- return $xml;
- }
-
- /**
- * serialize an array
- *
- * @access private
- * @param array $array array to serialize
- * @param string $tagName name of the root tag
- * @param array $attributes attributes for the root tag
- * @return string $string serialized data
- * @uses XML_Util::isValidName() to check, whether key has to be substituted
- */
- function _serializeArray(&$array, $tagName = null, $attributes = array())
- {
- $_content = null;
-
- /**
- * check for special attributes
- */
- if ($this->options['attributesArray'] !== null) {
- if (isset($array[$this->options['attributesArray']])) {
- $attributes = $array[$this->options['attributesArray']];
- unset($array[$this->options['attributesArray']]);
- }
- /**
- * check for special content
- */
- if ($this->options['contentName'] !== null) {
- if (isset($array[$this->options['contentName']])) {
- $_content = $array[$this->options['contentName']];
- unset($array[$this->options['contentName']]);
- }
- }
- }
-
- /*
- * if mode is set to simpleXML, check whether
- * the array is associative or indexed
- */
- if (is_array($array) && $this->options['mode'] == 'simplexml') {
- $indexed = true;
- if (!count($array)) {
- $indexed = false;
- }
- foreach ($array as $key => $val) {
- if (!is_int($key)) {
- $indexed = false;
- break;
- }
- }
-
- if ($indexed && $this->options['mode'] == 'simplexml') {
- $string = '';
- foreach ($array as $key => $val) {
- if ($this->options['beautifyFilelist'] && $tagName == 'dir') {
- if (!isset($this->_curdir)) {
- $this->_curdir = '';
- }
- $savedir = $this->_curdir;
- if (isset($val['attribs'])) {
- if ($val['attribs']['name'] == '/') {
- $this->_curdir = '/';
- } else {
- if ($this->_curdir == '/') {
- $this->_curdir = '';
- }
- $this->_curdir .= '/' . $val['attribs']['name'];
- }
- }
- }
- $string .= $this->_serializeValue( $val, $tagName, $attributes);
- if ($this->options['beautifyFilelist'] && $tagName == 'dir') {
- $string .= ' <!-- ' . $this->_curdir . ' -->';
- if (empty($savedir)) {
- unset($this->_curdir);
- } else {
- $this->_curdir = $savedir;
- }
- }
-
- $string .= $this->options['linebreak'];
- // do indentation
- if ($this->options['indent'] !== null && $this->_tagDepth > 0) {
- $string .= str_repeat($this->options['indent'], $this->_tagDepth);
- }
- }
- return rtrim($string);
- }
- }
-
- if ($this->options['scalarAsAttributes'] === true) {
- foreach ($array as $key => $value) {
- if (is_scalar($value) && (XML_Util::isValidName($key) === true)) {
- unset($array[$key]);
- $attributes[$this->options['prependAttributes'].$key] = $value;
- }
- }
- }
-
- // check for empty array => create empty tag
- if (empty($array)) {
- $tag = array(
- 'qname' => $tagName,
- 'content' => $_content,
- 'attributes' => $attributes
- );
-
- } else {
- $this->_tagDepth++;
- $tmp = $this->options['linebreak'];
- foreach ($array as $key => $value) {
- // do indentation
- if ($this->options['indent'] !== null && $this->_tagDepth > 0) {
- $tmp .= str_repeat($this->options['indent'], $this->_tagDepth);
- }
-
- // copy key
- $origKey = $key;
- // key cannot be used as tagname => use default tag
- $valid = XML_Util::isValidName($key);
- if (PEAR::isError($valid)) {
- if ($this->options['classAsTagName'] && is_object($value)) {
- $key = get_class($value);
- } else {
- $key = $this->options['defaultTagName'];
- }
- }
- $atts = array();
- if ($this->options['typeHints'] === true) {
- $atts[$this->options['typeAttribute']] = gettype($value);
- if ($key !== $origKey) {
- $atts[$this->options['keyAttribute']] = (string)$origKey;
- }
-
- }
- if ($this->options['beautifyFilelist'] && $key == 'dir') {
- if (!isset($this->_curdir)) {
- $this->_curdir = '';
- }
- $savedir = $this->_curdir;
- if (isset($value['attribs'])) {
- if ($value['attribs']['name'] == '/') {
- $this->_curdir = '/';
- } else {
- $this->_curdir .= '/' . $value['attribs']['name'];
- }
- }
- }
-
- if (is_string($value) && $value && ($value{strlen($value) - 1} == "\n")) {
- $value .= str_repeat($this->options['indent'], $this->_tagDepth);
- }
- $tmp .= $this->_createXMLTag(array(
- 'qname' => $key,
- 'attributes' => $atts,
- 'content' => $value )
- );
- if ($this->options['beautifyFilelist'] && $key == 'dir') {
- if (isset($value['attribs'])) {
- $tmp .= ' <!-- ' . $this->_curdir . ' -->';
- if (empty($savedir)) {
- unset($this->_curdir);
- } else {
- $this->_curdir = $savedir;
- }
- }
- }
- $tmp .= $this->options['linebreak'];
- }
-
- $this->_tagDepth--;
- if ($this->options['indent']!==null && $this->_tagDepth>0) {
- $tmp .= str_repeat($this->options['indent'], $this->_tagDepth);
- }
-
- if (trim($tmp) === '') {
- $tmp = null;
- }
-
- $tag = array(
- 'qname' => $tagName,
- 'content' => $tmp,
- 'attributes' => $attributes
- );
- }
- if ($this->options['typeHints'] === true) {
- if (!isset($tag['attributes'][$this->options['typeAttribute']])) {
- $tag['attributes'][$this->options['typeAttribute']] = 'array';
- }
- }
-
- $string = $this->_createXMLTag($tag, false);
- return $string;
- }
-
- /**
- * create a tag from an array
- * this method awaits an array in the following format
- * array(
- * 'qname' => $tagName,
- * 'attributes' => array(),
- * 'content' => $content, // optional
- * 'namespace' => $namespace // optional
- * 'namespaceUri' => $namespaceUri // optional
- * )
- *
- * @access private
- * @param array $tag tag definition
- * @param boolean $replaceEntities whether to replace XML entities in content or not
- * @return string $string XML tag
- */
- function _createXMLTag($tag, $replaceEntities = true)
- {
- if ($this->options['indentAttributes'] !== false) {
- $multiline = true;
- $indent = str_repeat($this->options['indent'], $this->_tagDepth);
-
- if ($this->options['indentAttributes'] == '_auto') {
- $indent .= str_repeat(' ', (strlen($tag['qname'])+2));
-
- } else {
- $indent .= $this->options['indentAttributes'];
- }
- } else {
- $indent = $multiline = false;
- }
-
- if (is_array($tag['content'])) {
- if (empty($tag['content'])) {
- $tag['content'] = '';
- }
- } elseif(is_scalar($tag['content']) && (string)$tag['content'] == '') {
- $tag['content'] = '';
- }
-
- if (is_scalar($tag['content']) || is_null($tag['content'])) {
- if ($this->options['encoding'] == 'UTF-8' &&
- version_compare(phpversion(), '5.0.0', 'lt')
- ) {
- $tag['content'] = utf8_encode($tag['content']);
- }
-
- if ($replaceEntities === true) {
- $replaceEntities = XML_UTIL_ENTITIES_XML;
- }
-
- $tag = XML_Util::createTagFromArray($tag, $replaceEntities, $multiline, $indent, $this->options['linebreak']);
- } elseif (is_array($tag['content'])) {
- $tag = $this->_serializeArray($tag['content'], $tag['qname'], $tag['attributes']);
- } elseif (is_object($tag['content'])) {
- $tag = $this->_serializeObject($tag['content'], $tag['qname'], $tag['attributes']);
- } elseif (is_resource($tag['content'])) {
- settype($tag['content'], 'string');
- $tag = XML_Util::createTagFromArray($tag, $replaceEntities);
- }
- return $tag;
- }
-} \ No newline at end of file
diff --git a/3rdparty/PEAR/PackageFile/Parser/v1.php b/3rdparty/PEAR/PackageFile/Parser/v1.php
deleted file mode 100644
index 23395dc757a..00000000000
--- a/3rdparty/PEAR/PackageFile/Parser/v1.php
+++ /dev/null
@@ -1,459 +0,0 @@
-<?php
-/**
- * package.xml parsing class, package.xml version 1.0
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: v1.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a1
- */
-/**
- * package.xml abstraction class
- */
-require_once 'PEAR/PackageFile/v1.php';
-/**
- * Parser for package.xml version 1.0
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @PEAR-VER@
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a1
- */
-class PEAR_PackageFile_Parser_v1
-{
- var $_registry;
- var $_config;
- var $_logger;
- /**
- * BC hack to allow PEAR_Common::infoFromString() to sort of
- * work with the version 2.0 format - there's no filelist though
- * @param PEAR_PackageFile_v2
- */
- function fromV2($packagefile)
- {
- $info = $packagefile->getArray(true);
- $ret = new PEAR_PackageFile_v1;
- $ret->fromArray($info['old']);
- }
-
- function setConfig(&$c)
- {
- $this->_config = &$c;
- $this->_registry = &$c->getRegistry();
- }
-
- function setLogger(&$l)
- {
- $this->_logger = &$l;
- }
-
- /**
- * @param string contents of package.xml file, version 1.0
- * @return bool success of parsing
- */
- function &parse($data, $file, $archive = false)
- {
- if (!extension_loaded('xml')) {
- return PEAR::raiseError('Cannot create xml parser for parsing package.xml, no xml extension');
- }
- $xp = xml_parser_create();
- if (!$xp) {
- $a = &PEAR::raiseError('Cannot create xml parser for parsing package.xml');
- return $a;
- }
- xml_set_object($xp, $this);
- xml_set_element_handler($xp, '_element_start_1_0', '_element_end_1_0');
- xml_set_character_data_handler($xp, '_pkginfo_cdata_1_0');
- xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, false);
-
- $this->element_stack = array();
- $this->_packageInfo = array('provides' => array());
- $this->current_element = false;
- unset($this->dir_install);
- $this->_packageInfo['filelist'] = array();
- $this->filelist =& $this->_packageInfo['filelist'];
- $this->dir_names = array();
- $this->in_changelog = false;
- $this->d_i = 0;
- $this->cdata = '';
- $this->_isValid = true;
-
- if (!xml_parse($xp, $data, 1)) {
- $code = xml_get_error_code($xp);
- $line = xml_get_current_line_number($xp);
- xml_parser_free($xp);
- $a = &PEAR::raiseError(sprintf("XML error: %s at line %d",
- $str = xml_error_string($code), $line), 2);
- return $a;
- }
-
- xml_parser_free($xp);
-
- $pf = new PEAR_PackageFile_v1;
- $pf->setConfig($this->_config);
- if (isset($this->_logger)) {
- $pf->setLogger($this->_logger);
- }
- $pf->setPackagefile($file, $archive);
- $pf->fromArray($this->_packageInfo);
- return $pf;
- }
- // {{{ _unIndent()
-
- /**
- * Unindent given string
- *
- * @param string $str The string that has to be unindented.
- * @return string
- * @access private
- */
- function _unIndent($str)
- {
- // remove leading newlines
- $str = preg_replace('/^[\r\n]+/', '', $str);
- // find whitespace at the beginning of the first line
- $indent_len = strspn($str, " \t");
- $indent = substr($str, 0, $indent_len);
- $data = '';
- // remove the same amount of whitespace from following lines
- foreach (explode("\n", $str) as $line) {
- if (substr($line, 0, $indent_len) == $indent) {
- $data .= substr($line, $indent_len) . "\n";
- } elseif (trim(substr($line, 0, $indent_len))) {
- $data .= ltrim($line);
- }
- }
- return $data;
- }
-
- // Support for package DTD v1.0:
- // {{{ _element_start_1_0()
-
- /**
- * XML parser callback for ending elements. Used for version 1.0
- * packages.
- *
- * @param resource $xp XML parser resource
- * @param string $name name of ending element
- *
- * @return void
- *
- * @access private
- */
- function _element_start_1_0($xp, $name, $attribs)
- {
- array_push($this->element_stack, $name);
- $this->current_element = $name;
- $spos = sizeof($this->element_stack) - 2;
- $this->prev_element = ($spos >= 0) ? $this->element_stack[$spos] : '';
- $this->current_attributes = $attribs;
- $this->cdata = '';
- switch ($name) {
- case 'dir':
- if ($this->in_changelog) {
- break;
- }
- if (array_key_exists('name', $attribs) && $attribs['name'] != '/') {
- $attribs['name'] = preg_replace(array('!\\\\+!', '!/+!'), array('/', '/'),
- $attribs['name']);
- if (strrpos($attribs['name'], '/') === strlen($attribs['name']) - 1) {
- $attribs['name'] = substr($attribs['name'], 0,
- strlen($attribs['name']) - 1);
- }
- if (strpos($attribs['name'], '/') === 0) {
- $attribs['name'] = substr($attribs['name'], 1);
- }
- $this->dir_names[] = $attribs['name'];
- }
- if (isset($attribs['baseinstalldir'])) {
- $this->dir_install = $attribs['baseinstalldir'];
- }
- if (isset($attribs['role'])) {
- $this->dir_role = $attribs['role'];
- }
- break;
- case 'file':
- if ($this->in_changelog) {
- break;
- }
- if (isset($attribs['name'])) {
- $path = '';
- if (count($this->dir_names)) {
- foreach ($this->dir_names as $dir) {
- $path .= $dir . '/';
- }
- }
- $path .= preg_replace(array('!\\\\+!', '!/+!'), array('/', '/'),
- $attribs['name']);
- unset($attribs['name']);
- $this->current_path = $path;
- $this->filelist[$path] = $attribs;
- // Set the baseinstalldir only if the file don't have this attrib
- if (!isset($this->filelist[$path]['baseinstalldir']) &&
- isset($this->dir_install))
- {
- $this->filelist[$path]['baseinstalldir'] = $this->dir_install;
- }
- // Set the Role
- if (!isset($this->filelist[$path]['role']) && isset($this->dir_role)) {
- $this->filelist[$path]['role'] = $this->dir_role;
- }
- }
- break;
- case 'replace':
- if (!$this->in_changelog) {
- $this->filelist[$this->current_path]['replacements'][] = $attribs;
- }
- break;
- case 'maintainers':
- $this->_packageInfo['maintainers'] = array();
- $this->m_i = 0; // maintainers array index
- break;
- case 'maintainer':
- // compatibility check
- if (!isset($this->_packageInfo['maintainers'])) {
- $this->_packageInfo['maintainers'] = array();
- $this->m_i = 0;
- }
- $this->_packageInfo['maintainers'][$this->m_i] = array();
- $this->current_maintainer =& $this->_packageInfo['maintainers'][$this->m_i];
- break;
- case 'changelog':
- $this->_packageInfo['changelog'] = array();
- $this->c_i = 0; // changelog array index
- $this->in_changelog = true;
- break;
- case 'release':
- if ($this->in_changelog) {
- $this->_packageInfo['changelog'][$this->c_i] = array();
- $this->current_release = &$this->_packageInfo['changelog'][$this->c_i];
- } else {
- $this->current_release = &$this->_packageInfo;
- }
- break;
- case 'deps':
- if (!$this->in_changelog) {
- $this->_packageInfo['release_deps'] = array();
- }
- break;
- case 'dep':
- // dependencies array index
- if (!$this->in_changelog) {
- $this->d_i++;
- isset($attribs['type']) ? ($attribs['type'] = strtolower($attribs['type'])) : false;
- $this->_packageInfo['release_deps'][$this->d_i] = $attribs;
- }
- break;
- case 'configureoptions':
- if (!$this->in_changelog) {
- $this->_packageInfo['configure_options'] = array();
- }
- break;
- case 'configureoption':
- if (!$this->in_changelog) {
- $this->_packageInfo['configure_options'][] = $attribs;
- }
- break;
- case 'provides':
- if (empty($attribs['type']) || empty($attribs['name'])) {
- break;
- }
- $attribs['explicit'] = true;
- $this->_packageInfo['provides']["$attribs[type];$attribs[name]"] = $attribs;
- break;
- case 'package' :
- if (isset($attribs['version'])) {
- $this->_packageInfo['xsdversion'] = trim($attribs['version']);
- } else {
- $this->_packageInfo['xsdversion'] = '1.0';
- }
- if (isset($attribs['packagerversion'])) {
- $this->_packageInfo['packagerversion'] = $attribs['packagerversion'];
- }
- break;
- }
- }
-
- // }}}
- // {{{ _element_end_1_0()
-
- /**
- * XML parser callback for ending elements. Used for version 1.0
- * packages.
- *
- * @param resource $xp XML parser resource
- * @param string $name name of ending element
- *
- * @return void
- *
- * @access private
- */
- function _element_end_1_0($xp, $name)
- {
- $data = trim($this->cdata);
- switch ($name) {
- case 'name':
- switch ($this->prev_element) {
- case 'package':
- $this->_packageInfo['package'] = $data;
- break;
- case 'maintainer':
- $this->current_maintainer['name'] = $data;
- break;
- }
- break;
- case 'extends' :
- $this->_packageInfo['extends'] = $data;
- break;
- case 'summary':
- $this->_packageInfo['summary'] = $data;
- break;
- case 'description':
- $data = $this->_unIndent($this->cdata);
- $this->_packageInfo['description'] = $data;
- break;
- case 'user':
- $this->current_maintainer['handle'] = $data;
- break;
- case 'email':
- $this->current_maintainer['email'] = $data;
- break;
- case 'role':
- $this->current_maintainer['role'] = $data;
- break;
- case 'version':
- if ($this->in_changelog) {
- $this->current_release['version'] = $data;
- } else {
- $this->_packageInfo['version'] = $data;
- }
- break;
- case 'date':
- if ($this->in_changelog) {
- $this->current_release['release_date'] = $data;
- } else {
- $this->_packageInfo['release_date'] = $data;
- }
- break;
- case 'notes':
- // try to "de-indent" release notes in case someone
- // has been over-indenting their xml ;-)
- // Trim only on the right side
- $data = rtrim($this->_unIndent($this->cdata));
- if ($this->in_changelog) {
- $this->current_release['release_notes'] = $data;
- } else {
- $this->_packageInfo['release_notes'] = $data;
- }
- break;
- case 'warnings':
- if ($this->in_changelog) {
- $this->current_release['release_warnings'] = $data;
- } else {
- $this->_packageInfo['release_warnings'] = $data;
- }
- break;
- case 'state':
- if ($this->in_changelog) {
- $this->current_release['release_state'] = $data;
- } else {
- $this->_packageInfo['release_state'] = $data;
- }
- break;
- case 'license':
- if ($this->in_changelog) {
- $this->current_release['release_license'] = $data;
- } else {
- $this->_packageInfo['release_license'] = $data;
- }
- break;
- case 'dep':
- if ($data && !$this->in_changelog) {
- $this->_packageInfo['release_deps'][$this->d_i]['name'] = $data;
- }
- break;
- case 'dir':
- if ($this->in_changelog) {
- break;
- }
- array_pop($this->dir_names);
- break;
- case 'file':
- if ($this->in_changelog) {
- break;
- }
- if ($data) {
- $path = '';
- if (count($this->dir_names)) {
- foreach ($this->dir_names as $dir) {
- $path .= $dir . '/';
- }
- }
- $path .= $data;
- $this->filelist[$path] = $this->current_attributes;
- // Set the baseinstalldir only if the file don't have this attrib
- if (!isset($this->filelist[$path]['baseinstalldir']) &&
- isset($this->dir_install))
- {
- $this->filelist[$path]['baseinstalldir'] = $this->dir_install;
- }
- // Set the Role
- if (!isset($this->filelist[$path]['role']) && isset($this->dir_role)) {
- $this->filelist[$path]['role'] = $this->dir_role;
- }
- }
- break;
- case 'maintainer':
- if (empty($this->_packageInfo['maintainers'][$this->m_i]['role'])) {
- $this->_packageInfo['maintainers'][$this->m_i]['role'] = 'lead';
- }
- $this->m_i++;
- break;
- case 'release':
- if ($this->in_changelog) {
- $this->c_i++;
- }
- break;
- case 'changelog':
- $this->in_changelog = false;
- break;
- }
- array_pop($this->element_stack);
- $spos = sizeof($this->element_stack) - 1;
- $this->current_element = ($spos > 0) ? $this->element_stack[$spos] : '';
- $this->cdata = '';
- }
-
- // }}}
- // {{{ _pkginfo_cdata_1_0()
-
- /**
- * XML parser callback for character data. Used for version 1.0
- * packages.
- *
- * @param resource $xp XML parser resource
- * @param string $name character data
- *
- * @return void
- *
- * @access private
- */
- function _pkginfo_cdata_1_0($xp, $data)
- {
- if (isset($this->cdata)) {
- $this->cdata .= $data;
- }
- }
-
- // }}}
-}
-?> \ No newline at end of file
diff --git a/3rdparty/PEAR/PackageFile/Parser/v2.php b/3rdparty/PEAR/PackageFile/Parser/v2.php
deleted file mode 100644
index a3ba7063f2b..00000000000
--- a/3rdparty/PEAR/PackageFile/Parser/v2.php
+++ /dev/null
@@ -1,113 +0,0 @@
-<?php
-/**
- * package.xml parsing class, package.xml version 2.0
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: v2.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a1
- */
-/**
- * base xml parser class
- */
-require_once 'PEAR/XMLParser.php';
-require_once 'PEAR/PackageFile/v2.php';
-/**
- * Parser for package.xml version 2.0
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @PEAR-VER@
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a1
- */
-class PEAR_PackageFile_Parser_v2 extends PEAR_XMLParser
-{
- var $_config;
- var $_logger;
- var $_registry;
-
- function setConfig(&$c)
- {
- $this->_config = &$c;
- $this->_registry = &$c->getRegistry();
- }
-
- function setLogger(&$l)
- {
- $this->_logger = &$l;
- }
- /**
- * Unindent given string
- *
- * @param string $str The string that has to be unindented.
- * @return string
- * @access private
- */
- function _unIndent($str)
- {
- // remove leading newlines
- $str = preg_replace('/^[\r\n]+/', '', $str);
- // find whitespace at the beginning of the first line
- $indent_len = strspn($str, " \t");
- $indent = substr($str, 0, $indent_len);
- $data = '';
- // remove the same amount of whitespace from following lines
- foreach (explode("\n", $str) as $line) {
- if (substr($line, 0, $indent_len) == $indent) {
- $data .= substr($line, $indent_len) . "\n";
- } else {
- $data .= $line . "\n";
- }
- }
- return $data;
- }
-
- /**
- * post-process data
- *
- * @param string $data
- * @param string $element element name
- */
- function postProcess($data, $element)
- {
- if ($element == 'notes') {
- return trim($this->_unIndent($data));
- }
- return trim($data);
- }
-
- /**
- * @param string
- * @param string file name of the package.xml
- * @param string|false name of the archive this package.xml came from, if any
- * @param string class name to instantiate and return. This must be PEAR_PackageFile_v2 or
- * a subclass
- * @return PEAR_PackageFile_v2
- */
- function &parse($data, $file, $archive = false, $class = 'PEAR_PackageFile_v2')
- {
- if (PEAR::isError($err = parent::parse($data, $file))) {
- return $err;
- }
-
- $ret = new $class;
- $ret->encoding = $this->encoding;
- $ret->setConfig($this->_config);
- if (isset($this->_logger)) {
- $ret->setLogger($this->_logger);
- }
-
- $ret->fromArray($this->_unserializedData);
- $ret->setPackagefile($file, $archive);
- return $ret;
- }
-} \ No newline at end of file
diff --git a/3rdparty/PEAR/PackageFile/v1.php b/3rdparty/PEAR/PackageFile/v1.php
deleted file mode 100644
index 43e346bcdac..00000000000
--- a/3rdparty/PEAR/PackageFile/v1.php
+++ /dev/null
@@ -1,1612 +0,0 @@
-<?php
-/**
- * PEAR_PackageFile_v1, package.xml version 1.0
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: v1.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a1
- */
-/**
- * For error handling
- */
-require_once 'PEAR/ErrorStack.php';
-
-/**
- * Error code if parsing is attempted with no xml extension
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_XML_EXT', 3);
-
-/**
- * Error code if creating the xml parser resource fails
- */
-define('PEAR_PACKAGEFILE_ERROR_CANT_MAKE_PARSER', 4);
-
-/**
- * Error code used for all sax xml parsing errors
- */
-define('PEAR_PACKAGEFILE_ERROR_PARSER_ERROR', 5);
-
-/**
- * Error code used when there is no name
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_NAME', 6);
-
-/**
- * Error code when a package name is not valid
- */
-define('PEAR_PACKAGEFILE_ERROR_INVALID_NAME', 7);
-
-/**
- * Error code used when no summary is parsed
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_SUMMARY', 8);
-
-/**
- * Error code for summaries that are more than 1 line
- */
-define('PEAR_PACKAGEFILE_ERROR_MULTILINE_SUMMARY', 9);
-
-/**
- * Error code used when no description is present
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_DESCRIPTION', 10);
-
-/**
- * Error code used when no license is present
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_LICENSE', 11);
-
-/**
- * Error code used when a <version> version number is not present
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_VERSION', 12);
-
-/**
- * Error code used when a <version> version number is invalid
- */
-define('PEAR_PACKAGEFILE_ERROR_INVALID_VERSION', 13);
-
-/**
- * Error code when release state is missing
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_STATE', 14);
-
-/**
- * Error code when release state is invalid
- */
-define('PEAR_PACKAGEFILE_ERROR_INVALID_STATE', 15);
-
-/**
- * Error code when release state is missing
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_DATE', 16);
-
-/**
- * Error code when release state is invalid
- */
-define('PEAR_PACKAGEFILE_ERROR_INVALID_DATE', 17);
-
-/**
- * Error code when no release notes are found
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_NOTES', 18);
-
-/**
- * Error code when no maintainers are found
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_MAINTAINERS', 19);
-
-/**
- * Error code when a maintainer has no handle
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_MAINTHANDLE', 20);
-
-/**
- * Error code when a maintainer has no handle
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_MAINTROLE', 21);
-
-/**
- * Error code when a maintainer has no name
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_MAINTNAME', 22);
-
-/**
- * Error code when a maintainer has no email
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_MAINTEMAIL', 23);
-
-/**
- * Error code when a maintainer has no handle
- */
-define('PEAR_PACKAGEFILE_ERROR_INVALID_MAINTROLE', 24);
-
-/**
- * Error code when a dependency is not a PHP dependency, but has no name
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_DEPNAME', 25);
-
-/**
- * Error code when a dependency has no type (pkg, php, etc.)
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_DEPTYPE', 26);
-
-/**
- * Error code when a dependency has no relation (lt, ge, has, etc.)
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_DEPREL', 27);
-
-/**
- * Error code when a dependency is not a 'has' relation, but has no version
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_DEPVERSION', 28);
-
-/**
- * Error code when a dependency has an invalid relation
- */
-define('PEAR_PACKAGEFILE_ERROR_INVALID_DEPREL', 29);
-
-/**
- * Error code when a dependency has an invalid type
- */
-define('PEAR_PACKAGEFILE_ERROR_INVALID_DEPTYPE', 30);
-
-/**
- * Error code when a dependency has an invalid optional option
- */
-define('PEAR_PACKAGEFILE_ERROR_INVALID_DEPOPTIONAL', 31);
-
-/**
- * Error code when a dependency is a pkg dependency, and has an invalid package name
- */
-define('PEAR_PACKAGEFILE_ERROR_INVALID_DEPNAME', 32);
-
-/**
- * Error code when a dependency has a channel="foo" attribute, and foo is not a registered channel
- */
-define('PEAR_PACKAGEFILE_ERROR_UNKNOWN_DEPCHANNEL', 33);
-
-/**
- * Error code when rel="has" and version attribute is present.
- */
-define('PEAR_PACKAGEFILE_ERROR_DEPVERSION_IGNORED', 34);
-
-/**
- * Error code when type="php" and dependency name is present
- */
-define('PEAR_PACKAGEFILE_ERROR_DEPNAME_IGNORED', 35);
-
-/**
- * Error code when a configure option has no name
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_CONFNAME', 36);
-
-/**
- * Error code when a configure option has no name
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_CONFPROMPT', 37);
-
-/**
- * Error code when a file in the filelist has an invalid role
- */
-define('PEAR_PACKAGEFILE_ERROR_INVALID_FILEROLE', 38);
-
-/**
- * Error code when a file in the filelist has no role
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_FILEROLE', 39);
-
-/**
- * Error code when analyzing a php source file that has parse errors
- */
-define('PEAR_PACKAGEFILE_ERROR_INVALID_PHPFILE', 40);
-
-/**
- * Error code when analyzing a php source file reveals a source element
- * without a package name prefix
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_PNAME_PREFIX', 41);
-
-/**
- * Error code when an unknown channel is specified
- */
-define('PEAR_PACKAGEFILE_ERROR_UNKNOWN_CHANNEL', 42);
-
-/**
- * Error code when no files are found in the filelist
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_FILES', 43);
-
-/**
- * Error code when a file is not valid php according to _analyzeSourceCode()
- */
-define('PEAR_PACKAGEFILE_ERROR_INVALID_FILE', 44);
-
-/**
- * Error code when the channel validator returns an error or warning
- */
-define('PEAR_PACKAGEFILE_ERROR_CHANNELVAL', 45);
-
-/**
- * Error code when a php5 package is packaged in php4 (analysis doesn't work)
- */
-define('PEAR_PACKAGEFILE_ERROR_PHP5', 46);
-
-/**
- * Error code when a file is listed in package.xml but does not exist
- */
-define('PEAR_PACKAGEFILE_ERROR_FILE_NOTFOUND', 47);
-
-/**
- * Error code when a <dep type="php" rel="not"... is encountered (use rel="ne")
- */
-define('PEAR_PACKAGEFILE_PHP_NO_NOT', 48);
-
-/**
- * Error code when a package.xml contains non-ISO-8859-1 characters
- */
-define('PEAR_PACKAGEFILE_ERROR_NON_ISO_CHARS', 49);
-
-/**
- * Error code when a dependency is not a 'has' relation, but has no version
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_DEPPHPVERSION', 50);
-
-/**
- * Error code when a package has no lead developer
- */
-define('PEAR_PACKAGEFILE_ERROR_NO_LEAD', 51);
-
-/**
- * Error code when a filename begins with "."
- */
-define('PEAR_PACKAGEFILE_ERROR_INVALID_FILENAME', 52);
-/**
- * package.xml encapsulator
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a1
- */
-class PEAR_PackageFile_v1
-{
- /**
- * @access private
- * @var PEAR_ErrorStack
- * @access private
- */
- var $_stack;
-
- /**
- * A registry object, used to access the package name validation regex for non-standard channels
- * @var PEAR_Registry
- * @access private
- */
- var $_registry;
-
- /**
- * An object that contains a log method that matches PEAR_Common::log's signature
- * @var object
- * @access private
- */
- var $_logger;
-
- /**
- * Parsed package information
- * @var array
- * @access private
- */
- var $_packageInfo;
-
- /**
- * path to package.xml
- * @var string
- * @access private
- */
- var $_packageFile;
-
- /**
- * path to package .tgz or false if this is a local/extracted package.xml
- * @var string
- * @access private
- */
- var $_archiveFile;
-
- /**
- * @var int
- * @access private
- */
- var $_isValid = 0;
-
- /**
- * Determines whether this packagefile was initialized only with partial package info
- *
- * If this package file was constructed via parsing REST, it will only contain
- *
- * - package name
- * - channel name
- * - dependencies
- * @var boolean
- * @access private
- */
- var $_incomplete = true;
-
- /**
- * @param bool determines whether to return a PEAR_Error object, or use the PEAR_ErrorStack
- * @param string Name of Error Stack class to use.
- */
- function PEAR_PackageFile_v1()
- {
- $this->_stack = &new PEAR_ErrorStack('PEAR_PackageFile_v1');
- $this->_stack->setErrorMessageTemplate($this->_getErrorMessage());
- $this->_isValid = 0;
- }
-
- function installBinary($installer)
- {
- return false;
- }
-
- function isExtension($name)
- {
- return false;
- }
-
- function setConfig(&$config)
- {
- $this->_config = &$config;
- $this->_registry = &$config->getRegistry();
- }
-
- function setRequestedGroup()
- {
- // placeholder
- }
-
- /**
- * For saving in the registry.
- *
- * Set the last version that was installed
- * @param string
- */
- function setLastInstalledVersion($version)
- {
- $this->_packageInfo['_lastversion'] = $version;
- }
-
- /**
- * @return string|false
- */
- function getLastInstalledVersion()
- {
- if (isset($this->_packageInfo['_lastversion'])) {
- return $this->_packageInfo['_lastversion'];
- }
- return false;
- }
-
- function getInstalledBinary()
- {
- return false;
- }
-
- function listPostinstallScripts()
- {
- return false;
- }
-
- function initPostinstallScripts()
- {
- return false;
- }
-
- function setLogger(&$logger)
- {
- if ($logger && (!is_object($logger) || !method_exists($logger, 'log'))) {
- return PEAR::raiseError('Logger must be compatible with PEAR_Common::log');
- }
- $this->_logger = &$logger;
- }
-
- function setPackagefile($file, $archive = false)
- {
- $this->_packageFile = $file;
- $this->_archiveFile = $archive ? $archive : $file;
- }
-
- function getPackageFile()
- {
- return isset($this->_packageFile) ? $this->_packageFile : false;
- }
-
- function getPackageType()
- {
- return 'php';
- }
-
- function getArchiveFile()
- {
- return $this->_archiveFile;
- }
-
- function packageInfo($field)
- {
- if (!is_string($field) || empty($field) ||
- !isset($this->_packageInfo[$field])) {
- return false;
- }
- return $this->_packageInfo[$field];
- }
-
- function setDirtree($path)
- {
- if (!isset($this->_packageInfo['dirtree'])) {
- $this->_packageInfo['dirtree'] = array();
- }
- $this->_packageInfo['dirtree'][$path] = true;
- }
-
- function getDirtree()
- {
- if (isset($this->_packageInfo['dirtree']) && count($this->_packageInfo['dirtree'])) {
- return $this->_packageInfo['dirtree'];
- }
- return false;
- }
-
- function resetDirtree()
- {
- unset($this->_packageInfo['dirtree']);
- }
-
- function fromArray($pinfo)
- {
- $this->_incomplete = false;
- $this->_packageInfo = $pinfo;
- }
-
- function isIncomplete()
- {
- return $this->_incomplete;
- }
-
- function getChannel()
- {
- return 'pear.php.net';
- }
-
- function getUri()
- {
- return false;
- }
-
- function getTime()
- {
- return false;
- }
-
- function getExtends()
- {
- if (isset($this->_packageInfo['extends'])) {
- return $this->_packageInfo['extends'];
- }
- return false;
- }
-
- /**
- * @return array
- */
- function toArray()
- {
- if (!$this->validate(PEAR_VALIDATE_NORMAL)) {
- return false;
- }
- return $this->getArray();
- }
-
- function getArray()
- {
- return $this->_packageInfo;
- }
-
- function getName()
- {
- return $this->getPackage();
- }
-
- function getPackage()
- {
- if (isset($this->_packageInfo['package'])) {
- return $this->_packageInfo['package'];
- }
- return false;
- }
-
- /**
- * WARNING - don't use this unless you know what you are doing
- */
- function setRawPackage($package)
- {
- $this->_packageInfo['package'] = $package;
- }
-
- function setPackage($package)
- {
- $this->_packageInfo['package'] = $package;
- $this->_isValid = false;
- }
-
- function getVersion()
- {
- if (isset($this->_packageInfo['version'])) {
- return $this->_packageInfo['version'];
- }
- return false;
- }
-
- function setVersion($version)
- {
- $this->_packageInfo['version'] = $version;
- $this->_isValid = false;
- }
-
- function clearMaintainers()
- {
- unset($this->_packageInfo['maintainers']);
- }
-
- function getMaintainers()
- {
- if (isset($this->_packageInfo['maintainers'])) {
- return $this->_packageInfo['maintainers'];
- }
- return false;
- }
-
- /**
- * Adds a new maintainer - no checking of duplicates is performed, use
- * updatemaintainer for that purpose.
- */
- function addMaintainer($role, $handle, $name, $email)
- {
- $this->_packageInfo['maintainers'][] =
- array('handle' => $handle, 'role' => $role, 'email' => $email, 'name' => $name);
- $this->_isValid = false;
- }
-
- function updateMaintainer($role, $handle, $name, $email)
- {
- $found = false;
- if (!isset($this->_packageInfo['maintainers']) ||
- !is_array($this->_packageInfo['maintainers'])) {
- return $this->addMaintainer($role, $handle, $name, $email);
- }
- foreach ($this->_packageInfo['maintainers'] as $i => $maintainer) {
- if ($maintainer['handle'] == $handle) {
- $found = $i;
- break;
- }
- }
- if ($found !== false) {
- unset($this->_packageInfo['maintainers'][$found]);
- $this->_packageInfo['maintainers'] =
- array_values($this->_packageInfo['maintainers']);
- }
- $this->addMaintainer($role, $handle, $name, $email);
- }
-
- function deleteMaintainer($handle)
- {
- $found = false;
- foreach ($this->_packageInfo['maintainers'] as $i => $maintainer) {
- if ($maintainer['handle'] == $handle) {
- $found = $i;
- break;
- }
- }
- if ($found !== false) {
- unset($this->_packageInfo['maintainers'][$found]);
- $this->_packageInfo['maintainers'] =
- array_values($this->_packageInfo['maintainers']);
- return true;
- }
- return false;
- }
-
- function getState()
- {
- if (isset($this->_packageInfo['release_state'])) {
- return $this->_packageInfo['release_state'];
- }
- return false;
- }
-
- function setRawState($state)
- {
- $this->_packageInfo['release_state'] = $state;
- }
-
- function setState($state)
- {
- $this->_packageInfo['release_state'] = $state;
- $this->_isValid = false;
- }
-
- function getDate()
- {
- if (isset($this->_packageInfo['release_date'])) {
- return $this->_packageInfo['release_date'];
- }
- return false;
- }
-
- function setDate($date)
- {
- $this->_packageInfo['release_date'] = $date;
- $this->_isValid = false;
- }
-
- function getLicense()
- {
- if (isset($this->_packageInfo['release_license'])) {
- return $this->_packageInfo['release_license'];
- }
- return false;
- }
-
- function setLicense($date)
- {
- $this->_packageInfo['release_license'] = $date;
- $this->_isValid = false;
- }
-
- function getSummary()
- {
- if (isset($this->_packageInfo['summary'])) {
- return $this->_packageInfo['summary'];
- }
- return false;
- }
-
- function setSummary($summary)
- {
- $this->_packageInfo['summary'] = $summary;
- $this->_isValid = false;
- }
-
- function getDescription()
- {
- if (isset($this->_packageInfo['description'])) {
- return $this->_packageInfo['description'];
- }
- return false;
- }
-
- function setDescription($desc)
- {
- $this->_packageInfo['description'] = $desc;
- $this->_isValid = false;
- }
-
- function getNotes()
- {
- if (isset($this->_packageInfo['release_notes'])) {
- return $this->_packageInfo['release_notes'];
- }
- return false;
- }
-
- function setNotes($notes)
- {
- $this->_packageInfo['release_notes'] = $notes;
- $this->_isValid = false;
- }
-
- function getDeps()
- {
- if (isset($this->_packageInfo['release_deps'])) {
- return $this->_packageInfo['release_deps'];
- }
- return false;
- }
-
- /**
- * Reset dependencies prior to adding new ones
- */
- function clearDeps()
- {
- unset($this->_packageInfo['release_deps']);
- }
-
- function addPhpDep($version, $rel)
- {
- $this->_isValid = false;
- $this->_packageInfo['release_deps'][] =
- array('type' => 'php',
- 'rel' => $rel,
- 'version' => $version);
- }
-
- function addPackageDep($name, $version, $rel, $optional = 'no')
- {
- $this->_isValid = false;
- $dep =
- array('type' => 'pkg',
- 'name' => $name,
- 'rel' => $rel,
- 'optional' => $optional);
- if ($rel != 'has' && $rel != 'not') {
- $dep['version'] = $version;
- }
- $this->_packageInfo['release_deps'][] = $dep;
- }
-
- function addExtensionDep($name, $version, $rel, $optional = 'no')
- {
- $this->_isValid = false;
- $this->_packageInfo['release_deps'][] =
- array('type' => 'ext',
- 'name' => $name,
- 'rel' => $rel,
- 'version' => $version,
- 'optional' => $optional);
- }
-
- /**
- * WARNING - do not use this function directly unless you know what you're doing
- */
- function setDeps($deps)
- {
- $this->_packageInfo['release_deps'] = $deps;
- }
-
- function hasDeps()
- {
- return isset($this->_packageInfo['release_deps']) &&
- count($this->_packageInfo['release_deps']);
- }
-
- function getDependencyGroup($group)
- {
- return false;
- }
-
- function isCompatible($pf)
- {
- return false;
- }
-
- function isSubpackageOf($p)
- {
- return $p->isSubpackage($this);
- }
-
- function isSubpackage($p)
- {
- return false;
- }
-
- function dependsOn($package, $channel)
- {
- if (strtolower($channel) != 'pear.php.net') {
- return false;
- }
- if (!($deps = $this->getDeps())) {
- return false;
- }
- foreach ($deps as $dep) {
- if ($dep['type'] != 'pkg') {
- continue;
- }
- if (strtolower($dep['name']) == strtolower($package)) {
- return true;
- }
- }
- return false;
- }
-
- function getConfigureOptions()
- {
- if (isset($this->_packageInfo['configure_options'])) {
- return $this->_packageInfo['configure_options'];
- }
- return false;
- }
-
- function hasConfigureOptions()
- {
- return isset($this->_packageInfo['configure_options']) &&
- count($this->_packageInfo['configure_options']);
- }
-
- function addConfigureOption($name, $prompt, $default = false)
- {
- $o = array('name' => $name, 'prompt' => $prompt);
- if ($default !== false) {
- $o['default'] = $default;
- }
- if (!isset($this->_packageInfo['configure_options'])) {
- $this->_packageInfo['configure_options'] = array();
- }
- $this->_packageInfo['configure_options'][] = $o;
- }
-
- function clearConfigureOptions()
- {
- unset($this->_packageInfo['configure_options']);
- }
-
- function getProvides()
- {
- if (isset($this->_packageInfo['provides'])) {
- return $this->_packageInfo['provides'];
- }
- return false;
- }
-
- function getProvidesExtension()
- {
- return false;
- }
-
- function addFile($dir, $file, $attrs)
- {
- $dir = preg_replace(array('!\\\\+!', '!/+!'), array('/', '/'), $dir);
- if ($dir == '/' || $dir == '') {
- $dir = '';
- } else {
- $dir .= '/';
- }
- $file = $dir . $file;
- $file = preg_replace('![\\/]+!', '/', $file);
- $this->_packageInfo['filelist'][$file] = $attrs;
- }
-
- function getInstallationFilelist()
- {
- return $this->getFilelist();
- }
-
- function getFilelist()
- {
- if (isset($this->_packageInfo['filelist'])) {
- return $this->_packageInfo['filelist'];
- }
- return false;
- }
-
- function setFileAttribute($file, $attr, $value)
- {
- $this->_packageInfo['filelist'][$file][$attr] = $value;
- }
-
- function resetFilelist()
- {
- $this->_packageInfo['filelist'] = array();
- }
-
- function setInstalledAs($file, $path)
- {
- if ($path) {
- return $this->_packageInfo['filelist'][$file]['installed_as'] = $path;
- }
- unset($this->_packageInfo['filelist'][$file]['installed_as']);
- }
-
- function installedFile($file, $atts)
- {
- if (isset($this->_packageInfo['filelist'][$file])) {
- $this->_packageInfo['filelist'][$file] =
- array_merge($this->_packageInfo['filelist'][$file], $atts);
- } else {
- $this->_packageInfo['filelist'][$file] = $atts;
- }
- }
-
- function getChangelog()
- {
- if (isset($this->_packageInfo['changelog'])) {
- return $this->_packageInfo['changelog'];
- }
- return false;
- }
-
- function getPackagexmlVersion()
- {
- return '1.0';
- }
-
- /**
- * Wrapper to {@link PEAR_ErrorStack::getErrors()}
- * @param boolean determines whether to purge the error stack after retrieving
- * @return array
- */
- function getValidationWarnings($purge = true)
- {
- return $this->_stack->getErrors($purge);
- }
-
- // }}}
- /**
- * Validation error. Also marks the object contents as invalid
- * @param error code
- * @param array error information
- * @access private
- */
- function _validateError($code, $params = array())
- {
- $this->_stack->push($code, 'error', $params, false, false, debug_backtrace());
- $this->_isValid = false;
- }
-
- /**
- * Validation warning. Does not mark the object contents invalid.
- * @param error code
- * @param array error information
- * @access private
- */
- function _validateWarning($code, $params = array())
- {
- $this->_stack->push($code, 'warning', $params, false, false, debug_backtrace());
- }
-
- /**
- * @param integer error code
- * @access protected
- */
- function _getErrorMessage()
- {
- return array(
- PEAR_PACKAGEFILE_ERROR_NO_NAME =>
- 'Missing Package Name',
- PEAR_PACKAGEFILE_ERROR_NO_SUMMARY =>
- 'No summary found',
- PEAR_PACKAGEFILE_ERROR_MULTILINE_SUMMARY =>
- 'Summary should be on one line',
- PEAR_PACKAGEFILE_ERROR_NO_DESCRIPTION =>
- 'Missing description',
- PEAR_PACKAGEFILE_ERROR_NO_LICENSE =>
- 'Missing license',
- PEAR_PACKAGEFILE_ERROR_NO_VERSION =>
- 'No release version found',
- PEAR_PACKAGEFILE_ERROR_NO_STATE =>
- 'No release state found',
- PEAR_PACKAGEFILE_ERROR_NO_DATE =>
- 'No release date found',
- PEAR_PACKAGEFILE_ERROR_NO_NOTES =>
- 'No release notes found',
- PEAR_PACKAGEFILE_ERROR_NO_LEAD =>
- 'Package must have at least one lead maintainer',
- PEAR_PACKAGEFILE_ERROR_NO_MAINTAINERS =>
- 'No maintainers found, at least one must be defined',
- PEAR_PACKAGEFILE_ERROR_NO_MAINTHANDLE =>
- 'Maintainer %index% has no handle (user ID at channel server)',
- PEAR_PACKAGEFILE_ERROR_NO_MAINTROLE =>
- 'Maintainer %index% has no role',
- PEAR_PACKAGEFILE_ERROR_NO_MAINTNAME =>
- 'Maintainer %index% has no name',
- PEAR_PACKAGEFILE_ERROR_NO_MAINTEMAIL =>
- 'Maintainer %index% has no email',
- PEAR_PACKAGEFILE_ERROR_NO_DEPNAME =>
- 'Dependency %index% is not a php dependency, and has no name',
- PEAR_PACKAGEFILE_ERROR_NO_DEPREL =>
- 'Dependency %index% has no relation (rel)',
- PEAR_PACKAGEFILE_ERROR_NO_DEPTYPE =>
- 'Dependency %index% has no type',
- PEAR_PACKAGEFILE_ERROR_DEPNAME_IGNORED =>
- 'PHP Dependency %index% has a name attribute of "%name%" which will be' .
- ' ignored!',
- PEAR_PACKAGEFILE_ERROR_NO_DEPVERSION =>
- 'Dependency %index% is not a rel="has" or rel="not" dependency, ' .
- 'and has no version',
- PEAR_PACKAGEFILE_ERROR_NO_DEPPHPVERSION =>
- 'Dependency %index% is a type="php" dependency, ' .
- 'and has no version',
- PEAR_PACKAGEFILE_ERROR_DEPVERSION_IGNORED =>
- 'Dependency %index% is a rel="%rel%" dependency, versioning is ignored',
- PEAR_PACKAGEFILE_ERROR_INVALID_DEPOPTIONAL =>
- 'Dependency %index% has invalid optional value "%opt%", should be yes or no',
- PEAR_PACKAGEFILE_PHP_NO_NOT =>
- 'Dependency %index%: php dependencies cannot use "not" rel, use "ne"' .
- ' to exclude specific versions',
- PEAR_PACKAGEFILE_ERROR_NO_CONFNAME =>
- 'Configure Option %index% has no name',
- PEAR_PACKAGEFILE_ERROR_NO_CONFPROMPT =>
- 'Configure Option %index% has no prompt',
- PEAR_PACKAGEFILE_ERROR_NO_FILES =>
- 'No files in <filelist> section of package.xml',
- PEAR_PACKAGEFILE_ERROR_NO_FILEROLE =>
- 'File "%file%" has no role, expecting one of "%roles%"',
- PEAR_PACKAGEFILE_ERROR_INVALID_FILEROLE =>
- 'File "%file%" has invalid role "%role%", expecting one of "%roles%"',
- PEAR_PACKAGEFILE_ERROR_INVALID_FILENAME =>
- 'File "%file%" cannot start with ".", cannot package or install',
- PEAR_PACKAGEFILE_ERROR_INVALID_PHPFILE =>
- 'Parser error: invalid PHP found in file "%file%"',
- PEAR_PACKAGEFILE_ERROR_NO_PNAME_PREFIX =>
- 'in %file%: %type% "%name%" not prefixed with package name "%package%"',
- PEAR_PACKAGEFILE_ERROR_INVALID_FILE =>
- 'Parser error: invalid PHP file "%file%"',
- PEAR_PACKAGEFILE_ERROR_CHANNELVAL =>
- 'Channel validator error: field "%field%" - %reason%',
- PEAR_PACKAGEFILE_ERROR_PHP5 =>
- 'Error, PHP5 token encountered in %file%, analysis should be in PHP5',
- PEAR_PACKAGEFILE_ERROR_FILE_NOTFOUND =>
- 'File "%file%" in package.xml does not exist',
- PEAR_PACKAGEFILE_ERROR_NON_ISO_CHARS =>
- 'Package.xml contains non-ISO-8859-1 characters, and may not validate',
- );
- }
-
- /**
- * Validate XML package definition file.
- *
- * @access public
- * @return boolean
- */
- function validate($state = PEAR_VALIDATE_NORMAL, $nofilechecking = false)
- {
- if (($this->_isValid & $state) == $state) {
- return true;
- }
- $this->_isValid = true;
- $info = $this->_packageInfo;
- if (empty($info['package'])) {
- $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_NAME);
- $this->_packageName = $pn = 'unknown';
- } else {
- $this->_packageName = $pn = $info['package'];
- }
-
- if (empty($info['summary'])) {
- $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_SUMMARY);
- } elseif (strpos(trim($info['summary']), "\n") !== false) {
- $this->_validateWarning(PEAR_PACKAGEFILE_ERROR_MULTILINE_SUMMARY,
- array('summary' => $info['summary']));
- }
- if (empty($info['description'])) {
- $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_DESCRIPTION);
- }
- if (empty($info['release_license'])) {
- $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_LICENSE);
- }
- if (empty($info['version'])) {
- $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_VERSION);
- }
- if (empty($info['release_state'])) {
- $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_STATE);
- }
- if (empty($info['release_date'])) {
- $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_DATE);
- }
- if (empty($info['release_notes'])) {
- $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_NOTES);
- }
- if (empty($info['maintainers'])) {
- $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_MAINTAINERS);
- } else {
- $haslead = false;
- $i = 1;
- foreach ($info['maintainers'] as $m) {
- if (empty($m['handle'])) {
- $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_MAINTHANDLE,
- array('index' => $i));
- }
- if (empty($m['role'])) {
- $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_MAINTROLE,
- array('index' => $i, 'roles' => PEAR_Common::getUserRoles()));
- } elseif ($m['role'] == 'lead') {
- $haslead = true;
- }
- if (empty($m['name'])) {
- $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_MAINTNAME,
- array('index' => $i));
- }
- if (empty($m['email'])) {
- $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_MAINTEMAIL,
- array('index' => $i));
- }
- $i++;
- }
- if (!$haslead) {
- $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_LEAD);
- }
- }
- if (!empty($info['release_deps'])) {
- $i = 1;
- foreach ($info['release_deps'] as $d) {
- if (!isset($d['type']) || empty($d['type'])) {
- $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_DEPTYPE,
- array('index' => $i, 'types' => PEAR_Common::getDependencyTypes()));
- continue;
- }
- if (!isset($d['rel']) || empty($d['rel'])) {
- $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_DEPREL,
- array('index' => $i, 'rels' => PEAR_Common::getDependencyRelations()));
- continue;
- }
- if (!empty($d['optional'])) {
- if (!in_array($d['optional'], array('yes', 'no'))) {
- $this->_validateError(PEAR_PACKAGEFILE_ERROR_INVALID_DEPOPTIONAL,
- array('index' => $i, 'opt' => $d['optional']));
- }
- }
- if ($d['rel'] != 'has' && $d['rel'] != 'not' && empty($d['version'])) {
- $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_DEPVERSION,
- array('index' => $i));
- } elseif (($d['rel'] == 'has' || $d['rel'] == 'not') && !empty($d['version'])) {
- $this->_validateWarning(PEAR_PACKAGEFILE_ERROR_DEPVERSION_IGNORED,
- array('index' => $i, 'rel' => $d['rel']));
- }
- if ($d['type'] == 'php' && !empty($d['name'])) {
- $this->_validateWarning(PEAR_PACKAGEFILE_ERROR_DEPNAME_IGNORED,
- array('index' => $i, 'name' => $d['name']));
- } elseif ($d['type'] != 'php' && empty($d['name'])) {
- $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_DEPNAME,
- array('index' => $i));
- }
- if ($d['type'] == 'php' && empty($d['version'])) {
- $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_DEPPHPVERSION,
- array('index' => $i));
- }
- if (($d['rel'] == 'not') && ($d['type'] == 'php')) {
- $this->_validateError(PEAR_PACKAGEFILE_PHP_NO_NOT,
- array('index' => $i));
- }
- $i++;
- }
- }
- if (!empty($info['configure_options'])) {
- $i = 1;
- foreach ($info['configure_options'] as $c) {
- if (empty($c['name'])) {
- $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_CONFNAME,
- array('index' => $i));
- }
- if (empty($c['prompt'])) {
- $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_CONFPROMPT,
- array('index' => $i));
- }
- $i++;
- }
- }
- if (empty($info['filelist'])) {
- $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_FILES);
- $errors[] = 'no files';
- } else {
- foreach ($info['filelist'] as $file => $fa) {
- if (empty($fa['role'])) {
- $this->_validateError(PEAR_PACKAGEFILE_ERROR_NO_FILEROLE,
- array('file' => $file, 'roles' => PEAR_Common::getFileRoles()));
- continue;
- } elseif (!in_array($fa['role'], PEAR_Common::getFileRoles())) {
- $this->_validateError(PEAR_PACKAGEFILE_ERROR_INVALID_FILEROLE,
- array('file' => $file, 'role' => $fa['role'], 'roles' => PEAR_Common::getFileRoles()));
- }
- if (preg_match('~/\.\.?(/|\\z)|^\.\.?/~', str_replace('\\', '/', $file))) {
- // file contains .. parent directory or . cur directory references
- $this->_validateError(PEAR_PACKAGEFILE_ERROR_INVALID_FILENAME,
- array('file' => $file));
- }
- if (isset($fa['install-as']) &&
- preg_match('~/\.\.?(/|\\z)|^\.\.?/~',
- str_replace('\\', '/', $fa['install-as']))) {
- // install-as contains .. parent directory or . cur directory references
- $this->_validateError(PEAR_PACKAGEFILE_ERROR_INVALID_FILENAME,
- array('file' => $file . ' [installed as ' . $fa['install-as'] . ']'));
- }
- if (isset($fa['baseinstalldir']) &&
- preg_match('~/\.\.?(/|\\z)|^\.\.?/~',
- str_replace('\\', '/', $fa['baseinstalldir']))) {
- // install-as contains .. parent directory or . cur directory references
- $this->_validateError(PEAR_PACKAGEFILE_ERROR_INVALID_FILENAME,
- array('file' => $file . ' [baseinstalldir ' . $fa['baseinstalldir'] . ']'));
- }
- }
- }
- if (isset($this->_registry) && $this->_isValid) {
- $chan = $this->_registry->getChannel('pear.php.net');
- if (PEAR::isError($chan)) {
- $this->_validateError(PEAR_PACKAGEFILE_ERROR_CHANNELVAL, $chan->getMessage());
- return $this->_isValid = 0;
- }
- $validator = $chan->getValidationObject();
- $validator->setPackageFile($this);
- $validator->validate($state);
- $failures = $validator->getFailures();
- foreach ($failures['errors'] as $error) {
- $this->_validateError(PEAR_PACKAGEFILE_ERROR_CHANNELVAL, $error);
- }
- foreach ($failures['warnings'] as $warning) {
- $this->_validateWarning(PEAR_PACKAGEFILE_ERROR_CHANNELVAL, $warning);
- }
- }
- if ($this->_isValid && $state == PEAR_VALIDATE_PACKAGING && !$nofilechecking) {
- if ($this->_analyzePhpFiles()) {
- $this->_isValid = true;
- }
- }
- if ($this->_isValid) {
- return $this->_isValid = $state;
- }
- return $this->_isValid = 0;
- }
-
- function _analyzePhpFiles()
- {
- if (!$this->_isValid) {
- return false;
- }
- if (!isset($this->_packageFile)) {
- return false;
- }
- $dir_prefix = dirname($this->_packageFile);
- $common = new PEAR_Common;
- $log = isset($this->_logger) ? array(&$this->_logger, 'log') :
- array($common, 'log');
- $info = $this->getFilelist();
- foreach ($info as $file => $fa) {
- if (!file_exists($dir_prefix . DIRECTORY_SEPARATOR . $file)) {
- $this->_validateError(PEAR_PACKAGEFILE_ERROR_FILE_NOTFOUND,
- array('file' => realpath($dir_prefix) . DIRECTORY_SEPARATOR . $file));
- continue;
- }
- if ($fa['role'] == 'php' && $dir_prefix) {
- call_user_func_array($log, array(1, "Analyzing $file"));
- $srcinfo = $this->_analyzeSourceCode($dir_prefix . DIRECTORY_SEPARATOR . $file);
- if ($srcinfo) {
- $this->_buildProvidesArray($srcinfo);
- }
- }
- }
- $this->_packageName = $pn = $this->getPackage();
- $pnl = strlen($pn);
- if (isset($this->_packageInfo['provides'])) {
- foreach ((array) $this->_packageInfo['provides'] as $key => $what) {
- if (isset($what['explicit'])) {
- // skip conformance checks if the provides entry is
- // specified in the package.xml file
- continue;
- }
- extract($what);
- if ($type == 'class') {
- if (!strncasecmp($name, $pn, $pnl)) {
- continue;
- }
- $this->_validateWarning(PEAR_PACKAGEFILE_ERROR_NO_PNAME_PREFIX,
- array('file' => $file, 'type' => $type, 'name' => $name, 'package' => $pn));
- } elseif ($type == 'function') {
- if (strstr($name, '::') || !strncasecmp($name, $pn, $pnl)) {
- continue;
- }
- $this->_validateWarning(PEAR_PACKAGEFILE_ERROR_NO_PNAME_PREFIX,
- array('file' => $file, 'type' => $type, 'name' => $name, 'package' => $pn));
- }
- }
- }
- return $this->_isValid;
- }
-
- /**
- * Get the default xml generator object
- *
- * @return PEAR_PackageFile_Generator_v1
- */
- function &getDefaultGenerator()
- {
- if (!class_exists('PEAR_PackageFile_Generator_v1')) {
- require_once 'PEAR/PackageFile/Generator/v1.php';
- }
- $a = &new PEAR_PackageFile_Generator_v1($this);
- return $a;
- }
-
- /**
- * Get the contents of a file listed within the package.xml
- * @param string
- * @return string
- */
- function getFileContents($file)
- {
- if ($this->_archiveFile == $this->_packageFile) { // unpacked
- $dir = dirname($this->_packageFile);
- $file = $dir . DIRECTORY_SEPARATOR . $file;
- $file = str_replace(array('/', '\\'),
- array(DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR), $file);
- if (file_exists($file) && is_readable($file)) {
- return implode('', file($file));
- }
- } else { // tgz
- if (!class_exists('Archive_Tar')) {
- require_once 'Archive/Tar.php';
- }
- $tar = &new Archive_Tar($this->_archiveFile);
- $tar->pushErrorHandling(PEAR_ERROR_RETURN);
- if ($file != 'package.xml' && $file != 'package2.xml') {
- $file = $this->getPackage() . '-' . $this->getVersion() . '/' . $file;
- }
- $file = $tar->extractInString($file);
- $tar->popErrorHandling();
- if (PEAR::isError($file)) {
- return PEAR::raiseError("Cannot locate file '$file' in archive");
- }
- return $file;
- }
- }
-
- // {{{ analyzeSourceCode()
- /**
- * Analyze the source code of the given PHP file
- *
- * @param string Filename of the PHP file
- * @return mixed
- * @access private
- */
- function _analyzeSourceCode($file)
- {
- if (!function_exists("token_get_all")) {
- return false;
- }
- if (!defined('T_DOC_COMMENT')) {
- define('T_DOC_COMMENT', T_COMMENT);
- }
- if (!defined('T_INTERFACE')) {
- define('T_INTERFACE', -1);
- }
- if (!defined('T_IMPLEMENTS')) {
- define('T_IMPLEMENTS', -1);
- }
- if (!$fp = @fopen($file, "r")) {
- return false;
- }
- fclose($fp);
- $contents = file_get_contents($file);
- $tokens = token_get_all($contents);
-/*
- for ($i = 0; $i < sizeof($tokens); $i++) {
- @list($token, $data) = $tokens[$i];
- if (is_string($token)) {
- var_dump($token);
- } else {
- print token_name($token) . ' ';
- var_dump(rtrim($data));
- }
- }
-*/
- $look_for = 0;
- $paren_level = 0;
- $bracket_level = 0;
- $brace_level = 0;
- $lastphpdoc = '';
- $current_class = '';
- $current_interface = '';
- $current_class_level = -1;
- $current_function = '';
- $current_function_level = -1;
- $declared_classes = array();
- $declared_interfaces = array();
- $declared_functions = array();
- $declared_methods = array();
- $used_classes = array();
- $used_functions = array();
- $extends = array();
- $implements = array();
- $nodeps = array();
- $inquote = false;
- $interface = false;
- for ($i = 0; $i < sizeof($tokens); $i++) {
- if (is_array($tokens[$i])) {
- list($token, $data) = $tokens[$i];
- } else {
- $token = $tokens[$i];
- $data = '';
- }
- if ($inquote) {
- if ($token != '"' && $token != T_END_HEREDOC) {
- continue;
- } else {
- $inquote = false;
- continue;
- }
- }
- switch ($token) {
- case T_WHITESPACE :
- continue;
- case ';':
- if ($interface) {
- $current_function = '';
- $current_function_level = -1;
- }
- break;
- case '"':
- case T_START_HEREDOC:
- $inquote = true;
- break;
- case T_CURLY_OPEN:
- case T_DOLLAR_OPEN_CURLY_BRACES:
- case '{': $brace_level++; continue 2;
- case '}':
- $brace_level--;
- if ($current_class_level == $brace_level) {
- $current_class = '';
- $current_class_level = -1;
- }
- if ($current_function_level == $brace_level) {
- $current_function = '';
- $current_function_level = -1;
- }
- continue 2;
- case '[': $bracket_level++; continue 2;
- case ']': $bracket_level--; continue 2;
- case '(': $paren_level++; continue 2;
- case ')': $paren_level--; continue 2;
- case T_INTERFACE:
- $interface = true;
- case T_CLASS:
- if (($current_class_level != -1) || ($current_function_level != -1)) {
- $this->_validateError(PEAR_PACKAGEFILE_ERROR_INVALID_PHPFILE,
- array('file' => $file));
- return false;
- }
- case T_FUNCTION:
- case T_NEW:
- case T_EXTENDS:
- case T_IMPLEMENTS:
- $look_for = $token;
- continue 2;
- case T_STRING:
- if (version_compare(zend_version(), '2.0', '<')) {
- if (in_array(strtolower($data),
- array('public', 'private', 'protected', 'abstract',
- 'interface', 'implements', 'throw')
- )) {
- $this->_validateWarning(PEAR_PACKAGEFILE_ERROR_PHP5,
- array($file));
- }
- }
- if ($look_for == T_CLASS) {
- $current_class = $data;
- $current_class_level = $brace_level;
- $declared_classes[] = $current_class;
- } elseif ($look_for == T_INTERFACE) {
- $current_interface = $data;
- $current_class_level = $brace_level;
- $declared_interfaces[] = $current_interface;
- } elseif ($look_for == T_IMPLEMENTS) {
- $implements[$current_class] = $data;
- } elseif ($look_for == T_EXTENDS) {
- $extends[$current_class] = $data;
- } elseif ($look_for == T_FUNCTION) {
- if ($current_class) {
- $current_function = "$current_class::$data";
- $declared_methods[$current_class][] = $data;
- } elseif ($current_interface) {
- $current_function = "$current_interface::$data";
- $declared_methods[$current_interface][] = $data;
- } else {
- $current_function = $data;
- $declared_functions[] = $current_function;
- }
- $current_function_level = $brace_level;
- $m = array();
- } elseif ($look_for == T_NEW) {
- $used_classes[$data] = true;
- }
- $look_for = 0;
- continue 2;
- case T_VARIABLE:
- $look_for = 0;
- continue 2;
- case T_DOC_COMMENT:
- case T_COMMENT:
- if (preg_match('!^/\*\*\s!', $data)) {
- $lastphpdoc = $data;
- if (preg_match_all('/@nodep\s+(\S+)/', $lastphpdoc, $m)) {
- $nodeps = array_merge($nodeps, $m[1]);
- }
- }
- continue 2;
- case T_DOUBLE_COLON:
- if (!($tokens[$i - 1][0] == T_WHITESPACE || $tokens[$i - 1][0] == T_STRING)) {
- $this->_validateError(PEAR_PACKAGEFILE_ERROR_INVALID_PHPFILE,
- array('file' => $file));
- return false;
- }
- $class = $tokens[$i - 1][1];
- if (strtolower($class) != 'parent') {
- $used_classes[$class] = true;
- }
- continue 2;
- }
- }
- return array(
- "source_file" => $file,
- "declared_classes" => $declared_classes,
- "declared_interfaces" => $declared_interfaces,
- "declared_methods" => $declared_methods,
- "declared_functions" => $declared_functions,
- "used_classes" => array_diff(array_keys($used_classes), $nodeps),
- "inheritance" => $extends,
- "implements" => $implements,
- );
- }
-
- /**
- * Build a "provides" array from data returned by
- * analyzeSourceCode(). The format of the built array is like
- * this:
- *
- * array(
- * 'class;MyClass' => 'array('type' => 'class', 'name' => 'MyClass'),
- * ...
- * )
- *
- *
- * @param array $srcinfo array with information about a source file
- * as returned by the analyzeSourceCode() method.
- *
- * @return void
- *
- * @access private
- *
- */
- function _buildProvidesArray($srcinfo)
- {
- if (!$this->_isValid) {
- return false;
- }
- $file = basename($srcinfo['source_file']);
- $pn = $this->getPackage();
- $pnl = strlen($pn);
- foreach ($srcinfo['declared_classes'] as $class) {
- $key = "class;$class";
- if (isset($this->_packageInfo['provides'][$key])) {
- continue;
- }
- $this->_packageInfo['provides'][$key] =
- array('file'=> $file, 'type' => 'class', 'name' => $class);
- if (isset($srcinfo['inheritance'][$class])) {
- $this->_packageInfo['provides'][$key]['extends'] =
- $srcinfo['inheritance'][$class];
- }
- }
- foreach ($srcinfo['declared_methods'] as $class => $methods) {
- foreach ($methods as $method) {
- $function = "$class::$method";
- $key = "function;$function";
- if ($method{0} == '_' || !strcasecmp($method, $class) ||
- isset($this->_packageInfo['provides'][$key])) {
- continue;
- }
- $this->_packageInfo['provides'][$key] =
- array('file'=> $file, 'type' => 'function', 'name' => $function);
- }
- }
-
- foreach ($srcinfo['declared_functions'] as $function) {
- $key = "function;$function";
- if ($function{0} == '_' || isset($this->_packageInfo['provides'][$key])) {
- continue;
- }
- if (!strstr($function, '::') && strncasecmp($function, $pn, $pnl)) {
- $warnings[] = "in1 " . $file . ": function \"$function\" not prefixed with package name \"$pn\"";
- }
- $this->_packageInfo['provides'][$key] =
- array('file'=> $file, 'type' => 'function', 'name' => $function);
- }
- }
-
- // }}}
-}
-?>
diff --git a/3rdparty/PEAR/PackageFile/v2.php b/3rdparty/PEAR/PackageFile/v2.php
deleted file mode 100644
index 1ca412dc8cd..00000000000
--- a/3rdparty/PEAR/PackageFile/v2.php
+++ /dev/null
@@ -1,2049 +0,0 @@
-<?php
-/**
- * PEAR_PackageFile_v2, package.xml version 2.0
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: v2.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a1
- */
-/**
- * For error handling
- */
-require_once 'PEAR/ErrorStack.php';
-/**
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a1
- */
-class PEAR_PackageFile_v2
-{
-
- /**
- * Parsed package information
- * @var array
- * @access private
- */
- var $_packageInfo = array();
-
- /**
- * path to package .tgz or false if this is a local/extracted package.xml
- * @var string|false
- * @access private
- */
- var $_archiveFile;
-
- /**
- * path to package .xml or false if this is an abstract parsed-from-string xml
- * @var string|false
- * @access private
- */
- var $_packageFile;
-
- /**
- * This is used by file analysis routines to log progress information
- * @var PEAR_Common
- * @access protected
- */
- var $_logger;
-
- /**
- * This is set to the highest validation level that has been validated
- *
- * If the package.xml is invalid or unknown, this is set to 0. If
- * normal validation has occurred, this is set to PEAR_VALIDATE_NORMAL. If
- * downloading/installation validation has occurred it is set to PEAR_VALIDATE_DOWNLOADING
- * or INSTALLING, and so on up to PEAR_VALIDATE_PACKAGING. This allows validation
- * "caching" to occur, which is particularly important for package validation, so
- * that PHP files are not validated twice
- * @var int
- * @access private
- */
- var $_isValid = 0;
-
- /**
- * True if the filelist has been validated
- * @param bool
- */
- var $_filesValid = false;
-
- /**
- * @var PEAR_Registry
- * @access protected
- */
- var $_registry;
-
- /**
- * @var PEAR_Config
- * @access protected
- */
- var $_config;
-
- /**
- * Optional Dependency group requested for installation
- * @var string
- * @access private
- */
- var $_requestedGroup = false;
-
- /**
- * @var PEAR_ErrorStack
- * @access protected
- */
- var $_stack;
-
- /**
- * Namespace prefix used for tasks in this package.xml - use tasks: whenever possible
- */
- var $_tasksNs;
-
- /**
- * Determines whether this packagefile was initialized only with partial package info
- *
- * If this package file was constructed via parsing REST, it will only contain
- *
- * - package name
- * - channel name
- * - dependencies
- * @var boolean
- * @access private
- */
- var $_incomplete = true;
-
- /**
- * @var PEAR_PackageFile_v2_Validator
- */
- var $_v2Validator;
-
- /**
- * The constructor merely sets up the private error stack
- */
- function PEAR_PackageFile_v2()
- {
- $this->_stack = new PEAR_ErrorStack('PEAR_PackageFile_v2', false, null);
- $this->_isValid = false;
- }
-
- /**
- * To make unit-testing easier
- * @param PEAR_Frontend_*
- * @param array options
- * @param PEAR_Config
- * @return PEAR_Downloader
- * @access protected
- */
- function &getPEARDownloader(&$i, $o, &$c)
- {
- $z = &new PEAR_Downloader($i, $o, $c);
- return $z;
- }
-
- /**
- * To make unit-testing easier
- * @param PEAR_Config
- * @param array options
- * @param array package name as returned from {@link PEAR_Registry::parsePackageName()}
- * @param int PEAR_VALIDATE_* constant
- * @return PEAR_Dependency2
- * @access protected
- */
- function &getPEARDependency2(&$c, $o, $p, $s = PEAR_VALIDATE_INSTALLING)
- {
- if (!class_exists('PEAR_Dependency2')) {
- require_once 'PEAR/Dependency2.php';
- }
- $z = &new PEAR_Dependency2($c, $o, $p, $s);
- return $z;
- }
-
- function getInstalledBinary()
- {
- return isset($this->_packageInfo['#binarypackage']) ? $this->_packageInfo['#binarypackage'] :
- false;
- }
-
- /**
- * Installation of source package has failed, attempt to download and install the
- * binary version of this package.
- * @param PEAR_Installer
- * @return array|false
- */
- function installBinary(&$installer)
- {
- if (!OS_WINDOWS) {
- $a = false;
- return $a;
- }
- if ($this->getPackageType() == 'extsrc' || $this->getPackageType() == 'zendextsrc') {
- $releasetype = $this->getPackageType() . 'release';
- if (!is_array($installer->getInstallPackages())) {
- $a = false;
- return $a;
- }
- foreach ($installer->getInstallPackages() as $p) {
- if ($p->isExtension($this->_packageInfo['providesextension'])) {
- if ($p->getPackageType() != 'extsrc' && $p->getPackageType() != 'zendextsrc') {
- $a = false;
- return $a; // the user probably downloaded it separately
- }
- }
- }
- if (isset($this->_packageInfo[$releasetype]['binarypackage'])) {
- $installer->log(0, 'Attempting to download binary version of extension "' .
- $this->_packageInfo['providesextension'] . '"');
- $params = $this->_packageInfo[$releasetype]['binarypackage'];
- if (!is_array($params) || !isset($params[0])) {
- $params = array($params);
- }
- if (isset($this->_packageInfo['channel'])) {
- foreach ($params as $i => $param) {
- $params[$i] = array('channel' => $this->_packageInfo['channel'],
- 'package' => $param, 'version' => $this->getVersion());
- }
- }
- $dl = &$this->getPEARDownloader($installer->ui, $installer->getOptions(),
- $installer->config);
- $verbose = $dl->config->get('verbose');
- $dl->config->set('verbose', -1);
- foreach ($params as $param) {
- PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
- $ret = $dl->download(array($param));
- PEAR::popErrorHandling();
- if (is_array($ret) && count($ret)) {
- break;
- }
- }
- $dl->config->set('verbose', $verbose);
- if (is_array($ret)) {
- if (count($ret) == 1) {
- $pf = $ret[0]->getPackageFile();
- PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
- $err = $installer->install($ret[0]);
- PEAR::popErrorHandling();
- if (is_array($err)) {
- $this->_packageInfo['#binarypackage'] = $ret[0]->getPackage();
- // "install" self, so all dependencies will work transparently
- $this->_registry->addPackage2($this);
- $installer->log(0, 'Download and install of binary extension "' .
- $this->_registry->parsedPackageNameToString(
- array('channel' => $pf->getChannel(),
- 'package' => $pf->getPackage()), true) . '" successful');
- $a = array($ret[0], $err);
- return $a;
- }
- $installer->log(0, 'Download and install of binary extension "' .
- $this->_registry->parsedPackageNameToString(
- array('channel' => $pf->getChannel(),
- 'package' => $pf->getPackage()), true) . '" failed');
- }
- }
- }
- }
- $a = false;
- return $a;
- }
-
- /**
- * @return string|false Extension name
- */
- function getProvidesExtension()
- {
- if (in_array($this->getPackageType(),
- array('extsrc', 'extbin', 'zendextsrc', 'zendextbin'))) {
- if (isset($this->_packageInfo['providesextension'])) {
- return $this->_packageInfo['providesextension'];
- }
- }
- return false;
- }
-
- /**
- * @param string Extension name
- * @return bool
- */
- function isExtension($extension)
- {
- if (in_array($this->getPackageType(),
- array('extsrc', 'extbin', 'zendextsrc', 'zendextbin'))) {
- return $this->_packageInfo['providesextension'] == $extension;
- }
- return false;
- }
-
- /**
- * Tests whether every part of the package.xml 1.0 is represented in
- * this package.xml 2.0
- * @param PEAR_PackageFile_v1
- * @return bool
- */
- function isEquivalent($pf1)
- {
- if (!$pf1) {
- return true;
- }
- if ($this->getPackageType() == 'bundle') {
- return false;
- }
- $this->_stack->getErrors(true);
- if (!$pf1->validate(PEAR_VALIDATE_NORMAL)) {
- return false;
- }
- $pass = true;
- if ($pf1->getPackage() != $this->getPackage()) {
- $this->_differentPackage($pf1->getPackage());
- $pass = false;
- }
- if ($pf1->getVersion() != $this->getVersion()) {
- $this->_differentVersion($pf1->getVersion());
- $pass = false;
- }
- if (trim($pf1->getSummary()) != $this->getSummary()) {
- $this->_differentSummary($pf1->getSummary());
- $pass = false;
- }
- if (preg_replace('/\s+/', '', $pf1->getDescription()) !=
- preg_replace('/\s+/', '', $this->getDescription())) {
- $this->_differentDescription($pf1->getDescription());
- $pass = false;
- }
- if ($pf1->getState() != $this->getState()) {
- $this->_differentState($pf1->getState());
- $pass = false;
- }
- if (!strstr(preg_replace('/\s+/', '', $this->getNotes()),
- preg_replace('/\s+/', '', $pf1->getNotes()))) {
- $this->_differentNotes($pf1->getNotes());
- $pass = false;
- }
- $mymaintainers = $this->getMaintainers();
- $yourmaintainers = $pf1->getMaintainers();
- for ($i1 = 0; $i1 < count($yourmaintainers); $i1++) {
- $reset = false;
- for ($i2 = 0; $i2 < count($mymaintainers); $i2++) {
- if ($mymaintainers[$i2]['handle'] == $yourmaintainers[$i1]['handle']) {
- if ($mymaintainers[$i2]['role'] != $yourmaintainers[$i1]['role']) {
- $this->_differentRole($mymaintainers[$i2]['handle'],
- $yourmaintainers[$i1]['role'], $mymaintainers[$i2]['role']);
- $pass = false;
- }
- if ($mymaintainers[$i2]['email'] != $yourmaintainers[$i1]['email']) {
- $this->_differentEmail($mymaintainers[$i2]['handle'],
- $yourmaintainers[$i1]['email'], $mymaintainers[$i2]['email']);
- $pass = false;
- }
- if ($mymaintainers[$i2]['name'] != $yourmaintainers[$i1]['name']) {
- $this->_differentName($mymaintainers[$i2]['handle'],
- $yourmaintainers[$i1]['name'], $mymaintainers[$i2]['name']);
- $pass = false;
- }
- unset($mymaintainers[$i2]);
- $mymaintainers = array_values($mymaintainers);
- unset($yourmaintainers[$i1]);
- $yourmaintainers = array_values($yourmaintainers);
- $reset = true;
- break;
- }
- }
- if ($reset) {
- $i1 = -1;
- }
- }
- $this->_unmatchedMaintainers($mymaintainers, $yourmaintainers);
- $filelist = $this->getFilelist();
- foreach ($pf1->getFilelist() as $file => $atts) {
- if (!isset($filelist[$file])) {
- $this->_missingFile($file);
- $pass = false;
- }
- }
- return $pass;
- }
-
- function _differentPackage($package)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('package' => $package,
- 'self' => $this->getPackage()),
- 'package.xml 1.0 package "%package%" does not match "%self%"');
- }
-
- function _differentVersion($version)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('version' => $version,
- 'self' => $this->getVersion()),
- 'package.xml 1.0 version "%version%" does not match "%self%"');
- }
-
- function _differentState($state)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('state' => $state,
- 'self' => $this->getState()),
- 'package.xml 1.0 state "%state%" does not match "%self%"');
- }
-
- function _differentRole($handle, $role, $selfrole)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('handle' => $handle,
- 'role' => $role, 'self' => $selfrole),
- 'package.xml 1.0 maintainer "%handle%" role "%role%" does not match "%self%"');
- }
-
- function _differentEmail($handle, $email, $selfemail)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('handle' => $handle,
- 'email' => $email, 'self' => $selfemail),
- 'package.xml 1.0 maintainer "%handle%" email "%email%" does not match "%self%"');
- }
-
- function _differentName($handle, $name, $selfname)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('handle' => $handle,
- 'name' => $name, 'self' => $selfname),
- 'package.xml 1.0 maintainer "%handle%" name "%name%" does not match "%self%"');
- }
-
- function _unmatchedMaintainers($my, $yours)
- {
- if ($my) {
- array_walk($my, create_function('&$i, $k', '$i = $i["handle"];'));
- $this->_stack->push(__FUNCTION__, 'error', array('handles' => $my),
- 'package.xml 2.0 has unmatched extra maintainers "%handles%"');
- }
- if ($yours) {
- array_walk($yours, create_function('&$i, $k', '$i = $i["handle"];'));
- $this->_stack->push(__FUNCTION__, 'error', array('handles' => $yours),
- 'package.xml 1.0 has unmatched extra maintainers "%handles%"');
- }
- }
-
- function _differentNotes($notes)
- {
- $truncnotes = strlen($notes) < 25 ? $notes : substr($notes, 0, 24) . '...';
- $truncmynotes = strlen($this->getNotes()) < 25 ? $this->getNotes() :
- substr($this->getNotes(), 0, 24) . '...';
- $this->_stack->push(__FUNCTION__, 'error', array('notes' => $truncnotes,
- 'self' => $truncmynotes),
- 'package.xml 1.0 release notes "%notes%" do not match "%self%"');
- }
-
- function _differentSummary($summary)
- {
- $truncsummary = strlen($summary) < 25 ? $summary : substr($summary, 0, 24) . '...';
- $truncmysummary = strlen($this->getsummary()) < 25 ? $this->getSummary() :
- substr($this->getsummary(), 0, 24) . '...';
- $this->_stack->push(__FUNCTION__, 'error', array('summary' => $truncsummary,
- 'self' => $truncmysummary),
- 'package.xml 1.0 summary "%summary%" does not match "%self%"');
- }
-
- function _differentDescription($description)
- {
- $truncdescription = trim(strlen($description) < 25 ? $description : substr($description, 0, 24) . '...');
- $truncmydescription = trim(strlen($this->getDescription()) < 25 ? $this->getDescription() :
- substr($this->getdescription(), 0, 24) . '...');
- $this->_stack->push(__FUNCTION__, 'error', array('description' => $truncdescription,
- 'self' => $truncmydescription),
- 'package.xml 1.0 description "%description%" does not match "%self%"');
- }
-
- function _missingFile($file)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('file' => $file),
- 'package.xml 1.0 file "%file%" is not present in <contents>');
- }
-
- /**
- * WARNING - do not use this function unless you know what you're doing
- */
- function setRawState($state)
- {
- if (!isset($this->_packageInfo['stability'])) {
- $this->_packageInfo['stability'] = array();
- }
- $this->_packageInfo['stability']['release'] = $state;
- }
-
- /**
- * WARNING - do not use this function unless you know what you're doing
- */
- function setRawCompatible($compatible)
- {
- $this->_packageInfo['compatible'] = $compatible;
- }
-
- /**
- * WARNING - do not use this function unless you know what you're doing
- */
- function setRawPackage($package)
- {
- $this->_packageInfo['name'] = $package;
- }
-
- /**
- * WARNING - do not use this function unless you know what you're doing
- */
- function setRawChannel($channel)
- {
- $this->_packageInfo['channel'] = $channel;
- }
-
- function setRequestedGroup($group)
- {
- $this->_requestedGroup = $group;
- }
-
- function getRequestedGroup()
- {
- if (isset($this->_requestedGroup)) {
- return $this->_requestedGroup;
- }
- return false;
- }
-
- /**
- * For saving in the registry.
- *
- * Set the last version that was installed
- * @param string
- */
- function setLastInstalledVersion($version)
- {
- $this->_packageInfo['_lastversion'] = $version;
- }
-
- /**
- * @return string|false
- */
- function getLastInstalledVersion()
- {
- if (isset($this->_packageInfo['_lastversion'])) {
- return $this->_packageInfo['_lastversion'];
- }
- return false;
- }
-
- /**
- * Determines whether this package.xml has post-install scripts or not
- * @return array|false
- */
- function listPostinstallScripts()
- {
- $filelist = $this->getFilelist();
- $contents = $this->getContents();
- $contents = $contents['dir']['file'];
- if (!is_array($contents) || !isset($contents[0])) {
- $contents = array($contents);
- }
- $taskfiles = array();
- foreach ($contents as $file) {
- $atts = $file['attribs'];
- unset($file['attribs']);
- if (count($file)) {
- $taskfiles[$atts['name']] = $file;
- }
- }
- $common = new PEAR_Common;
- $common->debug = $this->_config->get('verbose');
- $this->_scripts = array();
- $ret = array();
- foreach ($taskfiles as $name => $tasks) {
- if (!isset($filelist[$name])) {
- // ignored files will not be in the filelist
- continue;
- }
- $atts = $filelist[$name];
- foreach ($tasks as $tag => $raw) {
- $task = $this->getTask($tag);
- $task = &new $task($this->_config, $common, PEAR_TASK_INSTALL);
- if ($task->isScript()) {
- $ret[] = $filelist[$name]['installed_as'];
- }
- }
- }
- if (count($ret)) {
- return $ret;
- }
- return false;
- }
-
- /**
- * Initialize post-install scripts for running
- *
- * This method can be used to detect post-install scripts, as the return value
- * indicates whether any exist
- * @return bool
- */
- function initPostinstallScripts()
- {
- $filelist = $this->getFilelist();
- $contents = $this->getContents();
- $contents = $contents['dir']['file'];
- if (!is_array($contents) || !isset($contents[0])) {
- $contents = array($contents);
- }
- $taskfiles = array();
- foreach ($contents as $file) {
- $atts = $file['attribs'];
- unset($file['attribs']);
- if (count($file)) {
- $taskfiles[$atts['name']] = $file;
- }
- }
- $common = new PEAR_Common;
- $common->debug = $this->_config->get('verbose');
- $this->_scripts = array();
- foreach ($taskfiles as $name => $tasks) {
- if (!isset($filelist[$name])) {
- // file was not installed due to installconditions
- continue;
- }
- $atts = $filelist[$name];
- foreach ($tasks as $tag => $raw) {
- $taskname = $this->getTask($tag);
- $task = &new $taskname($this->_config, $common, PEAR_TASK_INSTALL);
- if (!$task->isScript()) {
- continue; // scripts are only handled after installation
- }
- $lastversion = isset($this->_packageInfo['_lastversion']) ?
- $this->_packageInfo['_lastversion'] : null;
- $task->init($raw, $atts, $lastversion);
- $res = $task->startSession($this, $atts['installed_as']);
- if (!$res) {
- continue; // skip this file
- }
- if (PEAR::isError($res)) {
- return $res;
- }
- $assign = &$task;
- $this->_scripts[] = &$assign;
- }
- }
- if (count($this->_scripts)) {
- return true;
- }
- return false;
- }
-
- function runPostinstallScripts()
- {
- if ($this->initPostinstallScripts()) {
- $ui = &PEAR_Frontend::singleton();
- if ($ui) {
- $ui->runPostinstallScripts($this->_scripts, $this);
- }
- }
- }
-
-
- /**
- * Convert a recursive set of <dir> and <file> tags into a single <dir> tag with
- * <file> tags.
- */
- function flattenFilelist()
- {
- if (isset($this->_packageInfo['bundle'])) {
- return;
- }
- $filelist = array();
- if (isset($this->_packageInfo['contents']['dir']['dir'])) {
- $this->_getFlattenedFilelist($filelist, $this->_packageInfo['contents']['dir']);
- if (!isset($filelist[1])) {
- $filelist = $filelist[0];
- }
- $this->_packageInfo['contents']['dir']['file'] = $filelist;
- unset($this->_packageInfo['contents']['dir']['dir']);
- } else {
- // else already flattened but check for baseinstalldir propagation
- if (isset($this->_packageInfo['contents']['dir']['attribs']['baseinstalldir'])) {
- if (isset($this->_packageInfo['contents']['dir']['file'][0])) {
- foreach ($this->_packageInfo['contents']['dir']['file'] as $i => $file) {
- if (isset($file['attribs']['baseinstalldir'])) {
- continue;
- }
- $this->_packageInfo['contents']['dir']['file'][$i]['attribs']['baseinstalldir']
- = $this->_packageInfo['contents']['dir']['attribs']['baseinstalldir'];
- }
- } else {
- if (!isset($this->_packageInfo['contents']['dir']['file']['attribs']['baseinstalldir'])) {
- $this->_packageInfo['contents']['dir']['file']['attribs']['baseinstalldir']
- = $this->_packageInfo['contents']['dir']['attribs']['baseinstalldir'];
- }
- }
- }
- }
- }
-
- /**
- * @param array the final flattened file list
- * @param array the current directory being processed
- * @param string|false any recursively inherited baeinstalldir attribute
- * @param string private recursion variable
- * @return array
- * @access protected
- */
- function _getFlattenedFilelist(&$files, $dir, $baseinstall = false, $path = '')
- {
- if (isset($dir['attribs']) && isset($dir['attribs']['baseinstalldir'])) {
- $baseinstall = $dir['attribs']['baseinstalldir'];
- }
- if (isset($dir['dir'])) {
- if (!isset($dir['dir'][0])) {
- $dir['dir'] = array($dir['dir']);
- }
- foreach ($dir['dir'] as $subdir) {
- if (!isset($subdir['attribs']) || !isset($subdir['attribs']['name'])) {
- $name = '*unknown*';
- } else {
- $name = $subdir['attribs']['name'];
- }
- $newpath = empty($path) ? $name :
- $path . '/' . $name;
- $this->_getFlattenedFilelist($files, $subdir,
- $baseinstall, $newpath);
- }
- }
- if (isset($dir['file'])) {
- if (!isset($dir['file'][0])) {
- $dir['file'] = array($dir['file']);
- }
- foreach ($dir['file'] as $file) {
- $attrs = $file['attribs'];
- $name = $attrs['name'];
- if ($baseinstall && !isset($attrs['baseinstalldir'])) {
- $attrs['baseinstalldir'] = $baseinstall;
- }
- $attrs['name'] = empty($path) ? $name : $path . '/' . $name;
- $attrs['name'] = preg_replace(array('!\\\\+!', '!/+!'), array('/', '/'),
- $attrs['name']);
- $file['attribs'] = $attrs;
- $files[] = $file;
- }
- }
- }
-
- function setConfig(&$config)
- {
- $this->_config = &$config;
- $this->_registry = &$config->getRegistry();
- }
-
- function setLogger(&$logger)
- {
- if (!is_object($logger) || !method_exists($logger, 'log')) {
- return PEAR::raiseError('Logger must be compatible with PEAR_Common::log');
- }
- $this->_logger = &$logger;
- }
-
- /**
- * WARNING - do not use this function directly unless you know what you're doing
- */
- function setDeps($deps)
- {
- $this->_packageInfo['dependencies'] = $deps;
- }
-
- /**
- * WARNING - do not use this function directly unless you know what you're doing
- */
- function setCompatible($compat)
- {
- $this->_packageInfo['compatible'] = $compat;
- }
-
- function setPackagefile($file, $archive = false)
- {
- $this->_packageFile = $file;
- $this->_archiveFile = $archive ? $archive : $file;
- }
-
- /**
- * Wrapper to {@link PEAR_ErrorStack::getErrors()}
- * @param boolean determines whether to purge the error stack after retrieving
- * @return array
- */
- function getValidationWarnings($purge = true)
- {
- return $this->_stack->getErrors($purge);
- }
-
- function getPackageFile()
- {
- return $this->_packageFile;
- }
-
- function getArchiveFile()
- {
- return $this->_archiveFile;
- }
-
-
- /**
- * Directly set the array that defines this packagefile
- *
- * WARNING: no validation. This should only be performed by internal methods
- * inside PEAR or by inputting an array saved from an existing PEAR_PackageFile_v2
- * @param array
- */
- function fromArray($pinfo)
- {
- unset($pinfo['old']);
- unset($pinfo['xsdversion']);
- // If the changelog isn't an array then it was passed in as an empty tag
- if (isset($pinfo['changelog']) && !is_array($pinfo['changelog'])) {
- unset($pinfo['changelog']);
- }
- $this->_incomplete = false;
- $this->_packageInfo = $pinfo;
- }
-
- function isIncomplete()
- {
- return $this->_incomplete;
- }
-
- /**
- * @return array
- */
- function toArray($forreg = false)
- {
- if (!$this->validate(PEAR_VALIDATE_NORMAL)) {
- return false;
- }
- return $this->getArray($forreg);
- }
-
- function getArray($forReg = false)
- {
- if ($forReg) {
- $arr = $this->_packageInfo;
- $arr['old'] = array();
- $arr['old']['version'] = $this->getVersion();
- $arr['old']['release_date'] = $this->getDate();
- $arr['old']['release_state'] = $this->getState();
- $arr['old']['release_license'] = $this->getLicense();
- $arr['old']['release_notes'] = $this->getNotes();
- $arr['old']['release_deps'] = $this->getDeps();
- $arr['old']['maintainers'] = $this->getMaintainers();
- $arr['xsdversion'] = '2.0';
- return $arr;
- } else {
- $info = $this->_packageInfo;
- unset($info['dirtree']);
- if (isset($info['_lastversion'])) {
- unset($info['_lastversion']);
- }
- if (isset($info['#binarypackage'])) {
- unset($info['#binarypackage']);
- }
- return $info;
- }
- }
-
- function packageInfo($field)
- {
- $arr = $this->getArray(true);
- if ($field == 'state') {
- return $arr['stability']['release'];
- }
- if ($field == 'api-version') {
- return $arr['version']['api'];
- }
- if ($field == 'api-state') {
- return $arr['stability']['api'];
- }
- if (isset($arr['old'][$field])) {
- if (!is_string($arr['old'][$field])) {
- return null;
- }
- return $arr['old'][$field];
- }
- if (isset($arr[$field])) {
- if (!is_string($arr[$field])) {
- return null;
- }
- return $arr[$field];
- }
- return null;
- }
-
- function getName()
- {
- return $this->getPackage();
- }
-
- function getPackage()
- {
- if (isset($this->_packageInfo['name'])) {
- return $this->_packageInfo['name'];
- }
- return false;
- }
-
- function getChannel()
- {
- if (isset($this->_packageInfo['uri'])) {
- return '__uri';
- }
- if (isset($this->_packageInfo['channel'])) {
- return strtolower($this->_packageInfo['channel']);
- }
- return false;
- }
-
- function getUri()
- {
- if (isset($this->_packageInfo['uri'])) {
- return $this->_packageInfo['uri'];
- }
- return false;
- }
-
- function getExtends()
- {
- if (isset($this->_packageInfo['extends'])) {
- return $this->_packageInfo['extends'];
- }
- return false;
- }
-
- function getSummary()
- {
- if (isset($this->_packageInfo['summary'])) {
- return $this->_packageInfo['summary'];
- }
- return false;
- }
-
- function getDescription()
- {
- if (isset($this->_packageInfo['description'])) {
- return $this->_packageInfo['description'];
- }
- return false;
- }
-
- function getMaintainers($raw = false)
- {
- if (!isset($this->_packageInfo['lead'])) {
- return false;
- }
- if ($raw) {
- $ret = array('lead' => $this->_packageInfo['lead']);
- (isset($this->_packageInfo['developer'])) ?
- $ret['developer'] = $this->_packageInfo['developer'] :null;
- (isset($this->_packageInfo['contributor'])) ?
- $ret['contributor'] = $this->_packageInfo['contributor'] :null;
- (isset($this->_packageInfo['helper'])) ?
- $ret['helper'] = $this->_packageInfo['helper'] :null;
- return $ret;
- } else {
- $ret = array();
- $leads = isset($this->_packageInfo['lead'][0]) ? $this->_packageInfo['lead'] :
- array($this->_packageInfo['lead']);
- foreach ($leads as $lead) {
- $s = $lead;
- $s['handle'] = $s['user'];
- unset($s['user']);
- $s['role'] = 'lead';
- $ret[] = $s;
- }
- if (isset($this->_packageInfo['developer'])) {
- $leads = isset($this->_packageInfo['developer'][0]) ?
- $this->_packageInfo['developer'] :
- array($this->_packageInfo['developer']);
- foreach ($leads as $maintainer) {
- $s = $maintainer;
- $s['handle'] = $s['user'];
- unset($s['user']);
- $s['role'] = 'developer';
- $ret[] = $s;
- }
- }
- if (isset($this->_packageInfo['contributor'])) {
- $leads = isset($this->_packageInfo['contributor'][0]) ?
- $this->_packageInfo['contributor'] :
- array($this->_packageInfo['contributor']);
- foreach ($leads as $maintainer) {
- $s = $maintainer;
- $s['handle'] = $s['user'];
- unset($s['user']);
- $s['role'] = 'contributor';
- $ret[] = $s;
- }
- }
- if (isset($this->_packageInfo['helper'])) {
- $leads = isset($this->_packageInfo['helper'][0]) ?
- $this->_packageInfo['helper'] :
- array($this->_packageInfo['helper']);
- foreach ($leads as $maintainer) {
- $s = $maintainer;
- $s['handle'] = $s['user'];
- unset($s['user']);
- $s['role'] = 'helper';
- $ret[] = $s;
- }
- }
- return $ret;
- }
- return false;
- }
-
- function getLeads()
- {
- if (isset($this->_packageInfo['lead'])) {
- return $this->_packageInfo['lead'];
- }
- return false;
- }
-
- function getDevelopers()
- {
- if (isset($this->_packageInfo['developer'])) {
- return $this->_packageInfo['developer'];
- }
- return false;
- }
-
- function getContributors()
- {
- if (isset($this->_packageInfo['contributor'])) {
- return $this->_packageInfo['contributor'];
- }
- return false;
- }
-
- function getHelpers()
- {
- if (isset($this->_packageInfo['helper'])) {
- return $this->_packageInfo['helper'];
- }
- return false;
- }
-
- function setDate($date)
- {
- if (!isset($this->_packageInfo['date'])) {
- // ensure that the extends tag is set up in the right location
- $this->_packageInfo = $this->_insertBefore($this->_packageInfo,
- array('time', 'version',
- 'stability', 'license', 'notes', 'contents', 'compatible',
- 'dependencies', 'providesextension', 'srcpackage', 'srcuri',
- 'phprelease', 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease',
- 'zendextbinrelease', 'bundle', 'changelog'), array(), 'date');
- }
- $this->_packageInfo['date'] = $date;
- $this->_isValid = 0;
- }
-
- function setTime($time)
- {
- $this->_isValid = 0;
- if (!isset($this->_packageInfo['time'])) {
- // ensure that the time tag is set up in the right location
- $this->_packageInfo = $this->_insertBefore($this->_packageInfo,
- array('version',
- 'stability', 'license', 'notes', 'contents', 'compatible',
- 'dependencies', 'providesextension', 'srcpackage', 'srcuri',
- 'phprelease', 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease',
- 'zendextbinrelease', 'bundle', 'changelog'), $time, 'time');
- }
- $this->_packageInfo['time'] = $time;
- }
-
- function getDate()
- {
- if (isset($this->_packageInfo['date'])) {
- return $this->_packageInfo['date'];
- }
- return false;
- }
-
- function getTime()
- {
- if (isset($this->_packageInfo['time'])) {
- return $this->_packageInfo['time'];
- }
- return false;
- }
-
- /**
- * @param package|api version category to return
- */
- function getVersion($key = 'release')
- {
- if (isset($this->_packageInfo['version'][$key])) {
- return $this->_packageInfo['version'][$key];
- }
- return false;
- }
-
- function getStability()
- {
- if (isset($this->_packageInfo['stability'])) {
- return $this->_packageInfo['stability'];
- }
- return false;
- }
-
- function getState($key = 'release')
- {
- if (isset($this->_packageInfo['stability'][$key])) {
- return $this->_packageInfo['stability'][$key];
- }
- return false;
- }
-
- function getLicense($raw = false)
- {
- if (isset($this->_packageInfo['license'])) {
- if ($raw) {
- return $this->_packageInfo['license'];
- }
- if (is_array($this->_packageInfo['license'])) {
- return $this->_packageInfo['license']['_content'];
- } else {
- return $this->_packageInfo['license'];
- }
- }
- return false;
- }
-
- function getLicenseLocation()
- {
- if (!isset($this->_packageInfo['license']) || !is_array($this->_packageInfo['license'])) {
- return false;
- }
- return $this->_packageInfo['license']['attribs'];
- }
-
- function getNotes()
- {
- if (isset($this->_packageInfo['notes'])) {
- return $this->_packageInfo['notes'];
- }
- return false;
- }
-
- /**
- * Return the <usesrole> tag contents, if any
- * @return array|false
- */
- function getUsesrole()
- {
- if (isset($this->_packageInfo['usesrole'])) {
- return $this->_packageInfo['usesrole'];
- }
- return false;
- }
-
- /**
- * Return the <usestask> tag contents, if any
- * @return array|false
- */
- function getUsestask()
- {
- if (isset($this->_packageInfo['usestask'])) {
- return $this->_packageInfo['usestask'];
- }
- return false;
- }
-
- /**
- * This should only be used to retrieve filenames and install attributes
- */
- function getFilelist($preserve = false)
- {
- if (isset($this->_packageInfo['filelist']) && !$preserve) {
- return $this->_packageInfo['filelist'];
- }
- $this->flattenFilelist();
- if ($contents = $this->getContents()) {
- $ret = array();
- if (!isset($contents['dir'])) {
- return false;
- }
- if (!isset($contents['dir']['file'][0])) {
- $contents['dir']['file'] = array($contents['dir']['file']);
- }
- foreach ($contents['dir']['file'] as $file) {
- $name = $file['attribs']['name'];
- if (!$preserve) {
- $file = $file['attribs'];
- }
- $ret[$name] = $file;
- }
- if (!$preserve) {
- $this->_packageInfo['filelist'] = $ret;
- }
- return $ret;
- }
- return false;
- }
-
- /**
- * Return configure options array, if any
- *
- * @return array|false
- */
- function getConfigureOptions()
- {
- if ($this->getPackageType() != 'extsrc' && $this->getPackageType() != 'zendextsrc') {
- return false;
- }
-
- $releases = $this->getReleases();
- if (isset($releases[0])) {
- $releases = $releases[0];
- }
-
- if (isset($releases['configureoption'])) {
- if (!isset($releases['configureoption'][0])) {
- $releases['configureoption'] = array($releases['configureoption']);
- }
-
- for ($i = 0; $i < count($releases['configureoption']); $i++) {
- $releases['configureoption'][$i] = $releases['configureoption'][$i]['attribs'];
- }
-
- return $releases['configureoption'];
- }
-
- return false;
- }
-
- /**
- * This is only used at install-time, after all serialization
- * is over.
- */
- function resetFilelist()
- {
- $this->_packageInfo['filelist'] = array();
- }
-
- /**
- * Retrieve a list of files that should be installed on this computer
- * @return array
- */
- function getInstallationFilelist($forfilecheck = false)
- {
- $contents = $this->getFilelist(true);
- if (isset($contents['dir']['attribs']['baseinstalldir'])) {
- $base = $contents['dir']['attribs']['baseinstalldir'];
- }
- if (isset($this->_packageInfo['bundle'])) {
- return PEAR::raiseError(
- 'Exception: bundles should be handled in download code only');
- }
- $release = $this->getReleases();
- if ($release) {
- if (!isset($release[0])) {
- if (!isset($release['installconditions']) && !isset($release['filelist'])) {
- if ($forfilecheck) {
- return $this->getFilelist();
- }
- return $contents;
- }
- $release = array($release);
- }
- $depchecker = &$this->getPEARDependency2($this->_config, array(),
- array('channel' => $this->getChannel(), 'package' => $this->getPackage()),
- PEAR_VALIDATE_INSTALLING);
- foreach ($release as $instance) {
- if (isset($instance['installconditions'])) {
- $installconditions = $instance['installconditions'];
- if (is_array($installconditions)) {
- PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
- foreach ($installconditions as $type => $conditions) {
- if (!isset($conditions[0])) {
- $conditions = array($conditions);
- }
- foreach ($conditions as $condition) {
- $ret = $depchecker->{"validate{$type}Dependency"}($condition);
- if (PEAR::isError($ret)) {
- PEAR::popErrorHandling();
- continue 3; // skip this release
- }
- }
- }
- PEAR::popErrorHandling();
- }
- }
- // this is the release to use
- if (isset($instance['filelist'])) {
- // ignore files
- if (isset($instance['filelist']['ignore'])) {
- $ignore = isset($instance['filelist']['ignore'][0]) ?
- $instance['filelist']['ignore'] :
- array($instance['filelist']['ignore']);
- foreach ($ignore as $ig) {
- unset ($contents[$ig['attribs']['name']]);
- }
- }
- // install files as this name
- if (isset($instance['filelist']['install'])) {
- $installas = isset($instance['filelist']['install'][0]) ?
- $instance['filelist']['install'] :
- array($instance['filelist']['install']);
- foreach ($installas as $as) {
- $contents[$as['attribs']['name']]['attribs']['install-as'] =
- $as['attribs']['as'];
- }
- }
- }
- if ($forfilecheck) {
- foreach ($contents as $file => $attrs) {
- $contents[$file] = $attrs['attribs'];
- }
- }
- return $contents;
- }
- } else { // simple release - no installconditions or install-as
- if ($forfilecheck) {
- return $this->getFilelist();
- }
- return $contents;
- }
- // no releases matched
- return PEAR::raiseError('No releases in package.xml matched the existing operating ' .
- 'system, extensions installed, or architecture, cannot install');
- }
-
- /**
- * This is only used at install-time, after all serialization
- * is over.
- * @param string file name
- * @param string installed path
- */
- function setInstalledAs($file, $path)
- {
- if ($path) {
- return $this->_packageInfo['filelist'][$file]['installed_as'] = $path;
- }
- unset($this->_packageInfo['filelist'][$file]['installed_as']);
- }
-
- function getInstalledLocation($file)
- {
- if (isset($this->_packageInfo['filelist'][$file]['installed_as'])) {
- return $this->_packageInfo['filelist'][$file]['installed_as'];
- }
- return false;
- }
-
- /**
- * This is only used at install-time, after all serialization
- * is over.
- */
- function installedFile($file, $atts)
- {
- if (isset($this->_packageInfo['filelist'][$file])) {
- $this->_packageInfo['filelist'][$file] =
- array_merge($this->_packageInfo['filelist'][$file], $atts['attribs']);
- } else {
- $this->_packageInfo['filelist'][$file] = $atts['attribs'];
- }
- }
-
- /**
- * Retrieve the contents tag
- */
- function getContents()
- {
- if (isset($this->_packageInfo['contents'])) {
- return $this->_packageInfo['contents'];
- }
- return false;
- }
-
- /**
- * @param string full path to file
- * @param string attribute name
- * @param string attribute value
- * @param int risky but fast - use this to choose a file based on its position in the list
- * of files. Index is zero-based like PHP arrays.
- * @return bool success of operation
- */
- function setFileAttribute($filename, $attr, $value, $index = false)
- {
- $this->_isValid = 0;
- if (in_array($attr, array('role', 'name', 'baseinstalldir'))) {
- $this->_filesValid = false;
- }
- if ($index !== false &&
- isset($this->_packageInfo['contents']['dir']['file'][$index]['attribs'])) {
- $this->_packageInfo['contents']['dir']['file'][$index]['attribs'][$attr] = $value;
- return true;
- }
- if (!isset($this->_packageInfo['contents']['dir']['file'])) {
- return false;
- }
- $files = $this->_packageInfo['contents']['dir']['file'];
- if (!isset($files[0])) {
- $files = array($files);
- $ind = false;
- } else {
- $ind = true;
- }
- foreach ($files as $i => $file) {
- if (isset($file['attribs'])) {
- if ($file['attribs']['name'] == $filename) {
- if ($ind) {
- $this->_packageInfo['contents']['dir']['file'][$i]['attribs'][$attr] = $value;
- } else {
- $this->_packageInfo['contents']['dir']['file']['attribs'][$attr] = $value;
- }
- return true;
- }
- }
- }
- return false;
- }
-
- function setDirtree($path)
- {
- if (!isset($this->_packageInfo['dirtree'])) {
- $this->_packageInfo['dirtree'] = array();
- }
- $this->_packageInfo['dirtree'][$path] = true;
- }
-
- function getDirtree()
- {
- if (isset($this->_packageInfo['dirtree']) && count($this->_packageInfo['dirtree'])) {
- return $this->_packageInfo['dirtree'];
- }
- return false;
- }
-
- function resetDirtree()
- {
- unset($this->_packageInfo['dirtree']);
- }
-
- /**
- * Determines whether this package claims it is compatible with the version of
- * the package that has a recommended version dependency
- * @param PEAR_PackageFile_v2|PEAR_PackageFile_v1|PEAR_Downloader_Package
- * @return boolean
- */
- function isCompatible($pf)
- {
- if (!isset($this->_packageInfo['compatible'])) {
- return false;
- }
- if (!isset($this->_packageInfo['channel'])) {
- return false;
- }
- $me = $pf->getVersion();
- $compatible = $this->_packageInfo['compatible'];
- if (!isset($compatible[0])) {
- $compatible = array($compatible);
- }
- $found = false;
- foreach ($compatible as $info) {
- if (strtolower($info['name']) == strtolower($pf->getPackage())) {
- if (strtolower($info['channel']) == strtolower($pf->getChannel())) {
- $found = true;
- break;
- }
- }
- }
- if (!$found) {
- return false;
- }
- if (isset($info['exclude'])) {
- if (!isset($info['exclude'][0])) {
- $info['exclude'] = array($info['exclude']);
- }
- foreach ($info['exclude'] as $exclude) {
- if (version_compare($me, $exclude, '==')) {
- return false;
- }
- }
- }
- if (version_compare($me, $info['min'], '>=') && version_compare($me, $info['max'], '<=')) {
- return true;
- }
- return false;
- }
-
- /**
- * @return array|false
- */
- function getCompatible()
- {
- if (isset($this->_packageInfo['compatible'])) {
- return $this->_packageInfo['compatible'];
- }
- return false;
- }
-
- function getDependencies()
- {
- if (isset($this->_packageInfo['dependencies'])) {
- return $this->_packageInfo['dependencies'];
- }
- return false;
- }
-
- function isSubpackageOf($p)
- {
- return $p->isSubpackage($this);
- }
-
- /**
- * Determines whether the passed in package is a subpackage of this package.
- *
- * No version checking is done, only name verification.
- * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2
- * @return bool
- */
- function isSubpackage($p)
- {
- $sub = array();
- if (isset($this->_packageInfo['dependencies']['required']['subpackage'])) {
- $sub = $this->_packageInfo['dependencies']['required']['subpackage'];
- if (!isset($sub[0])) {
- $sub = array($sub);
- }
- }
- if (isset($this->_packageInfo['dependencies']['optional']['subpackage'])) {
- $sub1 = $this->_packageInfo['dependencies']['optional']['subpackage'];
- if (!isset($sub1[0])) {
- $sub1 = array($sub1);
- }
- $sub = array_merge($sub, $sub1);
- }
- if (isset($this->_packageInfo['dependencies']['group'])) {
- $group = $this->_packageInfo['dependencies']['group'];
- if (!isset($group[0])) {
- $group = array($group);
- }
- foreach ($group as $deps) {
- if (isset($deps['subpackage'])) {
- $sub2 = $deps['subpackage'];
- if (!isset($sub2[0])) {
- $sub2 = array($sub2);
- }
- $sub = array_merge($sub, $sub2);
- }
- }
- }
- foreach ($sub as $dep) {
- if (strtolower($dep['name']) == strtolower($p->getPackage())) {
- if (isset($dep['channel'])) {
- if (strtolower($dep['channel']) == strtolower($p->getChannel())) {
- return true;
- }
- } else {
- if ($dep['uri'] == $p->getURI()) {
- return true;
- }
- }
- }
- }
- return false;
- }
-
- function dependsOn($package, $channel)
- {
- if (!($deps = $this->getDependencies())) {
- return false;
- }
- foreach (array('package', 'subpackage') as $type) {
- foreach (array('required', 'optional') as $needed) {
- if (isset($deps[$needed][$type])) {
- if (!isset($deps[$needed][$type][0])) {
- $deps[$needed][$type] = array($deps[$needed][$type]);
- }
- foreach ($deps[$needed][$type] as $dep) {
- $depchannel = isset($dep['channel']) ? $dep['channel'] : '__uri';
- if (strtolower($dep['name']) == strtolower($package) &&
- $depchannel == $channel) {
- return true;
- }
- }
- }
- }
- if (isset($deps['group'])) {
- if (!isset($deps['group'][0])) {
- $dep['group'] = array($deps['group']);
- }
- foreach ($deps['group'] as $group) {
- if (isset($group[$type])) {
- if (!is_array($group[$type])) {
- $group[$type] = array($group[$type]);
- }
- foreach ($group[$type] as $dep) {
- $depchannel = isset($dep['channel']) ? $dep['channel'] : '__uri';
- if (strtolower($dep['name']) == strtolower($package) &&
- $depchannel == $channel) {
- return true;
- }
- }
- }
- }
- }
- }
- return false;
- }
-
- /**
- * Get the contents of a dependency group
- * @param string
- * @return array|false
- */
- function getDependencyGroup($name)
- {
- $name = strtolower($name);
- if (!isset($this->_packageInfo['dependencies']['group'])) {
- return false;
- }
- $groups = $this->_packageInfo['dependencies']['group'];
- if (!isset($groups[0])) {
- $groups = array($groups);
- }
- foreach ($groups as $group) {
- if (strtolower($group['attribs']['name']) == $name) {
- return $group;
- }
- }
- return false;
- }
-
- /**
- * Retrieve a partial package.xml 1.0 representation of dependencies
- *
- * a very limited representation of dependencies is returned by this method.
- * The <exclude> tag for excluding certain versions of a dependency is
- * completely ignored. In addition, dependency groups are ignored, with the
- * assumption that all dependencies in dependency groups are also listed in
- * the optional group that work with all dependency groups
- * @param boolean return package.xml 2.0 <dependencies> tag
- * @return array|false
- */
- function getDeps($raw = false, $nopearinstaller = false)
- {
- if (isset($this->_packageInfo['dependencies'])) {
- if ($raw) {
- return $this->_packageInfo['dependencies'];
- }
- $ret = array();
- $map = array(
- 'php' => 'php',
- 'package' => 'pkg',
- 'subpackage' => 'pkg',
- 'extension' => 'ext',
- 'os' => 'os',
- 'pearinstaller' => 'pkg',
- );
- foreach (array('required', 'optional') as $type) {
- $optional = ($type == 'optional') ? 'yes' : 'no';
- if (!isset($this->_packageInfo['dependencies'][$type])
- || empty($this->_packageInfo['dependencies'][$type])) {
- continue;
- }
- foreach ($this->_packageInfo['dependencies'][$type] as $dtype => $deps) {
- if ($dtype == 'pearinstaller' && $nopearinstaller) {
- continue;
- }
- if (!isset($deps[0])) {
- $deps = array($deps);
- }
- foreach ($deps as $dep) {
- if (!isset($map[$dtype])) {
- // no support for arch type
- continue;
- }
- if ($dtype == 'pearinstaller') {
- $dep['name'] = 'PEAR';
- $dep['channel'] = 'pear.php.net';
- }
- $s = array('type' => $map[$dtype]);
- if (isset($dep['channel'])) {
- $s['channel'] = $dep['channel'];
- }
- if (isset($dep['uri'])) {
- $s['uri'] = $dep['uri'];
- }
- if (isset($dep['name'])) {
- $s['name'] = $dep['name'];
- }
- if (isset($dep['conflicts'])) {
- $s['rel'] = 'not';
- } else {
- if (!isset($dep['min']) &&
- !isset($dep['max'])) {
- $s['rel'] = 'has';
- $s['optional'] = $optional;
- } elseif (isset($dep['min']) &&
- isset($dep['max'])) {
- $s['rel'] = 'ge';
- $s1 = $s;
- $s1['rel'] = 'le';
- $s['version'] = $dep['min'];
- $s1['version'] = $dep['max'];
- if (isset($dep['channel'])) {
- $s1['channel'] = $dep['channel'];
- }
- if ($dtype != 'php') {
- $s['name'] = $dep['name'];
- $s1['name'] = $dep['name'];
- }
- $s['optional'] = $optional;
- $s1['optional'] = $optional;
- $ret[] = $s1;
- } elseif (isset($dep['min'])) {
- if (isset($dep['exclude']) &&
- $dep['exclude'] == $dep['min']) {
- $s['rel'] = 'gt';
- } else {
- $s['rel'] = 'ge';
- }
- $s['version'] = $dep['min'];
- $s['optional'] = $optional;
- if ($dtype != 'php') {
- $s['name'] = $dep['name'];
- }
- } elseif (isset($dep['max'])) {
- if (isset($dep['exclude']) &&
- $dep['exclude'] == $dep['max']) {
- $s['rel'] = 'lt';
- } else {
- $s['rel'] = 'le';
- }
- $s['version'] = $dep['max'];
- $s['optional'] = $optional;
- if ($dtype != 'php') {
- $s['name'] = $dep['name'];
- }
- }
- }
- $ret[] = $s;
- }
- }
- }
- if (count($ret)) {
- return $ret;
- }
- }
- return false;
- }
-
- /**
- * @return php|extsrc|extbin|zendextsrc|zendextbin|bundle|false
- */
- function getPackageType()
- {
- if (isset($this->_packageInfo['phprelease'])) {
- return 'php';
- }
- if (isset($this->_packageInfo['extsrcrelease'])) {
- return 'extsrc';
- }
- if (isset($this->_packageInfo['extbinrelease'])) {
- return 'extbin';
- }
- if (isset($this->_packageInfo['zendextsrcrelease'])) {
- return 'zendextsrc';
- }
- if (isset($this->_packageInfo['zendextbinrelease'])) {
- return 'zendextbin';
- }
- if (isset($this->_packageInfo['bundle'])) {
- return 'bundle';
- }
- return false;
- }
-
- /**
- * @return array|false
- */
- function getReleases()
- {
- $type = $this->getPackageType();
- if ($type != 'bundle') {
- $type .= 'release';
- }
- if ($this->getPackageType() && isset($this->_packageInfo[$type])) {
- return $this->_packageInfo[$type];
- }
- return false;
- }
-
- /**
- * @return array
- */
- function getChangelog()
- {
- if (isset($this->_packageInfo['changelog'])) {
- return $this->_packageInfo['changelog'];
- }
- return false;
- }
-
- function hasDeps()
- {
- return isset($this->_packageInfo['dependencies']);
- }
-
- function getPackagexmlVersion()
- {
- if (isset($this->_packageInfo['zendextsrcrelease'])) {
- return '2.1';
- }
- if (isset($this->_packageInfo['zendextbinrelease'])) {
- return '2.1';
- }
- return '2.0';
- }
-
- /**
- * @return array|false
- */
- function getSourcePackage()
- {
- if (isset($this->_packageInfo['extbinrelease']) ||
- isset($this->_packageInfo['zendextbinrelease'])) {
- return array('channel' => $this->_packageInfo['srcchannel'],
- 'package' => $this->_packageInfo['srcpackage']);
- }
- return false;
- }
-
- function getBundledPackages()
- {
- if (isset($this->_packageInfo['bundle'])) {
- return $this->_packageInfo['contents']['bundledpackage'];
- }
- return false;
- }
-
- function getLastModified()
- {
- if (isset($this->_packageInfo['_lastmodified'])) {
- return $this->_packageInfo['_lastmodified'];
- }
- return false;
- }
-
- /**
- * Get the contents of a file listed within the package.xml
- * @param string
- * @return string
- */
- function getFileContents($file)
- {
- if ($this->_archiveFile == $this->_packageFile) { // unpacked
- $dir = dirname($this->_packageFile);
- $file = $dir . DIRECTORY_SEPARATOR . $file;
- $file = str_replace(array('/', '\\'),
- array(DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR), $file);
- if (file_exists($file) && is_readable($file)) {
- return implode('', file($file));
- }
- } else { // tgz
- $tar = &new Archive_Tar($this->_archiveFile);
- $tar->pushErrorHandling(PEAR_ERROR_RETURN);
- if ($file != 'package.xml' && $file != 'package2.xml') {
- $file = $this->getPackage() . '-' . $this->getVersion() . '/' . $file;
- }
- $file = $tar->extractInString($file);
- $tar->popErrorHandling();
- if (PEAR::isError($file)) {
- return PEAR::raiseError("Cannot locate file '$file' in archive");
- }
- return $file;
- }
- }
-
- function &getRW()
- {
- if (!class_exists('PEAR_PackageFile_v2_rw')) {
- require_once 'PEAR/PackageFile/v2/rw.php';
- }
- $a = new PEAR_PackageFile_v2_rw;
- foreach (get_object_vars($this) as $name => $unused) {
- if (!isset($this->$name)) {
- continue;
- }
- if ($name == '_config' || $name == '_logger'|| $name == '_registry' ||
- $name == '_stack') {
- $a->$name = &$this->$name;
- } else {
- $a->$name = $this->$name;
- }
- }
- return $a;
- }
-
- function &getDefaultGenerator()
- {
- if (!class_exists('PEAR_PackageFile_Generator_v2')) {
- require_once 'PEAR/PackageFile/Generator/v2.php';
- }
- $a = &new PEAR_PackageFile_Generator_v2($this);
- return $a;
- }
-
- function analyzeSourceCode($file, $string = false)
- {
- if (!isset($this->_v2Validator) ||
- !is_a($this->_v2Validator, 'PEAR_PackageFile_v2_Validator')) {
- if (!class_exists('PEAR_PackageFile_v2_Validator')) {
- require_once 'PEAR/PackageFile/v2/Validator.php';
- }
- $this->_v2Validator = new PEAR_PackageFile_v2_Validator;
- }
- return $this->_v2Validator->analyzeSourceCode($file, $string);
- }
-
- function validate($state = PEAR_VALIDATE_NORMAL)
- {
- if (!isset($this->_packageInfo) || !is_array($this->_packageInfo)) {
- return false;
- }
- if (!isset($this->_v2Validator) ||
- !is_a($this->_v2Validator, 'PEAR_PackageFile_v2_Validator')) {
- if (!class_exists('PEAR_PackageFile_v2_Validator')) {
- require_once 'PEAR/PackageFile/v2/Validator.php';
- }
- $this->_v2Validator = new PEAR_PackageFile_v2_Validator;
- }
- if (isset($this->_packageInfo['xsdversion'])) {
- unset($this->_packageInfo['xsdversion']);
- }
- return $this->_v2Validator->validate($this, $state);
- }
-
- function getTasksNs()
- {
- if (!isset($this->_tasksNs)) {
- if (isset($this->_packageInfo['attribs'])) {
- foreach ($this->_packageInfo['attribs'] as $name => $value) {
- if ($value == 'http://pear.php.net/dtd/tasks-1.0') {
- $this->_tasksNs = str_replace('xmlns:', '', $name);
- break;
- }
- }
- }
- }
- return $this->_tasksNs;
- }
-
- /**
- * Determine whether a task name is a valid task. Custom tasks may be defined
- * using subdirectories by putting a "-" in the name, as in <tasks:mycustom-task>
- *
- * Note that this method will auto-load the task class file and test for the existence
- * of the name with "-" replaced by "_" as in PEAR/Task/mycustom/task.php makes class
- * PEAR_Task_mycustom_task
- * @param string
- * @return boolean
- */
- function getTask($task)
- {
- $this->getTasksNs();
- // transform all '-' to '/' and 'tasks:' to '' so tasks:replace becomes replace
- $task = str_replace(array($this->_tasksNs . ':', '-'), array('', ' '), $task);
- $taskfile = str_replace(' ', '/', ucwords($task));
- $task = str_replace(array(' ', '/'), '_', ucwords($task));
- if (class_exists("PEAR_Task_$task")) {
- return "PEAR_Task_$task";
- }
- $fp = @fopen("PEAR/Task/$taskfile.php", 'r', true);
- if ($fp) {
- fclose($fp);
- require_once "PEAR/Task/$taskfile.php";
- return "PEAR_Task_$task";
- }
- return false;
- }
-
- /**
- * Key-friendly array_splice
- * @param tagname to splice a value in before
- * @param mixed the value to splice in
- * @param string the new tag name
- */
- function _ksplice($array, $key, $value, $newkey)
- {
- $offset = array_search($key, array_keys($array));
- $after = array_slice($array, $offset);
- $before = array_slice($array, 0, $offset);
- $before[$newkey] = $value;
- return array_merge($before, $after);
- }
-
- /**
- * @param array a list of possible keys, in the order they may occur
- * @param mixed contents of the new package.xml tag
- * @param string tag name
- * @access private
- */
- function _insertBefore($array, $keys, $contents, $newkey)
- {
- foreach ($keys as $key) {
- if (isset($array[$key])) {
- return $array = $this->_ksplice($array, $key, $contents, $newkey);
- }
- }
- $array[$newkey] = $contents;
- return $array;
- }
-
- /**
- * @param subsection of {@link $_packageInfo}
- * @param array|string tag contents
- * @param array format:
- * <pre>
- * array(
- * tagname => array(list of tag names that follow this one),
- * childtagname => array(list of child tag names that follow this one),
- * )
- * </pre>
- *
- * This allows construction of nested tags
- * @access private
- */
- function _mergeTag($manip, $contents, $order)
- {
- if (count($order)) {
- foreach ($order as $tag => $curorder) {
- if (!isset($manip[$tag])) {
- // ensure that the tag is set up
- $manip = $this->_insertBefore($manip, $curorder, array(), $tag);
- }
- if (count($order) > 1) {
- $manip[$tag] = $this->_mergeTag($manip[$tag], $contents, array_slice($order, 1));
- return $manip;
- }
- }
- } else {
- return $manip;
- }
- if (is_array($manip[$tag]) && !empty($manip[$tag]) && isset($manip[$tag][0])) {
- $manip[$tag][] = $contents;
- } else {
- if (!count($manip[$tag])) {
- $manip[$tag] = $contents;
- } else {
- $manip[$tag] = array($manip[$tag]);
- $manip[$tag][] = $contents;
- }
- }
- return $manip;
- }
-}
-?>
diff --git a/3rdparty/PEAR/PackageFile/v2/Validator.php b/3rdparty/PEAR/PackageFile/v2/Validator.php
deleted file mode 100644
index 33c8eee3876..00000000000
--- a/3rdparty/PEAR/PackageFile/v2/Validator.php
+++ /dev/null
@@ -1,2154 +0,0 @@
-<?php
-/**
- * PEAR_PackageFile_v2, package.xml version 2.0, read/write version
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Validator.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a8
- */
-/**
- * Private validation class used by PEAR_PackageFile_v2 - do not use directly, its
- * sole purpose is to split up the PEAR/PackageFile/v2.php file to make it smaller
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a8
- * @access private
- */
-class PEAR_PackageFile_v2_Validator
-{
- /**
- * @var array
- */
- var $_packageInfo;
- /**
- * @var PEAR_PackageFile_v2
- */
- var $_pf;
- /**
- * @var PEAR_ErrorStack
- */
- var $_stack;
- /**
- * @var int
- */
- var $_isValid = 0;
- /**
- * @var int
- */
- var $_filesValid = 0;
- /**
- * @var int
- */
- var $_curState = 0;
- /**
- * @param PEAR_PackageFile_v2
- * @param int
- */
- function validate(&$pf, $state = PEAR_VALIDATE_NORMAL)
- {
- $this->_pf = &$pf;
- $this->_curState = $state;
- $this->_packageInfo = $this->_pf->getArray();
- $this->_isValid = $this->_pf->_isValid;
- $this->_filesValid = $this->_pf->_filesValid;
- $this->_stack = &$pf->_stack;
- $this->_stack->getErrors(true);
- if (($this->_isValid & $state) == $state) {
- return true;
- }
- if (!isset($this->_packageInfo) || !is_array($this->_packageInfo)) {
- return false;
- }
- if (!isset($this->_packageInfo['attribs']['version']) ||
- ($this->_packageInfo['attribs']['version'] != '2.0' &&
- $this->_packageInfo['attribs']['version'] != '2.1')
- ) {
- $this->_noPackageVersion();
- }
- $structure =
- array(
- 'name',
- 'channel|uri',
- '*extends', // can't be multiple, but this works fine
- 'summary',
- 'description',
- '+lead', // these all need content checks
- '*developer',
- '*contributor',
- '*helper',
- 'date',
- '*time',
- 'version',
- 'stability',
- 'license->?uri->?filesource',
- 'notes',
- 'contents', //special validation needed
- '*compatible',
- 'dependencies', //special validation needed
- '*usesrole',
- '*usestask', // reserve these for 1.4.0a1 to implement
- // this will allow a package.xml to gracefully say it
- // needs a certain package installed in order to implement a role or task
- '*providesextension',
- '*srcpackage|*srcuri',
- '+phprelease|+extsrcrelease|+extbinrelease|' .
- '+zendextsrcrelease|+zendextbinrelease|bundle', //special validation needed
- '*changelog',
- );
- $test = $this->_packageInfo;
- if (isset($test['dependencies']) &&
- isset($test['dependencies']['required']) &&
- isset($test['dependencies']['required']['pearinstaller']) &&
- isset($test['dependencies']['required']['pearinstaller']['min']) &&
- version_compare('1.9.4',
- $test['dependencies']['required']['pearinstaller']['min'], '<')
- ) {
- $this->_pearVersionTooLow($test['dependencies']['required']['pearinstaller']['min']);
- return false;
- }
- // ignore post-installation array fields
- if (array_key_exists('filelist', $test)) {
- unset($test['filelist']);
- }
- if (array_key_exists('_lastmodified', $test)) {
- unset($test['_lastmodified']);
- }
- if (array_key_exists('#binarypackage', $test)) {
- unset($test['#binarypackage']);
- }
- if (array_key_exists('old', $test)) {
- unset($test['old']);
- }
- if (array_key_exists('_lastversion', $test)) {
- unset($test['_lastversion']);
- }
- if (!$this->_stupidSchemaValidate($structure, $test, '<package>')) {
- return false;
- }
- if (empty($this->_packageInfo['name'])) {
- $this->_tagCannotBeEmpty('name');
- }
- $test = isset($this->_packageInfo['uri']) ? 'uri' :'channel';
- if (empty($this->_packageInfo[$test])) {
- $this->_tagCannotBeEmpty($test);
- }
- if (is_array($this->_packageInfo['license']) &&
- (!isset($this->_packageInfo['license']['_content']) ||
- empty($this->_packageInfo['license']['_content']))) {
- $this->_tagCannotBeEmpty('license');
- } elseif (empty($this->_packageInfo['license'])) {
- $this->_tagCannotBeEmpty('license');
- }
- if (empty($this->_packageInfo['summary'])) {
- $this->_tagCannotBeEmpty('summary');
- }
- if (empty($this->_packageInfo['description'])) {
- $this->_tagCannotBeEmpty('description');
- }
- if (empty($this->_packageInfo['date'])) {
- $this->_tagCannotBeEmpty('date');
- }
- if (empty($this->_packageInfo['notes'])) {
- $this->_tagCannotBeEmpty('notes');
- }
- if (isset($this->_packageInfo['time']) && empty($this->_packageInfo['time'])) {
- $this->_tagCannotBeEmpty('time');
- }
- if (isset($this->_packageInfo['dependencies'])) {
- $this->_validateDependencies();
- }
- if (isset($this->_packageInfo['compatible'])) {
- $this->_validateCompatible();
- }
- if (!isset($this->_packageInfo['bundle'])) {
- if (empty($this->_packageInfo['contents'])) {
- $this->_tagCannotBeEmpty('contents');
- }
- if (!isset($this->_packageInfo['contents']['dir'])) {
- $this->_filelistMustContainDir('contents');
- return false;
- }
- if (isset($this->_packageInfo['contents']['file'])) {
- $this->_filelistCannotContainFile('contents');
- return false;
- }
- }
- $this->_validateMaintainers();
- $this->_validateStabilityVersion();
- $fail = false;
- if (array_key_exists('usesrole', $this->_packageInfo)) {
- $roles = $this->_packageInfo['usesrole'];
- if (!is_array($roles) || !isset($roles[0])) {
- $roles = array($roles);
- }
- foreach ($roles as $role) {
- if (!isset($role['role'])) {
- $this->_usesroletaskMustHaveRoleTask('usesrole', 'role');
- $fail = true;
- } else {
- if (!isset($role['channel'])) {
- if (!isset($role['uri'])) {
- $this->_usesroletaskMustHaveChannelOrUri($role['role'], 'usesrole');
- $fail = true;
- }
- } elseif (!isset($role['package'])) {
- $this->_usesroletaskMustHavePackage($role['role'], 'usesrole');
- $fail = true;
- }
- }
- }
- }
- if (array_key_exists('usestask', $this->_packageInfo)) {
- $roles = $this->_packageInfo['usestask'];
- if (!is_array($roles) || !isset($roles[0])) {
- $roles = array($roles);
- }
- foreach ($roles as $role) {
- if (!isset($role['task'])) {
- $this->_usesroletaskMustHaveRoleTask('usestask', 'task');
- $fail = true;
- } else {
- if (!isset($role['channel'])) {
- if (!isset($role['uri'])) {
- $this->_usesroletaskMustHaveChannelOrUri($role['task'], 'usestask');
- $fail = true;
- }
- } elseif (!isset($role['package'])) {
- $this->_usesroletaskMustHavePackage($role['task'], 'usestask');
- $fail = true;
- }
- }
- }
- }
-
- if ($fail) {
- return false;
- }
-
- $list = $this->_packageInfo['contents'];
- if (isset($list['dir']) && is_array($list['dir']) && isset($list['dir'][0])) {
- $this->_multipleToplevelDirNotAllowed();
- return $this->_isValid = 0;
- }
-
- $this->_validateFilelist();
- $this->_validateRelease();
- if (!$this->_stack->hasErrors()) {
- $chan = $this->_pf->_registry->getChannel($this->_pf->getChannel(), true);
- if (PEAR::isError($chan)) {
- $this->_unknownChannel($this->_pf->getChannel());
- } else {
- $valpack = $chan->getValidationPackage();
- // for channel validator packages, always use the default PEAR validator.
- // otherwise, they can't be installed or packaged
- $validator = $chan->getValidationObject($this->_pf->getPackage());
- if (!$validator) {
- $this->_stack->push(__FUNCTION__, 'error',
- array('channel' => $chan->getName(),
- 'package' => $this->_pf->getPackage(),
- 'name' => $valpack['_content'],
- 'version' => $valpack['attribs']['version']),
- 'package "%channel%/%package%" cannot be properly validated without ' .
- 'validation package "%channel%/%name%-%version%"');
- return $this->_isValid = 0;
- }
- $validator->setPackageFile($this->_pf);
- $validator->validate($state);
- $failures = $validator->getFailures();
- foreach ($failures['errors'] as $error) {
- $this->_stack->push(__FUNCTION__, 'error', $error,
- 'Channel validator error: field "%field%" - %reason%');
- }
- foreach ($failures['warnings'] as $warning) {
- $this->_stack->push(__FUNCTION__, 'warning', $warning,
- 'Channel validator warning: field "%field%" - %reason%');
- }
- }
- }
-
- $this->_pf->_isValid = $this->_isValid = !$this->_stack->hasErrors('error');
- if ($this->_isValid && $state == PEAR_VALIDATE_PACKAGING && !$this->_filesValid) {
- if ($this->_pf->getPackageType() == 'bundle') {
- if ($this->_analyzeBundledPackages()) {
- $this->_filesValid = $this->_pf->_filesValid = true;
- } else {
- $this->_pf->_isValid = $this->_isValid = 0;
- }
- } else {
- if (!$this->_analyzePhpFiles()) {
- $this->_pf->_isValid = $this->_isValid = 0;
- } else {
- $this->_filesValid = $this->_pf->_filesValid = true;
- }
- }
- }
-
- if ($this->_isValid) {
- return $this->_pf->_isValid = $this->_isValid = $state;
- }
-
- return $this->_pf->_isValid = $this->_isValid = 0;
- }
-
- function _stupidSchemaValidate($structure, $xml, $root)
- {
- if (!is_array($xml)) {
- $xml = array();
- }
- $keys = array_keys($xml);
- reset($keys);
- $key = current($keys);
- while ($key == 'attribs' || $key == '_contents') {
- $key = next($keys);
- }
- $unfoundtags = $optionaltags = array();
- $ret = true;
- $mismatch = false;
- foreach ($structure as $struc) {
- if ($key) {
- $tag = $xml[$key];
- }
- $test = $this->_processStructure($struc);
- if (isset($test['choices'])) {
- $loose = true;
- foreach ($test['choices'] as $choice) {
- if ($key == $choice['tag']) {
- $key = next($keys);
- while ($key == 'attribs' || $key == '_contents') {
- $key = next($keys);
- }
- $unfoundtags = $optionaltags = array();
- $mismatch = false;
- if ($key && $key != $choice['tag'] && isset($choice['multiple'])) {
- $unfoundtags[] = $choice['tag'];
- $optionaltags[] = $choice['tag'];
- if ($key) {
- $mismatch = true;
- }
- }
- $ret &= $this->_processAttribs($choice, $tag, $root);
- continue 2;
- } else {
- $unfoundtags[] = $choice['tag'];
- $mismatch = true;
- }
- if (!isset($choice['multiple']) || $choice['multiple'] != '*') {
- $loose = false;
- } else {
- $optionaltags[] = $choice['tag'];
- }
- }
- if (!$loose) {
- $this->_invalidTagOrder($unfoundtags, $key, $root);
- return false;
- }
- } else {
- if ($key != $test['tag']) {
- if (isset($test['multiple']) && $test['multiple'] != '*') {
- $unfoundtags[] = $test['tag'];
- $this->_invalidTagOrder($unfoundtags, $key, $root);
- return false;
- } else {
- if ($key) {
- $mismatch = true;
- }
- $unfoundtags[] = $test['tag'];
- $optionaltags[] = $test['tag'];
- }
- if (!isset($test['multiple'])) {
- $this->_invalidTagOrder($unfoundtags, $key, $root);
- return false;
- }
- continue;
- } else {
- $unfoundtags = $optionaltags = array();
- $mismatch = false;
- }
- $key = next($keys);
- while ($key == 'attribs' || $key == '_contents') {
- $key = next($keys);
- }
- if ($key && $key != $test['tag'] && isset($test['multiple'])) {
- $unfoundtags[] = $test['tag'];
- $optionaltags[] = $test['tag'];
- $mismatch = true;
- }
- $ret &= $this->_processAttribs($test, $tag, $root);
- continue;
- }
- }
- if (!$mismatch && count($optionaltags)) {
- // don't error out on any optional tags
- $unfoundtags = array_diff($unfoundtags, $optionaltags);
- }
- if (count($unfoundtags)) {
- $this->_invalidTagOrder($unfoundtags, $key, $root);
- } elseif ($key) {
- // unknown tags
- $this->_invalidTagOrder('*no tags allowed here*', $key, $root);
- while ($key = next($keys)) {
- $this->_invalidTagOrder('*no tags allowed here*', $key, $root);
- }
- }
- return $ret;
- }
-
- function _processAttribs($choice, $tag, $context)
- {
- if (isset($choice['attribs'])) {
- if (!is_array($tag)) {
- $tag = array($tag);
- }
- $tags = $tag;
- if (!isset($tags[0])) {
- $tags = array($tags);
- }
- $ret = true;
- foreach ($tags as $i => $tag) {
- if (!is_array($tag) || !isset($tag['attribs'])) {
- foreach ($choice['attribs'] as $attrib) {
- if ($attrib{0} != '?') {
- $ret &= $this->_tagHasNoAttribs($choice['tag'],
- $context);
- continue 2;
- }
- }
- }
- foreach ($choice['attribs'] as $attrib) {
- if ($attrib{0} != '?') {
- if (!isset($tag['attribs'][$attrib])) {
- $ret &= $this->_tagMissingAttribute($choice['tag'],
- $attrib, $context);
- }
- }
- }
- }
- return $ret;
- }
- return true;
- }
-
- function _processStructure($key)
- {
- $ret = array();
- if (count($pieces = explode('|', $key)) > 1) {
- $ret['choices'] = array();
- foreach ($pieces as $piece) {
- $ret['choices'][] = $this->_processStructure($piece);
- }
- return $ret;
- }
- $multi = $key{0};
- if ($multi == '+' || $multi == '*') {
- $ret['multiple'] = $key{0};
- $key = substr($key, 1);
- }
- if (count($attrs = explode('->', $key)) > 1) {
- $ret['tag'] = array_shift($attrs);
- $ret['attribs'] = $attrs;
- } else {
- $ret['tag'] = $key;
- }
- return $ret;
- }
-
- function _validateStabilityVersion()
- {
- $structure = array('release', 'api');
- $a = $this->_stupidSchemaValidate($structure, $this->_packageInfo['version'], '<version>');
- $a &= $this->_stupidSchemaValidate($structure, $this->_packageInfo['stability'], '<stability>');
- if ($a) {
- if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/',
- $this->_packageInfo['version']['release'])) {
- $this->_invalidVersion('release', $this->_packageInfo['version']['release']);
- }
- if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/',
- $this->_packageInfo['version']['api'])) {
- $this->_invalidVersion('api', $this->_packageInfo['version']['api']);
- }
- if (!in_array($this->_packageInfo['stability']['release'],
- array('snapshot', 'devel', 'alpha', 'beta', 'stable'))) {
- $this->_invalidState('release', $this->_packageInfo['stability']['release']);
- }
- if (!in_array($this->_packageInfo['stability']['api'],
- array('devel', 'alpha', 'beta', 'stable'))) {
- $this->_invalidState('api', $this->_packageInfo['stability']['api']);
- }
- }
- }
-
- function _validateMaintainers()
- {
- $structure =
- array(
- 'name',
- 'user',
- 'email',
- 'active',
- );
- foreach (array('lead', 'developer', 'contributor', 'helper') as $type) {
- if (!isset($this->_packageInfo[$type])) {
- continue;
- }
- if (isset($this->_packageInfo[$type][0])) {
- foreach ($this->_packageInfo[$type] as $lead) {
- $this->_stupidSchemaValidate($structure, $lead, '<' . $type . '>');
- }
- } else {
- $this->_stupidSchemaValidate($structure, $this->_packageInfo[$type],
- '<' . $type . '>');
- }
- }
- }
-
- function _validatePhpDep($dep, $installcondition = false)
- {
- $structure = array(
- 'min',
- '*max',
- '*exclude',
- );
- $type = $installcondition ? '<installcondition><php>' : '<dependencies><required><php>';
- $this->_stupidSchemaValidate($structure, $dep, $type);
- if (isset($dep['min'])) {
- if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?(?:-[a-zA-Z0-9]+)?\\z/',
- $dep['min'])) {
- $this->_invalidVersion($type . '<min>', $dep['min']);
- }
- }
- if (isset($dep['max'])) {
- if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?(?:-[a-zA-Z0-9]+)?\\z/',
- $dep['max'])) {
- $this->_invalidVersion($type . '<max>', $dep['max']);
- }
- }
- if (isset($dep['exclude'])) {
- if (!is_array($dep['exclude'])) {
- $dep['exclude'] = array($dep['exclude']);
- }
- foreach ($dep['exclude'] as $exclude) {
- if (!preg_match(
- '/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?(?:-[a-zA-Z0-9]+)?\\z/',
- $exclude)) {
- $this->_invalidVersion($type . '<exclude>', $exclude);
- }
- }
- }
- }
-
- function _validatePearinstallerDep($dep)
- {
- $structure = array(
- 'min',
- '*max',
- '*recommended',
- '*exclude',
- );
- $this->_stupidSchemaValidate($structure, $dep, '<dependencies><required><pearinstaller>');
- if (isset($dep['min'])) {
- if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/',
- $dep['min'])) {
- $this->_invalidVersion('<dependencies><required><pearinstaller><min>',
- $dep['min']);
- }
- }
- if (isset($dep['max'])) {
- if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/',
- $dep['max'])) {
- $this->_invalidVersion('<dependencies><required><pearinstaller><max>',
- $dep['max']);
- }
- }
- if (isset($dep['recommended'])) {
- if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/',
- $dep['recommended'])) {
- $this->_invalidVersion('<dependencies><required><pearinstaller><recommended>',
- $dep['recommended']);
- }
- }
- if (isset($dep['exclude'])) {
- if (!is_array($dep['exclude'])) {
- $dep['exclude'] = array($dep['exclude']);
- }
- foreach ($dep['exclude'] as $exclude) {
- if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/',
- $exclude)) {
- $this->_invalidVersion('<dependencies><required><pearinstaller><exclude>',
- $exclude);
- }
- }
- }
- }
-
- function _validatePackageDep($dep, $group, $type = '<package>')
- {
- if (isset($dep['uri'])) {
- if (isset($dep['conflicts'])) {
- $structure = array(
- 'name',
- 'uri',
- 'conflicts',
- '*providesextension',
- );
- } else {
- $structure = array(
- 'name',
- 'uri',
- '*providesextension',
- );
- }
- } else {
- if (isset($dep['conflicts'])) {
- $structure = array(
- 'name',
- 'channel',
- '*min',
- '*max',
- '*exclude',
- 'conflicts',
- '*providesextension',
- );
- } else {
- $structure = array(
- 'name',
- 'channel',
- '*min',
- '*max',
- '*recommended',
- '*exclude',
- '*nodefault',
- '*providesextension',
- );
- }
- }
- if (isset($dep['name'])) {
- $type .= '<name>' . $dep['name'] . '</name>';
- }
- $this->_stupidSchemaValidate($structure, $dep, '<dependencies>' . $group . $type);
- if (isset($dep['uri']) && (isset($dep['min']) || isset($dep['max']) ||
- isset($dep['recommended']) || isset($dep['exclude']))) {
- $this->_uriDepsCannotHaveVersioning('<dependencies>' . $group . $type);
- }
- if (isset($dep['channel']) && strtolower($dep['channel']) == '__uri') {
- $this->_DepchannelCannotBeUri('<dependencies>' . $group . $type);
- }
- if (isset($dep['min'])) {
- if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/',
- $dep['min'])) {
- $this->_invalidVersion('<dependencies>' . $group . $type . '<min>', $dep['min']);
- }
- }
- if (isset($dep['max'])) {
- if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/',
- $dep['max'])) {
- $this->_invalidVersion('<dependencies>' . $group . $type . '<max>', $dep['max']);
- }
- }
- if (isset($dep['recommended'])) {
- if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/',
- $dep['recommended'])) {
- $this->_invalidVersion('<dependencies>' . $group . $type . '<recommended>',
- $dep['recommended']);
- }
- }
- if (isset($dep['exclude'])) {
- if (!is_array($dep['exclude'])) {
- $dep['exclude'] = array($dep['exclude']);
- }
- foreach ($dep['exclude'] as $exclude) {
- if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/',
- $exclude)) {
- $this->_invalidVersion('<dependencies>' . $group . $type . '<exclude>',
- $exclude);
- }
- }
- }
- }
-
- function _validateSubpackageDep($dep, $group)
- {
- $this->_validatePackageDep($dep, $group, '<subpackage>');
- if (isset($dep['providesextension'])) {
- $this->_subpackageCannotProvideExtension(isset($dep['name']) ? $dep['name'] : '');
- }
- if (isset($dep['conflicts'])) {
- $this->_subpackagesCannotConflict(isset($dep['name']) ? $dep['name'] : '');
- }
- }
-
- function _validateExtensionDep($dep, $group = false, $installcondition = false)
- {
- if (isset($dep['conflicts'])) {
- $structure = array(
- 'name',
- '*min',
- '*max',
- '*exclude',
- 'conflicts',
- );
- } else {
- $structure = array(
- 'name',
- '*min',
- '*max',
- '*recommended',
- '*exclude',
- );
- }
- if ($installcondition) {
- $type = '<installcondition><extension>';
- } else {
- $type = '<dependencies>' . $group . '<extension>';
- }
- if (isset($dep['name'])) {
- $type .= '<name>' . $dep['name'] . '</name>';
- }
- $this->_stupidSchemaValidate($structure, $dep, $type);
- if (isset($dep['min'])) {
- if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/',
- $dep['min'])) {
- $this->_invalidVersion(substr($type, 1) . '<min', $dep['min']);
- }
- }
- if (isset($dep['max'])) {
- if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/',
- $dep['max'])) {
- $this->_invalidVersion(substr($type, 1) . '<max', $dep['max']);
- }
- }
- if (isset($dep['recommended'])) {
- if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/',
- $dep['recommended'])) {
- $this->_invalidVersion(substr($type, 1) . '<recommended', $dep['recommended']);
- }
- }
- if (isset($dep['exclude'])) {
- if (!is_array($dep['exclude'])) {
- $dep['exclude'] = array($dep['exclude']);
- }
- foreach ($dep['exclude'] as $exclude) {
- if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/',
- $exclude)) {
- $this->_invalidVersion(substr($type, 1) . '<exclude', $exclude);
- }
- }
- }
- }
-
- function _validateOsDep($dep, $installcondition = false)
- {
- $structure = array(
- 'name',
- '*conflicts',
- );
- $type = $installcondition ? '<installcondition><os>' : '<dependencies><required><os>';
- if ($this->_stupidSchemaValidate($structure, $dep, $type)) {
- if ($dep['name'] == '*') {
- if (array_key_exists('conflicts', $dep)) {
- $this->_cannotConflictWithAllOs($type);
- }
- }
- }
- }
-
- function _validateArchDep($dep, $installcondition = false)
- {
- $structure = array(
- 'pattern',
- '*conflicts',
- );
- $type = $installcondition ? '<installcondition><arch>' : '<dependencies><required><arch>';
- $this->_stupidSchemaValidate($structure, $dep, $type);
- }
-
- function _validateInstallConditions($cond, $release)
- {
- $structure = array(
- '*php',
- '*extension',
- '*os',
- '*arch',
- );
- if (!$this->_stupidSchemaValidate($structure,
- $cond, $release)) {
- return false;
- }
- foreach (array('php', 'extension', 'os', 'arch') as $type) {
- if (isset($cond[$type])) {
- $iter = $cond[$type];
- if (!is_array($iter) || !isset($iter[0])) {
- $iter = array($iter);
- }
- foreach ($iter as $package) {
- if ($type == 'extension') {
- $this->{"_validate{$type}Dep"}($package, false, true);
- } else {
- $this->{"_validate{$type}Dep"}($package, true);
- }
- }
- }
- }
- }
-
- function _validateDependencies()
- {
- $structure = array(
- 'required',
- '*optional',
- '*group->name->hint'
- );
- if (!$this->_stupidSchemaValidate($structure,
- $this->_packageInfo['dependencies'], '<dependencies>')) {
- return false;
- }
- foreach (array('required', 'optional') as $simpledep) {
- if (isset($this->_packageInfo['dependencies'][$simpledep])) {
- if ($simpledep == 'optional') {
- $structure = array(
- '*package',
- '*subpackage',
- '*extension',
- );
- } else {
- $structure = array(
- 'php',
- 'pearinstaller',
- '*package',
- '*subpackage',
- '*extension',
- '*os',
- '*arch',
- );
- }
- if ($this->_stupidSchemaValidate($structure,
- $this->_packageInfo['dependencies'][$simpledep],
- "<dependencies><$simpledep>")) {
- foreach (array('package', 'subpackage', 'extension') as $type) {
- if (isset($this->_packageInfo['dependencies'][$simpledep][$type])) {
- $iter = $this->_packageInfo['dependencies'][$simpledep][$type];
- if (!isset($iter[0])) {
- $iter = array($iter);
- }
- foreach ($iter as $package) {
- if ($type != 'extension') {
- if (isset($package['uri'])) {
- if (isset($package['channel'])) {
- $this->_UrlOrChannel($type,
- $package['name']);
- }
- } else {
- if (!isset($package['channel'])) {
- $this->_NoChannel($type, $package['name']);
- }
- }
- }
- $this->{"_validate{$type}Dep"}($package, "<$simpledep>");
- }
- }
- }
- if ($simpledep == 'optional') {
- continue;
- }
- foreach (array('php', 'pearinstaller', 'os', 'arch') as $type) {
- if (isset($this->_packageInfo['dependencies'][$simpledep][$type])) {
- $iter = $this->_packageInfo['dependencies'][$simpledep][$type];
- if (!isset($iter[0])) {
- $iter = array($iter);
- }
- foreach ($iter as $package) {
- $this->{"_validate{$type}Dep"}($package);
- }
- }
- }
- }
- }
- }
- if (isset($this->_packageInfo['dependencies']['group'])) {
- $groups = $this->_packageInfo['dependencies']['group'];
- if (!isset($groups[0])) {
- $groups = array($groups);
- }
- $structure = array(
- '*package',
- '*subpackage',
- '*extension',
- );
- foreach ($groups as $group) {
- if ($this->_stupidSchemaValidate($structure, $group, '<group>')) {
- if (!PEAR_Validate::validGroupName($group['attribs']['name'])) {
- $this->_invalidDepGroupName($group['attribs']['name']);
- }
- foreach (array('package', 'subpackage', 'extension') as $type) {
- if (isset($group[$type])) {
- $iter = $group[$type];
- if (!isset($iter[0])) {
- $iter = array($iter);
- }
- foreach ($iter as $package) {
- if ($type != 'extension') {
- if (isset($package['uri'])) {
- if (isset($package['channel'])) {
- $this->_UrlOrChannelGroup($type,
- $package['name'],
- $group['name']);
- }
- } else {
- if (!isset($package['channel'])) {
- $this->_NoChannelGroup($type,
- $package['name'],
- $group['name']);
- }
- }
- }
- $this->{"_validate{$type}Dep"}($package, '<group name="' .
- $group['attribs']['name'] . '">');
- }
- }
- }
- }
- }
- }
- }
-
- function _validateCompatible()
- {
- $compat = $this->_packageInfo['compatible'];
- if (!isset($compat[0])) {
- $compat = array($compat);
- }
- $required = array('name', 'channel', 'min', 'max', '*exclude');
- foreach ($compat as $package) {
- $type = '<compatible>';
- if (is_array($package) && array_key_exists('name', $package)) {
- $type .= '<name>' . $package['name'] . '</name>';
- }
- $this->_stupidSchemaValidate($required, $package, $type);
- if (is_array($package) && array_key_exists('min', $package)) {
- if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/',
- $package['min'])) {
- $this->_invalidVersion(substr($type, 1) . '<min', $package['min']);
- }
- }
- if (is_array($package) && array_key_exists('max', $package)) {
- if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/',
- $package['max'])) {
- $this->_invalidVersion(substr($type, 1) . '<max', $package['max']);
- }
- }
- if (is_array($package) && array_key_exists('exclude', $package)) {
- if (!is_array($package['exclude'])) {
- $package['exclude'] = array($package['exclude']);
- }
- foreach ($package['exclude'] as $exclude) {
- if (!preg_match('/^\d+(?:\.\d+)*(?:[a-zA-Z]+\d*)?\\z/',
- $exclude)) {
- $this->_invalidVersion(substr($type, 1) . '<exclude', $exclude);
- }
- }
- }
- }
- }
-
- function _validateBundle($list)
- {
- if (!is_array($list) || !isset($list['bundledpackage'])) {
- return $this->_NoBundledPackages();
- }
- if (!is_array($list['bundledpackage']) || !isset($list['bundledpackage'][0])) {
- return $this->_AtLeast2BundledPackages();
- }
- foreach ($list['bundledpackage'] as $package) {
- if (!is_string($package)) {
- $this->_bundledPackagesMustBeFilename();
- }
- }
- }
-
- function _validateFilelist($list = false, $allowignore = false, $dirs = '')
- {
- $iscontents = false;
- if (!$list) {
- $iscontents = true;
- $list = $this->_packageInfo['contents'];
- if (isset($this->_packageInfo['bundle'])) {
- return $this->_validateBundle($list);
- }
- }
- if ($allowignore) {
- $struc = array(
- '*install->name->as',
- '*ignore->name'
- );
- } else {
- $struc = array(
- '*dir->name->?baseinstalldir',
- '*file->name->role->?baseinstalldir->?md5sum'
- );
- if (isset($list['dir']) && isset($list['file'])) {
- // stave off validation errors without requiring a set order.
- $_old = $list;
- if (isset($list['attribs'])) {
- $list = array('attribs' => $_old['attribs']);
- }
- $list['dir'] = $_old['dir'];
- $list['file'] = $_old['file'];
- }
- }
- if (!isset($list['attribs']) || !isset($list['attribs']['name'])) {
- $unknown = $allowignore ? '<filelist>' : '<dir name="*unknown*">';
- $dirname = $iscontents ? '<contents>' : $unknown;
- } else {
- $dirname = '<dir name="' . $list['attribs']['name'] . '">';
- if (preg_match('~/\.\.?(/|\\z)|^\.\.?/~',
- str_replace('\\', '/', $list['attribs']['name']))) {
- // file contains .. parent directory or . cur directory
- $this->_invalidDirName($list['attribs']['name']);
- }
- }
- $res = $this->_stupidSchemaValidate($struc, $list, $dirname);
- if ($allowignore && $res) {
- $ignored_or_installed = array();
- $this->_pf->getFilelist();
- $fcontents = $this->_pf->getContents();
- $filelist = array();
- if (!isset($fcontents['dir']['file'][0])) {
- $fcontents['dir']['file'] = array($fcontents['dir']['file']);
- }
- foreach ($fcontents['dir']['file'] as $file) {
- $filelist[$file['attribs']['name']] = true;
- }
- if (isset($list['install'])) {
- if (!isset($list['install'][0])) {
- $list['install'] = array($list['install']);
- }
- foreach ($list['install'] as $file) {
- if (!isset($filelist[$file['attribs']['name']])) {
- $this->_notInContents($file['attribs']['name'], 'install');
- continue;
- }
- if (array_key_exists($file['attribs']['name'], $ignored_or_installed)) {
- $this->_multipleInstallAs($file['attribs']['name']);
- }
- if (!isset($ignored_or_installed[$file['attribs']['name']])) {
- $ignored_or_installed[$file['attribs']['name']] = array();
- }
- $ignored_or_installed[$file['attribs']['name']][] = 1;
- if (preg_match('~/\.\.?(/|\\z)|^\.\.?/~',
- str_replace('\\', '/', $file['attribs']['as']))) {
- // file contains .. parent directory or . cur directory references
- $this->_invalidFileInstallAs($file['attribs']['name'],
- $file['attribs']['as']);
- }
- }
- }
- if (isset($list['ignore'])) {
- if (!isset($list['ignore'][0])) {
- $list['ignore'] = array($list['ignore']);
- }
- foreach ($list['ignore'] as $file) {
- if (!isset($filelist[$file['attribs']['name']])) {
- $this->_notInContents($file['attribs']['name'], 'ignore');
- continue;
- }
- if (array_key_exists($file['attribs']['name'], $ignored_or_installed)) {
- $this->_ignoreAndInstallAs($file['attribs']['name']);
- }
- }
- }
- }
- if (!$allowignore && isset($list['file'])) {
- if (is_string($list['file'])) {
- $this->_oldStyleFileNotAllowed();
- return false;
- }
- if (!isset($list['file'][0])) {
- // single file
- $list['file'] = array($list['file']);
- }
- foreach ($list['file'] as $i => $file)
- {
- if (isset($file['attribs']) && isset($file['attribs']['name'])) {
- if ($file['attribs']['name']{0} == '.' &&
- $file['attribs']['name']{1} == '/') {
- // name is something like "./doc/whatever.txt"
- $this->_invalidFileName($file['attribs']['name'], $dirname);
- }
- if (preg_match('~/\.\.?(/|\\z)|^\.\.?/~',
- str_replace('\\', '/', $file['attribs']['name']))) {
- // file contains .. parent directory or . cur directory
- $this->_invalidFileName($file['attribs']['name'], $dirname);
- }
- }
- if (isset($file['attribs']) && isset($file['attribs']['role'])) {
- if (!$this->_validateRole($file['attribs']['role'])) {
- if (isset($this->_packageInfo['usesrole'])) {
- $roles = $this->_packageInfo['usesrole'];
- if (!isset($roles[0])) {
- $roles = array($roles);
- }
- foreach ($roles as $role) {
- if ($role['role'] = $file['attribs']['role']) {
- $msg = 'This package contains role "%role%" and requires ' .
- 'package "%package%" to be used';
- if (isset($role['uri'])) {
- $params = array('role' => $role['role'],
- 'package' => $role['uri']);
- } else {
- $params = array('role' => $role['role'],
- 'package' => $this->_pf->_registry->
- parsedPackageNameToString(array('package' =>
- $role['package'], 'channel' => $role['channel']),
- true));
- }
- $this->_stack->push('_mustInstallRole', 'error', $params, $msg);
- }
- }
- }
- $this->_invalidFileRole($file['attribs']['name'],
- $dirname, $file['attribs']['role']);
- }
- }
- if (!isset($file['attribs'])) {
- continue;
- }
- $save = $file['attribs'];
- if ($dirs) {
- $save['name'] = $dirs . '/' . $save['name'];
- }
- unset($file['attribs']);
- if (count($file) && $this->_curState != PEAR_VALIDATE_DOWNLOADING) { // has tasks
- foreach ($file as $task => $value) {
- if ($tagClass = $this->_pf->getTask($task)) {
- if (!is_array($value) || !isset($value[0])) {
- $value = array($value);
- }
- foreach ($value as $v) {
- $ret = call_user_func(array($tagClass, 'validateXml'),
- $this->_pf, $v, $this->_pf->_config, $save);
- if (is_array($ret)) {
- $this->_invalidTask($task, $ret, isset($save['name']) ?
- $save['name'] : '');
- }
- }
- } else {
- if (isset($this->_packageInfo['usestask'])) {
- $roles = $this->_packageInfo['usestask'];
- if (!isset($roles[0])) {
- $roles = array($roles);
- }
- foreach ($roles as $role) {
- if ($role['task'] = $task) {
- $msg = 'This package contains task "%task%" and requires ' .
- 'package "%package%" to be used';
- if (isset($role['uri'])) {
- $params = array('task' => $role['task'],
- 'package' => $role['uri']);
- } else {
- $params = array('task' => $role['task'],
- 'package' => $this->_pf->_registry->
- parsedPackageNameToString(array('package' =>
- $role['package'], 'channel' => $role['channel']),
- true));
- }
- $this->_stack->push('_mustInstallTask', 'error',
- $params, $msg);
- }
- }
- }
- $this->_unknownTask($task, $save['name']);
- }
- }
- }
- }
- }
- if (isset($list['ignore'])) {
- if (!$allowignore) {
- $this->_ignoreNotAllowed('ignore');
- }
- }
- if (isset($list['install'])) {
- if (!$allowignore) {
- $this->_ignoreNotAllowed('install');
- }
- }
- if (isset($list['file'])) {
- if ($allowignore) {
- $this->_fileNotAllowed('file');
- }
- }
- if (isset($list['dir'])) {
- if ($allowignore) {
- $this->_fileNotAllowed('dir');
- } else {
- if (!isset($list['dir'][0])) {
- $list['dir'] = array($list['dir']);
- }
- foreach ($list['dir'] as $dir) {
- if (isset($dir['attribs']) && isset($dir['attribs']['name'])) {
- if ($dir['attribs']['name'] == '/' ||
- !isset($this->_packageInfo['contents']['dir']['dir'])) {
- // always use nothing if the filelist has already been flattened
- $newdirs = '';
- } elseif ($dirs == '') {
- $newdirs = $dir['attribs']['name'];
- } else {
- $newdirs = $dirs . '/' . $dir['attribs']['name'];
- }
- } else {
- $newdirs = $dirs;
- }
- $this->_validateFilelist($dir, $allowignore, $newdirs);
- }
- }
- }
- }
-
- function _validateRelease()
- {
- if (isset($this->_packageInfo['phprelease'])) {
- $release = 'phprelease';
- if (isset($this->_packageInfo['providesextension'])) {
- $this->_cannotProvideExtension($release);
- }
- if (isset($this->_packageInfo['srcpackage']) || isset($this->_packageInfo['srcuri'])) {
- $this->_cannotHaveSrcpackage($release);
- }
- $releases = $this->_packageInfo['phprelease'];
- if (!is_array($releases)) {
- return true;
- }
- if (!isset($releases[0])) {
- $releases = array($releases);
- }
- foreach ($releases as $rel) {
- $this->_stupidSchemaValidate(array(
- '*installconditions',
- '*filelist',
- ), $rel, '<phprelease>');
- }
- }
- foreach (array('', 'zend') as $prefix) {
- $releasetype = $prefix . 'extsrcrelease';
- if (isset($this->_packageInfo[$releasetype])) {
- $release = $releasetype;
- if (!isset($this->_packageInfo['providesextension'])) {
- $this->_mustProvideExtension($release);
- }
- if (isset($this->_packageInfo['srcpackage']) || isset($this->_packageInfo['srcuri'])) {
- $this->_cannotHaveSrcpackage($release);
- }
- $releases = $this->_packageInfo[$releasetype];
- if (!is_array($releases)) {
- return true;
- }
- if (!isset($releases[0])) {
- $releases = array($releases);
- }
- foreach ($releases as $rel) {
- $this->_stupidSchemaValidate(array(
- '*installconditions',
- '*configureoption->name->prompt->?default',
- '*binarypackage',
- '*filelist',
- ), $rel, '<' . $releasetype . '>');
- if (isset($rel['binarypackage'])) {
- if (!is_array($rel['binarypackage']) || !isset($rel['binarypackage'][0])) {
- $rel['binarypackage'] = array($rel['binarypackage']);
- }
- foreach ($rel['binarypackage'] as $bin) {
- if (!is_string($bin)) {
- $this->_binaryPackageMustBePackagename();
- }
- }
- }
- }
- }
- $releasetype = 'extbinrelease';
- if (isset($this->_packageInfo[$releasetype])) {
- $release = $releasetype;
- if (!isset($this->_packageInfo['providesextension'])) {
- $this->_mustProvideExtension($release);
- }
- if (isset($this->_packageInfo['channel']) &&
- !isset($this->_packageInfo['srcpackage'])) {
- $this->_mustSrcPackage($release);
- }
- if (isset($this->_packageInfo['uri']) && !isset($this->_packageInfo['srcuri'])) {
- $this->_mustSrcuri($release);
- }
- $releases = $this->_packageInfo[$releasetype];
- if (!is_array($releases)) {
- return true;
- }
- if (!isset($releases[0])) {
- $releases = array($releases);
- }
- foreach ($releases as $rel) {
- $this->_stupidSchemaValidate(array(
- '*installconditions',
- '*filelist',
- ), $rel, '<' . $releasetype . '>');
- }
- }
- }
- if (isset($this->_packageInfo['bundle'])) {
- $release = 'bundle';
- if (isset($this->_packageInfo['providesextension'])) {
- $this->_cannotProvideExtension($release);
- }
- if (isset($this->_packageInfo['srcpackage']) || isset($this->_packageInfo['srcuri'])) {
- $this->_cannotHaveSrcpackage($release);
- }
- $releases = $this->_packageInfo['bundle'];
- if (!is_array($releases) || !isset($releases[0])) {
- $releases = array($releases);
- }
- foreach ($releases as $rel) {
- $this->_stupidSchemaValidate(array(
- '*installconditions',
- '*filelist',
- ), $rel, '<bundle>');
- }
- }
- foreach ($releases as $rel) {
- if (is_array($rel) && array_key_exists('installconditions', $rel)) {
- $this->_validateInstallConditions($rel['installconditions'],
- "<$release><installconditions>");
- }
- if (is_array($rel) && array_key_exists('filelist', $rel)) {
- if ($rel['filelist']) {
-
- $this->_validateFilelist($rel['filelist'], true);
- }
- }
- }
- }
-
- /**
- * This is here to allow role extension through plugins
- * @param string
- */
- function _validateRole($role)
- {
- return in_array($role, PEAR_Installer_Role::getValidRoles($this->_pf->getPackageType()));
- }
-
- function _pearVersionTooLow($version)
- {
- $this->_stack->push(__FUNCTION__, 'error',
- array('version' => $version),
- 'This package.xml requires PEAR version %version% to parse properly, we are ' .
- 'version 1.9.4');
- }
-
- function _invalidTagOrder($oktags, $actual, $root)
- {
- $this->_stack->push(__FUNCTION__, 'error',
- array('oktags' => $oktags, 'actual' => $actual, 'root' => $root),
- 'Invalid tag order in %root%, found <%actual%> expected one of "%oktags%"');
- }
-
- function _ignoreNotAllowed($type)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('type' => $type),
- '<%type%> is not allowed inside global <contents>, only inside ' .
- '<phprelease>/<extbinrelease>/<zendextbinrelease>, use <dir> and <file> only');
- }
-
- function _fileNotAllowed($type)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('type' => $type),
- '<%type%> is not allowed inside release <filelist>, only inside ' .
- '<contents>, use <ignore> and <install> only');
- }
-
- function _oldStyleFileNotAllowed()
- {
- $this->_stack->push(__FUNCTION__, 'error', array(),
- 'Old-style <file>name</file> is not allowed. Use' .
- '<file name="name" role="role"/>');
- }
-
- function _tagMissingAttribute($tag, $attr, $context)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('tag' => $tag,
- 'attribute' => $attr, 'context' => $context),
- 'tag <%tag%> in context "%context%" has no attribute "%attribute%"');
- }
-
- function _tagHasNoAttribs($tag, $context)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('tag' => $tag,
- 'context' => $context),
- 'tag <%tag%> has no attributes in context "%context%"');
- }
-
- function _invalidInternalStructure()
- {
- $this->_stack->push(__FUNCTION__, 'exception', array(),
- 'internal array was not generated by compatible parser, or extreme parser error, cannot continue');
- }
-
- function _invalidFileRole($file, $dir, $role)
- {
- $this->_stack->push(__FUNCTION__, 'error', array(
- 'file' => $file, 'dir' => $dir, 'role' => $role,
- 'roles' => PEAR_Installer_Role::getValidRoles($this->_pf->getPackageType())),
- 'File "%file%" in directory "%dir%" has invalid role "%role%", should be one of %roles%');
- }
-
- function _invalidFileName($file, $dir)
- {
- $this->_stack->push(__FUNCTION__, 'error', array(
- 'file' => $file),
- 'File "%file%" in directory "%dir%" cannot begin with "./" or contain ".."');
- }
-
- function _invalidFileInstallAs($file, $as)
- {
- $this->_stack->push(__FUNCTION__, 'error', array(
- 'file' => $file, 'as' => $as),
- 'File "%file%" <install as="%as%"/> cannot contain "./" or contain ".."');
- }
-
- function _invalidDirName($dir)
- {
- $this->_stack->push(__FUNCTION__, 'error', array(
- 'dir' => $file),
- 'Directory "%dir%" cannot begin with "./" or contain ".."');
- }
-
- function _filelistCannotContainFile($filelist)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('tag' => $filelist),
- '<%tag%> can only contain <dir>, contains <file>. Use ' .
- '<dir name="/"> as the first dir element');
- }
-
- function _filelistMustContainDir($filelist)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('tag' => $filelist),
- '<%tag%> must contain <dir>. Use <dir name="/"> as the ' .
- 'first dir element');
- }
-
- function _tagCannotBeEmpty($tag)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('tag' => $tag),
- '<%tag%> cannot be empty (<%tag%/>)');
- }
-
- function _UrlOrChannel($type, $name)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('type' => $type,
- 'name' => $name),
- 'Required dependency <%type%> "%name%" can have either url OR ' .
- 'channel attributes, and not both');
- }
-
- function _NoChannel($type, $name)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('type' => $type,
- 'name' => $name),
- 'Required dependency <%type%> "%name%" must have either url OR ' .
- 'channel attributes');
- }
-
- function _UrlOrChannelGroup($type, $name, $group)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('type' => $type,
- 'name' => $name, 'group' => $group),
- 'Group "%group%" dependency <%type%> "%name%" can have either url OR ' .
- 'channel attributes, and not both');
- }
-
- function _NoChannelGroup($type, $name, $group)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('type' => $type,
- 'name' => $name, 'group' => $group),
- 'Group "%group%" dependency <%type%> "%name%" must have either url OR ' .
- 'channel attributes');
- }
-
- function _unknownChannel($channel)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('channel' => $channel),
- 'Unknown channel "%channel%"');
- }
-
- function _noPackageVersion()
- {
- $this->_stack->push(__FUNCTION__, 'error', array(),
- 'package.xml <package> tag has no version attribute, or version is not 2.0');
- }
-
- function _NoBundledPackages()
- {
- $this->_stack->push(__FUNCTION__, 'error', array(),
- 'No <bundledpackage> tag was found in <contents>, required for bundle packages');
- }
-
- function _AtLeast2BundledPackages()
- {
- $this->_stack->push(__FUNCTION__, 'error', array(),
- 'At least 2 packages must be bundled in a bundle package');
- }
-
- function _ChannelOrUri($name)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('name' => $name),
- 'Bundled package "%name%" can have either a uri or a channel, not both');
- }
-
- function _noChildTag($child, $tag)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('child' => $child, 'tag' => $tag),
- 'Tag <%tag%> is missing child tag <%child%>');
- }
-
- function _invalidVersion($type, $value)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('type' => $type, 'value' => $value),
- 'Version type <%type%> is not a valid version (%value%)');
- }
-
- function _invalidState($type, $value)
- {
- $states = array('stable', 'beta', 'alpha', 'devel');
- if ($type != 'api') {
- $states[] = 'snapshot';
- }
- if (strtolower($value) == 'rc') {
- $this->_stack->push(__FUNCTION__, 'error',
- array('version' => $this->_packageInfo['version']['release']),
- 'RC is not a state, it is a version postfix, try %version%RC1, stability beta');
- }
- $this->_stack->push(__FUNCTION__, 'error', array('type' => $type, 'value' => $value,
- 'types' => $states),
- 'Stability type <%type%> is not a valid stability (%value%), must be one of ' .
- '%types%');
- }
-
- function _invalidTask($task, $ret, $file)
- {
- switch ($ret[0]) {
- case PEAR_TASK_ERROR_MISSING_ATTRIB :
- $info = array('attrib' => $ret[1], 'task' => $task, 'file' => $file);
- $msg = 'task <%task%> is missing attribute "%attrib%" in file %file%';
- break;
- case PEAR_TASK_ERROR_NOATTRIBS :
- $info = array('task' => $task, 'file' => $file);
- $msg = 'task <%task%> has no attributes in file %file%';
- break;
- case PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE :
- $info = array('attrib' => $ret[1], 'values' => $ret[3],
- 'was' => $ret[2], 'task' => $task, 'file' => $file);
- $msg = 'task <%task%> attribute "%attrib%" has the wrong value "%was%" '.
- 'in file %file%, expecting one of "%values%"';
- break;
- case PEAR_TASK_ERROR_INVALID :
- $info = array('reason' => $ret[1], 'task' => $task, 'file' => $file);
- $msg = 'task <%task%> in file %file% is invalid because of "%reason%"';
- break;
- }
- $this->_stack->push(__FUNCTION__, 'error', $info, $msg);
- }
-
- function _unknownTask($task, $file)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('task' => $task, 'file' => $file),
- 'Unknown task "%task%" passed in file <file name="%file%">');
- }
-
- function _subpackageCannotProvideExtension($name)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('name' => $name),
- 'Subpackage dependency "%name%" cannot use <providesextension>, ' .
- 'only package dependencies can use this tag');
- }
-
- function _subpackagesCannotConflict($name)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('name' => $name),
- 'Subpackage dependency "%name%" cannot use <conflicts/>, ' .
- 'only package dependencies can use this tag');
- }
-
- function _cannotProvideExtension($release)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('release' => $release),
- '<%release%> packages cannot use <providesextension>, only extbinrelease, extsrcrelease, zendextsrcrelease, and zendextbinrelease can provide a PHP extension');
- }
-
- function _mustProvideExtension($release)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('release' => $release),
- '<%release%> packages must use <providesextension> to indicate which PHP extension is provided');
- }
-
- function _cannotHaveSrcpackage($release)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('release' => $release),
- '<%release%> packages cannot specify a source code package, only extension binaries may use the <srcpackage> tag');
- }
-
- function _mustSrcPackage($release)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('release' => $release),
- '<extbinrelease>/<zendextbinrelease> packages must specify a source code package with <srcpackage>');
- }
-
- function _mustSrcuri($release)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('release' => $release),
- '<extbinrelease>/<zendextbinrelease> packages must specify a source code package with <srcuri>');
- }
-
- function _uriDepsCannotHaveVersioning($type)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('type' => $type),
- '%type%: dependencies with a <uri> tag cannot have any versioning information');
- }
-
- function _conflictingDepsCannotHaveVersioning($type)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('type' => $type),
- '%type%: conflicting dependencies cannot have versioning info, use <exclude> to ' .
- 'exclude specific versions of a dependency');
- }
-
- function _DepchannelCannotBeUri($type)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('type' => $type),
- '%type%: channel cannot be __uri, this is a pseudo-channel reserved for uri ' .
- 'dependencies only');
- }
-
- function _bundledPackagesMustBeFilename()
- {
- $this->_stack->push(__FUNCTION__, 'error', array(),
- '<bundledpackage> tags must contain only the filename of a package release ' .
- 'in the bundle');
- }
-
- function _binaryPackageMustBePackagename()
- {
- $this->_stack->push(__FUNCTION__, 'error', array(),
- '<binarypackage> tags must contain the name of a package that is ' .
- 'a compiled version of this extsrc/zendextsrc package');
- }
-
- function _fileNotFound($file)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('file' => $file),
- 'File "%file%" in package.xml does not exist');
- }
-
- function _notInContents($file, $tag)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('file' => $file, 'tag' => $tag),
- '<%tag% name="%file%"> is invalid, file is not in <contents>');
- }
-
- function _cannotValidateNoPathSet()
- {
- $this->_stack->push(__FUNCTION__, 'error', array(),
- 'Cannot validate files, no path to package file is set (use setPackageFile())');
- }
-
- function _usesroletaskMustHaveChannelOrUri($role, $tag)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('role' => $role, 'tag' => $tag),
- '<%tag%> for role "%role%" must contain either <uri>, or <channel> and <package>');
- }
-
- function _usesroletaskMustHavePackage($role, $tag)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('role' => $role, 'tag' => $tag),
- '<%tag%> for role "%role%" must contain <package>');
- }
-
- function _usesroletaskMustHaveRoleTask($tag, $type)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('tag' => $tag, 'type' => $type),
- '<%tag%> must contain <%type%> defining the %type% to be used');
- }
-
- function _cannotConflictWithAllOs($type)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('tag' => $tag),
- '%tag% cannot conflict with all OSes');
- }
-
- function _invalidDepGroupName($name)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('name' => $name),
- 'Invalid dependency group name "%name%"');
- }
-
- function _multipleToplevelDirNotAllowed()
- {
- $this->_stack->push(__FUNCTION__, 'error', array(),
- 'Multiple top-level <dir> tags are not allowed. Enclose them ' .
- 'in a <dir name="/">');
- }
-
- function _multipleInstallAs($file)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('file' => $file),
- 'Only one <install> tag is allowed for file "%file%"');
- }
-
- function _ignoreAndInstallAs($file)
- {
- $this->_stack->push(__FUNCTION__, 'error', array('file' => $file),
- 'Cannot have both <ignore> and <install> tags for file "%file%"');
- }
-
- function _analyzeBundledPackages()
- {
- if (!$this->_isValid) {
- return false;
- }
- if (!$this->_pf->getPackageType() == 'bundle') {
- return false;
- }
- if (!isset($this->_pf->_packageFile)) {
- return false;
- }
- $dir_prefix = dirname($this->_pf->_packageFile);
- $common = new PEAR_Common;
- $log = isset($this->_pf->_logger) ? array(&$this->_pf->_logger, 'log') :
- array($common, 'log');
- $info = $this->_pf->getContents();
- $info = $info['bundledpackage'];
- if (!is_array($info)) {
- $info = array($info);
- }
- $pkg = &new PEAR_PackageFile($this->_pf->_config);
- foreach ($info as $package) {
- if (!file_exists($dir_prefix . DIRECTORY_SEPARATOR . $package)) {
- $this->_fileNotFound($dir_prefix . DIRECTORY_SEPARATOR . $package);
- $this->_isValid = 0;
- continue;
- }
- call_user_func_array($log, array(1, "Analyzing bundled package $package"));
- PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
- $ret = $pkg->fromAnyFile($dir_prefix . DIRECTORY_SEPARATOR . $package,
- PEAR_VALIDATE_NORMAL);
- PEAR::popErrorHandling();
- if (PEAR::isError($ret)) {
- call_user_func_array($log, array(0, "ERROR: package $package is not a valid " .
- 'package'));
- $inf = $ret->getUserInfo();
- if (is_array($inf)) {
- foreach ($inf as $err) {
- call_user_func_array($log, array(1, $err['message']));
- }
- }
- return false;
- }
- }
- return true;
- }
-
- function _analyzePhpFiles()
- {
- if (!$this->_isValid) {
- return false;
- }
- if (!isset($this->_pf->_packageFile)) {
- $this->_cannotValidateNoPathSet();
- return false;
- }
- $dir_prefix = dirname($this->_pf->_packageFile);
- $common = new PEAR_Common;
- $log = isset($this->_pf->_logger) ? array(&$this->_pf->_logger, 'log') :
- array(&$common, 'log');
- $info = $this->_pf->getContents();
- if (!$info || !isset($info['dir']['file'])) {
- $this->_tagCannotBeEmpty('contents><dir');
- return false;
- }
- $info = $info['dir']['file'];
- if (isset($info['attribs'])) {
- $info = array($info);
- }
- $provides = array();
- foreach ($info as $fa) {
- $fa = $fa['attribs'];
- $file = $fa['name'];
- if (!file_exists($dir_prefix . DIRECTORY_SEPARATOR . $file)) {
- $this->_fileNotFound($dir_prefix . DIRECTORY_SEPARATOR . $file);
- $this->_isValid = 0;
- continue;
- }
- if (in_array($fa['role'], PEAR_Installer_Role::getPhpRoles()) && $dir_prefix) {
- call_user_func_array($log, array(1, "Analyzing $file"));
- $srcinfo = $this->analyzeSourceCode($dir_prefix . DIRECTORY_SEPARATOR . $file);
- if ($srcinfo) {
- $provides = array_merge($provides, $this->_buildProvidesArray($srcinfo));
- }
- }
- }
- $this->_packageName = $pn = $this->_pf->getPackage();
- $pnl = strlen($pn);
- foreach ($provides as $key => $what) {
- if (isset($what['explicit']) || !$what) {
- // skip conformance checks if the provides entry is
- // specified in the package.xml file
- continue;
- }
- extract($what);
- if ($type == 'class') {
- if (!strncasecmp($name, $pn, $pnl)) {
- continue;
- }
- $this->_stack->push(__FUNCTION__, 'warning',
- array('file' => $file, 'type' => $type, 'name' => $name, 'package' => $pn),
- 'in %file%: %type% "%name%" not prefixed with package name "%package%"');
- } elseif ($type == 'function') {
- if (strstr($name, '::') || !strncasecmp($name, $pn, $pnl)) {
- continue;
- }
- $this->_stack->push(__FUNCTION__, 'warning',
- array('file' => $file, 'type' => $type, 'name' => $name, 'package' => $pn),
- 'in %file%: %type% "%name%" not prefixed with package name "%package%"');
- }
- }
- return $this->_isValid;
- }
-
- /**
- * Analyze the source code of the given PHP file
- *
- * @param string Filename of the PHP file
- * @param boolean whether to analyze $file as the file contents
- * @return mixed
- */
- function analyzeSourceCode($file, $string = false)
- {
- if (!function_exists("token_get_all")) {
- $this->_stack->push(__FUNCTION__, 'error', array('file' => $file),
- 'Parser error: token_get_all() function must exist to analyze source code, PHP may have been compiled with --disable-tokenizer');
- return false;
- }
-
- if (!defined('T_DOC_COMMENT')) {
- define('T_DOC_COMMENT', T_COMMENT);
- }
-
- if (!defined('T_INTERFACE')) {
- define('T_INTERFACE', -1);
- }
-
- if (!defined('T_IMPLEMENTS')) {
- define('T_IMPLEMENTS', -1);
- }
-
- if ($string) {
- $contents = $file;
- } else {
- if (!$fp = @fopen($file, "r")) {
- return false;
- }
- fclose($fp);
- $contents = file_get_contents($file);
- }
-
- // Silence this function so we can catch PHP Warnings and show our own custom message
- $tokens = @token_get_all($contents);
- if (isset($php_errormsg)) {
- if (isset($this->_stack)) {
- $pn = $this->_pf->getPackage();
- $this->_stack->push(__FUNCTION__, 'warning',
- array('file' => $file, 'package' => $pn),
- 'in %file%: Could not process file for unkown reasons,' .
- ' possibly a PHP parse error in %file% from %package%');
- }
- }
-/*
- for ($i = 0; $i < sizeof($tokens); $i++) {
- @list($token, $data) = $tokens[$i];
- if (is_string($token)) {
- var_dump($token);
- } else {
- print token_name($token) . ' ';
- var_dump(rtrim($data));
- }
- }
-*/
- $look_for = 0;
- $paren_level = 0;
- $bracket_level = 0;
- $brace_level = 0;
- $lastphpdoc = '';
- $current_class = '';
- $current_interface = '';
- $current_class_level = -1;
- $current_function = '';
- $current_function_level = -1;
- $declared_classes = array();
- $declared_interfaces = array();
- $declared_functions = array();
- $declared_methods = array();
- $used_classes = array();
- $used_functions = array();
- $extends = array();
- $implements = array();
- $nodeps = array();
- $inquote = false;
- $interface = false;
- for ($i = 0; $i < sizeof($tokens); $i++) {
- if (is_array($tokens[$i])) {
- list($token, $data) = $tokens[$i];
- } else {
- $token = $tokens[$i];
- $data = '';
- }
-
- if ($inquote) {
- if ($token != '"' && $token != T_END_HEREDOC) {
- continue;
- } else {
- $inquote = false;
- continue;
- }
- }
-
- switch ($token) {
- case T_WHITESPACE :
- continue;
- case ';':
- if ($interface) {
- $current_function = '';
- $current_function_level = -1;
- }
- break;
- case '"':
- case T_START_HEREDOC:
- $inquote = true;
- break;
- case T_CURLY_OPEN:
- case T_DOLLAR_OPEN_CURLY_BRACES:
- case '{': $brace_level++; continue 2;
- case '}':
- $brace_level--;
- if ($current_class_level == $brace_level) {
- $current_class = '';
- $current_class_level = -1;
- }
- if ($current_function_level == $brace_level) {
- $current_function = '';
- $current_function_level = -1;
- }
- continue 2;
- case '[': $bracket_level++; continue 2;
- case ']': $bracket_level--; continue 2;
- case '(': $paren_level++; continue 2;
- case ')': $paren_level--; continue 2;
- case T_INTERFACE:
- $interface = true;
- case T_CLASS:
- if (($current_class_level != -1) || ($current_function_level != -1)) {
- if (isset($this->_stack)) {
- $this->_stack->push(__FUNCTION__, 'error', array('file' => $file),
- 'Parser error: invalid PHP found in file "%file%"');
- } else {
- PEAR::raiseError("Parser error: invalid PHP found in file \"$file\"",
- PEAR_COMMON_ERROR_INVALIDPHP);
- }
-
- return false;
- }
- case T_FUNCTION:
- case T_NEW:
- case T_EXTENDS:
- case T_IMPLEMENTS:
- $look_for = $token;
- continue 2;
- case T_STRING:
- if (version_compare(zend_version(), '2.0', '<')) {
- if (in_array(strtolower($data),
- array('public', 'private', 'protected', 'abstract',
- 'interface', 'implements', 'throw')
- )
- ) {
- if (isset($this->_stack)) {
- $this->_stack->push(__FUNCTION__, 'warning', array(
- 'file' => $file),
- 'Error, PHP5 token encountered in %file%,' .
- ' analysis should be in PHP5');
- } else {
- PEAR::raiseError('Error: PHP5 token encountered in ' . $file .
- 'packaging should be done in PHP 5');
- return false;
- }
- }
- }
-
- if ($look_for == T_CLASS) {
- $current_class = $data;
- $current_class_level = $brace_level;
- $declared_classes[] = $current_class;
- } elseif ($look_for == T_INTERFACE) {
- $current_interface = $data;
- $current_class_level = $brace_level;
- $declared_interfaces[] = $current_interface;
- } elseif ($look_for == T_IMPLEMENTS) {
- $implements[$current_class] = $data;
- } elseif ($look_for == T_EXTENDS) {
- $extends[$current_class] = $data;
- } elseif ($look_for == T_FUNCTION) {
- if ($current_class) {
- $current_function = "$current_class::$data";
- $declared_methods[$current_class][] = $data;
- } elseif ($current_interface) {
- $current_function = "$current_interface::$data";
- $declared_methods[$current_interface][] = $data;
- } else {
- $current_function = $data;
- $declared_functions[] = $current_function;
- }
-
- $current_function_level = $brace_level;
- $m = array();
- } elseif ($look_for == T_NEW) {
- $used_classes[$data] = true;
- }
-
- $look_for = 0;
- continue 2;
- case T_VARIABLE:
- $look_for = 0;
- continue 2;
- case T_DOC_COMMENT:
- case T_COMMENT:
- if (preg_match('!^/\*\*\s!', $data)) {
- $lastphpdoc = $data;
- if (preg_match_all('/@nodep\s+(\S+)/', $lastphpdoc, $m)) {
- $nodeps = array_merge($nodeps, $m[1]);
- }
- }
- continue 2;
- case T_DOUBLE_COLON:
- $token = $tokens[$i - 1][0];
- if (!($token == T_WHITESPACE || $token == T_STRING || $token == T_STATIC)) {
- if (isset($this->_stack)) {
- $this->_stack->push(__FUNCTION__, 'warning', array('file' => $file),
- 'Parser error: invalid PHP found in file "%file%"');
- } else {
- PEAR::raiseError("Parser error: invalid PHP found in file \"$file\"",
- PEAR_COMMON_ERROR_INVALIDPHP);
- }
-
- return false;
- }
-
- $class = $tokens[$i - 1][1];
- if (strtolower($class) != 'parent') {
- $used_classes[$class] = true;
- }
-
- continue 2;
- }
- }
-
- return array(
- "source_file" => $file,
- "declared_classes" => $declared_classes,
- "declared_interfaces" => $declared_interfaces,
- "declared_methods" => $declared_methods,
- "declared_functions" => $declared_functions,
- "used_classes" => array_diff(array_keys($used_classes), $nodeps),
- "inheritance" => $extends,
- "implements" => $implements,
- );
- }
-
- /**
- * Build a "provides" array from data returned by
- * analyzeSourceCode(). The format of the built array is like
- * this:
- *
- * array(
- * 'class;MyClass' => 'array('type' => 'class', 'name' => 'MyClass'),
- * ...
- * )
- *
- *
- * @param array $srcinfo array with information about a source file
- * as returned by the analyzeSourceCode() method.
- *
- * @return void
- *
- * @access private
- *
- */
- function _buildProvidesArray($srcinfo)
- {
- if (!$this->_isValid) {
- return array();
- }
-
- $providesret = array();
- $file = basename($srcinfo['source_file']);
- $pn = isset($this->_pf) ? $this->_pf->getPackage() : '';
- $pnl = strlen($pn);
- foreach ($srcinfo['declared_classes'] as $class) {
- $key = "class;$class";
- if (isset($providesret[$key])) {
- continue;
- }
-
- $providesret[$key] =
- array('file'=> $file, 'type' => 'class', 'name' => $class);
- if (isset($srcinfo['inheritance'][$class])) {
- $providesret[$key]['extends'] =
- $srcinfo['inheritance'][$class];
- }
- }
-
- foreach ($srcinfo['declared_methods'] as $class => $methods) {
- foreach ($methods as $method) {
- $function = "$class::$method";
- $key = "function;$function";
- if ($method{0} == '_' || !strcasecmp($method, $class) ||
- isset($providesret[$key])) {
- continue;
- }
-
- $providesret[$key] =
- array('file'=> $file, 'type' => 'function', 'name' => $function);
- }
- }
-
- foreach ($srcinfo['declared_functions'] as $function) {
- $key = "function;$function";
- if ($function{0} == '_' || isset($providesret[$key])) {
- continue;
- }
-
- if (!strstr($function, '::') && strncasecmp($function, $pn, $pnl)) {
- $warnings[] = "in1 " . $file . ": function \"$function\" not prefixed with package name \"$pn\"";
- }
-
- $providesret[$key] =
- array('file'=> $file, 'type' => 'function', 'name' => $function);
- }
-
- return $providesret;
- }
-} \ No newline at end of file
diff --git a/3rdparty/PEAR/PackageFile/v2/rw.php b/3rdparty/PEAR/PackageFile/v2/rw.php
deleted file mode 100644
index 58f76c55947..00000000000
--- a/3rdparty/PEAR/PackageFile/v2/rw.php
+++ /dev/null
@@ -1,1604 +0,0 @@
-<?php
-/**
- * PEAR_PackageFile_v2, package.xml version 2.0, read/write version
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: rw.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a8
- */
-/**
- * For base class
- */
-require_once 'PEAR/PackageFile/v2.php';
-/**
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a8
- */
-class PEAR_PackageFile_v2_rw extends PEAR_PackageFile_v2
-{
- /**
- * @param string Extension name
- * @return bool success of operation
- */
- function setProvidesExtension($extension)
- {
- if (in_array($this->getPackageType(),
- array('extsrc', 'extbin', 'zendextsrc', 'zendextbin'))) {
- if (!isset($this->_packageInfo['providesextension'])) {
- // ensure that the channel tag is set up in the right location
- $this->_packageInfo = $this->_insertBefore($this->_packageInfo,
- array('usesrole', 'usestask', 'srcpackage', 'srcuri', 'phprelease',
- 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease',
- 'bundle', 'changelog'),
- $extension, 'providesextension');
- }
- $this->_packageInfo['providesextension'] = $extension;
- return true;
- }
- return false;
- }
-
- function setPackage($package)
- {
- $this->_isValid = 0;
- if (!isset($this->_packageInfo['attribs'])) {
- $this->_packageInfo = array_merge(array('attribs' => array(
- 'version' => '2.0',
- 'xmlns' => 'http://pear.php.net/dtd/package-2.0',
- 'xmlns:tasks' => 'http://pear.php.net/dtd/tasks-1.0',
- 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
- 'xsi:schemaLocation' => 'http://pear.php.net/dtd/tasks-1.0
- http://pear.php.net/dtd/tasks-1.0.xsd
- http://pear.php.net/dtd/package-2.0
- http://pear.php.net/dtd/package-2.0.xsd',
- )), $this->_packageInfo);
- }
- if (!isset($this->_packageInfo['name'])) {
- return $this->_packageInfo = array_merge(array('name' => $package),
- $this->_packageInfo);
- }
- $this->_packageInfo['name'] = $package;
- }
-
- /**
- * set this as a package.xml version 2.1
- * @access private
- */
- function _setPackageVersion2_1()
- {
- $info = array(
- 'version' => '2.1',
- 'xmlns' => 'http://pear.php.net/dtd/package-2.1',
- 'xmlns:tasks' => 'http://pear.php.net/dtd/tasks-1.0',
- 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
- 'xsi:schemaLocation' => 'http://pear.php.net/dtd/tasks-1.0
- http://pear.php.net/dtd/tasks-1.0.xsd
- http://pear.php.net/dtd/package-2.1
- http://pear.php.net/dtd/package-2.1.xsd',
- );
- if (!isset($this->_packageInfo['attribs'])) {
- $this->_packageInfo = array_merge(array('attribs' => $info), $this->_packageInfo);
- } else {
- $this->_packageInfo['attribs'] = $info;
- }
- }
-
- function setUri($uri)
- {
- unset($this->_packageInfo['channel']);
- $this->_isValid = 0;
- if (!isset($this->_packageInfo['uri'])) {
- // ensure that the uri tag is set up in the right location
- $this->_packageInfo = $this->_insertBefore($this->_packageInfo,
- array('extends', 'summary', 'description', 'lead',
- 'developer', 'contributor', 'helper', 'date', 'time', 'version',
- 'stability', 'license', 'notes', 'contents', 'compatible',
- 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri',
- 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease',
- 'extbinrelease', 'bundle', 'changelog'), $uri, 'uri');
- }
- $this->_packageInfo['uri'] = $uri;
- }
-
- function setChannel($channel)
- {
- unset($this->_packageInfo['uri']);
- $this->_isValid = 0;
- if (!isset($this->_packageInfo['channel'])) {
- // ensure that the channel tag is set up in the right location
- $this->_packageInfo = $this->_insertBefore($this->_packageInfo,
- array('extends', 'summary', 'description', 'lead',
- 'developer', 'contributor', 'helper', 'date', 'time', 'version',
- 'stability', 'license', 'notes', 'contents', 'compatible',
- 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri',
- 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease',
- 'extbinrelease', 'bundle', 'changelog'), $channel, 'channel');
- }
- $this->_packageInfo['channel'] = $channel;
- }
-
- function setExtends($extends)
- {
- $this->_isValid = 0;
- if (!isset($this->_packageInfo['extends'])) {
- // ensure that the extends tag is set up in the right location
- $this->_packageInfo = $this->_insertBefore($this->_packageInfo,
- array('summary', 'description', 'lead',
- 'developer', 'contributor', 'helper', 'date', 'time', 'version',
- 'stability', 'license', 'notes', 'contents', 'compatible',
- 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri',
- 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease',
- 'extbinrelease', 'bundle', 'changelog'), $extends, 'extends');
- }
- $this->_packageInfo['extends'] = $extends;
- }
-
- function setSummary($summary)
- {
- $this->_isValid = 0;
- if (!isset($this->_packageInfo['summary'])) {
- // ensure that the summary tag is set up in the right location
- $this->_packageInfo = $this->_insertBefore($this->_packageInfo,
- array('description', 'lead',
- 'developer', 'contributor', 'helper', 'date', 'time', 'version',
- 'stability', 'license', 'notes', 'contents', 'compatible',
- 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri',
- 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease',
- 'extbinrelease', 'bundle', 'changelog'), $summary, 'summary');
- }
- $this->_packageInfo['summary'] = $summary;
- }
-
- function setDescription($desc)
- {
- $this->_isValid = 0;
- if (!isset($this->_packageInfo['description'])) {
- // ensure that the description tag is set up in the right location
- $this->_packageInfo = $this->_insertBefore($this->_packageInfo,
- array('lead',
- 'developer', 'contributor', 'helper', 'date', 'time', 'version',
- 'stability', 'license', 'notes', 'contents', 'compatible',
- 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri',
- 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease',
- 'extbinrelease', 'bundle', 'changelog'), $desc, 'description');
- }
- $this->_packageInfo['description'] = $desc;
- }
-
- /**
- * Adds a new maintainer - no checking of duplicates is performed, use
- * updatemaintainer for that purpose.
- */
- function addMaintainer($role, $handle, $name, $email, $active = 'yes')
- {
- if (!in_array($role, array('lead', 'developer', 'contributor', 'helper'))) {
- return false;
- }
- if (isset($this->_packageInfo[$role])) {
- if (!isset($this->_packageInfo[$role][0])) {
- $this->_packageInfo[$role] = array($this->_packageInfo[$role]);
- }
- $this->_packageInfo[$role][] =
- array(
- 'name' => $name,
- 'user' => $handle,
- 'email' => $email,
- 'active' => $active,
- );
- } else {
- $testarr = array('lead',
- 'developer', 'contributor', 'helper', 'date', 'time', 'version',
- 'stability', 'license', 'notes', 'contents', 'compatible',
- 'dependencies', 'providesextension', 'usesrole', 'usestask',
- 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease',
- 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog');
- foreach (array('lead', 'developer', 'contributor', 'helper') as $testrole) {
- array_shift($testarr);
- if ($role == $testrole) {
- break;
- }
- }
- if (!isset($this->_packageInfo[$role])) {
- // ensure that the extends tag is set up in the right location
- $this->_packageInfo = $this->_insertBefore($this->_packageInfo, $testarr,
- array(), $role);
- }
- $this->_packageInfo[$role] =
- array(
- 'name' => $name,
- 'user' => $handle,
- 'email' => $email,
- 'active' => $active,
- );
- }
- $this->_isValid = 0;
- }
-
- function updateMaintainer($newrole, $handle, $name, $email, $active = 'yes')
- {
- $found = false;
- foreach (array('lead', 'developer', 'contributor', 'helper') as $role) {
- if (!isset($this->_packageInfo[$role])) {
- continue;
- }
- $info = $this->_packageInfo[$role];
- if (!isset($info[0])) {
- if ($info['user'] == $handle) {
- $found = true;
- break;
- }
- }
- foreach ($info as $i => $maintainer) {
- if ($maintainer['user'] == $handle) {
- $found = $i;
- break 2;
- }
- }
- }
- if ($found === false) {
- return $this->addMaintainer($newrole, $handle, $name, $email, $active);
- }
- if ($found !== false) {
- if ($found === true) {
- unset($this->_packageInfo[$role]);
- } else {
- unset($this->_packageInfo[$role][$found]);
- $this->_packageInfo[$role] = array_values($this->_packageInfo[$role]);
- }
- }
- $this->addMaintainer($newrole, $handle, $name, $email, $active);
- $this->_isValid = 0;
- }
-
- function deleteMaintainer($handle)
- {
- $found = false;
- foreach (array('lead', 'developer', 'contributor', 'helper') as $role) {
- if (!isset($this->_packageInfo[$role])) {
- continue;
- }
- if (!isset($this->_packageInfo[$role][0])) {
- $this->_packageInfo[$role] = array($this->_packageInfo[$role]);
- }
- foreach ($this->_packageInfo[$role] as $i => $maintainer) {
- if ($maintainer['user'] == $handle) {
- $found = $i;
- break;
- }
- }
- if ($found !== false) {
- unset($this->_packageInfo[$role][$found]);
- if (!count($this->_packageInfo[$role]) && $role == 'lead') {
- $this->_isValid = 0;
- }
- if (!count($this->_packageInfo[$role])) {
- unset($this->_packageInfo[$role]);
- return true;
- }
- $this->_packageInfo[$role] =
- array_values($this->_packageInfo[$role]);
- if (count($this->_packageInfo[$role]) == 1) {
- $this->_packageInfo[$role] = $this->_packageInfo[$role][0];
- }
- return true;
- }
- if (count($this->_packageInfo[$role]) == 1) {
- $this->_packageInfo[$role] = $this->_packageInfo[$role][0];
- }
- }
- return false;
- }
-
- function setReleaseVersion($version)
- {
- if (isset($this->_packageInfo['version']) &&
- isset($this->_packageInfo['version']['release'])) {
- unset($this->_packageInfo['version']['release']);
- }
- $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $version, array(
- 'version' => array('stability', 'license', 'notes', 'contents', 'compatible',
- 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri',
- 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease',
- 'extbinrelease', 'bundle', 'changelog'),
- 'release' => array('api')));
- $this->_isValid = 0;
- }
-
- function setAPIVersion($version)
- {
- if (isset($this->_packageInfo['version']) &&
- isset($this->_packageInfo['version']['api'])) {
- unset($this->_packageInfo['version']['api']);
- }
- $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $version, array(
- 'version' => array('stability', 'license', 'notes', 'contents', 'compatible',
- 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri',
- 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease',
- 'extbinrelease', 'bundle', 'changelog'),
- 'api' => array()));
- $this->_isValid = 0;
- }
-
- /**
- * snapshot|devel|alpha|beta|stable
- */
- function setReleaseStability($state)
- {
- if (isset($this->_packageInfo['stability']) &&
- isset($this->_packageInfo['stability']['release'])) {
- unset($this->_packageInfo['stability']['release']);
- }
- $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $state, array(
- 'stability' => array('license', 'notes', 'contents', 'compatible',
- 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri',
- 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease',
- 'extbinrelease', 'bundle', 'changelog'),
- 'release' => array('api')));
- $this->_isValid = 0;
- }
-
- /**
- * @param devel|alpha|beta|stable
- */
- function setAPIStability($state)
- {
- if (isset($this->_packageInfo['stability']) &&
- isset($this->_packageInfo['stability']['api'])) {
- unset($this->_packageInfo['stability']['api']);
- }
- $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $state, array(
- 'stability' => array('license', 'notes', 'contents', 'compatible',
- 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri',
- 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease',
- 'extbinrelease', 'bundle', 'changelog'),
- 'api' => array()));
- $this->_isValid = 0;
- }
-
- function setLicense($license, $uri = false, $filesource = false)
- {
- if (!isset($this->_packageInfo['license'])) {
- // ensure that the license tag is set up in the right location
- $this->_packageInfo = $this->_insertBefore($this->_packageInfo,
- array('notes', 'contents', 'compatible',
- 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri',
- 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease',
- 'extbinrelease', 'bundle', 'changelog'), 0, 'license');
- }
- if ($uri || $filesource) {
- $attribs = array();
- if ($uri) {
- $attribs['uri'] = $uri;
- }
- $uri = true; // for test below
- if ($filesource) {
- $attribs['filesource'] = $filesource;
- }
- }
- $license = $uri ? array('attribs' => $attribs, '_content' => $license) : $license;
- $this->_packageInfo['license'] = $license;
- $this->_isValid = 0;
- }
-
- function setNotes($notes)
- {
- $this->_isValid = 0;
- if (!isset($this->_packageInfo['notes'])) {
- // ensure that the notes tag is set up in the right location
- $this->_packageInfo = $this->_insertBefore($this->_packageInfo,
- array('contents', 'compatible',
- 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri',
- 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease',
- 'extbinrelease', 'bundle', 'changelog'), $notes, 'notes');
- }
- $this->_packageInfo['notes'] = $notes;
- }
-
- /**
- * This is only used at install-time, after all serialization
- * is over.
- * @param string file name
- * @param string installed path
- */
- function setInstalledAs($file, $path)
- {
- if ($path) {
- return $this->_packageInfo['filelist'][$file]['installed_as'] = $path;
- }
- unset($this->_packageInfo['filelist'][$file]['installed_as']);
- }
-
- /**
- * This is only used at install-time, after all serialization
- * is over.
- */
- function installedFile($file, $atts)
- {
- if (isset($this->_packageInfo['filelist'][$file])) {
- $this->_packageInfo['filelist'][$file] =
- array_merge($this->_packageInfo['filelist'][$file], $atts['attribs']);
- } else {
- $this->_packageInfo['filelist'][$file] = $atts['attribs'];
- }
- }
-
- /**
- * Reset the listing of package contents
- * @param string base installation dir for the whole package, if any
- */
- function clearContents($baseinstall = false)
- {
- $this->_filesValid = false;
- $this->_isValid = 0;
- if (!isset($this->_packageInfo['contents'])) {
- $this->_packageInfo = $this->_insertBefore($this->_packageInfo,
- array('compatible',
- 'dependencies', 'providesextension', 'usesrole', 'usestask',
- 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease',
- 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease',
- 'bundle', 'changelog'), array(), 'contents');
- }
- if ($this->getPackageType() != 'bundle') {
- $this->_packageInfo['contents'] =
- array('dir' => array('attribs' => array('name' => '/')));
- if ($baseinstall) {
- $this->_packageInfo['contents']['dir']['attribs']['baseinstalldir'] = $baseinstall;
- }
- } else {
- $this->_packageInfo['contents'] = array('bundledpackage' => array());
- }
- }
-
- /**
- * @param string relative path of the bundled package.
- */
- function addBundledPackage($path)
- {
- if ($this->getPackageType() != 'bundle') {
- return false;
- }
- $this->_filesValid = false;
- $this->_isValid = 0;
- $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $path, array(
- 'contents' => array('compatible', 'dependencies', 'providesextension',
- 'usesrole', 'usestask', 'srcpackage', 'srcuri', 'phprelease',
- 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease',
- 'bundle', 'changelog'),
- 'bundledpackage' => array()));
- }
-
- /**
- * @param string file name
- * @param PEAR_Task_Common a read/write task
- */
- function addTaskToFile($filename, $task)
- {
- if (!method_exists($task, 'getXml')) {
- return false;
- }
- if (!method_exists($task, 'getName')) {
- return false;
- }
- if (!method_exists($task, 'validate')) {
- return false;
- }
- if (!$task->validate()) {
- return false;
- }
- if (!isset($this->_packageInfo['contents']['dir']['file'])) {
- return false;
- }
- $this->getTasksNs(); // discover the tasks namespace if not done already
- $files = $this->_packageInfo['contents']['dir']['file'];
- if (!isset($files[0])) {
- $files = array($files);
- $ind = false;
- } else {
- $ind = true;
- }
- foreach ($files as $i => $file) {
- if (isset($file['attribs'])) {
- if ($file['attribs']['name'] == $filename) {
- if ($ind) {
- $t = isset($this->_packageInfo['contents']['dir']['file'][$i]
- ['attribs'][$this->_tasksNs .
- ':' . $task->getName()]) ?
- $this->_packageInfo['contents']['dir']['file'][$i]
- ['attribs'][$this->_tasksNs .
- ':' . $task->getName()] : false;
- if ($t && !isset($t[0])) {
- $this->_packageInfo['contents']['dir']['file'][$i]
- [$this->_tasksNs . ':' . $task->getName()] = array($t);
- }
- $this->_packageInfo['contents']['dir']['file'][$i][$this->_tasksNs .
- ':' . $task->getName()][] = $task->getXml();
- } else {
- $t = isset($this->_packageInfo['contents']['dir']['file']
- ['attribs'][$this->_tasksNs .
- ':' . $task->getName()]) ? $this->_packageInfo['contents']['dir']['file']
- ['attribs'][$this->_tasksNs .
- ':' . $task->getName()] : false;
- if ($t && !isset($t[0])) {
- $this->_packageInfo['contents']['dir']['file']
- [$this->_tasksNs . ':' . $task->getName()] = array($t);
- }
- $this->_packageInfo['contents']['dir']['file'][$this->_tasksNs .
- ':' . $task->getName()][] = $task->getXml();
- }
- return true;
- }
- }
- }
- return false;
- }
-
- /**
- * @param string path to the file
- * @param string filename
- * @param array extra attributes
- */
- function addFile($dir, $file, $attrs)
- {
- if ($this->getPackageType() == 'bundle') {
- return false;
- }
- $this->_filesValid = false;
- $this->_isValid = 0;
- $dir = preg_replace(array('!\\\\+!', '!/+!'), array('/', '/'), $dir);
- if ($dir == '/' || $dir == '') {
- $dir = '';
- } else {
- $dir .= '/';
- }
- $attrs['name'] = $dir . $file;
- if (!isset($this->_packageInfo['contents'])) {
- // ensure that the contents tag is set up
- $this->_packageInfo = $this->_insertBefore($this->_packageInfo,
- array('compatible', 'dependencies', 'providesextension', 'usesrole', 'usestask',
- 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease',
- 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease',
- 'bundle', 'changelog'), array(), 'contents');
- }
- if (isset($this->_packageInfo['contents']['dir']['file'])) {
- if (!isset($this->_packageInfo['contents']['dir']['file'][0])) {
- $this->_packageInfo['contents']['dir']['file'] =
- array($this->_packageInfo['contents']['dir']['file']);
- }
- $this->_packageInfo['contents']['dir']['file'][]['attribs'] = $attrs;
- } else {
- $this->_packageInfo['contents']['dir']['file']['attribs'] = $attrs;
- }
- }
-
- /**
- * @param string Dependent package name
- * @param string Dependent package's channel name
- * @param string minimum version of specified package that this release is guaranteed to be
- * compatible with
- * @param string maximum version of specified package that this release is guaranteed to be
- * compatible with
- * @param string versions of specified package that this release is not compatible with
- */
- function addCompatiblePackage($name, $channel, $min, $max, $exclude = false)
- {
- $this->_isValid = 0;
- $set = array(
- 'name' => $name,
- 'channel' => $channel,
- 'min' => $min,
- 'max' => $max,
- );
- if ($exclude) {
- $set['exclude'] = $exclude;
- }
- $this->_isValid = 0;
- $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $set, array(
- 'compatible' => array('dependencies', 'providesextension', 'usesrole', 'usestask',
- 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
- 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog')
- ));
- }
-
- /**
- * Removes the <usesrole> tag entirely
- */
- function resetUsesrole()
- {
- if (isset($this->_packageInfo['usesrole'])) {
- unset($this->_packageInfo['usesrole']);
- }
- }
-
- /**
- * @param string
- * @param string package name or uri
- * @param string channel name if non-uri
- */
- function addUsesrole($role, $packageOrUri, $channel = false) {
- $set = array('role' => $role);
- if ($channel) {
- $set['package'] = $packageOrUri;
- $set['channel'] = $channel;
- } else {
- $set['uri'] = $packageOrUri;
- }
- $this->_isValid = 0;
- $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $set, array(
- 'usesrole' => array('usestask', 'srcpackage', 'srcuri',
- 'phprelease', 'extsrcrelease', 'extbinrelease',
- 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog')
- ));
- }
-
- /**
- * Removes the <usestask> tag entirely
- */
- function resetUsestask()
- {
- if (isset($this->_packageInfo['usestask'])) {
- unset($this->_packageInfo['usestask']);
- }
- }
-
-
- /**
- * @param string
- * @param string package name or uri
- * @param string channel name if non-uri
- */
- function addUsestask($task, $packageOrUri, $channel = false) {
- $set = array('task' => $task);
- if ($channel) {
- $set['package'] = $packageOrUri;
- $set['channel'] = $channel;
- } else {
- $set['uri'] = $packageOrUri;
- }
- $this->_isValid = 0;
- $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $set, array(
- 'usestask' => array('srcpackage', 'srcuri',
- 'phprelease', 'extsrcrelease', 'extbinrelease',
- 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog')
- ));
- }
-
- /**
- * Remove all compatible tags
- */
- function clearCompatible()
- {
- unset($this->_packageInfo['compatible']);
- }
-
- /**
- * Reset dependencies prior to adding new ones
- */
- function clearDeps()
- {
- if (!isset($this->_packageInfo['dependencies'])) {
- $this->_packageInfo = $this->_mergeTag($this->_packageInfo, array(),
- array(
- 'dependencies' => array('providesextension', 'usesrole', 'usestask',
- 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
- 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog')));
- }
- $this->_packageInfo['dependencies'] = array();
- }
-
- /**
- * @param string minimum PHP version allowed
- * @param string maximum PHP version allowed
- * @param array $exclude incompatible PHP versions
- */
- function setPhpDep($min, $max = false, $exclude = false)
- {
- $this->_isValid = 0;
- $dep =
- array(
- 'min' => $min,
- );
- if ($max) {
- $dep['max'] = $max;
- }
- if ($exclude) {
- if (count($exclude) == 1) {
- $exclude = $exclude[0];
- }
- $dep['exclude'] = $exclude;
- }
- if (isset($this->_packageInfo['dependencies']['required']['php'])) {
- $this->_stack->push(__FUNCTION__, 'warning', array('dep' =>
- $this->_packageInfo['dependencies']['required']['php']),
- 'warning: PHP dependency already exists, overwriting');
- unset($this->_packageInfo['dependencies']['required']['php']);
- }
- $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep,
- array(
- 'dependencies' => array('providesextension', 'usesrole', 'usestask',
- 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
- 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'),
- 'required' => array('optional', 'group'),
- 'php' => array('pearinstaller', 'package', 'subpackage', 'extension', 'os', 'arch')
- ));
- return true;
- }
-
- /**
- * @param string minimum allowed PEAR installer version
- * @param string maximum allowed PEAR installer version
- * @param string recommended PEAR installer version
- * @param array incompatible version of the PEAR installer
- */
- function setPearinstallerDep($min, $max = false, $recommended = false, $exclude = false)
- {
- $this->_isValid = 0;
- $dep =
- array(
- 'min' => $min,
- );
- if ($max) {
- $dep['max'] = $max;
- }
- if ($recommended) {
- $dep['recommended'] = $recommended;
- }
- if ($exclude) {
- if (count($exclude) == 1) {
- $exclude = $exclude[0];
- }
- $dep['exclude'] = $exclude;
- }
- if (isset($this->_packageInfo['dependencies']['required']['pearinstaller'])) {
- $this->_stack->push(__FUNCTION__, 'warning', array('dep' =>
- $this->_packageInfo['dependencies']['required']['pearinstaller']),
- 'warning: PEAR Installer dependency already exists, overwriting');
- unset($this->_packageInfo['dependencies']['required']['pearinstaller']);
- }
- $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep,
- array(
- 'dependencies' => array('providesextension', 'usesrole', 'usestask',
- 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
- 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'),
- 'required' => array('optional', 'group'),
- 'pearinstaller' => array('package', 'subpackage', 'extension', 'os', 'arch')
- ));
- }
-
- /**
- * Mark a package as conflicting with this package
- * @param string package name
- * @param string package channel
- * @param string extension this package provides, if any
- * @param string|false minimum version required
- * @param string|false maximum version allowed
- * @param array|false versions to exclude from installation
- */
- function addConflictingPackageDepWithChannel($name, $channel,
- $providesextension = false, $min = false, $max = false, $exclude = false)
- {
- $this->_isValid = 0;
- $dep = $this->_constructDep($name, $channel, false, $min, $max, false,
- $exclude, $providesextension, false, true);
- $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep,
- array(
- 'dependencies' => array('providesextension', 'usesrole', 'usestask',
- 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
- 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'),
- 'required' => array('optional', 'group'),
- 'package' => array('subpackage', 'extension', 'os', 'arch')
- ));
- }
-
- /**
- * Mark a package as conflicting with this package
- * @param string package name
- * @param string package channel
- * @param string extension this package provides, if any
- */
- function addConflictingPackageDepWithUri($name, $uri, $providesextension = false)
- {
- $this->_isValid = 0;
- $dep =
- array(
- 'name' => $name,
- 'uri' => $uri,
- 'conflicts' => '',
- );
- if ($providesextension) {
- $dep['providesextension'] = $providesextension;
- }
- $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep,
- array(
- 'dependencies' => array('providesextension', 'usesrole', 'usestask',
- 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
- 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'),
- 'required' => array('optional', 'group'),
- 'package' => array('subpackage', 'extension', 'os', 'arch')
- ));
- }
-
- function addDependencyGroup($name, $hint)
- {
- $this->_isValid = 0;
- $this->_packageInfo = $this->_mergeTag($this->_packageInfo,
- array('attribs' => array('name' => $name, 'hint' => $hint)),
- array(
- 'dependencies' => array('providesextension', 'usesrole', 'usestask',
- 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
- 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'),
- 'group' => array(),
- ));
- }
-
- /**
- * @param string package name
- * @param string|false channel name, false if this is a uri
- * @param string|false uri name, false if this is a channel
- * @param string|false minimum version required
- * @param string|false maximum version allowed
- * @param string|false recommended installation version
- * @param array|false versions to exclude from installation
- * @param string extension this package provides, if any
- * @param bool if true, tells the installer to ignore the default optional dependency group
- * when installing this package
- * @param bool if true, tells the installer to negate this dependency (conflicts)
- * @return array
- * @access private
- */
- function _constructDep($name, $channel, $uri, $min, $max, $recommended, $exclude,
- $providesextension = false, $nodefault = false,
- $conflicts = false)
- {
- $dep =
- array(
- 'name' => $name,
- );
- if ($channel) {
- $dep['channel'] = $channel;
- } elseif ($uri) {
- $dep['uri'] = $uri;
- }
- if ($min) {
- $dep['min'] = $min;
- }
- if ($max) {
- $dep['max'] = $max;
- }
- if ($recommended) {
- $dep['recommended'] = $recommended;
- }
- if ($exclude) {
- if (is_array($exclude) && count($exclude) == 1) {
- $exclude = $exclude[0];
- }
- $dep['exclude'] = $exclude;
- }
- if ($conflicts) {
- $dep['conflicts'] = '';
- }
- if ($nodefault) {
- $dep['nodefault'] = '';
- }
- if ($providesextension) {
- $dep['providesextension'] = $providesextension;
- }
- return $dep;
- }
-
- /**
- * @param package|subpackage
- * @param string group name
- * @param string package name
- * @param string package channel
- * @param string minimum version
- * @param string maximum version
- * @param string recommended version
- * @param array|false optional excluded versions
- * @param string extension this package provides, if any
- * @param bool if true, tells the installer to ignore the default optional dependency group
- * when installing this package
- * @return bool false if the dependency group has not been initialized with
- * {@link addDependencyGroup()}, or a subpackage is added with
- * a providesextension
- */
- function addGroupPackageDepWithChannel($type, $groupname, $name, $channel, $min = false,
- $max = false, $recommended = false, $exclude = false,
- $providesextension = false, $nodefault = false)
- {
- if ($type == 'subpackage' && $providesextension) {
- return false; // subpackages must be php packages
- }
- $dep = $this->_constructDep($name, $channel, false, $min, $max, $recommended, $exclude,
- $providesextension, $nodefault);
- return $this->_addGroupDependency($type, $dep, $groupname);
- }
-
- /**
- * @param package|subpackage
- * @param string group name
- * @param string package name
- * @param string package uri
- * @param string extension this package provides, if any
- * @param bool if true, tells the installer to ignore the default optional dependency group
- * when installing this package
- * @return bool false if the dependency group has not been initialized with
- * {@link addDependencyGroup()}
- */
- function addGroupPackageDepWithURI($type, $groupname, $name, $uri, $providesextension = false,
- $nodefault = false)
- {
- if ($type == 'subpackage' && $providesextension) {
- return false; // subpackages must be php packages
- }
- $dep = $this->_constructDep($name, false, $uri, false, false, false, false,
- $providesextension, $nodefault);
- return $this->_addGroupDependency($type, $dep, $groupname);
- }
-
- /**
- * @param string group name (must be pre-existing)
- * @param string extension name
- * @param string minimum version allowed
- * @param string maximum version allowed
- * @param string recommended version
- * @param array incompatible versions
- */
- function addGroupExtensionDep($groupname, $name, $min = false, $max = false,
- $recommended = false, $exclude = false)
- {
- $this->_isValid = 0;
- $dep = $this->_constructDep($name, false, false, $min, $max, $recommended, $exclude);
- return $this->_addGroupDependency('extension', $dep, $groupname);
- }
-
- /**
- * @param package|subpackage|extension
- * @param array dependency contents
- * @param string name of the dependency group to add this to
- * @return boolean
- * @access private
- */
- function _addGroupDependency($type, $dep, $groupname)
- {
- $arr = array('subpackage', 'extension');
- if ($type != 'package') {
- array_shift($arr);
- }
- if ($type == 'extension') {
- array_shift($arr);
- }
- if (!isset($this->_packageInfo['dependencies']['group'])) {
- return false;
- } else {
- if (!isset($this->_packageInfo['dependencies']['group'][0])) {
- if ($this->_packageInfo['dependencies']['group']['attribs']['name'] == $groupname) {
- $this->_packageInfo['dependencies']['group'] = $this->_mergeTag(
- $this->_packageInfo['dependencies']['group'], $dep,
- array(
- $type => $arr
- ));
- $this->_isValid = 0;
- return true;
- } else {
- return false;
- }
- } else {
- foreach ($this->_packageInfo['dependencies']['group'] as $i => $group) {
- if ($group['attribs']['name'] == $groupname) {
- $this->_packageInfo['dependencies']['group'][$i] = $this->_mergeTag(
- $this->_packageInfo['dependencies']['group'][$i], $dep,
- array(
- $type => $arr
- ));
- $this->_isValid = 0;
- return true;
- }
- }
- return false;
- }
- }
- }
-
- /**
- * @param optional|required
- * @param string package name
- * @param string package channel
- * @param string minimum version
- * @param string maximum version
- * @param string recommended version
- * @param string extension this package provides, if any
- * @param bool if true, tells the installer to ignore the default optional dependency group
- * when installing this package
- * @param array|false optional excluded versions
- */
- function addPackageDepWithChannel($type, $name, $channel, $min = false, $max = false,
- $recommended = false, $exclude = false,
- $providesextension = false, $nodefault = false)
- {
- if (!in_array($type, array('optional', 'required'), true)) {
- $type = 'required';
- }
- $this->_isValid = 0;
- $arr = array('optional', 'group');
- if ($type != 'required') {
- array_shift($arr);
- }
- $dep = $this->_constructDep($name, $channel, false, $min, $max, $recommended, $exclude,
- $providesextension, $nodefault);
- $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep,
- array(
- 'dependencies' => array('providesextension', 'usesrole', 'usestask',
- 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
- 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'),
- $type => $arr,
- 'package' => array('subpackage', 'extension', 'os', 'arch')
- ));
- }
-
- /**
- * @param optional|required
- * @param string name of the package
- * @param string uri of the package
- * @param string extension this package provides, if any
- * @param bool if true, tells the installer to ignore the default optional dependency group
- * when installing this package
- */
- function addPackageDepWithUri($type, $name, $uri, $providesextension = false,
- $nodefault = false)
- {
- $this->_isValid = 0;
- $arr = array('optional', 'group');
- if ($type != 'required') {
- array_shift($arr);
- }
- $dep = $this->_constructDep($name, false, $uri, false, false, false, false,
- $providesextension, $nodefault);
- $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep,
- array(
- 'dependencies' => array('providesextension', 'usesrole', 'usestask',
- 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
- 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'),
- $type => $arr,
- 'package' => array('subpackage', 'extension', 'os', 'arch')
- ));
- }
-
- /**
- * @param optional|required optional, required
- * @param string package name
- * @param string package channel
- * @param string minimum version
- * @param string maximum version
- * @param string recommended version
- * @param array incompatible versions
- * @param bool if true, tells the installer to ignore the default optional dependency group
- * when installing this package
- */
- function addSubpackageDepWithChannel($type, $name, $channel, $min = false, $max = false,
- $recommended = false, $exclude = false,
- $nodefault = false)
- {
- $this->_isValid = 0;
- $arr = array('optional', 'group');
- if ($type != 'required') {
- array_shift($arr);
- }
- $dep = $this->_constructDep($name, $channel, false, $min, $max, $recommended, $exclude,
- $nodefault);
- $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep,
- array(
- 'dependencies' => array('providesextension', 'usesrole', 'usestask',
- 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
- 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'),
- $type => $arr,
- 'subpackage' => array('extension', 'os', 'arch')
- ));
- }
-
- /**
- * @param optional|required optional, required
- * @param string package name
- * @param string package uri for download
- * @param bool if true, tells the installer to ignore the default optional dependency group
- * when installing this package
- */
- function addSubpackageDepWithUri($type, $name, $uri, $nodefault = false)
- {
- $this->_isValid = 0;
- $arr = array('optional', 'group');
- if ($type != 'required') {
- array_shift($arr);
- }
- $dep = $this->_constructDep($name, false, $uri, false, false, false, false, $nodefault);
- $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep,
- array(
- 'dependencies' => array('providesextension', 'usesrole', 'usestask',
- 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
- 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'),
- $type => $arr,
- 'subpackage' => array('extension', 'os', 'arch')
- ));
- }
-
- /**
- * @param optional|required optional, required
- * @param string extension name
- * @param string minimum version
- * @param string maximum version
- * @param string recommended version
- * @param array incompatible versions
- */
- function addExtensionDep($type, $name, $min = false, $max = false, $recommended = false,
- $exclude = false)
- {
- $this->_isValid = 0;
- $arr = array('optional', 'group');
- if ($type != 'required') {
- array_shift($arr);
- }
- $dep = $this->_constructDep($name, false, false, $min, $max, $recommended, $exclude);
- $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep,
- array(
- 'dependencies' => array('providesextension', 'usesrole', 'usestask',
- 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
- 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'),
- $type => $arr,
- 'extension' => array('os', 'arch')
- ));
- }
-
- /**
- * @param string Operating system name
- * @param boolean true if this package cannot be installed on this OS
- */
- function addOsDep($name, $conflicts = false)
- {
- $this->_isValid = 0;
- $dep = array('name' => $name);
- if ($conflicts) {
- $dep['conflicts'] = '';
- }
- $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep,
- array(
- 'dependencies' => array('providesextension', 'usesrole', 'usestask',
- 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
- 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'),
- 'required' => array('optional', 'group'),
- 'os' => array('arch')
- ));
- }
-
- /**
- * @param string Architecture matching pattern
- * @param boolean true if this package cannot be installed on this architecture
- */
- function addArchDep($pattern, $conflicts = false)
- {
- $this->_isValid = 0;
- $dep = array('pattern' => $pattern);
- if ($conflicts) {
- $dep['conflicts'] = '';
- }
- $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep,
- array(
- 'dependencies' => array('providesextension', 'usesrole', 'usestask',
- 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
- 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'),
- 'required' => array('optional', 'group'),
- 'arch' => array()
- ));
- }
-
- /**
- * Set the kind of package, and erase all release tags
- *
- * - a php package is a PEAR-style package
- * - an extbin package is a PECL-style extension binary
- * - an extsrc package is a PECL-style source for a binary
- * - an zendextbin package is a PECL-style zend extension binary
- * - an zendextsrc package is a PECL-style source for a zend extension binary
- * - a bundle package is a collection of other pre-packaged packages
- * @param php|extbin|extsrc|zendextsrc|zendextbin|bundle
- * @return bool success
- */
- function setPackageType($type)
- {
- $this->_isValid = 0;
- if (!in_array($type, array('php', 'extbin', 'extsrc', 'zendextsrc',
- 'zendextbin', 'bundle'))) {
- return false;
- }
-
- if (in_array($type, array('zendextsrc', 'zendextbin'))) {
- $this->_setPackageVersion2_1();
- }
-
- if ($type != 'bundle') {
- $type .= 'release';
- }
-
- foreach (array('phprelease', 'extbinrelease', 'extsrcrelease',
- 'zendextsrcrelease', 'zendextbinrelease', 'bundle') as $test) {
- unset($this->_packageInfo[$test]);
- }
-
- if (!isset($this->_packageInfo[$type])) {
- // ensure that the release tag is set up
- $this->_packageInfo = $this->_insertBefore($this->_packageInfo, array('changelog'),
- array(), $type);
- }
-
- $this->_packageInfo[$type] = array();
- return true;
- }
-
- /**
- * @return bool true if package type is set up
- */
- function addRelease()
- {
- if ($type = $this->getPackageType()) {
- if ($type != 'bundle') {
- $type .= 'release';
- }
- $this->_packageInfo = $this->_mergeTag($this->_packageInfo, array(),
- array($type => array('changelog')));
- return true;
- }
- return false;
- }
-
- /**
- * Get the current release tag in order to add to it
- * @param bool returns only releases that have installcondition if true
- * @return array|null
- */
- function &_getCurrentRelease($strict = true)
- {
- if ($p = $this->getPackageType()) {
- if ($strict) {
- if ($p == 'extsrc' || $p == 'zendextsrc') {
- $a = null;
- return $a;
- }
- }
- if ($p != 'bundle') {
- $p .= 'release';
- }
- if (isset($this->_packageInfo[$p][0])) {
- return $this->_packageInfo[$p][count($this->_packageInfo[$p]) - 1];
- } else {
- return $this->_packageInfo[$p];
- }
- } else {
- $a = null;
- return $a;
- }
- }
-
- /**
- * Add a file to the current release that should be installed under a different name
- * @param string <contents> path to file
- * @param string name the file should be installed as
- */
- function addInstallAs($path, $as)
- {
- $r = &$this->_getCurrentRelease();
- if ($r === null) {
- return false;
- }
- $this->_isValid = 0;
- $r = $this->_mergeTag($r, array('attribs' => array('name' => $path, 'as' => $as)),
- array(
- 'filelist' => array(),
- 'install' => array('ignore')
- ));
- }
-
- /**
- * Add a file to the current release that should be ignored
- * @param string <contents> path to file
- * @return bool success of operation
- */
- function addIgnore($path)
- {
- $r = &$this->_getCurrentRelease();
- if ($r === null) {
- return false;
- }
- $this->_isValid = 0;
- $r = $this->_mergeTag($r, array('attribs' => array('name' => $path)),
- array(
- 'filelist' => array(),
- 'ignore' => array()
- ));
- }
-
- /**
- * Add an extension binary package for this extension source code release
- *
- * Note that the package must be from the same channel as the extension source package
- * @param string
- */
- function addBinarypackage($package)
- {
- if ($this->getPackageType() != 'extsrc' && $this->getPackageType() != 'zendextsrc') {
- return false;
- }
- $r = &$this->_getCurrentRelease(false);
- if ($r === null) {
- return false;
- }
- $this->_isValid = 0;
- $r = $this->_mergeTag($r, $package,
- array(
- 'binarypackage' => array('filelist'),
- ));
- }
-
- /**
- * Add a configureoption to an extension source package
- * @param string
- * @param string
- * @param string
- */
- function addConfigureOption($name, $prompt, $default = null)
- {
- if ($this->getPackageType() != 'extsrc' && $this->getPackageType() != 'zendextsrc') {
- return false;
- }
-
- $r = &$this->_getCurrentRelease(false);
- if ($r === null) {
- return false;
- }
-
- $opt = array('attribs' => array('name' => $name, 'prompt' => $prompt));
- if ($default !== null) {
- $opt['attribs']['default'] = $default;
- }
-
- $this->_isValid = 0;
- $r = $this->_mergeTag($r, $opt,
- array(
- 'configureoption' => array('binarypackage', 'filelist'),
- ));
- }
-
- /**
- * Set an installation condition based on php version for the current release set
- * @param string minimum version
- * @param string maximum version
- * @param false|array incompatible versions of PHP
- */
- function setPhpInstallCondition($min, $max, $exclude = false)
- {
- $r = &$this->_getCurrentRelease();
- if ($r === null) {
- return false;
- }
- $this->_isValid = 0;
- if (isset($r['installconditions']['php'])) {
- unset($r['installconditions']['php']);
- }
- $dep = array('min' => $min, 'max' => $max);
- if ($exclude) {
- if (is_array($exclude) && count($exclude) == 1) {
- $exclude = $exclude[0];
- }
- $dep['exclude'] = $exclude;
- }
- if ($this->getPackageType() == 'extsrc' || $this->getPackageType() == 'zendextsrc') {
- $r = $this->_mergeTag($r, $dep,
- array(
- 'installconditions' => array('configureoption', 'binarypackage',
- 'filelist'),
- 'php' => array('extension', 'os', 'arch')
- ));
- } else {
- $r = $this->_mergeTag($r, $dep,
- array(
- 'installconditions' => array('filelist'),
- 'php' => array('extension', 'os', 'arch')
- ));
- }
- }
-
- /**
- * @param optional|required optional, required
- * @param string extension name
- * @param string minimum version
- * @param string maximum version
- * @param string recommended version
- * @param array incompatible versions
- */
- function addExtensionInstallCondition($name, $min = false, $max = false, $recommended = false,
- $exclude = false)
- {
- $r = &$this->_getCurrentRelease();
- if ($r === null) {
- return false;
- }
- $this->_isValid = 0;
- $dep = $this->_constructDep($name, false, false, $min, $max, $recommended, $exclude);
- if ($this->getPackageType() == 'extsrc' || $this->getPackageType() == 'zendextsrc') {
- $r = $this->_mergeTag($r, $dep,
- array(
- 'installconditions' => array('configureoption', 'binarypackage',
- 'filelist'),
- 'extension' => array('os', 'arch')
- ));
- } else {
- $r = $this->_mergeTag($r, $dep,
- array(
- 'installconditions' => array('filelist'),
- 'extension' => array('os', 'arch')
- ));
- }
- }
-
- /**
- * Set an installation condition based on operating system for the current release set
- * @param string OS name
- * @param bool whether this OS is incompatible with the current release
- */
- function setOsInstallCondition($name, $conflicts = false)
- {
- $r = &$this->_getCurrentRelease();
- if ($r === null) {
- return false;
- }
- $this->_isValid = 0;
- if (isset($r['installconditions']['os'])) {
- unset($r['installconditions']['os']);
- }
- $dep = array('name' => $name);
- if ($conflicts) {
- $dep['conflicts'] = '';
- }
- if ($this->getPackageType() == 'extsrc' || $this->getPackageType() == 'zendextsrc') {
- $r = $this->_mergeTag($r, $dep,
- array(
- 'installconditions' => array('configureoption', 'binarypackage',
- 'filelist'),
- 'os' => array('arch')
- ));
- } else {
- $r = $this->_mergeTag($r, $dep,
- array(
- 'installconditions' => array('filelist'),
- 'os' => array('arch')
- ));
- }
- }
-
- /**
- * Set an installation condition based on architecture for the current release set
- * @param string architecture pattern
- * @param bool whether this arch is incompatible with the current release
- */
- function setArchInstallCondition($pattern, $conflicts = false)
- {
- $r = &$this->_getCurrentRelease();
- if ($r === null) {
- return false;
- }
- $this->_isValid = 0;
- if (isset($r['installconditions']['arch'])) {
- unset($r['installconditions']['arch']);
- }
- $dep = array('pattern' => $pattern);
- if ($conflicts) {
- $dep['conflicts'] = '';
- }
- if ($this->getPackageType() == 'extsrc' || $this->getPackageType() == 'zendextsrc') {
- $r = $this->_mergeTag($r, $dep,
- array(
- 'installconditions' => array('configureoption', 'binarypackage',
- 'filelist'),
- 'arch' => array()
- ));
- } else {
- $r = $this->_mergeTag($r, $dep,
- array(
- 'installconditions' => array('filelist'),
- 'arch' => array()
- ));
- }
- }
-
- /**
- * For extension binary releases, this is used to specify either the
- * static URI to a source package, or the package name and channel of the extsrc/zendextsrc
- * package it is based on.
- * @param string Package name, or full URI to source package (extsrc/zendextsrc type)
- */
- function setSourcePackage($packageOrUri)
- {
- $this->_isValid = 0;
- if (isset($this->_packageInfo['channel'])) {
- $this->_packageInfo = $this->_insertBefore($this->_packageInfo, array('phprelease',
- 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease',
- 'bundle', 'changelog'),
- $packageOrUri, 'srcpackage');
- } else {
- $this->_packageInfo = $this->_insertBefore($this->_packageInfo, array('phprelease',
- 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease',
- 'bundle', 'changelog'), $packageOrUri, 'srcuri');
- }
- }
-
- /**
- * Generate a valid change log entry from the current package.xml
- * @param string|false
- */
- function generateChangeLogEntry($notes = false)
- {
- return array(
- 'version' =>
- array(
- 'release' => $this->getVersion('release'),
- 'api' => $this->getVersion('api'),
- ),
- 'stability' =>
- $this->getStability(),
- 'date' => $this->getDate(),
- 'license' => $this->getLicense(true),
- 'notes' => $notes ? $notes : $this->getNotes()
- );
- }
-
- /**
- * @param string release version to set change log notes for
- * @param array output of {@link generateChangeLogEntry()}
- */
- function setChangelogEntry($releaseversion, $contents)
- {
- if (!isset($this->_packageInfo['changelog'])) {
- $this->_packageInfo['changelog']['release'] = $contents;
- return;
- }
- if (!isset($this->_packageInfo['changelog']['release'][0])) {
- if ($this->_packageInfo['changelog']['release']['version']['release'] == $releaseversion) {
- $this->_packageInfo['changelog']['release'] = array(
- $this->_packageInfo['changelog']['release']);
- } else {
- $this->_packageInfo['changelog']['release'] = array(
- $this->_packageInfo['changelog']['release']);
- return $this->_packageInfo['changelog']['release'][] = $contents;
- }
- }
- foreach($this->_packageInfo['changelog']['release'] as $index => $changelog) {
- if (isset($changelog['version']) &&
- strnatcasecmp($changelog['version']['release'], $releaseversion) == 0) {
- $curlog = $index;
- }
- }
- if (isset($curlog)) {
- $this->_packageInfo['changelog']['release'][$curlog] = $contents;
- } else {
- $this->_packageInfo['changelog']['release'][] = $contents;
- }
- }
-
- /**
- * Remove the changelog entirely
- */
- function clearChangeLog()
- {
- unset($this->_packageInfo['changelog']);
- }
-} \ No newline at end of file
diff --git a/3rdparty/PEAR/Packager.php b/3rdparty/PEAR/Packager.php
deleted file mode 100644
index 8995a167fcc..00000000000
--- a/3rdparty/PEAR/Packager.php
+++ /dev/null
@@ -1,201 +0,0 @@
-<?php
-/**
- * PEAR_Packager for generating releases
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Stig Bakken <ssb@php.net>
- * @author Tomas V. V. Cox <cox@idecnet.com>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Packager.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 0.1
- */
-
-/**
- * base class
- */
-require_once 'PEAR/Common.php';
-require_once 'PEAR/PackageFile.php';
-require_once 'System.php';
-
-/**
- * Administration class used to make a PEAR release tarball.
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 0.1
- */
-class PEAR_Packager extends PEAR_Common
-{
- /**
- * @var PEAR_Registry
- */
- var $_registry;
-
- function package($pkgfile = null, $compress = true, $pkg2 = null)
- {
- // {{{ validate supplied package.xml file
- if (empty($pkgfile)) {
- $pkgfile = 'package.xml';
- }
-
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- $pkg = &new PEAR_PackageFile($this->config, $this->debug);
- $pf = &$pkg->fromPackageFile($pkgfile, PEAR_VALIDATE_NORMAL);
- $main = &$pf;
- PEAR::staticPopErrorHandling();
- if (PEAR::isError($pf)) {
- if (is_array($pf->getUserInfo())) {
- foreach ($pf->getUserInfo() as $error) {
- $this->log(0, 'Error: ' . $error['message']);
- }
- }
-
- $this->log(0, $pf->getMessage());
- return $this->raiseError("Cannot package, errors in package file");
- }
-
- foreach ($pf->getValidationWarnings() as $warning) {
- $this->log(1, 'Warning: ' . $warning['message']);
- }
-
- // }}}
- if ($pkg2) {
- $this->log(0, 'Attempting to process the second package file');
- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
- $pf2 = &$pkg->fromPackageFile($pkg2, PEAR_VALIDATE_NORMAL);
- PEAR::staticPopErrorHandling();
- if (PEAR::isError($pf2)) {
- if (is_array($pf2->getUserInfo())) {
- foreach ($pf2->getUserInfo() as $error) {
- $this->log(0, 'Error: ' . $error['message']);
- }
- }
- $this->log(0, $pf2->getMessage());
- return $this->raiseError("Cannot package, errors in second package file");
- }
-
- foreach ($pf2->getValidationWarnings() as $warning) {
- $this->log(1, 'Warning: ' . $warning['message']);
- }
-
- if ($pf2->getPackagexmlVersion() == '2.0' ||
- $pf2->getPackagexmlVersion() == '2.1'
- ) {
- $main = &$pf2;
- $other = &$pf;
- } else {
- $main = &$pf;
- $other = &$pf2;
- }
-
- if ($main->getPackagexmlVersion() != '2.0' &&
- $main->getPackagexmlVersion() != '2.1') {
- return PEAR::raiseError('Error: cannot package two package.xml version 1.0, can ' .
- 'only package together a package.xml 1.0 and package.xml 2.0');
- }
-
- if ($other->getPackagexmlVersion() != '1.0') {
- return PEAR::raiseError('Error: cannot package two package.xml version 2.0, can ' .
- 'only package together a package.xml 1.0 and package.xml 2.0');
- }
- }
-
- $main->setLogger($this);
- if (!$main->validate(PEAR_VALIDATE_PACKAGING)) {
- foreach ($main->getValidationWarnings() as $warning) {
- $this->log(0, 'Error: ' . $warning['message']);
- }
- return $this->raiseError("Cannot package, errors in package");
- }
-
- foreach ($main->getValidationWarnings() as $warning) {
- $this->log(1, 'Warning: ' . $warning['message']);
- }
-
- if ($pkg2) {
- $other->setLogger($this);
- $a = false;
- if (!$other->validate(PEAR_VALIDATE_NORMAL) || $a = !$main->isEquivalent($other)) {
- foreach ($other->getValidationWarnings() as $warning) {
- $this->log(0, 'Error: ' . $warning['message']);
- }
-
- foreach ($main->getValidationWarnings() as $warning) {
- $this->log(0, 'Error: ' . $warning['message']);
- }
-
- if ($a) {
- return $this->raiseError('The two package.xml files are not equivalent!');
- }
-
- return $this->raiseError("Cannot package, errors in package");
- }
-
- foreach ($other->getValidationWarnings() as $warning) {
- $this->log(1, 'Warning: ' . $warning['message']);
- }
-
- $gen = &$main->getDefaultGenerator();
- $tgzfile = $gen->toTgz2($this, $other, $compress);
- if (PEAR::isError($tgzfile)) {
- return $tgzfile;
- }
-
- $dest_package = basename($tgzfile);
- $pkgdir = dirname($pkgfile);
-
- // TAR the Package -------------------------------------------
- $this->log(1, "Package $dest_package done");
- if (file_exists("$pkgdir/CVS/Root")) {
- $cvsversion = preg_replace('/[^a-z0-9]/i', '_', $pf->getVersion());
- $cvstag = "RELEASE_$cvsversion";
- $this->log(1, 'Tag the released code with "pear cvstag ' .
- $main->getPackageFile() . '"');
- $this->log(1, "(or set the CVS tag $cvstag by hand)");
- } elseif (file_exists("$pkgdir/.svn")) {
- $svnversion = preg_replace('/[^a-z0-9]/i', '.', $pf->getVersion());
- $svntag = $pf->getName() . "-$svnversion";
- $this->log(1, 'Tag the released code with "pear svntag ' .
- $main->getPackageFile() . '"');
- $this->log(1, "(or set the SVN tag $svntag by hand)");
- }
- } else { // this branch is executed for single packagefile packaging
- $gen = &$pf->getDefaultGenerator();
- $tgzfile = $gen->toTgz($this, $compress);
- if (PEAR::isError($tgzfile)) {
- $this->log(0, $tgzfile->getMessage());
- return $this->raiseError("Cannot package, errors in package");
- }
-
- $dest_package = basename($tgzfile);
- $pkgdir = dirname($pkgfile);
-
- // TAR the Package -------------------------------------------
- $this->log(1, "Package $dest_package done");
- if (file_exists("$pkgdir/CVS/Root")) {
- $cvsversion = preg_replace('/[^a-z0-9]/i', '_', $pf->getVersion());
- $cvstag = "RELEASE_$cvsversion";
- $this->log(1, "Tag the released code with `pear cvstag $pkgfile'");
- $this->log(1, "(or set the CVS tag $cvstag by hand)");
- } elseif (file_exists("$pkgdir/.svn")) {
- $svnversion = preg_replace('/[^a-z0-9]/i', '.', $pf->getVersion());
- $svntag = $pf->getName() . "-$svnversion";
- $this->log(1, "Tag the released code with `pear svntag $pkgfile'");
- $this->log(1, "(or set the SVN tag $svntag by hand)");
- }
- }
-
- return $dest_package;
- }
-} \ No newline at end of file
diff --git a/3rdparty/PEAR/REST.php b/3rdparty/PEAR/REST.php
deleted file mode 100644
index 34a804f2bde..00000000000
--- a/3rdparty/PEAR/REST.php
+++ /dev/null
@@ -1,483 +0,0 @@
-<?php
-/**
- * PEAR_REST
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: REST.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a1
- */
-
-/**
- * For downloading xml files
- */
-require_once 'PEAR.php';
-require_once 'PEAR/XMLParser.php';
-
-/**
- * Intelligently retrieve data, following hyperlinks if necessary, and re-directing
- * as well
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a1
- */
-class PEAR_REST
-{
- var $config;
- var $_options;
-
- function PEAR_REST(&$config, $options = array())
- {
- $this->config = &$config;
- $this->_options = $options;
- }
-
- /**
- * Retrieve REST data, but always retrieve the local cache if it is available.
- *
- * This is useful for elements that should never change, such as information on a particular
- * release
- * @param string full URL to this resource
- * @param array|false contents of the accept-encoding header
- * @param boolean if true, xml will be returned as a string, otherwise, xml will be
- * parsed using PEAR_XMLParser
- * @return string|array
- */
- function retrieveCacheFirst($url, $accept = false, $forcestring = false, $channel = false)
- {
- $cachefile = $this->config->get('cache_dir') . DIRECTORY_SEPARATOR .
- md5($url) . 'rest.cachefile';
-
- if (file_exists($cachefile)) {
- return unserialize(implode('', file($cachefile)));
- }
-
- return $this->retrieveData($url, $accept, $forcestring, $channel);
- }
-
- /**
- * Retrieve a remote REST resource
- * @param string full URL to this resource
- * @param array|false contents of the accept-encoding header
- * @param boolean if true, xml will be returned as a string, otherwise, xml will be
- * parsed using PEAR_XMLParser
- * @return string|array
- */
- function retrieveData($url, $accept = false, $forcestring = false, $channel = false)
- {
- $cacheId = $this->getCacheId($url);
- if ($ret = $this->useLocalCache($url, $cacheId)) {
- return $ret;
- }
-
- $file = $trieddownload = false;
- if (!isset($this->_options['offline'])) {
- $trieddownload = true;
- $file = $this->downloadHttp($url, $cacheId ? $cacheId['lastChange'] : false, $accept, $channel);
- }
-
- if (PEAR::isError($file)) {
- if ($file->getCode() !== -9276) {
- return $file;
- }
-
- $trieddownload = false;
- $file = false; // use local copy if available on socket connect error
- }
-
- if (!$file) {
- $ret = $this->getCache($url);
- if (!PEAR::isError($ret) && $trieddownload) {
- // reset the age of the cache if the server says it was unmodified
- $result = $this->saveCache($url, $ret, null, true, $cacheId);
- if (PEAR::isError($result)) {
- return PEAR::raiseError($result->getMessage());
- }
- }
-
- return $ret;
- }
-
- if (is_array($file)) {
- $headers = $file[2];
- $lastmodified = $file[1];
- $content = $file[0];
- } else {
- $headers = array();
- $lastmodified = false;
- $content = $file;
- }
-
- if ($forcestring) {
- $result = $this->saveCache($url, $content, $lastmodified, false, $cacheId);
- if (PEAR::isError($result)) {
- return PEAR::raiseError($result->getMessage());
- }
-
- return $content;
- }
-
- if (isset($headers['content-type'])) {
- switch ($headers['content-type']) {
- case 'text/xml' :
- case 'application/xml' :
- case 'text/plain' :
- if ($headers['content-type'] === 'text/plain') {
- $check = substr($content, 0, 5);
- if ($check !== '<?xml') {
- break;
- }
- }
-
- $parser = new PEAR_XMLParser;
- PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
- $err = $parser->parse($content);
- PEAR::popErrorHandling();
- if (PEAR::isError($err)) {
- return PEAR::raiseError('Invalid xml downloaded from "' . $url . '": ' .
- $err->getMessage());
- }
- $content = $parser->getData();
- case 'text/html' :
- default :
- // use it as a string
- }
- } else {
- // assume XML
- $parser = new PEAR_XMLParser;
- $parser->parse($content);
- $content = $parser->getData();
- }
-
- $result = $this->saveCache($url, $content, $lastmodified, false, $cacheId);
- if (PEAR::isError($result)) {
- return PEAR::raiseError($result->getMessage());
- }
-
- return $content;
- }
-
- function useLocalCache($url, $cacheid = null)
- {
- if ($cacheid === null) {
- $cacheidfile = $this->config->get('cache_dir') . DIRECTORY_SEPARATOR .
- md5($url) . 'rest.cacheid';
- if (!file_exists($cacheidfile)) {
- return false;
- }
-
- $cacheid = unserialize(implode('', file($cacheidfile)));
- }
-
- $cachettl = $this->config->get('cache_ttl');
- // If cache is newer than $cachettl seconds, we use the cache!
- if (time() - $cacheid['age'] < $cachettl) {
- return $this->getCache($url);
- }
-
- return false;
- }
-
- function getCacheId($url)
- {
- $cacheidfile = $this->config->get('cache_dir') . DIRECTORY_SEPARATOR .
- md5($url) . 'rest.cacheid';
-
- if (!file_exists($cacheidfile)) {
- return false;
- }
-
- $ret = unserialize(implode('', file($cacheidfile)));
- return $ret;
- }
-
- function getCache($url)
- {
- $cachefile = $this->config->get('cache_dir') . DIRECTORY_SEPARATOR .
- md5($url) . 'rest.cachefile';
-
- if (!file_exists($cachefile)) {
- return PEAR::raiseError('No cached content available for "' . $url . '"');
- }
-
- return unserialize(implode('', file($cachefile)));
- }
-
- /**
- * @param string full URL to REST resource
- * @param string original contents of the REST resource
- * @param array HTTP Last-Modified and ETag headers
- * @param bool if true, then the cache id file should be regenerated to
- * trigger a new time-to-live value
- */
- function saveCache($url, $contents, $lastmodified, $nochange = false, $cacheid = null)
- {
- $cache_dir = $this->config->get('cache_dir');
- $d = $cache_dir . DIRECTORY_SEPARATOR . md5($url);
- $cacheidfile = $d . 'rest.cacheid';
- $cachefile = $d . 'rest.cachefile';
-
- if (!is_dir($cache_dir)) {
- if (System::mkdir(array('-p', $cache_dir)) === false) {
- return PEAR::raiseError("The value of config option cache_dir ($cache_dir) is not a directory and attempts to create the directory failed.");
- }
- }
-
- if ($cacheid === null && $nochange) {
- $cacheid = unserialize(implode('', file($cacheidfile)));
- }
-
- $idData = serialize(array(
- 'age' => time(),
- 'lastChange' => ($nochange ? $cacheid['lastChange'] : $lastmodified),
- ));
-
- $result = $this->saveCacheFile($cacheidfile, $idData);
- if (PEAR::isError($result)) {
- return $result;
- } elseif ($nochange) {
- return true;
- }
-
- $result = $this->saveCacheFile($cachefile, serialize($contents));
- if (PEAR::isError($result)) {
- if (file_exists($cacheidfile)) {
- @unlink($cacheidfile);
- }
-
- return $result;
- }
-
- return true;
- }
-
- function saveCacheFile($file, $contents)
- {
- $len = strlen($contents);
-
- $cachefile_fp = @fopen($file, 'xb'); // x is the O_CREAT|O_EXCL mode
- if ($cachefile_fp !== false) { // create file
- if (fwrite($cachefile_fp, $contents, $len) < $len) {
- fclose($cachefile_fp);
- return PEAR::raiseError("Could not write $file.");
- }
- } else { // update file
- $cachefile_lstat = lstat($file);
- $cachefile_fp = @fopen($file, 'wb');
- if (!$cachefile_fp) {
- return PEAR::raiseError("Could not open $file for writing.");
- }
-
- $cachefile_fstat = fstat($cachefile_fp);
- if (
- $cachefile_lstat['mode'] == $cachefile_fstat['mode'] &&
- $cachefile_lstat['ino'] == $cachefile_fstat['ino'] &&
- $cachefile_lstat['dev'] == $cachefile_fstat['dev'] &&
- $cachefile_fstat['nlink'] === 1
- ) {
- if (fwrite($cachefile_fp, $contents, $len) < $len) {
- fclose($cachefile_fp);
- return PEAR::raiseError("Could not write $file.");
- }
- } else {
- fclose($cachefile_fp);
- $link = function_exists('readlink') ? readlink($file) : $file;
- return PEAR::raiseError('SECURITY ERROR: Will not write to ' . $file . ' as it is symlinked to ' . $link . ' - Possible symlink attack');
- }
- }
-
- fclose($cachefile_fp);
- return true;
- }
-
- /**
- * Efficiently Download a file through HTTP. Returns downloaded file as a string in-memory
- * This is best used for small files
- *
- * If an HTTP proxy has been configured (http_proxy PEAR_Config
- * setting), the proxy will be used.
- *
- * @param string $url the URL to download
- * @param string $save_dir directory to save file in
- * @param false|string|array $lastmodified header values to check against for caching
- * use false to return the header values from this download
- * @param false|array $accept Accept headers to send
- * @return string|array Returns the contents of the downloaded file or a PEAR
- * error on failure. If the error is caused by
- * socket-related errors, the error object will
- * have the fsockopen error code available through
- * getCode(). If caching is requested, then return the header
- * values.
- *
- * @access public
- */
- function downloadHttp($url, $lastmodified = null, $accept = false, $channel = false)
- {
- static $redirect = 0;
- // always reset , so we are clean case of error
- $wasredirect = $redirect;
- $redirect = 0;
-
- $info = parse_url($url);
- if (!isset($info['scheme']) || !in_array($info['scheme'], array('http', 'https'))) {
- return PEAR::raiseError('Cannot download non-http URL "' . $url . '"');
- }
-
- if (!isset($info['host'])) {
- return PEAR::raiseError('Cannot download from non-URL "' . $url . '"');
- }
-
- $host = isset($info['host']) ? $info['host'] : null;
- $port = isset($info['port']) ? $info['port'] : null;
- $path = isset($info['path']) ? $info['path'] : null;
- $schema = (isset($info['scheme']) && $info['scheme'] == 'https') ? 'https' : 'http';
-
- $proxy_host = $proxy_port = $proxy_user = $proxy_pass = '';
- if ($this->config->get('http_proxy')&&
- $proxy = parse_url($this->config->get('http_proxy'))
- ) {
- $proxy_host = isset($proxy['host']) ? $proxy['host'] : null;
- if ($schema === 'https') {
- $proxy_host = 'ssl://' . $proxy_host;
- }
-
- $proxy_port = isset($proxy['port']) ? $proxy['port'] : 8080;
- $proxy_user = isset($proxy['user']) ? urldecode($proxy['user']) : null;
- $proxy_pass = isset($proxy['pass']) ? urldecode($proxy['pass']) : null;
- $proxy_schema = (isset($proxy['scheme']) && $proxy['scheme'] == 'https') ? 'https' : 'http';
- }
-
- if (empty($port)) {
- $port = (isset($info['scheme']) && $info['scheme'] == 'https') ? 443 : 80;
- }
-
- if (isset($proxy['host'])) {
- $request = "GET $url HTTP/1.1\r\n";
- } else {
- $request = "GET $path HTTP/1.1\r\n";
- }
-
- $request .= "Host: $host\r\n";
- $ifmodifiedsince = '';
- if (is_array($lastmodified)) {
- if (isset($lastmodified['Last-Modified'])) {
- $ifmodifiedsince = 'If-Modified-Since: ' . $lastmodified['Last-Modified'] . "\r\n";
- }
-
- if (isset($lastmodified['ETag'])) {
- $ifmodifiedsince .= "If-None-Match: $lastmodified[ETag]\r\n";
- }
- } else {
- $ifmodifiedsince = ($lastmodified ? "If-Modified-Since: $lastmodified\r\n" : '');
- }
-
- $request .= $ifmodifiedsince .
- "User-Agent: PEAR/1.9.4/PHP/" . PHP_VERSION . "\r\n";
-
- $username = $this->config->get('username', null, $channel);
- $password = $this->config->get('password', null, $channel);
-
- if ($username && $password) {
- $tmp = base64_encode("$username:$password");
- $request .= "Authorization: Basic $tmp\r\n";
- }
-
- if ($proxy_host != '' && $proxy_user != '') {
- $request .= 'Proxy-Authorization: Basic ' .
- base64_encode($proxy_user . ':' . $proxy_pass) . "\r\n";
- }
-
- if ($accept) {
- $request .= 'Accept: ' . implode(', ', $accept) . "\r\n";
- }
-
- $request .= "Accept-Encoding:\r\n";
- $request .= "Connection: close\r\n";
- $request .= "\r\n";
-
- if ($proxy_host != '') {
- $fp = @fsockopen($proxy_host, $proxy_port, $errno, $errstr, 15);
- if (!$fp) {
- return PEAR::raiseError("Connection to `$proxy_host:$proxy_port' failed: $errstr", -9276);
- }
- } else {
- if ($schema === 'https') {
- $host = 'ssl://' . $host;
- }
-
- $fp = @fsockopen($host, $port, $errno, $errstr);
- if (!$fp) {
- return PEAR::raiseError("Connection to `$host:$port' failed: $errstr", $errno);
- }
- }
-
- fwrite($fp, $request);
-
- $headers = array();
- $reply = 0;
- while ($line = trim(fgets($fp, 1024))) {
- if (preg_match('/^([^:]+):\s+(.*)\s*\\z/', $line, $matches)) {
- $headers[strtolower($matches[1])] = trim($matches[2]);
- } elseif (preg_match('|^HTTP/1.[01] ([0-9]{3}) |', $line, $matches)) {
- $reply = (int)$matches[1];
- if ($reply == 304 && ($lastmodified || ($lastmodified === false))) {
- return false;
- }
-
- if (!in_array($reply, array(200, 301, 302, 303, 305, 307))) {
- return PEAR::raiseError("File $schema://$host:$port$path not valid (received: $line)");
- }
- }
- }
-
- if ($reply != 200) {
- if (!isset($headers['location'])) {
- return PEAR::raiseError("File $schema://$host:$port$path not valid (redirected but no location)");
- }
-
- if ($wasredirect > 4) {
- return PEAR::raiseError("File $schema://$host:$port$path not valid (redirection looped more than 5 times)");
- }
-
- $redirect = $wasredirect + 1;
- return $this->downloadHttp($headers['location'], $lastmodified, $accept, $channel);
- }
-
- $length = isset($headers['content-length']) ? $headers['content-length'] : -1;
-
- $data = '';
- while ($chunk = @fread($fp, 8192)) {
- $data .= $chunk;
- }
- fclose($fp);
-
- if ($lastmodified === false || $lastmodified) {
- if (isset($headers['etag'])) {
- $lastmodified = array('ETag' => $headers['etag']);
- }
-
- if (isset($headers['last-modified'])) {
- if (is_array($lastmodified)) {
- $lastmodified['Last-Modified'] = $headers['last-modified'];
- } else {
- $lastmodified = $headers['last-modified'];
- }
- }
-
- return array($data, $lastmodified, $headers);
- }
-
- return $data;
- }
-} \ No newline at end of file
diff --git a/3rdparty/PEAR/REST/10.php b/3rdparty/PEAR/REST/10.php
deleted file mode 100644
index 6ded7aeace3..00000000000
--- a/3rdparty/PEAR/REST/10.php
+++ /dev/null
@@ -1,871 +0,0 @@
-<?php
-/**
- * PEAR_REST_10
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: 10.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a12
- */
-
-/**
- * For downloading REST xml/txt files
- */
-require_once 'PEAR/REST.php';
-
-/**
- * Implement REST 1.0
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a12
- */
-class PEAR_REST_10
-{
- /**
- * @var PEAR_REST
- */
- var $_rest;
- function PEAR_REST_10($config, $options = array())
- {
- $this->_rest = &new PEAR_REST($config, $options);
- }
-
- /**
- * Retrieve information about a remote package to be downloaded from a REST server
- *
- * @param string $base The uri to prepend to all REST calls
- * @param array $packageinfo an array of format:
- * <pre>
- * array(
- * 'package' => 'packagename',
- * 'channel' => 'channelname',
- * ['state' => 'alpha' (or valid state),]
- * -or-
- * ['version' => '1.whatever']
- * </pre>
- * @param string $prefstate Current preferred_state config variable value
- * @param bool $installed the installed version of this package to compare against
- * @return array|false|PEAR_Error see {@link _returnDownloadURL()}
- */
- function getDownloadURL($base, $packageinfo, $prefstate, $installed, $channel = false)
- {
- $states = $this->betterStates($prefstate, true);
- if (!$states) {
- return PEAR::raiseError('"' . $prefstate . '" is not a valid state');
- }
-
- $channel = $packageinfo['channel'];
- $package = $packageinfo['package'];
- $state = isset($packageinfo['state']) ? $packageinfo['state'] : null;
- $version = isset($packageinfo['version']) ? $packageinfo['version'] : null;
- $restFile = $base . 'r/' . strtolower($package) . '/allreleases.xml';
-
- $info = $this->_rest->retrieveData($restFile, false, false, $channel);
- if (PEAR::isError($info)) {
- return PEAR::raiseError('No releases available for package "' .
- $channel . '/' . $package . '"');
- }
-
- if (!isset($info['r'])) {
- return false;
- }
-
- $release = $found = false;
- if (!is_array($info['r']) || !isset($info['r'][0])) {
- $info['r'] = array($info['r']);
- }
-
- foreach ($info['r'] as $release) {
- if (!isset($this->_rest->_options['force']) && ($installed &&
- version_compare($release['v'], $installed, '<'))) {
- continue;
- }
-
- if (isset($state)) {
- // try our preferred state first
- if ($release['s'] == $state) {
- $found = true;
- break;
- }
- // see if there is something newer and more stable
- // bug #7221
- if (in_array($release['s'], $this->betterStates($state), true)) {
- $found = true;
- break;
- }
- } elseif (isset($version)) {
- if ($release['v'] == $version) {
- $found = true;
- break;
- }
- } else {
- if (in_array($release['s'], $states)) {
- $found = true;
- break;
- }
- }
- }
-
- return $this->_returnDownloadURL($base, $package, $release, $info, $found, false, $channel);
- }
-
- function getDepDownloadURL($base, $xsdversion, $dependency, $deppackage,
- $prefstate = 'stable', $installed = false, $channel = false)
- {
- $states = $this->betterStates($prefstate, true);
- if (!$states) {
- return PEAR::raiseError('"' . $prefstate . '" is not a valid state');
- }
-
- $channel = $dependency['channel'];
- $package = $dependency['name'];
- $state = isset($dependency['state']) ? $dependency['state'] : null;
- $version = isset($dependency['version']) ? $dependency['version'] : null;
- $restFile = $base . 'r/' . strtolower($package) . '/allreleases.xml';
-
- $info = $this->_rest->retrieveData($restFile, false, false, $channel);
- if (PEAR::isError($info)) {
- return PEAR::raiseError('Package "' . $deppackage['channel'] . '/' . $deppackage['package']
- . '" dependency "' . $channel . '/' . $package . '" has no releases');
- }
-
- if (!is_array($info) || !isset($info['r'])) {
- return false;
- }
-
- $exclude = array();
- $min = $max = $recommended = false;
- if ($xsdversion == '1.0') {
- switch ($dependency['rel']) {
- case 'ge' :
- $min = $dependency['version'];
- break;
- case 'gt' :
- $min = $dependency['version'];
- $exclude = array($dependency['version']);
- break;
- case 'eq' :
- $recommended = $dependency['version'];
- break;
- case 'lt' :
- $max = $dependency['version'];
- $exclude = array($dependency['version']);
- break;
- case 'le' :
- $max = $dependency['version'];
- break;
- case 'ne' :
- $exclude = array($dependency['version']);
- break;
- }
- } else {
- $min = isset($dependency['min']) ? $dependency['min'] : false;
- $max = isset($dependency['max']) ? $dependency['max'] : false;
- $recommended = isset($dependency['recommended']) ?
- $dependency['recommended'] : false;
- if (isset($dependency['exclude'])) {
- if (!isset($dependency['exclude'][0])) {
- $exclude = array($dependency['exclude']);
- }
- }
- }
- $release = $found = false;
- if (!is_array($info['r']) || !isset($info['r'][0])) {
- $info['r'] = array($info['r']);
- }
- foreach ($info['r'] as $release) {
- if (!isset($this->_rest->_options['force']) && ($installed &&
- version_compare($release['v'], $installed, '<'))) {
- continue;
- }
- if (in_array($release['v'], $exclude)) { // skip excluded versions
- continue;
- }
- // allow newer releases to say "I'm OK with the dependent package"
- if ($xsdversion == '2.0' && isset($release['co'])) {
- if (!is_array($release['co']) || !isset($release['co'][0])) {
- $release['co'] = array($release['co']);
- }
- foreach ($release['co'] as $entry) {
- if (isset($entry['x']) && !is_array($entry['x'])) {
- $entry['x'] = array($entry['x']);
- } elseif (!isset($entry['x'])) {
- $entry['x'] = array();
- }
- if ($entry['c'] == $deppackage['channel'] &&
- strtolower($entry['p']) == strtolower($deppackage['package']) &&
- version_compare($deppackage['version'], $entry['min'], '>=') &&
- version_compare($deppackage['version'], $entry['max'], '<=') &&
- !in_array($release['v'], $entry['x'])) {
- $recommended = $release['v'];
- break;
- }
- }
- }
- if ($recommended) {
- if ($release['v'] != $recommended) { // if we want a specific
- // version, then skip all others
- continue;
- } else {
- if (!in_array($release['s'], $states)) {
- // the stability is too low, but we must return the
- // recommended version if possible
- return $this->_returnDownloadURL($base, $package, $release, $info, true, false, $channel);
- }
- }
- }
- if ($min && version_compare($release['v'], $min, 'lt')) { // skip too old versions
- continue;
- }
- if ($max && version_compare($release['v'], $max, 'gt')) { // skip too new versions
- continue;
- }
- if ($installed && version_compare($release['v'], $installed, '<')) {
- continue;
- }
- if (in_array($release['s'], $states)) { // if in the preferred state...
- $found = true; // ... then use it
- break;
- }
- }
- return $this->_returnDownloadURL($base, $package, $release, $info, $found, false, $channel);
- }
-
- /**
- * Take raw data and return the array needed for processing a download URL
- *
- * @param string $base REST base uri
- * @param string $package Package name
- * @param array $release an array of format array('v' => version, 's' => state)
- * describing the release to download
- * @param array $info list of all releases as defined by allreleases.xml
- * @param bool|null $found determines whether the release was found or this is the next
- * best alternative. If null, then versions were skipped because
- * of PHP dependency
- * @return array|PEAR_Error
- * @access private
- */
- function _returnDownloadURL($base, $package, $release, $info, $found, $phpversion = false, $channel = false)
- {
- if (!$found) {
- $release = $info['r'][0];
- }
-
- $packageLower = strtolower($package);
- $pinfo = $this->_rest->retrieveCacheFirst($base . 'p/' . $packageLower . '/' .
- 'info.xml', false, false, $channel);
- if (PEAR::isError($pinfo)) {
- return PEAR::raiseError('Package "' . $package .
- '" does not have REST info xml available');
- }
-
- $releaseinfo = $this->_rest->retrieveCacheFirst($base . 'r/' . $packageLower . '/' .
- $release['v'] . '.xml', false, false, $channel);
- if (PEAR::isError($releaseinfo)) {
- return PEAR::raiseError('Package "' . $package . '" Version "' . $release['v'] .
- '" does not have REST xml available');
- }
-
- $packagexml = $this->_rest->retrieveCacheFirst($base . 'r/' . $packageLower . '/' .
- 'deps.' . $release['v'] . '.txt', false, true, $channel);
- if (PEAR::isError($packagexml)) {
- return PEAR::raiseError('Package "' . $package . '" Version "' . $release['v'] .
- '" does not have REST dependency information available');
- }
-
- $packagexml = unserialize($packagexml);
- if (!$packagexml) {
- $packagexml = array();
- }
-
- $allinfo = $this->_rest->retrieveData($base . 'r/' . $packageLower .
- '/allreleases.xml', false, false, $channel);
- if (PEAR::isError($allinfo)) {
- return $allinfo;
- }
-
- if (!is_array($allinfo['r']) || !isset($allinfo['r'][0])) {
- $allinfo['r'] = array($allinfo['r']);
- }
-
- $compatible = false;
- foreach ($allinfo['r'] as $release) {
- if ($release['v'] != $releaseinfo['v']) {
- continue;
- }
-
- if (!isset($release['co'])) {
- break;
- }
-
- $compatible = array();
- if (!is_array($release['co']) || !isset($release['co'][0])) {
- $release['co'] = array($release['co']);
- }
-
- foreach ($release['co'] as $entry) {
- $comp = array();
- $comp['name'] = $entry['p'];
- $comp['channel'] = $entry['c'];
- $comp['min'] = $entry['min'];
- $comp['max'] = $entry['max'];
- if (isset($entry['x']) && !is_array($entry['x'])) {
- $comp['exclude'] = $entry['x'];
- }
-
- $compatible[] = $comp;
- }
-
- if (count($compatible) == 1) {
- $compatible = $compatible[0];
- }
-
- break;
- }
-
- $deprecated = false;
- if (isset($pinfo['dc']) && isset($pinfo['dp'])) {
- if (is_array($pinfo['dp'])) {
- $deprecated = array('channel' => (string) $pinfo['dc'],
- 'package' => trim($pinfo['dp']['_content']));
- } else {
- $deprecated = array('channel' => (string) $pinfo['dc'],
- 'package' => trim($pinfo['dp']));
- }
- }
-
- $return = array(
- 'version' => $releaseinfo['v'],
- 'info' => $packagexml,
- 'package' => $releaseinfo['p']['_content'],
- 'stability' => $releaseinfo['st'],
- 'compatible' => $compatible,
- 'deprecated' => $deprecated,
- );
-
- if ($found) {
- $return['url'] = $releaseinfo['g'];
- return $return;
- }
-
- $return['php'] = $phpversion;
- return $return;
- }
-
- function listPackages($base, $channel = false)
- {
- $packagelist = $this->_rest->retrieveData($base . 'p/packages.xml', false, false, $channel);
- if (PEAR::isError($packagelist)) {
- return $packagelist;
- }
-
- if (!is_array($packagelist) || !isset($packagelist['p'])) {
- return array();
- }
-
- if (!is_array($packagelist['p'])) {
- $packagelist['p'] = array($packagelist['p']);
- }
-
- return $packagelist['p'];
- }
-
- /**
- * List all categories of a REST server
- *
- * @param string $base base URL of the server
- * @return array of categorynames
- */
- function listCategories($base, $channel = false)
- {
- $categories = array();
-
- // c/categories.xml does not exist;
- // check for every package its category manually
- // This is SLOOOWWWW : ///
- $packagelist = $this->_rest->retrieveData($base . 'p/packages.xml', false, false, $channel);
- if (PEAR::isError($packagelist)) {
- return $packagelist;
- }
-
- if (!is_array($packagelist) || !isset($packagelist['p'])) {
- $ret = array();
- return $ret;
- }
-
- if (!is_array($packagelist['p'])) {
- $packagelist['p'] = array($packagelist['p']);
- }
-
- PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
- foreach ($packagelist['p'] as $package) {
- $inf = $this->_rest->retrieveData($base . 'p/' . strtolower($package) . '/info.xml', false, false, $channel);
- if (PEAR::isError($inf)) {
- PEAR::popErrorHandling();
- return $inf;
- }
- $cat = $inf['ca']['_content'];
- if (!isset($categories[$cat])) {
- $categories[$cat] = $inf['ca'];
- }
- }
-
- return array_values($categories);
- }
-
- /**
- * List a category of a REST server
- *
- * @param string $base base URL of the server
- * @param string $category name of the category
- * @param boolean $info also download full package info
- * @return array of packagenames
- */
- function listCategory($base, $category, $info = false, $channel = false)
- {
- // gives '404 Not Found' error when category doesn't exist
- $packagelist = $this->_rest->retrieveData($base.'c/'.urlencode($category).'/packages.xml', false, false, $channel);
- if (PEAR::isError($packagelist)) {
- return $packagelist;
- }
-
- if (!is_array($packagelist) || !isset($packagelist['p'])) {
- return array();
- }
-
- if (!is_array($packagelist['p']) ||
- !isset($packagelist['p'][0])) { // only 1 pkg
- $packagelist = array($packagelist['p']);
- } else {
- $packagelist = $packagelist['p'];
- }
-
- if ($info == true) {
- // get individual package info
- PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
- foreach ($packagelist as $i => $packageitem) {
- $url = sprintf('%s'.'r/%s/latest.txt',
- $base,
- strtolower($packageitem['_content']));
- $version = $this->_rest->retrieveData($url, false, false, $channel);
- if (PEAR::isError($version)) {
- break; // skipit
- }
- $url = sprintf('%s'.'r/%s/%s.xml',
- $base,
- strtolower($packageitem['_content']),
- $version);
- $info = $this->_rest->retrieveData($url, false, false, $channel);
- if (PEAR::isError($info)) {
- break; // skipit
- }
- $packagelist[$i]['info'] = $info;
- }
- PEAR::popErrorHandling();
- }
-
- return $packagelist;
- }
-
-
- function listAll($base, $dostable, $basic = true, $searchpackage = false, $searchsummary = false, $channel = false)
- {
- $packagelist = $this->_rest->retrieveData($base . 'p/packages.xml', false, false, $channel);
- if (PEAR::isError($packagelist)) {
- return $packagelist;
- }
- if ($this->_rest->config->get('verbose') > 0) {
- $ui = &PEAR_Frontend::singleton();
- $ui->log('Retrieving data...0%', true);
- }
- $ret = array();
- if (!is_array($packagelist) || !isset($packagelist['p'])) {
- return $ret;
- }
- if (!is_array($packagelist['p'])) {
- $packagelist['p'] = array($packagelist['p']);
- }
-
- // only search-packagename = quicksearch !
- if ($searchpackage && (!$searchsummary || empty($searchpackage))) {
- $newpackagelist = array();
- foreach ($packagelist['p'] as $package) {
- if (!empty($searchpackage) && stristr($package, $searchpackage) !== false) {
- $newpackagelist[] = $package;
- }
- }
- $packagelist['p'] = $newpackagelist;
- }
- PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
- $next = .1;
- foreach ($packagelist['p'] as $progress => $package) {
- if ($this->_rest->config->get('verbose') > 0) {
- if ($progress / count($packagelist['p']) >= $next) {
- if ($next == .5) {
- $ui->log('50%', false);
- } else {
- $ui->log('.', false);
- }
- $next += .1;
- }
- }
-
- if ($basic) { // remote-list command
- if ($dostable) {
- $latest = $this->_rest->retrieveData($base . 'r/' . strtolower($package) .
- '/stable.txt', false, false, $channel);
- } else {
- $latest = $this->_rest->retrieveData($base . 'r/' . strtolower($package) .
- '/latest.txt', false, false, $channel);
- }
- if (PEAR::isError($latest)) {
- $latest = false;
- }
- $info = array('stable' => $latest);
- } else { // list-all command
- $inf = $this->_rest->retrieveData($base . 'p/' . strtolower($package) . '/info.xml', false, false, $channel);
- if (PEAR::isError($inf)) {
- PEAR::popErrorHandling();
- return $inf;
- }
- if ($searchpackage) {
- $found = (!empty($searchpackage) && stristr($package, $searchpackage) !== false);
- if (!$found && !(isset($searchsummary) && !empty($searchsummary)
- && (stristr($inf['s'], $searchsummary) !== false
- || stristr($inf['d'], $searchsummary) !== false)))
- {
- continue;
- };
- }
- $releases = $this->_rest->retrieveData($base . 'r/' . strtolower($package) .
- '/allreleases.xml', false, false, $channel);
- if (PEAR::isError($releases)) {
- continue;
- }
- if (!isset($releases['r'][0])) {
- $releases['r'] = array($releases['r']);
- }
- unset($latest);
- unset($unstable);
- unset($stable);
- unset($state);
- foreach ($releases['r'] as $release) {
- if (!isset($latest)) {
- if ($dostable && $release['s'] == 'stable') {
- $latest = $release['v'];
- $state = 'stable';
- }
- if (!$dostable) {
- $latest = $release['v'];
- $state = $release['s'];
- }
- }
- if (!isset($stable) && $release['s'] == 'stable') {
- $stable = $release['v'];
- if (!isset($unstable)) {
- $unstable = $stable;
- }
- }
- if (!isset($unstable) && $release['s'] != 'stable') {
- $latest = $unstable = $release['v'];
- $state = $release['s'];
- }
- if (isset($latest) && !isset($state)) {
- $state = $release['s'];
- }
- if (isset($latest) && isset($stable) && isset($unstable)) {
- break;
- }
- }
- $deps = array();
- if (!isset($unstable)) {
- $unstable = false;
- $state = 'stable';
- if (isset($stable)) {
- $latest = $unstable = $stable;
- }
- } else {
- $latest = $unstable;
- }
- if (!isset($latest)) {
- $latest = false;
- }
- if ($latest) {
- $d = $this->_rest->retrieveCacheFirst($base . 'r/' . strtolower($package) . '/deps.' .
- $latest . '.txt', false, false, $channel);
- if (!PEAR::isError($d)) {
- $d = unserialize($d);
- if ($d) {
- if (isset($d['required'])) {
- if (!class_exists('PEAR_PackageFile_v2')) {
- require_once 'PEAR/PackageFile/v2.php';
- }
- if (!isset($pf)) {
- $pf = new PEAR_PackageFile_v2;
- }
- $pf->setDeps($d);
- $tdeps = $pf->getDeps();
- } else {
- $tdeps = $d;
- }
- foreach ($tdeps as $dep) {
- if ($dep['type'] !== 'pkg') {
- continue;
- }
- $deps[] = $dep;
- }
- }
- }
- }
- if (!isset($stable)) {
- $stable = '-n/a-';
- }
- if (!$searchpackage) {
- $info = array('stable' => $latest, 'summary' => $inf['s'], 'description' =>
- $inf['d'], 'deps' => $deps, 'category' => $inf['ca']['_content'],
- 'unstable' => $unstable, 'state' => $state);
- } else {
- $info = array('stable' => $stable, 'summary' => $inf['s'], 'description' =>
- $inf['d'], 'deps' => $deps, 'category' => $inf['ca']['_content'],
- 'unstable' => $unstable, 'state' => $state);
- }
- }
- $ret[$package] = $info;
- }
- PEAR::popErrorHandling();
- return $ret;
- }
-
- function listLatestUpgrades($base, $pref_state, $installed, $channel, &$reg)
- {
- $packagelist = $this->_rest->retrieveData($base . 'p/packages.xml', false, false, $channel);
- if (PEAR::isError($packagelist)) {
- return $packagelist;
- }
-
- $ret = array();
- if (!is_array($packagelist) || !isset($packagelist['p'])) {
- return $ret;
- }
-
- if (!is_array($packagelist['p'])) {
- $packagelist['p'] = array($packagelist['p']);
- }
-
- foreach ($packagelist['p'] as $package) {
- if (!isset($installed[strtolower($package)])) {
- continue;
- }
-
- $inst_version = $reg->packageInfo($package, 'version', $channel);
- $inst_state = $reg->packageInfo($package, 'release_state', $channel);
- PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
- $info = $this->_rest->retrieveData($base . 'r/' . strtolower($package) .
- '/allreleases.xml', false, false, $channel);
- PEAR::popErrorHandling();
- if (PEAR::isError($info)) {
- continue; // no remote releases
- }
-
- if (!isset($info['r'])) {
- continue;
- }
-
- $release = $found = false;
- if (!is_array($info['r']) || !isset($info['r'][0])) {
- $info['r'] = array($info['r']);
- }
-
- // $info['r'] is sorted by version number
- usort($info['r'], array($this, '_sortReleasesByVersionNumber'));
- foreach ($info['r'] as $release) {
- if ($inst_version && version_compare($release['v'], $inst_version, '<=')) {
- // not newer than the one installed
- break;
- }
-
- // new version > installed version
- if (!$pref_state) {
- // every state is a good state
- $found = true;
- break;
- } else {
- $new_state = $release['s'];
- // if new state >= installed state: go
- if (in_array($new_state, $this->betterStates($inst_state, true))) {
- $found = true;
- break;
- } else {
- // only allow to lower the state of package,
- // if new state >= preferred state: go
- if (in_array($new_state, $this->betterStates($pref_state, true))) {
- $found = true;
- break;
- }
- }
- }
- }
-
- if (!$found) {
- continue;
- }
-
- $relinfo = $this->_rest->retrieveCacheFirst($base . 'r/' . strtolower($package) . '/' .
- $release['v'] . '.xml', false, false, $channel);
- if (PEAR::isError($relinfo)) {
- return $relinfo;
- }
-
- $ret[$package] = array(
- 'version' => $release['v'],
- 'state' => $release['s'],
- 'filesize' => $relinfo['f'],
- );
- }
-
- return $ret;
- }
-
- function packageInfo($base, $package, $channel = false)
- {
- PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
- $pinfo = $this->_rest->retrieveData($base . 'p/' . strtolower($package) . '/info.xml', false, false, $channel);
- if (PEAR::isError($pinfo)) {
- PEAR::popErrorHandling();
- return PEAR::raiseError('Unknown package: "' . $package . '" in channel "' . $channel . '"' . "\n". 'Debug: ' .
- $pinfo->getMessage());
- }
-
- $releases = array();
- $allreleases = $this->_rest->retrieveData($base . 'r/' . strtolower($package) .
- '/allreleases.xml', false, false, $channel);
- if (!PEAR::isError($allreleases)) {
- if (!class_exists('PEAR_PackageFile_v2')) {
- require_once 'PEAR/PackageFile/v2.php';
- }
-
- if (!is_array($allreleases['r']) || !isset($allreleases['r'][0])) {
- $allreleases['r'] = array($allreleases['r']);
- }
-
- $pf = new PEAR_PackageFile_v2;
- foreach ($allreleases['r'] as $release) {
- $ds = $this->_rest->retrieveCacheFirst($base . 'r/' . strtolower($package) . '/deps.' .
- $release['v'] . '.txt', false, false, $channel);
- if (PEAR::isError($ds)) {
- continue;
- }
-
- if (!isset($latest)) {
- $latest = $release['v'];
- }
-
- $pf->setDeps(unserialize($ds));
- $ds = $pf->getDeps();
- $info = $this->_rest->retrieveCacheFirst($base . 'r/' . strtolower($package)
- . '/' . $release['v'] . '.xml', false, false, $channel);
-
- if (PEAR::isError($info)) {
- continue;
- }
-
- $releases[$release['v']] = array(
- 'doneby' => $info['m'],
- 'license' => $info['l'],
- 'summary' => $info['s'],
- 'description' => $info['d'],
- 'releasedate' => $info['da'],
- 'releasenotes' => $info['n'],
- 'state' => $release['s'],
- 'deps' => $ds ? $ds : array(),
- );
- }
- } else {
- $latest = '';
- }
-
- PEAR::popErrorHandling();
- if (isset($pinfo['dc']) && isset($pinfo['dp'])) {
- if (is_array($pinfo['dp'])) {
- $deprecated = array('channel' => (string) $pinfo['dc'],
- 'package' => trim($pinfo['dp']['_content']));
- } else {
- $deprecated = array('channel' => (string) $pinfo['dc'],
- 'package' => trim($pinfo['dp']));
- }
- } else {
- $deprecated = false;
- }
-
- if (!isset($latest)) {
- $latest = '';
- }
-
- return array(
- 'name' => $pinfo['n'],
- 'channel' => $pinfo['c'],
- 'category' => $pinfo['ca']['_content'],
- 'stable' => $latest,
- 'license' => $pinfo['l'],
- 'summary' => $pinfo['s'],
- 'description' => $pinfo['d'],
- 'releases' => $releases,
- 'deprecated' => $deprecated,
- );
- }
-
- /**
- * Return an array containing all of the states that are more stable than
- * or equal to the passed in state
- *
- * @param string Release state
- * @param boolean Determines whether to include $state in the list
- * @return false|array False if $state is not a valid release state
- */
- function betterStates($state, $include = false)
- {
- static $states = array('snapshot', 'devel', 'alpha', 'beta', 'stable');
- $i = array_search($state, $states);
- if ($i === false) {
- return false;
- }
-
- if ($include) {
- $i--;
- }
-
- return array_slice($states, $i + 1);
- }
-
- /**
- * Sort releases by version number
- *
- * @access private
- */
- function _sortReleasesByVersionNumber($a, $b)
- {
- if (version_compare($a['v'], $b['v'], '=')) {
- return 0;
- }
-
- if (version_compare($a['v'], $b['v'], '>')) {
- return -1;
- }
-
- if (version_compare($a['v'], $b['v'], '<')) {
- return 1;
- }
- }
-} \ No newline at end of file
diff --git a/3rdparty/PEAR/REST/11.php b/3rdparty/PEAR/REST/11.php
deleted file mode 100644
index 831cfccdb75..00000000000
--- a/3rdparty/PEAR/REST/11.php
+++ /dev/null
@@ -1,341 +0,0 @@
-<?php
-/**
- * PEAR_REST_11 - implement faster list-all/remote-list command
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: 11.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.3
- */
-
-/**
- * For downloading REST xml/txt files
- */
-require_once 'PEAR/REST.php';
-
-/**
- * Implement REST 1.1
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.3
- */
-class PEAR_REST_11
-{
- /**
- * @var PEAR_REST
- */
- var $_rest;
-
- function PEAR_REST_11($config, $options = array())
- {
- $this->_rest = &new PEAR_REST($config, $options);
- }
-
- function listAll($base, $dostable, $basic = true, $searchpackage = false, $searchsummary = false, $channel = false)
- {
- $categorylist = $this->_rest->retrieveData($base . 'c/categories.xml', false, false, $channel);
- if (PEAR::isError($categorylist)) {
- return $categorylist;
- }
-
- $ret = array();
- if (!is_array($categorylist['c']) || !isset($categorylist['c'][0])) {
- $categorylist['c'] = array($categorylist['c']);
- }
-
- PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
-
- foreach ($categorylist['c'] as $progress => $category) {
- $category = $category['_content'];
- $packagesinfo = $this->_rest->retrieveData($base .
- 'c/' . urlencode($category) . '/packagesinfo.xml', false, false, $channel);
-
- if (PEAR::isError($packagesinfo)) {
- continue;
- }
-
- if (!is_array($packagesinfo) || !isset($packagesinfo['pi'])) {
- continue;
- }
-
- if (!is_array($packagesinfo['pi']) || !isset($packagesinfo['pi'][0])) {
- $packagesinfo['pi'] = array($packagesinfo['pi']);
- }
-
- foreach ($packagesinfo['pi'] as $packageinfo) {
- if (empty($packageinfo)) {
- continue;
- }
-
- $info = $packageinfo['p'];
- $package = $info['n'];
- $releases = isset($packageinfo['a']) ? $packageinfo['a'] : false;
- unset($latest);
- unset($unstable);
- unset($stable);
- unset($state);
-
- if ($releases) {
- if (!isset($releases['r'][0])) {
- $releases['r'] = array($releases['r']);
- }
-
- foreach ($releases['r'] as $release) {
- if (!isset($latest)) {
- if ($dostable && $release['s'] == 'stable') {
- $latest = $release['v'];
- $state = 'stable';
- }
- if (!$dostable) {
- $latest = $release['v'];
- $state = $release['s'];
- }
- }
-
- if (!isset($stable) && $release['s'] == 'stable') {
- $stable = $release['v'];
- if (!isset($unstable)) {
- $unstable = $stable;
- }
- }
-
- if (!isset($unstable) && $release['s'] != 'stable') {
- $unstable = $release['v'];
- $state = $release['s'];
- }
-
- if (isset($latest) && !isset($state)) {
- $state = $release['s'];
- }
-
- if (isset($latest) && isset($stable) && isset($unstable)) {
- break;
- }
- }
- }
-
- if ($basic) { // remote-list command
- if (!isset($latest)) {
- $latest = false;
- }
-
- if ($dostable) {
- // $state is not set if there are no releases
- if (isset($state) && $state == 'stable') {
- $ret[$package] = array('stable' => $latest);
- } else {
- $ret[$package] = array('stable' => '-n/a-');
- }
- } else {
- $ret[$package] = array('stable' => $latest);
- }
-
- continue;
- }
-
- // list-all command
- if (!isset($unstable)) {
- $unstable = false;
- $state = 'stable';
- if (isset($stable)) {
- $latest = $unstable = $stable;
- }
- } else {
- $latest = $unstable;
- }
-
- if (!isset($latest)) {
- $latest = false;
- }
-
- $deps = array();
- if ($latest && isset($packageinfo['deps'])) {
- if (!is_array($packageinfo['deps']) ||
- !isset($packageinfo['deps'][0])
- ) {
- $packageinfo['deps'] = array($packageinfo['deps']);
- }
-
- $d = false;
- foreach ($packageinfo['deps'] as $dep) {
- if ($dep['v'] == $latest) {
- $d = unserialize($dep['d']);
- }
- }
-
- if ($d) {
- if (isset($d['required'])) {
- if (!class_exists('PEAR_PackageFile_v2')) {
- require_once 'PEAR/PackageFile/v2.php';
- }
-
- if (!isset($pf)) {
- $pf = new PEAR_PackageFile_v2;
- }
-
- $pf->setDeps($d);
- $tdeps = $pf->getDeps();
- } else {
- $tdeps = $d;
- }
-
- foreach ($tdeps as $dep) {
- if ($dep['type'] !== 'pkg') {
- continue;
- }
-
- $deps[] = $dep;
- }
- }
- }
-
- $info = array(
- 'stable' => $latest,
- 'summary' => $info['s'],
- 'description' => $info['d'],
- 'deps' => $deps,
- 'category' => $info['ca']['_content'],
- 'unstable' => $unstable,
- 'state' => $state
- );
- $ret[$package] = $info;
- }
- }
-
- PEAR::popErrorHandling();
- return $ret;
- }
-
- /**
- * List all categories of a REST server
- *
- * @param string $base base URL of the server
- * @return array of categorynames
- */
- function listCategories($base, $channel = false)
- {
- $categorylist = $this->_rest->retrieveData($base . 'c/categories.xml', false, false, $channel);
- if (PEAR::isError($categorylist)) {
- return $categorylist;
- }
-
- if (!is_array($categorylist) || !isset($categorylist['c'])) {
- return array();
- }
-
- if (isset($categorylist['c']['_content'])) {
- // only 1 category
- $categorylist['c'] = array($categorylist['c']);
- }
-
- return $categorylist['c'];
- }
-
- /**
- * List packages in a category of a REST server
- *
- * @param string $base base URL of the server
- * @param string $category name of the category
- * @param boolean $info also download full package info
- * @return array of packagenames
- */
- function listCategory($base, $category, $info = false, $channel = false)
- {
- if ($info == false) {
- $url = '%s'.'c/%s/packages.xml';
- } else {
- $url = '%s'.'c/%s/packagesinfo.xml';
- }
- $url = sprintf($url,
- $base,
- urlencode($category));
-
- // gives '404 Not Found' error when category doesn't exist
- $packagelist = $this->_rest->retrieveData($url, false, false, $channel);
- if (PEAR::isError($packagelist)) {
- return $packagelist;
- }
- if (!is_array($packagelist)) {
- return array();
- }
-
- if ($info == false) {
- if (!isset($packagelist['p'])) {
- return array();
- }
- if (!is_array($packagelist['p']) ||
- !isset($packagelist['p'][0])) { // only 1 pkg
- $packagelist = array($packagelist['p']);
- } else {
- $packagelist = $packagelist['p'];
- }
- return $packagelist;
- }
-
- // info == true
- if (!isset($packagelist['pi'])) {
- return array();
- }
-
- if (!is_array($packagelist['pi']) ||
- !isset($packagelist['pi'][0])) { // only 1 pkg
- $packagelist_pre = array($packagelist['pi']);
- } else {
- $packagelist_pre = $packagelist['pi'];
- }
-
- $packagelist = array();
- foreach ($packagelist_pre as $i => $item) {
- // compatibility with r/<latest.txt>.xml
- if (isset($item['a']['r'][0])) {
- // multiple releases
- $item['p']['v'] = $item['a']['r'][0]['v'];
- $item['p']['st'] = $item['a']['r'][0]['s'];
- } elseif (isset($item['a'])) {
- // first and only release
- $item['p']['v'] = $item['a']['r']['v'];
- $item['p']['st'] = $item['a']['r']['s'];
- }
-
- $packagelist[$i] = array('attribs' => $item['p']['r'],
- '_content' => $item['p']['n'],
- 'info' => $item['p']);
- }
-
- return $packagelist;
- }
-
- /**
- * Return an array containing all of the states that are more stable than
- * or equal to the passed in state
- *
- * @param string Release state
- * @param boolean Determines whether to include $state in the list
- * @return false|array False if $state is not a valid release state
- */
- function betterStates($state, $include = false)
- {
- static $states = array('snapshot', 'devel', 'alpha', 'beta', 'stable');
- $i = array_search($state, $states);
- if ($i === false) {
- return false;
- }
- if ($include) {
- $i--;
- }
- return array_slice($states, $i + 1);
- }
-}
-?> \ No newline at end of file
diff --git a/3rdparty/PEAR/REST/13.php b/3rdparty/PEAR/REST/13.php
deleted file mode 100644
index 722ae0de30f..00000000000
--- a/3rdparty/PEAR/REST/13.php
+++ /dev/null
@@ -1,299 +0,0 @@
-<?php
-/**
- * PEAR_REST_13
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: 13.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a12
- */
-
-/**
- * For downloading REST xml/txt files
- */
-require_once 'PEAR/REST.php';
-require_once 'PEAR/REST/10.php';
-
-/**
- * Implement REST 1.3
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a12
- */
-class PEAR_REST_13 extends PEAR_REST_10
-{
- /**
- * Retrieve information about a remote package to be downloaded from a REST server
- *
- * This is smart enough to resolve the minimum PHP version dependency prior to download
- * @param string $base The uri to prepend to all REST calls
- * @param array $packageinfo an array of format:
- * <pre>
- * array(
- * 'package' => 'packagename',
- * 'channel' => 'channelname',
- * ['state' => 'alpha' (or valid state),]
- * -or-
- * ['version' => '1.whatever']
- * </pre>
- * @param string $prefstate Current preferred_state config variable value
- * @param bool $installed the installed version of this package to compare against
- * @return array|false|PEAR_Error see {@link _returnDownloadURL()}
- */
- function getDownloadURL($base, $packageinfo, $prefstate, $installed, $channel = false)
- {
- $states = $this->betterStates($prefstate, true);
- if (!$states) {
- return PEAR::raiseError('"' . $prefstate . '" is not a valid state');
- }
-
- $channel = $packageinfo['channel'];
- $package = $packageinfo['package'];
- $state = isset($packageinfo['state']) ? $packageinfo['state'] : null;
- $version = isset($packageinfo['version']) ? $packageinfo['version'] : null;
- $restFile = $base . 'r/' . strtolower($package) . '/allreleases2.xml';
-
- $info = $this->_rest->retrieveData($restFile, false, false, $channel);
- if (PEAR::isError($info)) {
- return PEAR::raiseError('No releases available for package "' .
- $channel . '/' . $package . '"');
- }
-
- if (!isset($info['r'])) {
- return false;
- }
-
- $release = $found = false;
- if (!is_array($info['r']) || !isset($info['r'][0])) {
- $info['r'] = array($info['r']);
- }
-
- $skippedphp = false;
- foreach ($info['r'] as $release) {
- if (!isset($this->_rest->_options['force']) && ($installed &&
- version_compare($release['v'], $installed, '<'))) {
- continue;
- }
-
- if (isset($state)) {
- // try our preferred state first
- if ($release['s'] == $state) {
- if (!isset($version) && version_compare($release['m'], phpversion(), '>')) {
- // skip releases that require a PHP version newer than our PHP version
- $skippedphp = $release;
- continue;
- }
- $found = true;
- break;
- }
-
- // see if there is something newer and more stable
- // bug #7221
- if (in_array($release['s'], $this->betterStates($state), true)) {
- if (!isset($version) && version_compare($release['m'], phpversion(), '>')) {
- // skip releases that require a PHP version newer than our PHP version
- $skippedphp = $release;
- continue;
- }
- $found = true;
- break;
- }
- } elseif (isset($version)) {
- if ($release['v'] == $version) {
- if (!isset($this->_rest->_options['force']) &&
- !isset($version) &&
- version_compare($release['m'], phpversion(), '>')) {
- // skip releases that require a PHP version newer than our PHP version
- $skippedphp = $release;
- continue;
- }
- $found = true;
- break;
- }
- } else {
- if (in_array($release['s'], $states)) {
- if (version_compare($release['m'], phpversion(), '>')) {
- // skip releases that require a PHP version newer than our PHP version
- $skippedphp = $release;
- continue;
- }
- $found = true;
- break;
- }
- }
- }
-
- if (!$found && $skippedphp) {
- $found = null;
- }
-
- return $this->_returnDownloadURL($base, $package, $release, $info, $found, $skippedphp, $channel);
- }
-
- function getDepDownloadURL($base, $xsdversion, $dependency, $deppackage,
- $prefstate = 'stable', $installed = false, $channel = false)
- {
- $states = $this->betterStates($prefstate, true);
- if (!$states) {
- return PEAR::raiseError('"' . $prefstate . '" is not a valid state');
- }
-
- $channel = $dependency['channel'];
- $package = $dependency['name'];
- $state = isset($dependency['state']) ? $dependency['state'] : null;
- $version = isset($dependency['version']) ? $dependency['version'] : null;
- $restFile = $base . 'r/' . strtolower($package) .'/allreleases2.xml';
-
- $info = $this->_rest->retrieveData($restFile, false, false, $channel);
- if (PEAR::isError($info)) {
- return PEAR::raiseError('Package "' . $deppackage['channel'] . '/' . $deppackage['package']
- . '" dependency "' . $channel . '/' . $package . '" has no releases');
- }
-
- if (!is_array($info) || !isset($info['r'])) {
- return false;
- }
-
- $exclude = array();
- $min = $max = $recommended = false;
- if ($xsdversion == '1.0') {
- $pinfo['package'] = $dependency['name'];
- $pinfo['channel'] = 'pear.php.net'; // this is always true - don't change this
- switch ($dependency['rel']) {
- case 'ge' :
- $min = $dependency['version'];
- break;
- case 'gt' :
- $min = $dependency['version'];
- $exclude = array($dependency['version']);
- break;
- case 'eq' :
- $recommended = $dependency['version'];
- break;
- case 'lt' :
- $max = $dependency['version'];
- $exclude = array($dependency['version']);
- break;
- case 'le' :
- $max = $dependency['version'];
- break;
- case 'ne' :
- $exclude = array($dependency['version']);
- break;
- }
- } else {
- $pinfo['package'] = $dependency['name'];
- $min = isset($dependency['min']) ? $dependency['min'] : false;
- $max = isset($dependency['max']) ? $dependency['max'] : false;
- $recommended = isset($dependency['recommended']) ?
- $dependency['recommended'] : false;
- if (isset($dependency['exclude'])) {
- if (!isset($dependency['exclude'][0])) {
- $exclude = array($dependency['exclude']);
- }
- }
- }
-
- $skippedphp = $found = $release = false;
- if (!is_array($info['r']) || !isset($info['r'][0])) {
- $info['r'] = array($info['r']);
- }
-
- foreach ($info['r'] as $release) {
- if (!isset($this->_rest->_options['force']) && ($installed &&
- version_compare($release['v'], $installed, '<'))) {
- continue;
- }
-
- if (in_array($release['v'], $exclude)) { // skip excluded versions
- continue;
- }
-
- // allow newer releases to say "I'm OK with the dependent package"
- if ($xsdversion == '2.0' && isset($release['co'])) {
- if (!is_array($release['co']) || !isset($release['co'][0])) {
- $release['co'] = array($release['co']);
- }
-
- foreach ($release['co'] as $entry) {
- if (isset($entry['x']) && !is_array($entry['x'])) {
- $entry['x'] = array($entry['x']);
- } elseif (!isset($entry['x'])) {
- $entry['x'] = array();
- }
-
- if ($entry['c'] == $deppackage['channel'] &&
- strtolower($entry['p']) == strtolower($deppackage['package']) &&
- version_compare($deppackage['version'], $entry['min'], '>=') &&
- version_compare($deppackage['version'], $entry['max'], '<=') &&
- !in_array($release['v'], $entry['x'])) {
- if (version_compare($release['m'], phpversion(), '>')) {
- // skip dependency releases that require a PHP version
- // newer than our PHP version
- $skippedphp = $release;
- continue;
- }
-
- $recommended = $release['v'];
- break;
- }
- }
- }
-
- if ($recommended) {
- if ($release['v'] != $recommended) { // if we want a specific
- // version, then skip all others
- continue;
- }
-
- if (!in_array($release['s'], $states)) {
- // the stability is too low, but we must return the
- // recommended version if possible
- return $this->_returnDownloadURL($base, $package, $release, $info, true, false, $channel);
- }
- }
-
- if ($min && version_compare($release['v'], $min, 'lt')) { // skip too old versions
- continue;
- }
-
- if ($max && version_compare($release['v'], $max, 'gt')) { // skip too new versions
- continue;
- }
-
- if ($installed && version_compare($release['v'], $installed, '<')) {
- continue;
- }
-
- if (in_array($release['s'], $states)) { // if in the preferred state...
- if (version_compare($release['m'], phpversion(), '>')) {
- // skip dependency releases that require a PHP version
- // newer than our PHP version
- $skippedphp = $release;
- continue;
- }
-
- $found = true; // ... then use it
- break;
- }
- }
-
- if (!$found && $skippedphp) {
- $found = null;
- }
-
- return $this->_returnDownloadURL($base, $package, $release, $info, $found, $skippedphp, $channel);
- }
-} \ No newline at end of file
diff --git a/3rdparty/PEAR/Registry.php b/3rdparty/PEAR/Registry.php
deleted file mode 100644
index 35e17db4952..00000000000
--- a/3rdparty/PEAR/Registry.php
+++ /dev/null
@@ -1,2395 +0,0 @@
-<?php
-/**
- * PEAR_Registry
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Stig Bakken <ssb@php.net>
- * @author Tomas V. V. Cox <cox@idecnet.com>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Registry.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 0.1
- */
-
-/**
- * for PEAR_Error
- */
-require_once 'PEAR.php';
-require_once 'PEAR/DependencyDB.php';
-
-define('PEAR_REGISTRY_ERROR_LOCK', -2);
-define('PEAR_REGISTRY_ERROR_FORMAT', -3);
-define('PEAR_REGISTRY_ERROR_FILE', -4);
-define('PEAR_REGISTRY_ERROR_CONFLICT', -5);
-define('PEAR_REGISTRY_ERROR_CHANNEL_FILE', -6);
-
-/**
- * Administration class used to maintain the installed package database.
- * @category pear
- * @package PEAR
- * @author Stig Bakken <ssb@php.net>
- * @author Tomas V. V. Cox <cox@idecnet.com>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a1
- */
-class PEAR_Registry extends PEAR
-{
- /**
- * File containing all channel information.
- * @var string
- */
- var $channels = '';
-
- /** Directory where registry files are stored.
- * @var string
- */
- var $statedir = '';
-
- /** File where the file map is stored
- * @var string
- */
- var $filemap = '';
-
- /** Directory where registry files for channels are stored.
- * @var string
- */
- var $channelsdir = '';
-
- /** Name of file used for locking the registry
- * @var string
- */
- var $lockfile = '';
-
- /** File descriptor used during locking
- * @var resource
- */
- var $lock_fp = null;
-
- /** Mode used during locking
- * @var int
- */
- var $lock_mode = 0; // XXX UNUSED
-
- /** Cache of package information. Structure:
- * array(
- * 'package' => array('id' => ... ),
- * ... )
- * @var array
- */
- var $pkginfo_cache = array();
-
- /** Cache of file map. Structure:
- * array( '/path/to/file' => 'package', ... )
- * @var array
- */
- var $filemap_cache = array();
-
- /**
- * @var false|PEAR_ChannelFile
- */
- var $_pearChannel;
-
- /**
- * @var false|PEAR_ChannelFile
- */
- var $_peclChannel;
-
- /**
- * @var false|PEAR_ChannelFile
- */
- var $_docChannel;
-
- /**
- * @var PEAR_DependencyDB
- */
- var $_dependencyDB;
-
- /**
- * @var PEAR_Config
- */
- var $_config;
-
- /**
- * PEAR_Registry constructor.
- *
- * @param string (optional) PEAR install directory (for .php files)
- * @param PEAR_ChannelFile PEAR_ChannelFile object representing the PEAR channel, if
- * default values are not desired. Only used the very first time a PEAR
- * repository is initialized
- * @param PEAR_ChannelFile PEAR_ChannelFile object representing the PECL channel, if
- * default values are not desired. Only used the very first time a PEAR
- * repository is initialized
- *
- * @access public
- */
- function PEAR_Registry($pear_install_dir = PEAR_INSTALL_DIR, $pear_channel = false,
- $pecl_channel = false)
- {
- parent::PEAR();
- $this->setInstallDir($pear_install_dir);
- $this->_pearChannel = $pear_channel;
- $this->_peclChannel = $pecl_channel;
- $this->_config = false;
- }
-
- function setInstallDir($pear_install_dir = PEAR_INSTALL_DIR)
- {
- $ds = DIRECTORY_SEPARATOR;
- $this->install_dir = $pear_install_dir;
- $this->channelsdir = $pear_install_dir.$ds.'.channels';
- $this->statedir = $pear_install_dir.$ds.'.registry';
- $this->filemap = $pear_install_dir.$ds.'.filemap';
- $this->lockfile = $pear_install_dir.$ds.'.lock';
- }
-
- function hasWriteAccess()
- {
- if (!file_exists($this->install_dir)) {
- $dir = $this->install_dir;
- while ($dir && $dir != '.') {
- $olddir = $dir;
- $dir = dirname($dir);
- if ($dir != '.' && file_exists($dir)) {
- if (is_writeable($dir)) {
- return true;
- }
-
- return false;
- }
-
- if ($dir == $olddir) { // this can happen in safe mode
- return @is_writable($dir);
- }
- }
-
- return false;
- }
-
- return is_writeable($this->install_dir);
- }
-
- function setConfig(&$config, $resetInstallDir = true)
- {
- $this->_config = &$config;
- if ($resetInstallDir) {
- $this->setInstallDir($config->get('php_dir'));
- }
- }
-
- function _initializeChannelDirs()
- {
- static $running = false;
- if (!$running) {
- $running = true;
- $ds = DIRECTORY_SEPARATOR;
- if (!is_dir($this->channelsdir) ||
- !file_exists($this->channelsdir . $ds . 'pear.php.net.reg') ||
- !file_exists($this->channelsdir . $ds . 'pecl.php.net.reg') ||
- !file_exists($this->channelsdir . $ds . 'doc.php.net.reg') ||
- !file_exists($this->channelsdir . $ds . '__uri.reg')) {
- if (!file_exists($this->channelsdir . $ds . 'pear.php.net.reg')) {
- $pear_channel = $this->_pearChannel;
- if (!is_a($pear_channel, 'PEAR_ChannelFile') || !$pear_channel->validate()) {
- if (!class_exists('PEAR_ChannelFile')) {
- require_once 'PEAR/ChannelFile.php';
- }
-
- $pear_channel = new PEAR_ChannelFile;
- $pear_channel->setAlias('pear');
- $pear_channel->setServer('pear.php.net');
- $pear_channel->setSummary('PHP Extension and Application Repository');
- $pear_channel->setDefaultPEARProtocols();
- $pear_channel->setBaseURL('REST1.0', 'http://pear.php.net/rest/');
- $pear_channel->setBaseURL('REST1.1', 'http://pear.php.net/rest/');
- $pear_channel->setBaseURL('REST1.3', 'http://pear.php.net/rest/');
- //$pear_channel->setBaseURL('REST1.4', 'http://pear.php.net/rest/');
- } else {
- $pear_channel->setServer('pear.php.net');
- $pear_channel->setAlias('pear');
- }
-
- $pear_channel->validate();
- $this->_addChannel($pear_channel);
- }
-
- if (!file_exists($this->channelsdir . $ds . 'pecl.php.net.reg')) {
- $pecl_channel = $this->_peclChannel;
- if (!is_a($pecl_channel, 'PEAR_ChannelFile') || !$pecl_channel->validate()) {
- if (!class_exists('PEAR_ChannelFile')) {
- require_once 'PEAR/ChannelFile.php';
- }
-
- $pecl_channel = new PEAR_ChannelFile;
- $pecl_channel->setAlias('pecl');
- $pecl_channel->setServer('pecl.php.net');
- $pecl_channel->setSummary('PHP Extension Community Library');
- $pecl_channel->setDefaultPEARProtocols();
- $pecl_channel->setBaseURL('REST1.0', 'http://pecl.php.net/rest/');
- $pecl_channel->setBaseURL('REST1.1', 'http://pecl.php.net/rest/');
- $pecl_channel->setValidationPackage('PEAR_Validator_PECL', '1.0');
- } else {
- $pecl_channel->setServer('pecl.php.net');
- $pecl_channel->setAlias('pecl');
- }
-
- $pecl_channel->validate();
- $this->_addChannel($pecl_channel);
- }
-
- if (!file_exists($this->channelsdir . $ds . 'doc.php.net.reg')) {
- $doc_channel = $this->_docChannel;
- if (!is_a($doc_channel, 'PEAR_ChannelFile') || !$doc_channel->validate()) {
- if (!class_exists('PEAR_ChannelFile')) {
- require_once 'PEAR/ChannelFile.php';
- }
-
- $doc_channel = new PEAR_ChannelFile;
- $doc_channel->setAlias('phpdocs');
- $doc_channel->setServer('doc.php.net');
- $doc_channel->setSummary('PHP Documentation Team');
- $doc_channel->setDefaultPEARProtocols();
- $doc_channel->setBaseURL('REST1.0', 'http://doc.php.net/rest/');
- $doc_channel->setBaseURL('REST1.1', 'http://doc.php.net/rest/');
- $doc_channel->setBaseURL('REST1.3', 'http://doc.php.net/rest/');
- } else {
- $doc_channel->setServer('doc.php.net');
- $doc_channel->setAlias('doc');
- }
-
- $doc_channel->validate();
- $this->_addChannel($doc_channel);
- }
-
- if (!file_exists($this->channelsdir . $ds . '__uri.reg')) {
- if (!class_exists('PEAR_ChannelFile')) {
- require_once 'PEAR/ChannelFile.php';
- }
-
- $private = new PEAR_ChannelFile;
- $private->setName('__uri');
- $private->setDefaultPEARProtocols();
- $private->setBaseURL('REST1.0', '****');
- $private->setSummary('Pseudo-channel for static packages');
- $this->_addChannel($private);
- }
- $this->_rebuildFileMap();
- }
-
- $running = false;
- }
- }
-
- function _initializeDirs()
- {
- $ds = DIRECTORY_SEPARATOR;
- // XXX Compatibility code should be removed in the future
- // rename all registry files if any to lowercase
- if (!OS_WINDOWS && file_exists($this->statedir) && is_dir($this->statedir) &&
- $handle = opendir($this->statedir)) {
- $dest = $this->statedir . $ds;
- while (false !== ($file = readdir($handle))) {
- if (preg_match('/^.*[A-Z].*\.reg\\z/', $file)) {
- rename($dest . $file, $dest . strtolower($file));
- }
- }
- closedir($handle);
- }
-
- $this->_initializeChannelDirs();
- if (!file_exists($this->filemap)) {
- $this->_rebuildFileMap();
- }
- $this->_initializeDepDB();
- }
-
- function _initializeDepDB()
- {
- if (!isset($this->_dependencyDB)) {
- static $initializing = false;
- if (!$initializing) {
- $initializing = true;
- if (!$this->_config) { // never used?
- $file = OS_WINDOWS ? 'pear.ini' : '.pearrc';
- $this->_config = &new PEAR_Config($this->statedir . DIRECTORY_SEPARATOR .
- $file);
- $this->_config->setRegistry($this);
- $this->_config->set('php_dir', $this->install_dir);
- }
-
- $this->_dependencyDB = &PEAR_DependencyDB::singleton($this->_config);
- if (PEAR::isError($this->_dependencyDB)) {
- // attempt to recover by removing the dep db
- if (file_exists($this->_config->get('php_dir', null, 'pear.php.net') .
- DIRECTORY_SEPARATOR . '.depdb')) {
- @unlink($this->_config->get('php_dir', null, 'pear.php.net') .
- DIRECTORY_SEPARATOR . '.depdb');
- }
-
- $this->_dependencyDB = &PEAR_DependencyDB::singleton($this->_config);
- if (PEAR::isError($this->_dependencyDB)) {
- echo $this->_dependencyDB->getMessage();
- echo 'Unrecoverable error';
- exit(1);
- }
- }
-
- $initializing = false;
- }
- }
- }
-
- /**
- * PEAR_Registry destructor. Makes sure no locks are forgotten.
- *
- * @access private
- */
- function _PEAR_Registry()
- {
- parent::_PEAR();
- if (is_resource($this->lock_fp)) {
- $this->_unlock();
- }
- }
-
- /**
- * Make sure the directory where we keep registry files exists.
- *
- * @return bool TRUE if directory exists, FALSE if it could not be
- * created
- *
- * @access private
- */
- function _assertStateDir($channel = false)
- {
- if ($channel && $this->_getChannelFromAlias($channel) != 'pear.php.net') {
- return $this->_assertChannelStateDir($channel);
- }
-
- static $init = false;
- if (!file_exists($this->statedir)) {
- if (!$this->hasWriteAccess()) {
- return false;
- }
-
- require_once 'System.php';
- if (!System::mkdir(array('-p', $this->statedir))) {
- return $this->raiseError("could not create directory '{$this->statedir}'");
- }
- $init = true;
- } elseif (!is_dir($this->statedir)) {
- return $this->raiseError('Cannot create directory ' . $this->statedir . ', ' .
- 'it already exists and is not a directory');
- }
-
- $ds = DIRECTORY_SEPARATOR;
- if (!file_exists($this->channelsdir)) {
- if (!file_exists($this->channelsdir . $ds . 'pear.php.net.reg') ||
- !file_exists($this->channelsdir . $ds . 'pecl.php.net.reg') ||
- !file_exists($this->channelsdir . $ds . 'doc.php.net.reg') ||
- !file_exists($this->channelsdir . $ds . '__uri.reg')) {
- $init = true;
- }
- } elseif (!is_dir($this->channelsdir)) {
- return $this->raiseError('Cannot create directory ' . $this->channelsdir . ', ' .
- 'it already exists and is not a directory');
- }
-
- if ($init) {
- static $running = false;
- if (!$running) {
- $running = true;
- $this->_initializeDirs();
- $running = false;
- $init = false;
- }
- } else {
- $this->_initializeDepDB();
- }
-
- return true;
- }
-
- /**
- * Make sure the directory where we keep registry files exists for a non-standard channel.
- *
- * @param string channel name
- * @return bool TRUE if directory exists, FALSE if it could not be
- * created
- *
- * @access private
- */
- function _assertChannelStateDir($channel)
- {
- $ds = DIRECTORY_SEPARATOR;
- if (!$channel || $this->_getChannelFromAlias($channel) == 'pear.php.net') {
- if (!file_exists($this->channelsdir . $ds . 'pear.php.net.reg')) {
- $this->_initializeChannelDirs();
- }
- return $this->_assertStateDir($channel);
- }
-
- $channelDir = $this->_channelDirectoryName($channel);
- if (!is_dir($this->channelsdir) ||
- !file_exists($this->channelsdir . $ds . 'pear.php.net.reg')) {
- $this->_initializeChannelDirs();
- }
-
- if (!file_exists($channelDir)) {
- if (!$this->hasWriteAccess()) {
- return false;
- }
-
- require_once 'System.php';
- if (!System::mkdir(array('-p', $channelDir))) {
- return $this->raiseError("could not create directory '" . $channelDir .
- "'");
- }
- } elseif (!is_dir($channelDir)) {
- return $this->raiseError("could not create directory '" . $channelDir .
- "', already exists and is not a directory");
- }
-
- return true;
- }
-
- /**
- * Make sure the directory where we keep registry files for channels exists
- *
- * @return bool TRUE if directory exists, FALSE if it could not be
- * created
- *
- * @access private
- */
- function _assertChannelDir()
- {
- if (!file_exists($this->channelsdir)) {
- if (!$this->hasWriteAccess()) {
- return false;
- }
-
- require_once 'System.php';
- if (!System::mkdir(array('-p', $this->channelsdir))) {
- return $this->raiseError("could not create directory '{$this->channelsdir}'");
- }
- } elseif (!is_dir($this->channelsdir)) {
- return $this->raiseError("could not create directory '{$this->channelsdir}" .
- "', it already exists and is not a directory");
- }
-
- if (!file_exists($this->channelsdir . DIRECTORY_SEPARATOR . '.alias')) {
- if (!$this->hasWriteAccess()) {
- return false;
- }
-
- require_once 'System.php';
- if (!System::mkdir(array('-p', $this->channelsdir . DIRECTORY_SEPARATOR . '.alias'))) {
- return $this->raiseError("could not create directory '{$this->channelsdir}/.alias'");
- }
- } elseif (!is_dir($this->channelsdir . DIRECTORY_SEPARATOR . '.alias')) {
- return $this->raiseError("could not create directory '{$this->channelsdir}" .
- "/.alias', it already exists and is not a directory");
- }
-
- return true;
- }
-
- /**
- * Get the name of the file where data for a given package is stored.
- *
- * @param string channel name, or false if this is a PEAR package
- * @param string package name
- *
- * @return string registry file name
- *
- * @access public
- */
- function _packageFileName($package, $channel = false)
- {
- if ($channel && $this->_getChannelFromAlias($channel) != 'pear.php.net') {
- return $this->_channelDirectoryName($channel) . DIRECTORY_SEPARATOR .
- strtolower($package) . '.reg';
- }
-
- return $this->statedir . DIRECTORY_SEPARATOR . strtolower($package) . '.reg';
- }
-
- /**
- * Get the name of the file where data for a given channel is stored.
- * @param string channel name
- * @return string registry file name
- */
- function _channelFileName($channel, $noaliases = false)
- {
- if (!$noaliases) {
- if (file_exists($this->_getChannelAliasFileName($channel))) {
- $channel = implode('', file($this->_getChannelAliasFileName($channel)));
- }
- }
- return $this->channelsdir . DIRECTORY_SEPARATOR . str_replace('/', '_',
- strtolower($channel)) . '.reg';
- }
-
- /**
- * @param string
- * @return string
- */
- function _getChannelAliasFileName($alias)
- {
- return $this->channelsdir . DIRECTORY_SEPARATOR . '.alias' .
- DIRECTORY_SEPARATOR . str_replace('/', '_', strtolower($alias)) . '.txt';
- }
-
- /**
- * Get the name of a channel from its alias
- */
- function _getChannelFromAlias($channel)
- {
- if (!$this->_channelExists($channel)) {
- if ($channel == 'pear.php.net') {
- return 'pear.php.net';
- }
-
- if ($channel == 'pecl.php.net') {
- return 'pecl.php.net';
- }
-
- if ($channel == 'doc.php.net') {
- return 'doc.php.net';
- }
-
- if ($channel == '__uri') {
- return '__uri';
- }
-
- return false;
- }
-
- $channel = strtolower($channel);
- if (file_exists($this->_getChannelAliasFileName($channel))) {
- // translate an alias to an actual channel
- return implode('', file($this->_getChannelAliasFileName($channel)));
- }
-
- return $channel;
- }
-
- /**
- * Get the alias of a channel from its alias or its name
- */
- function _getAlias($channel)
- {
- if (!$this->_channelExists($channel)) {
- if ($channel == 'pear.php.net') {
- return 'pear';
- }
-
- if ($channel == 'pecl.php.net') {
- return 'pecl';
- }
-
- if ($channel == 'doc.php.net') {
- return 'phpdocs';
- }
-
- return false;
- }
-
- $channel = $this->_getChannel($channel);
- if (PEAR::isError($channel)) {
- return $channel;
- }
-
- return $channel->getAlias();
- }
-
- /**
- * Get the name of the file where data for a given package is stored.
- *
- * @param string channel name, or false if this is a PEAR package
- * @param string package name
- *
- * @return string registry file name
- *
- * @access public
- */
- function _channelDirectoryName($channel)
- {
- if (!$channel || $this->_getChannelFromAlias($channel) == 'pear.php.net') {
- return $this->statedir;
- }
-
- $ch = $this->_getChannelFromAlias($channel);
- if (!$ch) {
- $ch = $channel;
- }
-
- return $this->statedir . DIRECTORY_SEPARATOR . strtolower('.channel.' .
- str_replace('/', '_', $ch));
- }
-
- function _openPackageFile($package, $mode, $channel = false)
- {
- if (!$this->_assertStateDir($channel)) {
- return null;
- }
-
- if (!in_array($mode, array('r', 'rb')) && !$this->hasWriteAccess()) {
- return null;
- }
-
- $file = $this->_packageFileName($package, $channel);
- if (!file_exists($file) && $mode == 'r' || $mode == 'rb') {
- return null;
- }
-
- $fp = @fopen($file, $mode);
- if (!$fp) {
- return null;
- }
-
- return $fp;
- }
-
- function _closePackageFile($fp)
- {
- fclose($fp);
- }
-
- function _openChannelFile($channel, $mode)
- {
- if (!$this->_assertChannelDir()) {
- return null;
- }
-
- if (!in_array($mode, array('r', 'rb')) && !$this->hasWriteAccess()) {
- return null;
- }
-
- $file = $this->_channelFileName($channel);
- if (!file_exists($file) && $mode == 'r' || $mode == 'rb') {
- return null;
- }
-
- $fp = @fopen($file, $mode);
- if (!$fp) {
- return null;
- }
-
- return $fp;
- }
-
- function _closeChannelFile($fp)
- {
- fclose($fp);
- }
-
- function _rebuildFileMap()
- {
- if (!class_exists('PEAR_Installer_Role')) {
- require_once 'PEAR/Installer/Role.php';
- }
-
- $channels = $this->_listAllPackages();
- $files = array();
- foreach ($channels as $channel => $packages) {
- foreach ($packages as $package) {
- $version = $this->_packageInfo($package, 'version', $channel);
- $filelist = $this->_packageInfo($package, 'filelist', $channel);
- if (!is_array($filelist)) {
- continue;
- }
-
- foreach ($filelist as $name => $attrs) {
- if (isset($attrs['attribs'])) {
- $attrs = $attrs['attribs'];
- }
-
- // it is possible for conflicting packages in different channels to
- // conflict with data files/doc files
- if ($name == 'dirtree') {
- continue;
- }
-
- if (isset($attrs['role']) && !in_array($attrs['role'],
- PEAR_Installer_Role::getInstallableRoles())) {
- // these are not installed
- continue;
- }
-
- if (isset($attrs['role']) && !in_array($attrs['role'],
- PEAR_Installer_Role::getBaseinstallRoles())) {
- $attrs['baseinstalldir'] = $package;
- }
-
- if (isset($attrs['baseinstalldir'])) {
- $file = $attrs['baseinstalldir'].DIRECTORY_SEPARATOR.$name;
- } else {
- $file = $name;
- }
-
- $file = preg_replace(',^/+,', '', $file);
- if ($channel != 'pear.php.net') {
- if (!isset($files[$attrs['role']])) {
- $files[$attrs['role']] = array();
- }
- $files[$attrs['role']][$file] = array(strtolower($channel),
- strtolower($package));
- } else {
- if (!isset($files[$attrs['role']])) {
- $files[$attrs['role']] = array();
- }
- $files[$attrs['role']][$file] = strtolower($package);
- }
- }
- }
- }
-
-
- $this->_assertStateDir();
- if (!$this->hasWriteAccess()) {
- return false;
- }
-
- $fp = @fopen($this->filemap, 'wb');
- if (!$fp) {
- return false;
- }
-
- $this->filemap_cache = $files;
- fwrite($fp, serialize($files));
- fclose($fp);
- return true;
- }
-
- function _readFileMap()
- {
- if (!file_exists($this->filemap)) {
- return array();
- }
-
- $fp = @fopen($this->filemap, 'r');
- if (!$fp) {
- return $this->raiseError('PEAR_Registry: could not open filemap "' . $this->filemap . '"', PEAR_REGISTRY_ERROR_FILE, null, null, $php_errormsg);
- }
-
- clearstatcache();
- $rt = get_magic_quotes_runtime();
- set_magic_quotes_runtime(0);
- $fsize = filesize($this->filemap);
- fclose($fp);
- $data = file_get_contents($this->filemap);
- set_magic_quotes_runtime($rt);
- $tmp = unserialize($data);
- if (!$tmp && $fsize > 7) {
- return $this->raiseError('PEAR_Registry: invalid filemap data', PEAR_REGISTRY_ERROR_FORMAT, null, null, $data);
- }
-
- $this->filemap_cache = $tmp;
- return true;
- }
-
- /**
- * Lock the registry.
- *
- * @param integer lock mode, one of LOCK_EX, LOCK_SH or LOCK_UN.
- * See flock manual for more information.
- *
- * @return bool TRUE on success, FALSE if locking failed, or a
- * PEAR error if some other error occurs (such as the
- * lock file not being writable).
- *
- * @access private
- */
- function _lock($mode = LOCK_EX)
- {
- if (stristr(php_uname(), 'Windows 9')) {
- return true;
- }
-
- if ($mode != LOCK_UN && is_resource($this->lock_fp)) {
- // XXX does not check type of lock (LOCK_SH/LOCK_EX)
- return true;
- }
-
- if (!$this->_assertStateDir()) {
- if ($mode == LOCK_EX) {
- return $this->raiseError('Registry directory is not writeable by the current user');
- }
-
- return true;
- }
-
- $open_mode = 'w';
- // XXX People reported problems with LOCK_SH and 'w'
- if ($mode === LOCK_SH || $mode === LOCK_UN) {
- if (!file_exists($this->lockfile)) {
- touch($this->lockfile);
- }
- $open_mode = 'r';
- }
-
- if (!is_resource($this->lock_fp)) {
- $this->lock_fp = @fopen($this->lockfile, $open_mode);
- }
-
- if (!is_resource($this->lock_fp)) {
- $this->lock_fp = null;
- return $this->raiseError("could not create lock file" .
- (isset($php_errormsg) ? ": " . $php_errormsg : ""));
- }
-
- if (!(int)flock($this->lock_fp, $mode)) {
- switch ($mode) {
- case LOCK_SH: $str = 'shared'; break;
- case LOCK_EX: $str = 'exclusive'; break;
- case LOCK_UN: $str = 'unlock'; break;
- default: $str = 'unknown'; break;
- }
-
- //is resource at this point, close it on error.
- fclose($this->lock_fp);
- $this->lock_fp = null;
- return $this->raiseError("could not acquire $str lock ($this->lockfile)",
- PEAR_REGISTRY_ERROR_LOCK);
- }
-
- return true;
- }
-
- function _unlock()
- {
- $ret = $this->_lock(LOCK_UN);
- if (is_resource($this->lock_fp)) {
- fclose($this->lock_fp);
- }
-
- $this->lock_fp = null;
- return $ret;
- }
-
- function _packageExists($package, $channel = false)
- {
- return file_exists($this->_packageFileName($package, $channel));
- }
-
- /**
- * Determine whether a channel exists in the registry
- *
- * @param string Channel name
- * @param bool if true, then aliases will be ignored
- * @return boolean
- */
- function _channelExists($channel, $noaliases = false)
- {
- $a = file_exists($this->_channelFileName($channel, $noaliases));
- if (!$a && $channel == 'pear.php.net') {
- return true;
- }
-
- if (!$a && $channel == 'pecl.php.net') {
- return true;
- }
-
- if (!$a && $channel == 'doc.php.net') {
- return true;
- }
-
- return $a;
- }
-
- /**
- * Determine whether a mirror exists within the deafult channel in the registry
- *
- * @param string Channel name
- * @param string Mirror name
- *
- * @return boolean
- */
- function _mirrorExists($channel, $mirror)
- {
- $data = $this->_channelInfo($channel);
- if (!isset($data['servers']['mirror'])) {
- return false;
- }
-
- foreach ($data['servers']['mirror'] as $m) {
- if ($m['attribs']['host'] == $mirror) {
- return true;
- }
- }
-
- return false;
- }
-
- /**
- * @param PEAR_ChannelFile Channel object
- * @param donotuse
- * @param string Last-Modified HTTP tag from remote request
- * @return boolean|PEAR_Error True on creation, false if it already exists
- */
- function _addChannel($channel, $update = false, $lastmodified = false)
- {
- if (!is_a($channel, 'PEAR_ChannelFile')) {
- return false;
- }
-
- if (!$channel->validate()) {
- return false;
- }
-
- if (file_exists($this->_channelFileName($channel->getName()))) {
- if (!$update) {
- return false;
- }
-
- $checker = $this->_getChannel($channel->getName());
- if (PEAR::isError($checker)) {
- return $checker;
- }
-
- if ($channel->getAlias() != $checker->getAlias()) {
- if (file_exists($this->_getChannelAliasFileName($checker->getAlias()))) {
- @unlink($this->_getChannelAliasFileName($checker->getAlias()));
- }
- }
- } else {
- if ($update && !in_array($channel->getName(), array('pear.php.net', 'pecl.php.net', 'doc.php.net'))) {
- return false;
- }
- }
-
- $ret = $this->_assertChannelDir();
- if (PEAR::isError($ret)) {
- return $ret;
- }
-
- $ret = $this->_assertChannelStateDir($channel->getName());
- if (PEAR::isError($ret)) {
- return $ret;
- }
-
- if ($channel->getAlias() != $channel->getName()) {
- if (file_exists($this->_getChannelAliasFileName($channel->getAlias())) &&
- $this->_getChannelFromAlias($channel->getAlias()) != $channel->getName()) {
- $channel->setAlias($channel->getName());
- }
-
- if (!$this->hasWriteAccess()) {
- return false;
- }
-
- $fp = @fopen($this->_getChannelAliasFileName($channel->getAlias()), 'w');
- if (!$fp) {
- return false;
- }
-
- fwrite($fp, $channel->getName());
- fclose($fp);
- }
-
- if (!$this->hasWriteAccess()) {
- return false;
- }
-
- $fp = @fopen($this->_channelFileName($channel->getName()), 'wb');
- if (!$fp) {
- return false;
- }
-
- $info = $channel->toArray();
- if ($lastmodified) {
- $info['_lastmodified'] = $lastmodified;
- } else {
- $info['_lastmodified'] = date('r');
- }
-
- fwrite($fp, serialize($info));
- fclose($fp);
- return true;
- }
-
- /**
- * Deletion fails if there are any packages installed from the channel
- * @param string|PEAR_ChannelFile channel name
- * @return boolean|PEAR_Error True on deletion, false if it doesn't exist
- */
- function _deleteChannel($channel)
- {
- if (!is_string($channel)) {
- if (!is_a($channel, 'PEAR_ChannelFile')) {
- return false;
- }
-
- if (!$channel->validate()) {
- return false;
- }
- $channel = $channel->getName();
- }
-
- if ($this->_getChannelFromAlias($channel) == '__uri') {
- return false;
- }
-
- if ($this->_getChannelFromAlias($channel) == 'pecl.php.net') {
- return false;
- }
-
- if ($this->_getChannelFromAlias($channel) == 'doc.php.net') {
- return false;
- }
-
- if (!$this->_channelExists($channel)) {
- return false;
- }
-
- if (!$channel || $this->_getChannelFromAlias($channel) == 'pear.php.net') {
- return false;
- }
-
- $channel = $this->_getChannelFromAlias($channel);
- if ($channel == 'pear.php.net') {
- return false;
- }
-
- $test = $this->_listChannelPackages($channel);
- if (count($test)) {
- return false;
- }
-
- $test = @rmdir($this->_channelDirectoryName($channel));
- if (!$test) {
- return false;
- }
-
- $file = $this->_getChannelAliasFileName($this->_getAlias($channel));
- if (file_exists($file)) {
- $test = @unlink($file);
- if (!$test) {
- return false;
- }
- }
-
- $file = $this->_channelFileName($channel);
- $ret = true;
- if (file_exists($file)) {
- $ret = @unlink($file);
- }
-
- return $ret;
- }
-
- /**
- * Determine whether a channel exists in the registry
- * @param string Channel Alias
- * @return boolean
- */
- function _isChannelAlias($alias)
- {
- return file_exists($this->_getChannelAliasFileName($alias));
- }
-
- /**
- * @param string|null
- * @param string|null
- * @param string|null
- * @return array|null
- * @access private
- */
- function _packageInfo($package = null, $key = null, $channel = 'pear.php.net')
- {
- if ($package === null) {
- if ($channel === null) {
- $channels = $this->_listChannels();
- $ret = array();
- foreach ($channels as $channel) {
- $channel = strtolower($channel);
- $ret[$channel] = array();
- $packages = $this->_listPackages($channel);
- foreach ($packages as $package) {
- $ret[$channel][] = $this->_packageInfo($package, null, $channel);
- }
- }
-
- return $ret;
- }
-
- $ps = $this->_listPackages($channel);
- if (!count($ps)) {
- return array();
- }
- return array_map(array(&$this, '_packageInfo'),
- $ps, array_fill(0, count($ps), null),
- array_fill(0, count($ps), $channel));
- }
-
- $fp = $this->_openPackageFile($package, 'r', $channel);
- if ($fp === null) {
- return null;
- }
-
- $rt = get_magic_quotes_runtime();
- set_magic_quotes_runtime(0);
- clearstatcache();
- $this->_closePackageFile($fp);
- $data = file_get_contents($this->_packageFileName($package, $channel));
- set_magic_quotes_runtime($rt);
- $data = unserialize($data);
- if ($key === null) {
- return $data;
- }
-
- // compatibility for package.xml version 2.0
- if (isset($data['old'][$key])) {
- return $data['old'][$key];
- }
-
- if (isset($data[$key])) {
- return $data[$key];
- }
-
- return null;
- }
-
- /**
- * @param string Channel name
- * @param bool whether to strictly retrieve info of channels, not just aliases
- * @return array|null
- */
- function _channelInfo($channel, $noaliases = false)
- {
- if (!$this->_channelExists($channel, $noaliases)) {
- return null;
- }
-
- $fp = $this->_openChannelFile($channel, 'r');
- if ($fp === null) {
- return null;
- }
-
- $rt = get_magic_quotes_runtime();
- set_magic_quotes_runtime(0);
- clearstatcache();
- $this->_closeChannelFile($fp);
- $data = file_get_contents($this->_channelFileName($channel));
- set_magic_quotes_runtime($rt);
- $data = unserialize($data);
- return $data;
- }
-
- function _listChannels()
- {
- $channellist = array();
- if (!file_exists($this->channelsdir) || !is_dir($this->channelsdir)) {
- return array('pear.php.net', 'pecl.php.net', 'doc.php.net', '__uri');
- }
-
- $dp = opendir($this->channelsdir);
- while ($ent = readdir($dp)) {
- if ($ent{0} == '.' || substr($ent, -4) != '.reg') {
- continue;
- }
-
- if ($ent == '__uri.reg') {
- $channellist[] = '__uri';
- continue;
- }
-
- $channellist[] = str_replace('_', '/', substr($ent, 0, -4));
- }
-
- closedir($dp);
- if (!in_array('pear.php.net', $channellist)) {
- $channellist[] = 'pear.php.net';
- }
-
- if (!in_array('pecl.php.net', $channellist)) {
- $channellist[] = 'pecl.php.net';
- }
-
- if (!in_array('doc.php.net', $channellist)) {
- $channellist[] = 'doc.php.net';
- }
-
-
- if (!in_array('__uri', $channellist)) {
- $channellist[] = '__uri';
- }
-
- natsort($channellist);
- return $channellist;
- }
-
- function _listPackages($channel = false)
- {
- if ($channel && $this->_getChannelFromAlias($channel) != 'pear.php.net') {
- return $this->_listChannelPackages($channel);
- }
-
- if (!file_exists($this->statedir) || !is_dir($this->statedir)) {
- return array();
- }
-
- $pkglist = array();
- $dp = opendir($this->statedir);
- if (!$dp) {
- return $pkglist;
- }
-
- while ($ent = readdir($dp)) {
- if ($ent{0} == '.' || substr($ent, -4) != '.reg') {
- continue;
- }
-
- $pkglist[] = substr($ent, 0, -4);
- }
- closedir($dp);
- return $pkglist;
- }
-
- function _listChannelPackages($channel)
- {
- $pkglist = array();
- if (!file_exists($this->_channelDirectoryName($channel)) ||
- !is_dir($this->_channelDirectoryName($channel))) {
- return array();
- }
-
- $dp = opendir($this->_channelDirectoryName($channel));
- if (!$dp) {
- return $pkglist;
- }
-
- while ($ent = readdir($dp)) {
- if ($ent{0} == '.' || substr($ent, -4) != '.reg') {
- continue;
- }
- $pkglist[] = substr($ent, 0, -4);
- }
-
- closedir($dp);
- return $pkglist;
- }
-
- function _listAllPackages()
- {
- $ret = array();
- foreach ($this->_listChannels() as $channel) {
- $ret[$channel] = $this->_listPackages($channel);
- }
-
- return $ret;
- }
-
- /**
- * Add an installed package to the registry
- * @param string package name
- * @param array package info (parsed by PEAR_Common::infoFrom*() methods)
- * @return bool success of saving
- * @access private
- */
- function _addPackage($package, $info)
- {
- if ($this->_packageExists($package)) {
- return false;
- }
-
- $fp = $this->_openPackageFile($package, 'wb');
- if ($fp === null) {
- return false;
- }
-
- $info['_lastmodified'] = time();
- fwrite($fp, serialize($info));
- $this->_closePackageFile($fp);
- if (isset($info['filelist'])) {
- $this->_rebuildFileMap();
- }
-
- return true;
- }
-
- /**
- * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2
- * @return bool
- * @access private
- */
- function _addPackage2($info)
- {
- if (!is_a($info, 'PEAR_PackageFile_v1') && !is_a($info, 'PEAR_PackageFile_v2')) {
- return false;
- }
-
- if (!$info->validate()) {
- if (class_exists('PEAR_Common')) {
- $ui = PEAR_Frontend::singleton();
- if ($ui) {
- foreach ($info->getValidationWarnings() as $err) {
- $ui->log($err['message'], true);
- }
- }
- }
- return false;
- }
-
- $channel = $info->getChannel();
- $package = $info->getPackage();
- $save = $info;
- if ($this->_packageExists($package, $channel)) {
- return false;
- }
-
- if (!$this->_channelExists($channel, true)) {
- return false;
- }
-
- $info = $info->toArray(true);
- if (!$info) {
- return false;
- }
-
- $fp = $this->_openPackageFile($package, 'wb', $channel);
- if ($fp === null) {
- return false;
- }
-
- $info['_lastmodified'] = time();
- fwrite($fp, serialize($info));
- $this->_closePackageFile($fp);
- $this->_rebuildFileMap();
- return true;
- }
-
- /**
- * @param string Package name
- * @param array parsed package.xml 1.0
- * @param bool this parameter is only here for BC. Don't use it.
- * @access private
- */
- function _updatePackage($package, $info, $merge = true)
- {
- $oldinfo = $this->_packageInfo($package);
- if (empty($oldinfo)) {
- return false;
- }
-
- $fp = $this->_openPackageFile($package, 'w');
- if ($fp === null) {
- return false;
- }
-
- if (is_object($info)) {
- $info = $info->toArray();
- }
- $info['_lastmodified'] = time();
-
- $newinfo = $info;
- if ($merge) {
- $info = array_merge($oldinfo, $info);
- } else {
- $diff = $info;
- }
-
- fwrite($fp, serialize($info));
- $this->_closePackageFile($fp);
- if (isset($newinfo['filelist'])) {
- $this->_rebuildFileMap();
- }
-
- return true;
- }
-
- /**
- * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2
- * @return bool
- * @access private
- */
- function _updatePackage2($info)
- {
- if (!$this->_packageExists($info->getPackage(), $info->getChannel())) {
- return false;
- }
-
- $fp = $this->_openPackageFile($info->getPackage(), 'w', $info->getChannel());
- if ($fp === null) {
- return false;
- }
-
- $save = $info;
- $info = $save->getArray(true);
- $info['_lastmodified'] = time();
- fwrite($fp, serialize($info));
- $this->_closePackageFile($fp);
- $this->_rebuildFileMap();
- return true;
- }
-
- /**
- * @param string Package name
- * @param string Channel name
- * @return PEAR_PackageFile_v1|PEAR_PackageFile_v2|null
- * @access private
- */
- function &_getPackage($package, $channel = 'pear.php.net')
- {
- $info = $this->_packageInfo($package, null, $channel);
- if ($info === null) {
- return $info;
- }
-
- $a = $this->_config;
- if (!$a) {
- $this->_config = &new PEAR_Config;
- $this->_config->set('php_dir', $this->statedir);
- }
-
- if (!class_exists('PEAR_PackageFile')) {
- require_once 'PEAR/PackageFile.php';
- }
-
- $pkg = &new PEAR_PackageFile($this->_config);
- $pf = &$pkg->fromArray($info);
- return $pf;
- }
-
- /**
- * @param string channel name
- * @param bool whether to strictly retrieve channel names
- * @return PEAR_ChannelFile|PEAR_Error
- * @access private
- */
- function &_getChannel($channel, $noaliases = false)
- {
- $ch = false;
- if ($this->_channelExists($channel, $noaliases)) {
- $chinfo = $this->_channelInfo($channel, $noaliases);
- if ($chinfo) {
- if (!class_exists('PEAR_ChannelFile')) {
- require_once 'PEAR/ChannelFile.php';
- }
-
- $ch = &PEAR_ChannelFile::fromArrayWithErrors($chinfo);
- }
- }
-
- if ($ch) {
- if ($ch->validate()) {
- return $ch;
- }
-
- foreach ($ch->getErrors(true) as $err) {
- $message = $err['message'] . "\n";
- }
-
- $ch = PEAR::raiseError($message);
- return $ch;
- }
-
- if ($this->_getChannelFromAlias($channel) == 'pear.php.net') {
- // the registry is not properly set up, so use defaults
- if (!class_exists('PEAR_ChannelFile')) {
- require_once 'PEAR/ChannelFile.php';
- }
-
- $pear_channel = new PEAR_ChannelFile;
- $pear_channel->setServer('pear.php.net');
- $pear_channel->setAlias('pear');
- $pear_channel->setSummary('PHP Extension and Application Repository');
- $pear_channel->setDefaultPEARProtocols();
- $pear_channel->setBaseURL('REST1.0', 'http://pear.php.net/rest/');
- $pear_channel->setBaseURL('REST1.1', 'http://pear.php.net/rest/');
- $pear_channel->setBaseURL('REST1.3', 'http://pear.php.net/rest/');
- return $pear_channel;
- }
-
- if ($this->_getChannelFromAlias($channel) == 'pecl.php.net') {
- // the registry is not properly set up, so use defaults
- if (!class_exists('PEAR_ChannelFile')) {
- require_once 'PEAR/ChannelFile.php';
- }
- $pear_channel = new PEAR_ChannelFile;
- $pear_channel->setServer('pecl.php.net');
- $pear_channel->setAlias('pecl');
- $pear_channel->setSummary('PHP Extension Community Library');
- $pear_channel->setDefaultPEARProtocols();
- $pear_channel->setBaseURL('REST1.0', 'http://pecl.php.net/rest/');
- $pear_channel->setBaseURL('REST1.1', 'http://pecl.php.net/rest/');
- $pear_channel->setValidationPackage('PEAR_Validator_PECL', '1.0');
- return $pear_channel;
- }
-
- if ($this->_getChannelFromAlias($channel) == 'doc.php.net') {
- // the registry is not properly set up, so use defaults
- if (!class_exists('PEAR_ChannelFile')) {
- require_once 'PEAR/ChannelFile.php';
- }
-
- $doc_channel = new PEAR_ChannelFile;
- $doc_channel->setServer('doc.php.net');
- $doc_channel->setAlias('phpdocs');
- $doc_channel->setSummary('PHP Documentation Team');
- $doc_channel->setDefaultPEARProtocols();
- $doc_channel->setBaseURL('REST1.0', 'http://doc.php.net/rest/');
- $doc_channel->setBaseURL('REST1.1', 'http://doc.php.net/rest/');
- $doc_channel->setBaseURL('REST1.3', 'http://doc.php.net/rest/');
- return $doc_channel;
- }
-
-
- if ($this->_getChannelFromAlias($channel) == '__uri') {
- // the registry is not properly set up, so use defaults
- if (!class_exists('PEAR_ChannelFile')) {
- require_once 'PEAR/ChannelFile.php';
- }
-
- $private = new PEAR_ChannelFile;
- $private->setName('__uri');
- $private->setDefaultPEARProtocols();
- $private->setBaseURL('REST1.0', '****');
- $private->setSummary('Pseudo-channel for static packages');
- return $private;
- }
-
- return $ch;
- }
-
- /**
- * @param string Package name
- * @param string Channel name
- * @return bool
- */
- function packageExists($package, $channel = 'pear.php.net')
- {
- if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
- return $e;
- }
- $ret = $this->_packageExists($package, $channel);
- $this->_unlock();
- return $ret;
- }
-
- // }}}
-
- // {{{ channelExists()
-
- /**
- * @param string channel name
- * @param bool if true, then aliases will be ignored
- * @return bool
- */
- function channelExists($channel, $noaliases = false)
- {
- if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
- return $e;
- }
- $ret = $this->_channelExists($channel, $noaliases);
- $this->_unlock();
- return $ret;
- }
-
- // }}}
-
- /**
- * @param string channel name mirror is in
- * @param string mirror name
- *
- * @return bool
- */
- function mirrorExists($channel, $mirror)
- {
- if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
- return $e;
- }
-
- $ret = $this->_mirrorExists($channel, $mirror);
- $this->_unlock();
- return $ret;
- }
-
- // {{{ isAlias()
-
- /**
- * Determines whether the parameter is an alias of a channel
- * @param string
- * @return bool
- */
- function isAlias($alias)
- {
- if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
- return $e;
- }
- $ret = $this->_isChannelAlias($alias);
- $this->_unlock();
- return $ret;
- }
-
- // }}}
- // {{{ packageInfo()
-
- /**
- * @param string|null
- * @param string|null
- * @param string
- * @return array|null
- */
- function packageInfo($package = null, $key = null, $channel = 'pear.php.net')
- {
- if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
- return $e;
- }
- $ret = $this->_packageInfo($package, $key, $channel);
- $this->_unlock();
- return $ret;
- }
-
- // }}}
- // {{{ channelInfo()
-
- /**
- * Retrieve a raw array of channel data.
- *
- * Do not use this, instead use {@link getChannel()} for normal
- * operations. Array structure is undefined in this method
- * @param string channel name
- * @param bool whether to strictly retrieve information only on non-aliases
- * @return array|null|PEAR_Error
- */
- function channelInfo($channel = null, $noaliases = false)
- {
- if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
- return $e;
- }
- $ret = $this->_channelInfo($channel, $noaliases);
- $this->_unlock();
- return $ret;
- }
-
- // }}}
-
- /**
- * @param string
- */
- function channelName($channel)
- {
- if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
- return $e;
- }
- $ret = $this->_getChannelFromAlias($channel);
- $this->_unlock();
- return $ret;
- }
-
- /**
- * @param string
- */
- function channelAlias($channel)
- {
- if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
- return $e;
- }
- $ret = $this->_getAlias($channel);
- $this->_unlock();
- return $ret;
- }
- // {{{ listPackages()
-
- function listPackages($channel = false)
- {
- if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
- return $e;
- }
- $ret = $this->_listPackages($channel);
- $this->_unlock();
- return $ret;
- }
-
- // }}}
- // {{{ listAllPackages()
-
- function listAllPackages()
- {
- if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
- return $e;
- }
- $ret = $this->_listAllPackages();
- $this->_unlock();
- return $ret;
- }
-
- // }}}
- // {{{ listChannel()
-
- function listChannels()
- {
- if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
- return $e;
- }
- $ret = $this->_listChannels();
- $this->_unlock();
- return $ret;
- }
-
- // }}}
- // {{{ addPackage()
-
- /**
- * Add an installed package to the registry
- * @param string|PEAR_PackageFile_v1|PEAR_PackageFile_v2 package name or object
- * that will be passed to {@link addPackage2()}
- * @param array package info (parsed by PEAR_Common::infoFrom*() methods)
- * @return bool success of saving
- */
- function addPackage($package, $info)
- {
- if (is_object($info)) {
- return $this->addPackage2($info);
- }
- if (PEAR::isError($e = $this->_lock(LOCK_EX))) {
- return $e;
- }
- $ret = $this->_addPackage($package, $info);
- $this->_unlock();
- if ($ret) {
- if (!class_exists('PEAR_PackageFile_v1')) {
- require_once 'PEAR/PackageFile/v1.php';
- }
- $pf = new PEAR_PackageFile_v1;
- $pf->setConfig($this->_config);
- $pf->fromArray($info);
- $this->_dependencyDB->uninstallPackage($pf);
- $this->_dependencyDB->installPackage($pf);
- }
- return $ret;
- }
-
- // }}}
- // {{{ addPackage2()
-
- function addPackage2($info)
- {
- if (!is_object($info)) {
- return $this->addPackage($info['package'], $info);
- }
- if (PEAR::isError($e = $this->_lock(LOCK_EX))) {
- return $e;
- }
- $ret = $this->_addPackage2($info);
- $this->_unlock();
- if ($ret) {
- $this->_dependencyDB->uninstallPackage($info);
- $this->_dependencyDB->installPackage($info);
- }
- return $ret;
- }
-
- // }}}
- // {{{ updateChannel()
-
- /**
- * For future expandibility purposes, separate this
- * @param PEAR_ChannelFile
- */
- function updateChannel($channel, $lastmodified = null)
- {
- if ($channel->getName() == '__uri') {
- return false;
- }
- return $this->addChannel($channel, $lastmodified, true);
- }
-
- // }}}
- // {{{ deleteChannel()
-
- /**
- * Deletion fails if there are any packages installed from the channel
- * @param string|PEAR_ChannelFile channel name
- * @return boolean|PEAR_Error True on deletion, false if it doesn't exist
- */
- function deleteChannel($channel)
- {
- if (PEAR::isError($e = $this->_lock(LOCK_EX))) {
- return $e;
- }
-
- $ret = $this->_deleteChannel($channel);
- $this->_unlock();
- if ($ret && is_a($this->_config, 'PEAR_Config')) {
- $this->_config->setChannels($this->listChannels());
- }
-
- return $ret;
- }
-
- // }}}
- // {{{ addChannel()
-
- /**
- * @param PEAR_ChannelFile Channel object
- * @param string Last-Modified header from HTTP for caching
- * @return boolean|PEAR_Error True on creation, false if it already exists
- */
- function addChannel($channel, $lastmodified = false, $update = false)
- {
- if (!is_a($channel, 'PEAR_ChannelFile') || !$channel->validate()) {
- return false;
- }
-
- if (PEAR::isError($e = $this->_lock(LOCK_EX))) {
- return $e;
- }
-
- $ret = $this->_addChannel($channel, $update, $lastmodified);
- $this->_unlock();
- if (!$update && $ret && is_a($this->_config, 'PEAR_Config')) {
- $this->_config->setChannels($this->listChannels());
- }
-
- return $ret;
- }
-
- // }}}
- // {{{ deletePackage()
-
- function deletePackage($package, $channel = 'pear.php.net')
- {
- if (PEAR::isError($e = $this->_lock(LOCK_EX))) {
- return $e;
- }
-
- $file = $this->_packageFileName($package, $channel);
- $ret = file_exists($file) ? @unlink($file) : false;
- $this->_rebuildFileMap();
- $this->_unlock();
- $p = array('channel' => $channel, 'package' => $package);
- $this->_dependencyDB->uninstallPackage($p);
- return $ret;
- }
-
- // }}}
- // {{{ updatePackage()
-
- function updatePackage($package, $info, $merge = true)
- {
- if (is_object($info)) {
- return $this->updatePackage2($info, $merge);
- }
- if (PEAR::isError($e = $this->_lock(LOCK_EX))) {
- return $e;
- }
- $ret = $this->_updatePackage($package, $info, $merge);
- $this->_unlock();
- if ($ret) {
- if (!class_exists('PEAR_PackageFile_v1')) {
- require_once 'PEAR/PackageFile/v1.php';
- }
- $pf = new PEAR_PackageFile_v1;
- $pf->setConfig($this->_config);
- $pf->fromArray($this->packageInfo($package));
- $this->_dependencyDB->uninstallPackage($pf);
- $this->_dependencyDB->installPackage($pf);
- }
- return $ret;
- }
-
- // }}}
- // {{{ updatePackage2()
-
- function updatePackage2($info)
- {
-
- if (!is_object($info)) {
- return $this->updatePackage($info['package'], $info, $merge);
- }
-
- if (!$info->validate(PEAR_VALIDATE_DOWNLOADING)) {
- return false;
- }
-
- if (PEAR::isError($e = $this->_lock(LOCK_EX))) {
- return $e;
- }
-
- $ret = $this->_updatePackage2($info);
- $this->_unlock();
- if ($ret) {
- $this->_dependencyDB->uninstallPackage($info);
- $this->_dependencyDB->installPackage($info);
- }
-
- return $ret;
- }
-
- // }}}
- // {{{ getChannel()
- /**
- * @param string channel name
- * @param bool whether to strictly return raw channels (no aliases)
- * @return PEAR_ChannelFile|PEAR_Error
- */
- function &getChannel($channel, $noaliases = false)
- {
- if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
- return $e;
- }
- $ret = &$this->_getChannel($channel, $noaliases);
- $this->_unlock();
- if (!$ret) {
- return PEAR::raiseError('Unknown channel: ' . $channel);
- }
- return $ret;
- }
-
- // }}}
- // {{{ getPackage()
- /**
- * @param string package name
- * @param string channel name
- * @return PEAR_PackageFile_v1|PEAR_PackageFile_v2|null
- */
- function &getPackage($package, $channel = 'pear.php.net')
- {
- if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
- return $e;
- }
- $pf = &$this->_getPackage($package, $channel);
- $this->_unlock();
- return $pf;
- }
-
- // }}}
-
- /**
- * Get PEAR_PackageFile_v[1/2] objects representing the contents of
- * a dependency group that are installed.
- *
- * This is used at uninstall-time
- * @param array
- * @return array|false
- */
- function getInstalledGroup($group)
- {
- $ret = array();
- if (isset($group['package'])) {
- if (!isset($group['package'][0])) {
- $group['package'] = array($group['package']);
- }
- foreach ($group['package'] as $package) {
- $depchannel = isset($package['channel']) ? $package['channel'] : '__uri';
- $p = &$this->getPackage($package['name'], $depchannel);
- if ($p) {
- $save = &$p;
- $ret[] = &$save;
- }
- }
- }
- if (isset($group['subpackage'])) {
- if (!isset($group['subpackage'][0])) {
- $group['subpackage'] = array($group['subpackage']);
- }
- foreach ($group['subpackage'] as $package) {
- $depchannel = isset($package['channel']) ? $package['channel'] : '__uri';
- $p = &$this->getPackage($package['name'], $depchannel);
- if ($p) {
- $save = &$p;
- $ret[] = &$save;
- }
- }
- }
- if (!count($ret)) {
- return false;
- }
- return $ret;
- }
-
- // {{{ getChannelValidator()
- /**
- * @param string channel name
- * @return PEAR_Validate|false
- */
- function &getChannelValidator($channel)
- {
- $chan = $this->getChannel($channel);
- if (PEAR::isError($chan)) {
- return $chan;
- }
- $val = $chan->getValidationObject();
- return $val;
- }
- // }}}
- // {{{ getChannels()
- /**
- * @param string channel name
- * @return array an array of PEAR_ChannelFile objects representing every installed channel
- */
- function &getChannels()
- {
- $ret = array();
- if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
- return $e;
- }
- foreach ($this->_listChannels() as $channel) {
- $e = &$this->_getChannel($channel);
- if (!$e || PEAR::isError($e)) {
- continue;
- }
- $ret[] = $e;
- }
- $this->_unlock();
- return $ret;
- }
-
- // }}}
- // {{{ checkFileMap()
-
- /**
- * Test whether a file or set of files belongs to a package.
- *
- * If an array is passed in
- * @param string|array file path, absolute or relative to the pear
- * install dir
- * @param string|array name of PEAR package or array('package' => name, 'channel' =>
- * channel) of a package that will be ignored
- * @param string API version - 1.1 will exclude any files belonging to a package
- * @param array private recursion variable
- * @return array|false which package and channel the file belongs to, or an empty
- * string if the file does not belong to an installed package,
- * or belongs to the second parameter's package
- */
- function checkFileMap($path, $package = false, $api = '1.0', $attrs = false)
- {
- if (is_array($path)) {
- static $notempty;
- if (empty($notempty)) {
- if (!class_exists('PEAR_Installer_Role')) {
- require_once 'PEAR/Installer/Role.php';
- }
- $notempty = create_function('$a','return !empty($a);');
- }
- $package = is_array($package) ? array(strtolower($package[0]), strtolower($package[1]))
- : strtolower($package);
- $pkgs = array();
- foreach ($path as $name => $attrs) {
- if (is_array($attrs)) {
- if (isset($attrs['install-as'])) {
- $name = $attrs['install-as'];
- }
- if (!in_array($attrs['role'], PEAR_Installer_Role::getInstallableRoles())) {
- // these are not installed
- continue;
- }
- if (!in_array($attrs['role'], PEAR_Installer_Role::getBaseinstallRoles())) {
- $attrs['baseinstalldir'] = is_array($package) ? $package[1] : $package;
- }
- if (isset($attrs['baseinstalldir'])) {
- $name = $attrs['baseinstalldir'] . DIRECTORY_SEPARATOR . $name;
- }
- }
- $pkgs[$name] = $this->checkFileMap($name, $package, $api, $attrs);
- if (PEAR::isError($pkgs[$name])) {
- return $pkgs[$name];
- }
- }
- return array_filter($pkgs, $notempty);
- }
- if (empty($this->filemap_cache)) {
- if (PEAR::isError($e = $this->_lock(LOCK_SH))) {
- return $e;
- }
- $err = $this->_readFileMap();
- $this->_unlock();
- if (PEAR::isError($err)) {
- return $err;
- }
- }
- if (!$attrs) {
- $attrs = array('role' => 'php'); // any old call would be for PHP role only
- }
- if (isset($this->filemap_cache[$attrs['role']][$path])) {
- if ($api >= '1.1' && $this->filemap_cache[$attrs['role']][$path] == $package) {
- return false;
- }
- return $this->filemap_cache[$attrs['role']][$path];
- }
- $l = strlen($this->install_dir);
- if (substr($path, 0, $l) == $this->install_dir) {
- $path = preg_replace('!^'.DIRECTORY_SEPARATOR.'+!', '', substr($path, $l));
- }
- if (isset($this->filemap_cache[$attrs['role']][$path])) {
- if ($api >= '1.1' && $this->filemap_cache[$attrs['role']][$path] == $package) {
- return false;
- }
- return $this->filemap_cache[$attrs['role']][$path];
- }
- return false;
- }
-
- // }}}
- // {{{ flush()
- /**
- * Force a reload of the filemap
- * @since 1.5.0RC3
- */
- function flushFileMap()
- {
- $this->filemap_cache = null;
- clearstatcache(); // ensure that the next read gets the full, current filemap
- }
-
- // }}}
- // {{{ apiVersion()
- /**
- * Get the expected API version. Channels API is version 1.1, as it is backwards
- * compatible with 1.0
- * @return string
- */
- function apiVersion()
- {
- return '1.1';
- }
- // }}}
-
-
- /**
- * Parse a package name, or validate a parsed package name array
- * @param string|array pass in an array of format
- * array(
- * 'package' => 'pname',
- * ['channel' => 'channame',]
- * ['version' => 'version',]
- * ['state' => 'state',]
- * ['group' => 'groupname'])
- * or a string of format
- * [channel://][channame/]pname[-version|-state][/group=groupname]
- * @return array|PEAR_Error
- */
- function parsePackageName($param, $defaultchannel = 'pear.php.net')
- {
- $saveparam = $param;
- if (is_array($param)) {
- // convert to string for error messages
- $saveparam = $this->parsedPackageNameToString($param);
- // process the array
- if (!isset($param['package'])) {
- return PEAR::raiseError('parsePackageName(): array $param ' .
- 'must contain a valid package name in index "param"',
- 'package', null, null, $param);
- }
- if (!isset($param['uri'])) {
- if (!isset($param['channel'])) {
- $param['channel'] = $defaultchannel;
- }
- } else {
- $param['channel'] = '__uri';
- }
- } else {
- $components = @parse_url((string) $param);
- if (isset($components['scheme'])) {
- if ($components['scheme'] == 'http') {
- // uri package
- $param = array('uri' => $param, 'channel' => '__uri');
- } elseif($components['scheme'] != 'channel') {
- return PEAR::raiseError('parsePackageName(): only channel:// uris may ' .
- 'be downloaded, not "' . $param . '"', 'invalid', null, null, $param);
- }
- }
- if (!isset($components['path'])) {
- return PEAR::raiseError('parsePackageName(): array $param ' .
- 'must contain a valid package name in "' . $param . '"',
- 'package', null, null, $param);
- }
- if (isset($components['host'])) {
- // remove the leading "/"
- $components['path'] = substr($components['path'], 1);
- }
- if (!isset($components['scheme'])) {
- if (strpos($components['path'], '/') !== false) {
- if ($components['path']{0} == '/') {
- return PEAR::raiseError('parsePackageName(): this is not ' .
- 'a package name, it begins with "/" in "' . $param . '"',
- 'invalid', null, null, $param);
- }
- $parts = explode('/', $components['path']);
- $components['host'] = array_shift($parts);
- if (count($parts) > 1) {
- $components['path'] = array_pop($parts);
- $components['host'] .= '/' . implode('/', $parts);
- } else {
- $components['path'] = implode('/', $parts);
- }
- } else {
- $components['host'] = $defaultchannel;
- }
- } else {
- if (strpos($components['path'], '/')) {
- $parts = explode('/', $components['path']);
- $components['path'] = array_pop($parts);
- $components['host'] .= '/' . implode('/', $parts);
- }
- }
-
- if (is_array($param)) {
- $param['package'] = $components['path'];
- } else {
- $param = array(
- 'package' => $components['path']
- );
- if (isset($components['host'])) {
- $param['channel'] = $components['host'];
- }
- }
- if (isset($components['fragment'])) {
- $param['group'] = $components['fragment'];
- }
- if (isset($components['user'])) {
- $param['user'] = $components['user'];
- }
- if (isset($components['pass'])) {
- $param['pass'] = $components['pass'];
- }
- if (isset($components['query'])) {
- parse_str($components['query'], $param['opts']);
- }
- // check for extension
- $pathinfo = pathinfo($param['package']);
- if (isset($pathinfo['extension']) &&
- in_array(strtolower($pathinfo['extension']), array('tgz', 'tar'))) {
- $param['extension'] = $pathinfo['extension'];
- $param['package'] = substr($pathinfo['basename'], 0,
- strlen($pathinfo['basename']) - 4);
- }
- // check for version
- if (strpos($param['package'], '-')) {
- $test = explode('-', $param['package']);
- if (count($test) != 2) {
- return PEAR::raiseError('parsePackageName(): only one version/state ' .
- 'delimiter "-" is allowed in "' . $saveparam . '"',
- 'version', null, null, $param);
- }
- list($param['package'], $param['version']) = $test;
- }
- }
- // validation
- $info = $this->channelExists($param['channel']);
- if (PEAR::isError($info)) {
- return $info;
- }
- if (!$info) {
- return PEAR::raiseError('unknown channel "' . $param['channel'] .
- '" in "' . $saveparam . '"', 'channel', null, null, $param);
- }
- $chan = $this->getChannel($param['channel']);
- if (PEAR::isError($chan)) {
- return $chan;
- }
- if (!$chan) {
- return PEAR::raiseError("Exception: corrupt registry, could not " .
- "retrieve channel " . $param['channel'] . " information",
- 'registry', null, null, $param);
- }
- $param['channel'] = $chan->getName();
- $validate = $chan->getValidationObject();
- $vpackage = $chan->getValidationPackage();
- // validate package name
- if (!$validate->validPackageName($param['package'], $vpackage['_content'])) {
- return PEAR::raiseError('parsePackageName(): invalid package name "' .
- $param['package'] . '" in "' . $saveparam . '"',
- 'package', null, null, $param);
- }
- if (isset($param['group'])) {
- if (!PEAR_Validate::validGroupName($param['group'])) {
- return PEAR::raiseError('parsePackageName(): dependency group "' . $param['group'] .
- '" is not a valid group name in "' . $saveparam . '"', 'group', null, null,
- $param);
- }
- }
- if (isset($param['state'])) {
- if (!in_array(strtolower($param['state']), $validate->getValidStates())) {
- return PEAR::raiseError('parsePackageName(): state "' . $param['state']
- . '" is not a valid state in "' . $saveparam . '"',
- 'state', null, null, $param);
- }
- }
- if (isset($param['version'])) {
- if (isset($param['state'])) {
- return PEAR::raiseError('parsePackageName(): cannot contain both ' .
- 'a version and a stability (state) in "' . $saveparam . '"',
- 'version/state', null, null, $param);
- }
- // check whether version is actually a state
- if (in_array(strtolower($param['version']), $validate->getValidStates())) {
- $param['state'] = strtolower($param['version']);
- unset($param['version']);
- } else {
- if (!$validate->validVersion($param['version'])) {
- return PEAR::raiseError('parsePackageName(): "' . $param['version'] .
- '" is neither a valid version nor a valid state in "' .
- $saveparam . '"', 'version/state', null, null, $param);
- }
- }
- }
- return $param;
- }
-
- /**
- * @param array
- * @return string
- */
- function parsedPackageNameToString($parsed, $brief = false)
- {
- if (is_string($parsed)) {
- return $parsed;
- }
- if (is_object($parsed)) {
- $p = $parsed;
- $parsed = array(
- 'package' => $p->getPackage(),
- 'channel' => $p->getChannel(),
- 'version' => $p->getVersion(),
- );
- }
- if (isset($parsed['uri'])) {
- return $parsed['uri'];
- }
- if ($brief) {
- if ($channel = $this->channelAlias($parsed['channel'])) {
- return $channel . '/' . $parsed['package'];
- }
- }
- $upass = '';
- if (isset($parsed['user'])) {
- $upass = $parsed['user'];
- if (isset($parsed['pass'])) {
- $upass .= ':' . $parsed['pass'];
- }
- $upass = "$upass@";
- }
- $ret = 'channel://' . $upass . $parsed['channel'] . '/' . $parsed['package'];
- if (isset($parsed['version']) || isset($parsed['state'])) {
- $ver = isset($parsed['version']) ? $parsed['version'] : '';
- $ver .= isset($parsed['state']) ? $parsed['state'] : '';
- $ret .= '-' . $ver;
- }
- if (isset($parsed['extension'])) {
- $ret .= '.' . $parsed['extension'];
- }
- if (isset($parsed['opts'])) {
- $ret .= '?';
- foreach ($parsed['opts'] as $name => $value) {
- $parsed['opts'][$name] = "$name=$value";
- }
- $ret .= implode('&', $parsed['opts']);
- }
- if (isset($parsed['group'])) {
- $ret .= '#' . $parsed['group'];
- }
- return $ret;
- }
-} \ No newline at end of file
diff --git a/3rdparty/PEAR/Remote.php b/3rdparty/PEAR/Remote.php
deleted file mode 100644
index 7b1e314f903..00000000000
--- a/3rdparty/PEAR/Remote.php
+++ /dev/null
@@ -1,394 +0,0 @@
-<?php
-//
-// +----------------------------------------------------------------------+
-// | PHP Version 5 |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2004 The PHP Group |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 3.0 of the PHP license, |
-// | that is bundled with this package in the file LICENSE, and is |
-// | available through the world-wide-web at the following url: |
-// | http://www.php.net/license/3_0.txt. |
-// | If you did not receive a copy of the PHP license and are unable to |
-// | obtain it through the world-wide-web, please send a note to |
-// | license@php.net so we can mail you a copy immediately. |
-// +----------------------------------------------------------------------+
-// | Author: Stig Bakken <ssb@php.net> |
-// +----------------------------------------------------------------------+
-//
-// $Id: Remote.php,v 1.50 2004/06/08 18:03:46 cellog Exp $
-
-require_once 'PEAR.php';
-require_once 'PEAR/Config.php';
-
-/**
- * This is a class for doing remote operations against the central
- * PEAR database.
- *
- * @nodep XML_RPC_Value
- * @nodep XML_RPC_Message
- * @nodep XML_RPC_Client
- */
-class PEAR_Remote extends PEAR
-{
- // {{{ properties
-
- var $config = null;
- var $cache = null;
-
- // }}}
-
- // {{{ PEAR_Remote(config_object)
-
- function PEAR_Remote(&$config)
- {
- $this->PEAR();
- $this->config = &$config;
- }
-
- // }}}
-
- // {{{ getCache()
-
-
- function getCache($args)
- {
- $id = md5(serialize($args));
- $cachedir = $this->config->get('cache_dir');
- $filename = $cachedir . DIRECTORY_SEPARATOR . 'xmlrpc_cache_' . $id;
- if (!file_exists($filename)) {
- return null;
- };
-
- $fp = fopen($filename, 'rb');
- if (!$fp) {
- return null;
- }
- $content = fread($fp, filesize($filename));
- fclose($fp);
- $result = array(
- 'age' => time() - filemtime($filename),
- 'lastChange' => filemtime($filename),
- 'content' => unserialize($content),
- );
- return $result;
- }
-
- // }}}
-
- // {{{ saveCache()
-
- function saveCache($args, $data)
- {
- $id = md5(serialize($args));
- $cachedir = $this->config->get('cache_dir');
- if (!file_exists($cachedir)) {
- System::mkdir(array('-p', $cachedir));
- }
- $filename = $cachedir.'/xmlrpc_cache_'.$id;
-
- $fp = @fopen($filename, "wb");
- if ($fp) {
- fwrite($fp, serialize($data));
- fclose($fp);
- };
- }
-
- // }}}
-
- // {{{ call(method, [args...])
-
- function call($method)
- {
- $_args = $args = func_get_args();
-
- $this->cache = $this->getCache($args);
- $cachettl = $this->config->get('cache_ttl');
- // If cache is newer than $cachettl seconds, we use the cache!
- if ($this->cache !== null && $this->cache['age'] < $cachettl) {
- return $this->cache['content'];
- };
-
- if (extension_loaded("xmlrpc")) {
- $result = call_user_func_array(array(&$this, 'call_epi'), $args);
- if (!PEAR::isError($result)) {
- $this->saveCache($_args, $result);
- };
- return $result;
- }
- if (!@include_once("XML/RPC.php")) {
- return $this->raiseError("For this remote PEAR operation you need to install the XML_RPC package");
- }
- array_shift($args);
- $server_host = $this->config->get('master_server');
- $username = $this->config->get('username');
- $password = $this->config->get('password');
- $eargs = array();
- foreach($args as $arg) $eargs[] = $this->_encode($arg);
- $f = new XML_RPC_Message($method, $eargs);
- if ($this->cache !== null) {
- $maxAge = '?maxAge='.$this->cache['lastChange'];
- } else {
- $maxAge = '';
- };
- $proxy_host = $proxy_port = $proxy_user = $proxy_pass = '';
- if ($proxy = parse_url($this->config->get('http_proxy'))) {
- $proxy_host = @$proxy['host'];
- $proxy_port = @$proxy['port'];
- $proxy_user = @urldecode(@$proxy['user']);
- $proxy_pass = @urldecode(@$proxy['pass']);
- }
- $c = new XML_RPC_Client('/xmlrpc.php'.$maxAge, $server_host, 80, $proxy_host, $proxy_port, $proxy_user, $proxy_pass);
- if ($username && $password) {
- $c->setCredentials($username, $password);
- }
- if ($this->config->get('verbose') >= 3) {
- $c->setDebug(1);
- }
- $r = $c->send($f);
- if (!$r) {
- return $this->raiseError("XML_RPC send failed");
- }
- $v = $r->value();
- if ($e = $r->faultCode()) {
- if ($e == $GLOBALS['XML_RPC_err']['http_error'] && strstr($r->faultString(), '304 Not Modified') !== false) {
- return $this->cache['content'];
- }
- return $this->raiseError($r->faultString(), $e);
- }
-
- $result = XML_RPC_decode($v);
- $this->saveCache($_args, $result);
- return $result;
- }
-
- // }}}
-
- // {{{ call_epi(method, [args...])
-
- function call_epi($method)
- {
- do {
- if (extension_loaded("xmlrpc")) {
- break;
- }
- if (OS_WINDOWS) {
- $ext = 'dll';
- } elseif (PHP_OS == 'HP-UX') {
- $ext = 'sl';
- } elseif (PHP_OS == 'AIX') {
- $ext = 'a';
- } else {
- $ext = 'so';
- }
- $ext = OS_WINDOWS ? 'dll' : 'so';
- @dl("xmlrpc-epi.$ext");
- if (extension_loaded("xmlrpc")) {
- break;
- }
- @dl("xmlrpc.$ext");
- if (extension_loaded("xmlrpc")) {
- break;
- }
- return $this->raiseError("unable to load xmlrpc extension");
- } while (false);
- $params = func_get_args();
- array_shift($params);
- $method = str_replace("_", ".", $method);
- $request = xmlrpc_encode_request($method, $params);
- $server_host = $this->config->get("master_server");
- if (empty($server_host)) {
- return $this->raiseError("PEAR_Remote::call: no master_server configured");
- }
- $server_port = 80;
- if ($http_proxy = $this->config->get('http_proxy')) {
- $proxy = parse_url($http_proxy);
- $proxy_host = $proxy_port = $proxy_user = $proxy_pass = '';
- $proxy_host = @$proxy['host'];
- $proxy_port = @$proxy['port'];
- $proxy_user = @urldecode(@$proxy['user']);
- $proxy_pass = @urldecode(@$proxy['pass']);
- $fp = @fsockopen($proxy_host, $proxy_port);
- $use_proxy = true;
- } else {
- $use_proxy = false;
- $fp = @fsockopen($server_host, $server_port);
- }
- if (!$fp && $http_proxy) {
- return $this->raiseError("PEAR_Remote::call: fsockopen(`$proxy_host', $proxy_port) failed");
- } elseif (!$fp) {
- return $this->raiseError("PEAR_Remote::call: fsockopen(`$server_host', $server_port) failed");
- }
- $len = strlen($request);
- $req_headers = "Host: $server_host:$server_port\r\n" .
- "Content-type: text/xml\r\n" .
- "Content-length: $len\r\n";
- $username = $this->config->get('username');
- $password = $this->config->get('password');
- if ($username && $password) {
- $req_headers .= "Cookie: PEAR_USER=$username; PEAR_PW=$password\r\n";
- $tmp = base64_encode("$username:$password");
- $req_headers .= "Authorization: Basic $tmp\r\n";
- }
- if ($this->cache !== null) {
- $maxAge = '?maxAge='.$this->cache['lastChange'];
- } else {
- $maxAge = '';
- };
-
- if ($use_proxy && $proxy_host != '' && $proxy_user != '') {
- $req_headers .= 'Proxy-Authorization: Basic '
- .base64_encode($proxy_user.':'.$proxy_pass)
- ."\r\n";
- }
-
- if ($this->config->get('verbose') > 3) {
- print "XMLRPC REQUEST HEADERS:\n";
- var_dump($req_headers);
- print "XMLRPC REQUEST BODY:\n";
- var_dump($request);
- }
-
- if ($use_proxy && $proxy_host != '') {
- $post_string = "POST http://".$server_host;
- if ($proxy_port > '') {
- $post_string .= ':'.$server_port;
- }
- } else {
- $post_string = "POST ";
- }
-
- fwrite($fp, ($post_string."/xmlrpc.php$maxAge HTTP/1.0\r\n$req_headers\r\n$request"));
- $response = '';
- $line1 = fgets($fp, 2048);
- if (!preg_match('!^HTTP/[0-9\.]+ (\d+) (.*)!', $line1, $matches)) {
- return $this->raiseError("PEAR_Remote: invalid HTTP response from XML-RPC server");
- }
- switch ($matches[1]) {
- case "200": // OK
- break;
- case "304": // Not Modified
- return $this->cache['content'];
- case "401": // Unauthorized
- if ($username && $password) {
- return $this->raiseError("PEAR_Remote: authorization failed", 401);
- } else {
- return $this->raiseError("PEAR_Remote: authorization required, please log in first", 401);
- }
- default:
- return $this->raiseError("PEAR_Remote: unexpected HTTP response", (int)$matches[1], null, null, "$matches[1] $matches[2]");
- }
- while (trim(fgets($fp, 2048)) != ''); // skip rest of headers
- while ($chunk = fread($fp, 10240)) {
- $response .= $chunk;
- }
- fclose($fp);
- if ($this->config->get('verbose') > 3) {
- print "XMLRPC RESPONSE:\n";
- var_dump($response);
- }
- $ret = xmlrpc_decode($response);
- if (is_array($ret) && isset($ret['__PEAR_TYPE__'])) {
- if ($ret['__PEAR_TYPE__'] == 'error') {
- if (isset($ret['__PEAR_CLASS__'])) {
- $class = $ret['__PEAR_CLASS__'];
- } else {
- $class = "PEAR_Error";
- }
- if ($ret['code'] === '') $ret['code'] = null;
- if ($ret['message'] === '') $ret['message'] = null;
- if ($ret['userinfo'] === '') $ret['userinfo'] = null;
- if (strtolower($class) == 'db_error') {
- $ret = $this->raiseError(PEAR::errorMessage($ret['code']),
- $ret['code'], null, null,
- $ret['userinfo']);
- } else {
- $ret = $this->raiseError($ret['message'], $ret['code'],
- null, null, $ret['userinfo']);
- }
- }
- } elseif (is_array($ret) && sizeof($ret) == 1 && isset($ret[0])
- && is_array($ret[0]) &&
- !empty($ret[0]['faultString']) &&
- !empty($ret[0]['faultCode'])) {
- extract($ret[0]);
- $faultString = "XML-RPC Server Fault: " .
- str_replace("\n", " ", $faultString);
- return $this->raiseError($faultString, $faultCode);
- }
- return $ret;
- }
-
- // }}}
-
- // {{{ _encode
-
- // a slightly extended version of XML_RPC_encode
- function _encode($php_val)
- {
- global $XML_RPC_Boolean, $XML_RPC_Int, $XML_RPC_Double;
- global $XML_RPC_String, $XML_RPC_Array, $XML_RPC_Struct;
-
- $type = gettype($php_val);
- $xmlrpcval = new XML_RPC_Value;
-
- switch($type) {
- case "array":
- reset($php_val);
- $firstkey = key($php_val);
- end($php_val);
- $lastkey = key($php_val);
- if ($firstkey === 0 && is_int($lastkey) &&
- ($lastkey + 1) == count($php_val)) {
- $is_continuous = true;
- reset($php_val);
- $size = count($php_val);
- for ($expect = 0; $expect < $size; $expect++, next($php_val)) {
- if (key($php_val) !== $expect) {
- $is_continuous = false;
- break;
- }
- }
- if ($is_continuous) {
- reset($php_val);
- $arr = array();
- while (list($k, $v) = each($php_val)) {
- $arr[$k] = $this->_encode($v);
- }
- $xmlrpcval->addArray($arr);
- break;
- }
- }
- // fall though if not numerical and continuous
- case "object":
- $arr = array();
- while (list($k, $v) = each($php_val)) {
- $arr[$k] = $this->_encode($v);
- }
- $xmlrpcval->addStruct($arr);
- break;
- case "integer":
- $xmlrpcval->addScalar($php_val, $XML_RPC_Int);
- break;
- case "double":
- $xmlrpcval->addScalar($php_val, $XML_RPC_Double);
- break;
- case "string":
- case "NULL":
- $xmlrpcval->addScalar($php_val, $XML_RPC_String);
- break;
- case "boolean":
- $xmlrpcval->addScalar($php_val, $XML_RPC_Boolean);
- break;
- case "unknown type":
- default:
- return null;
- }
- return $xmlrpcval;
- }
-
- // }}}
-
-}
-
-?>
diff --git a/3rdparty/PEAR/RunTest.php b/3rdparty/PEAR/RunTest.php
deleted file mode 100644
index 51824906970..00000000000
--- a/3rdparty/PEAR/RunTest.php
+++ /dev/null
@@ -1,968 +0,0 @@
-<?php
-/**
- * PEAR_RunTest
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Tomas V.V.Cox <cox@idecnet.com>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: RunTest.php 313024 2011-07-06 19:51:24Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.3.3
- */
-
-/**
- * for error handling
- */
-require_once 'PEAR.php';
-require_once 'PEAR/Config.php';
-
-define('DETAILED', 1);
-putenv("PHP_PEAR_RUNTESTS=1");
-
-/**
- * Simplified version of PHP's test suite
- *
- * Try it with:
- *
- * $ php -r 'include "../PEAR/RunTest.php"; $t=new PEAR_RunTest; $o=$t->run("./pear_system.phpt");print_r($o);'
- *
- *
- * @category pear
- * @package PEAR
- * @author Tomas V.V.Cox <cox@idecnet.com>
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.3.3
- */
-class PEAR_RunTest
-{
- var $_headers = array();
- var $_logger;
- var $_options;
- var $_php;
- var $tests_count;
- var $xdebug_loaded;
- /**
- * Saved value of php executable, used to reset $_php when we
- * have a test that uses cgi
- *
- * @var unknown_type
- */
- var $_savephp;
- var $ini_overwrites = array(
- 'output_handler=',
- 'open_basedir=',
- 'safe_mode=0',
- 'disable_functions=',
- 'output_buffering=Off',
- 'display_errors=1',
- 'log_errors=0',
- 'html_errors=0',
- 'track_errors=1',
- 'report_memleaks=0',
- 'report_zend_debug=0',
- 'docref_root=',
- 'docref_ext=.html',
- 'error_prepend_string=',
- 'error_append_string=',
- 'auto_prepend_file=',
- 'auto_append_file=',
- 'magic_quotes_runtime=0',
- 'xdebug.default_enable=0',
- 'allow_url_fopen=1',
- );
-
- /**
- * An object that supports the PEAR_Common->log() signature, or null
- * @param PEAR_Common|null
- */
- function PEAR_RunTest($logger = null, $options = array())
- {
- if (!defined('E_DEPRECATED')) {
- define('E_DEPRECATED', 0);
- }
- if (!defined('E_STRICT')) {
- define('E_STRICT', 0);
- }
- $this->ini_overwrites[] = 'error_reporting=' . (E_ALL & ~(E_DEPRECATED | E_STRICT));
- if (is_null($logger)) {
- require_once 'PEAR/Common.php';
- $logger = new PEAR_Common;
- }
- $this->_logger = $logger;
- $this->_options = $options;
-
- $conf = &PEAR_Config::singleton();
- $this->_php = $conf->get('php_bin');
- }
-
- /**
- * Taken from php-src/run-tests.php
- *
- * @param string $commandline command name
- * @param array $env
- * @param string $stdin standard input to pass to the command
- * @return unknown
- */
- function system_with_timeout($commandline, $env = null, $stdin = null)
- {
- $data = '';
- if (version_compare(phpversion(), '5.0.0', '<')) {
- $proc = proc_open($commandline, array(
- 0 => array('pipe', 'r'),
- 1 => array('pipe', 'w'),
- 2 => array('pipe', 'w')
- ), $pipes);
- } else {
- $proc = proc_open($commandline, array(
- 0 => array('pipe', 'r'),
- 1 => array('pipe', 'w'),
- 2 => array('pipe', 'w')
- ), $pipes, null, $env, array('suppress_errors' => true));
- }
-
- if (!$proc) {
- return false;
- }
-
- if (is_string($stdin)) {
- fwrite($pipes[0], $stdin);
- }
- fclose($pipes[0]);
-
- while (true) {
- /* hide errors from interrupted syscalls */
- $r = $pipes;
- $e = $w = null;
- $n = @stream_select($r, $w, $e, 60);
-
- if ($n === 0) {
- /* timed out */
- $data .= "\n ** ERROR: process timed out **\n";
- proc_terminate($proc);
- return array(1234567890, $data);
- } else if ($n > 0) {
- $line = fread($pipes[1], 8192);
- if (strlen($line) == 0) {
- /* EOF */
- break;
- }
- $data .= $line;
- }
- }
- if (function_exists('proc_get_status')) {
- $stat = proc_get_status($proc);
- if ($stat['signaled']) {
- $data .= "\nTermsig=".$stat['stopsig'];
- }
- }
- $code = proc_close($proc);
- if (function_exists('proc_get_status')) {
- $code = $stat['exitcode'];
- }
- return array($code, $data);
- }
-
- /**
- * Turns a PHP INI string into an array
- *
- * Turns -d "include_path=/foo/bar" into this:
- * array(
- * 'include_path' => array(
- * 'operator' => '-d',
- * 'value' => '/foo/bar',
- * )
- * )
- * Works both with quotes and without
- *
- * @param string an PHP INI string, -d "include_path=/foo/bar"
- * @return array
- */
- function iniString2array($ini_string)
- {
- if (!$ini_string) {
- return array();
- }
- $split = preg_split('/[\s]|=/', $ini_string, -1, PREG_SPLIT_NO_EMPTY);
- $key = $split[1][0] == '"' ? substr($split[1], 1) : $split[1];
- $value = $split[2][strlen($split[2]) - 1] == '"' ? substr($split[2], 0, -1) : $split[2];
- // FIXME review if this is really the struct to go with
- $array = array($key => array('operator' => $split[0], 'value' => $value));
- return $array;
- }
-
- function settings2array($settings, $ini_settings)
- {
- foreach ($settings as $setting) {
- if (strpos($setting, '=') !== false) {
- $setting = explode('=', $setting, 2);
- $name = trim(strtolower($setting[0]));
- $value = trim($setting[1]);
- $ini_settings[$name] = $value;
- }
- }
- return $ini_settings;
- }
-
- function settings2params($ini_settings)
- {
- $settings = '';
- foreach ($ini_settings as $name => $value) {
- if (is_array($value)) {
- $operator = $value['operator'];
- $value = $value['value'];
- } else {
- $operator = '-d';
- }
- $value = addslashes($value);
- $settings .= " $operator \"$name=$value\"";
- }
- return $settings;
- }
-
- function _preparePhpBin($php, $file, $ini_settings)
- {
- $file = escapeshellarg($file);
- // This was fixed in php 5.3 and is not needed after that
- if (OS_WINDOWS && version_compare(PHP_VERSION, '5.3', '<')) {
- $cmd = '"'.escapeshellarg($php).' '.$ini_settings.' -f ' . $file .'"';
- } else {
- $cmd = $php . $ini_settings . ' -f ' . $file;
- }
-
- return $cmd;
- }
-
- function runPHPUnit($file, $ini_settings = '')
- {
- if (!file_exists($file) && file_exists(getcwd() . DIRECTORY_SEPARATOR . $file)) {
- $file = realpath(getcwd() . DIRECTORY_SEPARATOR . $file);
- } elseif (file_exists($file)) {
- $file = realpath($file);
- }
-
- $cmd = $this->_preparePhpBin($this->_php, $file, $ini_settings);
- if (isset($this->_logger)) {
- $this->_logger->log(2, 'Running command "' . $cmd . '"');
- }
-
- $savedir = getcwd(); // in case the test moves us around
- chdir(dirname($file));
- echo `$cmd`;
- chdir($savedir);
- return 'PASSED'; // we have no way of knowing this information so assume passing
- }
-
- /**
- * Runs an individual test case.
- *
- * @param string The filename of the test
- * @param array|string INI settings to be applied to the test run
- * @param integer Number what the current running test is of the
- * whole test suite being runned.
- *
- * @return string|object Returns PASSED, WARNED, FAILED depending on how the
- * test came out.
- * PEAR Error when the tester it self fails
- */
- function run($file, $ini_settings = array(), $test_number = 1)
- {
- if (isset($this->_savephp)) {
- $this->_php = $this->_savephp;
- unset($this->_savephp);
- }
- if (empty($this->_options['cgi'])) {
- // try to see if php-cgi is in the path
- $res = $this->system_with_timeout('php-cgi -v');
- if (false !== $res && !(is_array($res) && in_array($res[0], array(-1, 127)))) {
- $this->_options['cgi'] = 'php-cgi';
- }
- }
- if (1 < $len = strlen($this->tests_count)) {
- $test_number = str_pad($test_number, $len, ' ', STR_PAD_LEFT);
- $test_nr = "[$test_number/$this->tests_count] ";
- } else {
- $test_nr = '';
- }
-
- $file = realpath($file);
- $section_text = $this->_readFile($file);
- if (PEAR::isError($section_text)) {
- return $section_text;
- }
-
- if (isset($section_text['POST_RAW']) && isset($section_text['UPLOAD'])) {
- return PEAR::raiseError("Cannot contain both POST_RAW and UPLOAD in test file: $file");
- }
-
- $cwd = getcwd();
-
- $pass_options = '';
- if (!empty($this->_options['ini'])) {
- $pass_options = $this->_options['ini'];
- }
-
- if (is_string($ini_settings)) {
- $ini_settings = $this->iniString2array($ini_settings);
- }
-
- $ini_settings = $this->settings2array($this->ini_overwrites, $ini_settings);
- if ($section_text['INI']) {
- if (strpos($section_text['INI'], '{PWD}') !== false) {
- $section_text['INI'] = str_replace('{PWD}', dirname($file), $section_text['INI']);
- }
- $ini = preg_split( "/[\n\r]+/", $section_text['INI']);
- $ini_settings = $this->settings2array($ini, $ini_settings);
- }
- $ini_settings = $this->settings2params($ini_settings);
- $shortname = str_replace($cwd . DIRECTORY_SEPARATOR, '', $file);
-
- $tested = trim($section_text['TEST']);
- $tested.= !isset($this->_options['simple']) ? "[$shortname]" : ' ';
-
- if (!empty($section_text['POST']) || !empty($section_text['POST_RAW']) ||
- !empty($section_text['UPLOAD']) || !empty($section_text['GET']) ||
- !empty($section_text['COOKIE']) || !empty($section_text['EXPECTHEADERS'])) {
- if (empty($this->_options['cgi'])) {
- if (!isset($this->_options['quiet'])) {
- $this->_logger->log(0, "SKIP $test_nr$tested (reason: --cgi option needed for this test, type 'pear help run-tests')");
- }
- if (isset($this->_options['tapoutput'])) {
- return array('ok', ' # skip --cgi option needed for this test, "pear help run-tests" for info');
- }
- return 'SKIPPED';
- }
- $this->_savephp = $this->_php;
- $this->_php = $this->_options['cgi'];
- }
-
- $temp_dir = realpath(dirname($file));
- $main_file_name = basename($file, 'phpt');
- $diff_filename = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name.'diff';
- $log_filename = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name.'log';
- $exp_filename = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name.'exp';
- $output_filename = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name.'out';
- $memcheck_filename = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name.'mem';
- $temp_file = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name.'php';
- $temp_skipif = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name.'skip.php';
- $temp_clean = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name.'clean.php';
- $tmp_post = $temp_dir . DIRECTORY_SEPARATOR . uniqid('phpt.');
-
- // unlink old test results
- $this->_cleanupOldFiles($file);
-
- // Check if test should be skipped.
- $res = $this->_runSkipIf($section_text, $temp_skipif, $tested, $ini_settings);
- if (count($res) != 2) {
- return $res;
- }
- $info = $res['info'];
- $warn = $res['warn'];
-
- // We've satisfied the preconditions - run the test!
- if (isset($this->_options['coverage']) && $this->xdebug_loaded) {
- $xdebug_file = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name . 'xdebug';
- $text = "\n" . 'function coverage_shutdown() {' .
- "\n" . ' $xdebug = var_export(xdebug_get_code_coverage(), true);';
- if (!function_exists('file_put_contents')) {
- $text .= "\n" . ' $fh = fopen(\'' . $xdebug_file . '\', "wb");' .
- "\n" . ' if ($fh !== false) {' .
- "\n" . ' fwrite($fh, $xdebug);' .
- "\n" . ' fclose($fh);' .
- "\n" . ' }';
- } else {
- $text .= "\n" . ' file_put_contents(\'' . $xdebug_file . '\', $xdebug);';
- }
-
- // Workaround for http://pear.php.net/bugs/bug.php?id=17292
- $lines = explode("\n", $section_text['FILE']);
- $numLines = count($lines);
- $namespace = '';
- $coverage_shutdown = 'coverage_shutdown';
-
- if (
- substr($lines[0], 0, 2) == '<?' ||
- substr($lines[0], 0, 5) == '<?php'
- ) {
- unset($lines[0]);
- }
-
-
- for ($i = 0; $i < $numLines; $i++) {
- if (isset($lines[$i]) && substr($lines[$i], 0, 9) == 'namespace') {
- $namespace = substr($lines[$i], 10, -1);
- $coverage_shutdown = $namespace . '\\coverage_shutdown';
- $namespace = "namespace " . $namespace . ";\n";
-
- unset($lines[$i]);
- break;
- }
- }
-
- $text .= "\n xdebug_stop_code_coverage();" .
- "\n" . '} // end coverage_shutdown()' .
- "\n\n" . 'register_shutdown_function("' . $coverage_shutdown . '");';
- $text .= "\n" . 'xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);' . "\n";
-
- $this->save_text($temp_file, "<?php\n" . $namespace . $text . "\n" . implode("\n", $lines));
- } else {
- $this->save_text($temp_file, $section_text['FILE']);
- }
-
- $args = $section_text['ARGS'] ? ' -- '.$section_text['ARGS'] : '';
- $cmd = $this->_preparePhpBin($this->_php, $temp_file, $ini_settings);
- $cmd.= "$args 2>&1";
- if (isset($this->_logger)) {
- $this->_logger->log(2, 'Running command "' . $cmd . '"');
- }
-
- // Reset environment from any previous test.
- $env = $this->_resetEnv($section_text, $temp_file);
-
- $section_text = $this->_processUpload($section_text, $file);
- if (PEAR::isError($section_text)) {
- return $section_text;
- }
-
- if (array_key_exists('POST_RAW', $section_text) && !empty($section_text['POST_RAW'])) {
- $post = trim($section_text['POST_RAW']);
- $raw_lines = explode("\n", $post);
-
- $request = '';
- $started = false;
- foreach ($raw_lines as $i => $line) {
- if (empty($env['CONTENT_TYPE']) &&
- preg_match('/^Content-Type:(.*)/i', $line, $res)) {
- $env['CONTENT_TYPE'] = trim(str_replace("\r", '', $res[1]));
- continue;
- }
- if ($started) {
- $request .= "\n";
- }
- $started = true;
- $request .= $line;
- }
-
- $env['CONTENT_LENGTH'] = strlen($request);
- $env['REQUEST_METHOD'] = 'POST';
-
- $this->save_text($tmp_post, $request);
- $cmd = "$this->_php$pass_options$ini_settings \"$temp_file\" 2>&1 < $tmp_post";
- } elseif (array_key_exists('POST', $section_text) && !empty($section_text['POST'])) {
- $post = trim($section_text['POST']);
- $this->save_text($tmp_post, $post);
- $content_length = strlen($post);
-
- $env['REQUEST_METHOD'] = 'POST';
- $env['CONTENT_TYPE'] = 'application/x-www-form-urlencoded';
- $env['CONTENT_LENGTH'] = $content_length;
-
- $cmd = "$this->_php$pass_options$ini_settings \"$temp_file\" 2>&1 < $tmp_post";
- } else {
- $env['REQUEST_METHOD'] = 'GET';
- $env['CONTENT_TYPE'] = '';
- $env['CONTENT_LENGTH'] = '';
- }
-
- if (OS_WINDOWS && isset($section_text['RETURNS'])) {
- ob_start();
- system($cmd, $return_value);
- $out = ob_get_contents();
- ob_end_clean();
- $section_text['RETURNS'] = (int) trim($section_text['RETURNS']);
- $returnfail = ($return_value != $section_text['RETURNS']);
- } else {
- $returnfail = false;
- $stdin = isset($section_text['STDIN']) ? $section_text['STDIN'] : null;
- $out = $this->system_with_timeout($cmd, $env, $stdin);
- $return_value = $out[0];
- $out = $out[1];
- }
-
- $output = preg_replace('/\r\n/', "\n", trim($out));
-
- if (isset($tmp_post) && realpath($tmp_post) && file_exists($tmp_post)) {
- @unlink(realpath($tmp_post));
- }
- chdir($cwd); // in case the test moves us around
-
- $this->_testCleanup($section_text, $temp_clean);
-
- /* when using CGI, strip the headers from the output */
- $output = $this->_stripHeadersCGI($output);
-
- if (isset($section_text['EXPECTHEADERS'])) {
- $testheaders = $this->_processHeaders($section_text['EXPECTHEADERS']);
- $missing = array_diff_assoc($testheaders, $this->_headers);
- $changed = '';
- foreach ($missing as $header => $value) {
- if (isset($this->_headers[$header])) {
- $changed .= "-$header: $value\n+$header: ";
- $changed .= $this->_headers[$header];
- } else {
- $changed .= "-$header: $value\n";
- }
- }
- if ($missing) {
- // tack on failed headers to output:
- $output .= "\n====EXPECTHEADERS FAILURE====:\n$changed";
- }
- }
- // Does the output match what is expected?
- do {
- if (isset($section_text['EXPECTF']) || isset($section_text['EXPECTREGEX'])) {
- if (isset($section_text['EXPECTF'])) {
- $wanted = trim($section_text['EXPECTF']);
- } else {
- $wanted = trim($section_text['EXPECTREGEX']);
- }
- $wanted_re = preg_replace('/\r\n/', "\n", $wanted);
- if (isset($section_text['EXPECTF'])) {
- $wanted_re = preg_quote($wanted_re, '/');
- // Stick to basics
- $wanted_re = str_replace("%s", ".+?", $wanted_re); //not greedy
- $wanted_re = str_replace("%i", "[+\-]?[0-9]+", $wanted_re);
- $wanted_re = str_replace("%d", "[0-9]+", $wanted_re);
- $wanted_re = str_replace("%x", "[0-9a-fA-F]+", $wanted_re);
- $wanted_re = str_replace("%f", "[+\-]?\.?[0-9]+\.?[0-9]*(E-?[0-9]+)?", $wanted_re);
- $wanted_re = str_replace("%c", ".", $wanted_re);
- // %f allows two points "-.0.0" but that is the best *simple* expression
- }
-
- /* DEBUG YOUR REGEX HERE
- var_dump($wanted_re);
- print(str_repeat('=', 80) . "\n");
- var_dump($output);
- */
- if (!$returnfail && preg_match("/^$wanted_re\$/s", $output)) {
- if (file_exists($temp_file)) {
- unlink($temp_file);
- }
- if (array_key_exists('FAIL', $section_text)) {
- break;
- }
- if (!isset($this->_options['quiet'])) {
- $this->_logger->log(0, "PASS $test_nr$tested$info");
- }
- if (isset($this->_options['tapoutput'])) {
- return array('ok', ' - ' . $tested);
- }
- return 'PASSED';
- }
- } else {
- if (isset($section_text['EXPECTFILE'])) {
- $f = $temp_dir . '/' . trim($section_text['EXPECTFILE']);
- if (!($fp = @fopen($f, 'rb'))) {
- return PEAR::raiseError('--EXPECTFILE-- section file ' .
- $f . ' not found');
- }
- fclose($fp);
- $section_text['EXPECT'] = file_get_contents($f);
- }
-
- if (isset($section_text['EXPECT'])) {
- $wanted = preg_replace('/\r\n/', "\n", trim($section_text['EXPECT']));
- } else {
- $wanted = '';
- }
-
- // compare and leave on success
- if (!$returnfail && 0 == strcmp($output, $wanted)) {
- if (file_exists($temp_file)) {
- unlink($temp_file);
- }
- if (array_key_exists('FAIL', $section_text)) {
- break;
- }
- if (!isset($this->_options['quiet'])) {
- $this->_logger->log(0, "PASS $test_nr$tested$info");
- }
- if (isset($this->_options['tapoutput'])) {
- return array('ok', ' - ' . $tested);
- }
- return 'PASSED';
- }
- }
- } while (false);
-
- if (array_key_exists('FAIL', $section_text)) {
- // we expect a particular failure
- // this is only used for testing PEAR_RunTest
- $expectf = isset($section_text['EXPECTF']) ? $wanted_re : null;
- $faildiff = $this->generate_diff($wanted, $output, null, $expectf);
- $faildiff = preg_replace('/\r/', '', $faildiff);
- $wanted = preg_replace('/\r/', '', trim($section_text['FAIL']));
- if ($faildiff == $wanted) {
- if (!isset($this->_options['quiet'])) {
- $this->_logger->log(0, "PASS $test_nr$tested$info");
- }
- if (isset($this->_options['tapoutput'])) {
- return array('ok', ' - ' . $tested);
- }
- return 'PASSED';
- }
- unset($section_text['EXPECTF']);
- $output = $faildiff;
- if (isset($section_text['RETURNS'])) {
- return PEAR::raiseError('Cannot have both RETURNS and FAIL in the same test: ' .
- $file);
- }
- }
-
- // Test failed so we need to report details.
- $txt = $warn ? 'WARN ' : 'FAIL ';
- $this->_logger->log(0, $txt . $test_nr . $tested . $info);
-
- // write .exp
- $res = $this->_writeLog($exp_filename, $wanted);
- if (PEAR::isError($res)) {
- return $res;
- }
-
- // write .out
- $res = $this->_writeLog($output_filename, $output);
- if (PEAR::isError($res)) {
- return $res;
- }
-
- // write .diff
- $returns = isset($section_text['RETURNS']) ?
- array(trim($section_text['RETURNS']), $return_value) : null;
- $expectf = isset($section_text['EXPECTF']) ? $wanted_re : null;
- $data = $this->generate_diff($wanted, $output, $returns, $expectf);
- $res = $this->_writeLog($diff_filename, $data);
- if (PEAR::isError($res)) {
- return $res;
- }
-
- // write .log
- $data = "
----- EXPECTED OUTPUT
-$wanted
----- ACTUAL OUTPUT
-$output
----- FAILED
-";
-
- if ($returnfail) {
- $data .= "
----- EXPECTED RETURN
-$section_text[RETURNS]
----- ACTUAL RETURN
-$return_value
-";
- }
-
- $res = $this->_writeLog($log_filename, $data);
- if (PEAR::isError($res)) {
- return $res;
- }
-
- if (isset($this->_options['tapoutput'])) {
- $wanted = explode("\n", $wanted);
- $wanted = "# Expected output:\n#\n#" . implode("\n#", $wanted);
- $output = explode("\n", $output);
- $output = "#\n#\n# Actual output:\n#\n#" . implode("\n#", $output);
- return array($wanted . $output . 'not ok', ' - ' . $tested);
- }
- return $warn ? 'WARNED' : 'FAILED';
- }
-
- function generate_diff($wanted, $output, $rvalue, $wanted_re)
- {
- $w = explode("\n", $wanted);
- $o = explode("\n", $output);
- $wr = explode("\n", $wanted_re);
- $w1 = array_diff_assoc($w, $o);
- $o1 = array_diff_assoc($o, $w);
- $o2 = $w2 = array();
- foreach ($w1 as $idx => $val) {
- if (!$wanted_re || !isset($wr[$idx]) || !isset($o1[$idx]) ||
- !preg_match('/^' . $wr[$idx] . '\\z/', $o1[$idx])) {
- $w2[sprintf("%03d<", $idx)] = sprintf("%03d- ", $idx + 1) . $val;
- }
- }
- foreach ($o1 as $idx => $val) {
- if (!$wanted_re || !isset($wr[$idx]) ||
- !preg_match('/^' . $wr[$idx] . '\\z/', $val)) {
- $o2[sprintf("%03d>", $idx)] = sprintf("%03d+ ", $idx + 1) . $val;
- }
- }
- $diff = array_merge($w2, $o2);
- ksort($diff);
- $extra = $rvalue ? "##EXPECTED: $rvalue[0]\r\n##RETURNED: $rvalue[1]" : '';
- return implode("\r\n", $diff) . $extra;
- }
-
- // Write the given text to a temporary file, and return the filename.
- function save_text($filename, $text)
- {
- if (!$fp = fopen($filename, 'w')) {
- return PEAR::raiseError("Cannot open file '" . $filename . "' (save_text)");
- }
- fwrite($fp, $text);
- fclose($fp);
- if (1 < DETAILED) echo "
-FILE $filename {{{
-$text
-}}}
-";
- }
-
- function _cleanupOldFiles($file)
- {
- $temp_dir = realpath(dirname($file));
- $mainFileName = basename($file, 'phpt');
- $diff_filename = $temp_dir . DIRECTORY_SEPARATOR . $mainFileName.'diff';
- $log_filename = $temp_dir . DIRECTORY_SEPARATOR . $mainFileName.'log';
- $exp_filename = $temp_dir . DIRECTORY_SEPARATOR . $mainFileName.'exp';
- $output_filename = $temp_dir . DIRECTORY_SEPARATOR . $mainFileName.'out';
- $memcheck_filename = $temp_dir . DIRECTORY_SEPARATOR . $mainFileName.'mem';
- $temp_file = $temp_dir . DIRECTORY_SEPARATOR . $mainFileName.'php';
- $temp_skipif = $temp_dir . DIRECTORY_SEPARATOR . $mainFileName.'skip.php';
- $temp_clean = $temp_dir . DIRECTORY_SEPARATOR . $mainFileName.'clean.php';
- $tmp_post = $temp_dir . DIRECTORY_SEPARATOR . uniqid('phpt.');
-
- // unlink old test results
- @unlink($diff_filename);
- @unlink($log_filename);
- @unlink($exp_filename);
- @unlink($output_filename);
- @unlink($memcheck_filename);
- @unlink($temp_file);
- @unlink($temp_skipif);
- @unlink($tmp_post);
- @unlink($temp_clean);
- }
-
- function _runSkipIf($section_text, $temp_skipif, $tested, $ini_settings)
- {
- $info = '';
- $warn = false;
- if (array_key_exists('SKIPIF', $section_text) && trim($section_text['SKIPIF'])) {
- $this->save_text($temp_skipif, $section_text['SKIPIF']);
- $output = $this->system_with_timeout("$this->_php$ini_settings -f \"$temp_skipif\"");
- $output = $output[1];
- $loutput = ltrim($output);
- unlink($temp_skipif);
- if (!strncasecmp('skip', $loutput, 4)) {
- $skipreason = "SKIP $tested";
- if (preg_match('/^\s*skip\s*(.+)\s*/i', $output, $m)) {
- $skipreason .= '(reason: ' . $m[1] . ')';
- }
- if (!isset($this->_options['quiet'])) {
- $this->_logger->log(0, $skipreason);
- }
- if (isset($this->_options['tapoutput'])) {
- return array('ok', ' # skip ' . $reason);
- }
- return 'SKIPPED';
- }
-
- if (!strncasecmp('info', $loutput, 4)
- && preg_match('/^\s*info\s*(.+)\s*/i', $output, $m)) {
- $info = " (info: $m[1])";
- }
-
- if (!strncasecmp('warn', $loutput, 4)
- && preg_match('/^\s*warn\s*(.+)\s*/i', $output, $m)) {
- $warn = true; /* only if there is a reason */
- $info = " (warn: $m[1])";
- }
- }
-
- return array('warn' => $warn, 'info' => $info);
- }
-
- function _stripHeadersCGI($output)
- {
- $this->headers = array();
- if (!empty($this->_options['cgi']) &&
- $this->_php == $this->_options['cgi'] &&
- preg_match("/^(.*?)(?:\n\n(.*)|\\z)/s", $output, $match)) {
- $output = isset($match[2]) ? trim($match[2]) : '';
- $this->_headers = $this->_processHeaders($match[1]);
- }
-
- return $output;
- }
-
- /**
- * Return an array that can be used with array_diff() to compare headers
- *
- * @param string $text
- */
- function _processHeaders($text)
- {
- $headers = array();
- $rh = preg_split("/[\n\r]+/", $text);
- foreach ($rh as $line) {
- if (strpos($line, ':')!== false) {
- $line = explode(':', $line, 2);
- $headers[trim($line[0])] = trim($line[1]);
- }
- }
- return $headers;
- }
-
- function _readFile($file)
- {
- // Load the sections of the test file.
- $section_text = array(
- 'TEST' => '(unnamed test)',
- 'SKIPIF' => '',
- 'GET' => '',
- 'COOKIE' => '',
- 'POST' => '',
- 'ARGS' => '',
- 'INI' => '',
- 'CLEAN' => '',
- );
-
- if (!is_file($file) || !$fp = fopen($file, "r")) {
- return PEAR::raiseError("Cannot open test file: $file");
- }
-
- $section = '';
- while (!feof($fp)) {
- $line = fgets($fp);
-
- // Match the beginning of a section.
- if (preg_match('/^--([_A-Z]+)--/', $line, $r)) {
- $section = $r[1];
- $section_text[$section] = '';
- continue;
- } elseif (empty($section)) {
- fclose($fp);
- return PEAR::raiseError("Invalid sections formats in test file: $file");
- }
-
- // Add to the section text.
- $section_text[$section] .= $line;
- }
- fclose($fp);
-
- return $section_text;
- }
-
- function _writeLog($logname, $data)
- {
- if (!$log = fopen($logname, 'w')) {
- return PEAR::raiseError("Cannot create test log - $logname");
- }
- fwrite($log, $data);
- fclose($log);
- }
-
- function _resetEnv($section_text, $temp_file)
- {
- $env = $_ENV;
- $env['REDIRECT_STATUS'] = '';
- $env['QUERY_STRING'] = '';
- $env['PATH_TRANSLATED'] = '';
- $env['SCRIPT_FILENAME'] = '';
- $env['REQUEST_METHOD'] = '';
- $env['CONTENT_TYPE'] = '';
- $env['CONTENT_LENGTH'] = '';
- if (!empty($section_text['ENV'])) {
- if (strpos($section_text['ENV'], '{PWD}') !== false) {
- $section_text['ENV'] = str_replace('{PWD}', dirname($temp_file), $section_text['ENV']);
- }
- foreach (explode("\n", trim($section_text['ENV'])) as $e) {
- $e = explode('=', trim($e), 2);
- if (!empty($e[0]) && isset($e[1])) {
- $env[$e[0]] = $e[1];
- }
- }
- }
- if (array_key_exists('GET', $section_text)) {
- $env['QUERY_STRING'] = trim($section_text['GET']);
- } else {
- $env['QUERY_STRING'] = '';
- }
- if (array_key_exists('COOKIE', $section_text)) {
- $env['HTTP_COOKIE'] = trim($section_text['COOKIE']);
- } else {
- $env['HTTP_COOKIE'] = '';
- }
- $env['REDIRECT_STATUS'] = '1';
- $env['PATH_TRANSLATED'] = $temp_file;
- $env['SCRIPT_FILENAME'] = $temp_file;
-
- return $env;
- }
-
- function _processUpload($section_text, $file)
- {
- if (array_key_exists('UPLOAD', $section_text) && !empty($section_text['UPLOAD'])) {
- $upload_files = trim($section_text['UPLOAD']);
- $upload_files = explode("\n", $upload_files);
-
- $request = "Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737\n" .
- "-----------------------------20896060251896012921717172737\n";
- foreach ($upload_files as $fileinfo) {
- $fileinfo = explode('=', $fileinfo);
- if (count($fileinfo) != 2) {
- return PEAR::raiseError("Invalid UPLOAD section in test file: $file");
- }
- if (!realpath(dirname($file) . '/' . $fileinfo[1])) {
- return PEAR::raiseError("File for upload does not exist: $fileinfo[1] " .
- "in test file: $file");
- }
- $file_contents = file_get_contents(dirname($file) . '/' . $fileinfo[1]);
- $fileinfo[1] = basename($fileinfo[1]);
- $request .= "Content-Disposition: form-data; name=\"$fileinfo[0]\"; filename=\"$fileinfo[1]\"\n";
- $request .= "Content-Type: text/plain\n\n";
- $request .= $file_contents . "\n" .
- "-----------------------------20896060251896012921717172737\n";
- }
-
- if (array_key_exists('POST', $section_text) && !empty($section_text['POST'])) {
- // encode POST raw
- $post = trim($section_text['POST']);
- $post = explode('&', $post);
- foreach ($post as $i => $post_info) {
- $post_info = explode('=', $post_info);
- if (count($post_info) != 2) {
- return PEAR::raiseError("Invalid POST data in test file: $file");
- }
- $post_info[0] = rawurldecode($post_info[0]);
- $post_info[1] = rawurldecode($post_info[1]);
- $post[$i] = $post_info;
- }
- foreach ($post as $post_info) {
- $request .= "Content-Disposition: form-data; name=\"$post_info[0]\"\n\n";
- $request .= $post_info[1] . "\n" .
- "-----------------------------20896060251896012921717172737\n";
- }
- unset($section_text['POST']);
- }
- $section_text['POST_RAW'] = $request;
- }
-
- return $section_text;
- }
-
- function _testCleanup($section_text, $temp_clean)
- {
- if ($section_text['CLEAN']) {
- // perform test cleanup
- $this->save_text($temp_clean, $section_text['CLEAN']);
- $output = $this->system_with_timeout("$this->_php $temp_clean 2>&1");
- if (strlen($output[1])) {
- echo "BORKED --CLEAN-- section! output:\n", $output[1];
- }
- if (file_exists($temp_clean)) {
- unlink($temp_clean);
- }
- }
- }
-}
diff --git a/3rdparty/PEAR/Task/Common.php b/3rdparty/PEAR/Task/Common.php
deleted file mode 100644
index 5b99c2e4347..00000000000
--- a/3rdparty/PEAR/Task/Common.php
+++ /dev/null
@@ -1,202 +0,0 @@
-<?php
-/**
- * PEAR_Task_Common, base class for installer tasks
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Common.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a1
- */
-/**#@+
- * Error codes for task validation routines
- */
-define('PEAR_TASK_ERROR_NOATTRIBS', 1);
-define('PEAR_TASK_ERROR_MISSING_ATTRIB', 2);
-define('PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE', 3);
-define('PEAR_TASK_ERROR_INVALID', 4);
-/**#@-*/
-define('PEAR_TASK_PACKAGE', 1);
-define('PEAR_TASK_INSTALL', 2);
-define('PEAR_TASK_PACKAGEANDINSTALL', 3);
-/**
- * A task is an operation that manipulates the contents of a file.
- *
- * Simple tasks operate on 1 file. Multiple tasks are executed after all files have been
- * processed and installed, and are designed to operate on all files containing the task.
- * The Post-install script task simply takes advantage of the fact that it will be run
- * after installation, replace is a simple task.
- *
- * Combining tasks is possible, but ordering is significant.
- *
- * <file name="test.php" role="php">
- * <tasks:replace from="@data-dir@" to="data_dir" type="pear-config"/>
- * <tasks:postinstallscript/>
- * </file>
- *
- * This will first replace any instance of @data-dir@ in the test.php file
- * with the path to the current data directory. Then, it will include the
- * test.php file and run the script it contains to configure the package post-installation.
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a1
- * @abstract
- */
-class PEAR_Task_Common
-{
- /**
- * Valid types for this version are 'simple' and 'multiple'
- *
- * - simple tasks operate on the contents of a file and write out changes to disk
- * - multiple tasks operate on the contents of many files and write out the
- * changes directly to disk
- *
- * Child task classes must override this property.
- * @access protected
- */
- var $type = 'simple';
- /**
- * Determines which install phase this task is executed under
- */
- var $phase = PEAR_TASK_INSTALL;
- /**
- * @access protected
- */
- var $config;
- /**
- * @access protected
- */
- var $registry;
- /**
- * @access protected
- */
- var $logger;
- /**
- * @access protected
- */
- var $installphase;
- /**
- * @param PEAR_Config
- * @param PEAR_Common
- */
- function PEAR_Task_Common(&$config, &$logger, $phase)
- {
- $this->config = &$config;
- $this->registry = &$config->getRegistry();
- $this->logger = &$logger;
- $this->installphase = $phase;
- if ($this->type == 'multiple') {
- $GLOBALS['_PEAR_TASK_POSTINSTANCES'][get_class($this)][] = &$this;
- }
- }
-
- /**
- * Validate the basic contents of a task tag.
- * @param PEAR_PackageFile_v2
- * @param array
- * @param PEAR_Config
- * @param array the entire parsed <file> tag
- * @return true|array On error, return an array in format:
- * array(PEAR_TASK_ERROR_???[, param1][, param2][, ...])
- *
- * For PEAR_TASK_ERROR_MISSING_ATTRIB, pass the attribute name in
- * For PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE, pass the attribute name and an array
- * of legal values in
- * @static
- * @abstract
- */
- function validateXml($pkg, $xml, $config, $fileXml)
- {
- }
-
- /**
- * Initialize a task instance with the parameters
- * @param array raw, parsed xml
- * @param array attributes from the <file> tag containing this task
- * @param string|null last installed version of this package
- * @abstract
- */
- function init($xml, $fileAttributes, $lastVersion)
- {
- }
-
- /**
- * Begin a task processing session. All multiple tasks will be processed after each file
- * has been successfully installed, all simple tasks should perform their task here and
- * return any errors using the custom throwError() method to allow forward compatibility
- *
- * This method MUST NOT write out any changes to disk
- * @param PEAR_PackageFile_v2
- * @param string file contents
- * @param string the eventual final file location (informational only)
- * @return string|false|PEAR_Error false to skip this file, PEAR_Error to fail
- * (use $this->throwError), otherwise return the new contents
- * @abstract
- */
- function startSession($pkg, $contents, $dest)
- {
- }
-
- /**
- * This method is used to process each of the tasks for a particular multiple class
- * type. Simple tasks need not implement this method.
- * @param array an array of tasks
- * @access protected
- * @static
- * @abstract
- */
- function run($tasks)
- {
- }
-
- /**
- * @static
- * @final
- */
- function hasPostinstallTasks()
- {
- return isset($GLOBALS['_PEAR_TASK_POSTINSTANCES']);
- }
-
- /**
- * @static
- * @final
- */
- function runPostinstallTasks()
- {
- foreach ($GLOBALS['_PEAR_TASK_POSTINSTANCES'] as $class => $tasks) {
- $err = call_user_func(array($class, 'run'),
- $GLOBALS['_PEAR_TASK_POSTINSTANCES'][$class]);
- if ($err) {
- return PEAR_Task_Common::throwError($err);
- }
- }
- unset($GLOBALS['_PEAR_TASK_POSTINSTANCES']);
- }
-
- /**
- * Determines whether a role is a script
- * @return bool
- */
- function isScript()
- {
- return $this->type == 'script';
- }
-
- function throwError($msg, $code = -1)
- {
- include_once 'PEAR.php';
- return PEAR::raiseError($msg, $code);
- }
-}
-?> \ No newline at end of file
diff --git a/3rdparty/PEAR/Task/Postinstallscript.php b/3rdparty/PEAR/Task/Postinstallscript.php
deleted file mode 100644
index e43ecca4b3d..00000000000
--- a/3rdparty/PEAR/Task/Postinstallscript.php
+++ /dev/null
@@ -1,323 +0,0 @@
-<?php
-/**
- * <tasks:postinstallscript>
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Postinstallscript.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a1
- */
-/**
- * Base class
- */
-require_once 'PEAR/Task/Common.php';
-/**
- * Implements the postinstallscript file task.
- *
- * Note that post-install scripts are handled separately from installation, by the
- * "pear run-scripts" command
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a1
- */
-class PEAR_Task_Postinstallscript extends PEAR_Task_Common
-{
- var $type = 'script';
- var $_class;
- var $_params;
- var $_obj;
- /**
- *
- * @var PEAR_PackageFile_v2
- */
- var $_pkg;
- var $_contents;
- var $phase = PEAR_TASK_INSTALL;
-
- /**
- * Validate the raw xml at parsing-time.
- *
- * This also attempts to validate the script to make sure it meets the criteria
- * for a post-install script
- * @param PEAR_PackageFile_v2
- * @param array The XML contents of the <postinstallscript> tag
- * @param PEAR_Config
- * @param array the entire parsed <file> tag
- * @static
- */
- function validateXml($pkg, $xml, $config, $fileXml)
- {
- if ($fileXml['role'] != 'php') {
- return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' .
- $fileXml['name'] . '" must be role="php"');
- }
- PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
- $file = $pkg->getFileContents($fileXml['name']);
- if (PEAR::isError($file)) {
- PEAR::popErrorHandling();
- return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' .
- $fileXml['name'] . '" is not valid: ' .
- $file->getMessage());
- } elseif ($file === null) {
- return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' .
- $fileXml['name'] . '" could not be retrieved for processing!');
- } else {
- $analysis = $pkg->analyzeSourceCode($file, true);
- if (!$analysis) {
- PEAR::popErrorHandling();
- $warnings = '';
- foreach ($pkg->getValidationWarnings() as $warn) {
- $warnings .= $warn['message'] . "\n";
- }
- return array(PEAR_TASK_ERROR_INVALID, 'Analysis of post-install script "' .
- $fileXml['name'] . '" failed: ' . $warnings);
- }
- if (count($analysis['declared_classes']) != 1) {
- PEAR::popErrorHandling();
- return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' .
- $fileXml['name'] . '" must declare exactly 1 class');
- }
- $class = $analysis['declared_classes'][0];
- if ($class != str_replace(array('/', '.php'), array('_', ''),
- $fileXml['name']) . '_postinstall') {
- PEAR::popErrorHandling();
- return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' .
- $fileXml['name'] . '" class "' . $class . '" must be named "' .
- str_replace(array('/', '.php'), array('_', ''),
- $fileXml['name']) . '_postinstall"');
- }
- if (!isset($analysis['declared_methods'][$class])) {
- PEAR::popErrorHandling();
- return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' .
- $fileXml['name'] . '" must declare methods init() and run()');
- }
- $methods = array('init' => 0, 'run' => 1);
- foreach ($analysis['declared_methods'][$class] as $method) {
- if (isset($methods[$method])) {
- unset($methods[$method]);
- }
- }
- if (count($methods)) {
- PEAR::popErrorHandling();
- return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' .
- $fileXml['name'] . '" must declare methods init() and run()');
- }
- }
- PEAR::popErrorHandling();
- $definedparams = array();
- $tasksNamespace = $pkg->getTasksNs() . ':';
- if (!isset($xml[$tasksNamespace . 'paramgroup']) && isset($xml['paramgroup'])) {
- // in order to support the older betas, which did not expect internal tags
- // to also use the namespace
- $tasksNamespace = '';
- }
- if (isset($xml[$tasksNamespace . 'paramgroup'])) {
- $params = $xml[$tasksNamespace . 'paramgroup'];
- if (!is_array($params) || !isset($params[0])) {
- $params = array($params);
- }
- foreach ($params as $param) {
- if (!isset($param[$tasksNamespace . 'id'])) {
- return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' .
- $fileXml['name'] . '" <paramgroup> must have ' .
- 'an ' . $tasksNamespace . 'id> tag');
- }
- if (isset($param[$tasksNamespace . 'name'])) {
- if (!in_array($param[$tasksNamespace . 'name'], $definedparams)) {
- return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' .
- $fileXml['name'] . '" ' . $tasksNamespace .
- 'paramgroup> id "' . $param[$tasksNamespace . 'id'] .
- '" parameter "' . $param[$tasksNamespace . 'name'] .
- '" has not been previously defined');
- }
- if (!isset($param[$tasksNamespace . 'conditiontype'])) {
- return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' .
- $fileXml['name'] . '" ' . $tasksNamespace .
- 'paramgroup> id "' . $param[$tasksNamespace . 'id'] .
- '" must have a ' . $tasksNamespace .
- 'conditiontype> tag containing either "=", ' .
- '"!=", or "preg_match"');
- }
- if (!in_array($param[$tasksNamespace . 'conditiontype'],
- array('=', '!=', 'preg_match'))) {
- return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' .
- $fileXml['name'] . '" ' . $tasksNamespace .
- 'paramgroup> id "' . $param[$tasksNamespace . 'id'] .
- '" must have a ' . $tasksNamespace .
- 'conditiontype> tag containing either "=", ' .
- '"!=", or "preg_match"');
- }
- if (!isset($param[$tasksNamespace . 'value'])) {
- return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' .
- $fileXml['name'] . '" ' . $tasksNamespace .
- 'paramgroup> id "' . $param[$tasksNamespace . 'id'] .
- '" must have a ' . $tasksNamespace .
- 'value> tag containing expected parameter value');
- }
- }
- if (isset($param[$tasksNamespace . 'instructions'])) {
- if (!is_string($param[$tasksNamespace . 'instructions'])) {
- return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' .
- $fileXml['name'] . '" ' . $tasksNamespace .
- 'paramgroup> id "' . $param[$tasksNamespace . 'id'] .
- '" ' . $tasksNamespace . 'instructions> must be simple text');
- }
- }
- if (!isset($param[$tasksNamespace . 'param'])) {
- continue; // <param> is no longer required
- }
- $subparams = $param[$tasksNamespace . 'param'];
- if (!is_array($subparams) || !isset($subparams[0])) {
- $subparams = array($subparams);
- }
- foreach ($subparams as $subparam) {
- if (!isset($subparam[$tasksNamespace . 'name'])) {
- return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' .
- $fileXml['name'] . '" parameter for ' .
- $tasksNamespace . 'paramgroup> id "' .
- $param[$tasksNamespace . 'id'] . '" must have ' .
- 'a ' . $tasksNamespace . 'name> tag');
- }
- if (!preg_match('/[a-zA-Z0-9]+/',
- $subparam[$tasksNamespace . 'name'])) {
- return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' .
- $fileXml['name'] . '" parameter "' .
- $subparam[$tasksNamespace . 'name'] .
- '" for ' . $tasksNamespace . 'paramgroup> id "' .
- $param[$tasksNamespace . 'id'] .
- '" is not a valid name. Must contain only alphanumeric characters');
- }
- if (!isset($subparam[$tasksNamespace . 'prompt'])) {
- return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' .
- $fileXml['name'] . '" parameter "' .
- $subparam[$tasksNamespace . 'name'] .
- '" for ' . $tasksNamespace . 'paramgroup> id "' .
- $param[$tasksNamespace . 'id'] .
- '" must have a ' . $tasksNamespace . 'prompt> tag');
- }
- if (!isset($subparam[$tasksNamespace . 'type'])) {
- return array(PEAR_TASK_ERROR_INVALID, 'Post-install script "' .
- $fileXml['name'] . '" parameter "' .
- $subparam[$tasksNamespace . 'name'] .
- '" for ' . $tasksNamespace . 'paramgroup> id "' .
- $param[$tasksNamespace . 'id'] .
- '" must have a ' . $tasksNamespace . 'type> tag');
- }
- $definedparams[] = $param[$tasksNamespace . 'id'] . '::' .
- $subparam[$tasksNamespace . 'name'];
- }
- }
- }
- return true;
- }
-
- /**
- * Initialize a task instance with the parameters
- * @param array raw, parsed xml
- * @param array attributes from the <file> tag containing this task
- * @param string|null last installed version of this package, if any (useful for upgrades)
- */
- function init($xml, $fileattribs, $lastversion)
- {
- $this->_class = str_replace('/', '_', $fileattribs['name']);
- $this->_filename = $fileattribs['name'];
- $this->_class = str_replace ('.php', '', $this->_class) . '_postinstall';
- $this->_params = $xml;
- $this->_lastversion = $lastversion;
- }
-
- /**
- * Strip the tasks: namespace from internal params
- *
- * @access private
- */
- function _stripNamespace($params = null)
- {
- if ($params === null) {
- $params = array();
- if (!is_array($this->_params)) {
- return;
- }
- foreach ($this->_params as $i => $param) {
- if (is_array($param)) {
- $param = $this->_stripNamespace($param);
- }
- $params[str_replace($this->_pkg->getTasksNs() . ':', '', $i)] = $param;
- }
- $this->_params = $params;
- } else {
- $newparams = array();
- foreach ($params as $i => $param) {
- if (is_array($param)) {
- $param = $this->_stripNamespace($param);
- }
- $newparams[str_replace($this->_pkg->getTasksNs() . ':', '', $i)] = $param;
- }
- return $newparams;
- }
- }
-
- /**
- * Unlike other tasks, the installed file name is passed in instead of the file contents,
- * because this task is handled post-installation
- * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2
- * @param string file name
- * @return bool|PEAR_Error false to skip this file, PEAR_Error to fail
- * (use $this->throwError)
- */
- function startSession($pkg, $contents)
- {
- if ($this->installphase != PEAR_TASK_INSTALL) {
- return false;
- }
- // remove the tasks: namespace if present
- $this->_pkg = $pkg;
- $this->_stripNamespace();
- $this->logger->log(0, 'Including external post-installation script "' .
- $contents . '" - any errors are in this script');
- include_once $contents;
- if (class_exists($this->_class)) {
- $this->logger->log(0, 'Inclusion succeeded');
- } else {
- return $this->throwError('init of post-install script class "' . $this->_class
- . '" failed');
- }
- $this->_obj = new $this->_class;
- $this->logger->log(1, 'running post-install script "' . $this->_class . '->init()"');
- PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
- $res = $this->_obj->init($this->config, $pkg, $this->_lastversion);
- PEAR::popErrorHandling();
- if ($res) {
- $this->logger->log(0, 'init succeeded');
- } else {
- return $this->throwError('init of post-install script "' . $this->_class .
- '->init()" failed');
- }
- $this->_contents = $contents;
- return true;
- }
-
- /**
- * No longer used
- * @see PEAR_PackageFile_v2::runPostinstallScripts()
- * @param array an array of tasks
- * @param string install or upgrade
- * @access protected
- * @static
- */
- function run()
- {
- }
-}
-?> \ No newline at end of file
diff --git a/3rdparty/PEAR/Task/Postinstallscript/rw.php b/3rdparty/PEAR/Task/Postinstallscript/rw.php
deleted file mode 100644
index 8f358bf22bc..00000000000
--- a/3rdparty/PEAR/Task/Postinstallscript/rw.php
+++ /dev/null
@@ -1,169 +0,0 @@
-<?php
-/**
- * <tasks:postinstallscript> - read/write version
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: rw.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a10
- */
-/**
- * Base class
- */
-require_once 'PEAR/Task/Postinstallscript.php';
-/**
- * Abstracts the postinstallscript file task xml.
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a10
- */
-class PEAR_Task_Postinstallscript_rw extends PEAR_Task_Postinstallscript
-{
- /**
- * parent package file object
- *
- * @var PEAR_PackageFile_v2_rw
- */
- var $_pkg;
- /**
- * Enter description here...
- *
- * @param PEAR_PackageFile_v2_rw $pkg
- * @param PEAR_Config $config
- * @param PEAR_Frontend $logger
- * @param array $fileXml
- * @return PEAR_Task_Postinstallscript_rw
- */
- function PEAR_Task_Postinstallscript_rw(&$pkg, &$config, &$logger, $fileXml)
- {
- parent::PEAR_Task_Common($config, $logger, PEAR_TASK_PACKAGE);
- $this->_contents = $fileXml;
- $this->_pkg = &$pkg;
- $this->_params = array();
- }
-
- function validate()
- {
- return $this->validateXml($this->_pkg, $this->_params, $this->config, $this->_contents);
- }
-
- function getName()
- {
- return 'postinstallscript';
- }
-
- /**
- * add a simple <paramgroup> to the post-install script
- *
- * Order is significant, so call this method in the same
- * sequence the users should see the paramgroups. The $params
- * parameter should either be the result of a call to {@link getParam()}
- * or an array of calls to getParam().
- *
- * Use {@link addConditionTypeGroup()} to add a <paramgroup> containing
- * a <conditiontype> tag
- * @param string $id <paramgroup> id as seen by the script
- * @param array|false $params array of getParam() calls, or false for no params
- * @param string|false $instructions
- */
- function addParamGroup($id, $params = false, $instructions = false)
- {
- if ($params && isset($params[0]) && !isset($params[1])) {
- $params = $params[0];
- }
- $stuff =
- array(
- $this->_pkg->getTasksNs() . ':id' => $id,
- );
- if ($instructions) {
- $stuff[$this->_pkg->getTasksNs() . ':instructions'] = $instructions;
- }
- if ($params) {
- $stuff[$this->_pkg->getTasksNs() . ':param'] = $params;
- }
- $this->_params[$this->_pkg->getTasksNs() . ':paramgroup'][] = $stuff;
- }
-
- /**
- * add a complex <paramgroup> to the post-install script with conditions
- *
- * This inserts a <paramgroup> with
- *
- * Order is significant, so call this method in the same
- * sequence the users should see the paramgroups. The $params
- * parameter should either be the result of a call to {@link getParam()}
- * or an array of calls to getParam().
- *
- * Use {@link addParamGroup()} to add a simple <paramgroup>
- *
- * @param string $id <paramgroup> id as seen by the script
- * @param string $oldgroup <paramgroup> id of the section referenced by
- * <conditiontype>
- * @param string $param name of the <param> from the older section referenced
- * by <contitiontype>
- * @param string $value value to match of the parameter
- * @param string $conditiontype one of '=', '!=', 'preg_match'
- * @param array|false $params array of getParam() calls, or false for no params
- * @param string|false $instructions
- */
- function addConditionTypeGroup($id, $oldgroup, $param, $value, $conditiontype = '=',
- $params = false, $instructions = false)
- {
- if ($params && isset($params[0]) && !isset($params[1])) {
- $params = $params[0];
- }
- $stuff = array(
- $this->_pkg->getTasksNs() . ':id' => $id,
- );
- if ($instructions) {
- $stuff[$this->_pkg->getTasksNs() . ':instructions'] = $instructions;
- }
- $stuff[$this->_pkg->getTasksNs() . ':name'] = $oldgroup . '::' . $param;
- $stuff[$this->_pkg->getTasksNs() . ':conditiontype'] = $conditiontype;
- $stuff[$this->_pkg->getTasksNs() . ':value'] = $value;
- if ($params) {
- $stuff[$this->_pkg->getTasksNs() . ':param'] = $params;
- }
- $this->_params[$this->_pkg->getTasksNs() . ':paramgroup'][] = $stuff;
- }
-
- function getXml()
- {
- return $this->_params;
- }
-
- /**
- * Use to set up a param tag for use in creating a paramgroup
- * @static
- */
- function getParam($name, $prompt, $type = 'string', $default = null)
- {
- if ($default !== null) {
- return
- array(
- $this->_pkg->getTasksNs() . ':name' => $name,
- $this->_pkg->getTasksNs() . ':prompt' => $prompt,
- $this->_pkg->getTasksNs() . ':type' => $type,
- $this->_pkg->getTasksNs() . ':default' => $default
- );
- }
- return
- array(
- $this->_pkg->getTasksNs() . ':name' => $name,
- $this->_pkg->getTasksNs() . ':prompt' => $prompt,
- $this->_pkg->getTasksNs() . ':type' => $type,
- );
- }
-}
-?> \ No newline at end of file
diff --git a/3rdparty/PEAR/Task/Replace.php b/3rdparty/PEAR/Task/Replace.php
deleted file mode 100644
index 376df64df65..00000000000
--- a/3rdparty/PEAR/Task/Replace.php
+++ /dev/null
@@ -1,176 +0,0 @@
-<?php
-/**
- * <tasks:replace>
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Replace.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a1
- */
-/**
- * Base class
- */
-require_once 'PEAR/Task/Common.php';
-/**
- * Implements the replace file task.
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a1
- */
-class PEAR_Task_Replace extends PEAR_Task_Common
-{
- var $type = 'simple';
- var $phase = PEAR_TASK_PACKAGEANDINSTALL;
- var $_replacements;
-
- /**
- * Validate the raw xml at parsing-time.
- * @param PEAR_PackageFile_v2
- * @param array raw, parsed xml
- * @param PEAR_Config
- * @static
- */
- function validateXml($pkg, $xml, $config, $fileXml)
- {
- if (!isset($xml['attribs'])) {
- return array(PEAR_TASK_ERROR_NOATTRIBS);
- }
- if (!isset($xml['attribs']['type'])) {
- return array(PEAR_TASK_ERROR_MISSING_ATTRIB, 'type');
- }
- if (!isset($xml['attribs']['to'])) {
- return array(PEAR_TASK_ERROR_MISSING_ATTRIB, 'to');
- }
- if (!isset($xml['attribs']['from'])) {
- return array(PEAR_TASK_ERROR_MISSING_ATTRIB, 'from');
- }
- if ($xml['attribs']['type'] == 'pear-config') {
- if (!in_array($xml['attribs']['to'], $config->getKeys())) {
- return array(PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE, 'to', $xml['attribs']['to'],
- $config->getKeys());
- }
- } elseif ($xml['attribs']['type'] == 'php-const') {
- if (defined($xml['attribs']['to'])) {
- return true;
- } else {
- return array(PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE, 'to', $xml['attribs']['to'],
- array('valid PHP constant'));
- }
- } elseif ($xml['attribs']['type'] == 'package-info') {
- if (in_array($xml['attribs']['to'],
- array('name', 'summary', 'channel', 'notes', 'extends', 'description',
- 'release_notes', 'license', 'release-license', 'license-uri',
- 'version', 'api-version', 'state', 'api-state', 'release_date',
- 'date', 'time'))) {
- return true;
- } else {
- return array(PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE, 'to', $xml['attribs']['to'],
- array('name', 'summary', 'channel', 'notes', 'extends', 'description',
- 'release_notes', 'license', 'release-license', 'license-uri',
- 'version', 'api-version', 'state', 'api-state', 'release_date',
- 'date', 'time'));
- }
- } else {
- return array(PEAR_TASK_ERROR_WRONG_ATTRIB_VALUE, 'type', $xml['attribs']['type'],
- array('pear-config', 'package-info', 'php-const'));
- }
- return true;
- }
-
- /**
- * Initialize a task instance with the parameters
- * @param array raw, parsed xml
- * @param unused
- */
- function init($xml, $attribs)
- {
- $this->_replacements = isset($xml['attribs']) ? array($xml) : $xml;
- }
-
- /**
- * Do a package.xml 1.0 replacement, with additional package-info fields available
- *
- * See validateXml() source for the complete list of allowed fields
- * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2
- * @param string file contents
- * @param string the eventual final file location (informational only)
- * @return string|false|PEAR_Error false to skip this file, PEAR_Error to fail
- * (use $this->throwError), otherwise return the new contents
- */
- function startSession($pkg, $contents, $dest)
- {
- $subst_from = $subst_to = array();
- foreach ($this->_replacements as $a) {
- $a = $a['attribs'];
- $to = '';
- if ($a['type'] == 'pear-config') {
- if ($this->installphase == PEAR_TASK_PACKAGE) {
- return false;
- }
- if ($a['to'] == 'master_server') {
- $chan = $this->registry->getChannel($pkg->getChannel());
- if (!PEAR::isError($chan)) {
- $to = $chan->getServer();
- } else {
- $this->logger->log(0, "$dest: invalid pear-config replacement: $a[to]");
- return false;
- }
- } else {
- if ($this->config->isDefinedLayer('ftp')) {
- // try the remote config file first
- $to = $this->config->get($a['to'], 'ftp', $pkg->getChannel());
- if (is_null($to)) {
- // then default to local
- $to = $this->config->get($a['to'], null, $pkg->getChannel());
- }
- } else {
- $to = $this->config->get($a['to'], null, $pkg->getChannel());
- }
- }
- if (is_null($to)) {
- $this->logger->log(0, "$dest: invalid pear-config replacement: $a[to]");
- return false;
- }
- } elseif ($a['type'] == 'php-const') {
- if ($this->installphase == PEAR_TASK_PACKAGE) {
- return false;
- }
- if (defined($a['to'])) {
- $to = constant($a['to']);
- } else {
- $this->logger->log(0, "$dest: invalid php-const replacement: $a[to]");
- return false;
- }
- } else {
- if ($t = $pkg->packageInfo($a['to'])) {
- $to = $t;
- } else {
- $this->logger->log(0, "$dest: invalid package-info replacement: $a[to]");
- return false;
- }
- }
- if (!is_null($to)) {
- $subst_from[] = $a['from'];
- $subst_to[] = $to;
- }
- }
- $this->logger->log(3, "doing " . sizeof($subst_from) .
- " substitution(s) for $dest");
- if (sizeof($subst_from)) {
- $contents = str_replace($subst_from, $subst_to, $contents);
- }
- return $contents;
- }
-}
-?> \ No newline at end of file
diff --git a/3rdparty/PEAR/Task/Replace/rw.php b/3rdparty/PEAR/Task/Replace/rw.php
deleted file mode 100644
index 32dad586297..00000000000
--- a/3rdparty/PEAR/Task/Replace/rw.php
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-/**
- * <tasks:replace> - read/write version
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: rw.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a10
- */
-/**
- * Base class
- */
-require_once 'PEAR/Task/Replace.php';
-/**
- * Abstracts the replace task xml.
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a10
- */
-class PEAR_Task_Replace_rw extends PEAR_Task_Replace
-{
- function PEAR_Task_Replace_rw(&$pkg, &$config, &$logger, $fileXml)
- {
- parent::PEAR_Task_Common($config, $logger, PEAR_TASK_PACKAGE);
- $this->_contents = $fileXml;
- $this->_pkg = &$pkg;
- $this->_params = array();
- }
-
- function validate()
- {
- return $this->validateXml($this->_pkg, $this->_params, $this->config, $this->_contents);
- }
-
- function setInfo($from, $to, $type)
- {
- $this->_params = array('attribs' => array('from' => $from, 'to' => $to, 'type' => $type));
- }
-
- function getName()
- {
- return 'replace';
- }
-
- function getXml()
- {
- return $this->_params;
- }
-}
-?> \ No newline at end of file
diff --git a/3rdparty/PEAR/Task/Unixeol.php b/3rdparty/PEAR/Task/Unixeol.php
deleted file mode 100644
index 89ca81be349..00000000000
--- a/3rdparty/PEAR/Task/Unixeol.php
+++ /dev/null
@@ -1,77 +0,0 @@
-<?php
-/**
- * <tasks:unixeol>
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Unixeol.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a1
- */
-/**
- * Base class
- */
-require_once 'PEAR/Task/Common.php';
-/**
- * Implements the unix line endings file task.
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a1
- */
-class PEAR_Task_Unixeol extends PEAR_Task_Common
-{
- var $type = 'simple';
- var $phase = PEAR_TASK_PACKAGE;
- var $_replacements;
-
- /**
- * Validate the raw xml at parsing-time.
- * @param PEAR_PackageFile_v2
- * @param array raw, parsed xml
- * @param PEAR_Config
- * @static
- */
- function validateXml($pkg, $xml, $config, $fileXml)
- {
- if ($xml != '') {
- return array(PEAR_TASK_ERROR_INVALID, 'no attributes allowed');
- }
- return true;
- }
-
- /**
- * Initialize a task instance with the parameters
- * @param array raw, parsed xml
- * @param unused
- */
- function init($xml, $attribs)
- {
- }
-
- /**
- * Replace all line endings with line endings customized for the current OS
- *
- * See validateXml() source for the complete list of allowed fields
- * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2
- * @param string file contents
- * @param string the eventual final file location (informational only)
- * @return string|false|PEAR_Error false to skip this file, PEAR_Error to fail
- * (use $this->throwError), otherwise return the new contents
- */
- function startSession($pkg, $contents, $dest)
- {
- $this->logger->log(3, "replacing all line endings with \\n in $dest");
- return preg_replace("/\r\n|\n\r|\r|\n/", "\n", $contents);
- }
-}
-?> \ No newline at end of file
diff --git a/3rdparty/PEAR/Task/Unixeol/rw.php b/3rdparty/PEAR/Task/Unixeol/rw.php
deleted file mode 100644
index b2ae5fa5cbd..00000000000
--- a/3rdparty/PEAR/Task/Unixeol/rw.php
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-/**
- * <tasks:unixeol> - read/write version
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: rw.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a10
- */
-/**
- * Base class
- */
-require_once 'PEAR/Task/Unixeol.php';
-/**
- * Abstracts the unixeol task xml.
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a10
- */
-class PEAR_Task_Unixeol_rw extends PEAR_Task_Unixeol
-{
- function PEAR_Task_Unixeol_rw(&$pkg, &$config, &$logger, $fileXml)
- {
- parent::PEAR_Task_Common($config, $logger, PEAR_TASK_PACKAGE);
- $this->_contents = $fileXml;
- $this->_pkg = &$pkg;
- $this->_params = array();
- }
-
- function validate()
- {
- return true;
- }
-
- function getName()
- {
- return 'unixeol';
- }
-
- function getXml()
- {
- return '';
- }
-}
-?> \ No newline at end of file
diff --git a/3rdparty/PEAR/Task/Windowseol.php b/3rdparty/PEAR/Task/Windowseol.php
deleted file mode 100644
index 8ba4171159f..00000000000
--- a/3rdparty/PEAR/Task/Windowseol.php
+++ /dev/null
@@ -1,77 +0,0 @@
-<?php
-/**
- * <tasks:windowseol>
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Windowseol.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a1
- */
-/**
- * Base class
- */
-require_once 'PEAR/Task/Common.php';
-/**
- * Implements the windows line endsings file task.
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a1
- */
-class PEAR_Task_Windowseol extends PEAR_Task_Common
-{
- var $type = 'simple';
- var $phase = PEAR_TASK_PACKAGE;
- var $_replacements;
-
- /**
- * Validate the raw xml at parsing-time.
- * @param PEAR_PackageFile_v2
- * @param array raw, parsed xml
- * @param PEAR_Config
- * @static
- */
- function validateXml($pkg, $xml, $config, $fileXml)
- {
- if ($xml != '') {
- return array(PEAR_TASK_ERROR_INVALID, 'no attributes allowed');
- }
- return true;
- }
-
- /**
- * Initialize a task instance with the parameters
- * @param array raw, parsed xml
- * @param unused
- */
- function init($xml, $attribs)
- {
- }
-
- /**
- * Replace all line endings with windows line endings
- *
- * See validateXml() source for the complete list of allowed fields
- * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2
- * @param string file contents
- * @param string the eventual final file location (informational only)
- * @return string|false|PEAR_Error false to skip this file, PEAR_Error to fail
- * (use $this->throwError), otherwise return the new contents
- */
- function startSession($pkg, $contents, $dest)
- {
- $this->logger->log(3, "replacing all line endings with \\r\\n in $dest");
- return preg_replace("/\r\n|\n\r|\r|\n/", "\r\n", $contents);
- }
-}
-?> \ No newline at end of file
diff --git a/3rdparty/PEAR/Task/Windowseol/rw.php b/3rdparty/PEAR/Task/Windowseol/rw.php
deleted file mode 100644
index f0f1149c83e..00000000000
--- a/3rdparty/PEAR/Task/Windowseol/rw.php
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-/**
- * <tasks:windowseol> - read/write version
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: rw.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a10
- */
-/**
- * Base class
- */
-require_once 'PEAR/Task/Windowseol.php';
-/**
- * Abstracts the windowseol task xml.
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a10
- */
-class PEAR_Task_Windowseol_rw extends PEAR_Task_Windowseol
-{
- function PEAR_Task_Windowseol_rw(&$pkg, &$config, &$logger, $fileXml)
- {
- parent::PEAR_Task_Common($config, $logger, PEAR_TASK_PACKAGE);
- $this->_contents = $fileXml;
- $this->_pkg = &$pkg;
- $this->_params = array();
- }
-
- function validate()
- {
- return true;
- }
-
- function getName()
- {
- return 'windowseol';
- }
-
- function getXml()
- {
- return '';
- }
-}
-?> \ No newline at end of file
diff --git a/3rdparty/PEAR/Validate.php b/3rdparty/PEAR/Validate.php
deleted file mode 100644
index 176560bc237..00000000000
--- a/3rdparty/PEAR/Validate.php
+++ /dev/null
@@ -1,629 +0,0 @@
-<?php
-/**
- * PEAR_Validate
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Validate.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a1
- */
-/**#@+
- * Constants for install stage
- */
-define('PEAR_VALIDATE_INSTALLING', 1);
-define('PEAR_VALIDATE_UNINSTALLING', 2); // this is not bit-mapped like the others
-define('PEAR_VALIDATE_NORMAL', 3);
-define('PEAR_VALIDATE_DOWNLOADING', 4); // this is not bit-mapped like the others
-define('PEAR_VALIDATE_PACKAGING', 7);
-/**#@-*/
-require_once 'PEAR/Common.php';
-require_once 'PEAR/Validator/PECL.php';
-
-/**
- * Validation class for package.xml - channel-level advanced validation
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a1
- */
-class PEAR_Validate
-{
- var $packageregex = _PEAR_COMMON_PACKAGE_NAME_PREG;
- /**
- * @var PEAR_PackageFile_v1|PEAR_PackageFile_v2
- */
- var $_packagexml;
- /**
- * @var int one of the PEAR_VALIDATE_* constants
- */
- var $_state = PEAR_VALIDATE_NORMAL;
- /**
- * Format: ('error' => array('field' => name, 'reason' => reason), 'warning' => same)
- * @var array
- * @access private
- */
- var $_failures = array('error' => array(), 'warning' => array());
-
- /**
- * Override this method to handle validation of normal package names
- * @param string
- * @return bool
- * @access protected
- */
- function _validPackageName($name)
- {
- return (bool) preg_match('/^' . $this->packageregex . '\\z/', $name);
- }
-
- /**
- * @param string package name to validate
- * @param string name of channel-specific validation package
- * @final
- */
- function validPackageName($name, $validatepackagename = false)
- {
- if ($validatepackagename) {
- if (strtolower($name) == strtolower($validatepackagename)) {
- return (bool) preg_match('/^[a-zA-Z0-9_]+(?:\.[a-zA-Z0-9_]+)*\\z/', $name);
- }
- }
- return $this->_validPackageName($name);
- }
-
- /**
- * This validates a bundle name, and bundle names must conform
- * to the PEAR naming convention, so the method is final and static.
- * @param string
- * @final
- * @static
- */
- function validGroupName($name)
- {
- return (bool) preg_match('/^' . _PEAR_COMMON_PACKAGE_NAME_PREG . '\\z/', $name);
- }
-
- /**
- * Determine whether $state represents a valid stability level
- * @param string
- * @return bool
- * @static
- * @final
- */
- function validState($state)
- {
- return in_array($state, array('snapshot', 'devel', 'alpha', 'beta', 'stable'));
- }
-
- /**
- * Get a list of valid stability levels
- * @return array
- * @static
- * @final
- */
- function getValidStates()
- {
- return array('snapshot', 'devel', 'alpha', 'beta', 'stable');
- }
-
- /**
- * Determine whether a version is a properly formatted version number that can be used
- * by version_compare
- * @param string
- * @return bool
- * @static
- * @final
- */
- function validVersion($ver)
- {
- return (bool) preg_match(PEAR_COMMON_PACKAGE_VERSION_PREG, $ver);
- }
-
- /**
- * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2
- */
- function setPackageFile(&$pf)
- {
- $this->_packagexml = &$pf;
- }
-
- /**
- * @access private
- */
- function _addFailure($field, $reason)
- {
- $this->_failures['errors'][] = array('field' => $field, 'reason' => $reason);
- }
-
- /**
- * @access private
- */
- function _addWarning($field, $reason)
- {
- $this->_failures['warnings'][] = array('field' => $field, 'reason' => $reason);
- }
-
- function getFailures()
- {
- $failures = $this->_failures;
- $this->_failures = array('warnings' => array(), 'errors' => array());
- return $failures;
- }
-
- /**
- * @param int one of the PEAR_VALIDATE_* constants
- */
- function validate($state = null)
- {
- if (!isset($this->_packagexml)) {
- return false;
- }
- if ($state !== null) {
- $this->_state = $state;
- }
- $this->_failures = array('warnings' => array(), 'errors' => array());
- $this->validatePackageName();
- $this->validateVersion();
- $this->validateMaintainers();
- $this->validateDate();
- $this->validateSummary();
- $this->validateDescription();
- $this->validateLicense();
- $this->validateNotes();
- if ($this->_packagexml->getPackagexmlVersion() == '1.0') {
- $this->validateState();
- $this->validateFilelist();
- } elseif ($this->_packagexml->getPackagexmlVersion() == '2.0' ||
- $this->_packagexml->getPackagexmlVersion() == '2.1') {
- $this->validateTime();
- $this->validateStability();
- $this->validateDeps();
- $this->validateMainFilelist();
- $this->validateReleaseFilelist();
- //$this->validateGlobalTasks();
- $this->validateChangelog();
- }
- return !((bool) count($this->_failures['errors']));
- }
-
- /**
- * @access protected
- */
- function validatePackageName()
- {
- if ($this->_state == PEAR_VALIDATE_PACKAGING ||
- $this->_state == PEAR_VALIDATE_NORMAL) {
- if (($this->_packagexml->getPackagexmlVersion() == '2.0' ||
- $this->_packagexml->getPackagexmlVersion() == '2.1') &&
- $this->_packagexml->getExtends()) {
- $version = $this->_packagexml->getVersion() . '';
- $name = $this->_packagexml->getPackage();
- $test = array_shift($a = explode('.', $version));
- if ($test == '0') {
- return true;
- }
- $vlen = strlen($test);
- $majver = substr($name, strlen($name) - $vlen);
- while ($majver && !is_numeric($majver{0})) {
- $majver = substr($majver, 1);
- }
- if ($majver != $test) {
- $this->_addWarning('package', "package $name extends package " .
- $this->_packagexml->getExtends() . ' and so the name should ' .
- 'have a postfix equal to the major version like "' .
- $this->_packagexml->getExtends() . $test . '"');
- return true;
- } elseif (substr($name, 0, strlen($name) - $vlen) !=
- $this->_packagexml->getExtends()) {
- $this->_addWarning('package', "package $name extends package " .
- $this->_packagexml->getExtends() . ' and so the name must ' .
- 'be an extension like "' . $this->_packagexml->getExtends() .
- $test . '"');
- return true;
- }
- }
- }
- if (!$this->validPackageName($this->_packagexml->getPackage())) {
- $this->_addFailure('name', 'package name "' .
- $this->_packagexml->getPackage() . '" is invalid');
- return false;
- }
- }
-
- /**
- * @access protected
- */
- function validateVersion()
- {
- if ($this->_state != PEAR_VALIDATE_PACKAGING) {
- if (!$this->validVersion($this->_packagexml->getVersion())) {
- $this->_addFailure('version',
- 'Invalid version number "' . $this->_packagexml->getVersion() . '"');
- }
- return false;
- }
- $version = $this->_packagexml->getVersion();
- $versioncomponents = explode('.', $version);
- if (count($versioncomponents) != 3) {
- $this->_addWarning('version',
- 'A version number should have 3 decimals (x.y.z)');
- return true;
- }
- $name = $this->_packagexml->getPackage();
- // version must be based upon state
- switch ($this->_packagexml->getState()) {
- case 'snapshot' :
- return true;
- case 'devel' :
- if ($versioncomponents[0] . 'a' == '0a') {
- return true;
- }
- if ($versioncomponents[0] == 0) {
- $versioncomponents[0] = '0';
- $this->_addWarning('version',
- 'version "' . $version . '" should be "' .
- implode('.' ,$versioncomponents) . '"');
- } else {
- $this->_addWarning('version',
- 'packages with devel stability must be < version 1.0.0');
- }
- return true;
- break;
- case 'alpha' :
- case 'beta' :
- // check for a package that extends a package,
- // like Foo and Foo2
- if ($this->_state == PEAR_VALIDATE_PACKAGING) {
- if (substr($versioncomponents[2], 1, 2) == 'rc') {
- $this->_addFailure('version', 'Release Candidate versions ' .
- 'must have capital RC, not lower-case rc');
- return false;
- }
- }
- if (!$this->_packagexml->getExtends()) {
- if ($versioncomponents[0] == '1') {
- if ($versioncomponents[2]{0} == '0') {
- if ($versioncomponents[2] == '0') {
- // version 1.*.0000
- $this->_addWarning('version',
- 'version 1.' . $versioncomponents[1] .
- '.0 probably should not be alpha or beta');
- return true;
- } elseif (strlen($versioncomponents[2]) > 1) {
- // version 1.*.0RC1 or 1.*.0beta24 etc.
- return true;
- } else {
- // version 1.*.0
- $this->_addWarning('version',
- 'version 1.' . $versioncomponents[1] .
- '.0 probably should not be alpha or beta');
- return true;
- }
- } else {
- $this->_addWarning('version',
- 'bugfix versions (1.3.x where x > 0) probably should ' .
- 'not be alpha or beta');
- return true;
- }
- } elseif ($versioncomponents[0] != '0') {
- $this->_addWarning('version',
- 'major versions greater than 1 are not allowed for packages ' .
- 'without an <extends> tag or an identical postfix (foo2 v2.0.0)');
- return true;
- }
- if ($versioncomponents[0] . 'a' == '0a') {
- return true;
- }
- if ($versioncomponents[0] == 0) {
- $versioncomponents[0] = '0';
- $this->_addWarning('version',
- 'version "' . $version . '" should be "' .
- implode('.' ,$versioncomponents) . '"');
- }
- } else {
- $vlen = strlen($versioncomponents[0] . '');
- $majver = substr($name, strlen($name) - $vlen);
- while ($majver && !is_numeric($majver{0})) {
- $majver = substr($majver, 1);
- }
- if (($versioncomponents[0] != 0) && $majver != $versioncomponents[0]) {
- $this->_addWarning('version', 'first version number "' .
- $versioncomponents[0] . '" must match the postfix of ' .
- 'package name "' . $name . '" (' .
- $majver . ')');
- return true;
- }
- if ($versioncomponents[0] == $majver) {
- if ($versioncomponents[2]{0} == '0') {
- if ($versioncomponents[2] == '0') {
- // version 2.*.0000
- $this->_addWarning('version',
- "version $majver." . $versioncomponents[1] .
- '.0 probably should not be alpha or beta');
- return false;
- } elseif (strlen($versioncomponents[2]) > 1) {
- // version 2.*.0RC1 or 2.*.0beta24 etc.
- return true;
- } else {
- // version 2.*.0
- $this->_addWarning('version',
- "version $majver." . $versioncomponents[1] .
- '.0 cannot be alpha or beta');
- return true;
- }
- } else {
- $this->_addWarning('version',
- "bugfix versions ($majver.x.y where y > 0) should " .
- 'not be alpha or beta');
- return true;
- }
- } elseif ($versioncomponents[0] != '0') {
- $this->_addWarning('version',
- "only versions 0.x.y and $majver.x.y are allowed for alpha/beta releases");
- return true;
- }
- if ($versioncomponents[0] . 'a' == '0a') {
- return true;
- }
- if ($versioncomponents[0] == 0) {
- $versioncomponents[0] = '0';
- $this->_addWarning('version',
- 'version "' . $version . '" should be "' .
- implode('.' ,$versioncomponents) . '"');
- }
- }
- return true;
- break;
- case 'stable' :
- if ($versioncomponents[0] == '0') {
- $this->_addWarning('version', 'versions less than 1.0.0 cannot ' .
- 'be stable');
- return true;
- }
- if (!is_numeric($versioncomponents[2])) {
- if (preg_match('/\d+(rc|a|alpha|b|beta)\d*/i',
- $versioncomponents[2])) {
- $this->_addWarning('version', 'version "' . $version . '" or any ' .
- 'RC/beta/alpha version cannot be stable');
- return true;
- }
- }
- // check for a package that extends a package,
- // like Foo and Foo2
- if ($this->_packagexml->getExtends()) {
- $vlen = strlen($versioncomponents[0] . '');
- $majver = substr($name, strlen($name) - $vlen);
- while ($majver && !is_numeric($majver{0})) {
- $majver = substr($majver, 1);
- }
- if (($versioncomponents[0] != 0) && $majver != $versioncomponents[0]) {
- $this->_addWarning('version', 'first version number "' .
- $versioncomponents[0] . '" must match the postfix of ' .
- 'package name "' . $name . '" (' .
- $majver . ')');
- return true;
- }
- } elseif ($versioncomponents[0] > 1) {
- $this->_addWarning('version', 'major version x in x.y.z may not be greater than ' .
- '1 for any package that does not have an <extends> tag');
- }
- return true;
- break;
- default :
- return false;
- break;
- }
- }
-
- /**
- * @access protected
- */
- function validateMaintainers()
- {
- // maintainers can only be truly validated server-side for most channels
- // but allow this customization for those who wish it
- return true;
- }
-
- /**
- * @access protected
- */
- function validateDate()
- {
- if ($this->_state == PEAR_VALIDATE_NORMAL ||
- $this->_state == PEAR_VALIDATE_PACKAGING) {
-
- if (!preg_match('/(\d\d\d\d)\-(\d\d)\-(\d\d)/',
- $this->_packagexml->getDate(), $res) ||
- count($res) < 4
- || !checkdate($res[2], $res[3], $res[1])
- ) {
- $this->_addFailure('date', 'invalid release date "' .
- $this->_packagexml->getDate() . '"');
- return false;
- }
-
- if ($this->_state == PEAR_VALIDATE_PACKAGING &&
- $this->_packagexml->getDate() != date('Y-m-d')) {
- $this->_addWarning('date', 'Release Date "' .
- $this->_packagexml->getDate() . '" is not today');
- }
- }
- return true;
- }
-
- /**
- * @access protected
- */
- function validateTime()
- {
- if (!$this->_packagexml->getTime()) {
- // default of no time value set
- return true;
- }
-
- // packager automatically sets time, so only validate if pear validate is called
- if ($this->_state = PEAR_VALIDATE_NORMAL) {
- if (!preg_match('/\d\d:\d\d:\d\d/',
- $this->_packagexml->getTime())) {
- $this->_addFailure('time', 'invalid release time "' .
- $this->_packagexml->getTime() . '"');
- return false;
- }
-
- $result = preg_match('|\d{2}\:\d{2}\:\d{2}|', $this->_packagexml->getTime(), $matches);
- if ($result === false || empty($matches)) {
- $this->_addFailure('time', 'invalid release time "' .
- $this->_packagexml->getTime() . '"');
- return false;
- }
- }
-
- return true;
- }
-
- /**
- * @access protected
- */
- function validateState()
- {
- // this is the closest to "final" php4 can get
- if (!PEAR_Validate::validState($this->_packagexml->getState())) {
- if (strtolower($this->_packagexml->getState() == 'rc')) {
- $this->_addFailure('state', 'RC is not a state, it is a version ' .
- 'postfix, use ' . $this->_packagexml->getVersion() . 'RC1, state beta');
- }
- $this->_addFailure('state', 'invalid release state "' .
- $this->_packagexml->getState() . '", must be one of: ' .
- implode(', ', PEAR_Validate::getValidStates()));
- return false;
- }
- return true;
- }
-
- /**
- * @access protected
- */
- function validateStability()
- {
- $ret = true;
- $packagestability = $this->_packagexml->getState();
- $apistability = $this->_packagexml->getState('api');
- if (!PEAR_Validate::validState($packagestability)) {
- $this->_addFailure('state', 'invalid release stability "' .
- $this->_packagexml->getState() . '", must be one of: ' .
- implode(', ', PEAR_Validate::getValidStates()));
- $ret = false;
- }
- $apistates = PEAR_Validate::getValidStates();
- array_shift($apistates); // snapshot is not allowed
- if (!in_array($apistability, $apistates)) {
- $this->_addFailure('state', 'invalid API stability "' .
- $this->_packagexml->getState('api') . '", must be one of: ' .
- implode(', ', $apistates));
- $ret = false;
- }
- return $ret;
- }
-
- /**
- * @access protected
- */
- function validateSummary()
- {
- return true;
- }
-
- /**
- * @access protected
- */
- function validateDescription()
- {
- return true;
- }
-
- /**
- * @access protected
- */
- function validateLicense()
- {
- return true;
- }
-
- /**
- * @access protected
- */
- function validateNotes()
- {
- return true;
- }
-
- /**
- * for package.xml 2.0 only - channels can't use package.xml 1.0
- * @access protected
- */
- function validateDependencies()
- {
- return true;
- }
-
- /**
- * for package.xml 1.0 only
- * @access private
- */
- function _validateFilelist()
- {
- return true; // placeholder for now
- }
-
- /**
- * for package.xml 2.0 only
- * @access protected
- */
- function validateMainFilelist()
- {
- return true; // placeholder for now
- }
-
- /**
- * for package.xml 2.0 only
- * @access protected
- */
- function validateReleaseFilelist()
- {
- return true; // placeholder for now
- }
-
- /**
- * @access protected
- */
- function validateChangelog()
- {
- return true;
- }
-
- /**
- * @access protected
- */
- function validateFilelist()
- {
- return true;
- }
-
- /**
- * @access protected
- */
- function validateDeps()
- {
- return true;
- }
-} \ No newline at end of file
diff --git a/3rdparty/PEAR/Validator/PECL.php b/3rdparty/PEAR/Validator/PECL.php
deleted file mode 100644
index 89b951f7b67..00000000000
--- a/3rdparty/PEAR/Validator/PECL.php
+++ /dev/null
@@ -1,63 +0,0 @@
-<?php
-/**
- * Channel Validator for the pecl.php.net channel
- *
- * PHP 4 and PHP 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2006 The PHP Group
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: PECL.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a5
- */
-/**
- * This is the parent class for all validators
- */
-require_once 'PEAR/Validate.php';
-/**
- * Channel Validator for the pecl.php.net channel
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a5
- */
-class PEAR_Validator_PECL extends PEAR_Validate
-{
- function validateVersion()
- {
- if ($this->_state == PEAR_VALIDATE_PACKAGING) {
- $version = $this->_packagexml->getVersion();
- $versioncomponents = explode('.', $version);
- $last = array_pop($versioncomponents);
- if (substr($last, 1, 2) == 'rc') {
- $this->_addFailure('version', 'Release Candidate versions must have ' .
- 'upper-case RC, not lower-case rc');
- return false;
- }
- }
- return true;
- }
-
- function validatePackageName()
- {
- $ret = parent::validatePackageName();
- if ($this->_packagexml->getPackageType() == 'extsrc' ||
- $this->_packagexml->getPackageType() == 'zendextsrc') {
- if (strtolower($this->_packagexml->getPackage()) !=
- strtolower($this->_packagexml->getProvidesExtension())) {
- $this->_addWarning('providesextension', 'package name "' .
- $this->_packagexml->getPackage() . '" is different from extension name "' .
- $this->_packagexml->getProvidesExtension() . '"');
- }
- }
- return $ret;
- }
-}
-?> \ No newline at end of file
diff --git a/3rdparty/PEAR/XMLParser.php b/3rdparty/PEAR/XMLParser.php
deleted file mode 100644
index 7f091c16fad..00000000000
--- a/3rdparty/PEAR/XMLParser.php
+++ /dev/null
@@ -1,253 +0,0 @@
-<?php
-/**
- * PEAR_XMLParser
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @author Stephan Schmidt (original XML_Unserializer code)
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license New BSD License
- * @version CVS: $Id: XMLParser.php 313023 2011-07-06 19:17:11Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 1.4.0a1
- */
-
-/**
- * Parser for any xml file
- * @category pear
- * @package PEAR
- * @author Greg Beaver <cellog@php.net>
- * @author Stephan Schmidt (original XML_Unserializer code)
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license New BSD License
- * @version Release: 1.9.4
- * @link http://pear.php.net/package/PEAR
- * @since Class available since Release 1.4.0a1
- */
-class PEAR_XMLParser
-{
- /**
- * unserilialized data
- * @var string $_serializedData
- */
- var $_unserializedData = null;
-
- /**
- * name of the root tag
- * @var string $_root
- */
- var $_root = null;
-
- /**
- * stack for all data that is found
- * @var array $_dataStack
- */
- var $_dataStack = array();
-
- /**
- * stack for all values that are generated
- * @var array $_valStack
- */
- var $_valStack = array();
-
- /**
- * current tag depth
- * @var int $_depth
- */
- var $_depth = 0;
-
- /**
- * The XML encoding to use
- * @var string $encoding
- */
- var $encoding = 'ISO-8859-1';
-
- /**
- * @return array
- */
- function getData()
- {
- return $this->_unserializedData;
- }
-
- /**
- * @param string xml content
- * @return true|PEAR_Error
- */
- function parse($data)
- {
- if (!extension_loaded('xml')) {
- include_once 'PEAR.php';
- return PEAR::raiseError("XML Extension not found", 1);
- }
- $this->_dataStack = $this->_valStack = array();
- $this->_depth = 0;
-
- if (
- strpos($data, 'encoding="UTF-8"')
- || strpos($data, 'encoding="utf-8"')
- || strpos($data, "encoding='UTF-8'")
- || strpos($data, "encoding='utf-8'")
- ) {
- $this->encoding = 'UTF-8';
- }
-
- if (version_compare(phpversion(), '5.0.0', 'lt') && $this->encoding == 'UTF-8') {
- $data = utf8_decode($data);
- $this->encoding = 'ISO-8859-1';
- }
-
- $xp = xml_parser_create($this->encoding);
- xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, 0);
- xml_set_object($xp, $this);
- xml_set_element_handler($xp, 'startHandler', 'endHandler');
- xml_set_character_data_handler($xp, 'cdataHandler');
- if (!xml_parse($xp, $data)) {
- $msg = xml_error_string(xml_get_error_code($xp));
- $line = xml_get_current_line_number($xp);
- xml_parser_free($xp);
- include_once 'PEAR.php';
- return PEAR::raiseError("XML Error: '$msg' on line '$line'", 2);
- }
- xml_parser_free($xp);
- return true;
- }
-
- /**
- * Start element handler for XML parser
- *
- * @access private
- * @param object $parser XML parser object
- * @param string $element XML element
- * @param array $attribs attributes of XML tag
- * @return void
- */
- function startHandler($parser, $element, $attribs)
- {
- $this->_depth++;
- $this->_dataStack[$this->_depth] = null;
-
- $val = array(
- 'name' => $element,
- 'value' => null,
- 'type' => 'string',
- 'childrenKeys' => array(),
- 'aggregKeys' => array()
- );
-
- if (count($attribs) > 0) {
- $val['children'] = array();
- $val['type'] = 'array';
- $val['children']['attribs'] = $attribs;
- }
-
- array_push($this->_valStack, $val);
- }
-
- /**
- * post-process data
- *
- * @param string $data
- * @param string $element element name
- */
- function postProcess($data, $element)
- {
- return trim($data);
- }
-
- /**
- * End element handler for XML parser
- *
- * @access private
- * @param object XML parser object
- * @param string
- * @return void
- */
- function endHandler($parser, $element)
- {
- $value = array_pop($this->_valStack);
- $data = $this->postProcess($this->_dataStack[$this->_depth], $element);
-
- // adjust type of the value
- switch (strtolower($value['type'])) {
- // unserialize an array
- case 'array':
- if ($data !== '') {
- $value['children']['_content'] = $data;
- }
-
- $value['value'] = isset($value['children']) ? $value['children'] : array();
- break;
-
- /*
- * unserialize a null value
- */
- case 'null':
- $data = null;
- break;
-
- /*
- * unserialize any scalar value
- */
- default:
- settype($data, $value['type']);
- $value['value'] = $data;
- break;
- }
-
- $parent = array_pop($this->_valStack);
- if ($parent === null) {
- $this->_unserializedData = &$value['value'];
- $this->_root = &$value['name'];
- return true;
- }
-
- // parent has to be an array
- if (!isset($parent['children']) || !is_array($parent['children'])) {
- $parent['children'] = array();
- if ($parent['type'] != 'array') {
- $parent['type'] = 'array';
- }
- }
-
- if (!empty($value['name'])) {
- // there already has been a tag with this name
- if (in_array($value['name'], $parent['childrenKeys'])) {
- // no aggregate has been created for this tag
- if (!in_array($value['name'], $parent['aggregKeys'])) {
- if (isset($parent['children'][$value['name']])) {
- $parent['children'][$value['name']] = array($parent['children'][$value['name']]);
- } else {
- $parent['children'][$value['name']] = array();
- }
- array_push($parent['aggregKeys'], $value['name']);
- }
- array_push($parent['children'][$value['name']], $value['value']);
- } else {
- $parent['children'][$value['name']] = &$value['value'];
- array_push($parent['childrenKeys'], $value['name']);
- }
- } else {
- array_push($parent['children'],$value['value']);
- }
- array_push($this->_valStack, $parent);
-
- $this->_depth--;
- }
-
- /**
- * Handler for character data
- *
- * @access private
- * @param object XML parser object
- * @param string CDATA
- * @return void
- */
- function cdataHandler($parser, $cdata)
- {
- $this->_dataStack[$this->_depth] .= $cdata;
- }
-} \ No newline at end of file
diff --git a/3rdparty/PEAR5.php b/3rdparty/PEAR5.php
deleted file mode 100644
index 428606780b7..00000000000
--- a/3rdparty/PEAR5.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-/**
- * This is only meant for PHP 5 to get rid of certain strict warning
- * that doesn't get hidden since it's in the shutdown function
- */
-class PEAR5
-{
- /**
- * If you have a class that's mostly/entirely static, and you need static
- * properties, you can use this method to simulate them. Eg. in your method(s)
- * do this: $myVar = &PEAR5::getStaticProperty('myclass', 'myVar');
- * You MUST use a reference, or they will not persist!
- *
- * @access public
- * @param string $class The calling classname, to prevent clashes
- * @param string $var The variable to retrieve.
- * @return mixed A reference to the variable. If not set it will be
- * auto initialised to NULL.
- */
- static function &getStaticProperty($class, $var)
- {
- static $properties;
- if (!isset($properties[$class])) {
- $properties[$class] = array();
- }
-
- if (!array_key_exists($var, $properties[$class])) {
- $properties[$class][$var] = null;
- }
-
- return $properties[$class][$var];
- }
-} \ No newline at end of file
diff --git a/3rdparty/Sabre/CalDAV/Backend/Abstract.php b/3rdparty/Sabre/CalDAV/Backend/Abstract.php
deleted file mode 100644
index 88e5b4a1a07..00000000000
--- a/3rdparty/Sabre/CalDAV/Backend/Abstract.php
+++ /dev/null
@@ -1,154 +0,0 @@
-<?php
-
-use Sabre\VObject;
-
-/**
- * Abstract Calendaring backend. Extend this class to create your own backends.
- *
- * Checkout the BackendInterface for all the methods that must be implemented.
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-abstract class Sabre_CalDAV_Backend_Abstract implements Sabre_CalDAV_Backend_BackendInterface {
-
- /**
- * Updates properties for a calendar.
- *
- * The mutations array uses the propertyName in clark-notation as key,
- * and the array value for the property value. In the case a property
- * should be deleted, the property value will be null.
- *
- * This method must be atomic. If one property cannot be changed, the
- * entire operation must fail.
- *
- * If the operation was successful, true can be returned.
- * If the operation failed, false can be returned.
- *
- * Deletion of a non-existent property is always successful.
- *
- * Lastly, it is optional to return detailed information about any
- * failures. In this case an array should be returned with the following
- * structure:
- *
- * array(
- * 403 => array(
- * '{DAV:}displayname' => null,
- * ),
- * 424 => array(
- * '{DAV:}owner' => null,
- * )
- * )
- *
- * In this example it was forbidden to update {DAV:}displayname.
- * (403 Forbidden), which in turn also caused {DAV:}owner to fail
- * (424 Failed Dependency) because the request needs to be atomic.
- *
- * @param mixed $calendarId
- * @param array $mutations
- * @return bool|array
- */
- public function updateCalendar($calendarId, array $mutations) {
-
- return false;
-
- }
-
- /**
- * Performs a calendar-query on the contents of this calendar.
- *
- * The calendar-query is defined in RFC4791 : CalDAV. Using the
- * calendar-query it is possible for a client to request a specific set of
- * object, based on contents of iCalendar properties, date-ranges and
- * iCalendar component types (VTODO, VEVENT).
- *
- * This method should just return a list of (relative) urls that match this
- * query.
- *
- * The list of filters are specified as an array. The exact array is
- * documented by Sabre_CalDAV_CalendarQueryParser.
- *
- * Note that it is extremely likely that getCalendarObject for every path
- * returned from this method will be called almost immediately after. You
- * may want to anticipate this to speed up these requests.
- *
- * This method provides a default implementation, which parses *all* the
- * iCalendar objects in the specified calendar.
- *
- * This default may well be good enough for personal use, and calendars
- * that aren't very large. But if you anticipate high usage, big calendars
- * or high loads, you are strongly adviced to optimize certain paths.
- *
- * The best way to do so is override this method and to optimize
- * specifically for 'common filters'.
- *
- * Requests that are extremely common are:
- * * requests for just VEVENTS
- * * requests for just VTODO
- * * requests with a time-range-filter on either VEVENT or VTODO.
- *
- * ..and combinations of these requests. It may not be worth it to try to
- * handle every possible situation and just rely on the (relatively
- * easy to use) CalendarQueryValidator to handle the rest.
- *
- * Note that especially time-range-filters may be difficult to parse. A
- * time-range filter specified on a VEVENT must for instance also handle
- * recurrence rules correctly.
- * A good example of how to interprete all these filters can also simply
- * be found in Sabre_CalDAV_CalendarQueryFilter. This class is as correct
- * as possible, so it gives you a good idea on what type of stuff you need
- * to think of.
- *
- * @param mixed $calendarId
- * @param array $filters
- * @return array
- */
- public function calendarQuery($calendarId, array $filters) {
-
- $result = array();
- $objects = $this->getCalendarObjects($calendarId);
-
- $validator = new Sabre_CalDAV_CalendarQueryValidator();
-
- foreach($objects as $object) {
-
- if ($this->validateFilterForObject($object, $filters)) {
- $result[] = $object['uri'];
- }
-
- }
-
- return $result;
-
- }
-
- /**
- * This method validates if a filters (as passed to calendarQuery) matches
- * the given object.
- *
- * @param array $object
- * @param array $filter
- * @return bool
- */
- protected function validateFilterForObject(array $object, array $filters) {
-
- // Unfortunately, setting the 'calendardata' here is optional. If
- // it was excluded, we actually need another call to get this as
- // well.
- if (!isset($object['calendardata'])) {
- $object = $this->getCalendarObject($object['calendarid'], $object['uri']);
- }
-
- $data = is_resource($object['calendardata'])?stream_get_contents($object['calendardata']):$object['calendardata'];
- $vObject = VObject\Reader::read($data);
-
- $validator = new Sabre_CalDAV_CalendarQueryValidator();
- return $validator->validate($vObject, $filters);
-
- }
-
-
-}
diff --git a/3rdparty/Sabre/CalDAV/Backend/BackendInterface.php b/3rdparty/Sabre/CalDAV/Backend/BackendInterface.php
deleted file mode 100644
index 881538ab60e..00000000000
--- a/3rdparty/Sabre/CalDAV/Backend/BackendInterface.php
+++ /dev/null
@@ -1,231 +0,0 @@
-<?php
-
-/**
- * Every CalDAV backend must at least implement this interface.
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-interface Sabre_CalDAV_Backend_BackendInterface {
-
- /**
- * Returns a list of calendars for a principal.
- *
- * Every project is an array with the following keys:
- * * id, a unique id that will be used by other functions to modify the
- * calendar. This can be the same as the uri or a database key.
- * * uri, which the basename of the uri with which the calendar is
- * accessed.
- * * principaluri. The owner of the calendar. Almost always the same as
- * principalUri passed to this method.
- *
- * Furthermore it can contain webdav properties in clark notation. A very
- * common one is '{DAV:}displayname'.
- *
- * @param string $principalUri
- * @return array
- */
- public function getCalendarsForUser($principalUri);
-
- /**
- * Creates a new calendar for a principal.
- *
- * If the creation was a success, an id must be returned that can be used to reference
- * this calendar in other methods, such as updateCalendar.
- *
- * @param string $principalUri
- * @param string $calendarUri
- * @param array $properties
- * @return void
- */
- public function createCalendar($principalUri,$calendarUri,array $properties);
-
- /**
- * Updates properties for a calendar.
- *
- * The mutations array uses the propertyName in clark-notation as key,
- * and the array value for the property value. In the case a property
- * should be deleted, the property value will be null.
- *
- * This method must be atomic. If one property cannot be changed, the
- * entire operation must fail.
- *
- * If the operation was successful, true can be returned.
- * If the operation failed, false can be returned.
- *
- * Deletion of a non-existent property is always successful.
- *
- * Lastly, it is optional to return detailed information about any
- * failures. In this case an array should be returned with the following
- * structure:
- *
- * array(
- * 403 => array(
- * '{DAV:}displayname' => null,
- * ),
- * 424 => array(
- * '{DAV:}owner' => null,
- * )
- * )
- *
- * In this example it was forbidden to update {DAV:}displayname.
- * (403 Forbidden), which in turn also caused {DAV:}owner to fail
- * (424 Failed Dependency) because the request needs to be atomic.
- *
- * @param mixed $calendarId
- * @param array $mutations
- * @return bool|array
- */
- public function updateCalendar($calendarId, array $mutations);
-
- /**
- * Delete a calendar and all it's objects
- *
- * @param mixed $calendarId
- * @return void
- */
- public function deleteCalendar($calendarId);
-
- /**
- * Returns all calendar objects within a calendar.
- *
- * Every item contains an array with the following keys:
- * * id - unique identifier which will be used for subsequent updates
- * * calendardata - The iCalendar-compatible calendar data
- * * uri - a unique key which will be used to construct the uri. This can be any arbitrary string.
- * * lastmodified - a timestamp of the last modification time
- * * etag - An arbitrary string, surrounded by double-quotes. (e.g.:
- * ' "abcdef"')
- * * calendarid - The calendarid as it was passed to this function.
- * * size - The size of the calendar objects, in bytes.
- *
- * Note that the etag is optional, but it's highly encouraged to return for
- * speed reasons.
- *
- * The calendardata is also optional. If it's not returned
- * 'getCalendarObject' will be called later, which *is* expected to return
- * calendardata.
- *
- * If neither etag or size are specified, the calendardata will be
- * used/fetched to determine these numbers. If both are specified the
- * amount of times this is needed is reduced by a great degree.
- *
- * @param mixed $calendarId
- * @return array
- */
- public function getCalendarObjects($calendarId);
-
- /**
- * Returns information from a single calendar object, based on it's object
- * uri.
- *
- * The returned array must have the same keys as getCalendarObjects. The
- * 'calendardata' object is required here though, while it's not required
- * for getCalendarObjects.
- *
- * @param mixed $calendarId
- * @param string $objectUri
- * @return array
- */
- public function getCalendarObject($calendarId,$objectUri);
-
- /**
- * Creates a new calendar object.
- *
- * It is possible return an etag from this function, which will be used in
- * the response to this PUT request. Note that the ETag must be surrounded
- * by double-quotes.
- *
- * However, you should only really return this ETag if you don't mangle the
- * calendar-data. If the result of a subsequent GET to this object is not
- * the exact same as this request body, you should omit the ETag.
- *
- * @param mixed $calendarId
- * @param string $objectUri
- * @param string $calendarData
- * @return string|null
- */
- public function createCalendarObject($calendarId,$objectUri,$calendarData);
-
- /**
- * Updates an existing calendarobject, based on it's uri.
- *
- * It is possible return an etag from this function, which will be used in
- * the response to this PUT request. Note that the ETag must be surrounded
- * by double-quotes.
- *
- * However, you should only really return this ETag if you don't mangle the
- * calendar-data. If the result of a subsequent GET to this object is not
- * the exact same as this request body, you should omit the ETag.
- *
- * @param mixed $calendarId
- * @param string $objectUri
- * @param string $calendarData
- * @return string|null
- */
- public function updateCalendarObject($calendarId,$objectUri,$calendarData);
-
- /**
- * Deletes an existing calendar object.
- *
- * @param mixed $calendarId
- * @param string $objectUri
- * @return void
- */
- public function deleteCalendarObject($calendarId,$objectUri);
-
- /**
- * Performs a calendar-query on the contents of this calendar.
- *
- * The calendar-query is defined in RFC4791 : CalDAV. Using the
- * calendar-query it is possible for a client to request a specific set of
- * object, based on contents of iCalendar properties, date-ranges and
- * iCalendar component types (VTODO, VEVENT).
- *
- * This method should just return a list of (relative) urls that match this
- * query.
- *
- * The list of filters are specified as an array. The exact array is
- * documented by Sabre_CalDAV_CalendarQueryParser.
- *
- * Note that it is extremely likely that getCalendarObject for every path
- * returned from this method will be called almost immediately after. You
- * may want to anticipate this to speed up these requests.
- *
- * This method provides a default implementation, which parses *all* the
- * iCalendar objects in the specified calendar.
- *
- * This default may well be good enough for personal use, and calendars
- * that aren't very large. But if you anticipate high usage, big calendars
- * or high loads, you are strongly adviced to optimize certain paths.
- *
- * The best way to do so is override this method and to optimize
- * specifically for 'common filters'.
- *
- * Requests that are extremely common are:
- * * requests for just VEVENTS
- * * requests for just VTODO
- * * requests with a time-range-filter on either VEVENT or VTODO.
- *
- * ..and combinations of these requests. It may not be worth it to try to
- * handle every possible situation and just rely on the (relatively
- * easy to use) CalendarQueryValidator to handle the rest.
- *
- * Note that especially time-range-filters may be difficult to parse. A
- * time-range filter specified on a VEVENT must for instance also handle
- * recurrence rules correctly.
- * A good example of how to interprete all these filters can also simply
- * be found in Sabre_CalDAV_CalendarQueryFilter. This class is as correct
- * as possible, so it gives you a good idea on what type of stuff you need
- * to think of.
- *
- * @param mixed $calendarId
- * @param array $filters
- * @return array
- */
- public function calendarQuery($calendarId, array $filters);
-
-}
diff --git a/3rdparty/Sabre/CalDAV/Backend/NotificationSupport.php b/3rdparty/Sabre/CalDAV/Backend/NotificationSupport.php
deleted file mode 100644
index d5a1409d9b9..00000000000
--- a/3rdparty/Sabre/CalDAV/Backend/NotificationSupport.php
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-
-/**
- * Adds caldav notification support to a backend.
- *
- * Note: This feature is experimental, and may change in between different
- * SabreDAV versions.
- *
- * Notifications are defined at:
- * http://svn.calendarserver.org/repository/calendarserver/CalendarServer/trunk/doc/Extensions/caldav-notifications.txt
- *
- * These notifications are basically a list of server-generated notifications
- * displayed to the user. Users can dismiss notifications by deleting them.
- *
- * The primary usecase is to allow for calendar-sharing.
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-interface Sabre_CalDAV_Backend_NotificationSupport extends Sabre_CalDAV_Backend_BackendInterface {
-
- /**
- * Returns a list of notifications for a given principal url.
- *
- * The returned array should only consist of implementations of
- * Sabre_CalDAV_Notifications_INotificationType.
- *
- * @param string $principalUri
- * @return array
- */
- public function getNotificationsForPrincipal($principalUri);
-
- /**
- * This deletes a specific notifcation.
- *
- * This may be called by a client once it deems a notification handled.
- *
- * @param string $principalUri
- * @param Sabre_CalDAV_Notifications_INotificationType $notification
- * @return void
- */
- public function deleteNotification($principalUri, Sabre_CalDAV_Notifications_INotificationType $notification);
-
-}
diff --git a/3rdparty/Sabre/CalDAV/Backend/PDO.php b/3rdparty/Sabre/CalDAV/Backend/PDO.php
deleted file mode 100644
index 447f5f590cf..00000000000
--- a/3rdparty/Sabre/CalDAV/Backend/PDO.php
+++ /dev/null
@@ -1,687 +0,0 @@
-<?php
-
-use Sabre\VObject;
-
-/**
- * PDO CalDAV backend
- *
- * This backend is used to store calendar-data in a PDO database, such as
- * sqlite or MySQL
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CalDAV_Backend_PDO extends Sabre_CalDAV_Backend_Abstract {
-
- /**
- * We need to specify a max date, because we need to stop *somewhere*
- *
- * On 32 bit system the maximum for a signed integer is 2147483647, so
- * MAX_DATE cannot be higher than date('Y-m-d', 2147483647) which results
- * in 2038-01-19 to avoid problems when the date is converted
- * to a unix timestamp.
- */
- const MAX_DATE = '2038-01-01';
-
- /**
- * pdo
- *
- * @var PDO
- */
- protected $pdo;
-
- /**
- * The table name that will be used for calendars
- *
- * @var string
- */
- protected $calendarTableName;
-
- /**
- * The table name that will be used for calendar objects
- *
- * @var string
- */
- protected $calendarObjectTableName;
-
- /**
- * List of CalDAV properties, and how they map to database fieldnames
- * Add your own properties by simply adding on to this array.
- *
- * Note that only string-based properties are supported here.
- *
- * @var array
- */
- public $propertyMap = array(
- '{DAV:}displayname' => 'displayname',
- '{urn:ietf:params:xml:ns:caldav}calendar-description' => 'description',
- '{urn:ietf:params:xml:ns:caldav}calendar-timezone' => 'timezone',
- '{http://apple.com/ns/ical/}calendar-order' => 'calendarorder',
- '{http://apple.com/ns/ical/}calendar-color' => 'calendarcolor',
- );
-
- /**
- * Creates the backend
- *
- * @param PDO $pdo
- * @param string $calendarTableName
- * @param string $calendarObjectTableName
- */
- public function __construct(PDO $pdo, $calendarTableName = 'calendars', $calendarObjectTableName = 'calendarobjects') {
-
- $this->pdo = $pdo;
- $this->calendarTableName = $calendarTableName;
- $this->calendarObjectTableName = $calendarObjectTableName;
-
- }
-
- /**
- * Returns a list of calendars for a principal.
- *
- * Every project is an array with the following keys:
- * * id, a unique id that will be used by other functions to modify the
- * calendar. This can be the same as the uri or a database key.
- * * uri, which the basename of the uri with which the calendar is
- * accessed.
- * * principaluri. The owner of the calendar. Almost always the same as
- * principalUri passed to this method.
- *
- * Furthermore it can contain webdav properties in clark notation. A very
- * common one is '{DAV:}displayname'.
- *
- * @param string $principalUri
- * @return array
- */
- public function getCalendarsForUser($principalUri) {
-
- $fields = array_values($this->propertyMap);
- $fields[] = 'id';
- $fields[] = 'uri';
- $fields[] = 'ctag';
- $fields[] = 'components';
- $fields[] = 'principaluri';
- $fields[] = 'transparent';
-
- // Making fields a comma-delimited list
- $fields = implode(', ', $fields);
- $stmt = $this->pdo->prepare("SELECT " . $fields . " FROM ".$this->calendarTableName." WHERE principaluri = ? ORDER BY calendarorder ASC");
- $stmt->execute(array($principalUri));
-
- $calendars = array();
- while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
-
- $components = array();
- if ($row['components']) {
- $components = explode(',',$row['components']);
- }
-
- $calendar = array(
- 'id' => $row['id'],
- 'uri' => $row['uri'],
- 'principaluri' => $row['principaluri'],
- '{' . Sabre_CalDAV_Plugin::NS_CALENDARSERVER . '}getctag' => $row['ctag']?$row['ctag']:'0',
- '{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}supported-calendar-component-set' => new Sabre_CalDAV_Property_SupportedCalendarComponentSet($components),
- '{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}schedule-calendar-transp' => new Sabre_CalDAV_Property_ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
- );
-
-
- foreach($this->propertyMap as $xmlName=>$dbName) {
- $calendar[$xmlName] = $row[$dbName];
- }
-
- $calendars[] = $calendar;
-
- }
-
- return $calendars;
-
- }
-
- /**
- * Creates a new calendar for a principal.
- *
- * If the creation was a success, an id must be returned that can be used to reference
- * this calendar in other methods, such as updateCalendar
- *
- * @param string $principalUri
- * @param string $calendarUri
- * @param array $properties
- * @return string
- */
- public function createCalendar($principalUri, $calendarUri, array $properties) {
-
- $fieldNames = array(
- 'principaluri',
- 'uri',
- 'ctag',
- 'transparent',
- );
- $values = array(
- ':principaluri' => $principalUri,
- ':uri' => $calendarUri,
- ':ctag' => 1,
- ':transparent' => 0,
- );
-
- // Default value
- $sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set';
- $fieldNames[] = 'components';
- if (!isset($properties[$sccs])) {
- $values[':components'] = 'VEVENT,VTODO';
- } else {
- if (!($properties[$sccs] instanceof Sabre_CalDAV_Property_SupportedCalendarComponentSet)) {
- throw new Sabre_DAV_Exception('The ' . $sccs . ' property must be of type: Sabre_CalDAV_Property_SupportedCalendarComponentSet');
- }
- $values[':components'] = implode(',',$properties[$sccs]->getValue());
- }
- $transp = '{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}schedule-calendar-transp';
- if (isset($properties[$transp])) {
- $values[':transparent'] = $properties[$transp]->getValue()==='transparent';
- }
-
- foreach($this->propertyMap as $xmlName=>$dbName) {
- if (isset($properties[$xmlName])) {
-
- $values[':' . $dbName] = $properties[$xmlName];
- $fieldNames[] = $dbName;
- }
- }
-
- $stmt = $this->pdo->prepare("INSERT INTO ".$this->calendarTableName." (".implode(', ', $fieldNames).") VALUES (".implode(', ',array_keys($values)).")");
- $stmt->execute($values);
-
- return $this->pdo->lastInsertId();
-
- }
-
- /**
- * Updates properties for a calendar.
- *
- * The mutations array uses the propertyName in clark-notation as key,
- * and the array value for the property value. In the case a property
- * should be deleted, the property value will be null.
- *
- * This method must be atomic. If one property cannot be changed, the
- * entire operation must fail.
- *
- * If the operation was successful, true can be returned.
- * If the operation failed, false can be returned.
- *
- * Deletion of a non-existent property is always successful.
- *
- * Lastly, it is optional to return detailed information about any
- * failures. In this case an array should be returned with the following
- * structure:
- *
- * array(
- * 403 => array(
- * '{DAV:}displayname' => null,
- * ),
- * 424 => array(
- * '{DAV:}owner' => null,
- * )
- * )
- *
- * In this example it was forbidden to update {DAV:}displayname.
- * (403 Forbidden), which in turn also caused {DAV:}owner to fail
- * (424 Failed Dependency) because the request needs to be atomic.
- *
- * @param string $calendarId
- * @param array $mutations
- * @return bool|array
- */
- public function updateCalendar($calendarId, array $mutations) {
-
- $newValues = array();
- $result = array(
- 200 => array(), // Ok
- 403 => array(), // Forbidden
- 424 => array(), // Failed Dependency
- );
-
- $hasError = false;
-
- foreach($mutations as $propertyName=>$propertyValue) {
-
- switch($propertyName) {
- case '{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}schedule-calendar-transp' :
- $fieldName = 'transparent';
- $newValues[$fieldName] = $propertyValue->getValue()==='transparent';
- break;
- default :
- // Checking the property map
- if (!isset($this->propertyMap[$propertyName])) {
- // We don't know about this property.
- $hasError = true;
- $result[403][$propertyName] = null;
- unset($mutations[$propertyName]);
- continue;
- }
-
- $fieldName = $this->propertyMap[$propertyName];
- $newValues[$fieldName] = $propertyValue;
- }
-
- }
-
- // If there were any errors we need to fail the request
- if ($hasError) {
- // Properties has the remaining properties
- foreach($mutations as $propertyName=>$propertyValue) {
- $result[424][$propertyName] = null;
- }
-
- // Removing unused statuscodes for cleanliness
- foreach($result as $status=>$properties) {
- if (is_array($properties) && count($properties)===0) unset($result[$status]);
- }
-
- return $result;
-
- }
-
- // Success
-
- // Now we're generating the sql query.
- $valuesSql = array();
- foreach($newValues as $fieldName=>$value) {
- $valuesSql[] = $fieldName . ' = ?';
- }
- $valuesSql[] = 'ctag = ctag + 1';
-
- $stmt = $this->pdo->prepare("UPDATE " . $this->calendarTableName . " SET " . implode(', ',$valuesSql) . " WHERE id = ?");
- $newValues['id'] = $calendarId;
- $stmt->execute(array_values($newValues));
-
- return true;
-
- }
-
- /**
- * Delete a calendar and all it's objects
- *
- * @param string $calendarId
- * @return void
- */
- public function deleteCalendar($calendarId) {
-
- $stmt = $this->pdo->prepare('DELETE FROM '.$this->calendarObjectTableName.' WHERE calendarid = ?');
- $stmt->execute(array($calendarId));
-
- $stmt = $this->pdo->prepare('DELETE FROM '.$this->calendarTableName.' WHERE id = ?');
- $stmt->execute(array($calendarId));
-
- }
-
- /**
- * Returns all calendar objects within a calendar.
- *
- * Every item contains an array with the following keys:
- * * id - unique identifier which will be used for subsequent updates
- * * calendardata - The iCalendar-compatible calendar data
- * * uri - a unique key which will be used to construct the uri. This can be any arbitrary string.
- * * lastmodified - a timestamp of the last modification time
- * * etag - An arbitrary string, surrounded by double-quotes. (e.g.:
- * ' "abcdef"')
- * * calendarid - The calendarid as it was passed to this function.
- * * size - The size of the calendar objects, in bytes.
- *
- * Note that the etag is optional, but it's highly encouraged to return for
- * speed reasons.
- *
- * The calendardata is also optional. If it's not returned
- * 'getCalendarObject' will be called later, which *is* expected to return
- * calendardata.
- *
- * If neither etag or size are specified, the calendardata will be
- * used/fetched to determine these numbers. If both are specified the
- * amount of times this is needed is reduced by a great degree.
- *
- * @param string $calendarId
- * @return array
- */
- public function getCalendarObjects($calendarId) {
-
- $stmt = $this->pdo->prepare('SELECT id, uri, lastmodified, etag, calendarid, size FROM '.$this->calendarObjectTableName.' WHERE calendarid = ?');
- $stmt->execute(array($calendarId));
-
- $result = array();
- foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) {
- $result[] = array(
- 'id' => $row['id'],
- 'uri' => $row['uri'],
- 'lastmodified' => $row['lastmodified'],
- 'etag' => '"' . $row['etag'] . '"',
- 'calendarid' => $row['calendarid'],
- 'size' => (int)$row['size'],
- );
- }
-
- return $result;
-
- }
-
- /**
- * Returns information from a single calendar object, based on it's object
- * uri.
- *
- * The returned array must have the same keys as getCalendarObjects. The
- * 'calendardata' object is required here though, while it's not required
- * for getCalendarObjects.
- *
- * @param string $calendarId
- * @param string $objectUri
- * @return array
- */
- public function getCalendarObject($calendarId,$objectUri) {
-
- $stmt = $this->pdo->prepare('SELECT id, uri, lastmodified, etag, calendarid, size, calendardata FROM '.$this->calendarObjectTableName.' WHERE calendarid = ? AND uri = ?');
- $stmt->execute(array($calendarId, $objectUri));
- $row = $stmt->fetch(\PDO::FETCH_ASSOC);
-
- if(!$row) return null;
-
- return array(
- 'id' => $row['id'],
- 'uri' => $row['uri'],
- 'lastmodified' => $row['lastmodified'],
- 'etag' => '"' . $row['etag'] . '"',
- 'calendarid' => $row['calendarid'],
- 'size' => (int)$row['size'],
- 'calendardata' => $row['calendardata'],
- );
-
- }
-
-
- /**
- * Creates a new calendar object.
- *
- * It is possible return an etag from this function, which will be used in
- * the response to this PUT request. Note that the ETag must be surrounded
- * by double-quotes.
- *
- * However, you should only really return this ETag if you don't mangle the
- * calendar-data. If the result of a subsequent GET to this object is not
- * the exact same as this request body, you should omit the ETag.
- *
- * @param mixed $calendarId
- * @param string $objectUri
- * @param string $calendarData
- * @return string|null
- */
- public function createCalendarObject($calendarId,$objectUri,$calendarData) {
-
- $extraData = $this->getDenormalizedData($calendarData);
-
- $stmt = $this->pdo->prepare('INSERT INTO '.$this->calendarObjectTableName.' (calendarid, uri, calendardata, lastmodified, etag, size, componenttype, firstoccurence, lastoccurence) VALUES (?,?,?,?,?,?,?,?,?)');
- $stmt->execute(array(
- $calendarId,
- $objectUri,
- $calendarData,
- time(),
- $extraData['etag'],
- $extraData['size'],
- $extraData['componentType'],
- $extraData['firstOccurence'],
- $extraData['lastOccurence'],
- ));
- $stmt = $this->pdo->prepare('UPDATE '.$this->calendarTableName.' SET ctag = ctag + 1 WHERE id = ?');
- $stmt->execute(array($calendarId));
-
- return '"' . $extraData['etag'] . '"';
-
- }
-
- /**
- * Updates an existing calendarobject, based on it's uri.
- *
- * It is possible return an etag from this function, which will be used in
- * the response to this PUT request. Note that the ETag must be surrounded
- * by double-quotes.
- *
- * However, you should only really return this ETag if you don't mangle the
- * calendar-data. If the result of a subsequent GET to this object is not
- * the exact same as this request body, you should omit the ETag.
- *
- * @param mixed $calendarId
- * @param string $objectUri
- * @param string $calendarData
- * @return string|null
- */
- public function updateCalendarObject($calendarId,$objectUri,$calendarData) {
-
- $extraData = $this->getDenormalizedData($calendarData);
-
- $stmt = $this->pdo->prepare('UPDATE '.$this->calendarObjectTableName.' SET calendardata = ?, lastmodified = ?, etag = ?, size = ?, componenttype = ?, firstoccurence = ?, lastoccurence = ? WHERE calendarid = ? AND uri = ?');
- $stmt->execute(array($calendarData,time(), $extraData['etag'], $extraData['size'], $extraData['componentType'], $extraData['firstOccurence'], $extraData['lastOccurence'] ,$calendarId,$objectUri));
- $stmt = $this->pdo->prepare('UPDATE '.$this->calendarTableName.' SET ctag = ctag + 1 WHERE id = ?');
- $stmt->execute(array($calendarId));
-
- return '"' . $extraData['etag'] . '"';
-
- }
-
- /**
- * Parses some information from calendar objects, used for optimized
- * calendar-queries.
- *
- * Returns an array with the following keys:
- * * etag
- * * size
- * * componentType
- * * firstOccurence
- * * lastOccurence
- *
- * @param string $calendarData
- * @return array
- */
- protected function getDenormalizedData($calendarData) {
-
- $vObject = VObject\Reader::read($calendarData);
- $componentType = null;
- $component = null;
- $firstOccurence = null;
- $lastOccurence = null;
- foreach($vObject->getComponents() as $component) {
- if ($component->name!=='VTIMEZONE') {
- $componentType = $component->name;
- break;
- }
- }
- if (!$componentType) {
- throw new Sabre_DAV_Exception_BadRequest('Calendar objects must have a VJOURNAL, VEVENT or VTODO component');
- }
- if ($componentType === 'VEVENT') {
- $firstOccurence = $component->DTSTART->getDateTime()->getTimeStamp();
- // Finding the last occurence is a bit harder
- if (!isset($component->RRULE)) {
- if (isset($component->DTEND)) {
- $lastOccurence = $component->DTEND->getDateTime()->getTimeStamp();
- } elseif (isset($component->DURATION)) {
- $endDate = clone $component->DTSTART->getDateTime();
- $endDate->add(VObject\DateTimeParser::parse($component->DURATION->value));
- $lastOccurence = $endDate->getTimeStamp();
- } elseif ($component->DTSTART->getDateType()===VObject\Property\DateTime::DATE) {
- $endDate = clone $component->DTSTART->getDateTime();
- $endDate->modify('+1 day');
- $lastOccurence = $endDate->getTimeStamp();
- } else {
- $lastOccurence = $firstOccurence;
- }
- } else {
- $it = new VObject\RecurrenceIterator($vObject, (string)$component->UID);
- $maxDate = new DateTime(self::MAX_DATE);
- if ($it->isInfinite()) {
- $lastOccurence = $maxDate->getTimeStamp();
- } else {
- $end = $it->getDtEnd();
- while($it->valid() && $end < $maxDate) {
- $end = $it->getDtEnd();
- $it->next();
-
- }
- $lastOccurence = $end->getTimeStamp();
- }
-
- }
- }
-
- return array(
- 'etag' => md5($calendarData),
- 'size' => strlen($calendarData),
- 'componentType' => $componentType,
- 'firstOccurence' => $firstOccurence,
- 'lastOccurence' => $lastOccurence,
- );
-
- }
-
- /**
- * Deletes an existing calendar object.
- *
- * @param string $calendarId
- * @param string $objectUri
- * @return void
- */
- public function deleteCalendarObject($calendarId,$objectUri) {
-
- $stmt = $this->pdo->prepare('DELETE FROM '.$this->calendarObjectTableName.' WHERE calendarid = ? AND uri = ?');
- $stmt->execute(array($calendarId,$objectUri));
- $stmt = $this->pdo->prepare('UPDATE '. $this->calendarTableName .' SET ctag = ctag + 1 WHERE id = ?');
- $stmt->execute(array($calendarId));
-
- }
-
- /**
- * Performs a calendar-query on the contents of this calendar.
- *
- * The calendar-query is defined in RFC4791 : CalDAV. Using the
- * calendar-query it is possible for a client to request a specific set of
- * object, based on contents of iCalendar properties, date-ranges and
- * iCalendar component types (VTODO, VEVENT).
- *
- * This method should just return a list of (relative) urls that match this
- * query.
- *
- * The list of filters are specified as an array. The exact array is
- * documented by Sabre_CalDAV_CalendarQueryParser.
- *
- * Note that it is extremely likely that getCalendarObject for every path
- * returned from this method will be called almost immediately after. You
- * may want to anticipate this to speed up these requests.
- *
- * This method provides a default implementation, which parses *all* the
- * iCalendar objects in the specified calendar.
- *
- * This default may well be good enough for personal use, and calendars
- * that aren't very large. But if you anticipate high usage, big calendars
- * or high loads, you are strongly adviced to optimize certain paths.
- *
- * The best way to do so is override this method and to optimize
- * specifically for 'common filters'.
- *
- * Requests that are extremely common are:
- * * requests for just VEVENTS
- * * requests for just VTODO
- * * requests with a time-range-filter on a VEVENT.
- *
- * ..and combinations of these requests. It may not be worth it to try to
- * handle every possible situation and just rely on the (relatively
- * easy to use) CalendarQueryValidator to handle the rest.
- *
- * Note that especially time-range-filters may be difficult to parse. A
- * time-range filter specified on a VEVENT must for instance also handle
- * recurrence rules correctly.
- * A good example of how to interprete all these filters can also simply
- * be found in Sabre_CalDAV_CalendarQueryFilter. This class is as correct
- * as possible, so it gives you a good idea on what type of stuff you need
- * to think of.
- *
- * This specific implementation (for the PDO) backend optimizes filters on
- * specific components, and VEVENT time-ranges.
- *
- * @param string $calendarId
- * @param array $filters
- * @return array
- */
- public function calendarQuery($calendarId, array $filters) {
-
- $result = array();
- $validator = new Sabre_CalDAV_CalendarQueryValidator();
-
- $componentType = null;
- $requirePostFilter = true;
- $timeRange = null;
-
- // if no filters were specified, we don't need to filter after a query
- if (!$filters['prop-filters'] && !$filters['comp-filters']) {
- $requirePostFilter = false;
- }
-
- // Figuring out if there's a component filter
- if (count($filters['comp-filters']) > 0 && !$filters['comp-filters'][0]['is-not-defined']) {
- $componentType = $filters['comp-filters'][0]['name'];
-
- // Checking if we need post-filters
- if (!$filters['prop-filters'] && !$filters['comp-filters'][0]['comp-filters'] && !$filters['comp-filters'][0]['time-range'] && !$filters['comp-filters'][0]['prop-filters']) {
- $requirePostFilter = false;
- }
- // There was a time-range filter
- if ($componentType == 'VEVENT' && isset($filters['comp-filters'][0]['time-range'])) {
- $timeRange = $filters['comp-filters'][0]['time-range'];
-
- // If start time OR the end time is not specified, we can do a
- // 100% accurate mysql query.
- if (!$filters['prop-filters'] && !$filters['comp-filters'][0]['comp-filters'] && !$filters['comp-filters'][0]['prop-filters'] && (!$timeRange['start'] || !$timeRange['end'])) {
- $requirePostFilter = false;
- }
- }
-
- }
-
- if ($requirePostFilter) {
- $query = "SELECT uri, calendardata FROM ".$this->calendarObjectTableName." WHERE calendarid = :calendarid";
- } else {
- $query = "SELECT uri FROM ".$this->calendarObjectTableName." WHERE calendarid = :calendarid";
- }
-
- $values = array(
- 'calendarid' => $calendarId,
- );
-
- if ($componentType) {
- $query.=" AND componenttype = :componenttype";
- $values['componenttype'] = $componentType;
- }
-
- if ($timeRange && $timeRange['start']) {
- $query.=" AND lastoccurence > :startdate";
- $values['startdate'] = $timeRange['start']->getTimeStamp();
- }
- if ($timeRange && $timeRange['end']) {
- $query.=" AND firstoccurence < :enddate";
- $values['enddate'] = $timeRange['end']->getTimeStamp();
- }
-
- $stmt = $this->pdo->prepare($query);
- $stmt->execute($values);
-
- $result = array();
- while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
- if ($requirePostFilter) {
- if (!$this->validateFilterForObject($row, $filters)) {
- continue;
- }
- }
- $result[] = $row['uri'];
-
- }
-
- return $result;
-
- }
-}
diff --git a/3rdparty/Sabre/CalDAV/Backend/SharingSupport.php b/3rdparty/Sabre/CalDAV/Backend/SharingSupport.php
deleted file mode 100644
index f73f0ff3d8a..00000000000
--- a/3rdparty/Sabre/CalDAV/Backend/SharingSupport.php
+++ /dev/null
@@ -1,238 +0,0 @@
-<?php
-
-/**
- * Adds support for sharing features to a CalDAV server.
- *
- * Note: This feature is experimental, and may change in between different
- * SabreDAV versions.
- *
- * Early warning: Currently SabreDAV provides no implementation for this. This
- * is, because in it's current state there is no elegant way to do this.
- * The problem lies in the fact that a real CalDAV server with sharing support
- * would first need email support (with invite notifications), and really also
- * a browser-frontend that allows people to accept or reject these shares.
- *
- * In addition, the CalDAV backends are currently kept as independent as
- * possible, and should not be aware of principals, email addresses or
- * accounts.
- *
- * Adding an implementation for Sharing to standard-sabredav would contradict
- * these goals, so for this reason this is currently not implemented, although
- * it may very well in the future; but probably not before SabreDAV 2.0.
- *
- * The interface works however, so if you implement all this, and do it
- * correctly sharing _will_ work. It's not particularly easy, and I _urge you_
- * to make yourself acquainted with the following document first:
- *
- * https://trac.calendarserver.org/browser/CalendarServer/trunk/doc/Extensions/caldav-sharing.txt
- *
- * An overview
- * ===========
- *
- * Implementing this interface will allow a user to share his or her calendars
- * to other users. Effectively, when a calendar is shared the calendar will
- * show up in both the Sharer's and Sharee's calendar-home root.
- * This interface adds a few methods that ensure that this happens, and there
- * are also a number of new requirements in the base-class you must now follow.
- *
- *
- * How it works
- * ============
- *
- * When a user shares a calendar, the addShare() method will be called with a
- * list of sharees that are now added, and a list of sharees that have been
- * removed.
- * Removal is instant, but when a sharee is added the sharee first gets a
- * chance to accept or reject the invitation for a share.
- *
- * After a share is accepted, the calendar will be returned from
- * getUserCalendars for both the sharer, and the sharee.
- *
- * If the sharee deletes the calendar, only their share gets deleted. When the
- * owner deletes a calendar, it will be removed for everybody.
- *
- *
- * Notifications
- * =============
- *
- * During all these sharing operations, a lot of notifications are sent back
- * and forward.
- *
- * Whenever the list of sharees for a calendar has been changed (they have been
- * added, removed or modified) all sharees should get a notification for this
- * change.
- * This notification is always represented by:
- *
- * Sabre_CalDAV_Notifications_Notification_Invite
- *
- * In the case of an invite, the sharee may reply with an 'accept' or
- * 'decline'. These are always represented by:
- *
- * Sabre_CalDAV_Notifications_Notification_Invite
- *
- *
- * Calendar access by sharees
- * ==========================
- *
- * As mentioned earlier, shared calendars must now also be returned for
- * getCalendarsForUser for sharees. A few things change though.
- *
- * The following properties must be specified:
- *
- * 1. {http://calendarserver.org/ns/}shared-url
- *
- * This property MUST contain the url to the original calendar, that is.. the
- * path to the calendar from the owner.
- *
- * 2. {http://sabredav.org/ns}owner-principal
- *
- * This is a url to to the principal who is sharing the calendar.
- *
- * 3. {http://sabredav.org/ns}read-only
- *
- * This should be either 0 or 1, depending on if the user has read-only or
- * read-write access to the calendar.
- *
- * Only when this is done, the calendar will correctly be marked as a calendar
- * that's shared to him, thus allowing clients to display the correct interface
- * and ACL enforcement.
- *
- * If a sharee deletes their calendar, only their instance of the calendar
- * should be deleted, the original should still exists.
- * Pretty much any 'dead' WebDAV properties on these shared calendars should be
- * specific to a user. This means that if the displayname is changed by a
- * sharee, the original is not affected. This is also true for:
- * * The description
- * * The color
- * * The order
- * * And any other dead properties.
- *
- * Properties like a ctag should not be different for multiple instances of the
- * calendar.
- *
- * Lastly, objects *within* calendars should also have user-specific data. The
- * two things that are user-specific are:
- * * VALARM objects
- * * The TRANSP property
- *
- * This _also_ implies that if a VALARM is deleted by a sharee for some event,
- * this has no effect on the original VALARM.
- *
- * Understandably, the this last requirement is one of the hardest.
- * Realisticly, I can see people ignoring this part of the spec, but that could
- * cause a different set of issues.
- *
- *
- * Publishing
- * ==========
- *
- * When a user publishes a url, the server should generate a 'publish url'.
- * This is a read-only url, anybody can use to consume the calendar feed.
- *
- * Calendars are in one of two states:
- * * published
- * * unpublished
- *
- * If a calendar is published, the following property should be returned
- * for each calendar in getCalendarsForPrincipal.
- *
- * {http://calendarserver.org/ns/}publish-url
- *
- * This element should contain a {DAV:}href element, which points to the
- * public url that does not require authentication. Unlike every other href,
- * this url must be absolute.
- *
- * Ideally, the following property is always returned
- *
- * {http://calendarserver.org/ns/}pre-publish-url
- *
- * This property should contain the url that the calendar _would_ have, if it
- * were to be published. iCal uses this to display the url, before the user
- * will actually publish it.
- *
- *
- * Selectively disabling publish or share feature
- * ==============================================
- *
- * If Sabre_CalDAV_Property_AllowedSharingModes is returned from
- * getCalendarsByUser, this allows the server to specify wether either sharing,
- * or publishing is supported.
- *
- * This allows a client to determine in advance which features are available,
- * and update the interface appropriately. If this property is not returned by
- * the backend, the SharingPlugin automatically injects it and assumes both
- * features are available.
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-interface Sabre_CalDAV_Backend_SharingSupport extends Sabre_CalDAV_Backend_NotificationSupport {
-
- /**
- * Updates the list of shares.
- *
- * The first array is a list of people that are to be added to the
- * calendar.
- *
- * Every element in the add array has the following properties:
- * * href - A url. Usually a mailto: address
- * * commonName - Usually a first and last name, or false
- * * summary - A description of the share, can also be false
- * * readOnly - A boolean value
- *
- * Every element in the remove array is just the address string.
- *
- * Note that if the calendar is currently marked as 'not shared' by and
- * this method is called, the calendar should be 'upgraded' to a shared
- * calendar.
- *
- * @param mixed $calendarId
- * @param array $add
- * @param array $remove
- * @return void
- */
- function updateShares($calendarId, array $add, array $remove);
-
- /**
- * Returns the list of people whom this calendar is shared with.
- *
- * Every element in this array should have the following properties:
- * * href - Often a mailto: address
- * * commonName - Optional, for example a first + last name
- * * status - See the Sabre_CalDAV_SharingPlugin::STATUS_ constants.
- * * readOnly - boolean
- * * summary - Optional, a description for the share
- *
- * @param mixed $calendarId
- * @return array
- */
- function getShares($calendarId);
-
- /**
- * This method is called when a user replied to a request to share.
- *
- * If the user chose to accept the share, this method should return the
- * newly created calendar url.
- *
- * @param string href The sharee who is replying (often a mailto: address)
- * @param int status One of the SharingPlugin::STATUS_* constants
- * @param string $calendarUri The url to the calendar thats being shared
- * @param string $inReplyTo The unique id this message is a response to
- * @param string $summary A description of the reply
- * @return null|string
- */
- function shareReply($href, $status, $calendarUri, $inReplyTo, $summary = null);
-
- /**
- * Publishes a calendar
- *
- * @param mixed $calendarId
- * @param bool $value
- * @return void
- */
- function setPublishStatus($calendarId, $value);
-
-}
diff --git a/3rdparty/Sabre/CalDAV/Calendar.php b/3rdparty/Sabre/CalDAV/Calendar.php
deleted file mode 100644
index 63253febd5c..00000000000
--- a/3rdparty/Sabre/CalDAV/Calendar.php
+++ /dev/null
@@ -1,378 +0,0 @@
-<?php
-
-/**
- * This object represents a CalDAV calendar.
- *
- * A calendar can contain multiple TODO and or Events. These are represented
- * as Sabre_CalDAV_CalendarObject objects.
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CalDAV_Calendar implements Sabre_CalDAV_ICalendar, Sabre_DAV_IProperties, Sabre_DAVACL_IACL {
-
- /**
- * This is an array with calendar information
- *
- * @var array
- */
- protected $calendarInfo;
-
- /**
- * CalDAV backend
- *
- * @var Sabre_CalDAV_Backend_BackendInterface
- */
- protected $caldavBackend;
-
- /**
- * Principal backend
- *
- * @var Sabre_DAVACL_IPrincipalBackend
- */
- protected $principalBackend;
-
- /**
- * Constructor
- *
- * @param Sabre_DAVACL_IPrincipalBackend $principalBackend
- * @param Sabre_CalDAV_Backend_BackendInterface $caldavBackend
- * @param array $calendarInfo
- */
- public function __construct(Sabre_DAVACL_IPrincipalBackend $principalBackend, Sabre_CalDAV_Backend_BackendInterface $caldavBackend, $calendarInfo) {
-
- $this->caldavBackend = $caldavBackend;
- $this->principalBackend = $principalBackend;
- $this->calendarInfo = $calendarInfo;
-
- }
-
- /**
- * Returns the name of the calendar
- *
- * @return string
- */
- public function getName() {
-
- return $this->calendarInfo['uri'];
-
- }
-
- /**
- * Updates properties such as the display name and description
- *
- * @param array $mutations
- * @return array
- */
- public function updateProperties($mutations) {
-
- return $this->caldavBackend->updateCalendar($this->calendarInfo['id'],$mutations);
-
- }
-
- /**
- * Returns the list of properties
- *
- * @param array $requestedProperties
- * @return array
- */
- public function getProperties($requestedProperties) {
-
- $response = array();
-
- foreach($requestedProperties as $prop) switch($prop) {
-
- case '{urn:ietf:params:xml:ns:caldav}supported-calendar-data' :
- $response[$prop] = new Sabre_CalDAV_Property_SupportedCalendarData();
- break;
- case '{urn:ietf:params:xml:ns:caldav}supported-collation-set' :
- $response[$prop] = new Sabre_CalDAV_Property_SupportedCollationSet();
- break;
- default :
- if (isset($this->calendarInfo[$prop])) $response[$prop] = $this->calendarInfo[$prop];
- break;
-
- }
- return $response;
-
- }
-
- /**
- * Returns a calendar object
- *
- * The contained calendar objects are for example Events or Todo's.
- *
- * @param string $name
- * @return Sabre_CalDAV_ICalendarObject
- */
- public function getChild($name) {
-
- $obj = $this->caldavBackend->getCalendarObject($this->calendarInfo['id'],$name);
- if (!$obj) throw new Sabre_DAV_Exception_NotFound('Calendar object not found');
-
- $obj['acl'] = $this->getACL();
- // Removing the irrelivant
- foreach($obj['acl'] as $key=>$acl) {
- if ($acl['privilege'] === '{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}read-free-busy') {
- unset($obj['acl'][$key]);
- }
- }
-
- return new Sabre_CalDAV_CalendarObject($this->caldavBackend,$this->calendarInfo,$obj);
-
- }
-
- /**
- * Returns the full list of calendar objects
- *
- * @return array
- */
- public function getChildren() {
-
- $objs = $this->caldavBackend->getCalendarObjects($this->calendarInfo['id']);
- $children = array();
- foreach($objs as $obj) {
- $obj['acl'] = $this->getACL();
- // Removing the irrelivant
- foreach($obj['acl'] as $key=>$acl) {
- if ($acl['privilege'] === '{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}read-free-busy') {
- unset($obj['acl'][$key]);
- }
- }
- $children[] = new Sabre_CalDAV_CalendarObject($this->caldavBackend,$this->calendarInfo,$obj);
- }
- return $children;
-
- }
-
- /**
- * Checks if a child-node exists.
- *
- * @param string $name
- * @return bool
- */
- public function childExists($name) {
-
- $obj = $this->caldavBackend->getCalendarObject($this->calendarInfo['id'],$name);
- if (!$obj)
- return false;
- else
- return true;
-
- }
-
- /**
- * Creates a new directory
- *
- * We actually block this, as subdirectories are not allowed in calendars.
- *
- * @param string $name
- * @return void
- */
- public function createDirectory($name) {
-
- throw new Sabre_DAV_Exception_MethodNotAllowed('Creating collections in calendar objects is not allowed');
-
- }
-
- /**
- * Creates a new file
- *
- * The contents of the new file must be a valid ICalendar string.
- *
- * @param string $name
- * @param resource $calendarData
- * @return string|null
- */
- public function createFile($name,$calendarData = null) {
-
- if (is_resource($calendarData)) {
- $calendarData = stream_get_contents($calendarData);
- }
- return $this->caldavBackend->createCalendarObject($this->calendarInfo['id'],$name,$calendarData);
-
- }
-
- /**
- * Deletes the calendar.
- *
- * @return void
- */
- public function delete() {
-
- $this->caldavBackend->deleteCalendar($this->calendarInfo['id']);
-
- }
-
- /**
- * Renames the calendar. Note that most calendars use the
- * {DAV:}displayname to display a name to display a name.
- *
- * @param string $newName
- * @return void
- */
- public function setName($newName) {
-
- throw new Sabre_DAV_Exception_MethodNotAllowed('Renaming calendars is not yet supported');
-
- }
-
- /**
- * Returns the last modification date as a unix timestamp.
- *
- * @return void
- */
- public function getLastModified() {
-
- return null;
-
- }
-
- /**
- * Returns the owner principal
- *
- * This must be a url to a principal, or null if there's no owner
- *
- * @return string|null
- */
- public function getOwner() {
-
- return $this->calendarInfo['principaluri'];
-
- }
-
- /**
- * Returns a group principal
- *
- * This must be a url to a principal, or null if there's no owner
- *
- * @return string|null
- */
- public function getGroup() {
-
- return null;
-
- }
-
- /**
- * Returns a list of ACE's for this node.
- *
- * Each ACE has the following properties:
- * * 'privilege', a string such as {DAV:}read or {DAV:}write. These are
- * currently the only supported privileges
- * * 'principal', a url to the principal who owns the node
- * * 'protected' (optional), indicating that this ACE is not allowed to
- * be updated.
- *
- * @return array
- */
- public function getACL() {
-
- return array(
- array(
- 'privilege' => '{DAV:}read',
- 'principal' => $this->getOwner(),
- 'protected' => true,
- ),
- array(
- 'privilege' => '{DAV:}write',
- 'principal' => $this->getOwner(),
- 'protected' => true,
- ),
- array(
- 'privilege' => '{DAV:}read',
- 'principal' => $this->getOwner() . '/calendar-proxy-write',
- 'protected' => true,
- ),
- array(
- 'privilege' => '{DAV:}write',
- 'principal' => $this->getOwner() . '/calendar-proxy-write',
- 'protected' => true,
- ),
- array(
- 'privilege' => '{DAV:}read',
- 'principal' => $this->getOwner() . '/calendar-proxy-read',
- 'protected' => true,
- ),
- array(
- 'privilege' => '{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}read-free-busy',
- 'principal' => '{DAV:}authenticated',
- 'protected' => true,
- ),
-
- );
-
- }
-
- /**
- * Updates the ACL
- *
- * This method will receive a list of new ACE's.
- *
- * @param array $acl
- * @return void
- */
- public function setACL(array $acl) {
-
- throw new Sabre_DAV_Exception_MethodNotAllowed('Changing ACL is not yet supported');
-
- }
-
- /**
- * Returns the list of supported privileges for this node.
- *
- * The returned data structure is a list of nested privileges.
- * See Sabre_DAVACL_Plugin::getDefaultSupportedPrivilegeSet for a simple
- * standard structure.
- *
- * If null is returned from this method, the default privilege set is used,
- * which is fine for most common usecases.
- *
- * @return array|null
- */
- public function getSupportedPrivilegeSet() {
-
- $default = Sabre_DAVACL_Plugin::getDefaultSupportedPrivilegeSet();
-
- // We need to inject 'read-free-busy' in the tree, aggregated under
- // {DAV:}read.
- foreach($default['aggregates'] as &$agg) {
-
- if ($agg['privilege'] !== '{DAV:}read') continue;
-
- $agg['aggregates'][] = array(
- 'privilege' => '{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}read-free-busy',
- );
-
- }
- return $default;
-
- }
-
- /**
- * Performs a calendar-query on the contents of this calendar.
- *
- * The calendar-query is defined in RFC4791 : CalDAV. Using the
- * calendar-query it is possible for a client to request a specific set of
- * object, based on contents of iCalendar properties, date-ranges and
- * iCalendar component types (VTODO, VEVENT).
- *
- * This method should just return a list of (relative) urls that match this
- * query.
- *
- * The list of filters are specified as an array. The exact array is
- * documented by Sabre_CalDAV_CalendarQueryParser.
- *
- * @param array $filters
- * @return array
- */
- public function calendarQuery(array $filters) {
-
- return $this->caldavBackend->calendarQuery($this->calendarInfo['id'], $filters);
-
- }
-
-}
diff --git a/3rdparty/Sabre/CalDAV/CalendarObject.php b/3rdparty/Sabre/CalDAV/CalendarObject.php
deleted file mode 100644
index 40bd8588c70..00000000000
--- a/3rdparty/Sabre/CalDAV/CalendarObject.php
+++ /dev/null
@@ -1,279 +0,0 @@
-<?php
-
-/**
- * The CalendarObject represents a single VEVENT or VTODO within a Calendar.
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CalDAV_CalendarObject extends Sabre_DAV_File implements Sabre_CalDAV_ICalendarObject, Sabre_DAVACL_IACL {
-
- /**
- * Sabre_CalDAV_Backend_BackendInterface
- *
- * @var array
- */
- protected $caldavBackend;
-
- /**
- * Array with information about this CalendarObject
- *
- * @var array
- */
- protected $objectData;
-
- /**
- * Array with information about the containing calendar
- *
- * @var array
- */
- protected $calendarInfo;
-
- /**
- * Constructor
- *
- * @param Sabre_CalDAV_Backend_BackendInterface $caldavBackend
- * @param array $calendarInfo
- * @param array $objectData
- */
- public function __construct(Sabre_CalDAV_Backend_BackendInterface $caldavBackend,array $calendarInfo,array $objectData) {
-
- $this->caldavBackend = $caldavBackend;
-
- if (!isset($objectData['calendarid'])) {
- throw new InvalidArgumentException('The objectData argument must contain a \'calendarid\' property');
- }
- if (!isset($objectData['uri'])) {
- throw new InvalidArgumentException('The objectData argument must contain an \'uri\' property');
- }
-
- $this->calendarInfo = $calendarInfo;
- $this->objectData = $objectData;
-
- }
-
- /**
- * Returns the uri for this object
- *
- * @return string
- */
- public function getName() {
-
- return $this->objectData['uri'];
-
- }
-
- /**
- * Returns the ICalendar-formatted object
- *
- * @return string
- */
- public function get() {
-
- // Pre-populating the 'calendardata' is optional, if we don't have it
- // already we fetch it from the backend.
- if (!isset($this->objectData['calendardata'])) {
- $this->objectData = $this->caldavBackend->getCalendarObject($this->objectData['calendarid'], $this->objectData['uri']);
- }
- return $this->objectData['calendardata'];
-
- }
-
- /**
- * Updates the ICalendar-formatted object
- *
- * @param string|resource $calendarData
- * @return string
- */
- public function put($calendarData) {
-
- if (is_resource($calendarData)) {
- $calendarData = stream_get_contents($calendarData);
- }
- $etag = $this->caldavBackend->updateCalendarObject($this->calendarInfo['id'],$this->objectData['uri'],$calendarData);
- $this->objectData['calendardata'] = $calendarData;
- $this->objectData['etag'] = $etag;
-
- return $etag;
-
- }
-
- /**
- * Deletes the calendar object
- *
- * @return void
- */
- public function delete() {
-
- $this->caldavBackend->deleteCalendarObject($this->calendarInfo['id'],$this->objectData['uri']);
-
- }
-
- /**
- * Returns the mime content-type
- *
- * @return string
- */
- public function getContentType() {
-
- return 'text/calendar; charset=utf-8';
-
- }
-
- /**
- * Returns an ETag for this object.
- *
- * The ETag is an arbitrary string, but MUST be surrounded by double-quotes.
- *
- * @return string
- */
- public function getETag() {
-
- if (isset($this->objectData['etag'])) {
- return $this->objectData['etag'];
- } else {
- return '"' . md5($this->get()). '"';
- }
-
- }
-
- /**
- * Returns the last modification date as a unix timestamp
- *
- * @return int
- */
- public function getLastModified() {
-
- return $this->objectData['lastmodified'];
-
- }
-
- /**
- * Returns the size of this object in bytes
- *
- * @return int
- */
- public function getSize() {
-
- if (array_key_exists('size',$this->objectData)) {
- return $this->objectData['size'];
- } else {
- return strlen($this->get());
- }
-
- }
-
- /**
- * Returns the owner principal
- *
- * This must be a url to a principal, or null if there's no owner
- *
- * @return string|null
- */
- public function getOwner() {
-
- return $this->calendarInfo['principaluri'];
-
- }
-
- /**
- * Returns a group principal
- *
- * This must be a url to a principal, or null if there's no owner
- *
- * @return string|null
- */
- public function getGroup() {
-
- return null;
-
- }
-
- /**
- * Returns a list of ACE's for this node.
- *
- * Each ACE has the following properties:
- * * 'privilege', a string such as {DAV:}read or {DAV:}write. These are
- * currently the only supported privileges
- * * 'principal', a url to the principal who owns the node
- * * 'protected' (optional), indicating that this ACE is not allowed to
- * be updated.
- *
- * @return array
- */
- public function getACL() {
-
- // An alternative acl may be specified in the object data.
- if (isset($this->objectData['acl'])) {
- return $this->objectData['acl'];
- }
-
- // The default ACL
- return array(
- array(
- 'privilege' => '{DAV:}read',
- 'principal' => $this->calendarInfo['principaluri'],
- 'protected' => true,
- ),
- array(
- 'privilege' => '{DAV:}write',
- 'principal' => $this->calendarInfo['principaluri'],
- 'protected' => true,
- ),
- array(
- 'privilege' => '{DAV:}read',
- 'principal' => $this->calendarInfo['principaluri'] . '/calendar-proxy-write',
- 'protected' => true,
- ),
- array(
- 'privilege' => '{DAV:}write',
- 'principal' => $this->calendarInfo['principaluri'] . '/calendar-proxy-write',
- 'protected' => true,
- ),
- array(
- 'privilege' => '{DAV:}read',
- 'principal' => $this->calendarInfo['principaluri'] . '/calendar-proxy-read',
- 'protected' => true,
- ),
-
- );
-
- }
-
- /**
- * Updates the ACL
- *
- * This method will receive a list of new ACE's.
- *
- * @param array $acl
- * @return void
- */
- public function setACL(array $acl) {
-
- throw new Sabre_DAV_Exception_MethodNotAllowed('Changing ACL is not yet supported');
-
- }
-
- /**
- * Returns the list of supported privileges for this node.
- *
- * The returned data structure is a list of nested privileges.
- * See Sabre_DAVACL_Plugin::getDefaultSupportedPrivilegeSet for a simple
- * standard structure.
- *
- * If null is returned from this method, the default privilege set is used,
- * which is fine for most common usecases.
- *
- * @return array|null
- */
- public function getSupportedPrivilegeSet() {
-
- return null;
-
- }
-
-}
-
diff --git a/3rdparty/Sabre/CalDAV/CalendarQueryParser.php b/3rdparty/Sabre/CalDAV/CalendarQueryParser.php
deleted file mode 100644
index b95095f96fc..00000000000
--- a/3rdparty/Sabre/CalDAV/CalendarQueryParser.php
+++ /dev/null
@@ -1,298 +0,0 @@
-<?php
-
-use Sabre\VObject;
-
-/**
- * Parses the calendar-query report request body.
- *
- * Whoever designed this format, and the CalDAV equivalent even more so,
- * has no feel for design.
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CalDAV_CalendarQueryParser {
-
- /**
- * List of requested properties the client wanted
- *
- * @var array
- */
- public $requestedProperties;
-
- /**
- * List of property/component filters.
- *
- * @var array
- */
- public $filters;
-
- /**
- * This property will contain null if CALDAV:expand was not specified,
- * otherwise it will contain an array with 2 elements (start, end). Each
- * contain a DateTime object.
- *
- * If expand is specified, recurring calendar objects are to be expanded
- * into their individual components, and only the components that fall
- * within the specified time-range are to be returned.
- *
- * For more details, see rfc4791, section 9.6.5.
- *
- * @var null|array
- */
- public $expand;
-
- /**
- * DOM Document
- *
- * @var DOMDocument
- */
- protected $dom;
-
- /**
- * DOM XPath object
- *
- * @var DOMXPath
- */
- protected $xpath;
-
- /**
- * Creates the parser
- *
- * @param DOMDocument $dom
- */
- public function __construct(DOMDocument $dom) {
-
- $this->dom = $dom;
-
- $this->xpath = new DOMXPath($dom);
- $this->xpath->registerNameSpace('cal',Sabre_CalDAV_Plugin::NS_CALDAV);
- $this->xpath->registerNameSpace('dav','DAV:');
-
- }
-
- /**
- * Parses the request.
- *
- * @return void
- */
- public function parse() {
-
- $filterNode = null;
-
- $filter = $this->xpath->query('/cal:calendar-query/cal:filter');
- if ($filter->length !== 1) {
- throw new Sabre_DAV_Exception_BadRequest('Only one filter element is allowed');
- }
-
- $compFilters = $this->parseCompFilters($filter->item(0));
- if (count($compFilters)!==1) {
- throw new Sabre_DAV_Exception_BadRequest('There must be exactly 1 top-level comp-filter.');
- }
-
- $this->filters = $compFilters[0];
- $this->requestedProperties = array_keys(Sabre_DAV_XMLUtil::parseProperties($this->dom->firstChild));
-
- $expand = $this->xpath->query('/cal:calendar-query/dav:prop/cal:calendar-data/cal:expand');
- if ($expand->length>0) {
- $this->expand = $this->parseExpand($expand->item(0));
- }
-
-
- }
-
- /**
- * Parses all the 'comp-filter' elements from a node
- *
- * @param DOMElement $parentNode
- * @return array
- */
- protected function parseCompFilters(DOMElement $parentNode) {
-
- $compFilterNodes = $this->xpath->query('cal:comp-filter', $parentNode);
- $result = array();
-
- for($ii=0; $ii < $compFilterNodes->length; $ii++) {
-
- $compFilterNode = $compFilterNodes->item($ii);
-
- $compFilter = array();
- $compFilter['name'] = $compFilterNode->getAttribute('name');
- $compFilter['is-not-defined'] = $this->xpath->query('cal:is-not-defined', $compFilterNode)->length>0;
- $compFilter['comp-filters'] = $this->parseCompFilters($compFilterNode);
- $compFilter['prop-filters'] = $this->parsePropFilters($compFilterNode);
- $compFilter['time-range'] = $this->parseTimeRange($compFilterNode);
-
- if ($compFilter['time-range'] && !in_array($compFilter['name'],array(
- 'VEVENT',
- 'VTODO',
- 'VJOURNAL',
- 'VFREEBUSY',
- 'VALARM',
- ))) {
- throw new Sabre_DAV_Exception_BadRequest('The time-range filter is not defined for the ' . $compFilter['name'] . ' component');
- };
-
- $result[] = $compFilter;
-
- }
-
- return $result;
-
- }
-
- /**
- * Parses all the prop-filter elements from a node
- *
- * @param DOMElement $parentNode
- * @return array
- */
- protected function parsePropFilters(DOMElement $parentNode) {
-
- $propFilterNodes = $this->xpath->query('cal:prop-filter', $parentNode);
- $result = array();
-
- for ($ii=0; $ii < $propFilterNodes->length; $ii++) {
-
- $propFilterNode = $propFilterNodes->item($ii);
- $propFilter = array();
- $propFilter['name'] = $propFilterNode->getAttribute('name');
- $propFilter['is-not-defined'] = $this->xpath->query('cal:is-not-defined', $propFilterNode)->length>0;
- $propFilter['param-filters'] = $this->parseParamFilters($propFilterNode);
- $propFilter['text-match'] = $this->parseTextMatch($propFilterNode);
- $propFilter['time-range'] = $this->parseTimeRange($propFilterNode);
-
- $result[] = $propFilter;
-
- }
-
- return $result;
-
- }
-
- /**
- * Parses the param-filter element
- *
- * @param DOMElement $parentNode
- * @return array
- */
- protected function parseParamFilters(DOMElement $parentNode) {
-
- $paramFilterNodes = $this->xpath->query('cal:param-filter', $parentNode);
- $result = array();
-
- for($ii=0;$ii<$paramFilterNodes->length;$ii++) {
-
- $paramFilterNode = $paramFilterNodes->item($ii);
- $paramFilter = array();
- $paramFilter['name'] = $paramFilterNode->getAttribute('name');
- $paramFilter['is-not-defined'] = $this->xpath->query('cal:is-not-defined', $paramFilterNode)->length>0;
- $paramFilter['text-match'] = $this->parseTextMatch($paramFilterNode);
-
- $result[] = $paramFilter;
-
- }
-
- return $result;
-
- }
-
- /**
- * Parses the text-match element
- *
- * @param DOMElement $parentNode
- * @return array|null
- */
- protected function parseTextMatch(DOMElement $parentNode) {
-
- $textMatchNodes = $this->xpath->query('cal:text-match', $parentNode);
-
- if ($textMatchNodes->length === 0)
- return null;
-
- $textMatchNode = $textMatchNodes->item(0);
- $negateCondition = $textMatchNode->getAttribute('negate-condition');
- $negateCondition = $negateCondition==='yes';
- $collation = $textMatchNode->getAttribute('collation');
- if (!$collation) $collation = 'i;ascii-casemap';
-
- return array(
- 'negate-condition' => $negateCondition,
- 'collation' => $collation,
- 'value' => $textMatchNode->nodeValue
- );
-
- }
-
- /**
- * Parses the time-range element
- *
- * @param DOMElement $parentNode
- * @return array|null
- */
- protected function parseTimeRange(DOMElement $parentNode) {
-
- $timeRangeNodes = $this->xpath->query('cal:time-range', $parentNode);
- if ($timeRangeNodes->length === 0) {
- return null;
- }
-
- $timeRangeNode = $timeRangeNodes->item(0);
-
- if ($start = $timeRangeNode->getAttribute('start')) {
- $start = VObject\DateTimeParser::parseDateTime($start);
- } else {
- $start = null;
- }
- if ($end = $timeRangeNode->getAttribute('end')) {
- $end = VObject\DateTimeParser::parseDateTime($end);
- } else {
- $end = null;
- }
-
- if (!is_null($start) && !is_null($end) && $end <= $start) {
- throw new Sabre_DAV_Exception_BadRequest('The end-date must be larger than the start-date in the time-range filter');
- }
-
- return array(
- 'start' => $start,
- 'end' => $end,
- );
-
- }
-
- /**
- * Parses the CALDAV:expand element
- *
- * @param DOMElement $parentNode
- * @return void
- */
- protected function parseExpand(DOMElement $parentNode) {
-
- $start = $parentNode->getAttribute('start');
- if(!$start) {
- throw new Sabre_DAV_Exception_BadRequest('The "start" attribute is required for the CALDAV:expand element');
- }
- $start = VObject\DateTimeParser::parseDateTime($start);
-
- $end = $parentNode->getAttribute('end');
- if(!$end) {
- throw new Sabre_DAV_Exception_BadRequest('The "end" attribute is required for the CALDAV:expand element');
- }
- $end = VObject\DateTimeParser::parseDateTime($end);
-
- if ($end <= $start) {
- throw new Sabre_DAV_Exception_BadRequest('The end-date must be larger than the start-date in the expand element.');
- }
-
- return array(
- 'start' => $start,
- 'end' => $end,
- );
-
- }
-
-}
diff --git a/3rdparty/Sabre/CalDAV/CalendarQueryValidator.php b/3rdparty/Sabre/CalDAV/CalendarQueryValidator.php
deleted file mode 100644
index 53e86fc509f..00000000000
--- a/3rdparty/Sabre/CalDAV/CalendarQueryValidator.php
+++ /dev/null
@@ -1,372 +0,0 @@
-<?php
-
-use Sabre\VObject;
-
-/**
- * CalendarQuery Validator
- *
- * This class is responsible for checking if an iCalendar object matches a set
- * of filters. The main function to do this is 'validate'.
- *
- * This is used to determine which icalendar objects should be returned for a
- * calendar-query REPORT request.
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CalDAV_CalendarQueryValidator {
-
- /**
- * Verify if a list of filters applies to the calendar data object
- *
- * The list of filters must be formatted as parsed by Sabre_CalDAV_CalendarQueryParser
- *
- * @param VObject\Component $vObject
- * @param array $filters
- * @return bool
- */
- public function validate(VObject\Component $vObject,array $filters) {
-
- // The top level object is always a component filter.
- // We'll parse it manually, as it's pretty simple.
- if ($vObject->name !== $filters['name']) {
- return false;
- }
-
- return
- $this->validateCompFilters($vObject, $filters['comp-filters']) &&
- $this->validatePropFilters($vObject, $filters['prop-filters']);
-
-
- }
-
- /**
- * This method checks the validity of comp-filters.
- *
- * A list of comp-filters needs to be specified. Also the parent of the
- * component we're checking should be specified, not the component to check
- * itself.
- *
- * @param VObject\Component $parent
- * @param array $filters
- * @return bool
- */
- protected function validateCompFilters(VObject\Component $parent, array $filters) {
-
- foreach($filters as $filter) {
-
- $isDefined = isset($parent->$filter['name']);
-
- if ($filter['is-not-defined']) {
-
- if ($isDefined) {
- return false;
- } else {
- continue;
- }
-
- }
- if (!$isDefined) {
- return false;
- }
-
- if ($filter['time-range']) {
- foreach($parent->$filter['name'] as $subComponent) {
- if ($this->validateTimeRange($subComponent, $filter['time-range']['start'], $filter['time-range']['end'])) {
- continue 2;
- }
- }
- return false;
- }
-
- if (!$filter['comp-filters'] && !$filter['prop-filters']) {
- continue;
- }
-
- // If there are sub-filters, we need to find at least one component
- // for which the subfilters hold true.
- foreach($parent->$filter['name'] as $subComponent) {
-
- if (
- $this->validateCompFilters($subComponent, $filter['comp-filters']) &&
- $this->validatePropFilters($subComponent, $filter['prop-filters'])) {
- // We had a match, so this comp-filter succeeds
- continue 2;
- }
-
- }
-
- // If we got here it means there were sub-comp-filters or
- // sub-prop-filters and there was no match. This means this filter
- // needs to return false.
- return false;
-
- }
-
- // If we got here it means we got through all comp-filters alive so the
- // filters were all true.
- return true;
-
- }
-
- /**
- * This method checks the validity of prop-filters.
- *
- * A list of prop-filters needs to be specified. Also the parent of the
- * property we're checking should be specified, not the property to check
- * itself.
- *
- * @param VObject\Component $parent
- * @param array $filters
- * @return bool
- */
- protected function validatePropFilters(VObject\Component $parent, array $filters) {
-
- foreach($filters as $filter) {
-
- $isDefined = isset($parent->$filter['name']);
-
- if ($filter['is-not-defined']) {
-
- if ($isDefined) {
- return false;
- } else {
- continue;
- }
-
- }
- if (!$isDefined) {
- return false;
- }
-
- if ($filter['time-range']) {
- foreach($parent->$filter['name'] as $subComponent) {
- if ($this->validateTimeRange($subComponent, $filter['time-range']['start'], $filter['time-range']['end'])) {
- continue 2;
- }
- }
- return false;
- }
-
- if (!$filter['param-filters'] && !$filter['text-match']) {
- continue;
- }
-
- // If there are sub-filters, we need to find at least one property
- // for which the subfilters hold true.
- foreach($parent->$filter['name'] as $subComponent) {
-
- if(
- $this->validateParamFilters($subComponent, $filter['param-filters']) &&
- (!$filter['text-match'] || $this->validateTextMatch($subComponent, $filter['text-match']))
- ) {
- // We had a match, so this prop-filter succeeds
- continue 2;
- }
-
- }
-
- // If we got here it means there were sub-param-filters or
- // text-match filters and there was no match. This means the
- // filter needs to return false.
- return false;
-
- }
-
- // If we got here it means we got through all prop-filters alive so the
- // filters were all true.
- return true;
-
- }
-
- /**
- * This method checks the validity of param-filters.
- *
- * A list of param-filters needs to be specified. Also the parent of the
- * parameter we're checking should be specified, not the parameter to check
- * itself.
- *
- * @param VObject\Property $parent
- * @param array $filters
- * @return bool
- */
- protected function validateParamFilters(VObject\Property $parent, array $filters) {
-
- foreach($filters as $filter) {
-
- $isDefined = isset($parent[$filter['name']]);
-
- if ($filter['is-not-defined']) {
-
- if ($isDefined) {
- return false;
- } else {
- continue;
- }
-
- }
- if (!$isDefined) {
- return false;
- }
-
- if (!$filter['text-match']) {
- continue;
- }
-
- // If there are sub-filters, we need to find at least one parameter
- // for which the subfilters hold true.
- foreach($parent[$filter['name']] as $subParam) {
-
- if($this->validateTextMatch($subParam,$filter['text-match'])) {
- // We had a match, so this param-filter succeeds
- continue 2;
- }
-
- }
-
- // If we got here it means there was a text-match filter and there
- // were no matches. This means the filter needs to return false.
- return false;
-
- }
-
- // If we got here it means we got through all param-filters alive so the
- // filters were all true.
- return true;
-
- }
-
- /**
- * This method checks the validity of a text-match.
- *
- * A single text-match should be specified as well as the specific property
- * or parameter we need to validate.
- *
- * @param VObject\Node $parent
- * @param array $textMatch
- * @return bool
- */
- protected function validateTextMatch(VObject\Node $parent, array $textMatch) {
-
- $value = (string)$parent;
-
- $isMatching = Sabre_DAV_StringUtil::textMatch($value, $textMatch['value'], $textMatch['collation']);
-
- return ($textMatch['negate-condition'] xor $isMatching);
-
- }
-
- /**
- * Validates if a component matches the given time range.
- *
- * This is all based on the rules specified in rfc4791, which are quite
- * complex.
- *
- * @param VObject\Node $component
- * @param DateTime $start
- * @param DateTime $end
- * @return bool
- */
- protected function validateTimeRange(VObject\Node $component, $start, $end) {
-
- if (is_null($start)) {
- $start = new DateTime('1900-01-01');
- }
- if (is_null($end)) {
- $end = new DateTime('3000-01-01');
- }
-
- switch($component->name) {
-
- case 'VEVENT' :
- case 'VTODO' :
- case 'VJOURNAL' :
-
- return $component->isInTimeRange($start, $end);
-
- case 'VALARM' :
-
- // If the valarm is wrapped in a recurring event, we need to
- // expand the recursions, and validate each.
- //
- // Our datamodel doesn't easily allow us to do this straight
- // 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 VObject\RecurrenceIterator($component->parent->parent, (string)$component->parent->UID);
- while($it->valid()) {
- $expandedEvent = $it->getEventObject();
-
- // We need to check from these expanded alarms, which
- // one is the first to trigger. Based on this, we can
- // determine if we can 'give up' expanding events.
- $firstAlarm = null;
- if ($expandedEvent->VALARM !== null) {
- foreach($expandedEvent->VALARM as $expandedAlarm) {
-
- $effectiveTrigger = $expandedAlarm->getEffectiveTriggerTime();
- 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;
- }
- $it->next();
- }
- return false;
- } else {
- return $component->isInTimeRange($start, $end);
- }
-
- case 'VFREEBUSY' :
- throw new Sabre_DAV_Exception_NotImplemented('time-range filters are currently not supported on ' . $component->name . ' components');
-
- case 'COMPLETED' :
- case 'CREATED' :
- case 'DTEND' :
- case 'DTSTAMP' :
- case 'DTSTART' :
- case 'DUE' :
- case 'LAST-MODIFIED' :
- return ($start <= $component->getDateTime() && $end >= $component->getDateTime());
-
-
-
- default :
- throw new Sabre_DAV_Exception_BadRequest('You cannot create a time-range filter on a ' . $component->name . ' component');
-
- }
-
- }
-
-}
diff --git a/3rdparty/Sabre/CalDAV/CalendarRootNode.php b/3rdparty/Sabre/CalDAV/CalendarRootNode.php
deleted file mode 100644
index eb62eea75a6..00000000000
--- a/3rdparty/Sabre/CalDAV/CalendarRootNode.php
+++ /dev/null
@@ -1,76 +0,0 @@
-<?php
-
-/**
- * Calendars collection
- *
- * This object is responsible for generating a list of calendar-homes for each
- * user.
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CalDAV_CalendarRootNode extends Sabre_DAVACL_AbstractPrincipalCollection {
-
- /**
- * CalDAV backend
- *
- * @var Sabre_CalDAV_Backend_BackendInterface
- */
- protected $caldavBackend;
-
- /**
- * Constructor
- *
- * This constructor needs both an authentication and a caldav backend.
- *
- * By default this class will show a list of calendar collections for
- * principals in the 'principals' collection. If your main principals are
- * actually located in a different path, use the $principalPrefix argument
- * to override this.
- *
- *
- * @param Sabre_DAVACL_IPrincipalBackend $principalBackend
- * @param Sabre_CalDAV_Backend_BackendInterface $caldavBackend
- * @param string $principalPrefix
- */
- public function __construct(Sabre_DAVACL_IPrincipalBackend $principalBackend,Sabre_CalDAV_Backend_BackendInterface $caldavBackend, $principalPrefix = 'principals') {
-
- parent::__construct($principalBackend, $principalPrefix);
- $this->caldavBackend = $caldavBackend;
-
- }
-
- /**
- * Returns the nodename
- *
- * We're overriding this, because the default will be the 'principalPrefix',
- * and we want it to be Sabre_CalDAV_Plugin::CALENDAR_ROOT
- *
- * @return string
- */
- public function getName() {
-
- return Sabre_CalDAV_Plugin::CALENDAR_ROOT;
-
- }
-
- /**
- * This method returns a node for a principal.
- *
- * The passed array contains principal information, and is guaranteed to
- * at least contain a uri item. Other properties may or may not be
- * supplied by the authentication backend.
- *
- * @param array $principal
- * @return Sabre_DAV_INode
- */
- public function getChildForPrincipal(array $principal) {
-
- return new Sabre_CalDAV_UserCalendars($this->principalBackend, $this->caldavBackend, $principal['uri']);
-
- }
-
-}
diff --git a/3rdparty/Sabre/CalDAV/Exception/InvalidComponentType.php b/3rdparty/Sabre/CalDAV/Exception/InvalidComponentType.php
deleted file mode 100644
index 4ac617d22f0..00000000000
--- a/3rdparty/Sabre/CalDAV/Exception/InvalidComponentType.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-
-/**
- * Sabre_CalDAV_Exception_InvalidComponentType
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CalDAV_Exception_InvalidComponentType extends Sabre_DAV_Exception_Forbidden {
-
- /**
- * Adds in extra information in the xml response.
- *
- * This method adds the {CALDAV:}supported-calendar-component as defined in rfc4791
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $errorNode
- * @return void
- */
- public function serialize(Sabre_DAV_Server $server,DOMElement $errorNode) {
-
- $doc = $errorNode->ownerDocument;
-
- $np = $doc->createElementNS(Sabre_CalDAV_Plugin::NS_CALDAV,'cal:supported-calendar-component');
- $errorNode->appendChild($np);
-
- }
-
-} \ No newline at end of file
diff --git a/3rdparty/Sabre/CalDAV/ICSExportPlugin.php b/3rdparty/Sabre/CalDAV/ICSExportPlugin.php
deleted file mode 100644
index d3e4e7b7201..00000000000
--- a/3rdparty/Sabre/CalDAV/ICSExportPlugin.php
+++ /dev/null
@@ -1,141 +0,0 @@
-<?php
-
-use Sabre\VObject;
-
-/**
- * ICS Exporter
- *
- * This plugin adds the ability to export entire calendars as .ics files.
- * This is useful for clients that don't support CalDAV yet. They often do
- * support ics files.
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CalDAV_ICSExportPlugin extends Sabre_DAV_ServerPlugin {
-
- /**
- * Reference to Server class
- *
- * @var Sabre_DAV_Server
- */
- private $server;
-
- /**
- * Initializes the plugin and registers event handlers
- *
- * @param Sabre_DAV_Server $server
- * @return void
- */
- public function initialize(Sabre_DAV_Server $server) {
-
- $this->server = $server;
- $this->server->subscribeEvent('beforeMethod',array($this,'beforeMethod'), 90);
-
- }
-
- /**
- * 'beforeMethod' event handles. This event handles intercepts GET requests ending
- * with ?export
- *
- * @param string $method
- * @param string $uri
- * @return bool
- */
- public function beforeMethod($method, $uri) {
-
- if ($method!='GET') return;
- if ($this->server->httpRequest->getQueryString()!='export') return;
-
- // splitting uri
- list($uri) = explode('?',$uri,2);
-
- $node = $this->server->tree->getNodeForPath($uri);
-
- if (!($node instanceof Sabre_CalDAV_Calendar)) return;
-
- // Checking ACL, if available.
- if ($aclPlugin = $this->server->getPlugin('acl')) {
- $aclPlugin->checkPrivileges($uri, '{DAV:}read');
- }
-
- $this->server->httpResponse->setHeader('Content-Type','text/calendar');
- $this->server->httpResponse->sendStatus(200);
-
- $nodes = $this->server->getPropertiesForPath($uri, array(
- '{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}calendar-data',
- ),1);
-
- $this->server->httpResponse->sendBody($this->generateICS($nodes));
-
- // Returning false to break the event chain
- return false;
-
- }
-
- /**
- * Merges all calendar objects, and builds one big ics export
- *
- * @param array $nodes
- * @return string
- */
- public function generateICS(array $nodes) {
-
- $calendar = new VObject\Component('vcalendar');
- $calendar->version = '2.0';
- if (Sabre_DAV_Server::$exposeVersion) {
- $calendar->prodid = '-//SabreDAV//SabreDAV ' . Sabre_DAV_Version::VERSION . '//EN';
- } else {
- $calendar->prodid = '-//SabreDAV//SabreDAV//EN';
- }
- $calendar->calscale = 'GREGORIAN';
-
- $collectedTimezones = array();
-
- $timezones = array();
- $objects = array();
-
- foreach($nodes as $node) {
-
- if (!isset($node[200]['{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}calendar-data'])) {
- continue;
- }
- $nodeData = $node[200]['{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}calendar-data'];
-
- $nodeComp = VObject\Reader::read($nodeData);
-
- foreach($nodeComp->children() as $child) {
-
- switch($child->name) {
- case 'VEVENT' :
- case 'VTODO' :
- case 'VJOURNAL' :
- $objects[] = $child;
- break;
-
- // VTIMEZONE is special, because we need to filter out the duplicates
- case 'VTIMEZONE' :
- // Naively just checking tzid.
- if (in_array((string)$child->TZID, $collectedTimezones)) continue;
-
- $timezones[] = $child;
- $collectedTimezones[] = $child->TZID;
- break;
-
- }
-
- }
-
- }
-
- foreach($timezones as $tz) $calendar->add($tz);
- foreach($objects as $obj) $calendar->add($obj);
-
- return $calendar->serialize();
-
- }
-
-}
diff --git a/3rdparty/Sabre/CalDAV/ICalendar.php b/3rdparty/Sabre/CalDAV/ICalendar.php
deleted file mode 100644
index 40aa9f9579c..00000000000
--- a/3rdparty/Sabre/CalDAV/ICalendar.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-
-/**
- * Calendar interface
- *
- * Implement this interface to allow a node to be recognized as an calendar.
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-interface Sabre_CalDAV_ICalendar extends Sabre_DAV_ICollection {
-
- /**
- * Performs a calendar-query on the contents of this calendar.
- *
- * The calendar-query is defined in RFC4791 : CalDAV. Using the
- * calendar-query it is possible for a client to request a specific set of
- * object, based on contents of iCalendar properties, date-ranges and
- * iCalendar component types (VTODO, VEVENT).
- *
- * This method should just return a list of (relative) urls that match this
- * query.
- *
- * The list of filters are specified as an array. The exact array is
- * documented by Sabre_CalDAV_CalendarQueryParser.
- *
- * @param array $filters
- * @return array
- */
- public function calendarQuery(array $filters);
-
-}
diff --git a/3rdparty/Sabre/CalDAV/ICalendarObject.php b/3rdparty/Sabre/CalDAV/ICalendarObject.php
deleted file mode 100644
index 280f982a310..00000000000
--- a/3rdparty/Sabre/CalDAV/ICalendarObject.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-
-/**
- * CalendarObject interface
-/**
- * Extend the ICalendarObject interface to allow your custom nodes to be picked up as
- * CalendarObjects.
- *
- * Calendar objects are resources such as Events, Todo's or Journals.
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-interface Sabre_CalDAV_ICalendarObject extends Sabre_DAV_IFile {
-
-}
-
diff --git a/3rdparty/Sabre/CalDAV/IShareableCalendar.php b/3rdparty/Sabre/CalDAV/IShareableCalendar.php
deleted file mode 100644
index 5b55788c014..00000000000
--- a/3rdparty/Sabre/CalDAV/IShareableCalendar.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-
-/**
- * This interface represents a Calendar that can be shared with other users.
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-interface Sabre_CalDAV_IShareableCalendar extends Sabre_CalDAV_ICalendar {
-
- /**
- * Updates the list of shares.
- *
- * The first array is a list of people that are to be added to the
- * calendar.
- *
- * Every element in the add array has the following properties:
- * * href - A url. Usually a mailto: address
- * * commonName - Usually a first and last name, or false
- * * summary - A description of the share, can also be false
- * * readOnly - A boolean value
- *
- * Every element in the remove array is just the address string.
- *
- * @param array $add
- * @param array $remove
- * @return void
- */
- function updateShares(array $add, array $remove);
-
- /**
- * Returns the list of people whom this calendar is shared with.
- *
- * Every element in this array should have the following properties:
- * * href - Often a mailto: address
- * * commonName - Optional, for example a first + last name
- * * status - See the Sabre_CalDAV_SharingPlugin::STATUS_ constants.
- * * readOnly - boolean
- * * summary - Optional, a description for the share
- *
- * @return array
- */
- function getShares();
-
-}
diff --git a/3rdparty/Sabre/CalDAV/ISharedCalendar.php b/3rdparty/Sabre/CalDAV/ISharedCalendar.php
deleted file mode 100644
index eb4d31fead5..00000000000
--- a/3rdparty/Sabre/CalDAV/ISharedCalendar.php
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-
-/**
- * This interface represents a Calendar that is shared by a different user.
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-interface Sabre_CalDAV_ISharedCalendar extends Sabre_CalDAV_ICalendar {
-
- /**
- * This method should return the url of the owners' copy of the shared
- * calendar.
- *
- * @return string
- */
- function getSharedUrl();
-
-}
diff --git a/3rdparty/Sabre/CalDAV/Notifications/Collection.php b/3rdparty/Sabre/CalDAV/Notifications/Collection.php
deleted file mode 100644
index 83b6c9301dc..00000000000
--- a/3rdparty/Sabre/CalDAV/Notifications/Collection.php
+++ /dev/null
@@ -1,169 +0,0 @@
-<?php
-
-/**
- * This node represents a list of notifications.
- *
- * It provides no additional functionality, but you must implement this
- * interface to allow the Notifications plugin to mark the collection
- * as a notifications collection.
- *
- * This collection should only return Sabre_CalDAV_Notifications_INode nodes as
- * its children.
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CalDAV_Notifications_Collection extends Sabre_DAV_Collection implements Sabre_CalDAV_Notifications_ICollection, Sabre_DAVACL_IACL {
-
- /**
- * The notification backend
- *
- * @var Sabre_CalDAV_Backend_NotificationSupport
- */
- protected $caldavBackend;
-
- /**
- * Principal uri
- *
- * @var string
- */
- protected $principalUri;
-
- /**
- * Constructor
- *
- * @param Sabre_CalDAV_Backend_NotificationSupport $caldavBackend
- * @param string $principalUri
- */
- public function __construct(Sabre_CalDAV_Backend_NotificationSupport $caldavBackend, $principalUri) {
-
- $this->caldavBackend = $caldavBackend;
- $this->principalUri = $principalUri;
-
- }
-
- /**
- * Returns all notifications for a principal
- *
- * @return array
- */
- public function getChildren() {
-
- $children = array();
- $notifications = $this->caldavBackend->getNotificationsForPrincipal($this->principalUri);
-
- foreach($notifications as $notification) {
-
- $children[] = new Sabre_CalDAV_Notifications_Node(
- $this->caldavBackend,
- $this->principalUri,
- $notification
- );
- }
-
- return $children;
-
- }
-
- /**
- * Returns the name of this object
- *
- * @return string
- */
- public function getName() {
-
- return 'notifications';
-
- }
-
- /**
- * Returns the owner principal
- *
- * This must be a url to a principal, or null if there's no owner
- *
- * @return string|null
- */
- public function getOwner() {
-
- return $this->principalUri;
-
- }
-
- /**
- * Returns a group principal
- *
- * This must be a url to a principal, or null if there's no owner
- *
- * @return string|null
- */
- public function getGroup() {
-
- return null;
-
- }
-
- /**
- * Returns a list of ACE's for this node.
- *
- * Each ACE has the following properties:
- * * 'privilege', a string such as {DAV:}read or {DAV:}write. These are
- * currently the only supported privileges
- * * 'principal', a url to the principal who owns the node
- * * 'protected' (optional), indicating that this ACE is not allowed to
- * be updated.
- *
- * @return array
- */
- public function getACL() {
-
- return array(
- array(
- 'principal' => $this->getOwner(),
- 'privilege' => '{DAV:}read',
- 'protected' => true,
- ),
- array(
- 'principal' => $this->getOwner(),
- 'privilege' => '{DAV:}write',
- 'protected' => true,
- )
- );
-
- }
-
- /**
- * Updates the ACL
- *
- * This method will receive a list of new ACE's as an array argument.
- *
- * @param array $acl
- * @return void
- */
- public function setACL(array $acl) {
-
- throw new Sabre_DAV_Exception_NotImplemented('Updating ACLs is not implemented here');
-
- }
-
- /**
- * Returns the list of supported privileges for this node.
- *
- * The returned data structure is a list of nested privileges.
- * See Sabre_DAVACL_Plugin::getDefaultSupportedPrivilegeSet for a simple
- * standard structure.
- *
- * If null is returned from this method, the default privilege set is used,
- * which is fine for most common usecases.
- *
- * @return array|null
- */
- public function getSupportedPrivilegeSet() {
-
- return null;
-
- }
-
-}
diff --git a/3rdparty/Sabre/CalDAV/Notifications/ICollection.php b/3rdparty/Sabre/CalDAV/Notifications/ICollection.php
deleted file mode 100644
index eb873af3f92..00000000000
--- a/3rdparty/Sabre/CalDAV/Notifications/ICollection.php
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-
-/**
- * This node represents a list of notifications.
- *
- * It provides no additional functionality, but you must implement this
- * interface to allow the Notifications plugin to mark the collection
- * as a notifications collection.
- *
- * This collection should only return Sabre_CalDAV_Notifications_INode nodes as
- * its children.
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-interface Sabre_CalDAV_Notifications_ICollection extends Sabre_DAV_ICollection {
-
-
-}
diff --git a/3rdparty/Sabre/CalDAV/Notifications/INode.php b/3rdparty/Sabre/CalDAV/Notifications/INode.php
deleted file mode 100644
index 84721de5ab7..00000000000
--- a/3rdparty/Sabre/CalDAV/Notifications/INode.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-
-/**
- * This node represents a single notification.
- *
- * The signature is mostly identical to that of Sabre_DAV_IFile, but the get() method
- * MUST return an xml document that matches the requirements of the
- * 'caldav-notifications.txt' spec.
- *
- * For a complete example, check out the Notification class, which contains
- * some helper functions.
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-interface Sabre_CalDAV_Notifications_INode {
-
- /**
- * This method must return an xml element, using the
- * Sabre_CalDAV_Notifications_INotificationType classes.
- *
- * @return Sabre_DAVNotification_INotificationType
- */
- function getNotificationType();
-
- /**
- * Returns the etag for the notification.
- *
- * The etag must be surrounded by litteral double-quotes.
- *
- * @return string
- */
- function getETag();
-
-}
diff --git a/3rdparty/Sabre/CalDAV/Notifications/INotificationType.php b/3rdparty/Sabre/CalDAV/Notifications/INotificationType.php
deleted file mode 100644
index 02a65a01fa3..00000000000
--- a/3rdparty/Sabre/CalDAV/Notifications/INotificationType.php
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php
-
-/**
- * This interface reflects a single notification type.
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-interface Sabre_CalDAV_Notifications_INotificationType extends Sabre_DAV_PropertyInterface {
-
- /**
- * This method serializes the entire notification, as it is used in the
- * response body.
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $node
- * @return void
- */
- function serializeBody(Sabre_DAV_Server $server, \DOMElement $node);
-
- /**
- * Returns a unique id for this notification
- *
- * This is just the base url. This should generally be some kind of unique
- * id.
- *
- * @return string
- */
- function getId();
-
- /**
- * Returns the ETag for this notification.
- *
- * The ETag must be surrounded by literal double-quotes.
- *
- * @return string
- */
- function getETag();
-
-}
diff --git a/3rdparty/Sabre/CalDAV/Notifications/Node.php b/3rdparty/Sabre/CalDAV/Notifications/Node.php
deleted file mode 100644
index 8021a75debf..00000000000
--- a/3rdparty/Sabre/CalDAV/Notifications/Node.php
+++ /dev/null
@@ -1,188 +0,0 @@
-<?php
-
-/**
- * This node represents a single notification.
- *
- * The signature is mostly identical to that of Sabre_DAV_IFile, but the get() method
- * MUST return an xml document that matches the requirements of the
- * 'caldav-notifications.txt' spec.
-
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CalDAV_Notifications_Node extends Sabre_DAV_File implements Sabre_CalDAV_Notifications_INode, Sabre_DAVACL_IACL {
-
- /**
- * The notification backend
- *
- * @var Sabre_CalDAV_Backend_NotificationSupport
- */
- protected $caldavBackend;
-
- /**
- * The actual notification
- *
- * @var Sabre_CalDAV_Notifications_INotificationType
- */
- protected $notification;
-
- /**
- * Owner principal of the notification
- *
- * @var string
- */
- protected $principalUri;
-
- /**
- * Constructor
- *
- * @param Sabre_CalDAV_Backend_NotificationSupport $caldavBackend
- * @param string $principalUri
- * @param Sabre_CalDAV_Notifications_INotificationType $notification
- */
- public function __construct(Sabre_CalDAV_Backend_NotificationSupport $caldavBackend, $principalUri, Sabre_CalDAV_Notifications_INotificationType $notification) {
-
- $this->caldavBackend = $caldavBackend;
- $this->principalUri = $principalUri;
- $this->notification = $notification;
-
- }
-
- /**
- * Returns the path name for this notification
- *
- * @return id
- */
- public function getName() {
-
- return $this->notification->getId() . '.xml';
-
- }
-
- /**
- * Returns the etag for the notification.
- *
- * The etag must be surrounded by litteral double-quotes.
- *
- * @return string
- */
- public function getETag() {
-
- return $this->notification->getETag();
-
- }
-
- /**
- * This method must return an xml element, using the
- * Sabre_CalDAV_Notifications_INotificationType classes.
- *
- * @return Sabre_DAVNotification_INotificationType
- */
- public function getNotificationType() {
-
- return $this->notification;
-
- }
-
- /**
- * Deletes this notification
- *
- * @return void
- */
- public function delete() {
-
- $this->caldavBackend->deleteNotification($this->getOwner(), $this->notification);
-
- }
-
- /**
- * Returns the owner principal
- *
- * This must be a url to a principal, or null if there's no owner
- *
- * @return string|null
- */
- public function getOwner() {
-
- return $this->principalUri;
-
- }
-
- /**
- * Returns a group principal
- *
- * This must be a url to a principal, or null if there's no owner
- *
- * @return string|null
- */
- public function getGroup() {
-
- return null;
-
- }
-
- /**
- * Returns a list of ACE's for this node.
- *
- * Each ACE has the following properties:
- * * 'privilege', a string such as {DAV:}read or {DAV:}write. These are
- * currently the only supported privileges
- * * 'principal', a url to the principal who owns the node
- * * 'protected' (optional), indicating that this ACE is not allowed to
- * be updated.
- *
- * @return array
- */
- public function getACL() {
-
- return array(
- array(
- 'principal' => $this->getOwner(),
- 'privilege' => '{DAV:}read',
- 'protected' => true,
- ),
- array(
- 'principal' => $this->getOwner(),
- 'privilege' => '{DAV:}write',
- 'protected' => true,
- )
- );
-
- }
-
- /**
- * Updates the ACL
- *
- * This method will receive a list of new ACE's as an array argument.
- *
- * @param array $acl
- * @return void
- */
- public function setACL(array $acl) {
-
- throw new Sabre_DAV_Exception_NotImplemented('Updating ACLs is not implemented here');
-
- }
-
- /**
- * Returns the list of supported privileges for this node.
- *
- * The returned data structure is a list of nested privileges.
- * See Sabre_DAVACL_Plugin::getDefaultSupportedPrivilegeSet for a simple
- * standard structure.
- *
- * If null is returned from this method, the default privilege set is used,
- * which is fine for most common usecases.
- *
- * @return array|null
- */
- public function getSupportedPrivilegeSet() {
-
- return null;
-
- }
-
-}
diff --git a/3rdparty/Sabre/CalDAV/Notifications/Notification/Invite.php b/3rdparty/Sabre/CalDAV/Notifications/Notification/Invite.php
deleted file mode 100644
index a6b36203f34..00000000000
--- a/3rdparty/Sabre/CalDAV/Notifications/Notification/Invite.php
+++ /dev/null
@@ -1,276 +0,0 @@
-<?php
-
-use Sabre_CalDAV_SharingPlugin as SharingPlugin;
-
-/**
- * This class represents the cs:invite-notification notification element.
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CalDAV_Notifications_Notification_Invite extends Sabre_DAV_Property implements Sabre_CalDAV_Notifications_INotificationType {
-
- /**
- * A unique id for the message
- *
- * @var string
- */
- protected $id;
-
- /**
- * Timestamp of the notification
- *
- * @var DateTime
- */
- protected $dtStamp;
-
- /**
- * A url to the recipient of the notification. This can be an email
- * address (mailto:), or a principal url.
- *
- * @var string
- */
- protected $href;
-
- /**
- * The type of message, see the SharingPlugin::STATUS_* constants.
- *
- * @var int
- */
- protected $type;
-
- /**
- * True if access to a calendar is read-only.
- *
- * @var bool
- */
- protected $readOnly;
-
- /**
- * A url to the shared calendar.
- *
- * @var string
- */
- protected $hostUrl;
-
- /**
- * Url to the sharer of the calendar
- *
- * @var string
- */
- protected $organizer;
-
- /**
- * The name of the sharer.
- *
- * @var string
- */
- protected $commonName;
-
- /**
- * A description of the share request
- *
- * @var string
- */
- protected $summary;
-
- /**
- * The Etag for the notification
- *
- * @var string
- */
- protected $etag;
-
- /**
- * The list of supported components
- *
- * @var Sabre_CalDAV_Property_SupportedCalendarComponentSet
- */
- protected $supportedComponents;
-
- /**
- * Creates the Invite notification.
- *
- * This constructor receives an array with the following elements:
- *
- * * id - A unique id
- * * etag - The etag
- * * dtStamp - A DateTime object with a timestamp for the notification.
- * * type - The type of notification, see SharingPlugin::STATUS_*
- * constants for details.
- * * readOnly - This must be set to true, if this is an invite for
- * read-only access to a calendar.
- * * hostUrl - A url to the shared calendar.
- * * organizer - Url to the sharer principal.
- * * commonName - The real name of the sharer (optional).
- * * summary - Description of the share, can be the same as the
- * calendar, but may also be modified (optional).
- * * supportedComponents - An instance of
- * Sabre_CalDAV_Property_SupportedCalendarComponentSet.
- * This allows the client to determine which components
- * will be supported in the shared calendar. This is
- * also optional.
- *
- * @param array $values All the options
- */
- public function __construct(array $values) {
-
- $required = array(
- 'id',
- 'etag',
- 'href',
- 'dtStamp',
- 'type',
- 'readOnly',
- 'hostUrl',
- 'organizer',
- );
- foreach($required as $item) {
- if (!isset($values[$item])) {
- throw new InvalidArgumentException($item . ' is a required constructor option');
- }
- }
-
- foreach($values as $key=>$value) {
- if (!property_exists($this, $key)) {
- throw new InvalidArgumentException('Unknown option: ' . $key);
- }
- $this->$key = $value;
- }
-
- }
-
- /**
- * Serializes the notification as a single property.
- *
- * You should usually just encode the single top-level element of the
- * notification.
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $node
- * @return void
- */
- public function serialize(Sabre_DAV_Server $server, \DOMElement $node) {
-
- $prop = $node->ownerDocument->createElement('cs:invite-notification');
- $node->appendChild($prop);
-
- }
-
- /**
- * This method serializes the entire notification, as it is used in the
- * response body.
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $node
- * @return void
- */
- public function serializeBody(Sabre_DAV_Server $server, \DOMElement $node) {
-
- $doc = $node->ownerDocument;
-
- $dt = $doc->createElement('cs:dtstamp');
- $this->dtStamp->setTimezone(new \DateTimezone('GMT'));
- $dt->appendChild($doc->createTextNode($this->dtStamp->format('Ymd\\THis\\Z')));
- $node->appendChild($dt);
-
- $prop = $doc->createElement('cs:invite-notification');
- $node->appendChild($prop);
-
- $uid = $doc->createElement('cs:uid');
- $uid->appendChild( $doc->createTextNode($this->id) );
- $prop->appendChild($uid);
-
- $href = $doc->createElement('d:href');
- $href->appendChild( $doc->createTextNode( $this->href ) );
- $prop->appendChild($href);
-
- $nodeName = null;
- switch($this->type) {
-
- case SharingPlugin::STATUS_ACCEPTED :
- $nodeName = 'cs:invite-accepted';
- break;
- case SharingPlugin::STATUS_DECLINED :
- $nodeName = 'cs:invite-declined';
- break;
- case SharingPlugin::STATUS_DELETED :
- $nodeName = 'cs:invite-deleted';
- break;
- case SharingPlugin::STATUS_NORESPONSE :
- $nodeName = 'cs:invite-noresponse';
- break;
-
- }
- $prop->appendChild(
- $doc->createElement($nodeName)
- );
- $hostHref = $doc->createElement('d:href', $server->getBaseUri() . $this->hostUrl);
- $hostUrl = $doc->createElement('cs:hosturl');
- $hostUrl->appendChild($hostHref);
- $prop->appendChild($hostUrl);
-
- $access = $doc->createElement('cs:access');
- if ($this->readOnly) {
- $access->appendChild($doc->createElement('cs:read'));
- } else {
- $access->appendChild($doc->createElement('cs:read-write'));
- }
- $prop->appendChild($access);
-
- $organizerHref = $doc->createElement('d:href', $server->getBaseUri() . $this->organizer);
- $organizerUrl = $doc->createElement('cs:organizer');
- if ($this->commonName) {
- $commonName = $doc->createElement('cs:common-name');
- $commonName->appendChild($doc->createTextNode($this->commonName));
- $organizerUrl->appendChild($commonName);
- }
- $organizerUrl->appendChild($organizerHref);
- $prop->appendChild($organizerUrl);
-
- if ($this->summary) {
- $summary = $doc->createElement('cs:summary');
- $summary->appendChild($doc->createTextNode($this->summary));
- $prop->appendChild($summary);
- }
- if ($this->supportedComponents) {
-
- $xcomp = $doc->createElement('cal:supported-calendar-component-set');
- $this->supportedComponents->serialize($server, $xcomp);
- $prop->appendChild($xcomp);
-
- }
-
- }
-
- /**
- * Returns a unique id for this notification
- *
- * This is just the base url. This should generally be some kind of unique
- * id.
- *
- * @return string
- */
- public function getId() {
-
- return $this->id;
-
- }
-
- /**
- * Returns the ETag for this notification.
- *
- * The ETag must be surrounded by literal double-quotes.
- *
- * @return string
- */
- public function getETag() {
-
- return $this->etag;
-
- }
-
-}
diff --git a/3rdparty/Sabre/CalDAV/Notifications/Notification/InviteReply.php b/3rdparty/Sabre/CalDAV/Notifications/Notification/InviteReply.php
deleted file mode 100644
index e935aa5aa11..00000000000
--- a/3rdparty/Sabre/CalDAV/Notifications/Notification/InviteReply.php
+++ /dev/null
@@ -1,216 +0,0 @@
-<?php
-
-use Sabre_CalDAV_SharingPlugin as SharingPlugin;
-
-/**
- * This class represents the cs:invite-reply notification element.
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CalDAV_Notifications_Notification_InviteReply extends Sabre_DAV_Property implements Sabre_CalDAV_Notifications_INotificationType {
-
- /**
- * A unique id for the message
- *
- * @var string
- */
- protected $id;
-
- /**
- * Timestamp of the notification
- *
- * @var DateTime
- */
- protected $dtStamp;
-
- /**
- * The unique id of the notification this was a reply to.
- *
- * @var string
- */
- protected $inReplyTo;
-
- /**
- * A url to the recipient of the original (!) notification.
- *
- * @var string
- */
- protected $href;
-
- /**
- * The type of message, see the SharingPlugin::STATUS_ constants.
- *
- * @var int
- */
- protected $type;
-
- /**
- * A url to the shared calendar.
- *
- * @var string
- */
- protected $hostUrl;
-
- /**
- * A description of the share request
- *
- * @var string
- */
- protected $summary;
-
- /**
- * Notification Etag
- *
- * @var string
- */
- protected $etag;
-
- /**
- * Creates the Invite Reply Notification.
- *
- * This constructor receives an array with the following elements:
- *
- * * id - A unique id
- * * etag - The etag
- * * dtStamp - A DateTime object with a timestamp for the notification.
- * * inReplyTo - This should refer to the 'id' of the notification
- * this is a reply to.
- * * type - The type of notification, see SharingPlugin::STATUS_*
- * constants for details.
- * * hostUrl - A url to the shared calendar.
- * * summary - Description of the share, can be the same as the
- * calendar, but may also be modified (optional).
- */
- public function __construct(array $values) {
-
- $required = array(
- 'id',
- 'etag',
- 'href',
- 'dtStamp',
- 'inReplyTo',
- 'type',
- 'hostUrl',
- );
- foreach($required as $item) {
- if (!isset($values[$item])) {
- throw new InvalidArgumentException($item . ' is a required constructor option');
- }
- }
-
- foreach($values as $key=>$value) {
- if (!property_exists($this, $key)) {
- throw new InvalidArgumentException('Unknown option: ' . $key);
- }
- $this->$key = $value;
- }
-
- }
-
- /**
- * Serializes the notification as a single property.
- *
- * You should usually just encode the single top-level element of the
- * notification.
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $node
- * @return void
- */
- public function serialize(Sabre_DAV_Server $server, \DOMElement $node) {
-
- $prop = $node->ownerDocument->createElement('cs:invite-reply');
- $node->appendChild($prop);
-
- }
-
- /**
- * This method serializes the entire notification, as it is used in the
- * response body.
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $node
- * @return void
- */
- public function serializeBody(Sabre_DAV_Server $server, \DOMElement $node) {
-
- $doc = $node->ownerDocument;
-
- $dt = $doc->createElement('cs:dtstamp');
- $this->dtStamp->setTimezone(new \DateTimezone('GMT'));
- $dt->appendChild($doc->createTextNode($this->dtStamp->format('Ymd\\THis\\Z')));
- $node->appendChild($dt);
-
- $prop = $doc->createElement('cs:invite-reply');
- $node->appendChild($prop);
-
- $uid = $doc->createElement('cs:uid');
- $uid->appendChild($doc->createTextNode($this->id));
- $prop->appendChild($uid);
-
- $inReplyTo = $doc->createElement('cs:in-reply-to');
- $inReplyTo->appendChild( $doc->createTextNode($this->inReplyTo) );
- $prop->appendChild($inReplyTo);
-
- $href = $doc->createElement('d:href');
- $href->appendChild( $doc->createTextNode($this->href) );
- $prop->appendChild($href);
-
- $nodeName = null;
- switch($this->type) {
-
- case SharingPlugin::STATUS_ACCEPTED :
- $nodeName = 'cs:invite-accepted';
- break;
- case SharingPlugin::STATUS_DECLINED :
- $nodeName = 'cs:invite-declined';
- break;
-
- }
- $prop->appendChild(
- $doc->createElement($nodeName)
- );
- $hostHref = $doc->createElement('d:href', $server->getBaseUri() . $this->hostUrl);
- $hostUrl = $doc->createElement('cs:hosturl');
- $hostUrl->appendChild($hostHref);
- $prop->appendChild($hostUrl);
-
- if ($this->summary) {
- $summary = $doc->createElement('cs:summary');
- $summary->appendChild($doc->createTextNode($this->summary));
- $prop->appendChild($summary);
- }
-
- }
-
- /**
- * Returns a unique id for this notification
- *
- * This is just the base url. This should generally be some kind of unique
- * id.
- *
- * @return string
- */
- public function getId() {
-
- return $this->id;
-
- }
-
- /**
- * Returns the ETag for this notification.
- *
- * The ETag must be surrounded by literal double-quotes.
- *
- * @return string
- */
- public function getETag() {
-
- return $this->etag;
-
- }
-}
diff --git a/3rdparty/Sabre/CalDAV/Notifications/Notification/SystemStatus.php b/3rdparty/Sabre/CalDAV/Notifications/Notification/SystemStatus.php
deleted file mode 100644
index f09ed3525f5..00000000000
--- a/3rdparty/Sabre/CalDAV/Notifications/Notification/SystemStatus.php
+++ /dev/null
@@ -1,179 +0,0 @@
-<?php
-
-/**
- * SystemStatus notification
- *
- * This notification can be used to indicate to the user that the system is
- * down.
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CalDAV_Notifications_Notification_SystemStatus extends Sabre_DAV_Property implements Sabre_CalDAV_Notifications_INotificationType {
-
- const TYPE_LOW = 1;
- const TYPE_MEDIUM = 2;
- const TYPE_HIGH = 3;
-
- /**
- * A unique id
- *
- * @var string
- */
- protected $id;
-
- /**
- * The type of alert. This should be one of the TYPE_ constants.
- *
- * @var int
- */
- protected $type;
-
- /**
- * A human-readable description of the problem.
- *
- * @var string
- */
- protected $description;
-
- /**
- * A url to a website with more information for the user.
- *
- * @var string
- */
- protected $href;
-
- /**
- * Notification Etag
- *
- * @var string
- */
- protected $etag;
-
- /**
- * Creates the notification.
- *
- * Some kind of unique id should be provided. This is used to generate a
- * url.
- *
- * @param string $id
- * @param string $etag
- * @param int $type
- * @param string $description
- * @param string $href
- */
- public function __construct($id, $etag, $type = self::TYPE_HIGH, $description = null, $href = null) {
-
- $this->id = $id;
- $this->type = $type;
- $this->description = $description;
- $this->href = $href;
- $this->etag = $etag;
-
- }
-
- /**
- * Serializes the notification as a single property.
- *
- * You should usually just encode the single top-level element of the
- * notification.
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $node
- * @return void
- */
- public function serialize(Sabre_DAV_Server $server, \DOMElement $node) {
-
- switch($this->type) {
- case self::TYPE_LOW :
- $type = 'low';
- break;
- case self::TYPE_MEDIUM :
- $type = 'medium';
- break;
- default :
- case self::TYPE_HIGH :
- $type = 'high';
- break;
- }
-
- $prop = $node->ownerDocument->createElement('cs:systemstatus');
- $prop->setAttribute('type', $type);
-
- $node->appendChild($prop);
-
- }
-
- /**
- * This method serializes the entire notification, as it is used in the
- * response body.
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $node
- * @return void
- */
- public function serializeBody(Sabre_DAV_Server $server, \DOMElement $node) {
-
- switch($this->type) {
- case self::TYPE_LOW :
- $type = 'low';
- break;
- case self::TYPE_MEDIUM :
- $type = 'medium';
- break;
- default :
- case self::TYPE_HIGH :
- $type = 'high';
- break;
- }
-
- $prop = $node->ownerDocument->createElement('cs:systemstatus');
- $prop->setAttribute('type', $type);
-
- if ($this->description) {
- $text = $node->ownerDocument->createTextNode($this->description);
- $desc = $node->ownerDocument->createElement('cs:description');
- $desc->appendChild($text);
- $prop->appendChild($desc);
- }
- if ($this->href) {
- $text = $node->ownerDocument->createTextNode($this->href);
- $href = $node->ownerDocument->createElement('d:href');
- $href->appendChild($text);
- $prop->appendChild($href);
- }
-
- $node->appendChild($prop);
-
- }
-
- /**
- * Returns a unique id for this notification
- *
- * This is just the base url. This should generally be some kind of unique
- * id.
- *
- * @return string
- */
- public function getId() {
-
- return $this->id;
-
- }
-
- /*
- * Returns the ETag for this notification.
- *
- * The ETag must be surrounded by literal double-quotes.
- *
- * @return string
- */
- public function getETag() {
-
- return $this->etag;
-
- }
-}
diff --git a/3rdparty/Sabre/CalDAV/Plugin.php b/3rdparty/Sabre/CalDAV/Plugin.php
deleted file mode 100644
index f3d11969c8b..00000000000
--- a/3rdparty/Sabre/CalDAV/Plugin.php
+++ /dev/null
@@ -1,1312 +0,0 @@
-<?php
-
-use Sabre\VObject;
-
-/**
- * CalDAV plugin
- *
- * This plugin provides functionality added by CalDAV (RFC 4791)
- * It implements new reports, and the MKCALENDAR method.
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CalDAV_Plugin extends Sabre_DAV_ServerPlugin {
-
- /**
- * This is the official CalDAV namespace
- */
- const NS_CALDAV = 'urn:ietf:params:xml:ns:caldav';
-
- /**
- * This is the namespace for the proprietary calendarserver extensions
- */
- const NS_CALENDARSERVER = 'http://calendarserver.org/ns/';
-
- /**
- * The hardcoded root for calendar objects. It is unfortunate
- * that we're stuck with it, but it will have to do for now
- */
- const CALENDAR_ROOT = 'calendars';
-
- /**
- * Reference to server object
- *
- * @var Sabre_DAV_Server
- */
- private $server;
-
- /**
- * The email handler for invites and other scheduling messages.
- *
- * @var Sabre_CalDAV_Schedule_IMip
- */
- protected $imipHandler;
-
- /**
- * Sets the iMIP handler.
- *
- * iMIP = The email transport of iCalendar scheduling messages. Setting
- * this is optional, but if you want the server to allow invites to be sent
- * out, you must set a handler.
- *
- * Specifically iCal will plain assume that the server supports this. If
- * the server doesn't, iCal will display errors when inviting people to
- * events.
- *
- * @param Sabre_CalDAV_Schedule_IMip $imipHandler
- * @return void
- */
- public function setIMipHandler(Sabre_CalDAV_Schedule_IMip $imipHandler) {
-
- $this->imipHandler = $imipHandler;
-
- }
-
- /**
- * Use this method to tell the server this plugin defines additional
- * HTTP methods.
- *
- * This method is passed a uri. It should only return HTTP methods that are
- * available for the specified uri.
- *
- * @param string $uri
- * @return array
- */
- public function getHTTPMethods($uri) {
-
- // The MKCALENDAR is only available on unmapped uri's, whose
- // parents extend IExtendedCollection
- list($parent, $name) = Sabre_DAV_URLUtil::splitPath($uri);
-
- $node = $this->server->tree->getNodeForPath($parent);
-
- if ($node instanceof Sabre_DAV_IExtendedCollection) {
- try {
- $node->getChild($name);
- } catch (Sabre_DAV_Exception_NotFound $e) {
- return array('MKCALENDAR');
- }
- }
- return array();
-
- }
-
- /**
- * Returns a list of features for the DAV: HTTP header.
- *
- * @return array
- */
- public function getFeatures() {
-
- return array('calendar-access', 'calendar-proxy');
-
- }
-
- /**
- * Returns a plugin name.
- *
- * Using this name other plugins will be able to access other plugins
- * using Sabre_DAV_Server::getPlugin
- *
- * @return string
- */
- public function getPluginName() {
-
- return 'caldav';
-
- }
-
- /**
- * Returns a list of reports this plugin supports.
- *
- * This will be used in the {DAV:}supported-report-set property.
- * Note that you still need to subscribe to the 'report' event to actually
- * implement them
- *
- * @param string $uri
- * @return array
- */
- public function getSupportedReportSet($uri) {
-
- $node = $this->server->tree->getNodeForPath($uri);
-
- $reports = array();
- if ($node instanceof Sabre_CalDAV_ICalendar || $node instanceof Sabre_CalDAV_ICalendarObject) {
- $reports[] = '{' . self::NS_CALDAV . '}calendar-multiget';
- $reports[] = '{' . self::NS_CALDAV . '}calendar-query';
- }
- if ($node instanceof Sabre_CalDAV_ICalendar) {
- $reports[] = '{' . self::NS_CALDAV . '}free-busy-query';
- }
- return $reports;
-
- }
-
- /**
- * Initializes the plugin
- *
- * @param Sabre_DAV_Server $server
- * @return void
- */
- public function initialize(Sabre_DAV_Server $server) {
-
- $this->server = $server;
-
- $server->subscribeEvent('unknownMethod',array($this,'unknownMethod'));
- //$server->subscribeEvent('unknownMethod',array($this,'unknownMethod2'),1000);
- $server->subscribeEvent('report',array($this,'report'));
- $server->subscribeEvent('beforeGetProperties',array($this,'beforeGetProperties'));
- $server->subscribeEvent('onHTMLActionsPanel', array($this,'htmlActionsPanel'));
- $server->subscribeEvent('onBrowserPostAction', array($this,'browserPostAction'));
- $server->subscribeEvent('beforeWriteContent', array($this, 'beforeWriteContent'));
- $server->subscribeEvent('beforeCreateFile', array($this, 'beforeCreateFile'));
- $server->subscribeEvent('beforeMethod', array($this,'beforeMethod'));
-
- $server->xmlNamespaces[self::NS_CALDAV] = 'cal';
- $server->xmlNamespaces[self::NS_CALENDARSERVER] = 'cs';
-
- $server->propertyMap['{' . self::NS_CALDAV . '}supported-calendar-component-set'] = 'Sabre_CalDAV_Property_SupportedCalendarComponentSet';
- $server->propertyMap['{' . self::NS_CALDAV . '}schedule-calendar-transp'] = 'Sabre_CalDAV_Property_ScheduleCalendarTransp';
-
- $server->resourceTypeMapping['Sabre_CalDAV_ICalendar'] = '{urn:ietf:params:xml:ns:caldav}calendar';
- $server->resourceTypeMapping['Sabre_CalDAV_Schedule_IOutbox'] = '{urn:ietf:params:xml:ns:caldav}schedule-outbox';
- $server->resourceTypeMapping['Sabre_CalDAV_Principal_ProxyRead'] = '{http://calendarserver.org/ns/}calendar-proxy-read';
- $server->resourceTypeMapping['Sabre_CalDAV_Principal_ProxyWrite'] = '{http://calendarserver.org/ns/}calendar-proxy-write';
- $server->resourceTypeMapping['Sabre_CalDAV_Notifications_ICollection'] = '{' . self::NS_CALENDARSERVER . '}notification';
-
- array_push($server->protectedProperties,
-
- '{' . self::NS_CALDAV . '}supported-calendar-component-set',
- '{' . self::NS_CALDAV . '}supported-calendar-data',
- '{' . self::NS_CALDAV . '}max-resource-size',
- '{' . self::NS_CALDAV . '}min-date-time',
- '{' . self::NS_CALDAV . '}max-date-time',
- '{' . self::NS_CALDAV . '}max-instances',
- '{' . self::NS_CALDAV . '}max-attendees-per-instance',
- '{' . self::NS_CALDAV . '}calendar-home-set',
- '{' . self::NS_CALDAV . '}supported-collation-set',
- '{' . self::NS_CALDAV . '}calendar-data',
-
- // scheduling extension
- '{' . self::NS_CALDAV . '}schedule-inbox-URL',
- '{' . self::NS_CALDAV . '}schedule-outbox-URL',
- '{' . self::NS_CALDAV . '}calendar-user-address-set',
- '{' . self::NS_CALDAV . '}calendar-user-type',
-
- // CalendarServer extensions
- '{' . self::NS_CALENDARSERVER . '}getctag',
- '{' . self::NS_CALENDARSERVER . '}calendar-proxy-read-for',
- '{' . self::NS_CALENDARSERVER . '}calendar-proxy-write-for',
- '{' . self::NS_CALENDARSERVER . '}notification-URL',
- '{' . self::NS_CALENDARSERVER . '}notificationtype'
-
- );
- }
-
- /**
- * This function handles support for the MKCALENDAR method
- *
- * @param string $method
- * @param string $uri
- * @return bool
- */
- public function unknownMethod($method, $uri) {
-
- switch ($method) {
- case 'MKCALENDAR' :
- $this->httpMkCalendar($uri);
- // false is returned to stop the propagation of the
- // unknownMethod event.
- return false;
- case 'POST' :
-
- // Checking if this is a text/calendar content type
- $contentType = $this->server->httpRequest->getHeader('Content-Type');
- if (strpos($contentType, 'text/calendar')!==0) {
- return;
- }
-
- // Checking if we're talking to an outbox
- try {
- $node = $this->server->tree->getNodeForPath($uri);
- } catch (Sabre_DAV_Exception_NotFound $e) {
- return;
- }
- if (!$node instanceof Sabre_CalDAV_Schedule_IOutbox)
- return;
-
- $this->outboxRequest($node, $uri);
- return false;
-
- }
-
- }
-
- /**
- * This functions handles REPORT requests specific to CalDAV
- *
- * @param string $reportName
- * @param DOMNode $dom
- * @return bool
- */
- public function report($reportName,$dom) {
-
- switch($reportName) {
- case '{'.self::NS_CALDAV.'}calendar-multiget' :
- $this->calendarMultiGetReport($dom);
- return false;
- case '{'.self::NS_CALDAV.'}calendar-query' :
- $this->calendarQueryReport($dom);
- return false;
- case '{'.self::NS_CALDAV.'}free-busy-query' :
- $this->freeBusyQueryReport($dom);
- return false;
-
- }
-
-
- }
-
- /**
- * This function handles the MKCALENDAR HTTP method, which creates
- * a new calendar.
- *
- * @param string $uri
- * @return void
- */
- public function httpMkCalendar($uri) {
-
- // Due to unforgivable bugs in iCal, we're completely disabling MKCALENDAR support
- // for clients matching iCal in the user agent
- //$ua = $this->server->httpRequest->getHeader('User-Agent');
- //if (strpos($ua,'iCal/')!==false) {
- // throw new Sabre_DAV_Exception_Forbidden('iCal has major bugs in it\'s RFC3744 support. Therefore we are left with no other choice but disabling this feature.');
- //}
-
- $body = $this->server->httpRequest->getBody(true);
- $properties = array();
-
- if ($body) {
-
- $dom = Sabre_DAV_XMLUtil::loadDOMDocument($body);
-
- foreach($dom->firstChild->childNodes as $child) {
-
- if (Sabre_DAV_XMLUtil::toClarkNotation($child)!=='{DAV:}set') continue;
- foreach(Sabre_DAV_XMLUtil::parseProperties($child,$this->server->propertyMap) as $k=>$prop) {
- $properties[$k] = $prop;
- }
-
- }
- }
-
- $resourceType = array('{DAV:}collection','{urn:ietf:params:xml:ns:caldav}calendar');
-
- $this->server->createCollection($uri,$resourceType,$properties);
-
- $this->server->httpResponse->sendStatus(201);
- $this->server->httpResponse->setHeader('Content-Length',0);
- }
-
- /**
- * beforeGetProperties
- *
- * This method handler is invoked before any after properties for a
- * resource are fetched. This allows us to add in any CalDAV specific
- * properties.
- *
- * @param string $path
- * @param Sabre_DAV_INode $node
- * @param array $requestedProperties
- * @param array $returnedProperties
- * @return void
- */
- public function beforeGetProperties($path, Sabre_DAV_INode $node, &$requestedProperties, &$returnedProperties) {
-
- if ($node instanceof Sabre_DAVACL_IPrincipal) {
-
- // calendar-home-set property
- $calHome = '{' . self::NS_CALDAV . '}calendar-home-set';
- if (in_array($calHome,$requestedProperties)) {
- $principalId = $node->getName();
- $calendarHomePath = self::CALENDAR_ROOT . '/' . $principalId . '/';
- unset($requestedProperties[$calHome]);
- $returnedProperties[200][$calHome] = new Sabre_DAV_Property_Href($calendarHomePath);
- }
-
- // schedule-outbox-URL property
- $scheduleProp = '{' . self::NS_CALDAV . '}schedule-outbox-URL';
- if (in_array($scheduleProp,$requestedProperties)) {
- $principalId = $node->getName();
- $outboxPath = self::CALENDAR_ROOT . '/' . $principalId . '/outbox';
- unset($requestedProperties[$scheduleProp]);
- $returnedProperties[200][$scheduleProp] = new Sabre_DAV_Property_Href($outboxPath);
- }
-
- // calendar-user-address-set property
- $calProp = '{' . self::NS_CALDAV . '}calendar-user-address-set';
- if (in_array($calProp,$requestedProperties)) {
-
- $addresses = $node->getAlternateUriSet();
- $addresses[] = $this->server->getBaseUri() . $node->getPrincipalUrl() . '/';
- unset($requestedProperties[$calProp]);
- $returnedProperties[200][$calProp] = new Sabre_DAV_Property_HrefList($addresses, false);
-
- }
-
- // These two properties are shortcuts for ical to easily find
- // other principals this principal has access to.
- $propRead = '{' . self::NS_CALENDARSERVER . '}calendar-proxy-read-for';
- $propWrite = '{' . self::NS_CALENDARSERVER . '}calendar-proxy-write-for';
- if (in_array($propRead,$requestedProperties) || in_array($propWrite,$requestedProperties)) {
-
- $membership = $node->getGroupMembership();
- $readList = array();
- $writeList = array();
-
- foreach($membership as $group) {
-
- $groupNode = $this->server->tree->getNodeForPath($group);
-
- // If the node is either ap proxy-read or proxy-write
- // group, we grab the parent principal and add it to the
- // list.
- if ($groupNode instanceof Sabre_CalDAV_Principal_ProxyRead) {
- list($readList[]) = Sabre_DAV_URLUtil::splitPath($group);
- }
- if ($groupNode instanceof Sabre_CalDAV_Principal_ProxyWrite) {
- list($writeList[]) = Sabre_DAV_URLUtil::splitPath($group);
- }
-
- }
- if (in_array($propRead,$requestedProperties)) {
- unset($requestedProperties[$propRead]);
- $returnedProperties[200][$propRead] = new Sabre_DAV_Property_HrefList($readList);
- }
- if (in_array($propWrite,$requestedProperties)) {
- unset($requestedProperties[$propWrite]);
- $returnedProperties[200][$propWrite] = new Sabre_DAV_Property_HrefList($writeList);
- }
-
- }
-
- // notification-URL property
- $notificationUrl = '{' . self::NS_CALENDARSERVER . '}notification-URL';
- if (($index = array_search($notificationUrl, $requestedProperties)) !== false) {
- $principalId = $node->getName();
- $calendarHomePath = 'calendars/' . $principalId . '/notifications/';
- unset($requestedProperties[$index]);
- $returnedProperties[200][$notificationUrl] = new Sabre_DAV_Property_Href($calendarHomePath);
- }
-
- } // instanceof IPrincipal
-
- if ($node instanceof Sabre_CalDAV_Notifications_INode) {
-
- $propertyName = '{' . self::NS_CALENDARSERVER . '}notificationtype';
- if (($index = array_search($propertyName, $requestedProperties)) !== false) {
-
- $returnedProperties[200][$propertyName] =
- $node->getNotificationType();
-
- unset($requestedProperties[$index]);
-
- }
-
- } // instanceof Notifications_INode
-
-
- if ($node instanceof Sabre_CalDAV_ICalendarObject) {
- // The calendar-data property is not supposed to be a 'real'
- // property, but in large chunks of the spec it does act as such.
- // Therefore we simply expose it as a property.
- $calDataProp = '{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}calendar-data';
- if (in_array($calDataProp, $requestedProperties)) {
- unset($requestedProperties[$calDataProp]);
- $val = $node->get();
- if (is_resource($val))
- $val = stream_get_contents($val);
-
- // Taking out \r to not screw up the xml output
- $returnedProperties[200][$calDataProp] = str_replace("\r","", $val);
-
- }
- }
-
- }
-
- /**
- * This function handles the calendar-multiget REPORT.
- *
- * This report is used by the client to fetch the content of a series
- * of urls. Effectively avoiding a lot of redundant requests.
- *
- * @param DOMNode $dom
- * @return void
- */
- public function calendarMultiGetReport($dom) {
-
- $properties = array_keys(Sabre_DAV_XMLUtil::parseProperties($dom->firstChild));
- $hrefElems = $dom->getElementsByTagNameNS('DAV:','href');
-
- $xpath = new DOMXPath($dom);
- $xpath->registerNameSpace('cal',Sabre_CalDAV_Plugin::NS_CALDAV);
- $xpath->registerNameSpace('dav','DAV:');
-
- $expand = $xpath->query('/cal:calendar-multiget/dav:prop/cal:calendar-data/cal:expand');
- if ($expand->length>0) {
- $expandElem = $expand->item(0);
- $start = $expandElem->getAttribute('start');
- $end = $expandElem->getAttribute('end');
- if(!$start || !$end) {
- throw new Sabre_DAV_Exception_BadRequest('The "start" and "end" attributes are required for the CALDAV:expand element');
- }
- $start = VObject\DateTimeParser::parseDateTime($start);
- $end = VObject\DateTimeParser::parseDateTime($end);
-
- if ($end <= $start) {
- throw new Sabre_DAV_Exception_BadRequest('The end-date must be larger than the start-date in the expand element.');
- }
-
- $expand = true;
-
- } else {
-
- $expand = false;
-
- }
-
- foreach($hrefElems as $elem) {
- $uri = $this->server->calculateUri($elem->nodeValue);
- list($objProps) = $this->server->getPropertiesForPath($uri,$properties);
-
- if ($expand && isset($objProps[200]['{' . self::NS_CALDAV . '}calendar-data'])) {
- $vObject = VObject\Reader::read($objProps[200]['{' . self::NS_CALDAV . '}calendar-data']);
- $vObject->expand($start, $end);
- $objProps[200]['{' . self::NS_CALDAV . '}calendar-data'] = $vObject->serialize();
- }
-
- $propertyList[]=$objProps;
-
- }
-
- $prefer = $this->server->getHTTPPRefer();
-
- $this->server->httpResponse->sendStatus(207);
- $this->server->httpResponse->setHeader('Content-Type','application/xml; charset=utf-8');
- $this->server->httpResponse->setHeader('Vary','Brief,Prefer');
- $this->server->httpResponse->sendBody($this->server->generateMultiStatus($propertyList, $prefer['return-minimal']));
-
- }
-
- /**
- * This function handles the calendar-query REPORT
- *
- * This report is used by clients to request calendar objects based on
- * complex conditions.
- *
- * @param DOMNode $dom
- * @return void
- */
- public function calendarQueryReport($dom) {
-
- $parser = new Sabre_CalDAV_CalendarQueryParser($dom);
- $parser->parse();
-
- $node = $this->server->tree->getNodeForPath($this->server->getRequestUri());
- $depth = $this->server->getHTTPDepth(0);
-
- // The default result is an empty array
- $result = array();
-
- // The calendarobject was requested directly. In this case we handle
- // this locally.
- if ($depth == 0 && $node instanceof Sabre_CalDAV_ICalendarObject) {
-
- $requestedCalendarData = true;
- $requestedProperties = $parser->requestedProperties;
-
- if (!in_array('{urn:ietf:params:xml:ns:caldav}calendar-data', $requestedProperties)) {
-
- // We always retrieve calendar-data, as we need it for filtering.
- $requestedProperties[] = '{urn:ietf:params:xml:ns:caldav}calendar-data';
-
- // If calendar-data wasn't explicitly requested, we need to remove
- // it after processing.
- $requestedCalendarData = false;
- }
-
- $properties = $this->server->getPropertiesForPath(
- $this->server->getRequestUri(),
- $requestedProperties,
- 0
- );
-
- // This array should have only 1 element, the first calendar
- // object.
- $properties = current($properties);
-
- // If there wasn't any calendar-data returned somehow, we ignore
- // this.
- if (isset($properties[200]['{urn:ietf:params:xml:ns:caldav}calendar-data'])) {
-
- $validator = new Sabre_CalDAV_CalendarQueryValidator();
- $vObject = VObject\Reader::read($properties[200]['{urn:ietf:params:xml:ns:caldav}calendar-data']);
- if ($validator->validate($vObject,$parser->filters)) {
-
- // If the client didn't require the calendar-data property,
- // we won't give it back.
- if (!$requestedCalendarData) {
- unset($properties[200]['{urn:ietf:params:xml:ns:caldav}calendar-data']);
- } else {
- if ($parser->expand) {
- $vObject->expand($parser->expand['start'], $parser->expand['end']);
- $properties[200]['{' . self::NS_CALDAV . '}calendar-data'] = $vObject->serialize();
- }
- }
-
- $result = array($properties);
-
- }
-
- }
-
- }
- // If we're dealing with a calendar, the calendar itself is responsible
- // for the calendar-query.
- if ($node instanceof Sabre_CalDAV_ICalendar && $depth = 1) {
-
- $nodePaths = $node->calendarQuery($parser->filters);
-
- foreach($nodePaths as $path) {
-
- list($properties) =
- $this->server->getPropertiesForPath($this->server->getRequestUri() . '/' . $path, $parser->requestedProperties);
-
- if ($parser->expand) {
- // We need to do some post-processing
- $vObject = VObject\Reader::read($properties[200]['{urn:ietf:params:xml:ns:caldav}calendar-data']);
- $vObject->expand($parser->expand['start'], $parser->expand['end']);
- $properties[200]['{' . self::NS_CALDAV . '}calendar-data'] = $vObject->serialize();
- }
-
- $result[] = $properties;
-
- }
-
- }
-
- $prefer = $this->server->getHTTPPRefer();
-
- $this->server->httpResponse->sendStatus(207);
- $this->server->httpResponse->setHeader('Content-Type','application/xml; charset=utf-8');
- $this->server->httpResponse->setHeader('Vary','Brief,Prefer');
- $this->server->httpResponse->sendBody($this->server->generateMultiStatus($result, $prefer['return-minimal']));
-
- }
-
- /**
- * This method is responsible for parsing the request and generating the
- * response for the CALDAV:free-busy-query REPORT.
- *
- * @param DOMNode $dom
- * @return void
- */
- protected function freeBusyQueryReport(DOMNode $dom) {
-
- $start = null;
- $end = null;
-
- foreach($dom->firstChild->childNodes as $childNode) {
-
- $clark = Sabre_DAV_XMLUtil::toClarkNotation($childNode);
- if ($clark == '{' . self::NS_CALDAV . '}time-range') {
- $start = $childNode->getAttribute('start');
- $end = $childNode->getAttribute('end');
- break;
- }
-
- }
- if ($start) {
- $start = VObject\DateTimeParser::parseDateTime($start);
- }
- if ($end) {
- $end = VObject\DateTimeParser::parseDateTime($end);
- }
-
- if (!$start && !$end) {
- throw new Sabre_DAV_Exception_BadRequest('The freebusy report must have a time-range filter');
- }
- $acl = $this->server->getPlugin('acl');
-
- if (!$acl) {
- throw new Sabre_DAV_Exception('The ACL plugin must be loaded for free-busy queries to work');
- }
- $uri = $this->server->getRequestUri();
- $acl->checkPrivileges($uri,'{' . self::NS_CALDAV . '}read-free-busy');
-
- $calendar = $this->server->tree->getNodeForPath($uri);
- if (!$calendar instanceof Sabre_CalDAV_ICalendar) {
- throw new Sabre_DAV_Exception_NotImplemented('The free-busy-query REPORT is only implemented on calendars');
- }
-
- // Doing a calendar-query first, to make sure we get the most
- // performance.
- $urls = $calendar->calendarQuery(array(
- 'name' => 'VCALENDAR',
- 'comp-filters' => array(
- array(
- 'name' => 'VEVENT',
- 'comp-filters' => array(),
- 'prop-filters' => array(),
- 'is-not-defined' => false,
- 'time-range' => array(
- 'start' => $start,
- 'end' => $end,
- ),
- ),
- ),
- 'prop-filters' => array(),
- 'is-not-defined' => false,
- 'time-range' => null,
- ));
-
- $objects = array_map(function($url) use ($calendar) {
- $obj = $calendar->getChild($url)->get();
- return $obj;
- }, $urls);
-
- $generator = new VObject\FreeBusyGenerator();
- $generator->setObjects($objects);
- $generator->setTimeRange($start, $end);
- $result = $generator->getResult();
- $result = $result->serialize();
-
- $this->server->httpResponse->sendStatus(200);
- $this->server->httpResponse->setHeader('Content-Type', 'text/calendar');
- $this->server->httpResponse->setHeader('Content-Length', strlen($result));
- $this->server->httpResponse->sendBody($result);
-
- }
-
- /**
- * This method is triggered before a file gets updated with new content.
- *
- * This plugin uses this method to ensure that CalDAV objects receive
- * valid calendar 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_CalDAV_ICalendarObject)
- return;
-
- $this->validateICalendar($data, $path);
-
- }
-
- /**
- * This method is triggered before a new file is created.
- *
- * This plugin uses this method to ensure that newly created calendar
- * objects contain valid calendar 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_CalDAV_Calendar)
- return;
-
- $this->validateICalendar($data, $path);
-
- }
-
- /**
- * This event is triggered before any HTTP request is handled.
- *
- * We use this to intercept GET calls to notification nodes, and return the
- * proper response.
- *
- * @param string $method
- * @param string $path
- * @return void
- */
- public function beforeMethod($method, $path) {
-
- if ($method!=='GET') return;
-
- try {
- $node = $this->server->tree->getNodeForPath($path);
- } catch (Sabre_DAV_Exception_NotFound $e) {
- return;
- }
-
- if (!$node instanceof Sabre_CalDAV_Notifications_INode)
- return;
-
- if (!$this->server->checkPreconditions(true)) return false;
-
- $dom = new DOMDocument('1.0', 'UTF-8');
- $dom->formatOutput = true;
-
- $root = $dom->createElement('cs:notification');
- foreach($this->server->xmlNamespaces as $namespace => $prefix) {
- $root->setAttribute('xmlns:' . $prefix, $namespace);
- }
-
- $dom->appendChild($root);
- $node->getNotificationType()->serializeBody($this->server, $root);
-
- $this->server->httpResponse->setHeader('Content-Type','application/xml');
- $this->server->httpResponse->setHeader('ETag',$node->getETag());
- $this->server->httpResponse->sendStatus(200);
- $this->server->httpResponse->sendBody($dom->saveXML());
-
- return false;
-
- }
-
- /**
- * Checks if the submitted iCalendar data is in fact, valid.
- *
- * An exception is thrown if it's not.
- *
- * @param resource|string $data
- * @param string $path
- * @return void
- */
- protected function validateICalendar(&$data, $path) {
-
- // 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 = VObject\Reader::read($data);
-
- } catch (VObject\ParseException $e) {
-
- throw new Sabre_DAV_Exception_UnsupportedMediaType('This resource only supports valid iCalendar 2.0 data. Parse error: ' . $e->getMessage());
-
- }
-
- if ($vobj->name !== 'VCALENDAR') {
- throw new Sabre_DAV_Exception_UnsupportedMediaType('This collection can only support iCalendar objects.');
- }
-
- // Get the Supported Components for the target calendar
- list($parentPath,$object) = Sabre_Dav_URLUtil::splitPath($path);
- $calendarProperties = $this->server->getProperties($parentPath,array('{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set'));
- $supportedComponents = $calendarProperties['{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set']->getValue();
-
- $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 (!in_array($foundType, $supportedComponents)) {
- throw new Sabre_CalDAV_Exception_InvalidComponentType('This calendar only supports ' . implode(', ', $supportedComponents) . '. We found a ' . $foundType);
- }
- 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');
-
- }
-
- /**
- * This method handles POST requests to the schedule-outbox.
- *
- * Currently, two types of requests are support:
- * * FREEBUSY requests from RFC 6638
- * * Simple iTIP messages from draft-desruisseaux-caldav-sched-04
- *
- * The latter is from an expired early draft of the CalDAV scheduling
- * extensions, but iCal depends on a feature from that spec, so we
- * implement it.
- *
- * @param Sabre_CalDAV_Schedule_IOutbox $outboxNode
- * @param string $outboxUri
- * @return void
- */
- public function outboxRequest(Sabre_CalDAV_Schedule_IOutbox $outboxNode, $outboxUri) {
-
- // Parsing the request body
- try {
- $vObject = VObject\Reader::read($this->server->httpRequest->getBody(true));
- } catch (VObject\ParseException $e) {
- throw new Sabre_DAV_Exception_BadRequest('The request body must be a valid iCalendar object. Parse error: ' . $e->getMessage());
- }
-
- // The incoming iCalendar object must have a METHOD property, and a
- // component. The combination of both determines what type of request
- // this is.
- $componentType = null;
- foreach($vObject->getComponents() as $component) {
- if ($component->name !== 'VTIMEZONE') {
- $componentType = $component->name;
- break;
- }
- }
- if (is_null($componentType)) {
- throw new Sabre_DAV_Exception_BadRequest('We expected at least one VTODO, VJOURNAL, VFREEBUSY or VEVENT component');
- }
-
- // Validating the METHOD
- $method = strtoupper((string)$vObject->METHOD);
- if (!$method) {
- throw new Sabre_DAV_Exception_BadRequest('A METHOD property must be specified in iTIP messages');
- }
-
- // So we support two types of requests:
- //
- // REQUEST with a VFREEBUSY component
- // REQUEST, REPLY, ADD, CANCEL on VEVENT components
-
- $acl = $this->server->getPlugin('acl');
-
- if ($componentType === 'VFREEBUSY' && $method === 'REQUEST') {
-
- $acl && $acl->checkPrivileges($outboxUri,'{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}schedule-query-freebusy');
- $this->handleFreeBusyRequest($outboxNode, $vObject);
-
- } elseif ($componentType === 'VEVENT' && in_array($method, array('REQUEST','REPLY','ADD','CANCEL'))) {
-
- $acl && $acl->checkPrivileges($outboxUri,'{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}schedule-post-vevent');
- $this->handleEventNotification($outboxNode, $vObject);
-
- } else {
-
- throw new Sabre_DAV_Exception_NotImplemented('SabreDAV supports only VFREEBUSY (REQUEST) and VEVENT (REQUEST, REPLY, ADD, CANCEL)');
-
- }
-
- }
-
- /**
- * This method handles the REQUEST, REPLY, ADD and CANCEL methods for
- * VEVENT iTip messages.
- *
- * @return void
- */
- protected function handleEventNotification(Sabre_CalDAV_Schedule_IOutbox $outboxNode, VObject\Component $vObject) {
-
- $originator = $this->server->httpRequest->getHeader('Originator');
- $recipients = $this->server->httpRequest->getHeader('Recipient');
-
- if (!$originator) {
- throw new Sabre_DAV_Exception_BadRequest('The Originator: header must be specified when making POST requests');
- }
- if (!$recipients) {
- throw new Sabre_DAV_Exception_BadRequest('The Recipient: header must be specified when making POST requests');
- }
-
- if (!preg_match('/^mailto:(.*)@(.*)$/i', $originator)) {
- throw new Sabre_DAV_Exception_BadRequest('Originator must start with mailto: and must be valid email address');
- }
- $originator = substr($originator,7);
-
- $recipients = explode(',',$recipients);
- foreach($recipients as $k=>$recipient) {
-
- $recipient = trim($recipient);
- if (!preg_match('/^mailto:(.*)@(.*)$/i', $recipient)) {
- throw new Sabre_DAV_Exception_BadRequest('Recipients must start with mailto: and must be valid email address');
- }
- $recipient = substr($recipient, 7);
- $recipients[$k] = $recipient;
- }
-
- // We need to make sure that 'originator' matches one of the email
- // addresses of the selected principal.
- $principal = $outboxNode->getOwner();
- $props = $this->server->getProperties($principal,array(
- '{' . self::NS_CALDAV . '}calendar-user-address-set',
- ));
-
- $addresses = array();
- if (isset($props['{' . self::NS_CALDAV . '}calendar-user-address-set'])) {
- $addresses = $props['{' . self::NS_CALDAV . '}calendar-user-address-set']->getHrefs();
- }
-
- if (!in_array('mailto:' . $originator, $addresses)) {
- throw new Sabre_DAV_Exception_Forbidden('The addresses specified in the Originator header did not match any addresses in the owners calendar-user-address-set header');
- }
-
- $result = $this->iMIPMessage($originator, $recipients, $vObject, $principal);
- $this->server->httpResponse->sendStatus(200);
- $this->server->httpResponse->setHeader('Content-Type','application/xml');
- $this->server->httpResponse->sendBody($this->generateScheduleResponse($result));
-
- }
-
- /**
- * Sends an iMIP message by email.
- *
- * This method must return an array with status codes per recipient.
- * This should look something like:
- *
- * array(
- * 'user1@example.org' => '2.0;Success'
- * )
- *
- * Formatting for this status code can be found at:
- * https://tools.ietf.org/html/rfc5545#section-3.8.8.3
- *
- * A list of valid status codes can be found at:
- * https://tools.ietf.org/html/rfc5546#section-3.6
- *
- * @param string $originator
- * @param array $recipients
- * @param Sabre\VObject\Component $vObject
- * @return array
- */
- protected function iMIPMessage($originator, array $recipients, VObject\Component $vObject, $principal) {
-
- if (!$this->imipHandler) {
- $resultStatus = '5.2;This server does not support this operation';
- } else {
- $this->imipHandler->sendMessage($originator, $recipients, $vObject, $principal);
- $resultStatus = '2.0;Success';
- }
-
- $result = array();
- foreach($recipients as $recipient) {
- $result[$recipient] = $resultStatus;
- }
-
- return $result;
-
- }
-
- /**
- * Generates a schedule-response XML body
- *
- * The recipients array is a key->value list, containing email addresses
- * and iTip status codes. See the iMIPMessage method for a description of
- * the value.
- *
- * @param array $recipients
- * @return string
- */
- public function generateScheduleResponse(array $recipients) {
-
- $dom = new DOMDocument('1.0','utf-8');
- $dom->formatOutput = true;
- $xscheduleResponse = $dom->createElement('cal:schedule-response');
- $dom->appendChild($xscheduleResponse);
-
- foreach($this->server->xmlNamespaces as $namespace=>$prefix) {
-
- $xscheduleResponse->setAttribute('xmlns:' . $prefix, $namespace);
-
- }
-
- foreach($recipients as $recipient=>$status) {
- $xresponse = $dom->createElement('cal:response');
-
- $xrecipient = $dom->createElement('cal:recipient');
- $xrecipient->appendChild($dom->createTextNode($recipient));
- $xresponse->appendChild($xrecipient);
-
- $xrequestStatus = $dom->createElement('cal:request-status');
- $xrequestStatus->appendChild($dom->createTextNode($status));
- $xresponse->appendChild($xrequestStatus);
-
- $xscheduleResponse->appendChild($xresponse);
-
- }
-
- return $dom->saveXML();
-
- }
-
- /**
- * This method is responsible for parsing a free-busy query request and
- * returning it's result.
- *
- * @param Sabre_CalDAV_Schedule_IOutbox $outbox
- * @param string $request
- * @return string
- */
- protected function handleFreeBusyRequest(Sabre_CalDAV_Schedule_IOutbox $outbox, VObject\Component $vObject) {
-
- $vFreeBusy = $vObject->VFREEBUSY;
- $organizer = $vFreeBusy->organizer;
-
- $organizer = (string)$organizer;
-
- // Validating if the organizer matches the owner of the inbox.
- $owner = $outbox->getOwner();
-
- $caldavNS = '{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}';
-
- $uas = $caldavNS . 'calendar-user-address-set';
- $props = $this->server->getProperties($owner,array($uas));
-
- if (empty($props[$uas]) || !in_array($organizer, $props[$uas]->getHrefs())) {
- throw new Sabre_DAV_Exception_Forbidden('The organizer in the request did not match any of the addresses for the owner of this inbox');
- }
-
- if (!isset($vFreeBusy->ATTENDEE)) {
- throw new Sabre_DAV_Exception_BadRequest('You must at least specify 1 attendee');
- }
-
- $attendees = array();
- foreach($vFreeBusy->ATTENDEE as $attendee) {
- $attendees[]= (string)$attendee;
- }
-
-
- if (!isset($vFreeBusy->DTSTART) || !isset($vFreeBusy->DTEND)) {
- throw new Sabre_DAV_Exception_BadRequest('DTSTART and DTEND must both be specified');
- }
-
- $startRange = $vFreeBusy->DTSTART->getDateTime();
- $endRange = $vFreeBusy->DTEND->getDateTime();
-
- $results = array();
- foreach($attendees as $attendee) {
- $results[] = $this->getFreeBusyForEmail($attendee, $startRange, $endRange, $vObject);
- }
-
- $dom = new DOMDocument('1.0','utf-8');
- $dom->formatOutput = true;
- $scheduleResponse = $dom->createElement('cal:schedule-response');
- foreach($this->server->xmlNamespaces as $namespace=>$prefix) {
-
- $scheduleResponse->setAttribute('xmlns:' . $prefix,$namespace);
-
- }
- $dom->appendChild($scheduleResponse);
-
- foreach($results as $result) {
- $response = $dom->createElement('cal:response');
-
- $recipient = $dom->createElement('cal:recipient');
- $recipientHref = $dom->createElement('d:href');
-
- $recipientHref->appendChild($dom->createTextNode($result['href']));
- $recipient->appendChild($recipientHref);
- $response->appendChild($recipient);
-
- $reqStatus = $dom->createElement('cal:request-status');
- $reqStatus->appendChild($dom->createTextNode($result['request-status']));
- $response->appendChild($reqStatus);
-
- if (isset($result['calendar-data'])) {
-
- $calendardata = $dom->createElement('cal:calendar-data');
- $calendardata->appendChild($dom->createTextNode(str_replace("\r\n","\n",$result['calendar-data']->serialize())));
- $response->appendChild($calendardata);
-
- }
- $scheduleResponse->appendChild($response);
- }
-
- $this->server->httpResponse->sendStatus(200);
- $this->server->httpResponse->setHeader('Content-Type','application/xml');
- $this->server->httpResponse->sendBody($dom->saveXML());
-
- }
-
- /**
- * Returns free-busy information for a specific address. The returned
- * data is an array containing the following properties:
- *
- * calendar-data : A VFREEBUSY VObject
- * request-status : an iTip status code.
- * href: The principal's email address, as requested
- *
- * The following request status codes may be returned:
- * * 2.0;description
- * * 3.7;description
- *
- * @param string $email address
- * @param DateTime $start
- * @param DateTime $end
- * @param Sabre_VObject_Component $request
- * @return Sabre_VObject_Component
- */
- protected function getFreeBusyForEmail($email, DateTime $start, DateTime $end, VObject\Component $request) {
-
- $caldavNS = '{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}';
-
- $aclPlugin = $this->server->getPlugin('acl');
- if (substr($email,0,7)==='mailto:') $email = substr($email,7);
-
- $result = $aclPlugin->principalSearch(
- array('{http://sabredav.org/ns}email-address' => $email),
- array(
- '{DAV:}principal-URL', $caldavNS . 'calendar-home-set',
- '{http://sabredav.org/ns}email-address',
- )
- );
-
- if (!count($result)) {
- return array(
- 'request-status' => '3.7;Could not find principal',
- 'href' => 'mailto:' . $email,
- );
- }
-
- if (!isset($result[0][200][$caldavNS . 'calendar-home-set'])) {
- return array(
- 'request-status' => '3.7;No calendar-home-set property found',
- 'href' => 'mailto:' . $email,
- );
- }
- $homeSet = $result[0][200][$caldavNS . 'calendar-home-set']->getHref();
-
- // Grabbing the calendar list
- $objects = array();
- foreach($this->server->tree->getNodeForPath($homeSet)->getChildren() as $node) {
- if (!$node instanceof Sabre_CalDAV_ICalendar) {
- continue;
- }
- $aclPlugin->checkPrivileges($homeSet . $node->getName() ,$caldavNS . 'read-free-busy');
-
- // Getting the list of object uris within the time-range
- $urls = $node->calendarQuery(array(
- 'name' => 'VCALENDAR',
- 'comp-filters' => array(
- array(
- 'name' => 'VEVENT',
- 'comp-filters' => array(),
- 'prop-filters' => array(),
- 'is-not-defined' => false,
- 'time-range' => array(
- 'start' => $start,
- 'end' => $end,
- ),
- ),
- ),
- 'prop-filters' => array(),
- 'is-not-defined' => false,
- 'time-range' => null,
- ));
-
- $calObjects = array_map(function($url) use ($node) {
- $obj = $node->getChild($url)->get();
- return $obj;
- }, $urls);
-
- $objects = array_merge($objects,$calObjects);
-
- }
-
- $vcalendar = VObject\Component::create('VCALENDAR');
- $vcalendar->VERSION = '2.0';
- $vcalendar->METHOD = 'REPLY';
- $vcalendar->CALSCALE = 'GREGORIAN';
- $vcalendar->PRODID = '-//SabreDAV//SabreDAV ' . Sabre_DAV_Version::VERSION . '//EN';
-
- $generator = new VObject\FreeBusyGenerator();
- $generator->setObjects($objects);
- $generator->setTimeRange($start, $end);
- $generator->setBaseObject($vcalendar);
-
- $result = $generator->getResult();
-
- $vcalendar->VFREEBUSY->ATTENDEE = 'mailto:' . $email;
- $vcalendar->VFREEBUSY->UID = (string)$request->VFREEBUSY->UID;
- $vcalendar->VFREEBUSY->ORGANIZER = clone $request->VFREEBUSY->ORGANIZER;
-
- return array(
- 'calendar-data' => $result,
- 'request-status' => '2.0;Success',
- 'href' => 'mailto:' . $email,
- );
- }
-
- /**
- * This method is used to generate HTML output for the
- * Sabre_DAV_Browser_Plugin. This allows us to generate an interface users
- * can use to create new calendars.
- *
- * @param Sabre_DAV_INode $node
- * @param string $output
- * @return bool
- */
- public function htmlActionsPanel(Sabre_DAV_INode $node, &$output) {
-
- if (!$node instanceof Sabre_CalDAV_UserCalendars)
- return;
-
- $output.= '<tr><td colspan="2"><form method="post" action="">
- <h3>Create new calendar</h3>
- <input type="hidden" name="sabreAction" value="mkcalendar" />
- <label>Name (uri):</label> <input type="text" name="name" /><br />
- <label>Display name:</label> <input type="text" name="{DAV:}displayname" /><br />
- <input type="submit" value="create" />
- </form>
- </td></tr>';
-
- return false;
-
- }
-
- /**
- * This method allows us to intercept the 'mkcalendar' sabreAction. This
- * action enables the user to create new calendars from the browser plugin.
- *
- * @param string $uri
- * @param string $action
- * @param array $postVars
- * @return bool
- */
- public function browserPostAction($uri, $action, array $postVars) {
-
- if ($action!=='mkcalendar')
- return;
-
- $resourceType = array('{DAV:}collection','{urn:ietf:params:xml:ns:caldav}calendar');
- $properties = array();
- if (isset($postVars['{DAV:}displayname'])) {
- $properties['{DAV:}displayname'] = $postVars['{DAV:}displayname'];
- }
- $this->server->createCollection($uri . '/' . $postVars['name'],$resourceType,$properties);
- return false;
-
- }
-
-}
diff --git a/3rdparty/Sabre/CalDAV/Principal/Collection.php b/3rdparty/Sabre/CalDAV/Principal/Collection.php
deleted file mode 100644
index abbefa5567a..00000000000
--- a/3rdparty/Sabre/CalDAV/Principal/Collection.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-
-/**
- * Principal collection
- *
- * This is an alternative collection to the standard ACL principal collection.
- * This collection adds support for the calendar-proxy-read and
- * calendar-proxy-write sub-principals, as defined by the caldav-proxy
- * specification.
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CalDAV_Principal_Collection extends Sabre_DAVACL_AbstractPrincipalCollection {
-
- /**
- * Returns a child object based on principal information
- *
- * @param array $principalInfo
- * @return Sabre_CalDAV_Principal_User
- */
- public function getChildForPrincipal(array $principalInfo) {
-
- return new Sabre_CalDAV_Principal_User($this->principalBackend, $principalInfo);
-
- }
-
-}
diff --git a/3rdparty/Sabre/CalDAV/Principal/ProxyRead.php b/3rdparty/Sabre/CalDAV/Principal/ProxyRead.php
deleted file mode 100644
index 4b3f035634a..00000000000
--- a/3rdparty/Sabre/CalDAV/Principal/ProxyRead.php
+++ /dev/null
@@ -1,178 +0,0 @@
-<?php
-
-/**
- * ProxyRead principal
- *
- * This class represents a principal group, hosted under the main principal.
- * This is needed to implement 'Calendar delegation' support. This class is
- * instantiated by Sabre_CalDAV_Principal_User.
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CalDAV_Principal_ProxyRead implements Sabre_DAVACL_IPrincipal {
-
- /**
- * Principal information from the parent principal.
- *
- * @var array
- */
- protected $principalInfo;
-
- /**
- * Principal backend
- *
- * @var Sabre_DAVACL_IPrincipalBackend
- */
- protected $principalBackend;
-
- /**
- * Creates the object.
- *
- * Note that you MUST supply the parent principal information.
- *
- * @param Sabre_DAVACL_IPrincipalBackend $principalBackend
- * @param array $principalInfo
- */
- public function __construct(Sabre_DAVACL_IPrincipalBackend $principalBackend, array $principalInfo) {
-
- $this->principalInfo = $principalInfo;
- $this->principalBackend = $principalBackend;
-
- }
-
- /**
- * Returns this principals name.
- *
- * @return string
- */
- public function getName() {
-
- return 'calendar-proxy-read';
-
- }
-
- /**
- * Returns the last modification time
- *
- * @return null
- */
- public function getLastModified() {
-
- return null;
-
- }
-
- /**
- * Deletes the current node
- *
- * @throws Sabre_DAV_Exception_Forbidden
- * @return void
- */
- public function delete() {
-
- throw new Sabre_DAV_Exception_Forbidden('Permission denied to delete node');
-
- }
-
- /**
- * Renames the node
- *
- * @throws Sabre_DAV_Exception_Forbidden
- * @param string $name The new name
- * @return void
- */
- public function setName($name) {
-
- throw new Sabre_DAV_Exception_Forbidden('Permission denied to rename file');
-
- }
-
-
- /**
- * Returns a list of alternative urls for a principal
- *
- * This can for example be an email address, or ldap url.
- *
- * @return array
- */
- public function getAlternateUriSet() {
-
- return array();
-
- }
-
- /**
- * Returns the full principal url
- *
- * @return string
- */
- public function getPrincipalUrl() {
-
- return $this->principalInfo['uri'] . '/' . $this->getName();
-
- }
-
- /**
- * Returns the list of group members
- *
- * If this principal is a group, this function should return
- * all member principal uri's for the group.
- *
- * @return array
- */
- public function getGroupMemberSet() {
-
- return $this->principalBackend->getGroupMemberSet($this->getPrincipalUrl());
-
- }
-
- /**
- * Returns the list of groups this principal is member of
- *
- * If this principal is a member of a (list of) groups, this function
- * should return a list of principal uri's for it's members.
- *
- * @return array
- */
- public function getGroupMembership() {
-
- return $this->principalBackend->getGroupMembership($this->getPrincipalUrl());
-
- }
-
- /**
- * Sets a list of group members
- *
- * If this principal is a group, this method sets all the group members.
- * The list of members is always overwritten, never appended to.
- *
- * This method should throw an exception if the members could not be set.
- *
- * @param array $principals
- * @return void
- */
- public function setGroupMemberSet(array $principals) {
-
- $this->principalBackend->setGroupMemberSet($this->getPrincipalUrl(), $principals);
-
- }
-
- /**
- * Returns the displayname
- *
- * This should be a human readable name for the principal.
- * If none is available, return the nodename.
- *
- * @return string
- */
- public function getDisplayName() {
-
- return $this->getName();
-
- }
-
-}
diff --git a/3rdparty/Sabre/CalDAV/Principal/ProxyWrite.php b/3rdparty/Sabre/CalDAV/Principal/ProxyWrite.php
deleted file mode 100644
index dd0c2e86edd..00000000000
--- a/3rdparty/Sabre/CalDAV/Principal/ProxyWrite.php
+++ /dev/null
@@ -1,178 +0,0 @@
-<?php
-
-/**
- * ProxyWrite principal
- *
- * This class represents a principal group, hosted under the main principal.
- * This is needed to implement 'Calendar delegation' support. This class is
- * instantiated by Sabre_CalDAV_Principal_User.
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CalDAV_Principal_ProxyWrite implements Sabre_DAVACL_IPrincipal {
-
- /**
- * Parent principal information
- *
- * @var array
- */
- protected $principalInfo;
-
- /**
- * Principal Backend
- *
- * @var Sabre_DAVACL_IPrincipalBackend
- */
- protected $principalBackend;
-
- /**
- * Creates the object
- *
- * Note that you MUST supply the parent principal information.
- *
- * @param Sabre_DAVACL_IPrincipalBackend $principalBackend
- * @param array $principalInfo
- */
- public function __construct(Sabre_DAVACL_IPrincipalBackend $principalBackend, array $principalInfo) {
-
- $this->principalInfo = $principalInfo;
- $this->principalBackend = $principalBackend;
-
- }
-
- /**
- * Returns this principals name.
- *
- * @return string
- */
- public function getName() {
-
- return 'calendar-proxy-write';
-
- }
-
- /**
- * Returns the last modification time
- *
- * @return null
- */
- public function getLastModified() {
-
- return null;
-
- }
-
- /**
- * Deletes the current node
- *
- * @throws Sabre_DAV_Exception_Forbidden
- * @return void
- */
- public function delete() {
-
- throw new Sabre_DAV_Exception_Forbidden('Permission denied to delete node');
-
- }
-
- /**
- * Renames the node
- *
- * @throws Sabre_DAV_Exception_Forbidden
- * @param string $name The new name
- * @return void
- */
- public function setName($name) {
-
- throw new Sabre_DAV_Exception_Forbidden('Permission denied to rename file');
-
- }
-
-
- /**
- * Returns a list of alternative urls for a principal
- *
- * This can for example be an email address, or ldap url.
- *
- * @return array
- */
- public function getAlternateUriSet() {
-
- return array();
-
- }
-
- /**
- * Returns the full principal url
- *
- * @return string
- */
- public function getPrincipalUrl() {
-
- return $this->principalInfo['uri'] . '/' . $this->getName();
-
- }
-
- /**
- * Returns the list of group members
- *
- * If this principal is a group, this function should return
- * all member principal uri's for the group.
- *
- * @return array
- */
- public function getGroupMemberSet() {
-
- return $this->principalBackend->getGroupMemberSet($this->getPrincipalUrl());
-
- }
-
- /**
- * Returns the list of groups this principal is member of
- *
- * If this principal is a member of a (list of) groups, this function
- * should return a list of principal uri's for it's members.
- *
- * @return array
- */
- public function getGroupMembership() {
-
- return $this->principalBackend->getGroupMembership($this->getPrincipalUrl());
-
- }
-
- /**
- * Sets a list of group members
- *
- * If this principal is a group, this method sets all the group members.
- * The list of members is always overwritten, never appended to.
- *
- * This method should throw an exception if the members could not be set.
- *
- * @param array $principals
- * @return void
- */
- public function setGroupMemberSet(array $principals) {
-
- $this->principalBackend->setGroupMemberSet($this->getPrincipalUrl(), $principals);
-
- }
-
- /**
- * Returns the displayname
- *
- * This should be a human readable name for the principal.
- * If none is available, return the nodename.
- *
- * @return string
- */
- public function getDisplayName() {
-
- return $this->getName();
-
- }
-
-}
diff --git a/3rdparty/Sabre/CalDAV/Principal/User.php b/3rdparty/Sabre/CalDAV/Principal/User.php
deleted file mode 100644
index 8453b877a73..00000000000
--- a/3rdparty/Sabre/CalDAV/Principal/User.php
+++ /dev/null
@@ -1,132 +0,0 @@
-<?php
-
-/**
- * CalDAV principal
- *
- * This is a standard user-principal for CalDAV. This principal is also a
- * collection and returns the caldav-proxy-read and caldav-proxy-write child
- * principals.
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CalDAV_Principal_User extends Sabre_DAVACL_Principal implements Sabre_DAV_ICollection {
-
- /**
- * Creates a new file in the directory
- *
- * @param string $name Name of the file
- * @param resource $data Initial payload, passed as a readable stream resource.
- * @throws Sabre_DAV_Exception_Forbidden
- * @return void
- */
- public function createFile($name, $data = null) {
-
- throw new Sabre_DAV_Exception_Forbidden('Permission denied to create file (filename ' . $name . ')');
-
- }
-
- /**
- * Creates a new subdirectory
- *
- * @param string $name
- * @throws Sabre_DAV_Exception_Forbidden
- * @return void
- */
- public function createDirectory($name) {
-
- throw new Sabre_DAV_Exception_Forbidden('Permission denied to create directory');
-
- }
-
- /**
- * Returns a specific child node, referenced by its name
- *
- * @param string $name
- * @return Sabre_DAV_INode
- */
- public function getChild($name) {
-
- $principal = $this->principalBackend->getPrincipalByPath($this->getPrincipalURL() . '/' . $name);
- if (!$principal) {
- throw new Sabre_DAV_Exception_NotFound('Node with name ' . $name . ' was not found');
- }
- if ($name === 'calendar-proxy-read')
- return new Sabre_CalDAV_Principal_ProxyRead($this->principalBackend, $this->principalProperties);
-
- if ($name === 'calendar-proxy-write')
- return new Sabre_CalDAV_Principal_ProxyWrite($this->principalBackend, $this->principalProperties);
-
- throw new Sabre_DAV_Exception_NotFound('Node with name ' . $name . ' was not found');
-
- }
-
- /**
- * Returns an array with all the child nodes
- *
- * @return Sabre_DAV_INode[]
- */
- public function getChildren() {
-
- $r = array();
- if ($this->principalBackend->getPrincipalByPath($this->getPrincipalURL() . '/calendar-proxy-read')) {
- $r[] = new Sabre_CalDAV_Principal_ProxyRead($this->principalBackend, $this->principalProperties);
- }
- if ($this->principalBackend->getPrincipalByPath($this->getPrincipalURL() . '/calendar-proxy-write')) {
- $r[] = new Sabre_CalDAV_Principal_ProxyWrite($this->principalBackend, $this->principalProperties);
- }
-
- return $r;
-
- }
-
- /**
- * Returns whether or not the child node exists
- *
- * @param string $name
- * @return bool
- */
- public function childExists($name) {
-
- try {
- $this->getChild($name);
- return true;
- } catch (Sabre_DAV_Exception_NotFound $e) {
- return false;
- }
-
- }
-
- /**
- * Returns a list of ACE's for this node.
- *
- * Each ACE has the following properties:
- * * 'privilege', a string such as {DAV:}read or {DAV:}write. These are
- * currently the only supported privileges
- * * 'principal', a url to the principal who owns the node
- * * 'protected' (optional), indicating that this ACE is not allowed to
- * be updated.
- *
- * @return array
- */
- public function getACL() {
-
- $acl = parent::getACL();
- $acl[] = array(
- 'privilege' => '{DAV:}read',
- 'principal' => $this->principalProperties['uri'] . '/calendar-proxy-read',
- 'protected' => true,
- );
- $acl[] = array(
- 'privilege' => '{DAV:}read',
- 'principal' => $this->principalProperties['uri'] . '/calendar-proxy-write',
- 'protected' => true,
- );
- return $acl;
-
- }
-
-}
diff --git a/3rdparty/Sabre/CalDAV/Property/AllowedSharingModes.php b/3rdparty/Sabre/CalDAV/Property/AllowedSharingModes.php
deleted file mode 100644
index efe751732c5..00000000000
--- a/3rdparty/Sabre/CalDAV/Property/AllowedSharingModes.php
+++ /dev/null
@@ -1,72 +0,0 @@
-<?php
-
-/**
- * AllowedSharingModes
- *
- * This property encodes the 'allowed-sharing-modes' property, as defined by
- * the 'caldav-sharing-02' spec, in the http://calendarserver.org/ns/
- * namespace.
- *
- * This property is a representation of the supported-calendar_component-set
- * property in the CalDAV namespace. It simply requires an array of components,
- * such as VEVENT, VTODO
- *
- * @package Sabre
- * @subpackage CalDAV
- * @see https://trac.calendarserver.org/browser/CalendarServer/trunk/doc/Extensions/caldav-sharing-02.txt
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CalDAV_Property_AllowedSharingModes extends Sabre_DAV_Property {
-
- /**
- * Whether or not a calendar can be shared with another user
- *
- * @var bool
- */
- protected $canBeShared;
-
- /**
- * Whether or not the calendar can be placed on a public url.
- *
- * @var bool
- */
- protected $canBePublished;
-
- /**
- * Constructor
- *
- * @param bool $canBeShared
- * @param bool $canBePublished
- * @return void
- */
- public function __construct($canBeShared, $canBePublished) {
-
- $this->canBeShared = $canBeShared;
- $this->canBePublished = $canBePublished;
-
- }
-
- /**
- * Serializes the property in a DOMDocument
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $node
- * @return void
- */
- public function serialize(Sabre_DAV_Server $server,DOMElement $node) {
-
- $doc = $node->ownerDocument;
- if ($this->canBeShared) {
- $xcomp = $doc->createElement('cs:can-be-shared');
- $node->appendChild($xcomp);
- }
- if ($this->canBePublished) {
- $xcomp = $doc->createElement('cs:can-be-published');
- $node->appendChild($xcomp);
- }
-
- }
-
-}
diff --git a/3rdparty/Sabre/CalDAV/Property/Invite.php b/3rdparty/Sabre/CalDAV/Property/Invite.php
deleted file mode 100644
index 4ed94877df2..00000000000
--- a/3rdparty/Sabre/CalDAV/Property/Invite.php
+++ /dev/null
@@ -1,173 +0,0 @@
-<?php
-
-use Sabre_CalDAV_SharingPlugin as SharingPlugin;
-
-/**
- * Invite property
- *
- * This property encodes the 'invite' property, as defined by
- * the 'caldav-sharing-02' spec, in the http://calendarserver.org/ns/
- * namespace.
- *
- * @package Sabre
- * @subpackage CalDAV
- * @see https://trac.calendarserver.org/browser/CalendarServer/trunk/doc/Extensions/caldav-sharing-02.txt
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CalDAV_Property_Invite extends Sabre_DAV_Property {
-
- /**
- * The list of users a calendar has been shared to.
- *
- * @var array
- */
- protected $users;
-
- /**
- * Creates the property.
- *
- * Users is an array. Each element of the array has the following
- * properties:
- *
- * * href - Often a mailto: address
- * * commonName - Optional, for example a first and lastname for a user.
- * * status - One of the SharingPlugin::STATUS_* constants.
- * * readOnly - true or false
- * * summary - Optional, description of the share
- *
- * @param array $users
- */
- public function __construct(array $users) {
-
- $this->users = $users;
-
- }
-
- /**
- * Returns the list of users, as it was passed to the constructor.
- *
- * @return array
- */
- public function getValue() {
-
- return $this->users;
-
- }
-
- /**
- * Serializes the property in a DOMDocument
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $node
- * @return void
- */
- public function serialize(Sabre_DAV_Server $server,DOMElement $node) {
-
- $doc = $node->ownerDocument;
- foreach($this->users as $user) {
-
- $xuser = $doc->createElement('cs:user');
-
- $href = $doc->createElement('d:href');
- $href->appendChild($doc->createTextNode($user['href']));
- $xuser->appendChild($href);
-
- if (isset($user['commonName']) && $user['commonName']) {
- $commonName = $doc->createElement('cs:common-name');
- $commonName->appendChild($doc->createTextNode($user['commonName']));
- $xuser->appendChild($commonName);
- }
-
- switch($user['status']) {
-
- case SharingPlugin::STATUS_ACCEPTED :
- $status = $doc->createElement('cs:invite-accepted');
- $xuser->appendChild($status);
- break;
- case SharingPlugin::STATUS_DECLINED :
- $status = $doc->createElement('cs:invite-declined');
- $xuser->appendChild($status);
- break;
- case SharingPlugin::STATUS_NORESPONSE :
- $status = $doc->createElement('cs:invite-noresponse');
- $xuser->appendChild($status);
- break;
- case SharingPlugin::STATUS_INVALID :
- $status = $doc->createElement('cs:invite-invalid');
- $xuser->appendChild($status);
- break;
-
- }
-
- $xaccess = $doc->createElement('cs:access');
-
- if ($user['readOnly']) {
- $xaccess->appendChild(
- $doc->createElement('cs:read')
- );
- } else {
- $xaccess->appendChild(
- $doc->createElement('cs:read-write')
- );
- }
- $xuser->appendChild($xaccess);
-
- if (isset($user['summary']) && $user['summary']) {
- $summary = $doc->createElement('cs:summary');
- $summary->appendChild($doc->createTextNode($user['summary']));
- $xuser->appendChild($summary);
- }
-
- $node->appendChild($xuser);
-
- }
-
- }
-
- /**
- * Unserializes the property.
- *
- * This static method should return a an instance of this object.
- *
- * @param DOMElement $prop
- * @return Sabre_DAV_IProperty
- */
- static function unserialize(DOMElement $prop) {
-
- $xpath = new \DOMXPath($prop->ownerDocument);
- $xpath->registerNamespace('cs', Sabre_CalDAV_Plugin::NS_CALENDARSERVER);
- $xpath->registerNamespace('d', 'DAV:');
-
- $users = array();
-
- foreach($xpath->query('cs:user', $prop) as $user) {
-
- $status = null;
- if ($xpath->evaluate('boolean(cs:invite-accepted)', $user)) {
- $status = SharingPlugin::STATUS_ACCEPTED;
- } elseif ($xpath->evaluate('boolean(cs:invite-declined)', $user)) {
- $status = SharingPlugin::STATUS_DECLINED;
- } elseif ($xpath->evaluate('boolean(cs:invite-noresponse)', $user)) {
- $status = SharingPlugin::STATUS_NORESPONSE;
- } elseif ($xpath->evaluate('boolean(cs:invite-invalid)', $user)) {
- $status = SharingPlugin::STATUS_INVALID;
- } else {
- throw new Sabre_DAV_Exception('Every cs:user property must have one of cs:invite-accepted, cs:invite-declined, cs:invite-noresponse or cs:invite-invalid');
- }
- $users[] = array(
- 'href' => $xpath->evaluate('string(d:href)', $user),
- 'commonName' => $xpath->evaluate('string(cs:common-name)', $user),
- 'readOnly' => $xpath->evaluate('boolean(cs:access/cs:read)', $user),
- 'summary' => $xpath->evaluate('string(cs:summary)', $user),
- 'status' => $status,
- );
-
- }
-
- return new self($users);
-
- }
-
-}
diff --git a/3rdparty/Sabre/CalDAV/Property/ScheduleCalendarTransp.php b/3rdparty/Sabre/CalDAV/Property/ScheduleCalendarTransp.php
deleted file mode 100644
index 76c1dbaec21..00000000000
--- a/3rdparty/Sabre/CalDAV/Property/ScheduleCalendarTransp.php
+++ /dev/null
@@ -1,99 +0,0 @@
-<?php
-
-/**
- * schedule-calendar-transp property.
- *
- * This property is a representation of the schedule-calendar-transp property.
- * This property is defined in RFC6638 (caldav scheduling).
- *
- * Its values are either 'transparent' or 'opaque'. If it's transparent, it
- * means that this calendar will not be taken into consideration when a
- * different user queries for free-busy information. If it's 'opaque', it will.
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CalDAV_Property_ScheduleCalendarTransp extends Sabre_DAV_Property {
-
- const TRANSPARENT = 'transparent';
- const OPAQUE = 'opaque';
-
- protected $value;
-
- /**
- * Creates the property
- *
- * @param string $value
- */
- public function __construct($value) {
-
- if ($value !== self::TRANSPARENT && $value !== self::OPAQUE) {
- throw new \InvalidArgumentException('The value must either be specified as "transparent" or "opaque"');
- }
- $this->value = $value;
-
- }
-
- /**
- * Returns the current value
- *
- * @return string
- */
- public function getValue() {
-
- return $this->value;
-
- }
-
- /**
- * Serializes the property in a DOMDocument
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $node
- * @return void
- */
- public function serialize(Sabre_DAV_Server $server,DOMElement $node) {
-
- $doc = $node->ownerDocument;
- switch($this->value) {
- case self::TRANSPARENT :
- $xval = $doc->createElement('cal:transparent');
- break;
- case self::OPAQUE :
- $xval = $doc->createElement('cal:opaque');
- break;
- }
-
- $node->appendChild($xval);
-
- }
-
- /**
- * Unserializes the DOMElement back into a Property class.
- *
- * @param DOMElement $node
- * @return Sabre_CalDAV_Property_ScheduleCalendarTransp
- */
- static function unserialize(DOMElement $node) {
-
- $value = null;
- foreach($node->childNodes as $childNode) {
- switch(Sabre_DAV_XMLUtil::toClarkNotation($childNode)) {
- case '{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}opaque' :
- $value = self::OPAQUE;
- break;
- case '{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}transparent' :
- $value = self::TRANSPARENT;
- break;
- }
- }
- if (is_null($value))
- return null;
-
- return new self($value);
-
- }
-}
diff --git a/3rdparty/Sabre/CalDAV/Property/SupportedCalendarComponentSet.php b/3rdparty/Sabre/CalDAV/Property/SupportedCalendarComponentSet.php
deleted file mode 100644
index 2ea078d7dac..00000000000
--- a/3rdparty/Sabre/CalDAV/Property/SupportedCalendarComponentSet.php
+++ /dev/null
@@ -1,85 +0,0 @@
-<?php
-
-/**
- * Supported component set property
- *
- * This property is a representation of the supported-calendar_component-set
- * property in the CalDAV namespace. It simply requires an array of components,
- * such as VEVENT, VTODO
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CalDAV_Property_SupportedCalendarComponentSet extends Sabre_DAV_Property {
-
- /**
- * List of supported components, such as "VEVENT, VTODO"
- *
- * @var array
- */
- private $components;
-
- /**
- * Creates the property
- *
- * @param array $components
- */
- public function __construct(array $components) {
-
- $this->components = $components;
-
- }
-
- /**
- * Returns the list of supported components
- *
- * @return array
- */
- public function getValue() {
-
- return $this->components;
-
- }
-
- /**
- * Serializes the property in a DOMDocument
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $node
- * @return void
- */
- public function serialize(Sabre_DAV_Server $server,DOMElement $node) {
-
- $doc = $node->ownerDocument;
- foreach($this->components as $component) {
-
- $xcomp = $doc->createElement('cal:comp');
- $xcomp->setAttribute('name',$component);
- $node->appendChild($xcomp);
-
- }
-
- }
-
- /**
- * Unserializes the DOMElement back into a Property class.
- *
- * @param DOMElement $node
- * @return Sabre_CalDAV_Property_SupportedCalendarComponentSet
- */
- static function unserialize(DOMElement $node) {
-
- $components = array();
- foreach($node->childNodes as $childNode) {
- if (Sabre_DAV_XMLUtil::toClarkNotation($childNode)==='{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}comp') {
- $components[] = $childNode->getAttribute('name');
- }
- }
- return new self($components);
-
- }
-
-}
diff --git a/3rdparty/Sabre/CalDAV/Property/SupportedCalendarData.php b/3rdparty/Sabre/CalDAV/Property/SupportedCalendarData.php
deleted file mode 100644
index 1d848dd5cf6..00000000000
--- a/3rdparty/Sabre/CalDAV/Property/SupportedCalendarData.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-
-/**
- * Supported-calendar-data property
- *
- * This property is a representation of the supported-calendar-data property
- * in the CalDAV namespace. SabreDAV only has support for text/calendar;2.0
- * so the value is currently hardcoded.
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CalDAV_Property_SupportedCalendarData extends Sabre_DAV_Property {
-
- /**
- * Serializes the property in a DOMDocument
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $node
- * @return void
- */
- public function serialize(Sabre_DAV_Server $server,DOMElement $node) {
-
- $doc = $node->ownerDocument;
-
- $prefix = isset($server->xmlNamespaces[Sabre_CalDAV_Plugin::NS_CALDAV])?$server->xmlNamespaces[Sabre_CalDAV_Plugin::NS_CALDAV]:'cal';
-
- $caldata = $doc->createElement($prefix . ':calendar-data');
- $caldata->setAttribute('content-type','text/calendar');
- $caldata->setAttribute('version','2.0');
-
- $node->appendChild($caldata);
- }
-
-}
diff --git a/3rdparty/Sabre/CalDAV/Property/SupportedCollationSet.php b/3rdparty/Sabre/CalDAV/Property/SupportedCollationSet.php
deleted file mode 100644
index 24e84d4c17d..00000000000
--- a/3rdparty/Sabre/CalDAV/Property/SupportedCollationSet.php
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-
-/**
- * supported-collation-set property
- *
- * This property is a representation of the supported-collation-set property
- * in the CalDAV namespace.
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CalDAV_Property_SupportedCollationSet extends Sabre_DAV_Property {
-
- /**
- * Serializes the property in a DOM document
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $node
- * @return void
- */
- public function serialize(Sabre_DAV_Server $server,DOMElement $node) {
-
- $doc = $node->ownerDocument;
-
- $prefix = $node->lookupPrefix('urn:ietf:params:xml:ns:caldav');
- if (!$prefix) $prefix = 'cal';
-
- $node->appendChild(
- $doc->createElement($prefix . ':supported-collation','i;ascii-casemap')
- );
- $node->appendChild(
- $doc->createElement($prefix . ':supported-collation','i;octet')
- );
- $node->appendChild(
- $doc->createElement($prefix . ':supported-collation','i;unicode-casemap')
- );
-
-
- }
-
-}
diff --git a/3rdparty/Sabre/CalDAV/Schedule/IMip.php b/3rdparty/Sabre/CalDAV/Schedule/IMip.php
deleted file mode 100644
index 92c3c097c15..00000000000
--- a/3rdparty/Sabre/CalDAV/Schedule/IMip.php
+++ /dev/null
@@ -1,110 +0,0 @@
-<?php
-
-use Sabre\VObject;
-
-/**
- * iMIP handler.
- *
- * This class is responsible for sending out iMIP messages. iMIP is the
- * email-based transport for iTIP. iTIP deals with scheduling operations for
- * iCalendar objects.
- *
- * If you want to customize the email that gets sent out, you can do so by
- * extending this class and overriding the sendMessage method.
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CalDAV_Schedule_IMip {
-
- /**
- * Email address used in From: header.
- *
- * @var string
- */
- protected $senderEmail;
-
- /**
- * Creates the email handler.
- *
- * @param string $senderEmail. The 'senderEmail' is the email that shows up
- * in the 'From:' address. This should
- * generally be some kind of no-reply email
- * address you own.
- */
- public function __construct($senderEmail) {
-
- $this->senderEmail = $senderEmail;
-
- }
-
- /**
- * Sends one or more iTip messages through email.
- *
- * @param string $originator Originator Email
- * @param array $recipients Array of email addresses
- * @param Sabre\VObject\Component $vObject
- * @param string $principal Principal Url of the originator
- * @return void
- */
- public function sendMessage($originator, array $recipients, VObject\Component $vObject, $principal) {
-
- foreach($recipients as $recipient) {
-
- $to = $recipient;
- $replyTo = $originator;
- $subject = 'SabreDAV iTIP message';
-
- switch(strtoupper($vObject->METHOD)) {
- case 'REPLY' :
- $subject = 'Response for: ' . $vObject->VEVENT->SUMMARY;
- break;
- case 'REQUEST' :
- $subject = 'Invitation for: ' .$vObject->VEVENT->SUMMARY;
- break;
- case 'CANCEL' :
- $subject = 'Cancelled event: ' . $vObject->VEVENT->SUMMARY;
- break;
- }
-
- $headers = array();
- $headers[] = 'Reply-To: ' . $replyTo;
- $headers[] = 'From: ' . $this->senderEmail;
- $headers[] = 'Content-Type: text/calendar; method=' . (string)$vObject->method . '; charset=utf-8';
- if (Sabre_DAV_Server::$exposeVersion) {
- $headers[] = 'X-Sabre-Version: ' . Sabre_DAV_Version::VERSION . '-' . Sabre_DAV_Version::STABILITY;
- }
-
- $vcalBody = $vObject->serialize();
-
- $this->mail($to, $subject, $vcalBody, $headers);
-
- }
-
- }
-
- // @codeCoverageIgnoreStart
- // This is deemed untestable in a reasonable manner
-
- /**
- * This function is reponsible for sending the actual email.
- *
- * @param string $to Recipient email address
- * @param string $subject Subject of the email
- * @param string $body iCalendar body
- * @param array $headers List of headers
- * @return void
- */
- protected function mail($to, $subject, $body, array $headers) {
-
-
- mail($to, $subject, $body, implode("\r\n", $headers));
-
- }
-
- // @codeCoverageIgnoreEnd
-
-}
diff --git a/3rdparty/Sabre/CalDAV/Schedule/IOutbox.php b/3rdparty/Sabre/CalDAV/Schedule/IOutbox.php
deleted file mode 100644
index 46d77514bc0..00000000000
--- a/3rdparty/Sabre/CalDAV/Schedule/IOutbox.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-
-/**
- * Implement this interface to have a node be recognized as a CalDAV scheduling
- * outbox.
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-interface Sabre_CalDAV_Schedule_IOutbox extends Sabre_DAV_ICollection, Sabre_DAVACL_IACL {
-
-
-}
diff --git a/3rdparty/Sabre/CalDAV/Schedule/Outbox.php b/3rdparty/Sabre/CalDAV/Schedule/Outbox.php
deleted file mode 100644
index 462aa527e23..00000000000
--- a/3rdparty/Sabre/CalDAV/Schedule/Outbox.php
+++ /dev/null
@@ -1,160 +0,0 @@
-<?php
-
-/**
- * The CalDAV scheduling outbox
- *
- * The outbox is mainly used as an endpoint in the tree for a client to do
- * free-busy requests. This functionality is completely handled by the
- * Scheduling plugin, so this object is actually mostly static.
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CalDAV_Schedule_Outbox extends Sabre_DAV_Collection implements Sabre_CalDAV_Schedule_IOutbox {
-
- /**
- * The principal Uri
- *
- * @var string
- */
- protected $principalUri;
-
- /**
- * Constructor
- *
- * @param string $principalUri
- */
- public function __construct($principalUri) {
-
- $this->principalUri = $principalUri;
-
- }
-
- /**
- * Returns the name of the node.
- *
- * This is used to generate the url.
- *
- * @return string
- */
- public function getName() {
-
- return 'outbox';
-
- }
-
- /**
- * Returns an array with all the child nodes
- *
- * @return Sabre_DAV_INode[]
- */
- public function getChildren() {
-
- return array();
-
- }
-
- /**
- * Returns the owner principal
- *
- * This must be a url to a principal, or null if there's no owner
- *
- * @return string|null
- */
- public function getOwner() {
-
- return $this->principalUri;
-
- }
-
- /**
- * Returns a group principal
- *
- * This must be a url to a principal, or null if there's no owner
- *
- * @return string|null
- */
- public function getGroup() {
-
- return null;
-
- }
-
- /**
- * Returns a list of ACE's for this node.
- *
- * Each ACE has the following properties:
- * * 'privilege', a string such as {DAV:}read or {DAV:}write. These are
- * currently the only supported privileges
- * * 'principal', a url to the principal who owns the node
- * * 'protected' (optional), indicating that this ACE is not allowed to
- * be updated.
- *
- * @return array
- */
- public function getACL() {
-
- return array(
- array(
- 'privilege' => '{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}schedule-query-freebusy',
- 'principal' => $this->getOwner(),
- 'protected' => true,
- ),
- array(
- 'privilege' => '{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}schedule-post-vevent',
- 'principal' => $this->getOwner(),
- 'protected' => true,
- ),
- array(
- 'privilege' => '{DAV:}read',
- 'principal' => $this->getOwner(),
- 'protected' => true,
- ),
- );
-
- }
-
- /**
- * Updates the ACL
- *
- * This method will receive a list of new ACE's.
- *
- * @param array $acl
- * @return void
- */
- public function setACL(array $acl) {
-
- throw new Sabre_DAV_Exception_MethodNotAllowed('You\'re not allowed to update the ACL');
-
- }
-
- /**
- * Returns the list of supported privileges for this node.
- *
- * The returned data structure is a list of nested privileges.
- * See Sabre_DAVACL_Plugin::getDefaultSupportedPrivilegeSet for a simple
- * standard structure.
- *
- * If null is returned from this method, the default privilege set is used,
- * which is fine for most common usecases.
- *
- * @return array|null
- */
- public function getSupportedPrivilegeSet() {
-
- $default = Sabre_DAVACL_Plugin::getDefaultSupportedPrivilegeSet();
- $default['aggregates'][] = array(
- 'privilege' => '{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}schedule-query-freebusy',
- );
- $default['aggregates'][] = array(
- 'privilege' => '{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}schedule-post-vevent',
- );
-
- return $default;
-
- }
-
-}
diff --git a/3rdparty/Sabre/CalDAV/ShareableCalendar.php b/3rdparty/Sabre/CalDAV/ShareableCalendar.php
deleted file mode 100644
index 0e44885c621..00000000000
--- a/3rdparty/Sabre/CalDAV/ShareableCalendar.php
+++ /dev/null
@@ -1,72 +0,0 @@
-<?php
-
-/**
- * This object represents a CalDAV calendar that can be shared with other
- * users.
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CalDAV_ShareableCalendar extends Sabre_CalDAV_Calendar implements Sabre_CalDAV_IShareableCalendar {
-
- /**
- * Updates the list of shares.
- *
- * The first array is a list of people that are to be added to the
- * calendar.
- *
- * Every element in the add array has the following properties:
- * * href - A url. Usually a mailto: address
- * * commonName - Usually a first and last name, or false
- * * summary - A description of the share, can also be false
- * * readOnly - A boolean value
- *
- * Every element in the remove array is just the address string.
- *
- * @param array $add
- * @param array $remove
- * @return void
- */
- public function updateShares(array $add, array $remove) {
-
- $this->caldavBackend->updateShares($this->calendarInfo['id'], $add, $remove);
-
- }
-
- /**
- * Returns the list of people whom this calendar is shared with.
- *
- * Every element in this array should have the following properties:
- * * href - Often a mailto: address
- * * commonName - Optional, for example a first + last name
- * * status - See the Sabre_CalDAV_SharingPlugin::STATUS_ constants.
- * * readOnly - boolean
- * * summary - Optional, a description for the share
- *
- * @return array
- */
- public function getShares() {
-
- return $this->caldavBackend->getShares($this->calendarInfo['id']);
-
- }
-
- /**
- * Marks this calendar as published.
- *
- * Publishing a calendar should automatically create a read-only, public,
- * subscribable calendar.
- *
- * @param bool $value
- * @return void
- */
- public function setPublishStatus($value) {
-
- $this->caldavBackend->setPublishStatus($this->calendarInfo['id'], $value);
-
- }
-
-}
diff --git a/3rdparty/Sabre/CalDAV/SharedCalendar.php b/3rdparty/Sabre/CalDAV/SharedCalendar.php
deleted file mode 100644
index 9000697d3ec..00000000000
--- a/3rdparty/Sabre/CalDAV/SharedCalendar.php
+++ /dev/null
@@ -1,98 +0,0 @@
-<?php
-
-/**
- * This object represents a CalDAV calendar that is shared by a different user.
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CalDAV_SharedCalendar extends Sabre_CalDAV_Calendar implements Sabre_CalDAV_ISharedCalendar {
-
- /**
- * Constructor
- *
- * @param Sabre_DAVACL_IPrincipalBackend $principalBackend
- * @param Sabre_CalDAV_Backend_BackendInterface $caldavBackend
- * @param array $calendarInfo
- */
- public function __construct(Sabre_DAVACL_IPrincipalBackend $principalBackend, Sabre_CalDAV_Backend_BackendInterface $caldavBackend, $calendarInfo) {
-
- $required = array(
- '{http://calendarserver.org/ns/}shared-url',
- '{http://sabredav.org/ns}owner-principal',
- '{http://sabredav.org/ns}read-only',
- );
- foreach($required as $r) {
- if (!isset($calendarInfo[$r])) {
- throw new InvalidArgumentException('The ' . $r . ' property must be specified for SharedCalendar(s)');
- }
- }
-
- parent::__construct($principalBackend, $caldavBackend, $calendarInfo);
-
- }
-
- /**
- * This method should return the url of the owners' copy of the shared
- * calendar.
- *
- * @return string
- */
- public function getSharedUrl() {
-
- return $this->calendarInfo['{http://calendarserver.org/ns/}shared-url'];
-
- }
-
- /**
- * Returns the owner principal
- *
- * This must be a url to a principal, or null if there's no owner
- *
- * @return string|null
- */
- public function getOwner() {
-
- return $this->calendarInfo['{http://sabredav.org/ns}owner-principal'];
-
- }
-
- /**
- * Returns a list of ACE's for this node.
- *
- * Each ACE has the following properties:
- * * 'privilege', a string such as {DAV:}read or {DAV:}write. These are
- * currently the only supported privileges
- * * 'principal', a url to the principal who owns the node
- * * 'protected' (optional), indicating that this ACE is not allowed to
- * be updated.
- *
- * @return array
- */
- public function getACL() {
-
- // The top-level ACL only contains access information for the true
- // owner of the calendar, so we need to add the information for the
- // sharee.
- $acl = parent::getACL();
- $acl[] = array(
- 'privilege' => '{DAV:}read',
- 'principal' => $this->calendarInfo['principaluri'],
- 'protected' => true,
- );
- if (!$this->calendarInfo['{http://sabredav.org/ns}read-only']) {
- $acl[] = array(
- 'privilege' => '{DAV:}write',
- 'principal' => $this->calendarInfo['principaluri'],
- 'protected' => true,
- );
- }
- return $acl;
-
- }
-
-
-}
diff --git a/3rdparty/Sabre/CalDAV/SharingPlugin.php b/3rdparty/Sabre/CalDAV/SharingPlugin.php
deleted file mode 100644
index 31df8057b24..00000000000
--- a/3rdparty/Sabre/CalDAV/SharingPlugin.php
+++ /dev/null
@@ -1,475 +0,0 @@
-<?php
-
-/**
- * This plugin implements support for caldav sharing.
- *
- * This spec is defined at:
- * http://svn.calendarserver.org/repository/calendarserver/CalendarServer/trunk/doc/Extensions/caldav-sharing.txt
- *
- * See:
- * Sabre_CalDAV_Backend_SharingSupport for all the documentation.
- *
- * Note: This feature is experimental, and may change in between different
- * SabreDAV versions.
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CalDAV_SharingPlugin extends Sabre_DAV_ServerPlugin {
-
- /**
- * These are the various status constants used by sharing-messages.
- */
- const STATUS_ACCEPTED = 1;
- const STATUS_DECLINED = 2;
- const STATUS_DELETED = 3;
- const STATUS_NORESPONSE = 4;
- const STATUS_INVALID = 5;
-
- /**
- * Reference to SabreDAV server object.
- *
- * @var Sabre_DAV_Server
- */
- protected $server;
-
- /**
- * This method should return a list of server-features.
- *
- * This is for example 'versioning' and is added to the DAV: header
- * in an OPTIONS response.
- *
- * @return array
- */
- public function getFeatures() {
-
- return array('calendarserver-sharing');
-
- }
-
- /**
- * Returns a plugin name.
- *
- * Using this name other plugins will be able to access other plugins
- * using Sabre_DAV_Server::getPlugin
- *
- * @return string
- */
- public function getPluginName() {
-
- return 'caldav-sharing';
-
- }
-
- /**
- * This initializes the plugin.
- *
- * This function is called by Sabre_DAV_Server, after
- * addPlugin is called.
- *
- * This method should set up the required event subscriptions.
- *
- * @param Sabre_DAV_Server $server
- * @return void
- */
- public function initialize(Sabre_DAV_Server $server) {
-
- $this->server = $server;
- //$server->resourceTypeMapping['Sabre_CalDAV_IShareableCalendar'] = '{' . Sabre_CalDAV_Plugin::NS_CALENDARSERVER . '}shared-owner';
- $server->resourceTypeMapping['Sabre_CalDAV_ISharedCalendar'] = '{' . Sabre_CalDAV_Plugin::NS_CALENDARSERVER . '}shared';
-
- array_push(
- $this->server->protectedProperties,
- '{' . Sabre_CalDAV_Plugin::NS_CALENDARSERVER . '}invite',
- '{' . Sabre_CalDAV_Plugin::NS_CALENDARSERVER . '}allowed-sharing-modes',
- '{' . Sabre_CalDAV_Plugin::NS_CALENDARSERVER . '}shared-url'
- );
-
- $this->server->subscribeEvent('beforeGetProperties', array($this, 'beforeGetProperties'));
- $this->server->subscribeEvent('afterGetProperties', array($this, 'afterGetProperties'));
- $this->server->subscribeEvent('updateProperties', array($this, 'updateProperties'));
- $this->server->subscribeEvent('unknownMethod', array($this,'unknownMethod'));
-
- }
-
- /**
- * This event is triggered when properties are requested for a certain
- * node.
- *
- * This allows us to inject any properties early.
- *
- * @param string $path
- * @param Sabre_DAV_INode $node
- * @param array $requestedProperties
- * @param array $returnedProperties
- * @return void
- */
- public function beforeGetProperties($path, Sabre_DAV_INode $node, &$requestedProperties, &$returnedProperties) {
-
- if ($node instanceof Sabre_CalDAV_IShareableCalendar) {
- if (($index = array_search('{' . Sabre_CalDAV_Plugin::NS_CALENDARSERVER . '}invite', $requestedProperties))!==false) {
-
- unset($requestedProperties[$index]);
- $returnedProperties[200]['{' . Sabre_CalDAV_Plugin::NS_CALENDARSERVER . '}invite'] =
- new Sabre_CalDAV_Property_Invite(
- $node->getShares()
- );
-
- }
-
- }
- if ($node instanceof Sabre_CalDAV_ISharedCalendar) {
- if (($index = array_search('{' . Sabre_CalDAV_Plugin::NS_CALENDARSERVER . '}shared-url', $requestedProperties))!==false) {
-
- unset($requestedProperties[$index]);
- $returnedProperties[200]['{' . Sabre_CalDAV_Plugin::NS_CALENDARSERVER . '}shared-url'] =
- new Sabre_DAV_Property_Href(
- $node->getSharedUrl()
- );
-
- }
-
- }
-
- }
-
- /**
- * This method is triggered *after* all properties have been retrieved.
- * This allows us to inject the correct resourcetype for calendars that
- * have been shared.
- *
- * @param string $path
- * @param array $properties
- * @param Sabre_DAV_INode $node
- * @return void
- */
- public function afterGetProperties($path, &$properties, Sabre_DAV_INode $node) {
-
- if ($node instanceof Sabre_CalDAV_IShareableCalendar) {
- if (isset($properties[200]['{DAV:}resourcetype'])) {
- if (count($node->getShares())>0) {
- $properties[200]['{DAV:}resourcetype']->add(
- '{' . Sabre_CalDAV_Plugin::NS_CALENDARSERVER . '}shared-owner'
- );
- }
- }
- $propName = '{' . Sabre_CalDAV_Plugin::NS_CALENDARSERVER . '}allowed-sharing-modes';
- if (array_key_exists($propName, $properties[404])) {
- unset($properties[404][$propName]);
- $properties[200][$propName] = new Sabre_CalDAV_Property_AllowedSharingModes(true,false);
- }
-
- }
-
- }
-
- /**
- * This method is trigged when a user attempts to update a node's
- * properties.
- *
- * A previous draft of the sharing spec stated that it was possible to use
- * PROPPATCH to remove 'shared-owner' from the resourcetype, thus unsharing
- * the calendar.
- *
- * Even though this is no longer in the current spec, we keep this around
- * because OS X 10.7 may still make use of this feature.
- *
- * @param array $mutations
- * @param array $result
- * @param Sabre_DAV_INode $node
- * @return void
- */
- public function updateProperties(array &$mutations, array &$result, Sabre_DAV_INode $node) {
-
- if (!$node instanceof Sabre_CalDAV_IShareableCalendar)
- return;
-
- if (!isset($mutations['{DAV:}resourcetype'])) {
- return;
- }
-
- // Only doing something if shared-owner is indeed not in the list.
- if($mutations['{DAV:}resourcetype']->is('{' . Sabre_CalDAV_Plugin::NS_CALENDARSERVER . '}shared-owner')) return;
-
- $shares = $node->getShares();
- $remove = array();
- foreach($shares as $share) {
- $remove[] = $share['href'];
- }
- $node->updateShares(array(), $remove);
-
- // We're marking this update as 200 OK
- $result[200]['{DAV:}resourcetype'] = null;
-
- // Removing it from the mutations list
- unset($mutations['{DAV:}resourcetype']);
-
- }
-
- /**
- * This event is triggered when the server didn't know how to handle a
- * certain request.
- *
- * We intercept this to handle POST requests on calendars.
- *
- * @param string $method
- * @param string $uri
- * @return null|bool
- */
- public function unknownMethod($method, $uri) {
-
- if ($method!=='POST') {
- return;
- }
-
- // Only handling xml
- $contentType = $this->server->httpRequest->getHeader('Content-Type');
- if (strpos($contentType,'application/xml')===false && strpos($contentType,'text/xml')===false)
- return;
-
- // Making sure the node exists
- try {
- $node = $this->server->tree->getNodeForPath($uri);
- } catch (Sabre_DAV_Exception_NotFound $e) {
- return;
- }
-
-
- $dom = Sabre_DAV_XMLUtil::loadDOMDocument($this->server->httpRequest->getBody(true));
-
- $documentType = Sabre_DAV_XMLUtil::toClarkNotation($dom->firstChild);
-
- switch($documentType) {
-
- // Dealing with the 'share' document, which modified invitees on a
- // calendar.
- case '{' . Sabre_CalDAV_Plugin::NS_CALENDARSERVER . '}share' :
-
- // We can only deal with IShareableCalendar objects
- if (!$node instanceof Sabre_CalDAV_IShareableCalendar) {
- return;
- }
-
- // Getting ACL info
- $acl = $this->server->getPlugin('acl');
-
- // If there's no ACL support, we allow everything
- if ($acl) {
- $acl->checkPrivileges($uri, '{DAV:}write');
- }
-
- $mutations = $this->parseShareRequest($dom);
-
- $node->updateShares($mutations[0], $mutations[1]);
-
- $this->server->httpResponse->sendStatus(200);
- // Adding this because sending a response body may cause issues,
- // and I wanted some type of indicator the response was handled.
- $this->server->httpResponse->setHeader('X-Sabre-Status', 'everything-went-well');
-
- // Breaking the event chain
- return false;
-
- // The invite-reply document is sent when the user replies to an
- // invitation of a calendar share.
- case '{'. Sabre_CalDAV_Plugin::NS_CALENDARSERVER.'}invite-reply' :
-
- // This only works on the calendar-home-root node.
- if (!$node instanceof Sabre_CalDAV_UserCalendars) {
- return;
- }
-
- // Getting ACL info
- $acl = $this->server->getPlugin('acl');
-
- // If there's no ACL support, we allow everything
- if ($acl) {
- $acl->checkPrivileges($uri, '{DAV:}write');
- }
-
- $message = $this->parseInviteReplyRequest($dom);
-
- $url = $node->shareReply(
- $message['href'],
- $message['status'],
- $message['calendarUri'],
- $message['inReplyTo'],
- $message['summary']
- );
-
- $this->server->httpResponse->sendStatus(200);
- // Adding this because sending a response body may cause issues,
- // and I wanted some type of indicator the response was handled.
- $this->server->httpResponse->setHeader('X-Sabre-Status', 'everything-went-well');
-
- if ($url) {
- $dom = new DOMDocument('1.0', 'UTF-8');
- $dom->formatOutput = true;
-
- $root = $dom->createElement('cs:shared-as');
- foreach($this->server->xmlNamespaces as $namespace => $prefix) {
- $root->setAttribute('xmlns:' . $prefix, $namespace);
- }
-
- $dom->appendChild($root);
- $href = new Sabre_DAV_Property_Href($url);
-
- $href->serialize($this->server, $root);
- $this->server->httpResponse->setHeader('Content-Type','application/xml');
- $this->server->httpResponse->sendBody($dom->saveXML());
-
- }
-
- // Breaking the event chain
- return false;
-
- case '{' . Sabre_CalDAV_Plugin::NS_CALENDARSERVER . '}publish-calendar' :
-
- // We can only deal with IShareableCalendar objects
- if (!$node instanceof Sabre_CalDAV_IShareableCalendar) {
- return;
- }
-
- // Getting ACL info
- $acl = $this->server->getPlugin('acl');
-
- // If there's no ACL support, we allow everything
- if ($acl) {
- $acl->checkPrivileges($uri, '{DAV:}write');
- }
-
- $node->setPublishStatus(true);
-
- // iCloud sends back the 202, so we will too.
- $this->server->httpResponse->sendStatus(202);
-
- // Adding this because sending a response body may cause issues,
- // and I wanted some type of indicator the response was handled.
- $this->server->httpResponse->setHeader('X-Sabre-Status', 'everything-went-well');
-
- // Breaking the event chain
- return false;
-
- case '{' . Sabre_CalDAV_Plugin::NS_CALENDARSERVER . '}unpublish-calendar' :
-
- // We can only deal with IShareableCalendar objects
- if (!$node instanceof Sabre_CalDAV_IShareableCalendar) {
- return;
- }
-
- // Getting ACL info
- $acl = $this->server->getPlugin('acl');
-
- // If there's no ACL support, we allow everything
- if ($acl) {
- $acl->checkPrivileges($uri, '{DAV:}write');
- }
-
- $node->setPublishStatus(false);
-
- $this->server->httpResponse->sendStatus(200);
-
- // Adding this because sending a response body may cause issues,
- // and I wanted some type of indicator the response was handled.
- $this->server->httpResponse->setHeader('X-Sabre-Status', 'everything-went-well');
-
- // Breaking the event chain
- return false;
-
- }
-
-
- }
-
- /**
- * Parses the 'share' POST request.
- *
- * This method returns an array, containing two arrays.
- * The first array is a list of new sharees. Every element is a struct
- * containing a:
- * * href element. (usually a mailto: address)
- * * commonName element (often a first and lastname, but can also be
- * false)
- * * readOnly (true or false)
- * * summary (A description of the share, can also be false)
- *
- * The second array is a list of sharees that are to be removed. This is
- * just a simple array with 'hrefs'.
- *
- * @param DOMDocument $dom
- * @return array
- */
- protected function parseShareRequest(DOMDocument $dom) {
-
- $xpath = new \DOMXPath($dom);
- $xpath->registerNamespace('cs', Sabre_CalDAV_Plugin::NS_CALENDARSERVER);
- $xpath->registerNamespace('d', 'DAV:');
-
-
- $set = array();
- $elems = $xpath->query('cs:set');
-
- for($i=0; $i < $elems->length; $i++) {
-
- $xset = $elems->item($i);
- $set[] = array(
- 'href' => $xpath->evaluate('string(d:href)', $xset),
- 'commonName' => $xpath->evaluate('string(cs:common-name)', $xset),
- 'summary' => $xpath->evaluate('string(cs:summary)', $xset),
- 'readOnly' => $xpath->evaluate('boolean(cs:read)', $xset)!==false
- );
-
- }
-
- $remove = array();
- $elems = $xpath->query('cs:remove');
-
- for($i=0; $i < $elems->length; $i++) {
-
- $xremove = $elems->item($i);
- $remove[] = $xpath->evaluate('string(d:href)', $xremove);
-
- }
-
- return array($set, $remove);
-
- }
-
- /**
- * Parses the 'invite-reply' POST request.
- *
- * This method returns an array, containing the following properties:
- * * href - The sharee who is replying
- * * status - One of the self::STATUS_* constants
- * * calendarUri - The url of the shared calendar
- * * inReplyTo - The unique id of the share invitation.
- * * summary - Optional description of the reply.
- *
- * @param DOMDocument $dom
- * @return array
- */
- protected function parseInviteReplyRequest(DOMDocument $dom) {
-
- $xpath = new \DOMXPath($dom);
- $xpath->registerNamespace('cs', Sabre_CalDAV_Plugin::NS_CALENDARSERVER);
- $xpath->registerNamespace('d', 'DAV:');
-
- $hostHref = $xpath->evaluate('string(cs:hosturl/d:href)');
- if (!$hostHref) {
- throw new Sabre_DAV_Exception_BadRequest('The {' . Sabre_CalDAV_Plugin::NS_CALENDARSERVER . '}hosturl/{DAV:}href element is required');
- }
-
- return array(
- 'href' => $xpath->evaluate('string(d:href)'),
- 'calendarUri' => $this->server->calculateUri($hostHref),
- 'inReplyTo' => $xpath->evaluate('string(cs:in-reply-to)'),
- 'summary' => $xpath->evaluate('string(cs:summary)'),
- 'status' => $xpath->evaluate('boolean(cs:invite-accepted)')?self::STATUS_ACCEPTED:self::STATUS_DECLINED
- );
-
- }
-
-}
diff --git a/3rdparty/Sabre/CalDAV/UserCalendars.php b/3rdparty/Sabre/CalDAV/UserCalendars.php
deleted file mode 100644
index 3194e6677ab..00000000000
--- a/3rdparty/Sabre/CalDAV/UserCalendars.php
+++ /dev/null
@@ -1,348 +0,0 @@
-<?php
-
-/**
- * The UserCalenders class contains all calendars associated to one user
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CalDAV_UserCalendars implements Sabre_DAV_IExtendedCollection, Sabre_DAVACL_IACL {
-
- /**
- * Principal backend
- *
- * @var Sabre_DAVACL_IPrincipalBackend
- */
- protected $principalBackend;
-
- /**
- * CalDAV backend
- *
- * @var Sabre_CalDAV_Backend_BackendInterface
- */
- protected $caldavBackend;
-
- /**
- * Principal information
- *
- * @var array
- */
- protected $principalInfo;
-
- /**
- * Constructor
- *
- * @param Sabre_DAVACL_IPrincipalBackend $principalBackend
- * @param Sabre_CalDAV_Backend_BackendInterface $caldavBackend
- * @param mixed $userUri
- */
- public function __construct(Sabre_DAVACL_IPrincipalBackend $principalBackend, Sabre_CalDAV_Backend_BackendInterface $caldavBackend, $userUri) {
-
- $this->principalBackend = $principalBackend;
- $this->caldavBackend = $caldavBackend;
- $this->principalInfo = $principalBackend->getPrincipalByPath($userUri);
-
- }
-
- /**
- * Returns the name of this object
- *
- * @return string
- */
- public function getName() {
-
- list(,$name) = Sabre_DAV_URLUtil::splitPath($this->principalInfo['uri']);
- return $name;
-
- }
-
- /**
- * Updates the name of this object
- *
- * @param string $name
- * @return void
- */
- public function setName($name) {
-
- throw new Sabre_DAV_Exception_Forbidden();
-
- }
-
- /**
- * Deletes this object
- *
- * @return void
- */
- public function delete() {
-
- throw new Sabre_DAV_Exception_Forbidden();
-
- }
-
- /**
- * Returns the last modification date
- *
- * @return int
- */
- public function getLastModified() {
-
- return null;
-
- }
-
- /**
- * Creates a new file under this object.
- *
- * This is currently not allowed
- *
- * @param string $filename
- * @param resource $data
- * @return void
- */
- public function createFile($filename, $data=null) {
-
- throw new Sabre_DAV_Exception_MethodNotAllowed('Creating new files in this collection is not supported');
-
- }
-
- /**
- * Creates a new directory under this object.
- *
- * This is currently not allowed.
- *
- * @param string $filename
- * @return void
- */
- public function createDirectory($filename) {
-
- throw new Sabre_DAV_Exception_MethodNotAllowed('Creating new collections in this collection is not supported');
-
- }
-
- /**
- * Returns a single calendar, by name
- *
- * @param string $name
- * @todo needs optimizing
- * @return Sabre_CalDAV_Calendar
- */
- public function getChild($name) {
-
- foreach($this->getChildren() as $child) {
- if ($name==$child->getName())
- return $child;
-
- }
- throw new Sabre_DAV_Exception_NotFound('Calendar with name \'' . $name . '\' could not be found');
-
- }
-
- /**
- * Checks if a calendar exists.
- *
- * @param string $name
- * @todo needs optimizing
- * @return bool
- */
- public function childExists($name) {
-
- foreach($this->getChildren() as $child) {
- if ($name==$child->getName())
- return true;
-
- }
- return false;
-
- }
-
- /**
- * Returns a list of calendars
- *
- * @return array
- */
- public function getChildren() {
-
- $calendars = $this->caldavBackend->getCalendarsForUser($this->principalInfo['uri']);
- $objs = array();
- foreach($calendars as $calendar) {
- if ($this->caldavBackend instanceof Sabre_CalDAV_Backend_SharingSupport) {
- if (isset($calendar['{http://calendarserver.org/ns/}shared-url'])) {
- $objs[] = new Sabre_CalDAV_SharedCalendar($this->principalBackend, $this->caldavBackend, $calendar);
- } else {
- $objs[] = new Sabre_CalDAV_ShareableCalendar($this->principalBackend, $this->caldavBackend, $calendar);
- }
- } else {
- $objs[] = new Sabre_CalDAV_Calendar($this->principalBackend, $this->caldavBackend, $calendar);
- }
- }
- $objs[] = new Sabre_CalDAV_Schedule_Outbox($this->principalInfo['uri']);
-
- // We're adding a notifications node, if it's supported by the backend.
- if ($this->caldavBackend instanceof Sabre_CalDAV_Backend_NotificationSupport) {
- $objs[] = new Sabre_CalDAV_Notifications_Collection($this->caldavBackend, $this->principalInfo['uri']);
- }
- return $objs;
-
- }
-
- /**
- * Creates a new calendar
- *
- * @param string $name
- * @param array $resourceType
- * @param array $properties
- * @return void
- */
- public function createExtendedCollection($name, array $resourceType, array $properties) {
-
- $isCalendar = false;
- foreach($resourceType as $rt) {
- switch ($rt) {
- case '{DAV:}collection' :
- case '{http://calendarserver.org/ns/}shared-owner' :
- // ignore
- break;
- case '{urn:ietf:params:xml:ns:caldav}calendar' :
- $isCalendar = true;
- break;
- default :
- throw new Sabre_DAV_Exception_InvalidResourceType('Unknown resourceType: ' . $rt);
- }
- }
- if (!$isCalendar) {
- throw new Sabre_DAV_Exception_InvalidResourceType('You can only create calendars in this collection');
- }
- $this->caldavBackend->createCalendar($this->principalInfo['uri'], $name, $properties);
-
- }
-
- /**
- * Returns the owner principal
- *
- * This must be a url to a principal, or null if there's no owner
- *
- * @return string|null
- */
- public function getOwner() {
-
- return $this->principalInfo['uri'];
-
- }
-
- /**
- * Returns a group principal
- *
- * This must be a url to a principal, or null if there's no owner
- *
- * @return string|null
- */
- public function getGroup() {
-
- return null;
-
- }
-
- /**
- * Returns a list of ACE's for this node.
- *
- * Each ACE has the following properties:
- * * 'privilege', a string such as {DAV:}read or {DAV:}write. These are
- * currently the only supported privileges
- * * 'principal', a url to the principal who owns the node
- * * 'protected' (optional), indicating that this ACE is not allowed to
- * be updated.
- *
- * @return array
- */
- public function getACL() {
-
- return array(
- array(
- 'privilege' => '{DAV:}read',
- 'principal' => $this->principalInfo['uri'],
- 'protected' => true,
- ),
- array(
- 'privilege' => '{DAV:}write',
- 'principal' => $this->principalInfo['uri'],
- 'protected' => true,
- ),
- array(
- 'privilege' => '{DAV:}read',
- 'principal' => $this->principalInfo['uri'] . '/calendar-proxy-write',
- 'protected' => true,
- ),
- array(
- 'privilege' => '{DAV:}write',
- 'principal' => $this->principalInfo['uri'] . '/calendar-proxy-write',
- 'protected' => true,
- ),
- array(
- 'privilege' => '{DAV:}read',
- 'principal' => $this->principalInfo['uri'] . '/calendar-proxy-read',
- 'protected' => true,
- ),
-
- );
-
- }
-
- /**
- * Updates the ACL
- *
- * This method will receive a list of new ACE's.
- *
- * @param array $acl
- * @return void
- */
- public function setACL(array $acl) {
-
- throw new Sabre_DAV_Exception_MethodNotAllowed('Changing ACL is not yet supported');
-
- }
-
- /**
- * Returns the list of supported privileges for this node.
- *
- * The returned data structure is a list of nested privileges.
- * See Sabre_DAVACL_Plugin::getDefaultSupportedPrivilegeSet for a simple
- * standard structure.
- *
- * If null is returned from this method, the default privilege set is used,
- * which is fine for most common usecases.
- *
- * @return array|null
- */
- public function getSupportedPrivilegeSet() {
-
- return null;
-
- }
-
- /**
- * This method is called when a user replied to a request to share.
- *
- * This method should return the url of the newly created calendar if the
- * share was accepted.
- *
- * @param string href The sharee who is replying (often a mailto: address)
- * @param int status One of the SharingPlugin::STATUS_* constants
- * @param string $calendarUri The url to the calendar thats being shared
- * @param string $inReplyTo The unique id this message is a response to
- * @param string $summary A description of the reply
- * @return null|string
- */
- public function shareReply($href, $status, $calendarUri, $inReplyTo, $summary = null) {
-
- if (!$this->caldavBackend instanceof Sabre_CalDAV_Backend_SharingSupport) {
- throw new Sabre_DAV_Exception_NotImplemented('Sharing support is not implemented by this backend.');
- }
-
- return $this->caldavBackend->shareReply($href, $status, $calendarUri, $inReplyTo, $summary);
-
- }
-
-}
diff --git a/3rdparty/Sabre/CalDAV/Version.php b/3rdparty/Sabre/CalDAV/Version.php
deleted file mode 100644
index 0ad14fa0869..00000000000
--- a/3rdparty/Sabre/CalDAV/Version.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-/**
- * This class contains the Sabre_CalDAV version constants.
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CalDAV_Version {
-
- /**
- * Full version number
- */
- const VERSION = '1.7.0';
-
- /**
- * Stability : alpha, beta, stable
- */
- const STABILITY = 'stable';
-
-}
diff --git a/3rdparty/Sabre/CalDAV/includes.php b/3rdparty/Sabre/CalDAV/includes.php
deleted file mode 100644
index 8b38e398f65..00000000000
--- a/3rdparty/Sabre/CalDAV/includes.php
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-
-/**
- * Sabre_CalDAV includes file
- *
- * Including this file will automatically include all files from the
- * Sabre_CalDAV package.
- *
- * This often allows faster loadtimes, as autoload-speed is often quite slow.
- *
- * @package Sabre
- * @subpackage CalDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-
-// Begin includes
-include __DIR__ . '/Backend/BackendInterface.php';
-include __DIR__ . '/Backend/NotificationSupport.php';
-include __DIR__ . '/Backend/SharingSupport.php';
-include __DIR__ . '/CalendarQueryParser.php';
-include __DIR__ . '/CalendarQueryValidator.php';
-include __DIR__ . '/CalendarRootNode.php';
-include __DIR__ . '/Exception/InvalidComponentType.php';
-include __DIR__ . '/ICalendar.php';
-include __DIR__ . '/ICalendarObject.php';
-include __DIR__ . '/ICSExportPlugin.php';
-include __DIR__ . '/IShareableCalendar.php';
-include __DIR__ . '/ISharedCalendar.php';
-include __DIR__ . '/Notifications/ICollection.php';
-include __DIR__ . '/Notifications/INode.php';
-include __DIR__ . '/Notifications/INotificationType.php';
-include __DIR__ . '/Notifications/Node.php';
-include __DIR__ . '/Notifications/Notification/Invite.php';
-include __DIR__ . '/Notifications/Notification/InviteReply.php';
-include __DIR__ . '/Notifications/Notification/SystemStatus.php';
-include __DIR__ . '/Plugin.php';
-include __DIR__ . '/Principal/Collection.php';
-include __DIR__ . '/Principal/ProxyRead.php';
-include __DIR__ . '/Principal/ProxyWrite.php';
-include __DIR__ . '/Principal/User.php';
-include __DIR__ . '/Property/AllowedSharingModes.php';
-include __DIR__ . '/Property/Invite.php';
-include __DIR__ . '/Property/ScheduleCalendarTransp.php';
-include __DIR__ . '/Property/SupportedCalendarComponentSet.php';
-include __DIR__ . '/Property/SupportedCalendarData.php';
-include __DIR__ . '/Property/SupportedCollationSet.php';
-include __DIR__ . '/Schedule/IMip.php';
-include __DIR__ . '/Schedule/IOutbox.php';
-include __DIR__ . '/Schedule/Outbox.php';
-include __DIR__ . '/SharingPlugin.php';
-include __DIR__ . '/UserCalendars.php';
-include __DIR__ . '/Version.php';
-include __DIR__ . '/Backend/Abstract.php';
-include __DIR__ . '/Backend/PDO.php';
-include __DIR__ . '/Calendar.php';
-include __DIR__ . '/CalendarObject.php';
-include __DIR__ . '/Notifications/Collection.php';
-include __DIR__ . '/ShareableCalendar.php';
-include __DIR__ . '/SharedCalendar.php';
-// End includes
diff --git a/3rdparty/Sabre/CardDAV/AddressBook.php b/3rdparty/Sabre/CardDAV/AddressBook.php
deleted file mode 100644
index 8d545114d97..00000000000
--- a/3rdparty/Sabre/CardDAV/AddressBook.php
+++ /dev/null
@@ -1,312 +0,0 @@
-<?php
-
-/**
- * The AddressBook class represents a CardDAV addressbook, owned by a specific user
- *
- * The AddressBook can contain multiple vcards
- *
- * @package Sabre
- * @subpackage CardDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CardDAV_AddressBook extends Sabre_DAV_Collection implements Sabre_CardDAV_IAddressBook, Sabre_DAV_IProperties, Sabre_DAVACL_IACL {
-
- /**
- * This is an array with addressbook information
- *
- * @var array
- */
- private $addressBookInfo;
-
- /**
- * CardDAV backend
- *
- * @var Sabre_CardDAV_Backend_Abstract
- */
- private $carddavBackend;
-
- /**
- * Constructor
- *
- * @param Sabre_CardDAV_Backend_Abstract $carddavBackend
- * @param array $addressBookInfo
- */
- public function __construct(Sabre_CardDAV_Backend_Abstract $carddavBackend, array $addressBookInfo) {
-
- $this->carddavBackend = $carddavBackend;
- $this->addressBookInfo = $addressBookInfo;
-
- }
-
- /**
- * Returns the name of the addressbook
- *
- * @return string
- */
- public function getName() {
-
- return $this->addressBookInfo['uri'];
-
- }
-
- /**
- * Returns a card
- *
- * @param string $name
- * @return Sabre_CardDAV_ICard
- */
- public function getChild($name) {
-
- $obj = $this->carddavBackend->getCard($this->addressBookInfo['id'],$name);
- if (!$obj) throw new Sabre_DAV_Exception_NotFound('Card not found');
- return new Sabre_CardDAV_Card($this->carddavBackend,$this->addressBookInfo,$obj);
-
- }
-
- /**
- * Returns the full list of cards
- *
- * @return array
- */
- public function getChildren() {
-
- $objs = $this->carddavBackend->getCards($this->addressBookInfo['id']);
- $children = array();
- foreach($objs as $obj) {
- $children[] = new Sabre_CardDAV_Card($this->carddavBackend,$this->addressBookInfo,$obj);
- }
- return $children;
-
- }
-
- /**
- * Creates a new directory
- *
- * We actually block this, as subdirectories are not allowed in addressbooks.
- *
- * @param string $name
- * @return void
- */
- public function createDirectory($name) {
-
- throw new Sabre_DAV_Exception_MethodNotAllowed('Creating collections in addressbooks is not allowed');
-
- }
-
- /**
- * Creates a new file
- *
- * The contents of the new file must be a valid VCARD.
- *
- * This method may return an ETag.
- *
- * @param string $name
- * @param resource $vcardData
- * @return string|null
- */
- public function createFile($name,$vcardData = null) {
-
- if (is_resource($vcardData)) {
- $vcardData = stream_get_contents($vcardData);
- }
- // Converting to UTF-8, if needed
- $vcardData = Sabre_DAV_StringUtil::ensureUTF8($vcardData);
-
- return $this->carddavBackend->createCard($this->addressBookInfo['id'],$name,$vcardData);
-
- }
-
- /**
- * Deletes the entire addressbook.
- *
- * @return void
- */
- public function delete() {
-
- $this->carddavBackend->deleteAddressBook($this->addressBookInfo['id']);
-
- }
-
- /**
- * Renames the addressbook
- *
- * @param string $newName
- * @return void
- */
- public function setName($newName) {
-
- throw new Sabre_DAV_Exception_MethodNotAllowed('Renaming addressbooks is not yet supported');
-
- }
-
- /**
- * Returns the last modification date as a unix timestamp.
- *
- * @return void
- */
- public function getLastModified() {
-
- return null;
-
- }
-
- /**
- * Updates properties on this node,
- *
- * The properties array uses the propertyName in clark-notation as key,
- * and the array value for the property value. In the case a property
- * should be deleted, the property value will be null.
- *
- * This method must be atomic. If one property cannot be changed, the
- * entire operation must fail.
- *
- * If the operation was successful, true can be returned.
- * If the operation failed, false can be returned.
- *
- * Deletion of a non-existent property is always successful.
- *
- * Lastly, it is optional to return detailed information about any
- * failures. In this case an array should be returned with the following
- * structure:
- *
- * array(
- * 403 => array(
- * '{DAV:}displayname' => null,
- * ),
- * 424 => array(
- * '{DAV:}owner' => null,
- * )
- * )
- *
- * In this example it was forbidden to update {DAV:}displayname.
- * (403 Forbidden), which in turn also caused {DAV:}owner to fail
- * (424 Failed Dependency) because the request needs to be atomic.
- *
- * @param array $mutations
- * @return bool|array
- */
- public function updateProperties($mutations) {
-
- return $this->carddavBackend->updateAddressBook($this->addressBookInfo['id'], $mutations);
-
- }
-
- /**
- * Returns a list of properties for this nodes.
- *
- * The properties list is a list of propertynames the client requested,
- * encoded in clark-notation {xmlnamespace}tagname
- *
- * If the array is empty, it means 'all properties' were requested.
- *
- * @param array $properties
- * @return array
- */
- public function getProperties($properties) {
-
- $response = array();
- foreach($properties as $propertyName) {
-
- if (isset($this->addressBookInfo[$propertyName])) {
-
- $response[$propertyName] = $this->addressBookInfo[$propertyName];
-
- }
-
- }
-
- return $response;
-
- }
-
- /**
- * Returns the owner principal
- *
- * This must be a url to a principal, or null if there's no owner
- *
- * @return string|null
- */
- public function getOwner() {
-
- return $this->addressBookInfo['principaluri'];
-
- }
-
- /**
- * Returns a group principal
- *
- * This must be a url to a principal, or null if there's no owner
- *
- * @return string|null
- */
- public function getGroup() {
-
- return null;
-
- }
-
- /**
- * Returns a list of ACE's for this node.
- *
- * Each ACE has the following properties:
- * * 'privilege', a string such as {DAV:}read or {DAV:}write. These are
- * currently the only supported privileges
- * * 'principal', a url to the principal who owns the node
- * * 'protected' (optional), indicating that this ACE is not allowed to
- * be updated.
- *
- * @return array
- */
- public function getACL() {
-
- return array(
- array(
- 'privilege' => '{DAV:}read',
- 'principal' => $this->addressBookInfo['principaluri'],
- 'protected' => true,
- ),
- array(
- 'privilege' => '{DAV:}write',
- 'principal' => $this->addressBookInfo['principaluri'],
- 'protected' => true,
- ),
-
- );
-
- }
-
- /**
- * Updates the ACL
- *
- * This method will receive a list of new ACE's.
- *
- * @param array $acl
- * @return void
- */
- public function setACL(array $acl) {
-
- throw new Sabre_DAV_Exception_MethodNotAllowed('Changing ACL is not yet supported');
-
- }
-
- /**
- * Returns the list of supported privileges for this node.
- *
- * The returned data structure is a list of nested privileges.
- * See Sabre_DAVACL_Plugin::getDefaultSupportedPrivilegeSet for a simple
- * standard structure.
- *
- * If null is returned from this method, the default privilege set is used,
- * which is fine for most common usecases.
- *
- * @return array|null
- */
- public function getSupportedPrivilegeSet() {
-
- return null;
-
- }
-
-}
diff --git a/3rdparty/Sabre/CardDAV/AddressBookQueryParser.php b/3rdparty/Sabre/CardDAV/AddressBookQueryParser.php
deleted file mode 100644
index 46bb8ff18dd..00000000000
--- a/3rdparty/Sabre/CardDAV/AddressBookQueryParser.php
+++ /dev/null
@@ -1,219 +0,0 @@
-<?php
-
-/**
- * Parses the addressbook-query report request body.
- *
- * Whoever designed this format, and the CalDAV equivalent even more so,
- * has no feel for design.
- *
- * @package Sabre
- * @subpackage CardDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CardDAV_AddressBookQueryParser {
-
- const TEST_ANYOF = 'anyof';
- const TEST_ALLOF = 'allof';
-
- /**
- * List of requested properties the client wanted
- *
- * @var array
- */
- public $requestedProperties;
-
- /**
- * The number of results the client wants
- *
- * null means it wasn't specified, which in most cases means 'all results'.
- *
- * @var int|null
- */
- public $limit;
-
- /**
- * List of property filters.
- *
- * @var array
- */
- public $filters;
-
- /**
- * Either TEST_ANYOF or TEST_ALLOF
- *
- * @var string
- */
- public $test;
-
- /**
- * DOM Document
- *
- * @var DOMDocument
- */
- protected $dom;
-
- /**
- * DOM XPath object
- *
- * @var DOMXPath
- */
- protected $xpath;
-
- /**
- * Creates the parser
- *
- * @param DOMDocument $dom
- */
- public function __construct(DOMDocument $dom) {
-
- $this->dom = $dom;
-
- $this->xpath = new DOMXPath($dom);
- $this->xpath->registerNameSpace('card',Sabre_CardDAV_Plugin::NS_CARDDAV);
-
- }
-
- /**
- * Parses the request.
- *
- * @return void
- */
- public function parse() {
-
- $filterNode = null;
-
- $limit = $this->xpath->evaluate('number(/card:addressbook-query/card:limit/card:nresults)');
- if (is_nan($limit)) $limit = null;
-
- $filter = $this->xpath->query('/card:addressbook-query/card:filter');
-
- // 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');
- }
-
- 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"');
- }
-
- $propFilters = array();
-
- $propFilterNodes = $this->xpath->query('card:prop-filter', $filter);
- for($ii=0; $ii < $propFilterNodes->length; $ii++) {
-
- $propFilters[] = $this->parsePropFilterNode($propFilterNodes->item($ii));
-
-
- }
-
- $this->filters = $propFilters;
- $this->limit = $limit;
- $this->requestedProperties = array_keys(Sabre_DAV_XMLUtil::parseProperties($this->dom->firstChild));
- $this->test = $test;
-
- }
-
- /**
- * Parses the prop-filter xml element
- *
- * @param DOMElement $propFilterNode
- * @return array
- */
- protected function parsePropFilterNode(DOMElement $propFilterNode) {
-
- $propFilter = array();
- $propFilter['name'] = $propFilterNode->getAttribute('name');
- $propFilter['test'] = $propFilterNode->getAttribute('test');
- if (!$propFilter['test']) $propFilter['test'] = 'anyof';
-
- $propFilter['is-not-defined'] = $this->xpath->query('card:is-not-defined', $propFilterNode)->length>0;
-
- $paramFilterNodes = $this->xpath->query('card:param-filter', $propFilterNode);
-
- $propFilter['param-filters'] = array();
-
-
- for($ii=0;$ii<$paramFilterNodes->length;$ii++) {
-
- $propFilter['param-filters'][] = $this->parseParamFilterNode($paramFilterNodes->item($ii));
-
- }
- $propFilter['text-matches'] = array();
- $textMatchNodes = $this->xpath->query('card:text-match', $propFilterNode);
-
- for($ii=0;$ii<$textMatchNodes->length;$ii++) {
-
- $propFilter['text-matches'][] = $this->parseTextMatchNode($textMatchNodes->item($ii));
-
- }
-
- return $propFilter;
-
- }
-
- /**
- * Parses the param-filter element
- *
- * @param DOMElement $paramFilterNode
- * @return array
- */
- public function parseParamFilterNode(DOMElement $paramFilterNode) {
-
- $paramFilter = array();
- $paramFilter['name'] = $paramFilterNode->getAttribute('name');
- $paramFilter['is-not-defined'] = $this->xpath->query('card:is-not-defined', $paramFilterNode)->length>0;
- $paramFilter['text-match'] = null;
-
- $textMatch = $this->xpath->query('card:text-match', $paramFilterNode);
- if ($textMatch->length>0) {
- $paramFilter['text-match'] = $this->parseTextMatchNode($textMatch->item(0));
- }
-
- return $paramFilter;
-
- }
-
- /**
- * Text match
- *
- * @param DOMElement $textMatchNode
- * @return array
- */
- public function parseTextMatchNode(DOMElement $textMatchNode) {
-
- $matchType = $textMatchNode->getAttribute('match-type');
- if (!$matchType) $matchType = 'contains';
-
- if (!in_array($matchType, array('contains', 'equals', 'starts-with', 'ends-with'))) {
- throw new Sabre_DAV_Exception_BadRequest('Unknown match-type: ' . $matchType);
- }
-
- $negateCondition = $textMatchNode->getAttribute('negate-condition');
- $negateCondition = $negateCondition==='yes';
- $collation = $textMatchNode->getAttribute('collation');
- if (!$collation) $collation = 'i;unicode-casemap';
-
- return array(
- 'negate-condition' => $negateCondition,
- 'collation' => $collation,
- 'match-type' => $matchType,
- 'value' => $textMatchNode->nodeValue
- );
-
-
- }
-
-}
diff --git a/3rdparty/Sabre/CardDAV/AddressBookRoot.php b/3rdparty/Sabre/CardDAV/AddressBookRoot.php
deleted file mode 100644
index 9d37b15f08e..00000000000
--- a/3rdparty/Sabre/CardDAV/AddressBookRoot.php
+++ /dev/null
@@ -1,78 +0,0 @@
-<?php
-
-/**
- * AddressBook rootnode
- *
- * This object lists a collection of users, which can contain addressbooks.
- *
- * @package Sabre
- * @subpackage CardDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CardDAV_AddressBookRoot extends Sabre_DAVACL_AbstractPrincipalCollection {
-
- /**
- * Principal Backend
- *
- * @var Sabre_DAVACL_IPrincipalBackend
- */
- protected $principalBackend;
-
- /**
- * CardDAV backend
- *
- * @var Sabre_CardDAV_Backend_Abstract
- */
- protected $carddavBackend;
-
- /**
- * Constructor
- *
- * This constructor needs both a principal and a carddav backend.
- *
- * By default this class will show a list of addressbook collections for
- * principals in the 'principals' collection. If your main principals are
- * actually located in a different path, use the $principalPrefix argument
- * to override this.
- *
- * @param Sabre_DAVACL_IPrincipalBackend $principalBackend
- * @param Sabre_CardDAV_Backend_Abstract $carddavBackend
- * @param string $principalPrefix
- */
- public function __construct(Sabre_DAVACL_IPrincipalBackend $principalBackend,Sabre_CardDAV_Backend_Abstract $carddavBackend, $principalPrefix = 'principals') {
-
- $this->carddavBackend = $carddavBackend;
- parent::__construct($principalBackend, $principalPrefix);
-
- }
-
- /**
- * Returns the name of the node
- *
- * @return string
- */
- public function getName() {
-
- return Sabre_CardDAV_Plugin::ADDRESSBOOK_ROOT;
-
- }
-
- /**
- * This method returns a node for a principal.
- *
- * The passed array contains principal information, and is guaranteed to
- * at least contain a uri item. Other properties may or may not be
- * supplied by the authentication backend.
- *
- * @param array $principal
- * @return Sabre_DAV_INode
- */
- public function getChildForPrincipal(array $principal) {
-
- return new Sabre_CardDAV_UserAddressBooks($this->carddavBackend, $principal['uri']);
-
- }
-
-}
diff --git a/3rdparty/Sabre/CardDAV/Backend/Abstract.php b/3rdparty/Sabre/CardDAV/Backend/Abstract.php
deleted file mode 100644
index e4806b7161f..00000000000
--- a/3rdparty/Sabre/CardDAV/Backend/Abstract.php
+++ /dev/null
@@ -1,166 +0,0 @@
-<?php
-
-/**
- * Abstract Backend class
- *
- * This class serves as a base-class for addressbook backends
- *
- * Note that there are references to 'addressBookId' scattered throughout the
- * class. The value of the addressBookId is completely up to you, it can be any
- * arbitrary value you can use as an unique identifier.
- *
- * @package Sabre
- * @subpackage CardDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-abstract class Sabre_CardDAV_Backend_Abstract {
-
- /**
- * Returns the list of addressbooks for a specific user.
- *
- * Every addressbook should have the following properties:
- * id - an arbitrary unique id
- * uri - the 'basename' part of the url
- * principaluri - Same as the passed parameter
- *
- * Any additional clark-notation property may be passed besides this. Some
- * common ones are :
- * {DAV:}displayname
- * {urn:ietf:params:xml:ns:carddav}addressbook-description
- * {http://calendarserver.org/ns/}getctag
- *
- * @param string $principalUri
- * @return array
- */
- public abstract function getAddressBooksForUser($principalUri);
-
- /**
- * Updates an addressbook's properties
- *
- * See Sabre_DAV_IProperties for a description of the mutations array, as
- * well as the return value.
- *
- * @param mixed $addressBookId
- * @param array $mutations
- * @see Sabre_DAV_IProperties::updateProperties
- * @return bool|array
- */
- public abstract function updateAddressBook($addressBookId, array $mutations);
-
- /**
- * Creates a new address book
- *
- * @param string $principalUri
- * @param string $url Just the 'basename' of the url.
- * @param array $properties
- * @return void
- */
- abstract public function createAddressBook($principalUri, $url, array $properties);
-
- /**
- * Deletes an entire addressbook and all its contents
- *
- * @param mixed $addressBookId
- * @return void
- */
- abstract public function deleteAddressBook($addressBookId);
-
- /**
- * Returns all cards for a specific addressbook id.
- *
- * This method should return the following properties for each card:
- * * carddata - raw vcard data
- * * uri - Some unique url
- * * lastmodified - A unix timestamp
- *
- * It's recommended to also return the following properties:
- * * etag - A unique etag. This must change every time the card changes.
- * * size - The size of the card in bytes.
- *
- * If these last two properties are provided, less time will be spent
- * calculating them. If they are specified, you can also ommit carddata.
- * This may speed up certain requests, especially with large cards.
- *
- * @param mixed $addressbookId
- * @return array
- */
- public abstract function getCards($addressbookId);
-
- /**
- * Returns a specfic card.
- *
- * The same set of properties must be returned as with getCards. The only
- * exception is that 'carddata' is absolutely required.
- *
- * @param mixed $addressBookId
- * @param string $cardUri
- * @return array
- */
- public abstract function getCard($addressBookId, $cardUri);
-
- /**
- * Creates a new card.
- *
- * The addressbook id will be passed as the first argument. This is the
- * same id as it is returned from the getAddressbooksForUser method.
- *
- * The cardUri is a base uri, and doesn't include the full path. The
- * cardData argument is the vcard body, and is passed as a string.
- *
- * It is possible to return an ETag from this method. This ETag is for the
- * newly created resource, and must be enclosed with double quotes (that
- * is, the string itself must contain the double quotes).
- *
- * You should only return the ETag if you store the carddata as-is. If a
- * subsequent GET request on the same card does not have the same body,
- * byte-by-byte and you did return an ETag here, clients tend to get
- * confused.
- *
- * If you don't return an ETag, you can just return null.
- *
- * @param mixed $addressBookId
- * @param string $cardUri
- * @param string $cardData
- * @return string|null
- */
- abstract public function createCard($addressBookId, $cardUri, $cardData);
-
- /**
- * Updates a card.
- *
- * The addressbook id will be passed as the first argument. This is the
- * same id as it is returned from the getAddressbooksForUser method.
- *
- * The cardUri is a base uri, and doesn't include the full path. The
- * cardData argument is the vcard body, and is passed as a string.
- *
- * It is possible to return an ETag from this method. This ETag should
- * match that of the updated resource, and must be enclosed with double
- * quotes (that is: the string itself must contain the actual quotes).
- *
- * You should only return the ETag if you store the carddata as-is. If a
- * subsequent GET request on the same card does not have the same body,
- * byte-by-byte and you did return an ETag here, clients tend to get
- * confused.
- *
- * If you don't return an ETag, you can just return null.
- *
- * @param mixed $addressBookId
- * @param string $cardUri
- * @param string $cardData
- * @return string|null
- */
- abstract public function updateCard($addressBookId, $cardUri, $cardData);
-
- /**
- * Deletes a card
- *
- * @param mixed $addressBookId
- * @param string $cardUri
- * @return bool
- */
- abstract public function deleteCard($addressBookId, $cardUri);
-
-}
diff --git a/3rdparty/Sabre/CardDAV/Backend/PDO.php b/3rdparty/Sabre/CardDAV/Backend/PDO.php
deleted file mode 100644
index 413a77f3bcc..00000000000
--- a/3rdparty/Sabre/CardDAV/Backend/PDO.php
+++ /dev/null
@@ -1,330 +0,0 @@
-<?php
-
-/**
- * PDO CardDAV backend
- *
- * This CardDAV backend uses PDO to store addressbooks
- *
- * @package Sabre
- * @subpackage CardDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CardDAV_Backend_PDO extends Sabre_CardDAV_Backend_Abstract {
-
- /**
- * PDO connection
- *
- * @var PDO
- */
- protected $pdo;
-
- /**
- * The PDO table name used to store addressbooks
- */
- protected $addressBooksTableName;
-
- /**
- * The PDO table name used to store cards
- */
- protected $cardsTableName;
-
- /**
- * Sets up the object
- *
- * @param PDO $pdo
- * @param string $addressBooksTableName
- * @param string $cardsTableName
- */
- public function __construct(PDO $pdo, $addressBooksTableName = 'addressbooks', $cardsTableName = 'cards') {
-
- $this->pdo = $pdo;
- $this->addressBooksTableName = $addressBooksTableName;
- $this->cardsTableName = $cardsTableName;
-
- }
-
- /**
- * Returns the list of addressbooks for a specific user.
- *
- * @param string $principalUri
- * @return array
- */
- public function getAddressBooksForUser($principalUri) {
-
- $stmt = $this->pdo->prepare('SELECT id, uri, displayname, principaluri, description, ctag FROM '.$this->addressBooksTableName.' WHERE principaluri = ?');
- $stmt->execute(array($principalUri));
-
- $addressBooks = array();
-
- foreach($stmt->fetchAll() as $row) {
-
- $addressBooks[] = array(
- 'id' => $row['id'],
- 'uri' => $row['uri'],
- 'principaluri' => $row['principaluri'],
- '{DAV:}displayname' => $row['displayname'],
- '{' . Sabre_CardDAV_Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'],
- '{http://calendarserver.org/ns/}getctag' => $row['ctag'],
- '{' . Sabre_CardDAV_Plugin::NS_CARDDAV . '}supported-address-data' =>
- new Sabre_CardDAV_Property_SupportedAddressData(),
- );
-
- }
-
- return $addressBooks;
-
- }
-
-
- /**
- * Updates an addressbook's properties
- *
- * See Sabre_DAV_IProperties for a description of the mutations array, as
- * well as the return value.
- *
- * @param mixed $addressBookId
- * @param array $mutations
- * @see Sabre_DAV_IProperties::updateProperties
- * @return bool|array
- */
- public function updateAddressBook($addressBookId, array $mutations) {
-
- $updates = array();
-
- foreach($mutations as $property=>$newValue) {
-
- switch($property) {
- case '{DAV:}displayname' :
- $updates['displayname'] = $newValue;
- break;
- case '{' . Sabre_CardDAV_Plugin::NS_CARDDAV . '}addressbook-description' :
- $updates['description'] = $newValue;
- break;
- default :
- // If any unsupported values were being updated, we must
- // let the entire request fail.
- return false;
- }
-
- }
-
- // No values are being updated?
- if (!$updates) {
- return false;
- }
-
- $query = 'UPDATE ' . $this->addressBooksTableName . ' SET ctag = ctag + 1 ';
- foreach($updates as $key=>$value) {
- $query.=', `' . $key . '` = :' . $key . ' ';
- }
- $query.=' WHERE id = :addressbookid';
-
- $stmt = $this->pdo->prepare($query);
- $updates['addressbookid'] = $addressBookId;
-
- $stmt->execute($updates);
-
- return true;
-
- }
-
- /**
- * Creates a new address book
- *
- * @param string $principalUri
- * @param string $url Just the 'basename' of the url.
- * @param array $properties
- * @return void
- */
- public function createAddressBook($principalUri, $url, array $properties) {
-
- $values = array(
- 'displayname' => null,
- 'description' => null,
- 'principaluri' => $principalUri,
- 'uri' => $url,
- );
-
- foreach($properties as $property=>$newValue) {
-
- switch($property) {
- case '{DAV:}displayname' :
- $values['displayname'] = $newValue;
- break;
- case '{' . Sabre_CardDAV_Plugin::NS_CARDDAV . '}addressbook-description' :
- $values['description'] = $newValue;
- break;
- default :
- throw new Sabre_DAV_Exception_BadRequest('Unknown property: ' . $property);
- }
-
- }
-
- $query = 'INSERT INTO ' . $this->addressBooksTableName . ' (uri, displayname, description, principaluri, ctag) VALUES (:uri, :displayname, :description, :principaluri, 1)';
- $stmt = $this->pdo->prepare($query);
- $stmt->execute($values);
-
- }
-
- /**
- * Deletes an entire addressbook and all its contents
- *
- * @param int $addressBookId
- * @return void
- */
- public function deleteAddressBook($addressBookId) {
-
- $stmt = $this->pdo->prepare('DELETE FROM ' . $this->cardsTableName . ' WHERE addressbookid = ?');
- $stmt->execute(array($addressBookId));
-
- $stmt = $this->pdo->prepare('DELETE FROM ' . $this->addressBooksTableName . ' WHERE id = ?');
- $stmt->execute(array($addressBookId));
-
- }
-
- /**
- * Returns all cards for a specific addressbook id.
- *
- * This method should return the following properties for each card:
- * * carddata - raw vcard data
- * * uri - Some unique url
- * * lastmodified - A unix timestamp
- *
- * It's recommended to also return the following properties:
- * * etag - A unique etag. This must change every time the card changes.
- * * size - The size of the card in bytes.
- *
- * If these last two properties are provided, less time will be spent
- * calculating them. If they are specified, you can also ommit carddata.
- * This may speed up certain requests, especially with large cards.
- *
- * @param mixed $addressbookId
- * @return array
- */
- public function getCards($addressbookId) {
-
- $stmt = $this->pdo->prepare('SELECT id, carddata, uri, lastmodified FROM ' . $this->cardsTableName . ' WHERE addressbookid = ?');
- $stmt->execute(array($addressbookId));
-
- return $stmt->fetchAll(PDO::FETCH_ASSOC);
-
-
- }
-
- /**
- * Returns a specfic card.
- *
- * The same set of properties must be returned as with getCards. The only
- * exception is that 'carddata' is absolutely required.
- *
- * @param mixed $addressBookId
- * @param string $cardUri
- * @return array
- */
- public function getCard($addressBookId, $cardUri) {
-
- $stmt = $this->pdo->prepare('SELECT id, carddata, uri, lastmodified FROM ' . $this->cardsTableName . ' WHERE addressbookid = ? AND uri = ? LIMIT 1');
- $stmt->execute(array($addressBookId, $cardUri));
-
- $result = $stmt->fetchAll(PDO::FETCH_ASSOC);
-
- return (count($result)>0?$result[0]:false);
-
- }
-
- /**
- * Creates a new card.
- *
- * The addressbook id will be passed as the first argument. This is the
- * same id as it is returned from the getAddressbooksForUser method.
- *
- * The cardUri is a base uri, and doesn't include the full path. The
- * cardData argument is the vcard body, and is passed as a string.
- *
- * It is possible to return an ETag from this method. This ETag is for the
- * newly created resource, and must be enclosed with double quotes (that
- * is, the string itself must contain the double quotes).
- *
- * You should only return the ETag if you store the carddata as-is. If a
- * subsequent GET request on the same card does not have the same body,
- * byte-by-byte and you did return an ETag here, clients tend to get
- * confused.
- *
- * If you don't return an ETag, you can just return null.
- *
- * @param mixed $addressBookId
- * @param string $cardUri
- * @param string $cardData
- * @return string|null
- */
- public function createCard($addressBookId, $cardUri, $cardData) {
-
- $stmt = $this->pdo->prepare('INSERT INTO ' . $this->cardsTableName . ' (carddata, uri, lastmodified, addressbookid) VALUES (?, ?, ?, ?)');
-
- $result = $stmt->execute(array($cardData, $cardUri, time(), $addressBookId));
-
- $stmt2 = $this->pdo->prepare('UPDATE ' . $this->addressBooksTableName . ' SET ctag = ctag + 1 WHERE id = ?');
- $stmt2->execute(array($addressBookId));
-
- return '"' . md5($cardData) . '"';
-
- }
-
- /**
- * Updates a card.
- *
- * The addressbook id will be passed as the first argument. This is the
- * same id as it is returned from the getAddressbooksForUser method.
- *
- * The cardUri is a base uri, and doesn't include the full path. The
- * cardData argument is the vcard body, and is passed as a string.
- *
- * It is possible to return an ETag from this method. This ETag should
- * match that of the updated resource, and must be enclosed with double
- * quotes (that is: the string itself must contain the actual quotes).
- *
- * You should only return the ETag if you store the carddata as-is. If a
- * subsequent GET request on the same card does not have the same body,
- * byte-by-byte and you did return an ETag here, clients tend to get
- * confused.
- *
- * If you don't return an ETag, you can just return null.
- *
- * @param mixed $addressBookId
- * @param string $cardUri
- * @param string $cardData
- * @return string|null
- */
- public function updateCard($addressBookId, $cardUri, $cardData) {
-
- $stmt = $this->pdo->prepare('UPDATE ' . $this->cardsTableName . ' SET carddata = ?, lastmodified = ? WHERE uri = ? AND addressbookid =?');
- $stmt->execute(array($cardData, time(), $cardUri, $addressBookId));
-
- $stmt2 = $this->pdo->prepare('UPDATE ' . $this->addressBooksTableName . ' SET ctag = ctag + 1 WHERE id = ?');
- $stmt2->execute(array($addressBookId));
-
- return '"' . md5($cardData) . '"';
-
- }
-
- /**
- * Deletes a card
- *
- * @param mixed $addressBookId
- * @param string $cardUri
- * @return bool
- */
- public function deleteCard($addressBookId, $cardUri) {
-
- $stmt = $this->pdo->prepare('DELETE FROM ' . $this->cardsTableName . ' WHERE addressbookid = ? AND uri = ?');
- $stmt->execute(array($addressBookId, $cardUri));
-
- $stmt2 = $this->pdo->prepare('UPDATE ' . $this->addressBooksTableName . ' SET ctag = ctag + 1 WHERE id = ?');
- $stmt2->execute(array($addressBookId));
-
- return $stmt->rowCount()===1;
-
- }
-}
diff --git a/3rdparty/Sabre/CardDAV/Card.php b/3rdparty/Sabre/CardDAV/Card.php
deleted file mode 100644
index 0e35d321eb8..00000000000
--- a/3rdparty/Sabre/CardDAV/Card.php
+++ /dev/null
@@ -1,256 +0,0 @@
-<?php
-
-/**
- * The Card object represents a single Card from an addressbook
- *
- * @package Sabre
- * @subpackage CardDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CardDAV_Card extends Sabre_DAV_File implements Sabre_CardDAV_ICard, Sabre_DAVACL_IACL {
-
- /**
- * CardDAV backend
- *
- * @var Sabre_CardDAV_Backend_Abstract
- */
- private $carddavBackend;
-
- /**
- * Array with information about this Card
- *
- * @var array
- */
- private $cardData;
-
- /**
- * Array with information about the containing addressbook
- *
- * @var array
- */
- private $addressBookInfo;
-
- /**
- * Constructor
- *
- * @param Sabre_CardDAV_Backend_Abstract $carddavBackend
- * @param array $addressBookInfo
- * @param array $cardData
- */
- public function __construct(Sabre_CardDAV_Backend_Abstract $carddavBackend,array $addressBookInfo,array $cardData) {
-
- $this->carddavBackend = $carddavBackend;
- $this->addressBookInfo = $addressBookInfo;
- $this->cardData = $cardData;
-
- }
-
- /**
- * Returns the uri for this object
- *
- * @return string
- */
- public function getName() {
-
- return $this->cardData['uri'];
-
- }
-
- /**
- * Returns the VCard-formatted object
- *
- * @return string
- */
- public function get() {
-
- // Pre-populating 'carddata' is optional. If we don't yet have it
- // already, we fetch it from the backend.
- if (!isset($this->cardData['carddata'])) {
- $this->cardData = $this->carddavBackend->getCard($this->addressBookInfo['id'], $this->cardData['uri']);
- }
- return $this->cardData['carddata'];
-
- }
-
- /**
- * Updates the VCard-formatted object
- *
- * @param string $cardData
- * @return string|null
- */
- public function put($cardData) {
-
- if (is_resource($cardData))
- $cardData = stream_get_contents($cardData);
-
- // Converting to UTF-8, if needed
- $cardData = Sabre_DAV_StringUtil::ensureUTF8($cardData);
-
- $etag = $this->carddavBackend->updateCard($this->addressBookInfo['id'],$this->cardData['uri'],$cardData);
- $this->cardData['carddata'] = $cardData;
- $this->cardData['etag'] = $etag;
-
- return $etag;
-
- }
-
- /**
- * Deletes the card
- *
- * @return void
- */
- public function delete() {
-
- $this->carddavBackend->deleteCard($this->addressBookInfo['id'],$this->cardData['uri']);
-
- }
-
- /**
- * Returns the mime content-type
- *
- * @return string
- */
- public function getContentType() {
-
- return 'text/x-vcard; charset=utf-8';
-
- }
-
- /**
- * Returns an ETag for this object
- *
- * @return string
- */
- public function getETag() {
-
- if (isset($this->cardData['etag'])) {
- return $this->cardData['etag'];
- } else {
- $data = $this->get();
- if (is_string($data)) {
- return '"' . md5($data) . '"';
- } else {
- // We refuse to calculate the md5 if it's a stream.
- return null;
- }
- }
-
- }
-
- /**
- * Returns the last modification date as a unix timestamp
- *
- * @return int
- */
- public function getLastModified() {
-
- return isset($this->cardData['lastmodified'])?$this->cardData['lastmodified']:null;
-
- }
-
- /**
- * Returns the size of this object in bytes
- *
- * @return int
- */
- public function getSize() {
-
- if (array_key_exists('size', $this->cardData)) {
- return $this->cardData['size'];
- } else {
- return strlen($this->get());
- }
-
- }
-
- /**
- * Returns the owner principal
- *
- * This must be a url to a principal, or null if there's no owner
- *
- * @return string|null
- */
- public function getOwner() {
-
- return $this->addressBookInfo['principaluri'];
-
- }
-
- /**
- * Returns a group principal
- *
- * This must be a url to a principal, or null if there's no owner
- *
- * @return string|null
- */
- public function getGroup() {
-
- return null;
-
- }
-
- /**
- * Returns a list of ACE's for this node.
- *
- * Each ACE has the following properties:
- * * 'privilege', a string such as {DAV:}read or {DAV:}write. These are
- * currently the only supported privileges
- * * 'principal', a url to the principal who owns the node
- * * 'protected' (optional), indicating that this ACE is not allowed to
- * be updated.
- *
- * @return array
- */
- public function getACL() {
-
- return array(
- array(
- 'privilege' => '{DAV:}read',
- 'principal' => $this->addressBookInfo['principaluri'],
- 'protected' => true,
- ),
- array(
- 'privilege' => '{DAV:}write',
- 'principal' => $this->addressBookInfo['principaluri'],
- 'protected' => true,
- ),
- );
-
- }
-
- /**
- * Updates the ACL
- *
- * This method will receive a list of new ACE's.
- *
- * @param array $acl
- * @return void
- */
- public function setACL(array $acl) {
-
- throw new Sabre_DAV_Exception_MethodNotAllowed('Changing ACL is not yet supported');
-
- }
-
- /**
- * Returns the list of supported privileges for this node.
- *
- * The returned data structure is a list of nested privileges.
- * See Sabre_DAVACL_Plugin::getDefaultSupportedPrivilegeSet for a simple
- * standard structure.
- *
- * If null is returned from this method, the default privilege set is used,
- * which is fine for most common usecases.
- *
- * @return array|null
- */
- public function getSupportedPrivilegeSet() {
-
- return null;
-
- }
-
-}
-
diff --git a/3rdparty/Sabre/CardDAV/IAddressBook.php b/3rdparty/Sabre/CardDAV/IAddressBook.php
deleted file mode 100644
index 2bc275bcf74..00000000000
--- a/3rdparty/Sabre/CardDAV/IAddressBook.php
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-
-/**
- * AddressBook interface
- *
- * Implement this interface to allow a node to be recognized as an addressbook.
- *
- * @package Sabre
- * @subpackage CardDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-interface Sabre_CardDAV_IAddressBook extends Sabre_DAV_ICollection {
-
-
-
-}
diff --git a/3rdparty/Sabre/CardDAV/ICard.php b/3rdparty/Sabre/CardDAV/ICard.php
deleted file mode 100644
index a17299316c1..00000000000
--- a/3rdparty/Sabre/CardDAV/ICard.php
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-
-/**
- * Card interface
- *
- * Extend the ICard interface to allow your custom nodes to be picked up as
- * 'Cards'.
- *
- * @package Sabre
- * @subpackage CardDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-interface Sabre_CardDAV_ICard extends Sabre_DAV_IFile {
-
-}
-
diff --git a/3rdparty/Sabre/CardDAV/IDirectory.php b/3rdparty/Sabre/CardDAV/IDirectory.php
deleted file mode 100644
index 22d4afeb24a..00000000000
--- a/3rdparty/Sabre/CardDAV/IDirectory.php
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-
-/**
- * IDirectory interface
- *
- * Implement this interface to have an addressbook marked as a 'directory'. A
- * directory is an (often) global addressbook.
- *
- * A full description can be found in the IETF draft:
- * - draft-daboo-carddav-directory-gateway
- *
- * @package Sabre
- * @subpackage CardDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-interface Sabre_CardDAV_IDirectory extends Sabre_CardDAV_IAddressBook {
-
-
-}
diff --git a/3rdparty/Sabre/CardDAV/Plugin.php b/3rdparty/Sabre/CardDAV/Plugin.php
deleted file mode 100644
index 12bccaec4fb..00000000000
--- a/3rdparty/Sabre/CardDAV/Plugin.php
+++ /dev/null
@@ -1,702 +0,0 @@
-<?php
-
-use Sabre\VObject;
-
-/**
- * CardDAV plugin
- *
- * The CardDAV plugin adds CardDAV functionality to the WebDAV server
- *
- * @package Sabre
- * @subpackage CardDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CardDAV_Plugin extends Sabre_DAV_ServerPlugin {
-
- /**
- * Url to the addressbooks
- */
- const ADDRESSBOOK_ROOT = 'addressbooks';
-
- /**
- * xml namespace for CardDAV elements
- */
- const NS_CARDDAV = 'urn:ietf:params:xml:ns:carddav';
-
- /**
- * Add urls to this property to have them automatically exposed as
- * 'directories' to the user.
- *
- * @var array
- */
- public $directories = array();
-
- /**
- * Server class
- *
- * @var Sabre_DAV_Server
- */
- protected $server;
-
- /**
- * Initializes the plugin
- *
- * @param Sabre_DAV_Server $server
- * @return void
- */
- public function initialize(Sabre_DAV_Server $server) {
-
- /* Events */
- $server->subscribeEvent('beforeGetProperties', array($this, 'beforeGetProperties'));
- $server->subscribeEvent('afterGetProperties', array($this, 'afterGetProperties'));
- $server->subscribeEvent('updateProperties', array($this, 'updateProperties'));
- $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';
-
- /* Mapping Interfaces to {DAV:}resourcetype values */
- $server->resourceTypeMapping['Sabre_CardDAV_IAddressBook'] = '{' . self::NS_CARDDAV . '}addressbook';
- $server->resourceTypeMapping['Sabre_CardDAV_IDirectory'] = '{' . self::NS_CARDDAV . '}directory';
-
- /* Adding properties that may never be changed */
- $server->protectedProperties[] = '{' . self::NS_CARDDAV . '}supported-address-data';
- $server->protectedProperties[] = '{' . self::NS_CARDDAV . '}max-resource-size';
- $server->protectedProperties[] = '{' . self::NS_CARDDAV . '}addressbook-home-set';
- $server->protectedProperties[] = '{' . self::NS_CARDDAV . '}supported-collation-set';
-
- $server->propertyMap['{http://calendarserver.org/ns/}me-card'] = 'Sabre_DAV_Property_Href';
-
- $this->server = $server;
-
- }
-
- /**
- * Returns a list of supported features.
- *
- * This is used in the DAV: header in the OPTIONS and PROPFIND requests.
- *
- * @return array
- */
- public function getFeatures() {
-
- return array('addressbook');
-
- }
-
- /**
- * Returns a list of reports this plugin supports.
- *
- * This will be used in the {DAV:}supported-report-set property.
- * Note that you still need to subscribe to the 'report' event to actually
- * implement them
- *
- * @param string $uri
- * @return array
- */
- public function getSupportedReportSet($uri) {
-
- $node = $this->server->tree->getNodeForPath($uri);
- if ($node instanceof Sabre_CardDAV_IAddressBook || $node instanceof Sabre_CardDAV_ICard) {
- return array(
- '{' . self::NS_CARDDAV . '}addressbook-multiget',
- '{' . self::NS_CARDDAV . '}addressbook-query',
- );
- }
- return array();
-
- }
-
-
- /**
- * Adds all CardDAV-specific properties
- *
- * @param string $path
- * @param Sabre_DAV_INode $node
- * @param array $requestedProperties
- * @param array $returnedProperties
- * @return void
- */
- public function beforeGetProperties($path, Sabre_DAV_INode $node, array &$requestedProperties, array &$returnedProperties) {
-
- if ($node instanceof Sabre_DAVACL_IPrincipal) {
-
- // calendar-home-set property
- $addHome = '{' . self::NS_CARDDAV . '}addressbook-home-set';
- if (in_array($addHome,$requestedProperties)) {
- $principalId = $node->getName();
- $addressbookHomePath = self::ADDRESSBOOK_ROOT . '/' . $principalId . '/';
- unset($requestedProperties[array_search($addHome, $requestedProperties)]);
- $returnedProperties[200][$addHome] = new Sabre_DAV_Property_Href($addressbookHomePath);
- }
-
- $directories = '{' . self::NS_CARDDAV . '}directory-gateway';
- if ($this->directories && in_array($directories, $requestedProperties)) {
- unset($requestedProperties[array_search($directories, $requestedProperties)]);
- $returnedProperties[200][$directories] = new Sabre_DAV_Property_HrefList($this->directories);
- }
-
- }
-
- if ($node instanceof Sabre_CardDAV_ICard) {
-
- // The address-data property is not supposed to be a 'real'
- // property, but in large chunks of the spec it does act as such.
- // Therefore we simply expose it as a property.
- $addressDataProp = '{' . self::NS_CARDDAV . '}address-data';
- if (in_array($addressDataProp, $requestedProperties)) {
- unset($requestedProperties[$addressDataProp]);
- $val = $node->get();
- if (is_resource($val))
- $val = stream_get_contents($val);
-
- $returnedProperties[200][$addressDataProp] = $val;
-
- }
- }
-
- if ($node instanceof Sabre_CardDAV_UserAddressBooks) {
-
- $meCardProp = '{http://calendarserver.org/ns/}me-card';
- if (in_array($meCardProp, $requestedProperties)) {
-
- $props = $this->server->getProperties($node->getOwner(), array('{http://sabredav.org/ns}vcard-url'));
- if (isset($props['{http://sabredav.org/ns}vcard-url'])) {
-
- $returnedProperties[200][$meCardProp] = new Sabre_DAV_Property_Href(
- $props['{http://sabredav.org/ns}vcard-url']
- );
- $pos = array_search($meCardProp, $requestedProperties);
- unset($requestedProperties[$pos]);
-
- }
-
- }
-
- }
-
- }
-
- /**
- * This event is triggered when a PROPPATCH method is executed
- *
- * @param array $mutations
- * @param array $result
- * @param Sabre_DAV_INode $node
- * @return bool
- */
- public function updateProperties(&$mutations, &$result, $node) {
-
- if (!$node instanceof Sabre_CardDAV_UserAddressBooks) {
- return true;
- }
-
- $meCard = '{http://calendarserver.org/ns/}me-card';
-
- // The only property we care about
- if (!isset($mutations[$meCard]))
- return true;
-
- $value = $mutations[$meCard];
- unset($mutations[$meCard]);
-
- if ($value instanceof Sabre_DAV_Property_IHref) {
- $value = $value->getHref();
- $value = $this->server->calculateUri($value);
- } elseif (!is_null($value)) {
- $result[400][$meCard] = null;
- return false;
- }
-
- $innerResult = $this->server->updateProperties(
- $node->getOwner(),
- array(
- '{http://sabredav.org/ns}vcard-url' => $value,
- )
- );
-
- $closureResult = false;
- foreach($innerResult as $status => $props) {
- if (is_array($props) && array_key_exists('{http://sabredav.org/ns}vcard-url', $props)) {
- $result[$status][$meCard] = null;
- $closureResult = ($status>=200 && $status<300);
- }
-
- }
-
- return $result;
-
- }
-
- /**
- * This functions handles REPORT requests specific to CardDAV
- *
- * @param string $reportName
- * @param DOMNode $dom
- * @return bool
- */
- public function report($reportName,$dom) {
-
- switch($reportName) {
- case '{'.self::NS_CARDDAV.'}addressbook-multiget' :
- $this->addressbookMultiGetReport($dom);
- return false;
- case '{'.self::NS_CARDDAV.'}addressbook-query' :
- $this->addressBookQueryReport($dom);
- return false;
- default :
- return;
-
- }
-
-
- }
-
- /**
- * This function handles the addressbook-multiget REPORT.
- *
- * This report is used by the client to fetch the content of a series
- * of urls. Effectively avoiding a lot of redundant requests.
- *
- * @param DOMNode $dom
- * @return void
- */
- public function addressbookMultiGetReport($dom) {
-
- $properties = array_keys(Sabre_DAV_XMLUtil::parseProperties($dom->firstChild));
-
- $hrefElems = $dom->getElementsByTagNameNS('DAV:','href');
- $propertyList = array();
-
- foreach($hrefElems as $elem) {
-
- $uri = $this->server->calculateUri($elem->nodeValue);
- list($propertyList[]) = $this->server->getPropertiesForPath($uri,$properties);
-
- }
-
- $prefer = $this->server->getHTTPPRefer();
-
- $this->server->httpResponse->sendStatus(207);
- $this->server->httpResponse->setHeader('Content-Type','application/xml; charset=utf-8');
- $this->server->httpResponse->setHeader('Vary','Brief,Prefer');
- $this->server->httpResponse->sendBody($this->server->generateMultiStatus($propertyList, $prefer['return-minimal']));
-
- }
-
- /**
- * 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 = VObject\Reader::read($data);
-
- } catch (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.');
- }
-
- if (!isset($vobj->UID)) {
- throw new Sabre_DAV_Exception_BadRequest('Every vcard must have an UID.');
- }
-
- }
-
-
- /**
- * This function handles the addressbook-query REPORT
- *
- * This report is used by the client to filter an addressbook based on a
- * complex query.
- *
- * @param DOMNode $dom
- * @return void
- */
- protected function addressbookQueryReport($dom) {
-
- $query = new Sabre_CardDAV_AddressBookQueryParser($dom);
- $query->parse();
-
- $depth = $this->server->getHTTPDepth(0);
-
- if ($depth==0) {
- $candidateNodes = array(
- $this->server->tree->getNodeForPath($this->server->getRequestUri())
- );
- } else {
- $candidateNodes = $this->server->tree->getChildren($this->server->getRequestUri());
- }
-
- $validNodes = array();
- foreach($candidateNodes as $node) {
-
- if (!$node instanceof Sabre_CardDAV_ICard)
- continue;
-
- $blob = $node->get();
- if (is_resource($blob)) {
- $blob = stream_get_contents($blob);
- }
-
- if (!$this->validateFilters($blob, $query->filters, $query->test)) {
- continue;
- }
-
- $validNodes[] = $node;
-
- if ($query->limit && $query->limit <= count($validNodes)) {
- // We hit the maximum number of items, we can stop now.
- break;
- }
-
- }
-
- $result = array();
- foreach($validNodes as $validNode) {
-
- if ($depth==0) {
- $href = $this->server->getRequestUri();
- } else {
- $href = $this->server->getRequestUri() . '/' . $validNode->getName();
- }
-
- list($result[]) = $this->server->getPropertiesForPath($href, $query->requestedProperties, 0);
-
- }
-
- $prefer = $this->server->getHTTPPRefer();
-
- $this->server->httpResponse->sendStatus(207);
- $this->server->httpResponse->setHeader('Content-Type','application/xml; charset=utf-8');
- $this->server->httpResponse->setHeader('Vary','Brief,Prefer');
- $this->server->httpResponse->sendBody($this->server->generateMultiStatus($result, $prefer['return-minimal']));
-
- }
-
- /**
- * Validates if a vcard makes it throught a list of filters.
- *
- * @param string $vcardData
- * @param array $filters
- * @param string $test anyof or allof (which means OR or AND)
- * @return bool
- */
- public function validateFilters($vcardData, array $filters, $test) {
-
- $vcard = VObject\Reader::read($vcardData);
-
- if (!$filters) return true;
-
- foreach($filters as $filter) {
-
- $isDefined = isset($vcard->{$filter['name']});
- if ($filter['is-not-defined']) {
- if ($isDefined) {
- $success = false;
- } else {
- $success = true;
- }
- } elseif ((!$filter['param-filters'] && !$filter['text-matches']) || !$isDefined) {
-
- // We only need to check for existence
- $success = $isDefined;
-
- } else {
-
- $vProperties = $vcard->select($filter['name']);
-
- $results = array();
- if ($filter['param-filters']) {
- $results[] = $this->validateParamFilters($vProperties, $filter['param-filters'], $filter['test']);
- }
- if ($filter['text-matches']) {
- $texts = array();
- foreach($vProperties as $vProperty)
- $texts[] = $vProperty->value;
-
- $results[] = $this->validateTextMatches($texts, $filter['text-matches'], $filter['test']);
- }
-
- if (count($results)===1) {
- $success = $results[0];
- } else {
- if ($filter['test'] === 'anyof') {
- $success = $results[0] || $results[1];
- } else {
- $success = $results[0] && $results[1];
- }
- }
-
- } // else
-
- // There are two conditions where we can already determine whether
- // or not this filter succeeds.
- if ($test==='anyof' && $success) {
- return true;
- }
- if ($test==='allof' && !$success) {
- return false;
- }
-
- } // foreach
-
- // If we got all the way here, it means we haven't been able to
- // determine early if the test failed or not.
- //
- // This implies for 'anyof' that the test failed, and for 'allof' that
- // we succeeded. Sounds weird, but makes sense.
- return $test==='allof';
-
- }
-
- /**
- * Validates if a param-filter can be applied to a specific property.
- *
- * @todo currently we're only validating the first parameter of the passed
- * property. Any subsequence parameters with the same name are
- * ignored.
- * @param array $vProperties
- * @param array $filters
- * @param string $test
- * @return bool
- */
- protected function validateParamFilters(array $vProperties, array $filters, $test) {
-
- foreach($filters as $filter) {
-
- $isDefined = false;
- foreach($vProperties as $vProperty) {
- $isDefined = isset($vProperty[$filter['name']]);
- if ($isDefined) break;
- }
-
- if ($filter['is-not-defined']) {
- if ($isDefined) {
- $success = false;
- } else {
- $success = true;
- }
-
- // If there's no text-match, we can just check for existence
- } elseif (!$filter['text-match'] || !$isDefined) {
-
- $success = $isDefined;
-
- } else {
-
- $success = false;
- foreach($vProperties as $vProperty) {
- // If we got all the way here, we'll need to validate the
- // text-match filter.
- $success = Sabre_DAV_StringUtil::textMatch($vProperty[$filter['name']]->value, $filter['text-match']['value'], $filter['text-match']['collation'], $filter['text-match']['match-type']);
- if ($success) break;
- }
- if ($filter['text-match']['negate-condition']) {
- $success = !$success;
- }
-
- } // else
-
- // There are two conditions where we can already determine whether
- // or not this filter succeeds.
- if ($test==='anyof' && $success) {
- return true;
- }
- if ($test==='allof' && !$success) {
- return false;
- }
-
- }
-
- // If we got all the way here, it means we haven't been able to
- // determine early if the test failed or not.
- //
- // This implies for 'anyof' that the test failed, and for 'allof' that
- // we succeeded. Sounds weird, but makes sense.
- return $test==='allof';
-
- }
-
- /**
- * Validates if a text-filter can be applied to a specific property.
- *
- * @param array $texts
- * @param array $filters
- * @param string $test
- * @return bool
- */
- protected function validateTextMatches(array $texts, array $filters, $test) {
-
- foreach($filters as $filter) {
-
- $success = false;
- foreach($texts as $haystack) {
- $success = Sabre_DAV_StringUtil::textMatch($haystack, $filter['value'], $filter['collation'], $filter['match-type']);
-
- // Breaking on the first match
- if ($success) break;
- }
- if ($filter['negate-condition']) {
- $success = !$success;
- }
-
- if ($success && $test==='anyof')
- return true;
-
- if (!$success && $test=='allof')
- return false;
-
-
- }
-
- // If we got all the way here, it means we haven't been able to
- // determine early if the test failed or not.
- //
- // This implies for 'anyof' that the test failed, and for 'allof' that
- // we succeeded. Sounds weird, but makes sense.
- return $test==='allof';
-
- }
-
- /**
- * This event is triggered after webdav-properties have been retrieved.
- *
- * @return bool
- */
- public function afterGetProperties($uri, &$properties) {
-
- // If the request was made using the SOGO connector, we must rewrite
- // the content-type property. By default SabreDAV will send back
- // text/x-vcard; charset=utf-8, but for SOGO we must strip that last
- // part.
- if (!isset($properties[200]['{DAV:}getcontenttype']))
- return;
-
- if (strpos($this->server->httpRequest->getHeader('User-Agent'),'Thunderbird')===false) {
- return;
- }
-
- if (strpos($properties[200]['{DAV:}getcontenttype'],'text/x-vcard')===0) {
- $properties[200]['{DAV:}getcontenttype'] = 'text/x-vcard';
- }
-
- }
-
- /**
- * This method is used to generate HTML output for the
- * Sabre_DAV_Browser_Plugin. This allows us to generate an interface users
- * can use to create new calendars.
- *
- * @param Sabre_DAV_INode $node
- * @param string $output
- * @return bool
- */
- public function htmlActionsPanel(Sabre_DAV_INode $node, &$output) {
-
- if (!$node instanceof Sabre_CardDAV_UserAddressBooks)
- return;
-
- $output.= '<tr><td colspan="2"><form method="post" action="">
- <h3>Create new address book</h3>
- <input type="hidden" name="sabreAction" value="mkaddressbook" />
- <label>Name (uri):</label> <input type="text" name="name" /><br />
- <label>Display name:</label> <input type="text" name="{DAV:}displayname" /><br />
- <input type="submit" value="create" />
- </form>
- </td></tr>';
-
- return false;
-
- }
-
- /**
- * This method allows us to intercept the 'mkcalendar' sabreAction. This
- * action enables the user to create new calendars from the browser plugin.
- *
- * @param string $uri
- * @param string $action
- * @param array $postVars
- * @return bool
- */
- public function browserPostAction($uri, $action, array $postVars) {
-
- if ($action!=='mkaddressbook')
- return;
-
- $resourceType = array('{DAV:}collection','{urn:ietf:params:xml:ns:carddav}addressbook');
- $properties = array();
- if (isset($postVars['{DAV:}displayname'])) {
- $properties['{DAV:}displayname'] = $postVars['{DAV:}displayname'];
- }
- $this->server->createCollection($uri . '/' . $postVars['name'],$resourceType,$properties);
- return false;
-
- }
-
-}
diff --git a/3rdparty/Sabre/CardDAV/Property/SupportedAddressData.php b/3rdparty/Sabre/CardDAV/Property/SupportedAddressData.php
deleted file mode 100644
index 36d9306e7aa..00000000000
--- a/3rdparty/Sabre/CardDAV/Property/SupportedAddressData.php
+++ /dev/null
@@ -1,69 +0,0 @@
-<?php
-
-/**
- * Supported-address-data property
- *
- * This property is a representation of the supported-address-data property
- * in the CardDAV namespace.
- *
- * @package Sabre
- * @subpackage CardDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CardDAV_Property_SupportedAddressData extends Sabre_DAV_Property {
-
- /**
- * supported versions
- *
- * @var array
- */
- protected $supportedData = array();
-
- /**
- * Creates the property
- *
- * @param array|null $supportedData
- */
- public function __construct(array $supportedData = null) {
-
- if (is_null($supportedData)) {
- $supportedData = array(
- array('contentType' => 'text/vcard', 'version' => '3.0'),
- array('contentType' => 'text/vcard', 'version' => '4.0'),
- );
- }
-
- $this->supportedData = $supportedData;
-
- }
-
- /**
- * Serializes the property in a DOMDocument
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $node
- * @return void
- */
- public function serialize(Sabre_DAV_Server $server,DOMElement $node) {
-
- $doc = $node->ownerDocument;
-
- $prefix =
- isset($server->xmlNamespaces[Sabre_CardDAV_Plugin::NS_CARDDAV]) ?
- $server->xmlNamespaces[Sabre_CardDAV_Plugin::NS_CARDDAV] :
- 'card';
-
- foreach($this->supportedData as $supported) {
-
- $caldata = $doc->createElementNS(Sabre_CardDAV_Plugin::NS_CARDDAV, $prefix . ':address-data-type');
- $caldata->setAttribute('content-type',$supported['contentType']);
- $caldata->setAttribute('version',$supported['version']);
- $node->appendChild($caldata);
-
- }
-
- }
-
-}
diff --git a/3rdparty/Sabre/CardDAV/UserAddressBooks.php b/3rdparty/Sabre/CardDAV/UserAddressBooks.php
deleted file mode 100644
index 3f11fb11238..00000000000
--- a/3rdparty/Sabre/CardDAV/UserAddressBooks.php
+++ /dev/null
@@ -1,257 +0,0 @@
-<?php
-
-/**
- * UserAddressBooks class
- *
- * The UserAddressBooks collection contains a list of addressbooks associated with a user
- *
- * @package Sabre
- * @subpackage CardDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CardDAV_UserAddressBooks extends Sabre_DAV_Collection implements Sabre_DAV_IExtendedCollection, Sabre_DAVACL_IACL {
-
- /**
- * Principal uri
- *
- * @var array
- */
- protected $principalUri;
-
- /**
- * carddavBackend
- *
- * @var Sabre_CardDAV_Backend_Abstract
- */
- protected $carddavBackend;
-
- /**
- * Constructor
- *
- * @param Sabre_CardDAV_Backend_Abstract $carddavBackend
- * @param string $principalUri
- */
- public function __construct(Sabre_CardDAV_Backend_Abstract $carddavBackend, $principalUri) {
-
- $this->carddavBackend = $carddavBackend;
- $this->principalUri = $principalUri;
-
- }
-
- /**
- * Returns the name of this object
- *
- * @return string
- */
- public function getName() {
-
- list(,$name) = Sabre_DAV_URLUtil::splitPath($this->principalUri);
- return $name;
-
- }
-
- /**
- * Updates the name of this object
- *
- * @param string $name
- * @return void
- */
- public function setName($name) {
-
- throw new Sabre_DAV_Exception_MethodNotAllowed();
-
- }
-
- /**
- * Deletes this object
- *
- * @return void
- */
- public function delete() {
-
- throw new Sabre_DAV_Exception_MethodNotAllowed();
-
- }
-
- /**
- * Returns the last modification date
- *
- * @return int
- */
- public function getLastModified() {
-
- return null;
-
- }
-
- /**
- * Creates a new file under this object.
- *
- * This is currently not allowed
- *
- * @param string $filename
- * @param resource $data
- * @return void
- */
- public function createFile($filename, $data=null) {
-
- throw new Sabre_DAV_Exception_MethodNotAllowed('Creating new files in this collection is not supported');
-
- }
-
- /**
- * Creates a new directory under this object.
- *
- * This is currently not allowed.
- *
- * @param string $filename
- * @return void
- */
- public function createDirectory($filename) {
-
- throw new Sabre_DAV_Exception_MethodNotAllowed('Creating new collections in this collection is not supported');
-
- }
-
- /**
- * Returns a single calendar, by name
- *
- * @param string $name
- * @todo needs optimizing
- * @return Sabre_CardDAV_AddressBook
- */
- public function getChild($name) {
-
- foreach($this->getChildren() as $child) {
- if ($name==$child->getName())
- return $child;
-
- }
- throw new Sabre_DAV_Exception_NotFound('Addressbook with name \'' . $name . '\' could not be found');
-
- }
-
- /**
- * Returns a list of addressbooks
- *
- * @return array
- */
- public function getChildren() {
-
- $addressbooks = $this->carddavBackend->getAddressbooksForUser($this->principalUri);
- $objs = array();
- foreach($addressbooks as $addressbook) {
- $objs[] = new Sabre_CardDAV_AddressBook($this->carddavBackend, $addressbook);
- }
- return $objs;
-
- }
-
- /**
- * Creates a new addressbook
- *
- * @param string $name
- * @param array $resourceType
- * @param array $properties
- * @return void
- */
- public function createExtendedCollection($name, array $resourceType, array $properties) {
-
- if (!in_array('{'.Sabre_CardDAV_Plugin::NS_CARDDAV.'}addressbook',$resourceType) || count($resourceType)!==2) {
- throw new Sabre_DAV_Exception_InvalidResourceType('Unknown resourceType for this collection');
- }
- $this->carddavBackend->createAddressBook($this->principalUri, $name, $properties);
-
- }
-
- /**
- * Returns the owner principal
- *
- * This must be a url to a principal, or null if there's no owner
- *
- * @return string|null
- */
- public function getOwner() {
-
- return $this->principalUri;
-
- }
-
- /**
- * Returns a group principal
- *
- * This must be a url to a principal, or null if there's no owner
- *
- * @return string|null
- */
- public function getGroup() {
-
- return null;
-
- }
-
- /**
- * Returns a list of ACE's for this node.
- *
- * Each ACE has the following properties:
- * * 'privilege', a string such as {DAV:}read or {DAV:}write. These are
- * currently the only supported privileges
- * * 'principal', a url to the principal who owns the node
- * * 'protected' (optional), indicating that this ACE is not allowed to
- * be updated.
- *
- * @return array
- */
- public function getACL() {
-
- return array(
- array(
- 'privilege' => '{DAV:}read',
- 'principal' => $this->principalUri,
- 'protected' => true,
- ),
- array(
- 'privilege' => '{DAV:}write',
- 'principal' => $this->principalUri,
- 'protected' => true,
- ),
-
- );
-
- }
-
- /**
- * Updates the ACL
- *
- * This method will receive a list of new ACE's.
- *
- * @param array $acl
- * @return void
- */
- public function setACL(array $acl) {
-
- throw new Sabre_DAV_Exception_MethodNotAllowed('Changing ACL is not yet supported');
-
- }
-
- /**
- * Returns the list of supported privileges for this node.
- *
- * The returned data structure is a list of nested privileges.
- * See Sabre_DAVACL_Plugin::getDefaultSupportedPrivilegeSet for a simple
- * standard structure.
- *
- * If null is returned from this method, the default privilege set is used,
- * which is fine for most common usecases.
- *
- * @return array|null
- */
- public function getSupportedPrivilegeSet() {
-
- return null;
-
- }
-
-}
diff --git a/3rdparty/Sabre/CardDAV/VCFExportPlugin.php b/3rdparty/Sabre/CardDAV/VCFExportPlugin.php
deleted file mode 100644
index 8850fef8afb..00000000000
--- a/3rdparty/Sabre/CardDAV/VCFExportPlugin.php
+++ /dev/null
@@ -1,107 +0,0 @@
-<?php
-
-use Sabre\VObject;
-
-/**
- * VCF Exporter
- *
- * This plugin adds the ability to export entire address books as .vcf files.
- * This is useful for clients that don't support CardDAV yet. They often do
- * support vcf files.
- *
- * @package Sabre
- * @subpackage CardDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @author Thomas Tanghus (http://tanghus.net/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CardDAV_VCFExportPlugin extends Sabre_DAV_ServerPlugin {
-
- /**
- * Reference to Server class
- *
- * @var Sabre_DAV_Server
- */
- private $server;
-
- /**
- * Initializes the plugin and registers event handlers
- *
- * @param Sabre_DAV_Server $server
- * @return void
- */
- public function initialize(Sabre_DAV_Server $server) {
-
- $this->server = $server;
- $this->server->subscribeEvent('beforeMethod',array($this,'beforeMethod'), 90);
-
- }
-
- /**
- * 'beforeMethod' event handles. This event handles intercepts GET requests ending
- * with ?export
- *
- * @param string $method
- * @param string $uri
- * @return bool
- */
- public function beforeMethod($method, $uri) {
-
- if ($method!='GET') return;
- if ($this->server->httpRequest->getQueryString()!='export') return;
-
- // splitting uri
- list($uri) = explode('?',$uri,2);
-
- $node = $this->server->tree->getNodeForPath($uri);
-
- if (!($node instanceof Sabre_CardDAV_IAddressBook)) return;
-
- // Checking ACL, if available.
- if ($aclPlugin = $this->server->getPlugin('acl')) {
- $aclPlugin->checkPrivileges($uri, '{DAV:}read');
- }
-
- $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);
-
- $this->server->httpResponse->sendBody($this->generateVCF($nodes));
-
- // Returning false to break the event chain
- return false;
-
- }
-
- /**
- * Merges all vcard objects, and builds one big vcf export
- *
- * @param array $nodes
- * @return string
- */
- public function generateVCF(array $nodes) {
-
- $output = "";
-
- foreach($nodes as $node) {
-
- if (!isset($node[200]['{' . Sabre_CardDAV_Plugin::NS_CARDDAV . '}address-data'])) {
- continue;
- }
- $nodeData = $node[200]['{' . Sabre_CardDAV_Plugin::NS_CARDDAV . '}address-data'];
-
- // Parsing this node so VObject can clean up the output.
- $output .=
- VObject\Reader::read($nodeData)->serialize();
-
- }
-
- return $output;
-
- }
-
-}
diff --git a/3rdparty/Sabre/CardDAV/Version.php b/3rdparty/Sabre/CardDAV/Version.php
deleted file mode 100644
index 6b70a2df9b5..00000000000
--- a/3rdparty/Sabre/CardDAV/Version.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-
-/**
- * Version Class
- *
- * This class contains the Sabre_CardDAV version information
- *
- * @package Sabre
- * @subpackage CardDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_CardDAV_Version {
-
- /**
- * Full version number
- */
- const VERSION = '1.7.0';
-
- /**
- * Stability : alpha, beta, stable
- */
- const STABILITY = 'stable';
-
-}
diff --git a/3rdparty/Sabre/CardDAV/includes.php b/3rdparty/Sabre/CardDAV/includes.php
deleted file mode 100644
index 08b4f76bd01..00000000000
--- a/3rdparty/Sabre/CardDAV/includes.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-
-/**
- * Sabre_CardDAV includes file
- *
- * Including this file will automatically include all files from the
- * Sabre_CardDAV package.
- *
- * This often allows faster loadtimes, as autoload-speed is often quite slow.
- *
- * @package Sabre
- * @subpackage CardDAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-
-// Begin includes
-include __DIR__ . '/AddressBookQueryParser.php';
-include __DIR__ . '/AddressBookRoot.php';
-include __DIR__ . '/Backend/Abstract.php';
-include __DIR__ . '/Backend/PDO.php';
-include __DIR__ . '/IAddressBook.php';
-include __DIR__ . '/ICard.php';
-include __DIR__ . '/IDirectory.php';
-include __DIR__ . '/Plugin.php';
-include __DIR__ . '/Property/SupportedAddressData.php';
-include __DIR__ . '/UserAddressBooks.php';
-include __DIR__ . '/VCFExportPlugin.php';
-include __DIR__ . '/Version.php';
-include __DIR__ . '/AddressBook.php';
-include __DIR__ . '/Card.php';
-// End includes
diff --git a/3rdparty/Sabre/DAV/Auth/Backend/AbstractBasic.php b/3rdparty/Sabre/DAV/Auth/Backend/AbstractBasic.php
deleted file mode 100644
index 1e89b84f9a1..00000000000
--- a/3rdparty/Sabre/DAV/Auth/Backend/AbstractBasic.php
+++ /dev/null
@@ -1,83 +0,0 @@
-<?php
-/**
- * HTTP Basic authentication backend class
- *
- * This class can be used by authentication objects wishing to use HTTP Basic
- * Most of the digest logic is handled, implementors just need to worry about
- * the validateUserPass method.
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author James David Low (http://jameslow.com/)
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-abstract class Sabre_DAV_Auth_Backend_AbstractBasic implements Sabre_DAV_Auth_IBackend {
-
- /**
- * This variable holds the currently logged in username.
- *
- * @var string|null
- */
- protected $currentUser;
-
- /**
- * Validates a username and password
- *
- * This method should return true or false depending on if login
- * succeeded.
- *
- * @param string $username
- * @param string $password
- * @return bool
- */
- abstract protected function validateUserPass($username, $password);
-
- /**
- * Returns information about the currently logged in username.
- *
- * If nobody is currently logged in, this method should return null.
- *
- * @return string|null
- */
- public function getCurrentUser() {
- return $this->currentUser;
- }
-
-
- /**
- * Authenticates the user based on the current request.
- *
- * If authentication is successful, true must be returned.
- * If authentication fails, an exception must be thrown.
- *
- * @param Sabre_DAV_Server $server
- * @param string $realm
- * @throws Sabre_DAV_Exception_NotAuthenticated
- * @return bool
- */
- public function authenticate(Sabre_DAV_Server $server, $realm) {
-
- $auth = new Sabre_HTTP_BasicAuth();
- $auth->setHTTPRequest($server->httpRequest);
- $auth->setHTTPResponse($server->httpResponse);
- $auth->setRealm($realm);
- $userpass = $auth->getUserPass();
- if (!$userpass) {
- $auth->requireLogin();
- throw new Sabre_DAV_Exception_NotAuthenticated('No basic authentication headers were found');
- }
-
- // Authenticates the user
- if (!$this->validateUserPass($userpass[0],$userpass[1])) {
- $auth->requireLogin();
- throw new Sabre_DAV_Exception_NotAuthenticated('Username or password does not match');
- }
- $this->currentUser = $userpass[0];
- return true;
- }
-
-
-}
-
diff --git a/3rdparty/Sabre/DAV/Auth/Backend/AbstractDigest.php b/3rdparty/Sabre/DAV/Auth/Backend/AbstractDigest.php
deleted file mode 100644
index 9833928b976..00000000000
--- a/3rdparty/Sabre/DAV/Auth/Backend/AbstractDigest.php
+++ /dev/null
@@ -1,98 +0,0 @@
-<?php
-
-/**
- * HTTP Digest authentication backend class
- *
- * This class can be used by authentication objects wishing to use HTTP Digest
- * Most of the digest logic is handled, implementors just need to worry about
- * the getDigestHash method
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-abstract class Sabre_DAV_Auth_Backend_AbstractDigest implements Sabre_DAV_Auth_IBackend {
-
- /**
- * This variable holds the currently logged in username.
- *
- * @var array|null
- */
- protected $currentUser;
-
- /**
- * Returns a users digest hash based on the username and realm.
- *
- * If the user was not known, null must be returned.
- *
- * @param string $realm
- * @param string $username
- * @return string|null
- */
- abstract public function getDigestHash($realm, $username);
-
- /**
- * Authenticates the user based on the current request.
- *
- * If authentication is successful, true must be returned.
- * If authentication fails, an exception must be thrown.
- *
- * @param Sabre_DAV_Server $server
- * @param string $realm
- * @throws Sabre_DAV_Exception_NotAuthenticated
- * @return bool
- */
- public function authenticate(Sabre_DAV_Server $server, $realm) {
-
- $digest = new Sabre_HTTP_DigestAuth();
-
- // Hooking up request and response objects
- $digest->setHTTPRequest($server->httpRequest);
- $digest->setHTTPResponse($server->httpResponse);
-
- $digest->setRealm($realm);
- $digest->init();
-
- $username = $digest->getUsername();
-
- // No username was given
- if (!$username) {
- $digest->requireLogin();
- throw new Sabre_DAV_Exception_NotAuthenticated('No digest authentication headers were found');
- }
-
- $hash = $this->getDigestHash($realm, $username);
- // If this was false, the user account didn't exist
- if ($hash===false || is_null($hash)) {
- $digest->requireLogin();
- throw new Sabre_DAV_Exception_NotAuthenticated('The supplied username was not on file');
- }
- if (!is_string($hash)) {
- throw new Sabre_DAV_Exception('The returned value from getDigestHash must be a string or null');
- }
-
- // If this was false, the password or part of the hash was incorrect.
- if (!$digest->validateA1($hash)) {
- $digest->requireLogin();
- throw new Sabre_DAV_Exception_NotAuthenticated('Incorrect username');
- }
-
- $this->currentUser = $username;
- return true;
-
- }
-
- /**
- * Returns the currently logged in username.
- *
- * @return string|null
- */
- public function getCurrentUser() {
-
- return $this->currentUser;
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAV/Auth/Backend/Apache.php b/3rdparty/Sabre/DAV/Auth/Backend/Apache.php
deleted file mode 100644
index d4294ea4d86..00000000000
--- a/3rdparty/Sabre/DAV/Auth/Backend/Apache.php
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-
-/**
- * Apache authenticator
- *
- * This authentication backend assumes that authentication has been
- * configured in apache, rather than within SabreDAV.
- *
- * Make sure apache is properly configured for this to work.
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Auth_Backend_Apache implements Sabre_DAV_Auth_IBackend {
-
- /**
- * Current apache user
- *
- * @var string
- */
- protected $remoteUser;
-
- /**
- * Authenticates the user based on the current request.
- *
- * If authentication is successful, true must be returned.
- * If authentication fails, an exception must be thrown.
- *
- * @param Sabre_DAV_Server $server
- * @param string $realm
- * @return bool
- */
- public function authenticate(Sabre_DAV_Server $server, $realm) {
-
- $remoteUser = $server->httpRequest->getRawServerValue('REMOTE_USER');
- if (is_null($remoteUser)) {
- throw new Sabre_DAV_Exception('We did not receive the $_SERVER[REMOTE_USER] property. This means that apache might have been misconfigured');
- }
-
- $this->remoteUser = $remoteUser;
- return true;
-
- }
-
- /**
- * Returns information about the currently logged in user.
- *
- * If nobody is currently logged in, this method should return null.
- *
- * @return array|null
- */
- public function getCurrentUser() {
-
- return $this->remoteUser;
-
- }
-
-}
-
diff --git a/3rdparty/Sabre/DAV/Auth/Backend/File.php b/3rdparty/Sabre/DAV/Auth/Backend/File.php
deleted file mode 100644
index de308d64a67..00000000000
--- a/3rdparty/Sabre/DAV/Auth/Backend/File.php
+++ /dev/null
@@ -1,75 +0,0 @@
-<?php
-
-/**
- * This is an authentication backend that uses a file to manage passwords.
- *
- * The backend file must conform to Apache's htdigest format
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Auth_Backend_File extends Sabre_DAV_Auth_Backend_AbstractDigest {
-
- /**
- * List of users
- *
- * @var array
- */
- protected $users = array();
-
- /**
- * Creates the backend object.
- *
- * If the filename argument is passed in, it will parse out the specified file fist.
- *
- * @param string|null $filename
- */
- public function __construct($filename=null) {
-
- if (!is_null($filename))
- $this->loadFile($filename);
-
- }
-
- /**
- * Loads an htdigest-formatted file. This method can be called multiple times if
- * more than 1 file is used.
- *
- * @param string $filename
- * @return void
- */
- public function loadFile($filename) {
-
- foreach(file($filename,FILE_IGNORE_NEW_LINES) as $line) {
-
- if (substr_count($line, ":") !== 2)
- throw new Sabre_DAV_Exception('Malformed htdigest file. Every line should contain 2 colons');
-
- list($username,$realm,$A1) = explode(':',$line);
-
- if (!preg_match('/^[a-zA-Z0-9]{32}$/', $A1))
- throw new Sabre_DAV_Exception('Malformed htdigest file. Invalid md5 hash');
-
- $this->users[$realm . ':' . $username] = $A1;
-
- }
-
- }
-
- /**
- * Returns a users' information
- *
- * @param string $realm
- * @param string $username
- * @return string
- */
- public function getDigestHash($realm, $username) {
-
- return isset($this->users[$realm . ':' . $username])?$this->users[$realm . ':' . $username]:false;
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAV/Auth/Backend/PDO.php b/3rdparty/Sabre/DAV/Auth/Backend/PDO.php
deleted file mode 100644
index eac18a23fbb..00000000000
--- a/3rdparty/Sabre/DAV/Auth/Backend/PDO.php
+++ /dev/null
@@ -1,65 +0,0 @@
-<?php
-
-/**
- * This is an authentication backend that uses a file to manage passwords.
- *
- * The backend file must conform to Apache's htdigest format
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Auth_Backend_PDO extends Sabre_DAV_Auth_Backend_AbstractDigest {
-
- /**
- * Reference to PDO connection
- *
- * @var PDO
- */
- protected $pdo;
-
- /**
- * PDO table name we'll be using
- *
- * @var string
- */
- protected $tableName;
-
-
- /**
- * Creates the backend object.
- *
- * If the filename argument is passed in, it will parse out the specified file fist.
- *
- * @param PDO $pdo
- * @param string $tableName The PDO table name to use
- */
- public function __construct(PDO $pdo, $tableName = 'users') {
-
- $this->pdo = $pdo;
- $this->tableName = $tableName;
-
- }
-
- /**
- * Returns the digest hash for a user.
- *
- * @param string $realm
- * @param string $username
- * @return string|null
- */
- public function getDigestHash($realm,$username) {
-
- $stmt = $this->pdo->prepare('SELECT username, digesta1 FROM '.$this->tableName.' WHERE username = ?');
- $stmt->execute(array($username));
- $result = $stmt->fetchAll();
-
- if (!count($result)) return;
-
- return $result[0]['digesta1'];
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAV/Auth/IBackend.php b/3rdparty/Sabre/DAV/Auth/IBackend.php
deleted file mode 100644
index 5be5d1bc93d..00000000000
--- a/3rdparty/Sabre/DAV/Auth/IBackend.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-
-/**
- * This is the base class for any authentication object.
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-interface Sabre_DAV_Auth_IBackend {
-
- /**
- * Authenticates the user based on the current request.
- *
- * If authentication is successful, true must be returned.
- * If authentication fails, an exception must be thrown.
- *
- * @param Sabre_DAV_Server $server
- * @param string $realm
- * @return bool
- */
- function authenticate(Sabre_DAV_Server $server,$realm);
-
- /**
- * Returns information about the currently logged in username.
- *
- * If nobody is currently logged in, this method should return null.
- *
- * @return string|null
- */
- function getCurrentUser();
-
-}
-
diff --git a/3rdparty/Sabre/DAV/Auth/Plugin.php b/3rdparty/Sabre/DAV/Auth/Plugin.php
deleted file mode 100644
index 55a4e391674..00000000000
--- a/3rdparty/Sabre/DAV/Auth/Plugin.php
+++ /dev/null
@@ -1,111 +0,0 @@
-<?php
-
-/**
- * This plugin provides Authentication for a WebDAV server.
- *
- * It relies on a Backend object, which provides user information.
- *
- * Additionally, it provides support for:
- * * {DAV:}current-user-principal property from RFC5397
- * * {DAV:}principal-collection-set property from RFC3744
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Auth_Plugin extends Sabre_DAV_ServerPlugin {
-
- /**
- * Reference to main server object
- *
- * @var Sabre_DAV_Server
- */
- private $server;
-
- /**
- * Authentication backend
- *
- * @var Sabre_DAV_Auth_IBackend
- */
- private $authBackend;
-
- /**
- * The authentication realm.
- *
- * @var string
- */
- private $realm;
-
- /**
- * __construct
- *
- * @param Sabre_DAV_Auth_IBackend $authBackend
- * @param string $realm
- */
- public function __construct(Sabre_DAV_Auth_IBackend $authBackend, $realm) {
-
- $this->authBackend = $authBackend;
- $this->realm = $realm;
-
- }
-
- /**
- * Initializes the plugin. This function is automatically called by the server
- *
- * @param Sabre_DAV_Server $server
- * @return void
- */
- public function initialize(Sabre_DAV_Server $server) {
-
- $this->server = $server;
- $this->server->subscribeEvent('beforeMethod',array($this,'beforeMethod'),10);
-
- }
-
- /**
- * Returns a plugin name.
- *
- * Using this name other plugins will be able to access other plugins
- * using Sabre_DAV_Server::getPlugin
- *
- * @return string
- */
- public function getPluginName() {
-
- return 'auth';
-
- }
-
- /**
- * Returns the current users' principal uri.
- *
- * If nobody is logged in, this will return null.
- *
- * @return string|null
- */
- public function getCurrentUser() {
-
- $userInfo = $this->authBackend->getCurrentUser();
- if (!$userInfo) return null;
-
- return $userInfo;
-
- }
-
- /**
- * This method is called before any HTTP method and forces users to be authenticated
- *
- * @param string $method
- * @param string $uri
- * @throws Sabre_DAV_Exception_NotAuthenticated
- * @return bool
- */
- public function beforeMethod($method, $uri) {
-
- $this->authBackend->authenticate($this->server,$this->realm);
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAV/Browser/GuessContentType.php b/3rdparty/Sabre/DAV/Browser/GuessContentType.php
deleted file mode 100644
index b6c00d461cb..00000000000
--- a/3rdparty/Sabre/DAV/Browser/GuessContentType.php
+++ /dev/null
@@ -1,97 +0,0 @@
-<?php
-
-/**
- * GuessContentType plugin
- *
- * A lot of the built-in File objects just return application/octet-stream
- * as a content-type by default. This is a problem for some clients, because
- * they expect a correct contenttype.
- *
- * There's really no accurate, fast and portable way to determine the contenttype
- * so this extension does what the rest of the world does, and guesses it based
- * on the file extension.
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Browser_GuessContentType extends Sabre_DAV_ServerPlugin {
-
- /**
- * List of recognized file extensions
- *
- * Feel free to add more
- *
- * @var array
- */
- public $extensionMap = array(
-
- // images
- 'jpg' => 'image/jpeg',
- 'gif' => 'image/gif',
- 'png' => 'image/png',
-
- // groupware
- 'ics' => 'text/calendar',
- 'vcf' => 'text/x-vcard',
-
- // text
- 'txt' => 'text/plain',
-
- );
-
- /**
- * Initializes the plugin
- *
- * @param Sabre_DAV_Server $server
- * @return void
- */
- public function initialize(Sabre_DAV_Server $server) {
-
- // Using a relatively low priority (200) to allow other extensions
- // to set the content-type first.
- $server->subscribeEvent('afterGetProperties',array($this,'afterGetProperties'),200);
-
- }
-
- /**
- * Handler for teh afterGetProperties event
- *
- * @param string $path
- * @param array $properties
- * @return void
- */
- public function afterGetProperties($path, &$properties) {
-
- if (array_key_exists('{DAV:}getcontenttype', $properties[404])) {
-
- list(, $fileName) = Sabre_DAV_URLUtil::splitPath($path);
- $contentType = $this->getContentType($fileName);
-
- if ($contentType) {
- $properties[200]['{DAV:}getcontenttype'] = $contentType;
- unset($properties[404]['{DAV:}getcontenttype']);
- }
-
- }
-
- }
-
- /**
- * Simple method to return the contenttype
- *
- * @param string $fileName
- * @return string
- */
- protected function getContentType($fileName) {
-
- // Just grabbing the extension
- $extension = strtolower(substr($fileName,strrpos($fileName,'.')+1));
- if (isset($this->extensionMap[$extension]))
- return $this->extensionMap[$extension];
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAV/Browser/MapGetToPropFind.php b/3rdparty/Sabre/DAV/Browser/MapGetToPropFind.php
deleted file mode 100644
index 15884887641..00000000000
--- a/3rdparty/Sabre/DAV/Browser/MapGetToPropFind.php
+++ /dev/null
@@ -1,55 +0,0 @@
-<?php
-
-/**
- * This is a simple plugin that will map any GET request for non-files to
- * PROPFIND allprops-requests.
- *
- * This should allow easy debugging of PROPFIND
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Browser_MapGetToPropFind extends Sabre_DAV_ServerPlugin {
-
- /**
- * reference to server class
- *
- * @var Sabre_DAV_Server
- */
- protected $server;
-
- /**
- * Initializes the plugin and subscribes to events
- *
- * @param Sabre_DAV_Server $server
- * @return void
- */
- public function initialize(Sabre_DAV_Server $server) {
-
- $this->server = $server;
- $this->server->subscribeEvent('beforeMethod',array($this,'httpGetInterceptor'));
- }
-
- /**
- * This method intercepts GET requests to non-files, and changes it into an HTTP PROPFIND request
- *
- * @param string $method
- * @param string $uri
- * @return bool
- */
- public function httpGetInterceptor($method, $uri) {
-
- if ($method!='GET') return true;
-
- $node = $this->server->tree->getNodeForPath($uri);
- if ($node instanceof Sabre_DAV_IFile) return;
-
- $this->server->invokeMethod('PROPFIND',$uri);
- return false;
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAV/Browser/Plugin.php b/3rdparty/Sabre/DAV/Browser/Plugin.php
deleted file mode 100644
index b6440ab6340..00000000000
--- a/3rdparty/Sabre/DAV/Browser/Plugin.php
+++ /dev/null
@@ -1,489 +0,0 @@
-<?php
-
-/**
- * Browser Plugin
- *
- * This plugin provides a html representation, so that a WebDAV server may be accessed
- * using a browser.
- *
- * The class intercepts GET requests to collection resources and generates a simple
- * html index.
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Browser_Plugin extends Sabre_DAV_ServerPlugin {
-
- /**
- * List of default icons for nodes.
- *
- * This is an array with class / interface names as keys, and asset names
- * as values.
- *
- * The evaluation order is reversed. The last item in the list gets
- * precendence.
- *
- * @var array
- */
- public $iconMap = array(
- 'Sabre_DAV_IFile' => 'icons/file',
- 'Sabre_DAV_ICollection' => 'icons/collection',
- 'Sabre_DAVACL_IPrincipal' => 'icons/principal',
- 'Sabre_CalDAV_ICalendar' => 'icons/calendar',
- 'Sabre_CardDAV_IAddressBook' => 'icons/addressbook',
- 'Sabre_CardDAV_ICard' => 'icons/card',
- );
-
- /**
- * The file extension used for all icons
- *
- * @var string
- */
- public $iconExtension = '.png';
-
- /**
- * reference to server class
- *
- * @var Sabre_DAV_Server
- */
- protected $server;
-
- /**
- * enablePost turns on the 'actions' panel, which allows people to create
- * folders and upload files straight from a browser.
- *
- * @var bool
- */
- protected $enablePost = true;
-
- /**
- * By default the browser plugin will generate a favicon and other images.
- * To turn this off, set this property to false.
- *
- * @var bool
- */
- protected $enableAssets = true;
-
- /**
- * Creates the object.
- *
- * By default it will allow file creation and uploads.
- * Specify the first argument as false to disable this
- *
- * @param bool $enablePost
- * @param bool $enableAssets
- */
- public function __construct($enablePost=true, $enableAssets = true) {
-
- $this->enablePost = $enablePost;
- $this->enableAssets = $enableAssets;
-
- }
-
- /**
- * Initializes the plugin and subscribes to events
- *
- * @param Sabre_DAV_Server $server
- * @return void
- */
- public function initialize(Sabre_DAV_Server $server) {
-
- $this->server = $server;
- $this->server->subscribeEvent('beforeMethod',array($this,'httpGetInterceptor'));
- $this->server->subscribeEvent('onHTMLActionsPanel', array($this, 'htmlActionsPanel'),200);
- if ($this->enablePost) $this->server->subscribeEvent('unknownMethod',array($this,'httpPOSTHandler'));
- }
-
- /**
- * This method intercepts GET requests to collections and returns the html
- *
- * @param string $method
- * @param string $uri
- * @return bool
- */
- public function httpGetInterceptor($method, $uri) {
-
- if ($method !== 'GET') return true;
-
- // We're not using straight-up $_GET, because we want everything to be
- // unit testable.
- $getVars = array();
- parse_str($this->server->httpRequest->getQueryString(), $getVars);
-
- if (isset($getVars['sabreAction']) && $getVars['sabreAction'] === 'asset' && isset($getVars['assetName'])) {
- $this->serveAsset($getVars['assetName']);
- return false;
- }
-
- try {
- $node = $this->server->tree->getNodeForPath($uri);
- } catch (Sabre_DAV_Exception_NotFound $e) {
- // We're simply stopping when the file isn't found to not interfere
- // with other plugins.
- return;
- }
- if ($node instanceof Sabre_DAV_IFile)
- return;
-
- $this->server->httpResponse->sendStatus(200);
- $this->server->httpResponse->setHeader('Content-Type','text/html; charset=utf-8');
-
- $this->server->httpResponse->sendBody(
- $this->generateDirectoryIndex($uri)
- );
-
- return false;
-
- }
-
- /**
- * Handles POST requests for tree operations.
- *
- * @param string $method
- * @param string $uri
- * @return bool
- */
- public function httpPOSTHandler($method, $uri) {
-
- if ($method!='POST') return;
- $contentType = $this->server->httpRequest->getHeader('Content-Type');
- list($contentType) = explode(';', $contentType);
- if ($contentType !== 'application/x-www-form-urlencoded' &&
- $contentType !== 'multipart/form-data') {
- return;
- }
- $postVars = $this->server->httpRequest->getPostVars();
-
- if (!isset($postVars['sabreAction']))
- return;
-
- if ($this->server->broadcastEvent('onBrowserPostAction', array($uri, $postVars['sabreAction'], $postVars))) {
-
- switch($postVars['sabreAction']) {
-
- case 'mkcol' :
- if (isset($postVars['name']) && trim($postVars['name'])) {
- // Using basename() because we won't allow slashes
- list(, $folderName) = Sabre_DAV_URLUtil::splitPath(trim($postVars['name']));
- $this->server->createDirectory($uri . '/' . $folderName);
- }
- break;
- case 'put' :
- if ($_FILES) $file = current($_FILES);
- else break;
-
- list(, $newName) = Sabre_DAV_URLUtil::splitPath(trim($file['name']));
- if (isset($postVars['name']) && trim($postVars['name']))
- $newName = trim($postVars['name']);
-
- // Making sure we only have a 'basename' component
- list(, $newName) = Sabre_DAV_URLUtil::splitPath($newName);
-
- if (is_uploaded_file($file['tmp_name'])) {
- $this->server->createFile($uri . '/' . $newName, fopen($file['tmp_name'],'r'));
- }
- break;
-
- }
-
- }
- $this->server->httpResponse->setHeader('Location',$this->server->httpRequest->getUri());
- $this->server->httpResponse->sendStatus(302);
- return false;
-
- }
-
- /**
- * Escapes a string for html.
- *
- * @param string $value
- * @return string
- */
- public function escapeHTML($value) {
-
- return htmlspecialchars($value,ENT_QUOTES,'UTF-8');
-
- }
-
- /**
- * Generates the html directory index for a given url
- *
- * @param string $path
- * @return string
- */
- public function generateDirectoryIndex($path) {
-
- $version = '';
- if (Sabre_DAV_Server::$exposeVersion) {
- $version = Sabre_DAV_Version::VERSION ."-". Sabre_DAV_Version::STABILITY;
- }
-
- $html = "<html>
-<head>
- <title>Index for " . $this->escapeHTML($path) . "/ - SabreDAV " . $version . "</title>
- <style type=\"text/css\">
- body { Font-family: arial}
- h1 { font-size: 150% }
- </style>
- ";
-
- if ($this->enableAssets) {
- $html.='<link rel="shortcut icon" href="'.$this->getAssetUrl('favicon.ico').'" type="image/vnd.microsoft.icon" />';
- }
-
- $html .= "</head>
-<body>
- <h1>Index for " . $this->escapeHTML($path) . "/</h1>
- <table>
- <tr><th width=\"24\"></th><th>Name</th><th>Type</th><th>Size</th><th>Last modified</th></tr>
- <tr><td colspan=\"5\"><hr /></td></tr>";
-
- $files = $this->server->getPropertiesForPath($path,array(
- '{DAV:}displayname',
- '{DAV:}resourcetype',
- '{DAV:}getcontenttype',
- '{DAV:}getcontentlength',
- '{DAV:}getlastmodified',
- ),1);
-
- $parent = $this->server->tree->getNodeForPath($path);
-
-
- if ($path) {
-
- list($parentUri) = Sabre_DAV_URLUtil::splitPath($path);
- $fullPath = Sabre_DAV_URLUtil::encodePath($this->server->getBaseUri() . $parentUri);
-
- $icon = $this->enableAssets?'<a href="' . $fullPath . '"><img src="' . $this->getAssetUrl('icons/parent' . $this->iconExtension) . '" width="24" alt="Parent" /></a>':'';
- $html.= "<tr>
- <td>$icon</td>
- <td><a href=\"{$fullPath}\">..</a></td>
- <td>[parent]</td>
- <td></td>
- <td></td>
- </tr>";
-
- }
-
- foreach($files as $file) {
-
- // This is the current directory, we can skip it
- if (rtrim($file['href'],'/')==$path) continue;
-
- list(, $name) = Sabre_DAV_URLUtil::splitPath($file['href']);
-
- $type = null;
-
-
- if (isset($file[200]['{DAV:}resourcetype'])) {
- $type = $file[200]['{DAV:}resourcetype']->getValue();
-
- // resourcetype can have multiple values
- if (!is_array($type)) $type = array($type);
-
- foreach($type as $k=>$v) {
-
- // Some name mapping is preferred
- switch($v) {
- case '{DAV:}collection' :
- $type[$k] = 'Collection';
- break;
- case '{DAV:}principal' :
- $type[$k] = 'Principal';
- break;
- case '{urn:ietf:params:xml:ns:carddav}addressbook' :
- $type[$k] = 'Addressbook';
- break;
- case '{urn:ietf:params:xml:ns:caldav}calendar' :
- $type[$k] = 'Calendar';
- break;
- case '{urn:ietf:params:xml:ns:caldav}schedule-inbox' :
- $type[$k] = 'Schedule Inbox';
- break;
- case '{urn:ietf:params:xml:ns:caldav}schedule-outbox' :
- $type[$k] = 'Schedule Outbox';
- break;
- case '{http://calendarserver.org/ns/}calendar-proxy-read' :
- $type[$k] = 'Proxy-Read';
- break;
- case '{http://calendarserver.org/ns/}calendar-proxy-write' :
- $type[$k] = 'Proxy-Write';
- break;
- }
-
- }
- $type = implode(', ', $type);
- }
-
- // If no resourcetype was found, we attempt to use
- // the contenttype property
- if (!$type && isset($file[200]['{DAV:}getcontenttype'])) {
- $type = $file[200]['{DAV:}getcontenttype'];
- }
- if (!$type) $type = 'Unknown';
-
- $size = isset($file[200]['{DAV:}getcontentlength'])?(int)$file[200]['{DAV:}getcontentlength']:'';
- $lastmodified = isset($file[200]['{DAV:}getlastmodified'])?$file[200]['{DAV:}getlastmodified']->getTime()->format(DateTime::ATOM):'';
-
- $fullPath = Sabre_DAV_URLUtil::encodePath('/' . trim($this->server->getBaseUri() . ($path?$path . '/':'') . $name,'/'));
-
- $displayName = isset($file[200]['{DAV:}displayname'])?$file[200]['{DAV:}displayname']:$name;
-
- $displayName = $this->escapeHTML($displayName);
- $type = $this->escapeHTML($type);
-
- $icon = '';
-
- if ($this->enableAssets) {
- $node = $this->server->tree->getNodeForPath(($path?$path.'/':'') . $name);
- foreach(array_reverse($this->iconMap) as $class=>$iconName) {
-
- if ($node instanceof $class) {
- $icon = '<a href="' . $fullPath . '"><img src="' . $this->getAssetUrl($iconName . $this->iconExtension) . '" alt="" width="24" /></a>';
- break;
- }
-
-
- }
-
- }
-
- $html.= "<tr>
- <td>$icon</td>
- <td><a href=\"{$fullPath}\">{$displayName}</a></td>
- <td>{$type}</td>
- <td>{$size}</td>
- <td>{$lastmodified}</td>
- </tr>";
-
- }
-
- $html.= "<tr><td colspan=\"5\"><hr /></td></tr>";
-
- $output = '';
-
- if ($this->enablePost) {
- $this->server->broadcastEvent('onHTMLActionsPanel',array($parent, &$output));
- }
-
- $html.=$output;
-
- $html.= "</table>
- <address>Generated by SabreDAV " . $version . " (c)2007-2012 <a href=\"http://code.google.com/p/sabredav/\">http://code.google.com/p/sabredav/</a></address>
- </body>
- </html>";
-
- return $html;
-
- }
-
- /**
- * This method is used to generate the 'actions panel' output for
- * collections.
- *
- * This specifically generates the interfaces for creating new files, and
- * creating new directories.
- *
- * @param Sabre_DAV_INode $node
- * @param mixed $output
- * @return void
- */
- public function htmlActionsPanel(Sabre_DAV_INode $node, &$output) {
-
- if (!$node instanceof Sabre_DAV_ICollection)
- return;
-
- // We also know fairly certain that if an object is a non-extended
- // SimpleCollection, we won't need to show the panel either.
- if (get_class($node)==='Sabre_DAV_SimpleCollection')
- return;
-
- $output.= '<tr><td colspan="2"><form method="post" action="">
- <h3>Create new folder</h3>
- <input type="hidden" name="sabreAction" value="mkcol" />
- Name: <input type="text" name="name" /><br />
- <input type="submit" value="create" />
- </form>
- <form method="post" action="" enctype="multipart/form-data">
- <h3>Upload file</h3>
- <input type="hidden" name="sabreAction" value="put" />
- Name (optional): <input type="text" name="name" /><br />
- File: <input type="file" name="file" /><br />
- <input type="submit" value="upload" />
- </form>
- </td></tr>';
-
- }
-
- /**
- * This method takes a path/name of an asset and turns it into url
- * suiteable for http access.
- *
- * @param string $assetName
- * @return string
- */
- protected function getAssetUrl($assetName) {
-
- return $this->server->getBaseUri() . '?sabreAction=asset&assetName=' . urlencode($assetName);
-
- }
-
- /**
- * This method returns a local pathname to an asset.
- *
- * @param string $assetName
- * @return string
- */
- protected function getLocalAssetPath($assetName) {
-
- // Making sure people aren't trying to escape from the base path.
- $assetSplit = explode('/', $assetName);
- if (in_array('..',$assetSplit)) {
- throw new Sabre_DAV_Exception('Incorrect asset path');
- }
- $path = __DIR__ . '/assets/' . $assetName;
- return $path;
-
- }
-
- /**
- * This method reads an asset from disk and generates a full http response.
- *
- * @param string $assetName
- * @return void
- */
- protected function serveAsset($assetName) {
-
- $assetPath = $this->getLocalAssetPath($assetName);
- if (!file_exists($assetPath)) {
- throw new Sabre_DAV_Exception_NotFound('Could not find an asset with this name');
- }
- // Rudimentary mime type detection
- switch(strtolower(substr($assetPath,strpos($assetPath,'.')+1))) {
-
- case 'ico' :
- $mime = 'image/vnd.microsoft.icon';
- break;
-
- case 'png' :
- $mime = 'image/png';
- break;
-
- default:
- $mime = 'application/octet-stream';
- break;
-
- }
-
- $this->server->httpResponse->setHeader('Content-Type', $mime);
- $this->server->httpResponse->setHeader('Content-Length', filesize($assetPath));
- $this->server->httpResponse->setHeader('Cache-Control', 'public, max-age=1209600');
- $this->server->httpResponse->sendStatus(200);
- $this->server->httpResponse->sendBody(fopen($assetPath,'r'));
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAV/Browser/assets/favicon.ico b/3rdparty/Sabre/DAV/Browser/assets/favicon.ico
deleted file mode 100644
index 2b2c10a22cc..00000000000
--- a/3rdparty/Sabre/DAV/Browser/assets/favicon.ico
+++ /dev/null
Binary files differ
diff --git a/3rdparty/Sabre/DAV/Browser/assets/icons/addressbook.png b/3rdparty/Sabre/DAV/Browser/assets/icons/addressbook.png
deleted file mode 100644
index c9acc84172d..00000000000
--- a/3rdparty/Sabre/DAV/Browser/assets/icons/addressbook.png
+++ /dev/null
Binary files differ
diff --git a/3rdparty/Sabre/DAV/Browser/assets/icons/calendar.png b/3rdparty/Sabre/DAV/Browser/assets/icons/calendar.png
deleted file mode 100644
index 3ecd6a800a0..00000000000
--- a/3rdparty/Sabre/DAV/Browser/assets/icons/calendar.png
+++ /dev/null
Binary files differ
diff --git a/3rdparty/Sabre/DAV/Browser/assets/icons/card.png b/3rdparty/Sabre/DAV/Browser/assets/icons/card.png
deleted file mode 100644
index 2ce954866d8..00000000000
--- a/3rdparty/Sabre/DAV/Browser/assets/icons/card.png
+++ /dev/null
Binary files differ
diff --git a/3rdparty/Sabre/DAV/Browser/assets/icons/collection.png b/3rdparty/Sabre/DAV/Browser/assets/icons/collection.png
deleted file mode 100644
index 156fa64fd50..00000000000
--- a/3rdparty/Sabre/DAV/Browser/assets/icons/collection.png
+++ /dev/null
Binary files differ
diff --git a/3rdparty/Sabre/DAV/Browser/assets/icons/file.png b/3rdparty/Sabre/DAV/Browser/assets/icons/file.png
deleted file mode 100644
index 3b98551cec3..00000000000
--- a/3rdparty/Sabre/DAV/Browser/assets/icons/file.png
+++ /dev/null
Binary files differ
diff --git a/3rdparty/Sabre/DAV/Browser/assets/icons/parent.png b/3rdparty/Sabre/DAV/Browser/assets/icons/parent.png
deleted file mode 100644
index 156fa64fd50..00000000000
--- a/3rdparty/Sabre/DAV/Browser/assets/icons/parent.png
+++ /dev/null
Binary files differ
diff --git a/3rdparty/Sabre/DAV/Browser/assets/icons/principal.png b/3rdparty/Sabre/DAV/Browser/assets/icons/principal.png
deleted file mode 100644
index f8988f828e6..00000000000
--- a/3rdparty/Sabre/DAV/Browser/assets/icons/principal.png
+++ /dev/null
Binary files differ
diff --git a/3rdparty/Sabre/DAV/Client.php b/3rdparty/Sabre/DAV/Client.php
deleted file mode 100644
index 9d9f4c96b02..00000000000
--- a/3rdparty/Sabre/DAV/Client.php
+++ /dev/null
@@ -1,541 +0,0 @@
-<?php
-
-/**
- * SabreDAV DAV client
- *
- * This client wraps around Curl to provide a convenient API to a WebDAV
- * server.
- *
- * NOTE: This class is experimental, it's api will likely change in the future.
- *
- * @package Sabre
- * @subpackage DAVClient
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Client {
-
- /**
- * The propertyMap is a key-value array.
- *
- * If you use the propertyMap, any {DAV:}multistatus responses with the
- * proeprties listed in this array, will automatically be mapped to a
- * respective class.
- *
- * The {DAV:}resourcetype property is automatically added. This maps to
- * Sabre_DAV_Property_ResourceType
- *
- * @var array
- */
- public $propertyMap = array();
-
- protected $baseUri;
- protected $userName;
- protected $password;
- protected $proxy;
- protected $trustedCertificates;
-
- /**
- * 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
- * settings are supported:
- *
- * * baseUri
- * * userName (optional)
- * * password (optional)
- * * proxy (optional)
- *
- * @param array $settings
- */
- public function __construct(array $settings) {
-
- if (!isset($settings['baseUri'])) {
- throw new InvalidArgumentException('A baseUri must be provided');
- }
-
- $validSettings = array(
- 'baseUri',
- 'userName',
- 'password',
- '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';
-
- }
-
- /**
- * Add trusted root certificates to the webdav client.
- *
- * The parameter certificates should be a absulute path to a file
- * which contains all trusted certificates
- *
- * @param string $certificates
- */
- public function addTrustedCertificates($certificates) {
- $this->trustedCertificates = $certificates;
- }
-
- /**
- * Does a PROPFIND request
- *
- * The list of requested properties must be specified as an array, in clark
- * notation.
- *
- * The returned array will contain a list of filenames as keys, and
- * properties as values.
- *
- * The properties array will contain the list of properties. Only properties
- * that are actually returned from the server (without error) will be
- * returned, anything else is discarded.
- *
- * Depth should be either 0 or 1. A depth of 1 will cause a request to be
- * made to the server to also return all child resources.
- *
- * @param string $url
- * @param array $properties
- * @param int $depth
- * @return array
- */
- public function propFind($url, array $properties, $depth = 0) {
-
- $body = '<?xml version="1.0"?>' . "\n";
- $body.= '<d:propfind xmlns:d="DAV:">' . "\n";
- $body.= ' <d:prop>' . "\n";
-
- foreach($properties as $property) {
-
- list(
- $namespace,
- $elementName
- ) = Sabre_DAV_XMLUtil::parseClarkNotation($property);
-
- if ($namespace === 'DAV:') {
- $body.=' <d:' . $elementName . ' />' . "\n";
- } else {
- $body.=" <x:" . $elementName . " xmlns:x=\"" . $namespace . "\"/>\n";
- }
-
- }
-
- $body.= ' </d:prop>' . "\n";
- $body.= '</d:propfind>';
-
- $response = $this->request('PROPFIND', $url, $body, array(
- 'Depth' => $depth,
- 'Content-Type' => 'application/xml'
- ));
-
- $result = $this->parseMultiStatus($response['body']);
-
- // If depth was 0, we only return the top item
- if ($depth===0) {
- reset($result);
- $result = current($result);
- return isset($result[200])?$result[200]:array();
- }
-
- $newResult = array();
- foreach($result as $href => $statusList) {
-
- $newResult[$href] = isset($statusList[200])?$statusList[200]:array();
-
- }
-
- return $newResult;
-
- }
-
- /**
- * Updates a list of properties on the server
- *
- * The list of properties must have clark-notation properties for the keys,
- * and the actual (string) value for the value. If the value is null, an
- * attempt is made to delete the property.
- *
- * @todo Must be building the request using the DOM, and does not yet
- * support complex properties.
- * @param string $url
- * @param array $properties
- * @return void
- */
- public function propPatch($url, array $properties) {
-
- $body = '<?xml version="1.0"?>' . "\n";
- $body.= '<d:propertyupdate xmlns:d="DAV:">' . "\n";
-
- foreach($properties as $propName => $propValue) {
-
- list(
- $namespace,
- $elementName
- ) = Sabre_DAV_XMLUtil::parseClarkNotation($propName);
-
- if ($propValue === null) {
-
- $body.="<d:remove><d:prop>\n";
-
- if ($namespace === 'DAV:') {
- $body.=' <d:' . $elementName . ' />' . "\n";
- } else {
- $body.=" <x:" . $elementName . " xmlns:x=\"" . $namespace . "\"/>\n";
- }
-
- $body.="</d:prop></d:remove>\n";
-
- } else {
-
- $body.="<d:set><d:prop>\n";
- if ($namespace === 'DAV:') {
- $body.=' <d:' . $elementName . '>';
- } else {
- $body.=" <x:" . $elementName . " xmlns:x=\"" . $namespace . "\">";
- }
- // Shitty.. i know
- $body.=htmlspecialchars($propValue, ENT_NOQUOTES, 'UTF-8');
- if ($namespace === 'DAV:') {
- $body.='</d:' . $elementName . '>' . "\n";
- } else {
- $body.="</x:" . $elementName . ">\n";
- }
- $body.="</d:prop></d:set>\n";
-
- }
-
- }
-
- $body.= '</d:propertyupdate>';
-
- $this->request('PROPPATCH', $url, $body, array(
- 'Content-Type' => 'application/xml'
- ));
-
- }
-
- /**
- * Performs an HTTP options request
- *
- * This method returns all the features from the 'DAV:' header as an array.
- * If there was no DAV header, or no contents this method will return an
- * empty array.
- *
- * @return array
- */
- public function options() {
-
- $result = $this->request('OPTIONS');
- if (!isset($result['headers']['dav'])) {
- return array();
- }
-
- $features = explode(',', $result['headers']['dav']);
- foreach($features as &$v) {
- $v = trim($v);
- }
- return $features;
-
- }
-
- /**
- * Performs an actual HTTP request, and returns the result.
- *
- * If the specified url is relative, it will be expanded based on the base
- * url.
- *
- * The returned array contains 3 keys:
- * * body - the response body
- * * httpCode - a HTTP code (200, 404, etc)
- * * headers - a list of response http headers. The header names have
- * been lowercased.
- *
- * @param string $method
- * @param string $url
- * @param string $body
- * @param array $headers
- * @return array
- */
- public function request($method, $url = '', $body = null, $headers = array()) {
-
- $url = $this->getAbsoluteUrl($url);
-
- $curlSettings = array(
- CURLOPT_RETURNTRANSFER => true,
- // Return headers as part of the response
- CURLOPT_HEADER => true,
- CURLOPT_POSTFIELDS => $body,
- // Automatically follow redirects
- CURLOPT_FOLLOWLOCATION => true,
- CURLOPT_MAXREDIRS => 5,
- );
-
- if($this->trustedCertificates) {
- $curlSettings[CURLOPT_CAINFO] = $this->trustedCertificates;
- }
-
- switch ($method) {
- case 'HEAD' :
-
- // do not read body with HEAD requests (this is neccessary because cURL does not ignore the body with HEAD
- // requests when the Content-Length header is given - which in turn is perfectly valid according to HTTP
- // specs...) cURL does unfortunately return an error in this case ("transfer closed transfer closed with
- // ... bytes remaining to read") this can be circumvented by explicitly telling cURL to ignore the
- // response body
- $curlSettings[CURLOPT_NOBODY] = true;
- $curlSettings[CURLOPT_CUSTOMREQUEST] = 'HEAD';
- break;
-
- default:
- $curlSettings[CURLOPT_CUSTOMREQUEST] = $method;
- break;
-
- }
-
- // Adding HTTP headers
- $nHeaders = array();
- foreach($headers as $key=>$value) {
-
- $nHeaders[] = $key . ': ' . $value;
-
- }
- $curlSettings[CURLOPT_HTTPHEADER] = $nHeaders;
-
- if ($this->proxy) {
- $curlSettings[CURLOPT_PROXY] = $this->proxy;
- }
-
- 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;
- }
-
- list(
- $response,
- $curlInfo,
- $curlErrNo,
- $curlError
- ) = $this->curlRequest($url, $curlSettings);
-
- $headerBlob = substr($response, 0, $curlInfo['header_size']);
- $response = substr($response, $curlInfo['header_size']);
-
- // In the case of 100 Continue, or redirects we'll have multiple lists
- // of headers for each separate HTTP response. We can easily split this
- // because they are separated by \r\n\r\n
- $headerBlob = explode("\r\n\r\n", trim($headerBlob, "\r\n"));
-
- // We only care about the last set of headers
- $headerBlob = $headerBlob[count($headerBlob)-1];
-
- // Splitting headers
- $headerBlob = explode("\r\n", $headerBlob);
-
- $headers = array();
- foreach($headerBlob as $header) {
- $parts = explode(':', $header, 2);
- if (count($parts)==2) {
- $headers[strtolower(trim($parts[0]))] = trim($parts[1]);
- }
- }
-
- $response = array(
- 'body' => $response,
- 'statusCode' => $curlInfo['http_code'],
- 'headers' => $headers
- );
-
- if ($curlErrNo) {
- throw new Sabre_DAV_Exception('[CURL] Error while making request: ' . $curlError . ' (error code: ' . $curlErrNo . ')');
- }
-
- if ($response['statusCode']>=400) {
- switch ($response['statusCode']) {
- case 400 :
- throw new Sabre_DAV_Exception_BadRequest('Bad request');
- case 401 :
- throw new Sabre_DAV_Exception_NotAuthenticated('Not authenticated');
- case 402 :
- throw new Sabre_DAV_Exception_PaymentRequired('Payment required');
- case 403 :
- throw new Sabre_DAV_Exception_Forbidden('Forbidden');
- case 404:
- throw new Sabre_DAV_Exception_NotFound('Resource not found.');
- case 405 :
- throw new Sabre_DAV_Exception_MethodNotAllowed('Method not allowed');
- case 409 :
- throw new Sabre_DAV_Exception_Conflict('Conflict');
- case 412 :
- throw new Sabre_DAV_Exception_PreconditionFailed('Precondition failed');
- case 416 :
- throw new Sabre_DAV_Exception_RequestedRangeNotSatisfiable('Requested Range Not Satisfiable');
- case 500 :
- throw new Sabre_DAV_Exception('Internal server error');
- case 501 :
- throw new Sabre_DAV_Exception_NotImplemented('Not Implemented');
- case 507 :
- throw new Sabre_DAV_Exception_InsufficientStorage('Insufficient storage');
- default:
- throw new Sabre_DAV_Exception('HTTP error response. (errorcode ' . $response['statusCode'] . ')');
- }
- }
-
- return $response;
-
- }
-
- /**
- * Wrapper for all curl functions.
- *
- * The only reason this was split out in a separate method, is so it
- * becomes easier to unittest.
- *
- * @param string $url
- * @param array $settings
- * @return array
- */
- // @codeCoverageIgnoreStart
- protected function curlRequest($url, $settings) {
-
- $curl = curl_init($url);
- curl_setopt_array($curl, $settings);
-
- return array(
- curl_exec($curl),
- curl_getinfo($curl),
- curl_errno($curl),
- curl_error($curl)
- );
-
- }
- // @codeCoverageIgnoreEnd
-
- /**
- * Returns the full url based on the given url (which may be relative). All
- * urls are expanded based on the base url as given by the server.
- *
- * @param string $url
- * @return string
- */
- protected function getAbsoluteUrl($url) {
-
- // If the url starts with http:// or https://, the url is already absolute.
- if (preg_match('/^http(s?):\/\//', $url)) {
- return $url;
- }
-
- // If the url starts with a slash, we must calculate the url based off
- // the root of the base url.
- if (strpos($url,'/') === 0) {
- $parts = parse_url($this->baseUri);
- return $parts['scheme'] . '://' . $parts['host'] . (isset($parts['port'])?':' . $parts['port']:'') . $url;
- }
-
- // Otherwise...
- return $this->baseUri . $url;
-
- }
-
- /**
- * Parses a WebDAV multistatus response body
- *
- * This method returns an array with the following structure
- *
- * array(
- * 'url/to/resource' => array(
- * '200' => array(
- * '{DAV:}property1' => 'value1',
- * '{DAV:}property2' => 'value2',
- * ),
- * '404' => array(
- * '{DAV:}property1' => null,
- * '{DAV:}property2' => null,
- * ),
- * )
- * 'url/to/resource2' => array(
- * .. etc ..
- * )
- * )
- *
- *
- * @param string $body xml body
- * @return array
- */
- public function parseMultiStatus($body) {
-
- $responseXML = simplexml_load_string($body, null, LIBXML_NOBLANKS | LIBXML_NOCDATA);
- if ($responseXML===false) {
- throw new InvalidArgumentException('The passed data is not valid XML');
- }
-
- $responseXML->registerXPathNamespace('d', 'DAV:');
-
- $propResult = array();
-
- foreach($responseXML->xpath('d:response') as $response) {
- $response->registerXPathNamespace('d', 'DAV:');
- $href = $response->xpath('d:href');
- $href = (string)$href[0];
-
- $properties = array();
-
- foreach($response->xpath('d:propstat') as $propStat) {
-
- $propStat->registerXPathNamespace('d', 'DAV:');
- $status = $propStat->xpath('d:status');
- list($httpVersion, $statusCode, $message) = explode(' ', (string)$status[0],3);
-
- $properties[$statusCode] = Sabre_DAV_XMLUtil::parseProperties(dom_import_simplexml($propStat), $this->propertyMap);
-
- }
-
- $propResult[$href] = $properties;
-
- }
-
- return $propResult;
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAV/Collection.php b/3rdparty/Sabre/DAV/Collection.php
deleted file mode 100644
index c7648a8a52d..00000000000
--- a/3rdparty/Sabre/DAV/Collection.php
+++ /dev/null
@@ -1,110 +0,0 @@
-<?php
-
-/**
- * Collection class
- *
- * This is a helper class, that should aid in getting collections classes setup.
- * Most of its methods are implemented, and throw permission denied exceptions
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-abstract class Sabre_DAV_Collection extends Sabre_DAV_Node implements Sabre_DAV_ICollection {
-
- /**
- * Returns a child object, by its name.
- *
- * This method makes use of the getChildren method to grab all the child
- * nodes, and compares the name.
- * Generally its wise to override this, as this can usually be optimized
- *
- * This method must throw Sabre_DAV_Exception_NotFound if the node does not
- * exist.
- *
- * @param string $name
- * @throws Sabre_DAV_Exception_NotFound
- * @return Sabre_DAV_INode
- */
- public function getChild($name) {
-
- foreach($this->getChildren() as $child) {
-
- if ($child->getName()==$name) return $child;
-
- }
- throw new Sabre_DAV_Exception_NotFound('File not found: ' . $name);
-
- }
-
- /**
- * Checks is a child-node exists.
- *
- * It is generally a good idea to try and override this. Usually it can be optimized.
- *
- * @param string $name
- * @return bool
- */
- public function childExists($name) {
-
- try {
-
- $this->getChild($name);
- return true;
-
- } catch(Sabre_DAV_Exception_NotFound $e) {
-
- return false;
-
- }
-
- }
-
- /**
- * Creates a new file in the directory
- *
- * 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|string $data Initial payload
- * @return null|string
- */
- public function createFile($name, $data = null) {
-
- throw new Sabre_DAV_Exception_Forbidden('Permission denied to create file (filename ' . $name . ')');
-
- }
-
- /**
- * Creates a new subdirectory
- *
- * @param string $name
- * @throws Sabre_DAV_Exception_Forbidden
- * @return void
- */
- public function createDirectory($name) {
-
- throw new Sabre_DAV_Exception_Forbidden('Permission denied to create directory');
-
- }
-
-
-}
-
diff --git a/3rdparty/Sabre/DAV/Exception.php b/3rdparty/Sabre/DAV/Exception.php
deleted file mode 100644
index a2cd6cf5820..00000000000
--- a/3rdparty/Sabre/DAV/Exception.php
+++ /dev/null
@@ -1,64 +0,0 @@
-<?php
-
-/**
- * SabreDAV base exception
- *
- * This is SabreDAV's base exception file, use this to implement your own exception.
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-
-/**
- * Main Exception class.
- *
- * This class defines a getHTTPCode method, which should return the appropriate HTTP code for the Exception occurred.
- * The default for this is 500.
- *
- * This class also allows you to generate custom xml data for your exceptions. This will be displayed
- * in the 'error' element in the failing response.
- */
-class Sabre_DAV_Exception extends Exception {
-
- /**
- * Returns the HTTP statuscode for this exception
- *
- * @return int
- */
- public function getHTTPCode() {
-
- return 500;
-
- }
-
- /**
- * This method allows the exception to include additional information into the WebDAV error response
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $errorNode
- * @return void
- */
- public function serialize(Sabre_DAV_Server $server,DOMElement $errorNode) {
-
-
- }
-
- /**
- * This method allows the exception to return any extra HTTP response headers.
- *
- * The headers must be returned as an array.
- *
- * @param Sabre_DAV_Server $server
- * @return array
- */
- public function getHTTPHeaders(Sabre_DAV_Server $server) {
-
- return array();
-
- }
-
-}
-
diff --git a/3rdparty/Sabre/DAV/Exception/BadRequest.php b/3rdparty/Sabre/DAV/Exception/BadRequest.php
deleted file mode 100644
index b198648a754..00000000000
--- a/3rdparty/Sabre/DAV/Exception/BadRequest.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-
-/**
- * BadRequest
- *
- * The BadRequest is thrown when the user submitted an invalid HTTP request
- * BadRequest
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Exception_BadRequest extends Sabre_DAV_Exception {
-
- /**
- * Returns the HTTP statuscode for this exception
- *
- * @return int
- */
- public function getHTTPCode() {
-
- return 400;
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAV/Exception/Conflict.php b/3rdparty/Sabre/DAV/Exception/Conflict.php
deleted file mode 100644
index 6b0bd1fad73..00000000000
--- a/3rdparty/Sabre/DAV/Exception/Conflict.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-
-/**
- * Conflict
- *
- * A 409 Conflict is thrown when a user tried to make a directory over an existing
- * file or in a parent directory that doesn't exist.
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Exception_Conflict extends Sabre_DAV_Exception {
-
- /**
- * Returns the HTTP statuscode for this exception
- *
- * @return int
- */
- public function getHTTPCode() {
-
- return 409;
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAV/Exception/ConflictingLock.php b/3rdparty/Sabre/DAV/Exception/ConflictingLock.php
deleted file mode 100644
index 6121868e69e..00000000000
--- a/3rdparty/Sabre/DAV/Exception/ConflictingLock.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-
-/**
- * ConflictingLock
- *
- * Similar to Exception_Locked, this exception thrown when a LOCK request
- * was made, on a resource which was already locked
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Exception_ConflictingLock extends Sabre_DAV_Exception_Locked {
-
- /**
- * This method allows the exception to include additional information into the WebDAV error response
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $errorNode
- * @return void
- */
- public function serialize(Sabre_DAV_Server $server,DOMElement $errorNode) {
-
- if ($this->lock) {
- $error = $errorNode->ownerDocument->createElementNS('DAV:','d:no-conflicting-lock');
- $errorNode->appendChild($error);
- if (!is_object($this->lock)) var_dump($this->lock);
- $error->appendChild($errorNode->ownerDocument->createElementNS('DAV:','d:href',$this->lock->uri));
- }
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAV/Exception/FileNotFound.php b/3rdparty/Sabre/DAV/Exception/FileNotFound.php
deleted file mode 100644
index d76e400c93b..00000000000
--- a/3rdparty/Sabre/DAV/Exception/FileNotFound.php
+++ /dev/null
@@ -1,19 +0,0 @@
-<?php
-
-/**
- * FileNotFound
- *
- * Deprecated: Warning, this class is deprecated and will be removed in a
- * future version of SabreDAV. Please use Sabre_DAV_Exception_NotFound instead.
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @deprecated Use Sabre_DAV_Exception_NotFound instead
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Exception_FileNotFound extends Sabre_DAV_Exception_NotFound {
-
-}
-
diff --git a/3rdparty/Sabre/DAV/Exception/Forbidden.php b/3rdparty/Sabre/DAV/Exception/Forbidden.php
deleted file mode 100644
index 20b1056e31b..00000000000
--- a/3rdparty/Sabre/DAV/Exception/Forbidden.php
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-
-/**
- * Forbidden
- *
- * This exception is thrown whenever a user tries to do an operation he's not allowed to
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Exception_Forbidden extends Sabre_DAV_Exception {
-
- /**
- * Returns the HTTP statuscode for this exception
- *
- * @return int
- */
- public function getHTTPCode() {
-
- return 403;
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAV/Exception/InsufficientStorage.php b/3rdparty/Sabre/DAV/Exception/InsufficientStorage.php
deleted file mode 100644
index 1a15089b0a3..00000000000
--- a/3rdparty/Sabre/DAV/Exception/InsufficientStorage.php
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-
-/**
- * InsufficientStorage
- *
- * This Exception can be thrown, when for example a harddisk is full or a quota is exceeded
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Exception_InsufficientStorage extends Sabre_DAV_Exception {
-
- /**
- * Returns the HTTP statuscode for this exception
- *
- * @return int
- */
- public function getHTTPCode() {
-
- return 507;
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAV/Exception/InvalidResourceType.php b/3rdparty/Sabre/DAV/Exception/InvalidResourceType.php
deleted file mode 100644
index 2230f1d0811..00000000000
--- a/3rdparty/Sabre/DAV/Exception/InvalidResourceType.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-
-/**
- * InvalidResourceType
- *
- * This exception is thrown when the user tried to create a new collection, with
- * a special resourcetype value that was not recognized by the server.
- *
- * See RFC5689 section 3.3
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Exception_InvalidResourceType extends Sabre_DAV_Exception_Forbidden {
-
- /**
- * This method allows the exception to include additional information into the WebDAV error response
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $errorNode
- * @return void
- */
- public function serialize(Sabre_DAV_Server $server,DOMElement $errorNode) {
-
- $error = $errorNode->ownerDocument->createElementNS('DAV:','d:valid-resourcetype');
- $errorNode->appendChild($error);
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAV/Exception/LockTokenMatchesRequestUri.php b/3rdparty/Sabre/DAV/Exception/LockTokenMatchesRequestUri.php
deleted file mode 100644
index 80ab7aff65a..00000000000
--- a/3rdparty/Sabre/DAV/Exception/LockTokenMatchesRequestUri.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-
-/**
- * LockTokenMatchesRequestUri
- *
- * This exception is thrown by UNLOCK if a supplied lock-token is invalid
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Exception_LockTokenMatchesRequestUri extends Sabre_DAV_Exception_Conflict {
-
- /**
- * Creates the exception
- */
- public function __construct() {
-
- $this->message = 'The locktoken supplied does not match any locks on this entity';
-
- }
-
- /**
- * This method allows the exception to include additional information into the WebDAV error response
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $errorNode
- * @return void
- */
- public function serialize(Sabre_DAV_Server $server,DOMElement $errorNode) {
-
- $error = $errorNode->ownerDocument->createElementNS('DAV:','d:lock-token-matches-request-uri');
- $errorNode->appendChild($error);
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAV/Exception/Locked.php b/3rdparty/Sabre/DAV/Exception/Locked.php
deleted file mode 100644
index 976365ac1f8..00000000000
--- a/3rdparty/Sabre/DAV/Exception/Locked.php
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-
-/**
- * Locked
- *
- * The 423 is thrown when a client tried to access a resource that was locked, without supplying a valid lock token
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Exception_Locked extends Sabre_DAV_Exception {
-
- /**
- * Lock information
- *
- * @var Sabre_DAV_Locks_LockInfo
- */
- protected $lock;
-
- /**
- * Creates the exception
- *
- * A LockInfo object should be passed if the user should be informed
- * which lock actually has the file locked.
- *
- * @param Sabre_DAV_Locks_LockInfo $lock
- */
- public function __construct(Sabre_DAV_Locks_LockInfo $lock = null) {
-
- $this->lock = $lock;
-
- }
-
- /**
- * Returns the HTTP statuscode for this exception
- *
- * @return int
- */
- public function getHTTPCode() {
-
- return 423;
-
- }
-
- /**
- * This method allows the exception to include additional information into the WebDAV error response
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $errorNode
- * @return void
- */
- public function serialize(Sabre_DAV_Server $server,DOMElement $errorNode) {
-
- if ($this->lock) {
- $error = $errorNode->ownerDocument->createElementNS('DAV:','d:lock-token-submitted');
- $errorNode->appendChild($error);
- if (!is_object($this->lock)) var_dump($this->lock);
- $error->appendChild($errorNode->ownerDocument->createElementNS('DAV:','d:href',$this->lock->uri));
- }
-
- }
-
-}
-
diff --git a/3rdparty/Sabre/DAV/Exception/MethodNotAllowed.php b/3rdparty/Sabre/DAV/Exception/MethodNotAllowed.php
deleted file mode 100644
index 31875751505..00000000000
--- a/3rdparty/Sabre/DAV/Exception/MethodNotAllowed.php
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-
-/**
- * MethodNotAllowed
- *
- * The 405 is thrown when a client tried to create a directory on an already existing directory
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Exception_MethodNotAllowed extends Sabre_DAV_Exception {
-
- /**
- * Returns the HTTP statuscode for this exception
- *
- * @return int
- */
- public function getHTTPCode() {
-
- return 405;
-
- }
-
- /**
- * This method allows the exception to return any extra HTTP response headers.
- *
- * The headers must be returned as an array.
- *
- * @param Sabre_DAV_Server $server
- * @return array
- */
- public function getHTTPHeaders(Sabre_DAV_Server $server) {
-
- $methods = $server->getAllowedMethods($server->getRequestUri());
-
- return array(
- 'Allow' => strtoupper(implode(', ',$methods)),
- );
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAV/Exception/NotAuthenticated.php b/3rdparty/Sabre/DAV/Exception/NotAuthenticated.php
deleted file mode 100644
index 87ca624429f..00000000000
--- a/3rdparty/Sabre/DAV/Exception/NotAuthenticated.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-
-/**
- * NotAuthenticated
- *
- * This exception is thrown when the client did not provide valid
- * authentication credentials.
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Exception_NotAuthenticated extends Sabre_DAV_Exception {
-
- /**
- * Returns the HTTP statuscode for this exception
- *
- * @return int
- */
- public function getHTTPCode() {
-
- return 401;
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAV/Exception/NotFound.php b/3rdparty/Sabre/DAV/Exception/NotFound.php
deleted file mode 100644
index 2b9da560d23..00000000000
--- a/3rdparty/Sabre/DAV/Exception/NotFound.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-
-/**
- * NotFound
- *
- * This Exception is thrown when a Node couldn't be found. It returns HTTP error code 404
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Exception_NotFound extends Sabre_DAV_Exception {
-
- /**
- * Returns the HTTP statuscode for this exception
- *
- * @return int
- */
- public function getHTTPCode() {
-
- return 404;
-
- }
-
-}
-
diff --git a/3rdparty/Sabre/DAV/Exception/NotImplemented.php b/3rdparty/Sabre/DAV/Exception/NotImplemented.php
deleted file mode 100644
index d017a19f559..00000000000
--- a/3rdparty/Sabre/DAV/Exception/NotImplemented.php
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-
-/**
- * NotImplemented
- *
- * This exception is thrown when the client tried to call an unsupported HTTP method or other feature
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Exception_NotImplemented extends Sabre_DAV_Exception {
-
- /**
- * Returns the HTTP statuscode for this exception
- *
- * @return int
- */
- public function getHTTPCode() {
-
- return 501;
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAV/Exception/PaymentRequired.php b/3rdparty/Sabre/DAV/Exception/PaymentRequired.php
deleted file mode 100644
index 4982f45a4b5..00000000000
--- a/3rdparty/Sabre/DAV/Exception/PaymentRequired.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-
-/**
- * Payment Required
- *
- * The PaymentRequired exception may be thrown in a case where a user must pay
- * to access a certain resource or operation.
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Exception_PaymentRequired extends Sabre_DAV_Exception {
-
- /**
- * Returns the HTTP statuscode for this exception
- *
- * @return int
- */
- public function getHTTPCode() {
-
- return 402;
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAV/Exception/PreconditionFailed.php b/3rdparty/Sabre/DAV/Exception/PreconditionFailed.php
deleted file mode 100644
index 213e9c52317..00000000000
--- a/3rdparty/Sabre/DAV/Exception/PreconditionFailed.php
+++ /dev/null
@@ -1,69 +0,0 @@
-<?php
-
-/**
- * PreconditionFailed
- *
- * This exception is normally thrown when a client submitted a conditional request,
- * like for example an If, If-None-Match or If-Match header, which caused the HTTP
- * request to not execute (the condition of the header failed)
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Exception_PreconditionFailed extends Sabre_DAV_Exception {
-
- /**
- * When this exception is thrown, the header-name might be set.
- *
- * This allows the exception-catching code to determine which HTTP header
- * caused the exception.
- *
- * @var string
- */
- public $header = null;
-
- /**
- * Create the exception
- *
- * @param string $message
- * @param string $header
- */
- public function __construct($message, $header=null) {
-
- parent::__construct($message);
- $this->header = $header;
-
- }
-
- /**
- * Returns the HTTP statuscode for this exception
- *
- * @return int
- */
- public function getHTTPCode() {
-
- return 412;
-
- }
-
- /**
- * This method allows the exception to include additional information into the WebDAV error response
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $errorNode
- * @return void
- */
- public function serialize(Sabre_DAV_Server $server,DOMElement $errorNode) {
-
- if ($this->header) {
- $prop = $errorNode->ownerDocument->createElement('s:header');
- $prop->nodeValue = $this->header;
- $errorNode->appendChild($prop);
- }
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAV/Exception/ReportNotSupported.php b/3rdparty/Sabre/DAV/Exception/ReportNotSupported.php
deleted file mode 100644
index a2906865f8e..00000000000
--- a/3rdparty/Sabre/DAV/Exception/ReportNotSupported.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-
-/**
- * ReportNotSupported
- *
- * This exception is thrown when the client requested an unknown report through the REPORT method
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Exception_ReportNotSupported extends Sabre_DAV_Exception_Forbidden {
-
- /**
- * This method allows the exception to include additional information into the WebDAV error response
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $errorNode
- * @return void
- */
- public function serialize(Sabre_DAV_Server $server,DOMElement $errorNode) {
-
- $error = $errorNode->ownerDocument->createElementNS('DAV:','d:supported-report');
- $errorNode->appendChild($error);
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAV/Exception/RequestedRangeNotSatisfiable.php b/3rdparty/Sabre/DAV/Exception/RequestedRangeNotSatisfiable.php
deleted file mode 100644
index 29ee3654a7e..00000000000
--- a/3rdparty/Sabre/DAV/Exception/RequestedRangeNotSatisfiable.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-
-/**
- * RequestedRangeNotSatisfiable
- *
- * This exception is normally thrown when the user
- * request a range that is out of the entity bounds.
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Exception_RequestedRangeNotSatisfiable extends Sabre_DAV_Exception {
-
- /**
- * returns the http statuscode for this exception
- *
- * @return int
- */
- public function getHTTPCode() {
-
- return 416;
-
- }
-
-}
-
diff --git a/3rdparty/Sabre/DAV/Exception/UnsupportedMediaType.php b/3rdparty/Sabre/DAV/Exception/UnsupportedMediaType.php
deleted file mode 100644
index 9a4693b21a8..00000000000
--- a/3rdparty/Sabre/DAV/Exception/UnsupportedMediaType.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-
-/**
- * UnSupportedMediaType
- *
- * The 415 Unsupported Media Type status code is generally sent back when the client
- * tried to call an HTTP method, with a body the server didn't understand
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Exception_UnsupportedMediaType extends Sabre_DAV_Exception {
-
- /**
- * returns the http statuscode for this exception
- *
- * @return int
- */
- public function getHTTPCode() {
-
- return 415;
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAV/FS/Directory.php b/3rdparty/Sabre/DAV/FS/Directory.php
deleted file mode 100644
index 72fec744d0f..00000000000
--- a/3rdparty/Sabre/DAV/FS/Directory.php
+++ /dev/null
@@ -1,139 +0,0 @@
-<?php
-
-/**
- * Directory class
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_FS_Directory extends Sabre_DAV_FS_Node implements Sabre_DAV_ICollection, Sabre_DAV_IQuota {
-
- /**
- * Creates a new file in the directory
- *
- * 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 successful 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|string $data Initial payload
- * @return null|string
- */
- public function createFile($name, $data = null) {
-
- $newPath = $this->path . '/' . $name;
- file_put_contents($newPath,$data);
-
- }
-
- /**
- * Creates a new subdirectory
- *
- * @param string $name
- * @return void
- */
- public function createDirectory($name) {
-
- $newPath = $this->path . '/' . $name;
- mkdir($newPath);
-
- }
-
- /**
- * Returns a specific child node, referenced by its name
- *
- * This method must throw Sabre_DAV_Exception_NotFound if the node does not
- * exist.
- *
- * @param string $name
- * @throws Sabre_DAV_Exception_NotFound
- * @return Sabre_DAV_INode
- */
- public function getChild($name) {
-
- $path = $this->path . '/' . $name;
-
- if (!file_exists($path)) throw new Sabre_DAV_Exception_NotFound('File with name ' . $path . ' could not be located');
-
- if (is_dir($path)) {
-
- return new Sabre_DAV_FS_Directory($path);
-
- } else {
-
- return new Sabre_DAV_FS_File($path);
-
- }
-
- }
-
- /**
- * Returns an array with all the child nodes
- *
- * @return Sabre_DAV_INode[]
- */
- public function getChildren() {
-
- $nodes = array();
- foreach(scandir($this->path) as $node) if($node!='.' && $node!='..') $nodes[] = $this->getChild($node);
- return $nodes;
-
- }
-
- /**
- * Checks if a child exists.
- *
- * @param string $name
- * @return bool
- */
- public function childExists($name) {
-
- $path = $this->path . '/' . $name;
- return file_exists($path);
-
- }
-
- /**
- * Deletes all files in this directory, and then itself
- *
- * @return void
- */
- public function delete() {
-
- foreach($this->getChildren() as $child) $child->delete();
- rmdir($this->path);
-
- }
-
- /**
- * Returns available diskspace information
- *
- * @return array
- */
- public function getQuotaInfo() {
-
- return array(
- disk_total_space($this->path)-disk_free_space($this->path),
- disk_free_space($this->path)
- );
-
- }
-
-}
-
diff --git a/3rdparty/Sabre/DAV/FS/File.php b/3rdparty/Sabre/DAV/FS/File.php
deleted file mode 100644
index 6a8039fe303..00000000000
--- a/3rdparty/Sabre/DAV/FS/File.php
+++ /dev/null
@@ -1,89 +0,0 @@
-<?php
-
-/**
- * File class
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_FS_File extends Sabre_DAV_FS_Node implements Sabre_DAV_IFile {
-
- /**
- * Updates the data
- *
- * @param resource $data
- * @return void
- */
- public function put($data) {
-
- file_put_contents($this->path,$data);
-
- }
-
- /**
- * Returns the data
- *
- * @return string
- */
- public function get() {
-
- return fopen($this->path,'r');
-
- }
-
- /**
- * Delete the current file
- *
- * @return void
- */
- public function delete() {
-
- unlink($this->path);
-
- }
-
- /**
- * Returns the size of the node, in bytes
- *
- * @return int
- */
- public function getSize() {
-
- return filesize($this->path);
-
- }
-
- /**
- * Returns the ETag for a file
- *
- * An ETag is a unique identifier representing the current version of the file. If the file changes, the ETag MUST change.
- * The ETag is an arbitrary string, but MUST be surrounded by double-quotes.
- *
- * Return null if the ETag can not effectively be determined
- *
- * @return mixed
- */
- public function getETag() {
-
- return null;
-
- }
-
- /**
- * Returns the mime-type for a file
- *
- * If null is returned, we'll assume application/octet-stream
- *
- * @return mixed
- */
- public function getContentType() {
-
- return null;
-
- }
-
-}
-
diff --git a/3rdparty/Sabre/DAV/FS/Node.php b/3rdparty/Sabre/DAV/FS/Node.php
deleted file mode 100644
index 1283e9d0fdc..00000000000
--- a/3rdparty/Sabre/DAV/FS/Node.php
+++ /dev/null
@@ -1,80 +0,0 @@
-<?php
-
-/**
- * Base node-class
- *
- * The node class implements the method used by both the File and the Directory classes
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-abstract class Sabre_DAV_FS_Node implements Sabre_DAV_INode {
-
- /**
- * The path to the current node
- *
- * @var string
- */
- protected $path;
-
- /**
- * Sets up the node, expects a full path name
- *
- * @param string $path
- */
- public function __construct($path) {
-
- $this->path = $path;
-
- }
-
-
-
- /**
- * Returns the name of the node
- *
- * @return string
- */
- public function getName() {
-
- list(, $name) = Sabre_DAV_URLUtil::splitPath($this->path);
- return $name;
-
- }
-
- /**
- * Renames the node
- *
- * @param string $name The new name
- * @return void
- */
- public function setName($name) {
-
- list($parentPath, ) = Sabre_DAV_URLUtil::splitPath($this->path);
- list(, $newName) = Sabre_DAV_URLUtil::splitPath($name);
-
- $newPath = $parentPath . '/' . $newName;
- rename($this->path,$newPath);
-
- $this->path = $newPath;
-
- }
-
-
-
- /**
- * Returns the last modification time, as a unix timestamp
- *
- * @return int
- */
- public function getLastModified() {
-
- return filemtime($this->path);
-
- }
-
-}
-
diff --git a/3rdparty/Sabre/DAV/FSExt/Directory.php b/3rdparty/Sabre/DAV/FSExt/Directory.php
deleted file mode 100644
index 70dfdc2c3b5..00000000000
--- a/3rdparty/Sabre/DAV/FSExt/Directory.php
+++ /dev/null
@@ -1,157 +0,0 @@
-<?php
-
-/**
- * Directory class
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_FSExt_Directory extends Sabre_DAV_FSExt_Node implements Sabre_DAV_ICollection, Sabre_DAV_IQuota {
-
- /**
- * Creates a new file in the directory
- *
- * 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 successful 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|string $data Initial payload
- * @return null|string
- */
- public function createFile($name, $data = null) {
-
- // We're not allowing dots
- if ($name=='.' || $name=='..') throw new Sabre_DAV_Exception_Forbidden('Permission denied to . and ..');
- $newPath = $this->path . '/' . $name;
- file_put_contents($newPath,$data);
-
- return '"' . md5_file($newPath) . '"';
-
- }
-
- /**
- * Creates a new subdirectory
- *
- * @param string $name
- * @return void
- */
- public function createDirectory($name) {
-
- // We're not allowing dots
- if ($name=='.' || $name=='..') throw new Sabre_DAV_Exception_Forbidden('Permission denied to . and ..');
- $newPath = $this->path . '/' . $name;
- mkdir($newPath);
-
- }
-
- /**
- * Returns a specific child node, referenced by its name
- *
- * This method must throw Sabre_DAV_Exception_NotFound if the node does not
- * exist.
- *
- * @param string $name
- * @throws Sabre_DAV_Exception_NotFound
- * @return Sabre_DAV_INode
- */
- public function getChild($name) {
-
- $path = $this->path . '/' . $name;
-
- if (!file_exists($path)) throw new Sabre_DAV_Exception_NotFound('File could not be located');
- if ($name=='.' || $name=='..') throw new Sabre_DAV_Exception_Forbidden('Permission denied to . and ..');
-
- if (is_dir($path)) {
-
- return new Sabre_DAV_FSExt_Directory($path);
-
- } else {
-
- return new Sabre_DAV_FSExt_File($path);
-
- }
-
- }
-
- /**
- * Checks if a child exists.
- *
- * @param string $name
- * @return bool
- */
- public function childExists($name) {
-
- if ($name=='.' || $name=='..')
- throw new Sabre_DAV_Exception_Forbidden('Permission denied to . and ..');
-
- $path = $this->path . '/' . $name;
- return file_exists($path);
-
- }
-
- /**
- * Returns an array with all the child nodes
- *
- * @return Sabre_DAV_INode[]
- */
- public function getChildren() {
-
- $nodes = array();
- foreach(scandir($this->path) as $node) if($node!='.' && $node!='..' && $node!='.sabredav') $nodes[] = $this->getChild($node);
- return $nodes;
-
- }
-
- /**
- * Deletes all files in this directory, and then itself
- *
- * @return bool
- */
- public function delete() {
-
- // Deleting all children
- foreach($this->getChildren() as $child) $child->delete();
-
- // Removing resource info, if its still around
- if (file_exists($this->path . '/.sabredav')) unlink($this->path . '/.sabredav');
-
- // Removing the directory itself
- rmdir($this->path);
-
- return parent::delete();
-
- }
-
- /**
- * Returns available diskspace information
- *
- * @return array
- */
- public function getQuotaInfo() {
-
- return array(
- disk_total_space($this->path)-disk_free_space($this->path),
- disk_free_space($this->path)
- );
-
- }
-
-}
-
diff --git a/3rdparty/Sabre/DAV/FSExt/File.php b/3rdparty/Sabre/DAV/FSExt/File.php
deleted file mode 100644
index 590fb808e61..00000000000
--- a/3rdparty/Sabre/DAV/FSExt/File.php
+++ /dev/null
@@ -1,117 +0,0 @@
-<?php
-
-/**
- * File class
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_FSExt_File extends Sabre_DAV_FSExt_Node implements Sabre_DAV_PartialUpdate_IFile {
-
- /**
- * Updates the data
- *
- * data is a readable stream resource.
- *
- * @param resource|string $data
- * @return string
- */
- public function put($data) {
-
- file_put_contents($this->path,$data);
- return '"' . md5_file($this->path) . '"';
-
- }
-
- /**
- * Updates the data at a given offset
- *
- * The data argument is a readable stream resource.
- * The offset argument is a 0-based offset where the data should be
- * written.
- *
- * param resource|string $data
- * @return void
- */
- public function putRange($data, $offset) {
-
- $f = fopen($this->path, 'c');
- fseek($f,$offset-1);
- if (is_string($data)) {
- fwrite($f, $data);
- } else {
- stream_copy_to_stream($data,$f);
- }
- fclose($f);
- return '"' . md5_file($this->path) . '"';
-
- }
-
- /**
- * Returns the data
- *
- * @return resource
- */
- public function get() {
-
- return fopen($this->path,'r');
-
- }
-
- /**
- * Delete the current file
- *
- * @return bool
- */
- public function delete() {
-
- unlink($this->path);
- return parent::delete();
-
- }
-
- /**
- * Returns the ETag for a file
- *
- * An ETag is a unique identifier representing the current version of the file. If the file changes, the ETag MUST change.
- * The ETag is an arbitrary string, but MUST be surrounded by double-quotes.
- *
- * Return null if the ETag can not effectively be determined
- *
- * @return string|null
- */
- public function getETag() {
-
- return '"' . md5_file($this->path). '"';
-
- }
-
- /**
- * Returns the mime-type for a file
- *
- * If null is returned, we'll assume application/octet-stream
- *
- * @return string|null
- */
- public function getContentType() {
-
- return null;
-
- }
-
- /**
- * Returns the size of the file, in bytes
- *
- * @return int
- */
- public function getSize() {
-
- return filesize($this->path);
-
- }
-
-}
-
diff --git a/3rdparty/Sabre/DAV/FSExt/Node.php b/3rdparty/Sabre/DAV/FSExt/Node.php
deleted file mode 100644
index 68ca06beb7e..00000000000
--- a/3rdparty/Sabre/DAV/FSExt/Node.php
+++ /dev/null
@@ -1,212 +0,0 @@
-<?php
-
-/**
- * Base node-class
- *
- * The node class implements the method used by both the File and the Directory classes
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-abstract class Sabre_DAV_FSExt_Node extends Sabre_DAV_FS_Node implements Sabre_DAV_IProperties {
-
- /**
- * Updates properties on this node,
- *
- * @param array $properties
- * @see Sabre_DAV_IProperties::updateProperties
- * @return bool|array
- */
- public function updateProperties($properties) {
-
- $resourceData = $this->getResourceData();
-
- foreach($properties as $propertyName=>$propertyValue) {
-
- // If it was null, we need to delete the property
- if (is_null($propertyValue)) {
- if (isset($resourceData['properties'][$propertyName])) {
- unset($resourceData['properties'][$propertyName]);
- }
- } else {
- $resourceData['properties'][$propertyName] = $propertyValue;
- }
-
- }
-
- $this->putResourceData($resourceData);
- return true;
- }
-
- /**
- * Returns a list of properties for this nodes.;
- *
- * The properties list is a list of propertynames the client requested, encoded as xmlnamespace#tagName, for example: http://www.example.org/namespace#author
- * If the array is empty, all properties should be returned
- *
- * @param array $properties
- * @return array
- */
- function getProperties($properties) {
-
- $resourceData = $this->getResourceData();
-
- // if the array was empty, we need to return everything
- if (!$properties) return $resourceData['properties'];
-
- $props = array();
- foreach($properties as $property) {
- if (isset($resourceData['properties'][$property])) $props[$property] = $resourceData['properties'][$property];
- }
-
- return $props;
-
- }
-
- /**
- * Returns the path to the resource file
- *
- * @return string
- */
- protected function getResourceInfoPath() {
-
- list($parentDir) = Sabre_DAV_URLUtil::splitPath($this->path);
- return $parentDir . '/.sabredav';
-
- }
-
- /**
- * Returns all the stored resource information
- *
- * @return array
- */
- protected function getResourceData() {
-
- $path = $this->getResourceInfoPath();
- if (!file_exists($path)) return array('properties' => array());
-
- // opening up the file, and creating a shared lock
- $handle = fopen($path,'r');
- flock($handle,LOCK_SH);
- $data = '';
-
- // Reading data until the eof
- while(!feof($handle)) {
- $data.=fread($handle,8192);
- }
-
- // We're all good
- fclose($handle);
-
- // Unserializing and checking if the resource file contains data for this file
- $data = unserialize($data);
- if (!isset($data[$this->getName()])) {
- return array('properties' => array());
- }
-
- $data = $data[$this->getName()];
- if (!isset($data['properties'])) $data['properties'] = array();
- return $data;
-
- }
-
- /**
- * Updates the resource information
- *
- * @param array $newData
- * @return void
- */
- protected function putResourceData(array $newData) {
-
- $path = $this->getResourceInfoPath();
-
- // opening up the file, and creating a shared lock
- $handle = fopen($path,'a+');
- flock($handle,LOCK_EX);
- $data = '';
-
- rewind($handle);
-
- // Reading data until the eof
- while(!feof($handle)) {
- $data.=fread($handle,8192);
- }
-
- // Unserializing and checking if the resource file contains data for this file
- $data = unserialize($data);
- $data[$this->getName()] = $newData;
- ftruncate($handle,0);
- rewind($handle);
-
- fwrite($handle,serialize($data));
- fclose($handle);
-
- }
-
- /**
- * Renames the node
- *
- * @param string $name The new name
- * @return void
- */
- public function setName($name) {
-
- list($parentPath, ) = Sabre_DAV_URLUtil::splitPath($this->path);
- list(, $newName) = Sabre_DAV_URLUtil::splitPath($name);
- $newPath = $parentPath . '/' . $newName;
-
- // We're deleting the existing resourcedata, and recreating it
- // for the new path.
- $resourceData = $this->getResourceData();
- $this->deleteResourceData();
-
- rename($this->path,$newPath);
- $this->path = $newPath;
- $this->putResourceData($resourceData);
-
-
- }
-
- /**
- * @return bool
- */
- public function deleteResourceData() {
-
- // When we're deleting this node, we also need to delete any resource information
- $path = $this->getResourceInfoPath();
- if (!file_exists($path)) return true;
-
- // opening up the file, and creating a shared lock
- $handle = fopen($path,'a+');
- flock($handle,LOCK_EX);
- $data = '';
-
- rewind($handle);
-
- // Reading data until the eof
- while(!feof($handle)) {
- $data.=fread($handle,8192);
- }
-
- // Unserializing and checking if the resource file contains data for this file
- $data = unserialize($data);
- if (isset($data[$this->getName()])) unset($data[$this->getName()]);
- ftruncate($handle,0);
- rewind($handle);
- fwrite($handle,serialize($data));
- fclose($handle);
-
- return true;
- }
-
- public function delete() {
-
- return $this->deleteResourceData();
-
- }
-
-}
-
diff --git a/3rdparty/Sabre/DAV/File.php b/3rdparty/Sabre/DAV/File.php
deleted file mode 100644
index 3126bd8d364..00000000000
--- a/3rdparty/Sabre/DAV/File.php
+++ /dev/null
@@ -1,85 +0,0 @@
-<?php
-
-/**
- * File class
- *
- * This is a helper class, that should aid in getting file classes setup.
- * Most of its methods are implemented, and throw permission denied exceptions
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-abstract class Sabre_DAV_File extends Sabre_DAV_Node implements Sabre_DAV_IFile {
-
- /**
- * Updates the data
- *
- * data is a readable stream resource.
- *
- * @param resource $data
- * @return void
- */
- public function put($data) {
-
- throw new Sabre_DAV_Exception_Forbidden('Permission denied to change data');
-
- }
-
- /**
- * Returns the data
- *
- * This method may either return a string or a readable stream resource
- *
- * @return mixed
- */
- public function get() {
-
- throw new Sabre_DAV_Exception_Forbidden('Permission denied to read this file');
-
- }
-
- /**
- * Returns the size of the file, in bytes.
- *
- * @return int
- */
- public function getSize() {
-
- return 0;
-
- }
-
- /**
- * Returns the ETag for a file
- *
- * An ETag is a unique identifier representing the current version of the file. If the file changes, the ETag MUST change.
- * The ETag is an arbitrary string, but MUST be surrounded by double-quotes.
- *
- * Return null if the ETag can not effectively be determined
- *
- * @return string|null
- */
- public function getETag() {
-
- return null;
-
- }
-
- /**
- * Returns the mime-type for a file
- *
- * If null is returned, we'll assume application/octet-stream
- *
- * @return string|null
- */
- public function getContentType() {
-
- return null;
-
- }
-
-}
-
diff --git a/3rdparty/Sabre/DAV/ICollection.php b/3rdparty/Sabre/DAV/ICollection.php
deleted file mode 100644
index 94431a0c496..00000000000
--- a/3rdparty/Sabre/DAV/ICollection.php
+++ /dev/null
@@ -1,77 +0,0 @@
-<?php
-
-/**
- * The ICollection Interface
- *
- * This interface should be implemented by each class that represents a collection
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-interface Sabre_DAV_ICollection extends Sabre_DAV_INode {
-
- /**
- * Creates a new file in the directory
- *
- * 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 successful 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|string $data Initial payload
- * @return null|string
- */
- function createFile($name, $data = null);
-
- /**
- * Creates a new subdirectory
- *
- * @param string $name
- * @return void
- */
- function createDirectory($name);
-
- /**
- * Returns a specific child node, referenced by its name
- *
- * This method must throw Sabre_DAV_Exception_NotFound if the node does not
- * exist.
- *
- * @param string $name
- * @return Sabre_DAV_INode
- */
- function getChild($name);
-
- /**
- * Returns an array with all the child nodes
- *
- * @return Sabre_DAV_INode[]
- */
- function getChildren();
-
- /**
- * Checks if a child-node with the specified name exists
- *
- * @param string $name
- * @return bool
- */
- function childExists($name);
-
-}
-
diff --git a/3rdparty/Sabre/DAV/IExtendedCollection.php b/3rdparty/Sabre/DAV/IExtendedCollection.php
deleted file mode 100644
index 6ec345f9a62..00000000000
--- a/3rdparty/Sabre/DAV/IExtendedCollection.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-
-/**
- * The IExtendedCollection interface.
- *
- * This interface can be used to create special-type of collection-resources
- * as defined by RFC 5689.
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-interface Sabre_DAV_IExtendedCollection extends Sabre_DAV_ICollection {
-
- /**
- * Creates a new collection
- *
- * @param string $name
- * @param array $resourceType
- * @param array $properties
- * @return void
- */
- function createExtendedCollection($name, array $resourceType, array $properties);
-
-}
-
diff --git a/3rdparty/Sabre/DAV/IFile.php b/3rdparty/Sabre/DAV/IFile.php
deleted file mode 100644
index 1eca8986a5c..00000000000
--- a/3rdparty/Sabre/DAV/IFile.php
+++ /dev/null
@@ -1,77 +0,0 @@
-<?php
-
-/**
- * This interface represents a file in the directory tree
- *
- * A file is a bit of a broad definition. In general it implies that on
- * this specific node a PUT or GET method may be performed, to either update,
- * or retrieve the contents of the file.
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-interface Sabre_DAV_IFile extends Sabre_DAV_INode {
-
- /**
- * 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 string|null
- */
- function put($data);
-
- /**
- * Returns the data
- *
- * This method may either return a string or a readable stream resource
- *
- * @return mixed
- */
- function get();
-
- /**
- * Returns the mime-type for a file
- *
- * If null is returned, we'll assume application/octet-stream
- *
- * @return string|null
- */
- function getContentType();
-
- /**
- * Returns the ETag for a file
- *
- * An ETag is a unique identifier representing the current version of the file. If the file changes, the ETag MUST change.
- *
- * Return null if the ETag can not effectively be determined
- *
- * @return void
- */
- function getETag();
-
- /**
- * Returns the size of the node, in bytes
- *
- * @return int
- */
- function getSize();
-
-}
-
diff --git a/3rdparty/Sabre/DAV/INode.php b/3rdparty/Sabre/DAV/INode.php
deleted file mode 100644
index c57d3923105..00000000000
--- a/3rdparty/Sabre/DAV/INode.php
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-
-/**
- * The INode interface is the base interface, and the parent class of both ICollection and IFile
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-interface Sabre_DAV_INode {
-
- /**
- * Deleted the current node
- *
- * @return void
- */
- function delete();
-
- /**
- * Returns the name of the node.
- *
- * This is used to generate the url.
- *
- * @return string
- */
- function getName();
-
- /**
- * Renames the node
- *
- * @param string $name The new name
- * @return void
- */
- function setName($name);
-
- /**
- * Returns the last modification time, as a unix timestamp
- *
- * @return int
- */
- function getLastModified();
-
-}
-
diff --git a/3rdparty/Sabre/DAV/IProperties.php b/3rdparty/Sabre/DAV/IProperties.php
deleted file mode 100644
index 38eaab16dad..00000000000
--- a/3rdparty/Sabre/DAV/IProperties.php
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-
-/**
- * IProperties interface
- *
- * Implement this interface to support custom WebDAV properties requested and sent from clients.
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-interface Sabre_DAV_IProperties extends Sabre_DAV_INode {
-
- /**
- * Updates properties on this node,
- *
- * The properties array uses the propertyName in clark-notation as key,
- * and the array value for the property value. In the case a property
- * should be deleted, the property value will be null.
- *
- * This method must be atomic. If one property cannot be changed, the
- * entire operation must fail.
- *
- * If the operation was successful, true can be returned.
- * If the operation failed, false can be returned.
- *
- * Deletion of a non-existent property is always successful.
- *
- * Lastly, it is optional to return detailed information about any
- * failures. In this case an array should be returned with the following
- * structure:
- *
- * array(
- * 403 => array(
- * '{DAV:}displayname' => null,
- * ),
- * 424 => array(
- * '{DAV:}owner' => null,
- * )
- * )
- *
- * In this example it was forbidden to update {DAV:}displayname.
- * (403 Forbidden), which in turn also caused {DAV:}owner to fail
- * (424 Failed Dependency) because the request needs to be atomic.
- *
- * @param array $mutations
- * @return bool|array
- */
- function updateProperties($mutations);
-
- /**
- * Returns a list of properties for this nodes.
- *
- * The properties list is a list of propertynames the client requested,
- * encoded in clark-notation {xmlnamespace}tagname
- *
- * If the array is empty, it means 'all properties' were requested.
- *
- * @param array $properties
- * @return void
- */
- function getProperties($properties);
-
-}
-
diff --git a/3rdparty/Sabre/DAV/IQuota.php b/3rdparty/Sabre/DAV/IQuota.php
deleted file mode 100644
index 3fe4c4eced4..00000000000
--- a/3rdparty/Sabre/DAV/IQuota.php
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-
-/**
- * IQuota interface
- *
- * Implement this interface to add the ability to return quota information. The ObjectTree
- * will check for quota information on any given node. If the information is not available it will
- * attempt to fetch the information from the root node.
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-interface Sabre_DAV_IQuota extends Sabre_DAV_ICollection {
-
- /**
- * Returns the quota information
- *
- * This method MUST return an array with 2 values, the first being the total used space,
- * the second the available space (in bytes)
- */
- function getQuotaInfo();
-
-}
-
diff --git a/3rdparty/Sabre/DAV/Locks/Backend/Abstract.php b/3rdparty/Sabre/DAV/Locks/Backend/Abstract.php
deleted file mode 100644
index 127e643a2b9..00000000000
--- a/3rdparty/Sabre/DAV/Locks/Backend/Abstract.php
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-
-/**
- * The Lock manager allows you to handle all file-locks centrally.
- *
- * This is an alternative approach to doing this on a per-node basis
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-abstract class Sabre_DAV_Locks_Backend_Abstract {
-
- /**
- * Returns a list of Sabre_DAV_Locks_LockInfo objects
- *
- * This method should return all the locks for a particular uri, including
- * locks that might be set on a parent uri.
- *
- * If returnChildLocks is set to true, this method should also look for
- * any locks in the subtree of the uri for locks.
- *
- * @param string $uri
- * @param bool $returnChildLocks
- * @return array
- */
- abstract function getLocks($uri, $returnChildLocks);
-
- /**
- * Locks a uri
- *
- * @param string $uri
- * @param Sabre_DAV_Locks_LockInfo $lockInfo
- * @return bool
- */
- abstract function lock($uri,Sabre_DAV_Locks_LockInfo $lockInfo);
-
- /**
- * Removes a lock from a uri
- *
- * @param string $uri
- * @param Sabre_DAV_Locks_LockInfo $lockInfo
- * @return bool
- */
- abstract function unlock($uri,Sabre_DAV_Locks_LockInfo $lockInfo);
-
-}
-
diff --git a/3rdparty/Sabre/DAV/Locks/Backend/FS.php b/3rdparty/Sabre/DAV/Locks/Backend/FS.php
deleted file mode 100644
index 02cab87fc82..00000000000
--- a/3rdparty/Sabre/DAV/Locks/Backend/FS.php
+++ /dev/null
@@ -1,191 +0,0 @@
-<?php
-
-/**
- * This Lock Backend stores all its data in the filesystem in separate file per
- * node.
- *
- * This Lock Manager is now deprecated. It has a bug that allows parent
- * collections to be deletes when children deeper in the tree are locked.
- *
- * This also means that using this backend means you will not pass the Neon
- * Litmus test.
- *
- * You are recommended to use either the PDO or the File backend instead.
- *
- * @package Sabre
- * @subpackage DAV
- * @deprecated
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Locks_Backend_FS extends Sabre_DAV_Locks_Backend_Abstract {
-
- /**
- * The default data directory
- *
- * @var string
- */
- private $dataDir;
-
- public function __construct($dataDir) {
-
- $this->dataDir = $dataDir;
-
- }
-
- protected function getFileNameForUri($uri) {
-
- return $this->dataDir . '/sabredav_' . md5($uri) . '.locks';
-
- }
-
-
- /**
- * Returns a list of Sabre_DAV_Locks_LockInfo objects
- *
- * This method should return all the locks for a particular uri, including
- * locks that might be set on a parent uri.
- *
- * If returnChildLocks is set to true, this method should also look for
- * any locks in the subtree of the uri for locks.
- *
- * @param string $uri
- * @param bool $returnChildLocks
- * @return array
- */
- public function getLocks($uri, $returnChildLocks) {
-
- $lockList = array();
- $currentPath = '';
-
- foreach(explode('/',$uri) as $uriPart) {
-
- // weird algorithm that can probably be improved, but we're traversing the path top down
- if ($currentPath) $currentPath.='/';
- $currentPath.=$uriPart;
-
- $uriLocks = $this->getData($currentPath);
-
- foreach($uriLocks as $uriLock) {
-
- // Unless we're on the leaf of the uri-tree we should ignore locks with depth 0
- if($uri==$currentPath || $uriLock->depth!=0) {
- $uriLock->uri = $currentPath;
- $lockList[] = $uriLock;
- }
-
- }
-
- }
-
- // Checking if we can remove any of these locks
- foreach($lockList as $k=>$lock) {
- if (time() > $lock->timeout + $lock->created) unset($lockList[$k]);
- }
- return $lockList;
-
- }
-
- /**
- * Locks a uri
- *
- * @param string $uri
- * @param Sabre_DAV_Locks_LockInfo $lockInfo
- * @return bool
- */
- public function lock($uri,Sabre_DAV_Locks_LockInfo $lockInfo) {
-
- // We're making the lock timeout 30 minutes
- $lockInfo->timeout = 1800;
- $lockInfo->created = time();
-
- $locks = $this->getLocks($uri,false);
- foreach($locks as $k=>$lock) {
- if ($lock->token == $lockInfo->token) unset($locks[$k]);
- }
- $locks[] = $lockInfo;
- $this->putData($uri,$locks);
- return true;
-
- }
-
- /**
- * Removes a lock from a uri
- *
- * @param string $uri
- * @param Sabre_DAV_Locks_LockInfo $lockInfo
- * @return bool
- */
- public function unlock($uri,Sabre_DAV_Locks_LockInfo $lockInfo) {
-
- $locks = $this->getLocks($uri,false);
- foreach($locks as $k=>$lock) {
-
- if ($lock->token == $lockInfo->token) {
-
- unset($locks[$k]);
- $this->putData($uri,$locks);
- return true;
-
- }
- }
- return false;
-
- }
-
- /**
- * Returns the stored data for a uri
- *
- * @param string $uri
- * @return array
- */
- protected function getData($uri) {
-
- $path = $this->getFilenameForUri($uri);
- if (!file_exists($path)) return array();
-
- // opening up the file, and creating a shared lock
- $handle = fopen($path,'r');
- flock($handle,LOCK_SH);
- $data = '';
-
- // Reading data until the eof
- while(!feof($handle)) {
- $data.=fread($handle,8192);
- }
-
- // We're all good
- fclose($handle);
-
- // Unserializing and checking if the resource file contains data for this file
- $data = unserialize($data);
- if (!$data) return array();
- return $data;
-
- }
-
- /**
- * Updates the lock information
- *
- * @param string $uri
- * @param array $newData
- * @return void
- */
- protected function putData($uri,array $newData) {
-
- $path = $this->getFileNameForUri($uri);
-
- // opening up the file, and creating a shared lock
- $handle = fopen($path,'a+');
- flock($handle,LOCK_EX);
- ftruncate($handle,0);
- rewind($handle);
-
- fwrite($handle,serialize($newData));
- fclose($handle);
-
- }
-
-}
-
diff --git a/3rdparty/Sabre/DAV/Locks/Backend/File.php b/3rdparty/Sabre/DAV/Locks/Backend/File.php
deleted file mode 100644
index c33f963514b..00000000000
--- a/3rdparty/Sabre/DAV/Locks/Backend/File.php
+++ /dev/null
@@ -1,181 +0,0 @@
-<?php
-
-/**
- * The Lock manager allows you to handle all file-locks centrally.
- *
- * This Lock Manager stores all its data in a single file.
- *
- * Note that this is not nearly as robust as a database, you are encouraged
- * to use the PDO backend instead.
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Locks_Backend_File extends Sabre_DAV_Locks_Backend_Abstract {
-
- /**
- * The storage file
- *
- * @var string
- */
- private $locksFile;
-
- /**
- * Constructor
- *
- * @param string $locksFile path to file
- */
- public function __construct($locksFile) {
-
- $this->locksFile = $locksFile;
-
- }
-
- /**
- * Returns a list of Sabre_DAV_Locks_LockInfo objects
- *
- * This method should return all the locks for a particular uri, including
- * locks that might be set on a parent uri.
- *
- * If returnChildLocks is set to true, this method should also look for
- * any locks in the subtree of the uri for locks.
- *
- * @param string $uri
- * @param bool $returnChildLocks
- * @return array
- */
- public function getLocks($uri, $returnChildLocks) {
-
- $newLocks = array();
-
- $locks = $this->getData();
-
- foreach($locks as $lock) {
-
- if ($lock->uri === $uri ||
- //deep locks on parents
- ($lock->depth!=0 && strpos($uri, $lock->uri . '/')===0) ||
-
- // locks on children
- ($returnChildLocks && (strpos($lock->uri, $uri . '/')===0)) ) {
-
- $newLocks[] = $lock;
-
- }
-
- }
-
- // Checking if we can remove any of these locks
- foreach($newLocks as $k=>$lock) {
- if (time() > $lock->timeout + $lock->created) unset($newLocks[$k]);
- }
- return $newLocks;
-
- }
-
- /**
- * Locks a uri
- *
- * @param string $uri
- * @param Sabre_DAV_Locks_LockInfo $lockInfo
- * @return bool
- */
- public function lock($uri, Sabre_DAV_Locks_LockInfo $lockInfo) {
-
- // We're making the lock timeout 30 minutes
- $lockInfo->timeout = 1800;
- $lockInfo->created = time();
- $lockInfo->uri = $uri;
-
- $locks = $this->getData();
-
- foreach($locks as $k=>$lock) {
- if (
- ($lock->token == $lockInfo->token) ||
- (time() > $lock->timeout + $lock->created)
- ) {
- unset($locks[$k]);
- }
- }
- $locks[] = $lockInfo;
- $this->putData($locks);
- return true;
-
- }
-
- /**
- * Removes a lock from a uri
- *
- * @param string $uri
- * @param Sabre_DAV_Locks_LockInfo $lockInfo
- * @return bool
- */
- public function unlock($uri, Sabre_DAV_Locks_LockInfo $lockInfo) {
-
- $locks = $this->getData();
- foreach($locks as $k=>$lock) {
-
- if ($lock->token == $lockInfo->token) {
-
- unset($locks[$k]);
- $this->putData($locks);
- return true;
-
- }
- }
- return false;
-
- }
-
- /**
- * Loads the lockdata from the filesystem.
- *
- * @return array
- */
- protected function getData() {
-
- if (!file_exists($this->locksFile)) return array();
-
- // opening up the file, and creating a shared lock
- $handle = fopen($this->locksFile,'r');
- flock($handle,LOCK_SH);
-
- // Reading data until the eof
- $data = stream_get_contents($handle);
-
- // We're all good
- fclose($handle);
-
- // Unserializing and checking if the resource file contains data for this file
- $data = unserialize($data);
- if (!$data) return array();
- return $data;
-
- }
-
- /**
- * Saves the lockdata
- *
- * @param array $newData
- * @return void
- */
- protected function putData(array $newData) {
-
- // opening up the file, and creating an exclusive lock
- $handle = fopen($this->locksFile,'a+');
- flock($handle,LOCK_EX);
-
- // We can only truncate and rewind once the lock is acquired.
- ftruncate($handle,0);
- rewind($handle);
-
- fwrite($handle,serialize($newData));
- fclose($handle);
-
- }
-
-}
-
diff --git a/3rdparty/Sabre/DAV/Locks/Backend/PDO.php b/3rdparty/Sabre/DAV/Locks/Backend/PDO.php
deleted file mode 100644
index acce80638ec..00000000000
--- a/3rdparty/Sabre/DAV/Locks/Backend/PDO.php
+++ /dev/null
@@ -1,165 +0,0 @@
-<?php
-
-/**
- * The Lock manager allows you to handle all file-locks centrally.
- *
- * This Lock Manager stores all its data in a database. You must pass a PDO
- * connection object in the constructor.
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Locks_Backend_PDO extends Sabre_DAV_Locks_Backend_Abstract {
-
- /**
- * The PDO connection object
- *
- * @var pdo
- */
- private $pdo;
-
- /**
- * The PDO tablename this backend uses.
- *
- * @var string
- */
- protected $tableName;
-
- /**
- * Constructor
- *
- * @param PDO $pdo
- * @param string $tableName
- */
- public function __construct(PDO $pdo, $tableName = 'locks') {
-
- $this->pdo = $pdo;
- $this->tableName = $tableName;
-
- }
-
- /**
- * Returns a list of Sabre_DAV_Locks_LockInfo objects
- *
- * This method should return all the locks for a particular uri, including
- * locks that might be set on a parent uri.
- *
- * If returnChildLocks is set to true, this method should also look for
- * any locks in the subtree of the uri for locks.
- *
- * @param string $uri
- * @param bool $returnChildLocks
- * @return array
- */
- public function getLocks($uri, $returnChildLocks) {
-
- // NOTE: the following 10 lines or so could be easily replaced by
- // pure sql. MySQL's non-standard string concatenation prevents us
- // from doing this though.
- $query = 'SELECT owner, token, timeout, created, scope, depth, uri FROM '.$this->tableName.' WHERE ((created + timeout) > CAST(? AS UNSIGNED INTEGER)) AND ((uri = ?)';
- $params = array(time(),$uri);
-
- // We need to check locks for every part in the uri.
- $uriParts = explode('/',$uri);
-
- // We already covered the last part of the uri
- array_pop($uriParts);
-
- $currentPath='';
-
- foreach($uriParts as $part) {
-
- if ($currentPath) $currentPath.='/';
- $currentPath.=$part;
-
- $query.=' OR (depth!=0 AND uri = ?)';
- $params[] = $currentPath;
-
- }
-
- if ($returnChildLocks) {
-
- $query.=' OR (uri LIKE ?)';
- $params[] = $uri . '/%';
-
- }
- $query.=')';
-
- $stmt = $this->pdo->prepare($query);
- $stmt->execute($params);
- $result = $stmt->fetchAll();
-
- $lockList = array();
- foreach($result as $row) {
-
- $lockInfo = new Sabre_DAV_Locks_LockInfo();
- $lockInfo->owner = $row['owner'];
- $lockInfo->token = $row['token'];
- $lockInfo->timeout = $row['timeout'];
- $lockInfo->created = $row['created'];
- $lockInfo->scope = $row['scope'];
- $lockInfo->depth = $row['depth'];
- $lockInfo->uri = $row['uri'];
- $lockList[] = $lockInfo;
-
- }
-
- return $lockList;
-
- }
-
- /**
- * Locks a uri
- *
- * @param string $uri
- * @param Sabre_DAV_Locks_LockInfo $lockInfo
- * @return bool
- */
- public function lock($uri,Sabre_DAV_Locks_LockInfo $lockInfo) {
-
- // We're making the lock timeout 30 minutes
- $lockInfo->timeout = 30*60;
- $lockInfo->created = time();
- $lockInfo->uri = $uri;
-
- $locks = $this->getLocks($uri,false);
- $exists = false;
- foreach($locks as $lock) {
- if ($lock->token == $lockInfo->token) $exists = true;
- }
-
- if ($exists) {
- $stmt = $this->pdo->prepare('UPDATE '.$this->tableName.' SET owner = ?, timeout = ?, scope = ?, depth = ?, uri = ?, created = ? WHERE token = ?');
- $stmt->execute(array($lockInfo->owner,$lockInfo->timeout,$lockInfo->scope,$lockInfo->depth,$uri,$lockInfo->created,$lockInfo->token));
- } else {
- $stmt = $this->pdo->prepare('INSERT INTO '.$this->tableName.' (owner,timeout,scope,depth,uri,created,token) VALUES (?,?,?,?,?,?,?)');
- $stmt->execute(array($lockInfo->owner,$lockInfo->timeout,$lockInfo->scope,$lockInfo->depth,$uri,$lockInfo->created,$lockInfo->token));
- }
-
- return true;
-
- }
-
-
-
- /**
- * Removes a lock from a uri
- *
- * @param string $uri
- * @param Sabre_DAV_Locks_LockInfo $lockInfo
- * @return bool
- */
- public function unlock($uri,Sabre_DAV_Locks_LockInfo $lockInfo) {
-
- $stmt = $this->pdo->prepare('DELETE FROM '.$this->tableName.' WHERE uri = ? AND token = ?');
- $stmt->execute(array($uri,$lockInfo->token));
-
- return $stmt->rowCount()===1;
-
- }
-
-}
-
diff --git a/3rdparty/Sabre/DAV/Locks/LockInfo.php b/3rdparty/Sabre/DAV/Locks/LockInfo.php
deleted file mode 100644
index 9df014a4281..00000000000
--- a/3rdparty/Sabre/DAV/Locks/LockInfo.php
+++ /dev/null
@@ -1,81 +0,0 @@
-<?php
-
-/**
- * LockInfo class
- *
- * An object of the LockInfo class holds all the information relevant to a
- * single lock.
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Locks_LockInfo {
-
- /**
- * A shared lock
- */
- const SHARED = 1;
-
- /**
- * An exclusive lock
- */
- const EXCLUSIVE = 2;
-
- /**
- * A never expiring timeout
- */
- const TIMEOUT_INFINITE = -1;
-
- /**
- * The owner of the lock
- *
- * @var string
- */
- public $owner;
-
- /**
- * The locktoken
- *
- * @var string
- */
- public $token;
-
- /**
- * How long till the lock is expiring
- *
- * @var int
- */
- public $timeout;
-
- /**
- * UNIX Timestamp of when this lock was created
- *
- * @var int
- */
- public $created;
-
- /**
- * Exclusive or shared lock
- *
- * @var int
- */
- public $scope = self::EXCLUSIVE;
-
- /**
- * Depth of lock, can be 0 or Sabre_DAV_Server::DEPTH_INFINITY
- */
- public $depth = 0;
-
- /**
- * The uri this lock locks
- *
- * TODO: This value is not always set
- * @var mixed
- */
- public $uri;
-
-}
-
diff --git a/3rdparty/Sabre/DAV/Locks/Plugin.php b/3rdparty/Sabre/DAV/Locks/Plugin.php
deleted file mode 100644
index 957ac506a9c..00000000000
--- a/3rdparty/Sabre/DAV/Locks/Plugin.php
+++ /dev/null
@@ -1,637 +0,0 @@
-<?php
-
-/**
- * Locking plugin
- *
- * This plugin provides locking support to a WebDAV server.
- * The easiest way to get started, is by hooking it up as such:
- *
- * $lockBackend = new Sabre_DAV_Locks_Backend_File('./mylockdb');
- * $lockPlugin = new Sabre_DAV_Locks_Plugin($lockBackend);
- * $server->addPlugin($lockPlugin);
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Locks_Plugin extends Sabre_DAV_ServerPlugin {
-
- /**
- * locksBackend
- *
- * @var Sabre_DAV_Locks_Backend_Abstract
- */
- private $locksBackend;
-
- /**
- * server
- *
- * @var Sabre_DAV_Server
- */
- private $server;
-
- /**
- * __construct
- *
- * @param Sabre_DAV_Locks_Backend_Abstract $locksBackend
- */
- public function __construct(Sabre_DAV_Locks_Backend_Abstract $locksBackend = null) {
-
- $this->locksBackend = $locksBackend;
-
- }
-
- /**
- * Initializes the plugin
- *
- * This method is automatically called by the Server class after addPlugin.
- *
- * @param Sabre_DAV_Server $server
- * @return void
- */
- public function initialize(Sabre_DAV_Server $server) {
-
- $this->server = $server;
- $server->subscribeEvent('unknownMethod',array($this,'unknownMethod'));
- $server->subscribeEvent('beforeMethod',array($this,'beforeMethod'),50);
- $server->subscribeEvent('afterGetProperties',array($this,'afterGetProperties'));
-
- }
-
- /**
- * Returns a plugin name.
- *
- * Using this name other plugins will be able to access other plugins
- * using Sabre_DAV_Server::getPlugin
- *
- * @return string
- */
- public function getPluginName() {
-
- return 'locks';
-
- }
-
- /**
- * This method is called by the Server if the user used an HTTP method
- * the server didn't recognize.
- *
- * This plugin intercepts the LOCK and UNLOCK methods.
- *
- * @param string $method
- * @param string $uri
- * @return bool
- */
- public function unknownMethod($method, $uri) {
-
- switch($method) {
-
- case 'LOCK' : $this->httpLock($uri); return false;
- case 'UNLOCK' : $this->httpUnlock($uri); return false;
-
- }
-
- }
-
- /**
- * This method is called after most properties have been found
- * it allows us to add in any Lock-related properties
- *
- * @param string $path
- * @param array $newProperties
- * @return bool
- */
- public function afterGetProperties($path, &$newProperties) {
-
- foreach($newProperties[404] as $propName=>$discard) {
-
- switch($propName) {
-
- case '{DAV:}supportedlock' :
- $val = false;
- if ($this->locksBackend) $val = true;
- $newProperties[200][$propName] = new Sabre_DAV_Property_SupportedLock($val);
- unset($newProperties[404][$propName]);
- break;
-
- case '{DAV:}lockdiscovery' :
- $newProperties[200][$propName] = new Sabre_DAV_Property_LockDiscovery($this->getLocks($path));
- unset($newProperties[404][$propName]);
- break;
-
- }
-
-
- }
- return true;
-
- }
-
-
- /**
- * This method is called before the logic for any HTTP method is
- * handled.
- *
- * This plugin uses that feature to intercept access to locked resources.
- *
- * @param string $method
- * @param string $uri
- * @return bool
- */
- public function beforeMethod($method, $uri) {
-
- switch($method) {
-
- case 'DELETE' :
- $lastLock = null;
- if (!$this->validateLock($uri,$lastLock, true))
- throw new Sabre_DAV_Exception_Locked($lastLock);
- break;
- case 'MKCOL' :
- case 'PROPPATCH' :
- case 'PUT' :
- case 'PATCH' :
- $lastLock = null;
- if (!$this->validateLock($uri,$lastLock))
- throw new Sabre_DAV_Exception_Locked($lastLock);
- break;
- case 'MOVE' :
- $lastLock = null;
- if (!$this->validateLock(array(
- $uri,
- $this->server->calculateUri($this->server->httpRequest->getHeader('Destination')),
- ),$lastLock, true))
- throw new Sabre_DAV_Exception_Locked($lastLock);
- break;
- case 'COPY' :
- $lastLock = null;
- if (!$this->validateLock(
- $this->server->calculateUri($this->server->httpRequest->getHeader('Destination')),
- $lastLock, true))
- throw new Sabre_DAV_Exception_Locked($lastLock);
- break;
- }
-
- return true;
-
- }
-
- /**
- * Use this method to tell the server this plugin defines additional
- * HTTP methods.
- *
- * This method is passed a uri. It should only return HTTP methods that are
- * available for the specified uri.
- *
- * @param string $uri
- * @return array
- */
- public function getHTTPMethods($uri) {
-
- if ($this->locksBackend)
- return array('LOCK','UNLOCK');
-
- return array();
-
- }
-
- /**
- * Returns a list of features for the HTTP OPTIONS Dav: header.
- *
- * In this case this is only the number 2. The 2 in the Dav: header
- * indicates the server supports locks.
- *
- * @return array
- */
- public function getFeatures() {
-
- return array(2);
-
- }
-
- /**
- * Returns all lock information on a particular uri
- *
- * This function should return an array with Sabre_DAV_Locks_LockInfo objects. If there are no locks on a file, return an empty array.
- *
- * Additionally there is also the possibility of locks on parent nodes, so we'll need to traverse every part of the tree
- * If the $returnChildLocks argument is set to true, we'll also traverse all the children of the object
- * for any possible locks and return those as well.
- *
- * @param string $uri
- * @param bool $returnChildLocks
- * @return array
- */
- public function getLocks($uri, $returnChildLocks = false) {
-
- $lockList = array();
-
- if ($this->locksBackend)
- $lockList = array_merge($lockList,$this->locksBackend->getLocks($uri, $returnChildLocks));
-
- return $lockList;
-
- }
-
- /**
- * Locks an uri
- *
- * The WebDAV lock request can be operated to either create a new lock on a file, or to refresh an existing lock
- * If a new lock is created, a full XML body should be supplied, containing information about the lock such as the type
- * of lock (shared or exclusive) and the owner of the lock
- *
- * If a lock is to be refreshed, no body should be supplied and there should be a valid If header containing the lock
- *
- * Additionally, a lock can be requested for a non-existent file. In these case we're obligated to create an empty file as per RFC4918:S7.3
- *
- * @param string $uri
- * @return void
- */
- protected function httpLock($uri) {
-
- $lastLock = null;
- if (!$this->validateLock($uri,$lastLock)) {
-
- // If the existing lock was an exclusive lock, we need to fail
- if (!$lastLock || $lastLock->scope == Sabre_DAV_Locks_LockInfo::EXCLUSIVE) {
- //var_dump($lastLock);
- throw new Sabre_DAV_Exception_ConflictingLock($lastLock);
- }
-
- }
-
- if ($body = $this->server->httpRequest->getBody(true)) {
- // This is a new lock request
- $lockInfo = $this->parseLockRequest($body);
- $lockInfo->depth = $this->server->getHTTPDepth();
- $lockInfo->uri = $uri;
- if($lastLock && $lockInfo->scope != Sabre_DAV_Locks_LockInfo::SHARED) throw new Sabre_DAV_Exception_ConflictingLock($lastLock);
-
- } elseif ($lastLock) {
-
- // This must have been a lock refresh
- $lockInfo = $lastLock;
-
- // The resource could have been locked through another uri.
- if ($uri!=$lockInfo->uri) $uri = $lockInfo->uri;
-
- } else {
-
- // There was neither a lock refresh nor a new lock request
- throw new Sabre_DAV_Exception_BadRequest('An xml body is required for lock requests');
-
- }
-
- if ($timeout = $this->getTimeoutHeader()) $lockInfo->timeout = $timeout;
-
- $newFile = false;
-
- // If we got this far.. we should go check if this node actually exists. If this is not the case, we need to create it first
- try {
- $this->server->tree->getNodeForPath($uri);
-
- // We need to call the beforeWriteContent event for RFC3744
- // Edit: looks like this is not used, and causing problems now.
- //
- // See Issue 222
- // $this->server->broadcastEvent('beforeWriteContent',array($uri));
-
- } catch (Sabre_DAV_Exception_NotFound $e) {
-
- // It didn't, lets create it
- $this->server->createFile($uri,fopen('php://memory','r'));
- $newFile = true;
-
- }
-
- $this->lockNode($uri,$lockInfo);
-
- $this->server->httpResponse->setHeader('Content-Type','application/xml; charset=utf-8');
- $this->server->httpResponse->setHeader('Lock-Token','<opaquelocktoken:' . $lockInfo->token . '>');
- $this->server->httpResponse->sendStatus($newFile?201:200);
- $this->server->httpResponse->sendBody($this->generateLockResponse($lockInfo));
-
- }
-
- /**
- * Unlocks a uri
- *
- * This WebDAV method allows you to remove a lock from a node. The client should provide a valid locktoken through the Lock-token http header
- * The server should return 204 (No content) on success
- *
- * @param string $uri
- * @return void
- */
- protected function httpUnlock($uri) {
-
- $lockToken = $this->server->httpRequest->getHeader('Lock-Token');
-
- // If the locktoken header is not supplied, we need to throw a bad request exception
- if (!$lockToken) throw new Sabre_DAV_Exception_BadRequest('No lock token was supplied');
-
- $locks = $this->getLocks($uri);
-
- // Windows sometimes forgets to include < and > in the Lock-Token
- // header
- if ($lockToken[0]!=='<') $lockToken = '<' . $lockToken . '>';
-
- foreach($locks as $lock) {
-
- if ('<opaquelocktoken:' . $lock->token . '>' == $lockToken) {
-
- $this->unlockNode($uri,$lock);
- $this->server->httpResponse->setHeader('Content-Length','0');
- $this->server->httpResponse->sendStatus(204);
- return;
-
- }
-
- }
-
- // If we got here, it means the locktoken was invalid
- throw new Sabre_DAV_Exception_LockTokenMatchesRequestUri();
-
- }
-
- /**
- * Locks a uri
- *
- * All the locking information is supplied in the lockInfo object. The object has a suggested timeout, but this can be safely ignored
- * It is important that if the existing timeout is ignored, the property is overwritten, as this needs to be sent back to the client
- *
- * @param string $uri
- * @param Sabre_DAV_Locks_LockInfo $lockInfo
- * @return bool
- */
- public function lockNode($uri,Sabre_DAV_Locks_LockInfo $lockInfo) {
-
- if (!$this->server->broadcastEvent('beforeLock',array($uri,$lockInfo))) return;
-
- if ($this->locksBackend) return $this->locksBackend->lock($uri,$lockInfo);
- throw new Sabre_DAV_Exception_MethodNotAllowed('Locking support is not enabled for this resource. No Locking backend was found so if you didn\'t expect this error, please check your configuration.');
-
- }
-
- /**
- * Unlocks a uri
- *
- * This method removes a lock from a uri. It is assumed all the supplied information is correct and verified
- *
- * @param string $uri
- * @param Sabre_DAV_Locks_LockInfo $lockInfo
- * @return bool
- */
- public function unlockNode($uri,Sabre_DAV_Locks_LockInfo $lockInfo) {
-
- if (!$this->server->broadcastEvent('beforeUnlock',array($uri,$lockInfo))) return;
- if ($this->locksBackend) return $this->locksBackend->unlock($uri,$lockInfo);
-
- }
-
-
- /**
- * Returns the contents of the HTTP Timeout header.
- *
- * The method formats the header into an integer.
- *
- * @return int
- */
- public function getTimeoutHeader() {
-
- $header = $this->server->httpRequest->getHeader('Timeout');
-
- if ($header) {
-
- if (stripos($header,'second-')===0) $header = (int)(substr($header,7));
- else if (strtolower($header)=='infinite') $header=Sabre_DAV_Locks_LockInfo::TIMEOUT_INFINITE;
- else throw new Sabre_DAV_Exception_BadRequest('Invalid HTTP timeout header');
-
- } else {
-
- $header = 0;
-
- }
-
- return $header;
-
- }
-
- /**
- * Generates the response for successful LOCK requests
- *
- * @param Sabre_DAV_Locks_LockInfo $lockInfo
- * @return string
- */
- protected function generateLockResponse(Sabre_DAV_Locks_LockInfo $lockInfo) {
-
- $dom = new DOMDocument('1.0','utf-8');
- $dom->formatOutput = true;
-
- $prop = $dom->createElementNS('DAV:','d:prop');
- $dom->appendChild($prop);
-
- $lockDiscovery = $dom->createElementNS('DAV:','d:lockdiscovery');
- $prop->appendChild($lockDiscovery);
-
- $lockObj = new Sabre_DAV_Property_LockDiscovery(array($lockInfo),true);
- $lockObj->serialize($this->server,$lockDiscovery);
-
- return $dom->saveXML();
-
- }
-
- /**
- * validateLock should be called when a write operation is about to happen
- * It will check if the requested url is locked, and see if the correct lock tokens are passed
- *
- * @param mixed $urls List of relevant urls. Can be an array, a string or nothing at all for the current request uri
- * @param mixed $lastLock This variable will be populated with the last checked lock object (Sabre_DAV_Locks_LockInfo)
- * @param bool $checkChildLocks If set to true, this function will also look for any locks set on child resources of the supplied urls. This is needed for for example deletion of entire trees.
- * @return bool
- */
- protected function validateLock($urls = null,&$lastLock = null, $checkChildLocks = false) {
-
- if (is_null($urls)) {
- $urls = array($this->server->getRequestUri());
- } elseif (is_string($urls)) {
- $urls = array($urls);
- } elseif (!is_array($urls)) {
- throw new Sabre_DAV_Exception('The urls parameter should either be null, a string or an array');
- }
-
- $conditions = $this->getIfConditions();
-
- // We're going to loop through the urls and make sure all lock conditions are satisfied
- foreach($urls as $url) {
-
- $locks = $this->getLocks($url, $checkChildLocks);
-
- // If there were no conditions, but there were locks, we fail
- if (!$conditions && $locks) {
- reset($locks);
- $lastLock = current($locks);
- return false;
- }
-
- // If there were no locks or conditions, we go to the next url
- if (!$locks && !$conditions) continue;
-
- foreach($conditions as $condition) {
-
- if (!$condition['uri']) {
- $conditionUri = $this->server->getRequestUri();
- } else {
- $conditionUri = $this->server->calculateUri($condition['uri']);
- }
-
- // If the condition has a url, and it isn't part of the affected url at all, check the next condition
- if ($conditionUri && strpos($url,$conditionUri)!==0) continue;
-
- // The tokens array contians arrays with 2 elements. 0=true/false for normal/not condition, 1=locktoken
- // At least 1 condition has to be satisfied
- foreach($condition['tokens'] as $conditionToken) {
-
- $etagValid = true;
- $lockValid = true;
-
- // key 2 can contain an etag
- if ($conditionToken[2]) {
-
- $uri = $conditionUri?$conditionUri:$this->server->getRequestUri();
- $node = $this->server->tree->getNodeForPath($uri);
- $etagValid = $node->getETag()==$conditionToken[2];
-
- }
-
- // key 1 can contain a lock token
- if ($conditionToken[1]) {
-
- $lockValid = false;
- // Match all the locks
- foreach($locks as $lockIndex=>$lock) {
-
- $lockToken = 'opaquelocktoken:' . $lock->token;
-
- // Checking NOT
- if (!$conditionToken[0] && $lockToken != $conditionToken[1]) {
-
- // Condition valid, onto the next
- $lockValid = true;
- break;
- }
- if ($conditionToken[0] && $lockToken == $conditionToken[1]) {
-
- $lastLock = $lock;
- // Condition valid and lock matched
- unset($locks[$lockIndex]);
- $lockValid = true;
- break;
-
- }
-
- }
-
- }
-
- // If, after checking both etags and locks they are stil valid,
- // we can continue with the next condition.
- if ($etagValid && $lockValid) continue 2;
- }
- // No conditions matched, so we fail
- throw new Sabre_DAV_Exception_PreconditionFailed('The tokens provided in the if header did not match','If');
- }
-
- // Conditions were met, we'll also need to check if all the locks are gone
- if (count($locks)) {
-
- reset($locks);
-
- // There's still locks, we fail
- $lastLock = current($locks);
- return false;
-
- }
-
-
- }
-
- // We got here, this means every condition was satisfied
- return true;
-
- }
-
- /**
- * This method is created to extract information from the WebDAV HTTP 'If:' header
- *
- * The If header can be quite complex, and has a bunch of features. We're using a regex to extract all relevant information
- * The function will return an array, containing structs with the following keys
- *
- * * uri - the uri the condition applies to. If this is returned as an
- * empty string, this implies it's referring to the request url.
- * * tokens - The lock token. another 2 dimensional array containing 2 elements (0 = true/false.. If this is a negative condition its set to false, 1 = the actual token)
- * * etag - an etag, if supplied
- *
- * @return array
- */
- public function getIfConditions() {
-
- $header = $this->server->httpRequest->getHeader('If');
- if (!$header) return array();
-
- $matches = array();
-
- $regex = '/(?:\<(?P<uri>.*?)\>\s)?\((?P<not>Not\s)?(?:\<(?P<token>[^\>]*)\>)?(?:\s?)(?:\[(?P<etag>[^\]]*)\])?\)/im';
- preg_match_all($regex,$header,$matches,PREG_SET_ORDER);
-
- $conditions = array();
-
- foreach($matches as $match) {
-
- $condition = array(
- 'uri' => $match['uri'],
- 'tokens' => array(
- array($match['not']?0:1,$match['token'],isset($match['etag'])?$match['etag']:'')
- ),
- );
-
- if (!$condition['uri'] && count($conditions)) $conditions[count($conditions)-1]['tokens'][] = array(
- $match['not']?0:1,
- $match['token'],
- isset($match['etag'])?$match['etag']:''
- );
- else {
- $conditions[] = $condition;
- }
-
- }
-
- return $conditions;
-
- }
-
- /**
- * Parses a webdav lock xml body, and returns a new Sabre_DAV_Locks_LockInfo object
- *
- * @param string $body
- * @return Sabre_DAV_Locks_LockInfo
- */
- protected function parseLockRequest($body) {
-
- $xml = simplexml_load_string($body,null,LIBXML_NOWARNING);
- $xml->registerXPathNamespace('d','DAV:');
- $lockInfo = new Sabre_DAV_Locks_LockInfo();
-
- $children = $xml->children("DAV:");
- $lockInfo->owner = (string)$children->owner;
-
- $lockInfo->token = Sabre_DAV_UUIDUtil::getUUID();
- $lockInfo->scope = count($xml->xpath('d:lockscope/d:exclusive'))>0?Sabre_DAV_Locks_LockInfo::EXCLUSIVE:Sabre_DAV_Locks_LockInfo::SHARED;
-
- return $lockInfo;
-
- }
-
-
-}
diff --git a/3rdparty/Sabre/DAV/Mount/Plugin.php b/3rdparty/Sabre/DAV/Mount/Plugin.php
deleted file mode 100644
index b37a90ae993..00000000000
--- a/3rdparty/Sabre/DAV/Mount/Plugin.php
+++ /dev/null
@@ -1,80 +0,0 @@
-<?php
-
-/**
- * This plugin provides support for RFC4709: Mounting WebDAV servers
- *
- * Simply append ?mount to any collection to generate the davmount response.
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- */
-class Sabre_DAV_Mount_Plugin extends Sabre_DAV_ServerPlugin {
-
- /**
- * Reference to Server class
- *
- * @var Sabre_DAV_Server
- */
- private $server;
-
- /**
- * Initializes the plugin and registers event handles
- *
- * @param Sabre_DAV_Server $server
- * @return void
- */
- public function initialize(Sabre_DAV_Server $server) {
-
- $this->server = $server;
- $this->server->subscribeEvent('beforeMethod',array($this,'beforeMethod'), 90);
-
- }
-
- /**
- * 'beforeMethod' event handles. This event handles intercepts GET requests ending
- * with ?mount
- *
- * @param string $method
- * @param string $uri
- * @return bool
- */
- public function beforeMethod($method, $uri) {
-
- if ($method!='GET') return;
- if ($this->server->httpRequest->getQueryString()!='mount') return;
-
- $currentUri = $this->server->httpRequest->getAbsoluteUri();
-
- // Stripping off everything after the ?
- list($currentUri) = explode('?',$currentUri);
-
- $this->davMount($currentUri);
-
- // Returning false to break the event chain
- return false;
-
- }
-
- /**
- * Generates the davmount response
- *
- * @param string $uri absolute uri
- * @return void
- */
- public function davMount($uri) {
-
- $this->server->httpResponse->sendStatus(200);
- $this->server->httpResponse->setHeader('Content-Type','application/davmount+xml');
- ob_start();
- echo '<?xml version="1.0"?>', "\n";
- echo "<dm:mount xmlns:dm=\"http://purl.org/NET/webdav/mount\">\n";
- echo " <dm:url>", htmlspecialchars($uri, ENT_NOQUOTES, 'UTF-8'), "</dm:url>\n";
- echo "</dm:mount>";
- $this->server->httpResponse->sendBody(ob_get_clean());
-
- }
-
-
-}
diff --git a/3rdparty/Sabre/DAV/Node.php b/3rdparty/Sabre/DAV/Node.php
deleted file mode 100644
index 3b95dfec2fa..00000000000
--- a/3rdparty/Sabre/DAV/Node.php
+++ /dev/null
@@ -1,55 +0,0 @@
-<?php
-
-/**
- * Node class
- *
- * This is a helper class, that should aid in getting nodes setup.
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-abstract class Sabre_DAV_Node implements Sabre_DAV_INode {
-
- /**
- * Returns the last modification time
- *
- * In this case, it will simply return the current time
- *
- * @return int
- */
- public function getLastModified() {
-
- return time();
-
- }
-
- /**
- * Deletes the current node
- *
- * @throws Sabre_DAV_Exception_Forbidden
- * @return void
- */
- public function delete() {
-
- throw new Sabre_DAV_Exception_Forbidden('Permission denied to delete node');
-
- }
-
- /**
- * Renames the node
- *
- * @throws Sabre_DAV_Exception_Forbidden
- * @param string $name The new name
- * @return void
- */
- public function setName($name) {
-
- throw new Sabre_DAV_Exception_Forbidden('Permission denied to rename file');
-
- }
-
-}
-
diff --git a/3rdparty/Sabre/DAV/ObjectTree.php b/3rdparty/Sabre/DAV/ObjectTree.php
deleted file mode 100644
index 3b7f222d64b..00000000000
--- a/3rdparty/Sabre/DAV/ObjectTree.php
+++ /dev/null
@@ -1,159 +0,0 @@
-<?php
-
-/**
- * ObjectTree class
- *
- * This implementation of the Tree class makes use of the INode, IFile and ICollection API's
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_ObjectTree extends Sabre_DAV_Tree {
-
- /**
- * The root node
- *
- * @var Sabre_DAV_ICollection
- */
- protected $rootNode;
-
- /**
- * This is the node cache. Accessed nodes are stored here
- *
- * @var array
- */
- protected $cache = array();
-
- /**
- * Creates the object
- *
- * This method expects the rootObject to be passed as a parameter
- *
- * @param Sabre_DAV_ICollection $rootNode
- */
- public function __construct(Sabre_DAV_ICollection $rootNode) {
-
- $this->rootNode = $rootNode;
-
- }
-
- /**
- * Returns the INode object for the requested path
- *
- * @param string $path
- * @return Sabre_DAV_INode
- */
- public function getNodeForPath($path) {
-
- $path = trim($path,'/');
- if (isset($this->cache[$path])) return $this->cache[$path];
-
- // Is it the root node?
- if (!strlen($path)) {
- return $this->rootNode;
- }
-
- // Attempting to fetch its parent
- list($parentName, $baseName) = Sabre_DAV_URLUtil::splitPath($path);
-
- // If there was no parent, we must simply ask it from the root node.
- if ($parentName==="") {
- $node = $this->rootNode->getChild($baseName);
- } else {
- // Otherwise, we recursively grab the parent and ask him/her.
- $parent = $this->getNodeForPath($parentName);
-
- if (!($parent instanceof Sabre_DAV_ICollection))
- throw new Sabre_DAV_Exception_NotFound('Could not find node at path: ' . $path);
-
- $node = $parent->getChild($baseName);
-
- }
-
- $this->cache[$path] = $node;
- return $node;
-
- }
-
- /**
- * This function allows you to check if a node exists.
- *
- * @param string $path
- * @return bool
- */
- public function nodeExists($path) {
-
- try {
-
- // The root always exists
- if ($path==='') return true;
-
- list($parent, $base) = Sabre_DAV_URLUtil::splitPath($path);
-
- $parentNode = $this->getNodeForPath($parent);
- if (!$parentNode instanceof Sabre_DAV_ICollection) return false;
- return $parentNode->childExists($base);
-
- } catch (Sabre_DAV_Exception_NotFound $e) {
-
- return false;
-
- }
-
- }
-
- /**
- * Returns a list of childnodes for a given path.
- *
- * @param string $path
- * @return array
- */
- public function getChildren($path) {
-
- $node = $this->getNodeForPath($path);
- $children = $node->getChildren();
- foreach($children as $child) {
-
- $this->cache[trim($path,'/') . '/' . $child->getName()] = $child;
-
- }
- return $children;
-
- }
-
- /**
- * This method is called with every tree update
- *
- * Examples of tree updates are:
- * * node deletions
- * * node creations
- * * copy
- * * move
- * * renaming nodes
- *
- * If Tree classes implement a form of caching, this will allow
- * them to make sure caches will be expired.
- *
- * If a path is passed, it is assumed that the entire subtree is dirty
- *
- * @param string $path
- * @return void
- */
- public function markDirty($path) {
-
- // We don't care enough about sub-paths
- // flushing the entire cache
- $path = trim($path,'/');
- foreach($this->cache as $nodePath=>$node) {
- if ($nodePath == $path || strpos($nodePath,$path.'/')===0)
- unset($this->cache[$nodePath]);
-
- }
-
- }
-
-}
-
diff --git a/3rdparty/Sabre/DAV/PartialUpdate/IFile.php b/3rdparty/Sabre/DAV/PartialUpdate/IFile.php
deleted file mode 100644
index cf5ad55c6de..00000000000
--- a/3rdparty/Sabre/DAV/PartialUpdate/IFile.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-
-/**
- * This interface provides a way to modify only part of a target resource
- * It may be used to update a file chunk, upload big a file into smaller
- * chunks or resume an upload
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Jean-Tiare LE BIGOT (http://www.jtlebi.fr/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-interface Sabre_DAV_PartialUpdate_IFile extends Sabre_DAV_IFile {
-
- /**
- * Updates the data at a given offset
- *
- * The data argument is a readable stream resource.
- * The offset argument is an integer describing the offset. Contrary to
- * what's sent in the request, the offset here is a 0-based index.
- *
- * After a successful 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.
- *
- * @param resource $data
- * @param integer $offset
- * @return string|null
- */
- function putRange($data, $offset);
-
-}
-
diff --git a/3rdparty/Sabre/DAV/PartialUpdate/Plugin.php b/3rdparty/Sabre/DAV/PartialUpdate/Plugin.php
deleted file mode 100644
index 170acbc9785..00000000000
--- a/3rdparty/Sabre/DAV/PartialUpdate/Plugin.php
+++ /dev/null
@@ -1,209 +0,0 @@
-<?php
-/**
- * Partial update plugin (Patch method)
- *
- * This plugin provides a way to modify only part of a target resource
- * It may bu used to update a file chunk, upload big a file into smaller
- * chunks or resume an upload.
- *
- * $patchPlugin = new Sabre_DAV_Patch_Plugin();
- * $server->addPlugin($patchPlugin);
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Jean-Tiare LE BIGOT (http://www.jtlebi.fr/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_PartialUpdate_Plugin extends Sabre_DAV_ServerPlugin {
-
- /**
- * Reference to server
- *
- * @var Sabre_DAV_Server
- */
- protected $server;
-
- /**
- * Initializes the plugin
- *
- * This method is automatically called by the Server class after addPlugin.
- *
- * @param Sabre_DAV_Server $server
- * @return void
- */
- public function initialize(Sabre_DAV_Server $server) {
-
- $this->server = $server;
- $server->subscribeEvent('unknownMethod',array($this,'unknownMethod'));
-
- }
-
- /**
- * Returns a plugin name.
- *
- * Using this name other plugins will be able to access other plugins
- * using Sabre_DAV_Server::getPlugin
- *
- * @return string
- */
- public function getPluginName() {
-
- return 'partialupdate';
-
- }
-
- /**
- * This method is called by the Server if the user used an HTTP method
- * the server didn't recognize.
- *
- * This plugin intercepts the PATCH methods.
- *
- * @param string $method
- * @param string $uri
- * @return bool|null
- */
- public function unknownMethod($method, $uri) {
-
- switch($method) {
-
- case 'PATCH':
- return $this->httpPatch($uri);
-
- }
-
- }
-
- /**
- * Use this method to tell the server this plugin defines additional
- * HTTP methods.
- *
- * This method is passed a uri. It should only return HTTP methods that are
- * available for the specified uri.
- *
- * We claim to support PATCH method (partial update) if and only if
- * - the node exist
- * - the node implements our partial update interface
- *
- * @param string $uri
- * @return array
- */
- public function getHTTPMethods($uri) {
-
- $tree = $this->server->tree;
-
- if ($tree->nodeExists($uri) &&
- $tree->getNodeForPath($uri) instanceof Sabre_DAV_PartialUpdate_IFile) {
- return array('PATCH');
- }
-
- return array();
-
- }
-
- /**
- * Returns a list of features for the HTTP OPTIONS Dav: header.
- *
- * @return array
- */
- public function getFeatures() {
-
- return array('sabredav-partialupdate');
-
- }
-
- /**
- * Patch an uri
- *
- * The WebDAV patch request can be used to modify only a part of an
- * existing resource. If the resource does not exist yet and the first
- * offset is not 0, the request fails
- *
- * @param string $uri
- * @return void
- */
- protected function httpPatch($uri) {
-
- // Get the node. Will throw a 404 if not found
- $node = $this->server->tree->getNodeForPath($uri);
- if (!($node instanceof Sabre_DAV_PartialUpdate_IFile)) {
- throw new Sabre_DAV_Exception_MethodNotAllowed('The target resource does not support the PATCH method.');
- }
-
- $range = $this->getHTTPUpdateRange();
-
- if (!$range) {
- throw new Sabre_DAV_Exception_BadRequest('No valid "X-Update-Range" found in the headers');
- }
-
- $contentType = strtolower(
- $this->server->httpRequest->getHeader('Content-Type')
- );
-
- if ($contentType != 'application/x-sabredav-partialupdate') {
- throw new Sabre_DAV_Exception_UnsupportedMediaType('Unknown Content-Type header "' . $contentType . '"');
- }
-
- $len = $this->server->httpRequest->getHeader('Content-Length');
-
- // Load the begin and end data
- $start = ($range[0])?$range[0]:0;
- $end = ($range[1])?$range[1]:$len-1;
-
- // Check consistency
- if($end < $start)
- throw new Sabre_DAV_Exception_RequestedRangeNotSatisfiable('The end offset (' . $range[1] . ') is lower than the start offset (' . $range[0] . ')');
- if($end - $start + 1 != $len)
- throw new Sabre_DAV_Exception_RequestedRangeNotSatisfiable('Actual data length (' . $len . ') is not consistent with begin (' . $range[0] . ') and end (' . $range[1] . ') offsets');
-
- // Checking If-None-Match and related headers.
- if (!$this->server->checkPreconditions()) return;
-
- if (!$this->server->broadcastEvent('beforeWriteContent',array($uri, $node, null)))
- return;
-
- $body = $this->server->httpRequest->getBody();
- $etag = $node->putRange($body, $start-1);
-
- $this->server->broadcastEvent('afterWriteContent',array($uri, $node));
-
- $this->server->httpResponse->setHeader('Content-Length','0');
- if ($etag) $this->server->httpResponse->setHeader('ETag',$etag);
- $this->server->httpResponse->sendStatus(204);
-
- return false;
-
- }
-
- /**
- * Returns the HTTP custom range update header
- *
- * This method returns null if there is no well-formed HTTP range request
- * header or array($start, $end).
- *
- * The first number is the offset of the first byte in the range.
- * The second number is the offset of the last byte in the range.
- *
- * If the second offset is null, it should be treated as the offset of the last byte of the entity
- * If the first offset is null, the second offset should be used to retrieve the last x bytes of the entity
- *
- * @return array|null
- */
- public function getHTTPUpdateRange() {
-
- $range = $this->server->httpRequest->getHeader('X-Update-Range');
- if (is_null($range)) return null;
-
- // Matching "Range: bytes=1234-5678: both numbers are optional
-
- if (!preg_match('/^bytes=([0-9]*)-([0-9]*)$/i',$range,$matches)) return null;
-
- if ($matches[1]==='' && $matches[2]==='') return null;
-
- return array(
- $matches[1]!==''?$matches[1]:null,
- $matches[2]!==''?$matches[2]:null,
- );
-
- }
-}
diff --git a/3rdparty/Sabre/DAV/Property.php b/3rdparty/Sabre/DAV/Property.php
deleted file mode 100644
index 6487bf44bc4..00000000000
--- a/3rdparty/Sabre/DAV/Property.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-
-/**
- * Abstract property class
- *
- * Extend this class to create custom complex properties
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-abstract class Sabre_DAV_Property implements Sabre_DAV_PropertyInterface {
-
- /**
- * Unserializes the property.
- *
- * This static method should return a an instance of this object.
- *
- * @param DOMElement $prop
- * @return Sabre_DAV_IProperty
- */
- static function unserialize(DOMElement $prop) {
-
- throw new Sabre_DAV_Exception('Unserialize has not been implemented for this class');
-
- }
-
-}
-
diff --git a/3rdparty/Sabre/DAV/Property/GetLastModified.php b/3rdparty/Sabre/DAV/Property/GetLastModified.php
deleted file mode 100644
index bd63f573140..00000000000
--- a/3rdparty/Sabre/DAV/Property/GetLastModified.php
+++ /dev/null
@@ -1,75 +0,0 @@
-<?php
-
-/**
- * This property represents the {DAV:}getlastmodified property.
- *
- * Although this is normally a simple property, windows requires us to add
- * some new attributes.
- *
- * This class uses unix timestamps internally, and converts them to RFC 1123 times for
- * serialization
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Property_GetLastModified extends Sabre_DAV_Property {
-
- /**
- * time
- *
- * @var int
- */
- public $time;
-
- /**
- * __construct
- *
- * @param int|DateTime $time
- */
- public function __construct($time) {
-
- if ($time instanceof DateTime) {
- $this->time = $time;
- } elseif (is_int($time) || ctype_digit($time)) {
- $this->time = new DateTime('@' . $time);
- } else {
- $this->time = new DateTime($time);
- }
-
- // Setting timezone to UTC
- $this->time->setTimezone(new DateTimeZone('UTC'));
-
- }
-
- /**
- * serialize
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $prop
- * @return void
- */
- public function serialize(Sabre_DAV_Server $server, DOMElement $prop) {
-
- $doc = $prop->ownerDocument;
- $prop->setAttribute('xmlns:b','urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/');
- $prop->setAttribute('b:dt','dateTime.rfc1123');
- $prop->nodeValue = Sabre_HTTP_Util::toHTTPDate($this->time);
-
- }
-
- /**
- * getTime
- *
- * @return DateTime
- */
- public function getTime() {
-
- return $this->time;
-
- }
-
-}
-
diff --git a/3rdparty/Sabre/DAV/Property/Href.php b/3rdparty/Sabre/DAV/Property/Href.php
deleted file mode 100644
index cd1d867f71b..00000000000
--- a/3rdparty/Sabre/DAV/Property/Href.php
+++ /dev/null
@@ -1,91 +0,0 @@
-<?php
-
-/**
- * Href property
- *
- * The href property represents a url within a {DAV:}href element.
- * This is used by many WebDAV extensions, but not really within the WebDAV core spec
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Property_Href extends Sabre_DAV_Property implements Sabre_DAV_Property_IHref {
-
- /**
- * href
- *
- * @var string
- */
- private $href;
-
- /**
- * Automatically prefix the url with the server base directory
- *
- * @var bool
- */
- private $autoPrefix = true;
-
- /**
- * __construct
- *
- * @param string $href
- * @param bool $autoPrefix
- */
- public function __construct($href, $autoPrefix = true) {
-
- $this->href = $href;
- $this->autoPrefix = $autoPrefix;
-
- }
-
- /**
- * Returns the uri
- *
- * @return string
- */
- public function getHref() {
-
- return $this->href;
-
- }
-
- /**
- * Serializes this property.
- *
- * It will additionally prepend the href property with the server's base uri.
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $dom
- * @return void
- */
- public function serialize(Sabre_DAV_Server $server, DOMElement $dom) {
-
- $prefix = $server->xmlNamespaces['DAV:'];
-
- $elem = $dom->ownerDocument->createElement($prefix . ':href');
- $elem->nodeValue = ($this->autoPrefix?$server->getBaseUri():'') . $this->href;
- $dom->appendChild($elem);
-
- }
-
- /**
- * Unserializes this property from a DOM Element
- *
- * This method returns an instance of this class.
- * It will only decode {DAV:}href values. For non-compatible elements null will be returned.
- *
- * @param DOMElement $dom
- * @return Sabre_DAV_Property_Href
- */
- static function unserialize(DOMElement $dom) {
-
- if ($dom->firstChild && Sabre_DAV_XMLUtil::toClarkNotation($dom->firstChild)==='{DAV:}href') {
- return new self($dom->firstChild->textContent,false);
- }
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAV/Property/HrefList.php b/3rdparty/Sabre/DAV/Property/HrefList.php
deleted file mode 100644
index 282c452ca0b..00000000000
--- a/3rdparty/Sabre/DAV/Property/HrefList.php
+++ /dev/null
@@ -1,96 +0,0 @@
-<?php
-
-/**
- * HrefList property
- *
- * This property contains multiple {DAV:}href elements, each containing a url.
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Property_HrefList extends Sabre_DAV_Property {
-
- /**
- * hrefs
- *
- * @var array
- */
- private $hrefs;
-
- /**
- * Automatically prefix the url with the server base directory
- *
- * @var bool
- */
- private $autoPrefix = true;
-
- /**
- * __construct
- *
- * @param array $hrefs
- * @param bool $autoPrefix
- */
- public function __construct(array $hrefs, $autoPrefix = true) {
-
- $this->hrefs = $hrefs;
- $this->autoPrefix = $autoPrefix;
-
- }
-
- /**
- * Returns the uris
- *
- * @return array
- */
- public function getHrefs() {
-
- return $this->hrefs;
-
- }
-
- /**
- * Serializes this property.
- *
- * It will additionally prepend the href property with the server's base uri.
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $dom
- * @return void
- */
- public function serialize(Sabre_DAV_Server $server,DOMElement $dom) {
-
- $prefix = $server->xmlNamespaces['DAV:'];
-
- foreach($this->hrefs as $href) {
- $elem = $dom->ownerDocument->createElement($prefix . ':href');
- $elem->nodeValue = ($this->autoPrefix?$server->getBaseUri():'') . $href;
- $dom->appendChild($elem);
- }
-
- }
-
- /**
- * Unserializes this property from a DOM Element
- *
- * This method returns an instance of this class.
- * It will only decode {DAV:}href values.
- *
- * @param DOMElement $dom
- * @return Sabre_DAV_Property_HrefList
- */
- static function unserialize(DOMElement $dom) {
-
- $hrefs = array();
- foreach($dom->childNodes as $child) {
- if (Sabre_DAV_XMLUtil::toClarkNotation($child)==='{DAV:}href') {
- $hrefs[] = $child->textContent;
- }
- }
- return new self($hrefs, false);
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAV/Property/IHref.php b/3rdparty/Sabre/DAV/Property/IHref.php
deleted file mode 100644
index 5c0409064cb..00000000000
--- a/3rdparty/Sabre/DAV/Property/IHref.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
-/**
- * IHref interface
- *
- * Any property implementing this interface can expose a related url.
- * This is used by certain subsystems to aquire more information about for example
- * the owner of a file
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-interface Sabre_DAV_Property_IHref {
-
- /**
- * getHref
- *
- * @return string
- */
- function getHref();
-
-}
diff --git a/3rdparty/Sabre/DAV/Property/LockDiscovery.php b/3rdparty/Sabre/DAV/Property/LockDiscovery.php
deleted file mode 100644
index 2ded5649a44..00000000000
--- a/3rdparty/Sabre/DAV/Property/LockDiscovery.php
+++ /dev/null
@@ -1,102 +0,0 @@
-<?php
-
-/**
- * Represents {DAV:}lockdiscovery property
- *
- * This property contains all the open locks on a given resource
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Property_LockDiscovery extends Sabre_DAV_Property {
-
- /**
- * locks
- *
- * @var array
- */
- public $locks;
-
- /**
- * Should we show the locktoken as well?
- *
- * @var bool
- */
- public $revealLockToken;
-
- /**
- * Hides the {DAV:}lockroot element from the response.
- *
- * It was reported that showing the lockroot in the response can break
- * Office 2000 compatibility.
- */
- static public $hideLockRoot = false;
-
- /**
- * __construct
- *
- * @param array $locks
- * @param bool $revealLockToken
- */
- public function __construct($locks, $revealLockToken = false) {
-
- $this->locks = $locks;
- $this->revealLockToken = $revealLockToken;
-
- }
-
- /**
- * serialize
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $prop
- * @return void
- */
- public function serialize(Sabre_DAV_Server $server, DOMElement $prop) {
-
- $doc = $prop->ownerDocument;
-
- foreach($this->locks as $lock) {
-
- $activeLock = $doc->createElementNS('DAV:','d:activelock');
- $prop->appendChild($activeLock);
-
- $lockScope = $doc->createElementNS('DAV:','d:lockscope');
- $activeLock->appendChild($lockScope);
-
- $lockScope->appendChild($doc->createElementNS('DAV:','d:' . ($lock->scope==Sabre_DAV_Locks_LockInfo::EXCLUSIVE?'exclusive':'shared')));
-
- $lockType = $doc->createElementNS('DAV:','d:locktype');
- $activeLock->appendChild($lockType);
-
- $lockType->appendChild($doc->createElementNS('DAV:','d:write'));
-
- /* {DAV:}lockroot */
- if (!self::$hideLockRoot) {
- $lockRoot = $doc->createElementNS('DAV:','d:lockroot');
- $activeLock->appendChild($lockRoot);
- $href = $doc->createElementNS('DAV:','d:href');
- $href->appendChild($doc->createTextNode($server->getBaseUri() . $lock->uri));
- $lockRoot->appendChild($href);
- }
-
- $activeLock->appendChild($doc->createElementNS('DAV:','d:depth',($lock->depth == Sabre_DAV_Server::DEPTH_INFINITY?'infinity':$lock->depth)));
- $activeLock->appendChild($doc->createElementNS('DAV:','d:timeout','Second-' . $lock->timeout));
-
- if ($this->revealLockToken) {
- $lockToken = $doc->createElementNS('DAV:','d:locktoken');
- $activeLock->appendChild($lockToken);
- $lockToken->appendChild($doc->createElementNS('DAV:','d:href','opaquelocktoken:' . $lock->token));
- }
-
- $activeLock->appendChild($doc->createElementNS('DAV:','d:owner',$lock->owner));
-
- }
-
- }
-
-}
-
diff --git a/3rdparty/Sabre/DAV/Property/ResourceType.php b/3rdparty/Sabre/DAV/Property/ResourceType.php
deleted file mode 100644
index f6269611e54..00000000000
--- a/3rdparty/Sabre/DAV/Property/ResourceType.php
+++ /dev/null
@@ -1,125 +0,0 @@
-<?php
-
-/**
- * This class represents the {DAV:}resourcetype property
- *
- * Normally for files this is empty, and for collection {DAV:}collection.
- * However, other specs define different values for this.
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Property_ResourceType extends Sabre_DAV_Property {
-
- /**
- * resourceType
- *
- * @var array
- */
- public $resourceType = array();
-
- /**
- * __construct
- *
- * @param mixed $resourceType
- */
- public function __construct($resourceType = array()) {
-
- if ($resourceType === Sabre_DAV_Server::NODE_FILE)
- $this->resourceType = array();
- elseif ($resourceType === Sabre_DAV_Server::NODE_DIRECTORY)
- $this->resourceType = array('{DAV:}collection');
- elseif (is_array($resourceType))
- $this->resourceType = $resourceType;
- else
- $this->resourceType = array($resourceType);
-
- }
-
- /**
- * serialize
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $prop
- * @return void
- */
- public function serialize(Sabre_DAV_Server $server, DOMElement $prop) {
-
- $propName = null;
- $rt = $this->resourceType;
-
- foreach($rt as $resourceType) {
- if (preg_match('/^{([^}]*)}(.*)$/',$resourceType,$propName)) {
-
- if (isset($server->xmlNamespaces[$propName[1]])) {
- $prop->appendChild($prop->ownerDocument->createElement($server->xmlNamespaces[$propName[1]] . ':' . $propName[2]));
- } else {
- $prop->appendChild($prop->ownerDocument->createElementNS($propName[1],'custom:' . $propName[2]));
- }
-
- }
- }
-
- }
-
- /**
- * Returns the values in clark-notation
- *
- * For example array('{DAV:}collection')
- *
- * @return array
- */
- public function getValue() {
-
- return $this->resourceType;
-
- }
-
- /**
- * Checks if the principal contains a certain value
- *
- * @param string $type
- * @return bool
- */
- public function is($type) {
-
- return in_array($type, $this->resourceType);
-
- }
-
- /**
- * Adds a resourcetype value to this property
- *
- * @param string $type
- * @return void
- */
- public function add($type) {
-
- $this->resourceType[] = $type;
- $this->resourceType = array_unique($this->resourceType);
-
- }
-
- /**
- * Unserializes a DOM element into a ResourceType property.
- *
- * @param DOMElement $dom
- * @return Sabre_DAV_Property_ResourceType
- */
- static public function unserialize(DOMElement $dom) {
-
- $value = array();
- foreach($dom->childNodes as $child) {
-
- $value[] = Sabre_DAV_XMLUtil::toClarkNotation($child);
-
- }
-
- return new self($value);
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAV/Property/Response.php b/3rdparty/Sabre/DAV/Property/Response.php
deleted file mode 100644
index 9f21163d12e..00000000000
--- a/3rdparty/Sabre/DAV/Property/Response.php
+++ /dev/null
@@ -1,155 +0,0 @@
-<?php
-
-/**
- * Response property
- *
- * This class represents the {DAV:}response XML element.
- * This is used by the Server class to encode individual items within a multistatus
- * response.
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Property_Response extends Sabre_DAV_Property implements Sabre_DAV_Property_IHref {
-
- /**
- * Url for the response
- *
- * @var string
- */
- private $href;
-
- /**
- * Propertylist, ordered by HTTP status code
- *
- * @var array
- */
- private $responseProperties;
-
- /**
- * The responseProperties argument is a list of properties
- * within an array with keys representing HTTP status codes
- *
- * @param string $href
- * @param array $responseProperties
- */
- public function __construct($href, array $responseProperties) {
-
- $this->href = $href;
- $this->responseProperties = $responseProperties;
-
- }
-
- /**
- * Returns the url
- *
- * @return string
- */
- public function getHref() {
-
- return $this->href;
-
- }
-
- /**
- * Returns the property list
- *
- * @return array
- */
- public function getResponseProperties() {
-
- return $this->responseProperties;
-
- }
-
- /**
- * serialize
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $dom
- * @return void
- */
- public function serialize(Sabre_DAV_Server $server, DOMElement $dom) {
-
- $document = $dom->ownerDocument;
- $properties = $this->responseProperties;
-
- $xresponse = $document->createElement('d:response');
- $dom->appendChild($xresponse);
-
- $uri = Sabre_DAV_URLUtil::encodePath($this->href);
-
- // Adding the baseurl to the beginning of the url
- $uri = $server->getBaseUri() . $uri;
-
- $xresponse->appendChild($document->createElement('d:href',$uri));
-
- // The properties variable is an array containing properties, grouped by
- // HTTP status
- foreach($properties as $httpStatus=>$propertyGroup) {
-
- // The 'href' is also in this array, and it's special cased.
- // We will ignore it
- if ($httpStatus=='href') continue;
-
- // If there are no properties in this group, we can also just carry on
- if (!count($propertyGroup)) continue;
-
- $xpropstat = $document->createElement('d:propstat');
- $xresponse->appendChild($xpropstat);
-
- $xprop = $document->createElement('d:prop');
- $xpropstat->appendChild($xprop);
-
- $nsList = $server->xmlNamespaces;
-
- foreach($propertyGroup as $propertyName=>$propertyValue) {
-
- $propName = null;
- preg_match('/^{([^}]*)}(.*)$/',$propertyName,$propName);
-
- // special case for empty namespaces
- if ($propName[1]=='') {
-
- $currentProperty = $document->createElement($propName[2]);
- $xprop->appendChild($currentProperty);
- $currentProperty->setAttribute('xmlns','');
-
- } else {
-
- if (!isset($nsList[$propName[1]])) {
- $nsList[$propName[1]] = 'x' . count($nsList);
- }
-
- // If the namespace was defined in the top-level xml namespaces, it means
- // there was already a namespace declaration, and we don't have to worry about it.
- if (isset($server->xmlNamespaces[$propName[1]])) {
- $currentProperty = $document->createElement($nsList[$propName[1]] . ':' . $propName[2]);
- } else {
- $currentProperty = $document->createElementNS($propName[1],$nsList[$propName[1]].':' . $propName[2]);
- }
- $xprop->appendChild($currentProperty);
-
- }
-
- if (is_scalar($propertyValue)) {
- $text = $document->createTextNode($propertyValue);
- $currentProperty->appendChild($text);
- } elseif ($propertyValue instanceof Sabre_DAV_PropertyInterface) {
- $propertyValue->serialize($server,$currentProperty);
- } elseif (!is_null($propertyValue)) {
- throw new Sabre_DAV_Exception('Unknown property value type: ' . gettype($propertyValue) . ' for property: ' . $propertyName);
- }
-
- }
-
- $xpropstat->appendChild($document->createElement('d:status',$server->httpResponse->getStatusMessage($httpStatus)));
-
- }
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAV/Property/ResponseList.php b/3rdparty/Sabre/DAV/Property/ResponseList.php
deleted file mode 100644
index cae923afbf9..00000000000
--- a/3rdparty/Sabre/DAV/Property/ResponseList.php
+++ /dev/null
@@ -1,57 +0,0 @@
-<?php
-
-/**
- * ResponseList property
- *
- * This class represents multiple {DAV:}response XML elements.
- * This is used by the Server class to encode items within a multistatus
- * response.
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Property_ResponseList extends Sabre_DAV_Property {
-
- /**
- * Response objects.
- *
- * @var array
- */
- private $responses;
-
- /**
- * The only valid argument is a list of Sabre_DAV_Property_Response
- * objects.
- *
- * @param array $responses;
- */
- public function __construct($responses) {
-
- foreach($responses as $response) {
- if (!($response instanceof Sabre_DAV_Property_Response)) {
- throw new InvalidArgumentException('You must pass an array of Sabre_DAV_Property_Response objects');
- }
- }
- $this->responses = $responses;
-
- }
-
- /**
- * serialize
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $dom
- * @return void
- */
- public function serialize(Sabre_DAV_Server $server,DOMElement $dom) {
-
- foreach($this->responses as $response) {
- $response->serialize($server, $dom);
- }
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAV/Property/SupportedLock.php b/3rdparty/Sabre/DAV/Property/SupportedLock.php
deleted file mode 100644
index 4e3aaf23a1a..00000000000
--- a/3rdparty/Sabre/DAV/Property/SupportedLock.php
+++ /dev/null
@@ -1,76 +0,0 @@
-<?php
-
-/**
- * This class represents the {DAV:}supportedlock property
- *
- * This property contains information about what kind of locks
- * this server supports.
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Property_SupportedLock extends Sabre_DAV_Property {
-
- /**
- * supportsLocks
- *
- * @var mixed
- */
- public $supportsLocks = false;
-
- /**
- * __construct
- *
- * @param mixed $supportsLocks
- */
- public function __construct($supportsLocks) {
-
- $this->supportsLocks = $supportsLocks;
-
- }
-
- /**
- * serialize
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $prop
- * @return void
- */
- public function serialize(Sabre_DAV_Server $server,DOMElement $prop) {
-
- $doc = $prop->ownerDocument;
-
- if (!$this->supportsLocks) return null;
-
- $lockEntry1 = $doc->createElementNS('DAV:','d:lockentry');
- $lockEntry2 = $doc->createElementNS('DAV:','d:lockentry');
-
- $prop->appendChild($lockEntry1);
- $prop->appendChild($lockEntry2);
-
- $lockScope1 = $doc->createElementNS('DAV:','d:lockscope');
- $lockScope2 = $doc->createElementNS('DAV:','d:lockscope');
- $lockType1 = $doc->createElementNS('DAV:','d:locktype');
- $lockType2 = $doc->createElementNS('DAV:','d:locktype');
-
- $lockEntry1->appendChild($lockScope1);
- $lockEntry1->appendChild($lockType1);
- $lockEntry2->appendChild($lockScope2);
- $lockEntry2->appendChild($lockType2);
-
- $lockScope1->appendChild($doc->createElementNS('DAV:','d:exclusive'));
- $lockScope2->appendChild($doc->createElementNS('DAV:','d:shared'));
-
- $lockType1->appendChild($doc->createElementNS('DAV:','d:write'));
- $lockType2->appendChild($doc->createElementNS('DAV:','d:write'));
-
- //$frag->appendXML('<d:lockentry><d:lockscope><d:exclusive /></d:lockscope><d:locktype><d:write /></d:locktype></d:lockentry>');
- //$frag->appendXML('<d:lockentry><d:lockscope><d:shared /></d:lockscope><d:locktype><d:write /></d:locktype></d:lockentry>');
-
- }
-
-}
-
diff --git a/3rdparty/Sabre/DAV/Property/SupportedReportSet.php b/3rdparty/Sabre/DAV/Property/SupportedReportSet.php
deleted file mode 100644
index e62699f3b5a..00000000000
--- a/3rdparty/Sabre/DAV/Property/SupportedReportSet.php
+++ /dev/null
@@ -1,109 +0,0 @@
-<?php
-
-/**
- * supported-report-set property.
- *
- * This property is defined in RFC3253, but since it's
- * so common in other webdav-related specs, it is part of the core server.
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Property_SupportedReportSet extends Sabre_DAV_Property {
-
- /**
- * List of reports
- *
- * @var array
- */
- protected $reports = array();
-
- /**
- * Creates the property
- *
- * Any reports passed in the constructor
- * should be valid report-types in clark-notation.
- *
- * Either a string or an array of strings must be passed.
- *
- * @param mixed $reports
- */
- public function __construct($reports = null) {
-
- if (!is_null($reports))
- $this->addReport($reports);
-
- }
-
- /**
- * Adds a report to this property
- *
- * The report must be a string in clark-notation.
- * Multiple reports can be specified as an array.
- *
- * @param mixed $report
- * @return void
- */
- public function addReport($report) {
-
- if (!is_array($report)) $report = array($report);
-
- foreach($report as $r) {
-
- if (!preg_match('/^{([^}]*)}(.*)$/',$r))
- throw new Sabre_DAV_Exception('Reportname must be in clark-notation');
-
- $this->reports[] = $r;
-
- }
-
- }
-
- /**
- * Returns the list of supported reports
- *
- * @return array
- */
- public function getValue() {
-
- return $this->reports;
-
- }
-
- /**
- * Serializes the node
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $prop
- * @return void
- */
- public function serialize(Sabre_DAV_Server $server, DOMElement $prop) {
-
- foreach($this->reports as $reportName) {
-
- $supportedReport = $prop->ownerDocument->createElement('d:supported-report');
- $prop->appendChild($supportedReport);
-
- $report = $prop->ownerDocument->createElement('d:report');
- $supportedReport->appendChild($report);
-
- preg_match('/^{([^}]*)}(.*)$/',$reportName,$matches);
-
- list(, $namespace, $element) = $matches;
-
- $prefix = isset($server->xmlNamespaces[$namespace])?$server->xmlNamespaces[$namespace]:null;
-
- if ($prefix) {
- $report->appendChild($prop->ownerDocument->createElement($prefix . ':' . $element));
- } else {
- $report->appendChild($prop->ownerDocument->createElementNS($namespace, 'x:' . $element));
- }
-
- }
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAV/PropertyInterface.php b/3rdparty/Sabre/DAV/PropertyInterface.php
deleted file mode 100644
index 515072cbd35..00000000000
--- a/3rdparty/Sabre/DAV/PropertyInterface.php
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-
-/**
- * PropertyInterface
- *
- * Implement this interface to create new complex properties
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-interface Sabre_DAV_PropertyInterface {
-
- public function serialize(Sabre_DAV_Server $server, DOMElement $prop);
-
- static function unserialize(DOMElement $prop);
-
-}
-
diff --git a/3rdparty/Sabre/DAV/Server.php b/3rdparty/Sabre/DAV/Server.php
deleted file mode 100644
index cf6f87e68ab..00000000000
--- a/3rdparty/Sabre/DAV/Server.php
+++ /dev/null
@@ -1,2135 +0,0 @@
-<?php
-
-/**
- * Main DAV server class
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Server {
-
- /**
- * Infinity is used for some request supporting the HTTP Depth header and indicates that the operation should traverse the entire tree
- */
- const DEPTH_INFINITY = -1;
-
- /**
- * Nodes that are files, should have this as the type property
- */
- const NODE_FILE = 1;
-
- /**
- * Nodes that are directories, should use this value as the type property
- */
- const NODE_DIRECTORY = 2;
-
- /**
- * XML namespace for all SabreDAV related elements
- */
- const NS_SABREDAV = 'http://sabredav.org/ns';
-
- /**
- * The tree object
- *
- * @var Sabre_DAV_Tree
- */
- public $tree;
-
- /**
- * The base uri
- *
- * @var string
- */
- protected $baseUri = null;
-
- /**
- * httpResponse
- *
- * @var Sabre_HTTP_Response
- */
- public $httpResponse;
-
- /**
- * httpRequest
- *
- * @var Sabre_HTTP_Request
- */
- public $httpRequest;
-
- /**
- * The list of plugins
- *
- * @var array
- */
- protected $plugins = array();
-
- /**
- * This array contains a list of callbacks we should call when certain events are triggered
- *
- * @var array
- */
- protected $eventSubscriptions = array();
-
- /**
- * This is a default list of namespaces.
- *
- * If you are defining your own custom namespace, add it here to reduce
- * bandwidth and improve legibility of xml bodies.
- *
- * @var array
- */
- public $xmlNamespaces = array(
- 'DAV:' => 'd',
- 'http://sabredav.org/ns' => 's',
- );
-
- /**
- * The propertymap can be used to map properties from
- * requests to property classes.
- *
- * @var array
- */
- public $propertyMap = array(
- '{DAV:}resourcetype' => 'Sabre_DAV_Property_ResourceType',
- );
-
- public $protectedProperties = array(
- // RFC4918
- '{DAV:}getcontentlength',
- '{DAV:}getetag',
- '{DAV:}getlastmodified',
- '{DAV:}lockdiscovery',
- '{DAV:}supportedlock',
-
- // RFC4331
- '{DAV:}quota-available-bytes',
- '{DAV:}quota-used-bytes',
-
- // RFC3744
- '{DAV:}supported-privilege-set',
- '{DAV:}current-user-privilege-set',
- '{DAV:}acl',
- '{DAV:}acl-restrictions',
- '{DAV:}inherited-acl-set',
-
- );
-
- /**
- * This is a flag that allow or not showing file, line and code
- * of the exception in the returned XML
- *
- * @var bool
- */
- public $debugExceptions = false;
-
- /**
- * This property allows you to automatically add the 'resourcetype' value
- * based on a node's classname or interface.
- *
- * The preset ensures that {DAV:}collection is automaticlly added for nodes
- * implementing Sabre_DAV_ICollection.
- *
- * @var array
- */
- public $resourceTypeMapping = array(
- 'Sabre_DAV_ICollection' => '{DAV:}collection',
- );
-
- /**
- * If this setting is turned off, SabreDAV's version number will be hidden
- * from various places.
- *
- * Some people feel this is a good security measure.
- *
- * @var bool
- */
- static public $exposeVersion = true;
-
- /**
- * Sets up the server
- *
- * If a Sabre_DAV_Tree object is passed as an argument, it will
- * use it as the directory tree. If a Sabre_DAV_INode is passed, it
- * will create a Sabre_DAV_ObjectTree and use the node as the root.
- *
- * If nothing is passed, a Sabre_DAV_SimpleCollection is created in
- * a Sabre_DAV_ObjectTree.
- *
- * If an array is passed, we automatically create a root node, and use
- * the nodes in the array as top-level children.
- *
- * @param Sabre_DAV_Tree|Sabre_DAV_INode|array|null $treeOrNode The tree object
- */
- public function __construct($treeOrNode = null) {
-
- if ($treeOrNode instanceof Sabre_DAV_Tree) {
- $this->tree = $treeOrNode;
- } elseif ($treeOrNode instanceof Sabre_DAV_INode) {
- $this->tree = new Sabre_DAV_ObjectTree($treeOrNode);
- } elseif (is_array($treeOrNode)) {
-
- // If it's an array, a list of nodes was passed, and we need to
- // create the root node.
- foreach($treeOrNode as $node) {
- if (!($node instanceof Sabre_DAV_INode)) {
- throw new Sabre_DAV_Exception('Invalid argument passed to constructor. If you\'re passing an array, all the values must implement Sabre_DAV_INode');
- }
- }
-
- $root = new Sabre_DAV_SimpleCollection('root', $treeOrNode);
- $this->tree = new Sabre_DAV_ObjectTree($root);
-
- } elseif (is_null($treeOrNode)) {
- $root = new Sabre_DAV_SimpleCollection('root');
- $this->tree = new Sabre_DAV_ObjectTree($root);
- } else {
- throw new Sabre_DAV_Exception('Invalid argument passed to constructor. Argument must either be an instance of Sabre_DAV_Tree, Sabre_DAV_INode, an array or null');
- }
- $this->httpResponse = new Sabre_HTTP_Response();
- $this->httpRequest = new Sabre_HTTP_Request();
-
- }
-
- /**
- * Starts the DAV Server
- *
- * @return void
- */
- public function exec() {
-
- try {
-
- $this->invokeMethod($this->httpRequest->getMethod(), $this->getRequestUri());
-
- } catch (Exception $e) {
-
- try {
- $this->broadcastEvent('exception', array($e));
- } catch (Exception $ignore) {
- }
- $DOM = new DOMDocument('1.0','utf-8');
- $DOM->formatOutput = true;
-
- $error = $DOM->createElementNS('DAV:','d:error');
- $error->setAttribute('xmlns:s',self::NS_SABREDAV);
- $DOM->appendChild($error);
-
- $h = function($v) {
-
- return htmlspecialchars($v, ENT_NOQUOTES, 'UTF-8');
-
- };
-
- $error->appendChild($DOM->createElement('s:exception',$h(get_class($e))));
- $error->appendChild($DOM->createElement('s:message',$h($e->getMessage())));
- if ($this->debugExceptions) {
- $error->appendChild($DOM->createElement('s:file',$h($e->getFile())));
- $error->appendChild($DOM->createElement('s:line',$h($e->getLine())));
- $error->appendChild($DOM->createElement('s:code',$h($e->getCode())));
- $error->appendChild($DOM->createElement('s:stacktrace',$h($e->getTraceAsString())));
-
- }
- if (self::$exposeVersion) {
- $error->appendChild($DOM->createElement('s:sabredav-version',$h(Sabre_DAV_Version::VERSION)));
- }
-
- if($e instanceof Sabre_DAV_Exception) {
-
- $httpCode = $e->getHTTPCode();
- $e->serialize($this,$error);
- $headers = $e->getHTTPHeaders($this);
-
- } else {
-
- $httpCode = 500;
- $headers = array();
-
- }
- $headers['Content-Type'] = 'application/xml; charset=utf-8';
-
- $this->httpResponse->sendStatus($httpCode);
- $this->httpResponse->setHeaders($headers);
- $this->httpResponse->sendBody($DOM->saveXML());
-
- }
-
- }
-
- /**
- * Sets the base server uri
- *
- * @param string $uri
- * @return void
- */
- public function setBaseUri($uri) {
-
- // If the baseUri does not end with a slash, we must add it
- if ($uri[strlen($uri)-1]!=='/')
- $uri.='/';
-
- $this->baseUri = $uri;
-
- }
-
- /**
- * Returns the base responding uri
- *
- * @return string
- */
- public function getBaseUri() {
-
- if (is_null($this->baseUri)) $this->baseUri = $this->guessBaseUri();
- return $this->baseUri;
-
- }
-
- /**
- * This method attempts to detect the base uri.
- * Only the PATH_INFO variable is considered.
- *
- * If this variable is not set, the root (/) is assumed.
- *
- * @return string
- */
- public function guessBaseUri() {
-
- $pathInfo = $this->httpRequest->getRawServerValue('PATH_INFO');
- $uri = $this->httpRequest->getRawServerValue('REQUEST_URI');
-
- // If PATH_INFO is found, we can assume it's accurate.
- if (!empty($pathInfo)) {
-
- // We need to make sure we ignore the QUERY_STRING part
- if ($pos = strpos($uri,'?'))
- $uri = substr($uri,0,$pos);
-
- // PATH_INFO is only set for urls, such as: /example.php/path
- // in that case PATH_INFO contains '/path'.
- // Note that REQUEST_URI is percent encoded, while PATH_INFO is
- // not, Therefore they are only comparable if we first decode
- // REQUEST_INFO as well.
- $decodedUri = Sabre_DAV_URLUtil::decodePath($uri);
-
- // A simple sanity check:
- if(substr($decodedUri,strlen($decodedUri)-strlen($pathInfo))===$pathInfo) {
- $baseUri = substr($decodedUri,0,strlen($decodedUri)-strlen($pathInfo));
- return rtrim($baseUri,'/') . '/';
- }
-
- throw new Sabre_DAV_Exception('The REQUEST_URI ('. $uri . ') did not end with the contents of PATH_INFO (' . $pathInfo . '). This server might be misconfigured.');
-
- }
-
- // The last fallback is that we're just going to assume the server root.
- return '/';
-
- }
-
- /**
- * Adds a plugin to the server
- *
- * For more information, console the documentation of Sabre_DAV_ServerPlugin
- *
- * @param Sabre_DAV_ServerPlugin $plugin
- * @return void
- */
- public function addPlugin(Sabre_DAV_ServerPlugin $plugin) {
-
- $this->plugins[$plugin->getPluginName()] = $plugin;
- $plugin->initialize($this);
-
- }
-
- /**
- * Returns an initialized plugin by it's name.
- *
- * This function returns null if the plugin was not found.
- *
- * @param string $name
- * @return Sabre_DAV_ServerPlugin
- */
- public function getPlugin($name) {
-
- if (isset($this->plugins[$name]))
- return $this->plugins[$name];
-
- // This is a fallback and deprecated.
- foreach($this->plugins as $plugin) {
- if (get_class($plugin)===$name) return $plugin;
- }
-
- return null;
-
- }
-
- /**
- * Returns all plugins
- *
- * @return array
- */
- public function getPlugins() {
-
- return $this->plugins;
-
- }
-
-
- /**
- * Subscribe to an event.
- *
- * When the event is triggered, we'll call all the specified callbacks.
- * It is possible to control the order of the callbacks through the
- * priority argument.
- *
- * This is for example used to make sure that the authentication plugin
- * is triggered before anything else. If it's not needed to change this
- * number, it is recommended to ommit.
- *
- * @param string $event
- * @param callback $callback
- * @param int $priority
- * @return void
- */
- public function subscribeEvent($event, $callback, $priority = 100) {
-
- if (!isset($this->eventSubscriptions[$event])) {
- $this->eventSubscriptions[$event] = array();
- }
- while(isset($this->eventSubscriptions[$event][$priority])) $priority++;
- $this->eventSubscriptions[$event][$priority] = $callback;
- ksort($this->eventSubscriptions[$event]);
-
- }
-
- /**
- * Broadcasts an event
- *
- * This method will call all subscribers. If one of the subscribers returns false, the process stops.
- *
- * The arguments parameter will be sent to all subscribers
- *
- * @param string $eventName
- * @param array $arguments
- * @return bool
- */
- public function broadcastEvent($eventName,$arguments = array()) {
-
- if (isset($this->eventSubscriptions[$eventName])) {
-
- foreach($this->eventSubscriptions[$eventName] as $subscriber) {
-
- $result = call_user_func_array($subscriber,$arguments);
- if ($result===false) return false;
-
- }
-
- }
-
- return true;
-
- }
-
- /**
- * Handles a http request, and execute a method based on its name
- *
- * @param string $method
- * @param string $uri
- * @return void
- */
- public function invokeMethod($method, $uri) {
-
- $method = strtoupper($method);
-
- if (!$this->broadcastEvent('beforeMethod',array($method, $uri))) return;
-
- // Make sure this is a HTTP method we support
- $internalMethods = array(
- 'OPTIONS',
- 'GET',
- 'HEAD',
- 'DELETE',
- 'PROPFIND',
- 'MKCOL',
- 'PUT',
- 'PROPPATCH',
- 'COPY',
- 'MOVE',
- 'REPORT'
- );
-
- if (in_array($method,$internalMethods)) {
-
- call_user_func(array($this,'http' . $method), $uri);
-
- } else {
-
- if ($this->broadcastEvent('unknownMethod',array($method, $uri))) {
- // Unsupported method
- throw new Sabre_DAV_Exception_NotImplemented('There was no handler found for this "' . $method . '" method');
- }
-
- }
-
- }
-
- // {{{ HTTP Method implementations
-
- /**
- * HTTP OPTIONS
- *
- * @param string $uri
- * @return void
- */
- protected function httpOptions($uri) {
-
- $methods = $this->getAllowedMethods($uri);
-
- $this->httpResponse->setHeader('Allow',strtoupper(implode(', ',$methods)));
- $features = array('1','3', 'extended-mkcol');
-
- foreach($this->plugins as $plugin) $features = array_merge($features,$plugin->getFeatures());
-
- $this->httpResponse->setHeader('DAV',implode(', ',$features));
- $this->httpResponse->setHeader('MS-Author-Via','DAV');
- $this->httpResponse->setHeader('Accept-Ranges','bytes');
- if (self::$exposeVersion) {
- $this->httpResponse->setHeader('X-Sabre-Version',Sabre_DAV_Version::VERSION);
- }
- $this->httpResponse->setHeader('Content-Length',0);
- $this->httpResponse->sendStatus(200);
-
- }
-
- /**
- * HTTP GET
- *
- * This method simply fetches the contents of a uri, like normal
- *
- * @param string $uri
- * @return bool
- */
- protected function httpGet($uri) {
-
- $node = $this->tree->getNodeForPath($uri,0);
-
- if (!$this->checkPreconditions(true)) return false;
-
- if (!$node instanceof Sabre_DAV_IFile) throw new Sabre_DAV_Exception_NotImplemented('GET is only implemented on File objects');
- $body = $node->get();
-
- // Converting string into stream, if needed.
- if (is_string($body)) {
- $stream = fopen('php://temp','r+');
- fwrite($stream,$body);
- rewind($stream);
- $body = $stream;
- }
-
- /*
- * TODO: getetag, getlastmodified, getsize should also be used using
- * this method
- */
- $httpHeaders = $this->getHTTPHeaders($uri);
-
- /* ContentType needs to get a default, because many webservers will otherwise
- * default to text/html, and we don't want this for security reasons.
- */
- if (!isset($httpHeaders['Content-Type'])) {
- $httpHeaders['Content-Type'] = 'application/octet-stream';
- }
-
-
- if (isset($httpHeaders['Content-Length'])) {
-
- $nodeSize = $httpHeaders['Content-Length'];
-
- // Need to unset Content-Length, because we'll handle that during figuring out the range
- unset($httpHeaders['Content-Length']);
-
- } else {
- $nodeSize = null;
- }
-
- $this->httpResponse->setHeaders($httpHeaders);
-
- $range = $this->getHTTPRange();
- $ifRange = $this->httpRequest->getHeader('If-Range');
- $ignoreRangeHeader = false;
-
- // If ifRange is set, and range is specified, we first need to check
- // the precondition.
- if ($nodeSize && $range && $ifRange) {
-
- // if IfRange is parsable as a date we'll treat it as a DateTime
- // otherwise, we must treat it as an etag.
- try {
- $ifRangeDate = new DateTime($ifRange);
-
- // It's a date. We must check if the entity is modified since
- // the specified date.
- if (!isset($httpHeaders['Last-Modified'])) $ignoreRangeHeader = true;
- else {
- $modified = new DateTime($httpHeaders['Last-Modified']);
- if($modified > $ifRangeDate) $ignoreRangeHeader = true;
- }
-
- } catch (Exception $e) {
-
- // It's an entity. We can do a simple comparison.
- if (!isset($httpHeaders['ETag'])) $ignoreRangeHeader = true;
- elseif ($httpHeaders['ETag']!==$ifRange) $ignoreRangeHeader = true;
- }
- }
-
- // We're only going to support HTTP ranges if the backend provided a filesize
- if (!$ignoreRangeHeader && $nodeSize && $range) {
-
- // Determining the exact byte offsets
- if (!is_null($range[0])) {
-
- $start = $range[0];
- $end = $range[1]?$range[1]:$nodeSize-1;
- if($start >= $nodeSize)
- throw new Sabre_DAV_Exception_RequestedRangeNotSatisfiable('The start offset (' . $range[0] . ') exceeded the size of the entity (' . $nodeSize . ')');
-
- if($end < $start) throw new Sabre_DAV_Exception_RequestedRangeNotSatisfiable('The end offset (' . $range[1] . ') is lower than the start offset (' . $range[0] . ')');
- if($end >= $nodeSize) $end = $nodeSize-1;
-
- } else {
-
- $start = $nodeSize-$range[1];
- $end = $nodeSize-1;
-
- if ($start<0) $start = 0;
-
- }
-
- // New read/write stream
- $newStream = fopen('php://temp','r+');
-
- stream_copy_to_stream($body, $newStream, $end-$start+1, $start);
- rewind($newStream);
-
- $this->httpResponse->setHeader('Content-Length', $end-$start+1);
- $this->httpResponse->setHeader('Content-Range','bytes ' . $start . '-' . $end . '/' . $nodeSize);
- $this->httpResponse->sendStatus(206);
- $this->httpResponse->sendBody($newStream);
-
-
- } else {
-
- if ($nodeSize) $this->httpResponse->setHeader('Content-Length',$nodeSize);
- $this->httpResponse->sendStatus(200);
- $this->httpResponse->sendBody($body);
-
- }
-
- }
-
- /**
- * HTTP HEAD
- *
- * This method is normally used to take a peak at a url, and only get the HTTP response headers, without the body
- * This is used by clients to determine if a remote file was changed, so they can use a local cached version, instead of downloading it again
- *
- * @param string $uri
- * @return void
- */
- protected function httpHead($uri) {
-
- $node = $this->tree->getNodeForPath($uri);
- /* This information is only collection for File objects.
- * Ideally we want to throw 405 Method Not Allowed for every
- * non-file, but MS Office does not like this
- */
- if ($node instanceof Sabre_DAV_IFile) {
- $headers = $this->getHTTPHeaders($this->getRequestUri());
- if (!isset($headers['Content-Type'])) {
- $headers['Content-Type'] = 'application/octet-stream';
- }
- $this->httpResponse->setHeaders($headers);
- }
- $this->httpResponse->sendStatus(200);
-
- }
-
- /**
- * HTTP Delete
- *
- * The HTTP delete method, deletes a given uri
- *
- * @param string $uri
- * @return void
- */
- protected function httpDelete($uri) {
-
- if (!$this->broadcastEvent('beforeUnbind',array($uri))) return;
- $this->tree->delete($uri);
- $this->broadcastEvent('afterUnbind',array($uri));
-
- $this->httpResponse->sendStatus(204);
- $this->httpResponse->setHeader('Content-Length','0');
-
- }
-
-
- /**
- * WebDAV PROPFIND
- *
- * This WebDAV method requests information about an uri resource, or a list of resources
- * If a client wants to receive the properties for a single resource it will add an HTTP Depth: header with a 0 value
- * If the value is 1, it means that it also expects a list of sub-resources (e.g.: files in a directory)
- *
- * The request body contains an XML data structure that has a list of properties the client understands
- * The response body is also an xml document, containing information about every uri resource and the requested properties
- *
- * It has to return a HTTP 207 Multi-status status code
- *
- * @param string $uri
- * @return void
- */
- protected function httpPropfind($uri) {
-
- // $xml = new Sabre_DAV_XMLReader(file_get_contents('php://input'));
- $requestedProperties = $this->parsePropfindRequest($this->httpRequest->getBody(true));
-
- $depth = $this->getHTTPDepth(1);
- // The only two options for the depth of a propfind is 0 or 1
- if ($depth!=0) $depth = 1;
-
- $newProperties = $this->getPropertiesForPath($uri,$requestedProperties,$depth);
-
- // This is a multi-status response
- $this->httpResponse->sendStatus(207);
- $this->httpResponse->setHeader('Content-Type','application/xml; charset=utf-8');
- $this->httpResponse->setHeader('Vary','Brief,Prefer');
-
- // Normally this header is only needed for OPTIONS responses, however..
- // iCal seems to also depend on these being set for PROPFIND. Since
- // this is not harmful, we'll add it.
- $features = array('1','3', 'extended-mkcol');
- foreach($this->plugins as $plugin) $features = array_merge($features,$plugin->getFeatures());
- $this->httpResponse->setHeader('DAV',implode(', ',$features));
-
- $prefer = $this->getHTTPPrefer();
- $minimal = $prefer['return-minimal'];
-
- $data = $this->generateMultiStatus($newProperties, $minimal);
- $this->httpResponse->sendBody($data);
-
- }
-
- /**
- * WebDAV PROPPATCH
- *
- * This method is called to update properties on a Node. The request is an XML body with all the mutations.
- * In this XML body it is specified which properties should be set/updated and/or deleted
- *
- * @param string $uri
- * @return void
- */
- protected function httpPropPatch($uri) {
-
- $newProperties = $this->parsePropPatchRequest($this->httpRequest->getBody(true));
-
- $result = $this->updateProperties($uri, $newProperties);
-
- $prefer = $this->getHTTPPrefer();
- $this->httpResponse->setHeader('Vary','Brief,Prefer');
-
- if ($prefer['return-minimal']) {
-
- // If return-minimal is specified, we only have to check if the
- // request was succesful, and don't need to return the
- // multi-status.
- $ok = true;
- foreach($result as $code=>$prop) {
- if ((int)$code > 299) {
- $ok = false;
- }
- }
-
- if ($ok) {
-
- $this->httpResponse->sendStatus(204);
- return;
-
- }
-
- }
-
- $this->httpResponse->sendStatus(207);
- $this->httpResponse->setHeader('Content-Type','application/xml; charset=utf-8');
-
- $this->httpResponse->sendBody(
- $this->generateMultiStatus(array($result))
- );
-
- }
-
- /**
- * HTTP PUT method
- *
- * This HTTP method updates a file, or creates a new one.
- *
- * If a new resource was created, a 201 Created status code should be returned. If an existing resource is updated, it's a 204 No Content
- *
- * @param string $uri
- * @return bool
- */
- protected function httpPut($uri) {
-
- $body = $this->httpRequest->getBody();
-
- // Intercepting Content-Range
- if ($this->httpRequest->getHeader('Content-Range')) {
- /**
- Content-Range is dangerous for PUT requests: PUT per definition
- stores a full resource. draft-ietf-httpbis-p2-semantics-15 says
- in section 7.6:
- An origin server SHOULD reject any PUT request that contains a
- Content-Range header field, since it might be misinterpreted as
- partial content (or might be partial content that is being mistakenly
- PUT as a full representation). Partial content updates are possible
- by targeting a separately identified resource with state that
- overlaps a portion of the larger resource, or by using a different
- method that has been specifically defined for partial updates (for
- example, the PATCH method defined in [RFC5789]).
- This clarifies RFC2616 section 9.6:
- The recipient of the entity MUST NOT ignore any Content-*
- (e.g. Content-Range) headers that it does not understand or implement
- and MUST return a 501 (Not Implemented) response in such cases.
- OTOH is a PUT request with a Content-Range currently the only way to
- continue an aborted upload request and is supported by curl, mod_dav,
- Tomcat and others. Since some clients do use this feature which results
- in unexpected behaviour (cf PEAR::HTTP_WebDAV_Client 1.0.1), we reject
- all PUT requests with a Content-Range for now.
- */
-
- throw new Sabre_DAV_Exception_NotImplemented('PUT with Content-Range is not allowed.');
- }
-
- // Intercepting the Finder problem
- if (($expected = $this->httpRequest->getHeader('X-Expected-Entity-Length')) && $expected > 0) {
-
- /**
- Many webservers will not cooperate well with Finder PUT requests,
- because it uses 'Chunked' transfer encoding for the request body.
-
- The symptom of this problem is that Finder sends files to the
- server, but they arrive as 0-length files in PHP.
-
- If we don't do anything, the user might think they are uploading
- files successfully, but they end up empty on the server. Instead,
- we throw back an error if we detect this.
-
- The reason Finder uses Chunked, is because it thinks the files
- might change as it's being uploaded, and therefore the
- Content-Length can vary.
-
- Instead it sends the X-Expected-Entity-Length header with the size
- of the file at the very start of the request. If this header is set,
- but we don't get a request body we will fail the request to
- protect the end-user.
- */
-
- // Only reading first byte
- $firstByte = fread($body,1);
- if (strlen($firstByte)!==1) {
- throw new Sabre_DAV_Exception_Forbidden('This server is not compatible with OS/X finder. Consider using a different WebDAV client or webserver.');
- }
-
- // The body needs to stay intact, so we copy everything to a
- // temporary stream.
-
- $newBody = fopen('php://temp','r+');
- fwrite($newBody,$firstByte);
- stream_copy_to_stream($body, $newBody);
- rewind($newBody);
-
- $body = $newBody;
-
- }
-
- if ($this->tree->nodeExists($uri)) {
-
- $node = $this->tree->getNodeForPath($uri);
-
- // Checking If-None-Match and related headers.
- if (!$this->checkPreconditions()) return;
-
- // If the node is a collection, we'll deny it
- if (!($node instanceof Sabre_DAV_IFile)) throw new Sabre_DAV_Exception_Conflict('PUT is not allowed on non-files.');
- if (!$this->broadcastEvent('beforeWriteContent',array($uri, $node, &$body))) return false;
-
- $etag = $node->put($body);
-
- $this->broadcastEvent('afterWriteContent',array($uri, $node));
-
- $this->httpResponse->setHeader('Content-Length','0');
- if ($etag) $this->httpResponse->setHeader('ETag',$etag);
- $this->httpResponse->sendStatus(204);
-
- } else {
-
- $etag = null;
- // If we got here, the resource didn't exist yet.
- if (!$this->createFile($this->getRequestUri(),$body,$etag)) {
- // For one reason or another the file was not created.
- return;
- }
-
- $this->httpResponse->setHeader('Content-Length','0');
- if ($etag) $this->httpResponse->setHeader('ETag', $etag);
- $this->httpResponse->sendStatus(201);
-
- }
-
- }
-
-
- /**
- * WebDAV MKCOL
- *
- * The MKCOL method is used to create a new collection (directory) on the server
- *
- * @param string $uri
- * @return void
- */
- protected function httpMkcol($uri) {
-
- $requestBody = $this->httpRequest->getBody(true);
-
- if ($requestBody) {
-
- $contentType = $this->httpRequest->getHeader('Content-Type');
- if (strpos($contentType,'application/xml')!==0 && strpos($contentType,'text/xml')!==0) {
-
- // We must throw 415 for unsupported mkcol bodies
- throw new Sabre_DAV_Exception_UnsupportedMediaType('The request body for the MKCOL request must have an xml Content-Type');
-
- }
-
- $dom = Sabre_DAV_XMLUtil::loadDOMDocument($requestBody);
- if (Sabre_DAV_XMLUtil::toClarkNotation($dom->firstChild)!=='{DAV:}mkcol') {
-
- // We must throw 415 for unsupported mkcol bodies
- throw new Sabre_DAV_Exception_UnsupportedMediaType('The request body for the MKCOL request must be a {DAV:}mkcol request construct.');
-
- }
-
- $properties = array();
- foreach($dom->firstChild->childNodes as $childNode) {
-
- if (Sabre_DAV_XMLUtil::toClarkNotation($childNode)!=='{DAV:}set') continue;
- $properties = array_merge($properties, Sabre_DAV_XMLUtil::parseProperties($childNode, $this->propertyMap));
-
- }
- if (!isset($properties['{DAV:}resourcetype']))
- throw new Sabre_DAV_Exception_BadRequest('The mkcol request must include a {DAV:}resourcetype property');
-
- $resourceType = $properties['{DAV:}resourcetype']->getValue();
- unset($properties['{DAV:}resourcetype']);
-
- } else {
-
- $properties = array();
- $resourceType = array('{DAV:}collection');
-
- }
-
- $result = $this->createCollection($uri, $resourceType, $properties);
-
- if (is_array($result)) {
- $this->httpResponse->sendStatus(207);
- $this->httpResponse->setHeader('Content-Type','application/xml; charset=utf-8');
-
- $this->httpResponse->sendBody(
- $this->generateMultiStatus(array($result))
- );
-
- } else {
- $this->httpResponse->setHeader('Content-Length','0');
- $this->httpResponse->sendStatus(201);
- }
-
- }
-
- /**
- * WebDAV HTTP MOVE method
- *
- * This method moves one uri to a different uri. A lot of the actual request processing is done in getCopyMoveInfo
- *
- * @param string $uri
- * @return bool
- */
- protected function httpMove($uri) {
-
- $moveInfo = $this->getCopyAndMoveInfo();
-
- // If the destination is part of the source tree, we must fail
- if ($moveInfo['destination']==$uri)
- throw new Sabre_DAV_Exception_Forbidden('Source and destination uri are identical.');
-
- if ($moveInfo['destinationExists']) {
-
- if (!$this->broadcastEvent('beforeUnbind',array($moveInfo['destination']))) return false;
- $this->tree->delete($moveInfo['destination']);
- $this->broadcastEvent('afterUnbind',array($moveInfo['destination']));
-
- }
-
- if (!$this->broadcastEvent('beforeUnbind',array($uri))) return false;
- if (!$this->broadcastEvent('beforeBind',array($moveInfo['destination']))) return false;
- $this->tree->move($uri,$moveInfo['destination']);
- $this->broadcastEvent('afterUnbind',array($uri));
- $this->broadcastEvent('afterBind',array($moveInfo['destination']));
-
- // If a resource was overwritten we should send a 204, otherwise a 201
- $this->httpResponse->setHeader('Content-Length','0');
- $this->httpResponse->sendStatus($moveInfo['destinationExists']?204:201);
-
- }
-
- /**
- * WebDAV HTTP COPY method
- *
- * This method copies one uri to a different uri, and works much like the MOVE request
- * A lot of the actual request processing is done in getCopyMoveInfo
- *
- * @param string $uri
- * @return bool
- */
- protected function httpCopy($uri) {
-
- $copyInfo = $this->getCopyAndMoveInfo();
- // If the destination is part of the source tree, we must fail
- if ($copyInfo['destination']==$uri)
- throw new Sabre_DAV_Exception_Forbidden('Source and destination uri are identical.');
-
- if ($copyInfo['destinationExists']) {
- if (!$this->broadcastEvent('beforeUnbind',array($copyInfo['destination']))) return false;
- $this->tree->delete($copyInfo['destination']);
-
- }
- if (!$this->broadcastEvent('beforeBind',array($copyInfo['destination']))) return false;
- $this->tree->copy($uri,$copyInfo['destination']);
- $this->broadcastEvent('afterBind',array($copyInfo['destination']));
-
- // If a resource was overwritten we should send a 204, otherwise a 201
- $this->httpResponse->setHeader('Content-Length','0');
- $this->httpResponse->sendStatus($copyInfo['destinationExists']?204:201);
-
- }
-
-
-
- /**
- * HTTP REPORT method implementation
- *
- * Although the REPORT method is not part of the standard WebDAV spec (it's from rfc3253)
- * It's used in a lot of extensions, so it made sense to implement it into the core.
- *
- * @param string $uri
- * @return void
- */
- protected function httpReport($uri) {
-
- $body = $this->httpRequest->getBody(true);
- $dom = Sabre_DAV_XMLUtil::loadDOMDocument($body);
-
- $reportName = Sabre_DAV_XMLUtil::toClarkNotation($dom->firstChild);
-
- if ($this->broadcastEvent('report',array($reportName,$dom, $uri))) {
-
- // If broadcastEvent returned true, it means the report was not supported
- throw new Sabre_DAV_Exception_ReportNotSupported();
-
- }
-
- }
-
- // }}}
- // {{{ HTTP/WebDAV protocol helpers
-
- /**
- * Returns an array with all the supported HTTP methods for a specific uri.
- *
- * @param string $uri
- * @return array
- */
- public function getAllowedMethods($uri) {
-
- $methods = array(
- 'OPTIONS',
- 'GET',
- 'HEAD',
- 'DELETE',
- 'PROPFIND',
- 'PUT',
- 'PROPPATCH',
- 'COPY',
- 'MOVE',
- 'REPORT'
- );
-
- // The MKCOL is only allowed on an unmapped uri
- try {
- $this->tree->getNodeForPath($uri);
- } catch (Sabre_DAV_Exception_NotFound $e) {
- $methods[] = 'MKCOL';
- }
-
- // We're also checking if any of the plugins register any new methods
- foreach($this->plugins as $plugin) $methods = array_merge($methods, $plugin->getHTTPMethods($uri));
- array_unique($methods);
-
- return $methods;
-
- }
-
- /**
- * Gets the uri for the request, keeping the base uri into consideration
- *
- * @return string
- */
- public function getRequestUri() {
-
- return $this->calculateUri($this->httpRequest->getUri());
-
- }
-
- /**
- * Calculates the uri for a request, making sure that the base uri is stripped out
- *
- * @param string $uri
- * @throws Sabre_DAV_Exception_Forbidden A permission denied exception is thrown whenever there was an attempt to supply a uri outside of the base uri
- * @return string
- */
- public function calculateUri($uri) {
-
- if ($uri[0]!='/' && strpos($uri,'://')) {
-
- $uri = parse_url($uri,PHP_URL_PATH);
-
- }
-
- $uri = str_replace('//','/',$uri);
-
- if (strpos($uri,$this->getBaseUri())===0) {
-
- return trim(Sabre_DAV_URLUtil::decodePath(substr($uri,strlen($this->getBaseUri()))),'/');
-
- // A special case, if the baseUri was accessed without a trailing
- // slash, we'll accept it as well.
- } elseif ($uri.'/' === $this->getBaseUri()) {
-
- return '';
-
- } else {
-
- throw new Sabre_DAV_Exception_Forbidden('Requested uri (' . $uri . ') is out of base uri (' . $this->getBaseUri() . ')');
-
- }
-
- }
-
- /**
- * Returns the HTTP depth header
- *
- * This method returns the contents of the HTTP depth request header. If the depth header was 'infinity' it will return the Sabre_DAV_Server::DEPTH_INFINITY object
- * It is possible to supply a default depth value, which is used when the depth header has invalid content, or is completely non-existent
- *
- * @param mixed $default
- * @return int
- */
- public function getHTTPDepth($default = self::DEPTH_INFINITY) {
-
- // If its not set, we'll grab the default
- $depth = $this->httpRequest->getHeader('Depth');
-
- if (is_null($depth)) return $default;
-
- if ($depth == 'infinity') return self::DEPTH_INFINITY;
-
-
- // If its an unknown value. we'll grab the default
- if (!ctype_digit($depth)) return $default;
-
- return (int)$depth;
-
- }
-
- /**
- * Returns the HTTP range header
- *
- * This method returns null if there is no well-formed HTTP range request
- * header or array($start, $end).
- *
- * The first number is the offset of the first byte in the range.
- * The second number is the offset of the last byte in the range.
- *
- * If the second offset is null, it should be treated as the offset of the last byte of the entity
- * If the first offset is null, the second offset should be used to retrieve the last x bytes of the entity
- *
- * @return array|null
- */
- public function getHTTPRange() {
-
- $range = $this->httpRequest->getHeader('range');
- if (is_null($range)) return null;
-
- // Matching "Range: bytes=1234-5678: both numbers are optional
-
- if (!preg_match('/^bytes=([0-9]*)-([0-9]*)$/i',$range,$matches)) return null;
-
- if ($matches[1]==='' && $matches[2]==='') return null;
-
- return array(
- $matches[1]!==''?$matches[1]:null,
- $matches[2]!==''?$matches[2]:null,
- );
-
- }
-
- /**
- * Returns the HTTP Prefer header information.
- *
- * The prefer header is defined in:
- * http://tools.ietf.org/html/draft-snell-http-prefer-14
- *
- * This method will return an array with options.
- *
- * Currently, the following options may be returned:
- * array(
- * 'return-asynch' => true,
- * 'return-minimal' => true,
- * 'return-representation' => true,
- * 'wait' => 30,
- * 'strict' => true,
- * 'lenient' => true,
- * )
- *
- * This method also supports the Brief header, and will also return
- * 'return-minimal' if the brief header was set to 't'.
- *
- * For the boolean options, false will be returned if the headers are not
- * specified. For the integer options it will be 'null'.
- *
- * @return array
- */
- public function getHTTPPrefer() {
-
- $result = array(
- 'return-asynch' => false,
- 'return-minimal' => false,
- 'return-representation' => false,
- 'wait' => null,
- 'strict' => false,
- 'lenient' => false,
- );
-
- if ($prefer = $this->httpRequest->getHeader('Prefer')) {
-
- $parameters = array_map('trim',
- explode(',', $prefer)
- );
-
- foreach($parameters as $parameter) {
-
- // Right now our regex only supports the tokens actually
- // specified in the draft. We may need to expand this if new
- // tokens get registered.
- if(!preg_match('/^(?P<token>[a-z0-9-]+)(?:=(?P<value>[0-9]+))?$/', $parameter, $matches)) {
- continue;
- }
-
- switch($matches['token']) {
-
- case 'return-asynch' :
- case 'return-minimal' :
- case 'return-representation' :
- case 'strict' :
- case 'lenient' :
- $result[$matches['token']] = true;
- break;
- case 'wait' :
- $result[$matches['token']] = $matches['value'];
- break;
-
- }
-
- }
-
- }
-
- if ($this->httpRequest->getHeader('Brief')=='t') {
- $result['return-minimal'] = true;
- }
-
- return $result;
-
- }
-
-
- /**
- * Returns information about Copy and Move requests
- *
- * This function is created to help getting information about the source and the destination for the
- * WebDAV MOVE and COPY HTTP request. It also validates a lot of information and throws proper exceptions
- *
- * The returned value is an array with the following keys:
- * * destination - Destination path
- * * destinationExists - Whether or not the destination is an existing url (and should therefore be overwritten)
- *
- * @return array
- */
- public function getCopyAndMoveInfo() {
-
- // Collecting the relevant HTTP headers
- if (!$this->httpRequest->getHeader('Destination')) throw new Sabre_DAV_Exception_BadRequest('The destination header was not supplied');
- $destination = $this->calculateUri($this->httpRequest->getHeader('Destination'));
- $overwrite = $this->httpRequest->getHeader('Overwrite');
- if (!$overwrite) $overwrite = 'T';
- if (strtoupper($overwrite)=='T') $overwrite = true;
- elseif (strtoupper($overwrite)=='F') $overwrite = false;
- // We need to throw a bad request exception, if the header was invalid
- else throw new Sabre_DAV_Exception_BadRequest('The HTTP Overwrite header should be either T or F');
-
- list($destinationDir) = Sabre_DAV_URLUtil::splitPath($destination);
-
- try {
- $destinationParent = $this->tree->getNodeForPath($destinationDir);
- if (!($destinationParent instanceof Sabre_DAV_ICollection)) throw new Sabre_DAV_Exception_UnsupportedMediaType('The destination node is not a collection');
- } catch (Sabre_DAV_Exception_NotFound $e) {
-
- // If the destination parent node is not found, we throw a 409
- throw new Sabre_DAV_Exception_Conflict('The destination node is not found');
- }
-
- try {
-
- $destinationNode = $this->tree->getNodeForPath($destination);
-
- // If this succeeded, it means the destination already exists
- // we'll need to throw precondition failed in case overwrite is false
- if (!$overwrite) throw new Sabre_DAV_Exception_PreconditionFailed('The destination node already exists, and the overwrite header is set to false','Overwrite');
-
- } catch (Sabre_DAV_Exception_NotFound $e) {
-
- // Destination didn't exist, we're all good
- $destinationNode = false;
-
-
-
- }
-
- // These are the three relevant properties we need to return
- return array(
- 'destination' => $destination,
- 'destinationExists' => $destinationNode==true,
- 'destinationNode' => $destinationNode,
- );
-
- }
-
- /**
- * Returns a list of properties for a path
- *
- * This is a simplified version getPropertiesForPath.
- * if you aren't interested in status codes, but you just
- * want to have a flat list of properties. Use this method.
- *
- * @param string $path
- * @param array $propertyNames
- */
- public function getProperties($path, $propertyNames) {
-
- $result = $this->getPropertiesForPath($path,$propertyNames,0);
- return $result[0][200];
-
- }
-
- /**
- * A kid-friendly way to fetch properties for a node's children.
- *
- * The returned array will be indexed by the path of the of child node.
- * Only properties that are actually found will be returned.
- *
- * The parent node will not be returned.
- *
- * @param string $path
- * @param array $propertyNames
- * @return array
- */
- public function getPropertiesForChildren($path, $propertyNames) {
-
- $result = array();
- foreach($this->getPropertiesForPath($path,$propertyNames,1) as $k=>$row) {
-
- // Skipping the parent path
- if ($k === 0) continue;
-
- $result[$row['href']] = $row[200];
-
- }
- return $result;
-
- }
-
- /**
- * Returns a list of HTTP headers for a particular resource
- *
- * The generated http headers are based on properties provided by the
- * resource. The method basically provides a simple mapping between
- * DAV property and HTTP header.
- *
- * The headers are intended to be used for HEAD and GET requests.
- *
- * @param string $path
- * @return array
- */
- public function getHTTPHeaders($path) {
-
- $propertyMap = array(
- '{DAV:}getcontenttype' => 'Content-Type',
- '{DAV:}getcontentlength' => 'Content-Length',
- '{DAV:}getlastmodified' => 'Last-Modified',
- '{DAV:}getetag' => 'ETag',
- );
-
- $properties = $this->getProperties($path,array_keys($propertyMap));
-
- $headers = array();
- foreach($propertyMap as $property=>$header) {
- if (!isset($properties[$property])) continue;
-
- if (is_scalar($properties[$property])) {
- $headers[$header] = $properties[$property];
-
- // GetLastModified gets special cased
- } elseif ($properties[$property] instanceof Sabre_DAV_Property_GetLastModified) {
- $headers[$header] = Sabre_HTTP_Util::toHTTPDate($properties[$property]->getTime());
- }
-
- }
-
- return $headers;
-
- }
-
- /**
- * Returns a list of properties for a given path
- *
- * The path that should be supplied should have the baseUrl stripped out
- * The list of properties should be supplied in Clark notation. If the list is empty
- * 'allprops' is assumed.
- *
- * If a depth of 1 is requested child elements will also be returned.
- *
- * @param string $path
- * @param array $propertyNames
- * @param int $depth
- * @return array
- */
- public function getPropertiesForPath($path, $propertyNames = array(), $depth = 0) {
-
- if ($depth!=0) $depth = 1;
-
- $returnPropertyList = array();
-
- $parentNode = $this->tree->getNodeForPath($path);
- $nodes = array(
- $path => $parentNode
- );
- if ($depth==1 && $parentNode instanceof Sabre_DAV_ICollection) {
- foreach($this->tree->getChildren($path) as $childNode)
- $nodes[$path . '/' . $childNode->getName()] = $childNode;
- }
-
- // If the propertyNames array is empty, it means all properties are requested.
- // We shouldn't actually return everything we know though, and only return a
- // sensible list.
- $allProperties = count($propertyNames)==0;
-
- foreach($nodes as $myPath=>$node) {
-
- $currentPropertyNames = $propertyNames;
-
- $newProperties = array(
- '200' => array(),
- '404' => array(),
- );
-
- if ($allProperties) {
- // Default list of propertyNames, when all properties were requested.
- $currentPropertyNames = array(
- '{DAV:}getlastmodified',
- '{DAV:}getcontentlength',
- '{DAV:}resourcetype',
- '{DAV:}quota-used-bytes',
- '{DAV:}quota-available-bytes',
- '{DAV:}getetag',
- '{DAV:}getcontenttype',
- );
- }
-
- // If the resourceType was not part of the list, we manually add it
- // and mark it for removal. We need to know the resourcetype in order
- // to make certain decisions about the entry.
- // WebDAV dictates we should add a / and the end of href's for collections
- $removeRT = false;
- if (!in_array('{DAV:}resourcetype',$currentPropertyNames)) {
- $currentPropertyNames[] = '{DAV:}resourcetype';
- $removeRT = true;
- }
-
- $result = $this->broadcastEvent('beforeGetProperties',array($myPath, $node, &$currentPropertyNames, &$newProperties));
- // If this method explicitly returned false, we must ignore this
- // node as it is inaccessible.
- if ($result===false) continue;
-
- if (count($currentPropertyNames) > 0) {
-
- if ($node instanceof Sabre_DAV_IProperties)
- $newProperties['200'] = $newProperties[200] + $node->getProperties($currentPropertyNames);
-
- }
-
-
- foreach($currentPropertyNames as $prop) {
-
- if (isset($newProperties[200][$prop])) continue;
-
- switch($prop) {
- case '{DAV:}getlastmodified' : if ($node->getLastModified()) $newProperties[200][$prop] = new Sabre_DAV_Property_GetLastModified($node->getLastModified()); break;
- case '{DAV:}getcontentlength' :
- if ($node instanceof Sabre_DAV_IFile) {
- $size = $node->getSize();
- if (!is_null($size)) {
- $newProperties[200][$prop] = (int)$node->getSize();
- }
- }
- break;
- case '{DAV:}quota-used-bytes' :
- if ($node instanceof Sabre_DAV_IQuota) {
- $quotaInfo = $node->getQuotaInfo();
- $newProperties[200][$prop] = $quotaInfo[0];
- }
- break;
- case '{DAV:}quota-available-bytes' :
- if ($node instanceof Sabre_DAV_IQuota) {
- $quotaInfo = $node->getQuotaInfo();
- $newProperties[200][$prop] = $quotaInfo[1];
- }
- break;
- case '{DAV:}getetag' : if ($node instanceof Sabre_DAV_IFile && $etag = $node->getETag()) $newProperties[200][$prop] = $etag; break;
- case '{DAV:}getcontenttype' : if ($node instanceof Sabre_DAV_IFile && $ct = $node->getContentType()) $newProperties[200][$prop] = $ct; break;
- case '{DAV:}supported-report-set' :
- $reports = array();
- foreach($this->plugins as $plugin) {
- $reports = array_merge($reports, $plugin->getSupportedReportSet($myPath));
- }
- $newProperties[200][$prop] = new Sabre_DAV_Property_SupportedReportSet($reports);
- break;
- case '{DAV:}resourcetype' :
- $newProperties[200]['{DAV:}resourcetype'] = new Sabre_DAV_Property_ResourceType();
- foreach($this->resourceTypeMapping as $className => $resourceType) {
- if ($node instanceof $className) $newProperties[200]['{DAV:}resourcetype']->add($resourceType);
- }
- break;
-
- }
-
- // If we were unable to find the property, we will list it as 404.
- if (!$allProperties && !isset($newProperties[200][$prop])) $newProperties[404][$prop] = null;
-
- }
-
- $this->broadcastEvent('afterGetProperties',array(trim($myPath,'/'),&$newProperties, $node));
-
- $newProperties['href'] = trim($myPath,'/');
-
- // Its is a WebDAV recommendation to add a trailing slash to collectionnames.
- // Apple's iCal also requires a trailing slash for principals (rfc 3744), though this is non-standard.
- if ($myPath!='' && isset($newProperties[200]['{DAV:}resourcetype'])) {
- $rt = $newProperties[200]['{DAV:}resourcetype'];
- if ($rt->is('{DAV:}collection') || $rt->is('{DAV:}principal')) {
- $newProperties['href'] .='/';
- }
- }
-
- // If the resourcetype property was manually added to the requested property list,
- // we will remove it again.
- if ($removeRT) unset($newProperties[200]['{DAV:}resourcetype']);
-
- $returnPropertyList[] = $newProperties;
-
- }
-
- return $returnPropertyList;
-
- }
-
- /**
- * This method is invoked by sub-systems creating a new file.
- *
- * Currently this is done by HTTP PUT and HTTP LOCK (in the Locks_Plugin).
- * It was important to get this done through a centralized function,
- * allowing plugins to intercept this using the beforeCreateFile event.
- *
- * This method will return true if the file was actually created
- *
- * @param string $uri
- * @param resource $data
- * @param string $etag
- * @return bool
- */
- public function createFile($uri,$data, &$etag = null) {
-
- list($dir,$name) = Sabre_DAV_URLUtil::splitPath($uri);
-
- if (!$this->broadcastEvent('beforeBind',array($uri))) return false;
-
- $parent = $this->tree->getNodeForPath($dir);
- if (!$parent instanceof Sabre_DAV_ICollection) {
- throw new Sabre_DAV_Exception_Conflict('Files can only be created as children of collections');
- }
-
- if (!$this->broadcastEvent('beforeCreateFile',array($uri, &$data, $parent))) return false;
-
- $etag = $parent->createFile($name,$data);
- $this->tree->markDirty($dir . '/' . $name);
-
- $this->broadcastEvent('afterBind',array($uri));
- $this->broadcastEvent('afterCreateFile',array($uri, $parent));
-
- return true;
- }
-
- /**
- * This method is invoked by sub-systems creating a new directory.
- *
- * @param string $uri
- * @return void
- */
- public function createDirectory($uri) {
-
- $this->createCollection($uri,array('{DAV:}collection'),array());
-
- }
-
- /**
- * Use this method to create a new collection
- *
- * The {DAV:}resourcetype is specified using the resourceType array.
- * At the very least it must contain {DAV:}collection.
- *
- * The properties array can contain a list of additional properties.
- *
- * @param string $uri The new uri
- * @param array $resourceType The resourceType(s)
- * @param array $properties A list of properties
- * @return array|null
- */
- public function createCollection($uri, array $resourceType, array $properties) {
-
- list($parentUri,$newName) = Sabre_DAV_URLUtil::splitPath($uri);
-
- // Making sure {DAV:}collection was specified as resourceType
- if (!in_array('{DAV:}collection', $resourceType)) {
- throw new Sabre_DAV_Exception_InvalidResourceType('The resourceType for this collection must at least include {DAV:}collection');
- }
-
-
- // Making sure the parent exists
- try {
-
- $parent = $this->tree->getNodeForPath($parentUri);
-
- } catch (Sabre_DAV_Exception_NotFound $e) {
-
- throw new Sabre_DAV_Exception_Conflict('Parent node does not exist');
-
- }
-
- // Making sure the parent is a collection
- if (!$parent instanceof Sabre_DAV_ICollection) {
- throw new Sabre_DAV_Exception_Conflict('Parent node is not a collection');
- }
-
-
-
- // Making sure the child does not already exist
- try {
- $parent->getChild($newName);
-
- // If we got here.. it means there's already a node on that url, and we need to throw a 405
- throw new Sabre_DAV_Exception_MethodNotAllowed('The resource you tried to create already exists');
-
- } catch (Sabre_DAV_Exception_NotFound $e) {
- // This is correct
- }
-
-
- if (!$this->broadcastEvent('beforeBind',array($uri))) return;
-
- // There are 2 modes of operation. The standard collection
- // creates the directory, and then updates properties
- // the extended collection can create it directly.
- if ($parent instanceof Sabre_DAV_IExtendedCollection) {
-
- $parent->createExtendedCollection($newName, $resourceType, $properties);
-
- } else {
-
- // No special resourcetypes are supported
- if (count($resourceType)>1) {
- throw new Sabre_DAV_Exception_InvalidResourceType('The {DAV:}resourcetype you specified is not supported here.');
- }
-
- $parent->createDirectory($newName);
- $rollBack = false;
- $exception = null;
- $errorResult = null;
-
- if (count($properties)>0) {
-
- try {
-
- $errorResult = $this->updateProperties($uri, $properties);
- if (!isset($errorResult[200])) {
- $rollBack = true;
- }
-
- } catch (Sabre_DAV_Exception $e) {
-
- $rollBack = true;
- $exception = $e;
-
- }
-
- }
-
- if ($rollBack) {
- if (!$this->broadcastEvent('beforeUnbind',array($uri))) return;
- $this->tree->delete($uri);
-
- // Re-throwing exception
- if ($exception) throw $exception;
-
- return $errorResult;
- }
-
- }
- $this->tree->markDirty($parentUri);
- $this->broadcastEvent('afterBind',array($uri));
-
- }
-
- /**
- * This method updates a resource's properties
- *
- * The properties array must be a list of properties. Array-keys are
- * property names in clarknotation, array-values are it's values.
- * If a property must be deleted, the value should be null.
- *
- * Note that this request should either completely succeed, or
- * completely fail.
- *
- * The response is an array with statuscodes for keys, which in turn
- * contain arrays with propertynames. This response can be used
- * to generate a multistatus body.
- *
- * @param string $uri
- * @param array $properties
- * @return array
- */
- public function updateProperties($uri, array $properties) {
-
- // we'll start by grabbing the node, this will throw the appropriate
- // exceptions if it doesn't.
- $node = $this->tree->getNodeForPath($uri);
-
- $result = array(
- 200 => array(),
- 403 => array(),
- 424 => array(),
- );
- $remainingProperties = $properties;
- $hasError = false;
-
- // Running through all properties to make sure none of them are protected
- if (!$hasError) foreach($properties as $propertyName => $value) {
- if(in_array($propertyName, $this->protectedProperties)) {
- $result[403][$propertyName] = null;
- unset($remainingProperties[$propertyName]);
- $hasError = true;
- }
- }
-
- if (!$hasError) {
- // Allowing plugins to take care of property updating
- $hasError = !$this->broadcastEvent('updateProperties',array(
- &$remainingProperties,
- &$result,
- $node
- ));
- }
-
- // If the node is not an instance of Sabre_DAV_IProperties, every
- // property is 403 Forbidden
- if (!$hasError && count($remainingProperties) && !($node instanceof Sabre_DAV_IProperties)) {
- $hasError = true;
- foreach($properties as $propertyName=> $value) {
- $result[403][$propertyName] = null;
- }
- $remainingProperties = array();
- }
-
- // Only if there were no errors we may attempt to update the resource
- if (!$hasError) {
-
- if (count($remainingProperties)>0) {
-
- $updateResult = $node->updateProperties($remainingProperties);
-
- if ($updateResult===true) {
- // success
- foreach($remainingProperties as $propertyName=>$value) {
- $result[200][$propertyName] = null;
- }
-
- } elseif ($updateResult===false) {
- // The node failed to update the properties for an
- // unknown reason
- foreach($remainingProperties as $propertyName=>$value) {
- $result[403][$propertyName] = null;
- }
-
- } elseif (is_array($updateResult)) {
-
- // The node has detailed update information
- // We need to merge the results with the earlier results.
- foreach($updateResult as $status => $props) {
- if (is_array($props)) {
- if (!isset($result[$status]))
- $result[$status] = array();
-
- $result[$status] = array_merge($result[$status], $updateResult[$status]);
- }
- }
-
- } else {
- throw new Sabre_DAV_Exception('Invalid result from updateProperties');
- }
- $remainingProperties = array();
- }
-
- }
-
- foreach($remainingProperties as $propertyName=>$value) {
- // if there are remaining properties, it must mean
- // there's a dependency failure
- $result[424][$propertyName] = null;
- }
-
- // Removing empty array values
- foreach($result as $status=>$props) {
-
- if (count($props)===0) unset($result[$status]);
-
- }
- $result['href'] = $uri;
- return $result;
-
- }
-
- /**
- * This method checks the main HTTP preconditions.
- *
- * Currently these are:
- * * If-Match
- * * If-None-Match
- * * If-Modified-Since
- * * If-Unmodified-Since
- *
- * The method will return true if all preconditions are met
- * The method will return false, or throw an exception if preconditions
- * failed. If false is returned the operation should be aborted, and
- * the appropriate HTTP response headers are already set.
- *
- * Normally this method will throw 412 Precondition Failed for failures
- * related to If-None-Match, If-Match and If-Unmodified Since. It will
- * set the status to 304 Not Modified for If-Modified_since.
- *
- * If the $handleAsGET argument is set to true, it will also return 304
- * Not Modified for failure of the If-None-Match precondition. This is the
- * desired behaviour for HTTP GET and HTTP HEAD requests.
- *
- * @param bool $handleAsGET
- * @return bool
- */
- public function checkPreconditions($handleAsGET = false) {
-
- $uri = $this->getRequestUri();
- $node = null;
- $lastMod = null;
- $etag = null;
-
- if ($ifMatch = $this->httpRequest->getHeader('If-Match')) {
-
- // If-Match contains an entity tag. Only if the entity-tag
- // matches we are allowed to make the request succeed.
- // If the entity-tag is '*' we are only allowed to make the
- // request succeed if a resource exists at that url.
- try {
- $node = $this->tree->getNodeForPath($uri);
- } catch (Sabre_DAV_Exception_NotFound $e) {
- throw new Sabre_DAV_Exception_PreconditionFailed('An If-Match header was specified and the resource did not exist','If-Match');
- }
-
- // Only need to check entity tags if they are not *
- if ($ifMatch!=='*') {
-
- // There can be multiple etags
- $ifMatch = explode(',',$ifMatch);
- $haveMatch = false;
- foreach($ifMatch as $ifMatchItem) {
-
- // Stripping any extra spaces
- $ifMatchItem = trim($ifMatchItem,' ');
-
- $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');
- }
- }
- }
-
- if ($ifNoneMatch = $this->httpRequest->getHeader('If-None-Match')) {
-
- // The If-None-Match header contains an etag.
- // Only if the ETag does not match the current ETag, the request will succeed
- // The header can also contain *, in which case the request
- // will only succeed if the entity does not exist at all.
- $nodeExists = true;
- if (!$node) {
- try {
- $node = $this->tree->getNodeForPath($uri);
- } catch (Sabre_DAV_Exception_NotFound $e) {
- $nodeExists = false;
- }
- }
- if ($nodeExists) {
- $haveMatch = false;
- if ($ifNoneMatch==='*') $haveMatch = true;
- else {
-
- // There might be multiple etags
- $ifNoneMatch = explode(',', $ifNoneMatch);
- $etag = $node->getETag();
-
- foreach($ifNoneMatch as $ifNoneMatchItem) {
-
- // Stripping any extra spaces
- $ifNoneMatchItem = trim($ifNoneMatchItem,' ');
-
- if ($etag===$ifNoneMatchItem) $haveMatch = true;
-
- }
-
- }
-
- if ($haveMatch) {
- if ($handleAsGET) {
- $this->httpResponse->sendStatus(304);
- return false;
- } else {
- throw new Sabre_DAV_Exception_PreconditionFailed('An If-None-Match header was specified, but the ETag matched (or * was specified).','If-None-Match');
- }
- }
- }
-
- }
-
- if (!$ifNoneMatch && ($ifModifiedSince = $this->httpRequest->getHeader('If-Modified-Since'))) {
-
- // The If-Modified-Since header contains a date. We
- // will only return the entity if it has been changed since
- // that date. If it hasn't been changed, we return a 304
- // header
- // Note that this header only has to be checked if there was no If-None-Match header
- // as per the HTTP spec.
- $date = Sabre_HTTP_Util::parseHTTPDate($ifModifiedSince);
-
- if ($date) {
- if (is_null($node)) {
- $node = $this->tree->getNodeForPath($uri);
- }
- $lastMod = $node->getLastModified();
- if ($lastMod) {
- $lastMod = new DateTime('@' . $lastMod);
- if ($lastMod <= $date) {
- $this->httpResponse->sendStatus(304);
- $this->httpResponse->setHeader('Last-Modified', Sabre_HTTP_Util::toHTTPDate($lastMod));
- return false;
- }
- }
- }
- }
-
- if ($ifUnmodifiedSince = $this->httpRequest->getHeader('If-Unmodified-Since')) {
-
- // The If-Unmodified-Since will allow allow the request if the
- // entity has not changed since the specified date.
- $date = Sabre_HTTP_Util::parseHTTPDate($ifUnmodifiedSince);
-
- // We must only check the date if it's valid
- if ($date) {
- if (is_null($node)) {
- $node = $this->tree->getNodeForPath($uri);
- }
- $lastMod = $node->getLastModified();
- if ($lastMod) {
- $lastMod = new DateTime('@' . $lastMod);
- if ($lastMod > $date) {
- throw new Sabre_DAV_Exception_PreconditionFailed('An If-Unmodified-Since header was specified, but the entity has been changed since the specified date.','If-Unmodified-Since');
- }
- }
- }
-
- }
- return true;
-
- }
-
- // }}}
- // {{{ XML Readers & Writers
-
-
- /**
- * Generates a WebDAV propfind response body based on a list of nodes.
- *
- * If 'strip404s' is set to true, all 404 responses will be removed.
- *
- * @param array $fileProperties The list with nodes
- * @param bool strip404s
- * @return string
- */
- public function generateMultiStatus(array $fileProperties, $strip404s = false) {
-
- $dom = new DOMDocument('1.0','utf-8');
- //$dom->formatOutput = true;
- $multiStatus = $dom->createElement('d:multistatus');
- $dom->appendChild($multiStatus);
-
- // Adding in default namespaces
- foreach($this->xmlNamespaces as $namespace=>$prefix) {
-
- $multiStatus->setAttribute('xmlns:' . $prefix,$namespace);
-
- }
-
- foreach($fileProperties as $entry) {
-
- $href = $entry['href'];
- unset($entry['href']);
-
- if ($strip404s && isset($entry[404])) {
- unset($entry[404]);
- }
-
- $response = new Sabre_DAV_Property_Response($href,$entry);
- $response->serialize($this,$multiStatus);
-
- }
-
- return $dom->saveXML();
-
- }
-
- /**
- * This method parses a PropPatch request
- *
- * PropPatch changes the properties for a resource. This method
- * returns a list of properties.
- *
- * The keys in the returned array contain the property name (e.g.: {DAV:}displayname,
- * and the value contains the property value. If a property is to be removed the value
- * will be null.
- *
- * @param string $body xml body
- * @return array list of properties in need of updating or deletion
- */
- public function parsePropPatchRequest($body) {
-
- //We'll need to change the DAV namespace declaration to something else in order to make it parsable
- $dom = Sabre_DAV_XMLUtil::loadDOMDocument($body);
-
- $newProperties = array();
-
- foreach($dom->firstChild->childNodes as $child) {
-
- if ($child->nodeType !== XML_ELEMENT_NODE) continue;
-
- $operation = Sabre_DAV_XMLUtil::toClarkNotation($child);
-
- if ($operation!=='{DAV:}set' && $operation!=='{DAV:}remove') continue;
-
- $innerProperties = Sabre_DAV_XMLUtil::parseProperties($child, $this->propertyMap);
-
- foreach($innerProperties as $propertyName=>$propertyValue) {
-
- if ($operation==='{DAV:}remove') {
- $propertyValue = null;
- }
-
- $newProperties[$propertyName] = $propertyValue;
-
- }
-
- }
-
- return $newProperties;
-
- }
-
- /**
- * This method parses the PROPFIND request and returns its information
- *
- * This will either be a list of properties, or an empty array; in which case
- * an {DAV:}allprop was requested.
- *
- * @param string $body
- * @return array
- */
- public function parsePropFindRequest($body) {
-
- // If the propfind body was empty, it means IE is requesting 'all' properties
- if (!$body) return array();
-
- $dom = Sabre_DAV_XMLUtil::loadDOMDocument($body);
- $elem = $dom->getElementsByTagNameNS('DAV:','propfind')->item(0);
- return array_keys(Sabre_DAV_XMLUtil::parseProperties($elem));
-
- }
-
- // }}}
-
-}
-
diff --git a/3rdparty/Sabre/DAV/ServerPlugin.php b/3rdparty/Sabre/DAV/ServerPlugin.php
deleted file mode 100644
index 120569ffccd..00000000000
--- a/3rdparty/Sabre/DAV/ServerPlugin.php
+++ /dev/null
@@ -1,90 +0,0 @@
-<?php
-
-/**
- * The baseclass for all server plugins.
- *
- * Plugins can modify or extend the servers behaviour.
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-abstract class Sabre_DAV_ServerPlugin {
-
- /**
- * This initializes the plugin.
- *
- * This function is called by Sabre_DAV_Server, after
- * addPlugin is called.
- *
- * This method should set up the required event subscriptions.
- *
- * @param Sabre_DAV_Server $server
- * @return void
- */
- abstract public function initialize(Sabre_DAV_Server $server);
-
- /**
- * This method should return a list of server-features.
- *
- * This is for example 'versioning' and is added to the DAV: header
- * in an OPTIONS response.
- *
- * @return array
- */
- public function getFeatures() {
-
- return array();
-
- }
-
- /**
- * Use this method to tell the server this plugin defines additional
- * HTTP methods.
- *
- * This method is passed a uri. It should only return HTTP methods that are
- * available for the specified uri.
- *
- * @param string $uri
- * @return array
- */
- public function getHTTPMethods($uri) {
-
- return array();
-
- }
-
- /**
- * Returns a plugin name.
- *
- * Using this name other plugins will be able to access other plugins
- * using Sabre_DAV_Server::getPlugin
- *
- * @return string
- */
- public function getPluginName() {
-
- return get_class($this);
-
- }
-
- /**
- * Returns a list of reports this plugin supports.
- *
- * This will be used in the {DAV:}supported-report-set property.
- * Note that you still need to subscribe to the 'report' event to actually
- * implement them
- *
- * @param string $uri
- * @return array
- */
- public function getSupportedReportSet($uri) {
-
- return array();
-
- }
-
-}
-
diff --git a/3rdparty/Sabre/DAV/SimpleCollection.php b/3rdparty/Sabre/DAV/SimpleCollection.php
deleted file mode 100644
index 79e2eaaacd4..00000000000
--- a/3rdparty/Sabre/DAV/SimpleCollection.php
+++ /dev/null
@@ -1,108 +0,0 @@
-<?php
-
-/**
- * SimpleCollection
- *
- * The SimpleCollection is used to quickly setup static directory structures.
- * Just create the object with a proper name, and add children to use it.
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_SimpleCollection extends Sabre_DAV_Collection {
-
- /**
- * List of childnodes
- *
- * @var array
- */
- protected $children = array();
-
- /**
- * Name of this resource
- *
- * @var string
- */
- protected $name;
-
- /**
- * Creates this node
- *
- * The name of the node must be passed, child nodes can also be passed.
- * This nodes must be instances of Sabre_DAV_INode
- *
- * @param string $name
- * @param array $children
- */
- public function __construct($name,array $children = array()) {
-
- $this->name = $name;
- foreach($children as $child) {
-
- if (!($child instanceof Sabre_DAV_INode)) throw new Sabre_DAV_Exception('Only instances of Sabre_DAV_INode are allowed to be passed in the children argument');
- $this->addChild($child);
-
- }
-
- }
-
- /**
- * Adds a new childnode to this collection
- *
- * @param Sabre_DAV_INode $child
- * @return void
- */
- public function addChild(Sabre_DAV_INode $child) {
-
- $this->children[$child->getName()] = $child;
-
- }
-
- /**
- * Returns the name of the collection
- *
- * @return string
- */
- public function getName() {
-
- return $this->name;
-
- }
-
- /**
- * Returns a child object, by its name.
- *
- * This method makes use of the getChildren method to grab all the child nodes, and compares the name.
- * Generally its wise to override this, as this can usually be optimized
- *
- * This method must throw Sabre_DAV_Exception_NotFound if the node does not
- * exist.
- *
- * @param string $name
- * @throws Sabre_DAV_Exception_NotFound
- * @return Sabre_DAV_INode
- */
- public function getChild($name) {
-
- if (isset($this->children[$name])) return $this->children[$name];
- throw new Sabre_DAV_Exception_NotFound('File not found: ' . $name . ' in \'' . $this->getName() . '\'');
-
- }
-
- /**
- * Returns a list of children for this collection
- *
- * @return array
- */
- public function getChildren() {
-
- return array_values($this->children);
-
- }
-
-
-}
-
diff --git a/3rdparty/Sabre/DAV/SimpleFile.php b/3rdparty/Sabre/DAV/SimpleFile.php
deleted file mode 100644
index 58330d6861d..00000000000
--- a/3rdparty/Sabre/DAV/SimpleFile.php
+++ /dev/null
@@ -1,121 +0,0 @@
-<?php
-
-/**
- * SimpleFile
- *
- * The 'SimpleFile' class is used to easily add read-only immutable files to
- * the directory structure. One usecase would be to add a 'readme.txt' to a
- * root of a webserver with some standard content.
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_SimpleFile extends Sabre_DAV_File {
-
- /**
- * File contents
- *
- * @var string
- */
- protected $contents = array();
-
- /**
- * Name of this resource
- *
- * @var string
- */
- protected $name;
-
- /**
- * A mimetype, such as 'text/plain' or 'text/html'
- *
- * @var string
- */
- protected $mimeType;
-
- /**
- * Creates this node
- *
- * The name of the node must be passed, as well as the contents of the
- * file.
- *
- * @param string $name
- * @param string $contents
- * @param string|null $mimeType
- */
- public function __construct($name, $contents, $mimeType = null) {
-
- $this->name = $name;
- $this->contents = $contents;
- $this->mimeType = $mimeType;
-
- }
-
- /**
- * Returns the node name for this file.
- *
- * This name is used to construct the url.
- *
- * @return string
- */
- public function getName() {
-
- return $this->name;
-
- }
-
- /**
- * Returns the data
- *
- * This method may either return a string or a readable stream resource
- *
- * @return mixed
- */
- public function get() {
-
- return $this->contents;
-
- }
-
- /**
- * Returns the size of the file, in bytes.
- *
- * @return int
- */
- public function getSize() {
-
- return strlen($this->contents);
-
- }
-
- /**
- * Returns the ETag for a file
- *
- * An ETag is a unique identifier representing the current version of the file. If the file changes, the ETag MUST change.
- * The ETag is an arbitrary string, but MUST be surrounded by double-quotes.
- *
- * Return null if the ETag can not effectively be determined
- * @return string
- */
- public function getETag() {
-
- return '"' . md5($this->contents) . '"';
-
- }
-
- /**
- * Returns the mime-type for a file
- *
- * If null is returned, we'll assume application/octet-stream
- * @return string
- */
- public function getContentType() {
-
- return $this->mimeType;
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAV/StringUtil.php b/3rdparty/Sabre/DAV/StringUtil.php
deleted file mode 100644
index b126a94c825..00000000000
--- a/3rdparty/Sabre/DAV/StringUtil.php
+++ /dev/null
@@ -1,91 +0,0 @@
-<?php
-
-/**
- * String utility
- *
- * This class is mainly used to implement the 'text-match' filter, used by both
- * the CalDAV calendar-query REPORT, and CardDAV addressbook-query REPORT.
- * Because they both need it, it was decided to put it in Sabre_DAV instead.
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_StringUtil {
-
- /**
- * Checks if a needle occurs in a haystack ;)
- *
- * @param string $haystack
- * @param string $needle
- * @param string $collation
- * @param string $matchType
- * @return bool
- */
- static public function textMatch($haystack, $needle, $collation, $matchType = 'contains') {
-
- switch($collation) {
-
- case 'i;ascii-casemap' :
- // default strtolower takes locale into consideration
- // we don't want this.
- $haystack = str_replace(range('a','z'), range('A','Z'), $haystack);
- $needle = str_replace(range('a','z'), range('A','Z'), $needle);
- break;
-
- case 'i;octet' :
- // Do nothing
- break;
-
- case 'i;unicode-casemap' :
- $haystack = mb_strtoupper($haystack, 'UTF-8');
- $needle = mb_strtoupper($needle, 'UTF-8');
- break;
-
- default :
- throw new Sabre_DAV_Exception_BadRequest('Collation type: ' . $collation . ' is not supported');
-
- }
-
- switch($matchType) {
-
- case 'contains' :
- return strpos($haystack, $needle)!==false;
- case 'equals' :
- return $haystack === $needle;
- case 'starts-with' :
- return strpos($haystack, $needle)===0;
- case 'ends-with' :
- return strrpos($haystack, $needle)===strlen($haystack)-strlen($needle);
- default :
- throw new Sabre_DAV_Exception_BadRequest('Match-type: ' . $matchType . ' is not supported');
-
- }
-
- }
-
- /**
- * This method takes an input string, checks if it's not valid UTF-8 and
- * attempts to convert it to UTF-8 if it's not.
- *
- * Note that currently this can only convert ISO-8559-1 to UTF-8 (latin-1),
- * anything else will likely fail.
- *
- * @param string $input
- * @return string
- */
- static public function ensureUTF8($input) {
-
- $encoding = mb_detect_encoding($input , array('UTF-8','ISO-8859-1'), true);
-
- if ($encoding === 'ISO-8859-1') {
- return utf8_encode($input);
- } else {
- return $input;
- }
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAV/TemporaryFileFilterPlugin.php b/3rdparty/Sabre/DAV/TemporaryFileFilterPlugin.php
deleted file mode 100644
index 36096e67775..00000000000
--- a/3rdparty/Sabre/DAV/TemporaryFileFilterPlugin.php
+++ /dev/null
@@ -1,289 +0,0 @@
-<?php
-
-/**
- * Temporary File Filter Plugin
- *
- * The purpose of this filter is to intercept some of the garbage files
- * operation systems and applications tend to generate when mounting
- * a WebDAV share as a disk.
- *
- * It will intercept these files and place them in a separate directory.
- * these files are not deleted automatically, so it is adviceable to
- * delete these after they are not accessed for 24 hours.
- *
- * Currently it supports:
- * * OS/X style resource forks and .DS_Store
- * * desktop.ini and Thumbs.db (windows)
- * * .*.swp (vim temporary files)
- * * .dat.* (smultron temporary files)
- *
- * Additional patterns can be added, by adding on to the
- * temporaryFilePatterns property.
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_TemporaryFileFilterPlugin extends Sabre_DAV_ServerPlugin {
-
- /**
- * This is the list of patterns we intercept.
- * If new patterns are added, they must be valid patterns for preg_match.
- *
- * @var array
- */
- public $temporaryFilePatterns = array(
- '/^\._(.*)$/', // OS/X resource forks
- '/^.DS_Store$/', // OS/X custom folder settings
- '/^desktop.ini$/', // Windows custom folder settings
- '/^Thumbs.db$/', // Windows thumbnail cache
- '/^.(.*).swp$/', // ViM temporary files
- '/^\.dat(.*)$/', // Smultron seems to create these
- '/^~lock.(.*)#$/', // Windows 7 lockfiles
- );
-
- /**
- * This is the directory where this plugin
- * will store it's files.
- *
- * @var string
- */
- private $dataDir;
-
- /**
- * A reference to the main Server class
- *
- * @var Sabre_DAV_Server
- */
- private $server;
-
- /**
- * Creates the plugin.
- *
- * Make sure you specify a directory for your files. If you don't, we
- * will use PHP's directory for session-storage instead, and you might
- * not want that.
- *
- * @param string|null $dataDir
- */
- public function __construct($dataDir = null) {
-
- if (!$dataDir) $dataDir = ini_get('session.save_path').'/sabredav/';
- if (!is_dir($dataDir)) mkdir($dataDir);
- $this->dataDir = $dataDir;
-
- }
-
- /**
- * Initialize the plugin
- *
- * This is called automatically be the Server class after this plugin is
- * added with Sabre_DAV_Server::addPlugin()
- *
- * @param Sabre_DAV_Server $server
- * @return void
- */
- public function initialize(Sabre_DAV_Server $server) {
-
- $this->server = $server;
- $server->subscribeEvent('beforeMethod',array($this,'beforeMethod'));
- $server->subscribeEvent('beforeCreateFile',array($this,'beforeCreateFile'));
-
- }
-
- /**
- * This method is called before any HTTP method handler
- *
- * This method intercepts any GET, DELETE, PUT and PROPFIND calls to
- * filenames that are known to match the 'temporary file' regex.
- *
- * @param string $method
- * @param string $uri
- * @return bool
- */
- public function beforeMethod($method, $uri) {
-
- if (!$tempLocation = $this->isTempFile($uri))
- return true;
-
- switch($method) {
- case 'GET' :
- return $this->httpGet($tempLocation);
- case 'PUT' :
- return $this->httpPut($tempLocation);
- case 'PROPFIND' :
- return $this->httpPropfind($tempLocation, $uri);
- case 'DELETE' :
- return $this->httpDelete($tempLocation);
- }
- return true;
-
- }
-
- /**
- * This method is invoked if some subsystem creates a new file.
- *
- * This is used to deal with HTTP LOCK requests which create a new
- * file.
- *
- * @param string $uri
- * @param resource $data
- * @return bool
- */
- public function beforeCreateFile($uri,$data) {
-
- if ($tempPath = $this->isTempFile($uri)) {
-
- $hR = $this->server->httpResponse;
- $hR->setHeader('X-Sabre-Temp','true');
- file_put_contents($tempPath,$data);
- return false;
- }
- return true;
-
- }
-
- /**
- * This method will check if the url matches the temporary file pattern
- * if it does, it will return an path based on $this->dataDir for the
- * temporary file storage.
- *
- * @param string $path
- * @return boolean|string
- */
- protected function isTempFile($path) {
-
- // We're only interested in the basename.
- list(, $tempPath) = Sabre_DAV_URLUtil::splitPath($path);
-
- foreach($this->temporaryFilePatterns as $tempFile) {
-
- if (preg_match($tempFile,$tempPath)) {
- return $this->getDataDir() . '/sabredav_' . md5($path) . '.tempfile';
- }
-
- }
-
- return false;
-
- }
-
-
- /**
- * This method handles the GET method for temporary files.
- * If the file doesn't exist, it will return false which will kick in
- * the regular system for the GET method.
- *
- * @param string $tempLocation
- * @return bool
- */
- public function httpGet($tempLocation) {
-
- if (!file_exists($tempLocation)) return true;
-
- $hR = $this->server->httpResponse;
- $hR->setHeader('Content-Type','application/octet-stream');
- $hR->setHeader('Content-Length',filesize($tempLocation));
- $hR->setHeader('X-Sabre-Temp','true');
- $hR->sendStatus(200);
- $hR->sendBody(fopen($tempLocation,'r'));
- return false;
-
- }
-
- /**
- * This method handles the PUT method.
- *
- * @param string $tempLocation
- * @return bool
- */
- public function httpPut($tempLocation) {
-
- $hR = $this->server->httpResponse;
- $hR->setHeader('X-Sabre-Temp','true');
-
- $newFile = !file_exists($tempLocation);
-
- if (!$newFile && ($this->server->httpRequest->getHeader('If-None-Match'))) {
- throw new Sabre_DAV_Exception_PreconditionFailed('The resource already exists, and an If-None-Match header was supplied');
- }
-
- file_put_contents($tempLocation,$this->server->httpRequest->getBody());
- $hR->sendStatus($newFile?201:200);
- return false;
-
- }
-
- /**
- * This method handles the DELETE method.
- *
- * If the file didn't exist, it will return false, which will make the
- * standard HTTP DELETE handler kick in.
- *
- * @param string $tempLocation
- * @return bool
- */
- public function httpDelete($tempLocation) {
-
- if (!file_exists($tempLocation)) return true;
-
- unlink($tempLocation);
- $hR = $this->server->httpResponse;
- $hR->setHeader('X-Sabre-Temp','true');
- $hR->sendStatus(204);
- return false;
-
- }
-
- /**
- * This method handles the PROPFIND method.
- *
- * It's a very lazy method, it won't bother checking the request body
- * for which properties were requested, and just sends back a default
- * set of properties.
- *
- * @param string $tempLocation
- * @param string $uri
- * @return bool
- */
- public function httpPropfind($tempLocation, $uri) {
-
- if (!file_exists($tempLocation)) return true;
-
- $hR = $this->server->httpResponse;
- $hR->setHeader('X-Sabre-Temp','true');
- $hR->sendStatus(207);
- $hR->setHeader('Content-Type','application/xml; charset=utf-8');
-
- $this->server->parsePropFindRequest($this->server->httpRequest->getBody(true));
-
- $properties = array(
- 'href' => $uri,
- 200 => array(
- '{DAV:}getlastmodified' => new Sabre_DAV_Property_GetLastModified(filemtime($tempLocation)),
- '{DAV:}getcontentlength' => filesize($tempLocation),
- '{DAV:}resourcetype' => new Sabre_DAV_Property_ResourceType(null),
- '{'.Sabre_DAV_Server::NS_SABREDAV.'}tempFile' => true,
-
- ),
- );
-
- $data = $this->server->generateMultiStatus(array($properties));
- $hR->sendBody($data);
- return false;
-
- }
-
-
- /**
- * This method returns the directory where the temporary files should be stored.
- *
- * @return string
- */
- protected function getDataDir()
- {
- return $this->dataDir;
- }
-}
diff --git a/3rdparty/Sabre/DAV/Tree.php b/3rdparty/Sabre/DAV/Tree.php
deleted file mode 100644
index 50216394155..00000000000
--- a/3rdparty/Sabre/DAV/Tree.php
+++ /dev/null
@@ -1,193 +0,0 @@
-<?php
-
-/**
- * Abstract tree object
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-abstract class Sabre_DAV_Tree {
-
- /**
- * This function must return an INode object for a path
- * If a Path doesn't exist, thrown a Exception_NotFound
- *
- * @param string $path
- * @throws Sabre_DAV_Exception_NotFound
- * @return Sabre_DAV_INode
- */
- abstract function getNodeForPath($path);
-
- /**
- * This function allows you to check if a node exists.
- *
- * Implementors of this class should override this method to make
- * it cheaper.
- *
- * @param string $path
- * @return bool
- */
- public function nodeExists($path) {
-
- try {
-
- $this->getNodeForPath($path);
- return true;
-
- } catch (Sabre_DAV_Exception_NotFound $e) {
-
- return false;
-
- }
-
- }
-
- /**
- * Copies a file from path to another
- *
- * @param string $sourcePath The source location
- * @param string $destinationPath The full destination path
- * @return void
- */
- public function copy($sourcePath, $destinationPath) {
-
- $sourceNode = $this->getNodeForPath($sourcePath);
-
- // grab the dirname and basename components
- list($destinationDir, $destinationName) = Sabre_DAV_URLUtil::splitPath($destinationPath);
-
- $destinationParent = $this->getNodeForPath($destinationDir);
- $this->copyNode($sourceNode,$destinationParent,$destinationName);
-
- $this->markDirty($destinationDir);
-
- }
-
- /**
- * Moves a file from one location to another
- *
- * @param string $sourcePath The path to the file which should be moved
- * @param string $destinationPath The full destination path, so not just the destination parent node
- * @return int
- */
- public function move($sourcePath, $destinationPath) {
-
- list($sourceDir, $sourceName) = Sabre_DAV_URLUtil::splitPath($sourcePath);
- list($destinationDir, $destinationName) = Sabre_DAV_URLUtil::splitPath($destinationPath);
-
- if ($sourceDir===$destinationDir) {
- $renameable = $this->getNodeForPath($sourcePath);
- $renameable->setName($destinationName);
- } else {
- $this->copy($sourcePath,$destinationPath);
- $this->getNodeForPath($sourcePath)->delete();
- }
- $this->markDirty($sourceDir);
- $this->markDirty($destinationDir);
-
- }
-
- /**
- * Deletes a node from the tree
- *
- * @param string $path
- * @return void
- */
- public function delete($path) {
-
- $node = $this->getNodeForPath($path);
- $node->delete();
-
- list($parent) = Sabre_DAV_URLUtil::splitPath($path);
- $this->markDirty($parent);
-
- }
-
- /**
- * Returns a list of childnodes for a given path.
- *
- * @param string $path
- * @return array
- */
- public function getChildren($path) {
-
- $node = $this->getNodeForPath($path);
- return $node->getChildren();
-
- }
-
- /**
- * This method is called with every tree update
- *
- * Examples of tree updates are:
- * * node deletions
- * * node creations
- * * copy
- * * move
- * * renaming nodes
- *
- * If Tree classes implement a form of caching, this will allow
- * them to make sure caches will be expired.
- *
- * If a path is passed, it is assumed that the entire subtree is dirty
- *
- * @param string $path
- * @return void
- */
- public function markDirty($path) {
-
-
- }
-
- /**
- * copyNode
- *
- * @param Sabre_DAV_INode $source
- * @param Sabre_DAV_ICollection $destinationParent
- * @param string $destinationName
- * @return void
- */
- protected function copyNode(Sabre_DAV_INode $source,Sabre_DAV_ICollection $destinationParent,$destinationName = null) {
-
- if (!$destinationName) $destinationName = $source->getName();
-
- if ($source instanceof Sabre_DAV_IFile) {
-
- $data = $source->get();
-
- // If the body was a string, we need to convert it to a stream
- if (is_string($data)) {
- $stream = fopen('php://temp','r+');
- fwrite($stream,$data);
- rewind($stream);
- $data = $stream;
- }
- $destinationParent->createFile($destinationName,$data);
- $destination = $destinationParent->getChild($destinationName);
-
- } elseif ($source instanceof Sabre_DAV_ICollection) {
-
- $destinationParent->createDirectory($destinationName);
-
- $destination = $destinationParent->getChild($destinationName);
- foreach($source->getChildren() as $child) {
-
- $this->copyNode($child,$destination);
-
- }
-
- }
- if ($source instanceof Sabre_DAV_IProperties && $destination instanceof Sabre_DAV_IProperties) {
-
- $props = $source->getProperties(array());
- $destination->updateProperties($props);
-
- }
-
- }
-
-}
-
diff --git a/3rdparty/Sabre/DAV/Tree/Filesystem.php b/3rdparty/Sabre/DAV/Tree/Filesystem.php
deleted file mode 100644
index 40580ae366f..00000000000
--- a/3rdparty/Sabre/DAV/Tree/Filesystem.php
+++ /dev/null
@@ -1,123 +0,0 @@
-<?php
-
-/**
- * Sabre_DAV_Tree_Filesystem
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Tree_Filesystem extends Sabre_DAV_Tree {
-
- /**
- * Base url on the filesystem.
- *
- * @var string
- */
- protected $basePath;
-
- /**
- * Creates this tree
- *
- * Supply the path you'd like to share.
- *
- * @param string $basePath
- */
- public function __construct($basePath) {
-
- $this->basePath = $basePath;
-
- }
-
- /**
- * Returns a new node for the given path
- *
- * @param string $path
- * @return Sabre_DAV_FS_Node
- */
- public function getNodeForPath($path) {
-
- $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($realPath);
- } else {
- return new Sabre_DAV_FS_File($realPath);
- }
-
- }
-
- /**
- * Returns the real filesystem path for a webdav url.
- *
- * @param string $publicPath
- * @return string
- */
- protected function getRealPath($publicPath) {
-
- return rtrim($this->basePath,'/') . '/' . trim($publicPath,'/');
-
- }
-
- /**
- * Copies a file or directory.
- *
- * This method must work recursively and delete the destination
- * if it exists
- *
- * @param string $source
- * @param string $destination
- * @return void
- */
- public function copy($source,$destination) {
-
- $source = $this->getRealPath($source);
- $destination = $this->getRealPath($destination);
- $this->realCopy($source,$destination);
-
- }
-
- /**
- * Used by self::copy
- *
- * @param string $source
- * @param string $destination
- * @return void
- */
- protected function realCopy($source,$destination) {
-
- if (is_file($source)) {
- copy($source,$destination);
- } else {
- mkdir($destination);
- foreach(scandir($source) as $subnode) {
-
- if ($subnode=='.' || $subnode=='..') continue;
- $this->realCopy($source.'/'.$subnode,$destination.'/'.$subnode);
-
- }
- }
-
- }
-
- /**
- * Moves a file or directory recursively.
- *
- * If the destination exists, delete it first.
- *
- * @param string $source
- * @param string $destination
- * @return void
- */
- public function move($source,$destination) {
-
- $source = $this->getRealPath($source);
- $destination = $this->getRealPath($destination);
- rename($source,$destination);
-
- }
-
-}
-
diff --git a/3rdparty/Sabre/DAV/URLUtil.php b/3rdparty/Sabre/DAV/URLUtil.php
deleted file mode 100644
index 794665a44f6..00000000000
--- a/3rdparty/Sabre/DAV/URLUtil.php
+++ /dev/null
@@ -1,121 +0,0 @@
-<?php
-
-/**
- * URL utility class
- *
- * This class provides methods to deal with encoding and decoding url (percent encoded) strings.
- *
- * It was not possible to use PHP's built-in methods for this, because some clients don't like
- * encoding of certain characters.
- *
- * Specifically, it was found that GVFS (gnome's webdav client) does not like encoding of ( and
- * ). Since these are reserved, but don't have a reserved meaning in url, these characters are
- * kept as-is.
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_URLUtil {
-
- /**
- * Encodes the path of a url.
- *
- * slashes (/) are treated as path-separators.
- *
- * @param string $path
- * @return string
- */
- static function encodePath($path) {
-
- return preg_replace_callback('/([^A-Za-z0-9_\-\.~\(\)\/])/',function($match) {
-
- return '%'.sprintf('%02x',ord($match[0]));
-
- }, $path);
-
- }
-
- /**
- * Encodes a 1 segment of a path
- *
- * Slashes are considered part of the name, and are encoded as %2f
- *
- * @param string $pathSegment
- * @return string
- */
- static function encodePathSegment($pathSegment) {
-
- return preg_replace_callback('/([^A-Za-z0-9_\-\.~\(\)])/',function($match) {
-
- return '%'.sprintf('%02x',ord($match[0]));
-
- }, $pathSegment);
- }
-
- /**
- * Decodes a url-encoded path
- *
- * @param string $path
- * @return string
- */
- static function decodePath($path) {
-
- return self::decodePathSegment($path);
-
- }
-
- /**
- * Decodes a url-encoded path segment
- *
- * @param string $path
- * @return string
- */
- static function decodePathSegment($path) {
-
- $path = rawurldecode($path);
- $encoding = mb_detect_encoding($path, array('UTF-8','ISO-8859-1'));
-
- switch($encoding) {
-
- case 'ISO-8859-1' :
- $path = utf8_encode($path);
-
- }
-
- return $path;
-
- }
-
- /**
- * Returns the 'dirname' and 'basename' for a path.
- *
- * The reason there is a custom function for this purpose, is because
- * basename() is locale aware (behaviour changes if C locale or a UTF-8 locale is used)
- * and we need a method that just operates on UTF-8 characters.
- *
- * In addition basename and dirname are platform aware, and will treat backslash (\) as a
- * directory separator on windows.
- *
- * This method returns the 2 components as an array.
- *
- * If there is no dirname, it will return an empty string. Any / appearing at the end of the
- * string is stripped off.
- *
- * @param string $path
- * @return array
- */
- static function splitPath($path) {
-
- $matches = array();
- if(preg_match('/^(?:(?:(.*)(?:\/+))?([^\/]+))(?:\/?)$/u',$path,$matches)) {
- return array($matches[1],$matches[2]);
- } else {
- return array(null,null);
- }
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAV/UUIDUtil.php b/3rdparty/Sabre/DAV/UUIDUtil.php
deleted file mode 100644
index f0eebe598e5..00000000000
--- a/3rdparty/Sabre/DAV/UUIDUtil.php
+++ /dev/null
@@ -1,64 +0,0 @@
-<?php
-
-/**
- * UUID Utility
- *
- * This class has static methods to generate and validate UUID's.
- * UUIDs are used a decent amount within various *DAV standards, so it made
- * sense to include it.
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_UUIDUtil {
-
- /**
- * Returns a pseudo-random v4 UUID
- *
- * This function is based on a comment by Andrew Moore on php.net
- *
- * @see http://www.php.net/manual/en/function.uniqid.php#94959
- * @return string
- */
- static function getUUID() {
-
- return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
- // 32 bits for "time_low"
- mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ),
-
- // 16 bits for "time_mid"
- mt_rand( 0, 0xffff ),
-
- // 16 bits for "time_hi_and_version",
- // four most significant bits holds version number 4
- mt_rand( 0, 0x0fff ) | 0x4000,
-
- // 16 bits, 8 bits for "clk_seq_hi_res",
- // 8 bits for "clk_seq_low",
- // two most significant bits holds zero and one for variant DCE1.1
- mt_rand( 0, 0x3fff ) | 0x8000,
-
- // 48 bits for "node"
- mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff )
- );
- }
-
- /**
- * Checks if a string is a valid UUID.
- *
- * @param string $uuid
- * @return bool
- */
- static function validateUUID($uuid) {
-
- return preg_match(
- '/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i',
- $uuid
- ) == true;
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAV/Version.php b/3rdparty/Sabre/DAV/Version.php
deleted file mode 100644
index 55611cf2148..00000000000
--- a/3rdparty/Sabre/DAV/Version.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-/**
- * This class contains the SabreDAV version constants.
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_Version {
-
- /**
- * Full version number
- */
- const VERSION = '1.7.1';
-
- /**
- * Stability : alpha, beta, stable
- */
- const STABILITY = 'stable';
-
-}
diff --git a/3rdparty/Sabre/DAV/XMLUtil.php b/3rdparty/Sabre/DAV/XMLUtil.php
deleted file mode 100644
index 712fa3fc014..00000000000
--- a/3rdparty/Sabre/DAV/XMLUtil.php
+++ /dev/null
@@ -1,165 +0,0 @@
-<?php
-
-/**
- * XML utilities for WebDAV
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAV_XMLUtil {
-
- /**
- * Returns the 'clark notation' for an element.
- *
- * For example, and element encoded as:
- * <b:myelem xmlns:b="http://www.example.org/" />
- * will be returned as:
- * {http://www.example.org}myelem
- *
- * This format is used throughout the SabreDAV sourcecode.
- *
- * This function will return null if a nodetype other than an Element is passed.
- *
- * @param DOMNode $dom
- * @return string
- */
- static function toClarkNotation(DOMNode $dom) {
-
- if ($dom->nodeType !== XML_ELEMENT_NODE) return null;
-
- $ns = $dom->namespaceURI;
-
- // Mapping to clark notation
- return '{' . $ns . '}' . $dom->localName;
-
- }
-
- /**
- * Parses a clark-notation string, and returns the namespace and element
- * name components.
- *
- * If the string was invalid, it will throw an InvalidArgumentException.
- *
- * @param string $str
- * @throws InvalidArgumentException
- * @return array
- */
- static function parseClarkNotation($str) {
-
- if (!preg_match('/^{([^}]*)}(.*)$/',$str,$matches)) {
- throw new InvalidArgumentException('\'' . $str . '\' is not a valid clark-notation formatted string');
- }
-
- return array(
- $matches[1],
- $matches[2]
- );
-
- }
-
- /**
- * This method provides a generic way to load a DOMDocument for WebDAV use.
- *
- * This method throws a Sabre_DAV_Exception_BadRequest exception for any xml errors.
- * It does not preserve whitespace.
- *
- * @param string $xml
- * @throws Sabre_DAV_Exception_BadRequest
- * @return DOMDocument
- */
- static function loadDOMDocument($xml) {
-
- if (empty($xml))
- throw new Sabre_DAV_Exception_BadRequest('Empty XML document sent');
-
- // The BitKinex client sends xml documents as UTF-16. PHP 5.3.1 (and presumably lower)
- // does not support this, so we must intercept this and convert to UTF-8.
- if (substr($xml,0,12) === "\x3c\x00\x3f\x00\x78\x00\x6d\x00\x6c\x00\x20\x00") {
-
- // Note: the preceeding byte sequence is "<?xml" encoded as UTF_16, without the BOM.
- $xml = iconv('UTF-16LE','UTF-8',$xml);
-
- // Because the xml header might specify the encoding, we must also change this.
- // This regex looks for the string encoding="UTF-16" and replaces it with
- // encoding="UTF-8".
- $xml = preg_replace('|<\?xml([^>]*)encoding="UTF-16"([^>]*)>|u','<?xml\1encoding="UTF-8"\2>',$xml);
-
- }
-
- // Retaining old error setting
- $oldErrorSetting = libxml_use_internal_errors(true);
-
- // Clearing any previous errors
- libxml_clear_errors();
-
- $dom = new DOMDocument();
-
- // We don't generally care about any whitespace
- $dom->preserveWhiteSpace = false;
-
- $dom->loadXML($xml,LIBXML_NOWARNING | LIBXML_NOERROR);
-
- if ($error = libxml_get_last_error()) {
- libxml_clear_errors();
- throw new Sabre_DAV_Exception_BadRequest('The request body had an invalid XML body. (message: ' . $error->message . ', errorcode: ' . $error->code . ', line: ' . $error->line . ')');
- }
-
- // Restoring old mechanism for error handling
- if ($oldErrorSetting===false) libxml_use_internal_errors(false);
-
- return $dom;
-
- }
-
- /**
- * Parses all WebDAV properties out of a DOM Element
- *
- * Generally WebDAV properties are enclosed in {DAV:}prop elements. This
- * method helps by going through all these and pulling out the actual
- * propertynames, making them array keys and making the property values,
- * well.. the array values.
- *
- * If no value was given (self-closing element) null will be used as the
- * value. This is used in for example PROPFIND requests.
- *
- * Complex values are supported through the propertyMap argument. The
- * propertyMap should have the clark-notation properties as it's keys, and
- * classnames as values.
- *
- * When any of these properties are found, the unserialize() method will be
- * (statically) called. The result of this method is used as the value.
- *
- * @param DOMElement $parentNode
- * @param array $propertyMap
- * @return array
- */
- static function parseProperties(DOMElement $parentNode, array $propertyMap = array()) {
-
- $propList = array();
- foreach($parentNode->childNodes as $propNode) {
-
- if (Sabre_DAV_XMLUtil::toClarkNotation($propNode)!=='{DAV:}prop') continue;
-
- foreach($propNode->childNodes as $propNodeData) {
-
- /* If there are no elements in here, we actually get 1 text node, this special case is dedicated to netdrive */
- if ($propNodeData->nodeType != XML_ELEMENT_NODE) continue;
-
- $propertyName = Sabre_DAV_XMLUtil::toClarkNotation($propNodeData);
- if (isset($propertyMap[$propertyName])) {
- $propList[$propertyName] = call_user_func(array($propertyMap[$propertyName],'unserialize'),$propNodeData);
- } else {
- $propList[$propertyName] = $propNodeData->textContent;
- }
- }
-
-
- }
- return $propList;
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAV/includes.php b/3rdparty/Sabre/DAV/includes.php
deleted file mode 100644
index 6728f88ce76..00000000000
--- a/3rdparty/Sabre/DAV/includes.php
+++ /dev/null
@@ -1,98 +0,0 @@
-<?php
-
-/**
- * Sabre_DAV includes file
- *
- * Including this file will automatically include all files from the Sabre_DAV
- * package.
- *
- * This often allows faster loadtimes, as autoload-speed is often quite slow.
- *
- * @package Sabre
- * @subpackage DAV
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-
-// Begin includes
-include __DIR__ . '/Auth/IBackend.php';
-include __DIR__ . '/Client.php';
-include __DIR__ . '/Exception.php';
-include __DIR__ . '/INode.php';
-include __DIR__ . '/IProperties.php';
-include __DIR__ . '/Locks/Backend/Abstract.php';
-include __DIR__ . '/Locks/Backend/File.php';
-include __DIR__ . '/Locks/Backend/FS.php';
-include __DIR__ . '/Locks/Backend/PDO.php';
-include __DIR__ . '/Locks/LockInfo.php';
-include __DIR__ . '/Node.php';
-include __DIR__ . '/Property/IHref.php';
-include __DIR__ . '/PropertyInterface.php';
-include __DIR__ . '/Server.php';
-include __DIR__ . '/ServerPlugin.php';
-include __DIR__ . '/StringUtil.php';
-include __DIR__ . '/TemporaryFileFilterPlugin.php';
-include __DIR__ . '/Tree.php';
-include __DIR__ . '/URLUtil.php';
-include __DIR__ . '/UUIDUtil.php';
-include __DIR__ . '/Version.php';
-include __DIR__ . '/XMLUtil.php';
-include __DIR__ . '/Auth/Backend/AbstractBasic.php';
-include __DIR__ . '/Auth/Backend/AbstractDigest.php';
-include __DIR__ . '/Auth/Backend/Apache.php';
-include __DIR__ . '/Auth/Backend/File.php';
-include __DIR__ . '/Auth/Backend/PDO.php';
-include __DIR__ . '/Auth/Plugin.php';
-include __DIR__ . '/Browser/GuessContentType.php';
-include __DIR__ . '/Browser/MapGetToPropFind.php';
-include __DIR__ . '/Browser/Plugin.php';
-include __DIR__ . '/Exception/BadRequest.php';
-include __DIR__ . '/Exception/Conflict.php';
-include __DIR__ . '/Exception/Forbidden.php';
-include __DIR__ . '/Exception/InsufficientStorage.php';
-include __DIR__ . '/Exception/InvalidResourceType.php';
-include __DIR__ . '/Exception/Locked.php';
-include __DIR__ . '/Exception/LockTokenMatchesRequestUri.php';
-include __DIR__ . '/Exception/MethodNotAllowed.php';
-include __DIR__ . '/Exception/NotAuthenticated.php';
-include __DIR__ . '/Exception/NotFound.php';
-include __DIR__ . '/Exception/NotImplemented.php';
-include __DIR__ . '/Exception/PaymentRequired.php';
-include __DIR__ . '/Exception/PreconditionFailed.php';
-include __DIR__ . '/Exception/ReportNotSupported.php';
-include __DIR__ . '/Exception/RequestedRangeNotSatisfiable.php';
-include __DIR__ . '/Exception/UnsupportedMediaType.php';
-include __DIR__ . '/FS/Node.php';
-include __DIR__ . '/FSExt/Node.php';
-include __DIR__ . '/ICollection.php';
-include __DIR__ . '/IExtendedCollection.php';
-include __DIR__ . '/IFile.php';
-include __DIR__ . '/IQuota.php';
-include __DIR__ . '/Locks/Plugin.php';
-include __DIR__ . '/Mount/Plugin.php';
-include __DIR__ . '/ObjectTree.php';
-include __DIR__ . '/PartialUpdate/IFile.php';
-include __DIR__ . '/PartialUpdate/Plugin.php';
-include __DIR__ . '/Property.php';
-include __DIR__ . '/Tree/Filesystem.php';
-include __DIR__ . '/Collection.php';
-include __DIR__ . '/Exception/ConflictingLock.php';
-include __DIR__ . '/Exception/FileNotFound.php';
-include __DIR__ . '/File.php';
-include __DIR__ . '/FS/Directory.php';
-include __DIR__ . '/FS/File.php';
-include __DIR__ . '/FSExt/Directory.php';
-include __DIR__ . '/FSExt/File.php';
-include __DIR__ . '/Property/GetLastModified.php';
-include __DIR__ . '/Property/Href.php';
-include __DIR__ . '/Property/HrefList.php';
-include __DIR__ . '/Property/LockDiscovery.php';
-include __DIR__ . '/Property/ResourceType.php';
-include __DIR__ . '/Property/Response.php';
-include __DIR__ . '/Property/ResponseList.php';
-include __DIR__ . '/Property/SupportedLock.php';
-include __DIR__ . '/Property/SupportedReportSet.php';
-include __DIR__ . '/SimpleCollection.php';
-include __DIR__ . '/SimpleFile.php';
-// End includes
diff --git a/3rdparty/Sabre/DAVACL/AbstractPrincipalCollection.php b/3rdparty/Sabre/DAVACL/AbstractPrincipalCollection.php
deleted file mode 100644
index f67eadad6e9..00000000000
--- a/3rdparty/Sabre/DAVACL/AbstractPrincipalCollection.php
+++ /dev/null
@@ -1,154 +0,0 @@
-<?php
-
-/**
- * Principals Collection
- *
- * This is a helper class that easily allows you to create a collection that
- * has a childnode for every principal.
- *
- * To use this class, simply implement the getChildForPrincipal method.
- *
- * @package Sabre
- * @subpackage DAVACL
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-abstract class Sabre_DAVACL_AbstractPrincipalCollection extends Sabre_DAV_Collection {
-
- /**
- * Node or 'directory' name.
- *
- * @var string
- */
- protected $path;
-
- /**
- * Principal backend
- *
- * @var Sabre_DAVACL_IPrincipalBackend
- */
- protected $principalBackend;
-
- /**
- * If this value is set to true, it effectively disables listing of users
- * it still allows user to find other users if they have an exact url.
- *
- * @var bool
- */
- public $disableListing = false;
-
- /**
- * Creates the object
- *
- * This object must be passed the principal backend. This object will
- * filter all principals from a specified prefix ($principalPrefix). The
- * default is 'principals', if your principals are stored in a different
- * collection, override $principalPrefix
- *
- *
- * @param Sabre_DAVACL_IPrincipalBackend $principalBackend
- * @param string $principalPrefix
- */
- public function __construct(Sabre_DAVACL_IPrincipalBackend $principalBackend, $principalPrefix = 'principals') {
-
- $this->principalPrefix = $principalPrefix;
- $this->principalBackend = $principalBackend;
-
- }
-
- /**
- * This method returns a node for a principal.
- *
- * The passed array contains principal information, and is guaranteed to
- * at least contain a uri item. Other properties may or may not be
- * supplied by the authentication backend.
- *
- * @param array $principalInfo
- * @return Sabre_DAVACL_IPrincipal
- */
- abstract function getChildForPrincipal(array $principalInfo);
-
- /**
- * Returns the name of this collection.
- *
- * @return string
- */
- public function getName() {
-
- list(,$name) = Sabre_DAV_URLUtil::splitPath($this->principalPrefix);
- return $name;
-
- }
-
- /**
- * Return the list of users
- *
- * @return array
- */
- public function getChildren() {
-
- if ($this->disableListing)
- throw new Sabre_DAV_Exception_MethodNotAllowed('Listing members of this collection is disabled');
-
- $children = array();
- foreach($this->principalBackend->getPrincipalsByPrefix($this->principalPrefix) as $principalInfo) {
-
- $children[] = $this->getChildForPrincipal($principalInfo);
-
-
- }
- return $children;
-
- }
-
- /**
- * Returns a child object, by its name.
- *
- * @param string $name
- * @throws Sabre_DAV_Exception_NotFound
- * @return Sabre_DAVACL_IPrincipal
- */
- public function getChild($name) {
-
- $principalInfo = $this->principalBackend->getPrincipalByPath($this->principalPrefix . '/' . $name);
- if (!$principalInfo) throw new Sabre_DAV_Exception_NotFound('Principal with name ' . $name . ' not found');
- return $this->getChildForPrincipal($principalInfo);
-
- }
-
- /**
- * This method is used to search for principals matching a set of
- * properties.
- *
- * This search is specifically used by RFC3744's principal-property-search
- * REPORT. You should at least allow searching on
- * http://sabredav.org/ns}email-address.
- *
- * The actual search should be a unicode-non-case-sensitive search. The
- * keys in searchProperties are the WebDAV property names, while the values
- * are the property values to search on.
- *
- * If multiple properties are being searched on, the search should be
- * AND'ed.
- *
- * This method should simply return a list of 'child names', which may be
- * used to call $this->getChild in the future.
- *
- * @param array $searchProperties
- * @return array
- */
- public function searchPrincipals(array $searchProperties) {
-
- $result = $this->principalBackend->searchPrincipals($this->principalPrefix, $searchProperties);
- $r = array();
-
- foreach($result as $row) {
- list(, $r[]) = Sabre_DAV_URLUtil::splitPath($row);
- }
-
- return $r;
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAVACL/Exception/AceConflict.php b/3rdparty/Sabre/DAVACL/Exception/AceConflict.php
deleted file mode 100644
index 4b9f93b0036..00000000000
--- a/3rdparty/Sabre/DAVACL/Exception/AceConflict.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-
-/**
- * Sabre_DAVACL_Exception_AceConflict
- *
- * @package Sabre
- * @subpackage DAVACL
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAVACL_Exception_AceConflict extends Sabre_DAV_Exception_Conflict {
-
- /**
- * Adds in extra information in the xml response.
- *
- * This method adds the {DAV:}no-ace-conflict element as defined in rfc3744
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $errorNode
- * @return void
- */
- public function serialize(Sabre_DAV_Server $server,DOMElement $errorNode) {
-
- $doc = $errorNode->ownerDocument;
-
- $np = $doc->createElementNS('DAV:','d:no-ace-conflict');
- $errorNode->appendChild($np);
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAVACL/Exception/NeedPrivileges.php b/3rdparty/Sabre/DAVACL/Exception/NeedPrivileges.php
deleted file mode 100644
index 9b055dd9709..00000000000
--- a/3rdparty/Sabre/DAVACL/Exception/NeedPrivileges.php
+++ /dev/null
@@ -1,81 +0,0 @@
-<?php
-
-/**
- * NeedPrivileges
- *
- * The 403-need privileges is thrown when a user didn't have the appropriate
- * permissions to perform an operation
- *
- * @package Sabre
- * @subpackage DAVACL
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAVACL_Exception_NeedPrivileges extends Sabre_DAV_Exception_Forbidden {
-
- /**
- * The relevant uri
- *
- * @var string
- */
- protected $uri;
-
- /**
- * The privileges the user didn't have.
- *
- * @var array
- */
- protected $privileges;
-
- /**
- * Constructor
- *
- * @param string $uri
- * @param array $privileges
- */
- public function __construct($uri,array $privileges) {
-
- $this->uri = $uri;
- $this->privileges = $privileges;
-
- parent::__construct('User did not have the required privileges (' . implode(',', $privileges) . ') for path "' . $uri . '"');
-
- }
-
- /**
- * Adds in extra information in the xml response.
- *
- * This method adds the {DAV:}need-privileges element as defined in rfc3744
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $errorNode
- * @return void
- */
- public function serialize(Sabre_DAV_Server $server,DOMElement $errorNode) {
-
- $doc = $errorNode->ownerDocument;
-
- $np = $doc->createElementNS('DAV:','d:need-privileges');
- $errorNode->appendChild($np);
-
- foreach($this->privileges as $privilege) {
-
- $resource = $doc->createElementNS('DAV:','d:resource');
- $np->appendChild($resource);
-
- $resource->appendChild($doc->createElementNS('DAV:','d:href',$server->getBaseUri() . $this->uri));
-
- $priv = $doc->createElementNS('DAV:','d:privilege');
- $resource->appendChild($priv);
-
- preg_match('/^{([^}]*)}(.*)$/',$privilege,$privilegeParts);
- $priv->appendChild($doc->createElementNS($privilegeParts[1],'d:' . $privilegeParts[2]));
-
-
- }
-
- }
-
-}
-
diff --git a/3rdparty/Sabre/DAVACL/Exception/NoAbstract.php b/3rdparty/Sabre/DAVACL/Exception/NoAbstract.php
deleted file mode 100644
index f44e3e32281..00000000000
--- a/3rdparty/Sabre/DAVACL/Exception/NoAbstract.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-
-/**
- * Sabre_DAVACL_Exception_NoAbstract
- *
- * @package Sabre
- * @subpackage DAVACL
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAVACL_Exception_NoAbstract extends Sabre_DAV_Exception_PreconditionFailed {
-
- /**
- * Adds in extra information in the xml response.
- *
- * This method adds the {DAV:}no-abstract element as defined in rfc3744
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $errorNode
- * @return void
- */
- public function serialize(Sabre_DAV_Server $server,DOMElement $errorNode) {
-
- $doc = $errorNode->ownerDocument;
-
- $np = $doc->createElementNS('DAV:','d:no-abstract');
- $errorNode->appendChild($np);
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAVACL/Exception/NotRecognizedPrincipal.php b/3rdparty/Sabre/DAVACL/Exception/NotRecognizedPrincipal.php
deleted file mode 100644
index 8d1e38ca1b4..00000000000
--- a/3rdparty/Sabre/DAVACL/Exception/NotRecognizedPrincipal.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-
-/**
- * Sabre_DAVACL_Exception_NotRecognizedPrincipal
- *
- * @package Sabre
- * @subpackage DAVACL
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAVACL_Exception_NotRecognizedPrincipal extends Sabre_DAV_Exception_PreconditionFailed {
-
- /**
- * Adds in extra information in the xml response.
- *
- * This method adds the {DAV:}recognized-principal element as defined in rfc3744
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $errorNode
- * @return void
- */
- public function serialize(Sabre_DAV_Server $server,DOMElement $errorNode) {
-
- $doc = $errorNode->ownerDocument;
-
- $np = $doc->createElementNS('DAV:','d:recognized-principal');
- $errorNode->appendChild($np);
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAVACL/Exception/NotSupportedPrivilege.php b/3rdparty/Sabre/DAVACL/Exception/NotSupportedPrivilege.php
deleted file mode 100644
index 3b5d012d7fa..00000000000
--- a/3rdparty/Sabre/DAVACL/Exception/NotSupportedPrivilege.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-
-/**
- * Sabre_DAVACL_Exception_NotSupportedPrivilege
- *
- * @package Sabre
- * @subpackage DAVACL
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAVACL_Exception_NotSupportedPrivilege extends Sabre_DAV_Exception_PreconditionFailed {
-
- /**
- * Adds in extra information in the xml response.
- *
- * This method adds the {DAV:}not-supported-privilege element as defined in rfc3744
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $errorNode
- * @return void
- */
- public function serialize(Sabre_DAV_Server $server,DOMElement $errorNode) {
-
- $doc = $errorNode->ownerDocument;
-
- $np = $doc->createElementNS('DAV:','d:not-supported-privilege');
- $errorNode->appendChild($np);
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAVACL/IACL.php b/3rdparty/Sabre/DAVACL/IACL.php
deleted file mode 100644
index 356bb481d55..00000000000
--- a/3rdparty/Sabre/DAVACL/IACL.php
+++ /dev/null
@@ -1,73 +0,0 @@
-<?php
-
-/**
- * ACL-enabled node
- *
- * If you want to add WebDAV ACL to a node, you must implement this class
- *
- * @package Sabre
- * @subpackage DAVACL
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-interface Sabre_DAVACL_IACL extends Sabre_DAV_INode {
-
- /**
- * Returns the owner principal
- *
- * This must be a url to a principal, or null if there's no owner
- *
- * @return string|null
- */
- function getOwner();
-
- /**
- * Returns a group principal
- *
- * This must be a url to a principal, or null if there's no owner
- *
- * @return string|null
- */
- function getGroup();
-
- /**
- * Returns a list of ACE's for this node.
- *
- * Each ACE has the following properties:
- * * 'privilege', a string such as {DAV:}read or {DAV:}write. These are
- * currently the only supported privileges
- * * 'principal', a url to the principal who owns the node
- * * 'protected' (optional), indicating that this ACE is not allowed to
- * be updated.
- *
- * @return array
- */
- function getACL();
-
- /**
- * Updates the ACL
- *
- * This method will receive a list of new ACE's as an array argument.
- *
- * @param array $acl
- * @return void
- */
- function setACL(array $acl);
-
- /**
- * Returns the list of supported privileges for this node.
- *
- * The returned data structure is a list of nested privileges.
- * See Sabre_DAVACL_Plugin::getDefaultSupportedPrivilegeSet for a simple
- * standard structure.
- *
- * If null is returned from this method, the default privilege set is used,
- * which is fine for most common usecases.
- *
- * @return array|null
- */
- function getSupportedPrivilegeSet();
-
-
-}
diff --git a/3rdparty/Sabre/DAVACL/IPrincipal.php b/3rdparty/Sabre/DAVACL/IPrincipal.php
deleted file mode 100644
index fc7605bf625..00000000000
--- a/3rdparty/Sabre/DAVACL/IPrincipal.php
+++ /dev/null
@@ -1,75 +0,0 @@
-<?php
-
-/**
- * IPrincipal interface
- *
- * Implement this interface to define your own principals
- *
- * @package Sabre
- * @subpackage DAVACL
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-interface Sabre_DAVACL_IPrincipal extends Sabre_DAV_INode {
-
- /**
- * Returns a list of alternative urls for a principal
- *
- * This can for example be an email address, or ldap url.
- *
- * @return array
- */
- function getAlternateUriSet();
-
- /**
- * Returns the full principal url
- *
- * @return string
- */
- function getPrincipalUrl();
-
- /**
- * Returns the list of group members
- *
- * If this principal is a group, this function should return
- * all member principal uri's for the group.
- *
- * @return array
- */
- function getGroupMemberSet();
-
- /**
- * Returns the list of groups this principal is member of
- *
- * If this principal is a member of a (list of) groups, this function
- * should return a list of principal uri's for it's members.
- *
- * @return array
- */
- function getGroupMembership();
-
- /**
- * Sets a list of group members
- *
- * If this principal is a group, this method sets all the group members.
- * The list of members is always overwritten, never appended to.
- *
- * This method should throw an exception if the members could not be set.
- *
- * @param array $principals
- * @return void
- */
- function setGroupMemberSet(array $principals);
-
- /**
- * Returns the displayname
- *
- * This should be a human readable name for the principal.
- * If none is available, return the nodename.
- *
- * @return string
- */
- function getDisplayName();
-
-}
diff --git a/3rdparty/Sabre/DAVACL/IPrincipalBackend.php b/3rdparty/Sabre/DAVACL/IPrincipalBackend.php
deleted file mode 100644
index e798bf890c0..00000000000
--- a/3rdparty/Sabre/DAVACL/IPrincipalBackend.php
+++ /dev/null
@@ -1,153 +0,0 @@
-<?php
-
-/**
- * Implement this interface to create your own principal backends.
- *
- * Creating backends for principals is entirely optional. You can also
- * implement Sabre_DAVACL_IPrincipal directly. This interface is used solely by
- * Sabre_DAVACL_AbstractPrincipalCollection.
- *
- * @package Sabre
- * @subpackage DAVACL
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-interface Sabre_DAVACL_IPrincipalBackend {
-
- /**
- * Returns a list of principals based on a prefix.
- *
- * This prefix will often contain something like 'principals'. You are only
- * expected to return principals that are in this base path.
- *
- * You are expected to return at least a 'uri' for every user, you can
- * return any additional properties if you wish so. Common properties are:
- * {DAV:}displayname
- * {http://sabredav.org/ns}email-address - This is a custom SabreDAV
- * field that's actually injected in a number of other properties. If
- * you have an email address, use this property.
- *
- * @param string $prefixPath
- * @return array
- */
- function getPrincipalsByPrefix($prefixPath);
-
- /**
- * Returns a specific principal, specified by it's path.
- * The returned structure should be the exact same as from
- * getPrincipalsByPrefix.
- *
- * @param string $path
- * @return array
- */
- function getPrincipalByPath($path);
-
- /**
- * Updates one ore more webdav properties on a principal.
- *
- * The list of mutations is supplied as an array. Each key in the array is
- * a propertyname, such as {DAV:}displayname.
- *
- * Each value is the actual value to be updated. If a value is null, it
- * must be deleted.
- *
- * This method should be atomic. It must either completely succeed, or
- * completely fail. Success and failure can simply be returned as 'true' or
- * 'false'.
- *
- * It is also possible to return detailed failure information. In that case
- * an array such as this should be returned:
- *
- * array(
- * 200 => array(
- * '{DAV:}prop1' => null,
- * ),
- * 201 => array(
- * '{DAV:}prop2' => null,
- * ),
- * 403 => array(
- * '{DAV:}prop3' => null,
- * ),
- * 424 => array(
- * '{DAV:}prop4' => null,
- * ),
- * );
- *
- * In this previous example prop1 was successfully updated or deleted, and
- * prop2 was succesfully created.
- *
- * prop3 failed to update due to '403 Forbidden' and because of this prop4
- * also could not be updated with '424 Failed dependency'.
- *
- * This last example was actually incorrect. While 200 and 201 could appear
- * in 1 response, if there's any error (403) the other properties should
- * always fail with 423 (failed dependency).
- *
- * But anyway, if you don't want to scratch your head over this, just
- * return true or false.
- *
- * @param string $path
- * @param array $mutations
- * @return array|bool
- */
- function updatePrincipal($path, $mutations);
-
- /**
- * This method is used to search for principals matching a set of
- * properties.
- *
- * This search is specifically used by RFC3744's principal-property-search
- * REPORT. You should at least allow searching on
- * http://sabredav.org/ns}email-address.
- *
- * The actual search should be a unicode-non-case-sensitive search. The
- * keys in searchProperties are the WebDAV property names, while the values
- * are the property values to search on.
- *
- * If multiple properties are being searched on, the search should be
- * AND'ed.
- *
- * This method should simply return an array with full principal uri's.
- *
- * If somebody attempted to search on a property the backend does not
- * support, you should simply return 0 results.
- *
- * You can also just return 0 results if you choose to not support
- * searching at all, but keep in mind that this may stop certain features
- * from working.
- *
- * @param string $prefixPath
- * @param array $searchProperties
- * @return array
- */
- function searchPrincipals($prefixPath, array $searchProperties);
-
- /**
- * Returns the list of members for a group-principal
- *
- * @param string $principal
- * @return array
- */
- function getGroupMemberSet($principal);
-
- /**
- * Returns the list of groups a principal is a member of
- *
- * @param string $principal
- * @return array
- */
- function getGroupMembership($principal);
-
- /**
- * Updates the list of group members for a group principal.
- *
- * The principals should be passed as a list of uri's.
- *
- * @param string $principal
- * @param array $members
- * @return void
- */
- function setGroupMemberSet($principal, array $members);
-
-}
diff --git a/3rdparty/Sabre/DAVACL/Plugin.php b/3rdparty/Sabre/DAVACL/Plugin.php
deleted file mode 100644
index 5b17c838475..00000000000
--- a/3rdparty/Sabre/DAVACL/Plugin.php
+++ /dev/null
@@ -1,1382 +0,0 @@
-<?php
-
-/**
- * SabreDAV ACL Plugin
- *
- * This plugin provides functionality to enforce ACL permissions.
- * ACL is defined in RFC3744.
- *
- * In addition it also provides support for the {DAV:}current-user-principal
- * property, defined in RFC5397 and the {DAV:}expand-property report, as
- * defined in RFC3253.
- *
- * @package Sabre
- * @subpackage DAVACL
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAVACL_Plugin extends Sabre_DAV_ServerPlugin {
-
- /**
- * Recursion constants
- *
- * This only checks the base node
- */
- const R_PARENT = 1;
-
- /**
- * Recursion constants
- *
- * This checks every node in the tree
- */
- const R_RECURSIVE = 2;
-
- /**
- * Recursion constants
- *
- * This checks every parentnode in the tree, but not leaf-nodes.
- */
- const R_RECURSIVEPARENTS = 3;
-
- /**
- * Reference to server object.
- *
- * @var Sabre_DAV_Server
- */
- protected $server;
-
- /**
- * List of urls containing principal collections.
- * Modify this if your principals are located elsewhere.
- *
- * @var array
- */
- public $principalCollectionSet = array(
- 'principals',
- );
-
- /**
- * By default ACL is only enforced for nodes that have ACL support (the
- * ones that implement Sabre_DAVACL_IACL). For any other node, access is
- * always granted.
- *
- * To override this behaviour you can turn this setting off. This is useful
- * if you plan to fully support ACL in the entire tree.
- *
- * @var bool
- */
- public $allowAccessToNodesWithoutACL = true;
-
- /**
- * By default nodes that are inaccessible by the user, can still be seen
- * in directory listings (PROPFIND on parent with Depth: 1)
- *
- * In certain cases it's desirable to hide inaccessible nodes. Setting this
- * to true will cause these nodes to be hidden from directory listings.
- *
- * @var bool
- */
- public $hideNodesFromListings = false;
-
- /**
- * This string is prepended to the username of the currently logged in
- * user. This allows the plugin to determine the principal path based on
- * the username.
- *
- * @var string
- */
- public $defaultUsernamePath = 'principals';
-
- /**
- * This list of properties are the properties a client can search on using
- * the {DAV:}principal-property-search report.
- *
- * The keys are the property names, values are descriptions.
- *
- * @var array
- */
- public $principalSearchPropertySet = array(
- '{DAV:}displayname' => 'Display name',
- '{http://sabredav.org/ns}email-address' => 'Email address',
- );
-
- /**
- * Any principal uri's added here, will automatically be added to the list
- * of ACL's. They will effectively receive {DAV:}all privileges, as a
- * protected privilege.
- *
- * @var array
- */
- public $adminPrincipals = array();
-
- /**
- * Returns a list of features added by this plugin.
- *
- * This list is used in the response of a HTTP OPTIONS request.
- *
- * @return array
- */
- public function getFeatures() {
-
- return array('access-control');
-
- }
-
- /**
- * Returns a list of available methods for a given url
- *
- * @param string $uri
- * @return array
- */
- public function getMethods($uri) {
-
- return array('ACL');
-
- }
-
- /**
- * Returns a plugin name.
- *
- * Using this name other plugins will be able to access other plugins
- * using Sabre_DAV_Server::getPlugin
- *
- * @return string
- */
- public function getPluginName() {
-
- return 'acl';
-
- }
-
- /**
- * Returns a list of reports this plugin supports.
- *
- * This will be used in the {DAV:}supported-report-set property.
- * Note that you still need to subscribe to the 'report' event to actually
- * implement them
- *
- * @param string $uri
- * @return array
- */
- public function getSupportedReportSet($uri) {
-
- return array(
- '{DAV:}expand-property',
- '{DAV:}principal-property-search',
- '{DAV:}principal-search-property-set',
- );
-
- }
-
-
- /**
- * Checks if the current user has the specified privilege(s).
- *
- * You can specify a single privilege, or a list of privileges.
- * This method will throw an exception if the privilege is not available
- * and return true otherwise.
- *
- * @param string $uri
- * @param array|string $privileges
- * @param int $recursion
- * @param bool $throwExceptions if set to false, this method won't through exceptions.
- * @throws Sabre_DAVACL_Exception_NeedPrivileges
- * @return bool
- */
- public function checkPrivileges($uri, $privileges, $recursion = self::R_PARENT, $throwExceptions = true) {
-
- if (!is_array($privileges)) $privileges = array($privileges);
-
- $acl = $this->getCurrentUserPrivilegeSet($uri);
-
- if (is_null($acl)) {
- if ($this->allowAccessToNodesWithoutACL) {
- return true;
- } else {
- if ($throwExceptions)
- throw new Sabre_DAVACL_Exception_NeedPrivileges($uri,$privileges);
- else
- return false;
-
- }
- }
-
- $failed = array();
- foreach($privileges as $priv) {
-
- if (!in_array($priv, $acl)) {
- $failed[] = $priv;
- }
-
- }
-
- if ($failed) {
- if ($throwExceptions)
- throw new Sabre_DAVACL_Exception_NeedPrivileges($uri,$failed);
- else
- return false;
- }
- return true;
-
- }
-
- /**
- * Returns the standard users' principal.
- *
- * This is one authorative principal url for the current user.
- * This method will return null if the user wasn't logged in.
- *
- * @return string|null
- */
- public function getCurrentUserPrincipal() {
-
- $authPlugin = $this->server->getPlugin('auth');
- if (is_null($authPlugin)) return null;
- /** @var $authPlugin Sabre_DAV_Auth_Plugin */
-
- $userName = $authPlugin->getCurrentUser();
- if (!$userName) return null;
-
- return $this->defaultUsernamePath . '/' . $userName;
-
- }
-
- /**
- * This array holds a cache for all the principals that are associated with
- * a single principal.
- *
- * @var array
- */
- protected $currentUserPrincipalsCache = array();
-
- /**
- * Returns a list of principals that's associated to the current
- * user, either directly or through group membership.
- *
- * @return array
- */
- public function getCurrentUserPrincipals() {
-
- $currentUser = $this->getCurrentUserPrincipal();
-
- if (is_null($currentUser)) return array();
-
- // First check our cache
- if (isset($this->currentUserPrincipalsCache[$currentUser])) {
- return $this->currentUserPrincipalsCache[$currentUser];
- }
-
- $check = array($currentUser);
- $principals = array($currentUser);
-
- while(count($check)) {
-
- $principal = array_shift($check);
-
- $node = $this->server->tree->getNodeForPath($principal);
- if ($node instanceof Sabre_DAVACL_IPrincipal) {
- foreach($node->getGroupMembership() as $groupMember) {
-
- if (!in_array($groupMember, $principals)) {
-
- $check[] = $groupMember;
- $principals[] = $groupMember;
-
- }
-
- }
-
- }
-
- }
-
- // Store the result in the cache
- $this->currentUserPrincipalsCache[$currentUser] = $principals;
-
- return $principals;
-
- }
-
- /**
- * Returns the supported privilege structure for this ACL plugin.
- *
- * See RFC3744 for more details. Currently we default on a simple,
- * standard structure.
- *
- * You can either get the list of privileges by a uri (path) or by
- * specifying a Node.
- *
- * @param string|Sabre_DAV_INode $node
- * @return array
- */
- public function getSupportedPrivilegeSet($node) {
-
- if (is_string($node)) {
- $node = $this->server->tree->getNodeForPath($node);
- }
-
- if ($node instanceof Sabre_DAVACL_IACL) {
- $result = $node->getSupportedPrivilegeSet();
-
- if ($result)
- return $result;
- }
-
- return self::getDefaultSupportedPrivilegeSet();
-
- }
-
- /**
- * Returns a fairly standard set of privileges, which may be useful for
- * other systems to use as a basis.
- *
- * @return array
- */
- static function getDefaultSupportedPrivilegeSet() {
-
- return array(
- 'privilege' => '{DAV:}all',
- 'abstract' => true,
- 'aggregates' => array(
- array(
- 'privilege' => '{DAV:}read',
- 'aggregates' => array(
- array(
- 'privilege' => '{DAV:}read-acl',
- 'abstract' => true,
- ),
- array(
- 'privilege' => '{DAV:}read-current-user-privilege-set',
- 'abstract' => true,
- ),
- ),
- ), // {DAV:}read
- array(
- 'privilege' => '{DAV:}write',
- 'aggregates' => array(
- array(
- 'privilege' => '{DAV:}write-acl',
- 'abstract' => true,
- ),
- array(
- 'privilege' => '{DAV:}write-properties',
- 'abstract' => true,
- ),
- array(
- 'privilege' => '{DAV:}write-content',
- 'abstract' => true,
- ),
- array(
- 'privilege' => '{DAV:}bind',
- 'abstract' => true,
- ),
- array(
- 'privilege' => '{DAV:}unbind',
- 'abstract' => true,
- ),
- array(
- 'privilege' => '{DAV:}unlock',
- 'abstract' => true,
- ),
- ),
- ), // {DAV:}write
- ),
- ); // {DAV:}all
-
- }
-
- /**
- * Returns the supported privilege set as a flat list
- *
- * This is much easier to parse.
- *
- * The returned list will be index by privilege name.
- * The value is a struct containing the following properties:
- * - aggregates
- * - abstract
- * - concrete
- *
- * @param string|Sabre_DAV_INode $node
- * @return array
- */
- final public function getFlatPrivilegeSet($node) {
-
- $privs = $this->getSupportedPrivilegeSet($node);
-
- $flat = array();
- $this->getFPSTraverse($privs, null, $flat);
-
- return $flat;
-
- }
-
- /**
- * Traverses the privilege set tree for reordering
- *
- * This function is solely used by getFlatPrivilegeSet, and would have been
- * a closure if it wasn't for the fact I need to support PHP 5.2.
- *
- * @param array $priv
- * @param $concrete
- * @param array $flat
- * @return void
- */
- final private function getFPSTraverse($priv, $concrete, &$flat) {
-
- $myPriv = array(
- 'privilege' => $priv['privilege'],
- 'abstract' => isset($priv['abstract']) && $priv['abstract'],
- 'aggregates' => array(),
- 'concrete' => isset($priv['abstract']) && $priv['abstract']?$concrete:$priv['privilege'],
- );
-
- if (isset($priv['aggregates']))
- foreach($priv['aggregates'] as $subPriv) $myPriv['aggregates'][] = $subPriv['privilege'];
-
- $flat[$priv['privilege']] = $myPriv;
-
- if (isset($priv['aggregates'])) {
-
- foreach($priv['aggregates'] as $subPriv) {
-
- $this->getFPSTraverse($subPriv, $myPriv['concrete'], $flat);
-
- }
-
- }
-
- }
-
- /**
- * Returns the full ACL list.
- *
- * Either a uri or a Sabre_DAV_INode may be passed.
- *
- * null will be returned if the node doesn't support ACLs.
- *
- * @param string|Sabre_DAV_INode $node
- * @return array
- */
- public function getACL($node) {
-
- if (is_string($node)) {
- $node = $this->server->tree->getNodeForPath($node);
- }
- if (!$node instanceof Sabre_DAVACL_IACL) {
- return null;
- }
- $acl = $node->getACL();
- foreach($this->adminPrincipals as $adminPrincipal) {
- $acl[] = array(
- 'principal' => $adminPrincipal,
- 'privilege' => '{DAV:}all',
- 'protected' => true,
- );
- }
- return $acl;
-
- }
-
- /**
- * Returns a list of privileges the current user has
- * on a particular node.
- *
- * Either a uri or a Sabre_DAV_INode may be passed.
- *
- * null will be returned if the node doesn't support ACLs.
- *
- * @param string|Sabre_DAV_INode $node
- * @return array
- */
- public function getCurrentUserPrivilegeSet($node) {
-
- if (is_string($node)) {
- $node = $this->server->tree->getNodeForPath($node);
- }
-
- $acl = $this->getACL($node);
-
- if (is_null($acl)) return null;
-
- $principals = $this->getCurrentUserPrincipals();
-
- $collected = array();
-
- foreach($acl as $ace) {
-
- $principal = $ace['principal'];
-
- switch($principal) {
-
- case '{DAV:}owner' :
- $owner = $node->getOwner();
- if ($owner && in_array($owner, $principals)) {
- $collected[] = $ace;
- }
- break;
-
-
- // 'all' matches for every user
- case '{DAV:}all' :
-
- // 'authenticated' matched for every user that's logged in.
- // Since it's not possible to use ACL while not being logged
- // in, this is also always true.
- case '{DAV:}authenticated' :
- $collected[] = $ace;
- break;
-
- // 'unauthenticated' can never occur either, so we simply
- // ignore these.
- case '{DAV:}unauthenticated' :
- break;
-
- default :
- if (in_array($ace['principal'], $principals)) {
- $collected[] = $ace;
- }
- break;
-
- }
-
-
-
- }
-
- // Now we deduct all aggregated privileges.
- $flat = $this->getFlatPrivilegeSet($node);
-
- $collected2 = array();
- while(count($collected)) {
-
- $current = array_pop($collected);
- $collected2[] = $current['privilege'];
-
- foreach($flat[$current['privilege']]['aggregates'] as $subPriv) {
- $collected2[] = $subPriv;
- $collected[] = $flat[$subPriv];
- }
-
- }
-
- return array_values(array_unique($collected2));
-
- }
-
- /**
- * Principal property search
- *
- * This method can search for principals matching certain values in
- * properties.
- *
- * This method will return a list of properties for the matched properties.
- *
- * @param array $searchProperties The properties to search on. This is a
- * key-value list. The keys are property
- * names, and the values the strings to
- * match them on.
- * @param array $requestedProperties This is the list of properties to
- * return for every match.
- * @param string $collectionUri The principal collection to search on.
- * If this is ommitted, the standard
- * principal collection-set will be used.
- * @return array This method returns an array structure similar to
- * Sabre_DAV_Server::getPropertiesForPath. Returned
- * properties are index by a HTTP status code.
- *
- */
- public function principalSearch(array $searchProperties, array $requestedProperties, $collectionUri = null) {
-
- if (!is_null($collectionUri)) {
- $uris = array($collectionUri);
- } else {
- $uris = $this->principalCollectionSet;
- }
-
- $lookupResults = array();
- foreach($uris as $uri) {
-
- $principalCollection = $this->server->tree->getNodeForPath($uri);
- if (!$principalCollection instanceof Sabre_DAVACL_AbstractPrincipalCollection) {
- // Not a principal collection, we're simply going to ignore
- // this.
- continue;
- }
-
- $results = $principalCollection->searchPrincipals($searchProperties);
- foreach($results as $result) {
- $lookupResults[] = rtrim($uri,'/') . '/' . $result;
- }
-
- }
-
- $matches = array();
-
- foreach($lookupResults as $lookupResult) {
-
- list($matches[]) = $this->server->getPropertiesForPath($lookupResult, $requestedProperties, 0);
-
- }
-
- return $matches;
-
- }
-
- /**
- * Sets up the plugin
- *
- * This method is automatically called by the server class.
- *
- * @param Sabre_DAV_Server $server
- * @return void
- */
- public function initialize(Sabre_DAV_Server $server) {
-
- $this->server = $server;
- $server->subscribeEvent('beforeGetProperties',array($this,'beforeGetProperties'));
-
- $server->subscribeEvent('beforeMethod', array($this,'beforeMethod'),20);
- $server->subscribeEvent('beforeBind', array($this,'beforeBind'),20);
- $server->subscribeEvent('beforeUnbind', array($this,'beforeUnbind'),20);
- $server->subscribeEvent('updateProperties',array($this,'updateProperties'));
- $server->subscribeEvent('beforeUnlock', array($this,'beforeUnlock'),20);
- $server->subscribeEvent('report',array($this,'report'));
- $server->subscribeEvent('unknownMethod', array($this, 'unknownMethod'));
-
- array_push($server->protectedProperties,
- '{DAV:}alternate-URI-set',
- '{DAV:}principal-URL',
- '{DAV:}group-membership',
- '{DAV:}principal-collection-set',
- '{DAV:}current-user-principal',
- '{DAV:}supported-privilege-set',
- '{DAV:}current-user-privilege-set',
- '{DAV:}acl',
- '{DAV:}acl-restrictions',
- '{DAV:}inherited-acl-set',
- '{DAV:}owner',
- '{DAV:}group'
- );
-
- // Automatically mapping nodes implementing IPrincipal to the
- // {DAV:}principal resourcetype.
- $server->resourceTypeMapping['Sabre_DAVACL_IPrincipal'] = '{DAV:}principal';
-
- // Mapping the group-member-set property to the HrefList property
- // class.
- $server->propertyMap['{DAV:}group-member-set'] = 'Sabre_DAV_Property_HrefList';
-
- }
-
-
- /* {{{ Event handlers */
-
- /**
- * Triggered before any method is handled
- *
- * @param string $method
- * @param string $uri
- * @return void
- */
- public function beforeMethod($method, $uri) {
-
- $exists = $this->server->tree->nodeExists($uri);
-
- // If the node doesn't exists, none of these checks apply
- if (!$exists) return;
-
- switch($method) {
-
- case 'GET' :
- case 'HEAD' :
- case 'OPTIONS' :
- // For these 3 we only need to know if the node is readable.
- $this->checkPrivileges($uri,'{DAV:}read');
- break;
-
- case 'PUT' :
- case 'LOCK' :
- case 'UNLOCK' :
- // This method requires the write-content priv if the node
- // already exists, and bind on the parent if the node is being
- // created.
- // The bind privilege is handled in the beforeBind event.
- $this->checkPrivileges($uri,'{DAV:}write-content');
- break;
-
-
- case 'PROPPATCH' :
- $this->checkPrivileges($uri,'{DAV:}write-properties');
- break;
-
- case 'ACL' :
- $this->checkPrivileges($uri,'{DAV:}write-acl');
- break;
-
- case 'COPY' :
- case 'MOVE' :
- // Copy requires read privileges on the entire source tree.
- // If the target exists write-content normally needs to be
- // checked, however, we're deleting the node beforehand and
- // creating a new one after, so this is handled by the
- // beforeUnbind event.
- //
- // The creation of the new node is handled by the beforeBind
- // event.
- //
- // If MOVE is used beforeUnbind will also be used to check if
- // the sourcenode can be deleted.
- $this->checkPrivileges($uri,'{DAV:}read',self::R_RECURSIVE);
-
- break;
-
- }
-
- }
-
- /**
- * Triggered before a new node is created.
- *
- * This allows us to check permissions for any operation that creates a
- * new node, such as PUT, MKCOL, MKCALENDAR, LOCK, COPY and MOVE.
- *
- * @param string $uri
- * @return void
- */
- public function beforeBind($uri) {
-
- list($parentUri,$nodeName) = Sabre_DAV_URLUtil::splitPath($uri);
- $this->checkPrivileges($parentUri,'{DAV:}bind');
-
- }
-
- /**
- * Triggered before a node is deleted
- *
- * This allows us to check permissions for any operation that will delete
- * an existing node.
- *
- * @param string $uri
- * @return void
- */
- public function beforeUnbind($uri) {
-
- list($parentUri,$nodeName) = Sabre_DAV_URLUtil::splitPath($uri);
- $this->checkPrivileges($parentUri,'{DAV:}unbind',self::R_RECURSIVEPARENTS);
-
- }
-
- /**
- * Triggered before a node is unlocked.
- *
- * @param string $uri
- * @param Sabre_DAV_Locks_LockInfo $lock
- * @TODO: not yet implemented
- * @return void
- */
- public function beforeUnlock($uri, Sabre_DAV_Locks_LockInfo $lock) {
-
-
- }
-
- /**
- * Triggered before properties are looked up in specific nodes.
- *
- * @param string $uri
- * @param Sabre_DAV_INode $node
- * @param array $requestedProperties
- * @param array $returnedProperties
- * @TODO really should be broken into multiple methods, or even a class.
- * @return bool
- */
- public function beforeGetProperties($uri, Sabre_DAV_INode $node, &$requestedProperties, &$returnedProperties) {
-
- // Checking the read permission
- if (!$this->checkPrivileges($uri,'{DAV:}read',self::R_PARENT,false)) {
-
- // User is not allowed to read properties
- if ($this->hideNodesFromListings) {
- return false;
- }
-
- // Marking all requested properties as '403'.
- foreach($requestedProperties as $key=>$requestedProperty) {
- unset($requestedProperties[$key]);
- $returnedProperties[403][$requestedProperty] = null;
- }
- return;
-
- }
-
- /* Adding principal properties */
- if ($node instanceof Sabre_DAVACL_IPrincipal) {
-
- if (false !== ($index = array_search('{DAV:}alternate-URI-set', $requestedProperties))) {
-
- unset($requestedProperties[$index]);
- $returnedProperties[200]['{DAV:}alternate-URI-set'] = new Sabre_DAV_Property_HrefList($node->getAlternateUriSet());
-
- }
- if (false !== ($index = array_search('{DAV:}principal-URL', $requestedProperties))) {
-
- unset($requestedProperties[$index]);
- $returnedProperties[200]['{DAV:}principal-URL'] = new Sabre_DAV_Property_Href($node->getPrincipalUrl() . '/');
-
- }
- if (false !== ($index = array_search('{DAV:}group-member-set', $requestedProperties))) {
-
- unset($requestedProperties[$index]);
- $returnedProperties[200]['{DAV:}group-member-set'] = new Sabre_DAV_Property_HrefList($node->getGroupMemberSet());
-
- }
- if (false !== ($index = array_search('{DAV:}group-membership', $requestedProperties))) {
-
- unset($requestedProperties[$index]);
- $returnedProperties[200]['{DAV:}group-membership'] = new Sabre_DAV_Property_HrefList($node->getGroupMembership());
-
- }
-
- if (false !== ($index = array_search('{DAV:}displayname', $requestedProperties))) {
-
- $returnedProperties[200]['{DAV:}displayname'] = $node->getDisplayName();
-
- }
-
- }
- if (false !== ($index = array_search('{DAV:}principal-collection-set', $requestedProperties))) {
-
- unset($requestedProperties[$index]);
- $val = $this->principalCollectionSet;
- // Ensuring all collections end with a slash
- foreach($val as $k=>$v) $val[$k] = $v . '/';
- $returnedProperties[200]['{DAV:}principal-collection-set'] = new Sabre_DAV_Property_HrefList($val);
-
- }
- if (false !== ($index = array_search('{DAV:}current-user-principal', $requestedProperties))) {
-
- unset($requestedProperties[$index]);
- if ($url = $this->getCurrentUserPrincipal()) {
- $returnedProperties[200]['{DAV:}current-user-principal'] = new Sabre_DAVACL_Property_Principal(Sabre_DAVACL_Property_Principal::HREF, $url . '/');
- } else {
- $returnedProperties[200]['{DAV:}current-user-principal'] = new Sabre_DAVACL_Property_Principal(Sabre_DAVACL_Property_Principal::UNAUTHENTICATED);
- }
-
- }
- if (false !== ($index = array_search('{DAV:}supported-privilege-set', $requestedProperties))) {
-
- unset($requestedProperties[$index]);
- $returnedProperties[200]['{DAV:}supported-privilege-set'] = new Sabre_DAVACL_Property_SupportedPrivilegeSet($this->getSupportedPrivilegeSet($node));
-
- }
- if (false !== ($index = array_search('{DAV:}current-user-privilege-set', $requestedProperties))) {
-
- if (!$this->checkPrivileges($uri, '{DAV:}read-current-user-privilege-set', self::R_PARENT, false)) {
- $returnedProperties[403]['{DAV:}current-user-privilege-set'] = null;
- unset($requestedProperties[$index]);
- } else {
- $val = $this->getCurrentUserPrivilegeSet($node);
- if (!is_null($val)) {
- unset($requestedProperties[$index]);
- $returnedProperties[200]['{DAV:}current-user-privilege-set'] = new Sabre_DAVACL_Property_CurrentUserPrivilegeSet($val);
- }
- }
-
- }
-
- /* The ACL property contains all the permissions */
- if (false !== ($index = array_search('{DAV:}acl', $requestedProperties))) {
-
- if (!$this->checkPrivileges($uri, '{DAV:}read-acl', self::R_PARENT, false)) {
-
- unset($requestedProperties[$index]);
- $returnedProperties[403]['{DAV:}acl'] = null;
-
- } else {
-
- $acl = $this->getACL($node);
- if (!is_null($acl)) {
- unset($requestedProperties[$index]);
- $returnedProperties[200]['{DAV:}acl'] = new Sabre_DAVACL_Property_Acl($this->getACL($node));
- }
-
- }
-
- }
-
- /* The acl-restrictions property contains information on how privileges
- * must behave.
- */
- if (false !== ($index = array_search('{DAV:}acl-restrictions', $requestedProperties))) {
- unset($requestedProperties[$index]);
- $returnedProperties[200]['{DAV:}acl-restrictions'] = new Sabre_DAVACL_Property_AclRestrictions();
- }
-
- /* Adding ACL properties */
- if ($node instanceof Sabre_DAVACL_IACL) {
-
- if (false !== ($index = array_search('{DAV:}owner', $requestedProperties))) {
-
- unset($requestedProperties[$index]);
- $returnedProperties[200]['{DAV:}owner'] = new Sabre_DAV_Property_Href($node->getOwner() . '/');
-
- }
-
- }
-
- }
-
- /**
- * This method intercepts PROPPATCH methods and make sure the
- * group-member-set is updated correctly.
- *
- * @param array $propertyDelta
- * @param array $result
- * @param Sabre_DAV_INode $node
- * @return bool
- */
- public function updateProperties(&$propertyDelta, &$result, Sabre_DAV_INode $node) {
-
- if (!array_key_exists('{DAV:}group-member-set', $propertyDelta))
- return;
-
- if (is_null($propertyDelta['{DAV:}group-member-set'])) {
- $memberSet = array();
- } elseif ($propertyDelta['{DAV:}group-member-set'] instanceof Sabre_DAV_Property_HrefList) {
- $memberSet = $propertyDelta['{DAV:}group-member-set']->getHrefs();
- } else {
- throw new Sabre_DAV_Exception('The group-member-set property MUST be an instance of Sabre_DAV_Property_HrefList or null');
- }
-
- if (!($node instanceof Sabre_DAVACL_IPrincipal)) {
- $result[403]['{DAV:}group-member-set'] = null;
- unset($propertyDelta['{DAV:}group-member-set']);
-
- // Returning false will stop the updateProperties process
- return false;
- }
-
- $node->setGroupMemberSet($memberSet);
- // We must also clear our cache, just in case
-
- $this->currentUserPrincipalsCache = array();
-
- $result[200]['{DAV:}group-member-set'] = null;
- unset($propertyDelta['{DAV:}group-member-set']);
-
- }
-
- /**
- * This method handles HTTP REPORT requests
- *
- * @param string $reportName
- * @param DOMNode $dom
- * @return bool
- */
- public function report($reportName, $dom) {
-
- switch($reportName) {
-
- case '{DAV:}principal-property-search' :
- $this->principalPropertySearchReport($dom);
- return false;
- case '{DAV:}principal-search-property-set' :
- $this->principalSearchPropertySetReport($dom);
- return false;
- case '{DAV:}expand-property' :
- $this->expandPropertyReport($dom);
- return false;
-
- }
-
- }
-
- /**
- * This event is triggered for any HTTP method that is not known by the
- * webserver.
- *
- * @param string $method
- * @param string $uri
- * @return bool
- */
- public function unknownMethod($method, $uri) {
-
- if ($method!=='ACL') return;
-
- $this->httpACL($uri);
- return false;
-
- }
-
- /**
- * This method is responsible for handling the 'ACL' event.
- *
- * @param string $uri
- * @return void
- */
- public function httpACL($uri) {
-
- $body = $this->server->httpRequest->getBody(true);
- $dom = Sabre_DAV_XMLUtil::loadDOMDocument($body);
-
- $newAcl =
- Sabre_DAVACL_Property_Acl::unserialize($dom->firstChild)
- ->getPrivileges();
-
- // Normalizing urls
- foreach($newAcl as $k=>$newAce) {
- $newAcl[$k]['principal'] = $this->server->calculateUri($newAce['principal']);
- }
-
- $node = $this->server->tree->getNodeForPath($uri);
-
- if (!($node instanceof Sabre_DAVACL_IACL)) {
- throw new Sabre_DAV_Exception_MethodNotAllowed('This node does not support the ACL method');
- }
-
- $oldAcl = $this->getACL($node);
-
- $supportedPrivileges = $this->getFlatPrivilegeSet($node);
-
- /* Checking if protected principals from the existing principal set are
- not overwritten. */
- foreach($oldAcl as $oldAce) {
-
- if (!isset($oldAce['protected']) || !$oldAce['protected']) continue;
-
- $found = false;
- foreach($newAcl as $newAce) {
- if (
- $newAce['privilege'] === $oldAce['privilege'] &&
- $newAce['principal'] === $oldAce['principal'] &&
- $newAce['protected']
- )
- $found = true;
- }
-
- if (!$found)
- throw new Sabre_DAVACL_Exception_AceConflict('This resource contained a protected {DAV:}ace, but this privilege did not occur in the ACL request');
-
- }
-
- foreach($newAcl as $newAce) {
-
- // Do we recognize the privilege
- if (!isset($supportedPrivileges[$newAce['privilege']])) {
- throw new Sabre_DAVACL_Exception_NotSupportedPrivilege('The privilege you specified (' . $newAce['privilege'] . ') is not recognized by this server');
- }
-
- if ($supportedPrivileges[$newAce['privilege']]['abstract']) {
- throw new Sabre_DAVACL_Exception_NoAbstract('The privilege you specified (' . $newAce['privilege'] . ') is an abstract privilege');
- }
-
- // Looking up the principal
- try {
- $principal = $this->server->tree->getNodeForPath($newAce['principal']);
- } catch (Sabre_DAV_Exception_NotFound $e) {
- throw new Sabre_DAVACL_Exception_NotRecognizedPrincipal('The specified principal (' . $newAce['principal'] . ') does not exist');
- }
- if (!($principal instanceof Sabre_DAVACL_IPrincipal)) {
- throw new Sabre_DAVACL_Exception_NotRecognizedPrincipal('The specified uri (' . $newAce['principal'] . ') is not a principal');
- }
-
- }
- $node->setACL($newAcl);
-
- }
-
- /* }}} */
-
- /* Reports {{{ */
-
- /**
- * The expand-property report is defined in RFC3253 section 3-8.
- *
- * This report is very similar to a standard PROPFIND. The difference is
- * that it has the additional ability to look at properties containing a
- * {DAV:}href element, follow that property and grab additional elements
- * there.
- *
- * Other rfc's, such as ACL rely on this report, so it made sense to put
- * it in this plugin.
- *
- * @param DOMElement $dom
- * @return void
- */
- protected function expandPropertyReport($dom) {
-
- $requestedProperties = $this->parseExpandPropertyReportRequest($dom->firstChild->firstChild);
- $depth = $this->server->getHTTPDepth(0);
- $requestUri = $this->server->getRequestUri();
-
- $result = $this->expandProperties($requestUri,$requestedProperties,$depth);
-
- $dom = new DOMDocument('1.0','utf-8');
- $dom->formatOutput = true;
- $multiStatus = $dom->createElement('d:multistatus');
- $dom->appendChild($multiStatus);
-
- // Adding in default namespaces
- foreach($this->server->xmlNamespaces as $namespace=>$prefix) {
-
- $multiStatus->setAttribute('xmlns:' . $prefix,$namespace);
-
- }
-
- foreach($result as $response) {
- $response->serialize($this->server, $multiStatus);
- }
-
- $xml = $dom->saveXML();
- $this->server->httpResponse->setHeader('Content-Type','application/xml; charset=utf-8');
- $this->server->httpResponse->sendStatus(207);
- $this->server->httpResponse->sendBody($xml);
-
- }
-
- /**
- * This method is used by expandPropertyReport to parse
- * out the entire HTTP request.
- *
- * @param DOMElement $node
- * @return array
- */
- protected function parseExpandPropertyReportRequest($node) {
-
- $requestedProperties = array();
- do {
-
- if (Sabre_DAV_XMLUtil::toClarkNotation($node)!=='{DAV:}property') continue;
-
- if ($node->firstChild) {
-
- $children = $this->parseExpandPropertyReportRequest($node->firstChild);
-
- } else {
-
- $children = array();
-
- }
-
- $namespace = $node->getAttribute('namespace');
- if (!$namespace) $namespace = 'DAV:';
-
- $propName = '{'.$namespace.'}' . $node->getAttribute('name');
- $requestedProperties[$propName] = $children;
-
- } while ($node = $node->nextSibling);
-
- return $requestedProperties;
-
- }
-
- /**
- * This method expands all the properties and returns
- * a list with property values
- *
- * @param array $path
- * @param array $requestedProperties the list of required properties
- * @param int $depth
- * @return array
- */
- protected function expandProperties($path, array $requestedProperties, $depth) {
-
- $foundProperties = $this->server->getPropertiesForPath($path, array_keys($requestedProperties), $depth);
-
- $result = array();
-
- foreach($foundProperties as $node) {
-
- foreach($requestedProperties as $propertyName=>$childRequestedProperties) {
-
- // We're only traversing if sub-properties were requested
- if(count($childRequestedProperties)===0) continue;
-
- // We only have to do the expansion if the property was found
- // and it contains an href element.
- if (!array_key_exists($propertyName,$node[200])) continue;
-
- if ($node[200][$propertyName] instanceof Sabre_DAV_Property_IHref) {
- $hrefs = array($node[200][$propertyName]->getHref());
- } elseif ($node[200][$propertyName] instanceof Sabre_DAV_Property_HrefList) {
- $hrefs = $node[200][$propertyName]->getHrefs();
- }
-
- $childProps = array();
- foreach($hrefs as $href) {
- $childProps = array_merge($childProps, $this->expandProperties($href, $childRequestedProperties, 0));
- }
- $node[200][$propertyName] = new Sabre_DAV_Property_ResponseList($childProps);
-
- }
- $result[] = new Sabre_DAV_Property_Response($path, $node);
-
- }
-
- return $result;
-
- }
-
- /**
- * principalSearchPropertySetReport
- *
- * This method responsible for handing the
- * {DAV:}principal-search-property-set report. This report returns a list
- * of properties the client may search on, using the
- * {DAV:}principal-property-search report.
- *
- * @param DOMDocument $dom
- * @return void
- */
- protected function principalSearchPropertySetReport(DOMDocument $dom) {
-
- $httpDepth = $this->server->getHTTPDepth(0);
- if ($httpDepth!==0) {
- throw new Sabre_DAV_Exception_BadRequest('This report is only defined when Depth: 0');
- }
-
- if ($dom->firstChild->hasChildNodes())
- throw new Sabre_DAV_Exception_BadRequest('The principal-search-property-set report element is not allowed to have child elements');
-
- $dom = new DOMDocument('1.0','utf-8');
- $dom->formatOutput = true;
- $root = $dom->createElement('d:principal-search-property-set');
- $dom->appendChild($root);
- // Adding in default namespaces
- foreach($this->server->xmlNamespaces as $namespace=>$prefix) {
-
- $root->setAttribute('xmlns:' . $prefix,$namespace);
-
- }
-
- $nsList = $this->server->xmlNamespaces;
-
- foreach($this->principalSearchPropertySet as $propertyName=>$description) {
-
- $psp = $dom->createElement('d:principal-search-property');
- $root->appendChild($psp);
-
- $prop = $dom->createElement('d:prop');
- $psp->appendChild($prop);
-
- $propName = null;
- preg_match('/^{([^}]*)}(.*)$/',$propertyName,$propName);
-
- $currentProperty = $dom->createElement($nsList[$propName[1]] . ':' . $propName[2]);
- $prop->appendChild($currentProperty);
-
- $descriptionElem = $dom->createElement('d:description');
- $descriptionElem->setAttribute('xml:lang','en');
- $descriptionElem->appendChild($dom->createTextNode($description));
- $psp->appendChild($descriptionElem);
-
-
- }
-
- $this->server->httpResponse->setHeader('Content-Type','application/xml; charset=utf-8');
- $this->server->httpResponse->sendStatus(200);
- $this->server->httpResponse->sendBody($dom->saveXML());
-
- }
-
- /**
- * principalPropertySearchReport
- *
- * This method is responsible for handing the
- * {DAV:}principal-property-search report. This report can be used for
- * clients to search for groups of principals, based on the value of one
- * or more properties.
- *
- * @param DOMDocument $dom
- * @return void
- */
- protected function principalPropertySearchReport(DOMDocument $dom) {
-
- list($searchProperties, $requestedProperties, $applyToPrincipalCollectionSet) = $this->parsePrincipalPropertySearchReportRequest($dom);
-
- $uri = null;
- if (!$applyToPrincipalCollectionSet) {
- $uri = $this->server->getRequestUri();
- }
- $result = $this->principalSearch($searchProperties, $requestedProperties, $uri);
-
- $prefer = $this->server->getHTTPPRefer();
-
- $this->server->httpResponse->sendStatus(207);
- $this->server->httpResponse->setHeader('Content-Type','application/xml; charset=utf-8');
- $this->server->httpResponse->setHeader('Vary','Brief,Prefer');
- $this->server->httpResponse->sendBody($this->server->generateMultiStatus($result, $prefer['return-minimal']));
-
- }
-
- /**
- * parsePrincipalPropertySearchReportRequest
- *
- * This method parses the request body from a
- * {DAV:}principal-property-search report.
- *
- * This method returns an array with two elements:
- * 1. an array with properties to search on, and their values
- * 2. a list of propertyvalues that should be returned for the request.
- *
- * @param DOMDocument $dom
- * @return array
- */
- protected function parsePrincipalPropertySearchReportRequest($dom) {
-
- $httpDepth = $this->server->getHTTPDepth(0);
- if ($httpDepth!==0) {
- throw new Sabre_DAV_Exception_BadRequest('This report is only defined when Depth: 0');
- }
-
- $searchProperties = array();
-
- $applyToPrincipalCollectionSet = false;
-
- // Parsing the search request
- foreach($dom->firstChild->childNodes as $searchNode) {
-
- if (Sabre_DAV_XMLUtil::toClarkNotation($searchNode) == '{DAV:}apply-to-principal-collection-set') {
- $applyToPrincipalCollectionSet = true;
- }
-
- if (Sabre_DAV_XMLUtil::toClarkNotation($searchNode)!=='{DAV:}property-search')
- continue;
-
- $propertyName = null;
- $propertyValue = null;
-
- foreach($searchNode->childNodes as $childNode) {
-
- switch(Sabre_DAV_XMLUtil::toClarkNotation($childNode)) {
-
- case '{DAV:}prop' :
- $property = Sabre_DAV_XMLUtil::parseProperties($searchNode);
- reset($property);
- $propertyName = key($property);
- break;
-
- case '{DAV:}match' :
- $propertyValue = $childNode->textContent;
- break;
-
- }
-
-
- }
-
- if (is_null($propertyName) || is_null($propertyValue))
- throw new Sabre_DAV_Exception_BadRequest('Invalid search request. propertyname: ' . $propertyName . '. propertvvalue: ' . $propertyValue);
-
- $searchProperties[$propertyName] = $propertyValue;
-
- }
-
- return array($searchProperties, array_keys(Sabre_DAV_XMLUtil::parseProperties($dom->firstChild)), $applyToPrincipalCollectionSet);
-
- }
-
-
- /* }}} */
-
-}
diff --git a/3rdparty/Sabre/DAVACL/Principal.php b/3rdparty/Sabre/DAVACL/Principal.php
deleted file mode 100644
index 51c6658afd6..00000000000
--- a/3rdparty/Sabre/DAVACL/Principal.php
+++ /dev/null
@@ -1,279 +0,0 @@
-<?php
-
-/**
- * Principal class
- *
- * This class is a representation of a simple principal
- *
- * Many WebDAV specs require a user to show up in the directory
- * structure.
- *
- * This principal also has basic ACL settings, only allowing the principal
- * access it's own principal.
- *
- * @package Sabre
- * @subpackage DAVACL
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAVACL_Principal extends Sabre_DAV_Node implements Sabre_DAVACL_IPrincipal, Sabre_DAV_IProperties, Sabre_DAVACL_IACL {
-
- /**
- * Struct with principal information.
- *
- * @var array
- */
- protected $principalProperties;
-
- /**
- * Principal backend
- *
- * @var Sabre_DAVACL_IPrincipalBackend
- */
- protected $principalBackend;
-
- /**
- * Creates the principal object
- *
- * @param Sabre_DAVACL_IPrincipalBackend $principalBackend
- * @param array $principalProperties
- */
- public function __construct(Sabre_DAVACL_IPrincipalBackend $principalBackend, array $principalProperties = array()) {
-
- if (!isset($principalProperties['uri'])) {
- throw new Sabre_DAV_Exception('The principal properties must at least contain the \'uri\' key');
- }
- $this->principalBackend = $principalBackend;
- $this->principalProperties = $principalProperties;
-
- }
-
- /**
- * Returns the full principal url
- *
- * @return string
- */
- public function getPrincipalUrl() {
-
- return $this->principalProperties['uri'];
-
- }
-
- /**
- * Returns a list of alternative urls for a principal
- *
- * This can for example be an email address, or ldap url.
- *
- * @return array
- */
- public function getAlternateUriSet() {
-
- $uris = array();
- if (isset($this->principalProperties['{DAV:}alternate-URI-set'])) {
-
- $uris = $this->principalProperties['{DAV:}alternate-URI-set'];
-
- }
-
- if (isset($this->principalProperties['{http://sabredav.org/ns}email-address'])) {
- $uris[] = 'mailto:' . $this->principalProperties['{http://sabredav.org/ns}email-address'];
- }
-
- return array_unique($uris);
-
- }
-
- /**
- * Returns the list of group members
- *
- * If this principal is a group, this function should return
- * all member principal uri's for the group.
- *
- * @return array
- */
- public function getGroupMemberSet() {
-
- return $this->principalBackend->getGroupMemberSet($this->principalProperties['uri']);
-
- }
-
- /**
- * Returns the list of groups this principal is member of
- *
- * If this principal is a member of a (list of) groups, this function
- * should return a list of principal uri's for it's members.
- *
- * @return array
- */
- public function getGroupMembership() {
-
- return $this->principalBackend->getGroupMemberShip($this->principalProperties['uri']);
-
- }
-
-
- /**
- * Sets a list of group members
- *
- * If this principal is a group, this method sets all the group members.
- * The list of members is always overwritten, never appended to.
- *
- * This method should throw an exception if the members could not be set.
- *
- * @param array $groupMembers
- * @return void
- */
- public function setGroupMemberSet(array $groupMembers) {
-
- $this->principalBackend->setGroupMemberSet($this->principalProperties['uri'], $groupMembers);
-
- }
-
-
- /**
- * Returns this principals name.
- *
- * @return string
- */
- public function getName() {
-
- $uri = $this->principalProperties['uri'];
- list(, $name) = Sabre_DAV_URLUtil::splitPath($uri);
- return $name;
-
- }
-
- /**
- * Returns the name of the user
- *
- * @return string
- */
- public function getDisplayName() {
-
- if (isset($this->principalProperties['{DAV:}displayname'])) {
- return $this->principalProperties['{DAV:}displayname'];
- } else {
- return $this->getName();
- }
-
- }
-
- /**
- * Returns a list of properties
- *
- * @param array $requestedProperties
- * @return array
- */
- public function getProperties($requestedProperties) {
-
- $newProperties = array();
- foreach($requestedProperties as $propName) {
-
- if (isset($this->principalProperties[$propName])) {
- $newProperties[$propName] = $this->principalProperties[$propName];
- }
-
- }
-
- return $newProperties;
-
- }
-
- /**
- * Updates this principals properties.
- *
- * @param array $mutations
- * @see Sabre_DAV_IProperties::updateProperties
- * @return bool|array
- */
- public function updateProperties($mutations) {
-
- return $this->principalBackend->updatePrincipal($this->principalProperties['uri'], $mutations);
-
- }
-
- /**
- * Returns the owner principal
- *
- * This must be a url to a principal, or null if there's no owner
- *
- * @return string|null
- */
- public function getOwner() {
-
- return $this->principalProperties['uri'];
-
-
- }
-
- /**
- * Returns a group principal
- *
- * This must be a url to a principal, or null if there's no owner
- *
- * @return string|null
- */
- public function getGroup() {
-
- return null;
-
- }
-
- /**
- * Returns a list of ACE's for this node.
- *
- * Each ACE has the following properties:
- * * 'privilege', a string such as {DAV:}read or {DAV:}write. These are
- * currently the only supported privileges
- * * 'principal', a url to the principal who owns the node
- * * 'protected' (optional), indicating that this ACE is not allowed to
- * be updated.
- *
- * @return array
- */
- public function getACL() {
-
- return array(
- array(
- 'privilege' => '{DAV:}read',
- 'principal' => $this->getPrincipalUrl(),
- 'protected' => true,
- ),
- );
-
- }
-
- /**
- * Updates the ACL
- *
- * This method will receive a list of new ACE's.
- *
- * @param array $acl
- * @return void
- */
- public function setACL(array $acl) {
-
- throw new Sabre_DAV_Exception_MethodNotAllowed('Updating ACLs is not allowed here');
-
- }
-
- /**
- * Returns the list of supported privileges for this node.
- *
- * The returned data structure is a list of nested privileges.
- * See Sabre_DAVACL_Plugin::getDefaultSupportedPrivilegeSet for a simple
- * standard structure.
- *
- * If null is returned from this method, the default privilege set is used,
- * which is fine for most common usecases.
- *
- * @return array|null
- */
- public function getSupportedPrivilegeSet() {
-
- return null;
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAVACL/PrincipalBackend/PDO.php b/3rdparty/Sabre/DAVACL/PrincipalBackend/PDO.php
deleted file mode 100644
index a76b4a9d727..00000000000
--- a/3rdparty/Sabre/DAVACL/PrincipalBackend/PDO.php
+++ /dev/null
@@ -1,427 +0,0 @@
-<?php
-
-/**
- * PDO principal backend
- *
- * This is a simple principal backend that maps exactly to the users table, as
- * used by Sabre_DAV_Auth_Backend_PDO.
- *
- * It assumes all principals are in a single collection. The default collection
- * is 'principals/', but this can be overriden.
- *
- * @package Sabre
- * @subpackage DAVACL
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAVACL_PrincipalBackend_PDO implements Sabre_DAVACL_IPrincipalBackend {
-
- /**
- * pdo
- *
- * @var PDO
- */
- protected $pdo;
-
- /**
- * PDO table name for 'principals'
- *
- * @var string
- */
- protected $tableName;
-
- /**
- * PDO table name for 'group members'
- *
- * @var string
- */
- protected $groupMembersTableName;
-
- /**
- * A list of additional fields to support
- *
- * @var array
- */
- protected $fieldMap = array(
-
- /**
- * This property can be used to display the users' real name.
- */
- '{DAV:}displayname' => array(
- 'dbField' => 'displayname',
- ),
-
- /**
- * This property is actually used by the CardDAV plugin, where it gets
- * mapped to {http://calendarserver.orgi/ns/}me-card.
- *
- * The reason we don't straight-up use that property, is because
- * me-card is defined as a property on the users' addressbook
- * collection.
- */
- '{http://sabredav.org/ns}vcard-url' => array(
- 'dbField' => 'vcardurl',
- ),
- /**
- * This is the users' primary email-address.
- */
- '{http://sabredav.org/ns}email-address' => array(
- 'dbField' => 'email',
- ),
- );
-
- /**
- * Sets up the backend.
- *
- * @param PDO $pdo
- * @param string $tableName
- * @param string $groupMembersTableName
- */
- public function __construct(PDO $pdo, $tableName = 'principals', $groupMembersTableName = 'groupmembers') {
-
- $this->pdo = $pdo;
- $this->tableName = $tableName;
- $this->groupMembersTableName = $groupMembersTableName;
-
- }
-
-
- /**
- * Returns a list of principals based on a prefix.
- *
- * This prefix will often contain something like 'principals'. You are only
- * expected to return principals that are in this base path.
- *
- * You are expected to return at least a 'uri' for every user, you can
- * return any additional properties if you wish so. Common properties are:
- * {DAV:}displayname
- * {http://sabredav.org/ns}email-address - This is a custom SabreDAV
- * field that's actualy injected in a number of other properties. If
- * you have an email address, use this property.
- *
- * @param string $prefixPath
- * @return array
- */
- public function getPrincipalsByPrefix($prefixPath) {
-
- $fields = array(
- 'uri',
- );
-
- foreach($this->fieldMap as $key=>$value) {
- $fields[] = $value['dbField'];
- }
- $result = $this->pdo->query('SELECT '.implode(',', $fields).' FROM '. $this->tableName);
-
- $principals = array();
-
- while($row = $result->fetch(PDO::FETCH_ASSOC)) {
-
- // Checking if the principal is in the prefix
- list($rowPrefix) = Sabre_DAV_URLUtil::splitPath($row['uri']);
- if ($rowPrefix !== $prefixPath) continue;
-
- $principal = array(
- 'uri' => $row['uri'],
- );
- foreach($this->fieldMap as $key=>$value) {
- if ($row[$value['dbField']]) {
- $principal[$key] = $row[$value['dbField']];
- }
- }
- $principals[] = $principal;
-
- }
-
- return $principals;
-
- }
-
- /**
- * Returns a specific principal, specified by it's path.
- * The returned structure should be the exact same as from
- * getPrincipalsByPrefix.
- *
- * @param string $path
- * @return array
- */
- public function getPrincipalByPath($path) {
-
- $fields = array(
- 'id',
- 'uri',
- );
-
- foreach($this->fieldMap as $key=>$value) {
- $fields[] = $value['dbField'];
- }
- $stmt = $this->pdo->prepare('SELECT '.implode(',', $fields).' FROM '. $this->tableName . ' WHERE uri = ?');
- $stmt->execute(array($path));
-
- $row = $stmt->fetch(PDO::FETCH_ASSOC);
- if (!$row) return;
-
- $principal = array(
- 'id' => $row['id'],
- 'uri' => $row['uri'],
- );
- foreach($this->fieldMap as $key=>$value) {
- if ($row[$value['dbField']]) {
- $principal[$key] = $row[$value['dbField']];
- }
- }
- return $principal;
-
- }
-
- /**
- * Updates one ore more webdav properties on a principal.
- *
- * The list of mutations is supplied as an array. Each key in the array is
- * a propertyname, such as {DAV:}displayname.
- *
- * Each value is the actual value to be updated. If a value is null, it
- * must be deleted.
- *
- * This method should be atomic. It must either completely succeed, or
- * completely fail. Success and failure can simply be returned as 'true' or
- * 'false'.
- *
- * It is also possible to return detailed failure information. In that case
- * an array such as this should be returned:
- *
- * array(
- * 200 => array(
- * '{DAV:}prop1' => null,
- * ),
- * 201 => array(
- * '{DAV:}prop2' => null,
- * ),
- * 403 => array(
- * '{DAV:}prop3' => null,
- * ),
- * 424 => array(
- * '{DAV:}prop4' => null,
- * ),
- * );
- *
- * In this previous example prop1 was successfully updated or deleted, and
- * prop2 was succesfully created.
- *
- * prop3 failed to update due to '403 Forbidden' and because of this prop4
- * also could not be updated with '424 Failed dependency'.
- *
- * This last example was actually incorrect. While 200 and 201 could appear
- * in 1 response, if there's any error (403) the other properties should
- * always fail with 423 (failed dependency).
- *
- * But anyway, if you don't want to scratch your head over this, just
- * return true or false.
- *
- * @param string $path
- * @param array $mutations
- * @return array|bool
- */
- public function updatePrincipal($path, $mutations) {
-
- $updateAble = array();
- foreach($mutations as $key=>$value) {
-
- // We are not aware of this field, we must fail.
- if (!isset($this->fieldMap[$key])) {
-
- $response = array(
- 403 => array(
- $key => null,
- ),
- 424 => array(),
- );
-
- // Adding the rest to the response as a 424
- foreach($mutations as $subKey=>$subValue) {
- if ($subKey !== $key) {
- $response[424][$subKey] = null;
- }
- }
- return $response;
- }
-
- $updateAble[$this->fieldMap[$key]['dbField']] = $value;
-
- }
-
- // No fields to update
- $query = "UPDATE " . $this->tableName . " SET ";
-
- $first = true;
- foreach($updateAble as $key => $value) {
- if (!$first) {
- $query.= ', ';
- }
- $first = false;
- $query.= "$key = :$key ";
- }
- $query.='WHERE uri = :uri';
- $stmt = $this->pdo->prepare($query);
- $updateAble['uri'] = $path;
- $stmt->execute($updateAble);
-
- return true;
-
- }
-
- /**
- * This method is used to search for principals matching a set of
- * properties.
- *
- * This search is specifically used by RFC3744's principal-property-search
- * REPORT. You should at least allow searching on
- * http://sabredav.org/ns}email-address.
- *
- * The actual search should be a unicode-non-case-sensitive search. The
- * keys in searchProperties are the WebDAV property names, while the values
- * are the property values to search on.
- *
- * If multiple properties are being searched on, the search should be
- * AND'ed.
- *
- * This method should simply return an array with full principal uri's.
- *
- * If somebody attempted to search on a property the backend does not
- * support, you should simply return 0 results.
- *
- * You can also just return 0 results if you choose to not support
- * searching at all, but keep in mind that this may stop certain features
- * from working.
- *
- * @param string $prefixPath
- * @param array $searchProperties
- * @return array
- */
- public function searchPrincipals($prefixPath, array $searchProperties) {
-
- $query = 'SELECT uri FROM ' . $this->tableName . ' WHERE 1=1 ';
- $values = array();
- foreach($searchProperties as $property => $value) {
-
- switch($property) {
-
- case '{DAV:}displayname' :
- $query.=' AND displayname LIKE ?';
- $values[] = '%' . $value . '%';
- break;
- case '{http://sabredav.org/ns}email-address' :
- $query.=' AND email LIKE ?';
- $values[] = '%' . $value . '%';
- break;
- default :
- // Unsupported property
- return array();
-
- }
-
- }
- $stmt = $this->pdo->prepare($query);
- $stmt->execute($values);
-
- $principals = array();
- while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
-
- // Checking if the principal is in the prefix
- list($rowPrefix) = Sabre_DAV_URLUtil::splitPath($row['uri']);
- if ($rowPrefix !== $prefixPath) continue;
-
- $principals[] = $row['uri'];
-
- }
-
- return $principals;
-
- }
-
- /**
- * Returns the list of members for a group-principal
- *
- * @param string $principal
- * @return array
- */
- public function getGroupMemberSet($principal) {
-
- $principal = $this->getPrincipalByPath($principal);
- if (!$principal) throw new Sabre_DAV_Exception('Principal not found');
-
- $stmt = $this->pdo->prepare('SELECT principals.uri as uri FROM '.$this->groupMembersTableName.' AS groupmembers LEFT JOIN '.$this->tableName.' AS principals ON groupmembers.member_id = principals.id WHERE groupmembers.principal_id = ?');
- $stmt->execute(array($principal['id']));
-
- $result = array();
- while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
- $result[] = $row['uri'];
- }
- return $result;
-
- }
-
- /**
- * Returns the list of groups a principal is a member of
- *
- * @param string $principal
- * @return array
- */
- public function getGroupMembership($principal) {
-
- $principal = $this->getPrincipalByPath($principal);
- if (!$principal) throw new Sabre_DAV_Exception('Principal not found');
-
- $stmt = $this->pdo->prepare('SELECT principals.uri as uri FROM '.$this->groupMembersTableName.' AS groupmembers LEFT JOIN '.$this->tableName.' AS principals ON groupmembers.principal_id = principals.id WHERE groupmembers.member_id = ?');
- $stmt->execute(array($principal['id']));
-
- $result = array();
- while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
- $result[] = $row['uri'];
- }
- return $result;
-
- }
-
- /**
- * Updates the list of group members for a group principal.
- *
- * The principals should be passed as a list of uri's.
- *
- * @param string $principal
- * @param array $members
- * @return void
- */
- public function setGroupMemberSet($principal, array $members) {
-
- // Grabbing the list of principal id's.
- $stmt = $this->pdo->prepare('SELECT id, uri FROM '.$this->tableName.' WHERE uri IN (? ' . str_repeat(', ? ', count($members)) . ');');
- $stmt->execute(array_merge(array($principal), $members));
-
- $memberIds = array();
- $principalId = null;
-
- while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
- if ($row['uri'] == $principal) {
- $principalId = $row['id'];
- } else {
- $memberIds[] = $row['id'];
- }
- }
- if (!$principalId) throw new Sabre_DAV_Exception('Principal not found');
-
- // Wiping out old members
- $stmt = $this->pdo->prepare('DELETE FROM '.$this->groupMembersTableName.' WHERE principal_id = ?;');
- $stmt->execute(array($principalId));
-
- foreach($memberIds as $memberId) {
-
- $stmt = $this->pdo->prepare('INSERT INTO '.$this->groupMembersTableName.' (principal_id, member_id) VALUES (?, ?);');
- $stmt->execute(array($principalId, $memberId));
-
- }
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAVACL/PrincipalCollection.php b/3rdparty/Sabre/DAVACL/PrincipalCollection.php
deleted file mode 100644
index c3e4cb83f23..00000000000
--- a/3rdparty/Sabre/DAVACL/PrincipalCollection.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-
-/**
- * Principals Collection
- *
- * This collection represents a list of users. It uses
- * Sabre_DAV_Auth_Backend to determine which users are available on the list.
- *
- * The users are instances of Sabre_DAV_Auth_Principal
- *
- * @package Sabre
- * @subpackage DAVACL
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAVACL_PrincipalCollection extends Sabre_DAVACL_AbstractPrincipalCollection {
-
- /**
- * This method returns a node for a principal.
- *
- * The passed array contains principal information, and is guaranteed to
- * at least contain a uri item. Other properties may or may not be
- * supplied by the authentication backend.
- *
- * @param array $principal
- * @return Sabre_DAV_INode
- */
- public function getChildForPrincipal(array $principal) {
-
- return new Sabre_DAVACL_Principal($this->principalBackend, $principal);
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAVACL/Property/Acl.php b/3rdparty/Sabre/DAVACL/Property/Acl.php
deleted file mode 100644
index 3f79a8d532e..00000000000
--- a/3rdparty/Sabre/DAVACL/Property/Acl.php
+++ /dev/null
@@ -1,209 +0,0 @@
-<?php
-
-/**
- * This class represents the {DAV:}acl property
- *
- * @package Sabre
- * @subpackage DAVACL
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAVACL_Property_Acl extends Sabre_DAV_Property {
-
- /**
- * List of privileges
- *
- * @var array
- */
- private $privileges;
-
- /**
- * Whether or not the server base url is required to be prefixed when
- * serializing the property.
- *
- * @var boolean
- */
- private $prefixBaseUrl;
-
- /**
- * Constructor
- *
- * This object requires a structure similar to the return value from
- * Sabre_DAVACL_Plugin::getACL().
- *
- * Each privilege is a an array with at least a 'privilege' property, and a
- * 'principal' property. A privilege may have a 'protected' property as
- * well.
- *
- * The prefixBaseUrl should be set to false, if the supplied principal urls
- * are already full urls. If this is kept to true, the servers base url
- * will automatically be prefixed.
- *
- * @param bool $prefixBaseUrl
- * @param array $privileges
- */
- public function __construct(array $privileges, $prefixBaseUrl = true) {
-
- $this->privileges = $privileges;
- $this->prefixBaseUrl = $prefixBaseUrl;
-
- }
-
- /**
- * Returns the list of privileges for this property
- *
- * @return array
- */
- public function getPrivileges() {
-
- return $this->privileges;
-
- }
-
- /**
- * Serializes the property into a DOMElement
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $node
- * @return void
- */
- public function serialize(Sabre_DAV_Server $server,DOMElement $node) {
-
- $doc = $node->ownerDocument;
- foreach($this->privileges as $ace) {
-
- $this->serializeAce($doc, $node, $ace, $server);
-
- }
-
- }
-
- /**
- * Unserializes the {DAV:}acl xml element.
- *
- * @param DOMElement $dom
- * @return Sabre_DAVACL_Property_Acl
- */
- static public function unserialize(DOMElement $dom) {
-
- $privileges = array();
- $xaces = $dom->getElementsByTagNameNS('DAV:','ace');
- for($ii=0; $ii < $xaces->length; $ii++) {
-
- $xace = $xaces->item($ii);
- $principal = $xace->getElementsByTagNameNS('DAV:','principal');
- if ($principal->length !== 1) {
- throw new Sabre_DAV_Exception_BadRequest('Each {DAV:}ace element must have one {DAV:}principal element');
- }
- $principal = Sabre_DAVACL_Property_Principal::unserialize($principal->item(0));
-
- switch($principal->getType()) {
- case Sabre_DAVACL_Property_Principal::HREF :
- $principal = $principal->getHref();
- break;
- case Sabre_DAVACL_Property_Principal::AUTHENTICATED :
- $principal = '{DAV:}authenticated';
- break;
- case Sabre_DAVACL_Property_Principal::UNAUTHENTICATED :
- $principal = '{DAV:}unauthenticated';
- break;
- case Sabre_DAVACL_Property_Principal::ALL :
- $principal = '{DAV:}all';
- break;
-
- }
-
- $protected = false;
-
- if ($xace->getElementsByTagNameNS('DAV:','protected')->length > 0) {
- $protected = true;
- }
-
- $grants = $xace->getElementsByTagNameNS('DAV:','grant');
- if ($grants->length < 1) {
- throw new Sabre_DAV_Exception_NotImplemented('Every {DAV:}ace element must have a {DAV:}grant element. {DAV:}deny is not yet supported');
- }
- $grant = $grants->item(0);
-
- $xprivs = $grant->getElementsByTagNameNS('DAV:','privilege');
- for($jj=0; $jj<$xprivs->length; $jj++) {
-
- $xpriv = $xprivs->item($jj);
-
- $privilegeName = null;
-
- for ($kk=0;$kk<$xpriv->childNodes->length;$kk++) {
-
- $childNode = $xpriv->childNodes->item($kk);
- if ($t = Sabre_DAV_XMLUtil::toClarkNotation($childNode)) {
- $privilegeName = $t;
- break;
- }
- }
- if (is_null($privilegeName)) {
- throw new Sabre_DAV_Exception_BadRequest('{DAV:}privilege elements must have a privilege element contained within them.');
- }
-
- $privileges[] = array(
- 'principal' => $principal,
- 'protected' => $protected,
- 'privilege' => $privilegeName,
- );
-
- }
-
- }
-
- return new self($privileges);
-
- }
-
- /**
- * Serializes a single access control entry.
- *
- * @param DOMDocument $doc
- * @param DOMElement $node
- * @param array $ace
- * @param Sabre_DAV_Server $server
- * @return void
- */
- private function serializeAce($doc,$node,$ace, $server) {
-
- $xace = $doc->createElementNS('DAV:','d:ace');
- $node->appendChild($xace);
-
- $principal = $doc->createElementNS('DAV:','d:principal');
- $xace->appendChild($principal);
- switch($ace['principal']) {
- case '{DAV:}authenticated' :
- $principal->appendChild($doc->createElementNS('DAV:','d:authenticated'));
- break;
- case '{DAV:}unauthenticated' :
- $principal->appendChild($doc->createElementNS('DAV:','d:unauthenticated'));
- break;
- case '{DAV:}all' :
- $principal->appendChild($doc->createElementNS('DAV:','d:all'));
- break;
- default:
- $principal->appendChild($doc->createElementNS('DAV:','d:href',($this->prefixBaseUrl?$server->getBaseUri():'') . $ace['principal'] . '/'));
- }
-
- $grant = $doc->createElementNS('DAV:','d:grant');
- $xace->appendChild($grant);
-
- $privParts = null;
-
- preg_match('/^{([^}]*)}(.*)$/',$ace['privilege'],$privParts);
-
- $xprivilege = $doc->createElementNS('DAV:','d:privilege');
- $grant->appendChild($xprivilege);
-
- $xprivilege->appendChild($doc->createElementNS($privParts[1],'d:'.$privParts[2]));
-
- if (isset($ace['protected']) && $ace['protected'])
- $xace->appendChild($doc->createElement('d:protected'));
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAVACL/Property/AclRestrictions.php b/3rdparty/Sabre/DAVACL/Property/AclRestrictions.php
deleted file mode 100644
index a8b054956dd..00000000000
--- a/3rdparty/Sabre/DAVACL/Property/AclRestrictions.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-
-/**
- * AclRestrictions property
- *
- * This property represents {DAV:}acl-restrictions, as defined in RFC3744.
- *
- * @package Sabre
- * @subpackage DAVACL
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAVACL_Property_AclRestrictions extends Sabre_DAV_Property {
-
- /**
- * Serializes the property into a DOMElement
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $elem
- * @return void
- */
- public function serialize(Sabre_DAV_Server $server,DOMElement $elem) {
-
- $doc = $elem->ownerDocument;
-
- $elem->appendChild($doc->createElementNS('DAV:','d:grant-only'));
- $elem->appendChild($doc->createElementNS('DAV:','d:no-invert'));
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAVACL/Property/CurrentUserPrivilegeSet.php b/3rdparty/Sabre/DAVACL/Property/CurrentUserPrivilegeSet.php
deleted file mode 100644
index 94a29640615..00000000000
--- a/3rdparty/Sabre/DAVACL/Property/CurrentUserPrivilegeSet.php
+++ /dev/null
@@ -1,75 +0,0 @@
-<?php
-
-/**
- * CurrentUserPrivilegeSet
- *
- * This class represents the current-user-privilege-set property. When
- * requested, it contain all the privileges a user has on a specific node.
- *
- * @package Sabre
- * @subpackage DAVACL
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAVACL_Property_CurrentUserPrivilegeSet extends Sabre_DAV_Property {
-
- /**
- * List of privileges
- *
- * @var array
- */
- private $privileges;
-
- /**
- * Creates the object
- *
- * Pass the privileges in clark-notation
- *
- * @param array $privileges
- */
- public function __construct(array $privileges) {
-
- $this->privileges = $privileges;
-
- }
-
- /**
- * Serializes the property in the DOM
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $node
- * @return void
- */
- public function serialize(Sabre_DAV_Server $server,DOMElement $node) {
-
- $doc = $node->ownerDocument;
- foreach($this->privileges as $privName) {
-
- $this->serializePriv($doc,$node,$privName);
-
- }
-
- }
-
- /**
- * Serializes one privilege
- *
- * @param DOMDocument $doc
- * @param DOMElement $node
- * @param string $privName
- * @return void
- */
- protected function serializePriv($doc,$node,$privName) {
-
- $xp = $doc->createElementNS('DAV:','d:privilege');
- $node->appendChild($xp);
-
- $privParts = null;
- preg_match('/^{([^}]*)}(.*)$/',$privName,$privParts);
-
- $xp->appendChild($doc->createElementNS($privParts[1],'d:'.$privParts[2]));
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAVACL/Property/Principal.php b/3rdparty/Sabre/DAVACL/Property/Principal.php
deleted file mode 100644
index 3f681742276..00000000000
--- a/3rdparty/Sabre/DAVACL/Property/Principal.php
+++ /dev/null
@@ -1,160 +0,0 @@
-<?php
-
-/**
- * Principal property
- *
- * The principal property represents a principal from RFC3744 (ACL).
- * The property can be used to specify a principal or pseudo principals.
- *
- * @package Sabre
- * @subpackage DAVACL
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAVACL_Property_Principal extends Sabre_DAV_Property implements Sabre_DAV_Property_IHref {
-
- /**
- * To specify a not-logged-in user, use the UNAUTHENTICATED principal
- */
- const UNAUTHENTICATED = 1;
-
- /**
- * To specify any principal that is logged in, use AUTHENTICATED
- */
- const AUTHENTICATED = 2;
-
- /**
- * Specific principals can be specified with the HREF
- */
- const HREF = 3;
-
- /**
- * Everybody, basically
- */
- const ALL = 4;
-
- /**
- * Principal-type
- *
- * Must be one of the UNAUTHENTICATED, AUTHENTICATED or HREF constants.
- *
- * @var int
- */
- private $type;
-
- /**
- * Url to principal
- *
- * This value is only used for the HREF principal type.
- *
- * @var string
- */
- private $href;
-
- /**
- * Creates the property.
- *
- * The 'type' argument must be one of the type constants defined in this class.
- *
- * 'href' is only required for the HREF type.
- *
- * @param int $type
- * @param string|null $href
- */
- public function __construct($type, $href = null) {
-
- $this->type = $type;
-
- if ($type===self::HREF && is_null($href)) {
- throw new Sabre_DAV_Exception('The href argument must be specified for the HREF principal type.');
- }
- $this->href = $href;
-
- }
-
- /**
- * Returns the principal type
- *
- * @return int
- */
- public function getType() {
-
- return $this->type;
-
- }
-
- /**
- * Returns the principal uri.
- *
- * @return string
- */
- public function getHref() {
-
- return $this->href;
-
- }
-
- /**
- * Serializes the property into a DOMElement.
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $node
- * @return void
- */
- public function serialize(Sabre_DAV_Server $server, DOMElement $node) {
-
- $prefix = $server->xmlNamespaces['DAV:'];
- switch($this->type) {
-
- case self::UNAUTHENTICATED :
- $node->appendChild(
- $node->ownerDocument->createElement($prefix . ':unauthenticated')
- );
- break;
- case self::AUTHENTICATED :
- $node->appendChild(
- $node->ownerDocument->createElement($prefix . ':authenticated')
- );
- break;
- case self::HREF :
- $href = $node->ownerDocument->createElement($prefix . ':href');
- $href->nodeValue = $server->getBaseUri() . $this->href;
- $node->appendChild($href);
- break;
-
- }
-
- }
-
- /**
- * Deserializes a DOM element into a property object.
- *
- * @param DOMElement $dom
- * @return Sabre_DAVACL_Property_Principal
- */
- static public function unserialize(DOMElement $dom) {
-
- $parent = $dom->firstChild;
- while(!Sabre_DAV_XMLUtil::toClarkNotation($parent)) {
- $parent = $parent->nextSibling;
- }
-
- switch(Sabre_DAV_XMLUtil::toClarkNotation($parent)) {
-
- case '{DAV:}unauthenticated' :
- return new self(self::UNAUTHENTICATED);
- case '{DAV:}authenticated' :
- return new self(self::AUTHENTICATED);
- case '{DAV:}href':
- return new self(self::HREF, $parent->textContent);
- case '{DAV:}all':
- return new self(self::ALL);
- default :
- throw new Sabre_DAV_Exception_BadRequest('Unexpected element (' . Sabre_DAV_XMLUtil::toClarkNotation($parent) . '). Could not deserialize');
-
- }
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAVACL/Property/SupportedPrivilegeSet.php b/3rdparty/Sabre/DAVACL/Property/SupportedPrivilegeSet.php
deleted file mode 100644
index 276d57ae093..00000000000
--- a/3rdparty/Sabre/DAVACL/Property/SupportedPrivilegeSet.php
+++ /dev/null
@@ -1,92 +0,0 @@
-<?php
-
-/**
- * SupportedPrivilegeSet property
- *
- * This property encodes the {DAV:}supported-privilege-set property, as defined
- * in rfc3744. Please consult the rfc for details about it's structure.
- *
- * This class expects a structure like the one given from
- * Sabre_DAVACL_Plugin::getSupportedPrivilegeSet as the argument in its
- * constructor.
- *
- * @package Sabre
- * @subpackage DAVACL
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAVACL_Property_SupportedPrivilegeSet extends Sabre_DAV_Property {
-
- /**
- * privileges
- *
- * @var array
- */
- private $privileges;
-
- /**
- * Constructor
- *
- * @param array $privileges
- */
- public function __construct(array $privileges) {
-
- $this->privileges = $privileges;
-
- }
-
- /**
- * Serializes the property into a domdocument.
- *
- * @param Sabre_DAV_Server $server
- * @param DOMElement $node
- * @return void
- */
- public function serialize(Sabre_DAV_Server $server,DOMElement $node) {
-
- $doc = $node->ownerDocument;
- $this->serializePriv($doc, $node, $this->privileges);
-
- }
-
- /**
- * Serializes a property
- *
- * This is a recursive function.
- *
- * @param DOMDocument $doc
- * @param DOMElement $node
- * @param array $privilege
- * @return void
- */
- private function serializePriv($doc,$node,$privilege) {
-
- $xsp = $doc->createElementNS('DAV:','d:supported-privilege');
- $node->appendChild($xsp);
-
- $xp = $doc->createElementNS('DAV:','d:privilege');
- $xsp->appendChild($xp);
-
- $privParts = null;
- preg_match('/^{([^}]*)}(.*)$/',$privilege['privilege'],$privParts);
-
- $xp->appendChild($doc->createElementNS($privParts[1],'d:'.$privParts[2]));
-
- if (isset($privilege['abstract']) && $privilege['abstract']) {
- $xsp->appendChild($doc->createElementNS('DAV:','d:abstract'));
- }
-
- if (isset($privilege['description'])) {
- $xsp->appendChild($doc->createElementNS('DAV:','d:description',$privilege['description']));
- }
-
- if (isset($privilege['aggregates'])) {
- foreach($privilege['aggregates'] as $subPrivilege) {
- $this->serializePriv($doc,$xsp,$subPrivilege);
- }
- }
-
- }
-
-}
diff --git a/3rdparty/Sabre/DAVACL/Version.php b/3rdparty/Sabre/DAVACL/Version.php
deleted file mode 100644
index 084a9c13c89..00000000000
--- a/3rdparty/Sabre/DAVACL/Version.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-/**
- * This class contains the SabreDAV version constants.
- *
- * @package Sabre
- * @subpackage DAVACL
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_DAVACL_Version {
-
- /**
- * Full version number
- */
- const VERSION = '1.7.0';
-
- /**
- * Stability : alpha, beta, stable
- */
- const STABILITY = 'stable';
-
-}
diff --git a/3rdparty/Sabre/DAVACL/includes.php b/3rdparty/Sabre/DAVACL/includes.php
deleted file mode 100644
index 28fa3eed225..00000000000
--- a/3rdparty/Sabre/DAVACL/includes.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-
-/**
- * Sabre_DAVACL includes file
- *
- * Including this file will automatically include all files from the
- * Sabre_DAVACL package.
- *
- * This often allows faster loadtimes, as autoload-speed is often quite slow.
- *
- * @package Sabre
- * @subpackage DAVACL
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-
-// Begin includes
-include __DIR__ . '/AbstractPrincipalCollection.php';
-include __DIR__ . '/Exception/AceConflict.php';
-include __DIR__ . '/Exception/NeedPrivileges.php';
-include __DIR__ . '/Exception/NoAbstract.php';
-include __DIR__ . '/Exception/NotRecognizedPrincipal.php';
-include __DIR__ . '/Exception/NotSupportedPrivilege.php';
-include __DIR__ . '/IACL.php';
-include __DIR__ . '/IPrincipal.php';
-include __DIR__ . '/IPrincipalBackend.php';
-include __DIR__ . '/Plugin.php';
-include __DIR__ . '/Principal.php';
-include __DIR__ . '/PrincipalBackend/PDO.php';
-include __DIR__ . '/PrincipalCollection.php';
-include __DIR__ . '/Property/Acl.php';
-include __DIR__ . '/Property/AclRestrictions.php';
-include __DIR__ . '/Property/CurrentUserPrivilegeSet.php';
-include __DIR__ . '/Property/Principal.php';
-include __DIR__ . '/Property/SupportedPrivilegeSet.php';
-include __DIR__ . '/Version.php';
-// End includes
diff --git a/3rdparty/Sabre/HTTP/AWSAuth.php b/3rdparty/Sabre/HTTP/AWSAuth.php
deleted file mode 100644
index fb8245c8cbf..00000000000
--- a/3rdparty/Sabre/HTTP/AWSAuth.php
+++ /dev/null
@@ -1,227 +0,0 @@
-<?php
-
-/**
- * HTTP AWS Authentication handler
- *
- * Use this class to leverage amazon's AWS authentication header
- *
- * @package Sabre
- * @subpackage HTTP
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_HTTP_AWSAuth extends Sabre_HTTP_AbstractAuth {
-
- /**
- * The signature supplied by the HTTP client
- *
- * @var string
- */
- private $signature = null;
-
- /**
- * The accesskey supplied by the HTTP client
- *
- * @var string
- */
- private $accessKey = null;
-
- /**
- * An error code, if any
- *
- * This value will be filled with one of the ERR_* constants
- *
- * @var int
- */
- public $errorCode = 0;
-
- const ERR_NOAWSHEADER = 1;
- const ERR_MD5CHECKSUMWRONG = 2;
- const ERR_INVALIDDATEFORMAT = 3;
- const ERR_REQUESTTIMESKEWED = 4;
- const ERR_INVALIDSIGNATURE = 5;
-
- /**
- * Gathers all information from the headers
- *
- * This method needs to be called prior to anything else.
- *
- * @return bool
- */
- public function init() {
-
- $authHeader = $this->httpRequest->getHeader('Authorization');
- $authHeader = explode(' ',$authHeader);
-
- if ($authHeader[0]!='AWS' || !isset($authHeader[1])) {
- $this->errorCode = self::ERR_NOAWSHEADER;
- return false;
- }
-
- list($this->accessKey,$this->signature) = explode(':',$authHeader[1]);
-
- return true;
-
- }
-
- /**
- * Returns the username for the request
- *
- * @return string
- */
- public function getAccessKey() {
-
- return $this->accessKey;
-
- }
-
- /**
- * Validates the signature based on the secretKey
- *
- * @param string $secretKey
- * @return bool
- */
- public function validate($secretKey) {
-
- $contentMD5 = $this->httpRequest->getHeader('Content-MD5');
-
- if ($contentMD5) {
- // We need to validate the integrity of the request
- $body = $this->httpRequest->getBody(true);
- $this->httpRequest->setBody($body,true);
-
- if ($contentMD5!=base64_encode(md5($body,true))) {
- // content-md5 header did not match md5 signature of body
- $this->errorCode = self::ERR_MD5CHECKSUMWRONG;
- return false;
- }
-
- }
-
- if (!$requestDate = $this->httpRequest->getHeader('x-amz-date'))
- $requestDate = $this->httpRequest->getHeader('Date');
-
- if (!$this->validateRFC2616Date($requestDate))
- return false;
-
- $amzHeaders = $this->getAmzHeaders();
-
- $signature = base64_encode(
- $this->hmacsha1($secretKey,
- $this->httpRequest->getMethod() . "\n" .
- $contentMD5 . "\n" .
- $this->httpRequest->getHeader('Content-type') . "\n" .
- $requestDate . "\n" .
- $amzHeaders .
- $this->httpRequest->getURI()
- )
- );
-
- if ($this->signature != $signature) {
-
- $this->errorCode = self::ERR_INVALIDSIGNATURE;
- return false;
-
- }
-
- return true;
-
- }
-
-
- /**
- * Returns an HTTP 401 header, forcing login
- *
- * This should be called when username and password are incorrect, or not supplied at all
- *
- * @return void
- */
- public function requireLogin() {
-
- $this->httpResponse->setHeader('WWW-Authenticate','AWS');
- $this->httpResponse->sendStatus(401);
-
- }
-
- /**
- * Makes sure the supplied value is a valid RFC2616 date.
- *
- * If we would just use strtotime to get a valid timestamp, we have no way of checking if a
- * user just supplied the word 'now' for the date header.
- *
- * This function also makes sure the Date header is within 15 minutes of the operating
- * system date, to prevent replay attacks.
- *
- * @param string $dateHeader
- * @return bool
- */
- protected function validateRFC2616Date($dateHeader) {
-
- $date = Sabre_HTTP_Util::parseHTTPDate($dateHeader);
-
- // Unknown format
- if (!$date) {
- $this->errorCode = self::ERR_INVALIDDATEFORMAT;
- return false;
- }
-
- $min = new DateTime('-15 minutes');
- $max = new DateTime('+15 minutes');
-
- // We allow 15 minutes around the current date/time
- if ($date > $max || $date < $min) {
- $this->errorCode = self::ERR_REQUESTTIMESKEWED;
- return false;
- }
-
- return $date;
-
- }
-
- /**
- * Returns a list of AMZ headers
- *
- * @return string
- */
- protected function getAmzHeaders() {
-
- $amzHeaders = array();
- $headers = $this->httpRequest->getHeaders();
- foreach($headers as $headerName => $headerValue) {
- if (strpos(strtolower($headerName),'x-amz-')===0) {
- $amzHeaders[strtolower($headerName)] = str_replace(array("\r\n"),array(' '),$headerValue) . "\n";
- }
- }
- ksort($amzHeaders);
-
- $headerStr = '';
- foreach($amzHeaders as $h=>$v) {
- $headerStr.=$h.':'.$v;
- }
-
- return $headerStr;
-
- }
-
- /**
- * Generates an HMAC-SHA1 signature
- *
- * @param string $key
- * @param string $message
- * @return string
- */
- private function hmacsha1($key, $message) {
-
- $blocksize=64;
- if (strlen($key)>$blocksize)
- $key=pack('H*', sha1($key));
- $key=str_pad($key,$blocksize,chr(0x00));
- $ipad=str_repeat(chr(0x36),$blocksize);
- $opad=str_repeat(chr(0x5c),$blocksize);
- $hmac = pack('H*',sha1(($key^$opad).pack('H*',sha1(($key^$ipad).$message))));
- return $hmac;
-
- }
-
-}
diff --git a/3rdparty/Sabre/HTTP/AbstractAuth.php b/3rdparty/Sabre/HTTP/AbstractAuth.php
deleted file mode 100644
index 3bccabcd1c1..00000000000
--- a/3rdparty/Sabre/HTTP/AbstractAuth.php
+++ /dev/null
@@ -1,111 +0,0 @@
-<?php
-
-/**
- * HTTP Authentication baseclass
- *
- * This class has the common functionality for BasicAuth and DigestAuth
- *
- * @package Sabre
- * @subpackage HTTP
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-abstract class Sabre_HTTP_AbstractAuth {
-
- /**
- * The realm will be displayed in the dialog boxes
- *
- * This identifier can be changed through setRealm()
- *
- * @var string
- */
- protected $realm = 'SabreDAV';
-
- /**
- * HTTP response helper
- *
- * @var Sabre_HTTP_Response
- */
- protected $httpResponse;
-
-
- /**
- * HTTP request helper
- *
- * @var Sabre_HTTP_Request
- */
- protected $httpRequest;
-
- /**
- * __construct
- *
- */
- public function __construct() {
-
- $this->httpResponse = new Sabre_HTTP_Response();
- $this->httpRequest = new Sabre_HTTP_Request();
-
- }
-
- /**
- * Sets an alternative HTTP response object
- *
- * @param Sabre_HTTP_Response $response
- * @return void
- */
- public function setHTTPResponse(Sabre_HTTP_Response $response) {
-
- $this->httpResponse = $response;
-
- }
-
- /**
- * Sets an alternative HTTP request object
- *
- * @param Sabre_HTTP_Request $request
- * @return void
- */
- public function setHTTPRequest(Sabre_HTTP_Request $request) {
-
- $this->httpRequest = $request;
-
- }
-
-
- /**
- * Sets the realm
- *
- * The realm is often displayed in authentication dialog boxes
- * Commonly an application name displayed here
- *
- * @param string $realm
- * @return void
- */
- public function setRealm($realm) {
-
- $this->realm = $realm;
-
- }
-
- /**
- * Returns the realm
- *
- * @return string
- */
- public function getRealm() {
-
- return $this->realm;
-
- }
-
- /**
- * Returns an HTTP 401 header, forcing login
- *
- * This should be called when username and password are incorrect, or not supplied at all
- *
- * @return void
- */
- abstract public function requireLogin();
-
-}
diff --git a/3rdparty/Sabre/HTTP/BasicAuth.php b/3rdparty/Sabre/HTTP/BasicAuth.php
deleted file mode 100644
index f90ed24f5d8..00000000000
--- a/3rdparty/Sabre/HTTP/BasicAuth.php
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-
-/**
- * HTTP Basic Authentication handler
- *
- * Use this class for easy http authentication setup
- *
- * @package Sabre
- * @subpackage HTTP
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_HTTP_BasicAuth extends Sabre_HTTP_AbstractAuth {
-
- /**
- * Returns the supplied username and password.
- *
- * The returned array has two values:
- * * 0 - username
- * * 1 - password
- *
- * If nothing was supplied, 'false' will be returned
- *
- * @return mixed
- */
- public function getUserPass() {
-
- // Apache and mod_php
- if (($user = $this->httpRequest->getRawServerValue('PHP_AUTH_USER')) && ($pass = $this->httpRequest->getRawServerValue('PHP_AUTH_PW'))) {
-
- return array($user,$pass);
-
- }
-
- // Most other webservers
- $auth = $this->httpRequest->getHeader('Authorization');
-
- // Apache could prefix environment variables with REDIRECT_ when urls
- // are passed through mod_rewrite
- if (!$auth) {
- $auth = $this->httpRequest->getRawServerValue('REDIRECT_HTTP_AUTHORIZATION');
- }
-
- if (!$auth) return false;
-
- if (strpos(strtolower($auth),'basic')!==0) return false;
-
- return explode(':', base64_decode(substr($auth, 6)),2);
-
- }
-
- /**
- * Returns an HTTP 401 header, forcing login
- *
- * This should be called when username and password are incorrect, or not supplied at all
- *
- * @return void
- */
- public function requireLogin() {
-
- $this->httpResponse->setHeader('WWW-Authenticate','Basic realm="' . $this->realm . '"');
- $this->httpResponse->sendStatus(401);
-
- }
-
-}
diff --git a/3rdparty/Sabre/HTTP/DigestAuth.php b/3rdparty/Sabre/HTTP/DigestAuth.php
deleted file mode 100644
index ee7f05c08ed..00000000000
--- a/3rdparty/Sabre/HTTP/DigestAuth.php
+++ /dev/null
@@ -1,240 +0,0 @@
-<?php
-
-/**
- * HTTP Digest Authentication handler
- *
- * Use this class for easy http digest authentication.
- * Instructions:
- *
- * 1. Create the object
- * 2. Call the setRealm() method with the realm you plan to use
- * 3. Call the init method function.
- * 4. Call the getUserName() function. This function may return false if no
- * authentication information was supplied. Based on the username you
- * should check your internal database for either the associated password,
- * or the so-called A1 hash of the digest.
- * 5. Call either validatePassword() or validateA1(). This will return true
- * or false.
- * 6. To make sure an authentication prompt is displayed, call the
- * requireLogin() method.
- *
- *
- * @package Sabre
- * @subpackage HTTP
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_HTTP_DigestAuth extends Sabre_HTTP_AbstractAuth {
-
- /**
- * These constants are used in setQOP();
- */
- const QOP_AUTH = 1;
- const QOP_AUTHINT = 2;
-
- protected $nonce;
- protected $opaque;
- protected $digestParts;
- protected $A1;
- protected $qop = self::QOP_AUTH;
-
- /**
- * Initializes the object
- */
- public function __construct() {
-
- $this->nonce = uniqid();
- $this->opaque = md5($this->realm);
- parent::__construct();
-
- }
-
- /**
- * Gathers all information from the headers
- *
- * This method needs to be called prior to anything else.
- *
- * @return void
- */
- public function init() {
-
- $digest = $this->getDigest();
- $this->digestParts = $this->parseDigest($digest);
-
- }
-
- /**
- * Sets the quality of protection value.
- *
- * Possible values are:
- * Sabre_HTTP_DigestAuth::QOP_AUTH
- * Sabre_HTTP_DigestAuth::QOP_AUTHINT
- *
- * Multiple values can be specified using logical OR.
- *
- * QOP_AUTHINT ensures integrity of the request body, but this is not
- * supported by most HTTP clients. QOP_AUTHINT also requires the entire
- * request body to be md5'ed, which can put strains on CPU and memory.
- *
- * @param int $qop
- * @return void
- */
- public function setQOP($qop) {
-
- $this->qop = $qop;
-
- }
-
- /**
- * Validates the user.
- *
- * The A1 parameter should be md5($username . ':' . $realm . ':' . $password);
- *
- * @param string $A1
- * @return bool
- */
- public function validateA1($A1) {
-
- $this->A1 = $A1;
- return $this->validate();
-
- }
-
- /**
- * Validates authentication through a password. The actual password must be provided here.
- * It is strongly recommended not store the password in plain-text and use validateA1 instead.
- *
- * @param string $password
- * @return bool
- */
- public function validatePassword($password) {
-
- $this->A1 = md5($this->digestParts['username'] . ':' . $this->realm . ':' . $password);
- return $this->validate();
-
- }
-
- /**
- * Returns the username for the request
- *
- * @return string
- */
- public function getUsername() {
-
- return $this->digestParts['username'];
-
- }
-
- /**
- * Validates the digest challenge
- *
- * @return bool
- */
- protected function validate() {
-
- $A2 = $this->httpRequest->getMethod() . ':' . $this->digestParts['uri'];
-
- if ($this->digestParts['qop']=='auth-int') {
- // Making sure we support this qop value
- if (!($this->qop & self::QOP_AUTHINT)) return false;
- // We need to add an md5 of the entire request body to the A2 part of the hash
- $body = $this->httpRequest->getBody(true);
- $this->httpRequest->setBody($body,true);
- $A2 .= ':' . md5($body);
- } else {
-
- // We need to make sure we support this qop value
- if (!($this->qop & self::QOP_AUTH)) return false;
- }
-
- $A2 = md5($A2);
-
- $validResponse = md5("{$this->A1}:{$this->digestParts['nonce']}:{$this->digestParts['nc']}:{$this->digestParts['cnonce']}:{$this->digestParts['qop']}:{$A2}");
-
- return $this->digestParts['response']==$validResponse;
-
-
- }
-
- /**
- * Returns an HTTP 401 header, forcing login
- *
- * This should be called when username and password are incorrect, or not supplied at all
- *
- * @return void
- */
- public function requireLogin() {
-
- $qop = '';
- switch($this->qop) {
- case self::QOP_AUTH : $qop = 'auth'; break;
- case self::QOP_AUTHINT : $qop = 'auth-int'; break;
- case self::QOP_AUTH | self::QOP_AUTHINT : $qop = 'auth,auth-int'; break;
- }
-
- $this->httpResponse->setHeader('WWW-Authenticate','Digest realm="' . $this->realm . '",qop="'.$qop.'",nonce="' . $this->nonce . '",opaque="' . $this->opaque . '"');
- $this->httpResponse->sendStatus(401);
-
- }
-
-
- /**
- * This method returns the full digest string.
- *
- * It should be compatibile with mod_php format and other webservers.
- *
- * If the header could not be found, null will be returned
- *
- * @return mixed
- */
- public function getDigest() {
-
- // mod_php
- $digest = $this->httpRequest->getRawServerValue('PHP_AUTH_DIGEST');
- if ($digest) return $digest;
-
- // most other servers
- $digest = $this->httpRequest->getHeader('Authorization');
-
- // Apache could prefix environment variables with REDIRECT_ when urls
- // are passed through mod_rewrite
- if (!$digest) {
- $digest = $this->httpRequest->getRawServerValue('REDIRECT_HTTP_AUTHORIZATION');
- }
-
- if ($digest && strpos(strtolower($digest),'digest')===0) {
- return substr($digest,7);
- } else {
- return null;
- }
-
- }
-
-
- /**
- * Parses the different pieces of the digest string into an array.
- *
- * This method returns false if an incomplete digest was supplied
- *
- * @param string $digest
- * @return mixed
- */
- protected function parseDigest($digest) {
-
- // protect against missing data
- $needed_parts = array('nonce'=>1, 'nc'=>1, 'cnonce'=>1, 'qop'=>1, 'username'=>1, 'uri'=>1, 'response'=>1);
- $data = array();
-
- preg_match_all('@(\w+)=(?:(?:")([^"]+)"|([^\s,$]+))@', $digest, $matches, PREG_SET_ORDER);
-
- foreach ($matches as $m) {
- $data[$m[1]] = $m[2] ? $m[2] : $m[3];
- unset($needed_parts[$m[1]]);
- }
-
- return $needed_parts ? false : $data;
-
- }
-
-}
diff --git a/3rdparty/Sabre/HTTP/Request.php b/3rdparty/Sabre/HTTP/Request.php
deleted file mode 100644
index 74d5ed3d7ee..00000000000
--- a/3rdparty/Sabre/HTTP/Request.php
+++ /dev/null
@@ -1,268 +0,0 @@
-<?php
-
-/**
- * HTTP Request information
- *
- * This object can be used to easily access information about an HTTP request.
- * It can additionally be used to create 'mock' requests.
- *
- * This class mostly operates independent, but because of the nature of a single
- * request per run it can operate as a singleton. For more information check out
- * the behaviour around 'defaultInputStream'.
- *
- * @package Sabre
- * @subpackage HTTP
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_HTTP_Request {
-
- /**
- * PHP's $_SERVER data
- *
- * @var array
- */
- protected $_SERVER;
-
- /**
- * PHP's $_POST data
- *
- * @var array
- */
- protected $_POST;
-
- /**
- * The request body, if any.
- *
- * This is stored in the form of a stream resource.
- *
- * @var resource
- */
- protected $body = null;
-
- /**
- * This will be set as the 'default' inputStream for a specific HTTP request
- * We sometimes need to retain, or rebuild this if we need multiple runs
- * of parsing the original HTTP request.
- *
- * @var resource
- */
- static $defaultInputStream=null;
-
- /**
- * Sets up the object
- *
- * The serverData and postData array can be used to override usage of PHP's
- * global _SERVER and _POST variable respectively.
- *
- * @param array $serverData
- * @param array $postData
- */
- public function __construct(array $serverData = null, array $postData = null) {
-
- if ($serverData) $this->_SERVER = $serverData;
- else $this->_SERVER =& $_SERVER;
-
- if ($postData) $this->_POST = $postData;
- else $this->_POST =& $_POST;
-
- }
-
- /**
- * Returns the value for a specific http header.
- *
- * This method returns null if the header did not exist.
- *
- * @param string $name
- * @return string
- */
- public function getHeader($name) {
-
- $name = strtoupper(str_replace(array('-'),array('_'),$name));
- if (isset($this->_SERVER['HTTP_' . $name])) {
- return $this->_SERVER['HTTP_' . $name];
- }
-
- // There's a few headers that seem to end up in the top-level
- // server array.
- switch($name) {
- case 'CONTENT_TYPE' :
- case 'CONTENT_LENGTH' :
- if (isset($this->_SERVER[$name])) {
- return $this->_SERVER[$name];
- }
- break;
-
- }
- return;
-
- }
-
- /**
- * Returns all (known) HTTP headers.
- *
- * All headers are converted to lower-case, and additionally all underscores
- * are automatically converted to dashes
- *
- * @return array
- */
- public function getHeaders() {
-
- $hdrs = array();
- foreach($this->_SERVER as $key=>$value) {
-
- switch($key) {
- case 'CONTENT_LENGTH' :
- case 'CONTENT_TYPE' :
- $hdrs[strtolower(str_replace('_','-',$key))] = $value;
- break;
- default :
- if (strpos($key,'HTTP_')===0) {
- $hdrs[substr(strtolower(str_replace('_','-',$key)),5)] = $value;
- }
- break;
- }
-
- }
-
- return $hdrs;
-
- }
-
- /**
- * Returns the HTTP request method
- *
- * This is for example POST or GET
- *
- * @return string
- */
- public function getMethod() {
-
- return $this->_SERVER['REQUEST_METHOD'];
-
- }
-
- /**
- * Returns the requested uri
- *
- * @return string
- */
- public function getUri() {
-
- return $this->_SERVER['REQUEST_URI'];
-
- }
-
- /**
- * Will return protocol + the hostname + the uri
- *
- * @return string
- */
- public function getAbsoluteUri() {
-
- // Checking if the request was made through HTTPS. The last in line is for IIS
- $protocol = isset($this->_SERVER['HTTPS']) && ($this->_SERVER['HTTPS']) && ($this->_SERVER['HTTPS']!='off');
- return ($protocol?'https':'http') . '://' . $this->getHeader('Host') . $this->getUri();
-
- }
-
- /**
- * Returns everything after the ? from the current url
- *
- * @return string
- */
- public function getQueryString() {
-
- return isset($this->_SERVER['QUERY_STRING'])?$this->_SERVER['QUERY_STRING']:'';
-
- }
-
- /**
- * Returns the HTTP request body body
- *
- * This method returns a readable stream resource.
- * If the asString parameter is set to true, a string is sent instead.
- *
- * @param bool $asString
- * @return resource
- */
- public function getBody($asString = false) {
-
- if (is_null($this->body)) {
- if (!is_null(self::$defaultInputStream)) {
- $this->body = self::$defaultInputStream;
- } else {
- $this->body = fopen('php://input','r');
- self::$defaultInputStream = $this->body;
- }
- }
- if ($asString) {
- $body = stream_get_contents($this->body);
- return $body;
- } else {
- return $this->body;
- }
-
- }
-
- /**
- * Sets the contents of the HTTP request body
- *
- * This method can either accept a string, or a readable stream resource.
- *
- * If the setAsDefaultInputStream is set to true, it means for this run of the
- * script the supplied body will be used instead of php://input.
- *
- * @param mixed $body
- * @param bool $setAsDefaultInputStream
- * @return void
- */
- public function setBody($body,$setAsDefaultInputStream = false) {
-
- if(is_resource($body)) {
- $this->body = $body;
- } else {
-
- $stream = fopen('php://temp','r+');
- fputs($stream,$body);
- rewind($stream);
- // String is assumed
- $this->body = $stream;
- }
- if ($setAsDefaultInputStream) {
- self::$defaultInputStream = $this->body;
- }
-
- }
-
- /**
- * Returns PHP's _POST variable.
- *
- * The reason this is in a method is so it can be subclassed and
- * overridden.
- *
- * @return array
- */
- public function getPostVars() {
-
- return $this->_POST;
-
- }
-
- /**
- * Returns a specific item from the _SERVER array.
- *
- * Do not rely on this feature, it is for internal use only.
- *
- * @param string $field
- * @return string
- */
- public function getRawServerValue($field) {
-
- return isset($this->_SERVER[$field])?$this->_SERVER[$field]:null;
-
- }
-
-}
-
diff --git a/3rdparty/Sabre/HTTP/Response.php b/3rdparty/Sabre/HTTP/Response.php
deleted file mode 100644
index 9d436881bdf..00000000000
--- a/3rdparty/Sabre/HTTP/Response.php
+++ /dev/null
@@ -1,162 +0,0 @@
-<?php
-
-/**
- * Sabre_HTTP_Response
- *
- * @package Sabre
- * @subpackage HTTP
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_HTTP_Response {
-
- /**
- * Returns a full HTTP status message for an HTTP status code
- *
- * @param int $code
- * @return string
- */
- public function getStatusMessage($code) {
-
- $msg = array(
- 100 => 'Continue',
- 101 => 'Switching Protocols',
- 102 => 'Processing',
- 200 => 'OK',
- 201 => 'Created',
- 202 => 'Accepted',
- 203 => 'Non-Authorative Information',
- 204 => 'No Content',
- 205 => 'Reset Content',
- 206 => 'Partial Content',
- 207 => 'Multi-Status', // RFC 4918
- 208 => 'Already Reported', // RFC 5842
- 226 => 'IM Used', // RFC 3229
- 300 => 'Multiple Choices',
- 301 => 'Moved Permanently',
- 302 => 'Found',
- 303 => 'See Other',
- 304 => 'Not Modified',
- 305 => 'Use Proxy',
- 306 => 'Reserved',
- 307 => 'Temporary Redirect',
- 400 => 'Bad request',
- 401 => 'Unauthorized',
- 402 => 'Payment Required',
- 403 => 'Forbidden',
- 404 => 'Not Found',
- 405 => 'Method Not Allowed',
- 406 => 'Not Acceptable',
- 407 => 'Proxy Authentication Required',
- 408 => 'Request Timeout',
- 409 => 'Conflict',
- 410 => 'Gone',
- 411 => 'Length Required',
- 412 => 'Precondition failed',
- 413 => 'Request Entity Too Large',
- 414 => 'Request-URI Too Long',
- 415 => 'Unsupported Media Type',
- 416 => 'Requested Range Not Satisfiable',
- 417 => 'Expectation Failed',
- 418 => 'I\'m a teapot', // RFC 2324
- 422 => 'Unprocessable Entity', // RFC 4918
- 423 => 'Locked', // RFC 4918
- 424 => 'Failed Dependency', // RFC 4918
- 426 => 'Upgrade required',
- 428 => 'Precondition required', // draft-nottingham-http-new-status
- 429 => 'Too Many Requests', // draft-nottingham-http-new-status
- 431 => 'Request Header Fields Too Large', // draft-nottingham-http-new-status
- 500 => 'Internal Server Error',
- 501 => 'Not Implemented',
- 502 => 'Bad Gateway',
- 503 => 'Service Unavailable',
- 504 => 'Gateway Timeout',
- 505 => 'HTTP Version not supported',
- 506 => 'Variant Also Negotiates',
- 507 => 'Insufficient Storage', // RFC 4918
- 508 => 'Loop Detected', // RFC 5842
- 509 => 'Bandwidth Limit Exceeded', // non-standard
- 510 => 'Not extended',
- 511 => 'Network Authentication Required', // draft-nottingham-http-new-status
- );
-
- return 'HTTP/1.1 ' . $code . ' ' . $msg[$code];
-
- }
-
- // @codeCoverageIgnoreStart
- // We cannot reasonably test header() related methods.
-
- /**
- * Sends an HTTP status header to the client
- *
- * @param int $code HTTP status code
- * @return bool
- */
- public function sendStatus($code) {
-
- if (!headers_sent())
- return header($this->getStatusMessage($code));
- else return false;
-
- }
-
- /**
- * Sets an HTTP header for the response
- *
- * @param string $name
- * @param string $value
- * @param bool $replace
- * @return bool
- */
- public function setHeader($name, $value, $replace = true) {
-
- $value = str_replace(array("\r","\n"),array('\r','\n'),$value);
- if (!headers_sent())
- return header($name . ': ' . $value, $replace);
- else return false;
-
-
- }
- // @codeCoverageIgnoreEnd
-
- /**
- * Sets a bunch of HTTP Headers
- *
- * headersnames are specified as keys, value in the array value
- *
- * @param array $headers
- * @return void
- */
- public function setHeaders(array $headers) {
-
- foreach($headers as $key=>$value)
- $this->setHeader($key, $value);
-
- }
-
- /**
- * Sends the entire response body
- *
- * This method can accept either an open filestream, or a string.
- *
- * @param mixed $body
- * @return void
- */
- public function sendBody($body) {
-
- if (is_resource($body)) {
-
- fpassthru($body);
-
- } else {
-
- // We assume a string
- echo $body;
-
- }
-
- }
-
-}
diff --git a/3rdparty/Sabre/HTTP/Util.php b/3rdparty/Sabre/HTTP/Util.php
deleted file mode 100644
index 67bdd489e1e..00000000000
--- a/3rdparty/Sabre/HTTP/Util.php
+++ /dev/null
@@ -1,82 +0,0 @@
-<?php
-
-/**
- * HTTP utility methods
- *
- * @package Sabre
- * @subpackage HTTP
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @author Paul Voegler
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_HTTP_Util {
-
- /**
- * Parses a RFC2616-compatible date string
- *
- * This method returns false if the date is invalid
- *
- * @param string $dateHeader
- * @return bool|DateTime
- */
- static function parseHTTPDate($dateHeader) {
-
- //RFC 2616 section 3.3.1 Full Date
- //Only the format is checked, valid ranges are checked by strtotime below
- $month = '(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)';
- $weekday = '(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday)';
- $wkday = '(Mon|Tue|Wed|Thu|Fri|Sat|Sun)';
- $time = '[0-2]\d(\:[0-5]\d){2}';
- $date3 = $month . ' ([1-3]\d| \d)';
- $date2 = '[0-3]\d\-' . $month . '\-\d\d';
- //4-digit year cannot begin with 0 - unix timestamp begins in 1970
- $date1 = '[0-3]\d ' . $month . ' [1-9]\d{3}';
-
- //ANSI C's asctime() format
- //4-digit year cannot begin with 0 - unix timestamp begins in 1970
- $asctime_date = $wkday . ' ' . $date3 . ' ' . $time . ' [1-9]\d{3}';
- //RFC 850, obsoleted by RFC 1036
- $rfc850_date = $weekday . ', ' . $date2 . ' ' . $time . ' GMT';
- //RFC 822, updated by RFC 1123
- $rfc1123_date = $wkday . ', ' . $date1 . ' ' . $time . ' GMT';
- //allowed date formats by RFC 2616
- $HTTP_date = "($rfc1123_date|$rfc850_date|$asctime_date)";
-
- //allow for space around the string and strip it
- $dateHeader = trim($dateHeader, ' ');
- if (!preg_match('/^' . $HTTP_date . '$/', $dateHeader))
- return false;
-
- //append implicit GMT timezone to ANSI C time format
- if (strpos($dateHeader, ' GMT') === false)
- $dateHeader .= ' GMT';
-
-
- $realDate = strtotime($dateHeader);
- //strtotime can return -1 or false in case of error
- if ($realDate !== false && $realDate >= 0)
- return new DateTime('@' . $realDate, new DateTimeZone('UTC'));
-
- }
-
- /**
- * Transforms a DateTime object to HTTP's most common date format.
- *
- * We're serializing it as the RFC 1123 date, which, for HTTP must be
- * specified as GMT.
- *
- * @param DateTime $dateTime
- * @return string
- */
- static function toHTTPDate(DateTime $dateTime) {
-
- // We need to clone it, as we don't want to affect the existing
- // DateTime.
- $dateTime = clone $dateTime;
- $dateTime->setTimeZone(new DateTimeZone('GMT'));
- return $dateTime->format('D, d M Y H:i:s \G\M\T');
-
- }
-
-}
diff --git a/3rdparty/Sabre/HTTP/Version.php b/3rdparty/Sabre/HTTP/Version.php
deleted file mode 100644
index 8ccd7c9edf6..00000000000
--- a/3rdparty/Sabre/HTTP/Version.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-/**
- * This class contains the Sabre_HTTP version constants.
- *
- * @package Sabre
- * @subpackage HTTP
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_HTTP_Version {
-
- /**
- * Full version number
- */
- const VERSION = '1.7.0';
-
- /**
- * Stability : alpha, beta, stable
- */
- const STABILITY = 'stable';
-
-}
diff --git a/3rdparty/Sabre/HTTP/includes.php b/3rdparty/Sabre/HTTP/includes.php
deleted file mode 100644
index 9d34bf3a8be..00000000000
--- a/3rdparty/Sabre/HTTP/includes.php
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-
-/**
- * Sabre_HTTP includes file
- *
- * Including this file will automatically include all files from the Sabre_HTTP
- * package.
- *
- * This often allows faster loadtimes, as autoload-speed is often quite slow.
- *
- * @package Sabre
- * @subpackage HTTP
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-
-// Begin includes
-include __DIR__ . '/AbstractAuth.php';
-include __DIR__ . '/AWSAuth.php';
-include __DIR__ . '/BasicAuth.php';
-include __DIR__ . '/DigestAuth.php';
-include __DIR__ . '/Request.php';
-include __DIR__ . '/Response.php';
-include __DIR__ . '/Util.php';
-include __DIR__ . '/Version.php';
-// End includes
diff --git a/3rdparty/Sabre/VObject/Component.php b/3rdparty/Sabre/VObject/Component.php
deleted file mode 100644
index 7604e3a9bb8..00000000000
--- a/3rdparty/Sabre/VObject/Component.php
+++ /dev/null
@@ -1,405 +0,0 @@
-<?php
-
-namespace Sabre\VObject;
-
-/**
- * VObject Component
- *
- * This class represents a VCALENDAR/VCARD component. A component is for example
- * VEVENT, VTODO and also VCALENDAR. It starts with BEGIN:COMPONENTNAME and
- * ends with END:COMPONENTNAME
- *
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Component extends Node {
-
- /**
- * Name, for example VEVENT
- *
- * @var string
- */
- public $name;
-
- /**
- * Children properties and components
- *
- * @var array
- */
- public $children = array();
-
- /**
- * If components are added to this map, they will be automatically mapped
- * to their respective classes, if parsed by the reader or constructed with
- * the 'create' method.
- *
- * @var array
- */
- static public $classMap = array(
- 'VALARM' => 'Sabre\\VObject\\Component\\VAlarm',
- 'VCALENDAR' => 'Sabre\\VObject\\Component\\VCalendar',
- 'VCARD' => 'Sabre\\VObject\\Component\\VCard',
- 'VEVENT' => 'Sabre\\VObject\\Component\\VEvent',
- 'VJOURNAL' => 'Sabre\\VObject\\Component\\VJournal',
- 'VTODO' => 'Sabre\\VObject\\Component\\VTodo',
- 'VFREEBUSY' => 'Sabre\\VObject\\Component\\VFreeBusy',
- );
-
- /**
- * Creates the new component by name, but in addition will also see if
- * there's a class mapped to the property name.
- *
- * @param string $name
- * @param string $value
- * @return Component
- */
- static public function create($name, $value = null) {
-
- $name = strtoupper($name);
-
- if (isset(self::$classMap[$name])) {
- return new self::$classMap[$name]($name, $value);
- } else {
- return new self($name, $value);
- }
-
- }
-
- /**
- * Creates a new component.
- *
- * By default this object will iterate over its own children, but this can
- * be overridden with the iterator argument
- *
- * @param string $name
- * @param ElementList $iterator
- */
- public function __construct($name, ElementList $iterator = null) {
-
- $this->name = strtoupper($name);
- if (!is_null($iterator)) $this->iterator = $iterator;
-
- }
-
- /**
- * Turns the object back into a serialized blob.
- *
- * @return string
- */
- public function serialize() {
-
- $str = "BEGIN:" . $this->name . "\r\n";
-
- /**
- * Gives a component a 'score' for sorting purposes.
- *
- * This is solely used by the childrenSort method.
- *
- * A higher score means the item will be lower in the list.
- * To avoid score collisions, each "score category" has a reasonable
- * space to accomodate elements. The $key is added to the $score to
- * preserve the original relative order of elements.
- *
- * @param int $key
- * @param array $array
- * @return int
- */
- $sortScore = function($key, $array) {
-
- if ($array[$key] instanceof Component) {
-
- // We want to encode VTIMEZONE first, this is a personal
- // preference.
- if ($array[$key]->name === 'VTIMEZONE') {
- $score=300000000;
- return $score+$key;
- } else {
- $score=400000000;
- return $score+$key;
- }
- } else {
- // Properties get encoded first
- // VCARD version 4.0 wants the VERSION property to appear first
- if ($array[$key] instanceof Property) {
- if ($array[$key]->name === 'VERSION') {
- $score=100000000;
- return $score+$key;
- } else {
- // All other properties
- $score=200000000;
- return $score+$key;
- }
- }
- }
-
- };
-
- $tmp = $this->children;
- uksort($this->children, function($a, $b) use ($sortScore, $tmp) {
-
- $sA = $sortScore($a, $tmp);
- $sB = $sortScore($b, $tmp);
-
- if ($sA === $sB) return 0;
-
- return ($sA < $sB) ? -1 : 1;
-
- });
-
- foreach($this->children as $child) $str.=$child->serialize();
- $str.= "END:" . $this->name . "\r\n";
-
- return $str;
-
- }
-
- /**
- * Adds a new component or element
- *
- * You can call this method with the following syntaxes:
- *
- * add(Node $node)
- * add(string $name, $value, array $parameters = array())
- *
- * The first version adds an Element
- * The second adds a property as a string.
- *
- * @param mixed $item
- * @param mixed $itemValue
- * @return void
- */
- public function add($item, $itemValue = null, array $parameters = array()) {
-
- if ($item instanceof Node) {
- if (!is_null($itemValue)) {
- throw new \InvalidArgumentException('The second argument must not be specified, when passing a VObject Node');
- }
- $item->parent = $this;
- $this->children[] = $item;
- } elseif(is_string($item)) {
-
- $item = Property::create($item,$itemValue, $parameters);
- $item->parent = $this;
- $this->children[] = $item;
-
- } else {
-
- throw new \InvalidArgumentException('The first argument must either be a \\Sabre\\VObject\\Node or a string');
-
- }
-
- }
-
- /**
- * Returns an iterable list of children
- *
- * @return ElementList
- */
- public function children() {
-
- return new ElementList($this->children);
-
- }
-
- /**
- * Returns an array with elements that match the specified name.
- *
- * This function is also aware of MIME-Directory groups (as they appear in
- * vcards). This means that if a property is grouped as "HOME.EMAIL", it
- * will also be returned when searching for just "EMAIL". If you want to
- * search for a property in a specific group, you can select on the entire
- * string ("HOME.EMAIL"). If you want to search on a specific property that
- * has not been assigned a group, specify ".EMAIL".
- *
- * Keys are retained from the 'children' array, which may be confusing in
- * certain cases.
- *
- * @param string $name
- * @return array
- */
- public function select($name) {
-
- $group = null;
- $name = strtoupper($name);
- if (strpos($name,'.')!==false) {
- list($group,$name) = explode('.', $name, 2);
- }
-
- $result = array();
- foreach($this->children as $key=>$child) {
-
- if (
- strtoupper($child->name) === $name &&
- (is_null($group) || ( $child instanceof Property && strtoupper($child->group) === $group))
- ) {
-
- $result[$key] = $child;
-
- }
- }
-
- reset($result);
- return $result;
-
- }
-
- /**
- * This method only returns a list of sub-components. Properties are
- * ignored.
- *
- * @return array
- */
- public function getComponents() {
-
- $result = array();
- foreach($this->children as $child) {
- if ($child instanceof Component) {
- $result[] = $child;
- }
- }
-
- return $result;
-
- }
-
- /**
- * Validates the node for correctness.
- *
- * The following options are supported:
- * - Node::REPAIR - If something is broken, and automatic repair may
- * be attempted.
- *
- * An array is returned with warnings.
- *
- * Every item in the array has the following properties:
- * * level - (number between 1 and 3 with severity information)
- * * message - (human readable message)
- * * node - (reference to the offending node)
- *
- * @param int $options
- * @return array
- */
- public function validate($options = 0) {
-
- $result = array();
- foreach($this->children as $child) {
- $result = array_merge($result, $child->validate($options));
- }
- return $result;
-
- }
-
- /* Magic property accessors {{{ */
-
- /**
- * Using 'get' you will either get a property or component,
- *
- * If there were no child-elements found with the specified name,
- * null is returned.
- *
- * @param string $name
- * @return Property
- */
- public function __get($name) {
-
- $matches = $this->select($name);
- if (count($matches)===0) {
- return null;
- } else {
- $firstMatch = current($matches);
- /** @var $firstMatch Property */
- $firstMatch->setIterator(new ElementList(array_values($matches)));
- return $firstMatch;
- }
-
- }
-
- /**
- * This method checks if a sub-element with the specified name exists.
- *
- * @param string $name
- * @return bool
- */
- public function __isset($name) {
-
- $matches = $this->select($name);
- return count($matches)>0;
-
- }
-
- /**
- * Using the setter method you can add properties or subcomponents
- *
- * You can either pass a Component, Property
- * object, or a string to automatically create a Property.
- *
- * If the item already exists, it will be removed. If you want to add
- * a new item with the same name, always use the add() method.
- *
- * @param string $name
- * @param mixed $value
- * @return void
- */
- public function __set($name, $value) {
-
- $matches = $this->select($name);
- $overWrite = count($matches)?key($matches):null;
-
- if ($value instanceof Component || $value instanceof Property) {
- $value->parent = $this;
- if (!is_null($overWrite)) {
- $this->children[$overWrite] = $value;
- } else {
- $this->children[] = $value;
- }
- } elseif (is_scalar($value)) {
- $property = Property::create($name,$value);
- $property->parent = $this;
- if (!is_null($overWrite)) {
- $this->children[$overWrite] = $property;
- } else {
- $this->children[] = $property;
- }
- } else {
- throw new \InvalidArgumentException('You must pass a \\Sabre\\VObject\\Component, \\Sabre\\VObject\\Property or scalar type');
- }
-
- }
-
- /**
- * Removes all properties and components within this component.
- *
- * @param string $name
- * @return void
- */
- public function __unset($name) {
-
- $matches = $this->select($name);
- foreach($matches as $k=>$child) {
-
- unset($this->children[$k]);
- $child->parent = null;
-
- }
-
- }
-
- /* }}} */
-
- /**
- * This method is automatically called when the object is cloned.
- * Specifically, this will ensure all child elements are also cloned.
- *
- * @return void
- */
- public function __clone() {
-
- foreach($this->children as $key=>$child) {
- $this->children[$key] = clone $child;
- $this->children[$key]->parent = $this;
- }
-
- }
-
-}
diff --git a/3rdparty/Sabre/VObject/Component/VAlarm.php b/3rdparty/Sabre/VObject/Component/VAlarm.php
deleted file mode 100644
index 383e16eef14..00000000000
--- a/3rdparty/Sabre/VObject/Component/VAlarm.php
+++ /dev/null
@@ -1,108 +0,0 @@
-<?php
-
-namespace Sabre\VObject\Component;
-use Sabre\VObject;
-
-/**
- * VAlarm component
- *
- * This component contains some additional functionality specific for VALARMs.
- *
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class VAlarm extends VObject\Component {
-
- /**
- * Returns a DateTime object when this alarm is going to trigger.
- *
- * This ignores repeated alarm, only the first trigger is returned.
- *
- * @return DateTime
- */
- public function getEffectiveTriggerTime() {
-
- $trigger = $this->TRIGGER;
- if(!isset($trigger['VALUE']) || strtoupper($trigger['VALUE']) === 'DURATION') {
- $triggerDuration = VObject\DateTimeParser::parseDuration($this->TRIGGER);
- $related = (isset($trigger['RELATED']) && strtoupper($trigger['RELATED']) == 'END') ? 'END' : 'START';
-
- $parentComponent = $this->parent;
- if ($related === 'START') {
-
- if ($parentComponent->name === 'VTODO') {
- $propName = 'DUE';
- } else {
- $propName = 'DTSTART';
- }
-
- $effectiveTrigger = clone $parentComponent->$propName->getDateTime();
- $effectiveTrigger->add($triggerDuration);
- } else {
- if ($parentComponent->name === 'VTODO') {
- $endProp = 'DUE';
- } elseif ($parentComponent->name === 'VEVENT') {
- $endProp = 'DTEND';
- } else {
- throw new \LogicException('time-range filters on VALARM components are only supported when they are a child of VTODO or VEVENT');
- }
-
- if (isset($parentComponent->$endProp)) {
- $effectiveTrigger = clone $parentComponent->$endProp->getDateTime();
- $effectiveTrigger->add($triggerDuration);
- } elseif (isset($parentComponent->DURATION)) {
- $effectiveTrigger = clone $parentComponent->DTSTART->getDateTime();
- $duration = VObject\DateTimeParser::parseDuration($parentComponent->DURATION);
- $effectiveTrigger->add($duration);
- $effectiveTrigger->add($triggerDuration);
- } else {
- $effectiveTrigger = clone $parentComponent->DTSTART->getDateTime();
- $effectiveTrigger->add($triggerDuration);
- }
- }
- } else {
- $effectiveTrigger = $trigger->getDateTime();
- }
- return $effectiveTrigger;
-
- }
-
- /**
- * Returns true or false depending on if the event falls in the specified
- * time-range. This is used for filtering purposes.
- *
- * The rules used to determine if an event falls within the specified
- * time-range is based on the CalDAV specification.
- *
- * @param \DateTime $start
- * @param \DateTime $end
- * @return bool
- */
- public function isInTimeRange(\DateTime $start, \DateTime $end) {
-
- $effectiveTrigger = $this->getEffectiveTriggerTime();
-
- if (isset($this->DURATION)) {
- $duration = VObject\DateTimeParser::parseDuration($this->DURATION);
- $repeat = (string)$this->repeat;
- if (!$repeat) {
- $repeat = 1;
- }
-
- $period = new \DatePeriod($effectiveTrigger, $duration, (int)$repeat);
-
- foreach($period as $occurrence) {
-
- if ($start <= $occurrence && $end > $occurrence) {
- return true;
- }
- }
- return false;
- } else {
- return ($start <= $effectiveTrigger && $end > $effectiveTrigger);
- }
-
- }
-
-}
diff --git a/3rdparty/Sabre/VObject/Component/VCalendar.php b/3rdparty/Sabre/VObject/Component/VCalendar.php
deleted file mode 100644
index 73f2f6d34fc..00000000000
--- a/3rdparty/Sabre/VObject/Component/VCalendar.php
+++ /dev/null
@@ -1,242 +0,0 @@
-<?php
-
-namespace Sabre\VObject\Component;
-
-use Sabre\VObject;
-
-/**
- * The VCalendar component
- *
- * This component adds functionality to a component, specific for a VCALENDAR.
- *
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class VCalendar extends VObject\Component {
-
- /**
- * Returns a list of all 'base components'. For instance, if an Event has
- * a recurrence rule, and one instance is overridden, the overridden event
- * will have the same UID, but will be excluded from this list.
- *
- * VTIMEZONE components will always be excluded.
- *
- * @param string $componentName filter by component name
- * @return array
- */
- public function getBaseComponents($componentName = null) {
-
- $components = array();
- foreach($this->children as $component) {
-
- if (!$component instanceof VObject\Component)
- continue;
-
- if (isset($component->{'RECURRENCE-ID'}))
- continue;
-
- if ($componentName && $component->name !== strtoupper($componentName))
- continue;
-
- if ($component->name === 'VTIMEZONE')
- continue;
-
- $components[] = $component;
-
- }
-
- return $components;
-
- }
-
- /**
- * If this calendar object, has events with recurrence rules, this method
- * can be used to expand the event into multiple sub-events.
- *
- * Each event will be stripped from it's recurrence information, and only
- * the instances of the event in the specified timerange will be left
- * alone.
- *
- * In addition, this method will cause timezone information to be stripped,
- * and normalized to UTC.
- *
- * This method will alter the VCalendar. This cannot be reversed.
- *
- * This functionality is specifically used by the CalDAV standard. It is
- * possible for clients to request expand events, if they are rather simple
- * clients and do not have the possibility to calculate recurrences.
- *
- * @param DateTime $start
- * @param DateTime $end
- * @return void
- */
- public function expand(\DateTime $start, \DateTime $end) {
-
- $newEvents = array();
-
- foreach($this->select('VEVENT') as $key=>$vevent) {
-
- if (isset($vevent->{'RECURRENCE-ID'})) {
- unset($this->children[$key]);
- continue;
- }
-
-
- if (!$vevent->rrule) {
- unset($this->children[$key]);
- if ($vevent->isInTimeRange($start, $end)) {
- $newEvents[] = $vevent;
- }
- continue;
- }
-
- $uid = (string)$vevent->uid;
- if (!$uid) {
- throw new \LogicException('Event did not have a UID!');
- }
-
- $it = new VObject\RecurrenceIterator($this, $vevent->uid);
- $it->fastForward($start);
-
- while($it->valid() && $it->getDTStart() < $end) {
-
- if ($it->getDTEnd() > $start) {
-
- $newEvents[] = $it->getEventObject();
-
- }
- $it->next();
-
- }
- unset($this->children[$key]);
-
- }
-
- foreach($newEvents as $newEvent) {
-
- foreach($newEvent->children as $child) {
- if ($child instanceof VObject\Property\DateTime &&
- $child->getDateType() == VObject\Property\DateTime::LOCALTZ) {
- $child->setDateTime($child->getDateTime(),VObject\Property\DateTime::UTC);
- }
- }
-
- $this->add($newEvent);
-
- }
-
- // Removing all VTIMEZONE components
- unset($this->VTIMEZONE);
-
- }
-
- /**
- * Validates the node for correctness.
- * An array is returned with warnings.
- *
- * Every item in the array has the following properties:
- * * level - (number between 1 and 3 with severity information)
- * * message - (human readable message)
- * * node - (reference to the offending node)
- *
- * @return array
- */
- /*
- public function validate() {
-
- $warnings = array();
-
- $version = $this->select('VERSION');
- if (count($version)!==1) {
- $warnings[] = array(
- 'level' => 1,
- 'message' => 'The VERSION property must appear in the VCALENDAR component exactly 1 time',
- 'node' => $this,
- );
- } else {
- if ((string)$this->VERSION !== '2.0') {
- $warnings[] = array(
- 'level' => 1,
- 'message' => 'Only iCalendar version 2.0 as defined in rfc5545 is supported.',
- 'node' => $this,
- );
- }
- }
- $version = $this->select('PRODID');
- if (count($version)!==1) {
- $warnings[] = array(
- 'level' => 2,
- 'message' => 'The PRODID property must appear in the VCALENDAR component exactly 1 time',
- 'node' => $this,
- );
- }
- if (count($this->CALSCALE) > 1) {
- $warnings[] = array(
- 'level' => 2,
- 'message' => 'The CALSCALE property must not be specified more than once.',
- 'node' => $this,
- );
- }
- if (count($this->METHOD) > 1) {
- $warnings[] = array(
- 'level' => 2,
- 'message' => 'The METHOD property must not be specified more than once.',
- 'node' => $this,
- );
- }
-
- $allowedComponents = array(
- 'VEVENT',
- 'VTODO',
- 'VJOURNAL',
- 'VFREEBUSY',
- 'VTIMEZONE',
- );
- $allowedProperties = array(
- 'PRODID',
- 'VERSION',
- 'CALSCALE',
- 'METHOD',
- );
- $componentsFound = 0;
- foreach($this->children as $child) {
- if($child instanceof Component) {
- $componentsFound++;
- if (!in_array($child->name, $allowedComponents)) {
- $warnings[] = array(
- 'level' => 1,
- 'message' => 'The ' . $child->name . " component is not allowed in the VCALENDAR component",
- 'node' => $this,
- );
- }
- }
- if ($child instanceof Property) {
- if (!in_array($child->name, $allowedProperties)) {
- $warnings[] = array(
- 'level' => 2,
- 'message' => 'The ' . $child->name . " property is not allowed in the VCALENDAR component",
- 'node' => $this,
- );
- }
- }
- }
-
- if ($componentsFound===0) {
- $warnings[] = array(
- 'level' => 1,
- 'message' => 'An iCalendar object must have at least 1 component.',
- 'node' => $this,
- );
- }
-
- return array_merge(
- $warnings,
- parent::validate()
- );
-
- }
- */
-
-}
-
diff --git a/3rdparty/Sabre/VObject/Component/VCard.php b/3rdparty/Sabre/VObject/Component/VCard.php
deleted file mode 100644
index b2926985550..00000000000
--- a/3rdparty/Sabre/VObject/Component/VCard.php
+++ /dev/null
@@ -1,105 +0,0 @@
-<?php
-
-namespace Sabre\VObject\Component;
-
-use Sabre\VObject;
-
-/**
- * The VCard component
- *
- * This component represents the BEGIN:VCARD and END:VCARD found in every
- * vcard.
- *
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class VCard extends VObject\Component {
-
- /**
- * VCards with version 2.1, 3.0 and 4.0 are found.
- *
- * If the VCARD doesn't know its version, 4.0 is assumed.
- */
- const DEFAULT_VERSION = '4.0';
-
- /**
- * Validates the node for correctness.
- *
- * The following options are supported:
- * - Node::REPAIR - If something is broken, and automatic repair may
- * be attempted.
- *
- * An array is returned with warnings.
- *
- * Every item in the array has the following properties:
- * * level - (number between 1 and 3 with severity information)
- * * message - (human readable message)
- * * node - (reference to the offending node)
- *
- * @param int $options
- * @return array
- */
- public function validate($options = 0) {
-
- $warnings = array();
-
- $version = $this->select('VERSION');
- if (count($version)!==1) {
- $warnings[] = array(
- 'level' => 1,
- 'message' => 'The VERSION property must appear in the VCARD component exactly 1 time',
- 'node' => $this,
- );
- if ($options & self::REPAIR) {
- $this->VERSION = self::DEFAULT_VERSION;
- }
- } else {
- $version = (string)$this->VERSION;
- if ($version!=='2.1' && $version!=='3.0' && $version!=='4.0') {
- $warnings[] = array(
- 'level' => 1,
- 'message' => 'Only vcard version 4.0 (RFC6350), version 3.0 (RFC2426) or version 2.1 (icm-vcard-2.1) are supported.',
- 'node' => $this,
- );
- if ($options & self::REPAIR) {
- $this->VERSION = '4.0';
- }
- }
-
- }
- $version = $this->select('FN');
- if (count($version)!==1) {
- $warnings[] = array(
- 'level' => 1,
- 'message' => 'The FN property must appear in the VCARD component exactly 1 time',
- 'node' => $this,
- );
- if (($options & self::REPAIR) && count($version) === 0) {
- // We're going to try to see if we can use the contents of the
- // N property.
- if (isset($this->N)) {
- $value = explode(';', (string)$this->N);
- if (isset($value[1]) && $value[1]) {
- $this->FN = $value[1] . ' ' . $value[0];
- } else {
- $this->FN = $value[0];
- }
-
- // Otherwise, the ORG property may work
- } elseif (isset($this->ORG)) {
- $this->FN = (string)$this->ORG;
- }
-
- }
- }
-
- return array_merge(
- parent::validate($options),
- $warnings
- );
-
- }
-
-}
-
diff --git a/3rdparty/Sabre/VObject/Component/VEvent.php b/3rdparty/Sabre/VObject/Component/VEvent.php
deleted file mode 100644
index 9d10966e203..00000000000
--- a/3rdparty/Sabre/VObject/Component/VEvent.php
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-
-namespace Sabre\VObject\Component;
-use Sabre\VObject;
-
-/**
- * VEvent component
- *
- * This component contains some additional functionality specific for VEVENT's.
- *
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class VEvent extends VObject\Component {
-
- /**
- * Returns true or false depending on if the event falls in the specified
- * time-range. This is used for filtering purposes.
- *
- * The rules used to determine if an event falls within the specified
- * time-range is based on the CalDAV specification.
- *
- * @param \DateTime $start
- * @param \DateTime $end
- * @return bool
- */
- public function isInTimeRange(\DateTime $start, \DateTime $end) {
-
- if ($this->RRULE) {
- $it = new VObject\RecurrenceIterator($this);
- $it->fastForward($start);
-
- // We fast-forwarded to a spot where the end-time of the
- // recurrence instance exceeded the start of the requested
- // time-range.
- //
- // If the starttime of the recurrence did not exceed the
- // end of the time range as well, we have a match.
- return ($it->getDTStart() < $end && $it->getDTEnd() > $start);
-
- }
-
- $effectiveStart = $this->DTSTART->getDateTime();
- if (isset($this->DTEND)) {
-
- // The DTEND property is considered non inclusive. So for a 3 day
- // event in july, dtstart and dtend would have to be July 1st and
- // July 4th respectively.
- //
- // See:
- // http://tools.ietf.org/html/rfc5545#page-54
- $effectiveEnd = $this->DTEND->getDateTime();
-
- } elseif (isset($this->DURATION)) {
- $effectiveEnd = clone $effectiveStart;
- $effectiveEnd->add( VObject\DateTimeParser::parseDuration($this->DURATION) );
- } elseif ($this->DTSTART->getDateType() == VObject\Property\DateTime::DATE) {
- $effectiveEnd = clone $effectiveStart;
- $effectiveEnd->modify('+1 day');
- } else {
- $effectiveEnd = clone $effectiveStart;
- }
- return (
- ($start <= $effectiveEnd) && ($end > $effectiveStart)
- );
-
- }
-
-}
diff --git a/3rdparty/Sabre/VObject/Component/VFreeBusy.php b/3rdparty/Sabre/VObject/Component/VFreeBusy.php
deleted file mode 100644
index d6da52cbd77..00000000000
--- a/3rdparty/Sabre/VObject/Component/VFreeBusy.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-
-namespace Sabre\VObject\Component;
-
-use Sabre\VObject;
-
-/**
- * The VFreeBusy component
- *
- * This component adds functionality to a component, specific for VFREEBUSY
- * components.
- *
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class VFreeBusy extends VObject\Component {
-
- /**
- * Checks based on the contained FREEBUSY information, if a timeslot is
- * available.
- *
- * @param DateTime $start
- * @param Datetime $end
- * @return bool
- */
- public function isFree(\DateTime $start, \Datetime $end) {
-
- foreach($this->select('FREEBUSY') as $freebusy) {
-
- // We are only interested in FBTYPE=BUSY (the default),
- // FBTYPE=BUSY-TENTATIVE or FBTYPE=BUSY-UNAVAILABLE.
- if (isset($freebusy['FBTYPE']) && strtoupper(substr((string)$freebusy['FBTYPE'],0,4))!=='BUSY') {
- continue;
- }
-
- // The freebusy component can hold more than 1 value, separated by
- // commas.
- $periods = explode(',', (string)$freebusy);
-
- foreach($periods as $period) {
- // Every period is formatted as [start]/[end]. The start is an
- // absolute UTC time, the end may be an absolute UTC time, or
- // duration (relative) value.
- list($busyStart, $busyEnd) = explode('/', $period);
-
- $busyStart = VObject\DateTimeParser::parse($busyStart);
- $busyEnd = VObject\DateTimeParser::parse($busyEnd);
- if ($busyEnd instanceof \DateInterval) {
- $tmp = clone $busyStart;
- $tmp->add($busyEnd);
- $busyEnd = $tmp;
- }
-
- if($start < $busyEnd && $end > $busyStart) {
- return false;
- }
-
- }
-
- }
-
- return true;
-
- }
-
-}
-
diff --git a/3rdparty/Sabre/VObject/Component/VJournal.php b/3rdparty/Sabre/VObject/Component/VJournal.php
deleted file mode 100644
index f104a1f66ed..00000000000
--- a/3rdparty/Sabre/VObject/Component/VJournal.php
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-
-namespace Sabre\VObject\Component;
-
-use Sabre\VObject;
-
-/**
- * VJournal component
- *
- * This component contains some additional functionality specific for VJOURNALs.
- *
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class VJournal extends VObject\Component {
-
- /**
- * Returns true or false depending on if the event falls in the specified
- * time-range. This is used for filtering purposes.
- *
- * The rules used to determine if an event falls within the specified
- * time-range is based on the CalDAV specification.
- *
- * @param DateTime $start
- * @param DateTime $end
- * @return bool
- */
- public function isInTimeRange(\DateTime $start, \DateTime $end) {
-
- $dtstart = isset($this->DTSTART)?$this->DTSTART->getDateTime():null;
- if ($dtstart) {
- $effectiveEnd = clone $dtstart;
- if ($this->DTSTART->getDateType() == VObject\Property\DateTime::DATE) {
- $effectiveEnd->modify('+1 day');
- }
-
- return ($start <= $effectiveEnd && $end > $dtstart);
-
- }
- return false;
-
-
- }
-
-}
diff --git a/3rdparty/Sabre/VObject/Component/VTodo.php b/3rdparty/Sabre/VObject/Component/VTodo.php
deleted file mode 100644
index 5f879aea435..00000000000
--- a/3rdparty/Sabre/VObject/Component/VTodo.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-
-namespace Sabre\VObject\Component;
-
-use Sabre\VObject;
-
-/**
- * VTodo component
- *
- * This component contains some additional functionality specific for VTODOs.
- *
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class VTodo extends VObject\Component {
-
- /**
- * Returns true or false depending on if the event falls in the specified
- * time-range. This is used for filtering purposes.
- *
- * The rules used to determine if an event falls within the specified
- * time-range is based on the CalDAV specification.
- *
- * @param DateTime $start
- * @param DateTime $end
- * @return bool
- */
- public function isInTimeRange(\DateTime $start, \DateTime $end) {
-
- $dtstart = isset($this->DTSTART)?$this->DTSTART->getDateTime():null;
- $duration = isset($this->DURATION)?VObject\DateTimeParser::parseDuration($this->DURATION):null;
- $due = isset($this->DUE)?$this->DUE->getDateTime():null;
- $completed = isset($this->COMPLETED)?$this->COMPLETED->getDateTime():null;
- $created = isset($this->CREATED)?$this->CREATED->getDateTime():null;
-
- if ($dtstart) {
- if ($duration) {
- $effectiveEnd = clone $dtstart;
- $effectiveEnd->add($duration);
- return $start <= $effectiveEnd && $end > $dtstart;
- } elseif ($due) {
- return
- ($start < $due || $start <= $dtstart) &&
- ($end > $dtstart || $end >= $due);
- } else {
- return $start <= $dtstart && $end > $dtstart;
- }
- }
- if ($due) {
- return ($start < $due && $end >= $due);
- }
- if ($completed && $created) {
- return
- ($start <= $created || $start <= $completed) &&
- ($end >= $created || $end >= $completed);
- }
- if ($completed) {
- return ($start <= $completed && $end >= $completed);
- }
- if ($created) {
- return ($end > $created);
- }
- return true;
-
- }
-
-}
diff --git a/3rdparty/Sabre/VObject/DateTimeParser.php b/3rdparty/Sabre/VObject/DateTimeParser.php
deleted file mode 100644
index d09ded96768..00000000000
--- a/3rdparty/Sabre/VObject/DateTimeParser.php
+++ /dev/null
@@ -1,181 +0,0 @@
-<?php
-
-namespace Sabre\VObject;
-
-/**
- * DateTimeParser
- *
- * This class is responsible for parsing the several different date and time
- * formats iCalendar and vCards have.
- *
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class DateTimeParser {
-
- /**
- * Parses an iCalendar (rfc5545) formatted datetime and returns a DateTime object
- *
- * Specifying a reference timezone is optional. It will only be used
- * if the non-UTC format is used. The argument is used as a reference, the
- * returned DateTime object will still be in the UTC timezone.
- *
- * @param string $dt
- * @param DateTimeZone $tz
- * @return DateTime
- */
- static public function parseDateTime($dt,\DateTimeZone $tz = null) {
-
- // Format is YYYYMMDD + "T" + hhmmss
- $result = preg_match('/^([1-4][0-9]{3})([0-1][0-9])([0-3][0-9])T([0-2][0-9])([0-5][0-9])([0-5][0-9])([Z]?)$/',$dt,$matches);
-
- if (!$result) {
- throw new \LogicException('The supplied iCalendar datetime value is incorrect: ' . $dt);
- }
-
- if ($matches[7]==='Z' || is_null($tz)) {
- $tz = new \DateTimeZone('UTC');
- }
- $date = new \DateTime($matches[1] . '-' . $matches[2] . '-' . $matches[3] . ' ' . $matches[4] . ':' . $matches[5] .':' . $matches[6], $tz);
-
- // Still resetting the timezone, to normalize everything to UTC
- $date->setTimeZone(new \DateTimeZone('UTC'));
- return $date;
-
- }
-
- /**
- * Parses an iCalendar (rfc5545) formatted date and returns a DateTime object
- *
- * @param string $date
- * @return DateTime
- */
- static public function parseDate($date) {
-
- // Format is YYYYMMDD
- $result = preg_match('/^([1-4][0-9]{3})([0-1][0-9])([0-3][0-9])$/',$date,$matches);
-
- if (!$result) {
- throw new \LogicException('The supplied iCalendar date value is incorrect: ' . $date);
- }
-
- $date = new \DateTime($matches[1] . '-' . $matches[2] . '-' . $matches[3], new \DateTimeZone('UTC'));
- return $date;
-
- }
-
- /**
- * Parses an iCalendar (RFC5545) formatted duration value.
- *
- * This method will either return a DateTimeInterval object, or a string
- * suitable for strtotime or DateTime::modify.
- *
- * @param string $duration
- * @param bool $asString
- * @return DateInterval|string
- */
- static public function parseDuration($duration, $asString = false) {
-
- $result = preg_match('/^(?P<plusminus>\+|-)?P((?P<week>\d+)W)?((?P<day>\d+)D)?(T((?P<hour>\d+)H)?((?P<minute>\d+)M)?((?P<second>\d+)S)?)?$/', $duration, $matches);
- if (!$result) {
- throw new \LogicException('The supplied iCalendar duration value is incorrect: ' . $duration);
- }
-
- if (!$asString) {
- $invert = false;
- if ($matches['plusminus']==='-') {
- $invert = true;
- }
-
-
- $parts = array(
- 'week',
- 'day',
- 'hour',
- 'minute',
- 'second',
- );
- foreach($parts as $part) {
- $matches[$part] = isset($matches[$part])&&$matches[$part]?(int)$matches[$part]:0;
- }
-
-
- // We need to re-construct the $duration string, because weeks and
- // days are not supported by DateInterval in the same string.
- $duration = 'P';
- $days = $matches['day'];
- if ($matches['week']) {
- $days+=$matches['week']*7;
- }
- if ($days)
- $duration.=$days . 'D';
-
- if ($matches['minute'] || $matches['second'] || $matches['hour']) {
- $duration.='T';
-
- if ($matches['hour'])
- $duration.=$matches['hour'].'H';
-
- if ($matches['minute'])
- $duration.=$matches['minute'].'M';
-
- if ($matches['second'])
- $duration.=$matches['second'].'S';
-
- }
-
- if ($duration==='P') {
- $duration = 'PT0S';
- }
- $iv = new \DateInterval($duration);
- if ($invert) $iv->invert = true;
-
- return $iv;
-
- }
-
-
-
- $parts = array(
- 'week',
- 'day',
- 'hour',
- 'minute',
- 'second',
- );
-
- $newDur = '';
- foreach($parts as $part) {
- if (isset($matches[$part]) && $matches[$part]) {
- $newDur.=' '.$matches[$part] . ' ' . $part . 's';
- }
- }
-
- $newDur = ($matches['plusminus']==='-'?'-':'+') . trim($newDur);
- if ($newDur === '+') { $newDur = '+0 seconds'; };
- return $newDur;
-
- }
-
- /**
- * Parses either a Date or DateTime, or Duration value.
- *
- * @param string $date
- * @param DateTimeZone|string $referenceTZ
- * @return DateTime|DateInterval
- */
- static public function parse($date, $referenceTZ = null) {
-
- if ($date[0]==='P' || ($date[0]==='-' && $date[1]==='P')) {
- return self::parseDuration($date);
- } elseif (strlen($date)===8) {
- return self::parseDate($date);
- } else {
- return self::parseDateTime($date, $referenceTZ);
- }
-
- }
-
-
-}
diff --git a/3rdparty/Sabre/VObject/ElementList.php b/3rdparty/Sabre/VObject/ElementList.php
deleted file mode 100644
index b7f1c8eee22..00000000000
--- a/3rdparty/Sabre/VObject/ElementList.php
+++ /dev/null
@@ -1,172 +0,0 @@
-<?php
-
-namespace Sabre\VObject;
-
-/**
- * VObject ElementList
- *
- * This class represents a list of elements. Lists are the result of queries,
- * such as doing $vcalendar->vevent where there's multiple VEVENT objects.
- *
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class ElementList implements \Iterator, \Countable, \ArrayAccess {
-
- /**
- * Inner elements
- *
- * @var array
- */
- protected $elements = array();
-
- /**
- * Creates the element list.
- *
- * @param array $elements
- */
- public function __construct(array $elements) {
-
- $this->elements = $elements;
-
- }
-
- /* {{{ Iterator interface */
-
- /**
- * Current position
- *
- * @var int
- */
- private $key = 0;
-
- /**
- * Returns current item in iteration
- *
- * @return Element
- */
- public function current() {
-
- return $this->elements[$this->key];
-
- }
-
- /**
- * To the next item in the iterator
- *
- * @return void
- */
- public function next() {
-
- $this->key++;
-
- }
-
- /**
- * Returns the current iterator key
- *
- * @return int
- */
- public function key() {
-
- return $this->key;
-
- }
-
- /**
- * Returns true if the current position in the iterator is a valid one
- *
- * @return bool
- */
- public function valid() {
-
- return isset($this->elements[$this->key]);
-
- }
-
- /**
- * Rewinds the iterator
- *
- * @return void
- */
- public function rewind() {
-
- $this->key = 0;
-
- }
-
- /* }}} */
-
- /* {{{ Countable interface */
-
- /**
- * Returns the number of elements
- *
- * @return int
- */
- public function count() {
-
- return count($this->elements);
-
- }
-
- /* }}} */
-
- /* {{{ ArrayAccess Interface */
-
-
- /**
- * Checks if an item exists through ArrayAccess.
- *
- * @param int $offset
- * @return bool
- */
- public function offsetExists($offset) {
-
- return isset($this->elements[$offset]);
-
- }
-
- /**
- * Gets an item through ArrayAccess.
- *
- * @param int $offset
- * @return mixed
- */
- public function offsetGet($offset) {
-
- return $this->elements[$offset];
-
- }
-
- /**
- * Sets an item through ArrayAccess.
- *
- * @param int $offset
- * @param mixed $value
- * @return void
- */
- public function offsetSet($offset,$value) {
-
- throw new \LogicException('You can not add new objects to an ElementList');
-
- }
-
- /**
- * Sets an item through ArrayAccess.
- *
- * This method just forwards the request to the inner iterator
- *
- * @param int $offset
- * @return void
- */
- public function offsetUnset($offset) {
-
- throw new \LogicException('You can not remove objects from an ElementList');
-
- }
-
- /* }}} */
-
-}
diff --git a/3rdparty/Sabre/VObject/FreeBusyGenerator.php b/3rdparty/Sabre/VObject/FreeBusyGenerator.php
deleted file mode 100644
index c607d119ced..00000000000
--- a/3rdparty/Sabre/VObject/FreeBusyGenerator.php
+++ /dev/null
@@ -1,322 +0,0 @@
-<?php
-
-namespace Sabre\VObject;
-
-/**
- * This class helps with generating FREEBUSY reports based on existing sets of
- * objects.
- *
- * It only looks at VEVENT and VFREEBUSY objects from the sourcedata, and
- * generates a single VFREEBUSY object.
- *
- * VFREEBUSY components are described in RFC5545, The rules for what should
- * go in a single freebusy report is taken from RFC4791, section 7.10.
- *
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class FreeBusyGenerator {
-
- /**
- * Input objects
- *
- * @var array
- */
- protected $objects;
-
- /**
- * Start of range
- *
- * @var DateTime|null
- */
- protected $start;
-
- /**
- * End of range
- *
- * @var DateTime|null
- */
- protected $end;
-
- /**
- * VCALENDAR object
- *
- * @var Component
- */
- protected $baseObject;
-
- /**
- * Creates the generator.
- *
- * Check the setTimeRange and setObjects methods for details about the
- * arguments.
- *
- * @param DateTime $start
- * @param DateTime $end
- * @param mixed $objects
- * @return void
- */
- public function __construct(\DateTime $start = null, \DateTime $end = null, $objects = null) {
-
- if ($start && $end) {
- $this->setTimeRange($start, $end);
- }
-
- if ($objects) {
- $this->setObjects($objects);
- }
-
- }
-
- /**
- * Sets the VCALENDAR object.
- *
- * If this is set, it will not be generated for you. You are responsible
- * for setting things like the METHOD, CALSCALE, VERSION, etc..
- *
- * The VFREEBUSY object will be automatically added though.
- *
- * @param Component $vcalendar
- * @return void
- */
- public function setBaseObject(Component $vcalendar) {
-
- $this->baseObject = $vcalendar;
-
- }
-
- /**
- * Sets the input objects
- *
- * You must either specify a valendar object as a strong, or as the parse
- * Component.
- * It's also possible to specify multiple objects as an array.
- *
- * @param mixed $objects
- * @return void
- */
- public function setObjects($objects) {
-
- if (!is_array($objects)) {
- $objects = array($objects);
- }
-
- $this->objects = array();
- foreach($objects as $object) {
-
- if (is_string($object)) {
- $this->objects[] = Reader::read($object);
- } elseif ($object instanceof Component) {
- $this->objects[] = $object;
- } else {
- throw new \InvalidArgumentException('You can only pass strings or \\Sabre\\VObject\\Component arguments to setObjects');
- }
-
- }
-
- }
-
- /**
- * Sets the time range
- *
- * Any freebusy object falling outside of this time range will be ignored.
- *
- * @param DateTime $start
- * @param DateTime $end
- * @return void
- */
- public function setTimeRange(\DateTime $start = null, \DateTime $end = null) {
-
- $this->start = $start;
- $this->end = $end;
-
- }
-
- /**
- * Parses the input data and returns a correct VFREEBUSY object, wrapped in
- * a VCALENDAR.
- *
- * @return Component
- */
- public function getResult() {
-
- $busyTimes = array();
-
- foreach($this->objects as $object) {
-
- foreach($object->getBaseComponents() as $component) {
-
- switch($component->name) {
-
- case 'VEVENT' :
-
- $FBTYPE = 'BUSY';
- if (isset($component->TRANSP) && (strtoupper($component->TRANSP) === 'TRANSPARENT')) {
- break;
- }
- if (isset($component->STATUS)) {
- $status = strtoupper($component->STATUS);
- if ($status==='CANCELLED') {
- break;
- }
- if ($status==='TENTATIVE') {
- $FBTYPE = 'BUSY-TENTATIVE';
- }
- }
-
- $times = array();
-
- if ($component->RRULE) {
-
- $iterator = new RecurrenceIterator($object, (string)$component->uid);
- if ($this->start) {
- $iterator->fastForward($this->start);
- }
-
- $maxRecurrences = 200;
-
- while($iterator->valid() && --$maxRecurrences) {
-
- $startTime = $iterator->getDTStart();
- if ($this->end && $startTime > $this->end) {
- break;
- }
- $times[] = array(
- $iterator->getDTStart(),
- $iterator->getDTEnd(),
- );
-
- $iterator->next();
-
- }
-
- } else {
-
- $startTime = $component->DTSTART->getDateTime();
- if ($this->end && $startTime > $this->end) {
- break;
- }
- $endTime = null;
- if (isset($component->DTEND)) {
- $endTime = $component->DTEND->getDateTime();
- } elseif (isset($component->DURATION)) {
- $duration = DateTimeParser::parseDuration((string)$component->DURATION);
- $endTime = clone $startTime;
- $endTime->add($duration);
- } elseif ($component->DTSTART->getDateType() === Property\DateTime::DATE) {
- $endTime = clone $startTime;
- $endTime->modify('+1 day');
- } else {
- // The event had no duration (0 seconds)
- break;
- }
-
- $times[] = array($startTime, $endTime);
-
- }
-
- foreach($times as $time) {
-
- if ($this->end && $time[0] > $this->end) break;
- if ($this->start && $time[1] < $this->start) break;
-
- $busyTimes[] = array(
- $time[0],
- $time[1],
- $FBTYPE,
- );
- }
- break;
-
- case 'VFREEBUSY' :
- foreach($component->FREEBUSY as $freebusy) {
-
- $fbType = isset($freebusy['FBTYPE'])?strtoupper($freebusy['FBTYPE']):'BUSY';
-
- // Skipping intervals marked as 'free'
- if ($fbType==='FREE')
- continue;
-
- $values = explode(',', $freebusy);
- foreach($values as $value) {
- list($startTime, $endTime) = explode('/', $value);
- $startTime = DateTimeParser::parseDateTime($startTime);
-
- if (substr($endTime,0,1)==='P' || substr($endTime,0,2)==='-P') {
- $duration = DateTimeParser::parseDuration($endTime);
- $endTime = clone $startTime;
- $endTime->add($duration);
- } else {
- $endTime = DateTimeParser::parseDateTime($endTime);
- }
-
- if($this->start && $this->start > $endTime) continue;
- if($this->end && $this->end < $startTime) continue;
- $busyTimes[] = array(
- $startTime,
- $endTime,
- $fbType
- );
-
- }
-
-
- }
- break;
-
-
-
- }
-
-
- }
-
- }
-
- if ($this->baseObject) {
- $calendar = $this->baseObject;
- } else {
- $calendar = new Component('VCALENDAR');
- $calendar->version = '2.0';
- $calendar->prodid = '-//Sabre//Sabre VObject ' . Version::VERSION . '//EN';
- $calendar->calscale = 'GREGORIAN';
- }
-
- $vfreebusy = new Component('VFREEBUSY');
- $calendar->add($vfreebusy);
-
- if ($this->start) {
- $dtstart = new Property\DateTime('DTSTART');
- $dtstart->setDateTime($this->start,Property\DateTime::UTC);
- $vfreebusy->add($dtstart);
- }
- if ($this->end) {
- $dtend = new Property\DateTime('DTEND');
- $dtend->setDateTime($this->end,Property\DateTime::UTC);
- $vfreebusy->add($dtend);
- }
- $dtstamp = new Property\DateTime('DTSTAMP');
- $dtstamp->setDateTime(new \DateTime('now'), Property\DateTime::UTC);
- $vfreebusy->add($dtstamp);
-
- foreach($busyTimes as $busyTime) {
-
- $busyTime[0]->setTimeZone(new \DateTimeZone('UTC'));
- $busyTime[1]->setTimeZone(new \DateTimeZone('UTC'));
-
- $prop = new Property(
- 'FREEBUSY',
- $busyTime[0]->format('Ymd\\THis\\Z') . '/' . $busyTime[1]->format('Ymd\\THis\\Z')
- );
- $prop['FBTYPE'] = $busyTime[2];
- $vfreebusy->add($prop);
-
- }
-
- return $calendar;
-
- }
-
-}
-
diff --git a/3rdparty/Sabre/VObject/Node.php b/3rdparty/Sabre/VObject/Node.php
deleted file mode 100644
index 5d2e1ce300f..00000000000
--- a/3rdparty/Sabre/VObject/Node.php
+++ /dev/null
@@ -1,187 +0,0 @@
-<?php
-
-namespace Sabre\VObject;
-
-/**
- * Base class for all nodes
- *
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-abstract class Node implements \IteratorAggregate, \ArrayAccess, \Countable {
-
- /**
- * The following constants are used by the validate() method.
- */
- const REPAIR = 1;
-
- /**
- * Turns the object back into a serialized blob.
- *
- * @return string
- */
- abstract function serialize();
-
- /**
- * Iterator override
- *
- * @var ElementList
- */
- protected $iterator = null;
-
- /**
- * A link to the parent node
- *
- * @var Node
- */
- public $parent = null;
-
- /**
- * Validates the node for correctness.
- *
- * The following options are supported:
- * - Node::REPAIR - If something is broken, and automatic repair may
- * be attempted.
- *
- * An array is returned with warnings.
- *
- * Every item in the array has the following properties:
- * * level - (number between 1 and 3 with severity information)
- * * message - (human readable message)
- * * node - (reference to the offending node)
- *
- * @param int $options
- * @return array
- */
- public function validate($options = 0) {
-
- return array();
-
- }
-
- /* {{{ IteratorAggregator interface */
-
- /**
- * Returns the iterator for this object
- *
- * @return ElementList
- */
- public function getIterator() {
-
- if (!is_null($this->iterator))
- return $this->iterator;
-
- return new ElementList(array($this));
-
- }
-
- /**
- * Sets the overridden iterator
- *
- * Note that this is not actually part of the iterator interface
- *
- * @param ElementList $iterator
- * @return void
- */
- public function setIterator(ElementList $iterator) {
-
- $this->iterator = $iterator;
-
- }
-
- /* }}} */
-
- /* {{{ Countable interface */
-
- /**
- * Returns the number of elements
- *
- * @return int
- */
- public function count() {
-
- $it = $this->getIterator();
- return $it->count();
-
- }
-
- /* }}} */
-
- /* {{{ ArrayAccess Interface */
-
-
- /**
- * Checks if an item exists through ArrayAccess.
- *
- * This method just forwards the request to the inner iterator
- *
- * @param int $offset
- * @return bool
- */
- public function offsetExists($offset) {
-
- $iterator = $this->getIterator();
- return $iterator->offsetExists($offset);
-
- }
-
- /**
- * Gets an item through ArrayAccess.
- *
- * This method just forwards the request to the inner iterator
- *
- * @param int $offset
- * @return mixed
- */
- public function offsetGet($offset) {
-
- $iterator = $this->getIterator();
- return $iterator->offsetGet($offset);
-
- }
-
- /**
- * Sets an item through ArrayAccess.
- *
- * This method just forwards the request to the inner iterator
- *
- * @param int $offset
- * @param mixed $value
- * @return void
- */
- public function offsetSet($offset,$value) {
-
- $iterator = $this->getIterator();
- $iterator->offsetSet($offset,$value);
-
- // @codeCoverageIgnoreStart
- //
- // This method always throws an exception, so we ignore the closing
- // brace
- }
- // @codeCoverageIgnoreEnd
-
- /**
- * Sets an item through ArrayAccess.
- *
- * This method just forwards the request to the inner iterator
- *
- * @param int $offset
- * @return void
- */
- public function offsetUnset($offset) {
-
- $iterator = $this->getIterator();
- $iterator->offsetUnset($offset);
-
- // @codeCoverageIgnoreStart
- //
- // This method always throws an exception, so we ignore the closing
- // brace
- }
- // @codeCoverageIgnoreEnd
-
- /* }}} */
-
-}
diff --git a/3rdparty/Sabre/VObject/Parameter.php b/3rdparty/Sabre/VObject/Parameter.php
deleted file mode 100644
index d6d7c54c3bd..00000000000
--- a/3rdparty/Sabre/VObject/Parameter.php
+++ /dev/null
@@ -1,88 +0,0 @@
-<?php
-
-namespace Sabre\VObject;
-
-/**
- * VObject Parameter
- *
- * This class represents a parameter. A parameter is always tied to a property.
- * In the case of:
- * DTSTART;VALUE=DATE:20101108
- * VALUE=DATE would be the parameter name and value.
- *
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Parameter extends Node {
-
- /**
- * Parameter name
- *
- * @var string
- */
- public $name;
-
- /**
- * Parameter value
- *
- * @var string
- */
- public $value;
-
- /**
- * Sets up the object
- *
- * @param string $name
- * @param string $value
- */
- public function __construct($name, $value = null) {
-
- if (!is_scalar($value) && !is_null($value)) {
- throw new \InvalidArgumentException('The value argument must be a scalar value or null');
- }
-
- $this->name = strtoupper($name);
- $this->value = $value;
-
- }
-
- /**
- * Turns the object back into a serialized blob.
- *
- * @return string
- */
- public function serialize() {
-
- if (is_null($this->value)) {
- return $this->name;
- }
- $src = array(
- '\\',
- "\n",
- ';',
- ',',
- );
- $out = array(
- '\\\\',
- '\n',
- '\;',
- '\,',
- );
-
- return $this->name . '=' . str_replace($src, $out, $this->value);
-
- }
-
- /**
- * Called when this object is being cast to a string
- *
- * @return string
- */
- public function __toString() {
-
- return $this->value;
-
- }
-
-}
diff --git a/3rdparty/Sabre/VObject/ParseException.php b/3rdparty/Sabre/VObject/ParseException.php
deleted file mode 100644
index 91386fec536..00000000000
--- a/3rdparty/Sabre/VObject/ParseException.php
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php
-
-namespace Sabre\VObject;
-
-/**
- * Exception thrown by Reader if an invalid object was attempted to be parsed.
- *
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class ParseException extends \Exception { }
diff --git a/3rdparty/Sabre/VObject/Property.php b/3rdparty/Sabre/VObject/Property.php
deleted file mode 100644
index 6f364a73257..00000000000
--- a/3rdparty/Sabre/VObject/Property.php
+++ /dev/null
@@ -1,430 +0,0 @@
-<?php
-
-namespace Sabre\VObject;
-
-/**
- * VObject Property
- *
- * A property in VObject is usually in the form PARAMNAME:paramValue.
- * An example is : SUMMARY:Weekly meeting
- *
- * Properties can also have parameters:
- * SUMMARY;LANG=en:Weekly meeting.
- *
- * Parameters can be accessed using the ArrayAccess interface.
- *
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Property extends Node {
-
- /**
- * Propertyname
- *
- * @var string
- */
- public $name;
-
- /**
- * Group name
- *
- * This may be something like 'HOME' for vcards.
- *
- * @var string
- */
- public $group;
-
- /**
- * Property parameters
- *
- * @var array
- */
- public $parameters = array();
-
- /**
- * Property value
- *
- * @var string
- */
- public $value;
-
- /**
- * If properties are added to this map, they will be automatically mapped
- * to their respective classes, if parsed by the reader or constructed with
- * the 'create' method.
- *
- * @var array
- */
- static public $classMap = array(
- 'COMPLETED' => 'Sabre\\VObject\\Property\\DateTime',
- 'CREATED' => 'Sabre\\VObject\\Property\\DateTime',
- 'DTEND' => 'Sabre\\VObject\\Property\\DateTime',
- 'DTSTAMP' => 'Sabre\\VObject\\Property\\DateTime',
- 'DTSTART' => 'Sabre\\VObject\\Property\\DateTime',
- 'DUE' => 'Sabre\\VObject\\Property\\DateTime',
- 'EXDATE' => 'Sabre\\VObject\\Property\\MultiDateTime',
- 'LAST-MODIFIED' => 'Sabre\\VObject\\Property\\DateTime',
- 'RECURRENCE-ID' => 'Sabre\\VObject\\Property\\DateTime',
- 'TRIGGER' => 'Sabre\\VObject\\Property\\DateTime',
- 'N' => 'Sabre\\VObject\\Property\\Compound',
- 'ORG' => 'Sabre\\VObject\\Property\\Compound',
- 'ADR' => 'Sabre\\VObject\\Property\\Compound',
- 'CATEGORIES' => 'Sabre\\VObject\\Property\\Compound',
- );
-
- /**
- * Creates the new property by name, but in addition will also see if
- * there's a class mapped to the property name.
- *
- * Parameters can be specified with the optional third argument. Parameters
- * must be a key->value map of the parameter name, and value. If the value
- * is specified as an array, it is assumed that multiple parameters with
- * the same name should be added.
- *
- * @param string $name
- * @param string $value
- * @param array $parameters
- * @return Property
- */
- static public function create($name, $value = null, array $parameters = array()) {
-
- $name = strtoupper($name);
- $shortName = $name;
- $group = null;
- if (strpos($shortName,'.')!==false) {
- list($group, $shortName) = explode('.', $shortName);
- }
-
- if (isset(self::$classMap[$shortName])) {
- return new self::$classMap[$shortName]($name, $value, $parameters);
- } else {
- return new self($name, $value, $parameters);
- }
-
- }
-
- /**
- * Creates a new property object
- *
- * Parameters can be specified with the optional third argument. Parameters
- * must be a key->value map of the parameter name, and value. If the value
- * is specified as an array, it is assumed that multiple parameters with
- * the same name should be added.
- *
- * @param string $name
- * @param string $value
- * @param array $parameters
- */
- public function __construct($name, $value = null, array $parameters = array()) {
-
- if (!is_scalar($value) && !is_null($value)) {
- throw new \InvalidArgumentException('The value argument must be scalar or null');
- }
-
- $name = strtoupper($name);
- $group = null;
- if (strpos($name,'.')!==false) {
- list($group, $name) = explode('.', $name);
- }
- $this->name = $name;
- $this->group = $group;
- $this->setValue($value);
-
- foreach($parameters as $paramName => $paramValues) {
-
- if (!is_array($paramValues)) {
- $paramValues = array($paramValues);
- }
-
- foreach($paramValues as $paramValue) {
- $this->add($paramName, $paramValue);
- }
-
- }
-
- }
-
- /**
- * Updates the internal value
- *
- * @param string $value
- * @return void
- */
- public function setValue($value) {
-
- $this->value = $value;
-
- }
-
- /**
- * Turns the object back into a serialized blob.
- *
- * @return string
- */
- public function serialize() {
-
- $str = $this->name;
- if ($this->group) $str = $this->group . '.' . $this->name;
-
- foreach($this->parameters as $param) {
-
- $str.=';' . $param->serialize();
-
- }
-
- $src = array(
- '\\',
- "\n",
- );
- $out = array(
- '\\\\',
- '\n',
- );
- $str.=':' . str_replace($src, $out, $this->value);
-
- $out = '';
- while(strlen($str)>0) {
- if (strlen($str)>75) {
- $out.= mb_strcut($str,0,75,'utf-8') . "\r\n";
- $str = ' ' . mb_strcut($str,75,strlen($str),'utf-8');
- } else {
- $out.=$str . "\r\n";
- $str='';
- break;
- }
- }
-
- return $out;
-
- }
-
- /**
- * Adds a new componenten or element
- *
- * You can call this method with the following syntaxes:
- *
- * add(Parameter $element)
- * add(string $name, $value)
- *
- * The first version adds an Parameter
- * The second adds a property as a string.
- *
- * @param mixed $item
- * @param mixed $itemValue
- * @return void
- */
- public function add($item, $itemValue = null) {
-
- if ($item instanceof Parameter) {
- if (!is_null($itemValue)) {
- throw new \InvalidArgumentException('The second argument must not be specified, when passing a VObject');
- }
- $item->parent = $this;
- $this->parameters[] = $item;
- } elseif(is_string($item)) {
-
- $parameter = new Parameter($item,$itemValue);
- $parameter->parent = $this;
- $this->parameters[] = $parameter;
-
- } else {
-
- throw new \InvalidArgumentException('The first argument must either be a Node a string');
-
- }
-
- }
-
- /* ArrayAccess interface {{{ */
-
- /**
- * Checks if an array element exists
- *
- * @param mixed $name
- * @return bool
- */
- public function offsetExists($name) {
-
- if (is_int($name)) return parent::offsetExists($name);
-
- $name = strtoupper($name);
-
- foreach($this->parameters as $parameter) {
- if ($parameter->name == $name) return true;
- }
- return false;
-
- }
-
- /**
- * Returns a parameter, or parameter list.
- *
- * @param string $name
- * @return Node
- */
- public function offsetGet($name) {
-
- if (is_int($name)) return parent::offsetGet($name);
- $name = strtoupper($name);
-
- $result = array();
- foreach($this->parameters as $parameter) {
- if ($parameter->name == $name)
- $result[] = $parameter;
- }
-
- if (count($result)===0) {
- return null;
- } elseif (count($result)===1) {
- return $result[0];
- } else {
- $result[0]->setIterator(new ElementList($result));
- return $result[0];
- }
-
- }
-
- /**
- * Creates a new parameter
- *
- * @param string $name
- * @param mixed $value
- * @return void
- */
- public function offsetSet($name, $value) {
-
- if (is_int($name)) parent::offsetSet($name, $value);
-
- if (is_scalar($value)) {
- if (!is_string($name))
- throw new \InvalidArgumentException('A parameter name must be specified. This means you cannot use the $array[]="string" to add parameters.');
-
- $this->offsetUnset($name);
- $parameter = new Parameter($name, $value);
- $parameter->parent = $this;
- $this->parameters[] = $parameter;
-
- } elseif ($value instanceof Parameter) {
- if (!is_null($name))
- throw new \InvalidArgumentException('Don\'t specify a parameter name if you\'re passing a \\Sabre\\VObject\\Parameter. Add using $array[]=$parameterObject.');
-
- $value->parent = $this;
- $this->parameters[] = $value;
- } else {
- throw new \InvalidArgumentException('You can only add parameters to the property object');
- }
-
- }
-
- /**
- * Removes one or more parameters with the specified name
- *
- * @param string $name
- * @return void
- */
- public function offsetUnset($name) {
-
- if (is_int($name)) parent::offsetUnset($name);
- $name = strtoupper($name);
-
- foreach($this->parameters as $key=>$parameter) {
- if ($parameter->name == $name) {
- $parameter->parent = null;
- unset($this->parameters[$key]);
- }
-
- }
-
- }
-
- /* }}} */
-
- /**
- * Called when this object is being cast to a string
- *
- * @return string
- */
- public function __toString() {
-
- return (string)$this->value;
-
- }
-
- /**
- * This method is automatically called when the object is cloned.
- * Specifically, this will ensure all child elements are also cloned.
- *
- * @return void
- */
- public function __clone() {
-
- foreach($this->parameters as $key=>$child) {
- $this->parameters[$key] = clone $child;
- $this->parameters[$key]->parent = $this;
- }
-
- }
-
- /**
- * Validates the node for correctness.
- *
- * The following options are supported:
- * - Node::REPAIR - If something is broken, and automatic repair may
- * be attempted.
- *
- * An array is returned with warnings.
- *
- * Every item in the array has the following properties:
- * * level - (number between 1 and 3 with severity information)
- * * message - (human readable message)
- * * node - (reference to the offending node)
- *
- * @param int $options
- * @return array
- */
- public function validate($options = 0) {
-
- $warnings = array();
-
- // Checking if our value is UTF-8
- if (!StringUtil::isUTF8($this->value)) {
- $warnings[] = array(
- 'level' => 1,
- 'message' => 'Property is not valid UTF-8!',
- 'node' => $this,
- );
- if ($options & self::REPAIR) {
- $this->value = StringUtil::convertToUTF8($this->value);
- }
- }
-
- // Checking if the propertyname does not contain any invalid bytes.
- if (!preg_match('/^([A-Z0-9-]+)$/', $this->name)) {
- $warnings[] = array(
- 'level' => 1,
- 'message' => 'The propertyname: ' . $this->name . ' contains invalid characters. Only A-Z, 0-9 and - are allowed',
- 'node' => $this,
- );
- if ($options & self::REPAIR) {
- // Uppercasing and converting underscores to dashes.
- $this->name = strtoupper(
- str_replace('_', '-', $this->name)
- );
- // Removing every other invalid character
- $this->name = preg_replace('/([^A-Z0-9-])/u', '', $this->name);
-
- }
-
- }
-
- // Validating inner parameters
- foreach($this->parameters as $param) {
- $warnings = array_merge($warnings, $param->validate($options));
- }
-
- return $warnings;
-
- }
-
-}
diff --git a/3rdparty/Sabre/VObject/Property/Compound.php b/3rdparty/Sabre/VObject/Property/Compound.php
deleted file mode 100644
index e2c18e7726e..00000000000
--- a/3rdparty/Sabre/VObject/Property/Compound.php
+++ /dev/null
@@ -1,129 +0,0 @@
-<?php
-
-namespace Sabre\VObject\Property;
-
-use Sabre\VObject;
-
-/**
-* Compound property.
-*
-* This class adds (de)serialization of compound properties to/from arrays.
-*
-* Currently the following properties from RFC 6350 are mapped to use this
-* class:
-*
-* N: Section 6.2.2
-* ADR: Section 6.3.1
-* ORG: Section 6.6.4
-* CATEGORIES: Section 6.7.1
-*
-* In order to use this correctly, you must call setParts and getParts to
-* retrieve and modify dates respectively.
-*
-* @author Thomas Tanghus (http://tanghus.net/)
-* @author Lars Kneschke
-* @author Evert Pot (http://www.rooftopsolutions.nl/)
-* @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
-* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
-*/
-
-/**
-* This class represents a compound property in a vCard.
-*/
-class Compound extends VObject\Property {
-
- /**
- * If property names are added to this map, they will be (de)serialised as arrays
- * using the getParts() and setParts() methods.
- * The keys are the property names, values are delimiter chars.
- *
- * @var array
- */
- static public $delimiterMap = array(
- 'N' => ';',
- 'ADR' => ';',
- 'ORG' => ';',
- 'CATEGORIES' => ',',
- );
-
- /**
- * The currently used delimiter.
- *
- * @var string
- */
- protected $delimiter = null;
-
- /**
- * Get a compound value as an array.
- *
- * @param $name string
- * @return array
- */
- public function getParts() {
-
- if (is_null($this->value)) {
- return array();
- }
-
- $delimiter = $this->getDelimiter();
-
- // split by any $delimiter which is NOT prefixed by a slash.
- // Note that this is not a a perfect solution. If a value is prefixed
- // by two slashes, it should actually be split anyway.
- //
- // Hopefully we can fix this better in a future version, where we can
- // break compatibility a bit.
- $compoundValues = preg_split("/(?<!\\\)$delimiter/", $this->value);
-
- // remove slashes from any semicolon and comma left escaped in the single values
- $compoundValues = array_map(
- function($val) {
- return strtr($val, array('\,' => ',', '\;' => ';'));
- }, $compoundValues);
-
- return $compoundValues;
-
- }
-
- /**
- * Returns the delimiter for this property.
- *
- * @return string
- */
- public function getDelimiter() {
-
- if (!$this->delimiter) {
- if (isset(self::$delimiterMap[$this->name])) {
- $this->delimiter = self::$delimiterMap[$this->name];
- } else {
- // To be a bit future proof, we are going to default the
- // delimiter to ;
- $this->delimiter = ';';
- }
- }
- return $this->delimiter;
-
- }
-
- /**
- * Set a compound value as an array.
- *
- *
- * @param $name string
- * @return array
- */
- public function setParts(array $values) {
-
- // add slashes to all semicolons and commas in the single values
- $values = array_map(
- function($val) {
- return strtr($val, array(',' => '\,', ';' => '\;'));
- }, $values);
-
- $this->setValue(
- implode($this->getDelimiter(), $values)
- );
-
- }
-
-}
diff --git a/3rdparty/Sabre/VObject/Property/DateTime.php b/3rdparty/Sabre/VObject/Property/DateTime.php
deleted file mode 100644
index 556cd441d8a..00000000000
--- a/3rdparty/Sabre/VObject/Property/DateTime.php
+++ /dev/null
@@ -1,233 +0,0 @@
-<?php
-
-namespace Sabre\VObject\Property;
-
-use Sabre\VObject;
-
-/**
- * DateTime property
- *
- * This element is used for iCalendar properties such as the DTSTART property.
- * It basically provides a few helper functions that make it easier to deal
- * with these. It supports both DATE-TIME and DATE values.
- *
- * In order to use this correctly, you must call setDateTime and getDateTime to
- * retrieve and modify dates respectively.
- *
- * If you use the 'value' or properties directly, this object does not keep
- * reference and results might appear incorrectly.
- *
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class DateTime extends VObject\Property {
-
- /**
- * Local 'floating' time
- */
- const LOCAL = 1;
-
- /**
- * UTC-based time
- */
- const UTC = 2;
-
- /**
- * Local time plus timezone
- */
- const LOCALTZ = 3;
-
- /**
- * Only a date, time is ignored
- */
- const DATE = 4;
-
- /**
- * DateTime representation
- *
- * @var \DateTime
- */
- protected $dateTime;
-
- /**
- * dateType
- *
- * @var int
- */
- protected $dateType;
-
- /**
- * Updates the Date and Time.
- *
- * @param \DateTime $dt
- * @param int $dateType
- * @return void
- */
- public function setDateTime(\DateTime $dt, $dateType = self::LOCALTZ) {
-
- switch($dateType) {
-
- case self::LOCAL :
- $this->setValue($dt->format('Ymd\\THis'));
- $this->offsetUnset('VALUE');
- $this->offsetUnset('TZID');
- $this->offsetSet('VALUE','DATE-TIME');
- break;
- case self::UTC :
- $dt->setTimeZone(new \DateTimeZone('UTC'));
- $this->setValue($dt->format('Ymd\\THis\\Z'));
- $this->offsetUnset('VALUE');
- $this->offsetUnset('TZID');
- $this->offsetSet('VALUE','DATE-TIME');
- break;
- case self::LOCALTZ :
- $this->setValue($dt->format('Ymd\\THis'));
- $this->offsetUnset('VALUE');
- $this->offsetUnset('TZID');
- $this->offsetSet('VALUE','DATE-TIME');
- $this->offsetSet('TZID', $dt->getTimeZone()->getName());
- break;
- case self::DATE :
- $this->setValue($dt->format('Ymd'));
- $this->offsetUnset('VALUE');
- $this->offsetUnset('TZID');
- $this->offsetSet('VALUE','DATE');
- break;
- default :
- throw new \InvalidArgumentException('You must pass a valid dateType constant');
-
- }
- $this->dateTime = $dt;
- $this->dateType = $dateType;
-
- }
-
- /**
- * Returns the current DateTime value.
- *
- * If no value was set, this method returns null.
- *
- * @return \DateTime|null
- */
- public function getDateTime() {
-
- if ($this->dateTime)
- return $this->dateTime;
-
- list(
- $this->dateType,
- $this->dateTime
- ) = self::parseData($this->value, $this);
- return $this->dateTime;
-
- }
-
- /**
- * Returns the type of Date format.
- *
- * This method returns one of the format constants. If no date was set,
- * this method will return null.
- *
- * @return int|null
- */
- public function getDateType() {
-
- if ($this->dateType)
- return $this->dateType;
-
- list(
- $this->dateType,
- $this->dateTime,
- ) = self::parseData($this->value, $this);
- return $this->dateType;
-
- }
-
- /**
- * Parses the internal data structure to figure out what the current date
- * and time is.
- *
- * The returned array contains two elements:
- * 1. A 'DateType' constant (as defined on this class), or null.
- * 2. A DateTime object (or null)
- *
- * @param string|null $propertyValue The string to parse (yymmdd or
- * ymmddThhmmss, etc..)
- * @param \Sabre\VObject\Property|null $property The instance of the
- * property we're parsing.
- * @return array
- */
- static public function parseData($propertyValue, VObject\Property $property = null) {
-
- if (is_null($propertyValue)) {
- return array(null, null);
- }
-
- $date = '(?P<year>[1-2][0-9]{3})(?P<month>[0-1][0-9])(?P<date>[0-3][0-9])';
- $time = '(?P<hour>[0-2][0-9])(?P<minute>[0-5][0-9])(?P<second>[0-5][0-9])';
- $regex = "/^$date(T$time(?P<isutc>Z)?)?$/";
-
- if (!preg_match($regex, $propertyValue, $matches)) {
- throw new \InvalidArgumentException($propertyValue . ' is not a valid \DateTime or Date string');
- }
-
- if (!isset($matches['hour'])) {
- // Date-only
- return array(
- self::DATE,
- new \DateTime($matches['year'] . '-' . $matches['month'] . '-' . $matches['date'] . ' 00:00:00', new \DateTimeZone('UTC')),
- );
- }
-
- $dateStr =
- $matches['year'] .'-' .
- $matches['month'] . '-' .
- $matches['date'] . ' ' .
- $matches['hour'] . ':' .
- $matches['minute'] . ':' .
- $matches['second'];
-
- if (isset($matches['isutc'])) {
- $dt = new \DateTime($dateStr,new \DateTimeZone('UTC'));
- $dt->setTimeZone(new \DateTimeZone('UTC'));
- return array(
- self::UTC,
- $dt
- );
- }
-
- // Finding the timezone.
- $tzid = $property['TZID'];
- if (!$tzid) {
- // This was a floating time string. This implies we use the
- // timezone from date_default_timezone_set / date.timezone ini
- // setting.
- return array(
- self::LOCAL,
- new \DateTime($dateStr)
- );
- }
-
- // To look up the timezone, we must first find the VCALENDAR component.
- $root = $property;
- while($root->parent) {
- $root = $root->parent;
- }
- if ($root->name === 'VCALENDAR') {
- $tz = VObject\TimeZoneUtil::getTimeZone((string)$tzid, $root);
- } else {
- $tz = VObject\TimeZoneUtil::getTimeZone((string)$tzid);
- }
-
- $dt = new \DateTime($dateStr, $tz);
- $dt->setTimeZone($tz);
-
- return array(
- self::LOCALTZ,
- $dt
- );
-
- }
-
-}
diff --git a/3rdparty/Sabre/VObject/Property/MultiDateTime.php b/3rdparty/Sabre/VObject/Property/MultiDateTime.php
deleted file mode 100644
index 629ef4a1340..00000000000
--- a/3rdparty/Sabre/VObject/Property/MultiDateTime.php
+++ /dev/null
@@ -1,168 +0,0 @@
-<?php
-
-namespace Sabre\VObject\Property;
-
-use Sabre\VObject;
-
-/**
- * Multi-DateTime property
- *
- * This element is used for iCalendar properties such as the EXDATE property.
- * It basically provides a few helper functions that make it easier to deal
- * with these. It supports both DATE-TIME and DATE values.
- *
- * In order to use this correctly, you must call setDateTimes and getDateTimes
- * to retrieve and modify dates respectively.
- *
- * If you use the 'value' or properties directly, this object does not keep
- * reference and results might appear incorrectly.
- *
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class MultiDateTime extends VObject\Property {
-
- /**
- * DateTime representation
- *
- * @var DateTime[]
- */
- protected $dateTimes;
-
- /**
- * dateType
- *
- * This is one of the Sabre\VObject\Property\DateTime constants.
- *
- * @var int
- */
- protected $dateType;
-
- /**
- * Updates the value
- *
- * @param array $dt Must be an array of DateTime objects.
- * @param int $dateType
- * @return void
- */
- public function setDateTimes(array $dt, $dateType = VObject\Property\DateTime::LOCALTZ) {
-
- foreach($dt as $i)
- if (!$i instanceof \DateTime)
- throw new \InvalidArgumentException('You must pass an array of DateTime objects');
-
- $this->offsetUnset('VALUE');
- $this->offsetUnset('TZID');
- switch($dateType) {
-
- case DateTime::LOCAL :
- $val = array();
- foreach($dt as $i) {
- $val[] = $i->format('Ymd\\THis');
- }
- $this->setValue(implode(',',$val));
- $this->offsetSet('VALUE','DATE-TIME');
- break;
- case DateTime::UTC :
- $val = array();
- foreach($dt as $i) {
- $i->setTimeZone(new \DateTimeZone('UTC'));
- $val[] = $i->format('Ymd\\THis\\Z');
- }
- $this->setValue(implode(',',$val));
- $this->offsetSet('VALUE','DATE-TIME');
- break;
- case DateTime::LOCALTZ :
- $val = array();
- foreach($dt as $i) {
- $val[] = $i->format('Ymd\\THis');
- }
- $this->setValue(implode(',',$val));
- $this->offsetSet('VALUE','DATE-TIME');
- $this->offsetSet('TZID', $dt[0]->getTimeZone()->getName());
- break;
- case DateTime::DATE :
- $val = array();
- foreach($dt as $i) {
- $val[] = $i->format('Ymd');
- }
- $this->setValue(implode(',',$val));
- $this->offsetSet('VALUE','DATE');
- break;
- default :
- throw new \InvalidArgumentException('You must pass a valid dateType constant');
-
- }
- $this->dateTimes = $dt;
- $this->dateType = $dateType;
-
- }
-
- /**
- * Returns the current DateTime value.
- *
- * If no value was set, this method returns null.
- *
- * @return array|null
- */
- public function getDateTimes() {
-
- if ($this->dateTimes)
- return $this->dateTimes;
-
- $dts = array();
-
- if (!$this->value) {
- $this->dateTimes = null;
- $this->dateType = null;
- return null;
- }
-
- foreach(explode(',',$this->value) as $val) {
- list(
- $type,
- $dt
- ) = DateTime::parseData($val, $this);
- $dts[] = $dt;
- $this->dateType = $type;
- }
- $this->dateTimes = $dts;
- return $this->dateTimes;
-
- }
-
- /**
- * Returns the type of Date format.
- *
- * This method returns one of the format constants. If no date was set,
- * this method will return null.
- *
- * @return int|null
- */
- public function getDateType() {
-
- if ($this->dateType)
- return $this->dateType;
-
- if (!$this->value) {
- $this->dateTimes = null;
- $this->dateType = null;
- return null;
- }
-
- $dts = array();
- foreach(explode(',',$this->value) as $val) {
- list(
- $type,
- $dt
- ) = DateTime::parseData($val, $this);
- $dts[] = $dt;
- $this->dateType = $type;
- }
- $this->dateTimes = $dts;
- return $this->dateType;
-
- }
-
-}
diff --git a/3rdparty/Sabre/VObject/Reader.php b/3rdparty/Sabre/VObject/Reader.php
deleted file mode 100644
index a24590cb388..00000000000
--- a/3rdparty/Sabre/VObject/Reader.php
+++ /dev/null
@@ -1,217 +0,0 @@
-<?php
-
-namespace Sabre\VObject;
-
-/**
- * VCALENDAR/VCARD reader
- *
- * This class reads the vobject file, and returns a full element tree.
- *
- * TODO: this class currently completely works 'statically'. This is pointless,
- * and defeats OOP principals. Needs refactoring in a future version.
- *
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Reader {
-
- /**
- * If this option is passed to the reader, it will be less strict about the
- * validity of the lines.
- *
- * Currently using this option just means, that it will accept underscores
- * in property names.
- */
- const OPTION_FORGIVING = 1;
-
- /**
- * If this option is turned on, any lines we cannot parse will be ignored
- * by the reader.
- */
- const OPTION_IGNORE_INVALID_LINES = 2;
-
- /**
- * Parses the file and returns the top component
- *
- * The options argument is a bitfield. Pass any of the OPTIONS constant to
- * alter the parsers' behaviour.
- *
- * @param string $data
- * @param int $options
- * @return Node
- */
- static function read($data, $options = 0) {
-
- // Normalizing newlines
- $data = str_replace(array("\r","\n\n"), array("\n","\n"), $data);
-
- $lines = explode("\n", $data);
-
- // Unfolding lines
- $lines2 = array();
- foreach($lines as $line) {
-
- // Skipping empty lines
- if (!$line) continue;
-
- if ($line[0]===" " || $line[0]==="\t") {
- $lines2[count($lines2)-1].=substr($line,1);
- } else {
- $lines2[] = $line;
- }
-
- }
-
- unset($lines);
-
- reset($lines2);
-
- return self::readLine($lines2, $options);
-
- }
-
- /**
- * Reads and parses a single line.
- *
- * This method receives the full array of lines. The array pointer is used
- * to traverse.
- *
- * This method returns null if an invalid line was encountered, and the
- * IGNORE_INVALID_LINES option was turned on.
- *
- * @param array $lines
- * @param int $options See the OPTIONS constants.
- * @return Node
- */
- static private function readLine(&$lines, $options = 0) {
-
- $line = current($lines);
- $lineNr = key($lines);
- next($lines);
-
- // Components
- if (strtoupper(substr($line,0,6)) === "BEGIN:") {
-
- $componentName = strtoupper(substr($line,6));
- $obj = Component::create($componentName);
-
- $nextLine = current($lines);
-
- while(strtoupper(substr($nextLine,0,4))!=="END:") {
-
- $parsedLine = self::readLine($lines, $options);
- $nextLine = current($lines);
-
- if (is_null($parsedLine)) {
- continue;
- }
- $obj->add($parsedLine);
-
- if ($nextLine===false)
- throw new ParseException('Invalid VObject. Document ended prematurely.');
-
- }
-
- // Checking component name of the 'END:' line.
- if (substr($nextLine,4)!==$obj->name) {
- throw new ParseException('Invalid VObject, expected: "END:' . $obj->name . '" got: "' . $nextLine . '"');
- }
- next($lines);
-
- return $obj;
-
- }
-
- // Properties
- //$result = preg_match('/(?P<name>[A-Z0-9-]+)(?:;(?P<parameters>^(?<!:):))(.*)$/',$line,$matches);
-
- if ($options & self::OPTION_FORGIVING) {
- $token = '[A-Z0-9-\._]+';
- } else {
- $token = '[A-Z0-9-\.]+';
- }
- $parameters = "(?:;(?P<parameters>([^:^\"]|\"([^\"]*)\")*))?";
- $regex = "/^(?P<name>$token)$parameters:(?P<value>.*)$/i";
-
- $result = preg_match($regex,$line,$matches);
-
- if (!$result) {
- if ($options & self::OPTION_IGNORE_INVALID_LINES) {
- return null;
- } else {
- throw new ParseException('Invalid VObject, line ' . ($lineNr+1) . ' did not follow the icalendar/vcard format');
- }
- }
-
- $propertyName = strtoupper($matches['name']);
- $propertyValue = preg_replace_callback('#(\\\\(\\\\|N|n))#',function($matches) {
- if ($matches[2]==='n' || $matches[2]==='N') {
- return "\n";
- } else {
- return $matches[2];
- }
- }, $matches['value']);
-
- $obj = Property::create($propertyName, $propertyValue);
-
- if ($matches['parameters']) {
-
- foreach(self::readParameters($matches['parameters']) as $param) {
- $obj->add($param);
- }
-
- }
-
- return $obj;
-
-
- }
-
- /**
- * Reads a parameter list from a property
- *
- * This method returns an array of Parameter
- *
- * @param string $parameters
- * @return array
- */
- static private function readParameters($parameters) {
-
- $token = '[A-Z0-9-]+';
-
- $paramValue = '(?P<paramValue>[^\"^;]*|"[^"]*")';
-
- $regex = "/(?<=^|;)(?P<paramName>$token)(=$paramValue(?=$|;))?/i";
- preg_match_all($regex, $parameters, $matches, PREG_SET_ORDER);
-
- $params = array();
- foreach($matches as $match) {
-
- $value = isset($match['paramValue'])?$match['paramValue']:null;
-
- if (isset($value[0])) {
- // Stripping quotes, if needed
- if ($value[0] === '"') $value = substr($value,1,strlen($value)-2);
- } else {
- $value = '';
- }
-
- $value = preg_replace_callback('#(\\\\(\\\\|N|n|;|,))#',function($matches) {
- if ($matches[2]==='n' || $matches[2]==='N') {
- return "\n";
- } else {
- return $matches[2];
- }
- }, $value);
-
- $params[] = new Parameter($match['paramName'], $value);
-
- }
-
- return $params;
-
- }
-
-
-}
diff --git a/3rdparty/Sabre/VObject/RecurrenceIterator.php b/3rdparty/Sabre/VObject/RecurrenceIterator.php
deleted file mode 100644
index 46c7f447806..00000000000
--- a/3rdparty/Sabre/VObject/RecurrenceIterator.php
+++ /dev/null
@@ -1,1061 +0,0 @@
-<?php
-
-namespace Sabre\VObject;
-
-/**
- * This class is used to determine new for a recurring event, when the next
- * events occur.
- *
- * This iterator may loop infinitely in the future, therefore it is important
- * that if you use this class, you set hard limits for the amount of iterations
- * you want to handle.
- *
- * Note that currently there is not full support for the entire iCalendar
- * specification, as it's very complex and contains a lot of permutations
- * that's not yet used very often in software.
- *
- * For the focus has been on features as they actually appear in Calendaring
- * software, but this may well get expanded as needed / on demand
- *
- * The following RRULE properties are supported
- * * UNTIL
- * * INTERVAL
- * * COUNT
- * * FREQ=DAILY
- * * BYDAY
- * * FREQ=WEEKLY
- * * BYDAY
- * * WKST
- * * FREQ=MONTHLY
- * * BYMONTHDAY
- * * BYDAY
- * * BYSETPOS
- * * FREQ=YEARLY
- * * BYMONTH
- * * BYMONTHDAY (only if BYMONTH is also set)
- * * BYDAY (only if BYMONTH is also set)
- *
- * Anything beyond this is 'undefined', which means that it may get ignored, or
- * you may get unexpected results. The effect is that in some applications the
- * specified recurrence may look incorrect, or is missing.
- *
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class RecurrenceIterator implements \Iterator {
-
- /**
- * The initial event date
- *
- * @var DateTime
- */
- public $startDate;
-
- /**
- * The end-date of the initial event
- *
- * @var DateTime
- */
- public $endDate;
-
- /**
- * The 'current' recurrence.
- *
- * This will be increased for every iteration.
- *
- * @var DateTime
- */
- public $currentDate;
-
-
- /**
- * List of dates that are excluded from the rules.
- *
- * This list contains the items that have been overriden by the EXDATE
- * property.
- *
- * @var array
- */
- public $exceptionDates = array();
-
- /**
- * Base event
- *
- * @var Component\VEvent
- */
- public $baseEvent;
-
- /**
- * List of dates that are overridden by other events.
- * Similar to $overriddenEvents, but this just contains the original dates.
- *
- * @var array
- */
- public $overriddenDates = array();
-
- /**
- * list of events that are 'overridden'.
- *
- * This is an array of Component\VEvent objects.
- *
- * @var array
- */
- public $overriddenEvents = array();
-
-
- /**
- * Frequency is one of: secondly, minutely, hourly, daily, weekly, monthly,
- * yearly.
- *
- * @var string
- */
- public $frequency;
-
- /**
- * The last instance of this recurrence, inclusively
- *
- * @var DateTime|null
- */
- public $until;
-
- /**
- * The number of recurrences, or 'null' if infinitely recurring.
- *
- * @var int
- */
- public $count;
-
- /**
- * The interval.
- *
- * If for example frequency is set to daily, interval = 2 would mean every
- * 2 days.
- *
- * @var int
- */
- public $interval = 1;
-
- /**
- * Which seconds to recur.
- *
- * This is an array of integers (between 0 and 60)
- *
- * @var array
- */
- public $bySecond;
-
- /**
- * Which minutes to recur
- *
- * This is an array of integers (between 0 and 59)
- *
- * @var array
- */
- public $byMinute;
-
- /**
- * Which hours to recur
- *
- * This is an array of integers (between 0 and 23)
- *
- * @var array
- */
- public $byHour;
-
- /**
- * Which weekdays to recur.
- *
- * This is an array of weekdays
- *
- * This may also be preceeded by a positive or negative integer. If present,
- * this indicates the nth occurrence of a specific day within the monthly or
- * yearly rrule. For instance, -2TU indicates the second-last tuesday of
- * the month, or year.
- *
- * @var array
- */
- public $byDay;
-
- /**
- * Which days of the month to recur
- *
- * This is an array of days of the months (1-31). The value can also be
- * negative. -5 for instance means the 5th last day of the month.
- *
- * @var array
- */
- public $byMonthDay;
-
- /**
- * Which days of the year to recur.
- *
- * This is an array with days of the year (1 to 366). The values can also
- * be negative. For instance, -1 will always represent the last day of the
- * year. (December 31st).
- *
- * @var array
- */
- public $byYearDay;
-
- /**
- * Which week numbers to recur.
- *
- * This is an array of integers from 1 to 53. The values can also be
- * negative. -1 will always refer to the last week of the year.
- *
- * @var array
- */
- public $byWeekNo;
-
- /**
- * Which months to recur
- *
- * This is an array of integers from 1 to 12.
- *
- * @var array
- */
- public $byMonth;
-
- /**
- * Which items in an existing st to recur.
- *
- * These numbers work together with an existing by* rule. It specifies
- * exactly which items of the existing by-rule to filter.
- *
- * Valid values are 1 to 366 and -1 to -366. As an example, this can be
- * used to recur the last workday of the month.
- *
- * This would be done by setting frequency to 'monthly', byDay to
- * 'MO,TU,WE,TH,FR' and bySetPos to -1.
- *
- * @var array
- */
- public $bySetPos;
-
- /**
- * When a week starts
- *
- * @var string
- */
- public $weekStart = 'MO';
-
- /**
- * The current item in the list
- *
- * @var int
- */
- public $counter = 0;
-
- /**
- * Simple mapping from iCalendar day names to day numbers
- *
- * @var array
- */
- private $dayMap = array(
- 'SU' => 0,
- 'MO' => 1,
- 'TU' => 2,
- 'WE' => 3,
- 'TH' => 4,
- 'FR' => 5,
- 'SA' => 6,
- );
-
- /**
- * Mappings between the day number and english day name.
- *
- * @var array
- */
- private $dayNames = array(
- 0 => 'Sunday',
- 1 => 'Monday',
- 2 => 'Tuesday',
- 3 => 'Wednesday',
- 4 => 'Thursday',
- 5 => 'Friday',
- 6 => 'Saturday',
- );
-
- /**
- * If the current iteration of the event is an overriden event, this
- * property will hold the VObject
- *
- * @var Component
- */
- private $currentOverriddenEvent;
-
- /**
- * This property may contain the date of the next not-overridden event.
- * This date is calculated sometimes a bit early, before overridden events
- * are evaluated.
- *
- * @var DateTime
- */
- private $nextDate;
-
- /**
- * Creates the iterator
- *
- * You should pass a VCALENDAR component, as well as the UID of the event
- * we're going to traverse.
- *
- * @param Component $vcal
- * @param string|null $uid
- */
- public function __construct(Component $vcal, $uid=null) {
-
- if (is_null($uid)) {
- if ($vcal->name === 'VCALENDAR') {
- throw new \InvalidArgumentException('If you pass a VCALENDAR object, you must pass a uid argument as well');
- }
- $components = array($vcal);
- $uid = (string)$vcal->uid;
- } else {
- $components = $vcal->select('VEVENT');
- }
- foreach($components as $component) {
- if ((string)$component->uid == $uid) {
- if (isset($component->{'RECURRENCE-ID'})) {
- $this->overriddenEvents[$component->DTSTART->getDateTime()->getTimeStamp()] = $component;
- $this->overriddenDates[] = $component->{'RECURRENCE-ID'}->getDateTime();
- } else {
- $this->baseEvent = $component;
- }
- }
- }
- if (!$this->baseEvent) {
- throw new \InvalidArgumentException('Could not find a base event with uid: ' . $uid);
- }
-
- $this->startDate = clone $this->baseEvent->DTSTART->getDateTime();
-
- $this->endDate = null;
- if (isset($this->baseEvent->DTEND)) {
- $this->endDate = clone $this->baseEvent->DTEND->getDateTime();
- } else {
- $this->endDate = clone $this->startDate;
- if (isset($this->baseEvent->DURATION)) {
- $this->endDate->add(DateTimeParser::parse($this->baseEvent->DURATION->value));
- } elseif ($this->baseEvent->DTSTART->getDateType()===Property\DateTime::DATE) {
- $this->endDate->modify('+1 day');
- }
- }
- $this->currentDate = clone $this->startDate;
-
- $rrule = (string)$this->baseEvent->RRULE;
-
- $parts = explode(';', $rrule);
-
- // If no rrule was specified, we create a default setting
- if (!$rrule) {
- $this->frequency = 'daily';
- $this->count = 1;
- } else foreach($parts as $part) {
-
- list($key, $value) = explode('=', $part, 2);
-
- switch(strtoupper($key)) {
-
- case 'FREQ' :
- if (!in_array(
- strtolower($value),
- array('secondly','minutely','hourly','daily','weekly','monthly','yearly')
- )) {
- throw new \InvalidArgumentException('Unknown value for FREQ=' . strtoupper($value));
-
- }
- $this->frequency = strtolower($value);
- break;
-
- case 'UNTIL' :
- $this->until = DateTimeParser::parse($value);
- break;
-
- case 'COUNT' :
- $this->count = (int)$value;
- break;
-
- case 'INTERVAL' :
- $this->interval = (int)$value;
- if ($this->interval < 1) {
- throw new \InvalidArgumentException('INTERVAL in RRULE must be a positive integer!');
- }
- break;
-
- case 'BYSECOND' :
- $this->bySecond = explode(',', $value);
- break;
-
- case 'BYMINUTE' :
- $this->byMinute = explode(',', $value);
- break;
-
- case 'BYHOUR' :
- $this->byHour = explode(',', $value);
- break;
-
- case 'BYDAY' :
- $this->byDay = explode(',', strtoupper($value));
- break;
-
- case 'BYMONTHDAY' :
- $this->byMonthDay = explode(',', $value);
- break;
-
- case 'BYYEARDAY' :
- $this->byYearDay = explode(',', $value);
- break;
-
- case 'BYWEEKNO' :
- $this->byWeekNo = explode(',', $value);
- break;
-
- case 'BYMONTH' :
- $this->byMonth = explode(',', $value);
- break;
-
- case 'BYSETPOS' :
- $this->bySetPos = explode(',', $value);
- break;
-
- case 'WKST' :
- $this->weekStart = strtoupper($value);
- break;
-
- }
-
- }
-
- // Parsing exception dates
- if (isset($this->baseEvent->EXDATE)) {
- foreach($this->baseEvent->EXDATE as $exDate) {
-
- foreach(explode(',', (string)$exDate) as $exceptionDate) {
-
- $this->exceptionDates[] =
- DateTimeParser::parse($exceptionDate, $this->startDate->getTimeZone());
-
- }
-
- }
-
- }
-
- }
-
- /**
- * Returns the current item in the list
- *
- * @return DateTime
- */
- public function current() {
-
- if (!$this->valid()) return null;
- return clone $this->currentDate;
-
- }
-
- /**
- * This method returns the startdate for the current iteration of the
- * event.
- *
- * @return DateTime
- */
- public function getDtStart() {
-
- if (!$this->valid()) return null;
- return clone $this->currentDate;
-
- }
-
- /**
- * This method returns the enddate for the current iteration of the
- * event.
- *
- * @return DateTime
- */
- public function getDtEnd() {
-
- if (!$this->valid()) return null;
- $dtEnd = clone $this->currentDate;
- $dtEnd->add( $this->startDate->diff( $this->endDate ) );
- return clone $dtEnd;
-
- }
-
- /**
- * Returns a VEVENT object with the updated start and end date.
- *
- * Any recurrence information is removed, and this function may return an
- * 'overridden' event instead.
- *
- * This method always returns a cloned instance.
- *
- * @return Component\VEvent
- */
- public function getEventObject() {
-
- if ($this->currentOverriddenEvent) {
- return clone $this->currentOverriddenEvent;
- }
- $event = clone $this->baseEvent;
- unset($event->RRULE);
- unset($event->EXDATE);
- unset($event->RDATE);
- unset($event->EXRULE);
-
- $event->DTSTART->setDateTime($this->getDTStart(), $event->DTSTART->getDateType());
- if (isset($event->DTEND)) {
- $event->DTEND->setDateTime($this->getDtEnd(), $event->DTSTART->getDateType());
- }
- if ($this->counter > 0) {
- $event->{'RECURRENCE-ID'} = (string)$event->DTSTART;
- }
-
- return $event;
-
- }
-
- /**
- * Returns the current item number
- *
- * @return int
- */
- public function key() {
-
- return $this->counter;
-
- }
-
- /**
- * Whether or not there is a 'next item'
- *
- * @return bool
- */
- public function valid() {
-
- if (!is_null($this->count)) {
- return $this->counter < $this->count;
- }
- if (!is_null($this->until)) {
- return $this->currentDate <= $this->until;
- }
- return true;
-
- }
-
- /**
- * Resets the iterator
- *
- * @return void
- */
- public function rewind() {
-
- $this->currentDate = clone $this->startDate;
- $this->counter = 0;
-
- }
-
- /**
- * This method allows you to quickly go to the next occurrence after the
- * specified date.
- *
- * Note that this checks the current 'endDate', not the 'stardDate'. This
- * means that if you forward to January 1st, the iterator will stop at the
- * first event that ends *after* January 1st.
- *
- * @param DateTime $dt
- * @return void
- */
- public function fastForward(\DateTime $dt) {
-
- while($this->valid() && $this->getDTEnd() <= $dt) {
- $this->next();
- }
-
- }
-
- /**
- * Returns true if this recurring event never ends.
- *
- * @return bool
- */
- public function isInfinite() {
-
- return !$this->count && !$this->until;
-
- }
-
- /**
- * Goes on to the next iteration
- *
- * @return void
- */
- public function next() {
-
- /*
- if (!is_null($this->count) && $this->counter >= $this->count) {
- $this->currentDate = null;
- }*/
-
-
- $previousStamp = $this->currentDate->getTimeStamp();
-
- while(true) {
-
- $this->currentOverriddenEvent = null;
-
- // If we have a next date 'stored', we use that
- if ($this->nextDate) {
- $this->currentDate = $this->nextDate;
- $currentStamp = $this->currentDate->getTimeStamp();
- $this->nextDate = null;
- } else {
-
- // Otherwise, we calculate it
- switch($this->frequency) {
-
- case 'daily' :
- $this->nextDaily();
- break;
-
- case 'weekly' :
- $this->nextWeekly();
- break;
-
- case 'monthly' :
- $this->nextMonthly();
- break;
-
- case 'yearly' :
- $this->nextYearly();
- break;
-
- }
- $currentStamp = $this->currentDate->getTimeStamp();
-
- // Checking exception dates
- foreach($this->exceptionDates as $exceptionDate) {
- if ($this->currentDate == $exceptionDate) {
- $this->counter++;
- continue 2;
- }
- }
- foreach($this->overriddenDates as $overriddenDate) {
- if ($this->currentDate == $overriddenDate) {
- continue 2;
- }
- }
-
- }
-
- // Checking overridden events
- foreach($this->overriddenEvents as $index=>$event) {
- if ($index > $previousStamp && $index <= $currentStamp) {
-
- // We're moving the 'next date' aside, for later use.
- $this->nextDate = clone $this->currentDate;
-
- $this->currentDate = $event->DTSTART->getDateTime();
- $this->currentOverriddenEvent = $event;
-
- break;
- }
- }
-
- break;
-
- }
-
- /*
- if (!is_null($this->until)) {
- if($this->currentDate > $this->until) {
- $this->currentDate = null;
- }
- }*/
-
- $this->counter++;
-
- }
-
- /**
- * Does the processing for advancing the iterator for daily frequency.
- *
- * @return void
- */
- protected function nextDaily() {
-
- if (!$this->byDay) {
- $this->currentDate->modify('+' . $this->interval . ' days');
- return;
- }
-
- $recurrenceDays = array();
- foreach($this->byDay as $byDay) {
-
- // The day may be preceeded with a positive (+n) or
- // negative (-n) integer. However, this does not make
- // sense in 'weekly' so we ignore it here.
- $recurrenceDays[] = $this->dayMap[substr($byDay,-2)];
-
- }
-
- do {
-
- $this->currentDate->modify('+' . $this->interval . ' days');
-
- // Current day of the week
- $currentDay = $this->currentDate->format('w');
-
- } while (!in_array($currentDay, $recurrenceDays));
-
- }
-
- /**
- * Does the processing for advancing the iterator for weekly frequency.
- *
- * @return void
- */
- protected function nextWeekly() {
-
- if (!$this->byDay) {
- $this->currentDate->modify('+' . $this->interval . ' weeks');
- return;
- }
-
- $recurrenceDays = array();
- foreach($this->byDay as $byDay) {
-
- // The day may be preceeded with a positive (+n) or
- // negative (-n) integer. However, this does not make
- // sense in 'weekly' so we ignore it here.
- $recurrenceDays[] = $this->dayMap[substr($byDay,-2)];
-
- }
-
- // Current day of the week
- $currentDay = $this->currentDate->format('w');
-
- // First day of the week:
- $firstDay = $this->dayMap[$this->weekStart];
-
- $time = array(
- $this->currentDate->format('H'),
- $this->currentDate->format('i'),
- $this->currentDate->format('s')
- );
-
- // Increasing the 'current day' until we find our next
- // occurrence.
- while(true) {
-
- $currentDay++;
-
- if ($currentDay>6) {
- $currentDay = 0;
- }
-
- // We need to roll over to the next week
- if ($currentDay === $firstDay) {
- $this->currentDate->modify('+' . $this->interval . ' weeks');
-
- // We need to go to the first day of this week, but only if we
- // are not already on this first day of this week.
- if($this->currentDate->format('w') != $firstDay) {
- $this->currentDate->modify('last ' . $this->dayNames[$this->dayMap[$this->weekStart]]);
- $this->currentDate->setTime($time[0],$time[1],$time[2]);
- }
- }
-
- // We have a match
- if (in_array($currentDay ,$recurrenceDays)) {
- $this->currentDate->modify($this->dayNames[$currentDay]);
- $this->currentDate->setTime($time[0],$time[1],$time[2]);
- break;
- }
-
- }
-
- }
-
- /**
- * Does the processing for advancing the iterator for monthly frequency.
- *
- * @return void
- */
- protected function nextMonthly() {
-
- $currentDayOfMonth = $this->currentDate->format('j');
- if (!$this->byMonthDay && !$this->byDay) {
-
- // If the current day is higher than the 28th, rollover can
- // occur to the next month. We Must skip these invalid
- // entries.
- if ($currentDayOfMonth < 29) {
- $this->currentDate->modify('+' . $this->interval . ' months');
- } else {
- $increase = 0;
- do {
- $increase++;
- $tempDate = clone $this->currentDate;
- $tempDate->modify('+ ' . ($this->interval*$increase) . ' months');
- } while ($tempDate->format('j') != $currentDayOfMonth);
- $this->currentDate = $tempDate;
- }
- return;
- }
-
- while(true) {
-
- $occurrences = $this->getMonthlyOccurrences();
-
- foreach($occurrences as $occurrence) {
-
- // The first occurrence thats higher than the current
- // day of the month wins.
- if ($occurrence > $currentDayOfMonth) {
- break 2;
- }
-
- }
-
- // If we made it all the way here, it means there were no
- // valid occurrences, and we need to advance to the next
- // month.
- $this->currentDate->modify('first day of this month');
- $this->currentDate->modify('+ ' . $this->interval . ' months');
-
- // This goes to 0 because we need to start counting at hte
- // beginning.
- $currentDayOfMonth = 0;
-
- }
-
- $this->currentDate->setDate($this->currentDate->format('Y'), $this->currentDate->format('n'), $occurrence);
-
- }
-
- /**
- * Does the processing for advancing the iterator for yearly frequency.
- *
- * @return void
- */
- protected function nextYearly() {
-
- $currentMonth = $this->currentDate->format('n');
- $currentYear = $this->currentDate->format('Y');
- $currentDayOfMonth = $this->currentDate->format('j');
-
- // No sub-rules, so we just advance by year
- if (!$this->byMonth) {
-
- // Unless it was a leap day!
- if ($currentMonth==2 && $currentDayOfMonth==29) {
-
- $counter = 0;
- do {
- $counter++;
- // Here we increase the year count by the interval, until
- // we hit a date that's also in a leap year.
- //
- // We could just find the next interval that's dividable by
- // 4, but that would ignore the rule that there's no leap
- // year every year that's dividable by a 100, but not by
- // 400. (1800, 1900, 2100). So we just rely on the datetime
- // functions instead.
- $nextDate = clone $this->currentDate;
- $nextDate->modify('+ ' . ($this->interval*$counter) . ' years');
- } while ($nextDate->format('n')!=2);
- $this->currentDate = $nextDate;
-
- return;
-
- }
-
- // The easiest form
- $this->currentDate->modify('+' . $this->interval . ' years');
- return;
-
- }
-
- $currentMonth = $this->currentDate->format('n');
- $currentYear = $this->currentDate->format('Y');
- $currentDayOfMonth = $this->currentDate->format('j');
-
- $advancedToNewMonth = false;
-
- // If we got a byDay or getMonthDay filter, we must first expand
- // further.
- if ($this->byDay || $this->byMonthDay) {
-
- while(true) {
-
- $occurrences = $this->getMonthlyOccurrences();
-
- foreach($occurrences as $occurrence) {
-
- // The first occurrence that's higher than the current
- // day of the month wins.
- // If we advanced to the next month or year, the first
- // occurrence is always correct.
- if ($occurrence > $currentDayOfMonth || $advancedToNewMonth) {
- break 2;
- }
-
- }
-
- // If we made it here, it means we need to advance to
- // the next month or year.
- $currentDayOfMonth = 1;
- $advancedToNewMonth = true;
- do {
-
- $currentMonth++;
- if ($currentMonth>12) {
- $currentYear+=$this->interval;
- $currentMonth = 1;
- }
- } while (!in_array($currentMonth, $this->byMonth));
-
- $this->currentDate->setDate($currentYear, $currentMonth, $currentDayOfMonth);
-
- }
-
- // If we made it here, it means we got a valid occurrence
- $this->currentDate->setDate($currentYear, $currentMonth, $occurrence);
- return;
-
- } else {
-
- // These are the 'byMonth' rules, if there are no byDay or
- // byMonthDay sub-rules.
- do {
-
- $currentMonth++;
- if ($currentMonth>12) {
- $currentYear+=$this->interval;
- $currentMonth = 1;
- }
- } while (!in_array($currentMonth, $this->byMonth));
- $this->currentDate->setDate($currentYear, $currentMonth, $currentDayOfMonth);
-
- return;
-
- }
-
- }
-
- /**
- * Returns all the occurrences for a monthly frequency with a 'byDay' or
- * 'byMonthDay' expansion for the current month.
- *
- * The returned list is an array of integers with the day of month (1-31).
- *
- * @return array
- */
- protected function getMonthlyOccurrences() {
-
- $startDate = clone $this->currentDate;
-
- $byDayResults = array();
-
- // Our strategy is to simply go through the byDays, advance the date to
- // that point and add it to the results.
- if ($this->byDay) foreach($this->byDay as $day) {
-
- $dayName = $this->dayNames[$this->dayMap[substr($day,-2)]];
-
- // Dayname will be something like 'wednesday'. Now we need to find
- // all wednesdays in this month.
- $dayHits = array();
-
- $checkDate = clone $startDate;
- $checkDate->modify('first day of this month');
- $checkDate->modify($dayName);
-
- do {
- $dayHits[] = $checkDate->format('j');
- $checkDate->modify('next ' . $dayName);
- } while ($checkDate->format('n') === $startDate->format('n'));
-
- // So now we have 'all wednesdays' for month. It is however
- // possible that the user only really wanted the 1st, 2nd or last
- // wednesday.
- if (strlen($day)>2) {
- $offset = (int)substr($day,0,-2);
-
- if ($offset>0) {
- // It is possible that the day does not exist, such as a
- // 5th or 6th wednesday of the month.
- if (isset($dayHits[$offset-1])) {
- $byDayResults[] = $dayHits[$offset-1];
- }
- } else {
-
- // if it was negative we count from the end of the array
- $byDayResults[] = $dayHits[count($dayHits) + $offset];
- }
- } else {
- // There was no counter (first, second, last wednesdays), so we
- // just need to add the all to the list).
- $byDayResults = array_merge($byDayResults, $dayHits);
-
- }
-
- }
-
- $byMonthDayResults = array();
- if ($this->byMonthDay) foreach($this->byMonthDay as $monthDay) {
-
- // Removing values that are out of range for this month
- if ($monthDay > $startDate->format('t') ||
- $monthDay < 0-$startDate->format('t')) {
- continue;
- }
- if ($monthDay>0) {
- $byMonthDayResults[] = $monthDay;
- } else {
- // Negative values
- $byMonthDayResults[] = $startDate->format('t') + 1 + $monthDay;
- }
- }
-
- // If there was just byDay or just byMonthDay, they just specify our
- // (almost) final list. If both were provided, then byDay limits the
- // list.
- if ($this->byMonthDay && $this->byDay) {
- $result = array_intersect($byMonthDayResults, $byDayResults);
- } elseif ($this->byMonthDay) {
- $result = $byMonthDayResults;
- } else {
- $result = $byDayResults;
- }
- $result = array_unique($result);
- sort($result, SORT_NUMERIC);
-
- // The last thing that needs checking is the BYSETPOS. If it's set, it
- // means only certain items in the set survive the filter.
- if (!$this->bySetPos) {
- return $result;
- }
-
- $filteredResult = array();
- foreach($this->bySetPos as $setPos) {
-
- if ($setPos<0) {
- $setPos = count($result)-($setPos+1);
- }
- if (isset($result[$setPos-1])) {
- $filteredResult[] = $result[$setPos-1];
- }
- }
-
- sort($filteredResult, SORT_NUMERIC);
- return $filteredResult;
-
- }
-
-
-}
-
diff --git a/3rdparty/Sabre/VObject/Splitter/ICalendar.php b/3rdparty/Sabre/VObject/Splitter/ICalendar.php
deleted file mode 100644
index 7a9a63e1b21..00000000000
--- a/3rdparty/Sabre/VObject/Splitter/ICalendar.php
+++ /dev/null
@@ -1,111 +0,0 @@
-<?php
-
-namespace Sabre\VObject\Splitter;
-
-use Sabre\VObject;
-
-/**
- * Splitter
- *
- * This class is responsible for splitting up iCalendar objects.
- *
- * This class expects a single VCALENDAR object with one or more
- * calendar-objects inside. Objects with identical UID's will be combined into
- * a single object.
- *
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Dominik Tobschall
- * @author Armin Hackmann
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class ICalendar implements SplitterInterface {
-
- /**
- * Timezones
- *
- * @var array
- */
- protected $vtimezones = array();
-
- /**
- * iCalendar objects
- *
- * @var array
- */
- protected $objects = array();
-
- /**
- * Constructor
- *
- * The splitter should receive an readable file stream as it's input.
- *
- * @param resource $input
- */
- public function __construct($input) {
-
- $data = VObject\Reader::read(stream_get_contents($input));
- $vtimezones = array();
- $components = array();
-
- foreach($data->children as $component) {
- if (!$component instanceof VObject\Component) {
- continue;
- }
-
- // Get all timezones
- if ($component->name === 'VTIMEZONE') {
- $this->vtimezones[(string)$component->TZID] = $component;
- continue;
- }
-
- // Get component UID for recurring Events search
- if($component->UID) {
- $uid = (string)$component->UID;
- } else {
- // Generating a random UID
- $uid = sha1(microtime()) . '-vobjectimport';
- }
-
- // Take care of recurring events
- if (!array_key_exists($uid, $this->objects)) {
- $this->objects[$uid] = VObject\Component::create('VCALENDAR');
- }
-
- $this->objects[$uid]->add(clone $component);
- }
-
- }
-
- /**
- * Every time getNext() is called, a new object will be parsed, until we
- * hit the end of the stream.
- *
- * When the end is reached, null will be returned.
- *
- * @return Sabre\VObject\Component|null
- */
- public function getNext() {
-
- if($object=array_shift($this->objects)) {
-
- // create our baseobject
- $object->version = '2.0';
- $object->prodid = '-//Sabre//Sabre VObject ' . VObject\Version::VERSION . '//EN';
- $object->calscale = 'GREGORIAN';
-
- // add vtimezone information to obj (if we have it)
- foreach ($this->vtimezones as $vtimezone) {
- $object->add($vtimezone);
- }
-
- return $object;
-
- } else {
-
- return null;
-
- }
-
- }
-
-}
diff --git a/3rdparty/Sabre/VObject/Splitter/SplitterInterface.php b/3rdparty/Sabre/VObject/Splitter/SplitterInterface.php
deleted file mode 100644
index 9f7a82450e3..00000000000
--- a/3rdparty/Sabre/VObject/Splitter/SplitterInterface.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-
-namespace Sabre\VObject\Splitter;
-
-/**
- * VObject splitter
- *
- * The splitter is responsible for reading a large vCard or iCalendar object,
- * and splitting it into multiple objects.
- *
- * This is for example for Card and CalDAV, which require every event and vcard
- * to exist in their own objects, instead of one large one.
- *
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Dominik Tobschall
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-interface SplitterInterface {
-
- /**
- * Constructor
- *
- * The splitter should receive an readable file stream as it's input.
- *
- * @param resource $input
- */
- function __construct($input);
-
- /**
- * Every time getNext() is called, a new object will be parsed, until we
- * hit the end of the stream.
- *
- * When the end is reached, null will be returned.
- *
- * @return Sabre\VObject\Component|null
- */
- function getNext();
-
-}
diff --git a/3rdparty/Sabre/VObject/Splitter/VCard.php b/3rdparty/Sabre/VObject/Splitter/VCard.php
deleted file mode 100644
index 829491ed07a..00000000000
--- a/3rdparty/Sabre/VObject/Splitter/VCard.php
+++ /dev/null
@@ -1,76 +0,0 @@
-<?php
-
-namespace Sabre\VObject\Splitter;
-
-use Sabre\VObject;
-
-/**
- * Splitter
- *
- * This class is responsible for splitting up VCard objects.
- *
- * It is assumed that the input stream contains 1 or more VCARD objects. This
- * class checks for BEGIN:VCARD and END:VCARD and parses each encountered
- * component individually.
- *
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Dominik Tobschall
- * @author Armin Hackmann
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class VCard implements SplitterInterface {
-
- /**
- * File handle
- *
- * @var resource
- */
- protected $input;
-
- /**
- * Constructor
- *
- * The splitter should receive an readable file stream as it's input.
- *
- * @param resource $input
- */
- public function __construct($input) {
-
- $this->input = $input;
-
- }
-
- /**
- * Every time getNext() is called, a new object will be parsed, until we
- * hit the end of the stream.
- *
- * When the end is reached, null will be returned.
- *
- * @return Sabre\VObject\Component|null
- */
- public function getNext() {
-
- $vcard = '';
-
- do {
-
- if (feof($this->input)) {
- return false;
- }
-
- $line = fgets($this->input);
- $vcard .= $line;
-
- } while(strtoupper(substr($line,0,4))!=="END:");
-
- $object = VObject\Reader::read($vcard);
-
- if($object->name !== 'VCARD') {
- throw new \InvalidArgumentException("Thats no vCard!", 1);
- }
-
- return $object;
-
- }
-
-}
diff --git a/3rdparty/Sabre/VObject/StringUtil.php b/3rdparty/Sabre/VObject/StringUtil.php
deleted file mode 100644
index 886a7135d67..00000000000
--- a/3rdparty/Sabre/VObject/StringUtil.php
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-
-namespace Sabre\VObject;
-
-/**
- * Useful utilities for working with various strings.
- *
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class StringUtil {
-
- /**
- * Returns true or false depending on if a string is valid UTF-8
- *
- * @param string $str
- * @return bool
- */
- static function isUTF8($str) {
-
- // First check.. mb_check_encoding
- if (!mb_check_encoding($str, 'UTF-8')) {
- return false;
- }
-
- // Control characters
- if (preg_match('%(?:[\x00-\x08\x0B-\x0C\x0E\x0F])%', $str)) {
- return false;
- }
-
- return true;
-
- }
-
- /**
- * This method tries its best to convert the input string to UTF-8.
- *
- * Currently only ISO-5991-1 input and UTF-8 input is supported, but this
- * may be expanded upon if we receive other examples.
- *
- * @param string $str
- * @return string
- */
- static function convertToUTF8($str) {
-
- $encoding = mb_detect_encoding($str , array('UTF-8','ISO-8859-1'), true);
-
- if ($encoding === 'ISO-8859-1') {
- $newStr = utf8_encode($str);
- } else {
- $newStr = $str;
- }
-
- // Removing any control characters
- return (preg_replace('%(?:[\x00-\x08\x0B-\x0C\x0E\x0F])%', '', $newStr));
-
- }
-
-}
-
diff --git a/3rdparty/Sabre/VObject/TimeZoneUtil.php b/3rdparty/Sabre/VObject/TimeZoneUtil.php
deleted file mode 100644
index ba73cf34a79..00000000000
--- a/3rdparty/Sabre/VObject/TimeZoneUtil.php
+++ /dev/null
@@ -1,351 +0,0 @@
-<?php
-
-namespace Sabre\VObject;
-
-/**
- * Time zone name translation
- *
- * This file translates well-known time zone names into "Olson database" time zone names.
- *
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Frank Edelhaeuser (fedel@users.sourceforge.net)
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class TimeZoneUtil {
-
- public static $map = array(
-
- // from http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/zone_tzid.html
- // snapshot taken on 2012/01/16
-
- // windows
- 'AUS Central Standard Time'=>'Australia/Darwin',
- 'AUS Eastern Standard Time'=>'Australia/Sydney',
- 'Afghanistan Standard Time'=>'Asia/Kabul',
- 'Alaskan Standard Time'=>'America/Anchorage',
- 'Arab Standard Time'=>'Asia/Riyadh',
- 'Arabian Standard Time'=>'Asia/Dubai',
- 'Arabic Standard Time'=>'Asia/Baghdad',
- 'Argentina Standard Time'=>'America/Buenos_Aires',
- 'Armenian Standard Time'=>'Asia/Yerevan',
- 'Atlantic Standard Time'=>'America/Halifax',
- 'Azerbaijan Standard Time'=>'Asia/Baku',
- 'Azores Standard Time'=>'Atlantic/Azores',
- 'Bangladesh Standard Time'=>'Asia/Dhaka',
- 'Canada Central Standard Time'=>'America/Regina',
- 'Cape Verde Standard Time'=>'Atlantic/Cape_Verde',
- 'Caucasus Standard Time'=>'Asia/Yerevan',
- 'Cen. Australia Standard Time'=>'Australia/Adelaide',
- 'Central America Standard Time'=>'America/Guatemala',
- 'Central Asia Standard Time'=>'Asia/Almaty',
- 'Central Brazilian Standard Time'=>'America/Cuiaba',
- 'Central Europe Standard Time'=>'Europe/Budapest',
- 'Central European Standard Time'=>'Europe/Warsaw',
- 'Central Pacific Standard Time'=>'Pacific/Guadalcanal',
- 'Central Standard Time'=>'America/Chicago',
- 'Central Standard Time (Mexico)'=>'America/Mexico_City',
- 'China Standard Time'=>'Asia/Shanghai',
- 'Dateline Standard Time'=>'Etc/GMT+12',
- 'E. Africa Standard Time'=>'Africa/Nairobi',
- 'E. Australia Standard Time'=>'Australia/Brisbane',
- 'E. Europe Standard Time'=>'Europe/Minsk',
- 'E. South America Standard Time'=>'America/Sao_Paulo',
- 'Eastern Standard Time'=>'America/New_York',
- 'Egypt Standard Time'=>'Africa/Cairo',
- 'Ekaterinburg Standard Time'=>'Asia/Yekaterinburg',
- 'FLE Standard Time'=>'Europe/Kiev',
- 'Fiji Standard Time'=>'Pacific/Fiji',
- 'GMT Standard Time'=>'Europe/London',
- 'GTB Standard Time'=>'Europe/Istanbul',
- 'Georgian Standard Time'=>'Asia/Tbilisi',
- 'Greenland Standard Time'=>'America/Godthab',
- 'Greenwich Standard Time'=>'Atlantic/Reykjavik',
- 'Hawaiian Standard Time'=>'Pacific/Honolulu',
- 'India Standard Time'=>'Asia/Calcutta',
- 'Iran Standard Time'=>'Asia/Tehran',
- 'Israel Standard Time'=>'Asia/Jerusalem',
- 'Jordan Standard Time'=>'Asia/Amman',
- 'Kamchatka Standard Time'=>'Asia/Kamchatka',
- 'Korea Standard Time'=>'Asia/Seoul',
- 'Magadan Standard Time'=>'Asia/Magadan',
- 'Mauritius Standard Time'=>'Indian/Mauritius',
- 'Mexico Standard Time'=>'America/Mexico_City',
- 'Mexico Standard Time 2'=>'America/Chihuahua',
- 'Mid-Atlantic Standard Time'=>'Etc/GMT+2',
- 'Middle East Standard Time'=>'Asia/Beirut',
- 'Montevideo Standard Time'=>'America/Montevideo',
- 'Morocco Standard Time'=>'Africa/Casablanca',
- 'Mountain Standard Time'=>'America/Denver',
- 'Mountain Standard Time (Mexico)'=>'America/Chihuahua',
- 'Myanmar Standard Time'=>'Asia/Rangoon',
- 'N. Central Asia Standard Time'=>'Asia/Novosibirsk',
- 'Namibia Standard Time'=>'Africa/Windhoek',
- 'Nepal Standard Time'=>'Asia/Katmandu',
- 'New Zealand Standard Time'=>'Pacific/Auckland',
- 'Newfoundland Standard Time'=>'America/St_Johns',
- 'North Asia East Standard Time'=>'Asia/Irkutsk',
- 'North Asia Standard Time'=>'Asia/Krasnoyarsk',
- 'Pacific SA Standard Time'=>'America/Santiago',
- 'Pacific Standard Time'=>'America/Los_Angeles',
- 'Pacific Standard Time (Mexico)'=>'America/Santa_Isabel',
- 'Pakistan Standard Time'=>'Asia/Karachi',
- 'Paraguay Standard Time'=>'America/Asuncion',
- 'Romance Standard Time'=>'Europe/Paris',
- 'Russian Standard Time'=>'Europe/Moscow',
- 'SA Eastern Standard Time'=>'America/Cayenne',
- 'SA Pacific Standard Time'=>'America/Bogota',
- 'SA Western Standard Time'=>'America/La_Paz',
- 'SE Asia Standard Time'=>'Asia/Bangkok',
- 'Samoa Standard Time'=>'Pacific/Apia',
- 'Singapore Standard Time'=>'Asia/Singapore',
- 'South Africa Standard Time'=>'Africa/Johannesburg',
- 'Sri Lanka Standard Time'=>'Asia/Colombo',
- 'Syria Standard Time'=>'Asia/Damascus',
- 'Taipei Standard Time'=>'Asia/Taipei',
- 'Tasmania Standard Time'=>'Australia/Hobart',
- 'Tokyo Standard Time'=>'Asia/Tokyo',
- 'Tonga Standard Time'=>'Pacific/Tongatapu',
- 'US Eastern Standard Time'=>'America/Indianapolis',
- 'US Mountain Standard Time'=>'America/Phoenix',
- 'UTC'=>'Etc/GMT',
- 'UTC+12'=>'Etc/GMT-12',
- 'UTC-02'=>'Etc/GMT+2',
- 'UTC-11'=>'Etc/GMT+11',
- 'Ulaanbaatar Standard Time'=>'Asia/Ulaanbaatar',
- 'Venezuela Standard Time'=>'America/Caracas',
- 'Vladivostok Standard Time'=>'Asia/Vladivostok',
- 'W. Australia Standard Time'=>'Australia/Perth',
- 'W. Central Africa Standard Time'=>'Africa/Lagos',
- 'W. Europe Standard Time'=>'Europe/Berlin',
- 'West Asia Standard Time'=>'Asia/Tashkent',
- 'West Pacific Standard Time'=>'Pacific/Port_Moresby',
- 'Yakutsk Standard Time'=>'Asia/Yakutsk',
-
- // Microsoft exchange timezones
- // Source:
- // http://msdn.microsoft.com/en-us/library/ms988620%28v=exchg.65%29.aspx
- //
- // Correct timezones deduced with help from:
- // http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
- 'Universal Coordinated Time' => 'UTC',
- 'Casablanca, Monrovia' => 'Africa/Casablanca',
- 'Greenwich Mean Time: Dublin, Edinburgh, Lisbon, London' => 'Europe/Lisbon',
- 'Greenwich Mean Time; Dublin, Edinburgh, London' => 'Europe/London',
- 'Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna' => 'Europe/Berlin',
- 'Belgrade, Pozsony, Budapest, Ljubljana, Prague' => 'Europe/Prague',
- 'Brussels, Copenhagen, Madrid, Paris' => 'Europe/Paris',
- 'Paris, Madrid, Brussels, Copenhagen' => 'Europe/Paris',
- 'Prague, Central Europe' => 'Europe/Prague',
- 'Sarajevo, Skopje, Sofija, Vilnius, Warsaw, Zagreb' => 'Europe/Sarajevo',
- 'West Central Africa' => 'Africa/Luanda', // This was a best guess
- 'Athens, Istanbul, Minsk' => 'Europe/Athens',
- 'Bucharest' => 'Europe/Bucharest',
- 'Cairo' => 'Africa/Cairo',
- 'Harare, Pretoria' => 'Africa/Harare',
- 'Helsinki, Riga, Tallinn' => 'Europe/Helsinki',
- 'Israel, Jerusalem Standard Time' => 'Asia/Jerusalem',
- 'Baghdad' => 'Asia/Baghdad',
- 'Arab, Kuwait, Riyadh' => 'Asia/Kuwait',
- 'Moscow, St. Petersburg, Volgograd' => 'Europe/Moscow',
- 'East Africa, Nairobi' => 'Africa/Nairobi',
- 'Tehran' => 'Asia/Tehran',
- 'Abu Dhabi, Muscat' => 'Asia/Muscat', // Best guess
- 'Baku, Tbilisi, Yerevan' => 'Asia/Baku',
- 'Kabul' => 'Asia/Kabul',
- 'Ekaterinburg' => 'Asia/Yekaterinburg',
- 'Islamabad, Karachi, Tashkent' => 'Asia/Karachi',
- 'Kolkata, Chennai, Mumbai, New Delhi, India Standard Time' => 'Asia/Calcutta',
- 'Kathmandu, Nepal' => 'Asia/Kathmandu',
- 'Almaty, Novosibirsk, North Central Asia' => 'Asia/Almaty',
- 'Astana, Dhaka' => 'Asia/Dhaka',
- 'Sri Jayawardenepura, Sri Lanka' => 'Asia/Colombo',
- 'Rangoon' => 'Asia/Rangoon',
- 'Bangkok, Hanoi, Jakarta' => 'Asia/Bangkok',
- 'Krasnoyarsk' => 'Asia/Krasnoyarsk',
- 'Beijing, Chongqing, Hong Kong SAR, Urumqi' => 'Asia/Shanghai',
- 'Irkutsk, Ulaan Bataar' => 'Asia/Irkutsk',
- 'Kuala Lumpur, Singapore' => 'Asia/Singapore',
- 'Perth, Western Australia' => 'Australia/Perth',
- 'Taipei' => 'Asia/Taipei',
- 'Osaka, Sapporo, Tokyo' => 'Asia/Tokyo',
- 'Seoul, Korea Standard time' => 'Asia/Seoul',
- 'Yakutsk' => 'Asia/Yakutsk',
- 'Adelaide, Central Australia' => 'Australia/Adelaide',
- 'Darwin' => 'Australia/Darwin',
- 'Brisbane, East Australia' => 'Australia/Brisbane',
- 'Canberra, Melbourne, Sydney, Hobart (year 2000 only)' => 'Australia/Sydney',
- 'Guam, Port Moresby' => 'Pacific/Guam',
- 'Hobart, Tasmania' => 'Australia/Hobart',
- 'Vladivostok' => 'Asia/Vladivostok',
- 'Magadan, Solomon Is., New Caledonia' => 'Asia/Magadan',
- 'Auckland, Wellington' => 'Pacific/Auckland',
- 'Fiji Islands, Kamchatka, Marshall Is.' => 'Pacific/Fiji',
- 'Nuku\'alofa, Tonga' => 'Pacific/Tongatapu',
- 'Azores' => 'Atlantic/Azores',
- 'Cape Verde Is.' => 'Atlantic/Cape_Verde',
- 'Mid-Atlantic' => 'America/Noronha',
- 'Brasilia' => 'America/Sao_Paulo', // Best guess
- 'Buenos Aires' => 'America/Argentina/Buenos_Aires',
- 'Greenland' => 'America/Godthab',
- 'Newfoundland' => 'America/St_Johns',
- 'Atlantic Time (Canada)' => 'America/Halifax',
- 'Caracas, La Paz' => 'America/Caracas',
- 'Santiago' => 'America/Santiago',
- 'Bogota, Lima, Quito' => 'America/Bogota',
- 'Eastern Time (US & Canada)' => 'America/New_York',
- 'Indiana (East)' => 'America/Indiana/Indianapolis',
- 'Central America' => 'America/Guatemala',
- 'Central Time (US & Canada)' => 'America/Chicago',
- 'Mexico City, Tegucigalpa' => 'America/Mexico_City',
- 'Saskatchewan' => 'America/Edmonton',
- 'Arizona' => 'America/Phoenix',
- 'Mountain Time (US & Canada)' => 'America/Denver', // Best guess
- 'Pacific Time (US & Canada); Tijuana' => 'America/Los_Angeles', // Best guess
- 'Alaska' => 'America/Anchorage',
- 'Hawaii' => 'Pacific/Honolulu',
- 'Midway Island, Samoa' => 'Pacific/Midway',
- 'Eniwetok, Kwajalein, Dateline Time' => 'Pacific/Kwajalein',
-
- );
-
- public static $microsoftExchangeMap = array(
- 0 => 'UTC',
- 31 => 'Africa/Casablanca',
- 2 => 'Europe/Lisbon',
- 1 => 'Europe/London',
- 4 => 'Europe/Berlin',
- 6 => 'Europe/Prague',
- 3 => 'Europe/Paris',
- 69 => 'Africa/Luanda', // This was a best guess
- 7 => 'Europe/Athens',
- 5 => 'Europe/Bucharest',
- 49 => 'Africa/Cairo',
- 50 => 'Africa/Harare',
- 59 => 'Europe/Helsinki',
- 27 => 'Asia/Jerusalem',
- 26 => 'Asia/Baghdad',
- 74 => 'Asia/Kuwait',
- 51 => 'Europe/Moscow',
- 56 => 'Africa/Nairobi',
- 25 => 'Asia/Tehran',
- 24 => 'Asia/Muscat', // Best guess
- 54 => 'Asia/Baku',
- 48 => 'Asia/Kabul',
- 58 => 'Asia/Yekaterinburg',
- 47 => 'Asia/Karachi',
- 23 => 'Asia/Calcutta',
- 62 => 'Asia/Kathmandu',
- 46 => 'Asia/Almaty',
- 71 => 'Asia/Dhaka',
- 66 => 'Asia/Colombo',
- 61 => 'Asia/Rangoon',
- 22 => 'Asia/Bangkok',
- 64 => 'Asia/Krasnoyarsk',
- 45 => 'Asia/Shanghai',
- 63 => 'Asia/Irkutsk',
- 21 => 'Asia/Singapore',
- 73 => 'Australia/Perth',
- 75 => 'Asia/Taipei',
- 20 => 'Asia/Tokyo',
- 72 => 'Asia/Seoul',
- 70 => 'Asia/Yakutsk',
- 19 => 'Australia/Adelaide',
- 44 => 'Australia/Darwin',
- 18 => 'Australia/Brisbane',
- 76 => 'Australia/Sydney',
- 43 => 'Pacific/Guam',
- 42 => 'Australia/Hobart',
- 68 => 'Asia/Vladivostok',
- 41 => 'Asia/Magadan',
- 17 => 'Pacific/Auckland',
- 40 => 'Pacific/Fiji',
- 67 => 'Pacific/Tongatapu',
- 29 => 'Atlantic/Azores',
- 53 => 'Atlantic/Cape_Verde',
- 30 => 'America/Noronha',
- 8 => 'America/Sao_Paulo', // Best guess
- 32 => 'America/Argentina/Buenos_Aires',
- 60 => 'America/Godthab',
- 28 => 'America/St_Johns',
- 9 => 'America/Halifax',
- 33 => 'America/Caracas',
- 65 => 'America/Santiago',
- 35 => 'America/Bogota',
- 10 => 'America/New_York',
- 34 => 'America/Indiana/Indianapolis',
- 55 => 'America/Guatemala',
- 11 => 'America/Chicago',
- 37 => 'America/Mexico_City',
- 36 => 'America/Edmonton',
- 38 => 'America/Phoenix',
- 12 => 'America/Denver', // Best guess
- 13 => 'America/Los_Angeles', // Best guess
- 14 => 'America/Anchorage',
- 15 => 'Pacific/Honolulu',
- 16 => 'Pacific/Midway',
- 39 => 'Pacific/Kwajalein',
- );
-
- /**
- * This method will try to find out the correct timezone for an iCalendar
- * date-time value.
- *
- * You must pass the contents of the TZID parameter, as well as the full
- * calendar.
- *
- * If the lookup fails, this method will return UTC.
- *
- * @param string $tzid
- * @param Sabre\VObject\Component $vcalendar
- * @return DateTimeZone
- */
- static public function getTimeZone($tzid, Component $vcalendar = null) {
-
- // First we will just see if the tzid is a support timezone identifier.
- try {
- return new \DateTimeZone($tzid);
- } catch (\Exception $e) {
- }
-
- // Next, we check if the tzid is somewhere in our tzid map.
- if (isset(self::$map[$tzid])) {
- return new \DateTimeZone(self::$map[$tzid]);
- }
-
- if ($vcalendar) {
-
- // If that didn't work, we will scan VTIMEZONE objects
- foreach($vcalendar->select('VTIMEZONE') as $vtimezone) {
-
- if ((string)$vtimezone->TZID === $tzid) {
-
- // Some clients add 'X-LIC-LOCATION' with the olson name.
- if (isset($vtimezone->{'X-LIC-LOCATION'})) {
- try {
- return new \DateTimeZone($vtimezone->{'X-LIC-LOCATION'});
- } catch (\Exception $e) {
- }
-
- }
- // Microsoft may add a magic number, which we also have an
- // answer for.
- if (isset($vtimezone->{'X-MICROSOFT-CDO-TZID'})) {
- if (isset(self::$microsoftExchangeMap[(int)$vtimezone->{'X-MICROSOFT-CDO-TZID'}->value])) {
- return new \DateTimeZone(self::$microsoftExchangeMap[(int)$vtimezone->{'X-MICROSOFT-CDO-TZID'}->value]);
- }
- }
- }
-
- }
-
- }
-
- // If we got all the way here, we default to UTC.
- return new \DateTimeZone(date_default_timezone_get());
-
-
- }
-
-
-}
diff --git a/3rdparty/Sabre/VObject/Version.php b/3rdparty/Sabre/VObject/Version.php
deleted file mode 100644
index 0065b7abc95..00000000000
--- a/3rdparty/Sabre/VObject/Version.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-namespace Sabre\VObject;
-
-/**
- * This class contains the version number for the VObject package
- *
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Version {
-
- /**
- * Full version number
- */
- const VERSION = '2.0.2';
-
- /**
- * Stability : alpha, beta, stable
- */
- const STABILITY = 'stable';
-
-}
diff --git a/3rdparty/Sabre/VObject/includes.php b/3rdparty/Sabre/VObject/includes.php
deleted file mode 100644
index b74bd3b6cbf..00000000000
--- a/3rdparty/Sabre/VObject/includes.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-
-/**
- * Includes file
- *
- * This file includes the entire VObject library in one go.
- * The benefit is that an autoloader is not needed, which is often faster.
- *
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-
-// Begin includes
-include __DIR__ . '/DateTimeParser.php';
-include __DIR__ . '/ElementList.php';
-include __DIR__ . '/FreeBusyGenerator.php';
-include __DIR__ . '/Node.php';
-include __DIR__ . '/Parameter.php';
-include __DIR__ . '/ParseException.php';
-include __DIR__ . '/Property.php';
-include __DIR__ . '/Reader.php';
-include __DIR__ . '/RecurrenceIterator.php';
-include __DIR__ . '/Splitter/SplitterInterface.php';
-include __DIR__ . '/StringUtil.php';
-include __DIR__ . '/TimeZoneUtil.php';
-include __DIR__ . '/Version.php';
-include __DIR__ . '/Splitter/VCard.php';
-include __DIR__ . '/Component.php';
-include __DIR__ . '/Property/Compound.php';
-include __DIR__ . '/Property/DateTime.php';
-include __DIR__ . '/Property/MultiDateTime.php';
-include __DIR__ . '/Splitter/ICalendar.php';
-include __DIR__ . '/Component/VAlarm.php';
-include __DIR__ . '/Component/VCalendar.php';
-include __DIR__ . '/Component/VEvent.php';
-include __DIR__ . '/Component/VFreeBusy.php';
-include __DIR__ . '/Component/VJournal.php';
-include __DIR__ . '/Component/VTodo.php';
-// End includes
diff --git a/3rdparty/Sabre/autoload.php b/3rdparty/Sabre/autoload.php
deleted file mode 100644
index 505bd36efb0..00000000000
--- a/3rdparty/Sabre/autoload.php
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-
-/**
- * SabreDAV's autoloader
- *
- * This file is kept for backwards compatibility purposes.
- * SabreDAV now uses the composer autoloader.
- *
- * You should stop including this file, and include 'vendor/autoload.php'
- * instead.
- *
- * @package Sabre
- * @subpackage DAV
- * @deprecated Will be removed in a future version!
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-
-/**
- * We are assuming that the composer autoloader is just 2 directories up.
- *
- * This is not the case when sabredav is installed as a dependency. But, in
- * those cases it's not expected that people will look for this file anyway.
- */
-
-require __DIR__ . '/../../vendor/autoload.php';
diff --git a/3rdparty/System.php b/3rdparty/System.php
deleted file mode 100644
index c27d44658e3..00000000000
--- a/3rdparty/System.php
+++ /dev/null
@@ -1,629 +0,0 @@
-<?php
-/**
- * File/Directory manipulation
- *
- * PHP versions 4 and 5
- *
- * @category pear
- * @package System
- * @author Tomas V.V.Cox <cox@idecnet.com>
- * @copyright 1997-2009 The Authors
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: System.php 313024 2011-07-06 19:51:24Z dufuz $
- * @link http://pear.php.net/package/PEAR
- * @since File available since Release 0.1
- */
-
-/**
- * base class
- */
-require_once 'PEAR.php';
-require_once 'Console/Getopt.php';
-
-$GLOBALS['_System_temp_files'] = array();
-
-/**
-* System offers cross plattform compatible system functions
-*
-* Static functions for different operations. Should work under
-* Unix and Windows. The names and usage has been taken from its respectively
-* GNU commands. The functions will return (bool) false on error and will
-* trigger the error with the PHP trigger_error() function (you can silence
-* the error by prefixing a '@' sign after the function call, but this
-* is not recommended practice. Instead use an error handler with
-* {@link set_error_handler()}).
-*
-* Documentation on this class you can find in:
-* http://pear.php.net/manual/
-*
-* Example usage:
-* if (!@System::rm('-r file1 dir1')) {
-* print "could not delete file1 or dir1";
-* }
-*
-* In case you need to to pass file names with spaces,
-* pass the params as an array:
-*
-* System::rm(array('-r', $file1, $dir1));
-*
-* @category pear
-* @package System
-* @author Tomas V.V. Cox <cox@idecnet.com>
-* @copyright 1997-2006 The PHP Group
-* @license http://opensource.org/licenses/bsd-license.php New BSD License
-* @version Release: 1.9.4
-* @link http://pear.php.net/package/PEAR
-* @since Class available since Release 0.1
-* @static
-*/
-class System
-{
- /**
- * returns the commandline arguments of a function
- *
- * @param string $argv the commandline
- * @param string $short_options the allowed option short-tags
- * @param string $long_options the allowed option long-tags
- * @return array the given options and there values
- * @static
- * @access private
- */
- function _parseArgs($argv, $short_options, $long_options = null)
- {
- if (!is_array($argv) && $argv !== null) {
- // Find all items, quoted or otherwise
- preg_match_all("/(?:[\"'])(.*?)(?:['\"])|([^\s]+)/", $argv, $av);
- $argv = $av[1];
- foreach ($av[2] as $k => $a) {
- if (empty($a)) {
- continue;
- }
- $argv[$k] = trim($a) ;
- }
- }
- return Console_Getopt::getopt2($argv, $short_options, $long_options);
- }
-
- /**
- * Output errors with PHP trigger_error(). You can silence the errors
- * with prefixing a "@" sign to the function call: @System::mkdir(..);
- *
- * @param mixed $error a PEAR error or a string with the error message
- * @return bool false
- * @static
- * @access private
- */
- function raiseError($error)
- {
- if (PEAR::isError($error)) {
- $error = $error->getMessage();
- }
- trigger_error($error, E_USER_WARNING);
- return false;
- }
-
- /**
- * Creates a nested array representing the structure of a directory
- *
- * System::_dirToStruct('dir1', 0) =>
- * Array
- * (
- * [dirs] => Array
- * (
- * [0] => dir1
- * )
- *
- * [files] => Array
- * (
- * [0] => dir1/file2
- * [1] => dir1/file3
- * )
- * )
- * @param string $sPath Name of the directory
- * @param integer $maxinst max. deep of the lookup
- * @param integer $aktinst starting deep of the lookup
- * @param bool $silent if true, do not emit errors.
- * @return array the structure of the dir
- * @static
- * @access private
- */
- function _dirToStruct($sPath, $maxinst, $aktinst = 0, $silent = false)
- {
- $struct = array('dirs' => array(), 'files' => array());
- if (($dir = @opendir($sPath)) === false) {
- if (!$silent) {
- System::raiseError("Could not open dir $sPath");
- }
- return $struct; // XXX could not open error
- }
-
- $struct['dirs'][] = $sPath = realpath($sPath); // XXX don't add if '.' or '..' ?
- $list = array();
- while (false !== ($file = readdir($dir))) {
- if ($file != '.' && $file != '..') {
- $list[] = $file;
- }
- }
-
- closedir($dir);
- natsort($list);
- if ($aktinst < $maxinst || $maxinst == 0) {
- foreach ($list as $val) {
- $path = $sPath . DIRECTORY_SEPARATOR . $val;
- if (is_dir($path) && !is_link($path)) {
- $tmp = System::_dirToStruct($path, $maxinst, $aktinst+1, $silent);
- $struct = array_merge_recursive($struct, $tmp);
- } else {
- $struct['files'][] = $path;
- }
- }
- }
-
- return $struct;
- }
-
- /**
- * Creates a nested array representing the structure of a directory and files
- *
- * @param array $files Array listing files and dirs
- * @return array
- * @static
- * @see System::_dirToStruct()
- */
- function _multipleToStruct($files)
- {
- $struct = array('dirs' => array(), 'files' => array());
- settype($files, 'array');
- foreach ($files as $file) {
- if (is_dir($file) && !is_link($file)) {
- $tmp = System::_dirToStruct($file, 0);
- $struct = array_merge_recursive($tmp, $struct);
- } else {
- if (!in_array($file, $struct['files'])) {
- $struct['files'][] = $file;
- }
- }
- }
- return $struct;
- }
-
- /**
- * The rm command for removing files.
- * Supports multiple files and dirs and also recursive deletes
- *
- * @param string $args the arguments for rm
- * @return mixed PEAR_Error or true for success
- * @static
- * @access public
- */
- function rm($args)
- {
- $opts = System::_parseArgs($args, 'rf'); // "f" does nothing but I like it :-)
- if (PEAR::isError($opts)) {
- return System::raiseError($opts);
- }
- foreach ($opts[0] as $opt) {
- if ($opt[0] == 'r') {
- $do_recursive = true;
- }
- }
- $ret = true;
- if (isset($do_recursive)) {
- $struct = System::_multipleToStruct($opts[1]);
- foreach ($struct['files'] as $file) {
- if (!@unlink($file)) {
- $ret = false;
- }
- }
-
- rsort($struct['dirs']);
- foreach ($struct['dirs'] as $dir) {
- if (!@rmdir($dir)) {
- $ret = false;
- }
- }
- } else {
- foreach ($opts[1] as $file) {
- $delete = (is_dir($file)) ? 'rmdir' : 'unlink';
- if (!@$delete($file)) {
- $ret = false;
- }
- }
- }
- return $ret;
- }
-
- /**
- * Make directories.
- *
- * The -p option will create parent directories
- * @param string $args the name of the director(y|ies) to create
- * @return bool True for success
- * @static
- * @access public
- */
- function mkDir($args)
- {
- $opts = System::_parseArgs($args, 'pm:');
- if (PEAR::isError($opts)) {
- return System::raiseError($opts);
- }
-
- $mode = 0777; // default mode
- foreach ($opts[0] as $opt) {
- if ($opt[0] == 'p') {
- $create_parents = true;
- } elseif ($opt[0] == 'm') {
- // if the mode is clearly an octal number (starts with 0)
- // convert it to decimal
- if (strlen($opt[1]) && $opt[1]{0} == '0') {
- $opt[1] = octdec($opt[1]);
- } else {
- // convert to int
- $opt[1] += 0;
- }
- $mode = $opt[1];
- }
- }
-
- $ret = true;
- if (isset($create_parents)) {
- foreach ($opts[1] as $dir) {
- $dirstack = array();
- while ((!file_exists($dir) || !is_dir($dir)) &&
- $dir != DIRECTORY_SEPARATOR) {
- array_unshift($dirstack, $dir);
- $dir = dirname($dir);
- }
-
- while ($newdir = array_shift($dirstack)) {
- if (!is_writeable(dirname($newdir))) {
- $ret = false;
- break;
- }
-
- if (!mkdir($newdir, $mode)) {
- $ret = false;
- }
- }
- }
- } else {
- foreach($opts[1] as $dir) {
- if ((@file_exists($dir) || !is_dir($dir)) && !mkdir($dir, $mode)) {
- $ret = false;
- }
- }
- }
-
- return $ret;
- }
-
- /**
- * Concatenate files
- *
- * Usage:
- * 1) $var = System::cat('sample.txt test.txt');
- * 2) System::cat('sample.txt test.txt > final.txt');
- * 3) System::cat('sample.txt test.txt >> final.txt');
- *
- * Note: as the class use fopen, urls should work also (test that)
- *
- * @param string $args the arguments
- * @return boolean true on success
- * @static
- * @access public
- */
- function &cat($args)
- {
- $ret = null;
- $files = array();
- if (!is_array($args)) {
- $args = preg_split('/\s+/', $args, -1, PREG_SPLIT_NO_EMPTY);
- }
-
- $count_args = count($args);
- for ($i = 0; $i < $count_args; $i++) {
- if ($args[$i] == '>') {
- $mode = 'wb';
- $outputfile = $args[$i+1];
- break;
- } elseif ($args[$i] == '>>') {
- $mode = 'ab+';
- $outputfile = $args[$i+1];
- break;
- } else {
- $files[] = $args[$i];
- }
- }
- $outputfd = false;
- if (isset($mode)) {
- if (!$outputfd = fopen($outputfile, $mode)) {
- $err = System::raiseError("Could not open $outputfile");
- return $err;
- }
- $ret = true;
- }
- foreach ($files as $file) {
- if (!$fd = fopen($file, 'r')) {
- System::raiseError("Could not open $file");
- continue;
- }
- while ($cont = fread($fd, 2048)) {
- if (is_resource($outputfd)) {
- fwrite($outputfd, $cont);
- } else {
- $ret .= $cont;
- }
- }
- fclose($fd);
- }
- if (is_resource($outputfd)) {
- fclose($outputfd);
- }
- return $ret;
- }
-
- /**
- * Creates temporary files or directories. This function will remove
- * the created files when the scripts finish its execution.
- *
- * Usage:
- * 1) $tempfile = System::mktemp("prefix");
- * 2) $tempdir = System::mktemp("-d prefix");
- * 3) $tempfile = System::mktemp();
- * 4) $tempfile = System::mktemp("-t /var/tmp prefix");
- *
- * prefix -> The string that will be prepended to the temp name
- * (defaults to "tmp").
- * -d -> A temporary dir will be created instead of a file.
- * -t -> The target dir where the temporary (file|dir) will be created. If
- * this param is missing by default the env vars TMP on Windows or
- * TMPDIR in Unix will be used. If these vars are also missing
- * c:\windows\temp or /tmp will be used.
- *
- * @param string $args The arguments
- * @return mixed the full path of the created (file|dir) or false
- * @see System::tmpdir()
- * @static
- * @access public
- */
- function mktemp($args = null)
- {
- static $first_time = true;
- $opts = System::_parseArgs($args, 't:d');
- if (PEAR::isError($opts)) {
- return System::raiseError($opts);
- }
-
- foreach ($opts[0] as $opt) {
- if ($opt[0] == 'd') {
- $tmp_is_dir = true;
- } elseif ($opt[0] == 't') {
- $tmpdir = $opt[1];
- }
- }
-
- $prefix = (isset($opts[1][0])) ? $opts[1][0] : 'tmp';
- if (!isset($tmpdir)) {
- $tmpdir = System::tmpdir();
- }
-
- if (!System::mkDir(array('-p', $tmpdir))) {
- return false;
- }
-
- $tmp = tempnam($tmpdir, $prefix);
- if (isset($tmp_is_dir)) {
- unlink($tmp); // be careful possible race condition here
- if (!mkdir($tmp, 0700)) {
- return System::raiseError("Unable to create temporary directory $tmpdir");
- }
- }
-
- $GLOBALS['_System_temp_files'][] = $tmp;
- if (isset($tmp_is_dir)) {
- //$GLOBALS['_System_temp_files'][] = dirname($tmp);
- }
-
- if ($first_time) {
- PEAR::registerShutdownFunc(array('System', '_removeTmpFiles'));
- $first_time = false;
- }
-
- return $tmp;
- }
-
- /**
- * Remove temporary files created my mkTemp. This function is executed
- * at script shutdown time
- *
- * @static
- * @access private
- */
- function _removeTmpFiles()
- {
- if (count($GLOBALS['_System_temp_files'])) {
- $delete = $GLOBALS['_System_temp_files'];
- array_unshift($delete, '-r');
- System::rm($delete);
- $GLOBALS['_System_temp_files'] = array();
- }
- }
-
- /**
- * Get the path of the temporal directory set in the system
- * by looking in its environments variables.
- * Note: php.ini-recommended removes the "E" from the variables_order setting,
- * making unavaible the $_ENV array, that s why we do tests with _ENV
- *
- * @static
- * @return string The temporary directory on the system
- */
- function tmpdir()
- {
- if (OS_WINDOWS) {
- if ($var = isset($_ENV['TMP']) ? $_ENV['TMP'] : getenv('TMP')) {
- return $var;
- }
- if ($var = isset($_ENV['TEMP']) ? $_ENV['TEMP'] : getenv('TEMP')) {
- return $var;
- }
- if ($var = isset($_ENV['USERPROFILE']) ? $_ENV['USERPROFILE'] : getenv('USERPROFILE')) {
- return $var;
- }
- if ($var = isset($_ENV['windir']) ? $_ENV['windir'] : getenv('windir')) {
- return $var;
- }
- return getenv('SystemRoot') . '\temp';
- }
- if ($var = isset($_ENV['TMPDIR']) ? $_ENV['TMPDIR'] : getenv('TMPDIR')) {
- return $var;
- }
- return realpath('/tmp');
- }
-
- /**
- * The "which" command (show the full path of a command)
- *
- * @param string $program The command to search for
- * @param mixed $fallback Value to return if $program is not found
- *
- * @return mixed A string with the full path or false if not found
- * @static
- * @author Stig Bakken <ssb@php.net>
- */
- function which($program, $fallback = false)
- {
- // enforce API
- if (!is_string($program) || '' == $program) {
- return $fallback;
- }
-
- // full path given
- if (basename($program) != $program) {
- $path_elements[] = dirname($program);
- $program = basename($program);
- } else {
- // Honor safe mode
- if (!ini_get('safe_mode') || !$path = ini_get('safe_mode_exec_dir')) {
- $path = getenv('PATH');
- if (!$path) {
- $path = getenv('Path'); // some OSes are just stupid enough to do this
- }
- }
- $path_elements = explode(PATH_SEPARATOR, $path);
- }
-
- if (OS_WINDOWS) {
- $exe_suffixes = getenv('PATHEXT')
- ? explode(PATH_SEPARATOR, getenv('PATHEXT'))
- : array('.exe','.bat','.cmd','.com');
- // allow passing a command.exe param
- if (strpos($program, '.') !== false) {
- array_unshift($exe_suffixes, '');
- }
- // is_executable() is not available on windows for PHP4
- $pear_is_executable = (function_exists('is_executable')) ? 'is_executable' : 'is_file';
- } else {
- $exe_suffixes = array('');
- $pear_is_executable = 'is_executable';
- }
-
- foreach ($exe_suffixes as $suff) {
- foreach ($path_elements as $dir) {
- $file = $dir . DIRECTORY_SEPARATOR . $program . $suff;
- if (@$pear_is_executable($file)) {
- return $file;
- }
- }
- }
- return $fallback;
- }
-
- /**
- * The "find" command
- *
- * Usage:
- *
- * System::find($dir);
- * System::find("$dir -type d");
- * System::find("$dir -type f");
- * System::find("$dir -name *.php");
- * System::find("$dir -name *.php -name *.htm*");
- * System::find("$dir -maxdepth 1");
- *
- * Params implmented:
- * $dir -> Start the search at this directory
- * -type d -> return only directories
- * -type f -> return only files
- * -maxdepth <n> -> max depth of recursion
- * -name <pattern> -> search pattern (bash style). Multiple -name param allowed
- *
- * @param mixed Either array or string with the command line
- * @return array Array of found files
- * @static
- *
- */
- function find($args)
- {
- if (!is_array($args)) {
- $args = preg_split('/\s+/', $args, -1, PREG_SPLIT_NO_EMPTY);
- }
- $dir = realpath(array_shift($args));
- if (!$dir) {
- return array();
- }
- $patterns = array();
- $depth = 0;
- $do_files = $do_dirs = true;
- $args_count = count($args);
- for ($i = 0; $i < $args_count; $i++) {
- switch ($args[$i]) {
- case '-type':
- if (in_array($args[$i+1], array('d', 'f'))) {
- if ($args[$i+1] == 'd') {
- $do_files = false;
- } else {
- $do_dirs = false;
- }
- }
- $i++;
- break;
- case '-name':
- $name = preg_quote($args[$i+1], '#');
- // our magic characters ? and * have just been escaped,
- // so now we change the escaped versions to PCRE operators
- $name = strtr($name, array('\?' => '.', '\*' => '.*'));
- $patterns[] = '('.$name.')';
- $i++;
- break;
- case '-maxdepth':
- $depth = $args[$i+1];
- break;
- }
- }
- $path = System::_dirToStruct($dir, $depth, 0, true);
- if ($do_files && $do_dirs) {
- $files = array_merge($path['files'], $path['dirs']);
- } elseif ($do_dirs) {
- $files = $path['dirs'];
- } else {
- $files = $path['files'];
- }
- if (count($patterns)) {
- $dsq = preg_quote(DIRECTORY_SEPARATOR, '#');
- $pattern = '#(^|'.$dsq.')'.implode('|', $patterns).'($|'.$dsq.')#';
- $ret = array();
- $files_count = count($files);
- for ($i = 0; $i < $files_count; $i++) {
- // only search in the part of the file below the current directory
- $filepart = basename($files[$i]);
- if (preg_match($pattern, $filepart)) {
- $ret[] = $files[$i];
- }
- }
- return $ret;
- }
- return $files;
- }
-} \ No newline at end of file
diff --git a/3rdparty/XML/Parser.php b/3rdparty/XML/Parser.php
deleted file mode 100644
index 04dd348753d..00000000000
--- a/3rdparty/XML/Parser.php
+++ /dev/null
@@ -1,754 +0,0 @@
-<?php
-
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * XML_Parser
- *
- * XML Parser package
- *
- * PHP versions 4 and 5
- *
- * LICENSE:
- *
- * Copyright (c) 2002-2008 The PHP Group
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * @category XML
- * @package XML_Parser
- * @author Stig Bakken <ssb@fast.no>
- * @author Tomas V.V.Cox <cox@idecnet.com>
- * @author Stephan Schmidt <schst@php.net>
- * @copyright 2002-2008 The PHP Group
- * @license http://opensource.org/licenses/bsd-license New BSD License
- * @version CVS: $Id: Parser.php 302733 2010-08-24 01:09:09Z clockwerx $
- * @link http://pear.php.net/package/XML_Parser
- */
-
-/**
- * uses PEAR's error handling
- */
-require_once 'PEAR.php';
-
-/**
- * resource could not be created
- */
-define('XML_PARSER_ERROR_NO_RESOURCE', 200);
-
-/**
- * unsupported mode
- */
-define('XML_PARSER_ERROR_UNSUPPORTED_MODE', 201);
-
-/**
- * invalid encoding was given
- */
-define('XML_PARSER_ERROR_INVALID_ENCODING', 202);
-
-/**
- * specified file could not be read
- */
-define('XML_PARSER_ERROR_FILE_NOT_READABLE', 203);
-
-/**
- * invalid input
- */
-define('XML_PARSER_ERROR_INVALID_INPUT', 204);
-
-/**
- * remote file cannot be retrieved in safe mode
- */
-define('XML_PARSER_ERROR_REMOTE', 205);
-
-/**
- * XML Parser class.
- *
- * This is an XML parser based on PHP's "xml" extension,
- * based on the bundled expat library.
- *
- * Notes:
- * - It requires PHP 4.0.4pl1 or greater
- * - From revision 1.17, the function names used by the 'func' mode
- * are in the format "xmltag_$elem", for example: use "xmltag_name"
- * to handle the <name></name> tags of your xml file.
- * - different parsing modes
- *
- * @category XML
- * @package XML_Parser
- * @author Stig Bakken <ssb@fast.no>
- * @author Tomas V.V.Cox <cox@idecnet.com>
- * @author Stephan Schmidt <schst@php.net>
- * @copyright 2002-2008 The PHP Group
- * @license http://opensource.org/licenses/bsd-license New BSD License
- * @version Release: @package_version@
- * @link http://pear.php.net/package/XML_Parser
- * @todo create XML_Parser_Namespace to parse documents with namespaces
- * @todo create XML_Parser_Pull
- * @todo Tests that need to be made:
- * - mixing character encodings
- * - a test using all expat handlers
- * - options (folding, output charset)
- */
-class XML_Parser extends PEAR
-{
- // {{{ properties
-
- /**
- * XML parser handle
- *
- * @var resource
- * @see xml_parser_create()
- */
- var $parser;
-
- /**
- * File handle if parsing from a file
- *
- * @var resource
- */
- var $fp;
-
- /**
- * Whether to do case folding
- *
- * If set to true, all tag and attribute names will
- * be converted to UPPER CASE.
- *
- * @var boolean
- */
- var $folding = true;
-
- /**
- * Mode of operation, one of "event" or "func"
- *
- * @var string
- */
- var $mode;
-
- /**
- * Mapping from expat handler function to class method.
- *
- * @var array
- */
- var $handler = array(
- 'character_data_handler' => 'cdataHandler',
- 'default_handler' => 'defaultHandler',
- 'processing_instruction_handler' => 'piHandler',
- 'unparsed_entity_decl_handler' => 'unparsedHandler',
- 'notation_decl_handler' => 'notationHandler',
- 'external_entity_ref_handler' => 'entityrefHandler'
- );
-
- /**
- * source encoding
- *
- * @var string
- */
- var $srcenc;
-
- /**
- * target encoding
- *
- * @var string
- */
- var $tgtenc;
-
- /**
- * handler object
- *
- * @var object
- */
- var $_handlerObj;
-
- /**
- * valid encodings
- *
- * @var array
- */
- var $_validEncodings = array('ISO-8859-1', 'UTF-8', 'US-ASCII');
-
- // }}}
- // {{{ php5 constructor
-
- /**
- * PHP5 constructor
- *
- * @param string $srcenc source charset encoding, use NULL (default) to use
- * whatever the document specifies
- * @param string $mode how this parser object should work, "event" for
- * startelement/endelement-type events, "func"
- * to have it call functions named after elements
- * @param string $tgtenc a valid target encoding
- */
- function __construct($srcenc = null, $mode = 'event', $tgtenc = null)
- {
- $this->PEAR('XML_Parser_Error');
-
- $this->mode = $mode;
- $this->srcenc = $srcenc;
- $this->tgtenc = $tgtenc;
- }
- // }}}
-
- /**
- * Sets the mode of the parser.
- *
- * Possible modes are:
- * - func
- * - event
- *
- * You can set the mode using the second parameter
- * in the constructor.
- *
- * This method is only needed, when switching to a new
- * mode at a later point.
- *
- * @param string $mode mode, either 'func' or 'event'
- *
- * @return boolean|object true on success, PEAR_Error otherwise
- * @access public
- */
- function setMode($mode)
- {
- if ($mode != 'func' && $mode != 'event') {
- $this->raiseError('Unsupported mode given',
- XML_PARSER_ERROR_UNSUPPORTED_MODE);
- }
-
- $this->mode = $mode;
- return true;
- }
-
- /**
- * Sets the object, that will handle the XML events
- *
- * This allows you to create a handler object independent of the
- * parser object that you are using and easily switch the underlying
- * parser.
- *
- * If no object will be set, XML_Parser assumes that you
- * extend this class and handle the events in $this.
- *
- * @param object &$obj object to handle the events
- *
- * @return boolean will always return true
- * @access public
- * @since v1.2.0beta3
- */
- function setHandlerObj(&$obj)
- {
- $this->_handlerObj = &$obj;
- return true;
- }
-
- /**
- * Init the element handlers
- *
- * @return mixed
- * @access private
- */
- function _initHandlers()
- {
- if (!is_resource($this->parser)) {
- return false;
- }
-
- if (!is_object($this->_handlerObj)) {
- $this->_handlerObj = &$this;
- }
- switch ($this->mode) {
-
- case 'func':
- xml_set_object($this->parser, $this->_handlerObj);
- xml_set_element_handler($this->parser,
- array(&$this, 'funcStartHandler'), array(&$this, 'funcEndHandler'));
- break;
-
- case 'event':
- xml_set_object($this->parser, $this->_handlerObj);
- xml_set_element_handler($this->parser, 'startHandler', 'endHandler');
- break;
- default:
- return $this->raiseError('Unsupported mode given',
- XML_PARSER_ERROR_UNSUPPORTED_MODE);
- break;
- }
-
- /**
- * set additional handlers for character data, entities, etc.
- */
- foreach ($this->handler as $xml_func => $method) {
- if (method_exists($this->_handlerObj, $method)) {
- $xml_func = 'xml_set_' . $xml_func;
- $xml_func($this->parser, $method);
- }
- }
- }
-
- // {{{ _create()
-
- /**
- * create the XML parser resource
- *
- * Has been moved from the constructor to avoid
- * problems with object references.
- *
- * Furthermore it allows us returning an error
- * if something fails.
- *
- * NOTE: uses '@' error suppresion in this method
- *
- * @return bool|PEAR_Error true on success, PEAR_Error otherwise
- * @access private
- * @see xml_parser_create
- */
- function _create()
- {
- if ($this->srcenc === null) {
- $xp = @xml_parser_create();
- } else {
- $xp = @xml_parser_create($this->srcenc);
- }
- if (is_resource($xp)) {
- if ($this->tgtenc !== null) {
- if (!@xml_parser_set_option($xp, XML_OPTION_TARGET_ENCODING,
- $this->tgtenc)
- ) {
- return $this->raiseError('invalid target encoding',
- XML_PARSER_ERROR_INVALID_ENCODING);
- }
- }
- $this->parser = $xp;
- $result = $this->_initHandlers($this->mode);
- if (PEAR::isError($result)) {
- return $result;
- }
- xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, $this->folding);
- return true;
- }
- if (!in_array(strtoupper($this->srcenc), $this->_validEncodings)) {
- return $this->raiseError('invalid source encoding',
- XML_PARSER_ERROR_INVALID_ENCODING);
- }
- return $this->raiseError('Unable to create XML parser resource.',
- XML_PARSER_ERROR_NO_RESOURCE);
- }
-
- // }}}
- // {{{ reset()
-
- /**
- * Reset the parser.
- *
- * This allows you to use one parser instance
- * to parse multiple XML documents.
- *
- * @access public
- * @return boolean|object true on success, PEAR_Error otherwise
- */
- function reset()
- {
- $result = $this->_create();
- if (PEAR::isError($result)) {
- return $result;
- }
- return true;
- }
-
- // }}}
- // {{{ setInputFile()
-
- /**
- * Sets the input xml file to be parsed
- *
- * @param string $file Filename (full path)
- *
- * @return resource fopen handle of the given file
- * @access public
- * @throws XML_Parser_Error
- * @see setInput(), setInputString(), parse()
- */
- function setInputFile($file)
- {
- /**
- * check, if file is a remote file
- */
- if (preg_match('/^(http|ftp):\/\//i', substr($file, 0, 10))) {
- if (!ini_get('allow_url_fopen')) {
- return $this->
- raiseError('Remote files cannot be parsed, as safe mode is enabled.',
- XML_PARSER_ERROR_REMOTE);
- }
- }
-
- $fp = @fopen($file, 'rb');
- if (is_resource($fp)) {
- $this->fp = $fp;
- return $fp;
- }
- return $this->raiseError('File could not be opened.',
- XML_PARSER_ERROR_FILE_NOT_READABLE);
- }
-
- // }}}
- // {{{ setInputString()
-
- /**
- * XML_Parser::setInputString()
- *
- * Sets the xml input from a string
- *
- * @param string $data a string containing the XML document
- *
- * @return null
- */
- function setInputString($data)
- {
- $this->fp = $data;
- return null;
- }
-
- // }}}
- // {{{ setInput()
-
- /**
- * Sets the file handle to use with parse().
- *
- * You should use setInputFile() or setInputString() if you
- * pass a string
- *
- * @param mixed $fp Can be either a resource returned from fopen(),
- * a URL, a local filename or a string.
- *
- * @return mixed
- * @access public
- * @see parse()
- * @uses setInputString(), setInputFile()
- */
- function setInput($fp)
- {
- if (is_resource($fp)) {
- $this->fp = $fp;
- return true;
- } elseif (preg_match('/^[a-z]+:\/\//i', substr($fp, 0, 10))) {
- // see if it's an absolute URL (has a scheme at the beginning)
- return $this->setInputFile($fp);
- } elseif (file_exists($fp)) {
- // see if it's a local file
- return $this->setInputFile($fp);
- } else {
- // it must be a string
- $this->fp = $fp;
- return true;
- }
-
- return $this->raiseError('Illegal input format',
- XML_PARSER_ERROR_INVALID_INPUT);
- }
-
- // }}}
- // {{{ parse()
-
- /**
- * Central parsing function.
- *
- * @return bool|PEAR_Error returns true on success, or a PEAR_Error otherwise
- * @access public
- */
- function parse()
- {
- /**
- * reset the parser
- */
- $result = $this->reset();
- if (PEAR::isError($result)) {
- return $result;
- }
- // if $this->fp was fopened previously
- if (is_resource($this->fp)) {
-
- while ($data = fread($this->fp, 4096)) {
- if (!$this->_parseString($data, feof($this->fp))) {
- $error = &$this->raiseError();
- $this->free();
- return $error;
- }
- }
- } else {
- // otherwise, $this->fp must be a string
- if (!$this->_parseString($this->fp, true)) {
- $error = &$this->raiseError();
- $this->free();
- return $error;
- }
- }
- $this->free();
-
- return true;
- }
-
- /**
- * XML_Parser::_parseString()
- *
- * @param string $data data
- * @param bool $eof end-of-file flag
- *
- * @return bool
- * @access private
- * @see parseString()
- **/
- function _parseString($data, $eof = false)
- {
- return xml_parse($this->parser, $data, $eof);
- }
-
- // }}}
- // {{{ parseString()
-
- /**
- * XML_Parser::parseString()
- *
- * Parses a string.
- *
- * @param string $data XML data
- * @param boolean $eof If set and TRUE, data is the last piece
- * of data sent in this parser
- *
- * @return bool|PEAR_Error true on success or a PEAR Error
- * @throws XML_Parser_Error
- * @see _parseString()
- */
- function parseString($data, $eof = false)
- {
- if (!isset($this->parser) || !is_resource($this->parser)) {
- $this->reset();
- }
-
- if (!$this->_parseString($data, $eof)) {
- $error = &$this->raiseError();
- $this->free();
- return $error;
- }
-
- if ($eof === true) {
- $this->free();
- }
- return true;
- }
-
- /**
- * XML_Parser::free()
- *
- * Free the internal resources associated with the parser
- *
- * @return null
- **/
- function free()
- {
- if (isset($this->parser) && is_resource($this->parser)) {
- xml_parser_free($this->parser);
- unset( $this->parser );
- }
- if (isset($this->fp) && is_resource($this->fp)) {
- fclose($this->fp);
- }
- unset($this->fp);
- return null;
- }
-
- /**
- * XML_Parser::raiseError()
- *
- * Throws a XML_Parser_Error
- *
- * @param string $msg the error message
- * @param integer $ecode the error message code
- *
- * @return XML_Parser_Error reference to the error object
- **/
- static function &raiseError($message = null,
- $code = 0,
- $mode = null,
- $options = null,
- $userinfo = null,
- $error_class = null,
- $skipmsg = false)
- {
- $msg = !is_null($msg) ? $msg : $this->parser;
- $err = new XML_Parser_Error($msg, $ecode);
- return parent::raiseError($err);
- }
-
- // }}}
- // {{{ funcStartHandler()
-
- /**
- * derives and calls the Start Handler function
- *
- * @param mixed $xp ??
- * @param mixed $elem ??
- * @param mixed $attribs ??
- *
- * @return void
- */
- function funcStartHandler($xp, $elem, $attribs)
- {
- $func = 'xmltag_' . $elem;
- $func = str_replace(array('.', '-', ':'), '_', $func);
- if (method_exists($this->_handlerObj, $func)) {
- call_user_func(array(&$this->_handlerObj, $func), $xp, $elem, $attribs);
- } elseif (method_exists($this->_handlerObj, 'xmltag')) {
- call_user_func(array(&$this->_handlerObj, 'xmltag'),
- $xp, $elem, $attribs);
- }
- }
-
- // }}}
- // {{{ funcEndHandler()
-
- /**
- * derives and calls the End Handler function
- *
- * @param mixed $xp ??
- * @param mixed $elem ??
- *
- * @return void
- */
- function funcEndHandler($xp, $elem)
- {
- $func = 'xmltag_' . $elem . '_';
- $func = str_replace(array('.', '-', ':'), '_', $func);
- if (method_exists($this->_handlerObj, $func)) {
- call_user_func(array(&$this->_handlerObj, $func), $xp, $elem);
- } elseif (method_exists($this->_handlerObj, 'xmltag_')) {
- call_user_func(array(&$this->_handlerObj, 'xmltag_'), $xp, $elem);
- }
- }
-
- // }}}
- // {{{ startHandler()
-
- /**
- * abstract method signature for Start Handler
- *
- * @param mixed $xp ??
- * @param mixed $elem ??
- * @param mixed &$attribs ??
- *
- * @return null
- * @abstract
- */
- function startHandler($xp, $elem, &$attribs)
- {
- return null;
- }
-
- // }}}
- // {{{ endHandler()
-
- /**
- * abstract method signature for End Handler
- *
- * @param mixed $xp ??
- * @param mixed $elem ??
- *
- * @return null
- * @abstract
- */
- function endHandler($xp, $elem)
- {
- return null;
- }
-
-
- // }}}me
-}
-
-/**
- * error class, replaces PEAR_Error
- *
- * An instance of this class will be returned
- * if an error occurs inside XML_Parser.
- *
- * There are three advantages over using the standard PEAR_Error:
- * - All messages will be prefixed
- * - check for XML_Parser error, using is_a( $error, 'XML_Parser_Error' )
- * - messages can be generated from the xml_parser resource
- *
- * @category XML
- * @package XML_Parser
- * @author Stig Bakken <ssb@fast.no>
- * @author Tomas V.V.Cox <cox@idecnet.com>
- * @author Stephan Schmidt <schst@php.net>
- * @copyright 2002-2008 The PHP Group
- * @license http://opensource.org/licenses/bsd-license New BSD License
- * @version Release: @package_version@
- * @link http://pear.php.net/package/XML_Parser
- * @see PEAR_Error
- */
-class XML_Parser_Error extends PEAR_Error
-{
- // {{{ properties
-
- /**
- * prefix for all messages
- *
- * @var string
- */
- var $error_message_prefix = 'XML_Parser: ';
-
- // }}}
- // {{{ constructor()
- /**
- * construct a new error instance
- *
- * You may either pass a message or an xml_parser resource as first
- * parameter. If a resource has been passed, the last error that
- * happened will be retrieved and returned.
- *
- * @param string|resource $msgorparser message or parser resource
- * @param integer $code error code
- * @param integer $mode error handling
- * @param integer $level error level
- *
- * @access public
- * @todo PEAR CS - can't meet 85char line limit without arg refactoring
- */
- function XML_Parser_Error($msgorparser = 'unknown error', $code = 0, $mode = PEAR_ERROR_RETURN, $level = E_USER_NOTICE)
- {
- if (is_resource($msgorparser)) {
- $code = xml_get_error_code($msgorparser);
- $msgorparser = sprintf('%s at XML input line %d:%d',
- xml_error_string($code),
- xml_get_current_line_number($msgorparser),
- xml_get_current_column_number($msgorparser));
- }
- $this->PEAR_Error($msgorparser, $code, $mode, $level);
- }
- // }}}
-}
-?>
diff --git a/3rdparty/XML/Parser/Simple.php b/3rdparty/XML/Parser/Simple.php
deleted file mode 100644
index 9ed0abfc6cc..00000000000
--- a/3rdparty/XML/Parser/Simple.php
+++ /dev/null
@@ -1,326 +0,0 @@
-<?php
-
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * XML_Parser
- *
- * XML Parser's Simple parser class
- *
- * PHP versions 4 and 5
- *
- * LICENSE:
- *
- * Copyright (c) 2002-2008 The PHP Group
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * @category XML
- * @package XML_Parser
- * @author Stephan Schmidt <schst@php.net>
- * @copyright 2004-2008 Stephan Schmidt <schst@php.net>
- * @license http://opensource.org/licenses/bsd-license New BSD License
- * @version CVS: $Id: Simple.php 265444 2008-08-24 21:48:21Z ashnazg $
- * @link http://pear.php.net/package/XML_Parser
- */
-
-/**
- * built on XML_Parser
- */
-require_once 'XML/Parser.php';
-
-/**
- * Simple XML parser class.
- *
- * This class is a simplified version of XML_Parser.
- * In most XML applications the real action is executed,
- * when a closing tag is found.
- *
- * XML_Parser_Simple allows you to just implement one callback
- * for each tag that will receive the tag with its attributes
- * and CData.
- *
- * <code>
- * require_once '../Parser/Simple.php';
- *
- * class myParser extends XML_Parser_Simple
- * {
- * function myParser()
- * {
- * $this->XML_Parser_Simple();
- * }
- *
- * function handleElement($name, $attribs, $data)
- * {
- * printf('handle %s<br>', $name);
- * }
- * }
- *
- * $p = &new myParser();
- *
- * $result = $p->setInputFile('myDoc.xml');
- * $result = $p->parse();
- * </code>
- *
- * @category XML
- * @package XML_Parser
- * @author Stephan Schmidt <schst@php.net>
- * @copyright 2004-2008 The PHP Group
- * @license http://opensource.org/licenses/bsd-license New BSD License
- * @version Release: @package_version@
- * @link http://pear.php.net/package/XML_Parser
- */
-class XML_Parser_Simple extends XML_Parser
-{
- /**
- * element stack
- *
- * @access private
- * @var array
- */
- var $_elStack = array();
-
- /**
- * all character data
- *
- * @access private
- * @var array
- */
- var $_data = array();
-
- /**
- * element depth
- *
- * @access private
- * @var integer
- */
- var $_depth = 0;
-
- /**
- * Mapping from expat handler function to class method.
- *
- * @var array
- */
- var $handler = array(
- 'default_handler' => 'defaultHandler',
- 'processing_instruction_handler' => 'piHandler',
- 'unparsed_entity_decl_handler' => 'unparsedHandler',
- 'notation_decl_handler' => 'notationHandler',
- 'external_entity_ref_handler' => 'entityrefHandler'
- );
-
- /**
- * Creates an XML parser.
- *
- * This is needed for PHP4 compatibility, it will
- * call the constructor, when a new instance is created.
- *
- * @param string $srcenc source charset encoding, use NULL (default) to use
- * whatever the document specifies
- * @param string $mode how this parser object should work, "event" for
- * handleElement(), "func" to have it call functions
- * named after elements (handleElement_$name())
- * @param string $tgtenc a valid target encoding
- */
- function XML_Parser_Simple($srcenc = null, $mode = 'event', $tgtenc = null)
- {
- $this->XML_Parser($srcenc, $mode, $tgtenc);
- }
-
- /**
- * inits the handlers
- *
- * @return mixed
- * @access private
- */
- function _initHandlers()
- {
- if (!is_object($this->_handlerObj)) {
- $this->_handlerObj = &$this;
- }
-
- if ($this->mode != 'func' && $this->mode != 'event') {
- return $this->raiseError('Unsupported mode given',
- XML_PARSER_ERROR_UNSUPPORTED_MODE);
- }
- xml_set_object($this->parser, $this->_handlerObj);
-
- xml_set_element_handler($this->parser, array(&$this, 'startHandler'),
- array(&$this, 'endHandler'));
- xml_set_character_data_handler($this->parser, array(&$this, 'cdataHandler'));
-
- /**
- * set additional handlers for character data, entities, etc.
- */
- foreach ($this->handler as $xml_func => $method) {
- if (method_exists($this->_handlerObj, $method)) {
- $xml_func = 'xml_set_' . $xml_func;
- $xml_func($this->parser, $method);
- }
- }
- }
-
- /**
- * Reset the parser.
- *
- * This allows you to use one parser instance
- * to parse multiple XML documents.
- *
- * @access public
- * @return boolean|object true on success, PEAR_Error otherwise
- */
- function reset()
- {
- $this->_elStack = array();
- $this->_data = array();
- $this->_depth = 0;
-
- $result = $this->_create();
- if ($this->isError($result)) {
- return $result;
- }
- return true;
- }
-
- /**
- * start handler
- *
- * Pushes attributes and tagname onto a stack
- *
- * @param resource $xp xml parser resource
- * @param string $elem element name
- * @param array &$attribs attributes
- *
- * @return mixed
- * @access private
- * @final
- */
- function startHandler($xp, $elem, &$attribs)
- {
- array_push($this->_elStack, array(
- 'name' => $elem,
- 'attribs' => $attribs
- ));
- $this->_depth++;
- $this->_data[$this->_depth] = '';
- }
-
- /**
- * end handler
- *
- * Pulls attributes and tagname from a stack
- *
- * @param resource $xp xml parser resource
- * @param string $elem element name
- *
- * @return mixed
- * @access private
- * @final
- */
- function endHandler($xp, $elem)
- {
- $el = array_pop($this->_elStack);
- $data = $this->_data[$this->_depth];
- $this->_depth--;
-
- switch ($this->mode) {
- case 'event':
- $this->_handlerObj->handleElement($el['name'], $el['attribs'], $data);
- break;
- case 'func':
- $func = 'handleElement_' . $elem;
- if (strchr($func, '.')) {
- $func = str_replace('.', '_', $func);
- }
- if (method_exists($this->_handlerObj, $func)) {
- call_user_func(array(&$this->_handlerObj, $func),
- $el['name'], $el['attribs'], $data);
- }
- break;
- }
- }
-
- /**
- * handle character data
- *
- * @param resource $xp xml parser resource
- * @param string $data data
- *
- * @return void
- * @access private
- * @final
- */
- function cdataHandler($xp, $data)
- {
- $this->_data[$this->_depth] .= $data;
- }
-
- /**
- * handle a tag
- *
- * Implement this in your parser
- *
- * @param string $name element name
- * @param array $attribs attributes
- * @param string $data character data
- *
- * @return void
- * @access public
- * @abstract
- */
- function handleElement($name, $attribs, $data)
- {
- }
-
- /**
- * get the current tag depth
- *
- * The root tag is in depth 0.
- *
- * @access public
- * @return integer
- */
- function getCurrentDepth()
- {
- return $this->_depth;
- }
-
- /**
- * add some string to the current ddata.
- *
- * This is commonly needed, when a document is parsed recursively.
- *
- * @param string $data data to add
- *
- * @return void
- * @access public
- */
- function addToData($data)
- {
- $this->_data[$this->_depth] .= $data;
- }
-}
-?>
diff --git a/3rdparty/aws-sdk/README.md b/3rdparty/aws-sdk/README.md
deleted file mode 100644
index 7e55f76b3b2..00000000000
--- a/3rdparty/aws-sdk/README.md
+++ /dev/null
@@ -1,136 +0,0 @@
-# AWS SDK for PHP
-
-The AWS SDK for PHP enables developers to build solutions for Amazon Simple Storage Service (Amazon S3),
-Amazon Elastic Compute Cloud (Amazon EC2), Amazon SimpleDB, and more. With the AWS SDK for PHP, developers
-can get started in minutes with a single, downloadable package.
-
-The SDK features:
-
-* **AWS PHP Libraries:** Build PHP applications on top of APIs that take the complexity out of coding directly
- against a web service interface. The toolkit provides APIs that hide much of the lower-level implementation.
-* **Code Samples:** Practical examples for how to use the toolkit to build applications.
-* **Documentation:** Complete SDK reference documentation with samples demonstrating how to use the SDK.
-* **PEAR package:** The ability to install the AWS SDK for PHP as a PEAR package.
-* **SDK Compatibility Test:** Includes both an HTML-based and a CLI-based SDK Compatibility Test that you can
- run on your server to determine whether or not your PHP environment meets the minimum requirements.
-
-For more information about the AWS SDK for PHP, including a complete list of supported services, see
-[aws.amazon.com/sdkforphp](http://aws.amazon.com/sdkforphp).
-
-
-## Signing up for Amazon Web Services
-
-Before you can begin, you must sign up for each service you want to use.
-
-To sign up for a service:
-
-* Go to the home page for the service. You can find a list of services on
- [aws.amazon.com/products](http://aws.amazon.com/products).
-* Click the Sign Up button on the top right corner of the page. If you don't already have an AWS account, you
- are prompted to create one as part of the sign up process.
-* Follow the on-screen instructions.
-* AWS sends you a confirmation e-mail after the sign-up process is complete. At any time, you can view your
- current account activity and manage your account by going to [aws.amazon.com](http://aws.amazon.com) and
- clicking "Your Account".
-
-
-## Source
-The source tree for includes the following files and directories:
-
-* `_compatibility_test` -- Includes both an HTML-based and a CLI-based SDK Compatibility Test that you can
- run on your server to determine whether or not your PHP environment meets the minimum requirements.
-* `_docs` -- Informational documents, the contents of which should be fairly self-explanatory.
-* `_samples` -- Code samples that you can run out of the box.
-* `extensions` -- Extra code that can be used to enhance usage of the SDK, but isn't a service class or a
- third-party library.
-* `lib` -- Contains any third-party libraries that the SDK depends on. The licenses for these projects will
- always be Apache 2.0-compatible.
-* `services` -- Contains the service-specific classes that communicate with AWS. These classes are always
- prefixed with `Amazon`.
-* `utilities` -- Contains any utility-type methods that the SDK uses. Includes extensions to built-in PHP
- classes, as well as new functionality that is entirely custom. These classes are always prefixed with `CF`.
-* `README` -- The document you're reading right now.
-* `config-sample.inc.php` -- A sample configuration file that should be filled out and renamed to `config.inc.php`.
-* `sdk.class.php` -- The SDK loader that you would include in your projects. Contains the base functionality
- that the rest of the SDK depends on.
-
-
-## Minimum Requirements in a nutshell
-
-* You are at least an intermediate-level PHP developer and have a basic understanding of object-oriented PHP.
-* You have a valid AWS account, and you've already signed up for the services you want to use.
-* The PHP interpreter, version 5.2 or newer. PHP 5.2.17 or 5.3.x is highly recommended for use with the AWS SDK for PHP.
-* The cURL PHP extension (compiled with the [OpenSSL](http://openssl.org) libraries for HTTPS support).
-* The ability to read from and write to the file system via [file_get_contents()](http://php.net/file_get_contents) and [file_put_contents()](http://php.net/file_put_contents).
-
-If you're not sure whether your PHP environment meets these requirements, run the
-[SDK Compatibility Test](http://github.com/amazonwebservices/aws-sdk-for-php/tree/master/_compatibility_test/) script
-included in the SDK download.
-
-
-## Installation
-
-### Via GitHub
-
-[Git](http://git-scm.com) is an extremely fast, efficient, distributed version control system ideal for the
-collaborative development of software. [GitHub](http://github.com/amazonwebservices) is the best way to
-collaborate with others. Fork, send pull requests and manage all your public and private git repositories.
-We believe that GitHub is the ideal service for working collaboratively with the open source PHP community.
-
-Git is primarily a command-line tool. GitHub provides instructions for installing Git on
-[Mac OS X](http://help.github.com/mac-git-installation/), [Windows](http://help.github.com/win-git-installation/),
-and [Linux](http://help.github.com/linux-git-installation/). If you're unfamiliar with Git, there are a variety
-of resources on the net that will help you learn more:
-
-* [Git Immersion](http://gitimmersion.com) is a guided tour that walks through the fundamentals of Git, inspired
- by the premise that to know a thing is to do it.
-* The [PeepCode screencast on Git](https://peepcode.com/products/git) ($12) will teach you how to install and
- use Git. You'll learn how to create a repository, use branches, and work with remote repositories.
-* [Git Reference](http://gitref.org) is meant to be a quick reference for learning and remembering the most
- important and commonly used Git commands.
-* [Git Ready](http://gitready.com) provides a collection of Git tips and tricks.
-* If you want to dig even further, I've [bookmarked other Git references](http://pinboard.in/u:skyzyx/t:git).
-
-If you're comfortable working with Git and/or GitHub, you can pull down the source code as follows:
-
- git clone git://github.com/amazonwebservices/aws-sdk-for-php.git AWSSDKforPHP
- cd ./AWSSDKforPHP
-
-### Via PEAR
-
-[PEAR](http://pear.php.net) stands for the _PHP Extension and Application Repository_ and is a framework and
-distribution system for reusable PHP components. It is the PHP equivalent to package management software such as
-[MacPorts](http://macports.org) and [Homebrew](https://github.com/mxcl/homebrew) for Mac OS X,
-[Yum](http://fedoraproject.org/wiki/Tools/yum) and [Apt](http://wiki.debian.org/Apt) for GNU/Linux,
-[RubyGems](http://rubygems.org) for Ruby, [Easy Install](http://packages.python.org/distribute/easy_install.html)
-for Python, [Maven](http://maven.apache.org) for Java, and [NPM](http://npm.mape.me) for Node.js.
-
-PEAR packages are very easy to install, and are available in your PHP environment path so that they are accessible
-to any PHP project. PEAR packages are not specific to your project, but rather to the machine that they're
-installed on.
-
-From the command-line, you can install the SDK with PEAR as follows:
-
- pear channel-discover pear.amazonwebservices.com
- pear install aws/sdk
-
-You may need to use `sudo` for the above commands. Once the SDK has been installed via PEAR, you can load it into
-your project with:
-
- require_once 'AWSSDKforPHP/sdk.class.php';
-
-### Configuration
-
-1. Copy the contents of [config-sample.inc.php](https://github.com/amazonwebservices/aws-sdk-for-php/raw/master/config-sample.inc.php)
- and add your credentials as instructed in the file.
-2. Move your file to `~/.aws/sdk/config.inc.php`.
-3. Make sure that `getenv('HOME')` points to your user directory. If not you'll need to set
- `putenv('HOME=<your-user-directory>')`.
-
-
-## Additional Information
-
-* AWS SDK for PHP: <http://aws.amazon.com/sdkforphp>
-* Documentation: <http://docs.amazonwebservices.com/AWSSDKforPHP/latest/>
-* License: <http://aws.amazon.com/apache2.0/>
-* Discuss: <http://aws.amazon.com/forums>
diff --git a/3rdparty/aws-sdk/_compatibility_test/README.md b/3rdparty/aws-sdk/_compatibility_test/README.md
deleted file mode 100644
index 9e2f2d89409..00000000000
--- a/3rdparty/aws-sdk/_compatibility_test/README.md
+++ /dev/null
@@ -1,37 +0,0 @@
-# Compatibility Test
-
-## Via your web browser
-
-1. Upload `sdk_compatibility_test.php` to the web-accessible root of your website.
-For example, if your website is `www.example.com`, upload it so that you can get
-to it at `www.example.com/sdk_compatibility_test.php`
-
-2. Open your web browser and go to the page you just uploaded.
-
-
-## Via the command line
-
-### Windows
-
-1. Upload `sdk_compatibility_test_cli.php` to your server via SFTP.
-
-2. SSH/RDP into the machine, and find the directory where you uploaded the test.
-
-3. Run the test, and review the results:
-
- php .\sdk_compatibility_test_cli.php
-
-
-### Non-Windows (Mac or *nix)
-
-1. Upload `sdk_compatibility_test_cli.php` to your server via SFTP.
-
-2. SSH into the machine, and find the directory where you uploaded the test.
-
-3. Set the executable bit:
-
- chmod +x ./sdk_compatibility_test_cli.php
-
-4. Run the test, and review the results:
-
- ./sdk_compatibility_test_cli.php
diff --git a/3rdparty/aws-sdk/_compatibility_test/sdk_compatibility.inc.php b/3rdparty/aws-sdk/_compatibility_test/sdk_compatibility.inc.php
deleted file mode 100644
index c17ec33d72e..00000000000
--- a/3rdparty/aws-sdk/_compatibility_test/sdk_compatibility.inc.php
+++ /dev/null
@@ -1,75 +0,0 @@
-<?php
-
-define('REQUIREMENTS_ALL_MET', 100);
-define('REQUIREMENTS_MIN_MET', 10);
-define('REQUIREMENTS_NOT_MET', 0);
-
-// Required
-$php_ok = (function_exists('version_compare') && version_compare(phpversion(), '5.2.0', '>='));
-$simplexml_ok = extension_loaded('simplexml');
-$dom_ok = extension_loaded('dom');
-$json_ok = (extension_loaded('json') && function_exists('json_encode') && function_exists('json_decode'));
-$spl_ok = extension_loaded('spl');
-$pcre_ok = extension_loaded('pcre');
-$curl_ok = false;
-if (function_exists('curl_version'))
-{
- $curl_version = curl_version();
- $curl_ok = (function_exists('curl_exec') && in_array('https', $curl_version['protocols'], true));
-}
-$file_ok = (function_exists('file_get_contents') && function_exists('file_put_contents'));
-
-// Optional, but recommended
-$openssl_ok = (extension_loaded('openssl') && function_exists('openssl_sign'));
-$zlib_ok = extension_loaded('zlib');
-
-// Optional
-$apc_ok = extension_loaded('apc');
-$xcache_ok = extension_loaded('xcache');
-$memcached_ok = extension_loaded('memcached');
-$memcache_ok = extension_loaded('memcache');
-$mc_ok = ($memcache_ok || $memcached_ok);
-$pdo_ok = extension_loaded('pdo');
-$pdo_sqlite_ok = extension_loaded('pdo_sqlite');
-$sqlite2_ok = extension_loaded('sqlite');
-$sqlite3_ok = extension_loaded('sqlite3');
-$sqlite_ok = ($pdo_ok && $pdo_sqlite_ok && ($sqlite2_ok || $sqlite3_ok));
-
-// Other
-$int64_ok = (PHP_INT_MAX === 9223372036854775807);
-$ini_memory_limit = get_ini('memory_limit');
-$ini_open_basedir = get_ini('open_basedir');
-$ini_safe_mode = get_ini('safe_mode');
-$ini_zend_enable_gc = get_ini('zend.enable_gc');
-
-if ($php_ok && $int64_ok && $curl_ok && $simplexml_ok && $dom_ok && $spl_ok && $json_ok && $pcre_ok && $file_ok && $openssl_ok && $zlib_ok && ($apc_ok || $xcache_ok || $mc_ok || $sqlite_ok))
-{
- $compatiblity = REQUIREMENTS_ALL_MET;
-}
-elseif ($php_ok && $curl_ok && $simplexml_ok && $dom_ok && $spl_ok && $json_ok && $pcre_ok && $file_ok)
-{
- $compatiblity = REQUIREMENTS_MIN_MET;
-}
-else
-{
- $compatiblity = REQUIREMENTS_NOT_MET;
-}
-
-function get_ini($config)
-{
- $cfg_value = ini_get($config);
-
- if ($cfg_value === false || $cfg_value === '' || $cfg_value === 0)
- {
- return false;
- }
- elseif ($cfg_value === true || $cfg_value === '1' || $cfg_value === 1)
- {
- return true;
- }
-}
-
-function is_windows()
-{
- return strtolower(substr(PHP_OS, 0, 3)) === 'win';
-}
diff --git a/3rdparty/aws-sdk/_compatibility_test/sdk_compatibility_test.php b/3rdparty/aws-sdk/_compatibility_test/sdk_compatibility_test.php
deleted file mode 100644
index b36a38ab35e..00000000000
--- a/3rdparty/aws-sdk/_compatibility_test/sdk_compatibility_test.php
+++ /dev/null
@@ -1,789 +0,0 @@
-<?php
-if (isset($_GET['logopng']))
-{
- $data = <<<IMAGE
-iVBORw0KGgoAAAANSUhEUgAAASwAAABwCAYAAACkRk1NAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz
-AAALEgAACxIB0t1+/AAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNXG14zYAAAAU
-dEVYdENyZWF0aW9uIFRpbWUAOS80LzEwZyhWjQAAGJpJREFUeNrtnQ2wXEWVgJvwjKksP2MKMAKV
-HXbZIqUgU1CLWBtkLLZc1IU3CK4ssDAEFVlhM7qIyhYwiqALCqOFIkbNGDSsSszsqllA1zfhT0SX
-DD8aFgJv+DU/JG9CfpYErNluc+6m35m+ffvvvrkz75yqU8mbudO3b9/u755z+txuxkhISEhISEhI
-SEgyJa8tnlvgWgUtZqxuOa4lqFtF1JXuGAnJ9AJUHgZ/g2uHa1ehTYBEoQ/1K3KtcW3F1K3Ntc61
-LK6F7igJyfABqgyDvB0DAZ12AG6VNAABFl4FINl10BYATlhiObrjJCSDBajIjdJZKT4qWzg5h/qZ
-WHg+2syie0tCQqKGwYoUIBCnq23AAKBaPUV1mwBok9VFQjIAVtZ5AK+JwCAY47rIxz0EsC5KAV7i
-WpdwHaVeQEIyuAAbhYHsCq8VAMBcCnXzhdc4QYqEZHBg1IR4kFFMyQJexpCCmJmIa3XQ50WIedVM
-Zhwt4CUgdaNFmVFQv0Y9hoSk/8CSB3PDdMpfgte4DaTA5YxmHicFzhXAUgXsS5ZurSuk8KRDk3oM
-CUm2gIWn/IOkI0iQauisnwRg4XQJI3gZ1q9gMDNKwCIhyTCwVPAqWJSdN4GUI7BUuV5WqRISpEzz
-ywhYJCQDAizsminjShp3Kk1gdWPc2pwmXuaSBEvAIiEZQGDJWkTleaUWBAKWEjCQEBqsPBISEgIW
-AYuEhISARcAiISFgEbBISEgIWAQsEhISApa7UqY7CQkBa2CAVaUeQ0JCwCJgkZCQELAIWCQkBCwC
-FgkJCQGLgEVCQkLAImCRkBCwCFgkJCQELAIWCQkJAYuARUJCwCJgkZCQELAIWCQkJNkE1jgqq+C5
-L2JoYFWox5CQ9BdYJc/dnn2Blbibjce+iCGAtdp341cSEpLw4MLbYqUJLOMttzzh5QqsFQQpEpLh
-hJcpsJwh5QEvG2Cltjs1CUnWB3wRD+SM1a8AdcwFgJcOWMEhZQmvJGCNEaRIpqtFUlLsZOy0X16K
-sSrVHnwN081SJXit1gBrDMBR7OO1jgJgawpgUUyKZFpCKtp/r2ETBA61k7IhXKJNTDsWm6VWLbZz
-p4FPQpJxV6rqukmo6WakASDaDFS/YFvBk5CQ9NeVCqkdVzg4bLfuWr9MuLYkJCR6GNwIweNuyhoF
-qE+0tKgWoZhSWjoBsalR6hkkJIMBr9BwCDaLlhK8CFIkJEMALx84GEPKNaAN9TvPMYPd2NKDwH5q
-LuLIjL1zXItcK1yrSMXn+am87+J8cF6hBYffR78t9qG9SlPdXinfi6LPvQhUh4JUh3y/YGQVEDeE
-l/juKsPyJgX2Fd83bWJehkmgVhCFwH5LldYQCApigLW4dg20DcfnLQd2VaM5xbFtxbk7XOvy8TED
-qxFTd3GN5QCQqli2V812gME5mgG1YQMa6Be1hOtsQj1zDuCJ6wsVRT3qcO/j+kN+qoGlms0rGQ7m
-CA5jptP+usB5DLCcAvYIXmMekIpNHPUceDXDQRenVYunc2I50JE7Buft4MEH19MwrHfL1kqQ2quT
-dnvB+bopaDWlftHBoEk4h/Y+oX5j2h/K/QJWkNk8xXmKJrN7BsDqKhJBvWfzLGYfiwFgVYixYFy0
-HgJYFrDqgRYMspbDIMtbtFcrUHu1TCySfgArQL9oGl5bMwlYUBfb85f6DSwVvIzhEJMN3w0MLGd4
-OaZIFD1hlfe0ElRaCwCspsvgh/JdLcWmocURur3qWQOWwwPDGciGwHIBZ8fWPU0TWEZwcIFUQGCp
-suyD1i8AsFopDYaCB7B8nupVz3oXfQZXiuedMmA5Wqg6bXi2acXj3JWsAiv1FTg9gZVK/XyAJfz8
-lAaC1mowAFY/taapd6kf7dUHYNVSOFfFA1g+D7AWAWt4gNUytFjyCDYmv2sPKLCantZVDbVXwfB3
-HZ/AtKO7lI8JERgFtaW0gqqB+xjrnqVotU4K2hOwBhhYhh2zrHEZ2q4dxRJYdRgQNccnbfR70wHf
-0VyzU3tZPBy84y0W7lMl5vd1F3ffMCheDQCshpTy0A7hbhOwBgNYRZ8AtGGsKOcJrIJHbKWFLQjT
-maaU2quc9sCymEBpekBZ5zLXXaxuC2CVHfsDAWtILKyWi7VgAZ2ix2/rnnG3gqsF4dhelbTaK7CL
-H5u+Ydi2ec8YX8ERWPV+PQgIWBmJYSkGVPRaSSWAheYLrKJHALrlY+lY5GIVobxU28uwPqazo6XQ
-FpKlhVZ1BFbBoz9UCVhDBqwUXEovYCWcu+3hthT7EaRNE1gWSZUNz3Y1yVPr2JZhAKyO5zlTBdYE
-ASs7wFK80FuHDtbqI7CaI+4JkakCS2qvcqj2MjhfeyRAEqVvQrArfAx+00yrP4QAVpOA1T9gQaym
-ArMxvpnOrsDqDAqwpJefGwFeb3IBVm0kTGJqMYRrZeLeOfymRsAiYKlAVR+ZguztADNufQfWVLZX
-gPSQWqCyTIBVd5j99QIOAWuaAcvz1YdpByxw9zpT1V4ay65jmN6Rm0JgVW2vk4BFwLKBVX0kvSzj
-oQNWinC3BVbDJ72DgEXAGuZ3CTsQKylDx86lPEuYSWBZvEsYLSQXpL086lG16AsELAJWphNHTV2K
-Wh/SGjIHLJv2UrlgoYDlm81OwCJgDSqwTGaXKn3Kw8oisCo+AzogsJojHtnsnrlcIdIauqGBQ8Ca
-HsBKmoJv9zFxNIvAavWrvRziZ2XHPhFigUMCFgErLLAMV2pIyn0pTzNg+a5nVfIBVqhs9oQ6ekHZ
-8EHYHDZgVT2z3UMCYUXG67faZSuyEPEKw9nFoQBWoPaqeQLLdQXQDrRXNWmNc8N7mkuIi6bxLmF2
-gSUN5FHYRHRiioGwAna2yWW0fsa7AaUFLIsAdIWAZWx56NaLqgZMnejEbTNmaAWWPK3uwlACywMO
-LkAwgpRB/cazWD/HAdjwnAmKXTVhSIHVChB7anvAzkXLDg+ipsd9aacBnMwByxJepkAwhgDsJ5g3
-rF8B9hscn6r6pQSsuKeh7TrwlSEAlmn8qOjR1jqXKc0loXMObmHZEcrlaQcsA3jpgGADqWjz0qZi
-U9eCBbxs6jeWFqQcYg3y2t3RWll1RxekMA2C7tG1Vj3bS/WuXZrAKjpMyET5ZkVwI02us+2xpvtw
-AAtZQNGOygX03ZgFpGz2BbTa1FWCq6p+XjGplGaEUtsRZkCB1ZjC9mr0C1gpxMxMYl/TC1ieoPPd
-FxDvi5gfhGtPeYuvpFjJIAJrKnf6qfYTWCk80OppAmeogQWuXhkA001JW+BOFjIOLd9OWTaYri8P
-Qx6W4XlN2qvq0F46NyvaRaYkuaKRqxbtFtRyAFaozVTrBv2QgKWB1ZIAq5ra5EmVMgys3Ij7FuCl
-BPB1hvDlZ9dB3JFBFFP/TpzbpIBUxeHVm2hhxqbFWum+0Kob1o2AlWKe15SmIEwRtGwsh6Zi+yzc
-sdueW9X7Aqvsce6OQXvVA7dXJ6G9amApFQPOEtcN3w3MOcS02klJqpbxQV9gVdgwSQB4DRSkNJ24
-prj5bSlTOulp3ICBkDMYBBVpQ0yshYTfFzS/rRicX3fukmF75aX26ni0V8PWWurjg62isbg6cC1l
-h7J197NqcD+9fp81GDVtAuIArxsNkkBtUiT+P7DPSEiGQADYUbwsRy0SFliqgLgJvOQk0Amwwkxe
-28lJgf2O7mVqEhISEh2wnOBlcJ6cyewj3REvmc31QK5voKYgmY7A6rpmsUPZqmz4LgErFbmG6wau
-W+HfedQkwWQG13O5rgE9m5ok+8AygpcEqVaI9bVIjOXHXLuSvoeaJJj8GddXpLYVD4UjqFkGB1hT
-tiAgibGsJGClJl9CbSv0FGoWAhYBi4CVRZnDdZPUti+z3fFCEgIWCQErk7If11u4fp2agoBFwCJg
-kZAQsAZQ5nO9nO0OoovZvse43s71Aq4HOAJLTI6czvVUrkdynRmgngdx/dMArpG4JtGHjuU6bAmW
-oo1EmsnrPMqYy/VdcN/28ShHTBzMI2ANN7D+iu2exv4t12Wa40a53s11jOtZmuMENO7kegdX/IrL
-/mx3asILrDfAG+kTXBdaAOtvuK7l2pE+38ZVLFf8dw7tIcq7B+q4GeI6W7g+znU517dw3dugHDHw
-ylx/zfVZqNME1xe53g9toxvkZ3A9h+vBXPeCzy7m+ijUZ5zrvvD5J7neB/UuG9TtMK5LoT2jd+xE
-WkMVyl/N9TLN74/i+hVoE9H2T3N9jutd0DdmGcbMLoW+Jx5aO6C918F1HGvYzlWpP70C7bwT6nSd
-1EZ/lIPnHFDm2kQqPqvB//NwXDH6joCVLfmBNNB3wUBRyf3ScaJTjyiOEZ/9r3TcF6XvZsGA36mB
-VVfqeGcaAEuU/7KmHHE9N1hYQT/huj2hbuL77yaUdQiAfVdC3e6MsbgE1F+F40R7/gW0HS7v43D8
-i9JnG8Ha1Mld0vF/gM9yAI2udF4se8EDqYXucxed/46E8x8HD0hdX9iZ0M7HAOiS+tJ6+QELIKpy
-bYNWJTh1xd9wXF3+m4CVHbkYWSfLYwbgk9Ix68BVwnIydJAuWAGyhXWbooM+A+f7BXR0+TtRp7cl
-AGtnwt8RGC4zaId7DDq/fJ4vayyH31uU9ZDCfV0qff8S11tjri0C1n3o808ngFmu35gErO3ooYHl
-eAOgR78dA4say59D3zBtn9sUD8f5YLWaliEs2wXI0vqjdYX+7gDEcgArAlYGgXUkuBfRzX1Rccz7
-EVCEVXOu4rgrpCfvBohNRE/UHagT3Q6xD9lNeRgd83gCsOSnurBKTgIXB8PvNa6Ha9rgVMVA/B3X
-xVy/wPU/wV3Bg3Kewg28QwHMu+EcZ8BA3oaOuVYDrC2Kc++Ez6NBuAhZPPdrrvU0qX3ENXzYEFiH
-Iis76gfiem8GV162dkXi6T8pYNlSPJiEZftutju7/lfIknxVESL4maI9xO++yXbPcD7JJifBdsFl
-TQJWZFXVAF5NAlY2g+6y9STAkkffq5IK64py5Cf9g1Js5CH027jtsMSgaKO6HJ8ArE0KGB2rAKRu
-qn4MHbtSEYeZCxYhPk6WhWiwCVBeqDjfpZLLFw3aA2KA9Qfkji6DwS0f/1aweuXBGRd8riNL+WBD
-YC1ClriwcE5Ex1yPjmmhIPo1CCTbwSrH8m1kUa6VytkXrE45Xnk+ineNQPxvAt2Lv04AlnAPWwCt
-OgEru8Bagp5WH9bEr2QLZCayLmTL5ibJnXwZxUaO0dTlixowrlRYL+8ziM1FlmNcMPgFdP3HxRz3
-dmkgiXOvQt//Cp1zVUzgeCbEAeVjL4sBljzg4t7vmwUxIRmA5yiOez2yYtdI3yUB62H03eWK8l+H
-Hk6bJSDtB1aYfE1LYq5nNopP7YJZxMhal/vZU4bxWdHv3msArAoAq0TAyi6wFqIn479J3x2k6Ghd
-iIPI75qdInWyrWxPysEV6HfPxgTsI1mABs46DbB+l+DqTiBr7a0xx76EgPXOmONmwGzpVxXHFFBs
-5hWYTdO5obI1dl8CsFYk3MOvo+OXxwSqn5eO+awhsI5Cv9scE5+KZjfljPnPS/1jK3L1kmb/5Ov5
-AXw+itrtSQCxSgQk/4XrJyB2JruEBaHo7zzEr4ryZwSs7MnhyBV7nu2ZSh+VgrTbpEEpOvSHUPxK
-DhRHs18/QR3vFxCwj9N3INB0ARQqYH0l4bqeQ8cvijluHB13vxR/M5V/VABdJ/OQ5bmR7UlzWKqw
-JJPyi96F2u1Z1pvTdKkU61qHJjV0wKqgGNk9mnrMRX1pKXx+C7qm3yRczwmoPmsk6G5GbXMp88vf
-ypYQsIzkURRbiAbs51CQVY6V3Cr9/t6YGNXjikDtRo2+hOIX2yAgrwJW0lLGOAC+2CCuI7uQPwdX
-bQHTJ7QKaSgmDD6o0UuQRbYVYngqYD0tPUCYxi2cQLE9HGNaJX0/jr7TAesbhuCP5GRot49wfTN8
-9iAq496E9rkStc8mcKVnIgsugtYasMLOAotwNgFruIH1NTR4TofPH5A+F0mQjyCXbBYM5rXS51+K
-Cei7qADW0THASno151Z0/PdjjjsMYkRxdRDtsR4GnQgcz0+YcHDVY2OAdZvhPfwvjQWKU1OWWQDr
-TnQ/XHaBesKzbTZBeELIlxOO7YCFK/rLeQNnfRGwjORs9ERbAjMyckBaDNZr0WzU0chtFIP7A1K5
-L3p21B2SO4SBdWrCNWHLoKE59iLFkztON4AFMDMmKO2qb4sB1rcM7+H5bHLKxNPSd/8gxRi3wD0z
-Bdbd6NpH+wSsg6XyHjD83S7og0cTsIYLWIdCB49u9CNgwWyQOsxJAKPNUqf+KJj/cpLeG6Vy26gD
-fQbiE6aa0wTdkyysGwwC0bKcCYDeZTAQXkUxPOz6boRBaqq/kcC8VDODqJP9UWB7o+SSLUEza4dY
-AKsZAFjPKGJ8bQt9QOHm3YwmTHT6HNPn4mUKWPUMAWs8w031axQ4v5ZNTgTdF2C0Cc3ejKHBMEMq
-839Qx/m8R/0wsE5POB7Hpr5neB6R+/VVcHm3aQAm7mU0i4QTIm/2uE4MrEssfvtLNnnGU/z2T+Ba
-cHa7i0u4Faw1W8H94MxAfTYH3sESiMNOsPhXfpazQRFY1ngR7MQ81cAah513Chlvpn9FwfFHFbM6
-M5B5vxZZZt9AZeJljW8NCKxywvE/Qsdf43je46Bt1ikGwUVwzO3o85/2CVjyTGAXXFXRf6O0BPHd
-hZbAwjltVyfUQUxSLET35xFUxg0p9eE54AksY71vPKyD7wcuCG8LLxdgDQqkZDkDmdhyIFp+d+6b
-yO2IYl+iw+MVEq5WWCU6mQ1PSzF1fhMKcGNgfTuhLOymvduzfeaiyQW5Dtcx8xwx2YU7LDCwjlDE
-DT/H9mT+i0F7pCWwPsV6U1Pi5E1gZa+HvvSjGKD/h8G1HKhwXW3kBIV1/HY2yGIIL1NgDSKkZDmA
-TU4QjF6jWI8C6adJkNqBXBC8+oBoCzkpdTtDL6Iq4khyJ/uZBlhrNeW8mU3OcxLXcFAMhH4Mg1wM
-sKMS2ujqGDfzJOSK7Ig5nwzmh+CcImfqqkDAYqw3RUWOH/03U68VpgNWCYUBhJU2SxP436KYMLiQ
-9b6QrEsgFvG8NdA+T0kupEjYfQz6yG8T2mEG682xG55FHzXw0gFr0CGF5UGF2/MMsgT2Z+o37p+P
-KRO7A+uZOhFyHnRO+djrNcDapoljLWe9yaAq+Rg6Trxeo1uHaTFT53bNYb0rCCzWlPNJNvm9ujUB
-gYVfb5JdxJs0saA4YOWQZbmdxS9DhFMgzpTurfy6jZi0+KCFWxw9uNqojI8ntAV2C49nwygAr6sA
-SBhYY7ADdHEIL/0aBYhUT7LHmHopEJWcznpXQxCD+yPQkXNgweEZHzFjd6gGWNG09QL0VD0XWXW6
-dw4LyEoUbvC1McceznpXWrgoxlWOrCzVYoRFNnk2T+iVAYG1AFnKslVzogOwGOtNEXmM9c66XYLa
-XZQhL1J4N+tNIlY9cD6K2kfcv7NiHhjPQXuq5Ep0TZuY/RsMJBmXU1jvqzGqGa/Pst4lPj6gKfen
-TL2ulEiR+D3rXYjvNcXTc6XCXY0G4kpwz1ax3sXlxOB6vaZu9yog+CTA+xywJm5gva/6dBBQD0QD
-NrIyxJT8h8DaaCjaVwykfQICazbrfbk6SiXYxxFYf6mAtZj5uwWgvIJNXmdL/B6vyzWf9S77IsB0
-B5Tx93D/8DGPSy7ofLZnzTX5PtwJ/eU0cEvvUjwU7qXhPXyyD4pXiM5wgeK4k5GJjwcvljkKMOiS
-/aoK10wG1jJFh4xbITQp/6agCKab5GF9RlHW2QpoJWVlnxAw6B7J1xTn+nfN8SYL+H1M4WJFuXX4
-M9W7gnuB1bPTon1eUFhFCy3LiMCYp+E9nPIQeiqrBvy+yO1Ya1j29Sw5KznOfVspuVri7ft/Vjz1
-8fuAJxjWa36MGxX3utB1msDzBcwsa35DjEuEgXWxwz18L+vdZ/B8zfH7sd4JFJXcyPTLUgvr9p6E
-h8QXEu6bbFnFxYYvYuYrlz7F1OtukQyJCBiI4PsvwdJhmoEppq1/yPasV2QiYpaqAgNTTJGLd+C+
-Y1CGeL2iyXYvFyJbR6sArC/BIBUzQ3XmtoPK5eDqbGeTZyt3wFNaBH+PMShHDNifQxmvIijvhDaL
-i6ecA4NxA0PrOFmIsJi+C23xBLhMSe/UidQVsQGFSCC+IuaYvWHwi+TTdaDRDKvIx7vaME4kZnEf
-hrbZhSy7DliIcwzaOLrGLQqLStxH8V7rm2hIk2RNhLXzRhZmG60Z0MmLXP8WBugRHuWJcspsd3qA
-yWzyCFzLkZ7nTVNEHQ+BazvZ8Lri7ts7wZV+D9vzKpFtGW+BuogyFjAKrpOQkJCQkJCQkJCQkJCE
-l/8Df+8XDp+g0JUAAAAASUVORK5CYII=
-IMAGE;
-
-
- header('Content-type: image/png');
- echo base64_decode($data);
- exit;
-}
-elseif (isset($_GET['background']))
-{
- $data = <<<IMAGE
-R0lGODlhMAEeAeYAAP///8ni6cTf5+72+PD3+c3k6+nz9ufy9ev099Pn7bnZ48bg6LfY4uHv8/r8
-/f3+/v7//7bX4cjh6fj7/Mvj6vz9/rva4+z19/X6+/f7/Pn8/fb6+7jZ4vv9/bra473b5Lzb5LXX
-4b7c5b/c5e31+NTo7tvs8dfq7/H3+bjY4tnq79Hm7c/l69nr8PL4+t7t8sDd5cLe5uPw9Nvr8Mri
-6fP4+tLn7er099Hm7O/2+dDm7OTw9OXx9Nbp7tbp7+Lv8+Du8szj6sXg57bY4d3s8djq7+jz9tzs
-8cPe58fh6M7k68Pf5+by9fz+/sDd5vT5+vT5+97t8bbY4trr8P7+/v7+/+Pw8+Xx9dXo7sHe5vH4
-+fP5+sHd5t/u8s/l7AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5
-BAAAAAAALAAAAAAwAR4BAAf/gCGCg4SFhoeIiYqLjI2Oj5CRkpOUlZaXmJmam5ydnp+goaKNEaWm
-p6ipqqusra6vsLGys7S1tre4ubq7vL2+v8DBwsPExbBDyMnKy8zNzs/Q0dLT1NXW19jZ2tvc3d7K
-UuHi4+Tl5ufo6err7O3u7/Dx8vP09fb34wz6+/z9/v8AAwocSLCgwYMIEypcyLChw4cQI0qcSLGi
-xYsYM2osmKKjx48gQ4ocSbKkyZMoU6pcybKly5cwY8qc+ZGDzZs4c+rcybOnz59AgwodSrSo0aNI
-kypdyrSp06dQo0qdSrWq1aAKsmrdyrWr169gw4odS7as2bNo06pdy7at27dw/+PKnUu3rt27ePOS
-9cC3r9+/gAMLHky4sOHDiBMrXsy4sePHkCNLnky5suXLmDNr3sz5sIXPoEOLHk26tOnTqFOrXs26
-tevXsGPLnk27tu3buHPr3s27t+/fqkEIH068uPHjyJMrX868ufPn0KNLn069uvXr2LNr3869u/fv
-4MOLb/6hvPnz6NOrX8++vfv38OPLn0+/vv37+PPr38+/v///AAYo4IAEFgifCAgmqOCCDDbo4IMQ
-RijhhBRWaOGFGGao4YYcdujhhyCGKOKIJJZo4okoTjjCiiy26OKLMMYo44w01mjjjTjmqOOOPPbo
-449ABinkkEQWaeSRSCap5P+SNsLg5JNQRinllFRWaeWVWGap5ZZcdunll2CGKeaYZELpxJlopqnm
-mmy26eabcMYp55x01mnnnXjmqeeefPaZJheABirooIQWauihiCaq6KKMNuroo5BGKumklFZqqaBZ
-ZKrpppx26umnoIYq6qiklmrqqaimquqqrLbq6qubxiDrrLTWauutuOaq66689urrr8AGK+ywxBZr
-7LHI0orEssw26+yz0EYr7bTUVmvttdhmq+223Hbr7bfghtvsEuSWa+656Kar7rrstuvuu/DGK++8
-9NZr77345quvuQL06++/AAcs8MAEF2zwwQgnrPDCDDfs8MMQRyzxxBRXbPH/xRhnrPHGHHeMsBAg
-hyzyyCSXbPLJKKes8sost+zyyzDHLPPMNNdss8gL5Kzzzjz37PPPQAct9NBEF2300UgnrfTSTDft
-9NNQRy311FRXbfXVWGdNdBJcd+3112CHLfbYZJdt9tlop6322my37fbbcMctt9cS1G333Xjnrffe
-fPft99+ABy744IQXbvjhiCeu+OKMN+7445BHLvnklFcOeACYZ6755px37vnnoIcu+uikl2766ain
-rvrqrLfu+uuwxy777LTXbvvtuI9Ow+689+7778AHL/zwxBdv/PHIJ6/88sw37/zz0EffOwXUV2/9
-9dhnr/323Hfv/ffghy/+//jkl2/++einr/767Lfv/vvwxy///PR/H8T9+Oev//789+///wAMoAAH
-SMACGvCACEygAhfIwAbmrwAQjKAEJ0jBClrwghjMoAY3yMEOevCDIAyhCEdIwhKa8IQoTKEKV8jC
-FrrwhTDcoBJmSMMa2vCGOMyhDnfIwx768IdADKIQh0jEIhrxiEhMYg1ZwMQmOvGJUIyiFKdIxSpa
-8YpYzKIWt8jFLnrxi2AMoxid6IUymvGMaEyjGtfIxja68Y1wjKMc50jHOtrxjnjMox73eEYd+PGP
-gAykIAdJyEIa8pCITKQiF8nIRjrykZCMpCQnSUlA4uCSmMykJjfJyU568v+ToAylKEdJylKa8pSo
-TKUqV8nKVmZyBbCMpSxnScta2vKWuMylLnfJy1768pfADKYwh0nMYhpTljZIpjKXycxmOvOZ0Iym
-NKdJzWpa85rYzKY2t8nNbnrzm8tMgDjHSc5ymvOc6EynOtfJzna6853wjKc850nPetrznvjMpz73
-yc9++vOfAA2oQNtZgoIa9KAITahCF8rQhjr0oRCNqEQnStGKWvSiGM2oRjd6UCx49KMgDalIR0rS
-kpr0pChNqUpXytKWuvSlMI2pTGdKU5D24KY4zalOd8rTnvr0p0ANqlCHStSiGvWoSE2qUpfK1Kbm
-1AdQjapUp0rVqlr1qlj/zapWt8rVrnr1q2ANq1jHStaymlWqJ0irWtfK1ra69a1wjatc50rXutr1
-rnjNq173yte++vWvay2CYAdL2MIa9rCITaxiF8vYxjr2sZCNrGQnS9nKWvaymCWsCjbL2c569rOg
-Da1oR0va0pr2tKhNrWpXy9rWuva1sI1tZ1tA29ra9ra4za1ud8vb3vr2t8ANrnCHS9ziGve4yE2u
-cm07heY697nQja50p0vd6lr3utjNrna3y93ueve74A2veMf73BmY97zoTa9618ve9rr3vfCNr3zn
-S9/62ve++M2vfvfLX/Sa4L8ADrCAB0zgAhv4wAhOsIIXzOAGO/jBEI6w/4QnTOEKB/gIGM6whjfM
-4Q57+MMgDrGIR0ziEpv4xChOsYpXzOIWu1jDRIixjGdM4xrb+MY4zrGOd8zjHvv4x0AOspCHTOQi
-G/nIM46CkpfM5CY7+clQjrKUp0zlKlv5yljOspa3zOUue/nLYGbyC8ZM5jKb+cxoTrOa18zmNrv5
-zXCOs5znTOc62/nOeM5zmbvA5z77+c+ADrSgB03oQhv60IhOtKIXzehGO/rRkI60pP0MhEpb+tKY
-zrSmN83pTnv606AOtahHTepSm/rUqE61qld96Qa4+tWwjrWsZ03rWtv61rjOta53zete+/rXwA62
-sIdN7GIb+9jITrayl//N7GY7O9c/iLa0p03talv72tjOtra3ze1ue/vb4A63uMdN7nKb+9zTtoK6
-183udrv73fCOt7znTe962/ve+M63vvfN7377+98AZ7cMBk7wghv84AhPuMIXzvCGO/zhEI+4xCdO
-8Ypb/OIYz3jBd8Dxjnv84yAPuchHTvKSm/zkKE+5ylfO8pa7/OUwj7nMPc6Dmtv85jjPuc53zvOe
-+/znQA+60IdO9KIb/ehIT7rSl37zKzj96VCPutSnTvWqW/3qWM+61rfO9a57/etgD7vYx052qDPh
-7GhPu9rXzva2u/3tcI+73OdO97rb/e54z7ve9873vqf9AIAPvOAHT/j/whv+8IhPvOIXz/jGO/7x
-kI+85CdP+cpb/vKYz7zmN8/5znv+86BfvBFGT/rSm/70qE+96lfP+ta7/vWwj73sZ0/72tv+9rjP
-fekNwPve+/73wA++8IdP/OIb//jIT77yl8/85jv/+dCPvvSnT/3qW//62M++9rfP/ePf4PvgD7/4
-x0/+8pv//OhPv/rXz/72u//98I+//OdP//qHHwH4z7/+98///vv//wAYgAI4gARYgAZ4gAiYgAq4
-gAzYgA74gBAYgRI4gRRYgRZ4gRg4gBewgRzYgR74gSAYgiI4giRYgiZ4giiYgiq4gizYgi74gjAY
-gzI4gzRYgzZ4gziY/4M6uIMmSAI++INAGIRCOIREWIRGeIRImIRKuIRM2IRO+IRQGIVSOIVUCIQD
-cIVYmIVauIVc2IVe+IVgGIZiOIZkWIZmeIZomIZquIZs2IZu+IZwGIdyOId0WId2eIdimAN6uId8
-2Id++IeAGIiCOIiEWIiGeIiImIiKuIiM2IiO+IiQyIcEMImUWImWeImYmImauImc2Ime+ImgGIqi
-OIqkWIqmeIqomIqquIqs2Iqu+IqwGIuyOIueiAK2eIu4mIu6uIu82Iu++IvAGIzCOIzEWIzGeIzI
-mIzKuIzMiIta8IzQGI3SOI3UWI3WeI3YmI3auI3c2I3e+I3gGI7iOP+O5FiO0egC6JiO6riO7NiO
-7viO8BiP8jiP9FiP9niP+JiP+riP/NiP/qiONRCQAjmQBFmQBnmQCJmQCrmQDNmQDvmQEBmREjmR
-FFmRFnmRA7kFGrmRHNmRHvmRIBmSIjmSJFmSJnmSKJmSKrmSLNmSLvmSMMmRTzCTNFmTNnmTOJmT
-OrmTPNmTPvmTQBmUQjmURFmURnmUSJmUNQkFTNmUTvmUUBmVUjmVVFmVVnmVWJmVWrmVXNmVXvmV
-YBmWYumUGFCWZnmWaJmWarmWbNmWbvmWcBmXcjmXdFmXdnmXeJmXermXfNmXfvmXgBmYgjmYhFmY
-cLkBiJmYirmYjNn/mI75mJAZmZI5mZRZmZZ5mZiZmZq5mZzZmZ75maAZmqI5mqRZmqZ5mqg5mRmw
-mqzZmq75mrAZm7I5m7RZm7Z5m7iZm7q5m7zZm775m8AZnMI5nMRZnMZ5nMiZnMq5nLY5Ac75nNAZ
-ndI5ndRZndZ5ndiZndq5ndzZnd75neAZnuI5nuRZnuZ5nuiZnuq5nuzZnu6ZnRoQn/I5n/RZn/Z5
-n/iZn/q5n/zZn/75nwAaoAI6oARaoAZ6oAiaoAq6oAzaoA76oBAaofzpABRaoRZ6oRiaoRq6oRza
-oR76oSAaoiI6oiRaoiZ6oiiaoiq6oizaoi76ojAaozI6ozT6oR1w/6M4mqM6uqM82qM++qNAGqRC
-OqREWqRGeqRImqRKuqRM2qRO+qRQGqVSOqVUWqVWeqVCWgFauqVc2qVe+qVgGqZiOqZkWqZmeqZo
-mqZquqZs2qZu+qZwGqdyOqd0Wqd2eqd4mqd6WqZN0Kd++qeAGqiCOqiEWqiGeqiImqiKuqiM2qiO
-+qiQGqmSOql/+gCWeqmYmqmauqmc2qme+qmgGqqiOqqkWqqmeqqomqqquqqs2qqu+qqwGquyOqu0
-Wqu2GqpUkKu6uqu82qu++qvAGqzCOqzEWqzGeqzImqzKuqzM2qzO+qy7WgXSOq3UWq3Weq3Ymq3a
-uq3c2q3e+q3gGv+u4jqu5Fqu5nqu6EqtELCu7Nqu7vqu8Bqv8jqv9Fqv9nqv+Jqv+rqv/Nqv/vqv
-ABuwAjuwBFuwBnuwCJuwCruw9goADvuwEBuxEjuxFFuxFnuxGJuxGruxHNuxHvuxIBuyIjuyJFuy
-JnuyKJuyKruyLNuyLvuyMBuzMjuzNFuzNnuzOJuzOruzPNuzPvuzQBu0Qju0RFu0Rnu0SJu0Sru0
-TNu0Tvu0UBu1Uju1VFu1Vnu1WJu1Wru1XNu1Xvu1YBu2Yju2ZFu2Znu2aJu2aru2bNu2bvu2cBu3
-cju3dFu3dnu3eJu3eru3fNu3fvu3gBu4gju4hFu4hnu4iJu4irv/uIzbuI77uJAbuZI7uZRbuZZ7
-uZibuZq7uZzbuZ77uaAbuqI7uqRbuqZ7uqibuqq7uqzbuq77urAbu7I7u7Rbu7Z7u7ibu7q7u7zb
-u777u8AbvMI7vMRbvMZ7vMibvMq7vMzbvM77vNAbvdI7vdRbvdZ7vdibvdq7vdzbvd77veAbvuI7
-vuRbvuZ7vuibvuq7vuzbvu77vvAbv/I7v/Rbv/Z7v/ibv/q7v/zbv/77vwAcwAI8wARcwAZ8wAic
-wAq8wAzcwA78wBAcwRI8wRRcwRZ8wRicwRq8wRzcwR78wSAcwiI8wiRcwiZ8wiicwiq8wizcwi78
-wjAcwzI8wzRcFcM2fMM4nMM6vMM83MM+/MNArLmBAAA7
-IMAGE;
-
- header('Content-type: image/gif');
- echo base64_decode($data);
- exit;
-}
-elseif (isset($_GET['loader']))
-{
- $data = <<<IMAGE
-R0lGODlhEAALAPQAAP///wBmzNro9tDi9Ory+gZpzQBmzC6B1YKz5WCf3rrV8CJ60kqS2oq452Sh
-377X8SZ80wRozE6U2+bv+djn9vT4/DiH19zp9/L2+7bS76DF68re8+70+gAAAAAAAAAAACH/C05F
-VFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCwAAACwAAAAA
-EAALAAAFLSAgjmRpnqSgCuLKAq5AEIM4zDVw03ve27ifDgfkEYe04kDIDC5zrtYKRa2WQgAh+QQJ
-CwAAACwAAAAAEAALAAAFJGBhGAVgnqhpHIeRvsDawqns0qeN5+y967tYLyicBYE7EYkYAgAh+QQJ
-CwAAACwAAAAAEAALAAAFNiAgjothLOOIJAkiGgxjpGKiKMkbz7SN6zIawJcDwIK9W/HISxGBzdHT
-uBNOmcJVCyoUlk7CEAAh+QQJCwAAACwAAAAAEAALAAAFNSAgjqQIRRFUAo3jNGIkSdHqPI8Tz3V5
-5zuaDacDyIQ+YrBH+hWPzJFzOQQaeavWi7oqnVIhACH5BAkLAAAALAAAAAAQAAsAAAUyICCOZGme
-1rJY5kRRk7hI0mJSVUXJtF3iOl7tltsBZsNfUegjAY3I5sgFY55KqdX1GgIAIfkECQsAAAAsAAAA
-ABAACwAABTcgII5kaZ4kcV2EqLJipmnZhWGXaOOitm2aXQ4g7P2Ct2ER4AMul00kj5g0Al8tADY2
-y6C+4FIIACH5BAkLAAAALAAAAAAQAAsAAAUvICCOZGme5ERRk6iy7qpyHCVStA3gNa/7txxwlwv2
-isSacYUc+l4tADQGQ1mvpBAAIfkECQsAAAAsAAAAABAACwAABS8gII5kaZ7kRFGTqLLuqnIcJVK0
-DeA1r/u3HHCXC/aKxJpxhRz6Xi0ANAZDWa+kEAA7AAAAAAAAAAAA
-IMAGE;
- header('Content-type: image/gif');
- echo base64_decode($data);
- exit;
-}
-elseif (isset($_GET['ssl_check']))
-{
- header('Content-type: text/plain; charset=utf-8');
-
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, 'https://email.us-east-1.amazonaws.com');
- curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
- curl_setopt($ch, CURLOPT_HEADER, false);
- curl_setopt($ch, CURLOPT_NOBODY, true);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_TIMEOUT, 5184000);
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120);
- curl_setopt($ch, CURLOPT_NOSIGNAL, true);
- curl_setopt($ch, CURLOPT_USERAGENT, 'aws-sdk-php/compat-www');
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
- curl_setopt($ch, CURLOPT_VERBOSE, true);
-
- curl_exec($ch);
- echo (curl_getinfo($ch, CURLINFO_SSL_VERIFYRESULT) === 0) ? 'false' : 'true';
- curl_close($ch);
-
- exit;
-}
-
-// Include the compatibility test logic
-require dirname(__FILE__) . DIRECTORY_SEPARATOR . 'sdk_compatibility.inc.php';
-
-header('Content-type: text/html; charset=UTF-8');
-
-?><!DOCTYPE html>
-
-<html lang="en">
-<head>
-<title>AWS SDK for PHP: Environment Compatibility Test</title>
-<meta name="ROBOTS" content="NOINDEX, NOFOLLOW, NOARCHIVE" />
-
-<script type="text/javascript" charset="utf-8">
-/*!
- * Reqwest! A x-browser general purpose XHR connection manager
- * copyright Dustin Diaz 2011
- * https://github.com/ded/reqwest
- * license MIT
- */
-!function(window){function serial(a){var b=a.name;if(a.disabled||!b)return"";b=enc(b);switch(a.tagName.toLowerCase()){case"input":switch(a.type){case"reset":case"button":case"image":case"file":return"";case"checkbox":case"radio":return a.checked?b+"="+(a.value?enc(a.value):!0)+"&":"";default:return b+"="+(a.value?enc(a.value):"")+"&"}break;case"textarea":return b+"="+enc(a.value)+"&";case"select":return b+"="+enc(a.options[a.selectedIndex].value)+"&"}return""}function enc(a){return encodeURIComponent(a)}function reqwest(a,b){return new Reqwest(a,b)}function init(o,fn){function error(a){o.error&&o.error(a),complete(a)}function success(resp){o.timeout&&clearTimeout(self.timeout)&&(self.timeout=null);var r=resp.responseText;if(r)switch(type){case"json":resp=window.JSON?window.JSON.parse(r):eval("("+r+")");break;case"js":resp=eval(r);break;case"html":resp=r}fn(resp),o.success&&o.success(resp),complete(resp)}function complete(a){o.complete&&o.complete(a)}this.url=typeof o=="string"?o:o.url,this.timeout=null;var type=o.type||setType(this.url),self=this;fn=fn||function(){},o.timeout&&(this.timeout=setTimeout(function(){self.abort(),error()},o.timeout)),this.request=getRequest(o,success,error)}function setType(a){return/\.json$/.test(a)?"json":/\.jsonp$/.test(a)?"jsonp":/\.js$/.test(a)?"js":/\.html?$/.test(a)?"html":/\.xml$/.test(a)?"xml":"js"}function Reqwest(a,b){this.o=a,this.fn=b,init.apply(this,arguments)}function getRequest(a,b,c){if(a.type!="jsonp"){var f=xhr();f.open(a.method||"GET",typeof a=="string"?a:a.url,!0),setHeaders(f,a),f.onreadystatechange=readyState(f,b,c),a.before&&a.before(f),f.send(a.data||null);return f}var d=doc.createElement("script");window[getCallbackName(a)]=generalCallback,d.type="text/javascript",d.src=a.url,d.async=!0;var e=function(){a.success&&a.success(lastValue),lastValue=undefined,head.removeChild(d)};d.onload=e,d.onreadystatechange=function(){/^loaded|complete$/.test(d.readyState)&&e()},head.appendChild(d)}function generalCallback(a){lastValue=a}function getCallbackName(a){var b=a.jsonpCallback||"callback";if(a.url.slice(-(b.length+2))==b+"=?"){var c="reqwest_"+uniqid++;a.url=a.url.substr(0,a.url.length-1)+c;return c}var d=new RegExp(b+"=([\\w]+)");return a.url.match(d)[1]}function setHeaders(a,b){var c=b.headers||{};c.Accept=c.Accept||"text/javascript, text/html, application/xml, text/xml, */*",b.crossOrigin||(c["X-Requested-With"]=c["X-Requested-With"]||"XMLHttpRequest");if(b.data){c["Content-type"]=c["Content-type"]||"application/x-www-form-urlencoded";for(var d in c)c.hasOwnProperty(d)&&a.setRequestHeader(d,c[d],!1)}}function readyState(a,b,c){return function(){a&&a.readyState==4&&(twoHundo.test(a.status)?b(a):c(a))}}var v=window.v;!v&&typeof require!="undefined"&&(v=require("valentine"));var twoHundo=/^20\d$/,doc=document,byTag="getElementsByTagName",head=doc[byTag]("head")[0],xhr="XMLHttpRequest"in window?function(){return new XMLHttpRequest}:function(){return new ActiveXObject("Microsoft.XMLHTTP")},uniqid=0,lastValue;Reqwest.prototype={abort:function(){this.request.abort()},retry:function(){init.call(this,this.o,this.fn)}},reqwest.serialize=function(a){var b=a[byTag]("input"),c=a[byTag]("select"),d=a[byTag]("textarea");return(v(b).chain().toArray().map(serial).value().join("")+v(c).chain().toArray().map(serial).value().join("")+v(d).chain().toArray().map(serial).value().join("")).replace(/&$/,"")},reqwest.serializeArray=function(a){for(var b=this.serialize(a).split("&"),c=0,d=b.length,e=[],f;c<d;c++)b[c]&&(f=b[c].split("="))&&e.push({name:f[0],value:f[1]});return e};var old=window.reqwest;reqwest.noConflict=function(){window.reqwest=old;return this},window.reqwest=reqwest}(this)
-</script>
-
-<style type="text/css">
-body {
- font:14px/1.4em "Helvetica Neue", Helvetica, "Lucida Grande", Roboto, "Droid Sans", Ubuntu, Verdana, Arial, Clean, Sans, sans-serif;
- letter-spacing:0px;
- color:#333;
- margin:0;
- padding:0;
- background:#fff url(<?php echo pathinfo(__FILE__, PATHINFO_BASENAME); ?>?background) repeat-x top left;
-}
-
-div#site {
- width:650px;
- margin:20px auto 0 auto;
-}
-
-a {
- color: #326EA1;
- text-decoration: underline;
- padding: 1px 2px;
- -webkit-transition: background-color 0.15s;
- -webkit-transition: color 0.15s;
- -moz-transition: background-color 0.15s;
- -moz-transition: color 0.15s;
- transition: background-color 0.15s;
- transition: color 0.15s;
- -webkit-border-radius: 2px;
- -moz-border-radius: 2px;
- border-radius: 2px;
-}
-
-a:hover, a.hover {
- color: #fff;
- background-color: #333;
- text-decoration: none;
- padding: 1px 2px;
-}
-
-p {
- margin:0;
- padding:5px 0;
-}
-
-em {
- font-style:normal;
- background-color:#ffc;
-}
-
-ul, ol {
- margin:10px 0 10px 20px;
- padding:0 0 0 15px;
-}
-
-ul li, ol li {
- margin:0 0 4px 0;
- padding:0 0 0 3px;
-}
-
-h2 {
- font-size:18px;
- padding:0;
- margin:0 0 10px 0;
-}
-
-h3 {
- font-size:16px;
- padding:0;
- margin:20px 0 5px 0;
-}
-
-h4 {
- font-size:14px;
- padding:0;
- margin:15px 0 5px 0;
-}
-
-pre, code {
- font-family: "Panic Sans", "Bitstream Vera Sans Mono", Monaco, Consolas, "Andale Mono", monospace;
- background-color: #F0F0F0;
- border-radius: 3px 3px 3px 3px;
- padding: 0 3px;
- font-size: 1em;
-}
-
-em strong {
- text-transform: uppercase;
-}
-
-table.chart {
- border-collapse:collapse;
-}
-
-table.chart th {
- background-color:#eee;
- padding:2px 3px;
- border:1px solid #fff;
-}
-
-table.chart td {
- text-align:center;
- padding:2px 3px;
- border:1px solid #eee;
-}
-
-table.chart tr.enabled td {
- /* Leave this alone */
-}
-
-table.chart tr.disabled td,
-table.chart tr.disabled td a {
- color:#999;
- font-style:italic;
-}
-
-table.chart tr.disabled td a {
- text-decoration:underline;
-}
-
-div.chunk {
- margin:0;
- padding:10px;
- border-bottom:1px solid #ccc;
-}
-
-div.important {
- background-color:#ffc;
-}
-
-div.ok {
- background-color:#cfc;
-}
-
-div.error {
- background-color:#fcc;
-}
-
-div.important h3 {
- margin: 7px 0 5px 0;
-}
-
-.footnote,
-.footnote a {
- font:12px/1.4em "Helvetica Neue", Helvetica, "Lucida Grande", Verdana, Arial, Clean, Sans, sans-serif;
- color:#aaa;
-}
-
-.footnote em {
- background-color:transparent;
- font-style:italic;
-}
-</style>
-
-</head>
-
-<body>
-
-<div id="site">
- <div id="content">
-
- <div class="chunk">
- <h2 style="text-align:center;"><img src="<?php echo pathinfo(__FILE__, PATHINFO_BASENAME); ?>?logopng" alt="SDK Compatibility Test" title="SDK Compatibility Test" /></h2>
-
- <h3>Minimum Requirements</h3>
- <table cellpadding="0" cellspacing="0" border="0" width="100%" class="chart">
- <thead>
- <tr>
- <th>Test</th>
- <th>Should Be</th>
- <th>What You Have</th>
- </tr>
- </thead>
- <tbody>
- <tr class="<?php echo ($php_ok) ? 'enabled' : 'disabled'; ?>">
- <td>PHP</td>
- <td>5.2 or newer</td>
- <td><?php echo phpversion(); ?></td>
- </tr>
- <tr class="<?php echo ($curl_ok) ? 'enabled' : 'disabled'; ?>">
- <td><a href="http://php.net/curl">cURL</a></td>
- <td>7.15.0 or newer, with SSL</td>
- <td><?php echo ($curl_ok) ? ($curl_version['version'] . ' (' . $curl_version['ssl_version'] . ')') : ($curl_version['version'] . (in_array('https', $curl_version['protocols'], true) ? ' (with ' . $curl_version['ssl_version'] . ')' : ' (without SSL)')); ?></td>
- </tr>
- <tr class="<?php echo ($simplexml_ok) ? 'enabled' : 'disabled'; ?>">
- <td><a href="http://php.net/simplexml">SimpleXML</a></td>
- <td>Enabled</td>
- <td><?php echo ($simplexml_ok) ? 'Enabled' : 'Disabled'; ?></td>
- </tr>
- <tr class="<?php echo ($dom_ok) ? 'enabled' : 'disabled'; ?>">
- <td><a href="http://php.net/dom">DOM</a></td>
- <td>Enabled</td>
- <td><?php echo ($dom_ok) ? 'Enabled' : 'Disabled'; ?></td>
- </tr>
- <tr class="<?php echo ($spl_ok) ? 'enabled' : 'disabled'; ?>">
- <td><a href="http://php.net/spl">SPL</a></td>
- <td>Enabled</td>
- <td><?php echo ($spl_ok) ? 'Enabled' : 'Disabled'; ?></td>
- </tr>
- <tr class="<?php echo ($json_ok) ? 'enabled' : 'disabled'; ?>">
- <td><a href="http://php.net/json">JSON</a></td>
- <td>Enabled</td>
- <td><?php echo ($json_ok) ? 'Enabled' : 'Disabled'; ?></td>
- </tr>
- <tr class="<?php echo ($pcre_ok) ? 'enabled' : 'disabled'; ?>">
- <td><a href="http://php.net/pcre">PCRE</a></td>
- <td>Enabled</td>
- <td><?php echo ($pcre_ok) ? 'Enabled' : 'Disabled'; ?></td>
- </tr>
- <tr class="<?php echo ($file_ok) ? 'enabled' : 'disabled'; ?>">
- <td>File System <a href="http://php.net/file_get_contents">Read</a>/<a href="http://php.net/file_put_contents">Write</a></td>
- <td>Enabled</td>
- <td><?php echo ($file_ok) ? 'Enabled' : 'Disabled'; ?></td>
- </tr>
- </tbody>
- </table>
-
- <h3>Optional Extensions</h3>
- <table cellpadding="0" cellspacing="0" border="0" width="100%" class="chart">
- <thead>
- <tr>
- <th>Test</th>
- <th>Would Like To Be</th>
- <th>What You Have</th>
- </tr>
- </thead>
- <tbody>
- <tr class="<?php echo ($openssl_ok) ? 'enabled' : 'disabled'; ?>">
- <td><a href="http://php.net/openssl">OpenSSL</a></td>
- <td>Enabled</td>
- <td><?php echo ($openssl_ok) ? 'Enabled' : 'Disabled'; ?></td>
- </tr>
- <tr class="<?php echo ($zlib_ok) ? 'enabled' : 'disabled'; ?>">
- <td><a href="http://php.net/zlib">Zlib</a></td>
- <td>Enabled</td>
- <td><?php echo ($zlib_ok) ? 'Enabled' : 'Disabled'; ?></td>
- </tr>
- <tr class="<?php echo ($apc_ok) ? 'enabled' : 'disabled'; ?>">
- <td><a href="http://php.net/apc">APC</a></td>
- <td>Enabled</td>
- <td><?php echo ($apc_ok) ? 'Enabled' : 'Disabled'; ?></td>
- </tr>
- <tr class="<?php echo ($xcache_ok) ? 'enabled' : 'disabled'; ?>">
- <td><a href="http://xcache.lighttpd.net">XCache</a></td>
- <td>Enabled</td>
- <td><?php echo ($xcache_ok) ? 'Enabled' : 'Disabled'; ?></td>
- </tr>
- <tr class="<?php echo ($memcache_ok) ? 'enabled' : 'disabled'; ?>">
- <td><a href="http://php.net/memcache">Memcache</a></td>
- <td>Enabled</td>
- <td><?php echo ($memcache_ok) ? 'Enabled' : 'Disabled'; ?></td>
- </tr>
- <tr class="<?php echo ($memcached_ok) ? 'enabled' : 'disabled'; ?>">
- <td><a href="http://php.net/memcached">Memcached</a></td>
- <td>Enabled</td>
- <td><?php echo ($memcached_ok) ? 'Enabled' : 'Disabled'; ?></td>
- </tr>
- <tr class="<?php echo ($pdo_ok) ? 'enabled' : 'disabled'; ?>">
- <td><a href="http://php.net/pdo">PDO</a></td>
- <td>Enabled</td>
- <td><?php echo ($pdo_ok) ? 'Enabled' : 'Disabled'; ?></td>
- </tr>
- <tr class="<?php echo ($pdo_sqlite_ok) ? 'enabled' : 'disabled'; ?>">
- <td><a href="http://php.net/pdo-sqlite">PDO-SQLite</a></td>
- <td>Enabled</td>
- <td><?php echo ($pdo_sqlite_ok) ? 'Enabled' : 'Disabled'; ?></td>
- </tr>
- <tr class="<?php echo ($sqlite2_ok) ? 'enabled' : 'disabled'; ?>">
- <td><a href="http://php.net/sqlite">SQLite 2</a></td>
- <td>Enabled</td>
- <td><?php echo ($sqlite2_ok) ? 'Enabled' : 'Disabled'; ?></td>
- </tr>
- <tr class="<?php echo ($sqlite3_ok) ? 'enabled' : 'disabled'; ?>">
- <td><a href="http://php.net/sqlite3">SQLite 3</a></td>
- <td>Enabled</td>
- <td><?php echo ($sqlite3_ok) ? 'Enabled' : 'Disabled'; ?></td>
- </tr>
- </tbody>
- </table>
-
- <h3>Settings for php.ini</h3>
- <table cellpadding="0" cellspacing="0" border="0" width="100%" class="chart">
- <thead>
- <tr>
- <th>Test</th>
- <th>Would Like To Be</th>
- <th>What You Have</th>
- </tr>
- </thead>
- <tbody>
- <tr class="<?php echo (!$ini_open_basedir) ? 'enabled' : 'disabled'; ?>">
- <td><a href="http://php.net/open_basedir">open_basedir</a></td>
- <td>off</td>
- <td><?php echo ($ini_open_basedir) ? 'on' : 'off'; ?></td>
- </tr>
- <tr class="<?php echo (!$ini_safe_mode) ? 'enabled' : 'disabled'; ?>">
- <td><a href="http://php.net/safe_mode">safe_mode</a></td>
- <td>off</td>
- <td><?php echo ($ini_safe_mode) ? 'on' : 'off'; ?></td>
- </tr>
- <tr class="<?php echo ($ini_zend_enable_gc) ? 'enabled' : 'disabled'; ?>">
- <td><a href="http://php.net/zend.enable_gc">zend.enable_gc</a></td>
- <td>on</td>
- <td><?php echo ($ini_zend_enable_gc) ? 'on' : 'off'; ?></td>
- </tr>
- </tbody>
- </table>
-
- <h3>Other</h3>
- <table cellpadding="0" cellspacing="0" border="0" width="100%" class="chart">
- <thead>
- <tr>
- <th>Test</th>
- <th>Would Like To Be</th>
- <th>What You Have</th>
- </tr>
- </thead>
- <tbody>
- <tr class="<?php echo ($int64_ok) ? 'enabled' : 'disabled'; ?>">
- <td><a href="https://aws.amazon.com/amis/4158">Architecture</a></td>
- <td>64-bit</td>
- <td><?php echo ($int64_ok) ? '64-bit' : '32-bit'; ?><?php if (is_windows()): ?>
- (<a href="#win64">why?</a>)
- <?php endif; ?></td>
- </tr>
- </tbody>
- </table>
-
- <br>
- </div>
-
- <?php if ($compatiblity == REQUIREMENTS_ALL_MET): ?>
- <div class="chunk important ok">
- <h3>Bottom Line: Yes, you can!</h3>
- <p>Your PHP environment is ready to go, and can take advantage of all possible features!</p>
- </div>
- <div class="chunk">
- <h3>What's Next?</h3>
- <p>You can download the latest version of the <a href="http://aws.amazon.com/sdkforphp"><strong>AWS SDK for PHP</strong></a> and install it by <a href="http://aws.amazon.com/articles/4261">following the instructions</a>. Also, check out our library of <a href="http://aws.amazon.com/articles/4262">screencasts and tutorials</a>.</p>
- <p>Take the time to read <a href="http://aws.amazon.com/articles/4261">"Getting Started"</a> to make sure you're prepared to use the AWS SDK for PHP. No seriously, read it.</p>
- </div>
- <?php elseif ($compatiblity == REQUIREMENTS_MIN_MET): ?>
- <div class="chunk important ok">
- <h3>Bottom Line: Yes, you can!</h3>
- <p>Your PHP environment is ready to go! <i>There are a couple of minor features that you won't be able to take advantage of, but nothing that's a show-stopper.</i></p>
- </div>
- <div class="chunk">
- <h3>What's Next?</h3>
- <p>You can download the latest version of the <a href="http://aws.amazon.com/sdkforphp"><strong>AWS SDK for PHP</strong></a> and install it by <a href="http://aws.amazon.com/articles/4261">following the instructions</a>. Also, check out our library of <a href="http://aws.amazon.com/articles/4262">screencasts and tutorials</a>.</p>
- <p>Take the time to read <a href="http://aws.amazon.com/articles/4261">"Getting Started"</a> to make sure you're prepared to use the AWS SDK for PHP. No seriously, read it.</p>
- </div>
- <?php else: ?>
- <div class="chunk important error">
- <h3>Bottom Line: We're sorry&hellip;</h3>
- <p>Your PHP environment does not support the minimum requirements for the <strong>AWS SDK for PHP</strong>.</p>
- </div>
- <div class="chunk">
- <h3>What's Next?</h3>
- <p>If you're using a shared hosting plan, it may be a good idea to contact your web host and ask them to install a more recent version of PHP and relevant extensions.</p>
- <p>If you have control over your PHP environment, we recommended that you upgrade your PHP environment. Check out the "Set Up Your Environment" section of the <a href="http://aws.amazon.com/articles/4261">Getting Started Guide</a> for more information.</p>
- </div>
- <?php endif; ?>
-
- <?php if ($compatiblity >= REQUIREMENTS_MIN_MET): ?>
- <div class="chunk">
- <h3>Recommended settings for config.inc.php</h3>
- <p>Based on your particular server configuration, the following settings are recommended.</p>
- <br>
- <table cellpadding="0" cellspacing="0" border="0" width="100%" class="chart">
- <thead>
- <tr>
- <th>Configuration Setting</th>
- <th>Recommended Value</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><code>default_cache_config</code></td>
- <?php if ($apc_ok): ?>
- <td><code>apc</code></td>
- <?php elseif ($xcache_ok): ?>
- <td><code>xcache</code></td>
- <?php elseif ($file_ok): ?>
- <td>Any valid, server-writable file system path</td>
- <?php endif; ?>
- </tr>
- <tr>
- <td><code>certificate_authority</code></td>
- <?php if (is_windows()): ?>
- <td id="ssl_check"><code>true</code></td>
- <?php else: ?>
- <td id="ssl_check"><img src="<?php echo pathinfo(__FILE__, PATHINFO_BASENAME); ?>?loader" alt="Loading..."></td>
- <?php endif; ?>
- </tr>
- </tbody>
- </table>
- <br>
- </div>
- <?php endif; ?>
-
- <div class="chunk">
- <h3>Give me the details!</h3>
- <?php if ($compatiblity >= REQUIREMENTS_MIN_MET): ?>
- <ol>
- <li><em>Your environment meets the minimum requirements for using the <strong>AWS SDK for PHP</strong>!</em></li>
-
- <?php if (version_compare(PHP_VERSION, '5.3.0') < 0): ?>
- <li>You're still running <strong>PHP <?php echo PHP_VERSION; ?></strong>. The PHP 5.2 family is no longer supported by the PHP team, and future versions of the AWS SDK for PHP will <i>require</i> PHP 5.3 or newer.</li>
- <?php endif; ?>
-
- <?php if ($openssl_ok): ?>
- <li>The <a href="http://php.net/openssl">OpenSSL</a> extension is installed. This will allow you to use <a href="http://docs.amazonwebservices.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html">CloudFront Private URLs</a> and decrypt Microsoft&reg; Windows&reg; instance passwords.</li>
- <?php endif; ?>
-
- <?php if ($zlib_ok): ?>
- <li>The <a href="http://php.net/zlib">Zlib</a> extension is installed. The SDK will request gzipped data whenever possible.</li>
- <?php endif; ?>
-
- <?php if (!$int64_ok): ?>
- <li>You're running on a <strong>32-bit</strong> system. This means that PHP does not correctly handle files larger than 2GB (this is a <a href="http://www.google.com/search?q=php+2gb+32-bit">well-known PHP issue</a>). For more information, please see: <a href="http://docs.php.net/manual/en/function.filesize.php#refsect1-function.filesize-returnvalues">PHP filesize: Return values</a>.</li>
- <?php if (is_windows()): ?>
- <li id="win64"><em>Note that PHP on Microsoft® Windows® <a href="http://j.mp/php64win">does not support 64-bit integers at all</a>, even if both the hardware and PHP are 64-bit.</em></li>
- <?php endif; ?>
- <?php endif; ?>
-
- <?php if ($ini_open_basedir || $ini_safe_mode): ?>
- <li>You have <a href="http://php.net/open_basedir">open_basedir</a> or <a href="http://php.net/safe_mode">safe_mode</a> enabled in your <code>php.ini</code> file. Sometimes PHP behaves strangely when these settings are enabled. Disable them if you can.</li>
- <?php endif; ?>
-
- <?php if (!$ini_zend_enable_gc): ?>
- <li>The PHP garbage collector (available in PHP 5.3+) is not enabled in your <code>php.ini</code> file. Enabling <a href="http://php.net/zend.enable_gc">zend.enable_gc</a> will provide better memory management in the PHP core.</li>
- <?php endif; ?>
-
- <?php
- $storage_types = array();
- if ($file_ok) { $storage_types[] = '<a href="http://php.net/file_put_contents">The file system</a>'; }
- if ($apc_ok) { $storage_types[] = '<a href="http://php.net/apc">APC</a>'; }
- if ($xcache_ok) { $storage_types[] = '<a href="http://xcache.lighttpd.net">XCache</a>'; }
- if ($sqlite_ok && $sqlite3_ok) { $storage_types[] = '<a href="http://php.net/sqlite3">SQLite 3</a>'; }
- elseif ($sqlite_ok && $sqlite2_ok) { $storage_types[] = '<a href="http://php.net/sqlite">SQLite 2</a>'; }
- if ($memcached_ok) { $storage_types[] = '<a href="http://php.net/memcached">Memcached</a>'; }
- elseif ($memcache_ok) { $storage_types[] = '<a href="http://php.net/memcache">Memcache</a>'; }
- ?>
- <li>Storage types available for response caching: <?php echo implode(', ', $storage_types); ?></li>
- </ol>
-
- <?php if (!$openssl_ok && !$zlib_ok): ?>
- <p class="footnote"><strong>NOTE:</strong> You're missing the <a href="http://php.net/openssl">OpenSSL</a> extension, which means that you won't be able to take advantage of <a href="http://docs.amazonwebservices.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html">CloudFront Private URLs</a> or decrypt Microsoft&reg; Windows&reg; instance passwords. You're also missing the <a href="http://php.net/zlib">Zlib</a> extension, which means that the SDK will be unable to request gzipped data from Amazon and you won't be able to take advantage of compression with the <i>response caching</i> feature.</p>
- <?php elseif (!$zlib_ok): ?>
- <p class="footnote"><strong>NOTE:</strong> You're missing the <a href="http://php.net/zlib">Zlib</a> extension, which means that the SDK will be unable to request gzipped data from Amazon and you won't be able to take advantage of compression with the <i>response caching</i> feature.</p>
- <?php elseif (!$openssl_ok): ?>
- <p class="footnote"><strong>NOTE:</strong> You're missing the <a href="http://php.net/openssl">OpenSSL</a> extension, which means that you won't be able to take advantage of <a href="http://docs.amazonwebservices.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html">CloudFront Private URLs</a> or decrypt Microsoft&reg; Windows&reg; instance passwords.</p>
- <?php endif; ?>
-
- <?php else: ?>
- <ol>
- <?php if (!$php_ok): ?>
- <li><strong>PHP:</strong> You are running an unsupported version of PHP.</li>
- <?php endif; ?>
-
- <?php if (!$curl_ok): ?>
- <li><strong>cURL:</strong> The <a href="http://php.net/curl">cURL</a> extension is not available. Without cURL, the SDK cannot connect to &mdash; or authenticate with &mdash; Amazon's services.</li>
- <?php endif; ?>
-
- <?php if (!$simplexml_ok): ?>
- <li><strong>SimpleXML:</strong> The <a href="http://php.net/simplexml">SimpleXML</a> extension is not available. Without SimpleXML, the SDK cannot parse the XML responses from Amazon's services.</li>
- <?php endif; ?>
-
- <?php if (!$dom_ok): ?>
- <li><strong>DOM:</strong> The <a href="http://php.net/dom">DOM</a> extension is not available. Without DOM, the SDK cannot transliterate JSON responses from Amazon's services into the common SimpleXML-based pattern used throughout the SDK.</li>
- <?php endif; ?>
-
- <?php if (!$spl_ok): ?>
- <li><strong>SPL:</strong> <a href="http://php.net/spl">Standard PHP Library</a> support is not available. Without SPL support, the SDK cannot autoload the required PHP classes.</li>
- <?php endif; ?>
-
- <?php if (!$json_ok): ?>
- <li><strong>JSON:</strong> <a href="http://php.net/json">JSON</a> support is not available. AWS leverages JSON heavily in many of its services.</li>
- <?php endif; ?>
-
- <?php if (!$pcre_ok): ?>
- <li><strong>PCRE:</strong> Your PHP installation doesn't support Perl-Compatible Regular Expressions (PCRE). Without PCRE, the SDK cannot do any filtering via regular expressions.</li>
- <?php endif; ?>
-
- <?php if (!$file_ok): ?>
- <li><strong>File System Read/Write:</strong> The <a href="http://php.net/file_get_contents">file_get_contents()</a> and/or <a href="http://php.net/file_put_contents">file_put_contents()</a> functions have been disabled. Without them, the SDK cannot read from, or write to, the file system.</li>
- <?php endif; ?>
- </ol>
- <?php endif; ?>
- </div>
-
- <div class="chunk">
- <p class="footnote"><strong>NOTE</strong>: Passing this test does not guarantee that the AWS SDK for PHP will run on your web server &mdash; it only ensures that the requirements have been addressed.</p>
- </div>
- </div>
-
-</div>
-
-<?php if (!is_windows()): ?>
-<script type="text/javascript" charset="utf-8">
-reqwest('<?php echo pathinfo(__FILE__, PATHINFO_BASENAME); ?>?ssl_check', function(resp) {
- $sslCheck = document.getElementById('ssl_check');
- $sslCheck.innerHTML = '';
- $sslCheck.innerHTML = '<code>' + resp + '</code>';
-});
-</script>
-<?php endif; ?>
-
-</body>
-</html>
diff --git a/3rdparty/aws-sdk/_compatibility_test/sdk_compatibility_test_cli.php b/3rdparty/aws-sdk/_compatibility_test/sdk_compatibility_test_cli.php
deleted file mode 100755
index a6632d89787..00000000000
--- a/3rdparty/aws-sdk/_compatibility_test/sdk_compatibility_test_cli.php
+++ /dev/null
@@ -1,186 +0,0 @@
-#! /usr/bin/env php
-<?php
-
-//Prevent script from being called via browser
-if (PHP_SAPI !== 'cli')
-{
- die('ERROR: You may only run the compatibility test from the command line.');
-}
-
-// Include the compatibility test logic
-require dirname(__FILE__) . DIRECTORY_SEPARATOR . 'sdk_compatibility.inc.php';
-
-// CLI display
-function success($s = 'Yes')
-{
- return is_windows() ? $s : "\033[1;37m\033[42m " . $s . " \033[0m";
-}
-
-function info($s = 'Info')
-{
- return is_windows() ? $s : "\033[1;37m\033[44m " . $s . " \033[0m";
-}
-
-function failure($s = 'No ')
-{
- return is_windows() ? $s : "\033[1;37m\033[41m " . $s . " \033[0m";
-}
-
-/////////////////////////////////////////////////////////////////////////
-
-echo PHP_EOL;
-
-echo info('AWS SDK for PHP') . PHP_EOL;
-echo 'PHP Environment Compatibility Test (CLI)' . PHP_EOL;
-echo '----------------------------------------' . PHP_EOL;
-echo PHP_EOL;
-
-echo 'PHP 5.2 or newer............ ' . ($php_ok ? (success() . ' ' . phpversion()) : failure()) . PHP_EOL;
-echo '64-bit architecture......... ' . ($int64_ok ? success() : failure()) . (is_windows() ? ' (see note below)' : '') . PHP_EOL;
-echo 'cURL with SSL............... ' . ($curl_ok ? (success() . ' ' . $curl_version['version'] . ' (' . $curl_version['ssl_version'] . ')') : failure($curl_version['version'] . (in_array('https', $curl_version['protocols'], true) ? ' (with ' . $curl_version['ssl_version'] . ')' : ' (without SSL)'))) . PHP_EOL;
-echo 'Standard PHP Library........ ' . ($spl_ok ? success() : failure()) . PHP_EOL;
-echo 'SimpleXML................... ' . ($simplexml_ok ? success() : failure()) . PHP_EOL;
-echo 'DOM......................... ' . ($dom_ok ? success() : failure()) . PHP_EOL;
-echo 'JSON........................ ' . ($json_ok ? success() : failure()) . PHP_EOL;
-echo 'PCRE........................ ' . ($pcre_ok ? success() : failure()) . PHP_EOL;
-echo 'File system read/write...... ' . ($file_ok ? success() : failure()) . PHP_EOL;
-echo 'OpenSSL extension........... ' . ($openssl_ok ? success() : failure()) . PHP_EOL;
-echo 'Zlib........................ ' . ($zlib_ok ? success() : failure()) . PHP_EOL;
-echo 'APC......................... ' . ($apc_ok ? success() : failure()) . PHP_EOL;
-echo 'XCache...................... ' . ($xcache_ok ? success() : failure()) . PHP_EOL;
-echo 'Memcache.................... ' . ($memcache_ok ? success() : failure()) . PHP_EOL;
-echo 'Memcached................... ' . ($memcached_ok ? success() : failure()) . PHP_EOL;
-echo 'PDO......................... ' . ($pdo_ok ? success() : failure()) . PHP_EOL;
-echo 'SQLite 2.................... ' . ($sqlite2_ok ? success() : failure()) . PHP_EOL;
-echo 'SQLite 3.................... ' . ($sqlite3_ok ? success() : failure()) . PHP_EOL;
-echo 'PDO-SQLite driver........... ' . ($pdo_sqlite_ok ? success() : failure()) . PHP_EOL;
-echo 'open_basedir disabled....... ' . (!$ini_open_basedir ? success() : failure()) . PHP_EOL;
-echo 'safe_mode disabled.......... ' . (!$ini_safe_mode ? success() : failure()) . PHP_EOL;
-echo 'Garbage Collector enabled... ' . ($ini_zend_enable_gc ? success() : failure()) . PHP_EOL;
-
-// Test SSL cert
-if (!is_windows())
-{
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, 'https://email.us-east-1.amazonaws.com');
- curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
- curl_setopt($ch, CURLOPT_HEADER, false);
- curl_setopt($ch, CURLOPT_NOBODY, true);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
- curl_setopt($ch, CURLOPT_TIMEOUT, 5184000);
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120);
- curl_setopt($ch, CURLOPT_NOSIGNAL, true);
- curl_setopt($ch, CURLOPT_USERAGENT, 'aws-sdk-php/compat-cli');
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
- curl_setopt($ch, CURLOPT_VERBOSE, false);
- curl_exec($ch);
- $ssl_result = !(curl_getinfo($ch, CURLINFO_SSL_VERIFYRESULT) === 0);
- curl_close($ch);
-
- echo 'Valid SSL certificate....... ' . ($ssl_result ? failure() : success()) . PHP_EOL;
-}
-else
-{
- $ssl_result = false;
- echo 'Valid SSL certificate....... ' . failure() . ' (will use the bundled certificate instead)' . PHP_EOL;
-}
-
-echo PHP_EOL;
-
-echo '----------------------------------------' . PHP_EOL;
-echo PHP_EOL;
-
-if ($compatiblity >= REQUIREMENTS_MIN_MET)
-{
- echo success('Your environment meets the minimum requirements for using the AWS SDK for PHP!') . PHP_EOL . PHP_EOL;
- if (version_compare(PHP_VERSION, '5.3.0') < 0) { echo '* You\'re still running PHP ' . PHP_VERSION . '. The PHP 5.2 family is no longer supported' . PHP_EOL . ' by the PHP team, and future versions of the AWS SDK for PHP will *require*' . PHP_EOL . ' PHP 5.3 or newer.' . PHP_EOL . PHP_EOL; }
- if ($openssl_ok) { echo '* The OpenSSL extension is installed. This will allow you to use CloudFront' . PHP_EOL . ' Private URLs and decrypt Windows instance passwords.' . PHP_EOL . PHP_EOL; }
- if ($zlib_ok) { echo '* The Zlib extension is installed. The SDK will request gzipped data' . PHP_EOL . ' whenever possible.' . PHP_EOL . PHP_EOL; }
- if (!$int64_ok) { echo '* You\'re running on a 32-bit system. This means that PHP does not correctly' . PHP_EOL . ' handle files larger than 2GB (this is a well-known PHP issue).' . PHP_EOL . PHP_EOL; }
- if (!$int64_ok && is_windows()) { echo '* Note that PHP on Microsoft(R) Windows(R) does not support 64-bit integers' . PHP_EOL . ' at all, even if both the hardware and PHP are 64-bit. http://j.mp/php64win' . PHP_EOL . PHP_EOL; }
-
- if ($ini_open_basedir || $ini_safe_mode) { echo '* You have open_basedir or safe_mode enabled in your php.ini file. Sometimes' . PHP_EOL . ' PHP behaves strangely when these settings are enabled. Disable them if you can.' . PHP_EOL . PHP_EOL; }
- if (!$ini_zend_enable_gc) { echo '* The PHP garbage collector (available in PHP 5.3+) is not enabled in your' . PHP_EOL . ' php.ini file. Enabling zend.enable_gc will provide better memory management' . PHP_EOL . ' in the PHP core.' . PHP_EOL . PHP_EOL; }
-
- $storage_types = array();
- if ($file_ok) { $storage_types[] = 'The file system'; }
- if ($apc_ok) { $storage_types[] = 'APC'; }
- if ($xcache_ok) { $storage_types[] = 'XCache'; }
- if ($sqlite_ok && $sqlite3_ok) { $storage_types[] = 'SQLite 3'; }
- elseif ($sqlite_ok && $sqlite2_ok) { $storage_types[] = 'SQLite 2'; }
- if ($memcached_ok) { $storage_types[] = 'Memcached'; }
- elseif ($memcache_ok) { $storage_types[] = 'Memcache'; }
- echo '* Storage types available for response caching:' . PHP_EOL . ' ' . implode(', ', $storage_types) . PHP_EOL . PHP_EOL;
-
- if (!$openssl_ok) { echo '* You\'re missing the OpenSSL extension, which means that you won\'t be able' . PHP_EOL . ' to take advantage of CloudFront Private URLs or Windows password decryption.' . PHP_EOL . PHP_EOL; }
- if (!$zlib_ok) { echo '* You\'re missing the Zlib extension, which means that the SDK will be unable' . PHP_EOL . ' to request gzipped data from Amazon and you won\'t be able to take advantage' . PHP_EOL . ' of compression with the response caching feature.' . PHP_EOL . PHP_EOL; }
-}
-else
-{
- if (!$php_ok) { echo '* ' . failure('PHP:') . ' You are running an unsupported version of PHP.' . PHP_EOL . PHP_EOL; }
- if (!$curl_ok) { echo '* ' . failure('cURL:') . ' The cURL extension is not available. Without cURL, the SDK cannot' . PHP_EOL . ' connect to -- or authenticate with -- Amazon\'s services.' . PHP_EOL . PHP_EOL; }
- if (!$simplexml_ok) { echo '* ' . failure('SimpleXML:') . ': The SimpleXML extension is not available. Without SimpleXML,' . PHP_EOL . ' the SDK cannot parse the XML responses from Amazon\'s services.' . PHP_EOL . PHP_EOL; }
- if (!$dom_ok) { echo '* ' . failure('DOM:') . ': The DOM extension is not available. Without DOM, the SDK' . PHP_EOL . ' Without DOM, the SDK cannot transliterate JSON responses from Amazon\'s' . PHP_EOL . ' services into the common SimpleXML-based pattern used throughout the SDK.' . PHP_EOL . PHP_EOL; }
- if (!$spl_ok) { echo '* ' . failure('SPL:') . ' Standard PHP Library support is not available. Without SPL support,' . PHP_EOL . ' the SDK cannot autoload the required PHP classes.' . PHP_EOL . PHP_EOL; }
- if (!$json_ok) { echo '* ' . failure('JSON:') . ' JSON support is not available. AWS leverages JSON heavily in many' . PHP_EOL . ' of its services.' . PHP_EOL . PHP_EOL; }
- if (!$pcre_ok) { echo '* ' . failure('PCRE:') . ' Your PHP installation doesn\'t support Perl-Compatible Regular' . PHP_EOL . ' Expressions (PCRE). Without PCRE, the SDK cannot do any filtering via' . PHP_EOL . ' regular expressions.' . PHP_EOL . PHP_EOL; }
- if (!$file_ok) { echo '* ' . failure('File System Read/Write:') . ' The file_get_contents() and/or file_put_contents()' . PHP_EOL . ' functions have been disabled. Without them, the SDK cannot read from,' . PHP_EOL . ' or write to, the file system.' . PHP_EOL . PHP_EOL; }
-}
-
-echo '----------------------------------------' . PHP_EOL;
-echo PHP_EOL;
-
-if ($compatiblity === REQUIREMENTS_ALL_MET)
-{
- echo success('Bottom Line: Yes, you can!') . PHP_EOL;
- echo PHP_EOL;
- echo 'Your PHP environment is ready to go, and can take advantage of all possible features!' . PHP_EOL;
-
- echo PHP_EOL;
- echo info('Recommended settings for config.inc.php') . PHP_EOL;
- echo PHP_EOL;
-
- echo "CFCredentials::set(array(" . PHP_EOL;
- echo " '@default' => array(" . PHP_EOL;
- echo " 'key' => 'aws-key'," . PHP_EOL;
- echo " 'secret' => 'aws-secret'," . PHP_EOL;
- echo " 'default_cache_config' => ";
- if ($apc_ok) echo success('\'apc\'');
- elseif ($xcache_ok) echo success('\'xcache\'');
- elseif ($file_ok) echo success('\'/path/to/cache/folder\'');
- echo "," . PHP_EOL;
- echo " 'certificate_authority' => " . success($ssl_result ? 'true' : 'false') . PHP_EOL;
- echo " )" . PHP_EOL;
- echo "));" . PHP_EOL;
-}
-elseif ($compatiblity === REQUIREMENTS_MIN_MET)
-{
- echo success('Bottom Line: Yes, you can!') . PHP_EOL;
- echo PHP_EOL;
- echo 'Your PHP environment is ready to go! There are a couple of minor features that' . PHP_EOL . 'you won\'t be able to take advantage of, but nothing that\'s a show-stopper.' . PHP_EOL;
-
- echo PHP_EOL;
- echo info('Recommended settings for config.inc.php') . PHP_EOL;
- echo PHP_EOL;
-
- echo "CFCredentials::set(array(" . PHP_EOL;
- echo " '@default' => array(" . PHP_EOL;
- echo " 'key' => 'aws-key'," . PHP_EOL;
- echo " 'secret' => 'aws-secret'," . PHP_EOL;
- echo " 'default_cache_config' => ";
- if ($apc_ok) echo success('\'apc\'');
- elseif ($xcache_ok) echo success('\'xcache\'');
- elseif ($file_ok) echo success('\'/path/to/cache/folder\'');
- echo "," . PHP_EOL;
- echo " 'certificate_authority' => " . ($ssl_result ? 'false' : 'true') . PHP_EOL;
- echo " )" . PHP_EOL;
- echo "));" . PHP_EOL;
-}
-else
-{
- echo failure('Bottom Line: We\'re sorry...') . PHP_EOL;
- echo 'Your PHP environment does not support the minimum requirements for the ' . PHP_EOL . 'AWS SDK for PHP.' . PHP_EOL;
-}
-
-echo PHP_EOL;
diff --git a/3rdparty/aws-sdk/_docs/CHANGELOG.md b/3rdparty/aws-sdk/_docs/CHANGELOG.md
deleted file mode 100644
index 52db66f4f6f..00000000000
--- a/3rdparty/aws-sdk/_docs/CHANGELOG.md
+++ /dev/null
@@ -1,1405 +0,0 @@
-# Changelog: 1.5.6.2 "Gershwin"
-Code name for Apple's never-released successor to the never-released Copeland. <http://en.wikipedia.org/wiki/Gershwin_operating_system>
-
-Launched Tuesday, May 29th, 2012.
-
-## Services
-### AmazonDynamoDB
-- **Fixed:** STS credentials were not always being cached correctly.
-
-----
-
-# Changelog: 1.5.6.1 "Gershwin"
-Code name for Apple's never-released successor to the never-released Copeland. <http://en.wikipedia.org/wiki/Gershwin_operating_system>
-
-Launched Tuesday, May 24th, 2012.
-
-## Services
-### AmazonDynamoDB
-- **Fixed:** STS credentials were not always being cached correctly.
-
-----
-
-# Changelog: 1.5.6 "Gershwin"
-Code name for Apple's never-released successor to the never-released Copeland. <http://en.wikipedia.org/wiki/Gershwin_operating_system>
-
-Launched Tuesday, May 15th, 2012.
-
-## Services
-### AmazonSES
-- **New:** Support for domain verification has been added to the SDK, which enables customers to verify an entire email domain.
-- **New:** Requests to this service are now signed with Signature V4.
-
-----
-
-# Changelog: 1.5.5 "Fishhead"
-Code name for the Apple II File Mangement Utility. <http://applemuseum.bott.org/sections/codenames.html>
-
-Launched Wednesday, May 9, 2012.
-
-## Services
-### AmazonCloudFormation
-* **New:** Requests to this service are now signed with Signature V4.
-
-### AmazonCloudFront
-* **New:** Updated the supported API version to `2012-03-15`.
-
-### AmazonDynamoDB
-* **New:** Support for the US West (Northern California), US West (Oregon), Asia Pacific "Southeast" (Signapore) endpoints have been added.
-
-### AmazonElasticBeanstalk
-* **New:** Support for the new Asia Pacific "Northeast" (Japan) endpoint has been added.
-
-### AmazonStorageGateway
-* **New:** Support for the AWS Storage Gateway service has been added to the SDK.
-
----
-
-# Changelog: 1.5.4 "Enterprise"
-Code name for Mac OS X Server 1.0 (Rhapsody CR1). <http://en.wikipedia.org/wiki/Rhapsody_(operating_system)>
-
-Launched Thursday, April 19, 2012.
-
-## Bug fixes and enhancements
-* [PHP SDK Bug - Memory leak](https://forums.aws.amazon.com/thread.jspa?threadID=72310)
-* [Does update_object work in 1.5.3?](https://forums.aws.amazon.com/thread.jspa?threadID=89297)
-* [The value of CURLOPT_SSL_VERIFYHOST](https://forums.aws.amazon.com/thread.jspa?threadID=86186)
-* [PHP SDK BUG: s3.class.php Line 2396 on 1.5.2](https://forums.aws.amazon.com/thread.jspa?threadID=86779)
-* [first create_bucket(), then get_bucket_list()](https://forums.aws.amazon.com/thread.jspa?messageID=318885)
-* [Issue with AmazonS3::get_object_list() max-keys](https://forums.aws.amazon.com/thread.jspa?threadID=85878)
-* [Correct the "Bottom line" minimum requirements check](https://github.com/amazonwebservices/aws-sdk-for-php/pull/23)
-* [S3 PHP SDK: copy_object() fails to update the header](http://stackoverflow.com/questions/7677837/s3-php-sdk-copy-object-fails-to-update-the-header)
-* [Adds the following utility methods to simplexml.class.php](https://github.com/amazonwebservices/aws-sdk-for-php/pull/22)
-* [Adding the ability to name a 'rule' for Object Expiration (suggested tweak)](https://forums.aws.amazon.com/thread.jspa?messageID=328023)
-
-## Runtime
-* **New:** Support for Signature Version 4 has been added to the SDK. Signature Version 4 is now the default authentication method for AWS Identity and Access Management, AWS Security Token Service and Amazon CloudSearch.
-
-## Services
-### AmazonCloudFront
-* **New:** Support for a Minimum TTL of zero has been added to the SDK.
-
-### AmazonCloudSearch
-* **New:** Support for Amazon CloudSearch has been added to the SDK. This includes only the Configuration API.
-
-### AmazonDynamoDB
-* **New:** Support for BatchWriteItem API has been added to the SDK.
-* **New:** Support for the European (Ireland) endpoint has been added.
-* **New:** Support for the Asia Pacific "Northeast" (Tokyo) endpoint has been added.
-* **New:** Amazon DynamoDB Session Handler has been added to the SDK.
-* **New:** A simplified interface for adding attributes has been added to the SDK.
-
-### AmazonEC2
-* **New:** The new "m1.medium" instance type is now supported.
-* **New:** Amazon EBS support for Volume Status and Volume Attributes have been added to the SDK.
-* **New:** Amazon EBS support for Conversion Tasks has been added to the SDK.
-* **New:** Amazon EC2 support for the Report Instance Status feature has been added to the SDK.
-* **New:** Amazon VPC support for Network Interfaces has been added to the SDK.
-* **Fixed:** Various parameter fixes have been applied.
-
-### AmazonIAM
-* **New:** Support for Password Policies and the ability to change passwords has been added to the SDK.
-
-### AmazonS3
-* **New:** Support for pre-signed URLs using temporary credentials has been added to the SDK.
-* **New:** Support for setting a custom name to Lifecycle (i.e., Object Expiration) rules has been added to the SDK.
-* **New:** Support for pre-signed URLs with https has been added to the SDK.
-* **Fixed:** Resolved an issue where setting a custom XML parsing class was not being respected.
-* **Fixed:** Resolved an issue where the `get_object_list()` method would return an incorrect number of entries.
-* **Fixed:** Resolved an issue where `update_object()` was attempting to COPY instead of REPLACE.
-* **Fixed:** Resolved an issue stemming from using path-style URLs, `create_bucket()` + `list_bucket()` and the EU-West region.
-* **Fixed:** Resolved an issue where XML responses were not being parsed consistently.
-* **Fixed:** Resolved an issue where Private Streaming URLs contained a double-encoded signature.
-* **Fixed:** The `Expect: 100-continue` HTTP header is now only sent during `create_object()` and `upload_part()` requests.
-
-## Utilities
-### CFRuntime
-* **Fixed:** Resolved an issue where `CURLOPT_SSL_VERIFYHOST` was not set strictly enough.
-* **Fixed:** The `Expect: 100-continue` HTTP header is no longer set on every request.
-
-### CFSimpleXML
-* **New:** Support for `matches()`, `starts_with()` and `ends_with()` methods have been added to the SDK. (Thanks [Wil Moore III](https://github.com/wilmoore)!)
-
-## Compatibility Test
-* **New:** SDK Compatibility Test pages are marked up as to not be indexed by search engines. (Thanks [Eric Caron](http://www.ericcaron.com)!)
-* **Fixed:** Duplicate code between the CLI and web versions of the SDK has been refactored. (Thanks [Jimmy Berry](https://github.com/boombatower)!)
-
----
-
-# Changelog: 1.5.3 "Darwin"
-UNIX foundation upon which Mac OS X, Apple TV, and iOS are based. <http://en.wikipedia.org/wiki/Darwin_operating_system>
-
-Launched Wednesday, Tuesday, February 21, 2012.
-
-## Bug fixes and enhancements
-* [Fixing Issue with set_distribution_config](https://github.com/amazonwebservices/aws-sdk-for-php/pull/20)
-
-## Services
-### AmazonCloudFront
-* **Fixed:** Resolved an issue where the `set_distribution_config()` method could fail to satisfy an API constraint when using a custom origin server. (Thanks [zoxa](https://github.com/zoxa)!)
-
-### AmazonSWF
-* **New:** Support for the new Amazon Simple Workflow Service has been added to the SDK.
-
-----
-
-# Changelog: 1.5.2 "Copland"
-Code name for Apple's never-released successor to System 7. <http://en.wikipedia.org/wiki/Copland_(operating_system)>
-
-Launched Wednesday, Febraury 1, 2012.
-
-## Bug fixes and enhancements
-* [SSL Cert on PHP SDK 1.5.0.1 ](https://forums.aws.amazon.com/thread.jspa?threadID=84947)
-* [Stream Wrapper need a buffer !](https://forums.aws.amazon.com/thread.jspa?threadID=85436)
-* [Fixing Issue with set_distribution_config](https://github.com/amazonwebservices/aws-sdk-for-php/pull/20)
-* [[Bug] SDK Autoloader Interferes with PHPExcel Autoloader](https://forums.aws.amazon.com/thread.jspa?threadID=85239)
-* [get_object query does not always return the same content type](https://forums.aws.amazon.com/thread.jspa?threadID=84148)
-* [AWSSDKforPHP/authentication/swift_transport_esmtp_signature_handler.class.p ](https://forums.aws.amazon.com/thread.jspa?threadID=85087)
-
-## Runtime
-* **New:** Updated the CA Root Certificates file to version 1.81.
-* **Fixed:** Resolved an issue in the autoloader where the matching logic was too aggressive in certain cases, causing subsequent autoloaders to never trigger.
-
-## Services
-### AmazonAS
-* **New:** Support for Auto Scaling Resource Tagging has been added to the SDK.
-
-### AmazonS3
-* **Fixed:** Resolved an issue where `delete_all_objects()` and `delete_all_object_versions()` was being limited to 1000 items.
-* **Fixed:** Resolved an issue where `delete_bucket()` would fail to delete a bucket with the "force" option enabled if the bucket contained more than 1000 items.
-* **Fixed:** Resolved an issue where JSON documents stored in Amazon S3 would be parsed into a native PHP object when retrieved.
-
-## Utilities
-### S3StreamWrapper
-* **New:** Support for multiple stream wrappers (e.g., one per region) has been added to the SDK.
-* **Fixed:** Writes to Amazon S3 are now buffered, resolving issues with pushing more than 8k of data at a time.
-
-### CFJSON
-* **Fixed:** The JSON-to-XML conversion code is now substantially more robust and better handles encoded characters.
-
-### CacheCore
-* **Changed:** Formerly, attempting to cache to a file system location that didn't exist or was not writable by the PHP process would fail silently. This behavior has been changed to throw a `CacheFile_Exception`.
-
-----
-
-# Changelog: 1.5.1 "Blue"
-Code name for Macintosh System 7. <http://en.wikipedia.org/wiki/System_7>
-
-Launched Wednesday, January 18, 2012.
-
-## Bug fixes and enhancements
-* [Documentation patch](https://github.com/amazonwebservices/aws-sdk-for-php/pull/13)
-* [Removed duplicate comment line.](https://github.com/amazonwebservices/aws-sdk-for-php/pull/17)
-* [CFRuntime credentials handling issue](https://forums.aws.amazon.com/thread.jspa?messageID=310388)
-* [PHP 5.2 bug in AWS SDK for PHP 1.5.x](https://forums.aws.amazon.com/thread.jspa?messageID=311543)
-* [[Bug] Custom Curl Opts Lost During Retry](https://forums.aws.amazon.com/thread.jspa?threadID=84835)
-* [json_last_error doesn't exist before php v 5.3.0](https://github.com/amazonwebservices/aws-sdk-for-php/pull/12)
-* [XML still being parsed when use_cache_flow is false](https://github.com/amazonwebservices/aws-sdk-for-php/pull/15)
-* [Bug ssl_verification option not respected for AmazonS3 ](https://forums.aws.amazon.com/thread.jspa?threadID=83710)
-* [[Bug] Compatibility test for Garbage Collector enabled should use ini_get](https://forums.aws.amazon.com/thread.jspa?threadID=84156)
-
-## Runtime
-* **Fixed:** Corrected an issue where calling `AmazonS3->get_object()` would continue to parse the content if caching was being leveraged. (Thanks [Eric Caron](http://www.ericcaron.com)!)
-* **Fixed:** The autoloader now returns `false` for any class it doesn't match, allowing subsequent autoloaders to catch the class name. (Thanks [Eric Caron](http://www.ericcaron.com)!)
-* **Fixed:** An issue that caused CloudWatch to fail to decompress gzipped data correctly has been resolved.
-* **Fixed:** Resolved an issue with passing explicit credentials without requiring a config file or a `CFCredentials` declaration.
-* **Fixed:** Resolved an issue which causes custom cURL options to be unset from the payload when retrying.
-
-## Services
-### AmazonAS
-* **New:** Support for Amazon SNS notifications and Tagging have been added to the SDK.
-
-### AmazonCloudFront
-* **Fixed:** Resolved an issue with disabling SSL verification.
-* **Fixed:** Resolved an issue where `AmazonCloudFront` were throwing warnings in `E_STRICT` mode.
-
-### AmazonCloudWatch
-* **Fixed:** Resolved an issue with decompressing gzipped data.
-
-### AmazonDynamoDB
-* **New:** Support for Amazon DynamoDB has been added to the SDK.
-* **New:** Amazon DynamoDB requires a default cache configuration to be set in the credential set, otherwise it will not function properly.
-
-### AmazonS3
-* **Fixed:** Resolved an issue with disabling SSL verification.
-* **Fixed:** Resolved multiple documentation issues. (Thanks [Aizat Faiz](http://aizatto.com) and [Jason Ardell](http://ardell.posterous.com/)!)
-* **Fixed:** Resolved an issue where `AmazonS3` were throwing warnings in `E_STRICT` mode.
-
-### AmazonSNS
-* **New:** Support for Short Messaging Service (SMS) endpoints has been added to the SDK.
-* **New:** Support for Subscription Attributes has been added to the SDK.
-
-## Utilities
-### CFJSON
-* **Fixed:** Support for the handling of JSON nulls in PHP 5.2 has been improved. (Thanks [David Chan](http://www.chandeeland.org)!)
-
-## Compatibility Test
-* **Fixed:** The SDK compatibility test now uses `ini_get()` instead of `get_cfg_var()` and `get_cfg_ini()` for more accurate test results.
-
-
-----
-
-# Changelog: 1.5 "Allegro"
-Code name for Mac OS 8.5. <http://en.wikipedia.org/wiki/Mac_OS_8#Mac_OS_8.5>
-
-Launched Wednesday, December 14, 2011
-
-## Credentials
-* !! BACKWARDS-INCOMPATIBLE CHANGE !! - The function signature of all service constructors has changed. Instead of passing a key and secret as the first and second parameters, the constructor now accepts a hash (associative array) containing `key` and `secret` keys. Please see the API reference documentation
-
-## Runtime
-* !! BACKWARDS-INCOMPATIBLE CHANGE !! - The function signature of all service constructors has changed. Instead of passing a key and secret as the first and second parameters, the constructor now accepts a hash (associative array) containing `key` and `secret` keys. If you are explicitly passing a key and secret to the constructor, you will need to change your code. If you are simply inheriting your default credentials from a config file, you don't need to make any changes beyond upgrading your config file to the new 1.5 format. Please see the API reference documentation for more information.
-* !! BACKWARDS-INCOMPATIBLE CHANGE !! - The method by which the `config.inc.php` file maintains its list of credentials has been re-factored and updated to support managing multiple sets of credentials in a single location (e.g., development, staging, production).
-* !! BACKWARDS-INCOMPATIBLE CHANGE !! - The `init()` method has been renamed to `factory()` to better reflect what it actually does.
-* !! BACKWARDS-INCOMPATIBLE CHANGE !! - The `adjust_offset()` method has been removed. Instead, please ensure that the machine's time is set correctly using an [NTP server](https://secure.wikimedia.org/wikipedia/en/wiki/Network_Time_Protocol).
-* !! BACKWARDS-INCOMPATIBLE CHANGE !! - In version 1.4 we enabled a mode where -- for services that supported it -- a set of temporary credentials were fetched and cached before the first request. This functionality has been reverted. The use of short-term credentials must be explicitly enabled by instantiating the `AmazonSTS` class and passing those credentials into the service constructor.
-* **New:** Improved the user directory lookup for the config file.
-* **Changed:** Made `set_region()` an alias of `set_hostname()`.
-
-## Services
-### AmazonAS
-* **New:** Support for the South American (São Paulo) region has been added to the SDK.
-* **New:** Plain english aliases have been added to the SDK: `REGION_VIRGINA`, `REGION_CALIFORNIA`, `REGION_OREGON`, `REGION_IRELAND`, `REGION_SINGAPORE`, `REGION_TOKYO`, `REGION_SAO_PAULO`
-
-### AmazonCloudFormation
-* **New:** Support for the South American (São Paulo) region has been added to the SDK.
-* **New:** Plain english aliases have been added to the SDK: `REGION_VIRGINA`, `REGION_CALIFORNIA`, `REGION_OREGON`, `REGION_IRELAND`, `REGION_SINGAPORE`, `REGION_TOKYO`, `REGION_SAO_PAULO`
-* **New:** Support for cost estimation of CloudFormation templates has been added to the SDK.
-
-### AmazonCloudWatch
-* **New:** Support for the South American (São Paulo) region has been added to the SDK.
-* **New:** Plain english aliases have been added to the SDK: `REGION_VIRGINA`, `REGION_CALIFORNIA`, `REGION_OREGON`, `REGION_IRELAND`, `REGION_SINGAPORE`, `REGION_TOKYO`, `REGION_SAO_PAULO`
-
-### AmazonEC2
-* **New:** Support for the South American (São Paulo) region has been added to the SDK.
-* **New:** Plain english aliases have been added to the SDK: `REGION_VIRGINA`, `REGION_CALIFORNIA`, `REGION_OREGON`, `REGION_IRELAND`, `REGION_SINGAPORE`, `REGION_TOKYO`, `REGION_SAO_PAULO`
-* **New:** Support for 24x7 Reserved Instances has been added to the SDK. For more information, please see [New Amazon EC2 Reserved Instance Options Now Available](https://aws.amazon.com/about-aws/whats-new/2011/12/01/New-Amazon-EC2-Reserved-Instances-Options-Now-Available/).
-* **New:** Support for VPC Spot Instances has been added to the SDK. For more information, please see [Announcing Amazon EC2 Spot Integration with Amazon VPC](https://aws.amazon.com/about-aws/whats-new/2011/10/11/announcing-amazon-ec2-spot-integration-with-amazon-vpc/).
-* **New:** Support for VPC Everywhere has been added to the SDK. For more information, please see [Amazon VPC Generally Available in Multiple AZs in All Regions](https://aws.amazon.com/about-aws/whats-new/2011/08/03/Announcing-VPC-GA/).
-* **New:** Instance Type-related constants have been added to the SDK: `INSTANCE_MICRO`, `INSTANCE_SMALL`, `INSTANCE_LARGE`, `INSTANCE_XLARGE`, `INSTANCE_HIGH_MEM_XLARGE`, `INSTANCE_HIGH_MEM_2XLARGE`, `INSTANCE_HIGH_MEM_4XLARGE`, `INSTANCE_HIGH_CPU_MEDIUM`, `INSTANCE_HIGH_CPU_XLARGE`, `INSTANCE_CLUSTER_4XLARGE`, `INSTANCE_CLUSTER_8XLARGE`, `INSTANCE_CLUSTER_GPU_XLARGE`.
-
-### AmazonElastiCache
-* **New:** Support for US-West 1 (California), EU-West (Ireland), Asia Pacific Southeast (Singapore), and Asia Pacific Northeast (Tokyo) regions has been added to the SDK. For more information, please see [Amazon ElastiCache is now available in four additional AWS Regions and as a CloudFormation template](https://aws.amazon.com/about-aws/whats-new/2011/12/05/amazon-elasticache-new-regions/).
-* **New:** Plain english aliases have been added to the SDK: `REGION_VIRGINA`, `REGION_CALIFORNIA`, `REGION_IRELAND`, `REGION_SINGAPORE`, `REGION_TOKYO`
-
-### AmazonElasticBeanstalk
-* **New:** Plain english aliases have been added to the SDK: `REGION_VIRGINA`
-
-### AmazonELB
-* **New:** Support for the South American (São Paulo) region has been added to the SDK.
-* **New:** Plain english aliases have been added to the SDK: `REGION_VIRGINA`, `REGION_CALIFORNIA`, `REGION_OREGON`, `REGION_IRELAND`, `REGION_SINGAPORE`, `REGION_TOKYO`, `REGION_SAO_PAULO`
-* **New:** Support for ELBs running in VPC has been added to the SDK. For more information, please see [Announcing Elastic Load Balancing in Amazon VPC](https://aws.amazon.com/about-aws/whats-new/2011/11/21/announcing-elastic-load-balancing-in-amazon-vpc/).
-
-### AmazonEMR
-* **New:** Support for the South American (São Paulo) region has been added to the SDK.
-* **New:** Plain english aliases have been added to the SDK: `REGION_VIRGINA`, `REGION_CALIFORNIA`, `REGION_OREGON`, `REGION_IRELAND`, `REGION_SINGAPORE`, `REGION_TOKYO`, `REGION_SAO_PAULO`
-* **New:** Support for EMR AMI Versioning, new Hadoop and Pig versions, and EMR running in VPC has been added to the SDK. For more information, please see [Amazon Elastic MapReduce Announces Support for New Hadoop and Pig Versions, AMI Versioning, and Amazon VPC](https://aws.amazon.com/about-aws/whats-new/2011/12/11/amazon-elastic-mapreduce-ami-versioning-vpc/).
-
-### AmazonIAM
-* **New:** Plain english aliases have been added to the SDK: `REGION_VIRGINA`
-
-### AmazonImportExport
-* **New:** Plain english aliases have been added to the SDK: `REGION_VIRGINA`
-
-### AmazonRDS
-* **New:** Support for the South American (São Paulo) region has been added to the SDK.
-* **New:** Plain english aliases have been added to the SDK: `REGION_VIRGINA`, `REGION_CALIFORNIA`, `REGION_OREGON`, `REGION_IRELAND`, `REGION_SINGAPORE`, `REGION_TOKYO`, `REGION_SAO_PAULO`
-
-### AmazonS3
-* **New:** Support for the South American (São Paulo) region has been added to the SDK.
-* **New:** Plain english aliases have been added to the SDK: `REGION_VIRGINA`, `REGION_CALIFORNIA`, `REGION_OREGON`, `REGION_IRELAND`, `REGION_SINGAPORE`, `REGION_TOKYO`, `REGION_SAO_PAULO`
-* **New:** Support for an S3 Stream Wrapper has been added to the SDK. This enables users to read/write to Amazon S3 as though it were the local file system.
-**Fixed:** The `get_object()` method no longer attempts to parse XML/JSON content.
-**Fixed:** Simplified S3 region logic. Now uses fully-qualified domain names across the board.
-
-### AmazonSES
-* **New:** Plain english aliases have been added to the SDK: `REGION_VIRGINA`
-
-### AmazonSDB
-* **New:** Support for the South American (São Paulo) region has been added to the SDK.
-* **New:** Plain english aliases have been added to the SDK: `REGION_VIRGINA`, `REGION_CALIFORNIA`, `REGION_OREGON`, `REGION_IRELAND`, `REGION_SINGAPORE`, `REGION_TOKYO`, `REGION_SAO_PAULO`
-
-### AmazonSNS
-* **New:** Support for the South American (São Paulo) region has been added to the SDK.
-* **New:** Plain english aliases have been added to the SDK: `REGION_VIRGINA`, `REGION_CALIFORNIA`, `REGION_OREGON`, `REGION_IRELAND`, `REGION_SINGAPORE`, `REGION_TOKYO`, `REGION_SAO_PAULO`
-
-### AmazonSQS
-* **New:** Support for the South American (São Paulo) region has been added to the SDK.
-* **New:** Plain english aliases have been added to the SDK: `REGION_VIRGINA`, `REGION_CALIFORNIA`, `REGION_OREGON`, `REGION_IRELAND`, `REGION_SINGAPORE`, `REGION_TOKYO`, `REGION_SAO_PAULO`
-
-### AmazonSTS
-* **New:** Plain english aliases have been added to the SDK: `REGION_VIRGINA`
-
-
-----
-
-# Changelog: 1.4.8 "Zanarkand"
-<http://finalfantasy.wikia.com/wiki/Zanarkand>
-
-Launched Wednesday, December 7, 2011
-
-## Services
-### AmazonCloudFront
-* **Fixed:** Merged in a pull request contributed by Ben Lumley: <https://github.com/amazonwebservices/aws-sdk-for-php/pull/11>
-
-### AmazonEC2
-* **Fixed:** Resolved an issue where `set_region()` was not setting the correct endpoint for the region.
-
-### AmazonS3
-* **New:** Support for S3-side multi-object delete has been added to the SDK as the `delete_objects()` method. The implementations of `delete_all_objects()` and `delete_all_object_versions()` have been updated to use this new functionality.
-* **Changed:** XML and JSON responses from `get_object()` are no longer parsed. The raw XML and JSON string content is now returned.
-
-
-----
-
-# Changelog: 1.4.7 "Yuna"
-<http://finalfantasy.wikia.com/wiki/Yuna>
-
-Launched Wednesday, November 9, 2011
-
-## Service Classes
-### AmazonAS
-* **New:** Support for the US-West 2 (Oregon) region has been added to the SDK.
-
-### AmazonCloudFormation
-* **New:** Support for the US-West 2 (Oregon) region has been added to the SDK.
-
-### AmazonCloudWatch
-* **New:** Support for the US-West 2 (Oregon) region has been added to the SDK.
-* **New:** Support for the US GovCloud region has been added to the SDK.
-
-### AmazonEC2
-* **New:** Support for the US-West 2 (Oregon) region has been added to the SDK.
-* **New:** Support for the US GovCloud region has been added to the SDK.
-
-### AmazonELB
-* **New:** Support for the US-West 2 (Oregon) region has been added to the SDK.
-
-### AmazonEMR
-* **New:** Support for the US-West 2 (Oregon) region has been added to the SDK.
-
-### AmazonIAM
-* **New:** Support for the US GovCloud region has been added to the SDK.
-
-### AmazonRDS
-* **New:** Support for the US-West 2 (Oregon) region has been added to the SDK.
-
-### AmazonS3
-* **New:** Support for the US-West 2 (Oregon) region has been added to the SDK.
-* **Fixed:** Resolved an issue where certain bits of metadata were not maintained during a copy operation. <https://forums.aws.amazon.com/thread.jspa?threadID=77630>
-* **Fixed:** Resolved an issue where an unsuccessful lookup of an existing content-type would throw a warning. <https://forums.aws.amazon.com/thread.jspa?threadID=78121>
-* **Fixed:** Resolved an issue where an exception would be thrown when a filesize lookup was attempted on an object that didn't exist. <https://forums.aws.amazon.com/thread.jspa?threadID=78197>
-
-### AmazonSDB
-* **New:** Support for the US-West 2 (Oregon) region has been added to the SDK.
-
-### AmazonSNS
-* **New:** Support for the US-West 2 (Oregon) region has been added to the SDK.
-
-### AmazonSQS
-* **New:** Support for the US-West 2 (Oregon) region has been added to the SDK.
-
-
-----
-
-# Changelog: 1.4.6 "Xezat"
-<http://finalfantasy.wikia.com/wiki/Xezat>
-
-Launched Thursday, November 3, 2011
-
-## Service Classes
-### AmazonIAM
-* **New:** Support for a virtual MFA device. A virtual MFA device uses a software application that can generate six-digit authentication codes that are Open AuTHentication Time-based One-Time Password (OATHTOTP)-compatible. The software application can run on any mobile hardware device, including a smartphone.
-
-
-----
-
-# Changelog: 1.4.5 "Weiss"
-<http://finalfantasy.wikia.com/wiki/Weiss>
-
-Launched Friday, October 21, 2011
-
-## Service Classes
-### AmazonSQS
-* **New:** Support for delayed queues and batch operations has been added to the SDK.
-
-
-----
-
-# Changelog: 1.4.4 "Vaan"
-<http://finalfantasy.wikia.com/wiki/Vaan>
-
-Launched Tuesday, October 12, 2011
-
-## Runtime
-* **Fixed:** Resolved an issue where a segmentation fault is triggererd when there are multiple autoloaders in the stack and one of them doesn't return a value.
-
-## Service Classes
-### AmazonS3
-* **New:** Support for server-side encryption has been added to the SDK.
-
-
-----
-
-# Changelog: 1.4.3 "Ultros"
-<http://finalfantasy.wikia.com/wiki/Ultros>
-
-Launched Friday, September 30, 2011
-
-## Service Classes
-### AmazonCloudFormation
-* **New:** Support for new features in CloudFormation have been added to the SDK.
-
-### AmazonS3
-* **Fixed:** Setting the default cache configuration no longer causes authentication errors in `AmazonS3`.
-
-
-----
-
-# Changelog: 1.4.2.1 "Tiamat, Part II"
-<http://finalfantasy.wikia.com/wiki/Tiamat>
-
-Launched Wednesday, September 7, 2011
-
-## Utility Classes
-### RequestCore
-* **Fixed:** RequestCore has updated the `cacert.pem` file from Mozilla. This update revokes trust from the DigiNotar and Staat der Nederlanden root certificates.
-
-
-----
-
-# Changelog: 1.4.2 "Tiamat"
-<http://finalfantasy.wikia.com/wiki/Tiamat>
-
-Launched Thursday, September 1, 2011
-
-## Service Classes
-### AmazonEC2
-* **Fixed:** Requests made to Amazon EC2 now use the correct API version (2011-07-15).
-
-### AmazonELB
-* **New:** A pre-defined set of ciphers may now be used for SSL termination at the Elastic Load Balancer.
-* **New:** Application servers can now accept secure communication from the corresponding Elastic Load Balancer.
-* **New:** In cases where HTTPS is required for all traffic entering the back-end server, Elastic Load Balancing can now perform health checks using HTTPS.
-* **New:** White list of public keys can now be associated with back-end servers. Elastic Load Balancing authenticates back-end servers with the public keys in the white list and communicates only with back-end servers that pass this authentication check.
-
-## Utility Classes
-### RequestCore
-* **Fixed:** RequestCore has updated the `cacert.pem` file from Mozilla. This update revokes trust from the DigiNotar root certificate.
-
-
-----
-
-# Changelog: 1.4.1 "Sephiroth"
-<http://finalfantasy.wikia.com/wiki/Sephiroth>
-
-Launched Tuesday, August 23, 2011
-
-## Service Classes
-### AmazonElastiCache
-* **New:** Support for Amazon ElastiCache has been added to the SDK.
-
-### AmazonEMR
-* **New:** Support for Hadoop Bootstrap Actions has been added to the SDK.
-* **New:** Support for Amazon Elastic MapReduce on Spot Instances has been added to the SDK.
-* **New:** Support for Termination Protection has been added to the SDK.
-* **Changed:** For the <code>add_instance_groups()</code> method, the <code>$instance_groups</code> and <code>$job_flow_id</code> parameters have been reversed.
-
-## Utility Classes
-### CFHadoopBootstrap
-* **New:** The `CFHadoopBootstrap` class has been added to the SDK. Simplifies the process of working with Hadoop system and daemon configurations in Amazon EMR.
-* **New:** This class extends from the `CFHadoopBase` class.
-
-
-----
-
-# Changelog: 1.4 "Rikku"
-<http://finalfantasy.wikia.com/wiki/Rikku>
-
-Launched Wednesday, August 3, 2011
-
-## Bug fixes and enhancements
-
-## Service Classes
-### AmazonEC2
-* **New:** Support for Session-Based Authentication (SBA) leveraging Amazon Secure Token Service (STS) has been added to the SDK.
-
-### AmazonS3
-* **New:** Support for Session-Based Authentication (SBA) leveraging Amazon Secure Token Service (STS) has been added to the SDK.
-
-### AmazonSNS
-* **New:** Support for Session-Based Authentication (SBA) leveraging Amazon Secure Token Service (STS) has been added to the SDK.
-
-### AmazonSQS
-* **New:** Support for Session-Based Authentication (SBA) leveraging Amazon Secure Token Service (STS) has been added to the SDK.
-
-### AmazonSTS
-* **New:** Support for the Amazon Secure Token Service (STS) has been added to the SDK.
-
-## Utility Classes
-### CFRuntime
-* **New:** The following anonymous datapoints are now collected in aggregate so that we can make more informed decisions about future SDK features: `memory_limit`, `date.timezone`, `open_basedir`, `safe_mode`, `zend.enable_gc`.
-
-## Compatibility Test
-* **New:** Support for verifying the installed SSL certificate has been added to the compatibility test.
-* **New:** Support for verifying the status of `open_basedir` and `safe_mode` has been added to the compatibility test.
-* **New:** Support for verifying the status of the PHP 5.3 garbage collector has been added to the compatibility test.
-* **New:** The compatibility test now recommends optimal values for the `AWS_CERTIFICATE_AUTHORITY` and `AWS_DEFAULT_CACHE_CONFIG` configuration options based on the system's configuration.
-
-
-----
-
-# Changelog: 1.3.7 "Quistis"
-<http://finalfantasy.wikia.com/wiki/Quistis_Trepe>
-
-Launched Monday, July 25, 2011
-
-## Bug fixes and enhancements
-* Addressed minor bug fixes reported via the feedback form in the API Reference.
-
-## Service Classes
-### AmazonAS
-* **Changed:** Introduced backwards-incompatible changes to the <code>put_scheduled_update_group_action()</code> method.
-
-
-----
-
-# Changelog: 1.3.6 "Penelo"
-<http://finalfantasy.wikia.com/wiki/Penelo>
-
-Launched Tuesday, July 12, 2011
-
-## Bug fixes and enhancements
-* [[Bug Report] rawurlencode error when using SES and curlopts](https://forums.aws.amazon.com/thread.jspa?threadID=68484)
-
-## Service Classes
-### AmazonCloudFormation
-* **New:** Support for the `list_stacks()` method has been added to the SDK.
-
-### AmazonElasticBeanstalk
-* **New:** Support for the `swap_environment_cnames()` method has been added to the SDK.
-
-### AmazonS3
-* **Fixed:** Additional information about maximum open connections has been added to the `create_mpu_object()` method.
-
-## Compatibility Test
-* **New:** Now tests whether the system is 64- or 32-bit.
-
-
-----
-
-# Changelog: 1.3.5 "Occuria"
-<http://finalfantasy.wikia.com/wiki/Occuria>
-
-Launched Tuesday, June 21, 2011
-
-## Service Classes
-### AmazonS3
-* **New:** Support for S3 copy part has been added to the SDK.
-
-
-----
-
-# Changelog: 1.3.4 "Nero"
-<http://finalfantasy.wikia.com/wiki/Nero>
-
-Launched Tuesday, June 7, 2011
-
-## Bug fixes and enhancements
-* [Bug in PHP SDK](https://forums.aws.amazon.com/thread.jspa?threadID=67502)
-* [cURL error: SSL certificate problem (60) with aws-sdk-for-php 1.3.3](https://forums.aws.amazon.com/thread.jspa?threadID=68349)
-
-
-## Service Classes
-### AmazonEC2
-* **New:** Support for Local Availability Zone Pricing has been added to the SDK.
-
-### AmazonELB
-* **New:** Elastic Load Balancing provides a special Amazon EC2 security group that you can use to ensure that a back-end Amazon EC2 instance receives traffic only from its load balancer.
-
-### AmazonRDS
-* **New:** Support for Oracle databases has been added to the SDK.
-
-
-## Utility Classes
-### CFArray
-* **New:** Added the init() method which simplifies the process of instantiating and chaining a class.
-* **New:** Added support for associative arrays to `each()`, `map()` and `filter()`.
-
-### CFRequest
-* **New:** Now supports the `AWS_CERTIFICATE_AUTHORITY` configuration option.
-
-
-----
-
-# Changelog: 1.3.3 "Moogle"
-<http://finalfantasy.wikia.com/wiki/Moogle>
-
-Launched Tuesday, May 10, 2011
-
-## Bug fixes and enhancements
-* [Bug in AmazonCloudFront::get_private_object_url](https://forums.aws.amazon.com/thread.jspa?threadID=64004)
-* [SDK 1.3.2 - Call to undefined function json_last_error()](https://forums.aws.amazon.com/thread.jspa?threadID=64767)
-* [CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir](https://forums.aws.amazon.com/thread.jspa?threadID=61333)
-
-
-## Service Classes
-### AmazonCloudFront
-* **Fixed:** Resolved an issue where the expires value for `get_private_object_url()` only accepted a string instead of a string or integer.
-
-### AmazonCloudWatch
-* **New:** Support for CloudWatch custom user metrics has been added to the SDK.
-
-
-## Extensions
-### S3BrowserUpload
-* **New:** Added the `S3BrowserUpload` class to the SDK. This class assists in generating the correct HTML/XHTML markup for uploading files to S3 via an HTML <form> element.
-
-
-## Utility Classes
-### CFArray
-* **New:** Added the `init()` method which simplifies the process of instantiating and chaining a class.
-
-### CFHadoopBase
-* **New:** The `CFHadoopBase` class has been extracted out of `CFHadoopStep` as a shared library.
-
-### CFHadoopStep
-* **New:** The `CFHadoopBase` class has been extracted out of `CFHadoopStep` as a shared library.
-* **New:** This class now extends from the `CFHadoopBase` class.
-
-### CFJSON
-* **Fixed:** Resolved an issue where a PHP 5.3-specific function was being used.
-
-### CFPolicy
-* **New:** Added the init() method which simplifies the process of instantiating and chaining a class.
-
-### CFSimpleXML
-* **New:** Added the init() method which simplifies the process of instantiating and chaining a class.
-
-### RequestCore
-* **Fixed:** Improvements to running in PHP environments with open_basedir enabled.
-* **Fixed:** RequestCore now uses an up-to-date `cacert.pem` file from Mozilla instead of the Certificate Authority that libcurl or libopenssl was compiled with, which should resolve certain issues with making SSL connections to AWS services.
-
-
-----
-
-# Changelog: 1.3.2 "Luna"
-<http://finalfantasy.wikia.com/wiki/Luna_Wolf>
-
-Launched Tuesday, April 5, 2011
-
-## New Features & Highlights (Summary)
-* Support for Dedicated Instances within a Virtual Private Cloud on single-tenant hardware has been added to the SDK.
-* Bug fixes and enhancements:
- * [AmazonCloudWatch get_metric_statistics returns gzipped body](https://forums.aws.amazon.com/thread.jspa?threadID=62625)
-
-
-## Service Classes
-### AmazonCloudWatch
-* **Fixed:** Worked around an issue where when CloudWatch sends back `Content-Encoding: gzip`, it really means `deflate`. When CloudWatch sends back `Content-Encoding: deflate`, it really means the data isn't encoded at all.
-
-### AmazonEC2
-* **New:** Support for Dedicated Instances within a Virtual Private Cloud on single-tenant hardware has been added to the SDK.
-
-
-----
-
-# Changelog: 1.3.1 "Kraken"
-<http://finalfantasy.wikia.com/wiki/Kraken>
-
-Launched Friday, March 25, 2011
-
-## New Features & Highlights (Summary)
-* Fixed issues with Signature v3 authentication (SES).
-* Added gzip decoding.
-* Added support for converting data to more alternate formats.
-* Bug fixes and enhancements:
- * [Cannot send email](https://forums.aws.amazon.com/thread.jspa?threadID=62833)
- * [AmazonCloudWatch get_metric_statistics returns gzipped body](https://forums.aws.amazon.com/thread.jspa?threadID=62625)
-
-
-## Utility Classes
-### CFArray
-* **New:** The `to_json()` and `to_yaml()` methoda have been added to the class.
-
-### CFGzipDecode
-* **New:** Handles a variety of primary and edge cases around gzip/deflate decoding in PHP.
-
-### CFRuntime
-* **New:** Gzip decoding has been added to the SDK.
-* **Fixed:** The previous release contained a regression in the Signature v3 support that affected AmazonSES. This has been resolved.
-* **Fixed:** Completed support for Signature v3 over HTTP connections.
-
-### CFSimpleXML
-* **New:** The `to_stdClass()` and `to_yaml()` methoda have been added to the class.
-
-
-----
-
-# Changelog: 1.3 "Jecht"
-<http://finalfantasy.wikia.com/wiki/Jecht>
-
-Launched Tuesday, March 15, 2011
-
-## New Features & Highlights (Summary)
-* Support for VPC Internet Access has been added to the SDK.
-* Bug fixes and enhancements:
- * [AmazonEC2::register_image issue](https://forums.aws.amazon.com/thread.jspa?threadID=52499)
- * [Automatic Parseing of XML objects](https://forums.aws.amazon.com/thread.jspa?threadID=61882)
-
-## Service Classes
-### AmazonEC2
-* **New:** Support for VPC Internet Access has been added to the SDK.
-* **Fixed:** The `$image_location` parameter in the `register_image()` method is no longer required. This is a backwards-incompatible change.
-
-### AmazonS3
-* **Fixed:** Resolved an issue in `get_object()` where using the `lastmodified` and `etag` parameters required both to be set before taking effect. They can now be set independently from each other.
-
-
-## Utility classes
-### CFArray
-* **Changed:** The `reduce()` method has been renamed to `filter()`. `reduce()` is now simply an alias for `filter()`.
-
-### CFJSON
-* **New:** Simplifies the task of normalizing XML and JSON responses as `CFSimpleXML` objects.
-
-### CFRuntime
-* **New:** Preliminary support for Signature v3 over HTTP has been added to the SDK. This is useful for debugging Signature v3 issues over non-HTTPS connections.
-* **Changed:** Classes that use the shared authentication method (i.e., NOT `AmazonS3` or `AmazonCloudFront`) will automatically convert JSON service responses into a `CFSimpleXML` object.
-* **Changed:** Formerly, the SDK would attempt to sniff the content to determine the type. Now, the SDK will check the HTTP response headers for `text/xml`, `application/xml` or `application/json` to determine whether or not to parse the content. If the HTTP response headers are not available, the SDK will still attempt content sniffing.
-
-### CFSimpleXML
-* **New:** The `to_json()` method has been added to the class.
-
-### CFUtilities
-* **New:** The `is_json()` method has been added to the class.
-
-
-----
-
-# Changelog: 1.2.6 "Ifrit"
-<http://finalfantasy.wikia.com/wiki/Ifrit>
-
-Launched Wednesday, March 2, 2011
-
-## New Features & Highlights (Summary)
-* **New:** Support for the new Asia Pacific "Northeast" (Japan) endpoint has been added for all relevant services.
-* **New:** Support for registering callback functions for read/write streams has been added to the SDK. Includes a runnable sample.
-* **Fixed:** Improvements to avoid triggering warnings when PHP is in Safe Mode.
-
-
-## Service Classes
-### AmazonAS
-* **New:** Added a new _class_ constant: `REGION_APAC_NE1`.
-
-### AmazonCloudFormation
-* **New:** Added a new _class_ constant: `REGION_APAC_NE1`.
-
-### AmazonCloudWatch
-* **New:** Added a new _class_ constant: `REGION_APAC_NE1`.
-
-### AmazonEC2
-* **New:** Added a new _class_ constant: `REGION_APAC_NE1`.
-
-### AmazonELB
-* **New:** Added a new _class_ constant: `REGION_APAC_NE1`.
-
-### AmazonRDS
-* **New:** Added a new _class_ constant: `REGION_APAC_NE1`.
-
-### AmazonS3
-* **New:** Added a new _class_ constant: `REGION_APAC_NE1`.
-* **New:** Added support for `ap-northeast-1` as a location constraint when creating a new bucket.
-
-### AmazonSDB
-* **New:** Added a new _class_ constant: `REGION_APAC_NE1`.
-
-### AmazonSNS
-* **New:** Added a new _class_ constant: `REGION_APAC_NE1`.
-
-### AmazonSQS
-* **New:** Added a new _class_ constant: `REGION_APAC_NE1`.
-
-## Utility classes
-### CFRuntime
-* **New:** Support for registering callback functions for read/write streams has been added to the SDK.
-* **New:** Future-proofed for future regional endpoints.
-
-### RequestCore
-* **New:** Support for registering callback functions for read/write streams has been added to the SDK.
-* **Fixed:** Improvements to avoid triggering warnings when PHP is in Safe Mode.
-
-## Samples
-* **New:** A sample demonstrating how to add a command-line progress bar for S3 transfers has been added to the SDK.
-
-
-----
-
-# Changelog: 1.2.5 "Heidegger"
-<http://finalfantasy.wikia.com/wiki/Heidegger>
-
-Launched Thursday, February 24, 2011
-
-## New Features & Highlights (Summary)
-* Support for AWS CloudFormation has been added to the SDK.
-* Bug fixes and enhancements:
- * [PHP API change_content_type() broken](https://forums.aws.amazon.com/thread.jspa?threadID=59532)
- * [Bug setting OriginAccessIdentity for a Cloudfront distribution config](https://forums.aws.amazon.com/thread.jspa?threadID=60989)
-
-## Service Classes
-### AmazonCloudFormation
-* **New:** Support for AWS CloudFormation has been added to the SDK.
-
-### AmazonCloudFront
-* **Fixed:** Issues around `update_xml_config()` have been resolved.
-
-### AmazonS3
-* **Fixed:** Issues around `change_content_type()` have been resolved.
-
-
-----
-
-# Changelog: 1.2.4 "Goltanna"
-<http://finalfantasy.wikia.com/wiki/Druksmald_Goltanna>
-
-Launched Wednesday, February 16, 2011
-
-## New Features & Highlights (Summary)
-* Support for IAM account aliases and server certificates has been added to the SDK.
-* Support for Amazon S3 Website Configuration has been added to the SDK.
-* Documentation updates for Amazon RDS and AWS Import/Export.
-* Updated all documentation blocks to adhere to the PHPDoc format. This enables a greater number of tools to take advantage of the SDK documentation.
-* Rolled out a major update to the SDK API Reference.
-
-## Service Classes
-### AmazonIAM
-* **New:** Support for IAM account aliases and server certificates has been added to the SDK.
-
-### AmazonImportExport
-* **New:** Documentation has been updated to note the new US West region support.
-
-### AmazonRDS
-* **New:** Documentation has been updated to note the new support for MySQL 5.5.
-
-### AmazonS3
-* **New:** Support for Amazon S3 Website Configuration has been added to the SDK.
-
-
-----
-
-# Changelog: 1.2.3 "Fayth"
-<http://finalfantasy.wikia.com/wiki/Fayth>
-
-Launched Tuesday, January 25, 2010
-
-## New Features & Highlights (Summary)
-* Support for Amazon Simple Email Service has been added to the SDK.
-
-## Service Classes
-### AmazonSES
-* **New:** Support for Amazon Simple Email Service has been added to the SDK.
-
-
-----
-
-# Changelog: 1.2.2 "Esper"
-<http://finalfantasy.wikia.com/wiki/Esper>
-
-Launched Tuesday, January 18, 2011
-
-## New Features & Highlights (Summary)
-* Support for Amazon Elastic Beanstalk has been added to the SDK.
-* Bug fixes and enhancements:
- * [AWS PHP S3 Library is not working out of the box](https://forums.aws.amazon.com/thread.jspa?threadID=55174)
- * [Problem with create_mpu_object() and streaming_read_callback() in S3](https://forums.aws.amazon.com/thread.jspa?threadID=54541)
- * [Integrated Uranium235's GitHub contributions](https://github.com/Uranium235/aws-sdk-for-php/compare/Streaming)
-
-## Service Classes
-### AmazonElasticBeanstalk
-* **New:** Support for AWS Elastic Beanstalk has been added to the SDK.
-
-### AmazonS3
-* **Fixed:** Major improvements to transferring data over streams.
-
-## Utility classes
-###RequestCore
-* **New:** Upgraded to version 1.4.
-* **Fixed:** Major improvements to transferring data over streams.
-
-
-----
-
-# Changelog: 1.2.1 "Dio"
-<http://finalfantasy.wikia.com/wiki/Dio>
-
-Launched Friday, January 14, 2011
-
-
-## New Features & Highlights (Summary)
-* Support for S3 Response Headers has been added to the SDK.
-* Bug fixes and enhancements:
- * [copy_object failed between regions](https://forums.aws.amazon.com/thread.jspa?threadID=56893)
- * [Possible S3 bug with multiple buckets?](https://forums.aws.amazon.com/thread.jspa?threadID=56561)
-
-## Service Classes
-### AmazonS3
-* **New:** Support for S3 Response Headers has been added to the SDK.
-* **New:** Documentation for Amazon S3 has been updated to include large object support details.
-* **New:** The `abort_multipart_uploads_by_date()` method has been added to the SDK, which aborts multipart uploads that were initiated before a specific date.
-* **Fixed:** Resolved an issue where the resource prefix wasn't being reset correctly.
-
-## Utility classes
-### CFArray
-* **New:** Instantiating the class without passing an array will use an empty array instead.
-* **New:** Added the `compress()` method which removes null values from the array.
-* **New:** Added the `reindex()` method which reindexes all array elements starting at zero.
-
-## Compatibility Test
-* **New:** The command-line compatibility test now color-codes the responses.
-
-
-----
-
-# Changelog: 1.2 "Cloud"
-<http://finalfantasy.wikia.com/wiki/Cloud_Strife>
-
-Launched Friday, December 3, 2010
-
-
-## New Features & Highlights (Summary)
-* Support for Amazon AutoScaling, Amazon Elastic MapReduce, and Amazon Import/Export Service has been added to the SDK.
-* Support for metric alarms has been added to Amazon CloudWatch.
-* Support for batch deletion has been added to Amazon SimpleDB.
-* Bug fixes and enhancements:
- * [EU Region DNS problem](https://forums.aws.amazon.com/thread.jspa?threadID=53028)
- * [[SimpleDB] Conditional PUT](https://forums.aws.amazon.com/thread.jspa?threadID=55884)
- * [Suggestions for the PHP SDK](https://forums.aws.amazon.com/thread.jspa?threadID=55210)
- * [Updating a distribution config](https://forums.aws.amazon.com/thread.jspa?threadID=54888)
- * [Problem with curlopt parameter in S3](https://forums.aws.amazon.com/thread.jspa?threadID=54532)
- * [AmazonS3::get_object_list() doesn't consider max-keys option](https://forums.aws.amazon.com/thread.jspa?threadID=55169)
-
-## Base/Runtime class
-* **New:** Added support for an alternate approach to instantiating classes which allows for method chaining (PHP 5.3+).
-* **Changed:** Moved `CHANGELOG.md`, `CONTRIBUTORS.md`, `LICENSE.md` and `NOTICE.md` into a new `_docs` folder.
-* **Changed:** Renamed the `samples` directory to `_samples`.
-* **Changed:** Changed the permissions for the SDK files from `0755` to `0644`.
-* **Fixed:** Resolved an issue where attempting to merge cURL options would fail.
-
-## Service Classes
-### AmazonAS
-* **New:** Support for the Amazon AutoScaling Service has been added to the SDK.
-
-### AmazonCloudFront
-* **Fixed:** Resolved an issue where the incorrect formatting of an XML element prevented the ability to update the list of trusted signers.
-
-### AmazonCloudWatch
-* **New:** Support for the Amazon CloudWatch `2010-08-01` service release expands Amazon's cloud monitoring offerings with custom alarms.
-* **Changed:** The changes made to the `get_metric_statistics()` method are backwards-incompatible with the previous release. The `Namespace` and `Period` parameters are now required and the parameter order has changed.
-
-### AmazonEMR
-* **New:** Support for the Amazon Elastic MapReduce Service has been added to the SDK.
-
-### AmazonImportExport
-* **New:** Support for the Amazon Import/Export Service has been added to the SDK.
-
-### AmazonS3
-* **Fixed:** Resolved an issue in the `create_bucket()` method that caused the regional endpoint to be reset to US-Standard.
-* **Fixed:** Resolved an issue in the `get_object_list()` method where the `max-keys` parameter was ignored.
-
-### AmazonSDB
-* **New:** Support for `BatchDeleteAttributes` has been added to the SDK.
-* **Fixed:** Resolved an issue where the `Expected` condition was not respected by `put_attributes()` or `delete_attributes()`.
-
-
-## Utility classes
-### CFComplexType
-* **New:** You can now assign a `member` parameter to prefix all list identifiers.
-* **Changed:** The `option_group()` method is now `public` instead of `private`.
-* **Changed:** Rewrote the `to_query_string()` method to avoid the use of PHP's `http_build_query()` function because it uses `urlencode()` internally instead of `rawurlencode()`.
-
-### CFHadoopStep
-* **New:** Simplifies the process of working with Hadoop steps in Amazon EMR.
-
-### CFManifest
-* **New:** Simplifies the process of constructing YAML manifest documents for Amazon Import/Export Service.
-
-### CFStepConfig
-* **New:** Simplifies the process of working with step configuration in Amazon EMR.
-
-
-## Third-party Libraries
-### CacheCore
-* **Changed:** The `generate_timestamp()` method is now `protected` instead of `private`.
-
-
-----
-
-# Changelog: 1.1 "Barret"
-<http://finalfantasy.wikia.com/wiki/Barret_Wallace>
-
-Launched Wednesday, November 10, 2010
-
-
-## New Features & Highlights (Summary)
-* Support for Amazon ELB, Amazon RDS and Amazon VPC has been added to the SDK.
-* Support for the Amazon S3 multipart upload feature has been added to the SDK. This feature enables developers upload large objects in a series of requests for improved upload reliability.
-* Support for the Amazon CloudFront custom origin (2010-11-01 release) feature has been added to the SDK. This feature enables developers to use custom domains as sources for Amazon CloudFront distributions.
-* The `AmazonS3` class now supports reading from and writing to open file resources in addition to the already-supported file system paths.
-* You can now seek to a specific byte-position within a file or file resource and begin streaming from that point when uploading or downloading objects.
-* The methods `get_bucket_filesize()`, `get_object_list()`, `delete_all_objects()` and `delete_all_object_versions()` are no longer limited to 1000 entries and will work correctly for all entries.
-* Requests that have errors at the cURL level now throw exceptions containing the error message and error code returned by cURL.
-* Bug fixes and enhancements:
- * [Bug in Samples](http://developer.amazonwebservices.com/connect/thread.jspa?threadID=52748)
- * [EU Region DNS problem](http://developer.amazonwebservices.com/connect/thread.jspa?threadID=53028)
- * [AmazonS3 get_bucket_object_count](http://developer.amazonwebservices.com/connect/thread.jspa?threadID=52976)
- * [S3: get_object_list() fatal error](http://developer.amazonwebservices.com/connect/thread.jspa?threadID=53418)
- * [S3 get_object_metadata() problems](http://developer.amazonwebservices.com/connect/thread.jspa?threadID=54244)
- * [Bug in authenticate in sdk.class.php](http://developer.amazonwebservices.com/connect/thread.jspa?threadID=53117)
- * [How to use Prefix with "get_object_list"?](http://developer.amazonwebservices.com/connect/thread.jspa?threadID=52987)
- * [SignatureDoesNotMatch with utf-8 in SimpleDB](http://developer.amazonwebservices.com/connect/thread.jspa?threadID=52798)
- * [Suggestion for the PHP SDK concerning streaming](http://developer.amazonwebservices.com/connect/thread.jspa?threadID=52787)
- * [get_bucket_filesize only returns filesize for first 1000 objects](http://developer.amazonwebservices.com/connect/thread.jspa?threadID=53786)
-
-
-## Base/Runtime class
-* **Changed:** Port numbers other than 80 and 443 are now part of the signature.
-* **Changed:** When putting UTF-8 characters via HTTP `POST`, a `SignatureDoesNotMatch` error would be returned. This was resolved by specifying the character set in the `Content-Type` header.
-
-
-## Service Classes
-### AmazonCloudFront
-* **New:** Support for the Amazon CloudFront non-S3 origin feature (2010-11-01 release) has been added to the SDK. This feature enables developers to use non-S3 domains as sources for Amazon CloudFront distributions.
-
-### AmazonEC2
-* **New:** Support for Amazon Virtual Private Cloud has been added to the SDK.
-
-### AmazonELB
-* **New:** Support for Amazon Elastic Load Balancing Service has been added to the SDK.
-
-### AmazonIAM
-* **Fixed:** Removed `set_region()` as IAM only supports a single endpoint.
-
-### AmazonRDS
-* **New:** Support for Amazon Relational Database Service has been added to the SDK.
-
-### AmazonS3
-* **New:** Support for the Amazon S3 multipart upload feature has been added to the SDK. This feature enables developers upload large objects in a series of requests for improved upload reliability.
-* **New:** The `fileUpload` and `fileDownload` options now support reading from and writing to open file resources in addition to the already-supported file system paths.
-* **Fixed:** In Amazon S3, requests directly to the eu-west endpoint must use the path-style URI. The set_region() method now takes this into account.
-* **Fixed:** As of version 1.0.1, CFSimpleXML extends SimpleXMLIterator instead of SimpleXMLElement. This prevented the `__call()` magic method from firing when `get_object_list()` was used.
-* **Fixed:** The `preauth` option for the `get_object_list()` method has been removed from the documentation as it is not supported.
-* **Fixed:** The methods `get_bucket_filesize()`, `get_object_list()`, `delete_all_objects()` and `delete_all_object_versions()` are no longer limited to 1000 entries and will work correctly for all entries.
-* **Fixed:** Using `delete_bucket()` to force-delete a bucket now works correctly for buckets with more than 1000 versions.
-* **Fixed:** The response from the `get_object_metadata()` method now includes all supported HTTP headers, including metadata stored in `x-amz-meta-` headers.
-* **Fixed:** Previously, if the `get_object_metadata()` method was called on a non-existant object, metadata for the alphabetically-next object would be returned.
-
-### AmazonSQS
-* **New:** The `get_queue_arn()` method has been added to the `AmazonSQS` class, which converts a queue URI to a queue ARN.
-
-
-## Utility classes
-### CFSimpleXML
-* **New:** Added `to_string()` and `to_array()` methods.
-
-
-## Third-party Libraries
-### RequestCore
-* **New:** Upgraded to version 1.3.
-* **New:** Added `set_seek_position()` for seeking to a byte-position in a file or file resource before starting an upload.
-* **New:** Added support for reading from and writing to open file resources.
-* **Fixed:** Improved the reporting for cURL errors.
-
-
-## Compatibility Test
-* **Fixed:** Fixed the links to the Getting Started Guide.
-
-
-----
-
-# Changelog: 1.0.1 "Aeris"
-<http://finalfantasy.wikia.com/wiki/Aerith_Gainsborough>
-
-Launched Tuesday, October 12, 2010
-
-
-## New Features & Highlights (Summary)
-* Improved support for running XPath queries against the service response bodies.
-* Added support for request retries and exponential backoff.
-* Added support for HTTP request/response header logging.
-* Bug fixes and enhancements:
- * [Bug in Samples](http://developer.amazonwebservices.com/connect/thread.jspa?threadID=52748)
- * [Can't set ACL on object using the SDK](http://developer.amazonwebservices.com/connect/thread.jspa?threadID=52305)
- * [Range requests for S3 - status codes 200, 206](http://developer.amazonwebservices.com/connect/thread.jspa?threadID=52738)
- * [S3 change_storage_redundancy() function clears public-read ACL](http://developer.amazonwebservices.com/connect/thread.jspa?threadID=52652)
-
-
-## Base/Runtime class
-* **New:** Added support for request retries and exponential backoff for all `500` and `503` HTTP status codes.
-* **New:** Added the `enable_debug_mode()` method to enable HTTP request/response header logging to `STDERR`.
-
-
-## Service Classes
-### AmazonS3
-* **Fixed:** Lots of tweaks to the documentation.
-* **Fixed:** The `change_content_type()`, `change_storage_redundancy()`, `set_object_acl()`, and `update_object()` methods now respect the existing content-type, storage redundancy, and ACL settings when updating.
-* **New:** Added the `get_object_metadata()` method has been added as a singular interface for obtaining all available metadata for an object.
-
-
-## Utility Classes
-### CFArray
-* **New:** Added the `each()` method which accepts a callback function to execute for each entry in the array. Works similarly to [jQuery's each()](http://api.jquery.com/each).
-* **New:** Added the `map()` method which accepts a callback function to execute for each entry in the array. Works similarly to [jQuery's map()](http://api.jquery.com/map).
-* **New:** Added the `reduce()` method which accepts a callback function to execute for each entry in the array. Works similarly to [DomCrawler reduce()](http://github.com/symfony/symfony/blob/master/src/Symfony/Component/DomCrawler/Crawler.php) from the [Symfony 2](http://symfony-reloaded.org) Preview Release.
-* **New:** Added the `first()` and `last()` methods to return the first and last nodes in the array, respectively.
-
-### CFInfo
-* **New:** Retrieves information about the current installation of the AWS SDK for PHP.
-
-### CFSimpleXML
-* **New:** Added the `query()` method, which allows for XPath queries while the results are wrapped in a `CFArray` response.
-* **New:** Added the `parent()` method, which allows for traversing back up the document tree.
-* **New:** Added the `stringify()` method, which typecasts the value as a string.
-* **New:** Added the `is()` and `contains()` methods, which allow for testing whether the XML value is or contains a given value, respectively.
-* **Changed:** Now extends the `SimpleXMLIterator` class, which in-turn extends the `SimpleXMLElement` class. This adds new iterator methods to the `CFSimpleXML` class.
-
-
-## Third-party Libraries
-### CacheCore
-* **New:** Upgraded to version 1.2.
-* **New:** Added a static `init` method that allows for chainable cache initialization (5.3+).
-
-### RequestCore
-* **New:** Added `206` as a successful status code (i.e., Range GET).
-
-
-## Compatibility Test
-* **Fixed:** Some of the links in the compatibility test were missing. These have been fixed.
-
-
-----
-
-# Changelog: AWS SDK for PHP 1.0
-
-Launched Tuesday, September 28, 2010
-
-This is a complete list of changes since we forked from the CloudFusion 2.5.x trunk build.
-
-
-## New Features & Highlights (Summary)
-* The new file to include is `sdk.class.php` rather than `cloudfusion.class.php`.
-* Because of the increased reliance on [JSON](http://json.org) across AWS services, the minimum supported version is now PHP 5.2 ([Released in November 2006](http://www.php.net/ChangeLog-5.php#5.2.0); Justified by these [WordPress usage statistics](http://wpdevel.wordpress.com/2010/07/09/suggest-topics-for-the-july-15-2010-dev/comment-page-1/#comment-8542) and the fact that [PHP 5.2 has been end-of-life'd](http://www.php.net/archive/2010.php#id2010-07-22-1) in favor of 5.3).
-* Up-to-date service support for [EC2](http://aws.amazon.com/ec2), [S3](http://aws.amazon.com/s3), [SQS](http://aws.amazon.com/sqs), [SimpleDB](http://aws.amazon.com/simpledb), [CloudWatch](http://aws.amazon.com/cloudwatch), and [CloudFront](http://aws.amazon.com/cloudfront).
-* Added service support for [SNS](http://aws.amazon.com/sns).
-* Limited testing for third-party API-compatible services such as [Eucalyptus](http://open.eucalyptus.com), [Walrus](http://open.eucalyptus.com) and [Google Storage](http://sandbox.google.com/storage).
-* Improved the consistency of setting complex data types across services. (Required some backwards-incompatible changes.)
-* Added new APIs and syntactic sugar for SimpleXML responses, batch requests and response caching.
-* Moved away from _global_ constants in favor of _class_ constants.
-* Minor, but notable improvements to the monkey patching support.
-* Added a complete list of bug fix and patch contributors. Give credit where credit is due. ;)
-
-**Note: ALL backwards-incompatible changes are noted below. Please review the changes if you are upgrading.** We're making a small number of backwards-incompatible changes in order to improve the consistency across services. We're making these changes _now_ so that we can ensure that future versions will always be backwards-compatible with the next major version change.
-
-
-## File structure
-The package file structure has been refined in a few ways:
-
-* All service-specific classes are inside the `/services/` directory.
-* All utility-specific classes are inside the `/utilities/` directory.
-* All third-party classes are inside the `/lib/` directory.
-
-
-## Base/Runtime class
-* **Fixed:** Resolved issues: [#206](http://code.google.com/p/tarzan-aws/issues/detail?id=206).
-* **New:** The following global constants have been added: `CFRUNTIME_NAME`, `CFRUNTIME_VERSION`, `CFRUNTIME_BUILD`, `CFRUNTIME_URL`, and `CFRUNTIME_USERAGENT`
-* **New:** Now supports camelCase versions of the snake_case method names. (e.g. `getObjectList()` will get translated to `get_object_list()` behind the scenes.)
-* **New:** Added `set_resource_prefix()` and `allow_hostname_override()` (in addition to `set_hostname()`) to support third-party, API-compatible services.
-* **New:** Added new caching APIs: `cache()` and `delete_cache()`, which work differently from the methods they replace. See docs for more information.
-* **New:** Added new batch request APIs, `batch()` and `CFBatchRequest` which are intended to replace the old `returnCurlHandle` optional parameter.
-* **New:** Will look for the `config.inc.php` file first in the same directory (`./config.inc.php`), and then fallback to `~/.aws/sdk/config.inc.php`.
-* **Changed:** Renamed the `CloudFusion` base class to `CFRuntime`.
-* **Changed:** `CloudFusion_Exception` has been renamed as `CFRuntime_Exception`.
-* **Changed:** Renamed the `CloudFusion::$enable_ssl` property to `CFRuntime::$use_ssl`.
-* **Changed:** Renamed the `CloudFusion::$set_proxy` property to `CFRuntime::$proxy`.
-* **Changed:** `CFRuntime::disable_ssl()` no longer takes any parameters. Once SSL is off, it is always off for that class instance.
-* **Changed:** All date-related constants are now class constants of the `CFUtilities` class (e.g. `CFUtilities::DATE_FORMAT_ISO8601`).
- * Use `CFUtilities::konst()` if you're extending classes and need to do something such as `$this->util::DATE_FORMAT_ISO8601` but keep getting the `T_PAAMAYIM_NEKUDOTAYIMM` error.
-* **Changed:** All `x-cloudfusion-` and `x-tarzan-` HTTP headers are now `x-aws-`.
-* **Changed:** `CloudFusion::autoloader()` is now in its own separate class: `CFLoader::autoloader()`. This prevents it from being incorrectly inherited by extending classes.
-* **Changed:** `RequestCore`, `ResponseCore` and `SimpleXMLElement` are now extended by `CFRequest`, `CFResponse` and `CFSimpleXML`, respectively. These new classes are now used by default.
-* **Changed:** Changes to monkey patching:
- * You must now extend `CFRequest` instead of `RequestCore`, and then pass that class name to `set_request_class()`.
- * You must now extend `CFResponse` instead of `ResponseCore`, and then pass that class name to `set_response_class()`.
- * You can now monkey patch `CFSimpleXML` (extended from `SimpleXMLElement`) with `set_parser_class()`.
- * You can now monkey patch `CFBatchRequest` with `set_batch_class()`.
- * No changes for monkey patching `CFUtilities` with `set_utilities_class()`.
-* **Removed:** Removed ALL existing _global_ constants and replaced them with _class_ constants.
-* **Removed:** Removed `cache_response()` and `delete_cache_response()`.
-
-
-## Service classes
-
-### AmazonCloudFront
-* **Fixed:** Resolved issues: [#124](http://code.google.com/p/tarzan-aws/issues/detail?id=124), [#225](http://code.google.com/p/tarzan-aws/issues/detail?id=225), [#229](http://code.google.com/p/tarzan-aws/issues/detail?id=229), [#232](http://code.google.com/p/tarzan-aws/issues/detail?id=232), [#239](http://code.google.com/p/tarzan-aws/issues/detail?id=239).
-* **Fixed:** Fixed an issue where `AmazonCloudFront` sent a `RequestCore` user agent in requests.
-* **New:** Class is now up-to-date with the [2010-07-15](http://docs.amazonwebservices.com/AmazonCloudFront/2010-07-15/APIReference/) API release.
-* **New:** Added _class_ constants for deployment states: `STATE_INPROGRESS` and `STATE_DEPLOYED`.
-* **New:** Now supports streaming distributions.
-* **New:** Now supports HTTPS (as well as HTTPS-only) access.
-* **New:** Now supports Origin Access Identities. Added `create_oai()`, `list_oais()`, `get_oai()`, `delete_oai()`, `generate_oai_xml()` and `update_oai_xml()`.
-* **New:** Now supports private (signed) URLs. Added `get_private_object_url()`.
-* **New:** Now supports default root objects.
-* **New:** Now supports invalidation.
-* **New:** Added `get_distribution_list()`, `get_streaming_distribution_list()` and `get_oai_list()` which return simplified arrays of identifiers.
-* **Changed:** Replaced all of the remaining `CDN_*` constants with _class_ constants.
-
-### AmazonCloudWatch
-* **New:** Added new _class_ constants: `DEFAULT_URL`, `REGION_US_E1`, `REGION_US_W1`, `REGION_EU_W1`, and `REGION_APAC_SE1`.
-* **New:** Now supports the _Northern California_, _European_ and _Asia-Pacific_ regions.
-* **New:** The _global_ `CW_DEFAULT_URL` constant has been replaced by `AmazonCloudFront::DEFAULT_URL`.
-
-### AmazonEC2
-* **Fixed:** Resolved issues: [#124](http://code.google.com/p/tarzan-aws/issues/detail?id=124), [#131](http://code.google.com/p/tarzan-aws/issues/detail?id=131), [#138](http://code.google.com/p/tarzan-aws/issues/detail?id=138), [#139](http://code.google.com/p/tarzan-aws/issues/detail?id=139), [#154](http://code.google.com/p/tarzan-aws/issues/detail?id=154), [#173](http://code.google.com/p/tarzan-aws/issues/detail?id=173), [#200](http://code.google.com/p/tarzan-aws/issues/detail?id=200), [#233](http://code.google.com/p/tarzan-aws/issues/detail?id=233).
-* **New:** Class is now up-to-date with the [2010-06-15](http://docs.amazonwebservices.com/AWSEC2/2010-06-15/APIReference/) API release.
-* **New:** Now supports [Paid AMIs](http://developer.amazonwebservices.com/connect/entry.jspa?externalID=865&categoryID=87).
-* **New:** Now supports [Multiple instance types](http://developer.amazonwebservices.com/connect/entry.jspa?externalID=992&categoryID=87).
-* **New:** Now supports [Elastic IPs](http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1344&categoryID=87).
-* **New:** Now supports [Availability Zones](http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1344&categoryID=87).
-* **New:** Now supports [Elastic Block Store](http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1665&categoryID=87).
-* **New:** Now supports [Windows instances](http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1765&categoryID=87).
-* **New:** Now supports the [European region](http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1926&categoryID=87).
-* **New:** Now supports the _Northern California_ and _Asia-Pacific_ regions.
-* **New:** Now supports [Reserved instances](http://developer.amazonwebservices.com/connect/entry.jspa?externalID=2213&categoryID=87).
-* **New:** Now supports [Shared snapshots](http://developer.amazonwebservices.com/connect/entry.jspa?externalID=2843&categoryID=87).
-* **New:** Now supports [EBS AMIs](http://developer.amazonwebservices.com/connect/entry.jspa?externalID=3105&categoryID=87).
-* **New:** Now supports [Spot instances](http://developer.amazonwebservices.com/connect/entry.jspa?externalID=3215&categoryID=87).
-* **New:** Now supports [Cluster Compute Instances](http://developer.amazonwebservices.com/connect/entry.jspa?externalID=3965&categoryID=87).
-* **New:** Now supports [Placement Groups](http://developer.amazonwebservices.com/connect/entry.jspa?externalID=3965&categoryID=87).
-* **New:** Added new _class_ constants for regions: `REGION_US_E1`, `REGION_US_W1`, `REGION_EU_W1`, `REGION_APAC_SE1`.
-* **New:** Added new _class_ constants for run-state codes: `STATE_PENDING`, `STATE_RUNNING`, `STATE_SHUTTING_DOWN`, `STATE_TERMINATED`, `STATE_STOPPING`, `STATE_STOPPED`.
-* **New:** Added support for decrypting the Administrator password for Microsoft Windows instances.
-* **New:** Instead of needing to pass `Parameter.0`, `Parameter.1`, ...`Parameter.n` individually to certain methods, you can now reliably pass a string for a single value or an indexed array for a list of values.
-* **New:** Limited tested has been done with the Eucalyptus EC2-clone.
-* **Changed:** The `$account_id` parameter has been removed from the constructor.
-* **Changed:** The _global_ `EC2_LOCATION_US` and `EC2_LOCATION_EU` constants have been replaced.
-* **Changed:** The `set_locale()` method has been renamed to `set_region()`. It accepts any of the region constants.
-
-### AmazonIAM
-* **New:** Up-to-date with the [2010-03-31](http://docs.amazonwebservices.com/sns/2010-03-31/api/) API release.
-
-### AmazonS3
-* **Fixed:** Resolved issues: [#31](http://code.google.com/p/tarzan-aws/issues/detail?id=31), [#72](http://code.google.com/p/tarzan-aws/issues/detail?id=72), [#123](http://code.google.com/p/tarzan-aws/issues/detail?id=123), [#156](http://code.google.com/p/tarzan-aws/issues/detail?id=156), [#199](http://code.google.com/p/tarzan-aws/issues/detail?id=199), [#201](http://code.google.com/p/tarzan-aws/issues/detail?id=201), [#203](http://code.google.com/p/tarzan-aws/issues/detail?id=203), [#207](http://code.google.com/p/tarzan-aws/issues/detail?id=207), [#208](http://code.google.com/p/tarzan-aws/issues/detail?id=208), [#209](http://code.google.com/p/tarzan-aws/issues/detail?id=209), [#210](http://code.google.com/p/tarzan-aws/issues/detail?id=210), [#212](http://code.google.com/p/tarzan-aws/issues/detail?id=212), [#216](http://code.google.com/p/tarzan-aws/issues/detail?id=216), [#217](http://code.google.com/p/tarzan-aws/issues/detail?id=217), [#226](http://code.google.com/p/tarzan-aws/issues/detail?id=226), [#228](http://code.google.com/p/tarzan-aws/issues/detail?id=228), [#234](http://code.google.com/p/tarzan-aws/issues/detail?id=234), [#235](http://code.google.com/p/tarzan-aws/issues/detail?id=235).
-* **Fixed:** Fixed an issue where `AmazonS3` sent a `RequestCore` user agent in requests.
-* **New:** Now supports the _Northern California_ and _Asia-Pacific_ regions.
-* **New:** Now supports the new _EU (Ireland)_ REST endpoint.
-* **New:** Now supports MFA Delete.
-* **New:** Now supports Conditional Copy.
-* **New:** Now supports Reduced Redundancy Storage (RRS). Added `change_storage_redundancy()`.
-* **New:** Now supports Object Versioning. Added `enable_versioning()`, `disable_versioning`, `get_versioning_status()`, and `list_bucket_object_versions()`.
-* **New:** Now supports Bucket Policies. Added `set_bucket_policy()`, `get_bucket_policy()`, and `delete_bucket_policy()`.
-* **New:** Now supports Bucket Notifications. Added `create_bucket_notification()`, `get_bucket_notifications()`, and `delete_bucket_notification()`.
-* **New:** Added _class_ constants for regions: `REGION_US_E1`, `REGION_US_W1`, `REGION_EU_W1`, `REGION_APAC_SE1`.
-* **New:** Added _class_ constants for storage types: `STORAGE_STANDARD` and `STORAGE_REDUCED`.
-* **New:** Enhanced `create_object()` with the ability to upload a file from the file system.
-* **New:** Enhanced `get_object()` with the ability to download a file to the file system.
-* **New:** Enhanced `get_bucket_list()` and `get_object_list()` with performance improvements.
-* **New:** Enhanced all GET operations with the ability to generate pre-authenticated URLs. This is the same feature as `get_object_url()` has had, applied to all GET operations.
-* **New:** Limited testing with Walrus, the Eucalyptus S3-clone.
-* **New:** Limited testing with Google Storage.
-* **Changed:** Replaced all of the remaining `S3_*` constants with _class_ constants: `self::ACL_*`, `self::GRANT_*`, `self::USERS_*`, and `self::PCRE_ALL`.
-* **Changed:** Changed the function signature for `create_object()`. The filename is now passed as the second parameter, while the remaining options are now passed as the third parameter. This behavior now matches all of the other object-related methods.
-* **Changed:** Changed the function signature for `head_object()`, `delete_object()`, and `get_object_acl()`. The methods now accept optional parameters as the third parameter instead of simply `returnCurlHandle`.
-* **Changed:** Changed the function signature for `get_object_url()` and `get_torrent_url()`. Instead of passing a number of seconds until the URL expires, you now pass a string that `strtotime()` understands (including `60 seconds`).
-* **Changed:** Changed the function signature for `get_object_url()`. Instead of passing a boolean value for `$torrent`, the last parameter is now an `$opt` variable which allows you to set `torrent` and `method` parameters.
-* **Changed:** Changed how `returnCurlHandle` is used. Instead of passing `true` as the last parameter to most methods, you now need to explicitly set `array('returnCurlHandle' => true)`. This behavior is consistent with the implementation in other classes.
-* **Changed:** Optional parameter names changed in `list_objects()`: `maxKeys` is now `max-keys`.
-* **Changed:** `get_bucket_locale()` is now called `get_bucket_region()`, and returns the response body as a _string_ for easier comparison with class constants.
-* **Changed:** `get_bucket_size()` is now called `get_bucket_object_count()`. Everything else about it is identical.
-* **Changed:** `head_bucket()` is now called `get_bucket_headers()`. Everything else about it is identical.
-* **Changed:** `head_object()` is now called `get_object_headers()`. Everything else about it is identical.
-* **Changed:** `create_bucket()` has two backward-incompatible changes:
- * Method now **requires** the region (formerly _locale_) to be set.
- * Method takes an `$acl` parameter so that the ACL can be set directly when creating a new bucket.
-* **Changed:** Bucket names are now validated. Creating a new bucket now requires the more stringent DNS-valid guidelines, while the process of reading existing buckets follows the looser path-style guidelines. This change also means that the reading of path-style bucket names is now supported, when previously they weren’t.
-* **Removed:** Removed `store_remote_file()` because its intended usage repeatedly confused users, and had potential for misuse. If you were using it to upload from the local file system, you should be using `create_object` instead.
-* **Removed:** Removed `copy_bucket()`, `replace_bucket()`, `duplicate_object()`, `move_object()`, and `rename_object()` because only a small number of users used them, and they weren't very robust anyway.
-* **Removed:** Removed `get_bucket()` because it was just an alias for `list_objects()` anyway. Use the latter from now on -- it's identical.
-
-### AmazonSDB
-* **Fixed:** Resolved issues: [#205](http://code.google.com/p/tarzan-aws/issues/detail?id=205).
-* **New:** Class is now up-to-date with the [2009-04-15](http://docs.amazonwebservices.com/AmazonSimpleDB/2009-04-15/DeveloperGuide/) API release.
-* **Changed:** Changed the function signatures for `get_attributes()` and `delete_attributes()` to improve consistency.
-
-### AmazonSNS
-* **New:** Up-to-date with the [2010-03-31](http://docs.amazonwebservices.com/sns/2010-03-31/api/) API release.
-
-### AmazonSQS
-* **Fixed:** Resolved issues: [#137](http://code.google.com/p/tarzan-aws/issues/detail?id=137), [#213](http://code.google.com/p/tarzan-aws/issues/detail?id=213), [#219](http://code.google.com/p/tarzan-aws/issues/detail?id=219), [#220](http://code.google.com/p/tarzan-aws/issues/detail?id=220), [#221](http://code.google.com/p/tarzan-aws/issues/detail?id=221), [#222](http://code.google.com/p/tarzan-aws/issues/detail?id=222).
-* **Fixed:** In CloudFusion 2.5, neither `add_permission()` nor `remove_permission()` were functional. They are now working.
-* **New:** Now supports the _Northern California_ and _Asia-Pacific_ regions.
-* **New:** Now supports the new _US-East (N. Virginia)_ endpoint.
-* **New:** Now supports the new _EU (Ireland)_ endpoint.
-* **New:** Added new _class_ constants for regions: `REGION_US_E1`, `REGION_US_W1`, `REGION_EU_W1`, and `REGION_APAC_SE1`.
-* **Changed:** Because we now support multiple region endpoints, queue names alone are no longer sufficient for referencing your queues. As such, you must now use a full-queue URL instead of just the queue name.
-* **Changed:** The _global_ `SQS_LOCATION_US` and `SQS_LOCATION_EU` constants have been replaced.
-* **Changed:** Renamed `set_locale()` as `set_region()`. It accepts any of the region constants.
-* **Changed:** Changed the function signature for `list_queues()`. See the updated API reference.
-* **Changed:** Changed the function signature for `set_queue_attributes()`. See the updated API reference.
-* **Changed:** Changed how `returnCurlHandle` is used. Instead of passing `true` as the last parameter to most methods, you now need to explicitly set `array('returnCurlHandle' => true)`. This behavior is consistent with the implementation in other classes.
-* **Changed:** Function signature changed in `get_queue_attributes()`. The `$attribute_name` parameter is now passed as a value in the `$opt` parameter.
-
-### AmazonSQSQueue
-* **Removed:** `AmazonSQSQueue` was a simple wrapper around the AmazonSDB class. It generally failed as an object-centric approach to working with SQS, and as such, has been eliminated. Use the `AmazonSQS` class instead.
-
-
-## Utility Classes
-### CFArray
-* **New:** Extends `ArrayObject`.
-* **New:** Simplified typecasting of SimpleXML nodes to native types (e.g. integers, strings).
-
-### CFBatchRequest
-* **New:** Provides a higher-level API for executing batch requests.
-
-### CFComplexType
-* **New:** Used internally by several classes to handle various complex data-types (e.g. single or multiple values, `Key.x.Subkey.y.Value` combinations).
-* **New:** Introduces a way to convert between JSON, YAML, and the PHP equivalent of Lists and Maps (nested associative arrays).
-
-### CFRequest
-* **New:** Sets some project-specific settings and passes them to the lower-level RequestCore.
-
-### CFResponse
-* **New:** No additional changes from the base `ResponseCore` class.
-
-### CFPolicy
-* **New:** Used for constructing Base64-encoded, JSON policy documents to be passed around to other methods.
-
-### CFSimpleXML
-* **New:** Extends `SimpleXMLElement`.
-* **New:** Simplified node retrieval. All SimpleXML-based objects (e.g. `$response->body`) now have magic methods that allow you to quickly retrieve nodes with the same name
- * e.g. `$response->body->Name()` will return an array of all SimpleXML nodes that match the `//Name` XPath expression.
-
-### CFUtilities
-* **Fixed:** `to_query_string()` now explicitly passes a `&` character to `http_build_query()` to avoid configuration issues with MAMP/WAMP/XAMP installations.
-* **Fixed:** `convert_response_to_array()` has been fixed to correctly return an all-array response under both PHP 5.2 and 5.3. Previously, PHP 5.3 returned a mix of `array`s and `stdClass` objects.
-* **New:** Added `konst()` to retrieve the value of a class constant, while avoiding the `T_PAAMAYIM_NEKUDOTAYIM` error. Misspelled because `const` is a reserved word.
-* **New:** Added `is_base64()` to determine whether or not a string is Base64-encoded data.
-* **New:** Added `decode_uhex()` to decode `\uXXXX` entities back into their unicode equivalents.
-* **Changed:** Changed `size_readable()`. Now supports units up to exabytes.
-* **Changed:** Moved the `DATE_FORMAT_*` _global_ constants into this class as _class_ constants.
-* **Removed:** Removed `json_encode_php51()` now that the minimum required version is PHP 5.2 (which includes the JSON extension by default).
-* **Removed:** Removed `hex_to_base64()`.
-
-
-## Third-party Libraries
-### CacheCore
-* **New:** Upgraded to version 1.1.1.
-* **New:** Now supports both the [memcache](http://php.net/memcache) extension, but also the newer, faster [memcached](http://php.net/memcached) extension. Prefers `memcached` if both are installed.
-* **Deprecated:** Support for MySQL and PostgreSQL as storage mechanisms has been **deprecated**. Since they're using PDO, they'll continue to function (as we're maintaining SQLite support via PDO), but we recommend migrating to using APC, XCache, Memcache or SQLite if you'd like to continue using response caching.
-* New BSD licensed
-* <http://github.com/skyzyx/cachecore>
-
-### RequestCore
-* **New:** Upgraded to version 1.2.
-* **New:** Now supports streaming up and down.
-* **New:** Now supports "rolling" requests for better scalability.
-* New BSD licensed
-* <http://github.com/skyzyx/requestcore>
diff --git a/3rdparty/aws-sdk/_docs/CONTRIBUTORS.md b/3rdparty/aws-sdk/_docs/CONTRIBUTORS.md
deleted file mode 100644
index 3523bf6723c..00000000000
--- a/3rdparty/aws-sdk/_docs/CONTRIBUTORS.md
+++ /dev/null
@@ -1,64 +0,0 @@
-# Contributors
-
-## AWS SDK for PHP Contributors
-
-Contributions were provided under the Apache 2.0 License, as appropriate.
-
-The following people have provided ideas, support and bug fixes:
-
-* [arech8](http://developer.amazonwebservices.com/connect/profile.jspa?userID=154435) (bug fixes)
-* [Aizat Faiz](http://aizatto.com) (bug fixes)
-* [Ben Lumley](http://github.com/benlumley) (bug fixes)
-* [David Chan](http://www.chandeeland.org) (bug fixes)
-* [Eric Caron](http://www.ericcaron.com) (bug fixes)
-* [Jason Ardell](http://ardell.posterous.com/) (bug fixes)
-* [Jeremy Archuleta](http://code.google.com/u/jeremy.archuleta/) (bug fixes)
-* [Jimmy Berry](http://blog.boombatower.com/) (bug fixes, patches)
-* [Paul Voegler](mailto:voegler@gmx.de) (bug fixes, bug reports, patches)
-* [Peter Bowen](http://github.com/pzb) (feedback, bug reports)
-* [zoxa](https://github.com/zoxa) (bug fixes)
-
-
-## CloudFusion/CacheCore/RequestCore Contributors
-
-Contributions were provided under the New BSD License, as appropriate.
-
-The following people have provided ideas, support and bug fixes:
-
-* [Aaron Collegeman](http://blog.aaroncollegeman.com) (bug fixes)
-* [Alex Schenkel](http://code.google.com/u/alex.schenkel/) (bug fixes)
-* [Andrzej Bednarczyk](http://kreo-consulting.com) (bug fixes)
-* [bprater](http://code.google.com/u/bprater/) (bug fixes)
-* [castoware](http://code.google.com/u/castoware/) (bug fixes)
-* [Chris Chen](http://github.com/chrischen) (bug fixes, patches, support)
-* [Chris Mytton](http://hecticjeff.net) (bug fixes)
-* [evgen.dm](http://code.google.com/u/evgen.dm/) (bug fixes)
-* [gafitescu](http://code.google.com/u/gafitescu/) (bug fixes)
-* [Gary Richardson](http://code.google.com/u/gary.richardson/) (bug fixes)
-* [Gil Hildebrand](http://squidoo.com) (bug fixes)
-* [Guilherme Blanco](http://blog.bisna.com) (bug fixes)
-* [hammjazz](http://code.google.com/u/hammjazz/) (bug fixes)
-* [HelloBunty](http://code.google.com/u/HelloBunty/) (bug fixes)
-* [inputrequired](http://code.google.com/u/inputrequired/) (bug fixes)
-* [Ivo Beckers](http://infopractica.nl) (bug fixes)
-* [Jason Litka](http://jasonlitka.com) (bug fixes, patches)
-* [Jeremy Archuleta](http://code.google.com/u/jeremy.archuleta/) (bug fixes)
-* [John Beales](http://johnbeales.com) (bug fixes)
-* [John Parker](http://code.google.com/u/john3parker/) (bug fixes)
-* [Jon Cianciullo](http://code.google.com/u/jon.cianciullo/) (bug fixes)
-* [kris0476](http://code.google.com/u/kris0476/) (bug fixes)
-* [Matt Terenzio](http://jour.nali.st/blog) (bug fixes, patches)
-* [Mike Jetter](http://mbjetter.com) (bug fixes)
-* [Morten Blinksbjerg Nielsen](http://mbn.dk) (bug fixes)
-* [nathell](http://code.google.com/u/nathell/) (bug fixes)
-* [nickgsuperstar](http://code.google.com/u/nickgsuperstar/) (bug fixes)
-* [ofpichon](http://code.google.com/u/ofpichon/) (bug fixes)
-* [Otavio Ferreira](http://otaviofff.me) (bug fixes)
-* [Paul Voegler](mailto:voegler@gmx.de) (bug fixes, bug reports, patches)
-* [Steve Brozosky](http://code.google.com/u/@UBZWSlJVBxhHXAN1/) (bug fixes)
-* [Steve Chu](http://stevechu.org) (bug fixes)
-* [tommusic](http://code.google.com/u/tommusic/) (bug fixes)
-* [Tyler Hall](http://clickontyler.com) (bug fixes)
-* [webcentrica.co.uk](http://code.google.com/u/@VhBQQldUBBBEXAF1/) (bug fixes)
-* [worden341](http://github.com/worden341) (bug fixes)
-* [yakkyjunk](http://code.google.com/u/yakkyjunk/) (bug fixes)
diff --git a/3rdparty/aws-sdk/_docs/DYNAMODBSESSIONHANDLER.html b/3rdparty/aws-sdk/_docs/DYNAMODBSESSIONHANDLER.html
deleted file mode 100644
index 8b1545db50a..00000000000
--- a/3rdparty/aws-sdk/_docs/DYNAMODBSESSIONHANDLER.html
+++ /dev/null
@@ -1,235 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <meta http-equiv="Content-type" content="text/html; charset=utf-8">
- <title>README</title>
- <style type="text/css" media="screen">
- body {
- font: 18px/1.5em 'Book Antiqua', 'Palatino Linotype', Palatino, 'Minion Pro', Cambria, Georgia, serif;
- padding: 50px 10%;
- max-width: 1000px;
- margin: 0 auto;
- color: #080000;
- background-color: #fbfbf9;
- }
- code {
- font: 13px/1.4em Monaco, monospace;
- background-color: #f3f3f3;
- color: #444;
- padding: 1px 2px;
-
- border-radius: 2px;
- -webkit-border-radius: 2px;
- -moz-border-radius: 2px;
- }
- pre {
- border: 1px solid #ddd;
- border-left: 6px solid #c0c0c0;
- background-color: #f3f3f3;
- color: #444;
- font: 13px/1.4em Monaco, monospace;
- overflow: auto;
-
- margin: 1em 0 1.5em 0;
- padding: 1em;
- text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
-
- -webkit-border-top-right-radius: 5px;
- -webkit-border-bottom-right-radius: 5px;
- -moz-border-radius-topright: 5px;
- -moz-border-radius-bottomright: 5px;
- border-top-right-radius: 5px;
- border-bottom-right-radius: 5px;
- }
- pre code {
- font-family: inherit;
- font-size: inherit;
- background-color: inherit;
- color: inherit;
- padding: 0;
-
- border-radius: none;
- -webkit-border-radius: none;
- -moz-border-radius: none;
- }
- a {
- color: #326EA1;
- text-decoration: underline;
- padding: 1px 2px;
- -webkit-transition: background-color 0.15s;
- -webkit-transition: color 0.15s;
- -moz-transition: background-color 0.15s;
- -moz-transition: color 0.15s;
- transition: background-color 0.15s;
- transition: color 0.15s;
- -webkit-border-radius: 2px;
- -moz-border-radius: 2px;
- border-radius: 2px;
- }
- a:hover, a.hover {
- color: #fff;
- background-color: #333;
- text-decoration: none;
- padding: 1px 2px;
- }
- a.active {
- font-weight: bold;
- }
- h1, h2, h3, h4, h5, h6 {
- padding: 0.8em 0 0.2em 0;
- margin: 0;
- }
- h1 {
- margin-top: 30px;
- padding: 15px 0 5px 5px;
- font-size: 2em;
- line-height: 1.3em;
- border-bottom: 3px solid #cdcdcc;
- }
- h2 {
- margin-top: 30px;
- padding: 15px 0 5px 5px;
- font-size: 1.5em;
- line-height: 1.3em;
- border-bottom: 1px solid #cdcdcc;
- }
- li {
- margin: 0;
- padding: 0;
- }
- em, i {
- font-style: italic;
- }
- strong, b {
- font-weight: bold;
- color: #000;
- }
- p {
- margin: 0;
- padding: 0.5em 0;
- }
- ul.columns {
- -moz-column-count: 3;
- -moz-column-gap: 20px;
- -webkit-column-count: 3;
- -webkit-column-gap: 20px;
- column-count: 3;
- column-gap: 20px;
- }
- dl dt {
- font: 13px/1.4em Monaco, monospace;
- font-weight: bold;
- }
- dl dd {
- margin-bottom: 0.5em;
- }
- </style>
- </head>
- <body>
- <h1>DynamoDB Session Handler</h1>
- <p>The <strong>DynamoDB Session Handler</strong> is a custom session handler for PHP that allows Amazon DynamoDB to be used as a session store while still using PHP&rsquo;s native session functions.</p>
-
- <h2>What issues does this address?</h2>
- <p>The native PHP session handler stores sessions on the local file system. This is unreliable in distributed web applications, because the user may be routed to servers that do not contain the session data. To solve this problem, PHP developers have implemented custom solutions for storing user session data using databases, shared file systems, Memcache servers, tamper-proof cookies, etc., by taking advantage of the interface provided by PHP via the <code>session_set_save_handler()</code> function. Unfortunately, most of these solutions require a lot of configuration or prior knowledge about the storage mechanism in order to setup. Some of them also require the provisioning or management of additional servers.</p>
-
- <h2>Proposed solution</h2>
- <p>The DynamoDB Session Handler uses Amazon DynamoDB as a session store, which alleviates many of the problems with existing solutions. There are no additional servers to manage, and there is very little configuration required. The Amazon DynamoDB is also fundamentally designed for low latency (the data is even stored on <abbr title="Solid State Drive">SSD</abbr>s), so the performance impact is much smaller when compared to other databases. Since the Session Handler is designed to be a drop in replacement for the default PHP session handler, it also implements session locking in a familiar way.</p>
-
- <h2>How do I use it?</h2>
- <p>The first step is to instantiate the Amazon DynamoDB client and register the session handler.</p>
- <pre>require_once 'AWSSDKforPHP/sdk.class.php';
-
-// Instantiate the Amazon DynamoDB client.
-// REMEMBER: You need to set 'default_cache_config' in your config.inc.php.
-$dynamodb = new AmazonDynamoDB();
-
-// Register the DynamoDB Session Handler.
-$handler = $dynamodb->register_session_handler(array(
- 'table_name' => 'my-sessions-table'
-));</pre>
- <p>Before you can use the session handler, you need to create a table to store the sessions in. This can be done through the <a href="https://console.aws.amazon.com/dynamodb/home">AWS Console for Amazon DynamoDB</a>, or using the session handler class (which you must configure with the table name like in the example above).</p>
- <pre>// Create a table for session storage with default settings.
-$handler->create_sessions_table();</pre>
- <p>If you create the table via the AWS Console, you need to make sure the primary key is a string. By default the DynamoDB Session Handler looks for a key named "id", so if you name the key something else, you will need to specify that when you configure the session handler (see the <a href="#configuration">Configuration section</a> below).</p>
- <p>Once the session handler is registered with a valid table, you can write to (and read from) the session using the standard <code>$_SESSION</code> superglobal.</p>
- <pre>// Start the session. This will acquire a lock if session locking is enabled.
-session_start();
-
-// Alter the session data.
-$_SESSION['username'] = 'jeremy';
-$_SESSION['role'] = 'admin';
-
-// Close and write to the session.
-// REMEMBER: You should close the session ASAP to release the session lock.
-session_write_close();</pre>
-
- <h3>Removing expired sessions</h3>
- <p>The session handler ties into PHP's native session garbage collection functionality, so expired sessions will be deleted periodically and automatically based on how you configure PHP to do the garbage collection. See the PHP manual for the following PHP INI settings: <a href="http://www.php.net/manual/en/session.configuration.php#ini.session.gc-probability">session.gc_probability</a>, <a href="http://www.php.net/manual/en/session.configuration.php#ini.session.gc-divisor">session.gc_divisor</a>, and <a href="http://www.php.net/manual/en/session.configuration.php#ini.session.gc-maxlifetime">session.gc_maxlifetime</a>. You may also manually call the <code>DynamoDBSessionHandler::garbage_collect()</code> to clean up the expired sessions.</p>
-
- <h2 id="configuration">Configuring the DynamoDB Session Handler</h2>
- <p>You may configure the behavior of the session handler using a the following settings:</p>
- <dl>
- <dt>table_name</dt>
- <dd>The name of the DynamoDB table in which to store sessions.</dd>
-
- <dt>hash_key</dt>
- <dd>The name of the primary hash key in the DynamoDB sessions table.</dd>
-
- <dt>session_lifetime</dt>
- <dd>The lifetime of an inactive session before it should be garbage collected. If <code>0</code> is used, then the actual lifetime value that will be used is <code>ini_get('session.gc_maxlifetime')</code>.</dd>
-
- <dt>consistent_reads</dt>
- <dd>Whether or not the session handler should do consistent reads from DynamoDB.</dd>
-
- <dt>session_locking</dt>
- <dd>Whether or not the session handler should do session locking (see the <a href="#session_locking">Session locking section</a> for more information).</dd>
-
- <dt>max_lock_wait_time</dt>
- <dd>Maximum time, in seconds, that the session handler should take to acquire a lock before giving up. Only used if <code>session_locking</code> is <code>true</code>.</dd>
-
- <dt>min_lock_retry_utime</dt>
- <dd>Minimum time, in microseconds, that the session handler should wait to retry acquiring a lock. Only used if <code>session_locking</code> is <code>true</code>.</dd>
-
- <dt>max_lock_retry_utime</dt>
- <dd>Maximum time, in microseconds, that the session handler should wait to retry acquiring a lock. Only used if <code>session_locking</code> is <code>true</code>.</dd>
- </dl>
-
- <p>To configure the Session Handle, you must pass the configuration data into the constructor. (<strong>Note</strong>: The values used below are actually the default settings.)</p>
- <pre>$dynamodb = new AmazonDynamoDB();
-$handler = $dynamodb->register_session_handler(array(
- 'table_name' => 'sessions',
- 'hash_key' => 'id',
- 'session_lifetime' => 0,
- 'consistent_reads' => true,
- 'session_locking' => true,
- 'max_lock_wait_time' => 15,
- 'min_lock_retry_utime' => 5000,
- 'max_lock_retry_utime' => 50000,
-));</pre>
-
- <h2 id="session_locking">Session locking</h2>
- <p>The default session handler for PHP locks sessions using a pessimistic locking algorithm. If a request (process) opens a session for reading using the <code>session_start()</code> function, it first acquires a lock. The lock is closed when that request writes back to the session, either when the request is complete, or via the <code>session_write_close()</code> function. Since the DynamoDB Session Handler is meant to be a drop in replacement for the default session handler, it also implements the same locking scheme. However, this can be slow, undesirable, and costly when multiple, simultaneous requests from the same user occur, particularly with ajax requests or HTML iframes. In some cases, you may not want or need the session to be locked. After evaluating whether or not your application actually requires session locking, you may turn off locking when you configure the session handler by setting <code>session_locking</code> to <code>false</code>.</p>
-
- <h2 id="pricing">Pricing</h2>
- <p>Aside from nominal data storage and data transfer fees, the costs associated with using Amazon DynamoDB are calculated based on provisioned throughput capacity and item size (see the <a href="http://aws.amazon.com/dynamodb/#pricing">Amazon DynamoDB pricing</a> details). Throughput is measured in units of Read Capacity and Write Capacity. Ultimately, the throughput and costs required for your sessions table is going to be based on your website traffic, but the following is a list of the capacity units required for each session-related operation:</p>
- <ul>
- <li><strong>Reading</strong> via <code>session_start()</code>
- <p>With locking enabled: 1 unit of Write Capacity + 1 unit of Write Capacity for each time it must retry acquiring the lock</p>
- <p>With locking disabed: 1 unit of Read Capacity (or 0.5 units of Read Capacity if <i>consistent reads</i> are disabled)</p>
- </li>
- <li><strong>Writing</strong> via <code>session_write_close()</code>
- <p>1 unit of Write Capacity</p>
- </li>
- <li><strong>Deleting</strong> via <code>session_destroy()</code>
- <p>1 unit of Write Capacity</p>
- </li>
- <li><strong>Garbage Collecting</strong> via <code>DyanamoDBSessionHandler::garbage_collect()</code>
- <p>0.5 units of Read Capacity per KB of data in the sessions table + 1 unit of Write Capacity per expired item</p>
- </li>
- </ul>
-
- <h2 id="more_information">More information</h2>
- <p>For more information on the Amazon DynamoDB service please visit the <a href="http://aws.amazon.com/dynamodb">Amazon DynamoDB homepage</a>.</p>
-
- </body>
-</html>
diff --git a/3rdparty/aws-sdk/_docs/KNOWNISSUES.md b/3rdparty/aws-sdk/_docs/KNOWNISSUES.md
deleted file mode 100644
index 9773c3932b8..00000000000
--- a/3rdparty/aws-sdk/_docs/KNOWNISSUES.md
+++ /dev/null
@@ -1,65 +0,0 @@
-# Known Issues
-
-## 2GB limit for 32-bit stacks; all Windows stacks.
-
-Because PHP's integer type is signed and many platforms use 32-bit integers, the AWS SDK for PHP does not correctly
-handle files larger than 2GB on a 32-bit stack (where "stack" includes CPU, OS, web server, and PHP binary). This is a
-[well-known PHP issue]. In the case of Microsoft® Windows®, there are no official builds of PHP that support 64-bit
-integers.
-
-The recommended solution is to use a 64-bit Linux stack, such as the [64-bit Amazon Linux AMI] with the latest version of
-PHP installed.
-
-For more information, please see: [PHP filesize: Return values]. A workaround is suggested in
-`AmazonS3::create_mpu_object()` [with files bigger than 2GB].
-
- [well-known PHP issue]: http://www.google.com/search?q=php+2gb+32-bit
- [64-bit Amazon Linux AMI]: http://aws.amazon.com/amazon-linux-ami/
- [PHP filesize: Return values]: http://docs.php.net/manual/en/function.filesize.php#refsect1-function.filesize-returnvalues
- [with files bigger than 2GB]: https://forums.aws.amazon.com/thread.jspa?messageID=215487#215487
-
-
-## Amazon S3 Buckets containing periods
-
-Amazon S3's SSL certificate covers domains that match `*.s3.amazonaws.com`. When buckets (e.g., `my-bucket`) are accessed
-using DNS-style addressing (e.g., `my-bucket.s3.amazonaws.com`), those SSL/HTTPS connections are covered by the certificate.
-
-However, when a bucket name contains one or more periods (e.g., `s3.my-domain.com`) and is accessed using DNS-style
-addressing (e.g., `s3.my-domain.com.s3.amazonaws.com`), that SSL/HTTPS connection will fail because the certificate
-doesn't match.
-
-The most secure workaround is to change the bucket name to one that does not contain periods. Less secure workarounds
-are to use `disable_ssl()` or `disable_ssl_verification()`. Because of the security implications, calling either of
-these methods will throw a warning. You can avoid the warning by adjusting your `error_reporting()` settings.
-
-
-## Expiring request signatures
-
-When leveraging `AmazonS3::create_mpu_object()`, it's possible that later parts of the multipart upload will fail if
-the upload takes more than 15 minutes.
-
-
-## Too many open file connections
-
-When leveraging `AmazonS3::create_mpu_object()`, it's possible that the SDK will attempt to open too many file resources
-at once. Because the file connection limit is not available to the PHP environment, the SDK is unable to automatically
-adjust the number of connections it attempts to open.
-
-A workaround is to increase the part size so that fewer file connections are opened.
-
-
-## Exceptionally large batch requests
-
-When leveraging the batch request feature to execute multiple requests in parallel, it's possible that the SDK will
-throw a fatal exception if a particular batch pool is exceptionally large and a service gets overloaded with requests.
-
-This seems to be most common when attempting to send a large number of emails with the SES service.
-
-
-## Long-running processes using SSL leak memory
-
-When making requests with the SDK over SSL during long-running processes, there will be a gradual memory leak that can
-eventually cause a crash. The leak occurs within the PHP bindings for cURL when attempting to verify the peer during an
-SSL handshake. See <https://bugs.php.net/61030> for details about the bug.
-
-A workaround is to disable SSL for requests executed in long-running processes.
diff --git a/3rdparty/aws-sdk/_docs/LICENSE.md b/3rdparty/aws-sdk/_docs/LICENSE.md
deleted file mode 100644
index 853ab3bae8e..00000000000
--- a/3rdparty/aws-sdk/_docs/LICENSE.md
+++ /dev/null
@@ -1,151 +0,0 @@
-# Apache License
-Version 2.0, January 2004
-
-TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-
-## 1. Definitions.
-
-"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1
-through 9 of this document.
-
-"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the
-License.
-
-"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled
-by, or are under common control with that entity. For the purposes of this definition, "control" means
-(i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract
-or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial
-ownership of such entity.
-
-"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
-
-"Source" form shall mean the preferred form for making modifications, including but not limited to software
-source code, documentation source, and configuration files.
-
-"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form,
-including but not limited to compiled object code, generated documentation, and conversions to other media
-types.
-
-"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License,
-as indicated by a copyright notice that is included in or attached to the work (an example is provided in the
-Appendix below).
-
-"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from)
-the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent,
-as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not
-include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work
-and Derivative Works thereof.
-
-"Contribution" shall mean any work of authorship, including the original version of the Work and any
-modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to
-Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to
-submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of
-electronic, verbal, or written communication sent to the Licensor or its representatives, including but not
-limited to communication on electronic mailing lists, source code control systems, and issue tracking systems
-that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but
-excluding communication that is conspicuously marked or otherwise designated in writing by the copyright
-owner as "Not a Contribution."
-
-"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been
-received by Licensor and subsequently incorporated within the Work.
-
-
-## 2. Grant of Copyright License.
-
-Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual,
-worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare
-Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such
-Derivative Works in Source or Object form.
-
-
-## 3. Grant of Patent License.
-
-Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual,
-worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent
-license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such
-license applies only to those patent claims licensable by such Contributor that are necessarily infringed by
-their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such
-Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim
-or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work
-constitutes direct or contributory patent infringement, then any patent licenses granted to You under this
-License for that Work shall terminate as of the date such litigation is filed.
-
-
-## 4. Redistribution.
-
-You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without
-modifications, and in Source or Object form, provided that You meet the following conditions:
-
- 1. You must give any other recipients of the Work or Derivative Works a copy of this License; and
-
- 2. You must cause any modified files to carry prominent notices stating that You changed the files; and
-
- 3. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent,
- trademark, and attribution notices from the Source form of the Work, excluding those notices that do
- not pertain to any part of the Derivative Works; and
-
- 4. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that
- You distribute must include a readable copy of the attribution notices contained within such NOTICE
- file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed as part of the Derivative Works; within
- the Source form or documentation, if provided along with the Derivative Works; or, within a display
- generated by the Derivative Works, if and wherever such third-party notices normally appear. The
- contents of the NOTICE file are for informational purposes only and do not modify the License. You may
- add Your own attribution notices within Derivative Works that You distribute, alongside or as an
- addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be
- construed as modifying the License.
-
-You may add Your own copyright statement to Your modifications and may provide additional or different license
-terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative
-Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the
-conditions stated in this License.
-
-
-## 5. Submission of Contributions.
-
-Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by
-You to the Licensor shall be under the terms and conditions of this License, without any additional terms or
-conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate
-license agreement you may have executed with Licensor regarding such Contributions.
-
-
-## 6. Trademarks.
-
-This License does not grant permission to use the trade names, trademarks, service marks, or product names of
-the Licensor, except as required for reasonable and customary use in describing the origin of the Work and
-reproducing the content of the NOTICE file.
-
-
-## 7. Disclaimer of Warranty.
-
-Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor
-provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
-or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT,
-MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the
-appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of
-permissions under this License.
-
-
-## 8. Limitation of Liability.
-
-In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless
-required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any
-Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential
-damages of any character arising as a result of this License or out of the use or inability to use the Work
-(including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or
-any and all other commercial damages or losses), even if such Contributor has been advised of the possibility
-of such damages.
-
-
-## 9. Accepting Warranty or Additional Liability.
-
-While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for,
-acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this
-License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole
-responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold
-each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason
-of your accepting any such warranty or additional liability.
-
-
-END OF TERMS AND CONDITIONS
diff --git a/3rdparty/aws-sdk/_docs/NOTICE.md b/3rdparty/aws-sdk/_docs/NOTICE.md
deleted file mode 100644
index 780c2e4c9d5..00000000000
--- a/3rdparty/aws-sdk/_docs/NOTICE.md
+++ /dev/null
@@ -1,444 +0,0 @@
-# AWS SDK for PHP
-
-Based on [CloudFusion](http://getcloudfusion.com). Includes other third-party software.
-
-See below for complete copyright and licensing notices.
-
-
-## AWS SDK for PHP
-
-<http://aws.amazon.com/php>
-
-Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License").
-You may not use this file except in compliance with the License.
-A copy of the License is located at
-
-<http://aws.amazon.com/apache2.0>
-
-or in the "license" file accompanying this file. This file is distributed
-on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
-express or implied. See the License for the specific language governing
-permissions and limitations under the License.
-
-
-## CloudFusion
-
-<http://getcloudfusion.com>
-
-* Copyright 2005-2010 [Ryan Parman](http://ryanparman.com)
-* Copyright 2007-2010 [Foleeo Inc.](http://warpshare.com)
-* Copyright 2007-2010 "CONTRIBUTORS" (see [CONTRIBUTORS.md](CONTRIBUTORS.md) for a list)
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
-* Neither the name of the organization nor the names of its contributors
- may be used to endorse or promote products derived from this software without
- specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
-INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
-OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
-<http://opensource.org/licenses/bsd-license.php>
-
-
-## CacheCore
-
-<http://github.com/skyzyx/cachecore>
-
-* Copyright 2007-2010 [Ryan Parman](http://ryanparman.com)
-* Copyright 2007-2010 [Foleeo Inc.](http://warpshare.com)
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
-* Neither the name of the organization nor the names of its contributors
- may be used to endorse or promote products derived from this software without
- specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
-INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
-OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
-<http://opensource.org/licenses/bsd-license.php>
-
-
-## RequestCore
-
-<http://github.com/skyzyx/requestcore>
-
-* Copyright 2007-2010 [Ryan Parman](http://ryanparman.com)
-* Copyright 2007-2010 [Foleeo Inc.](http://warpshare.com)
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
-* Neither the name of the organization nor the names of its contributors
- may be used to endorse or promote products derived from this software without
- specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
-INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
-OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
-<http://opensource.org/licenses/bsd-license.php>
-
-
-## SimplePie
-
-<http://simplepie.org>
-
-* Copyright 2004-2010 [Ryan Parman](http://ryanparman.com)
-* Copyright 2005-2010 [Geoffrey Sneddon](http://gsnedders.com)
-* Copyright 2008-2011 [Ryan McCue](http://ryanmccue.info)
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
-* Neither the name of the organization nor the names of its contributors
- may be used to endorse or promote products derived from this software without
- specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
-INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
-OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
-<http://opensource.org/licenses/bsd-license.php>
-
-
-## Reqwest
-
-<https://github.com/ded/reqwest>
-
-* Copyright 2011 [Dustin Diaz](http://dustindiaz.com)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-<http://www.opensource.org/licenses/mit-license.php>
-
-
-## Human readable file sizes
-
-<http://aidanlister.com/2004/04/human-readable-file-sizes/>
-
-* Copyright 2004-2010 [Aidan Lister](http://aidanlister.com)
-* Copyright 2007-2010 [Ryan Parman](http://ryanparman.com)
-
-Redistribution and use in source and binary forms, with or without
-modification, is permitted provided that the following conditions
-are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
- 3. The name "PHP" must not be used to endorse or promote products
- derived from this software without prior written permission. For
- written permission, please contact group@php.net.
-
- 4. Products derived from this software may not be called "PHP", nor
- may "PHP" appear in their name, without prior written permission
- from group@php.net. You may indicate that your software works in
- conjunction with PHP by saying "Foo for PHP" instead of calling
- it "PHP Foo" or "phpfoo"
-
- 5. The PHP Group may publish revised and/or new versions of the
- license from time to time. Each version will be given a
- distinguishing version number.
- Once covered code has been published under a particular version
- of the license, you may always continue to use it under the terms
- of that version. You may also choose to use such covered code
- under the terms of any subsequent version of the license
- published by the PHP Group. No one other than the PHP Group has
- the right to modify the terms applicable to covered code created
- under this License.
-
- 6. Redistributions of any form whatsoever must retain the following
- acknowledgment:
- "This product includes PHP software, freely available from
- <http://www.php.net/software/>".
-
-THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND
-ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP
-DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
-INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
-OF THE POSSIBILITY OF SUCH DAMAGE.
-
-<http://www.php.net/license/3_01.txt>
-
-
-## Snippets from PHP.net documentation
-
-* `CFUtilities::is_base64()` - Copyright 2008 "debug" <http://us.php.net/manual/en/function.base64-decode.php#81425>
-
-Redistribution and use in source and binary forms, with or without
-modification, is permitted provided that the following conditions
-are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
- 3. The name "PHP" must not be used to endorse or promote products
- derived from this software without prior written permission. For
- written permission, please contact group@php.net.
-
- 4. Products derived from this software may not be called "PHP", nor
- may "PHP" appear in their name, without prior written permission
- from group@php.net. You may indicate that your software works in
- conjunction with PHP by saying "Foo for PHP" instead of calling
- it "PHP Foo" or "phpfoo"
-
- 5. The PHP Group may publish revised and/or new versions of the
- license from time to time. Each version will be given a
- distinguishing version number.
- Once covered code has been published under a particular version
- of the license, you may always continue to use it under the terms
- of that version. You may also choose to use such covered code
- under the terms of any subsequent version of the license
- published by the PHP Group. No one other than the PHP Group has
- the right to modify the terms applicable to covered code created
- under this License.
-
- 6. Redistributions of any form whatsoever must retain the following
- acknowledgment:
- "This product includes PHP software, freely available from
- <http://www.php.net/software/>".
-
-THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND
-ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP
-DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
-INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
-OF THE POSSIBILITY OF SUCH DAMAGE.
-
-<http://www.php.net/license/3_01.txt>
-
-
-## phunction PHP framework
-
-<http://sourceforge.net/projects/phunction/>
-
-* Copyright 2010 [Alix Axel](mailto:alix-axel@users.sf.net)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-<http://www.opensource.org/licenses/mit-license.php>
-
-
-## Symfony YAML Component
-
-<http://components.symfony-project.org/yaml/>
-
-Copyright 2008-2009 [Fabien Potencier](http://fabien.potencier.org)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is furnished
-to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-<http://opensource.org/licenses/mit-license.php>
-
-
-## PEAR Console_ProgressBar
-
-<http://pear.php.net/package/Console_ProgressBar/>
-
-Copyright 2003-2007 [Stefan Walk](http://pear.php.net/user/et)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is furnished
-to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-<http://opensource.org/licenses/mit-license.php>
-
-
-## Mozilla Certificate Authority
-
-* <http://curl.haxx.se/ca/cacert.pem>
-* <https://mxr.mozilla.org/mozilla/source/security/nss/lib/ckfw/builtins/certdata.txt?raw=1>
-
-The contents of this file are subject to the Mozilla Public License Version
-1.1 (the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-http://www.mozilla.org/MPL/
-
-Software distributed under the License is distributed on an "AS IS" basis,
-WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-for the specific language governing rights and limitations under the
-License.
-
-The Original Code is the Netscape security libraries.
-
-The Initial Developer of the Original Code is Netscape Communications
-Corporation. Portions created by the Initial Developer are Copyright
-(C) 1994-2000 the Initial Developer. All Rights Reserved.
-
-<http://www.mozilla.org/MPL/>
-
-
-## array-to-domdocument
-
-<https://code.google.com/p/array-to-domdocument/>
-
-* Copyright 2010-2011 [Omer Hassan](https://code.google.com/u/113495690012051782542/)
-* Portions copyright 2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is furnished
-to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-<http://opensource.org/licenses/mit-license.php>
diff --git a/3rdparty/aws-sdk/_docs/STREAMWRAPPER_README.html b/3rdparty/aws-sdk/_docs/STREAMWRAPPER_README.html
deleted file mode 100644
index 5d91068aa23..00000000000
--- a/3rdparty/aws-sdk/_docs/STREAMWRAPPER_README.html
+++ /dev/null
@@ -1,243 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <meta http-equiv="Content-type" content="text/html; charset=utf-8">
- <title>README</title>
- <style type="text/css" media="screen">
- body {
- font: 18px/1.5em 'Book Antiqua', 'Palatino Linotype', Palatino, 'Minion Pro', Cambria, Georgia, serif;
- padding: 50px 10%;
- max-width: 1000px;
- margin: 0 auto;
- color: #080000;
- background-color: #fbfbf9;
- }
- code {
- font: 13px/1.4em Monaco, monospace;
- background-color: #f3f3f3;
- color: #444;
- padding: 1px 2px;
-
- border-radius: 2px;
- -webkit-border-radius: 2px;
- -moz-border-radius: 2px;
- }
- pre {
- border: 1px solid #ddd;
- border-left: 6px solid #c0c0c0;
- background-color: #f3f3f3;
- color: #444;
- font: 13px/1.4em Monaco, monospace;
- overflow: auto;
-
- margin: 1em 0 1.5em 0;
- padding: 1em;
- text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
-
- -webkit-border-top-right-radius: 5px;
- -webkit-border-bottom-right-radius: 5px;
- -moz-border-radius-topright: 5px;
- -moz-border-radius-bottomright: 5px;
- border-top-right-radius: 5px;
- border-bottom-right-radius: 5px;
- }
- pre code {
- font-family: inherit;
- font-size: inherit;
- background-color: inherit;
- color: inherit;
- padding: 0;
-
- border-radius: none;
- -webkit-border-radius: none;
- -moz-border-radius: none;
- }
- a {
- color: #326EA1;
- text-decoration: underline;
- padding: 1px 2px;
- -webkit-transition: background-color 0.15s;
- -webkit-transition: color 0.15s;
- -moz-transition: background-color 0.15s;
- -moz-transition: color 0.15s;
- transition: background-color 0.15s;
- transition: color 0.15s;
- -webkit-border-radius: 2px;
- -moz-border-radius: 2px;
- border-radius: 2px;
- }
- a:hover, a.hover {
- color: #fff;
- background-color: #333;
- text-decoration: none;
- padding: 1px 2px;
- }
- a.active {
- font-weight: bold;
- }
- h1, h2, h3, h4, h5, h6 {
- padding: 0.8em 0 0.2em 0;
- margin: 0;
- }
- h1 {
- margin-top: 30px;
- padding: 15px 0 5px 5px;
- font-size: 2em;
- line-height: 1.3em;
- border-bottom: 3px solid #cdcdcc;
- }
- h2 {
- margin-top: 30px;
- padding: 15px 0 5px 5px;
- font-size: 1.5em;
- line-height: 1.3em;
- border-bottom: 1px solid #cdcdcc;
- }
- li {
- margin: 0;
- padding: 0;
- }
- em, i {
- font-style: italic;
- }
- strong, b {
- font-weight: bold;
- color: #000;
- }
- p {
- margin: 0;
- padding: 0.5em 0;
- }
- ul.columns {
- -moz-column-count: 3;
- -moz-column-gap: 20px;
- -webkit-column-count: 3;
- -webkit-column-gap: 20px;
- column-count: 3;
- column-gap: 20px;
- }
- </style>
- </head>
- <body>
- <h1>S3 Stream Wrapper</h1>
- <p>The <strong>S3 Stream Wrapper</strong> is a stream wrapper interface for PHP that provides access to Amazon S3 using PHP&#8217;s standard File System API functions.</p>
-
- <h2>What issues does this address?</h2>
- <p>There are a large number of existing applications, code snippets and other bits of PHP that are designed to read and write from the local file system as part of their normal operations. Many of these apps could benefit from moving into the cloud, but doing so would require rewriting a substantial amount of code.</p>
- <p>What if we could simplify this process so that the updates required to make an existing application cloud-backed would be very minimal?</p>
-
- <h2>Proposed solution</h2>
- <p>PHP provides an interface for solving this exact kind of problem, called the <a href="http://php.net/streamwrapper">Stream Wrapper</a> interface. By writing a class that implements this interface and <a href="http://php.net/manual/en/function.stream-wrapper-register.php">registering it as a handler</a> we can reduce both the amount of rewriting that needs to be done for existing applications, as well as substantially lower the learning curve for reading and writing from Amazon S3.</p>
-
- <h2>How do I use it?</h2>
- <p>After including the AWS SDK for PHP in your project, use the <code>AmazonS3::register_stream_wrapper()</code> method to register <code>s3://</code> as a <a href="http://php.net/manual/en/wrappers.php">supported stream wrapper</a> for Amazon S3. <em>It's that simple</em>. Amazon S3 file patterns take the following form: <code>s3://bucket/object</code>.</p>
-
- <pre><code>require_once 'AWSSDKforPHP/sdk.class.php';
-
-$s3 = new AmazonS3();
-$s3->register_stream_wrapper();
-
-$directory = 's3://my-new-bucket';
-$filename = $directory . '/put.txt';
-$contents = '';
-
-if (mkdir($directory))
-{
- if (file_put_contents($filename, 'This is some sample data.'))
- {
- $handle = fopen($filename, 'rb+');
- $contents = stream_get_contents($handle);
- fclose($handle);
- }
-
- rmdir($directory);
-}
-
-echo $contents;</code></pre>
-
- <p>You may also pass a different protocol name as a parameter to <code>AmazonS3::register_stream_wrapper()</code> if you want to use something besides <code>s3://</code>. Using this technique you can create more than one stream wrapper with different configurations (e.g. for different regions). To do that you just need to create separate instances of the <code>AmazonS3</code> class, configure them, and then register a stream wrapper for each of them with different protocol names.</p>
-
- <pre><code>require_once 'AWSSDKforPHP/sdk.class.php';
-
-$s3east = new AmazonS3();
-$s3east->set_region(AmazonS3::REGION_US_E1);
-$s3east->register_stream_wrapper('s3east');
-mkdir('s3east://my-easterly-bucket');
-
-$s3west = new AmazonS3();
-$s3west->set_region(AmazonS3::REGION_US_W1);
-$s3west->register_stream_wrapper('s3west');
-mkdir('s3west://my-westerly-bucket');</code></pre>
-
- <h2>Tests and usage examples</h2>
- <p>We are also including tests written in the <a href="http://qa.php.net/phpt_details.php">PHPT</a> format. Not only do these tests show how the software can be used, but any tests submitted back to us should be in this format. These tests will likely fail for you unless you change the bucket names to be globally unique across S3. You can run the tests with <code>pear</code>.</p>
- <pre><code>cd S3StreamWrapper/tests;
-pear run-tests;</code></pre>
- <p>If you have <a href="http://phpunit.de">PHPUnit</a> 3.6+ and <a href="http://xdebug.org">Xdebug</a> installed, you can generate a code coverage report as follows:</p>
- <pre><code>cd S3StreamWrapper/tests && \
-phpunit --colors --coverage-html ./_coverage_report . && \
-open ./_coverage_report/index.html;</code></pre>
-
- <h2>Notes and Known Issues</h2>
- <ul>
- <li><p><code>stream_lock()</code> and <code>stream_cast()</code> are not currently implemented, and likely won't be.</p></li>
- <li><p>Strangely <code>touch()</code> doesn&#8217;t seem to work. I think this is because of an issue with my implementation of <code>url_stat()</code>, but I can&#8217;t find any information on the magical combination of parameters that will make this work.</p></li>
- <li><p>Using <code>fopen()</code> will always open in <code>rb+</code> mode. Amazon S3 as a service doesn&#8217;t support anything else.</p></li>
- <li><p>Because of the way that PHP interacts with the <a href="http://php.net/manual/en/class.streamwrapper.php">StreamWrapper</a> interface, it&#8217;s difficult to optimize for batch requests under the hood. If you need to push or pull data from several objects, you may find that using <a href="http://docs.amazonwebservices.com/AWSSDKforPHP/latest/#m=CFRuntime/batch">batch requests</a> with the <a href="http://docs.amazonwebservices.com/AWSSDKforPHP/latest/#i=AmazonS3">standard interface</a> has better latency.</p></li>
- <li><p><code>rmdir()</code> does not do a force-delete, so you will need to iterate over the files to delete them one-by-one.</p></li>
- <li><p><code>realpath()</code>, <code>glob()</code>, <code>chmod()</code>, <code>chown()</code>, <code>chgrp()</code>, <code>tempnam()</code> and a few other functions don&#8217;t support the StreamWrapper interface at the PHP-level because they're designed to work with the (no/low-latency) local file system.</p></li>
- <li><p>Support for <code>ftruncate()</code> does not exist in any current release of PHP, but is implemented on the PHP trunk for a future release. <a href="http://bugs.php.net/53888">http://bugs.php.net/53888</a>.</p></li>
- <li><p>Since <a href="http://docs.amazonwebservices.com/AmazonS3/latest/gsg/WorkingWithS3.html#WriteObject">Amazon S3 doesn&#8217;t support appending data</a>, it is best to avoid functions that expect or rely on that functionality (e.g. <a href="http://php.net/fputcsv">fputcsv()</a>).</p></li>
- </ul>
-
- <h2>Successfully tested with</h2>
- <ul class="columns">
- <li><a href="http://php.net/close_dir">close_dir()</a></li>
- <li><a href="http://php.net/file_exists">file_exists()</a></li>
- <li><a href="http://php.net/file_get_contents">file_get_contents()</a></li>
- <li><a href="http://php.net/file_put_contents">file_put_contents()</a></li>
- <li><a href="http://php.net/fclose">fclose()</a></li>
- <li><a href="http://php.net/feof">feof()</a></li>
- <li><a href="http://php.net/fflush">fflush()</a></li>
- <li><a href="http://php.net/fgetc">fgetc()</a></li>
- <li><a href="http://php.net/fgetcsv">fgetcsv()</a></li>
- <li><a href="http://php.net/fgets">fgets()</a></li>
- <li><a href="http://php.net/fgetss">fgetss()</a></li>
- <li><a href="http://php.net/fopen">fopen()</a></li>
- <li><a href="http://php.net/fpassthru">fpassthru()</a></li>
- <li><a href="http://php.net/fputs">fputs()</a></li>
- <li><a href="http://php.net/fread">fread()</a></li>
- <li><a href="http://php.net/fseek">fseek()</a></li>
- <li><a href="http://php.net/fstat">fstat()</a></li>
- <li><a href="http://php.net/ftell">ftell()</a></li>
- <li><a href="http://php.net/fwrite">fwrite()</a></li>
- <li><a href="http://php.net/is_dir">is_dir()</a></li>
- <li><a href="http://php.net/is_file">is_file()</a></li>
- <li><a href="http://php.net/is_readable">is_readable()</a></li>
- <li><a href="http://php.net/is_writable">is_writable()</a></li>
- <li><a href="http://php.net/mkdir">mkdir()</a></li>
- <li><a href="http://php.net/open_dir">open_dir()</a></li>
- <li><a href="http://php.net/read_dir">read_dir()</a></li>
- <li><a href="http://php.net/rewind">rewind()</a></li>
- <li><a href="http://php.net/rewinddir">rewinddir()</a></li>
- <li><a href="http://php.net/rmdir">rmdir()</a></li>
- <li><a href="http://php.net/scandir">scandir()</a></li>
- <li><a href="http://php.net/stream_get_contents">stream_get_contents()</a></li>
- <li><a href="http://php.net/unlink">unlink()</a></li>
- </ul>
-
- <h2>Known issues with</h2>
- <ul>
- <li><a href="http://php.net/chgrp">chgrp()</a></li>
- <li><a href="http://php.net/chmod">chmod()</a></li>
- <li><a href="http://php.net/chown">chown()</a></li>
- <li><a href="http://php.net/fputcsv">fputcsv()</a></li>
- <li><a href="http://php.net/glob">glob()</a></li>
- <li><a href="http://php.net/realpath">realpath()</a></li>
- <li><a href="http://php.net/tempnam">tempnam()</a></li>
- <li><a href="http://php.net/touch">touch()</a></li>
- </ul>
-
- <p>A future version <em>may</em> provide S3-specific implementations of some of these functions (e.g., <code>s3chmod()</code>, <code>s3glob()</code>, <code>s3touch()</code>).</p>
- </body>
-</html>
diff --git a/3rdparty/aws-sdk/_docs/WHERE_IS_THE_API_REFERENCE.md b/3rdparty/aws-sdk/_docs/WHERE_IS_THE_API_REFERENCE.md
deleted file mode 100644
index 7ad235576b4..00000000000
--- a/3rdparty/aws-sdk/_docs/WHERE_IS_THE_API_REFERENCE.md
+++ /dev/null
@@ -1,2 +0,0 @@
-You can find the API Reference at:
-http://docs.amazonwebservices.com/AWSSDKforPHP/latest/
diff --git a/3rdparty/aws-sdk/authentication/signable.interface.php b/3rdparty/aws-sdk/authentication/signable.interface.php
deleted file mode 100644
index 5316d16a815..00000000000
--- a/3rdparty/aws-sdk/authentication/signable.interface.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-/*
- * Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License").
- * You may not use this file except in compliance with the License.
- * A copy of the License is located at
- *
- * http://aws.amazon.com/apache2.0
- *
- * or in the "license" file accompanying this file. This file is distributed
- * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-
-/*%******************************************************************************************%*/
-// INTERFACE
-
-/**
- * The interface implemented by all signing classes.
- *
- * @version 2011.11.22
- * @license See the included NOTICE.md file for more information.
- * @copyright See the included NOTICE.md file for more information.
- * @link http://aws.amazon.com/php/ PHP Developer Center
- */
-interface Signable
-{
- /**
- * Constructs a new instance of the implementing class.
- *
- * @param string $endpoint (Required) The endpoint to direct the request to.
- * @param string $operation (Required) The operation to execute as a result of this request.
- * @param array $payload (Required) The options to use as part of the payload in the request.
- * @param CFCredential $credentials (Required) The credentials to use for signing and making requests.
- * @return void
- */
- public function __construct($endpoint, $operation, $payload, CFCredential $credentials);
-
- /**
- * Generates a cURL handle with all of the required authentication bits set.
- *
- * @return resource A cURL handle ready for executing.
- */
- public function authenticate();
-}
diff --git a/3rdparty/aws-sdk/authentication/signature_v2query.class.php b/3rdparty/aws-sdk/authentication/signature_v2query.class.php
deleted file mode 100644
index a91190e1a25..00000000000
--- a/3rdparty/aws-sdk/authentication/signature_v2query.class.php
+++ /dev/null
@@ -1,163 +0,0 @@
-<?php
-/*
- * Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License").
- * You may not use this file except in compliance with the License.
- * A copy of the License is located at
- *
- * http://aws.amazon.com/apache2.0
- *
- * or in the "license" file accompanying this file. This file is distributed
- * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-
-/*%******************************************************************************************%*/
-// CLASS
-
-/**
- * Implements support for Signature v2 (AWS Query).
- *
- * @version 2011.11.22
- * @license See the included NOTICE.md file for more information.
- * @copyright See the included NOTICE.md file for more information.
- * @link http://aws.amazon.com/php/ PHP Developer Center
- */
-class AuthV2Query extends Signer implements Signable
-{
- /**
- * Constructs a new instance of the <AuthV2Query> class.
- *
- * @param string $endpoint (Required) The endpoint to direct the request to.
- * @param string $operation (Required) The operation to execute as a result of this request.
- * @param array $payload (Required) The options to use as part of the payload in the request.
- * @param CFCredential $credentials (Required) The credentials to use for signing and making requests.
- * @return void
- */
- public function __construct($endpoint, $operation, $payload, CFCredential $credentials)
- {
- parent::__construct($endpoint, $operation, $payload, $credentials);
- }
-
- /**
- * Generates a cURL handle with all of the required authentication bits set.
- *
- * @return resource A cURL handle ready for executing.
- */
- public function authenticate()
- {
- // Determine signing values
- $current_time = time();
- $date = gmdate(CFUtilities::DATE_FORMAT_RFC2616, $current_time);
- $timestamp = gmdate(CFUtilities::DATE_FORMAT_ISO8601, $current_time);
- $query = array();
-
- // Do we have an authentication token?
- if ($this->auth_token)
- {
- $headers['X-Amz-Security-Token'] = $this->auth_token;
- $query['SecurityToken'] = $this->auth_token;
- }
-
- // Only add it if it exists.
- if ($this->api_version)
- {
- $query['Version'] = $this->api_version;
- }
-
- $query['Action'] = $this->operation;
- $query['AWSAccessKeyId'] = $this->key;
- $query['SignatureMethod'] = 'HmacSHA256';
- $query['SignatureVersion'] = 2;
- $query['Timestamp'] = $timestamp;
-
- // Merge in any options that were passed in
- if (is_array($this->payload))
- {
- $query = array_merge($query, $this->payload);
- }
-
- // Do a case-sensitive, natural order sort on the array keys.
- uksort($query, 'strcmp');
-
- // Create the string that needs to be hashed.
- $canonical_query_string = $this->util->to_signable_string($query);
-
- // Remove the default scheme from the domain.
- $domain = str_replace(array('http://', 'https://'), '', $this->endpoint);
-
- // Parse our request.
- $parsed_url = parse_url('http://' . $domain);
-
- // Set the proper host header.
- if (isset($parsed_url['port']) && (integer) $parsed_url['port'] !== 80 && (integer) $parsed_url['port'] !== 443)
- {
- $host_header = strtolower($parsed_url['host']) . ':' . $parsed_url['port'];
- }
- else
- {
- $host_header = strtolower($parsed_url['host']);
- }
-
- // Set the proper request URI.
- $request_uri = isset($parsed_url['path']) ? $parsed_url['path'] : '/';
-
- // Prepare the string to sign
- $this->string_to_sign = "POST\n$host_header\n$request_uri\n$canonical_query_string";
-
- // Hash the AWS secret key and generate a signature for the request.
- $query['Signature'] = base64_encode(hash_hmac('sha256', $this->string_to_sign, $this->secret_key, true));
-
- // Generate the querystring from $query
- $this->querystring = $this->util->to_query_string($query);
-
- // Gather information to pass along to other classes.
- $helpers = array(
- 'utilities' => $this->utilities_class,
- 'request' => $this->request_class,
- 'response' => $this->response_class,
- );
-
- // Compose the request.
- $request_url = ($this->use_ssl ? 'https://' : 'http://') . $domain;
- $request_url .= !isset($parsed_url['path']) ? '/' : '';
-
- // Instantiate the request class
- $request = new $this->request_class($request_url, $this->proxy, $helpers, $this->credentials);
- $request->set_method('POST');
- $request->set_body($this->querystring);
- $headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=utf-8';
-
- // Pass along registered stream callbacks
- if ($this->registered_streaming_read_callback)
- {
- $request->register_streaming_read_callback($this->registered_streaming_read_callback);
- }
-
- if ($this->registered_streaming_write_callback)
- {
- $request->register_streaming_write_callback($this->registered_streaming_write_callback);
- }
-
- // Sort headers
- uksort($headers, 'strnatcasecmp');
-
- // Add headers to request and compute the string to sign
- foreach ($headers as $header_key => $header_value)
- {
- // Strip linebreaks from header values as they're illegal and can allow for security issues
- $header_value = str_replace(array("\r", "\n"), '', $header_value);
-
- // Add the header if it has a value
- if ($header_value !== '')
- {
- $request->add_header($header_key, $header_value);
- }
- }
-
- return $request;
- }
-}
diff --git a/3rdparty/aws-sdk/authentication/signature_v3json.class.php b/3rdparty/aws-sdk/authentication/signature_v3json.class.php
deleted file mode 100644
index d07f554d1f7..00000000000
--- a/3rdparty/aws-sdk/authentication/signature_v3json.class.php
+++ /dev/null
@@ -1,235 +0,0 @@
-<?php
-/*
- * Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License").
- * You may not use this file except in compliance with the License.
- * A copy of the License is located at
- *
- * http://aws.amazon.com/apache2.0
- *
- * or in the "license" file accompanying this file. This file is distributed
- * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-
-/*%******************************************************************************************%*/
-// CLASS
-
-/**
- * Implements support for Signature v3 (JSON).
- *
- * @version 2011.12.08
- * @license See the included NOTICE.md file for more information.
- * @copyright See the included NOTICE.md file for more information.
- * @link http://aws.amazon.com/php/ PHP Developer Center
- */
-class AuthV3JSON extends Signer implements Signable
-{
- /**
- * Constructs a new instance of the <AuthV3JSON> class.
- *
- * @param string $endpoint (Required) The endpoint to direct the request to.
- * @param string $operation (Required) The operation to execute as a result of this request.
- * @param array $payload (Required) The options to use as part of the payload in the request.
- * @param CFCredential $credentials (Required) The credentials to use for signing and making requests.
- * @return void
- */
- public function __construct($endpoint, $operation, $payload, CFCredential $credentials)
- {
- parent::__construct($endpoint, $operation, $payload, $credentials);
- }
-
- /**
- * Generates a cURL handle with all of the required authentication bits set.
- *
- * @return resource A cURL handle ready for executing.
- */
- public function authenticate()
- {
- // Determine signing values
- $current_time = time();
- $date = gmdate(CFUtilities::DATE_FORMAT_RFC2616, $current_time);
- $timestamp = gmdate(CFUtilities::DATE_FORMAT_ISO8601, $current_time);
- $nonce = $this->util->generate_guid();
- $curlopts = array();
- $signed_headers = array();
- $return_curl_handle = false;
- $x_amz_target = null;
- $query = array('body' => $this->payload);
-
- // Do we have an authentication token?
- if ($this->auth_token)
- {
- $headers['X-Amz-Security-Token'] = $this->auth_token;
- $query['SecurityToken'] = $this->auth_token;
- }
-
- // Manage the key-value pairs that are used in the query.
- if (stripos($this->operation, 'x-amz-target') !== false)
- {
- $x_amz_target = trim(str_ireplace('x-amz-target:', '', $this->operation));
- }
- else
- {
- $query['Action'] = $this->operation;
- }
-
- // Only add it if it exists.
- if ($this->api_version)
- {
- $query['Version'] = $this->api_version;
- }
-
- $curlopts = array();
-
- // Set custom CURLOPT settings
- if (is_array($this->payload) && isset($this->payload['curlopts']))
- {
- $curlopts = $this->payload['curlopts'];
- unset($this->payload['curlopts']);
- }
-
- // Merge in any options that were passed in
- if (is_array($this->payload))
- {
- $query = array_merge($query, $this->payload);
- }
-
- $return_curl_handle = isset($query['returnCurlHandle']) ? $query['returnCurlHandle'] : false;
- unset($query['returnCurlHandle']);
-
- // Do a case-sensitive, natural order sort on the array keys.
- uksort($query, 'strcmp');
-
- // Normalize JSON input
- if (isset($query['body']) && $query['body'] === '[]')
- {
- $query['body'] = '{}';
- }
-
- // Create the string that needs to be hashed.
- $canonical_query_string = $this->util->encode_signature2($query['body']);
-
- // Remove the default scheme from the domain.
- $domain = str_replace(array('http://', 'https://'), '', $this->endpoint);
-
- // Parse our request.
- $parsed_url = parse_url('http://' . $domain);
-
- // Set the proper host header.
- if (isset($parsed_url['port']) && (integer) $parsed_url['port'] !== 80 && (integer) $parsed_url['port'] !== 443)
- {
- $host_header = strtolower($parsed_url['host']) . ':' . $parsed_url['port'];
- }
- else
- {
- $host_header = strtolower($parsed_url['host']);
- }
-
- // Set the proper request URI.
- $request_uri = isset($parsed_url['path']) ? $parsed_url['path'] : '/';
-
- // Generate the querystring from $query
- $this->querystring = $this->util->to_query_string($query);
-
- // Gather information to pass along to other classes.
- $helpers = array(
- 'utilities' => $this->utilities_class,
- 'request' => $this->request_class,
- 'response' => $this->response_class,
- );
-
- // Compose the request.
- $request_url = ($this->use_ssl ? 'https://' : 'http://') . $domain;
- $request_url .= !isset($parsed_url['path']) ? '/' : '';
-
- // Instantiate the request class
- $request = new $this->request_class($request_url, $this->proxy, $helpers, $this->credentials);
- $request->set_method('POST');
- //$request->set_body($this->querystring);
- //$headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=utf-8';
-
- // Signing using X-Amz-Target is handled differently.
- $headers['X-Amz-Target'] = $x_amz_target;
- $headers['Content-Type'] = 'application/x-amz-json-1.0';
- $request->set_body($query['body']);
- $this->querystring = $query['body'];
-
- // Pass along registered stream callbacks
- if ($this->registered_streaming_read_callback)
- {
- $request->register_streaming_read_callback($this->registered_streaming_read_callback);
- }
-
- if ($this->registered_streaming_write_callback)
- {
- $request->register_streaming_write_callback($this->registered_streaming_write_callback);
- }
-
- // Add authentication headers
- // $headers['X-Amz-Nonce'] = $nonce;
- $headers['Date'] = $date;
- $headers['Content-Length'] = strlen($this->querystring);
- $headers['Content-MD5'] = $this->util->hex_to_base64(md5($this->querystring));
- $headers['Host'] = $host_header;
-
- // Sort headers
- uksort($headers, 'strnatcasecmp');
-
- // Prepare the string to sign (HTTP)
- $this->string_to_sign = "POST\n$request_uri\n\n";
-
- // Add headers to request and compute the string to sign
- foreach ($headers as $header_key => $header_value)
- {
- // Strip linebreaks from header values as they're illegal and can allow for security issues
- $header_value = str_replace(array("\r", "\n"), '', $header_value);
-
- // Add the header if it has a value
- if ($header_value !== '')
- {
- $request->add_header($header_key, $header_value);
- }
-
- // Generate the string to sign
- if (
- substr(strtolower($header_key), 0, 8) === 'content-' ||
- strtolower($header_key) === 'date' ||
- strtolower($header_key) === 'expires' ||
- strtolower($header_key) === 'host' ||
- substr(strtolower($header_key), 0, 6) === 'x-amz-'
- )
- {
- $this->string_to_sign .= strtolower($header_key) . ':' . $header_value . "\n";
- $signed_headers[] = $header_key;
- }
- }
-
- $this->string_to_sign .= "\n";
-
- if (isset($query['body']) && $query['body'] !== '')
- {
- $this->string_to_sign .= $query['body'];
- }
-
- // Convert from string-to-sign to bytes-to-sign
- $bytes_to_sign = hash('sha256', $this->string_to_sign, true);
-
- // Hash the AWS secret key and generate a signature for the request.
- $signature = base64_encode(hash_hmac('sha256', $bytes_to_sign, $this->secret_key, true));
-
- $headers['X-Amzn-Authorization'] = 'AWS3'
- . ' AWSAccessKeyId=' . $this->key
- . ',Algorithm=HmacSHA256'
- . ',SignedHeaders=' . implode(';', $signed_headers)
- . ',Signature=' . $signature;
-
- $request->add_header('X-Amzn-Authorization', $headers['X-Amzn-Authorization']);
- $request->request_headers = $headers;
-
- return $request;
- }
-}
diff --git a/3rdparty/aws-sdk/authentication/signature_v3query.class.php b/3rdparty/aws-sdk/authentication/signature_v3query.class.php
deleted file mode 100644
index 04565f928ed..00000000000
--- a/3rdparty/aws-sdk/authentication/signature_v3query.class.php
+++ /dev/null
@@ -1,192 +0,0 @@
-<?php
-/*
- * Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License").
- * You may not use this file except in compliance with the License.
- * A copy of the License is located at
- *
- * http://aws.amazon.com/apache2.0
- *
- * or in the "license" file accompanying this file. This file is distributed
- * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-
-/*%******************************************************************************************%*/
-// CLASS
-
-/**
- * Implements support for Signature v3 (AWS Query).
- *
- * @version 2011.11.22
- * @license See the included NOTICE.md file for more information.
- * @copyright See the included NOTICE.md file for more information.
- * @link http://aws.amazon.com/php/ PHP Developer Center
- */
-class AuthV3Query extends Signer implements Signable
-{
- /**
- * Constructs a new instance of the <AuthV3Query> class.
- *
- * @param string $endpoint (Required) The endpoint to direct the request to.
- * @param string $operation (Required) The operation to execute as a result of this request.
- * @param array $payload (Required) The options to use as part of the payload in the request.
- * @param CFCredential $credentials (Required) The credentials to use for signing and making requests.
- * @return void
- */
- public function __construct($endpoint, $operation, $payload, CFCredential $credentials)
- {
- parent::__construct($endpoint, $operation, $payload, $credentials);
- }
-
- /**
- * Generates a cURL handle with all of the required authentication bits set.
- *
- * @return resource A cURL handle ready for executing.
- */
- public function authenticate()
- {
- // Determine signing values
- $current_time = time();
- $date = gmdate(CFUtilities::DATE_FORMAT_RFC2616, $current_time);
- $timestamp = gmdate(CFUtilities::DATE_FORMAT_ISO8601, $current_time);
- $nonce = $this->util->generate_guid();
- $curlopts = array();
- $signed_headers = array();
-
- // Do we have an authentication token?
- if ($this->auth_token)
- {
- $headers['X-Amz-Security-Token'] = $this->auth_token;
- $query['SecurityToken'] = $this->auth_token;
- }
-
- $query['Action'] = $this->operation;
- $query['Version'] = $this->api_version;
-
- // Set custom CURLOPT settings
- if (is_array($this->payload) && isset($this->payload['curlopts']))
- {
- $curlopts = $this->payload['curlopts'];
- unset($this->payload['curlopts']);
- }
-
- // Merge in any options that were passed in
- if (is_array($this->payload))
- {
- $query = array_merge($query, $this->payload);
- }
-
- $return_curl_handle = isset($query['returnCurlHandle']) ? $query['returnCurlHandle'] : false;
- unset($query['returnCurlHandle']);
-
- // Do a case-sensitive, natural order sort on the array keys.
- uksort($query, 'strcmp');
- $canonical_query_string = $this->util->to_signable_string($query);
-
- // Remove the default scheme from the domain.
- $domain = str_replace(array('http://', 'https://'), '', $this->endpoint);
-
- // Parse our request.
- $parsed_url = parse_url('http://' . $domain);
-
- // Set the proper host header.
- if (isset($parsed_url['port']) && (integer) $parsed_url['port'] !== 80 && (integer) $parsed_url['port'] !== 443)
- {
- $host_header = strtolower($parsed_url['host']) . ':' . $parsed_url['port'];
- }
- else
- {
- $host_header = strtolower($parsed_url['host']);
- }
-
- // Set the proper request URI.
- $request_uri = isset($parsed_url['path']) ? $parsed_url['path'] : '/';
-
- // Generate the querystring from $query
- $this->querystring = $this->util->to_query_string($query);
-
- // Gather information to pass along to other classes.
- $helpers = array(
- 'utilities' => $this->utilities_class,
- 'request' => $this->request_class,
- 'response' => $this->response_class,
- );
-
- // Compose the request.
- $request_url = ($this->use_ssl ? 'https://' : 'http://') . $domain;
- $request_url .= !isset($parsed_url['path']) ? '/' : '';
-
- // Instantiate the request class
- $request = new $this->request_class($request_url, $this->proxy, $helpers, $this->credentials);
- $request->set_method('POST');
- $request->set_body($this->querystring);
- $headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=utf-8';
-
- // Pass along registered stream callbacks
- if ($this->registered_streaming_read_callback)
- {
- $request->register_streaming_read_callback($this->registered_streaming_read_callback);
- }
-
- if ($this->registered_streaming_write_callback)
- {
- $request->register_streaming_write_callback($this->registered_streaming_write_callback);
- }
-
- // Add authentication headers
- $headers['X-Amz-Nonce'] = $nonce;
- $headers['Date'] = $date;
- $headers['Content-Length'] = strlen($this->querystring);
- $headers['Content-MD5'] = $this->util->hex_to_base64(md5($this->querystring));
- $headers['Host'] = $host_header;
-
- // Sort headers
- uksort($headers, 'strnatcasecmp');
-
- // Prepare the string to sign (HTTPS)
- $this->string_to_sign = $date . $nonce;
-
- // Add headers to request and compute the string to sign
- foreach ($headers as $header_key => $header_value)
- {
- // Strip linebreaks from header values as they're illegal and can allow for security issues
- $header_value = str_replace(array("\r", "\n"), '', $header_value);
-
- // Add the header if it has a value
- if ($header_value !== '')
- {
- $request->add_header($header_key, $header_value);
- }
-
- // Generate the string to sign
- if (
- substr(strtolower($header_key), 0, 8) === 'content-' ||
- strtolower($header_key) === 'date' ||
- strtolower($header_key) === 'expires' ||
- strtolower($header_key) === 'host' ||
- substr(strtolower($header_key), 0, 6) === 'x-amz-'
- )
- {
- $signed_headers[] = $header_key;
- }
- }
-
- // Hash the AWS secret key and generate a signature for the request.
- $signature = base64_encode(hash_hmac('sha256', $this->string_to_sign, $this->secret_key, true));
-
- $headers['X-Amzn-Authorization'] = 'AWS3-HTTPS'
- . ' AWSAccessKeyId=' . $this->key
- . ',Algorithm=HmacSHA256'
- . ',SignedHeaders=' . implode(';', $signed_headers)
- . ',Signature=' . $signature;
-
- $request->add_header('X-Amzn-Authorization', $headers['X-Amzn-Authorization']);
- $request->request_headers = $headers;
-
- return $request;
- }
-}
diff --git a/3rdparty/aws-sdk/authentication/signature_v4json.class.php b/3rdparty/aws-sdk/authentication/signature_v4json.class.php
deleted file mode 100644
index d3ab07ad8bf..00000000000
--- a/3rdparty/aws-sdk/authentication/signature_v4json.class.php
+++ /dev/null
@@ -1,353 +0,0 @@
-<?php
-/*
- * Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License").
- * You may not use this file except in compliance with the License.
- * A copy of the License is located at
- *
- * http://aws.amazon.com/apache2.0
- *
- * or in the "license" file accompanying this file. This file is distributed
- * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-
-/*%******************************************************************************************%*/
-// CLASS
-
-/**
- * Implements support for Signature v4 (Query).
- *
- * @version 2011.01.03
- * @license See the included NOTICE.md file for more information.
- * @copyright See the included NOTICE.md file for more information.
- * @link http://aws.amazon.com/php/ PHP Developer Center
- */
-class AuthV4JSON extends Signer implements Signable
-{
- /**
- * Constructs a new instance of the <AuthV4Query> class.
- *
- * @param string $endpoint (Required) The endpoint to direct the request to.
- * @param string $operation (Required) The operation to execute as a result of this request.
- * @param array $payload (Required) The options to use as part of the payload in the request.
- * @param CFCredential $credentials (Required) The credentials to use for signing and making requests.
- * @return void
- */
- public function __construct($endpoint, $operation, $payload, CFCredential $credentials)
- {
- parent::__construct($endpoint, $operation, $payload, $credentials);
- }
-
- /**
- * Generates a cURL handle with all of the required authentication bits set.
- *
- * @return resource A cURL handle ready for executing.
- */
- public function authenticate()
- {
- // Determine signing values
- $current_time = time();
- $timestamp = gmdate(CFUtilities::DATE_FORMAT_SIGV4, $current_time);
-
- // Initialize
- $x_amz_target = null;
-
- $this->headers = array();
- $this->signed_headers = array();
- $this->canonical_headers = array();
- $this->query = array();
-
- // Prepare JSON structure
- $decoded = json_decode($this->payload, true);
- $data = (array) (is_array($decoded) ? $decoded : $this->payload);
- unset($data['curlopts']);
- unset($data['returnCurlHandle']);
- $this->body = json_encode($data);
- if ($this->body === '' || $this->body === '[]')
- {
- $this->body = '{}';
- }
-
- // Do we have an authentication token?
- if ($this->auth_token)
- {
- $this->headers['X-Amz-Security-Token'] = $this->auth_token;
- $this->query['SecurityToken'] = $this->auth_token;
- }
-
- // Manage the key-value pairs that are used in the query.
- if (stripos($this->operation, 'x-amz-target') !== false)
- {
- $x_amz_target = trim(str_ireplace('x-amz-target:', '', $this->operation));
- }
- else
- {
- $this->query['Action'] = $this->operation;
- }
-
- // Only add it if it exists.
- if ($this->api_version)
- {
- $this->query['Version'] = $this->api_version;
- }
-
- // Do a case-sensitive, natural order sort on the array keys.
- uksort($this->query, 'strcmp');
-
- // Remove the default scheme from the domain.
- $domain = str_replace(array('http://', 'https://'), '', $this->endpoint);
-
- // Parse our request.
- $parsed_url = parse_url('http://' . $domain);
-
- // Set the proper host header.
- if (isset($parsed_url['port']) && (integer) $parsed_url['port'] !== 80 && (integer) $parsed_url['port'] !== 443)
- {
- $host_header = strtolower($parsed_url['host']) . ':' . $parsed_url['port'];
- }
- else
- {
- $host_header = strtolower($parsed_url['host']);
- }
-
- // Generate the querystring from $this->query
- $this->querystring = $this->util->to_query_string($this->query);
-
- // Gather information to pass along to other classes.
- $helpers = array(
- 'utilities' => $this->utilities_class,
- 'request' => $this->request_class,
- 'response' => $this->response_class,
- );
-
- // Compose the request.
- $request_url = ($this->use_ssl ? 'https://' : 'http://') . $domain;
- $request_url .= !isset($parsed_url['path']) ? '/' : '';
-
- // Instantiate the request class
- $request = new $this->request_class($request_url, $this->proxy, $helpers, $this->credentials);
- $request->set_method('POST');
- $request->set_body($this->body);
- $this->querystring = $this->body;
- $this->headers['Content-Type'] = 'application/x-amz-json-1.1';
- $this->headers['X-Amz-Target'] = $x_amz_target;
-
- // Pass along registered stream callbacks
- if ($this->registered_streaming_read_callback)
- {
- $request->register_streaming_read_callback($this->registered_streaming_read_callback);
- }
-
- if ($this->registered_streaming_write_callback)
- {
- $request->register_streaming_write_callback($this->registered_streaming_write_callback);
- }
-
- // Add authentication headers
- $this->headers['X-Amz-Date'] = $timestamp;
- $this->headers['Content-Length'] = strlen($this->querystring);
- $this->headers['Host'] = $host_header;
-
- // Sort headers
- uksort($this->headers, 'strnatcasecmp');
-
- // Add headers to request and compute the string to sign
- foreach ($this->headers as $header_key => $header_value)
- {
- // Strip linebreaks from header values as they're illegal and can allow for security issues
- $header_value = str_replace(array("\r", "\n"), '', $header_value);
-
- $request->add_header($header_key, $header_value);
- $this->canonical_headers[] = strtolower($header_key) . ':' . $header_value;
-
- $this->signed_headers[] = strtolower($header_key);
- }
-
- $this->headers['Authorization'] = $this->authorization($timestamp);
- $request->add_header('Authorization', $this->headers['Authorization']);
- $request->request_headers = $this->headers;
-
- return $request;
- }
-
- /**
- * Generates the authorization string to use for the request.
- *
- * @param string $datetime (Required) The current timestamp.
- * @return string The authorization string.
- */
- protected function authorization($datetime)
- {
- $access_key_id = $this->key;
-
- $parts = array();
- $parts[] = "AWS4-HMAC-SHA256 Credential=${access_key_id}/" . $this->credential_string($datetime);
- $parts[] = 'SignedHeaders=' . implode(';', $this->signed_headers);
- $parts[] = 'Signature=' . $this->hex16($this->signature($datetime));
-
- return implode(',', $parts);
- }
-
- /**
- * Calculate the signature.
- *
- * @param string $datetime (Required) The current timestamp.
- * @return string The signature.
- */
- protected function signature($datetime)
- {
- $k_date = $this->hmac('AWS4' . $this->secret_key, substr($datetime, 0, 8));
- $k_region = $this->hmac($k_date, $this->region());
- $k_service = $this->hmac($k_region, $this->service());
- $k_credentials = $this->hmac($k_service, 'aws4_request');
- $signature = $this->hmac($k_credentials, $this->string_to_sign($datetime));
-
- return $signature;
- }
-
- /**
- * Calculate the string to sign.
- *
- * @param string $datetime (Required) The current timestamp.
- * @return string The string to sign.
- */
- protected function string_to_sign($datetime)
- {
- $parts = array();
- $parts[] = 'AWS4-HMAC-SHA256';
- $parts[] = $datetime;
- $parts[] = $this->credential_string($datetime);
- $parts[] = $this->hex16($this->hash($this->canonical_request()));
-
- $this->string_to_sign = implode("\n", $parts);
-
- return $this->string_to_sign;
- }
-
- /**
- * Generates the credential string to use for signing.
- *
- * @param string $datetime (Required) The current timestamp.
- * @return string The credential string.
- */
- protected function credential_string($datetime)
- {
- $parts = array();
- $parts[] = substr($datetime, 0, 8);
- $parts[] = $this->region();
- $parts[] = $this->service();
- $parts[] = 'aws4_request';
-
- return implode('/', $parts);
- }
-
- /**
- * Calculate the canonical request.
- *
- * @return string The canonical request.
- */
- protected function canonical_request()
- {
- $parts = array();
- $parts[] = 'POST';
- $parts[] = $this->canonical_uri();
- $parts[] = ''; // $parts[] = $this->canonical_querystring();
- $parts[] = implode("\n", $this->canonical_headers) . "\n";
- $parts[] = implode(';', $this->signed_headers);
- $parts[] = $this->hex16($this->hash($this->body));
-
- $this->canonical_request = implode("\n", $parts);
-
- return $this->canonical_request;
- }
-
- /**
- * The region ID to use in the signature.
- *
- * @return return The region ID.
- */
- protected function region()
- {
- $pieces = explode('.', $this->endpoint);
-
- // Handle cases with single/no region (i.e. service.region.amazonaws.com vs. service.amazonaws.com)
- if (count($pieces < 4))
- {
- return 'us-east-1';
- }
-
- return $pieces[1];
- }
-
- /**
- * The service ID to use in the signature.
- *
- * @return return The service ID.
- */
- protected function service()
- {
- $pieces = explode('.', $this->endpoint);
- return $pieces[0];
- }
-
- /**
- * The request URI path.
- *
- * @return string The request URI path.
- */
- protected function canonical_uri()
- {
- return '/';
- }
-
- /**
- * The canonical query string.
- *
- * @return string The canonical query string.
- */
- protected function canonical_querystring()
- {
- if (!isset($this->canonical_querystring))
- {
- $this->canonical_querystring = $this->util->to_signable_string($this->query);
- }
-
- return $this->canonical_querystring;
- }
-
- /**
- * Hex16-pack the data.
- *
- * @param string $value (Required) The data to hex16 pack.
- * @return string The hex16-packed data.
- */
- protected function hex16($value)
- {
- $result = unpack('H*', $value);
- return reset($result);
- }
-
- /**
- * Applies HMAC SHA-256 encryption to the string, salted by the key.
- *
- * @return string Raw HMAC SHA-256 hashed string.
- */
- protected function hmac($key, $string)
- {
- return hash_hmac('sha256', $string, $key, true);
- }
-
- /**
- * SHA-256 hashes the string.
- *
- * @return string Raw SHA-256 hashed string.
- */
- protected function hash($string)
- {
- return hash('sha256', $string, true);
- }
-}
diff --git a/3rdparty/aws-sdk/authentication/signature_v4query.class.php b/3rdparty/aws-sdk/authentication/signature_v4query.class.php
deleted file mode 100644
index bd5a3fbf5b5..00000000000
--- a/3rdparty/aws-sdk/authentication/signature_v4query.class.php
+++ /dev/null
@@ -1,345 +0,0 @@
-<?php
-/*
- * Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License").
- * You may not use this file except in compliance with the License.
- * A copy of the License is located at
- *
- * http://aws.amazon.com/apache2.0
- *
- * or in the "license" file accompanying this file. This file is distributed
- * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-
-/*%******************************************************************************************%*/
-// CLASS
-
-/**
- * Implements support for Signature v4 (Query).
- *
- * @version 2011.01.03
- * @license See the included NOTICE.md file for more information.
- * @copyright See the included NOTICE.md file for more information.
- * @link http://aws.amazon.com/php/ PHP Developer Center
- */
-class AuthV4Query extends Signer implements Signable
-{
- /**
- * Constructs a new instance of the <AuthV4Query> class.
- *
- * @param string $endpoint (Required) The endpoint to direct the request to.
- * @param string $operation (Required) The operation to execute as a result of this request.
- * @param array $payload (Required) The options to use as part of the payload in the request.
- * @param CFCredential $credentials (Required) The credentials to use for signing and making requests.
- * @return void
- */
- public function __construct($endpoint, $operation, $payload, CFCredential $credentials)
- {
- parent::__construct($endpoint, $operation, $payload, $credentials);
- }
-
- /**
- * Generates a cURL handle with all of the required authentication bits set.
- *
- * @return resource A cURL handle ready for executing.
- */
- public function authenticate()
- {
- // Determine signing values
- $current_time = time();
- $timestamp = gmdate(CFUtilities::DATE_FORMAT_SIGV4, $current_time);
-
- // Initialize
- $x_amz_target = null;
-
- $this->headers = array();
- $this->signed_headers = array();
- $this->canonical_headers = array();
- $this->query = array('body' => is_array($this->payload) ? $this->payload : array());
-
- // Do we have an authentication token?
- if ($this->auth_token)
- {
- $this->headers['X-Amz-Security-Token'] = $this->auth_token;
- $this->query['body']['SecurityToken'] = $this->auth_token;
- }
-
- // Manage the key-value pairs that are used in the query.
- if (stripos($this->operation, 'x-amz-target') !== false)
- {
- $x_amz_target = trim(str_ireplace('x-amz-target:', '', $this->operation));
- }
- else
- {
- $this->query['body']['Action'] = $this->operation;
- }
-
- // Only add it if it exists.
- if ($this->api_version)
- {
- $this->query['body']['Version'] = $this->api_version;
- }
-
- // Do a case-sensitive, natural order sort on the array keys.
- uksort($this->query['body'], 'strcmp');
-
- // Remove the default scheme from the domain.
- $domain = str_replace(array('http://', 'https://'), '', $this->endpoint);
-
- // Parse our request.
- $parsed_url = parse_url('http://' . $domain);
-
- // Set the proper host header.
- if (isset($parsed_url['port']) && (integer) $parsed_url['port'] !== 80 && (integer) $parsed_url['port'] !== 443)
- {
- $host_header = strtolower($parsed_url['host']) . ':' . $parsed_url['port'];
- }
- else
- {
- $host_header = strtolower($parsed_url['host']);
- }
-
- // Generate the querystring from $this->query
- $this->querystring = $this->util->to_query_string($this->query);
-
- // Gather information to pass along to other classes.
- $helpers = array(
- 'utilities' => $this->utilities_class,
- 'request' => $this->request_class,
- 'response' => $this->response_class,
- );
-
- // Compose the request.
- $request_url = ($this->use_ssl ? 'https://' : 'http://') . $domain;
- $request_url .= !isset($parsed_url['path']) ? '/' : '';
-
- // Instantiate the request class
- $request = new $this->request_class($request_url, $this->proxy, $helpers, $this->credentials);
- $request->set_method('POST');
- $request->set_body($this->canonical_querystring());
- $this->querystring = $this->canonical_querystring();
-
- $this->headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=utf-8';
- $this->headers['X-Amz-Target'] = $x_amz_target;
-
- // Pass along registered stream callbacks
- if ($this->registered_streaming_read_callback)
- {
- $request->register_streaming_read_callback($this->registered_streaming_read_callback);
- }
-
- if ($this->registered_streaming_write_callback)
- {
- $request->register_streaming_write_callback($this->registered_streaming_write_callback);
- }
-
- // Add authentication headers
- $this->headers['X-Amz-Date'] = $timestamp;
- $this->headers['Content-Length'] = strlen($this->querystring);
- $this->headers['Content-MD5'] = $this->util->hex_to_base64(md5($this->querystring));
- $this->headers['Host'] = $host_header;
-
- // Sort headers
- uksort($this->headers, 'strnatcasecmp');
-
- // Add headers to request and compute the string to sign
- foreach ($this->headers as $header_key => $header_value)
- {
- // Strip linebreaks from header values as they're illegal and can allow for security issues
- $header_value = str_replace(array("\r", "\n"), '', $header_value);
-
- $request->add_header($header_key, $header_value);
- $this->canonical_headers[] = strtolower($header_key) . ':' . $header_value;
-
- $this->signed_headers[] = strtolower($header_key);
- }
-
- $this->headers['Authorization'] = $this->authorization($timestamp);
-
- $request->add_header('Authorization', $this->headers['Authorization']);
- $request->request_headers = $this->headers;
-
- return $request;
- }
-
- /**
- * Generates the authorization string to use for the request.
- *
- * @param string $datetime (Required) The current timestamp.
- * @return string The authorization string.
- */
- protected function authorization($datetime)
- {
- $access_key_id = $this->key;
-
- $parts = array();
- $parts[] = "AWS4-HMAC-SHA256 Credential=${access_key_id}/" . $this->credential_string($datetime);
- $parts[] = 'SignedHeaders=' . implode(';', $this->signed_headers);
- $parts[] = 'Signature=' . $this->hex16($this->signature($datetime));
-
- return implode(',', $parts);
- }
-
- /**
- * Calculate the signature.
- *
- * @param string $datetime (Required) The current timestamp.
- * @return string The signature.
- */
- protected function signature($datetime)
- {
- $k_date = $this->hmac('AWS4' . $this->secret_key, substr($datetime, 0, 8));
- $k_region = $this->hmac($k_date, $this->region());
- $k_service = $this->hmac($k_region, $this->service());
- $k_credentials = $this->hmac($k_service, 'aws4_request');
- $signature = $this->hmac($k_credentials, $this->string_to_sign($datetime));
-
- return $signature;
- }
-
- /**
- * Calculate the string to sign.
- *
- * @param string $datetime (Required) The current timestamp.
- * @return string The string to sign.
- */
- protected function string_to_sign($datetime)
- {
- $parts = array();
- $parts[] = 'AWS4-HMAC-SHA256';
- $parts[] = $datetime;
- $parts[] = $this->credential_string($datetime);
- $parts[] = $this->hex16($this->hash($this->canonical_request()));
-
- $this->string_to_sign = implode("\n", $parts);
-
- return $this->string_to_sign;
- }
-
- /**
- * Generates the credential string to use for signing.
- *
- * @param string $datetime (Required) The current timestamp.
- * @return string The credential string.
- */
- protected function credential_string($datetime)
- {
- $parts = array();
- $parts[] = substr($datetime, 0, 8);
- $parts[] = $this->region();
- $parts[] = $this->service();
- $parts[] = 'aws4_request';
-
- return implode('/', $parts);
- }
-
- /**
- * Calculate the canonical request.
- *
- * @return string The canonical request.
- */
- protected function canonical_request()
- {
- $parts = array();
- $parts[] = 'POST';
- $parts[] = $this->canonical_uri();
- $parts[] = ''; // $parts[] = $this->canonical_querystring();
- $parts[] = implode("\n", $this->canonical_headers) . "\n";
- $parts[] = implode(';', $this->signed_headers);
- $parts[] = $this->hex16($this->hash($this->canonical_querystring()));
-
- $this->canonical_request = implode("\n", $parts);
-
- return $this->canonical_request;
- }
-
- /**
- * The region ID to use in the signature.
- *
- * @return return The region ID.
- */
- protected function region()
- {
- $pieces = explode('.', $this->endpoint);
-
- // Handle cases with single/no region (i.e. service.region.amazonaws.com vs. service.amazonaws.com)
- if (count($pieces < 4))
- {
- return 'us-east-1';
- }
-
- return $pieces[1];
- }
-
- /**
- * The service ID to use in the signature.
- *
- * @return return The service ID.
- */
- protected function service()
- {
- $pieces = explode('.', $this->endpoint);
- return ($pieces[0] === 'email') ? 'ses' : $pieces[0];
- }
-
- /**
- * The request URI path.
- *
- * @return string The request URI path.
- */
- protected function canonical_uri()
- {
- return '/';
- }
-
- /**
- * The canonical query string.
- *
- * @return string The canonical query string.
- */
- protected function canonical_querystring()
- {
- if (!isset($this->canonical_querystring))
- {
- $this->canonical_querystring = $this->util->to_signable_string($this->query['body']);
- }
-
- return $this->canonical_querystring;
- }
-
- /**
- * Hex16-pack the data.
- *
- * @param string $value (Required) The data to hex16 pack.
- * @return string The hex16-packed data.
- */
- protected function hex16($value)
- {
- $result = unpack('H*', $value);
- return reset($result);
- }
-
- /**
- * Applies HMAC SHA-256 encryption to the string, salted by the key.
- *
- * @return string Raw HMAC SHA-256 hashed string.
- */
- protected function hmac($key, $string)
- {
- return hash_hmac('sha256', $string, $key, true);
- }
-
- /**
- * SHA-256 hashes the string.
- *
- * @return string Raw SHA-256 hashed string.
- */
- protected function hash($string)
- {
- return hash('sha256', $string, true);
- }
-}
diff --git a/3rdparty/aws-sdk/authentication/signer.abstract.php b/3rdparty/aws-sdk/authentication/signer.abstract.php
deleted file mode 100644
index f6bf7912f7b..00000000000
--- a/3rdparty/aws-sdk/authentication/signer.abstract.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-/*
- * Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License").
- * You may not use this file except in compliance with the License.
- * A copy of the License is located at
- *
- * http://aws.amazon.com/apache2.0
- *
- * or in the "license" file accompanying this file. This file is distributed
- * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-
-/*%******************************************************************************************%*/
-// CLASS
-
-/**
- * The abstract class that serves as the base class that signer classes extend.
- *
- * @version 2011.11.22
- * @license See the included NOTICE.md file for more information.
- * @copyright See the included NOTICE.md file for more information.
- * @link http://aws.amazon.com/php/ PHP Developer Center
- */
-abstract class Signer
-{
- /**
- * The endpoint to direct the request to.
- */
- public $endpoint;
-
- /**
- * The operation to execute as a result of this request.
- */
- public $operation;
-
- /**
- * The options to use as part of the payload in the request.
- */
- public $payload;
-
- /**
- * The credentials to use for signing and making requests.
- */
- public $credentials;
-
-
- /**
- * Constructs a new instance of the implementing class.
- *
- * @param string $endpoint (Required) The endpoint to direct the request to.
- * @param string $operation (Required) The operation to execute as a result of this request.
- * @param array $payload (Required) The options to use as part of the payload in the request.
- * @param CFCredential $credentials (Required) The credentials to use for signing and making requests.
- * @return void
- */
- public function __construct($endpoint, $operation, $payload, CFCredential $credentials)
- {
- $this->endpoint = $endpoint;
- $this->operation = $operation;
- $this->payload = $payload;
- $this->credentials = $credentials;
- }
-}
diff --git a/3rdparty/aws-sdk/lib/cachecore/LICENSE b/3rdparty/aws-sdk/lib/cachecore/LICENSE
deleted file mode 100755
index 49b38bd620a..00000000000
--- a/3rdparty/aws-sdk/lib/cachecore/LICENSE
+++ /dev/null
@@ -1,25 +0,0 @@
-Copyright (c) 2006-2010 Ryan Parman, Foleeo Inc., and contributors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are
-permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this list of
- conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice, this list
- of conditions and the following disclaimer in the documentation and/or other materials
- provided with the distribution.
-
- * Neither the name of Ryan Parman, Foleeo Inc. nor the names of its contributors may be used to
- endorse or promote products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
-OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
-AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
diff --git a/3rdparty/aws-sdk/lib/cachecore/README b/3rdparty/aws-sdk/lib/cachecore/README
deleted file mode 100755
index 07e00267cbb..00000000000
--- a/3rdparty/aws-sdk/lib/cachecore/README
+++ /dev/null
@@ -1 +0,0 @@
-A simple caching system for PHP5 that provides a single interface for a variety of storage types.
diff --git a/3rdparty/aws-sdk/lib/cachecore/_sql/README b/3rdparty/aws-sdk/lib/cachecore/_sql/README
deleted file mode 100755
index e25d53d1208..00000000000
--- a/3rdparty/aws-sdk/lib/cachecore/_sql/README
+++ /dev/null
@@ -1,5 +0,0 @@
-The .sql files in this directory contain the code to create the tables for database caching.
-
-If you're not using database caching, you can safely ignore these.
-
-If you ARE using database caching, simply load the correct *.sql file into your database to set up the required tables.
diff --git a/3rdparty/aws-sdk/lib/cachecore/_sql/mysql.sql b/3rdparty/aws-sdk/lib/cachecore/_sql/mysql.sql
deleted file mode 100755
index 2efee3a732f..00000000000
--- a/3rdparty/aws-sdk/lib/cachecore/_sql/mysql.sql
+++ /dev/null
@@ -1,7 +0,0 @@
-CREATE TABLE `cache` (
- `id` char(40) NOT NULL default '',
- `expires` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
- `data` longtext,
- PRIMARY KEY (`id`),
- UNIQUE KEY `id` (`id`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 \ No newline at end of file
diff --git a/3rdparty/aws-sdk/lib/cachecore/_sql/pgsql.sql b/3rdparty/aws-sdk/lib/cachecore/_sql/pgsql.sql
deleted file mode 100755
index f2bdd86a528..00000000000
--- a/3rdparty/aws-sdk/lib/cachecore/_sql/pgsql.sql
+++ /dev/null
@@ -1,6 +0,0 @@
-CREATE TABLE "cache" (
- expires timestamp without time zone NOT NULL,
- id character(40) NOT NULL,
- data text NOT NULL
-)
-WITH (OIDS=TRUE); \ No newline at end of file
diff --git a/3rdparty/aws-sdk/lib/cachecore/_sql/sqlite3.sql b/3rdparty/aws-sdk/lib/cachecore/_sql/sqlite3.sql
deleted file mode 100755
index 590f45e4ff1..00000000000
--- a/3rdparty/aws-sdk/lib/cachecore/_sql/sqlite3.sql
+++ /dev/null
@@ -1,2 +0,0 @@
-CREATE TABLE cache (id TEXT, expires NUMERIC, data BLOB);
-CREATE UNIQUE INDEX idx ON cache(id ASC); \ No newline at end of file
diff --git a/3rdparty/aws-sdk/lib/cachecore/cacheapc.class.php b/3rdparty/aws-sdk/lib/cachecore/cacheapc.class.php
deleted file mode 100755
index 59f5e88f397..00000000000
--- a/3rdparty/aws-sdk/lib/cachecore/cacheapc.class.php
+++ /dev/null
@@ -1,126 +0,0 @@
-<?php
-/**
- * Container for all APC-based cache methods. Inherits additional methods from <CacheCore>. Adheres
- * to the ICacheCore interface.
- *
- * @version 2012.04.17
- * @copyright 2006-2012 Ryan Parman
- * @copyright 2006-2010 Foleeo, Inc.
- * @copyright 2012 Amazon.com, Inc. or its affiliates.
- * @copyright 2008-2010 Contributors
- * @license http://opensource.org/licenses/bsd-license.php Simplified BSD License
- * @link http://github.com/skyzyx/cachecore CacheCore
- * @link http://getcloudfusion.com CloudFusion
- * @link http://php.net/apc APC
- */
-class CacheAPC extends CacheCore implements ICacheCore
-{
-
- /*%******************************************************************************************%*/
- // CONSTRUCTOR
-
- /**
- * Constructs a new instance of this class.
- *
- * @param string $name (Required) A name to uniquely identify the cache object.
- * @param string $location (Optional) The location to store the cache object in. This may vary by cache method. The default value is NULL.
- * @param integer $expires (Optional) The number of seconds until a cache object is considered stale. The default value is 0.
- * @param boolean $gzip (Optional) Whether data should be gzipped before being stored. The default value is true.
- * @return object Reference to the cache object.
- */
- public function __construct($name, $location = null, $expires = 0, $gzip = true)
- {
- parent::__construct($name, null, $expires, $gzip);
- $this->id = $this->name;
- }
-
- /**
- * Creates a new cache.
- *
- * @param mixed $data (Required) The data to cache.
- * @return boolean Whether the operation was successful.
- */
- public function create($data)
- {
- $data = serialize($data);
- $data = $this->gzip ? gzcompress($data) : $data;
-
- return apc_add($this->id, $data, $this->expires);
- }
-
- /**
- * Reads a cache.
- *
- * @return mixed Either the content of the cache object, or boolean `false`.
- */
- public function read()
- {
- if ($data = apc_fetch($this->id))
- {
- $data = $this->gzip ? gzuncompress($data) : $data;
- return unserialize($data);
- }
-
- return false;
- }
-
- /**
- * Updates an existing cache.
- *
- * @param mixed $data (Required) The data to cache.
- * @return boolean Whether the operation was successful.
- */
- public function update($data)
- {
- $data = serialize($data);
- $data = $this->gzip ? gzcompress($data) : $data;
-
- return apc_store($this->id, $data, $this->expires);
- }
-
- /**
- * Deletes a cache.
- *
- * @return boolean Whether the operation was successful.
- */
- public function delete()
- {
- return apc_delete($this->id);
- }
-
- /**
- * Implemented here, but always returns `false`. APC manages its own expirations.
- *
- * @return boolean Whether the cache is expired or not.
- */
- public function is_expired()
- {
- return false;
- }
-
- /**
- * Implemented here, but always returns `false`. APC manages its own expirations.
- *
- * @return mixed Either the Unix time stamp of the cache creation, or boolean `false`.
- */
- public function timestamp()
- {
- return false;
- }
-
- /**
- * Implemented here, but always returns `false`. APC manages its own expirations.
- *
- * @return boolean Whether the operation was successful.
- */
- public function reset()
- {
- return false;
- }
-}
-
-
-/*%******************************************************************************************%*/
-// EXCEPTIONS
-
-class CacheAPC_Exception extends CacheCore_Exception {}
diff --git a/3rdparty/aws-sdk/lib/cachecore/cachecore.class.php b/3rdparty/aws-sdk/lib/cachecore/cachecore.class.php
deleted file mode 100755
index 1670d316408..00000000000
--- a/3rdparty/aws-sdk/lib/cachecore/cachecore.class.php
+++ /dev/null
@@ -1,160 +0,0 @@
-<?php
-/**
- * Container for all shared caching methods. This is not intended to be instantiated directly, but is
- * extended by the cache-specific classes.
- *
- * @version 2012.04.17
- * @copyright 2006-2012 Ryan Parman
- * @copyright 2006-2010 Foleeo, Inc.
- * @copyright 2012 Amazon.com, Inc. or its affiliates.
- * @copyright 2008-2010 Contributors
- * @license http://opensource.org/licenses/bsd-license.php Simplified BSD License
- * @link http://github.com/skyzyx/cachecore CacheCore
- * @link http://getcloudfusion.com CloudFusion
- */
-class CacheCore
-{
- /**
- * A name to uniquely identify the cache object by.
- */
- var $name;
-
- /**
- * Where to store the cache.
- */
- var $location;
-
- /**
- * The number of seconds before a cache object is considered stale.
- */
- var $expires;
-
- /**
- * Used internally to uniquely identify the location + name of the cache object.
- */
- var $id;
-
- /**
- * Stores the time when the cache object was created.
- */
- var $timestamp;
-
- /**
- * Stores whether or not the content should be gzipped when stored
- */
- var $gzip;
-
-
- /*%******************************************************************************************%*/
- // CONSTRUCTOR
-
- /**
- * Constructs a new instance of this class.
- *
- * @param string $name (Required) A name to uniquely identify the cache object.
- * @param string $location (Optional) The location to store the cache object in. This may vary by cache method. The default value is NULL.
- * @param integer $expires (Optional) The number of seconds until a cache object is considered stale. The default value is 0.
- * @param boolean $gzip (Optional) Whether data should be gzipped before being stored. The default value is true.
- * @return object Reference to the cache object.
- */
- public function __construct($name, $location = null, $expires = 0, $gzip = true)
- {
- if (!extension_loaded('zlib'))
- {
- $gzip = false;
- }
-
- $this->name = $name;
- $this->location = $location;
- $this->expires = $expires;
- $this->gzip = $gzip;
-
- return $this;
- }
-
- /**
- * Allows for chaining from the constructor. Requires PHP 5.3 or newer.
- *
- * @param string $name (Required) A name to uniquely identify the cache object.
- * @param string $location (Optional) The location to store the cache object in. This may vary by cache method. The default value is NULL.
- * @param integer $expires (Optional) The number of seconds until a cache object is considered stale. The default value is 0.
- * @param boolean $gzip (Optional) Whether data should be gzipped before being stored. The default value is true.
- * @return object Reference to the cache object.
- */
- public static function init($name, $location = null, $expires = 0, $gzip = true)
- {
- if (version_compare(PHP_VERSION, '5.3.0', '<'))
- {
- throw new Exception('PHP 5.3 or newer is required to use CacheCore::init().');
- }
-
- $self = get_called_class();
- return new $self($name, $location, $expires, $gzip);
- }
-
- /**
- * Set the number of seconds until a cache expires.
- *
- * @param integer $expires (Optional) The number of seconds until a cache object is considered stale. The default value is 0.
- * @return $this
- */
- public function expire_in($seconds)
- {
- $this->expires = $seconds;
- return $this;
- }
-
- /**
- * Provides a simple, straightforward cache-logic mechanism. Useful for non-complex response caches.
- *
- * @param string|function $callback (Required) The name of the function to fire when we need to fetch new data to cache.
- * @param array params (Optional) Parameters to pass into the callback function, as an array.
- * @return array The cached data being requested.
- */
- public function response_manager($callback, $params = null)
- {
- // Automatically handle $params values.
- $params = is_array($params) ? $params : array($params);
-
- if ($data = $this->read())
- {
- if ($this->is_expired())
- {
- if ($data = call_user_func_array($callback, $params))
- {
- $this->update($data);
- }
- else
- {
- $this->reset();
- $data = $this->read();
- }
- }
- }
- else
- {
- if ($data = call_user_func_array($callback, $params))
- {
- $this->create($data);
- }
- }
-
- return $data;
- }
-}
-
-
-/*%******************************************************************************************%*/
-// CORE DEPENDENCIES
-
-// Include the ICacheCore interface.
-if (file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'icachecore.interface.php'))
-{
- include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'icachecore.interface.php';
-}
-
-
-/*%******************************************************************************************%*/
-// EXCEPTIONS
-
-class CacheCore_Exception extends Exception {}
diff --git a/3rdparty/aws-sdk/lib/cachecore/cachefile.class.php b/3rdparty/aws-sdk/lib/cachecore/cachefile.class.php
deleted file mode 100755
index 3df240151fb..00000000000
--- a/3rdparty/aws-sdk/lib/cachecore/cachefile.class.php
+++ /dev/null
@@ -1,189 +0,0 @@
-<?php
-/**
- * Container for all file-based cache methods. Inherits additional methods from <CacheCore>. Adheres
- * to the ICacheCore interface.
- *
- * @version 2012.04.17
- * @copyright 2006-2012 Ryan Parman
- * @copyright 2006-2010 Foleeo, Inc.
- * @copyright 2012 Amazon.com, Inc. or its affiliates.
- * @copyright 2008-2010 Contributors
- * @license http://opensource.org/licenses/bsd-license.php Simplified BSD License
- * @link http://github.com/skyzyx/cachecore CacheCore
- * @link http://getcloudfusion.com CloudFusion
- */
-class CacheFile extends CacheCore implements ICacheCore
-{
-
- /*%******************************************************************************************%*/
- // CONSTRUCTOR
-
- /**
- * Constructs a new instance of this class.
- *
- * @param string $name (Required) A name to uniquely identify the cache object.
- * @param string $location (Optional) The location to store the cache object in. This may vary by cache method. The default value is NULL.
- * @param integer $expires (Optional) The number of seconds until a cache object is considered stale. The default value is 0.
- * @param boolean $gzip (Optional) Whether data should be gzipped before being stored. The default value is true.
- * @return object Reference to the cache object.
- */
- public function __construct($name, $location = null, $expires = 0, $gzip = true)
- {
- parent::__construct($name, $location, $expires, $gzip);
- $this->id = $this->location . '/' . $this->name . '.cache';
- }
-
- /**
- * Creates a new cache.
- *
- * @param mixed $data (Required) The data to cache.
- * @return boolean Whether the operation was successful.
- */
- public function create($data)
- {
- if (file_exists($this->id))
- {
- return false;
- }
- elseif (realpath($this->location) && file_exists($this->location) && is_writeable($this->location))
- {
- $data = serialize($data);
- $data = $this->gzip ? gzcompress($data) : $data;
-
- return (bool) file_put_contents($this->id, $data);
- }
- elseif (realpath($this->location) && file_exists($this->location))
- {
- throw new CacheFile_Exception('The file system location "' . $this->location . '" is not writable. Check the file system permissions for this directory.');
- }
- else
- {
- throw new CacheFile_Exception('The file system location "' . $this->location . '" does not exist. Create the directory, or double-check any relative paths that may have been set.');
- }
-
- return false;
- }
-
- /**
- * Reads a cache.
- *
- * @return mixed Either the content of the cache object, or boolean `false`.
- */
- public function read()
- {
- if (file_exists($this->id) && is_readable($this->id))
- {
- $data = file_get_contents($this->id);
- $data = $this->gzip ? gzuncompress($data) : $data;
- $data = unserialize($data);
-
- if ($data === false)
- {
- /*
- This should only happen when someone changes the gzip settings and there is
- existing data or someone has been mucking about in the cache folder manually.
- Delete the bad entry since the file cache doesn't clean up after itself and
- then return false so fresh data will be retrieved.
- */
- $this->delete();
- return false;
- }
-
- return $data;
- }
-
- return false;
- }
-
- /**
- * Updates an existing cache.
- *
- * @param mixed $data (Required) The data to cache.
- * @return boolean Whether the operation was successful.
- */
- public function update($data)
- {
- if (file_exists($this->id) && is_writeable($this->id))
- {
- $data = serialize($data);
- $data = $this->gzip ? gzcompress($data) : $data;
-
- return (bool) file_put_contents($this->id, $data);
- }
- else
- {
- throw new CacheFile_Exception('The file system location is not writeable. Check your file system permissions and ensure that the cache directory exists.');
- }
-
- return false;
- }
-
- /**
- * Deletes a cache.
- *
- * @return boolean Whether the operation was successful.
- */
- public function delete()
- {
- if (file_exists($this->id))
- {
- return unlink($this->id);
- }
-
- return false;
- }
-
- /**
- * Checks whether the cache object is expired or not.
- *
- * @return boolean Whether the cache is expired or not.
- */
- public function is_expired()
- {
- if ($this->timestamp() + $this->expires < time())
- {
- return true;
- }
-
- return false;
- }
-
- /**
- * Retrieves the timestamp of the cache.
- *
- * @return mixed Either the Unix time stamp of the cache creation, or boolean `false`.
- */
- public function timestamp()
- {
- clearstatcache();
-
- if (file_exists($this->id))
- {
- $this->timestamp = filemtime($this->id);
- return $this->timestamp;
- }
-
- return false;
- }
-
- /**
- * Resets the freshness of the cache.
- *
- * @return boolean Whether the operation was successful.
- */
- public function reset()
- {
- if (file_exists($this->id))
- {
- return touch($this->id);
- }
-
- return false;
- }
-}
-
-
-/*%******************************************************************************************%*/
-// EXCEPTIONS
-
-class CacheFile_Exception extends CacheCore_Exception {}
diff --git a/3rdparty/aws-sdk/lib/cachecore/cachemc.class.php b/3rdparty/aws-sdk/lib/cachecore/cachemc.class.php
deleted file mode 100755
index 5b0f8a93061..00000000000
--- a/3rdparty/aws-sdk/lib/cachecore/cachemc.class.php
+++ /dev/null
@@ -1,183 +0,0 @@
-<?php
-/**
- * Container for all Memcache-based cache methods. Inherits additional methods from <CacheCore>. Adheres
- * to the ICacheCore interface.
- *
- * @version 2012.04.17
- * @copyright 2006-2012 Ryan Parman
- * @copyright 2006-2010 Foleeo, Inc.
- * @copyright 2012 Amazon.com, Inc. or its affiliates.
- * @copyright 2008-2010 Contributors
- * @license http://opensource.org/licenses/bsd-license.php Simplified BSD License
- * @link http://github.com/skyzyx/cachecore CacheCore
- * @link http://getcloudfusion.com CloudFusion
- * @link http://php.net/memcache Memcache
- * @link http://php.net/memcached Memcached
- */
-class CacheMC extends CacheCore implements ICacheCore
-{
- /**
- * Holds the Memcache object.
- */
- var $memcache = null;
-
- /**
- * Whether the Memcached extension is being used (as opposed to Memcache).
- */
- var $is_memcached = false;
-
-
- /*%******************************************************************************************%*/
- // CONSTRUCTOR
-
- /**
- * Constructs a new instance of this class.
- *
- * @param string $name (Required) A name to uniquely identify the cache object.
- * @param string $location (Optional) The location to store the cache object in. This may vary by cache method. The default value is NULL.
- * @param integer $expires (Optional) The number of seconds until a cache object is considered stale. The default value is 0.
- * @param boolean $gzip (Optional) Whether data should be gzipped before being stored. The default value is true.
- * @return object Reference to the cache object.
- */
- public function __construct($name, $location = null, $expires = 0, $gzip = true)
- {
- parent::__construct($name, null, $expires, $gzip);
- $this->id = $this->name;
-
- // Prefer Memcached over Memcache.
- if (class_exists('Memcached'))
- {
- $this->memcache = new Memcached();
- $this->is_memcached = true;
- }
- elseif (class_exists('Memcache'))
- {
- $this->memcache = new Memcache();
- }
- else
- {
- return false;
- }
-
- // Enable compression, if available
- if ($this->gzip)
- {
- if ($this->is_memcached)
- {
- $this->memcache->setOption(Memcached::OPT_COMPRESSION, true);
- }
- else
- {
- $this->gzip = MEMCACHE_COMPRESSED;
- }
- }
-
- // Process Memcached servers.
- if (isset($location) && sizeof($location) > 0)
- {
- foreach ($location as $loc)
- {
- if (isset($loc['port']) && !empty($loc['port']))
- {
- $this->memcache->addServer($loc['host'], $loc['port']);
- }
- else
- {
- $this->memcache->addServer($loc['host'], 11211);
- }
- }
- }
-
- return $this;
- }
-
- /**
- * Creates a new cache.
- *
- * @param mixed $data (Required) The data to cache.
- * @return boolean Whether the operation was successful.
- */
- public function create($data)
- {
- if ($this->is_memcached)
- {
- return $this->memcache->set($this->id, $data, $this->expires);
- }
- return $this->memcache->set($this->id, $data, $this->gzip, $this->expires);
- }
-
- /**
- * Reads a cache.
- *
- * @return mixed Either the content of the cache object, or boolean `false`.
- */
- public function read()
- {
- if ($this->is_memcached)
- {
- return $this->memcache->get($this->id);
- }
- return $this->memcache->get($this->id, $this->gzip);
- }
-
- /**
- * Updates an existing cache.
- *
- * @param mixed $data (Required) The data to cache.
- * @return boolean Whether the operation was successful.
- */
- public function update($data)
- {
- if ($this->is_memcached)
- {
- return $this->memcache->replace($this->id, $data, $this->expires);
- }
- return $this->memcache->replace($this->id, $data, $this->gzip, $this->expires);
- }
-
- /**
- * Deletes a cache.
- *
- * @return boolean Whether the operation was successful.
- */
- public function delete()
- {
- return $this->memcache->delete($this->id);
- }
-
- /**
- * Implemented here, but always returns `false`. Memcache manages its own expirations.
- *
- * @return boolean Whether the cache is expired or not.
- */
- public function is_expired()
- {
- return false;
- }
-
- /**
- * Implemented here, but always returns `false`. Memcache manages its own expirations.
- *
- * @return mixed Either the Unix time stamp of the cache creation, or boolean `false`.
- */
- public function timestamp()
- {
- return false;
- }
-
- /**
- * Implemented here, but always returns `false`. Memcache manages its own expirations.
- *
- * @return boolean Whether the operation was successful.
- */
- public function reset()
- {
- return false;
- }
-}
-
-
-/*%******************************************************************************************%*/
-// EXCEPTIONS
-
-class CacheMC_Exception extends CacheCore_Exception {}
diff --git a/3rdparty/aws-sdk/lib/cachecore/cachepdo.class.php b/3rdparty/aws-sdk/lib/cachecore/cachepdo.class.php
deleted file mode 100755
index 5716021d8fc..00000000000
--- a/3rdparty/aws-sdk/lib/cachecore/cachepdo.class.php
+++ /dev/null
@@ -1,297 +0,0 @@
-<?php
-/**
- * Container for all PDO-based cache methods. Inherits additional methods from <CacheCore>. Adheres
- * to the ICacheCore interface.
- *
- * @version 2012.04.17
- * @copyright 2006-2012 Ryan Parman
- * @copyright 2006-2010 Foleeo, Inc.
- * @copyright 2012 Amazon.com, Inc. or its affiliates.
- * @copyright 2008-2010 Contributors
- * @license http://opensource.org/licenses/bsd-license.php Simplified BSD License
- * @link http://github.com/skyzyx/cachecore CacheCore
- * @link http://getcloudfusion.com CloudFusion
- * @link http://php.net/pdo PDO
- */
-class CachePDO extends CacheCore implements ICacheCore
-{
- /**
- * Reference to the PDO connection object.
- */
- var $pdo = null;
-
- /**
- * Holds the parsed URL components.
- */
- var $dsn = null;
-
- /**
- * Holds the PDO-friendly version of the connection string.
- */
- var $dsn_string = null;
-
- /**
- * Holds the prepared statement for creating an entry.
- */
- var $create = null;
-
- /**
- * Holds the prepared statement for reading an entry.
- */
- var $read = null;
-
- /**
- * Holds the prepared statement for updating an entry.
- */
- var $update = null;
-
- /**
- * Holds the prepared statement for resetting the expiry of an entry.
- */
- var $reset = null;
-
- /**
- * Holds the prepared statement for deleting an entry.
- */
- var $delete = null;
-
- /**
- * Holds the response of the read so we only need to fetch it once instead of doing
- * multiple queries.
- */
- var $store_read = null;
-
-
- /*%******************************************************************************************%*/
- // CONSTRUCTOR
-
- /**
- * Constructs a new instance of this class.
- *
- * Tested with [MySQL 5.0.x](http://mysql.com), [PostgreSQL](http://postgresql.com), and
- * [SQLite 3.x](http://sqlite.org). SQLite 2.x is assumed to work. No other PDO-supported databases have
- * been tested (e.g. Oracle, Microsoft SQL Server, IBM DB2, ODBC, Sybase, Firebird). Feel free to send
- * patches for additional database support.
- *
- * See <http://php.net/pdo> for more information.
- *
- * @param string $name (Required) A name to uniquely identify the cache object.
- * @param string $location (Optional) The location to store the cache object in. This may vary by cache method. The default value is NULL.
- * @param integer $expires (Optional) The number of seconds until a cache object is considered stale. The default value is 0.
- * @param boolean $gzip (Optional) Whether data should be gzipped before being stored. The default value is true.
- * @return object Reference to the cache object.
- */
- public function __construct($name, $location = null, $expires = 0, $gzip = true)
- {
- // Make sure the name is no longer than 40 characters.
- $name = sha1($name);
-
- // Call parent constructor and set id.
- parent::__construct($name, $location, $expires, $gzip);
- $this->id = $this->name;
- $options = array();
-
- // Check if the location contains :// (e.g. mysql://user:pass@hostname:port/table)
- if (stripos($location, '://') === false)
- {
- // No? Just pass it through.
- $this->dsn = parse_url($location);
- $this->dsn_string = $location;
- }
- else
- {
- // Yes? Parse and set the DSN
- $this->dsn = parse_url($location);
- $this->dsn_string = $this->dsn['scheme'] . ':host=' . $this->dsn['host'] . ((isset($this->dsn['port'])) ? ';port=' . $this->dsn['port'] : '') . ';dbname=' . substr($this->dsn['path'], 1);
- }
-
- // Make sure that user/pass are defined.
- $user = isset($this->dsn['user']) ? $this->dsn['user'] : null;
- $pass = isset($this->dsn['pass']) ? $this->dsn['pass'] : null;
-
- // Set persistence for databases that support it.
- switch ($this->dsn['scheme'])
- {
- case 'mysql': // MySQL
- case 'pgsql': // PostgreSQL
- $options[PDO::ATTR_PERSISTENT] = true;
- break;
- }
-
- // Instantiate a new PDO object with a persistent connection.
- $this->pdo = new PDO($this->dsn_string, $user, $pass, $options);
-
- // Define prepared statements for improved performance.
- $this->create = $this->pdo->prepare("INSERT INTO cache (id, expires, data) VALUES (:id, :expires, :data)");
- $this->read = $this->pdo->prepare("SELECT id, expires, data FROM cache WHERE id = :id");
- $this->reset = $this->pdo->prepare("UPDATE cache SET expires = :expires WHERE id = :id");
- $this->delete = $this->pdo->prepare("DELETE FROM cache WHERE id = :id");
- }
-
- /**
- * Creates a new cache.
- *
- * @param mixed $data (Required) The data to cache.
- * @return boolean Whether the operation was successful.
- */
- public function create($data)
- {
- $data = serialize($data);
- $data = $this->gzip ? gzcompress($data) : $data;
-
- $this->create->bindParam(':id', $this->id);
- $this->create->bindParam(':data', $data);
- $this->create->bindParam(':expires', $this->generate_timestamp());
-
- return (bool) $this->create->execute();
- }
-
- /**
- * Reads a cache.
- *
- * @return mixed Either the content of the cache object, or boolean `false`.
- */
- public function read()
- {
- if (!$this->store_read)
- {
- $this->read->bindParam(':id', $this->id);
- $this->read->execute();
- $this->store_read = $this->read->fetch(PDO::FETCH_ASSOC);
- }
-
- if ($this->store_read)
- {
- $data = $this->store_read['data'];
- $data = $this->gzip ? gzuncompress($data) : $data;
-
- return unserialize($data);
- }
-
- return false;
- }
-
- /**
- * Updates an existing cache.
- *
- * @param mixed $data (Required) The data to cache.
- * @return boolean Whether the operation was successful.
- */
- public function update($data)
- {
- $this->delete();
- return $this->create($data);
- }
-
- /**
- * Deletes a cache.
- *
- * @return boolean Whether the operation was successful.
- */
- public function delete()
- {
- $this->delete->bindParam(':id', $this->id);
- return $this->delete->execute();
- }
-
- /**
- * Checks whether the cache object is expired or not.
- *
- * @return boolean Whether the cache is expired or not.
- */
- public function is_expired()
- {
- if ($this->timestamp() + $this->expires < time())
- {
- return true;
- }
-
- return false;
- }
-
- /**
- * Retrieves the timestamp of the cache.
- *
- * @return mixed Either the Unix time stamp of the cache creation, or boolean `false`.
- */
- public function timestamp()
- {
- if (!$this->store_read)
- {
- $this->read->bindParam(':id', $this->id);
- $this->read->execute();
- $this->store_read = $this->read->fetch(PDO::FETCH_ASSOC);
- }
-
- if ($this->store_read)
- {
- $value = $this->store_read['expires'];
-
- // If 'expires' isn't yet an integer, convert it into one.
- if (!is_numeric($value))
- {
- $value = strtotime($value);
- }
-
- $this->timestamp = date('U', $value);
- return $this->timestamp;
- }
-
- return false;
- }
-
- /**
- * Resets the freshness of the cache.
- *
- * @return boolean Whether the operation was successful.
- */
- public function reset()
- {
- $this->reset->bindParam(':id', $this->id);
- $this->reset->bindParam(':expires', $this->generate_timestamp());
- return (bool) $this->reset->execute();
- }
-
- /**
- * Returns a list of supported PDO database drivers. Identical to <PDO::getAvailableDrivers()>.
- *
- * @return array The list of supported database drivers.
- * @link http://php.net/pdo.getavailabledrivers PHP Method
- */
- public function get_drivers()
- {
- return PDO::getAvailableDrivers();
- }
-
- /**
- * Returns a timestamp value apropriate to the current database type.
- *
- * @return mixed Timestamp for MySQL and PostgreSQL, integer value for SQLite.
- */
- protected function generate_timestamp()
- {
- // Define 'expires' settings differently.
- switch ($this->dsn['scheme'])
- {
- // These support timestamps.
- case 'mysql': // MySQL
- case 'pgsql': // PostgreSQL
- $expires = date(DATE_FORMAT_MYSQL, time());
- break;
-
- // These support integers.
- case 'sqlite': // SQLite 3
- case 'sqlite2': // SQLite 2
- $expires = time();
- break;
- }
-
- return $expires;
- }
-}
-
-
-/*%******************************************************************************************%*/
-// EXCEPTIONS
-
-class CachePDO_Exception extends CacheCore_Exception {}
diff --git a/3rdparty/aws-sdk/lib/cachecore/cachexcache.class.php b/3rdparty/aws-sdk/lib/cachecore/cachexcache.class.php
deleted file mode 100755
index a0f279aaea3..00000000000
--- a/3rdparty/aws-sdk/lib/cachecore/cachexcache.class.php
+++ /dev/null
@@ -1,129 +0,0 @@
-<?php
-/**
- * Container for all XCache-based cache methods. Inherits additional methods from <CacheCore>. Adheres
- * to the ICacheCore interface.
- *
- * @version 2012.04.17
- * @copyright 2006-2012 Ryan Parman
- * @copyright 2006-2010 Foleeo, Inc.
- * @copyright 2012 Amazon.com, Inc. or its affiliates.
- * @copyright 2008-2010 Contributors
- * @license http://opensource.org/licenses/bsd-license.php Simplified BSD License
- * @link http://github.com/skyzyx/cachecore CacheCore
- * @link http://getcloudfusion.com CloudFusion
- * @link http://xcache.lighttpd.net XCache
- */
-class CacheXCache extends CacheCore implements ICacheCore
-{
-
- /*%******************************************************************************************%*/
- // CONSTRUCTOR
-
- /**
- * Constructs a new instance of this class.
- *
- * @param string $name (Required) A name to uniquely identify the cache object.
- * @param string $location (Optional) The location to store the cache object in. This may vary by cache method. The default value is NULL.
- * @param integer $expires (Optional) The number of seconds until a cache object is considered stale. The default value is 0.
- * @param boolean $gzip (Optional) Whether data should be gzipped before being stored. The default value is true.
- * @return object Reference to the cache object.
- */
- public function __construct($name, $location = null, $expires = 0, $gzip = true)
- {
- parent::__construct($name, null, $expires, $gzip);
- $this->id = $this->name;
- }
-
- /**
- * Creates a new cache.
- *
- * @param mixed $data (Required) The data to cache.
- * @return boolean Whether the operation was successful.
- */
- public function create($data)
- {
- $data = serialize($data);
- $data = $this->gzip ? gzcompress($data) : $data;
-
- return xcache_set($this->id, $data, $this->expires);
- }
-
- /**
- * Reads a cache.
- *
- * @return mixed Either the content of the cache object, or boolean `false`.
- */
- public function read()
- {
- if ($data = xcache_get($this->id))
- {
- $data = $this->gzip ? gzuncompress($data) : $data;
- return unserialize($data);
- }
-
- return false;
- }
-
- /**
- * Updates an existing cache.
- *
- * @param mixed $data (Required) The data to cache.
- * @return boolean Whether the operation was successful.
- */
- public function update($data)
- {
- $data = serialize($data);
- $data = $this->gzip ? gzcompress($data) : $data;
-
- return xcache_set($this->id, $data, $this->expires);
- }
-
- /**
- * Deletes a cache.
- *
- * @return boolean Whether the operation was successful.
- */
- public function delete()
- {
- return xcache_unset($this->id);
- }
-
- /**
- * Defined here, but always returns false. XCache manages it's own expirations. It's worth
- * mentioning that if the server is configured for a long xcache.var_gc_interval then it IS
- * possible for expired data to remain in the var cache, though it is not possible to access
- * it.
- *
- * @return boolean Whether the cache is expired or not.
- */
- public function is_expired()
- {
- return false;
- }
-
- /**
- * Implemented here, but always returns `false`. XCache manages its own expirations.
- *
- * @return mixed Either the Unix time stamp of the cache creation, or boolean `false`.
- */
- public function timestamp()
- {
- return false;
- }
-
- /**
- * Implemented here, but always returns `false`. XCache manages its own expirations.
- *
- * @return boolean Whether the operation was successful.
- */
- public function reset()
- {
- return false;
- }
-}
-
-
-/*%******************************************************************************************%*/
-// EXCEPTIONS
-
-class CacheXCache_Exception extends CacheCore_Exception {}
diff --git a/3rdparty/aws-sdk/lib/cachecore/icachecore.interface.php b/3rdparty/aws-sdk/lib/cachecore/icachecore.interface.php
deleted file mode 100755
index 8d49f5bf492..00000000000
--- a/3rdparty/aws-sdk/lib/cachecore/icachecore.interface.php
+++ /dev/null
@@ -1,66 +0,0 @@
-<?php
-/**
- * Defines the methods that all implementing classes MUST have. Covers CRUD (create, read, update,
- * delete) methods, as well as others that are used in the base <CacheCore> class.
- *
- * @version 2009.03.22
- * @copyright 2006-2010 Ryan Parman
- * @copyright 2006-2010 Foleeo, Inc.
- * @copyright 2008-2010 Contributors
- * @license http://opensource.org/licenses/bsd-license.php Simplified BSD License
- * @link http://github.com/skyzyx/cachecore CacheCore
- * @link http://getcloudfusion.com CloudFusion
- */
-interface ICacheCore
-{
- /**
- * Creates a new cache.
- *
- * @param mixed $data (Required) The data to cache.
- * @return boolean Whether the operation was successful.
- */
- public function create($data);
-
- /**
- * Reads a cache.
- *
- * @return mixed Either the content of the cache object, or boolean `false`.
- */
- public function read();
-
- /**
- * Updates an existing cache.
- *
- * @param mixed $data (Required) The data to cache.
- * @return boolean Whether the operation was successful.
- */
- public function update($data);
-
- /**
- * Deletes a cache.
- *
- * @return boolean Whether the operation was successful.
- */
- public function delete();
-
- /**
- * Checks whether the cache object is expired or not.
- *
- * @return boolean Whether the cache is expired or not.
- */
- public function is_expired();
-
- /**
- * Retrieves the timestamp of the cache.
- *
- * @return mixed Either the Unix time stamp of the cache creation, or boolean `false`.
- */
- public function timestamp();
-
- /**
- * Resets the freshness of the cache.
- *
- * @return boolean Whether the operation was successful.
- */
- public function reset();
-}
diff --git a/3rdparty/aws-sdk/lib/dom/ArrayToDOMDocument.php b/3rdparty/aws-sdk/lib/dom/ArrayToDOMDocument.php
deleted file mode 100644
index 06ad502eebb..00000000000
--- a/3rdparty/aws-sdk/lib/dom/ArrayToDOMDocument.php
+++ /dev/null
@@ -1,181 +0,0 @@
-<?php
-/**
- * @author Omer Hassan
- * @author Ryan Parman
- * @license MIT
- */
-class Array2DOM
-{
- const ATTRIBUTES = '__attributes__';
- const CONTENT = '__content__';
-
- /**
- * @param array $source
- * @param string $rootTagName
- * @return DOMDocument
- */
- public static function arrayToDOMDocument(array $source, $rootTagName = 'root')
- {
- $document = new DOMDocument();
- $document->appendChild(self::createDOMElement($source, $rootTagName, $document));
-
- return $document;
- }
-
- /**
- * @param array $source
- * @param string $rootTagName
- * @param bool $formatOutput
- * @return string
- */
- public static function arrayToXMLString(array $source, $rootTagName = 'root', $formatOutput = true)
- {
- $document = self::arrayToDOMDocument($source, $rootTagName);
- $document->formatOutput = $formatOutput;
-
- return $document->saveXML();
- }
-
- /**
- * @param DOMDocument $document
- * @return array
- */
- public static function domDocumentToArray(DOMDocument $document)
- {
- return self::createArray($document->documentElement);
- }
-
- /**
- * @param string $xmlString
- * @return array
- */
- public static function xmlStringToArray($xmlString)
- {
- $document = new DOMDocument();
-
- return $document->loadXML($xmlString) ? self::domDocumentToArray($document) : array();
- }
-
- /**
- * @param mixed $source
- * @param string $tagName
- * @param DOMDocument $document
- * @return DOMNode
- */
- private static function createDOMElement($source, $tagName, DOMDocument $document)
- {
- if (!is_array($source))
- {
- $element = $document->createElement($tagName);
- $element->appendChild($document->createCDATASection($source));
-
- return $element;
- }
-
- $element = $document->createElement($tagName);
-
- foreach ($source as $key => $value)
- {
- if (is_string($key) && !is_numeric($key))
- {
- if ($key === self::ATTRIBUTES)
- {
- foreach ($value as $attributeName => $attributeValue)
- {
- $element->setAttribute($attributeName, $attributeValue);
- }
- }
- elseif ($key === self::CONTENT)
- {
- $element->appendChild($document->createCDATASection($value));
- }
- elseif (is_string($value) && !is_numeric($value))
- {
- $element->appendChild(self::createDOMElement($value, $key, $document));
- }
- elseif (is_array($value) && count($value))
- {
- $keyNode = $document->createElement($key);
-
- foreach ($value as $elementKey => $elementValue)
- {
- if (is_string($elementKey) && !is_numeric($elementKey))
- {
- $keyNode->appendChild(self::createDOMElement($elementValue, $elementKey, $document));
- }
- else
- {
- $element->appendChild(self::createDOMElement($elementValue, $key, $document));
- }
- }
-
- if ($keyNode->hasChildNodes())
- {
- $element->appendChild($keyNode);
- }
- }
- else
- {
- if (is_bool($value))
- {
- $value = $value ? 'true' : 'false';
- }
-
- $element->appendChild(self::createDOMElement($value, $key, $document));
- }
- }
- else
- {
- $element->appendChild(self::createDOMElement($value, $tagName, $document));
- }
- }
-
- return $element;
- }
-
- /**
- * @param DOMNode $domNode
- * @return array
- */
- private static function createArray(DOMNode $domNode)
- {
- $array = array();
-
- for ($i = 0; $i < $domNode->childNodes->length; $i++)
- {
- $item = $domNode->childNodes->item($i);
-
- if ($item->nodeType === XML_ELEMENT_NODE)
- {
- $arrayElement = array();
-
- for ($attributeIndex = 0; !is_null($attribute = $item->attributes->item($attributeIndex)); $attributeIndex++)
- {
- if ($attribute->nodeType === XML_ATTRIBUTE_NODE)
- {
- $arrayElement[self::ATTRIBUTES][$attribute->nodeName] = $attribute->nodeValue;
- }
- }
-
- $children = self::createArray($item);
-
- if (is_array($children))
- {
- $arrayElement = array_merge($arrayElement, $children);
- }
- else
- {
- $arrayElement[self::CONTENT] = $children;
- }
-
- $array[$item->nodeName][] = $arrayElement;
- }
- elseif ($item->nodeType === XML_CDATA_SECTION_NODE || ($item->nodeType === XML_TEXT_NODE && trim($item->nodeValue) !== ''))
- {
- return $item->nodeValue;
- }
- }
-
- return $array;
- }
-}
diff --git a/3rdparty/aws-sdk/lib/requestcore/LICENSE b/3rdparty/aws-sdk/lib/requestcore/LICENSE
deleted file mode 100755
index 49b38bd620a..00000000000
--- a/3rdparty/aws-sdk/lib/requestcore/LICENSE
+++ /dev/null
@@ -1,25 +0,0 @@
-Copyright (c) 2006-2010 Ryan Parman, Foleeo Inc., and contributors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are
-permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this list of
- conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice, this list
- of conditions and the following disclaimer in the documentation and/or other materials
- provided with the distribution.
-
- * Neither the name of Ryan Parman, Foleeo Inc. nor the names of its contributors may be used to
- endorse or promote products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
-OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
-AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
diff --git a/3rdparty/aws-sdk/lib/requestcore/README.md b/3rdparty/aws-sdk/lib/requestcore/README.md
deleted file mode 100755
index 373ea4dccad..00000000000
--- a/3rdparty/aws-sdk/lib/requestcore/README.md
+++ /dev/null
@@ -1,15 +0,0 @@
-# RequestCore
-
-RequestCore is a lightweight cURL-based HTTP request/response class that leverages MultiCurl for parallel requests.
-
-### PEAR HTTP_Request?
-
-RequestCore was written as a replacement for [PEAR HTTP_Request](http://pear.php.net/http_request/). While PEAR HTTP_Request is full-featured and heavy, RequestCore features only the essentials and is very lightweight. It also leverages the batch request support in cURL's `curl_multi_exec()` to enable multi-threaded requests that fire in parallel.
-
-### Reference and Download
-
-You can find the class reference at <http://skyzyx.github.com/requestcore/>. You can get the code from <http://github.com/skyzyx/requestcore>.
-
-### License and Copyright
-
-This code is Copyright (c) 2008-2010, Ryan Parman. However, I'm licensing this code for others to use under the [Simplified BSD license](http://www.opensource.org/licenses/bsd-license.php).
diff --git a/3rdparty/aws-sdk/lib/requestcore/cacert.pem b/3rdparty/aws-sdk/lib/requestcore/cacert.pem
deleted file mode 100755
index 80bff62fd27..00000000000
--- a/3rdparty/aws-sdk/lib/requestcore/cacert.pem
+++ /dev/null
@@ -1,3390 +0,0 @@
-##
-## ca-bundle.crt -- Bundle of CA Root Certificates
-##
-## Certificate data from Mozilla as of: Wed Jan 18 00:04:16 2012
-##
-## This is a bundle of X.509 certificates of public Certificate Authorities
-## (CA). These were automatically extracted from Mozilla's root certificates
-## file (certdata.txt). This file can be found in the mozilla source tree:
-## http://mxr.mozilla.org/mozilla/source/security/nss/lib/ckfw/builtins/certdata.txt?raw=1
-##
-## It contains the certificates in PEM format and therefore
-## can be directly used with curl / libcurl / php_curl, or with
-## an Apache+mod_ssl webserver for SSL client authentication.
-## Just configure this file as the SSLCACertificateFile.
-##
-
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is the Netscape security libraries.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1994-2000
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-# @(#) $RCSfile: certdata.txt,v $ $Revision: 1.81 $ $Date: 2012/01/17 22:02:37 $
-
-GTE CyberTrust Global Root
-==========================
------BEGIN CERTIFICATE-----
-MIICWjCCAcMCAgGlMA0GCSqGSIb3DQEBBAUAMHUxCzAJBgNVBAYTAlVTMRgwFgYDVQQKEw9HVEUg
-Q29ycG9yYXRpb24xJzAlBgNVBAsTHkdURSBDeWJlclRydXN0IFNvbHV0aW9ucywgSW5jLjEjMCEG
-A1UEAxMaR1RFIEN5YmVyVHJ1c3QgR2xvYmFsIFJvb3QwHhcNOTgwODEzMDAyOTAwWhcNMTgwODEz
-MjM1OTAwWjB1MQswCQYDVQQGEwJVUzEYMBYGA1UEChMPR1RFIENvcnBvcmF0aW9uMScwJQYDVQQL
-Ex5HVEUgQ3liZXJUcnVzdCBTb2x1dGlvbnMsIEluYy4xIzAhBgNVBAMTGkdURSBDeWJlclRydXN0
-IEdsb2JhbCBSb290MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCVD6C28FCc6HrHiM3dFw4u
-sJTQGz0O9pTAipTHBsiQl8i4ZBp6fmw8U+E3KHNgf7KXUwefU/ltWJTSr41tiGeA5u2ylc9yMcql
-HHK6XALnZELn+aks1joNrI1CqiQBOeacPwGFVw1Yh0X404Wqk2kmhXBIgD8SFcd5tB8FLztimQID
-AQABMA0GCSqGSIb3DQEBBAUAA4GBAG3rGwnpXtlR22ciYaQqPEh346B8pt5zohQDhT37qw4wxYMW
-M4ETCJ57NE7fQMh017l93PR2VX2bY1QY6fDq81yx2YtCHrnAlU66+tXifPVoYb+O7AWXX1uw16OF
-NMQkpw0PlZPvy5TYnh+dXIVtx6quTx8itc2VrbqnzPmrC3p/
------END CERTIFICATE-----
-
-Thawte Server CA
-================
------BEGIN CERTIFICATE-----
-MIIDEzCCAnygAwIBAgIBATANBgkqhkiG9w0BAQQFADCBxDELMAkGA1UEBhMCWkExFTATBgNVBAgT
-DFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYDVQQKExRUaGF3dGUgQ29uc3Vs
-dGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjEZMBcGA1UE
-AxMQVGhhd3RlIFNlcnZlciBDQTEmMCQGCSqGSIb3DQEJARYXc2VydmVyLWNlcnRzQHRoYXd0ZS5j
-b20wHhcNOTYwODAxMDAwMDAwWhcNMjAxMjMxMjM1OTU5WjCBxDELMAkGA1UEBhMCWkExFTATBgNV
-BAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYDVQQKExRUaGF3dGUgQ29u
-c3VsdGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjEZMBcG
-A1UEAxMQVGhhd3RlIFNlcnZlciBDQTEmMCQGCSqGSIb3DQEJARYXc2VydmVyLWNlcnRzQHRoYXd0
-ZS5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANOkUG7I/1Zr5s9dtuoMaHVHoqrC2oQl
-/Kj0R1HahbUgdJSGHg91yekIYfUGbTBuFRkC6VLAYttNmZ7iagxEOM3+vuNkCXDF/rFrKbYvScg7
-1CcEJRCXL+eQbcAoQpnXTEPew/UhbVSfXcNY4cDk2VuwuNy0e982OsK1ZiIS1ocNAgMBAAGjEzAR
-MA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEEBQADgYEAB/pMaVz7lcxG7oWDTSEwjsrZqG9J
-GubaUeNgcGyEYRGhGshIPllDfU+VPaGLtwtimHp1it2ITk6eQNuozDJ0uW8NxuOzRAvZim+aKZuZ
-GCg70eNAKJpaPNW15yAbi8qkq43pUdniTCxZqdq5snUb9kLy78fyGPmJvKP/iiMucEc=
------END CERTIFICATE-----
-
-Thawte Premium Server CA
-========================
------BEGIN CERTIFICATE-----
-MIIDJzCCApCgAwIBAgIBATANBgkqhkiG9w0BAQQFADCBzjELMAkGA1UEBhMCWkExFTATBgNVBAgT
-DFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYDVQQKExRUaGF3dGUgQ29uc3Vs
-dGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjEhMB8GA1UE
-AxMYVGhhd3RlIFByZW1pdW0gU2VydmVyIENBMSgwJgYJKoZIhvcNAQkBFhlwcmVtaXVtLXNlcnZl
-ckB0aGF3dGUuY29tMB4XDTk2MDgwMTAwMDAwMFoXDTIwMTIzMTIzNTk1OVowgc4xCzAJBgNVBAYT
-AlpBMRUwEwYDVQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEdMBsGA1UEChMU
-VGhhd3RlIENvbnN1bHRpbmcgY2MxKDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2VydmljZXMgRGl2
-aXNpb24xITAfBgNVBAMTGFRoYXd0ZSBQcmVtaXVtIFNlcnZlciBDQTEoMCYGCSqGSIb3DQEJARYZ
-cHJlbWl1bS1zZXJ2ZXJAdGhhd3RlLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA0jY2
-aovXwlue2oFBYo847kkEVdbQ7xwblRZH7xhINTpS9CtqBo87L+pW46+GjZ4X9560ZXUCTe/LCaIh
-Udib0GfQug2SBhRz1JPLlyoAnFxODLz6FVL88kRu2hFKbgifLy3j+ao6hnO2RlNYyIkFvYMRuHM/
-qgeN9EJN50CdHDcCAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQQFAAOBgQAm
-SCwWwlj66BZ0DKqqX1Q/8tfJeGBeXm43YyJ3Nn6yF8Q0ufUIhfzJATj/Tb7yFkJD57taRvvBxhEf
-8UqwKEbJw8RCfbz6q1lu1bdRiBHjpIUZa4JMpAwSremkrj/xw0llmozFyD4lt5SZu5IycQfwhl7t
-UCemDaYj+bvLpgcUQg==
------END CERTIFICATE-----
-
-Equifax Secure CA
-=================
------BEGIN CERTIFICATE-----
-MIIDIDCCAomgAwIBAgIENd70zzANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJVUzEQMA4GA1UE
-ChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2VydGlmaWNhdGUgQXV0aG9yaXR5
-MB4XDTk4MDgyMjE2NDE1MVoXDTE4MDgyMjE2NDE1MVowTjELMAkGA1UEBhMCVVMxEDAOBgNVBAoT
-B0VxdWlmYXgxLTArBgNVBAsTJEVxdWlmYXggU2VjdXJlIENlcnRpZmljYXRlIEF1dGhvcml0eTCB
-nzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAwV2xWGcIYu6gmi0fCG2RFGiYCh7+2gRvE4RiIcPR
-fM6fBeC4AfBONOziipUEZKzxa1NfBbPLZ4C/QgKO/t0BCezhABRP/PvwDN1Dulsr4R+AcJkVV5MW
-8Q+XarfCaCMczE1ZMKxRHjuvK9buY0V7xdlfUNLjUA86iOe/FP3gx7kCAwEAAaOCAQkwggEFMHAG
-A1UdHwRpMGcwZaBjoGGkXzBdMQswCQYDVQQGEwJVUzEQMA4GA1UEChMHRXF1aWZheDEtMCsGA1UE
-CxMkRXF1aWZheCBTZWN1cmUgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMBoG
-A1UdEAQTMBGBDzIwMTgwODIyMTY0MTUxWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUSOZo+SvS
-spXXR9gjIBBPM5iQn9QwHQYDVR0OBBYEFEjmaPkr0rKV10fYIyAQTzOYkJ/UMAwGA1UdEwQFMAMB
-Af8wGgYJKoZIhvZ9B0EABA0wCxsFVjMuMGMDAgbAMA0GCSqGSIb3DQEBBQUAA4GBAFjOKer89961
-zgK5F7WF0bnj4JXMJTENAKaSbn+2kmOeUJXRmm/kEd5jhW6Y7qj/WsjTVbJmcVfewCHrPSqnI0kB
-BIZCe/zuf6IWUrVnZ9NA2zsmWLIodz2uFHdh1voqZiegDfqnc1zqcPGUIWVEX/r87yloqaKHee95
-70+sB3c4
------END CERTIFICATE-----
-
-Digital Signature Trust Co. Global CA 1
-=======================================
------BEGIN CERTIFICATE-----
-MIIDKTCCApKgAwIBAgIENnAVljANBgkqhkiG9w0BAQUFADBGMQswCQYDVQQGEwJVUzEkMCIGA1UE
-ChMbRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QgQ28uMREwDwYDVQQLEwhEU1RDQSBFMTAeFw05ODEy
-MTAxODEwMjNaFw0xODEyMTAxODQwMjNaMEYxCzAJBgNVBAYTAlVTMSQwIgYDVQQKExtEaWdpdGFs
-IFNpZ25hdHVyZSBUcnVzdCBDby4xETAPBgNVBAsTCERTVENBIEUxMIGdMA0GCSqGSIb3DQEBAQUA
-A4GLADCBhwKBgQCgbIGpzzQeJN3+hijM3oMv+V7UQtLodGBmE5gGHKlREmlvMVW5SXIACH7TpWJE
-NySZj9mDSI+ZbZUTu0M7LklOiDfBu1h//uG9+LthzfNHwJmm8fOR6Hh8AMthyUQncWlVSn5JTe2i
-o74CTADKAqjuAQIxZA9SLRN0dja1erQtcQIBA6OCASQwggEgMBEGCWCGSAGG+EIBAQQEAwIABzBo
-BgNVHR8EYTBfMF2gW6BZpFcwVTELMAkGA1UEBhMCVVMxJDAiBgNVBAoTG0RpZ2l0YWwgU2lnbmF0
-dXJlIFRydXN0IENvLjERMA8GA1UECxMIRFNUQ0EgRTExDTALBgNVBAMTBENSTDEwKwYDVR0QBCQw
-IoAPMTk5ODEyMTAxODEwMjNagQ8yMDE4MTIxMDE4MTAyM1owCwYDVR0PBAQDAgEGMB8GA1UdIwQY
-MBaAFGp5fpFpRhgTCgJ3pVlbYJglDqL4MB0GA1UdDgQWBBRqeX6RaUYYEwoCd6VZW2CYJQ6i+DAM
-BgNVHRMEBTADAQH/MBkGCSqGSIb2fQdBAAQMMAobBFY0LjADAgSQMA0GCSqGSIb3DQEBBQUAA4GB
-ACIS2Hod3IEGtgllsofIH160L+nEHvI8wbsEkBFKg05+k7lNQseSJqBcNJo4cvj9axY+IO6CizEq
-kzaFI4iKPANo08kJD038bKTaKHKTDomAsH3+gG9lbRgzl4vCa4nuYD3Im+9/KzJic5PLPON74nZ4
-RbyhkwS7hp86W0N6w4pl
------END CERTIFICATE-----
-
-Digital Signature Trust Co. Global CA 3
-=======================================
------BEGIN CERTIFICATE-----
-MIIDKTCCApKgAwIBAgIENm7TzjANBgkqhkiG9w0BAQUFADBGMQswCQYDVQQGEwJVUzEkMCIGA1UE
-ChMbRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QgQ28uMREwDwYDVQQLEwhEU1RDQSBFMjAeFw05ODEy
-MDkxOTE3MjZaFw0xODEyMDkxOTQ3MjZaMEYxCzAJBgNVBAYTAlVTMSQwIgYDVQQKExtEaWdpdGFs
-IFNpZ25hdHVyZSBUcnVzdCBDby4xETAPBgNVBAsTCERTVENBIEUyMIGdMA0GCSqGSIb3DQEBAQUA
-A4GLADCBhwKBgQC/k48Xku8zExjrEH9OFr//Bo8qhbxe+SSmJIi2A7fBw18DW9Fvrn5C6mYjuGOD
-VvsoLeE4i7TuqAHhzhy2iCoiRoX7n6dwqUcUP87eZfCocfdPJmyMvMa1795JJ/9IKn3oTQPMx7JS
-xhcxEzu1TdvIxPbDDyQq2gyd55FbgM2UnQIBA6OCASQwggEgMBEGCWCGSAGG+EIBAQQEAwIABzBo
-BgNVHR8EYTBfMF2gW6BZpFcwVTELMAkGA1UEBhMCVVMxJDAiBgNVBAoTG0RpZ2l0YWwgU2lnbmF0
-dXJlIFRydXN0IENvLjERMA8GA1UECxMIRFNUQ0EgRTIxDTALBgNVBAMTBENSTDEwKwYDVR0QBCQw
-IoAPMTk5ODEyMDkxOTE3MjZagQ8yMDE4MTIwOTE5MTcyNlowCwYDVR0PBAQDAgEGMB8GA1UdIwQY
-MBaAFB6CTShlgDzJQW6sNS5ay97u+DlbMB0GA1UdDgQWBBQegk0oZYA8yUFurDUuWsve7vg5WzAM
-BgNVHRMEBTADAQH/MBkGCSqGSIb2fQdBAAQMMAobBFY0LjADAgSQMA0GCSqGSIb3DQEBBQUAA4GB
-AEeNg61i8tuwnkUiBbmi1gMOOHLnnvx75pO2mqWilMg0HZHRxdf0CiUPPXiBng+xZ8SQTGPdXqfi
-up/1902lMXucKS1M/mQ+7LZT/uqb7YLbdHVLB3luHtgZg3Pe9T7Qtd7nS2h9Qy4qIOF+oHhEngj1
-mPnHfxsb1gYgAlihw6ID
------END CERTIFICATE-----
-
-Verisign Class 3 Public Primary Certification Authority
-=======================================================
------BEGIN CERTIFICATE-----
-MIICPDCCAaUCEHC65B0Q2Sk0tjjKewPMur8wDQYJKoZIhvcNAQECBQAwXzELMAkGA1UEBhMCVVMx
-FzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmltYXJ5
-IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2MDEyOTAwMDAwMFoXDTI4MDgwMTIzNTk1OVow
-XzELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAz
-IFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUA
-A4GNADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhEBarsAx94
-f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/isI19wKTakyYbnsZogy1Ol
-hec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0GCSqGSIb3DQEBAgUAA4GBALtMEivPLCYA
-TxQT3ab7/AoRhIzzKBxnki98tsX63/Dolbwdj2wsqFHMc9ikwFPwTtYmwHYBV4GSXiHx0bH/59Ah
-WM1pF+NEHJwZRDmJXNycAA9WjQKZ7aKQRUzkuxCkPfAyAw7xzvjoyVGM5mKf5p/AfbdynMk2Omuf
-Tqj/ZA1k
------END CERTIFICATE-----
-
-Verisign Class 3 Public Primary Certification Authority - G2
-============================================================
------BEGIN CERTIFICATE-----
-MIIDAjCCAmsCEH3Z/gfPqB63EHln+6eJNMYwDQYJKoZIhvcNAQEFBQAwgcExCzAJBgNVBAYTAlVT
-MRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xhc3MgMyBQdWJsaWMgUHJpbWFy
-eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMTowOAYDVQQLEzEoYykgMTk5OCBWZXJpU2ln
-biwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVz
-dCBOZXR3b3JrMB4XDTk4MDUxODAwMDAwMFoXDTI4MDgwMTIzNTk1OVowgcExCzAJBgNVBAYTAlVT
-MRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xhc3MgMyBQdWJsaWMgUHJpbWFy
-eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMTowOAYDVQQLEzEoYykgMTk5OCBWZXJpU2ln
-biwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVz
-dCBOZXR3b3JrMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDMXtERXVxp0KvTuWpMmR9ZmDCO
-FoUgRm1HP9SFIIThbbP4pO0M8RcPO/mn+SXXwc+EY/J8Y8+iR/LGWzOOZEAEaMGAuWQcRXfH2G71
-lSk8UOg013gfqLptQ5GVj0VXXn7F+8qkBOvqlzdUMG+7AUcyM83cV5tkaWH4mx0ciU9cZwIDAQAB
-MA0GCSqGSIb3DQEBBQUAA4GBAFFNzb5cy5gZnBWyATl4Lk0PZ3BwmcYQWpSkU01UbSuvDV1Ai2TT
-1+7eVmGSX6bEHRBhNtMsJzzoKQm5EWR0zLVznxxIqbxhAe7iF6YM40AIOw7n60RzKprxaZLvcRTD
-Oaxxp5EJb+RxBrO6WVcmeQD2+A2iMzAo1KpYoJ2daZH9
------END CERTIFICATE-----
-
-GlobalSign Root CA
-==================
------BEGIN CERTIFICATE-----
-MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkGA1UEBhMCQkUx
-GTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jvb3QgQ0ExGzAZBgNVBAMTEkds
-b2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAwMDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNV
-BAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYD
-VQQDExJHbG9iYWxTaWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDa
-DuaZjc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavpxy0Sy6sc
-THAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp1Wrjsok6Vjk4bwY8iGlb
-Kk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdGsnUOhugZitVtbNV4FpWi6cgKOOvyJBNP
-c1STE4U6G7weNLWLBYy5d4ux2x8gkasJU26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrX
-gzT/LCrBbBlDSgeF59N89iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV
-HRMBAf8EBTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0BAQUF
-AAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOzyj1hTdNGCbM+w6Dj
-Y1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE38NflNUVyRRBnMRddWQVDf9VMOyG
-j/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymPAbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhH
-hm4qxFYxldBniYUr+WymXUadDKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveC
-X4XSQRjbgbMEHMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==
------END CERTIFICATE-----
-
-GlobalSign Root CA - R2
-=======================
------BEGIN CERTIFICATE-----
-MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4GA1UECxMXR2xv
-YmFsU2lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
-bFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjExMjE1MDgwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
-aWduIFJvb3QgQ0EgLSBSMjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
-bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKbPJA6+Lm8omUVCxKs+IVSbC9N/hHD6
-ErPLv4dfxn+G07IwXNb9rfF73OX4YJYJkhD10FPe+3t+c4isUoh7SqbKSaZeqKeMWhG8eoLrvozp
-s6yWJQeXSpkqBy+0Hne/ig+1AnwblrjFuTosvNYSuetZfeLQBoZfXklqtTleiDTsvHgMCJiEbKjN
-S7SgfQx5TfC4LcshytVsW33hoCmEofnTlEnLJGKRILzdC9XZzPnqJworc5HGnRusyMvo4KD0L5CL
-TfuwNhv2GXqF4G3yYROIXJ/gkwpRl4pazq+r1feqCapgvdzZX99yqWATXgAByUr6P6TqBwMhAo6C
-ygPCm48CAwEAAaOBnDCBmTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E
-FgQUm+IHV2ccHsBqBt5ZtJot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5nbG9i
-YWxzaWduLm5ldC9yb290LXIyLmNybDAfBgNVHSMEGDAWgBSb4gdXZxwewGoG3lm0mi3f3BmGLjAN
-BgkqhkiG9w0BAQUFAAOCAQEAmYFThxxol4aR7OBKuEQLq4GsJ0/WwbgcQ3izDJr86iw8bmEbTUsp
-9Z8FHSbBuOmDAGJFtqkIk7mpM0sYmsL4h4hO291xNBrBVNpGP+DTKqttVCL1OmLNIG+6KYnX3ZHu
-01yiPqFbQfXf5WRDLenVOavSot+3i9DAgBkcRcAtjOj4LaR0VknFBbVPFd5uRHg5h6h+u/N5GJG7
-9G+dwfCMNYxdAfvDbbnvRG15RjF+Cv6pgsH/76tuIMRQyV+dTZsXjAzlAcmgQWpzU/qlULRuJQ/7
-TBj0/VLZjmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg==
------END CERTIFICATE-----
-
-ValiCert Class 1 VA
-===================
------BEGIN CERTIFICATE-----
-MIIC5zCCAlACAQEwDQYJKoZIhvcNAQEFBQAwgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRp
-b24gTmV0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENs
-YXNzIDEgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZh
-bGljZXJ0LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMB4XDTk5MDYyNTIy
-MjM0OFoXDTE5MDYyNTIyMjM0OFowgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRpb24gTmV0
-d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENsYXNzIDEg
-UG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZhbGljZXJ0
-LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMIGfMA0GCSqGSIb3DQEBAQUA
-A4GNADCBiQKBgQDYWYJ6ibiWuqYvaG9YLqdUHAZu9OqNSLwxlBfw8068srg1knaw0KWlAdcAAxIi
-GQj4/xEjm84H9b9pGib+TunRf50sQB1ZaG6m+FiwnRqP0z/x3BkGgagO4DrdyFNFCQbmD3DD+kCm
-DuJWBQ8YTfwggtFzVXSNdnKgHZ0dwN0/cQIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFBoPUn0LBwG
-lN+VYH+Wexf+T3GtZMjdd9LvWVXoP+iOBSoh8gfStadS/pyxtuJbdxdA6nLWI8sogTLDAHkY7FkX
-icnGah5xyf23dKUlRWnFSKsZ4UWKJWsZ7uW7EvV/96aNUcPwnXS3qT6gpf+2SQMT2iLM7XGCK5nP
-Orf1LXLI
------END CERTIFICATE-----
-
-ValiCert Class 2 VA
-===================
------BEGIN CERTIFICATE-----
-MIIC5zCCAlACAQEwDQYJKoZIhvcNAQEFBQAwgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRp
-b24gTmV0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENs
-YXNzIDIgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZh
-bGljZXJ0LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMB4XDTk5MDYyNjAw
-MTk1NFoXDTE5MDYyNjAwMTk1NFowgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRpb24gTmV0
-d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENsYXNzIDIg
-UG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZhbGljZXJ0
-LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMIGfMA0GCSqGSIb3DQEBAQUA
-A4GNADCBiQKBgQDOOnHK5avIWZJV16vYdA757tn2VUdZZUcOBVXc65g2PFxTXdMwzzjsvUGJ7SVC
-CSRrCl6zfN1SLUzm1NZ9WlmpZdRJEy0kTRxQb7XBhVQ7/nHk01xC+YDgkRoKWzk2Z/M/VXwbP7Rf
-ZHM047QSv4dk+NoS/zcnwbNDu+97bi5p9wIDAQABMA0GCSqGSIb3DQEBBQUAA4GBADt/UG9vUJSZ
-SWI4OB9L+KXIPqeCgfYrx+jFzug6EILLGACOTb2oWH+heQC1u+mNr0HZDzTuIYEZoDJJKPTEjlbV
-UjP9UNV+mWwD5MlM/Mtsq2azSiGM5bUMMj4QssxsodyamEwCW/POuZ6lcg5Ktz885hZo+L7tdEy8
-W9ViH0Pd
------END CERTIFICATE-----
-
-RSA Root Certificate 1
-======================
------BEGIN CERTIFICATE-----
-MIIC5zCCAlACAQEwDQYJKoZIhvcNAQEFBQAwgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRp
-b24gTmV0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENs
-YXNzIDMgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZh
-bGljZXJ0LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMB4XDTk5MDYyNjAw
-MjIzM1oXDTE5MDYyNjAwMjIzM1owgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRpb24gTmV0
-d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENsYXNzIDMg
-UG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZhbGljZXJ0
-LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMIGfMA0GCSqGSIb3DQEBAQUA
-A4GNADCBiQKBgQDjmFGWHOjVsQaBalfDcnWTq8+epvzzFlLWLU2fNUSoLgRNB0mKOCn1dzfnt6td
-3zZxFJmP3MKS8edgkpfs2Ejcv8ECIMYkpChMMFp2bbFc893enhBxoYjHW5tBbcqwuI4V7q0zK89H
-BFx1cQqYJJgpp0lZpd34t0NiYfPT4tBVPwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFa7AliEZwgs
-3x/be0kz9dNnnfS0ChCzycUs4pJqcXgn8nCDQtM+z6lU9PHYkhaM0QTLS6vJn0WuPIqpsHEzXcjF
-V9+vqDWzf4mH6eglkrh/hXqu1rweN1gqZ8mRzyqBPu3GOd/APhmcGcwTTYJBtYze4D1gCCAPRX5r
-on+jjBXu
------END CERTIFICATE-----
-
-Verisign Class 3 Public Primary Certification Authority - G3
-============================================================
------BEGIN CERTIFICATE-----
-MIIEGjCCAwICEQCbfgZJoz5iudXukEhxKe9XMA0GCSqGSIb3DQEBBQUAMIHKMQswCQYDVQQGEwJV
-UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
-cmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
-IG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNh
-dGlvbiBBdXRob3JpdHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQsw
-CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRy
-dXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhv
-cml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkg
-Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
-ggEBAMu6nFL8eB8aHm8bN3O9+MlrlBIwT/A2R/XQkQr1F8ilYcEWQE37imGQ5XYgwREGfassbqb1
-EUGO+i2tKmFZpGcmTNDovFJbcCAEWNF6yaRpvIMXZK0Fi7zQWM6NjPXr8EJJC52XJ2cybuGukxUc
-cLwgTS8Y3pKI6GyFVxEa6X7jJhFUokWWVYPKMIno3Nij7SqAP395ZVc+FSBmCC+Vk7+qRy+oRpfw
-EuL+wgorUeZ25rdGt+INpsyow0xZVYnm6FNcHOqd8GIWC6fJXwzw3sJ2zq/3avL6QaaiMxTJ5Xpj
-055iN9WFZZ4O5lMkdBteHRJTW8cs54NJOxWuimi5V5cCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEA
-ERSWwauSCPc/L8my/uRan2Te2yFPhpk0djZX3dAVL8WtfxUfN2JzPtTnX84XA9s1+ivbrmAJXx5f
-j267Cz3qWhMeDGBvtcC1IyIuBwvLqXTLR7sdwdela8wv0kL9Sd2nic9TutoAWii/gt/4uhMdUIaC
-/Y4wjylGsB49Ndo4YhYYSq3mtlFs3q9i6wHQHiT+eo8SGhJouPtmmRQURVyu565pF4ErWjfJXir0
-xuKhXFSbplQAz/DxwceYMBo7Nhbbo27q/a2ywtrvAkcTisDxszGtTxzhT5yvDwyd93gN2PQ1VoDa
-t20Xj50egWTh/sVFuq1ruQp6Tk9LhO5L8X3dEQ==
------END CERTIFICATE-----
-
-Verisign Class 4 Public Primary Certification Authority - G3
-============================================================
------BEGIN CERTIFICATE-----
-MIIEGjCCAwICEQDsoKeLbnVqAc/EfMwvlF7XMA0GCSqGSIb3DQEBBQUAMIHKMQswCQYDVQQGEwJV
-UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
-cmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
-IG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDQgUHVibGljIFByaW1hcnkgQ2VydGlmaWNh
-dGlvbiBBdXRob3JpdHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQsw
-CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRy
-dXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhv
-cml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDQgUHVibGljIFByaW1hcnkg
-Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
-ggEBAK3LpRFpxlmr8Y+1GQ9Wzsy1HyDkniYlS+BzZYlZ3tCD5PUPtbut8XzoIfzk6AzufEUiGXaS
-tBO3IFsJ+mGuqPKljYXCKtbeZjbSmwL0qJJgfJxptI8kHtCGUvYynEFYHiK9zUVilQhu0GbdU6LM
-8BDcVHOLBKFGMzNcF0C5nk3T875Vg+ixiY5afJqWIpA7iCXy0lOIAgwLePLmNxdLMEYH5IBtptiW
-Lugs+BGzOA1mppvqySNb247i8xOOGlktqgLw7KSHZtzBP/XYufTsgsbSPZUd5cBPhMnZo0QoBmrX
-Razwa2rvTl/4EYIeOGM0ZlDUPpNz+jDDZq3/ky2X7wMCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEA
-j/ola09b5KROJ1WrIhVZPMq1CtRK26vdoV9TxaBXOcLORyu+OshWv8LZJxA6sQU8wHcxuzrTBXtt
-mhwwjIDLk5Mqg6sFUYICABFna/OIYUdfA5PVWw3g8dShMjWFsjrbsIKr0csKvE+MW8VLADsfKoKm
-fjaF3H48ZwC15DtS4KjrXRX5xm3wrR0OhbepmnMUWluPQSjA1egtTaRezarZ7c7c2NU8Qh0XwRJd
-RTjDOPP8hS6DRkiy1yBfkjaP53kPmF6Z6PDQpLv1U70qzlmwr25/bLvSHgCwIe34QWKCudiyxLtG
-UPMxxY8BqHTr9Xgn2uf3ZkPznoM+IKrDNWCRzg==
------END CERTIFICATE-----
-
-Entrust.net Secure Server CA
-============================
------BEGIN CERTIFICATE-----
-MIIE2DCCBEGgAwIBAgIEN0rSQzANBgkqhkiG9w0BAQUFADCBwzELMAkGA1UEBhMCVVMxFDASBgNV
-BAoTC0VudHJ1c3QubmV0MTswOQYDVQQLEzJ3d3cuZW50cnVzdC5uZXQvQ1BTIGluY29ycC4gYnkg
-cmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRl
-ZDE6MDgGA1UEAxMxRW50cnVzdC5uZXQgU2VjdXJlIFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhv
-cml0eTAeFw05OTA1MjUxNjA5NDBaFw0xOTA1MjUxNjM5NDBaMIHDMQswCQYDVQQGEwJVUzEUMBIG
-A1UEChMLRW50cnVzdC5uZXQxOzA5BgNVBAsTMnd3dy5lbnRydXN0Lm5ldC9DUFMgaW5jb3JwLiBi
-eSByZWYuIChsaW1pdHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMTk5OSBFbnRydXN0Lm5ldCBMaW1p
-dGVkMTowOAYDVQQDEzFFbnRydXN0Lm5ldCBTZWN1cmUgU2VydmVyIENlcnRpZmljYXRpb24gQXV0
-aG9yaXR5MIGdMA0GCSqGSIb3DQEBAQUAA4GLADCBhwKBgQDNKIM0VBuJ8w+vN5Ex/68xYMmo6LIQ
-aO2f55M28Qpku0f1BBc/I0dNxScZgSYMVHINiC3ZH5oSn7yzcdOAGT9HZnuMNSjSuQrfJNqc1lB5
-gXpa0zf3wkrYKZImZNHkmGw6AIr1NJtl+O3jEP/9uElY3KDegjlrgbEWGWG5VLbmQwIBA6OCAdcw
-ggHTMBEGCWCGSAGG+EIBAQQEAwIABzCCARkGA1UdHwSCARAwggEMMIHeoIHboIHYpIHVMIHSMQsw
-CQYDVQQGEwJVUzEUMBIGA1UEChMLRW50cnVzdC5uZXQxOzA5BgNVBAsTMnd3dy5lbnRydXN0Lm5l
-dC9DUFMgaW5jb3JwLiBieSByZWYuIChsaW1pdHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMTk5OSBF
-bnRydXN0Lm5ldCBMaW1pdGVkMTowOAYDVQQDEzFFbnRydXN0Lm5ldCBTZWN1cmUgU2VydmVyIENl
-cnRpZmljYXRpb24gQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMCmgJ6AlhiNodHRwOi8vd3d3LmVu
-dHJ1c3QubmV0L0NSTC9uZXQxLmNybDArBgNVHRAEJDAigA8xOTk5MDUyNTE2MDk0MFqBDzIwMTkw
-NTI1MTYwOTQwWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAU8BdiE1U9s/8KAGv7UISX8+1i0Bow
-HQYDVR0OBBYEFPAXYhNVPbP/CgBr+1CEl/PtYtAaMAwGA1UdEwQFMAMBAf8wGQYJKoZIhvZ9B0EA
-BAwwChsEVjQuMAMCBJAwDQYJKoZIhvcNAQEFBQADgYEAkNwwAvpkdMKnCqV8IY00F6j7Rw7/JXyN
-Ewr75Ji174z4xRAN95K+8cPV1ZVqBLssziY2ZcgxxufuP+NXdYR6Ee9GTxj005i7qIcyunL2POI9
-n9cd2cNgQ4xYDiKWL2KjLB+6rQXvqzJ4h6BUcxm1XAX5Uj5tLUUL9wqT6u0G+bI=
------END CERTIFICATE-----
-
-Entrust.net Premium 2048 Secure Server CA
-=========================================
------BEGIN CERTIFICATE-----
-MIIEXDCCA0SgAwIBAgIEOGO5ZjANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChMLRW50cnVzdC5u
-ZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBpbmNvcnAuIGJ5IHJlZi4gKGxp
-bWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNV
-BAMTKkVudHJ1c3QubmV0IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQx
-NzUwNTFaFw0xOTEyMjQxODIwNTFaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3
-d3d3LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTEl
-MCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEGA1UEAxMqRW50cnVzdC5u
-ZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgpMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
-MIIBCgKCAQEArU1LqRKGsuqjIAcVFmQqK0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOL
-Gp18EzoOH1u3Hs/lJBQesYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSr
-hRSGlVuXMlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVTXTzW
-nLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/HoZdenoVve8AjhUi
-VBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH4QIDAQABo3QwcjARBglghkgBhvhC
-AQEEBAMCAAcwHwYDVR0jBBgwFoAUVeSB0RGAvtiJuQijMfmhJAkWuXAwHQYDVR0OBBYEFFXkgdER
-gL7YibkIozH5oSQJFrlwMB0GCSqGSIb2fQdBAAQQMA4bCFY1LjA6NC4wAwIEkDANBgkqhkiG9w0B
-AQUFAAOCAQEAWUesIYSKF8mciVMeuoCFGsY8Tj6xnLZ8xpJdGGQC49MGCBFhfGPjK50xA3B20qMo
-oPS7mmNz7W3lKtvtFKkrxjYR0CvrB4ul2p5cGZ1WEvVUKcgF7bISKo30Axv/55IQh7A6tcOdBTcS
-o8f0FbnVpDkWm1M6I5HxqIKiaohowXkCIryqptau37AUX7iH0N18f3v/rxzP5tsHrV7bhZ3QKw0z
-2wTR5klAEyt2+z7pnIkPFc4YsIV4IU9rTw76NmfNB/L/CNDi3tm/Kq+4h4YhPATKt5Rof8886ZjX
-OP/swNlQ8C5LWK5Gb9Auw2DaclVyvUxFnmG6v4SBkgPR0ml8xQ==
------END CERTIFICATE-----
-
-Baltimore CyberTrust Root
-=========================
------BEGIN CERTIFICATE-----
-MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJRTESMBAGA1UE
-ChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYDVQQDExlCYWx0aW1vcmUgQ3li
-ZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoXDTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMC
-SUUxEjAQBgNVBAoTCUJhbHRpbW9yZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFs
-dGltb3JlIEN5YmVyVHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKME
-uyKrmD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjrIZ3AQSsB
-UnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeKmpYcqWe4PwzV9/lSEy/C
-G9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSuXmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9
-XbIGevOF6uvUA65ehD5f/xXtabz5OTZydc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjpr
-l3RjM71oGDHweI12v/yejl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoI
-VDaGezq1BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEB
-BQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT929hkTI7gQCvlYpNRh
-cL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3WgxjkzSswF07r51XgdIGn9w/xZchMB5
-hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsa
-Y71k5h+3zvDyny67G7fyUIhzksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9H
-RCwBXbsdtTLSR9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp
------END CERTIFICATE-----
-
-Equifax Secure Global eBusiness CA
-==================================
------BEGIN CERTIFICATE-----
-MIICkDCCAfmgAwIBAgIBATANBgkqhkiG9w0BAQQFADBaMQswCQYDVQQGEwJVUzEcMBoGA1UEChMT
-RXF1aWZheCBTZWN1cmUgSW5jLjEtMCsGA1UEAxMkRXF1aWZheCBTZWN1cmUgR2xvYmFsIGVCdXNp
-bmVzcyBDQS0xMB4XDTk5MDYyMTA0MDAwMFoXDTIwMDYyMTA0MDAwMFowWjELMAkGA1UEBhMCVVMx
-HDAaBgNVBAoTE0VxdWlmYXggU2VjdXJlIEluYy4xLTArBgNVBAMTJEVxdWlmYXggU2VjdXJlIEds
-b2JhbCBlQnVzaW5lc3MgQ0EtMTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAuucXkAJlsTRV
-PEnCUdXfp9E3j9HngXNBUmCbnaEXJnitx7HoJpQytd4zjTov2/KaelpzmKNc6fuKcxtc58O/gGzN
-qfTWK8D3+ZmqY6KxRwIP1ORROhI8bIpaVIRw28HFkM9yRcuoWcDNM50/o5brhTMhHD4ePmBudpxn
-hcXIw2ECAwEAAaNmMGQwEQYJYIZIAYb4QgEBBAQDAgAHMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0j
-BBgwFoAUvqigdHJQa0S3ySPY+6j/s1draGwwHQYDVR0OBBYEFL6ooHRyUGtEt8kj2Puo/7NXa2hs
-MA0GCSqGSIb3DQEBBAUAA4GBADDiAVGqx+pf2rnQZQ8w1j7aDRRJbpGTJxQx78T3LUX47Me/okEN
-I7SS+RkAZ70Br83gcfxaz2TE4JaY0KNA4gGK7ycH8WUBikQtBmV1UsCGECAhX2xrD2yuCRyv8qIY
-NMR1pHMc8Y3c7635s3a0kr/clRAevsvIO1qEYBlWlKlV
------END CERTIFICATE-----
-
-Equifax Secure eBusiness CA 1
-=============================
------BEGIN CERTIFICATE-----
-MIICgjCCAeugAwIBAgIBBDANBgkqhkiG9w0BAQQFADBTMQswCQYDVQQGEwJVUzEcMBoGA1UEChMT
-RXF1aWZheCBTZWN1cmUgSW5jLjEmMCQGA1UEAxMdRXF1aWZheCBTZWN1cmUgZUJ1c2luZXNzIENB
-LTEwHhcNOTkwNjIxMDQwMDAwWhcNMjAwNjIxMDQwMDAwWjBTMQswCQYDVQQGEwJVUzEcMBoGA1UE
-ChMTRXF1aWZheCBTZWN1cmUgSW5jLjEmMCQGA1UEAxMdRXF1aWZheCBTZWN1cmUgZUJ1c2luZXNz
-IENBLTEwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAM4vGbwXt3fek6lfWg0XTzQaDJj0ItlZ
-1MRoRvC0NcWFAyDGr0WlIVFFQesWWDYyb+JQYmT5/VGcqiTZ9J2DKocKIdMSODRsjQBuWqDZQu4a
-IZX5UkxVWsUPOE9G+m34LjXWHXzr4vCwdYDIqROsvojvOm6rXyo4YgKwEnv+j6YDAgMBAAGjZjBk
-MBEGCWCGSAGG+EIBAQQEAwIABzAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFEp4MlIR21kW
-Nl7fwRQ2QGpHfEyhMB0GA1UdDgQWBBRKeDJSEdtZFjZe38EUNkBqR3xMoTANBgkqhkiG9w0BAQQF
-AAOBgQB1W6ibAxHm6VZMzfmpTMANmvPMZWnmJXbMWbfWVMMdzZmsGd20hdXgPfxiIKeES1hl8eL5
-lSE/9dR+WB5Hh1Q+WKG1tfgq73HnvMP2sUlG4tega+VWeponmHxGYhTnyfxuAxJ5gDgdSIKN/Bf+
-KpYrtWKmpj29f5JZzVoqgrI3eQ==
------END CERTIFICATE-----
-
-Equifax Secure eBusiness CA 2
-=============================
------BEGIN CERTIFICATE-----
-MIIDIDCCAomgAwIBAgIEN3DPtTANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJVUzEXMBUGA1UE
-ChMORXF1aWZheCBTZWN1cmUxJjAkBgNVBAsTHUVxdWlmYXggU2VjdXJlIGVCdXNpbmVzcyBDQS0y
-MB4XDTk5MDYyMzEyMTQ0NVoXDTE5MDYyMzEyMTQ0NVowTjELMAkGA1UEBhMCVVMxFzAVBgNVBAoT
-DkVxdWlmYXggU2VjdXJlMSYwJAYDVQQLEx1FcXVpZmF4IFNlY3VyZSBlQnVzaW5lc3MgQ0EtMjCB
-nzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA5Dk5kx5SBhsoNviyoynF7Y6yEb3+6+e0dMKP/wXn
-2Z0GvxLIPw7y1tEkshHe0XMJitSxLJgJDR5QRrKDpkWNYmi7hRsgcDKqQM2mll/EcTc/BPO3QSQ5
-BxoeLmFYoBIL5aXfxavqN3HMHMg3OrmXUqesxWoklE6ce8/AatbfIb0CAwEAAaOCAQkwggEFMHAG
-A1UdHwRpMGcwZaBjoGGkXzBdMQswCQYDVQQGEwJVUzEXMBUGA1UEChMORXF1aWZheCBTZWN1cmUx
-JjAkBgNVBAsTHUVxdWlmYXggU2VjdXJlIGVCdXNpbmVzcyBDQS0yMQ0wCwYDVQQDEwRDUkwxMBoG
-A1UdEAQTMBGBDzIwMTkwNjIzMTIxNDQ1WjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUUJ4L6q9e
-uSBIplBqy/3YIHqngnYwHQYDVR0OBBYEFFCeC+qvXrkgSKZQasv92CB6p4J2MAwGA1UdEwQFMAMB
-Af8wGgYJKoZIhvZ9B0EABA0wCxsFVjMuMGMDAgbAMA0GCSqGSIb3DQEBBQUAA4GBAAyGgq3oThr1
-jokn4jVYPSm0B482UJW/bsGe68SQsoWou7dC4A8HOd/7npCy0cE+U58DRLB+S/Rv5Hwf5+Kx5Lia
-78O9zt4LMjTZ3ijtM2vE1Nc9ElirfQkty3D1E4qUoSek1nDFbZS1yX2doNLGCEnZZpum0/QL3MUm
-V+GRMOrN
------END CERTIFICATE-----
-
-AddTrust Low-Value Services Root
-================================
------BEGIN CERTIFICATE-----
-MIIEGDCCAwCgAwIBAgIBATANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
-QWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSEwHwYDVQQDExhBZGRU
-cnVzdCBDbGFzcyAxIENBIFJvb3QwHhcNMDAwNTMwMTAzODMxWhcNMjAwNTMwMTAzODMxWjBlMQsw
-CQYDVQQGEwJTRTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBO
-ZXR3b3JrMSEwHwYDVQQDExhBZGRUcnVzdCBDbGFzcyAxIENBIFJvb3QwggEiMA0GCSqGSIb3DQEB
-AQUAA4IBDwAwggEKAoIBAQCWltQhSWDia+hBBwzexODcEyPNwTXH+9ZOEQpnXvUGW2ulCDtbKRY6
-54eyNAbFvAWlA3yCyykQruGIgb3WntP+LVbBFc7jJp0VLhD7Bo8wBN6ntGO0/7Gcrjyvd7ZWxbWr
-oulpOj0OM3kyP3CCkplhbY0wCI9xP6ZIVxn4JdxLZlyldI+Yrsj5wAYi56xz36Uu+1LcsRVlIPo1
-Zmne3yzxbrww2ywkEtvrNTVokMsAsJchPXQhI2U0K7t4WaPW4XY5mqRJjox0r26kmqPZm9I4XJui
-GMx1I4S+6+JNM3GOGvDC+Mcdoq0Dlyz4zyXG9rgkMbFjXZJ/Y/AlyVMuH79NAgMBAAGjgdIwgc8w
-HQYDVR0OBBYEFJWxtPCUtr3H2tERCSG+wa9J/RB7MAsGA1UdDwQEAwIBBjAPBgNVHRMBAf8EBTAD
-AQH/MIGPBgNVHSMEgYcwgYSAFJWxtPCUtr3H2tERCSG+wa9J/RB7oWmkZzBlMQswCQYDVQQGEwJT
-RTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSEw
-HwYDVQQDExhBZGRUcnVzdCBDbGFzcyAxIENBIFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBACxt
-ZBsfzQ3duQH6lmM0MkhHma6X7f1yFqZzR1r0693p9db7RcwpiURdv0Y5PejuvE1Uhh4dbOMXJ0Ph
-iVYrqW9yTkkz43J8KiOavD7/KCrto/8cI7pDVwlnTUtiBi34/2ydYB7YHEt9tTEv2dB8Xfjea4MY
-eDdXL+gzB2ffHsdrKpV2ro9Xo/D0UrSpUwjP4E/TelOL/bscVjby/rK25Xa71SJlpz/+0WatC7xr
-mYbvP33zGDLKe8bjq2RGlfgmadlVg3sslgf/WSxEo8bl6ancoWOAWiFeIc9TVPC6b4nbqKqVz4vj
-ccweGyBECMB6tkD9xOQ14R0WHNC8K47Wcdk=
------END CERTIFICATE-----
-
-AddTrust External Root
-======================
------BEGIN CERTIFICATE-----
-MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
-QWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYD
-VQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEw
-NDgzOFowbzELMAkGA1UEBhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRU
-cnVzdCBFeHRlcm5hbCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0Eg
-Um9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvtH7xsD821
-+iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9uMq/NzgtHj6RQa1wVsfw
-Tz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzXmk6vBbOmcZSccbNQYArHE504B4YCqOmo
-aSYYkKtMsE8jqzpPhNjfzp/haW+710LXa0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy
-2xSoRcRdKn23tNbE7qzNE0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv7
-7+ldU9U0WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYDVR0P
-BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0Jvf6xCZU7wO94CTL
-VBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEmMCQGA1UECxMdQWRk
-VHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsxIjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENB
-IFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZl
-j7DYd7usQWxHYINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5
-6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvCNr4TDea9Y355
-e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEXc4g/VhsxOBi0cQ+azcgOno4u
-G+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5amnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ=
------END CERTIFICATE-----
-
-AddTrust Public Services Root
-=============================
------BEGIN CERTIFICATE-----
-MIIEFTCCAv2gAwIBAgIBATANBgkqhkiG9w0BAQUFADBkMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
-QWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSAwHgYDVQQDExdBZGRU
-cnVzdCBQdWJsaWMgQ0EgUm9vdDAeFw0wMDA1MzAxMDQxNTBaFw0yMDA1MzAxMDQxNTBaMGQxCzAJ
-BgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEdMBsGA1UECxMUQWRkVHJ1c3QgVFRQIE5l
-dHdvcmsxIDAeBgNVBAMTF0FkZFRydXN0IFB1YmxpYyBDQSBSb290MIIBIjANBgkqhkiG9w0BAQEF
-AAOCAQ8AMIIBCgKCAQEA6Rowj4OIFMEg2Dybjxt+A3S72mnTRqX4jsIMEZBRpS9mVEBV6tsfSlbu
-nyNu9DnLoblv8n75XYcmYZ4c+OLspoH4IcUkzBEMP9smcnrHAZcHF/nXGCwwfQ56HmIexkvA/X1i
-d9NEHif2P0tEs7c42TkfYNVRknMDtABp4/MUTu7R3AnPdzRGULD4EfL+OHn3Bzn+UZKXC1sIXzSG
-Aa2Il+tmzV7R/9x98oTaunet3IAIx6eH1lWfl2royBFkuucZKT8Rs3iQhCBSWxHveNCD9tVIkNAw
-HM+A+WD+eeSI8t0A65RF62WUaUC6wNW0uLp9BBGo6zEFlpROWCGOn9Bg/QIDAQABo4HRMIHOMB0G
-A1UdDgQWBBSBPjfYkrAfd59ctKtzquf2NGAv+jALBgNVHQ8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB
-/zCBjgYDVR0jBIGGMIGDgBSBPjfYkrAfd59ctKtzquf2NGAv+qFopGYwZDELMAkGA1UEBhMCU0Ux
-FDASBgNVBAoTC0FkZFRydXN0IEFCMR0wGwYDVQQLExRBZGRUcnVzdCBUVFAgTmV0d29yazEgMB4G
-A1UEAxMXQWRkVHJ1c3QgUHVibGljIENBIFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBAAP3FUr4
-JNojVhaTdt02KLmuG7jD8WS6IBh4lSknVwW8fCr0uVFV2ocC3g8WFzH4qnkuCRO7r7IgGRLlk/lL
-+YPoRNWyQSW/iHVv/xD8SlTQX/D67zZzfRs2RcYhbbQVuE7PnFylPVoAjgbjPGsye/Kf8Lb93/Ao
-GEjwxrzQvzSAlsJKsW2Ox5BF3i9nrEUEo3rcVZLJR2bYGozH7ZxOmuASu7VqTITh4SINhwBk/ox9
-Yjllpu9CtoAlEmEBqCQTcAARJl/6NVDFSMwGR+gn2HCNX2TmoUQmXiLsks3/QppEIW1cxeMiHV9H
-EufOX1362KqxMy3ZdvJOOjMMK7MtkAY=
------END CERTIFICATE-----
-
-AddTrust Qualified Certificates Root
-====================================
------BEGIN CERTIFICATE-----
-MIIEHjCCAwagAwIBAgIBATANBgkqhkiG9w0BAQUFADBnMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
-QWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSMwIQYDVQQDExpBZGRU
-cnVzdCBRdWFsaWZpZWQgQ0EgUm9vdDAeFw0wMDA1MzAxMDQ0NTBaFw0yMDA1MzAxMDQ0NTBaMGcx
-CzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEdMBsGA1UECxMUQWRkVHJ1c3QgVFRQ
-IE5ldHdvcmsxIzAhBgNVBAMTGkFkZFRydXN0IFF1YWxpZmllZCBDQSBSb290MIIBIjANBgkqhkiG
-9w0BAQEFAAOCAQ8AMIIBCgKCAQEA5B6a/twJWoekn0e+EV+vhDTbYjx5eLfpMLXsDBwqxBb/4Oxx
-64r1EW7tTw2R0hIYLUkVAcKkIhPHEWT/IhKauY5cLwjPcWqzZwFZ8V1G87B4pfYOQnrjfxvM0PC3
-KP0q6p6zsLkEqv32x7SxuCqg+1jxGaBvcCV+PmlKfw8i2O+tCBGaKZnhqkRFmhJePp1tUvznoD1o
-L/BLcHwTOK28FSXx1s6rosAx1i+f4P8UWfyEk9mHfExUE+uf0S0R+Bg6Ot4l2ffTQO2kBhLEO+GR
-wVY18BTcZTYJbqukB8c10cIDMzZbdSZtQvESa0NvS3GU+jQd7RNuyoB/mC9suWXY6QIDAQABo4HU
-MIHRMB0GA1UdDgQWBBQ5lYtii1zJ1IC6WA+XPxUIQ8yYpzALBgNVHQ8EBAMCAQYwDwYDVR0TAQH/
-BAUwAwEB/zCBkQYDVR0jBIGJMIGGgBQ5lYtii1zJ1IC6WA+XPxUIQ8yYp6FrpGkwZzELMAkGA1UE
-BhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMR0wGwYDVQQLExRBZGRUcnVzdCBUVFAgTmV0d29y
-azEjMCEGA1UEAxMaQWRkVHJ1c3QgUXVhbGlmaWVkIENBIFJvb3SCAQEwDQYJKoZIhvcNAQEFBQAD
-ggEBABmrder4i2VhlRO6aQTvhsoToMeqT2QbPxj2qC0sVY8FtzDqQmodwCVRLae/DLPt7wh/bDxG
-GuoYQ992zPlmhpwsaPXpF/gxsxjE1kh9I0xowX67ARRvxdlu3rsEQmr49lx95dr6h+sNNVJn0J6X
-dgWTP5XHAeZpVTh/EGGZyeNfpso+gmNIquIISD6q8rKFYqa0p9m9N5xotS1WfbC3P6CxB9bpT9ze
-RXEwMn8bLgn5v1Kh7sKAPgZcLlVAwRv1cEWw3F369nJad9Jjzc9YiQBCYz95OdBEsIJuQRno3eDB
-iFrRHnGTHyQwdOUeqN48Jzd/g66ed8/wMLH/S5noxqE=
------END CERTIFICATE-----
-
-Entrust Root Certification Authority
-====================================
------BEGIN CERTIFICATE-----
-MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMCVVMxFjAUBgNV
-BAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0Lm5ldC9DUFMgaXMgaW5jb3Jw
-b3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMWKGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsG
-A1UEAxMkRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0
-MloXDTI2MTEyNzIwNTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMu
-MTkwNwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSByZWZlcmVu
-Y2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNVBAMTJEVudHJ1c3QgUm9v
-dCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
-ALaVtkNC+sZtKm9I35RMOVcF7sN5EUFoNu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYsz
-A9u3g3s+IIRe7bJWKKf44LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOww
-Cj0Yzfv9KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGIrb68
-j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi94DkZfs0Nw4pgHBN
-rziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOBsDCBrTAOBgNVHQ8BAf8EBAMCAQYw
-DwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAigA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1
-MzQyWjAfBgNVHSMEGDAWgBRokORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DH
-hmak8fdLQ/uEvW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA
-A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9tO1KzKtvn1ISM
-Y/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6ZuaAGAT/3B+XxFNSRuzFVJ7yVTa
-v52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP9WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTS
-W3iDVuycNsMm4hH2Z0kdkquM++v/eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0
-tHuu2guQOHXvgR1m0vdXcDazv/wor3ElhVsT/h5/WrQ8
------END CERTIFICATE-----
-
-RSA Security 2048 v3
-====================
------BEGIN CERTIFICATE-----
-MIIDYTCCAkmgAwIBAgIQCgEBAQAAAnwAAAAKAAAAAjANBgkqhkiG9w0BAQUFADA6MRkwFwYDVQQK
-ExBSU0EgU2VjdXJpdHkgSW5jMR0wGwYDVQQLExRSU0EgU2VjdXJpdHkgMjA0OCBWMzAeFw0wMTAy
-MjIyMDM5MjNaFw0yNjAyMjIyMDM5MjNaMDoxGTAXBgNVBAoTEFJTQSBTZWN1cml0eSBJbmMxHTAb
-BgNVBAsTFFJTQSBTZWN1cml0eSAyMDQ4IFYzMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC
-AQEAt49VcdKA3XtpeafwGFAyPGJn9gqVB93mG/Oe2dJBVGutn3y+Gc37RqtBaB4Y6lXIL5F4iSj7
-Jylg/9+PjDvJSZu1pJTOAeo+tWN7fyb9Gd3AIb2E0S1PRsNO3Ng3OTsor8udGuorryGlwSMiuLgb
-WhOHV4PR8CDn6E8jQrAApX2J6elhc5SYcSa8LWrg903w8bYqODGBDSnhAMFRD0xS+ARaqn1y07iH
-KrtjEAMqs6FPDVpeRrc9DvV07Jmf+T0kgYim3WBU6JU2PcYJk5qjEoAAVZkZR73QpXzDuvsf9/UP
-+Ky5tfQ3mBMY3oVbtwyCO4dvlTlYMNpuAWgXIszACwIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/
-MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBQHw1EwpKrpRa41JPr/JCwz0LGdjDAdBgNVHQ4E
-FgQUB8NRMKSq6UWuNST6/yQsM9CxnYwwDQYJKoZIhvcNAQEFBQADggEBAF8+hnZuuDU8TjYcHnmY
-v/3VEhF5Ug7uMYm83X/50cYVIeiKAVQNOvtUudZj1LGqlk2iQk3UUx+LEN5/Zb5gEydxiKRz44Rj
-0aRV4VCT5hsOedBnvEbIvz8XDZXmxpBp3ue0L96VfdASPz0+f00/FGj1EVDVwfSQpQgdMWD/YIwj
-VAqv/qFuxdF6Kmh4zx6CCiC0H63lhbJqaHVOrSU3lIW+vaHU6rcMSzyd6BIA8F+sDeGscGNz9395
-nzIlQnQFgCi/vcEkllgVsRch6YlL2weIZ/QVrXA+L02FO8K32/6YaCOJ4XQP3vTFhGMpG8zLB8kA
-pKnXwiJPZ9d37CAFYd4=
------END CERTIFICATE-----
-
-GeoTrust Global CA
-==================
------BEGIN CERTIFICATE-----
-MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVTMRYwFAYDVQQK
-Ew1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9iYWwgQ0EwHhcNMDIwNTIxMDQw
-MDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5j
-LjEbMBkGA1UEAxMSR2VvVHJ1c3QgR2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
-CgKCAQEA2swYYzD99BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjo
-BbdqfnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDviS2Aelet
-8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU1XupGc1V3sjs0l44U+Vc
-T4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+bw8HHa8sHo9gOeL6NlMTOdReJivbPagU
-vTLrGAMoUgRx5aszPeE4uwc2hGKceeoWMPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTAD
-AQH/MB0GA1UdDgQWBBTAephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVk
-DBF9qn1luMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKInZ57Q
-zxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfStQWVYrmm3ok9Nns4
-d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcFPseKUgzbFbS9bZvlxrFUaKnjaZC2
-mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Unhw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6p
-XE0zX5IJL4hmXXeXxx12E6nV5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvm
-Mw==
------END CERTIFICATE-----
-
-GeoTrust Global CA 2
-====================
------BEGIN CERTIFICATE-----
-MIIDZjCCAk6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBEMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
-R2VvVHJ1c3QgSW5jLjEdMBsGA1UEAxMUR2VvVHJ1c3QgR2xvYmFsIENBIDIwHhcNMDQwMzA0MDUw
-MDAwWhcNMTkwMzA0MDUwMDAwWjBEMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5j
-LjEdMBsGA1UEAxMUR2VvVHJ1c3QgR2xvYmFsIENBIDIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
-ggEKAoIBAQDvPE1APRDfO1MA4Wf+lGAVPoWI8YkNkMgoI5kF6CsgncbzYEbYwbLVjDHZ3CB5JIG/
-NTL8Y2nbsSpr7iFY8gjpeMtvy/wWUsiRxP89c96xPqfCfWbB9X5SJBri1WeR0IIQ13hLTytCOb1k
-LUCgsBDTOEhGiKEMuzozKmKY+wCdE1l/bztyqu6mD4b5BWHqZ38MN5aL5mkWRxHCJ1kDs6ZgwiFA
-Vvqgx306E+PsV8ez1q6diYD3Aecs9pYrEw15LNnA5IZ7S4wMcoKK+xfNAGw6EzywhIdLFnopsk/b
-HdQL82Y3vdj2V7teJHq4PIu5+pIaGoSe2HSPqht/XvT+RSIhAgMBAAGjYzBhMA8GA1UdEwEB/wQF
-MAMBAf8wHQYDVR0OBBYEFHE4NvICMVNHK266ZUapEBVYIAUJMB8GA1UdIwQYMBaAFHE4NvICMVNH
-K266ZUapEBVYIAUJMA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQUFAAOCAQEAA/e1K6tdEPx7
-srJerJsOflN4WT5CBP51o62sgU7XAotexC3IUnbHLB/8gTKY0UvGkpMzNTEv/NgdRN3ggX+d6Yvh
-ZJFiCzkIjKx0nVnZellSlxG5FntvRdOW2TF9AjYPnDtuzywNA0ZF66D0f0hExghAzN4bcLUprbqL
-OzRldRtxIR0sFAqwlpW41uryZfspuk/qkZN0abby/+Ea0AzRdoXLiiW9l14sbxWZJue2Kf8i7MkC
-x1YAzUm5s2x7UwQa4qjJqhIFI8LO57sEAszAR6LkxCkvW0VXiVHuPOtSCP8HNR6fNWpHSlaY0VqF
-H4z1Ir+rzoPz4iIprn2DQKi6bA==
------END CERTIFICATE-----
-
-GeoTrust Universal CA
-=====================
------BEGIN CERTIFICATE-----
-MIIFaDCCA1CgAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
-R2VvVHJ1c3QgSW5jLjEeMBwGA1UEAxMVR2VvVHJ1c3QgVW5pdmVyc2FsIENBMB4XDTA0MDMwNDA1
-MDAwMFoXDTI5MDMwNDA1MDAwMFowRTELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IElu
-Yy4xHjAcBgNVBAMTFUdlb1RydXN0IFVuaXZlcnNhbCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIP
-ADCCAgoCggIBAKYVVaCjxuAfjJ0hUNfBvitbtaSeodlyWL0AG0y/YckUHUWCq8YdgNY96xCcOq9t
-JPi8cQGeBvV8Xx7BDlXKg5pZMK4ZyzBIle0iN430SppyZj6tlcDgFgDgEB8rMQ7XlFTTQjOgNB0e
-RXbdT8oYN+yFFXoZCPzVx5zw8qkuEKmS5j1YPakWaDwvdSEYfyh3peFhF7em6fgemdtzbvQKoiFs
-7tqqhZJmr/Z6a4LauiIINQ/PQvE1+mrufislzDoR5G2vc7J2Ha3QsnhnGqQ5HFELZ1aD/ThdDc7d
-8Lsrlh/eezJS/R27tQahsiFepdaVaH/wmZ7cRQg+59IJDTWU3YBOU5fXtQlEIGQWFwMCTFMNaN7V
-qnJNk22CDtucvc+081xdVHppCZbW2xHBjXWotM85yM48vCR85mLK4b19p71XZQvk/iXttmkQ3Cga
-Rr0BHdCXteGYO8A3ZNY9lO4L4fUorgtWv3GLIylBjobFS1J72HGrH4oVpjuDWtdYAVHGTEHZf9hB
-Z3KiKN9gg6meyHv8U3NyWfWTehd2Ds735VzZC1U0oqpbtWpU5xPKV+yXbfReBi9Fi1jUIxaS5BZu
-KGNZMN9QAZxjiRqf2xeUgnA3wySemkfWWspOqGmJch+RbNt+nhutxx9z3SxPGWX9f5NAEC7S8O08
-ni4oPmkmM8V7AgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNq7LqqwDLiIJlF0
-XG0D08DYj3rWMB8GA1UdIwQYMBaAFNq7LqqwDLiIJlF0XG0D08DYj3rWMA4GA1UdDwEB/wQEAwIB
-hjANBgkqhkiG9w0BAQUFAAOCAgEAMXjmx7XfuJRAyXHEqDXsRh3ChfMoWIawC/yOsjmPRFWrZIRc
-aanQmjg8+uUfNeVE44B5lGiku8SfPeE0zTBGi1QrlaXv9z+ZhP015s8xxtxqv6fXIwjhmF7DWgh2
-qaavdy+3YL1ERmrvl/9zlcGO6JP7/TG37FcREUWbMPEaiDnBTzynANXH/KttgCJwpQzgXQQpAvvL
-oJHRfNbDflDVnVi+QTjruXU8FdmbyUqDWcDaU/0zuzYYm4UPFd3uLax2k7nZAY1IEKj79TiG8dsK
-xr2EoyNB3tZ3b4XUhRxQ4K5RirqNPnbiucon8l+f725ZDQbYKxek0nxru18UGkiPGkzns0ccjkxF
-KyDuSN/n3QmOGKjaQI2SJhFTYXNd673nxE0pN2HrrDktZy4W1vUAg4WhzH92xH3kt0tm7wNFYGm2
-DFKWkoRepqO1pD4r2czYG0eq8kTaT/kD6PAUyz/zg97QwVTjt+gKN02LIFkDMBmhLMi9ER/frslK
-xfMnZmaGrGiR/9nmUxwPi1xpZQomyB40w11Re9epnAahNt3ViZS82eQtDF4JbAiXfKM9fJP/P6EU
-p8+1Xevb2xzEdt+Iub1FBZUbrvxGakyvSOPOrg/SfuvmbJxPgWp6ZKy7PtXny3YuxadIwVyQD8vI
-P/rmMuGNG2+k5o7Y+SlIis5z/iw=
------END CERTIFICATE-----
-
-GeoTrust Universal CA 2
-=======================
------BEGIN CERTIFICATE-----
-MIIFbDCCA1SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
-R2VvVHJ1c3QgSW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwHhcNMDQwMzA0
-MDUwMDAwWhcNMjkwMzA0MDUwMDAwWjBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3Qg
-SW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwggIiMA0GCSqGSIb3DQEBAQUA
-A4ICDwAwggIKAoICAQCzVFLByT7y2dyxUxpZKeexw0Uo5dfR7cXFS6GqdHtXr0om/Nj1XqduGdt0
-DE81WzILAePb63p3NeqqWuDW6KFXlPCQo3RWlEQwAx5cTiuFJnSCegx2oG9NzkEtoBUGFF+3Qs17
-j1hhNNwqCPkuwwGmIkQcTAeC5lvO0Ep8BNMZcyfwqph/Lq9O64ceJHdqXbboW0W63MOhBW9Wjo8Q
-JqVJwy7XQYci4E+GymC16qFjwAGXEHm9ADwSbSsVsaxLse4YuU6W3Nx2/zu+z18DwPw76L5GG//a
-QMJS9/7jOvdqdzXQ2o3rXhhqMcceujwbKNZrVMaqW9eiLBsZzKIC9ptZvTdrhrVtgrrY6slWvKk2
-WP0+GfPtDCapkzj4T8FdIgbQl+rhrcZV4IErKIM6+vR7IVEAvlI4zs1meaj0gVbi0IMJR1FbUGrP
-20gaXT73y/Zl92zxlfgCOzJWgjl6W70viRu/obTo/3+NjN8D8WBOWBFM66M/ECuDmgFz2ZRthAAn
-ZqzwcEAJQpKtT5MNYQlRJNiS1QuUYbKHsu3/mjX/hVTK7URDrBs8FmtISgocQIgfksILAAX/8sgC
-SqSqqcyZlpwvWOB94b67B9xfBHJcMTTD7F8t4D1kkCLm0ey4Lt1ZrtmhN79UNdxzMk+MBB4zsslG
-8dhcyFVQyWi9qLo2CQIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR281Xh+qQ2
-+/CfXGJx7Tz0RzgQKzAfBgNVHSMEGDAWgBR281Xh+qQ2+/CfXGJx7Tz0RzgQKzAOBgNVHQ8BAf8E
-BAMCAYYwDQYJKoZIhvcNAQEFBQADggIBAGbBxiPz2eAubl/oz66wsCVNK/g7WJtAJDday6sWSf+z
-dXkzoS9tcBc0kf5nfo/sm+VegqlVHy/c1FEHEv6sFj4sNcZj/NwQ6w2jqtB8zNHQL1EuxBRa3ugZ
-4T7GzKQp5y6EqgYweHZUcyiYWTjgAA1i00J9IZ+uPTqM1fp3DRgrFg5fNuH8KrUwJM/gYwx7WBr+
-mbpCErGR9Hxo4sjoryzqyX6uuyo9DRXcNJW2GHSoag/HtPQTxORb7QrSpJdMKu0vbBKJPfEncKpq
-A1Ihn0CoZ1Dy81of398j9tx4TuaYT1U6U+Pv8vSfx3zYWK8pIpe44L2RLrB27FcRz+8pRPPphXpg
-Y+RdM4kX2TGq2tbzGDVyz4crL2MjhF2EjD9XoIj8mZEoJmmZ1I+XRL6O1UixpCgp8RW04eWe3fiP
-pm8m1wk8OhwRDqZsN/etRIcsKMfYdIKz0G9KV7s1KSegi+ghp4dkNl3M2Basx7InQJJVOCiNUW7d
-FGdTbHFcJoRNdVq2fmBWqU2t+5sel/MN2dKXVHfaPRK34B7vCAas+YWH6aLcr34YEoP9VhdBLtUp
-gn2Z9DH2canPLAEnpQW5qrJITirvn5NSUZU8UnOOVkwXQMAJKOSLakhT2+zNVVXxxvjpoixMptEm
-X36vWkzaH6byHCx+rgIW0lbQL1dTR+iS
------END CERTIFICATE-----
-
-America Online Root Certification Authority 1
-=============================================
------BEGIN CERTIFICATE-----
-MIIDpDCCAoygAwIBAgIBATANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEcMBoGA1UEChMT
-QW1lcmljYSBPbmxpbmUgSW5jLjE2MDQGA1UEAxMtQW1lcmljYSBPbmxpbmUgUm9vdCBDZXJ0aWZp
-Y2F0aW9uIEF1dGhvcml0eSAxMB4XDTAyMDUyODA2MDAwMFoXDTM3MTExOTIwNDMwMFowYzELMAkG
-A1UEBhMCVVMxHDAaBgNVBAoTE0FtZXJpY2EgT25saW5lIEluYy4xNjA0BgNVBAMTLUFtZXJpY2Eg
-T25saW5lIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgMTCCASIwDQYJKoZIhvcNAQEBBQAD
-ggEPADCCAQoCggEBAKgv6KRpBgNHw+kqmP8ZonCaxlCyfqXfaE0bfA+2l2h9LaaLl+lkhsmj76CG
-v2BlnEtUiMJIxUo5vxTjWVXlGbR0yLQFOVwWpeKVBeASrlmLojNoWBym1BW32J/X3HGrfpq/m44z
-DyL9Hy7nBzbvYjnF3cu6JRQj3gzGPTzOggjmZj7aUTsWOqMFf6Dch9Wc/HKpoH145LcxVR5lu9Rh
-sCFg7RAycsWSJR74kEoYeEfffjA3PlAb2xzTa5qGUwew76wGePiEmf4hjUyAtgyC9mZweRrTT6PP
-8c9GsEsPPt2IYriMqQkoO3rHl+Ee5fSfwMCuJKDIodkP1nsmgmkyPacCAwEAAaNjMGEwDwYDVR0T
-AQH/BAUwAwEB/zAdBgNVHQ4EFgQUAK3Zo/Z59m50qX8zPYEX10zPM94wHwYDVR0jBBgwFoAUAK3Z
-o/Z59m50qX8zPYEX10zPM94wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBBQUAA4IBAQB8itEf
-GDeC4Liwo+1WlchiYZwFos3CYiZhzRAW18y0ZTTQEYqtqKkFZu90821fnZmv9ov761KyBZiibyrF
-VL0lvV+uyIbqRizBs73B6UlwGBaXCBOMIOAbLjpHyx7kADCVW/RFo8AasAFOq73AI25jP4BKxQft
-3OJvx8Fi8eNy1gTIdGcL+oiroQHIb/AUr9KZzVGTfu0uOMe9zkZQPXLjeSWdm4grECDdpbgyn43g
-Kd8hdIaC2y+CMMbHNYaz+ZZfRtsMRf3zUMNvxsNIrUam4SdHCh0Om7bCd39j8uB9Gr784N/Xx6ds
-sPmuujz9dLQR6FgNgLzTqIA6me11zEZ7
------END CERTIFICATE-----
-
-America Online Root Certification Authority 2
-=============================================
------BEGIN CERTIFICATE-----
-MIIFpDCCA4ygAwIBAgIBATANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEcMBoGA1UEChMT
-QW1lcmljYSBPbmxpbmUgSW5jLjE2MDQGA1UEAxMtQW1lcmljYSBPbmxpbmUgUm9vdCBDZXJ0aWZp
-Y2F0aW9uIEF1dGhvcml0eSAyMB4XDTAyMDUyODA2MDAwMFoXDTM3MDkyOTE0MDgwMFowYzELMAkG
-A1UEBhMCVVMxHDAaBgNVBAoTE0FtZXJpY2EgT25saW5lIEluYy4xNjA0BgNVBAMTLUFtZXJpY2Eg
-T25saW5lIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgMjCCAiIwDQYJKoZIhvcNAQEBBQAD
-ggIPADCCAgoCggIBAMxBRR3pPU0Q9oyxQcngXssNt79Hc9PwVU3dxgz6sWYFas14tNwC206B89en
-fHG8dWOgXeMHDEjsJcQDIPT/DjsS/5uN4cbVG7RtIuOx238hZK+GvFciKtZHgVdEglZTvYYUAQv8
-f3SkWq7xuhG1m1hagLQ3eAkzfDJHA1zEpYNI9FdWboE2JxhP7JsowtS013wMPgwr38oE18aO6lhO
-qKSlGBxsRZijQdEt0sdtjRnxrXm3gT+9BoInLRBYBbV4Bbkv2wxrkJB+FFk4u5QkE+XRnRTf04JN
-RvCAOVIyD+OEsnpD8l7eXz8d3eOyG6ChKiMDbi4BFYdcpnV1x5dhvt6G3NRI270qv0pV2uh9UPu0
-gBe4lL8BPeraunzgWGcXuVjgiIZGZ2ydEEdYMtA1fHkqkKJaEBEjNa0vzORKW6fIJ/KD3l67Xnfn
-6KVuY8INXWHQjNJsWiEOyiijzirplcdIz5ZvHZIlyMbGwcEMBawmxNJ10uEqZ8A9W6Wa6897Gqid
-FEXlD6CaZd4vKL3Ob5Rmg0gp2OpljK+T2WSfVVcmv2/LNzGZo2C7HK2JNDJiuEMhBnIMoVxtRsX6
-Kc8w3onccVvdtjc+31D1uAclJuW8tf48ArO3+L5DwYcRlJ4jbBeKuIonDFRH8KmzwICMoCfrHRnj
-B453cMor9H124HhnAgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFE1FwWg4u3Op
-aaEg5+31IqEjFNeeMB8GA1UdIwQYMBaAFE1FwWg4u3OpaaEg5+31IqEjFNeeMA4GA1UdDwEB/wQE
-AwIBhjANBgkqhkiG9w0BAQUFAAOCAgEAZ2sGuV9FOypLM7PmG2tZTiLMubekJcmnxPBUlgtk87FY
-T15R/LKXeydlwuXK5w0MJXti4/qftIe3RUavg6WXSIylvfEWK5t2LHo1YGwRgJfMqZJS5ivmae2p
-+DYtLHe/YUjRYwu5W1LtGLBDQiKmsXeu3mnFzcccobGlHBD7GL4acN3Bkku+KVqdPzW+5X1R+FXg
-JXUjhx5c3LqdsKyzadsXg8n33gy8CNyRnqjQ1xU3c6U1uPx+xURABsPr+CKAXEfOAuMRn0T//Zoy
-zH1kUQ7rVyZ2OuMeIjzCpjbdGe+n/BLzJsBZMYVMnNjP36TMzCmT/5RtdlwTCJfy7aULTd3oyWgO
-ZtMADjMSW7yV5TKQqLPGbIOtd+6Lfn6xqavT4fG2wLHqiMDn05DpKJKUe2h7lyoKZy2FAjgQ5ANh
-1NolNscIWC2hp1GvMApJ9aZphwctREZ2jirlmjvXGKL8nDgQzMY70rUXOm/9riW99XJZZLF0Kjhf
-GEzfz3EEWjbUvy+ZnOjZurGV5gJLIaFb1cFPj65pbVPbAZO1XB4Y3WRayhgoPmMEEf0cjQAPuDff
-Z4qdZqkCapH/E8ovXYO8h5Ns3CRRFgQlZvqz2cK6Kb6aSDiCmfS/O0oxGfm/jiEzFMpPVF/7zvuP
-cX/9XhmgD0uRuMRUvAawRY8mkaKO/qk=
------END CERTIFICATE-----
-
-Visa eCommerce Root
-===================
------BEGIN CERTIFICATE-----
-MIIDojCCAoqgAwIBAgIQE4Y1TR0/BvLB+WUF1ZAcYjANBgkqhkiG9w0BAQUFADBrMQswCQYDVQQG
-EwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMmVmlzYSBJbnRlcm5hdGlvbmFsIFNlcnZpY2Ug
-QXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNvbW1lcmNlIFJvb3QwHhcNMDIwNjI2MDIxODM2
-WhcNMjIwNjI0MDAxNjEyWjBrMQswCQYDVQQGEwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMm
-VmlzYSBJbnRlcm5hdGlvbmFsIFNlcnZpY2UgQXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNv
-bW1lcmNlIFJvb3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvV95WHm6h2mCxlCfL
-F9sHP4CFT8icttD0b0/Pmdjh28JIXDqsOTPHH2qLJj0rNfVIsZHBAk4ElpF7sDPwsRROEW+1QK8b
-RaVK7362rPKgH1g/EkZgPI2h4H3PVz4zHvtH8aoVlwdVZqW1LS7YgFmypw23RuwhY/81q6UCzyr0
-TP579ZRdhE2o8mCP2w4lPJ9zcc+U30rq299yOIzzlr3xF7zSujtFWsan9sYXiwGd/BmoKoMWuDpI
-/k4+oKsGGelT84ATB+0tvz8KPFUgOSwsAGl0lUq8ILKpeeUYiZGo3BxN77t+Nwtd/jmliFKMAGzs
-GHxBvfaLdXe6YJ2E5/4tAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEG
-MB0GA1UdDgQWBBQVOIMPPyw/cDMezUb+B4wg4NfDtzANBgkqhkiG9w0BAQUFAAOCAQEAX/FBfXxc
-CLkr4NWSR/pnXKUTwwMhmytMiUbPWU3J/qVAtmPN3XEolWcRzCSs00Rsca4BIGsDoo8Ytyk6feUW
-YFN4PMCvFYP3j1IzJL1kk5fui/fbGKhtcbP3LBfQdCVp9/5rPJS+TUtBjE7ic9DjkCJzQ83z7+pz
-zkWKsKZJ/0x9nXGIxHYdkFsd7v3M9+79YKWxehZx0RbQfBI8bGmX265fOZpwLwU8GUYEmSA20GBu
-YQa7FkKMcPcw++DbZqMAAb3mLNqRX6BGi01qnD093QVG/na/oAo85ADmJ7f/hC3euiInlhBx6yLt
-398znM/jra6O1I7mT1GvFpLgXPYHDw==
------END CERTIFICATE-----
-
-Certum Root CA
-==============
------BEGIN CERTIFICATE-----
-MIIDDDCCAfSgAwIBAgIDAQAgMA0GCSqGSIb3DQEBBQUAMD4xCzAJBgNVBAYTAlBMMRswGQYDVQQK
-ExJVbml6ZXRvIFNwLiB6IG8uby4xEjAQBgNVBAMTCUNlcnR1bSBDQTAeFw0wMjA2MTExMDQ2Mzla
-Fw0yNzA2MTExMDQ2MzlaMD4xCzAJBgNVBAYTAlBMMRswGQYDVQQKExJVbml6ZXRvIFNwLiB6IG8u
-by4xEjAQBgNVBAMTCUNlcnR1bSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAM6x
-wS7TT3zNJc4YPk/EjG+AanPIW1H4m9LcuwBcsaD8dQPugfCI7iNS6eYVM42sLQnFdvkrOYCJ5JdL
-kKWoePhzQ3ukYbDYWMzhbGZ+nPMJXlVjhNWo7/OxLjBos8Q82KxujZlakE403Daaj4GIULdtlkIJ
-89eVgw1BS7Bqa/j8D35in2fE7SZfECYPCE/wpFcozo+47UX2bu4lXapuOb7kky/ZR6By6/qmW6/K
-Uz/iDsaWVhFu9+lmqSbYf5VT7QqFiLpPKaVCjF62/IUgAKpoC6EahQGcxEZjgoi2IrHu/qpGWX7P
-NSzVttpd90gzFFS269lvzs2I1qsb2pY7HVkCAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zANBgkq
-hkiG9w0BAQUFAAOCAQEAuI3O7+cUus/usESSbLQ5PqKEbq24IXfS1HeCh+YgQYHu4vgRt2PRFze+
-GXYkHAQaTOs9qmdvLdTN/mUxcMUbpgIKumB7bVjCmkn+YzILa+M6wKyrO7Do0wlRjBCDxjTgxSvg
-GrZgFCdsMneMvLJymM/NzD+5yCRCFNZX/OYmQ6kd5YCQzgNUKD73P9P4Te1qCjqTE5s7FCMTY5w/
-0YcneeVMUeMBrYVdGjux1XMQpNPyvG5k9VpWkKjHDkx0Dy5xO/fIR/RpbxXyEV6DHpx8Uq79AtoS
-qFlnGNu8cN2bsWntgM6JQEhqDjXKKWYVIZQs6GAqm4VKQPNriiTsBhYscw==
------END CERTIFICATE-----
-
-Comodo AAA Services root
-========================
------BEGIN CERTIFICATE-----
-MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
-R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
-TGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAw
-MFoXDTI4MTIzMTIzNTk1OVowezELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hl
-c3RlcjEQMA4GA1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNV
-BAMMGEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
-ggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQuaBtDFcCLNSS1UY8y2bmhG
-C1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe3M/vg4aijJRPn2jymJBGhCfHdr/jzDUs
-i14HZGWCwEiwqJH5YZ92IFCokcdmtet4YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszW
-Y19zjNoFmag4qMsXeDZRrOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjH
-Ypy+g8cmez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQUoBEK
-Iz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wewYDVR0f
-BHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20vQUFBQ2VydGlmaWNhdGVTZXJ2aWNl
-cy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29tb2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2Vz
-LmNybDANBgkqhkiG9w0BAQUFAAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm
-7l3sAg9g1o1QGE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz
-Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2G9w84FoVxp7Z
-8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsil2D4kF501KKaU73yqWjgom7C
-12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg==
------END CERTIFICATE-----
-
-Comodo Secure Services root
-===========================
------BEGIN CERTIFICATE-----
-MIIEPzCCAyegAwIBAgIBATANBgkqhkiG9w0BAQUFADB+MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
-R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
-TGltaXRlZDEkMCIGA1UEAwwbU2VjdXJlIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAw
-MDAwMFoXDTI4MTIzMTIzNTk1OVowfjELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFu
-Y2hlc3RlcjEQMA4GA1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxJDAi
-BgNVBAMMG1NlY3VyZSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEP
-ADCCAQoCggEBAMBxM4KK0HDrc4eCQNUd5MvJDkKQ+d40uaG6EfQlhfPMcm3ye5drswfxdySRXyWP
-9nQ95IDC+DwN879A6vfIUtFyb+/Iq0G4bi4XKpVpDM3SHpR7LZQdqnXXs5jLrLxkU0C8j6ysNstc
-rbvd4JQX7NFc0L/vpZXJkMWwrPsbQ996CF23uPJAGysnnlDOXmWCiIxe004MeuoIkbY2qitC++rC
-oznl2yY4rYsK7hljxxwk3wN42ubqwUcaCwtGCd0C/N7Lh1/XMGNooa7cMqG6vv5Eq2i2pRcV/b3V
-p6ea5EQz6YiO/O1R65NxTq0B50SOqy3LqP4BSUjwwN3HaNiS/j0CAwEAAaOBxzCBxDAdBgNVHQ4E
-FgQUPNiTiMLAggnMAZkGkyDpnnAJY08wDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8w
-gYEGA1UdHwR6MHgwO6A5oDeGNWh0dHA6Ly9jcmwuY29tb2RvY2EuY29tL1NlY3VyZUNlcnRpZmlj
-YXRlU2VydmljZXMuY3JsMDmgN6A1hjNodHRwOi8vY3JsLmNvbW9kby5uZXQvU2VjdXJlQ2VydGlm
-aWNhdGVTZXJ2aWNlcy5jcmwwDQYJKoZIhvcNAQEFBQADggEBAIcBbSMdflsXfcFhMs+P5/OKlFlm
-4J4oqF7Tt/Q05qo5spcWxYJvMqTpjOev/e/C6LlLqqP05tqNZSH7uoDrJiiFGv45jN5bBAS0VPmj
-Z55B+glSzAVIqMk/IQQezkhr/IXownuvf7fM+F86/TXGDe+X3EyrEeFryzHRbPtIgKvcnDe4IRRL
-DXE97IMzbtFuMhbsmMcWi1mmNKsFVy2T96oTy9IT4rcuO81rUBcJaD61JlfutuC23bkpgHl9j6Pw
-pCikFcSF9CfUa7/lXORlAnZUtOM3ZiTTGWHIUhDlizeauan5Hb/qmZJhlv8BzaFfDbxxvA6sCx1H
-RR3B7Hzs/Sk=
------END CERTIFICATE-----
-
-Comodo Trusted Services root
-============================
------BEGIN CERTIFICATE-----
-MIIEQzCCAyugAwIBAgIBATANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
-R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
-TGltaXRlZDElMCMGA1UEAwwcVHJ1c3RlZCBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczAeFw0wNDAxMDEw
-MDAwMDBaFw0yODEyMzEyMzU5NTlaMH8xCzAJBgNVBAYTAkdCMRswGQYDVQQIDBJHcmVhdGVyIE1h
-bmNoZXN0ZXIxEDAOBgNVBAcMB1NhbGZvcmQxGjAYBgNVBAoMEUNvbW9kbyBDQSBMaW1pdGVkMSUw
-IwYDVQQDDBxUcnVzdGVkIENlcnRpZmljYXRlIFNlcnZpY2VzMIIBIjANBgkqhkiG9w0BAQEFAAOC
-AQ8AMIIBCgKCAQEA33FvNlhTWvI2VFeAxHQIIO0Yfyod5jWaHiWsnOWWfnJSoBVC21ndZHoa0Lh7
-3TkVvFVIxO06AOoxEbrycXQaZ7jPM8yoMa+j49d/vzMtTGo87IvDktJTdyR0nAducPy9C1t2ul/y
-/9c3S0pgePfw+spwtOpZqqPOSC+pw7ILfhdyFgymBwwbOM/JYrc/oJOlh0Hyt3BAd9i+FHzjqMB6
-juljatEPmsbS9Is6FARW1O24zG71++IsWL1/T2sr92AkWCTOJu80kTrV44HQsvAEAtdbtz6SrGsS
-ivnkBbA7kUlcsutT6vifR4buv5XAwAaf0lteERv0xwQ1KdJVXOTt6wIDAQABo4HJMIHGMB0GA1Ud
-DgQWBBTFe1i97doladL3WRaoszLAeydb9DAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB
-/zCBgwYDVR0fBHwwejA8oDqgOIY2aHR0cDovL2NybC5jb21vZG9jYS5jb20vVHJ1c3RlZENlcnRp
-ZmljYXRlU2VydmljZXMuY3JsMDqgOKA2hjRodHRwOi8vY3JsLmNvbW9kby5uZXQvVHJ1c3RlZENl
-cnRpZmljYXRlU2VydmljZXMuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQDIk4E7ibSvuIQSTI3S8Ntw
-uleGFTQQuS9/HrCoiWChisJ3DFBKmwCL2Iv0QeLQg4pKHBQGsKNoBXAxMKdTmw7pSqBYaWcOrp32
-pSxBvzwGa+RZzG0Q8ZZvH9/0BAKkn0U+yNj6NkZEUD+Cl5EfKNsYEYwq5GWDVxISjBc/lDb+XbDA
-BHcTuPQV1T84zJQ6VdCsmPW6AF/ghhmBeC8owH7TzEIK9a5QoNE+xqFx7D+gIIxmOom0jtTYsU0l
-R+4viMi14QVFwL4Ucd56/Y57fU0IlqUSc/AtyjcndBInTMu2l+nZrghtWjlA3QVHdWpaIbOjGM9O
-9y5Xt5hwXsjEeLBi
------END CERTIFICATE-----
-
-QuoVadis Root CA
-================
------BEGIN CERTIFICATE-----
-MIIF0DCCBLigAwIBAgIEOrZQizANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJCTTEZMBcGA1UE
-ChMQUXVvVmFkaXMgTGltaXRlZDElMCMGA1UECxMcUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0
-eTEuMCwGA1UEAxMlUXVvVmFkaXMgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wMTAz
-MTkxODMzMzNaFw0yMTAzMTcxODMzMzNaMH8xCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRp
-cyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MS4wLAYDVQQD
-EyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEF
-AAOCAQ8AMIIBCgKCAQEAv2G1lVO6V/z68mcLOhrfEYBklbTRvM16z/Ypli4kVEAkOPcahdxYTMuk
-J0KX0J+DisPkBgNbAKVRHnAEdOLB1Dqr1607BxgFjv2DrOpm2RgbaIr1VxqYuvXtdj182d6UajtL
-F8HVj71lODqV0D1VNk7feVcxKh7YWWVJWCCYfqtffp/p1k3sg3Spx2zY7ilKhSoGFPlU5tPaZQeL
-YzcS19Dsw3sgQUSj7cugF+FxZc4dZjH3dgEZyH0DWLaVSR2mEiboxgx24ONmy+pdpibu5cxfvWen
-AScOospUxbF6lR1xHkopigPcakXBpBlebzbNw6Kwt/5cOOJSvPhEQ+aQuwIDAQABo4ICUjCCAk4w
-PQYIKwYBBQUHAQEEMTAvMC0GCCsGAQUFBzABhiFodHRwczovL29jc3AucXVvdmFkaXNvZmZzaG9y
-ZS5jb20wDwYDVR0TAQH/BAUwAwEB/zCCARoGA1UdIASCAREwggENMIIBCQYJKwYBBAG+WAABMIH7
-MIHUBggrBgEFBQcCAjCBxxqBxFJlbGlhbmNlIG9uIHRoZSBRdW9WYWRpcyBSb290IENlcnRpZmlj
-YXRlIGJ5IGFueSBwYXJ0eSBhc3N1bWVzIGFjY2VwdGFuY2Ugb2YgdGhlIHRoZW4gYXBwbGljYWJs
-ZSBzdGFuZGFyZCB0ZXJtcyBhbmQgY29uZGl0aW9ucyBvZiB1c2UsIGNlcnRpZmljYXRpb24gcHJh
-Y3RpY2VzLCBhbmQgdGhlIFF1b1ZhZGlzIENlcnRpZmljYXRlIFBvbGljeS4wIgYIKwYBBQUHAgEW
-Fmh0dHA6Ly93d3cucXVvdmFkaXMuYm0wHQYDVR0OBBYEFItLbe3TKbkGGew5Oanwl4Rqy+/fMIGu
-BgNVHSMEgaYwgaOAFItLbe3TKbkGGew5Oanwl4Rqy+/foYGEpIGBMH8xCzAJBgNVBAYTAkJNMRkw
-FwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0
-aG9yaXR5MS4wLAYDVQQDEyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggQ6
-tlCLMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAitQUtf70mpKnGdSkfnIYj9lo
-fFIk3WdvOXrEql494liwTXCYhGHoG+NpGA7O+0dQoE7/8CQfvbLO9Sf87C9TqnN7Az10buYWnuul
-LsS/VidQK2K6vkscPFVcQR0kvoIgR13VRH56FmjffU1RcHhXHTMe/QKZnAzNCgVPx7uOpHX6Sm2x
-gI4JVrmcGmD+XcHXetwReNDWXcG31a0ymQM6isxUJTkxgXsTIlG6Rmyhu576BGxJJnSP0nPrzDCi
-5upZIof4l/UO/erMkqQWxFIY6iHOsfHmhIHluqmGKPJDWl0Snawe2ajlCmqnf6CHKc/yiU3U7MXi
-5nrQNiOKSnQ2+Q==
------END CERTIFICATE-----
-
-QuoVadis Root CA 2
-==================
------BEGIN CERTIFICATE-----
-MIIFtzCCA5+gAwIBAgICBQkwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
-EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMjAeFw0wNjExMjQx
-ODI3MDBaFw0zMTExMjQxODIzMzNaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
-aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4IC
-DwAwggIKAoICAQCaGMpLlA0ALa8DKYrwD4HIrkwZhR0In6spRIXzL4GtMh6QRr+jhiYaHv5+HBg6
-XJxgFyo6dIMzMH1hVBHL7avg5tKifvVrbxi3Cgst/ek+7wrGsxDp3MJGF/hd/aTa/55JWpzmM+Yk
-lvc/ulsrHHo1wtZn/qtmUIttKGAr79dgw8eTvI02kfN/+NsRE8Scd3bBrrcCaoF6qUWD4gXmuVbB
-lDePSHFjIuwXZQeVikvfj8ZaCuWw419eaxGrDPmF60Tp+ARz8un+XJiM9XOva7R+zdRcAitMOeGy
-lZUtQofX1bOQQ7dsE/He3fbE+Ik/0XX1ksOR1YqI0JDs3G3eicJlcZaLDQP9nL9bFqyS2+r+eXyt
-66/3FsvbzSUr5R/7mp/iUcw6UwxI5g69ybR2BlLmEROFcmMDBOAENisgGQLodKcftslWZvB1Jdxn
-wQ5hYIizPtGo/KPaHbDRsSNU30R2be1B2MGyIrZTHN81Hdyhdyox5C315eXbyOD/5YDXC2Og/zOh
-D7osFRXql7PSorW+8oyWHhqPHWykYTe5hnMz15eWniN9gqRMgeKh0bpnX5UHoycR7hYQe7xFSkyy
-BNKr79X9DFHOUGoIMfmR2gyPZFwDwzqLID9ujWc9Otb+fVuIyV77zGHcizN300QyNQliBJIWENie
-J0f7OyHj+OsdWwIDAQABo4GwMIGtMA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1Ud
-DgQWBBQahGK8SEwzJQTU7tD2A8QZRtGUazBuBgNVHSMEZzBlgBQahGK8SEwzJQTU7tD2A8QZRtGU
-a6FJpEcwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMT
-ElF1b1ZhZGlzIFJvb3QgQ0EgMoICBQkwDQYJKoZIhvcNAQEFBQADggIBAD4KFk2fBluornFdLwUv
-Z+YTRYPENvbzwCYMDbVHZF34tHLJRqUDGCdViXh9duqWNIAXINzng/iN/Ae42l9NLmeyhP3ZRPx3
-UIHmfLTJDQtyU/h2BwdBR5YM++CCJpNVjP4iH2BlfF/nJrP3MpCYUNQ3cVX2kiF495V5+vgtJodm
-VjB3pjd4M1IQWK4/YY7yarHvGH5KWWPKjaJW1acvvFYfzznB4vsKqBUsfU16Y8Zsl0Q80m/DShcK
-+JDSV6IZUaUtl0HaB0+pUNqQjZRG4T7wlP0QADj1O+hA4bRuVhogzG9Yje0uRY/W6ZM/57Es3zrW
-IozchLsib9D45MY56QSIPMO661V6bYCZJPVsAfv4l7CUW+v90m/xd2gNNWQjrLhVoQPRTUIZ3Ph1
-WVaj+ahJefivDrkRoHy3au000LYmYjgahwz46P0u05B/B5EqHdZ+XIWDmbA4CD/pXvk1B+TJYm5X
-f6dQlfe6yJvmjqIBxdZmv3lh8zwc4bmCXF2gw+nYSL0ZohEUGW6yhhtoPkg3Goi3XZZenMfvJ2II
-4pEZXNLxId26F0KCl3GBUzGpn/Z9Yr9y4aOTHcyKJloJONDO1w2AFrR4pTqHTI2KpdVGl/IsELm8
-VCLAAVBpQ570su9t+Oza8eOx79+Rj1QqCyXBJhnEUhAFZdWCEOrCMc0u
------END CERTIFICATE-----
-
-QuoVadis Root CA 3
-==================
------BEGIN CERTIFICATE-----
-MIIGnTCCBIWgAwIBAgICBcYwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
-EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMzAeFw0wNjExMjQx
-OTExMjNaFw0zMTExMjQxOTA2NDRaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
-aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
-DwAwggIKAoICAQDMV0IWVJzmmNPTTe7+7cefQzlKZbPoFog02w1ZkXTPkrgEQK0CSzGrvI2RaNgg
-DhoB4hp7Thdd4oq3P5kazethq8Jlph+3t723j/z9cI8LoGe+AaJZz3HmDyl2/7FWeUUrH556VOij
-KTVopAFPD6QuN+8bv+OPEKhyq1hX51SGyMnzW9os2l2ObjyjPtr7guXd8lyyBTNvijbO0BNO/79K
-DDRMpsMhvVAEVeuxu537RR5kFd5VAYwCdrXLoT9CabwvvWhDFlaJKjdhkf2mrk7AyxRllDdLkgbv
-BNDInIjbC3uBr7E9KsRlOni27tyAsdLTmZw67mtaa7ONt9XOnMK+pUsvFrGeaDsGb659n/je7Mwp
-p5ijJUMv7/FfJuGITfhebtfZFG4ZM2mnO4SJk8RTVROhUXhA+LjJou57ulJCg54U7QVSWllWp5f8
-nT8KKdjcT5EOE7zelaTfi5m+rJsziO+1ga8bxiJTyPbH7pcUsMV8eFLI8M5ud2CEpukqdiDtWAEX
-MJPpGovgc2PZapKUSU60rUqFxKMiMPwJ7Wgic6aIDFUhWMXhOp8q3crhkODZc6tsgLjoC2SToJyM
-Gf+z0gzskSaHirOi4XCPLArlzW1oUevaPwV/izLmE1xr/l9A4iLItLRkT9a6fUg+qGkM17uGcclz
-uD87nSVL2v9A6wIDAQABo4IBlTCCAZEwDwYDVR0TAQH/BAUwAwEB/zCB4QYDVR0gBIHZMIHWMIHT
-BgkrBgEEAb5YAAMwgcUwgZMGCCsGAQUFBwICMIGGGoGDQW55IHVzZSBvZiB0aGlzIENlcnRpZmlj
-YXRlIGNvbnN0aXR1dGVzIGFjY2VwdGFuY2Ugb2YgdGhlIFF1b1ZhZGlzIFJvb3QgQ0EgMyBDZXJ0
-aWZpY2F0ZSBQb2xpY3kgLyBDZXJ0aWZpY2F0aW9uIFByYWN0aWNlIFN0YXRlbWVudC4wLQYIKwYB
-BQUHAgEWIWh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL2NwczALBgNVHQ8EBAMCAQYwHQYD
-VR0OBBYEFPLAE+CCQz777i9nMpY1XNu4ywLQMG4GA1UdIwRnMGWAFPLAE+CCQz777i9nMpY1XNu4
-ywLQoUmkRzBFMQswCQYDVQQGEwJCTTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDEbMBkGA1UE
-AxMSUXVvVmFkaXMgUm9vdCBDQSAzggIFxjANBgkqhkiG9w0BAQUFAAOCAgEAT62gLEz6wPJv92ZV
-qyM07ucp2sNbtrCD2dDQ4iH782CnO11gUyeim/YIIirnv6By5ZwkajGxkHon24QRiSemd1o417+s
-hvzuXYO8BsbRd2sPbSQvS3pspweWyuOEn62Iix2rFo1bZhfZFvSLgNLd+LJ2w/w4E6oM3kJpK27z
-POuAJ9v1pkQNn1pVWQvVDVJIxa6f8i+AxeoyUDUSly7B4f/xI4hROJ/yZlZ25w9Rl6VSDE1JUZU2
-Pb+iSwwQHYaZTKrzchGT5Or2m9qoXadNt54CrnMAyNojA+j56hl0YgCUyyIgvpSnWbWCar6ZeXqp
-8kokUvd0/bpO5qgdAm6xDYBEwa7TIzdfu4V8K5Iu6H6li92Z4b8nby1dqnuH/grdS/yO9SbkbnBC
-bjPsMZ57k8HkyWkaPcBrTiJt7qtYTcbQQcEr6k8Sh17rRdhs9ZgC06DYVYoGmRmioHfRMJ6szHXu
-g/WwYjnPbFfiTNKRCw51KBuav/0aQ/HKd/s7j2G4aSgWQgRecCocIdiP4b0jWy10QJLZYxkNc91p
-vGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeTmJlglFwjz1onl14LBQaTNx47aTbr
-qZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK4SVhM7JZG+Ju1zdXtg2pEto=
------END CERTIFICATE-----
-
-Security Communication Root CA
-==============================
------BEGIN CERTIFICATE-----
-MIIDWjCCAkKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
-U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
-HhcNMDMwOTMwMDQyMDQ5WhcNMjMwOTMwMDQyMDQ5WjBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
-U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
-ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCzs/5/022x7xZ8V6UMbXaKL0u/ZPtM7orw
-8yl89f/uKuDp6bpbZCKamm8sOiZpUQWZJtzVHGpxxpp9Hp3dfGzGjGdnSj74cbAZJ6kJDKaVv0uM
-DPpVmDvY6CKhS3E4eayXkmmziX7qIWgGmBSWh9JhNrxtJ1aeV+7AwFb9Ms+k2Y7CI9eNqPPYJayX
-5HA49LY6tJ07lyZDo6G8SVlyTCMwhwFY9k6+HGhWZq/NQV3Is00qVUarH9oe4kA92819uZKAnDfd
-DJZkndwi92SL32HeFZRSFaB9UslLqCHJxrHty8OVYNEP8Ktw+N/LTX7s1vqr2b1/VPKl6Xn62dZ2
-JChzAgMBAAGjPzA9MB0GA1UdDgQWBBSgc0mZaNyFW2XjmygvV5+9M7wHSDALBgNVHQ8EBAMCAQYw
-DwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAaECpqLvkT115swW1F7NgE+vGkl3g
-0dNq/vu+m22/xwVtWSDEHPC32oRYAmP6SBbvT6UL90qY8j+eG61Ha2POCEfrUj94nK9NrvjVT8+a
-mCoQQTlSxN3Zmw7vkwGusi7KaEIkQmywszo+zenaSMQVy+n5Bw+SUEmK3TGXX8npN6o7WWWXlDLJ
-s58+OmJYxUmtYg5xpTKqL8aJdkNAExNnPaJUJRDL8Try2frbSVa7pv6nQTXD4IhhyYjH3zYQIphZ
-6rBK+1YWc26sTfcioU+tHXotRSflMMFe8toTyyVCUZVHA4xsIcx0Qu1T/zOLjw9XARYvz6buyXAi
-FL39vmwLAw==
------END CERTIFICATE-----
-
-Sonera Class 2 Root CA
-======================
------BEGIN CERTIFICATE-----
-MIIDIDCCAgigAwIBAgIBHTANBgkqhkiG9w0BAQUFADA5MQswCQYDVQQGEwJGSTEPMA0GA1UEChMG
-U29uZXJhMRkwFwYDVQQDExBTb25lcmEgQ2xhc3MyIENBMB4XDTAxMDQwNjA3Mjk0MFoXDTIxMDQw
-NjA3Mjk0MFowOTELMAkGA1UEBhMCRkkxDzANBgNVBAoTBlNvbmVyYTEZMBcGA1UEAxMQU29uZXJh
-IENsYXNzMiBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJAXSjWdyvANlsdE+hY3
-/Ei9vX+ALTU74W+oZ6m/AxxNjG8yR9VBaKQTBME1DJqEQ/xcHf+Js+gXGM2RX/uJ4+q/Tl18GybT
-dXnt5oTjV+WtKcT0OijnpXuENmmz/V52vaMtmdOQTiMofRhj8VQ7Jp12W5dCsv+u8E7s3TmVToMG
-f+dJQMjFAbJUWmYdPfz56TwKnoG4cPABi+QjVHzIrviQHgCWctRUz2EjvOr7nQKV0ba5cTppCD8P
-tOFCx4j1P5iop7oc4HFx71hXgVB6XGt0Rg6DA5jDjqhu8nYybieDwnPz3BjotJPqdURrBGAgcVeH
-nfO+oJAjPYok4doh28MCAwEAAaMzMDEwDwYDVR0TAQH/BAUwAwEB/zARBgNVHQ4ECgQISqCqWITT
-XjwwCwYDVR0PBAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQBazof5FnIVV0sd2ZvnoiYw7JNn39Yt
-0jSv9zilzqsWuasvfDXLrNAPtEwr/IDva4yRXzZ299uzGxnq9LIR/WFxRL8oszodv7ND6J+/3DEI
-cbCdjdY0RzKQxmUk96BKfARzjzlvF4xytb1LyHr4e4PDKE6cCepnP7JnBBvDFNr450kkkdAdavph
-Oe9r5yF1BgfYErQhIHBCcYHaPJo2vqZbDWpsmh+Re/n570K6Tk6ezAyNlNzZRZxe7EJQY670XcSx
-EtzKO6gunRRaBXW37Ndj4ro1tgQIkejanZz2ZrUYrAqmVCY0M9IbwdR/GjqOC6oybtv8TyWf2TLH
-llpwrN9M
------END CERTIFICATE-----
-
-Staat der Nederlanden Root CA
-=============================
------BEGIN CERTIFICATE-----
-MIIDujCCAqKgAwIBAgIEAJiWijANBgkqhkiG9w0BAQUFADBVMQswCQYDVQQGEwJOTDEeMBwGA1UE
-ChMVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSYwJAYDVQQDEx1TdGFhdCBkZXIgTmVkZXJsYW5kZW4g
-Um9vdCBDQTAeFw0wMjEyMTcwOTIzNDlaFw0xNTEyMTYwOTE1MzhaMFUxCzAJBgNVBAYTAk5MMR4w
-HAYDVQQKExVTdGFhdCBkZXIgTmVkZXJsYW5kZW4xJjAkBgNVBAMTHVN0YWF0IGRlciBOZWRlcmxh
-bmRlbiBSb290IENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmNK1URF6gaYUmHFt
-vsznExvWJw56s2oYHLZhWtVhCb/ekBPHZ+7d89rFDBKeNVU+LCeIQGv33N0iYfXCxw719tV2U02P
-jLwYdjeFnejKScfST5gTCaI+Ioicf9byEGW07l8Y1Rfj+MX94p2i71MOhXeiD+EwR+4A5zN9RGca
-C1Hoi6CeUJhoNFIfLm0B8mBF8jHrqTFoKbt6QZ7GGX+UtFE5A3+y3qcym7RHjm+0Sq7lr7HcsBth
-vJly3uSJt3omXdozSVtSnA71iq3DuD3oBmrC1SoLbHuEvVYFy4ZlkuxEK7COudxwC0barbxjiDn6
-22r+I/q85Ej0ZytqERAhSQIDAQABo4GRMIGOMAwGA1UdEwQFMAMBAf8wTwYDVR0gBEgwRjBEBgRV
-HSAAMDwwOgYIKwYBBQUHAgEWLmh0dHA6Ly93d3cucGtpb3ZlcmhlaWQubmwvcG9saWNpZXMvcm9v
-dC1wb2xpY3kwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBSofeu8Y6R0E3QA7Jbg0zTBLL9s+DAN
-BgkqhkiG9w0BAQUFAAOCAQEABYSHVXQ2YcG70dTGFagTtJ+k/rvuFbQvBgwp8qiSpGEN/KtcCFtR
-EytNwiphyPgJWPwtArI5fZlmgb9uXJVFIGzmeafR2Bwp/MIgJ1HI8XxdNGdphREwxgDS1/PTfLbw
-MVcoEoJz6TMvplW0C5GUR5z6u3pCMuiufi3IvKwUv9kP2Vv8wfl6leF9fpb8cbDCTMjfRTTJzg3y
-nGQI0DvDKcWy7ZAEwbEpkcUwb8GpcjPM/l0WFywRaed+/sWDCN+83CI6LiBpIzlWYGeQiy52OfsR
-iJf2fL1LuCAWZwWN4jvBcj+UlTfHXbme2JOhF4//DGYVwSR8MnwDHTuhWEUykw==
------END CERTIFICATE-----
-
-TDC Internet Root CA
-====================
------BEGIN CERTIFICATE-----
-MIIEKzCCAxOgAwIBAgIEOsylTDANBgkqhkiG9w0BAQUFADBDMQswCQYDVQQGEwJESzEVMBMGA1UE
-ChMMVERDIEludGVybmV0MR0wGwYDVQQLExRUREMgSW50ZXJuZXQgUm9vdCBDQTAeFw0wMTA0MDUx
-NjMzMTdaFw0yMTA0MDUxNzAzMTdaMEMxCzAJBgNVBAYTAkRLMRUwEwYDVQQKEwxUREMgSW50ZXJu
-ZXQxHTAbBgNVBAsTFFREQyBJbnRlcm5ldCBSb290IENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
-MIIBCgKCAQEAxLhAvJHVYx/XmaCLDEAedLdInUaMArLgJF/wGROnN4NrXceO+YQwzho7+vvOi20j
-xsNuZp+Jpd/gQlBn+h9sHvTQBda/ytZO5GhgbEaqHF1j4QeGDmUApy6mcca8uYGoOn0a0vnRrEvL
-znWv3Hv6gXPU/Lq9QYjUdLP5Xjg6PEOo0pVOd20TDJ2PeAG3WiAfAzc14izbSysseLlJ28TQx5yc
-5IogCSEWVmb/Bexb4/DPqyQkXsN/cHoSxNK1EKC2IeGNeGlVRGn1ypYcNIUXJXfi9i8nmHj9eQY6
-otZaQ8H/7AQ77hPv01ha/5Lr7K7a8jcDR0G2l8ktCkEiu7vmpwIDAQABo4IBJTCCASEwEQYJYIZI
-AYb4QgEBBAQDAgAHMGUGA1UdHwReMFwwWqBYoFakVDBSMQswCQYDVQQGEwJESzEVMBMGA1UEChMM
-VERDIEludGVybmV0MR0wGwYDVQQLExRUREMgSW50ZXJuZXQgUm9vdCBDQTENMAsGA1UEAxMEQ1JM
-MTArBgNVHRAEJDAigA8yMDAxMDQwNTE2MzMxN1qBDzIwMjEwNDA1MTcwMzE3WjALBgNVHQ8EBAMC
-AQYwHwYDVR0jBBgwFoAUbGQBx/2FbazI2p5QCIUItTxWqFAwHQYDVR0OBBYEFGxkAcf9hW2syNqe
-UAiFCLU8VqhQMAwGA1UdEwQFMAMBAf8wHQYJKoZIhvZ9B0EABBAwDhsIVjUuMDo0LjADAgSQMA0G
-CSqGSIb3DQEBBQUAA4IBAQBOQ8zR3R0QGwZ/t6T609lN+yOfI1Rb5osvBCiLtSdtiaHsmGnc540m
-gwV5dOy0uaOXwTUA/RXaOYE6lTGQ3pfphqiZdwzlWqCE/xIWrG64jcN7ksKsLtB9KOy282A4aW8+
-2ARVPp7MVdK6/rtHBNcK2RYKNCn1WBPVT8+PVkuzHu7TmHnaCB4Mb7j4Fifvwm899qNLPg7kbWzb
-O0ESm70NRyN/PErQr8Cv9u8btRXE64PECV90i9kR+8JWsTz4cMo0jUNAE4z9mQNUecYu6oah9jrU
-Cbz0vGbMPVjQV0kK7iXiQe4T+Zs4NNEA9X7nlB38aQNiuJkFBT1reBK9sG9l
------END CERTIFICATE-----
-
-TDC OCES Root CA
-================
------BEGIN CERTIFICATE-----
-MIIFGTCCBAGgAwIBAgIEPki9xDANBgkqhkiG9w0BAQUFADAxMQswCQYDVQQGEwJESzEMMAoGA1UE
-ChMDVERDMRQwEgYDVQQDEwtUREMgT0NFUyBDQTAeFw0wMzAyMTEwODM5MzBaFw0zNzAyMTEwOTA5
-MzBaMDExCzAJBgNVBAYTAkRLMQwwCgYDVQQKEwNUREMxFDASBgNVBAMTC1REQyBPQ0VTIENBMIIB
-IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArGL2YSCyz8DGhdfjeebM7fI5kqSXLmSjhFuH
-nEz9pPPEXyG9VhDr2y5h7JNp46PMvZnDBfwGuMo2HP6QjklMxFaaL1a8z3sM8W9Hpg1DTeLpHTk0
-zY0s2RKY+ePhwUp8hjjEqcRhiNJerxomTdXkoCJHhNlktxmW/OwZ5LKXJk5KTMuPJItUGBxIYXvV
-iGjaXbXqzRowwYCDdlCqT9HU3Tjw7xb04QxQBr/q+3pJoSgrHPb8FTKjdGqPqcNiKXEx5TukYBde
-dObaE+3pHx8b0bJoc8YQNHVGEBDjkAB2QMuLt0MJIf+rTpPGWOmlgtt3xDqZsXKVSQTwtyv6e1mO
-3QIDAQABo4ICNzCCAjMwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwgewGA1UdIASB
-5DCB4TCB3gYIKoFQgSkBAQEwgdEwLwYIKwYBBQUHAgEWI2h0dHA6Ly93d3cuY2VydGlmaWthdC5k
-ay9yZXBvc2l0b3J5MIGdBggrBgEFBQcCAjCBkDAKFgNUREMwAwIBARqBgUNlcnRpZmlrYXRlciBm
-cmEgZGVubmUgQ0EgdWRzdGVkZXMgdW5kZXIgT0lEIDEuMi4yMDguMTY5LjEuMS4xLiBDZXJ0aWZp
-Y2F0ZXMgZnJvbSB0aGlzIENBIGFyZSBpc3N1ZWQgdW5kZXIgT0lEIDEuMi4yMDguMTY5LjEuMS4x
-LjARBglghkgBhvhCAQEEBAMCAAcwgYEGA1UdHwR6MHgwSKBGoESkQjBAMQswCQYDVQQGEwJESzEM
-MAoGA1UEChMDVERDMRQwEgYDVQQDEwtUREMgT0NFUyBDQTENMAsGA1UEAxMEQ1JMMTAsoCqgKIYm
-aHR0cDovL2NybC5vY2VzLmNlcnRpZmlrYXQuZGsvb2Nlcy5jcmwwKwYDVR0QBCQwIoAPMjAwMzAy
-MTEwODM5MzBagQ8yMDM3MDIxMTA5MDkzMFowHwYDVR0jBBgwFoAUYLWF7FZkfhIZJ2cdUBVLc647
-+RIwHQYDVR0OBBYEFGC1hexWZH4SGSdnHVAVS3OuO/kSMB0GCSqGSIb2fQdBAAQQMA4bCFY2LjA6
-NC4wAwIEkDANBgkqhkiG9w0BAQUFAAOCAQEACromJkbTc6gJ82sLMJn9iuFXehHTuJTXCRBuo7E4
-A9G28kNBKWKnctj7fAXmMXAnVBhOinxO5dHKjHiIzxvTkIvmI/gLDjNDfZziChmPyQE+dF10yYsc
-A+UYyAFMP8uXBV2YcaaYb7Z8vTd/vuGTJW1v8AqtFxjhA7wHKcitJuj4YfD9IQl+mo6paH1IYnK9
-AOoBmbgGglGBTvH1tJFUuSN6AJqfXY3gPGS5GhKSKseCRHI53OI8xthV9RVOyAUO28bQYqbsFbS1
-AoLbrIyigfCbmTH1ICCoiGEKB5+U/NDXG8wuF/MEJ3Zn61SD/aSQfgY9BKNDLdr8C2LqL19iUw==
------END CERTIFICATE-----
-
-UTN DATACorp SGC Root CA
-========================
------BEGIN CERTIFICATE-----
-MIIEXjCCA0agAwIBAgIQRL4Mi1AAIbQR0ypoBqmtaTANBgkqhkiG9w0BAQUFADCBkzELMAkGA1UE
-BhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2UgQ2l0eTEeMBwGA1UEChMVVGhl
-IFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExhodHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xGzAZ
-BgNVBAMTElVUTiAtIERBVEFDb3JwIFNHQzAeFw05OTA2MjQxODU3MjFaFw0xOTA2MjQxOTA2MzBa
-MIGTMQswCQYDVQQGEwJVUzELMAkGA1UECBMCVVQxFzAVBgNVBAcTDlNhbHQgTGFrZSBDaXR5MR4w
-HAYDVQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxITAfBgNVBAsTGGh0dHA6Ly93d3cudXNlcnRy
-dXN0LmNvbTEbMBkGA1UEAxMSVVROIC0gREFUQUNvcnAgU0dDMIIBIjANBgkqhkiG9w0BAQEFAAOC
-AQ8AMIIBCgKCAQEA3+5YEKIrblXEjr8uRgnn4AgPLit6E5Qbvfa2gI5lBZMAHryv4g+OGQ0SR+ys
-raP6LnD43m77VkIVni5c7yPeIbkFdicZD0/Ww5y0vpQZY/KmEQrrU0icvvIpOxboGqBMpsn0GFlo
-wHDyUwDAXlCCpVZvNvlK4ESGoE1O1kduSUrLZ9emxAW5jh70/P/N5zbgnAVssjMiFdC04MwXwLLA
-9P4yPykqlXvY8qdOD1R8oQ2AswkDwf9c3V6aPryuvEeKaq5xyh+xKrhfQgUL7EYw0XILyulWbfXv
-33i+Ybqypa4ETLyorGkVl73v67SMvzX41MPRKA5cOp9wGDMgd8SirwIDAQABo4GrMIGoMAsGA1Ud
-DwQEAwIBxjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRTMtGzz3/64PGgXYVOktKeRR20TzA9
-BgNVHR8ENjA0MDKgMKAuhixodHRwOi8vY3JsLnVzZXJ0cnVzdC5jb20vVVROLURBVEFDb3JwU0dD
-LmNybDAqBgNVHSUEIzAhBggrBgEFBQcDAQYKKwYBBAGCNwoDAwYJYIZIAYb4QgQBMA0GCSqGSIb3
-DQEBBQUAA4IBAQAnNZcAiosovcYzMB4p/OL31ZjUQLtgyr+rFywJNn9Q+kHcrpY6CiM+iVnJowft
-Gzet/Hy+UUla3joKVAgWRcKZsYfNjGjgaQPpxE6YsjuMFrMOoAyYUJuTqXAJyCyjj98C5OBxOvG0
-I3KgqgHf35g+FFCgMSa9KOlaMCZ1+XtgHI3zzVAmbQQnmt/VDUVHKWss5nbZqSl9Mt3JNjy9rjXx
-EZ4du5A/EkdOjtd+D2JzHVImOBwYSf0wdJrE5SIv2MCN7ZF6TACPcn9d2t0bi0Vr591pl6jFVkwP
-DPafepE39peC4N1xaf92P2BNPM/3mfnGV/TJVTl4uix5yaaIK/QI
------END CERTIFICATE-----
-
-UTN USERFirst Hardware Root CA
-==============================
------BEGIN CERTIFICATE-----
-MIIEdDCCA1ygAwIBAgIQRL4Mi1AAJLQR0zYq/mUK/TANBgkqhkiG9w0BAQUFADCBlzELMAkGA1UE
-BhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2UgQ2l0eTEeMBwGA1UEChMVVGhl
-IFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExhodHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xHzAd
-BgNVBAMTFlVUTi1VU0VSRmlyc3QtSGFyZHdhcmUwHhcNOTkwNzA5MTgxMDQyWhcNMTkwNzA5MTgx
-OTIyWjCBlzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2UgQ2l0
-eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExhodHRwOi8vd3d3LnVz
-ZXJ0cnVzdC5jb20xHzAdBgNVBAMTFlVUTi1VU0VSRmlyc3QtSGFyZHdhcmUwggEiMA0GCSqGSIb3
-DQEBAQUAA4IBDwAwggEKAoIBAQCx98M4P7Sof885glFn0G2f0v9Y8+efK+wNiVSZuTiZFvfgIXlI
-wrthdBKWHTxqctU8EGc6Oe0rE81m65UJM6Rsl7HoxuzBdXmcRl6Nq9Bq/bkqVRcQVLMZ8Jr28bFd
-tqdt++BxF2uiiPsA3/4aMXcMmgF6sTLjKwEHOG7DpV4jvEWbe1DByTCP2+UretNb+zNAHqDVmBe8
-i4fDidNdoI6yqqr2jmmIBsX6iSHzCJ1pLgkzmykNRg+MzEk0sGlRvfkGzWitZky8PqxhvQqIDsjf
-Pe58BEydCl5rkdbux+0ojatNh4lz0G6k0B4WixThdkQDf2Os5M1JnMWS9KsyoUhbAgMBAAGjgbkw
-gbYwCwYDVR0PBAQDAgHGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFKFyXyYbKJhDlV0HN9WF
-lp1L0sNFMEQGA1UdHwQ9MDswOaA3oDWGM2h0dHA6Ly9jcmwudXNlcnRydXN0LmNvbS9VVE4tVVNF
-UkZpcnN0LUhhcmR3YXJlLmNybDAxBgNVHSUEKjAoBggrBgEFBQcDAQYIKwYBBQUHAwUGCCsGAQUF
-BwMGBggrBgEFBQcDBzANBgkqhkiG9w0BAQUFAAOCAQEARxkP3nTGmZev/K0oXnWO6y1n7k57K9cM
-//bey1WiCuFMVGWTYGufEpytXoMs61quwOQt9ABjHbjAbPLPSbtNk28GpgoiskliCE7/yMgUsogW
-XecB5BKV5UU0s4tpvc+0hY91UZ59Ojg6FEgSxvunOxqNDYJAB+gECJChicsZUN/KHAG8HQQZexB2
-lzvukJDKxA4fFm517zP4029bHpbj4HR3dHuKom4t3XbWOTCC8KucUvIqx69JXn7HaOWCgchqJ/kn
-iCrVWFCVH/A7HFe7fRQ5YiuayZSSKqMiDP+JJn1fIytH1xUdqWqeUQ0qUZ6B+dQ7XnASfxAynB67
-nfhmqA==
------END CERTIFICATE-----
-
-Camerfirma Chambers of Commerce Root
-====================================
------BEGIN CERTIFICATE-----
-MIIEvTCCA6WgAwIBAgIBADANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJFVTEnMCUGA1UEChMe
-QUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1i
-ZXJzaWduLm9yZzEiMCAGA1UEAxMZQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdDAeFw0wMzA5MzAx
-NjEzNDNaFw0zNzA5MzAxNjEzNDRaMH8xCzAJBgNVBAYTAkVVMScwJQYDVQQKEx5BQyBDYW1lcmZp
-cm1hIFNBIENJRiBBODI3NDMyODcxIzAhBgNVBAsTGmh0dHA6Ly93d3cuY2hhbWJlcnNpZ24ub3Jn
-MSIwIAYDVQQDExlDaGFtYmVycyBvZiBDb21tZXJjZSBSb290MIIBIDANBgkqhkiG9w0BAQEFAAOC
-AQ0AMIIBCAKCAQEAtzZV5aVdGDDg2olUkfzIx1L4L1DZ77F1c2VHfRtbunXF/KGIJPov7coISjlU
-xFF6tdpg6jg8gbLL8bvZkSM/SAFwdakFKq0fcfPJVD0dBmpAPrMMhe5cG3nCYsS4No41XQEMIwRH
-NaqbYE6gZj3LJgqcQKH0XZi/caulAGgq7YN6D6IUtdQis4CwPAxaUWktWBiP7Zme8a7ileb2R6jW
-DA+wWFjbw2Y3npuRVDM30pQcakjJyfKl2qUMI/cjDpwyVV5xnIQFUZot/eZOKjRa3spAN2cMVCFV
-d9oKDMyXroDclDZK9D7ONhMeU+SsTjoF7Nuucpw4i9A5O4kKPnf+dQIBA6OCAUQwggFAMBIGA1Ud
-EwEB/wQIMAYBAf8CAQwwPAYDVR0fBDUwMzAxoC+gLYYraHR0cDovL2NybC5jaGFtYmVyc2lnbi5v
-cmcvY2hhbWJlcnNyb290LmNybDAdBgNVHQ4EFgQU45T1sU3p26EpW1eLTXYGduHRooowDgYDVR0P
-AQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzAnBgNVHREEIDAegRxjaGFtYmVyc3Jvb3RAY2hh
-bWJlcnNpZ24ub3JnMCcGA1UdEgQgMB6BHGNoYW1iZXJzcm9vdEBjaGFtYmVyc2lnbi5vcmcwWAYD
-VR0gBFEwTzBNBgsrBgEEAYGHLgoDATA+MDwGCCsGAQUFBwIBFjBodHRwOi8vY3BzLmNoYW1iZXJz
-aWduLm9yZy9jcHMvY2hhbWJlcnNyb290Lmh0bWwwDQYJKoZIhvcNAQEFBQADggEBAAxBl8IahsAi
-fJ/7kPMa0QOx7xP5IV8EnNrJpY0nbJaHkb5BkAFyk+cefV/2icZdp0AJPaxJRUXcLo0waLIJuvvD
-L8y6C98/d3tGfToSJI6WjzwFCm/SlCgdbQzALogi1djPHRPH8EjX1wWnz8dHnjs8NMiAT9QUu/wN
-UPf6s+xCX6ndbcj0dc97wXImsQEcXCz9ek60AcUFV7nnPKoF2YjpB0ZBzu9Bga5Y34OirsrXdx/n
-ADydb47kMgkdTXg0eDQ8lJsm7U9xxhl6vSAiSFr+S30Dt+dYvsYyTnQeaN2oaFuzPu5ifdmA6Ap1
-erfutGWaIZDgqtCYvDi1czyL+Nw=
------END CERTIFICATE-----
-
-Camerfirma Global Chambersign Root
-==================================
------BEGIN CERTIFICATE-----
-MIIExTCCA62gAwIBAgIBADANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJFVTEnMCUGA1UEChMe
-QUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1i
-ZXJzaWduLm9yZzEgMB4GA1UEAxMXR2xvYmFsIENoYW1iZXJzaWduIFJvb3QwHhcNMDMwOTMwMTYx
-NDE4WhcNMzcwOTMwMTYxNDE4WjB9MQswCQYDVQQGEwJFVTEnMCUGA1UEChMeQUMgQ2FtZXJmaXJt
-YSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1iZXJzaWduLm9yZzEg
-MB4GA1UEAxMXR2xvYmFsIENoYW1iZXJzaWduIFJvb3QwggEgMA0GCSqGSIb3DQEBAQUAA4IBDQAw
-ggEIAoIBAQCicKLQn0KuWxfH2H3PFIP8T8mhtxOviteePgQKkotgVvq0Mi+ITaFgCPS3CU6gSS9J
-1tPfnZdan5QEcOw/Wdm3zGaLmFIoCQLfxS+EjXqXd7/sQJ0lcqu1PzKY+7e3/HKE5TWH+VX6ox8O
-by4o3Wmg2UIQxvi1RMLQQ3/bvOSiPGpVeAp3qdjqGTK3L/5cPxvusZjsyq16aUXjlg9V9ubtdepl
-6DJWk0aJqCWKZQbua795B9Dxt6/tLE2Su8CoX6dnfQTyFQhwrJLWfQTSM/tMtgsL+xrJxI0DqX5c
-8lCrEqWhz0hQpe/SyBoT+rB/sYIcd2oPX9wLlY/vQ37mRQklAgEDo4IBUDCCAUwwEgYDVR0TAQH/
-BAgwBgEB/wIBDDA/BgNVHR8EODA2MDSgMqAwhi5odHRwOi8vY3JsLmNoYW1iZXJzaWduLm9yZy9j
-aGFtYmVyc2lnbnJvb3QuY3JsMB0GA1UdDgQWBBRDnDafsJ4wTcbOX60Qq+UDpfqpFDAOBgNVHQ8B
-Af8EBAMCAQYwEQYJYIZIAYb4QgEBBAQDAgAHMCoGA1UdEQQjMCGBH2NoYW1iZXJzaWducm9vdEBj
-aGFtYmVyc2lnbi5vcmcwKgYDVR0SBCMwIYEfY2hhbWJlcnNpZ25yb290QGNoYW1iZXJzaWduLm9y
-ZzBbBgNVHSAEVDBSMFAGCysGAQQBgYcuCgEBMEEwPwYIKwYBBQUHAgEWM2h0dHA6Ly9jcHMuY2hh
-bWJlcnNpZ24ub3JnL2Nwcy9jaGFtYmVyc2lnbnJvb3QuaHRtbDANBgkqhkiG9w0BAQUFAAOCAQEA
-PDtwkfkEVCeR4e3t/mh/YV3lQWVPMvEYBZRqHN4fcNs+ezICNLUMbKGKfKX0j//U2K0X1S0E0T9Y
-gOKBWYi+wONGkyT+kL0mojAt6JcmVzWJdJYY9hXiryQZVgICsroPFOrGimbBhkVVi76SvpykBMdJ
-PJ7oKXqJ1/6v/2j1pReQvayZzKWGVwlnRtvWFsJG8eSpUPWP0ZIV018+xgBJOm5YstHRJw0lyDL4
-IBHNfTIzSJRUTN3cecQwn+uOuFW114hcxWokPbLTBQNRxgfvzBRydD1ucs4YKIxKoHflCStFREes
-t2d/AYoFWpO+ocH/+OcOZ6RHSXZddZAa9SaP8A==
------END CERTIFICATE-----
-
-NetLock Notary (Class A) Root
-=============================
------BEGIN CERTIFICATE-----
-MIIGfTCCBWWgAwIBAgICAQMwDQYJKoZIhvcNAQEEBQAwga8xCzAJBgNVBAYTAkhVMRAwDgYDVQQI
-EwdIdW5nYXJ5MREwDwYDVQQHEwhCdWRhcGVzdDEnMCUGA1UEChMeTmV0TG9jayBIYWxvemF0Yml6
-dG9uc2FnaSBLZnQuMRowGAYDVQQLExFUYW51c2l0dmFueWtpYWRvazE2MDQGA1UEAxMtTmV0TG9j
-ayBLb3pqZWd5em9pIChDbGFzcyBBKSBUYW51c2l0dmFueWtpYWRvMB4XDTk5MDIyNDIzMTQ0N1oX
-DTE5MDIxOTIzMTQ0N1owga8xCzAJBgNVBAYTAkhVMRAwDgYDVQQIEwdIdW5nYXJ5MREwDwYDVQQH
-EwhCdWRhcGVzdDEnMCUGA1UEChMeTmV0TG9jayBIYWxvemF0Yml6dG9uc2FnaSBLZnQuMRowGAYD
-VQQLExFUYW51c2l0dmFueWtpYWRvazE2MDQGA1UEAxMtTmV0TG9jayBLb3pqZWd5em9pIChDbGFz
-cyBBKSBUYW51c2l0dmFueWtpYWRvMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvHSM
-D7tM9DceqQWC2ObhbHDqeLVu0ThEDaiDzl3S1tWBxdRL51uUcCbbO51qTGL3cfNk1mE7PetzozfZ
-z+qMkjvN9wfcZnSX9EUi3fRc4L9t875lM+QVOr/bmJBVOMTtplVjC7B4BPTjbsE/jvxReB+SnoPC
-/tmwqcm8WgD/qaiYdPv2LD4VOQ22BFWoDpggQrOxJa1+mm9dU7GrDPzr4PN6s6iz/0b2Y6LYOph7
-tqyF/7AlT3Rj5xMHpQqPBffAZG9+pyeAlt7ULoZgx2srXnN7F+eRP2QM2EsiNCubMvJIH5+hCoR6
-4sKtlz2O1cH5VqNQ6ca0+pii7pXmKgOM3wIDAQABo4ICnzCCApswDgYDVR0PAQH/BAQDAgAGMBIG
-A1UdEwEB/wQIMAYBAf8CAQQwEQYJYIZIAYb4QgEBBAQDAgAHMIICYAYJYIZIAYb4QgENBIICURaC
-Ak1GSUdZRUxFTSEgRXplbiB0YW51c2l0dmFueSBhIE5ldExvY2sgS2Z0LiBBbHRhbGFub3MgU3pv
-bGdhbHRhdGFzaSBGZWx0ZXRlbGVpYmVuIGxlaXJ0IGVsamFyYXNvayBhbGFwamFuIGtlc3p1bHQu
-IEEgaGl0ZWxlc2l0ZXMgZm9seWFtYXRhdCBhIE5ldExvY2sgS2Z0LiB0ZXJtZWtmZWxlbG9zc2Vn
-LWJpenRvc2l0YXNhIHZlZGkuIEEgZGlnaXRhbGlzIGFsYWlyYXMgZWxmb2dhZGFzYW5hayBmZWx0
-ZXRlbGUgYXogZWxvaXJ0IGVsbGVub3J6ZXNpIGVsamFyYXMgbWVndGV0ZWxlLiBBeiBlbGphcmFz
-IGxlaXJhc2EgbWVndGFsYWxoYXRvIGEgTmV0TG9jayBLZnQuIEludGVybmV0IGhvbmxhcGphbiBh
-IGh0dHBzOi8vd3d3Lm5ldGxvY2submV0L2RvY3MgY2ltZW4gdmFneSBrZXJoZXRvIGF6IGVsbGVu
-b3J6ZXNAbmV0bG9jay5uZXQgZS1tYWlsIGNpbWVuLiBJTVBPUlRBTlQhIFRoZSBpc3N1YW5jZSBh
-bmQgdGhlIHVzZSBvZiB0aGlzIGNlcnRpZmljYXRlIGlzIHN1YmplY3QgdG8gdGhlIE5ldExvY2sg
-Q1BTIGF2YWlsYWJsZSBhdCBodHRwczovL3d3dy5uZXRsb2NrLm5ldC9kb2NzIG9yIGJ5IGUtbWFp
-bCBhdCBjcHNAbmV0bG9jay5uZXQuMA0GCSqGSIb3DQEBBAUAA4IBAQBIJEb3ulZv+sgoA0BO5TE5
-ayZrU3/b39/zcT0mwBQOxmd7I6gMc90Bu8bKbjc5VdXHjFYgDigKDtIqpLBJUsY4B/6+CgmM0ZjP
-ytoUMaFP0jn8DxEsQ8Pdq5PHVT5HfBgaANzze9jyf1JsIPQLX2lS9O74silg6+NJMSEN1rUQQeJB
-CWziGppWS3cC9qCbmieH6FUpccKQn0V4GuEVZD3QDtigdp+uxdAu6tYPVuxkf1qbFFgBJ34TUMdr
-KuZoPL9coAob4Q566eKAw+np9v1sEZ7Q5SgnK1QyQhSCdeZK8CtmdWOMovsEPoMOmzbwGOQmIMOM
-8CgHrTwXZoi1/baI
------END CERTIFICATE-----
-
-NetLock Business (Class B) Root
-===============================
------BEGIN CERTIFICATE-----
-MIIFSzCCBLSgAwIBAgIBaTANBgkqhkiG9w0BAQQFADCBmTELMAkGA1UEBhMCSFUxETAPBgNVBAcT
-CEJ1ZGFwZXN0MScwJQYDVQQKEx5OZXRMb2NrIEhhbG96YXRiaXp0b25zYWdpIEtmdC4xGjAYBgNV
-BAsTEVRhbnVzaXR2YW55a2lhZG9rMTIwMAYDVQQDEylOZXRMb2NrIFV6bGV0aSAoQ2xhc3MgQikg
-VGFudXNpdHZhbnlraWFkbzAeFw05OTAyMjUxNDEwMjJaFw0xOTAyMjAxNDEwMjJaMIGZMQswCQYD
-VQQGEwJIVTERMA8GA1UEBxMIQnVkYXBlc3QxJzAlBgNVBAoTHk5ldExvY2sgSGFsb3phdGJpenRv
-bnNhZ2kgS2Z0LjEaMBgGA1UECxMRVGFudXNpdHZhbnlraWFkb2sxMjAwBgNVBAMTKU5ldExvY2sg
-VXpsZXRpIChDbGFzcyBCKSBUYW51c2l0dmFueWtpYWRvMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCB
-iQKBgQCx6gTsIKAjwo84YM/HRrPVG/77uZmeBNwcf4xKgZjupNTKihe5In+DCnVMm8Bp2GQ5o+2S
-o/1bXHQawEfKOml2mrriRBf8TKPV/riXiK+IA4kfpPIEPsgHC+b5sy96YhQJRhTKZPWLgLViqNhr
-1nGTLbO/CVRY7QbrqHvcQ7GhaQIDAQABo4ICnzCCApswEgYDVR0TAQH/BAgwBgEB/wIBBDAOBgNV
-HQ8BAf8EBAMCAAYwEQYJYIZIAYb4QgEBBAQDAgAHMIICYAYJYIZIAYb4QgENBIICURaCAk1GSUdZ
-RUxFTSEgRXplbiB0YW51c2l0dmFueSBhIE5ldExvY2sgS2Z0LiBBbHRhbGFub3MgU3pvbGdhbHRh
-dGFzaSBGZWx0ZXRlbGVpYmVuIGxlaXJ0IGVsamFyYXNvayBhbGFwamFuIGtlc3p1bHQuIEEgaGl0
-ZWxlc2l0ZXMgZm9seWFtYXRhdCBhIE5ldExvY2sgS2Z0LiB0ZXJtZWtmZWxlbG9zc2VnLWJpenRv
-c2l0YXNhIHZlZGkuIEEgZGlnaXRhbGlzIGFsYWlyYXMgZWxmb2dhZGFzYW5hayBmZWx0ZXRlbGUg
-YXogZWxvaXJ0IGVsbGVub3J6ZXNpIGVsamFyYXMgbWVndGV0ZWxlLiBBeiBlbGphcmFzIGxlaXJh
-c2EgbWVndGFsYWxoYXRvIGEgTmV0TG9jayBLZnQuIEludGVybmV0IGhvbmxhcGphbiBhIGh0dHBz
-Oi8vd3d3Lm5ldGxvY2submV0L2RvY3MgY2ltZW4gdmFneSBrZXJoZXRvIGF6IGVsbGVub3J6ZXNA
-bmV0bG9jay5uZXQgZS1tYWlsIGNpbWVuLiBJTVBPUlRBTlQhIFRoZSBpc3N1YW5jZSBhbmQgdGhl
-IHVzZSBvZiB0aGlzIGNlcnRpZmljYXRlIGlzIHN1YmplY3QgdG8gdGhlIE5ldExvY2sgQ1BTIGF2
-YWlsYWJsZSBhdCBodHRwczovL3d3dy5uZXRsb2NrLm5ldC9kb2NzIG9yIGJ5IGUtbWFpbCBhdCBj
-cHNAbmV0bG9jay5uZXQuMA0GCSqGSIb3DQEBBAUAA4GBAATbrowXr/gOkDFOzT4JwG06sPgzTEdM
-43WIEJessDgVkcYplswhwG08pXTP2IKlOcNl40JwuyKQ433bNXbhoLXan3BukxowOR0w2y7jfLKR
-stE3Kfq51hdcR0/jHTjrn9V7lagonhVK0dHQKwCXoOKSNitjrFgBazMpUIaD8QFI
------END CERTIFICATE-----
-
-NetLock Express (Class C) Root
-==============================
------BEGIN CERTIFICATE-----
-MIIFTzCCBLigAwIBAgIBaDANBgkqhkiG9w0BAQQFADCBmzELMAkGA1UEBhMCSFUxETAPBgNVBAcT
-CEJ1ZGFwZXN0MScwJQYDVQQKEx5OZXRMb2NrIEhhbG96YXRiaXp0b25zYWdpIEtmdC4xGjAYBgNV
-BAsTEVRhbnVzaXR2YW55a2lhZG9rMTQwMgYDVQQDEytOZXRMb2NrIEV4cHJlc3N6IChDbGFzcyBD
-KSBUYW51c2l0dmFueWtpYWRvMB4XDTk5MDIyNTE0MDgxMVoXDTE5MDIyMDE0MDgxMVowgZsxCzAJ
-BgNVBAYTAkhVMREwDwYDVQQHEwhCdWRhcGVzdDEnMCUGA1UEChMeTmV0TG9jayBIYWxvemF0Yml6
-dG9uc2FnaSBLZnQuMRowGAYDVQQLExFUYW51c2l0dmFueWtpYWRvazE0MDIGA1UEAxMrTmV0TG9j
-ayBFeHByZXNzeiAoQ2xhc3MgQykgVGFudXNpdHZhbnlraWFkbzCBnzANBgkqhkiG9w0BAQEFAAOB
-jQAwgYkCgYEA6+ywbGGKIyWvYCDj2Z/8kwvbXY2wobNAOoLO/XXgeDIDhlqGlZHtU/qdQPzm6N3Z
-W3oDvV3zOwzDUXmbrVWg6dADEK8KuhRC2VImESLH0iDMgqSaqf64gXadarfSNnU+sYYJ9m5tfk63
-euyucYT2BDMIJTLrdKwWRMbkQJMdf60CAwEAAaOCAp8wggKbMBIGA1UdEwEB/wQIMAYBAf8CAQQw
-DgYDVR0PAQH/BAQDAgAGMBEGCWCGSAGG+EIBAQQEAwIABzCCAmAGCWCGSAGG+EIBDQSCAlEWggJN
-RklHWUVMRU0hIEV6ZW4gdGFudXNpdHZhbnkgYSBOZXRMb2NrIEtmdC4gQWx0YWxhbm9zIFN6b2xn
-YWx0YXRhc2kgRmVsdGV0ZWxlaWJlbiBsZWlydCBlbGphcmFzb2sgYWxhcGphbiBrZXN6dWx0LiBB
-IGhpdGVsZXNpdGVzIGZvbHlhbWF0YXQgYSBOZXRMb2NrIEtmdC4gdGVybWVrZmVsZWxvc3NlZy1i
-aXp0b3NpdGFzYSB2ZWRpLiBBIGRpZ2l0YWxpcyBhbGFpcmFzIGVsZm9nYWRhc2FuYWsgZmVsdGV0
-ZWxlIGF6IGVsb2lydCBlbGxlbm9yemVzaSBlbGphcmFzIG1lZ3RldGVsZS4gQXogZWxqYXJhcyBs
-ZWlyYXNhIG1lZ3RhbGFsaGF0byBhIE5ldExvY2sgS2Z0LiBJbnRlcm5ldCBob25sYXBqYW4gYSBo
-dHRwczovL3d3dy5uZXRsb2NrLm5ldC9kb2NzIGNpbWVuIHZhZ3kga2VyaGV0byBheiBlbGxlbm9y
-emVzQG5ldGxvY2submV0IGUtbWFpbCBjaW1lbi4gSU1QT1JUQU5UISBUaGUgaXNzdWFuY2UgYW5k
-IHRoZSB1c2Ugb2YgdGhpcyBjZXJ0aWZpY2F0ZSBpcyBzdWJqZWN0IHRvIHRoZSBOZXRMb2NrIENQ
-UyBhdmFpbGFibGUgYXQgaHR0cHM6Ly93d3cubmV0bG9jay5uZXQvZG9jcyBvciBieSBlLW1haWwg
-YXQgY3BzQG5ldGxvY2submV0LjANBgkqhkiG9w0BAQQFAAOBgQAQrX/XDDKACtiG8XmYta3UzbM2
-xJZIwVzNmtkFLp++UOv0JhQQLdRmF/iewSf98e3ke0ugbLWrmldwpu2gpO0u9f38vf5NNwgMvOOW
-gyL1SRt/Syu0VMGAfJlOHdCM7tCs5ZL6dVb+ZKATj7i4Fp1hBWeAyNDYpQcCNJgEjTME1A==
------END CERTIFICATE-----
-
-XRamp Global CA Root
-====================
------BEGIN CERTIFICATE-----
-MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCBgjELMAkGA1UE
-BhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2Vj
-dXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB
-dXRob3JpdHkwHhcNMDQxMTAxMTcxNDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMx
-HjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkg
-U2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3Jp
-dHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS638eMpSe2OAtp87ZOqCwu
-IR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCPKZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMx
-foArtYzAQDsRhtDLooY2YKTVMIJt2W7QDxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FE
-zG+gSqmUsE3a56k0enI4qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqs
-AxcZZPRaJSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNViPvry
-xS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
-EwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASsjVy16bYbMDYGA1UdHwQvMC0wK6Ap
-oCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMC
-AQEwDQYJKoZIhvcNAQEFBQADggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc
-/Kh4ZzXxHfARvbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt
-qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLaIR9NmXmd4c8n
-nxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSyi6mx5O+aGtA9aZnuqCij4Tyz
-8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQO+7ETPTsJ3xCwnR8gooJybQDJbw=
------END CERTIFICATE-----
-
-Go Daddy Class 2 CA
-===================
------BEGIN CERTIFICATE-----
-MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMY
-VGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRp
-ZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkG
-A1UEBhMCVVMxITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28g
-RGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQAD
-ggENADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCAPVYYYwhv
-2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6wwdhFJ2+qN1j3hybX2C32
-qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXiEqITLdiOr18SPaAIBQi2XKVlOARFmR6j
-YGB0xUGlcmIbYsUfb18aQr4CUWWoriMYavx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmY
-vLEHZ6IVDd2gWMZEewo+YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0O
-BBYEFNLEsNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h/t2o
-atTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMu
-MTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwG
-A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wim
-PQoZ+YeAEW5p5JYXMP80kWNyOO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKt
-I3lpjbi2Tc7PTMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ
-HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mERdEr/VxqHD3VI
-Ls9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5CufReYNnyicsbkqWletNw+vHX/b
-vZ8=
------END CERTIFICATE-----
-
-Starfield Class 2 CA
-====================
------BEGIN CERTIFICATE-----
-MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzElMCMGA1UEChMc
-U3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZpZWxkIENsYXNzIDIg
-Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQwNjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBo
-MQswCQYDVQQGEwJVUzElMCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAG
-A1UECxMpU3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqG
-SIb3DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf8MOh2tTY
-bitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN+lq2cwQlZut3f+dZxkqZ
-JRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVm
-epsZGD3/cVE8MC5fvj13c7JdBmzDI1aaK4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSN
-F4Azbl5KXZnJHoe0nRrA1W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HF
-MIHCMB0GA1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fRzt0f
-hvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNo
-bm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBDbGFzcyAyIENlcnRpZmljYXRpb24g
-QXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGs
-afPzWdqbAYcaT1epoXkJKtv3L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLM
-PUxA2IGvd56Deruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl
-xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynpVSJYACPq4xJD
-KVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEYWQPJIrSPnNVeKtelttQKbfi3
-QBFGmh95DmK/D5fs4C8fF5Q=
------END CERTIFICATE-----
-
-StartCom Certification Authority
-================================
------BEGIN CERTIFICATE-----
-MIIHyTCCBbGgAwIBAgIBATANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMN
-U3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmlu
-ZzEpMCcGA1UEAxMgU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDYwOTE3MTk0
-NjM2WhcNMzYwOTE3MTk0NjM2WjB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMNU3RhcnRDb20gTHRk
-LjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMg
-U3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw
-ggIKAoICAQDBiNsJvGxGfHiflXu1M5DycmLWwTYgIiRezul38kMKogZkpMyONvg45iPwbm2xPN1y
-o4UcodM9tDMr0y+v/uqwQVlntsQGfQqedIXWeUyAN3rfOQVSWff0G0ZDpNKFhdLDcfN1YjS6LIp/
-Ho/u7TTQEceWzVI9ujPW3U3eCztKS5/CJi/6tRYccjV3yjxd5srhJosaNnZcAdt0FCX+7bWgiA/d
-eMotHweXMAEtcnn6RtYTKqi5pquDSR3l8u/d5AGOGAqPY1MWhWKpDhk6zLVmpsJrdAfkK+F2PrRt
-2PZE4XNiHzvEvqBTViVsUQn3qqvKv3b9bZvzndu/PWa8DFaqr5hIlTpL36dYUNk4dalb6kMMAv+Z
-6+hsTXBbKWWc3apdzK8BMewM69KN6Oqce+Zu9ydmDBpI125C4z/eIT574Q1w+2OqqGwaVLRcJXrJ
-osmLFqa7LH4XXgVNWG4SHQHuEhANxjJ/GP/89PrNbpHoNkm+Gkhpi8KWTRoSsmkXwQqQ1vp5Iki/
-untp+HDH+no32NgN0nZPV/+Qt+OR0t3vwmC3Zzrd/qqc8NSLf3Iizsafl7b4r4qgEKjZ+xjGtrVc
-UjyJthkqcwEKDwOzEmDyei+B26Nu/yYwl/WL3YlXtq09s68rxbd2AvCl1iuahhQqcvbjM4xdCUsT
-37uMdBNSSwIDAQABo4ICUjCCAk4wDAYDVR0TBAUwAwEB/zALBgNVHQ8EBAMCAa4wHQYDVR0OBBYE
-FE4L7xqkQFulF2mHMMo0aEPQQa7yMGQGA1UdHwRdMFswLKAqoCiGJmh0dHA6Ly9jZXJ0LnN0YXJ0
-Y29tLm9yZy9zZnNjYS1jcmwuY3JsMCugKaAnhiVodHRwOi8vY3JsLnN0YXJ0Y29tLm9yZy9zZnNj
-YS1jcmwuY3JsMIIBXQYDVR0gBIIBVDCCAVAwggFMBgsrBgEEAYG1NwEBATCCATswLwYIKwYBBQUH
-AgEWI2h0dHA6Ly9jZXJ0LnN0YXJ0Y29tLm9yZy9wb2xpY3kucGRmMDUGCCsGAQUFBwIBFilodHRw
-Oi8vY2VydC5zdGFydGNvbS5vcmcvaW50ZXJtZWRpYXRlLnBkZjCB0AYIKwYBBQUHAgIwgcMwJxYg
-U3RhcnQgQ29tbWVyY2lhbCAoU3RhcnRDb20pIEx0ZC4wAwIBARqBl0xpbWl0ZWQgTGlhYmlsaXR5
-LCByZWFkIHRoZSBzZWN0aW9uICpMZWdhbCBMaW1pdGF0aW9ucyogb2YgdGhlIFN0YXJ0Q29tIENl
-cnRpZmljYXRpb24gQXV0aG9yaXR5IFBvbGljeSBhdmFpbGFibGUgYXQgaHR0cDovL2NlcnQuc3Rh
-cnRjb20ub3JnL3BvbGljeS5wZGYwEQYJYIZIAYb4QgEBBAQDAgAHMDgGCWCGSAGG+EIBDQQrFilT
-dGFydENvbSBGcmVlIFNTTCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTANBgkqhkiG9w0BAQUFAAOC
-AgEAFmyZ9GYMNPXQhV59CuzaEE44HF7fpiUFS5Eyweg78T3dRAlbB0mKKctmArexmvclmAk8jhvh
-3TaHK0u7aNM5Zj2gJsfyOZEdUauCe37Vzlrk4gNXcGmXCPleWKYK34wGmkUWFjgKXlf2Ysd6AgXm
-vB618p70qSmD+LIU424oh0TDkBreOKk8rENNZEXO3SipXPJzewT4F+irsfMuXGRuczE6Eri8sxHk
-fY+BUZo7jYn0TZNmezwD7dOaHZrzZVD1oNB1ny+v8OqCQ5j4aZyJecRDjkZy42Q2Eq/3JR44iZB3
-fsNrarnDy0RLrHiQi+fHLB5LEUTINFInzQpdn4XBidUaePKVEFMy3YCEZnXZtWgo+2EuvoSoOMCZ
-EoalHmdkrQYuL6lwhceWD3yJZfWOQ1QOq92lgDmUYMA0yZZwLKMS9R9Ie70cfmu3nZD0Ijuu+Pwq
-yvqCUqDvr0tVk+vBtfAii6w0TiYiBKGHLHVKt+V9E9e4DGTANtLJL4YSjCMJwRuCO3NJo2pXh5Tl
-1njFmUNj403gdy3hZZlyaQQaRwnmDwFWJPsfvw55qVguucQJAX6Vum0ABj6y6koQOdjQK/W/7HW/
-lwLFCRsI3FU34oH7N4RDYiDK51ZLZer+bMEkkyShNOsF/5oirpt9P/FlUQqmMGqz9IgcgA38coro
-g14=
------END CERTIFICATE-----
-
-Taiwan GRCA
-===========
------BEGIN CERTIFICATE-----
-MIIFcjCCA1qgAwIBAgIQH51ZWtcvwgZEpYAIaeNe9jANBgkqhkiG9w0BAQUFADA/MQswCQYDVQQG
-EwJUVzEwMC4GA1UECgwnR292ZXJubWVudCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4X
-DTAyMTIwNTEzMjMzM1oXDTMyMTIwNTEzMjMzM1owPzELMAkGA1UEBhMCVFcxMDAuBgNVBAoMJ0dv
-dmVybm1lbnQgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCAiIwDQYJKoZIhvcNAQEBBQAD
-ggIPADCCAgoCggIBAJoluOzMonWoe/fOW1mKydGGEghU7Jzy50b2iPN86aXfTEc2pBsBHH8eV4qN
-w8XRIePaJD9IK/ufLqGU5ywck9G/GwGHU5nOp/UKIXZ3/6m3xnOUT0b3EEk3+qhZSV1qgQdW8or5
-BtD3cCJNtLdBuTK4sfCxw5w/cP1T3YGq2GN49thTbqGsaoQkclSGxtKyyhwOeYHWtXBiCAEuTk8O
-1RGvqa/lmr/czIdtJuTJV6L7lvnM4T9TjGxMfptTCAtsF/tnyMKtsc2AtJfcdgEWFelq16TheEfO
-htX7MfP6Mb40qij7cEwdScevLJ1tZqa2jWR+tSBqnTuBto9AAGdLiYa4zGX+FVPpBMHWXx1E1wov
-J5pGfaENda1UhhXcSTvxls4Pm6Dso3pdvtUqdULle96ltqqvKKyskKw4t9VoNSZ63Pc78/1Fm9G7
-Q3hub/FCVGqY8A2tl+lSXunVanLeavcbYBT0peS2cWeqH+riTcFCQP5nRhc4L0c/cZyu5SHKYS1t
-B6iEfC3uUSXxY5Ce/eFXiGvviiNtsea9P63RPZYLhY3Naye7twWb7LuRqQoHEgKXTiCQ8P8NHuJB
-O9NAOueNXdpm5AKwB1KYXA6OM5zCppX7VRluTI6uSw+9wThNXo+EHWbNxWCWtFJaBYmOlXqYwZE8
-lSOyDvR5tMl8wUohAgMBAAGjajBoMB0GA1UdDgQWBBTMzO/MKWCkO7GStjz6MmKPrCUVOzAMBgNV
-HRMEBTADAQH/MDkGBGcqBwAEMTAvMC0CAQAwCQYFKw4DAhoFADAHBgVnKgMAAAQUA5vwIhP/lSg2
-09yewDL7MTqKUWUwDQYJKoZIhvcNAQEFBQADggIBAECASvomyc5eMN1PhnR2WPWus4MzeKR6dBcZ
-TulStbngCnRiqmjKeKBMmo4sIy7VahIkv9Ro04rQ2JyftB8M3jh+Vzj8jeJPXgyfqzvS/3WXy6Tj
-Zwj/5cAWtUgBfen5Cv8b5Wppv3ghqMKnI6mGq3ZW6A4M9hPdKmaKZEk9GhiHkASfQlK3T8v+R0F2
-Ne//AHY2RTKbxkaFXeIksB7jSJaYV0eUVXoPQbFEJPPB/hprv4j9wabak2BegUqZIJxIZhm1AHlU
-D7gsL0u8qV1bYH+Mh6XgUmMqvtg7hUAV/h62ZT/FS9p+tXo1KaMuephgIqP0fSdOLeq0dDzpD6Qz
-DxARvBMB1uUO07+1EqLhRSPAzAhuYbeJq4PjJB7mXQfnHyA+z2fI56wwbSdLaG5LKlwCCDTb+Hbk
-Z6MmnD+iMsJKxYEYMRBWqoTvLQr/uB930r+lWKBi5NdLkXWNiYCYfm3LU05er/ayl4WXudpVBrkk
-7tfGOB5jGxI7leFYrPLfhNVfmS8NVVvmONsuP3LpSIXLuykTjx44VbnzssQwmSNOXfJIoRIM3BKQ
-CZBUkQM8R+XVyWXgt0t97EfTsws+rZ7QdAAO671RrcDeLMDDav7v3Aun+kbfYNucpllQdSNpc5Oy
-+fwC00fmcc4QAu4njIT/rEUNE1yDMuAlpYYsfPQS
------END CERTIFICATE-----
-
-Firmaprofesional Root CA
-========================
------BEGIN CERTIFICATE-----
-MIIEVzCCAz+gAwIBAgIBATANBgkqhkiG9w0BAQUFADCBnTELMAkGA1UEBhMCRVMxIjAgBgNVBAcT
-GUMvIE11bnRhbmVyIDI0NCBCYXJjZWxvbmExQjBABgNVBAMTOUF1dG9yaWRhZCBkZSBDZXJ0aWZp
-Y2FjaW9uIEZpcm1hcHJvZmVzaW9uYWwgQ0lGIEE2MjYzNDA2ODEmMCQGCSqGSIb3DQEJARYXY2FA
-ZmlybWFwcm9mZXNpb25hbC5jb20wHhcNMDExMDI0MjIwMDAwWhcNMTMxMDI0MjIwMDAwWjCBnTEL
-MAkGA1UEBhMCRVMxIjAgBgNVBAcTGUMvIE11bnRhbmVyIDI0NCBCYXJjZWxvbmExQjBABgNVBAMT
-OUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1hcHJvZmVzaW9uYWwgQ0lGIEE2MjYzNDA2
-ODEmMCQGCSqGSIb3DQEJARYXY2FAZmlybWFwcm9mZXNpb25hbC5jb20wggEiMA0GCSqGSIb3DQEB
-AQUAA4IBDwAwggEKAoIBAQDnIwNvbyOlXnjOlSztlB5uCp4Bx+ow0Syd3Tfom5h5VtP8c9/Qit5V
-j1H5WuretXDE7aTt/6MNbg9kUDGvASdYrv5sp0ovFy3Tc9UTHI9ZpTQsHVQERc1ouKDAA6XPhUJH
-lShbz++AbOCQl4oBPB3zhxAwJkh91/zpnZFx/0GaqUC1N5wpIE8fUuOgfRNtVLcK3ulqTgesrBlf
-3H5idPayBQC6haD9HThuy1q7hryUZzM1gywfI834yJFxzJeL764P3CkDG8A563DtwW4O2GcLiam8
-NeTvtjS0pbbELaW+0MOUJEjb35bTALVmGotmBQ/dPz/LP6pemkr4tErvlTcbAgMBAAGjgZ8wgZww
-KgYDVR0RBCMwIYYfaHR0cDovL3d3dy5maXJtYXByb2Zlc2lvbmFsLmNvbTASBgNVHRMBAf8ECDAG
-AQH/AgEBMCsGA1UdEAQkMCKADzIwMDExMDI0MjIwMDAwWoEPMjAxMzEwMjQyMjAwMDBaMA4GA1Ud
-DwEB/wQEAwIBBjAdBgNVHQ4EFgQUMwugZtHq2s7eYpMEKFK1FH84aLcwDQYJKoZIhvcNAQEFBQAD
-ggEBAEdz/o0nVPD11HecJ3lXV7cVVuzH2Fi3AQL0M+2TUIiefEaxvT8Ub/GzR0iLjJcG1+p+o1wq
-u00vR+L4OQbJnC4xGgN49Lw4xiKLMzHwFgQEffl25EvXwOaD7FnMP97/T2u3Z36mhoEyIwOdyPdf
-wUpgpZKpsaSgYMN4h7Mi8yrrW6ntBas3D7Hi05V2Y1Z0jFhyGzflZKG+TQyTmAyX9odtsz/ny4Cm
-7YjHX1BiAuiZdBbQ5rQ58SfLyEDW44YQqSMSkuBpQWOnryULwMWSyx6Yo1q6xTMPoJcB3X/ge9YG
-VM+h4k0460tQtcsm9MracEpqoeJ5quGnM/b9Sh/22WA=
------END CERTIFICATE-----
-
-Wells Fargo Root CA
-===================
------BEGIN CERTIFICATE-----
-MIID5TCCAs2gAwIBAgIEOeSXnjANBgkqhkiG9w0BAQUFADCBgjELMAkGA1UEBhMCVVMxFDASBgNV
-BAoTC1dlbGxzIEZhcmdvMSwwKgYDVQQLEyNXZWxscyBGYXJnbyBDZXJ0aWZpY2F0aW9uIEF1dGhv
-cml0eTEvMC0GA1UEAxMmV2VsbHMgRmFyZ28gUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcN
-MDAxMDExMTY0MTI4WhcNMjEwMTE0MTY0MTI4WjCBgjELMAkGA1UEBhMCVVMxFDASBgNVBAoTC1dl
-bGxzIEZhcmdvMSwwKgYDVQQLEyNXZWxscyBGYXJnbyBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEv
-MC0GA1UEAxMmV2VsbHMgRmFyZ28gUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0GCSqG
-SIb3DQEBAQUAA4IBDwAwggEKAoIBAQDVqDM7Jvk0/82bfuUER84A4n135zHCLielTWi5MbqNQ1mX
-x3Oqfz1cQJ4F5aHiidlMuD+b+Qy0yGIZLEWukR5zcUHESxP9cMIlrCL1dQu3U+SlK93OvRw6esP3
-E48mVJwWa2uv+9iWsWCaSOAlIiR5NM4OJgALTqv9i86C1y8IcGjBqAr5dE8Hq6T54oN+J3N0Prj5
-OEL8pahbSCOz6+MlsoCultQKnMJ4msZoGK43YjdeUXWoWGPAUe5AeH6orxqg4bB4nVCMe+ez/I4j
-sNtlAHCEAQgAFG5Uhpq6zPk3EPbg3oQtnaSFN9OH4xXQwReQfhkhahKpdv0SAulPIV4XAgMBAAGj
-YTBfMA8GA1UdEwEB/wQFMAMBAf8wTAYDVR0gBEUwQzBBBgtghkgBhvt7hwcBCzAyMDAGCCsGAQUF
-BwIBFiRodHRwOi8vd3d3LndlbGxzZmFyZ28uY29tL2NlcnRwb2xpY3kwDQYJKoZIhvcNAQEFBQAD
-ggEBANIn3ZwKdyu7IvICtUpKkfnRLb7kuxpo7w6kAOnu5+/u9vnldKTC2FJYxHT7zmu1Oyl5GFrv
-m+0fazbuSCUlFLZWohDo7qd/0D+j0MNdJu4HzMPBJCGHHt8qElNvQRbn7a6U+oxy+hNH8Dx+rn0R
-OhPs7fpvcmR7nX1/Jv16+yWt6j4pf0zjAFcysLPp7VMX2YuyFA4w6OXVE8Zkr8QA1dhYJPz1j+zx
-x32l2w8n0cbyQIjmH/ZhqPRCyLk306m+LFZ4wnKbWV01QIroTmMatukgalHizqSQ33ZwmVxwQ023
-tqcZZE6St8WRPH9IFmV7Fv3L/PvZ1dZPIWU7Sn9Ho/s=
------END CERTIFICATE-----
-
-Swisscom Root CA 1
-==================
------BEGIN CERTIFICATE-----
-MIIF2TCCA8GgAwIBAgIQXAuFXAvnWUHfV8w/f52oNjANBgkqhkiG9w0BAQUFADBkMQswCQYDVQQG
-EwJjaDERMA8GA1UEChMIU3dpc3Njb20xJTAjBgNVBAsTHERpZ2l0YWwgQ2VydGlmaWNhdGUgU2Vy
-dmljZXMxGzAZBgNVBAMTElN3aXNzY29tIFJvb3QgQ0EgMTAeFw0wNTA4MTgxMjA2MjBaFw0yNTA4
-MTgyMjA2MjBaMGQxCzAJBgNVBAYTAmNoMREwDwYDVQQKEwhTd2lzc2NvbTElMCMGA1UECxMcRGln
-aXRhbCBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczEbMBkGA1UEAxMSU3dpc3Njb20gUm9vdCBDQSAxMIIC
-IjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0LmwqAzZuz8h+BvVM5OAFmUgdbI9m2BtRsiM
-MW8Xw/qabFbtPMWRV8PNq5ZJkCoZSx6jbVfd8StiKHVFXqrWW/oLJdihFvkcxC7mlSpnzNApbjyF
-NDhhSbEAn9Y6cV9Nbc5fuankiX9qUvrKm/LcqfmdmUc/TilftKaNXXsLmREDA/7n29uj/x2lzZAe
-AR81sH8A25Bvxn570e56eqeqDFdvpG3FEzuwpdntMhy0XmeLVNxzh+XTF3xmUHJd1BpYwdnP2IkC
-b6dJtDZd0KTeByy2dbcokdaXvij1mB7qWybJvbCXc9qukSbraMH5ORXWZ0sKbU/Lz7DkQnGMU3nn
-7uHbHaBuHYwadzVcFh4rUx80i9Fs/PJnB3r1re3WmquhsUvhzDdf/X/NTa64H5xD+SpYVUNFvJbN
-cA78yeNmuk6NO4HLFWR7uZToXTNShXEuT46iBhFRyePLoW4xCGQMwtI89Tbo19AOeCMgkckkKmUp
-WyL3Ic6DXqTz3kvTaI9GdVyDCW4pa8RwjPWd1yAv/0bSKzjCL3UcPX7ape8eYIVpQtPM+GP+HkM5
-haa2Y0EQs3MevNP6yn0WR+Kn1dCjigoIlmJWbjTb2QK5MHXjBNLnj8KwEUAKrNVxAmKLMb7dxiNY
-MUJDLXT5xp6mig/p/r+D5kNXJLrvRjSq1xIBOO0CAwEAAaOBhjCBgzAOBgNVHQ8BAf8EBAMCAYYw
-HQYDVR0hBBYwFDASBgdghXQBUwABBgdghXQBUwABMBIGA1UdEwEB/wQIMAYBAf8CAQcwHwYDVR0j
-BBgwFoAUAyUv3m+CATpcLNwroWm1Z9SM0/0wHQYDVR0OBBYEFAMlL95vggE6XCzcK6FptWfUjNP9
-MA0GCSqGSIb3DQEBBQUAA4ICAQA1EMvspgQNDQ/NwNurqPKIlwzfky9NfEBWMXrrpA9gzXrzvsMn
-jgM+pN0S734edAY8PzHyHHuRMSG08NBsl9Tpl7IkVh5WwzW9iAUPWxAaZOHHgjD5Mq2eUCzneAXQ
-MbFamIp1TpBcahQq4FJHgmDmHtqBsfsUC1rxn9KVuj7QG9YVHaO+htXbD8BJZLsuUBlL0iT43R4H
-VtA4oJVwIHaM190e3p9xxCPvgxNcoyQVTSlAPGrEqdi3pkSlDfTgnXceQHAm/NrZNuR55LU/vJtl
-vrsRls/bxig5OgjOR1tTWsWZ/l2p3e9M1MalrQLmjAcSHm8D0W+go/MpvRLHUKKwf4ipmXeascCl
-OS5cfGniLLDqN2qk4Vrh9VDlg++luyqI54zb/W1elxmofmZ1a3Hqv7HHb6D0jqTsNFFbjCYDcKF3
-1QESVwA12yPeDooomf2xEG9L/zgtYE4snOtnta1J7ksfrK/7DZBaZmBwXarNeNQk7shBoJMBkpxq
-nvy5JMWzFYJ+vq6VK+uxwNrjAWALXmmshFZhvnEX/h0TD/7Gh0Xp/jKgGg0TpJRVcaUWi7rKibCy
-x/yP2FS1k2Kdzs9Z+z0YzirLNRWCXf9UIltxUvu3yf5gmwBBZPCqKuy2QkPOiWaByIufOVQDJdMW
-NY6E0F/6MBr1mmz0DlP5OlvRHA==
------END CERTIFICATE-----
-
-DigiCert Assured ID Root CA
-===========================
------BEGIN CERTIFICATE-----
-MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQG
-EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
-IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzEx
-MTEwMDAwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
-ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0Ew
-ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7cJpSIqvTO
-9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYPmDI2dsze3Tyoou9q+yHy
-UmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW
-/lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpy
-oeb6pNnVFzF1roV9Iq4/AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whf
-GHdPAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRF
-66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYunpyGd823IDzANBgkq
-hkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRCdWKuh+vy1dneVrOfzM4UKLkNl2Bc
-EkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTffwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38Fn
-SbNd67IJKusm7Xi+fT8r87cmNW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i
-8b5QZ7dsvfPxH2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe
-+o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g==
------END CERTIFICATE-----
-
-DigiCert Global Root CA
-=======================
------BEGIN CERTIFICATE-----
-MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBhMQswCQYDVQQG
-EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
-HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBDQTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAw
-MDAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
-dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkq
-hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsBCSDMAZOn
-TjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97nh6Vfe63SKMI2tavegw5
-BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt43C/dxC//AH2hdmoRBBYMql1GNXRor5H
-4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7PT19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y
-7vrTC0LUq7dBMtoM1O/4gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQAB
-o2MwYTAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbRTLtm
-8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUwDQYJKoZIhvcNAQEF
-BQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/EsrhMAtudXH/vTBH1jLuG2cenTnmCmr
-EbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIt
-tep3Sp+dWOIrWcBAI+0tKIJFPnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886
-UAb3LujEV0lsYSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk
-CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=
------END CERTIFICATE-----
-
-DigiCert High Assurance EV Root CA
-==================================
------BEGIN CERTIFICATE-----
-MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBsMQswCQYDVQQG
-EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSsw
-KQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5jZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAw
-MFoXDTMxMTExMDAwMDAwMFowbDELMAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZ
-MBcGA1UECxMQd3d3LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFu
-Y2UgRVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm+9S75S0t
-Mqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTWPNt0OKRKzE0lgvdKpVMS
-OO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEMxChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3
-MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFBIk5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQ
-NAQTXKFx01p8VdteZOE3hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUe
-h10aUAsgEsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMB
-Af8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaAFLE+w2kD+L9HAdSY
-JhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3NecnzyIZgYIVyHbIUf4KmeqvxgydkAQ
-V8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6zeM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFp
-myPInngiK3BD41VHMWEZ71jFhS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkK
-mNEVX58Svnw2Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
-vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep+OkuE6N36B9K
------END CERTIFICATE-----
-
-Certplus Class 2 Primary CA
-===========================
------BEGIN CERTIFICATE-----
-MIIDkjCCAnqgAwIBAgIRAIW9S/PY2uNp9pTXX8OlRCMwDQYJKoZIhvcNAQEFBQAwPTELMAkGA1UE
-BhMCRlIxETAPBgNVBAoTCENlcnRwbHVzMRswGQYDVQQDExJDbGFzcyAyIFByaW1hcnkgQ0EwHhcN
-OTkwNzA3MTcwNTAwWhcNMTkwNzA2MjM1OTU5WjA9MQswCQYDVQQGEwJGUjERMA8GA1UEChMIQ2Vy
-dHBsdXMxGzAZBgNVBAMTEkNsYXNzIDIgUHJpbWFyeSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEP
-ADCCAQoCggEBANxQltAS+DXSCHh6tlJw/W/uz7kRy1134ezpfgSN1sxvc0NXYKwzCkTsA18cgCSR
-5aiRVhKC9+Ar9NuuYS6JEI1rbLqzAr3VNsVINyPi8Fo3UjMXEuLRYE2+L0ER4/YXJQyLkcAbmXuZ
-Vg2v7tK8R1fjeUl7NIknJITesezpWE7+Tt9avkGtrAjFGA7v0lPubNCdEgETjdyAYveVqUSISnFO
-YFWe2yMZeVYHDD9jC1yw4r5+FfyUM1hBOHTE4Y+L3yasH7WLO7dDWWuwJKZtkIvEcupdM5i3y95e
-e++U8Rs+yskhwcWYAqqi9lt3m/V+llU0HGdpwPFC40es/CgcZlUCAwEAAaOBjDCBiTAPBgNVHRME
-CDAGAQH/AgEKMAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQU43Mt38sOKAze3bOkynm4jrvoMIkwEQYJ
-YIZIAYb4QgEBBAQDAgEGMDcGA1UdHwQwMC4wLKAqoCiGJmh0dHA6Ly93d3cuY2VydHBsdXMuY29t
-L0NSTC9jbGFzczIuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQCnVM+IRBnL39R/AN9WM2K191EBkOvD
-P9GIROkkXe/nFL0gt5o8AP5tn9uQ3Nf0YtaLcF3n5QRIqWh8yfFC82x/xXp8HVGIutIKPidd3i1R
-TtMTZGnkLuPT55sJmabglZvOGtd/vjzOUrMRFcEPF80Du5wlFbqidon8BvEY0JNLDnyCt6X09l/+
-7UCmnYR0ObncHoUW2ikbhiMAybuJfm6AiB4vFLQDJKgybwOaRywwvlbGp0ICcBvqQNi6BQNwB6SW
-//1IMwrh3KWBkJtN3X3n57LNXMhqlfil9o3EXXgIvnsG1knPGTZQIy4I5p4FTUcY1Rbpsda2ENW7
-l7+ijrRU
------END CERTIFICATE-----
-
-DST Root CA X3
-==============
------BEGIN CERTIFICATE-----
-MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/MSQwIgYDVQQK
-ExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMTDkRTVCBSb290IENBIFgzMB4X
-DTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVowPzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1
-cmUgVHJ1c3QgQ28uMRcwFQYDVQQDEw5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQAD
-ggEPADCCAQoCggEBAN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmT
-rE4Orz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEqOLl5CjH9
-UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9bxiqKqy69cK3FCxolkHRy
-xXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw7BZy1SbsOFU5Q9D8/RhcQPGX69Wam40d
-utolucbY38EVAjqr2m7xPi71XAicPNaDaeQQmxkqtilX4+U9m5/wAl0CAwEAAaNCMEAwDwYDVR0T
-AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMSnsaR7LHH62+FLkHX/xBVghYkQ
-MA0GCSqGSIb3DQEBBQUAA4IBAQCjGiybFwBcqR7uKGY3Or+Dxz9LwwmglSBd49lZRNI+DT69ikug
-dB/OEIKcdBodfpga3csTS7MgROSR6cz8faXbauX+5v3gTt23ADq1cEmv8uXrAvHRAosZy5Q6XkjE
-GB5YGV8eAlrwDPGxrancWYaLbumR9YbK+rlmM6pZW87ipxZzR8srzJmwN0jP41ZL9c8PDHIyh8bw
-RLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubS
-fZGL+T0yjWW06XyxV3bqxbYoOb8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ
------END CERTIFICATE-----
-
-DST ACES CA X6
-==============
------BEGIN CERTIFICATE-----
-MIIECTCCAvGgAwIBAgIQDV6ZCtadt3js2AdWO4YV2TANBgkqhkiG9w0BAQUFADBbMQswCQYDVQQG
-EwJVUzEgMB4GA1UEChMXRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QxETAPBgNVBAsTCERTVCBBQ0VT
-MRcwFQYDVQQDEw5EU1QgQUNFUyBDQSBYNjAeFw0wMzExMjAyMTE5NThaFw0xNzExMjAyMTE5NTha
-MFsxCzAJBgNVBAYTAlVTMSAwHgYDVQQKExdEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdDERMA8GA1UE
-CxMIRFNUIEFDRVMxFzAVBgNVBAMTDkRTVCBBQ0VTIENBIFg2MIIBIjANBgkqhkiG9w0BAQEFAAOC
-AQ8AMIIBCgKCAQEAuT31LMmU3HWKlV1j6IR3dma5WZFcRt2SPp/5DgO0PWGSvSMmtWPuktKe1jzI
-DZBfZIGxqAgNTNj50wUoUrQBJcWVHAx+PhCEdc/BGZFjz+iokYi5Q1K7gLFViYsx+tC3dr5BPTCa
-pCIlF3PoHuLTrCq9Wzgh1SpL11V94zpVvddtawJXa+ZHfAjIgrrep4c9oW24MFbCswKBXy314pow
-GCi4ZtPLAZZv6opFVdbgnf9nKxcCpk4aahELfrd755jWjHZvwTvbUJN+5dCOHze4vbrGn2zpfDPy
-MjwmR/onJALJfh1biEITajV8fTXpLmaRcpPVMibEdPVTo7NdmvYJywIDAQABo4HIMIHFMA8GA1Ud
-EwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgHGMB8GA1UdEQQYMBaBFHBraS1vcHNAdHJ1c3Rkc3Qu
-Y29tMGIGA1UdIARbMFkwVwYKYIZIAWUDAgEBATBJMEcGCCsGAQUFBwIBFjtodHRwOi8vd3d3LnRy
-dXN0ZHN0LmNvbS9jZXJ0aWZpY2F0ZXMvcG9saWN5L0FDRVMtaW5kZXguaHRtbDAdBgNVHQ4EFgQU
-CXIGThhDD+XWzMNqizF7eI+og7gwDQYJKoZIhvcNAQEFBQADggEBAKPYjtay284F5zLNAdMEA+V2
-5FYrnJmQ6AgwbN99Pe7lv7UkQIRJ4dEorsTCOlMwiPH1d25Ryvr/ma8kXxug/fKshMrfqfBfBC6t
-Fr8hlxCBPeP/h40y3JTlR4peahPJlJU90u7INJXQgNStMgiAVDzgvVJT11J8smk/f3rPanTK+gQq
-nExaBqXpIK1FZg9p8d2/6eMyi/rgwYZNcjwu2JN4Cir42NInPRmJX1p7ijvMDNpRrscL9yuwNwXs
-vFcj4jjSm2jzVhKIT0J8uDHEtdvkyCE06UgRNe76x5JXxZ805Mf29w4LTJxoeHtxMcfrHuBnQfO3
-oKfN5XozNmr6mis=
------END CERTIFICATE-----
-
-TURKTRUST Certificate Services Provider Root 1
-==============================================
------BEGIN CERTIFICATE-----
-MIID+zCCAuOgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBtzE/MD0GA1UEAww2VMOcUktUUlVTVCBF
-bGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMQswCQYDVQQGDAJUUjEP
-MA0GA1UEBwwGQU5LQVJBMVYwVAYDVQQKDE0oYykgMjAwNSBUw5xSS1RSVVNUIEJpbGdpIMSwbGV0
-acWfaW0gdmUgQmlsacWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWeLjAeFw0wNTA1MTMx
-MDI3MTdaFw0xNTAzMjIxMDI3MTdaMIG3MT8wPQYDVQQDDDZUw5xSS1RSVVNUIEVsZWt0cm9uaWsg
-U2VydGlmaWthIEhpem1ldCBTYcSfbGF5xLFjxLFzxLExCzAJBgNVBAYMAlRSMQ8wDQYDVQQHDAZB
-TktBUkExVjBUBgNVBAoMTShjKSAyMDA1IFTDnFJLVFJVU1QgQmlsZ2kgxLBsZXRpxZ9pbSB2ZSBC
-aWxpxZ9pbSBHw7x2ZW5sacSfaSBIaXptZXRsZXJpIEEuxZ4uMIIBIjANBgkqhkiG9w0BAQEFAAOC
-AQ8AMIIBCgKCAQEAylIF1mMD2Bxf3dJ7XfIMYGFbazt0K3gNfUW9InTojAPBxhEqPZW8qZSwu5GX
-yGl8hMW0kWxsE2qkVa2kheiVfrMArwDCBRj1cJ02i67L5BuBf5OI+2pVu32Fks66WJ/bMsW9Xe8i
-Si9BB35JYbOG7E6mQW6EvAPs9TscyB/C7qju6hJKjRTP8wrgUDn5CDX4EVmt5yLqS8oUBt5CurKZ
-8y1UiBAG6uEaPj1nH/vO+3yC6BFdSsG5FOpU2WabfIl9BJpiyelSPJ6c79L1JuTm5Rh8i27fbMx4
-W09ysstcP4wFjdFMjK2Sx+F4f2VsSQZQLJ4ywtdKxnWKWU51b0dewQIDAQABoxAwDjAMBgNVHRME
-BTADAQH/MA0GCSqGSIb3DQEBBQUAA4IBAQAV9VX/N5aAWSGk/KEVTCD21F/aAyT8z5Aa9CEKmu46
-sWrv7/hg0Uw2ZkUd82YCdAR7kjCo3gp2D++Vbr3JN+YaDayJSFvMgzbC9UZcWYJWtNX+I7TYVBxE
-q8Sn5RTOPEFhfEPmzcSBCYsk+1Ql1haolgxnB2+zUEfjHCQo3SqYpGH+2+oSN7wBGjSFvW5P55Fy
-B0SFHljKVETd96y5y4khctuPwGkplyqjrhgjlxxBKot8KsF8kOipKMDTkcatKIdAaLX/7KfS0zgY
-nNN9aV3wxqUeJBujR/xpB2jn5Jq07Q+hh4cCzofSSE7hvP/L8XKSRGQDJereW26fyfJOrN3H
------END CERTIFICATE-----
-
-TURKTRUST Certificate Services Provider Root 2
-==============================================
------BEGIN CERTIFICATE-----
-MIIEPDCCAySgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBvjE/MD0GA1UEAww2VMOcUktUUlVTVCBF
-bGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMQswCQYDVQQGEwJUUjEP
-MA0GA1UEBwwGQW5rYXJhMV0wWwYDVQQKDFRUw5xSS1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUg
-QmlsacWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWeLiAoYykgS2FzxLFtIDIwMDUwHhcN
-MDUxMTA3MTAwNzU3WhcNMTUwOTE2MTAwNzU3WjCBvjE/MD0GA1UEAww2VMOcUktUUlVTVCBFbGVr
-dHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMQswCQYDVQQGEwJUUjEPMA0G
-A1UEBwwGQW5rYXJhMV0wWwYDVQQKDFRUw5xSS1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUgQmls
-acWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWeLiAoYykgS2FzxLFtIDIwMDUwggEiMA0G
-CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCpNn7DkUNMwxmYCMjHWHtPFoylzkkBH3MOrHUTpvqe
-LCDe2JAOCtFp0if7qnefJ1Il4std2NiDUBd9irWCPwSOtNXwSadktx4uXyCcUHVPr+G1QRT0mJKI
-x+XlZEdhR3n9wFHxwZnn3M5q+6+1ATDcRhzviuyV79z/rxAc653YsKpqhRgNF8k+v/Gb0AmJQv2g
-QrSdiVFVKc8bcLyEVK3BEx+Y9C52YItdP5qtygy/p1Zbj3e41Z55SZI/4PGXJHpsmxcPbe9TmJEr
-5A++WXkHeLuXlfSfadRYhwqp48y2WBmfJiGxxFmNskF1wK1pzpwACPI2/z7woQ8arBT9pmAPAgMB
-AAGjQzBBMB0GA1UdDgQWBBTZN7NOBf3Zz58SFq62iS/rJTqIHDAPBgNVHQ8BAf8EBQMDBwYAMA8G
-A1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAHJglrfJ3NgpXiOFX7KzLXb7iNcX/ntt
-Rbj2hWyfIvwqECLsqrkw9qtY1jkQMZkpAL2JZkH7dN6RwRgLn7Vhy506vvWolKMiVW4XSf/SKfE4
-Jl3vpao6+XF75tpYHdN0wgH6PmlYX63LaL4ULptswLbcoCb6dxriJNoaN+BnrdFzgw2lGh1uEpJ+
-hGIAF728JRhX8tepb1mIvDS3LoV4nZbcFMMsilKbloxSZj2GFotHuFEJjOp9zYhys2AzsfAKRO8P
-9Qk3iCQOLGsgOqL6EfJANZxEaGM7rDNvY7wsu/LSy3Z9fYjYHcgFHW68lKlmjHdxx/qR+i9Rnuk5
-UrbnBEI=
------END CERTIFICATE-----
-
-SwissSign Gold CA - G2
-======================
------BEGIN CERTIFICATE-----
-MIIFujCCA6KgAwIBAgIJALtAHEP1Xk+wMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNVBAYTAkNIMRUw
-EwYDVQQKEwxTd2lzc1NpZ24gQUcxHzAdBgNVBAMTFlN3aXNzU2lnbiBHb2xkIENBIC0gRzIwHhcN
-MDYxMDI1MDgzMDM1WhcNMzYxMDI1MDgzMDM1WjBFMQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dp
-c3NTaWduIEFHMR8wHQYDVQQDExZTd2lzc1NpZ24gR29sZCBDQSAtIEcyMIICIjANBgkqhkiG9w0B
-AQEFAAOCAg8AMIICCgKCAgEAr+TufoskDhJuqVAtFkQ7kpJcyrhdhJJCEyq8ZVeCQD5XJM1QiyUq
-t2/876LQwB8CJEoTlo8jE+YoWACjR8cGp4QjK7u9lit/VcyLwVcfDmJlD909Vopz2q5+bbqBHH5C
-jCA12UNNhPqE21Is8w4ndwtrvxEvcnifLtg+5hg3Wipy+dpikJKVyh+c6bM8K8vzARO/Ws/BtQpg
-vd21mWRTuKCWs2/iJneRjOBiEAKfNA+k1ZIzUd6+jbqEemA8atufK+ze3gE/bk3lUIbLtK/tREDF
-ylqM2tIrfKjuvqblCqoOpd8FUrdVxyJdMmqXl2MT28nbeTZ7hTpKxVKJ+STnnXepgv9VHKVxaSvR
-AiTysybUa9oEVeXBCsdtMDeQKuSeFDNeFhdVxVu1yzSJkvGdJo+hB9TGsnhQ2wwMC3wLjEHXuend
-jIj3o02yMszYF9rNt85mndT9Xv+9lz4pded+p2JYryU0pUHHPbwNUMoDAw8IWh+Vc3hiv69yFGkO
-peUDDniOJihC8AcLYiAQZzlG+qkDzAQ4embvIIO1jEpWjpEA/I5cgt6IoMPiaG59je883WX0XaxR
-7ySArqpWl2/5rX3aYT+YdzylkbYcjCbaZaIJbcHiVOO5ykxMgI93e2CaHt+28kgeDrpOVG2Y4OGi
-GqJ3UM/EY5LsRxmd6+ZrzsECAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUw
-AwEB/zAdBgNVHQ4EFgQUWyV7lqRlUX64OfPAeGZe6Drn8O4wHwYDVR0jBBgwFoAUWyV7lqRlUX64
-OfPAeGZe6Drn8O4wRgYDVR0gBD8wPTA7BglghXQBWQECAQEwLjAsBggrBgEFBQcCARYgaHR0cDov
-L3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBACe645R88a7A3hfm
-5djV9VSwg/S7zV4Fe0+fdWavPOhWfvxyeDgD2StiGwC5+OlgzczOUYrHUDFu4Up+GC9pWbY9ZIEr
-44OE5iKHjn3g7gKZYbge9LgriBIWhMIxkziWMaa5O1M/wySTVltpkuzFwbs4AOPsF6m43Md8AYOf
-Mke6UiI0HTJ6CVanfCU2qT1L2sCCbwq7EsiHSycR+R4tx5M/nttfJmtS2S6K8RTGRI0Vqbe/vd6m
-Gu6uLftIdxf+u+yvGPUqUfA5hJeVbG4bwyvEdGB5JbAKJ9/fXtI5z0V9QkvfsywexcZdylU6oJxp
-mo/a77KwPJ+HbBIrZXAVUjEaJM9vMSNQH4xPjyPDdEFjHFWoFN0+4FFQz/EbMFYOkrCChdiDyyJk
-vC24JdVUorgG6q2SpCSgwYa1ShNqR88uC1aVVMvOmttqtKay20EIhid392qgQmwLOM7XdVAyksLf
-KzAiSNDVQTglXaTpXZ/GlHXQRf0wl0OPkKsKx4ZzYEppLd6leNcG2mqeSz53OiATIgHQv2ieY2Br
-NU0LbbqhPcCT4H8js1WtciVORvnSFu+wZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6Lqj
-viOvrv1vA+ACOzB2+httQc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ
------END CERTIFICATE-----
-
-SwissSign Silver CA - G2
-========================
------BEGIN CERTIFICATE-----
-MIIFvTCCA6WgAwIBAgIITxvUL1S7L0swDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCQ0gxFTAT
-BgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMB4X
-DTA2MTAyNTA4MzI0NloXDTM2MTAyNTA4MzI0NlowRzELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFN3
-aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMIICIjANBgkqhkiG
-9w0BAQEFAAOCAg8AMIICCgKCAgEAxPGHf9N4Mfc4yfjDmUO8x/e8N+dOcbpLj6VzHVxumK4DV644
-N0MvFz0fyM5oEMF4rhkDKxD6LHmD9ui5aLlV8gREpzn5/ASLHvGiTSf5YXu6t+WiE7brYT7QbNHm
-+/pe7R20nqA1W6GSy/BJkv6FCgU+5tkL4k+73JU3/JHpMjUi0R86TieFnbAVlDLaYQ1HTWBCrpJH
-6INaUFjpiou5XaHc3ZlKHzZnu0jkg7Y360g6rw9njxcH6ATK72oxh9TAtvmUcXtnZLi2kUpCe2Uu
-MGoM9ZDulebyzYLs2aFK7PayS+VFheZteJMELpyCbTapxDFkH4aDCyr0NQp4yVXPQbBH6TCfmb5h
-qAaEuSh6XzjZG6k4sIN/c8HDO0gqgg8hm7jMqDXDhBuDsz6+pJVpATqJAHgE2cn0mRmrVn5bi4Y5
-FZGkECwJMoBgs5PAKrYYC51+jUnyEEp/+dVGLxmSo5mnJqy7jDzmDrxHB9xzUfFwZC8I+bRHHTBs
-ROopN4WSaGa8gzj+ezku01DwH/teYLappvonQfGbGHLy9YR0SslnxFSuSGTfjNFusB3hB48IHpmc
-celM2KX3RxIfdNFRnobzwqIjQAtz20um53MGjMGg6cFZrEb65i/4z3GcRm25xBWNOHkDRUjvxF3X
-CO6HOSKGsg0PWEP3calILv3q1h8CAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/
-BAUwAwEB/zAdBgNVHQ4EFgQUF6DNweRBtjpbO8tFnb0cwpj6hlgwHwYDVR0jBBgwFoAUF6DNweRB
-tjpbO8tFnb0cwpj6hlgwRgYDVR0gBD8wPTA7BglghXQBWQEDAQEwLjAsBggrBgEFBQcCARYgaHR0
-cDovL3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBAHPGgeAn0i0P
-4JUw4ppBf1AsX19iYamGamkYDHRJ1l2E6kFSGG9YrVBWIGrGvShpWJHckRE1qTodvBqlYJ7YH39F
-kWnZfrt4csEGDyrOj4VwYaygzQu4OSlWhDJOhrs9xCrZ1x9y7v5RoSJBsXECYxqCsGKrXlcSH9/L
-3XWgwF15kIwb4FDm3jH+mHtwX6WQ2K34ArZv02DdQEsixT2tOnqfGhpHkXkzuoLcMmkDlm4fS/Bx
-/uNncqCxv1yL5PqZIseEuRuNI5c/7SXgz2W79WEE790eslpBIlqhn10s6FvJbakMDHiqYMZWjwFa
-DGi8aRl5xB9+lwW/xekkUV7U1UtT7dkjWjYDZaPBA61BMPNGG4WQr2W11bHkFlt4dR2Xem1ZqSqP
-e97Dh4kQmUlzeMg9vVE1dCrV8X5pGyq7O70luJpaPXJhkGaH7gzWTdQRdAtq/gsD/KNVV4n+Ssuu
-WxcFyPKNIzFTONItaj+CuY0IavdeQXRuwxF+B6wpYJE/OMpXEA29MC/HpeZBoNquBYeaoKRlbEwJ
-DIm6uNO5wJOKMPqN5ZprFQFOZ6raYlY+hAhm0sQ2fac+EPyI4NSA5QC9qvNOBqN6avlicuMJT+ub
-DgEj8Z+7fNzcbBGXJbLytGMU0gYqZ4yD9c7qB9iaah7s5Aq7KkzrCWA5zspi2C5u
------END CERTIFICATE-----
-
-GeoTrust Primary Certification Authority
-========================================
------BEGIN CERTIFICATE-----
-MIIDfDCCAmSgAwIBAgIQGKy1av1pthU6Y2yv2vrEoTANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQG
-EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjExMC8GA1UEAxMoR2VvVHJ1c3QgUHJpbWFyeSBD
-ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjExMjcwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMFgx
-CzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTEwLwYDVQQDEyhHZW9UcnVzdCBQ
-cmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
-CgKCAQEAvrgVe//UfH1nrYNke8hCUy3f9oQIIGHWAVlqnEQRr+92/ZV+zmEwu3qDXwK9AWbK7hWN
-b6EwnL2hhZ6UOvNWiAAxz9juapYC2e0DjPt1befquFUWBRaa9OBesYjAZIVcFU2Ix7e64HXprQU9
-nceJSOC7KMgD4TCTZF5SwFlwIjVXiIrxlQqD17wxcwE07e9GceBrAqg1cmuXm2bgyxx5X9gaBGge
-RwLmnWDiNpcB3841kt++Z8dtd1k7j53WkBWUvEI0EME5+bEnPn7WinXFsq+W06Lem+SYvn3h6YGt
-tm/81w7a4DSwDRp35+MImO9Y+pyEtzavwt+s0vQQBnBxNQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
-AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQULNVQQZcVi/CPNmFbSvtr2ZnJM5IwDQYJKoZI
-hvcNAQEFBQADggEBAFpwfyzdtzRP9YZRqSa+S7iq8XEN3GHHoOo0Hnp3DwQ16CePbJC/kRYkRj5K
-Ts4rFtULUh38H2eiAkUxT87z+gOneZ1TatnaYzr4gNfTmeGl4b7UVXGYNTq+k+qurUKykG/g/CFN
-NWMziUnWm07Kx+dOCQD32sfvmWKZd7aVIl6KoKv0uHiYyjgZmclynnjNS6yvGaBzEi38wkG6gZHa
-Floxt/m0cYASSJlyc1pZU8FjUjPtp8nSOQJw+uCxQmYpqptR7TBUIhRf2asdweSU8Pj1K/fqynhG
-1riR/aYNKxoUAT6A8EKglQdebc3MS6RFjasS6LPeWuWgfOgPIh1a6Vk=
------END CERTIFICATE-----
-
-thawte Primary Root CA
-======================
------BEGIN CERTIFICATE-----
-MIIEIDCCAwigAwIBAgIQNE7VVyDV7exJ9C/ON9srbTANBgkqhkiG9w0BAQUFADCBqTELMAkGA1UE
-BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
-aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
-cml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwHhcNMDYxMTE3
-MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCBqTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwg
-SW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMv
-KGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMT
-FnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCs
-oPD7gFnUnMekz52hWXMJEEUMDSxuaPFsW0hoSVk3/AszGcJ3f8wQLZU0HObrTQmnHNK4yZc2AreJ
-1CRfBsDMRJSUjQJib+ta3RGNKJpchJAQeg29dGYvajig4tVUROsdB58Hum/u6f1OCyn1PoSgAfGc
-q/gcfomk6KHYcWUNo1F77rzSImANuVud37r8UVsLr5iy6S7pBOhih94ryNdOwUxkHt3Ph1i6Sk/K
-aAcdHJ1KxtUvkcx8cXIcxcBn6zL9yZJclNqFwJu/U30rCfSMnZEfl2pSy94JNqR32HuHUETVPm4p
-afs5SSYeCaWAe0At6+gnhcn+Yf1+5nyXHdWdAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYD
-VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBR7W0XPr87Lev0xkhpqtvNG61dIUDANBgkqhkiG9w0BAQUF
-AAOCAQEAeRHAS7ORtvzw6WfUDW5FvlXok9LOAz/t2iWwHVfLHjp2oEzsUHboZHIMpKnxuIvW1oeE
-uzLlQRHAd9mzYJ3rG9XRbkREqaYB7FViHXe4XI5ISXycO1cRrK1zN44veFyQaEfZYGDm/Ac9IiAX
-xPcW6cTYcvnIc3zfFi8VqT79aie2oetaupgf1eNNZAqdE8hhuvU5HIe6uL17In/2/qxAeeWsEG89
-jxt5dovEN7MhGITlNgDrYyCZuen+MwS7QcjBAvlEYyCegc5C09Y/LHbTY5xZ3Y+m4Q6gLkH3LpVH
-z7z9M/P2C2F+fpErgUfCJzDupxBdN49cOSvkBPB7jVaMaA==
------END CERTIFICATE-----
-
-VeriSign Class 3 Public Primary Certification Authority - G5
-============================================================
------BEGIN CERTIFICATE-----
-MIIE0zCCA7ugAwIBAgIQGNrRniZ96LtKIVjNzGs7SjANBgkqhkiG9w0BAQUFADCByjELMAkGA1UE
-BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
-ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
-IHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRp
-ZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwHhcNMDYxMTA4MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCB
-yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2ln
-biBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBh
-dXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmlt
-YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
-ggEKAoIBAQCvJAgIKXo1nmAMqudLO07cfLw8RRy7K+D+KQL5VwijZIUVJ/XxrcgxiV0i6CqqpkKz
-j/i5Vbext0uz/o9+B1fs70PbZmIVYc9gDaTY3vjgw2IIPVQT60nKWVSFJuUrjxuf6/WhkcIzSdhD
-Y2pSS9KP6HBRTdGJaXvHcPaz3BJ023tdS1bTlr8Vd6Gw9KIl8q8ckmcY5fQGBO+QueQA5N06tRn/
-Arr0PO7gi+s3i+z016zy9vA9r911kTMZHRxAy3QkGSGT2RT+rCpSx4/VBEnkjWNHiDxpg8v+R70r
-fk/Fla4OndTRQ8Bnc+MUCH7lP59zuDMKz10/NIeWiu5T6CUVAgMBAAGjgbIwga8wDwYDVR0TAQH/
-BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2Uv
-Z2lmMCEwHzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVy
-aXNpZ24uY29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFH/TZafC3ey78DAJ80M5+gKvMzEzMA0GCSqG
-SIb3DQEBBQUAA4IBAQCTJEowX2LP2BqYLz3q3JktvXf2pXkiOOzEp6B4Eq1iDkVwZMXnl2YtmAl+
-X6/WzChl8gGqCBpH3vn5fJJaCGkgDdk+bW48DW7Y5gaRQBi5+MHt39tBquCWIMnNZBU4gcmU7qKE
-KQsTb47bDN0lAtukixlE0kF6BWlKWE9gyn6CagsCqiUXObXbf+eEZSqVir2G3l6BFoMtEMze/aiC
-Km0oHw0LxOXnGiYZ4fQRbxC1lfznQgUy286dUV4otp6F01vvpX1FQHKOtw5rDgb7MzVIcbidJ4vE
-ZV8NhnacRHr2lVz2XTIIM6RUthg/aFzyQkqFOFSDX9HoLPKsEdao7WNq
------END CERTIFICATE-----
-
-SecureTrust CA
-==============
------BEGIN CERTIFICATE-----
-MIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBIMQswCQYDVQQG
-EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xFzAVBgNVBAMTDlNlY3VyZVRy
-dXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIzMTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAe
-BgNVBAoTF1NlY3VyZVRydXN0IENvcnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCC
-ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQX
-OZEzZum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO0gMdA+9t
-DWccV9cGrcrI9f4Or2YlSASWC12juhbDCE/RRvgUXPLIXgGZbf2IzIaowW8xQmxSPmjL8xk037uH
-GFaAJsTQ3MBv396gwpEWoGQRS0S8Hvbn+mPeZqx2pHGj7DaUaHp3pLHnDi+BeuK1cobvomuL8A/b
-01k/unK8RCSc43Oz969XL0Imnal0ugBS8kvNU3xHCzaFDmapCJcWNFfBZveA4+1wVMeT4C4oFVmH
-ursCAwEAAaOBnTCBmjATBgkrBgEEAYI3FAIEBh4EAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/
-BAUwAwEB/zAdBgNVHQ4EFgQUQjK2FvoE/f5dS3rD/fdMQB1aQ68wNAYDVR0fBC0wKzApoCegJYYj
-aHR0cDovL2NybC5zZWN1cmV0cnVzdC5jb20vU1RDQS5jcmwwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
-KoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt36Z3q059c4EVlew3KW+JwULKUBRSu
-SceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/3XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHf
-mbx8IVQr5Fiiu1cprp6poxkmD5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZ
-nMUFdAvnZyPSCPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR
-3ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE=
------END CERTIFICATE-----
-
-Secure Global CA
-================
------BEGIN CERTIFICATE-----
-MIIDvDCCAqSgAwIBAgIQB1YipOjUiolN9BPI8PjqpTANBgkqhkiG9w0BAQUFADBKMQswCQYDVQQG
-EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBH
-bG9iYWwgQ0EwHhcNMDYxMTA3MTk0MjI4WhcNMjkxMjMxMTk1MjA2WjBKMQswCQYDVQQGEwJVUzEg
-MB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwg
-Q0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvNS7YrGxVaQZx5RNoJLNP2MwhR/jx
-YDiJiQPpvepeRlMJ3Fz1Wuj3RSoC6zFh1ykzTM7HfAo3fg+6MpjhHZevj8fcyTiW89sa/FHtaMbQ
-bqR8JNGuQsiWUGMu4P51/pinX0kuleM5M2SOHqRfkNJnPLLZ/kG5VacJjnIFHovdRIWCQtBJwB1g
-8NEXLJXr9qXBkqPFwqcIYA1gBBCWeZ4WNOaptvolRTnIHmX5k/Wq8VLcmZg9pYYaDDUz+kulBAYV
-HDGA76oYa8J719rO+TMg1fW9ajMtgQT7sFzUnKPiXB3jqUJ1XnvUd+85VLrJChgbEplJL4hL/VBi
-0XPnj3pDAgMBAAGjgZ0wgZowEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
-EwEB/wQFMAMBAf8wHQYDVR0OBBYEFK9EBMJBfkiD2045AuzshHrmzsmkMDQGA1UdHwQtMCswKaAn
-oCWGI2h0dHA6Ly9jcmwuc2VjdXJldHJ1c3QuY29tL1NHQ0EuY3JsMBAGCSsGAQQBgjcVAQQDAgEA
-MA0GCSqGSIb3DQEBBQUAA4IBAQBjGghAfaReUw132HquHw0LURYD7xh8yOOvaliTFGCRsoTciE6+
-OYo68+aCiV0BN7OrJKQVDpI1WkpEXk5X+nXOH0jOZvQ8QCaSmGwb7iRGDBezUqXbpZGRzzfTb+cn
-CDpOGR86p1hcF895P4vkp9MmI50mD1hp/Ed+stCNi5O/KU9DaXR2Z0vPB4zmAve14bRDtUstFJ/5
-3CYNv6ZHdAbYiNE6KTCEztI5gGIbqMdXSbxqVVFnFUq+NQfk1XWYN3kwFNspnWzFacxHVaIw98xc
-f8LDmBxrThaA63p4ZUWiABqvDA1VZDRIuJK58bRQKfJPIx/abKwfROHdI3hRW8cW
------END CERTIFICATE-----
-
-COMODO Certification Authority
-==============================
------BEGIN CERTIFICATE-----
-MIIEHTCCAwWgAwIBAgIQToEtioJl4AsC7j41AkblPTANBgkqhkiG9w0BAQUFADCBgTELMAkGA1UE
-BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
-A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNVBAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1
-dGhvcml0eTAeFw0wNjEyMDEwMDAwMDBaFw0yOTEyMzEyMzU5NTlaMIGBMQswCQYDVQQGEwJHQjEb
-MBkGA1UECBMSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRowGAYDVQQKExFD
-T01PRE8gQ0EgTGltaXRlZDEnMCUGA1UEAxMeQ09NT0RPIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
-MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ECLi3LjkRv3UcEbVASY06m/weaKXTuH
-+7uIzg3jLz8GlvCiKVCZrts7oVewdFFxze1CkU1B/qnI2GqGd0S7WWaXUF601CxwRM/aN5VCaTww
-xHGzUvAhTaHYujl8HJ6jJJ3ygxaYqhZ8Q5sVW7euNJH+1GImGEaaP+vB+fGQV+useg2L23IwambV
-4EajcNxo2f8ESIl33rXp+2dtQem8Ob0y2WIC8bGoPW43nOIv4tOiJovGuFVDiOEjPqXSJDlqR6sA
-1KGzqSX+DT+nHbrTUcELpNqsOO9VUCQFZUaTNE8tja3G1CEZ0o7KBWFxB3NH5YoZEr0ETc5OnKVI
-rLsm9wIDAQABo4GOMIGLMB0GA1UdDgQWBBQLWOWLxkwVN6RAqTCpIb5HNlpW/zAOBgNVHQ8BAf8E
-BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zBJBgNVHR8EQjBAMD6gPKA6hjhodHRwOi8vY3JsLmNvbW9k
-b2NhLmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9uQXV0aG9yaXR5LmNybDANBgkqhkiG9w0BAQUFAAOC
-AQEAPpiem/Yb6dc5t3iuHXIYSdOH5EOC6z/JqvWote9VfCFSZfnVDeFs9D6Mk3ORLgLETgdxb8CP
-OGEIqB6BCsAvIC9Bi5HcSEW88cbeunZrM8gALTFGTO3nnc+IlP8zwFboJIYmuNg4ON8qa90SzMc/
-RxdMosIGlgnW2/4/PEZB31jiVg88O8EckzXZOFKs7sjsLjBOlDW0JB9LeGna8gI4zJVSk/BwJVmc
-IGfE7vmLV2H0knZ9P4SNVbfo5azV8fUZVqZa+5Acr5Pr5RzUZ5ddBA6+C4OmF4O5MBKgxTMVBbkN
-+8cFduPYSo38NBejxiEovjBFMR7HeL5YYTisO+IBZQ==
------END CERTIFICATE-----
-
-Network Solutions Certificate Authority
-=======================================
------BEGIN CERTIFICATE-----
-MIID5jCCAs6gAwIBAgIQV8szb8JcFuZHFhfjkDFo4DANBgkqhkiG9w0BAQUFADBiMQswCQYDVQQG
-EwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMuMTAwLgYDVQQDEydOZXR3b3Jr
-IFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMDYxMjAxMDAwMDAwWhcNMjkxMjMx
-MjM1OTU5WjBiMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMu
-MTAwLgYDVQQDEydOZXR3b3JrIFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0G
-CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDkvH6SMG3G2I4rC7xGzuAnlt7e+foS0zwzc7MEL7xx
-jOWftiJgPl9dzgn/ggwbmlFQGiaJ3dVhXRncEg8tCqJDXRfQNJIg6nPPOCwGJgl6cvf6UDL4wpPT
-aaIjzkGxzOTVHzbRijr4jGPiFFlp7Q3Tf2vouAPlT2rlmGNpSAW+Lv8ztumXWWn4Zxmuk2GWRBXT
-crA/vGp97Eh/jcOrqnErU2lBUzS1sLnFBgrEsEX1QV1uiUV7PTsmjHTC5dLRfbIR1PtYMiKagMnc
-/Qzpf14Dl847ABSHJ3A4qY5usyd2mFHgBeMhqxrVhSI8KbWaFsWAqPS7azCPL0YCorEMIuDTAgMB
-AAGjgZcwgZQwHQYDVR0OBBYEFCEwyfsA106Y2oeqKtCnLrFAMadMMA4GA1UdDwEB/wQEAwIBBjAP
-BgNVHRMBAf8EBTADAQH/MFIGA1UdHwRLMEkwR6BFoEOGQWh0dHA6Ly9jcmwubmV0c29sc3NsLmNv
-bS9OZXR3b3JrU29sdXRpb25zQ2VydGlmaWNhdGVBdXRob3JpdHkuY3JsMA0GCSqGSIb3DQEBBQUA
-A4IBAQC7rkvnt1frf6ott3NHhWrB5KUd5Oc86fRZZXe1eltajSU24HqXLjjAV2CDmAaDn7l2em5Q
-4LqILPxFzBiwmZVRDuwduIj/h1AcgsLj4DKAv6ALR8jDMe+ZZzKATxcheQxpXN5eNK4CtSbqUN9/
-GGUsyfJj4akH/nxxH2szJGoeBfcFaMBqEssuXmHLrijTfsK0ZpEmXzwuJF/LWA/rKOyvEZbz3Htv
-wKeI8lN3s2Berq4o2jUsbzRF0ybh3uxbTydrFny9RAQYgrOJeRcQcT16ohZO9QHNpGxlaKFJdlxD
-ydi8NmdspZS11My5vWo1ViHe2MPr+8ukYEywVaCge1ey
------END CERTIFICATE-----
-
-WellsSecure Public Root Certificate Authority
-=============================================
------BEGIN CERTIFICATE-----
-MIIEvTCCA6WgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBhTELMAkGA1UEBhMCVVMxIDAeBgNVBAoM
-F1dlbGxzIEZhcmdvIFdlbGxzU2VjdXJlMRwwGgYDVQQLDBNXZWxscyBGYXJnbyBCYW5rIE5BMTYw
-NAYDVQQDDC1XZWxsc1NlY3VyZSBQdWJsaWMgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcN
-MDcxMjEzMTcwNzU0WhcNMjIxMjE0MDAwNzU0WjCBhTELMAkGA1UEBhMCVVMxIDAeBgNVBAoMF1dl
-bGxzIEZhcmdvIFdlbGxzU2VjdXJlMRwwGgYDVQQLDBNXZWxscyBGYXJnbyBCYW5rIE5BMTYwNAYD
-VQQDDC1XZWxsc1NlY3VyZSBQdWJsaWMgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0G
-CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDub7S9eeKPCCGeOARBJe+rWxxTkqxtnt3CxC5FlAM1
-iGd0V+PfjLindo8796jE2yljDpFoNoqXjopxaAkH5OjUDk/41itMpBb570OYj7OeUt9tkTmPOL13
-i0Nj67eT/DBMHAGTthP796EfvyXhdDcsHqRePGj4S78NuR4uNuip5Kf4D8uCdXw1LSLWwr8L87T8
-bJVhHlfXBIEyg1J55oNjz7fLY4sR4r1e6/aN7ZVyKLSsEmLpSjPmgzKuBXWVvYSV2ypcm44uDLiB
-K0HmOFafSZtsdvqKXfcBeYF8wYNABf5x/Qw/zE5gCQ5lRxAvAcAFP4/4s0HvWkJ+We/SlwxlAgMB
-AAGjggE0MIIBMDAPBgNVHRMBAf8EBTADAQH/MDkGA1UdHwQyMDAwLqAsoCqGKGh0dHA6Ly9jcmwu
-cGtpLndlbGxzZmFyZ28uY29tL3dzcHJjYS5jcmwwDgYDVR0PAQH/BAQDAgHGMB0GA1UdDgQWBBQm
-lRkQ2eihl5H/3BnZtQQ+0nMKajCBsgYDVR0jBIGqMIGngBQmlRkQ2eihl5H/3BnZtQQ+0nMKaqGB
-i6SBiDCBhTELMAkGA1UEBhMCVVMxIDAeBgNVBAoMF1dlbGxzIEZhcmdvIFdlbGxzU2VjdXJlMRww
-GgYDVQQLDBNXZWxscyBGYXJnbyBCYW5rIE5BMTYwNAYDVQQDDC1XZWxsc1NlY3VyZSBQdWJsaWMg
-Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHmCAQEwDQYJKoZIhvcNAQEFBQADggEBALkVsUSRzCPI
-K0134/iaeycNzXK7mQDKfGYZUMbVmO2rvwNa5U3lHshPcZeG1eMd/ZDJPHV3V3p9+N701NX3leZ0
-bh08rnyd2wIDBSxxSyU+B+NemvVmFymIGjifz6pBA4SXa5M4esowRBskRDPQ5NHcKDj0E0M1NSlj
-qHyita04pO2t/caaH/+Xc/77szWnk4bGdpEA5qxRFsQnMlzbc9qlk1eOPm01JghZ1edE13YgY+es
-E2fDbbFwRnzVlhE9iW9dqKHrjQrawx0zbKPqZxmamX9LPYNRKh3KL4YMon4QLSvUFpULB6ouFJJJ
-tylv2G0xffX8oRAHh84vWdw+WNs=
------END CERTIFICATE-----
-
-COMODO ECC Certification Authority
-==================================
------BEGIN CERTIFICATE-----
-MIICiTCCAg+gAwIBAgIQH0evqmIAcFBUTAGem2OZKjAKBggqhkjOPQQDAzCBhTELMAkGA1UEBhMC
-R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
-ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBB
-dXRob3JpdHkwHhcNMDgwMzA2MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0Ix
-GzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR
-Q09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRo
-b3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQDR3svdcmCFYX7deSRFtSrYpn1PlILBs5BAH+X
-4QokPB0BBO490o0JlwzgdeT6+3eKKvUDYEs2ixYjFq0JcfRK9ChQtP6IHG4/bC8vCVlbpVsLM5ni
-wz2J+Wos77LTBumjQjBAMB0GA1UdDgQWBBR1cacZSBm8nZ3qQUfflMRId5nTeTAOBgNVHQ8BAf8E
-BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjEA7wNbeqy3eApyt4jf/7VG
-FAkK+qDmfQjGGoe9GKhzvSbKYAydzpmfz1wPMOG+FDHqAjAU9JM8SaczepBGR7NjfRObTrdvGDeA
-U/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY=
------END CERTIFICATE-----
-
-IGC/A
-=====
------BEGIN CERTIFICATE-----
-MIIEAjCCAuqgAwIBAgIFORFFEJQwDQYJKoZIhvcNAQEFBQAwgYUxCzAJBgNVBAYTAkZSMQ8wDQYD
-VQQIEwZGcmFuY2UxDjAMBgNVBAcTBVBhcmlzMRAwDgYDVQQKEwdQTS9TR0ROMQ4wDAYDVQQLEwVE
-Q1NTSTEOMAwGA1UEAxMFSUdDL0ExIzAhBgkqhkiG9w0BCQEWFGlnY2FAc2dkbi5wbS5nb3V2LmZy
-MB4XDTAyMTIxMzE0MjkyM1oXDTIwMTAxNzE0MjkyMlowgYUxCzAJBgNVBAYTAkZSMQ8wDQYDVQQI
-EwZGcmFuY2UxDjAMBgNVBAcTBVBhcmlzMRAwDgYDVQQKEwdQTS9TR0ROMQ4wDAYDVQQLEwVEQ1NT
-STEOMAwGA1UEAxMFSUdDL0ExIzAhBgkqhkiG9w0BCQEWFGlnY2FAc2dkbi5wbS5nb3V2LmZyMIIB
-IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsh/R0GLFMzvABIaIs9z4iPf930Pfeo2aSVz2
-TqrMHLmh6yeJ8kbpO0px1R2OLc/mratjUMdUC24SyZA2xtgv2pGqaMVy/hcKshd+ebUyiHDKcMCW
-So7kVc0dJ5S/znIq7Fz5cyD+vfcuiWe4u0dzEvfRNWk68gq5rv9GQkaiv6GFGvm/5P9JhfejcIYy
-HF2fYPepraX/z9E0+X1bF8bc1g4oa8Ld8fUzaJ1O/Id8NhLWo4DoQw1VYZTqZDdH6nfK0LJYBcNd
-frGoRpAxVs5wKpayMLh35nnAvSk7/ZR3TL0gzUEl4C7HG7vupARB0l2tEmqKm0f7yd1GQOGdPDPQ
-tQIDAQABo3cwdTAPBgNVHRMBAf8EBTADAQH/MAsGA1UdDwQEAwIBRjAVBgNVHSAEDjAMMAoGCCqB
-egF5AQEBMB0GA1UdDgQWBBSjBS8YYFDCiQrdKyFP/45OqDAxNjAfBgNVHSMEGDAWgBSjBS8YYFDC
-iQrdKyFP/45OqDAxNjANBgkqhkiG9w0BAQUFAAOCAQEABdwm2Pp3FURo/C9mOnTgXeQp/wYHE4RK
-q89toB9RlPhJy3Q2FLwV3duJL92PoF189RLrn544pEfMs5bZvpwlqwN+Mw+VgQ39FuCIvjfwbF3Q
-MZsyK10XZZOYYLxuj7GoPB7ZHPOpJkL5ZB3C55L29B5aqhlSXa/oovdgoPaN8In1buAKBQGVyYsg
-Crpa/JosPL3Dt8ldeCUFP1YUmwza+zpI/pdpXsoQhvdOlgQITeywvl3cO45Pwf2aNjSaTFR+FwNI
-lQgRHAdvhQh+XU3Endv7rs6y0bO4g2wdsrN58dhwmX7wEwLOXt1R0982gaEbeC9xs/FZTEYYKKuF
-0mBWWg==
------END CERTIFICATE-----
-
-Security Communication EV RootCA1
-=================================
------BEGIN CERTIFICATE-----
-MIIDfTCCAmWgAwIBAgIBADANBgkqhkiG9w0BAQUFADBgMQswCQYDVQQGEwJKUDElMCMGA1UEChMc
-U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEqMCgGA1UECxMhU2VjdXJpdHkgQ29tbXVuaWNh
-dGlvbiBFViBSb290Q0ExMB4XDTA3MDYwNjAyMTIzMloXDTM3MDYwNjAyMTIzMlowYDELMAkGA1UE
-BhMCSlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xKjAoBgNVBAsTIVNl
-Y3VyaXR5IENvbW11bmljYXRpb24gRVYgUm9vdENBMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
-AQoCggEBALx/7FebJOD+nLpCeamIivqA4PUHKUPqjgo0No0c+qe1OXj/l3X3L+SqawSERMqm4miO
-/VVQYg+kcQ7OBzgtQoVQrTyWb4vVog7P3kmJPdZkLjjlHmy1V4qe70gOzXppFodEtZDkBp2uoQSX
-WHnvIEqCa4wiv+wfD+mEce3xDuS4GBPMVjZd0ZoeUWs5bmB2iDQL87PRsJ3KYeJkHcFGB7hj3R4z
-ZbOOCVVSPbW9/wfrrWFVGCypaZhKqkDFMxRldAD5kd6vA0jFQFTcD4SQaCDFkpbcLuUCRarAX1T4
-bepJz11sS6/vmsJWXMY1VkJqMF/Cq/biPT+zyRGPMUzXn0kCAwEAAaNCMEAwHQYDVR0OBBYEFDVK
-9U2vP9eCOKyrcWUXdYydVZPmMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqG
-SIb3DQEBBQUAA4IBAQCoh+ns+EBnXcPBZsdAS5f8hxOQWsTvoMpfi7ent/HWtWS3irO4G8za+6xm
-iEHO6Pzk2x6Ipu0nUBsCMCRGef4Eh3CXQHPRwMFXGZpppSeZq51ihPZRwSzJIxXYKLerJRO1RuGG
-Av8mjMSIkh1W/hln8lXkgKNrnKt34VFxDSDbEJrbvXZ5B3eZKK2aXtqxT0QsNY6llsf9g/BYxnnW
-mHyojf6GPgcWkuF75x3sM3Z+Qi5KhfmRiWiEA4Glm5q+4zfFVKtWOxgtQaQM+ELbmaDgcm+7XeEW
-T1MKZPlO9L9OVL14bIjqv5wTJMJwaaJ/D8g8rQjJsJhAoyrniIPtd490
------END CERTIFICATE-----
-
-OISTE WISeKey Global Root GA CA
-===============================
------BEGIN CERTIFICATE-----
-MIID8TCCAtmgAwIBAgIQQT1yx/RrH4FDffHSKFTfmjANBgkqhkiG9w0BAQUFADCBijELMAkGA1UE
-BhMCQ0gxEDAOBgNVBAoTB1dJU2VLZXkxGzAZBgNVBAsTEkNvcHlyaWdodCAoYykgMjAwNTEiMCAG
-A1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNlZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBH
-bG9iYWwgUm9vdCBHQSBDQTAeFw0wNTEyMTExNjAzNDRaFw0zNzEyMTExNjA5NTFaMIGKMQswCQYD
-VQQGEwJDSDEQMA4GA1UEChMHV0lTZUtleTEbMBkGA1UECxMSQ29weXJpZ2h0IChjKSAyMDA1MSIw
-IAYDVQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5
-IEdsb2JhbCBSb290IEdBIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy0+zAJs9
-Nt350UlqaxBJH+zYK7LG+DKBKUOVTJoZIyEVRd7jyBxRVVuuk+g3/ytr6dTqvirdqFEr12bDYVxg
-Asj1znJ7O7jyTmUIms2kahnBAbtzptf2w93NvKSLtZlhuAGio9RN1AU9ka34tAhxZK9w8RxrfvbD
-d50kc3vkDIzh2TbhmYsFmQvtRTEJysIA2/dyoJaqlYfQjse2YXMNdmaM3Bu0Y6Kff5MTMPGhJ9vZ
-/yxViJGg4E8HsChWjBgbl0SOid3gF27nKu+POQoxhILYQBRJLnpB5Kf+42TMwVlxSywhp1t94B3R
-LoGbw9ho972WG6xwsRYUC9tguSYBBQIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUw
-AwEB/zAdBgNVHQ4EFgQUswN+rja8sHnR3JQmthG+IbJphpQwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
-KoZIhvcNAQEFBQADggEBAEuh/wuHbrP5wUOxSPMowB0uyQlB+pQAHKSkq0lPjz0e701vvbyk9vIm
-MMkQyh2I+3QZH4VFvbBsUfk2ftv1TDI6QU9bR8/oCy22xBmddMVHxjtqD6wU2zz0c5ypBd8A3HR4
-+vg1YFkCExh8vPtNsCBtQ7tgMHpnM1zFmdH4LTlSc/uMqpclXHLZCB6rTjzjgTGfA6b7wP4piFXa
-hNVQA7bihKOmNqoROgHhGEvWRGizPflTdISzRpFGlgC3gCy24eMQ4tui5yiPAZZiFj4A4xylNoEY
-okxSdsARo27mHbrjWr42U8U+dY+GaSlYU7Wcu2+fXMUY7N0v4ZjJ/L7fCg0=
------END CERTIFICATE-----
-
-Microsec e-Szigno Root CA
-=========================
------BEGIN CERTIFICATE-----
-MIIHqDCCBpCgAwIBAgIRAMy4579OKRr9otxmpRwsDxEwDQYJKoZIhvcNAQEFBQAwcjELMAkGA1UE
-BhMCSFUxETAPBgNVBAcTCEJ1ZGFwZXN0MRYwFAYDVQQKEw1NaWNyb3NlYyBMdGQuMRQwEgYDVQQL
-EwtlLVN6aWdubyBDQTEiMCAGA1UEAxMZTWljcm9zZWMgZS1Temlnbm8gUm9vdCBDQTAeFw0wNTA0
-MDYxMjI4NDRaFw0xNzA0MDYxMjI4NDRaMHIxCzAJBgNVBAYTAkhVMREwDwYDVQQHEwhCdWRhcGVz
-dDEWMBQGA1UEChMNTWljcm9zZWMgTHRkLjEUMBIGA1UECxMLZS1Temlnbm8gQ0ExIjAgBgNVBAMT
-GU1pY3Jvc2VjIGUtU3ppZ25vIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB
-AQDtyADVgXvNOABHzNuEwSFpLHSQDCHZU4ftPkNEU6+r+ICbPHiN1I2uuO/TEdyB5s87lozWbxXG
-d36hL+BfkrYn13aaHUM86tnsL+4582pnS4uCzyL4ZVX+LMsvfUh6PXX5qqAnu3jCBspRwn5mS6/N
-oqdNAoI/gqyFxuEPkEeZlApxcpMqyabAvjxWTHOSJ/FrtfX9/DAFYJLG65Z+AZHCabEeHXtTRbjc
-QR/Ji3HWVBTji1R4P770Yjtb9aPs1ZJ04nQw7wHb4dSrmZsqa/i9phyGI0Jf7Enemotb9HI6QMVJ
-PqW+jqpx62z69Rrkav17fVVA71hu5tnVvCSrwe+3AgMBAAGjggQ3MIIEMzBnBggrBgEFBQcBAQRb
-MFkwKAYIKwYBBQUHMAGGHGh0dHBzOi8vcmNhLmUtc3ppZ25vLmh1L29jc3AwLQYIKwYBBQUHMAKG
-IWh0dHA6Ly93d3cuZS1zemlnbm8uaHUvUm9vdENBLmNydDAPBgNVHRMBAf8EBTADAQH/MIIBcwYD
-VR0gBIIBajCCAWYwggFiBgwrBgEEAYGoGAIBAQEwggFQMCgGCCsGAQUFBwIBFhxodHRwOi8vd3d3
-LmUtc3ppZ25vLmh1L1NaU1ovMIIBIgYIKwYBBQUHAgIwggEUHoIBEABBACAAdABhAG4A+gBzAO0A
-dAB2AOEAbgB5ACAA6QByAHQAZQBsAG0AZQB6AOkAcwDpAGgAZQB6ACAA6QBzACAAZQBsAGYAbwBn
-AGEAZADhAHMA4QBoAG8AegAgAGEAIABTAHoAbwBsAGcA4QBsAHQAYQB0APMAIABTAHoAbwBsAGcA
-4QBsAHQAYQB0AOEAcwBpACAAUwB6AGEAYgDhAGwAeQB6AGEAdABhACAAcwB6AGUAcgBpAG4AdAAg
-AGsAZQBsAGwAIABlAGwAagDhAHIAbgBpADoAIABoAHQAdABwADoALwAvAHcAdwB3AC4AZQAtAHMA
-egBpAGcAbgBvAC4AaAB1AC8AUwBaAFMAWgAvMIHIBgNVHR8EgcAwgb0wgbqggbeggbSGIWh0dHA6
-Ly93d3cuZS1zemlnbm8uaHUvUm9vdENBLmNybIaBjmxkYXA6Ly9sZGFwLmUtc3ppZ25vLmh1L0NO
-PU1pY3Jvc2VjJTIwZS1Temlnbm8lMjBSb290JTIwQ0EsT1U9ZS1Temlnbm8lMjBDQSxPPU1pY3Jv
-c2VjJTIwTHRkLixMPUJ1ZGFwZXN0LEM9SFU/Y2VydGlmaWNhdGVSZXZvY2F0aW9uTGlzdDtiaW5h
-cnkwDgYDVR0PAQH/BAQDAgEGMIGWBgNVHREEgY4wgYuBEGluZm9AZS1zemlnbm8uaHWkdzB1MSMw
-IQYDVQQDDBpNaWNyb3NlYyBlLVN6aWduw7MgUm9vdCBDQTEWMBQGA1UECwwNZS1TemlnbsOzIEhT
-WjEWMBQGA1UEChMNTWljcm9zZWMgS2Z0LjERMA8GA1UEBxMIQnVkYXBlc3QxCzAJBgNVBAYTAkhV
-MIGsBgNVHSMEgaQwgaGAFMegSXUWYYTbMUuE0vE3QJDvTtz3oXakdDByMQswCQYDVQQGEwJIVTER
-MA8GA1UEBxMIQnVkYXBlc3QxFjAUBgNVBAoTDU1pY3Jvc2VjIEx0ZC4xFDASBgNVBAsTC2UtU3pp
-Z25vIENBMSIwIAYDVQQDExlNaWNyb3NlYyBlLVN6aWdubyBSb290IENBghEAzLjnv04pGv2i3Gal
-HCwPETAdBgNVHQ4EFgQUx6BJdRZhhNsxS4TS8TdAkO9O3PcwDQYJKoZIhvcNAQEFBQADggEBANMT
-nGZjWS7KXHAM/IO8VbH0jgdsZifOwTsgqRy7RlRw7lrMoHfqaEQn6/Ip3Xep1fvj1KcExJW4C+FE
-aGAHQzAxQmHl7tnlJNUb3+FKG6qfx1/4ehHqE5MAyopYse7tDk2016g2JnzgOsHVV4Lxdbb9iV/a
-86g4nzUGCM4ilb7N1fy+W955a9x6qWVmvrElWl/tftOsRm1M9DKHtCAE4Gx4sHfRhUZLphK3dehK
-yVZs15KrnfVJONJPU+NVkBHbmJbGSfI+9J8b4PeI3CVimUTYc78/MPMMNz7UwiiAc7EBt51alhQB
-S6kRnSlqLtBdgcDPsiBDxwPgN05dCtxZICU=
------END CERTIFICATE-----
-
-Certigna
-========
------BEGIN CERTIFICATE-----
-MIIDqDCCApCgAwIBAgIJAP7c4wEPyUj/MA0GCSqGSIb3DQEBBQUAMDQxCzAJBgNVBAYTAkZSMRIw
-EAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hMB4XDTA3MDYyOTE1MTMwNVoXDTI3
-MDYyOTE1MTMwNVowNDELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczERMA8GA1UEAwwI
-Q2VydGlnbmEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDIaPHJ1tazNHUmgh7stL7q
-XOEm7RFHYeGifBZ4QCHkYJ5ayGPhxLGWkv8YbWkj4Sti993iNi+RB7lIzw7sebYs5zRLcAglozyH
-GxnygQcPOJAZ0xH+hrTy0V4eHpbNgGzOOzGTtvKg0KmVEn2lmsxryIRWijOp5yIVUxbwzBfsV1/p
-ogqYCd7jX5xv3EjjhQsVWqa6n6xI4wmy9/Qy3l40vhx4XUJbzg4ij02Q130yGLMLLGq/jj8UEYkg
-DncUtT2UCIf3JR7VsmAA7G8qKCVuKj4YYxclPz5EIBb2JsglrgVKtOdjLPOMFlN+XPsRGgjBRmKf
-Irjxwo1p3Po6WAbfAgMBAAGjgbwwgbkwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUGu3+QTmQ
-tCRZvgHyUtVF9lo53BEwZAYDVR0jBF0wW4AUGu3+QTmQtCRZvgHyUtVF9lo53BGhOKQ2MDQxCzAJ
-BgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hggkA/tzjAQ/J
-SP8wDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzANBgkqhkiG9w0BAQUFAAOCAQEA
-hQMeknH2Qq/ho2Ge6/PAD/Kl1NqV5ta+aDY9fm4fTIrv0Q8hbV6lUmPOEvjvKtpv6zf+EwLHyzs+
-ImvaYS5/1HI93TDhHkxAGYwP15zRgzB7mFncfca5DClMoTOi62c6ZYTTluLtdkVwj7Ur3vkj1klu
-PBS1xp81HlDQwY9qcEQCYsuuHWhBp6pX6FOqB9IG9tUUBguRA3UsbHK1YZWaDYu5Def131TN3ubY
-1gkIl2PlwS6wt0QmwCbAr1UwnjvVNioZBPRcHv/PLLf/0P2HQBHVESO7SMAhqaQoLf0V+LBOK/Qw
-WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg==
------END CERTIFICATE-----
-
-AC Ra\xC3\xADz Certic\xC3\xA1mara S.A.
-======================================
------BEGIN CERTIFICATE-----
-MIIGZjCCBE6gAwIBAgIPB35Sk3vgFeNX8GmMy+wMMA0GCSqGSIb3DQEBBQUAMHsxCzAJBgNVBAYT
-AkNPMUcwRQYDVQQKDD5Tb2NpZWRhZCBDYW1lcmFsIGRlIENlcnRpZmljYWNpw7NuIERpZ2l0YWwg
-LSBDZXJ0aWPDoW1hcmEgUy5BLjEjMCEGA1UEAwwaQUMgUmHDrXogQ2VydGljw6FtYXJhIFMuQS4w
-HhcNMDYxMTI3MjA0NjI5WhcNMzAwNDAyMjE0MjAyWjB7MQswCQYDVQQGEwJDTzFHMEUGA1UECgw+
-U29jaWVkYWQgQ2FtZXJhbCBkZSBDZXJ0aWZpY2FjacOzbiBEaWdpdGFsIC0gQ2VydGljw6FtYXJh
-IFMuQS4xIzAhBgNVBAMMGkFDIFJhw616IENlcnRpY8OhbWFyYSBTLkEuMIICIjANBgkqhkiG9w0B
-AQEFAAOCAg8AMIICCgKCAgEAq2uJo1PMSCMI+8PPUZYILrgIem08kBeGqentLhM0R7LQcNzJPNCN
-yu5LF6vQhbCnIwTLqKL85XXbQMpiiY9QngE9JlsYhBzLfDe3fezTf3MZsGqy2IiKLUV0qPezuMDU
-2s0iiXRNWhU5cxh0T7XrmafBHoi0wpOQY5fzp6cSsgkiBzPZkc0OnB8OIMfuuzONj8LSWKdf/WU3
-4ojC2I+GdV75LaeHM/J4Ny+LvB2GNzmxlPLYvEqcgxhaBvzz1NS6jBUJJfD5to0EfhcSM2tXSExP
-2yYe68yQ54v5aHxwD6Mq0Do43zeX4lvegGHTgNiRg0JaTASJaBE8rF9ogEHMYELODVoqDA+bMMCm
-8Ibbq0nXl21Ii/kDwFJnmxL3wvIumGVC2daa49AZMQyth9VXAnow6IYm+48jilSH5L887uvDdUhf
-HjlvgWJsxS3EF1QZtzeNnDeRyPYL1epjb4OsOMLzP96a++EjYfDIJss2yKHzMI+ko6Kh3VOz3vCa
-Mh+DkXkwwakfU5tTohVTP92dsxA7SH2JD/ztA/X7JWR1DhcZDY8AFmd5ekD8LVkH2ZD6mq093ICK
-5lw1omdMEWux+IBkAC1vImHFrEsm5VoQgpukg3s0956JkSCXjrdCx2bD0Omk1vUgjcTDlaxECp1b
-czwmPS9KvqfJpxAe+59QafMCAwEAAaOB5jCB4zAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQE
-AwIBBjAdBgNVHQ4EFgQU0QnQ6dfOeXRU+Tows/RtLAMDG2gwgaAGA1UdIASBmDCBlTCBkgYEVR0g
-ADCBiTArBggrBgEFBQcCARYfaHR0cDovL3d3dy5jZXJ0aWNhbWFyYS5jb20vZHBjLzBaBggrBgEF
-BQcCAjBOGkxMaW1pdGFjaW9uZXMgZGUgZ2FyYW507WFzIGRlIGVzdGUgY2VydGlmaWNhZG8gc2Ug
-cHVlZGVuIGVuY29udHJhciBlbiBsYSBEUEMuMA0GCSqGSIb3DQEBBQUAA4ICAQBclLW4RZFNjmEf
-AygPU3zmpFmps4p6xbD/CHwso3EcIRNnoZUSQDWDg4902zNc8El2CoFS3UnUmjIz75uny3XlesuX
-EpBcunvFm9+7OSPI/5jOCk0iAUgHforA1SBClETvv3eiiWdIG0ADBaGJ7M9i4z0ldma/Jre7Ir5v
-/zlXdLp6yQGVwZVR6Kss+LGGIOk/yzVb0hfpKv6DExdA7ohiZVvVO2Dpezy4ydV/NgIlqmjCMRW3
-MGXrfx1IebHPOeJCgBbT9ZMj/EyXyVo3bHwi2ErN0o42gzmRkBDI8ck1fj+404HGIGQatlDCIaR4
-3NAvO2STdPCWkPHv+wlaNECW8DYSwaN0jJN+Qd53i+yG2dIPPy3RzECiiWZIHiCznCNZc6lEc7wk
-eZBWN7PGKX6jD/EpOe9+XCgycDWs2rjIdWb8m0w5R44bb5tNAlQiM+9hup4phO9OSzNHdpdqy35f
-/RWmnkJDW2ZaiogN9xa5P1FlK2Zqi9E4UqLWRhH6/JocdJ6PlwsCT2TG9WjTSy3/pDceiz+/RL5h
-RqGEPQgnTIEgd4kI6mdAXmwIUV80WoyWaM3X94nCHNMyAK9Sy9NgWyo6R35rMDOhYil/SrnhLecU
-Iw4OGEfhefwVVdCx/CVxY3UzHCMrr1zZ7Ud3YA47Dx7SwNxkBYn8eNZcLCZDqQ==
------END CERTIFICATE-----
-
-TC TrustCenter Class 2 CA II
-============================
------BEGIN CERTIFICATE-----
-MIIEqjCCA5KgAwIBAgIOLmoAAQACH9dSISwRXDswDQYJKoZIhvcNAQEFBQAwdjELMAkGA1UEBhMC
-REUxHDAaBgNVBAoTE1RDIFRydXN0Q2VudGVyIEdtYkgxIjAgBgNVBAsTGVRDIFRydXN0Q2VudGVy
-IENsYXNzIDIgQ0ExJTAjBgNVBAMTHFRDIFRydXN0Q2VudGVyIENsYXNzIDIgQ0EgSUkwHhcNMDYw
-MTEyMTQzODQzWhcNMjUxMjMxMjI1OTU5WjB2MQswCQYDVQQGEwJERTEcMBoGA1UEChMTVEMgVHJ1
-c3RDZW50ZXIgR21iSDEiMCAGA1UECxMZVEMgVHJ1c3RDZW50ZXIgQ2xhc3MgMiBDQTElMCMGA1UE
-AxMcVEMgVHJ1c3RDZW50ZXIgQ2xhc3MgMiBDQSBJSTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
-AQoCggEBAKuAh5uO8MN8h9foJIIRszzdQ2Lu+MNF2ujhoF/RKrLqk2jftMjWQ+nEdVl//OEd+DFw
-IxuInie5e/060smp6RQvkL4DUsFJzfb95AhmC1eKokKguNV/aVyQMrKXDcpK3EY+AlWJU+MaWss2
-xgdW94zPEfRMuzBwBJWl9jmM/XOBCH2JXjIeIqkiRUuwZi4wzJ9l/fzLganx4Duvo4bRierERXlQ
-Xa7pIXSSTYtZgo+U4+lK8edJsBTj9WLL1XK9H7nSn6DNqPoByNkN39r8R52zyFTfSUrxIan+GE7u
-SNQZu+995OKdy1u2bv/jzVrndIIFuoAlOMvkaZ6vQaoahPUCAwEAAaOCATQwggEwMA8GA1UdEwEB
-/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTjq1RMgKHbVkO3kUrL84J6E1wIqzCB
-7QYDVR0fBIHlMIHiMIHfoIHcoIHZhjVodHRwOi8vd3d3LnRydXN0Y2VudGVyLmRlL2NybC92Mi90
-Y19jbGFzc18yX2NhX0lJLmNybIaBn2xkYXA6Ly93d3cudHJ1c3RjZW50ZXIuZGUvQ049VEMlMjBU
-cnVzdENlbnRlciUyMENsYXNzJTIwMiUyMENBJTIwSUksTz1UQyUyMFRydXN0Q2VudGVyJTIwR21i
-SCxPVT1yb290Y2VydHMsREM9dHJ1c3RjZW50ZXIsREM9ZGU/Y2VydGlmaWNhdGVSZXZvY2F0aW9u
-TGlzdD9iYXNlPzANBgkqhkiG9w0BAQUFAAOCAQEAjNfffu4bgBCzg/XbEeprS6iSGNn3Bzn1LL4G
-dXpoUxUc6krtXvwjshOg0wn/9vYua0Fxec3ibf2uWWuFHbhOIprtZjluS5TmVfwLG4t3wVMTZonZ
-KNaL80VKY7f9ewthXbhtvsPcW3nS7Yblok2+XnR8au0WOB9/WIFaGusyiC2y8zl3gK9etmF1Kdsj
-TYjKUCjLhdLTEKJZbtOTVAB6okaVhgWcqRmY5TFyDADiZ9lA4CQze28suVyrZZ0srHbqNZn1l7kP
-JOzHdiEoZa5X6AeIdUpWoNIFOqTmjZKILPPy4cHGYdtBxceb9w4aUUXCYWvcZCcXjFq32nQozZfk
-vQ==
------END CERTIFICATE-----
-
-TC TrustCenter Class 3 CA II
-============================
------BEGIN CERTIFICATE-----
-MIIEqjCCA5KgAwIBAgIOSkcAAQAC5aBd1j8AUb8wDQYJKoZIhvcNAQEFBQAwdjELMAkGA1UEBhMC
-REUxHDAaBgNVBAoTE1RDIFRydXN0Q2VudGVyIEdtYkgxIjAgBgNVBAsTGVRDIFRydXN0Q2VudGVy
-IENsYXNzIDMgQ0ExJTAjBgNVBAMTHFRDIFRydXN0Q2VudGVyIENsYXNzIDMgQ0EgSUkwHhcNMDYw
-MTEyMTQ0MTU3WhcNMjUxMjMxMjI1OTU5WjB2MQswCQYDVQQGEwJERTEcMBoGA1UEChMTVEMgVHJ1
-c3RDZW50ZXIgR21iSDEiMCAGA1UECxMZVEMgVHJ1c3RDZW50ZXIgQ2xhc3MgMyBDQTElMCMGA1UE
-AxMcVEMgVHJ1c3RDZW50ZXIgQ2xhc3MgMyBDQSBJSTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
-AQoCggEBALTgu1G7OVyLBMVMeRwjhjEQY0NVJz/GRcekPewJDRoeIMJWHt4bNwcwIi9v8Qbxq63W
-yKthoy9DxLCyLfzDlml7forkzMA5EpBCYMnMNWju2l+QVl/NHE1bWEnrDgFPZPosPIlY2C8u4rBo
-6SI7dYnWRBpl8huXJh0obazovVkdKyT21oQDZogkAHhg8fir/gKya/si+zXmFtGt9i4S5Po1auUZ
-uV3bOx4a+9P/FRQI2AlqukWdFHlgfa9Aigdzs5OW03Q0jTo3Kd5c7PXuLjHCINy+8U9/I1LZW+Jk
-2ZyqBwi1Rb3R0DHBq1SfqdLDYmAD8bs5SpJKPQq5ncWg/jcCAwEAAaOCATQwggEwMA8GA1UdEwEB
-/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTUovyfs8PYA9NXXAek0CSnwPIA1DCB
-7QYDVR0fBIHlMIHiMIHfoIHcoIHZhjVodHRwOi8vd3d3LnRydXN0Y2VudGVyLmRlL2NybC92Mi90
-Y19jbGFzc18zX2NhX0lJLmNybIaBn2xkYXA6Ly93d3cudHJ1c3RjZW50ZXIuZGUvQ049VEMlMjBU
-cnVzdENlbnRlciUyMENsYXNzJTIwMyUyMENBJTIwSUksTz1UQyUyMFRydXN0Q2VudGVyJTIwR21i
-SCxPVT1yb290Y2VydHMsREM9dHJ1c3RjZW50ZXIsREM9ZGU/Y2VydGlmaWNhdGVSZXZvY2F0aW9u
-TGlzdD9iYXNlPzANBgkqhkiG9w0BAQUFAAOCAQEANmDkcPcGIEPZIxpC8vijsrlNirTzwppVMXzE
-O2eatN9NDoqTSheLG43KieHPOh6sHfGcMrSOWXaiQYUlN6AT0PV8TtXqluJucsG7Kv5sbviRmEb8
-yRtXW+rIGjs/sFGYPAfaLFkB2otE6OF0/ado3VS6g0bsyEa1+K+XwDsJHI/OcpY9M1ZwvJbL2NV9
-IJqDnxrcOfHFcqMRA/07QlIp2+gB95tejNaNhk4Z+rwcvsUhpYeeeC422wlxo3I0+GzjBgnyXlal
-092Y+tTmBvTwtiBjS+opvaqCZh77gaqnN60TGOaSw4HBM7uIHqHn4rS9MWwOUT1v+5ZWgOI2F9Hc
-5A==
------END CERTIFICATE-----
-
-TC TrustCenter Universal CA I
-=============================
------BEGIN CERTIFICATE-----
-MIID3TCCAsWgAwIBAgIOHaIAAQAC7LdggHiNtgYwDQYJKoZIhvcNAQEFBQAweTELMAkGA1UEBhMC
-REUxHDAaBgNVBAoTE1RDIFRydXN0Q2VudGVyIEdtYkgxJDAiBgNVBAsTG1RDIFRydXN0Q2VudGVy
-IFVuaXZlcnNhbCBDQTEmMCQGA1UEAxMdVEMgVHJ1c3RDZW50ZXIgVW5pdmVyc2FsIENBIEkwHhcN
-MDYwMzIyMTU1NDI4WhcNMjUxMjMxMjI1OTU5WjB5MQswCQYDVQQGEwJERTEcMBoGA1UEChMTVEMg
-VHJ1c3RDZW50ZXIgR21iSDEkMCIGA1UECxMbVEMgVHJ1c3RDZW50ZXIgVW5pdmVyc2FsIENBMSYw
-JAYDVQQDEx1UQyBUcnVzdENlbnRlciBVbml2ZXJzYWwgQ0EgSTCCASIwDQYJKoZIhvcNAQEBBQAD
-ggEPADCCAQoCggEBAKR3I5ZEr5D0MacQ9CaHnPM42Q9e3s9B6DGtxnSRJJZ4Hgmgm5qVSkr1YnwC
-qMqs+1oEdjneX/H5s7/zA1hV0qq34wQi0fiU2iIIAI3TfCZdzHd55yx4Oagmcw6iXSVphU9VDprv
-xrlE4Vc93x9UIuVvZaozhDrzznq+VZeujRIPFDPiUHDDSYcTvFHe15gSWu86gzOSBnWLknwSaHtw
-ag+1m7Z3W0hZneTvWq3zwZ7U10VOylY0Ibw+F1tvdwxIAUMpsN0/lm7mlaoMwCC2/T42J5zjXM9O
-gdwZu5GQfezmlwQek8wiSdeXhrYTCjxDI3d+8NzmzSQfO4ObNDqDNOMCAwEAAaNjMGEwHwYDVR0j
-BBgwFoAUkqR1LKSevoFE63n8isWVpesQdXMwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
-AYYwHQYDVR0OBBYEFJKkdSyknr6BROt5/IrFlaXrEHVzMA0GCSqGSIb3DQEBBQUAA4IBAQAo0uCG
-1eb4e/CX3CJrO5UUVg8RMKWaTzqwOuAGy2X17caXJ/4l8lfmXpWMPmRgFVp/Lw0BxbFg/UU1z/Cy
-vwbZ71q+s2IhtNerNXxTPqYn8aEt2hojnczd7Dwtnic0XQ/CNnm8yUpiLe1r2X1BQ3y2qsrtYbE3
-ghUJGooWMNjsydZHcnhLEEYUjl8Or+zHL6sQ17bxbuyGssLoDZJz3KL0Dzq/YSMQiZxIQG5wALPT
-ujdEWBF6AmqI8Dc08BnprNRlc/ZpjGSUOnmFKbAWKwyCPwacx/0QK54PLLae4xW/2TYcuiUaUj0a
-7CIMHOCkoj3w6DnPgcB77V0fb8XQC9eY
------END CERTIFICATE-----
-
-Deutsche Telekom Root CA 2
-==========================
------BEGIN CERTIFICATE-----
-MIIDnzCCAoegAwIBAgIBJjANBgkqhkiG9w0BAQUFADBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMT
-RGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0GA1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEG
-A1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBSb290IENBIDIwHhcNOTkwNzA5MTIxMTAwWhcNMTkwNzA5
-MjM1OTAwWjBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMTRGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0G
-A1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEGA1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBS
-b290IENBIDIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCrC6M14IspFLEUha88EOQ5
-bzVdSq7d6mGNlUn0b2SjGmBmpKlAIoTZ1KXleJMOaAGtuU1cOs7TuKhCQN/Po7qCWWqSG6wcmtoI
-KyUn+WkjR/Hg6yx6m/UTAtB+NHzCnjwAWav12gz1MjwrrFDa1sPeg5TKqAyZMg4ISFZbavva4VhY
-AUlfckE8FQYBjl2tqriTtM2e66foai1SNNs671x1Udrb8zH57nGYMsRUFUQM+ZtV7a3fGAigo4aK
-Se5TBY8ZTNXeWHmb0mocQqvF1afPaA+W5OFhmHZhyJF81j4A4pFQh+GdCuatl9Idxjp9y7zaAzTV
-jlsB9WoHtxa2bkp/AgMBAAGjQjBAMB0GA1UdDgQWBBQxw3kbuvVT1xfgiXotF2wKsyudMzAPBgNV
-HRMECDAGAQH/AgEFMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAlGRZrTlk5ynr
-E/5aw4sTV8gEJPB0d8Bg42f76Ymmg7+Wgnxu1MM9756AbrsptJh6sTtU6zkXR34ajgv8HzFZMQSy
-zhfzLMdiNlXiItiJVbSYSKpk+tYcNthEeFpaIzpXl/V6ME+un2pMSyuOoAPjPuCp1NJ70rOo4nI8
-rZ7/gFnkm0W09juwzTkZmDLl6iFhkOQxIY40sfcvNUqFENrnijchvllj4PKFiDFT1FQUhXB59C4G
-dyd1Lx+4ivn+xbrYNuSD7Odlt79jWvNGr4GUN9RBjNYj1h7P9WgbRGOiWrqnNVmh5XAFmw4jV5mU
-Cm26OWMohpLzGITY+9HPBVZkVw==
------END CERTIFICATE-----
-
-ComSign Secured CA
-==================
------BEGIN CERTIFICATE-----
-MIIDqzCCApOgAwIBAgIRAMcoRwmzuGxFjB36JPU2TukwDQYJKoZIhvcNAQEFBQAwPDEbMBkGA1UE
-AxMSQ29tU2lnbiBTZWN1cmVkIENBMRAwDgYDVQQKEwdDb21TaWduMQswCQYDVQQGEwJJTDAeFw0w
-NDAzMjQxMTM3MjBaFw0yOTAzMTYxNTA0NTZaMDwxGzAZBgNVBAMTEkNvbVNpZ24gU2VjdXJlZCBD
-QTEQMA4GA1UEChMHQ29tU2lnbjELMAkGA1UEBhMCSUwwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
-ggEKAoIBAQDGtWhfHZQVw6QIVS3joFd67+l0Kru5fFdJGhFeTymHDEjWaueP1H5XJLkGieQcPOqs
-49ohgHMhCu95mGwfCP+hUH3ymBvJVG8+pSjsIQQPRbsHPaHA+iqYHU4Gk/v1iDurX8sWv+bznkqH
-7Rnqwp9D5PGBpX8QTz7RSmKtUxvLg/8HZaWSLWapW7ha9B20IZFKF3ueMv5WJDmyVIRD9YTC2LxB
-kMyd1mja6YJQqTtoz7VdApRgFrFD2UNd3V2Hbuq7s8lr9gOUCXDeFhF6K+h2j0kQmHe5Y1yLM5d1
-9guMsqtb3nQgJT/j8xH5h2iGNXHDHYwt6+UarA9z1YJZQIDTAgMBAAGjgacwgaQwDAYDVR0TBAUw
-AwEB/zBEBgNVHR8EPTA7MDmgN6A1hjNodHRwOi8vZmVkaXIuY29tc2lnbi5jby5pbC9jcmwvQ29t
-U2lnblNlY3VyZWRDQS5jcmwwDgYDVR0PAQH/BAQDAgGGMB8GA1UdIwQYMBaAFMFL7XC29z58ADsA
-j8c+DkWfHl3sMB0GA1UdDgQWBBTBS+1wtvc+fAA7AI/HPg5Fnx5d7DANBgkqhkiG9w0BAQUFAAOC
-AQEAFs/ukhNQq3sUnjO2QiBq1BW9Cav8cujvR3qQrFHBZE7piL1DRYHjZiM/EoZNGeQFsOY3wo3a
-BijJD4mkU6l1P7CW+6tMM1X5eCZGbxs2mPtCdsGCuY7e+0X5YxtiOzkGynd6qDwJz2w2PQ8KRUtp
-FhpFfTMDZflScZAmlaxMDPWLkz/MdXSFmLr/YnpNH4n+rr2UAJm/EaXc4HnFFgt9AmEd6oX5AhVP
-51qJThRv4zdLhfXBPGHg/QVBspJ/wx2g0K5SZGBrGMYmnNj1ZOQ2GmKfig8+/21OGVZOIJFsnzQz
-OjRXUDpvgV4GxvU+fE6OK85lBi5d0ipTdF7Tbieejw==
------END CERTIFICATE-----
-
-Cybertrust Global Root
-======================
------BEGIN CERTIFICATE-----
-MIIDoTCCAomgAwIBAgILBAAAAAABD4WqLUgwDQYJKoZIhvcNAQEFBQAwOzEYMBYGA1UEChMPQ3li
-ZXJ0cnVzdCwgSW5jMR8wHQYDVQQDExZDeWJlcnRydXN0IEdsb2JhbCBSb290MB4XDTA2MTIxNTA4
-MDAwMFoXDTIxMTIxNTA4MDAwMFowOzEYMBYGA1UEChMPQ3liZXJ0cnVzdCwgSW5jMR8wHQYDVQQD
-ExZDeWJlcnRydXN0IEdsb2JhbCBSb290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
-+Mi8vRRQZhP/8NN57CPytxrHjoXxEnOmGaoQ25yiZXRadz5RfVb23CO21O1fWLE3TdVJDm71aofW
-0ozSJ8bi/zafmGWgE07GKmSb1ZASzxQG9Dvj1Ci+6A74q05IlG2OlTEQXO2iLb3VOm2yHLtgwEZL
-AfVJrn5GitB0jaEMAs7u/OePuGtm839EAL9mJRQr3RAwHQeWP032a7iPt3sMpTjr3kfb1V05/Iin
-89cqdPHoWqI7n1C6poxFNcJQZZXcY4Lv3b93TZxiyWNzFtApD0mpSPCzqrdsxacwOUBdrsTiXSZT
-8M4cIwhhqJQZugRiQOwfOHB3EgZxpzAYXSUnpQIDAQABo4GlMIGiMA4GA1UdDwEB/wQEAwIBBjAP
-BgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBS2CHsNesysIEyGVjJez6tuhS1wVzA/BgNVHR8EODA2
-MDSgMqAwhi5odHRwOi8vd3d3Mi5wdWJsaWMtdHJ1c3QuY29tL2NybC9jdC9jdHJvb3QuY3JsMB8G
-A1UdIwQYMBaAFLYIew16zKwgTIZWMl7Pq26FLXBXMA0GCSqGSIb3DQEBBQUAA4IBAQBW7wojoFRO
-lZfJ+InaRcHUowAl9B8Tq7ejhVhpwjCt2BWKLePJzYFa+HMjWqd8BfP9IjsO0QbE2zZMcwSO5bAi
-5MXzLqXZI+O4Tkogp24CJJ8iYGd7ix1yCcUxXOl5n4BHPa2hCwcUPUf/A2kaDAtE52Mlp3+yybh2
-hO0j9n0Hq0V+09+zv+mKts2oomcrUtW3ZfA5TGOgkXmTUg9U3YO7n9GPp1Nzw8v/MOx8BLjYRB+T
-X3EJIrduPuocA06dGiBh+4E37F78CkWr1+cXVdCg6mCbpvbjjFspwgZgFJ0tl0ypkxWdYcQBX0jW
-WL1WMRJOEcgh4LMRkWXbtKaIOM5V
------END CERTIFICATE-----
-
-ePKI Root Certification Authority
-=================================
------BEGIN CERTIFICATE-----
-MIIFsDCCA5igAwIBAgIQFci9ZUdcr7iXAF7kBtK8nTANBgkqhkiG9w0BAQUFADBeMQswCQYDVQQG
-EwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0ZC4xKjAoBgNVBAsMIWVQS0kg
-Um9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNDEyMjAwMjMxMjdaFw0zNDEyMjAwMjMx
-MjdaMF4xCzAJBgNVBAYTAlRXMSMwIQYDVQQKDBpDaHVuZ2h3YSBUZWxlY29tIENvLiwgTHRkLjEq
-MCgGA1UECwwhZVBLSSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0B
-AQEFAAOCAg8AMIICCgKCAgEA4SUP7o3biDN1Z82tH306Tm2d0y8U82N0ywEhajfqhFAHSyZbCUNs
-IZ5qyNUD9WBpj8zwIuQf5/dqIjG3LBXy4P4AakP/h2XGtRrBp0xtInAhijHyl3SJCRImHJ7K2RKi
-lTza6We/CKBk49ZCt0Xvl/T29de1ShUCWH2YWEtgvM3XDZoTM1PRYfl61dd4s5oz9wCGzh1NlDiv
-qOx4UXCKXBCDUSH3ET00hl7lSM2XgYI1TBnsZfZrxQWh7kcT1rMhJ5QQCtkkO7q+RBNGMD+XPNjX
-12ruOzjjK9SXDrkb5wdJfzcq+Xd4z1TtW0ado4AOkUPB1ltfFLqfpo0kR0BZv3I4sjZsN/+Z0V0O
-WQqraffAsgRFelQArr5T9rXn4fg8ozHSqf4hUmTFpmfwdQcGlBSBVcYn5AGPF8Fqcde+S/uUWH1+
-ETOxQvdibBjWzwloPn9s9h6PYq2lY9sJpx8iQkEeb5mKPtf5P0B6ebClAZLSnT0IFaUQAS2zMnao
-lQ2zepr7BxB4EW/hj8e6DyUadCrlHJhBmd8hh+iVBmoKs2pHdmX2Os+PYhcZewoozRrSgx4hxyy/
-vv9haLdnG7t4TY3OZ+XkwY63I2binZB1NJipNiuKmpS5nezMirH4JYlcWrYvjB9teSSnUmjDhDXi
-Zo1jDiVN1Rmy5nk3pyKdVDECAwEAAaNqMGgwHQYDVR0OBBYEFB4M97Zn8uGSJglFwFU5Lnc/Qkqi
-MAwGA1UdEwQFMAMBAf8wOQYEZyoHAAQxMC8wLQIBADAJBgUrDgMCGgUAMAcGBWcqAwAABBRFsMLH
-ClZ87lt4DJX5GFPBphzYEDANBgkqhkiG9w0BAQUFAAOCAgEACbODU1kBPpVJufGBuvl2ICO1J2B0
-1GqZNF5sAFPZn/KmsSQHRGoqxqWOeBLoR9lYGxMqXnmbnwoqZ6YlPwZpVnPDimZI+ymBV3QGypzq
-KOg4ZyYr8dW1P2WT+DZdjo2NQCCHGervJ8A9tDkPJXtoUHRVnAxZfVo9QZQlUgjgRywVMRnVvwdV
-xrsStZf0X4OFunHB2WyBEXYKCrC/gpf36j36+uwtqSiUO1bd0lEursC9CBWMd1I0ltabrNMdjmEP
-NXubrjlpC2JgQCA2j6/7Nu4tCEoduL+bXPjqpRugc6bY+G7gMwRfaKonh+3ZwZCc7b3jajWvY9+r
-GNm65ulK6lCKD2GTHuItGeIwlDWSXQ62B68ZgI9HkFFLLk3dheLSClIKF5r8GrBQAuUBo2M3IUxE
-xJtRmREOc5wGj1QupyheRDmHVi03vYVElOEMSyycw5KFNGHLD7ibSkNS/jQ6fbjpKdx2qcgw+BRx
-gMYeNkh0IkFch4LoGHGLQYlE535YW6i4jRPpp2zDR+2zGp1iro2C6pSe3VkQw63d4k3jMdXH7Ojy
-sP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTEW9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmOD
-BCEIZ43ygknQW/2xzQ+DhNQ+IIX3Sj0rnP0qCglN6oH4EZw=
------END CERTIFICATE-----
-
-T\xc3\x9c\x42\xC4\xB0TAK UEKAE K\xC3\xB6k Sertifika Hizmet Sa\xC4\x9Flay\xc4\xb1\x63\xc4\xb1s\xc4\xb1 - S\xC3\xBCr\xC3\xBCm 3
-=============================================================================================================================
------BEGIN CERTIFICATE-----
-MIIFFzCCA/+gAwIBAgIBETANBgkqhkiG9w0BAQUFADCCASsxCzAJBgNVBAYTAlRSMRgwFgYDVQQH
-DA9HZWJ6ZSAtIEtvY2FlbGkxRzBFBgNVBAoMPlTDvHJraXllIEJpbGltc2VsIHZlIFRla25vbG9q
-aWsgQXJhxZ90xLFybWEgS3VydW11IC0gVMOcQsSwVEFLMUgwRgYDVQQLDD9VbHVzYWwgRWxla3Ry
-b25payB2ZSBLcmlwdG9sb2ppIEFyYcWfdMSxcm1hIEVuc3RpdMO8c8O8IC0gVUVLQUUxIzAhBgNV
-BAsMGkthbXUgU2VydGlmaWthc3lvbiBNZXJrZXppMUowSAYDVQQDDEFUw5xCxLBUQUsgVUVLQUUg
-S8O2ayBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsSAtIFPDvHLDvG0gMzAeFw0wNzA4
-MjQxMTM3MDdaFw0xNzA4MjExMTM3MDdaMIIBKzELMAkGA1UEBhMCVFIxGDAWBgNVBAcMD0dlYnpl
-IC0gS29jYWVsaTFHMEUGA1UECgw+VMO8cmtpeWUgQmlsaW1zZWwgdmUgVGVrbm9sb2ppayBBcmHF
-n3TEsXJtYSBLdXJ1bXUgLSBUw5xCxLBUQUsxSDBGBgNVBAsMP1VsdXNhbCBFbGVrdHJvbmlrIHZl
-IEtyaXB0b2xvamkgQXJhxZ90xLFybWEgRW5zdGl0w7xzw7wgLSBVRUtBRTEjMCEGA1UECwwaS2Ft
-dSBTZXJ0aWZpa2FzeW9uIE1lcmtlemkxSjBIBgNVBAMMQVTDnELEsFRBSyBVRUtBRSBLw7ZrIFNl
-cnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxIC0gU8O8csO8bSAzMIIBIjANBgkqhkiG9w0B
-AQEFAAOCAQ8AMIIBCgKCAQEAim1L/xCIOsP2fpTo6iBkcK4hgb46ezzb8R1Sf1n68yJMlaCQvEhO
-Eav7t7WNeoMojCZG2E6VQIdhn8WebYGHV2yKO7Rm6sxA/OOqbLLLAdsyv9Lrhc+hDVXDWzhXcLh1
-xnnRFDDtG1hba+818qEhTsXOfJlfbLm4IpNQp81McGq+agV/E5wrHur+R84EpW+sky58K5+eeROR
-6Oqeyjh1jmKwlZMq5d/pXpduIF9fhHpEORlAHLpVK/swsoHvhOPc7Jg4OQOFCKlUAwUp8MmPi+oL
-hmUZEdPpCSPeaJMDyTYcIW7OjGbxmTDY17PDHfiBLqi9ggtm/oLL4eAagsNAgQIDAQABo0IwQDAd
-BgNVHQ4EFgQUvYiHyY/2pAoLquvF/pEjnatKijIwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF
-MAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAB18+kmPNOm3JpIWmgV050vQbTlswyb2zrgxvMTfvCr4
-N5EY3ATIZJkrGG2AA1nJrvhY0D7twyOfaTyGOBye79oneNGEN3GKPEs5z35FBtYt2IpNeBLWrcLT
-y9LQQfMmNkqblWwM7uXRQydmwYj3erMgbOqwaSvHIOgMA8RBBZniP+Rr+KCGgceExh/VS4ESshYh
-LBOhgLJeDEoTniDYYkCrkOpkSi+sDQESeUWoL4cZaMjihccwsnX5OD+ywJO0a+IDRM5noN+J1q2M
-dqMTw5RhK2vZbMEHCiIHhWyFJEapvj+LeISCfiQMnf2BN+MlqO02TpUsyZyQ2uypQjyttgI=
------END CERTIFICATE-----
-
-Buypass Class 2 CA 1
-====================
------BEGIN CERTIFICATE-----
-MIIDUzCCAjugAwIBAgIBATANBgkqhkiG9w0BAQUFADBLMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
-QnV5cGFzcyBBUy05ODMxNjMzMjcxHTAbBgNVBAMMFEJ1eXBhc3MgQ2xhc3MgMiBDQSAxMB4XDTA2
-MTAxMzEwMjUwOVoXDTE2MTAxMzEwMjUwOVowSzELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1eXBh
-c3MgQVMtOTgzMTYzMzI3MR0wGwYDVQQDDBRCdXlwYXNzIENsYXNzIDIgQ0EgMTCCASIwDQYJKoZI
-hvcNAQEBBQADggEPADCCAQoCggEBAIs8B0XY9t/mx8q6jUPFR42wWsE425KEHK8T1A9vNkYgxC7M
-cXA0ojTTNy7Y3Tp3L8DrKehc0rWpkTSHIln+zNvnma+WwajHQN2lFYxuyHyXA8vmIPLXl18xoS83
-0r7uvqmtqEyeIWZDO6i88wmjONVZJMHCR3axiFyCO7srpgTXjAePzdVBHfCuuCkslFJgNJQ72uA4
-0Z0zPhX0kzLFANq1KWYOOngPIVJfAuWSeyXTkh4vFZ2B5J2O6O+JzhRMVB0cgRJNcKi+EAUXfh/R
-uFdV7c27UsKwHnjCTTZoy1YmwVLBvXb3WNVyfh9EdrsAiR0WnVE1703CVu9r4Iw7DekCAwEAAaNC
-MEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUP42aWYv8e3uco684sDntkHGA1sgwDgYDVR0P
-AQH/BAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQAVGn4TirnoB6NLJzKyQJHyIdFkhb5jatLPgcIV
-1Xp+DCmsNx4cfHZSldq1fyOhKXdlyTKdqC5Wq2B2zha0jX94wNWZUYN/Xtm+DKhQ7SLHrQVMdvvt
-7h5HZPb3J31cKA9FxVxiXqaakZG3Uxcu3K1gnZZkOb1naLKuBctN518fV4bVIJwo+28TOPX2EZL2
-fZleHwzoq0QkKXJAPTZSr4xYkHPB7GEseaHsh7U/2k3ZIQAw3pDaDtMaSKk+hQsUi4y8QZ5q9w5w
-wDX3OaJdZtB7WZ+oRxKaJyOkLY4ng5IgodcVf/EuGO70SH8vf/GhGLWhC5SgYiAynB321O+/TIho
------END CERTIFICATE-----
-
-Buypass Class 3 CA 1
-====================
------BEGIN CERTIFICATE-----
-MIIDUzCCAjugAwIBAgIBAjANBgkqhkiG9w0BAQUFADBLMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
-QnV5cGFzcyBBUy05ODMxNjMzMjcxHTAbBgNVBAMMFEJ1eXBhc3MgQ2xhc3MgMyBDQSAxMB4XDTA1
-MDUwOTE0MTMwM1oXDTE1MDUwOTE0MTMwM1owSzELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1eXBh
-c3MgQVMtOTgzMTYzMzI3MR0wGwYDVQQDDBRCdXlwYXNzIENsYXNzIDMgQ0EgMTCCASIwDQYJKoZI
-hvcNAQEBBQADggEPADCCAQoCggEBAKSO13TZKWTeXx+HgJHqTjnmGcZEC4DVC69TB4sSveZn8AKx
-ifZgisRbsELRwCGoy+Gb72RRtqfPFfV0gGgEkKBYouZ0plNTVUhjP5JW3SROjvi6K//zNIqeKNc0
-n6wv1g/xpC+9UrJJhW05NfBEMJNGJPO251P7vGGvqaMU+8IXF4Rs4HyI+MkcVyzwPX6UvCWThOia
-AJpFBUJXgPROztmuOfbIUxAMZTpHe2DC1vqRycZxbL2RhzyRhkmr8w+gbCZ2Xhysm3HljbybIR6c
-1jh+JIAVMYKWsUnTYjdbiAwKYjT+p0h+mbEwi5A3lRyoH6UsjfRVyNvdWQrCrXig9IsCAwEAAaNC
-MEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUOBTmyPCppAP0Tj4io1vy1uCtQHQwDgYDVR0P
-AQH/BAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQABZ6OMySU9E2NdFm/soT4JXJEVKirZgCFPBdy7
-pYmrEzMqnji3jG8CcmPHc3ceCQa6Oyh7pEfJYWsICCD8igWKH7y6xsL+z27sEzNxZy5p+qksP2bA
-EllNC1QCkoS72xLvg3BweMhT+t/Gxv/ciC8HwEmdMldg0/L2mSlf56oBzKwzqBwKu5HEA6BvtjT5
-htOzdlSY9EqBs1OdTUDs5XcTRa9bqh/YL0yCe/4qxFi7T/ye/QNlGioOw6UgFpRreaaiErS7GqQj
-el/wroQk5PMr+4okoyeYZdowdXb8GZHo2+ubPzK/QJcHJrrM85SFSnonk8+QQtS4Wxam58tAA915
------END CERTIFICATE-----
-
-EBG Elektronik Sertifika Hizmet Sa\xC4\x9Flay\xc4\xb1\x63\xc4\xb1s\xc4\xb1
-==========================================================================
------BEGIN CERTIFICATE-----
-MIIF5zCCA8+gAwIBAgIITK9zQhyOdAIwDQYJKoZIhvcNAQEFBQAwgYAxODA2BgNVBAMML0VCRyBF
-bGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMTcwNQYDVQQKDC5FQkcg
-QmlsacWfaW0gVGVrbm9sb2ppbGVyaSB2ZSBIaXptZXRsZXJpIEEuxZ4uMQswCQYDVQQGEwJUUjAe
-Fw0wNjA4MTcwMDIxMDlaFw0xNjA4MTQwMDMxMDlaMIGAMTgwNgYDVQQDDC9FQkcgRWxla3Ryb25p
-ayBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsTE3MDUGA1UECgwuRUJHIEJpbGnFn2lt
-IFRla25vbG9qaWxlcmkgdmUgSGl6bWV0bGVyaSBBLsWeLjELMAkGA1UEBhMCVFIwggIiMA0GCSqG
-SIb3DQEBAQUAA4ICDwAwggIKAoICAQDuoIRh0DpqZhAy2DE4f6en5f2h4fuXd7hxlugTlkaDT7by
-X3JWbhNgpQGR4lvFzVcfd2NR/y8927k/qqk153nQ9dAktiHq6yOU/im/+4mRDGSaBUorzAzu8T2b
-gmmkTPiab+ci2hC6X5L8GCcKqKpE+i4stPtGmggDg3KriORqcsnlZR9uKg+ds+g75AxuetpX/dfr
-eYteIAbTdgtsApWjluTLdlHRKJ2hGvxEok3MenaoDT2/F08iiFD9rrbskFBKW5+VQarKD7JK/oCZ
-TqNGFav4c0JqwmZ2sQomFd2TkuzbqV9UIlKRcF0T6kjsbgNs2d1s/OsNA/+mgxKb8amTD8UmTDGy
-Y5lhcucqZJnSuOl14nypqZoaqsNW2xCaPINStnuWt6yHd6i58mcLlEOzrz5z+kI2sSXFCjEmN1Zn
-uqMLfdb3ic1nobc6HmZP9qBVFCVMLDMNpkGMvQQxahByCp0OLna9XvNRiYuoP1Vzv9s6xiQFlpJI
-qkuNKgPlV5EQ9GooFW5Hd4RcUXSfGenmHmMWOeMRFeNYGkS9y8RsZteEBt8w9DeiQyJ50hBs37vm
-ExH8nYQKE3vwO9D8owrXieqWfo1IhR5kX9tUoqzVegJ5a9KK8GfaZXINFHDk6Y54jzJ0fFfy1tb0
-Nokb+Clsi7n2l9GkLqq+CxnCRelwXQIDAJ3Zo2MwYTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB
-/wQEAwIBBjAdBgNVHQ4EFgQU587GT/wWZ5b6SqMHwQSny2re2kcwHwYDVR0jBBgwFoAU587GT/wW
-Z5b6SqMHwQSny2re2kcwDQYJKoZIhvcNAQEFBQADggIBAJuYml2+8ygjdsZs93/mQJ7ANtyVDR2t
-FcU22NU57/IeIl6zgrRdu0waypIN30ckHrMk2pGI6YNw3ZPX6bqz3xZaPt7gyPvT/Wwp+BVGoGgm
-zJNSroIBk5DKd8pNSe/iWtkqvTDOTLKBtjDOWU/aWR1qeqRFsIImgYZ29fUQALjuswnoT4cCB64k
-XPBfrAowzIpAoHMEwfuJJPaaHFy3PApnNgUIMbOv2AFoKuB4j3TeuFGkjGwgPaL7s9QJ/XvCgKqT
-bCmYIai7FvOpEl90tYeY8pUm3zTvilORiF0alKM/fCL414i6poyWqD1SNGKfAB5UVUJnxk1Gj7sU
-RT0KlhaOEKGXmdXTMIXM3rRyt7yKPBgpaP3ccQfuJDlq+u2lrDgv+R4QDgZxGhBM/nV+/x5XOULK
-1+EVoVZVWRvRo68R2E7DpSvvkL/A7IITW43WciyTTo9qKd+FPNMN4KIYEsxVL0e3p5sC/kH2iExt
-2qkBR4NkJ2IQgtYSe14DHzSpyZH+r11thie3I6p1GMog57AP14kOpmciY/SDQSsGS7tY1dHXt7kQ
-Y9iJSrSq3RZj9W6+YKH47ejWkE8axsWgKdOnIaj1Wjz3x0miIZpKlVIglnKaZsv30oZDfCK+lvm9
-AahH3eU7QPl1K5srRmSGjR70j/sHd9DqSaIcjVIUpgqT
------END CERTIFICATE-----
-
-certSIGN ROOT CA
-================
------BEGIN CERTIFICATE-----
-MIIDODCCAiCgAwIBAgIGIAYFFnACMA0GCSqGSIb3DQEBBQUAMDsxCzAJBgNVBAYTAlJPMREwDwYD
-VQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBDQTAeFw0wNjA3MDQxNzIwMDRa
-Fw0zMTA3MDQxNzIwMDRaMDsxCzAJBgNVBAYTAlJPMREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UE
-CxMQY2VydFNJR04gUk9PVCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALczuX7I
-JUqOtdu0KBuqV5Do0SLTZLrTk+jUrIZhQGpgV2hUhE28alQCBf/fm5oqrl0Hj0rDKH/v+yv6efHH
-rfAQUySQi2bJqIirr1qjAOm+ukbuW3N7LBeCgV5iLKECZbO9xSsAfsT8AzNXDe3i+s5dRdY4zTW2
-ssHQnIFKquSyAVwdj1+ZxLGt24gh65AIgoDzMKND5pCCrlUoSe1b16kQOA7+j0xbm0bqQfWwCHTD
-0IgztnzXdN/chNFDDnU5oSVAKOp4yw4sLjmdjItuFhwvJoIQ4uNllAoEwF73XVv4EOLQunpL+943
-AAAaWyjj0pxzPjKHmKHJUS/X3qwzs08CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8B
-Af8EBAMCAcYwHQYDVR0OBBYEFOCMm9slSbPxfIbWskKHC9BroNnkMA0GCSqGSIb3DQEBBQUAA4IB
-AQA+0hyJLjX8+HXd5n9liPRyTMks1zJO890ZeUe9jjtbkw9QSSQTaxQGcu8J06Gh40CEyecYMnQ8
-SG4Pn0vU9x7Tk4ZkVJdjclDVVc/6IJMCopvDI5NOFlV2oHB5bc0hH88vLbwZ44gx+FkagQnIl6Z0
-x2DEW8xXjrJ1/RsCCdtZb3KTafcxQdaIOL+Hsr0Wefmq5L6IJd1hJyMctTEHBDa0GpC9oHRxUIlt
-vBTjD4au8as+x6AJzKNI0eDbZOeStc+vckNwi/nDhDwTqn6Sm1dTk/pwwpEOMfmbZ13pljheX7Nz
-TogVZ96edhBiIL5VaZVDADlN9u6wWk5JRFRYX0KD
------END CERTIFICATE-----
-
-CNNIC ROOT
-==========
------BEGIN CERTIFICATE-----
-MIIDVTCCAj2gAwIBAgIESTMAATANBgkqhkiG9w0BAQUFADAyMQswCQYDVQQGEwJDTjEOMAwGA1UE
-ChMFQ05OSUMxEzARBgNVBAMTCkNOTklDIFJPT1QwHhcNMDcwNDE2MDcwOTE0WhcNMjcwNDE2MDcw
-OTE0WjAyMQswCQYDVQQGEwJDTjEOMAwGA1UEChMFQ05OSUMxEzARBgNVBAMTCkNOTklDIFJPT1Qw
-ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDTNfc/c3et6FtzF8LRb+1VvG7q6KR5smzD
-o+/hn7E7SIX1mlwhIhAsxYLO2uOabjfhhyzcuQxauohV3/2q2x8x6gHx3zkBwRP9SFIhxFXf2tiz
-VHa6dLG3fdfA6PZZxU3Iva0fFNrfWEQlMhkqx35+jq44sDB7R3IJMfAw28Mbdim7aXZOV/kbZKKT
-VrdvmW7bCgScEeOAH8tjlBAKqeFkgjH5jCftppkA9nCTGPihNIaj3XrCGHn2emU1z5DrvTOTn1Or
-czvmmzQgLx3vqR1jGqCA2wMv+SYahtKNu6m+UjqHZ0gNv7Sg2Ca+I19zN38m5pIEo3/PIKe38zrK
-y5nLAgMBAAGjczBxMBEGCWCGSAGG+EIBAQQEAwIABzAfBgNVHSMEGDAWgBRl8jGtKvf33VKWCscC
-wQ7vptU7ETAPBgNVHRMBAf8EBTADAQH/MAsGA1UdDwQEAwIB/jAdBgNVHQ4EFgQUZfIxrSr3991S
-lgrHAsEO76bVOxEwDQYJKoZIhvcNAQEFBQADggEBAEs17szkrr/Dbq2flTtLP1se31cpolnKOOK5
-Gv+e5m4y3R6u6jW39ZORTtpC4cMXYFDy0VwmuYK36m3knITnA3kXr5g9lNvHugDnuL8BV8F3RTIM
-O/G0HAiw/VGgod2aHRM2mm23xzy54cXZF/qD1T0VoDy7HgviyJA/qIYM/PmLXoXLT1tLYhFHxUV8
-BS9BsZ4QaRuZluBVeftOhpm4lNqGOGqTo+fLbuXf6iFViZx9fX+Y9QCJ7uOEwFyWtcVG6kbghVW2
-G8kS1sHNzYDzAgE8yGnLRUhj2JTQ7IUOO04RZfSCjKY9ri4ilAnIXOo8gV0WKgOXFlUJ24pBgp5m
-mxE=
------END CERTIFICATE-----
-
-ApplicationCA - Japanese Government
-===================================
------BEGIN CERTIFICATE-----
-MIIDoDCCAoigAwIBAgIBMTANBgkqhkiG9w0BAQUFADBDMQswCQYDVQQGEwJKUDEcMBoGA1UEChMT
-SmFwYW5lc2UgR292ZXJubWVudDEWMBQGA1UECxMNQXBwbGljYXRpb25DQTAeFw0wNzEyMTIxNTAw
-MDBaFw0xNzEyMTIxNTAwMDBaMEMxCzAJBgNVBAYTAkpQMRwwGgYDVQQKExNKYXBhbmVzZSBHb3Zl
-cm5tZW50MRYwFAYDVQQLEw1BcHBsaWNhdGlvbkNBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
-CgKCAQEAp23gdE6Hj6UG3mii24aZS2QNcfAKBZuOquHMLtJqO8F6tJdhjYq+xpqcBrSGUeQ3DnR4
-fl+Kf5Sk10cI/VBaVuRorChzoHvpfxiSQE8tnfWuREhzNgaeZCw7NCPbXCbkcXmP1G55IrmTwcrN
-wVbtiGrXoDkhBFcsovW8R0FPXjQilbUfKW1eSvNNcr5BViCH/OlQR9cwFO5cjFW6WY2H/CPek9AE
-jP3vbb3QesmlOmpyM8ZKDQUXKi17safY1vC+9D/qDihtQWEjdnjDuGWk81quzMKq2edY3rZ+nYVu
-nyoKb58DKTCXKB28t89UKU5RMfkntigm/qJj5kEW8DOYRwIDAQABo4GeMIGbMB0GA1UdDgQWBBRU
-WssmP3HMlEYNllPqa0jQk/5CdTAOBgNVHQ8BAf8EBAMCAQYwWQYDVR0RBFIwUKROMEwxCzAJBgNV
-BAYTAkpQMRgwFgYDVQQKDA/ml6XmnKzlm73mlL/lupwxIzAhBgNVBAsMGuOCouODl+ODquOCseOD
-vOOCt+ODp+ODs0NBMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADlqRHZ3ODrs
-o2dGD/mLBqj7apAxzn7s2tGJfHrrLgy9mTLnsCTWw//1sogJhyzjVOGjprIIC8CFqMjSnHH2HZ9g
-/DgzE+Ge3Atf2hZQKXsvcJEPmbo0NI2VdMV+eKlmXb3KIXdCEKxmJj3ekav9FfBv7WxfEPjzFvYD
-io+nEhEMy/0/ecGc/WLuo89UDNErXxc+4z6/wCs+CZv+iKZ+tJIX/COUgb1up8WMwusRRdv4QcmW
-dupwX3kSa+SjB1oF7ydJzyGfikwJcGapJsErEU4z0g781mzSDjJkaP+tBXhfAx2o45CsJOAPQKdL
-rosot4LKGAfmt1t06SAZf7IbiVQ=
------END CERTIFICATE-----
-
-GeoTrust Primary Certification Authority - G3
-=============================================
------BEGIN CERTIFICATE-----
-MIID/jCCAuagAwIBAgIQFaxulBmyeUtB9iepwxgPHzANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UE
-BhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA4IEdlb1RydXN0
-IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFy
-eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEczMB4XDTA4MDQwMjAwMDAwMFoXDTM3MTIwMTIz
-NTk1OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAo
-YykgMjAwOCBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMT
-LUdlb1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZI
-hvcNAQEBBQADggEPADCCAQoCggEBANziXmJYHTNXOTIz+uvLh4yn1ErdBojqZI4xmKU4kB6Yzy5j
-K/BGvESyiaHAKAxJcCGVn2TAppMSAmUmhsalifD614SgcK9PGpc/BkTVyetyEH3kMSj7HGHmKAdE
-c5IiaacDiGydY8hS2pgn5whMcD60yRLBxWeDXTPzAxHsatBT4tG6NmCUgLthY2xbF37fQJQeqw3C
-IShwiP/WJmxsYAQlTlV+fe+/lEjetx3dcI0FX4ilm/LC7urRQEFtYjgdVgbFA0dRIBn8exALDmKu
-dlW/X3e+PkkBUz2YJQN2JFodtNuJ6nnltrM7P7pMKEF/BqxqjsHQ9gUdfeZChuOl1UcCAwEAAaNC
-MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMR5yo6hTgMdHNxr
-2zFblD4/MH8tMA0GCSqGSIb3DQEBCwUAA4IBAQAtxRPPVoB7eni9n64smefv2t+UXglpp+duaIy9
-cr5HqQ6XErhK8WTTOd8lNNTBzU6B8A8ExCSzNJbGpqow32hhc9f5joWJ7w5elShKKiePEI4ufIbE
-Ap7aDHdlDkQNkv39sxY2+hENHYwOB4lqKVb3cvTdFZx3NWZXqxNT2I7BQMXXExZacse3aQHEerGD
-AWh9jUGhlBjBJVz88P6DAod8DQ3PLghcSkANPuyBYeYk28rgDi0Hsj5W3I31QYUHSJsMC8tJP33s
-t/3LjWeJGqvtux6jAAgIFyqCXDFdRootD4abdNlF+9RAsXqqaC2Gspki4cErx5z481+oghLrGREt
------END CERTIFICATE-----
-
-thawte Primary Root CA - G2
-===========================
------BEGIN CERTIFICATE-----
-MIICiDCCAg2gAwIBAgIQNfwmXNmET8k9Jj1Xm67XVjAKBggqhkjOPQQDAzCBhDELMAkGA1UEBhMC
-VVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjE4MDYGA1UECxMvKGMpIDIwMDcgdGhhd3RlLCBJbmMu
-IC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3Qg
-Q0EgLSBHMjAeFw0wNzExMDUwMDAwMDBaFw0zODAxMTgyMzU5NTlaMIGEMQswCQYDVQQGEwJVUzEV
-MBMGA1UEChMMdGhhd3RlLCBJbmMuMTgwNgYDVQQLEy8oYykgMjAwNyB0aGF3dGUsIEluYy4gLSBG
-b3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIGA1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAt
-IEcyMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEotWcgnuVnfFSeIf+iha/BebfowJPDQfGAFG6DAJS
-LSKkQjnE/o/qycG+1E3/n3qe4rF8mq2nhglzh9HnmuN6papu+7qzcMBniKI11KOasf2twu8x+qi5
-8/sIxpHR+ymVo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU
-mtgAMADna3+FGO6Lts6KDPgR4bswCgYIKoZIzj0EAwMDaQAwZgIxAN344FdHW6fmCsO99YCKlzUN
-G4k8VIZ3KMqh9HneteY4sPBlcIx/AlTCv//YoT7ZzwIxAMSNlPzcU9LcnXgWHxUzI1NS41oxXZ3K
-rr0TKUQNJ1uo52icEvdYPy5yAlejj6EULg==
------END CERTIFICATE-----
-
-thawte Primary Root CA - G3
-===========================
------BEGIN CERTIFICATE-----
-MIIEKjCCAxKgAwIBAgIQYAGXt0an6rS0mtZLL/eQ+zANBgkqhkiG9w0BAQsFADCBrjELMAkGA1UE
-BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
-aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDggdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
-cml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EgLSBHMzAeFw0w
-ODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIGuMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMdGhh
-d3RlLCBJbmMuMSgwJgYDVQQLEx9DZXJ0aWZpY2F0aW9uIFNlcnZpY2VzIERpdmlzaW9uMTgwNgYD
-VQQLEy8oYykgMjAwOCB0aGF3dGUsIEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIG
-A1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAtIEczMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
-MIIBCgKCAQEAsr8nLPvb2FvdeHsbnndmgcs+vHyu86YnmjSjaDFxODNi5PNxZnmxqWWjpYvVj2At
-P0LMqmsywCPLLEHd5N/8YZzic7IilRFDGF/Eth9XbAoFWCLINkw6fKXRz4aviKdEAhN0cXMKQlkC
-+BsUa0Lfb1+6a4KinVvnSr0eAXLbS3ToO39/fR8EtCab4LRarEc9VbjXsCZSKAExQGbY2SS99irY
-7CFJXJv2eul/VTV+lmuNk5Mny5K76qxAwJ/C+IDPXfRa3M50hqY+bAtTyr2SzhkGcuYMXDhpxwTW
-vGzOW/b3aJzcJRVIiKHpqfiYnODz1TEoYRFsZ5aNOZnLwkUkOQIDAQABo0IwQDAPBgNVHRMBAf8E
-BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUrWyqlGCc7eT/+j4KdCtjA/e2Wb8wDQYJ
-KoZIhvcNAQELBQADggEBABpA2JVlrAmSicY59BDlqQ5mU1143vokkbvnRFHfxhY0Cu9qRFHqKweK
-A3rD6z8KLFIWoCtDuSWQP3CpMyVtRRooOyfPqsMpQhvfO0zAMzRbQYi/aytlryjvsvXDqmbOe1bu
-t8jLZ8HJnBoYuMTDSQPxYA5QzUbF83d597YV4Djbxy8ooAw/dyZ02SUS2jHaGh7cKUGRIjxpp7sC
-8rZcJwOJ9Abqm+RyguOhCcHpABnTPtRwa7pxpqpYrvS76Wy274fMm7v/OeZWYdMKp8RcTGB7BXcm
-er/YB1IsYvdwY9k5vG8cwnncdimvzsUsZAReiDZuMdRAGmI0Nj81Aa6sY6A=
------END CERTIFICATE-----
-
-GeoTrust Primary Certification Authority - G2
-=============================================
------BEGIN CERTIFICATE-----
-MIICrjCCAjWgAwIBAgIQPLL0SAoA4v7rJDteYD7DazAKBggqhkjOPQQDAzCBmDELMAkGA1UEBhMC
-VVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA3IEdlb1RydXN0IElu
-Yy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFyeSBD
-ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMB4XDTA3MTEwNTAwMDAwMFoXDTM4MDExODIzNTk1
-OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAoYykg
-MjAwNyBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMTLUdl
-b1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMjB2MBAGByqGSM49AgEG
-BSuBBAAiA2IABBWx6P0DFUPlrOuHNxFi79KDNlJ9RVcLSo17VDs6bl8VAsBQps8lL33KSLjHUGMc
-KiEIfJo22Av+0SbFWDEwKCXzXV2juLaltJLtbCyf691DiaI8S0iRHVDsJt/WYC69IaNCMEAwDwYD
-VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBVfNVdRVfslsq0DafwBo/q+
-EVXVMAoGCCqGSM49BAMDA2cAMGQCMGSWWaboCd6LuvpaiIjwH5HTRqjySkwCY/tsXzjbLkGTqQ7m
-ndwxHLKgpxgceeHHNgIwOlavmnRs9vuD4DPTCF+hnMJbn0bWtsuRBmOiBuczrD6ogRLQy7rQkgu2
-npaqBA+K
------END CERTIFICATE-----
-
-VeriSign Universal Root Certification Authority
-===============================================
------BEGIN CERTIFICATE-----
-MIIEuTCCA6GgAwIBAgIQQBrEZCGzEyEDDrvkEhrFHTANBgkqhkiG9w0BAQsFADCBvTELMAkGA1UE
-BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
-ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwOCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
-IHVzZSBvbmx5MTgwNgYDVQQDEy9WZXJpU2lnbiBVbml2ZXJzYWwgUm9vdCBDZXJ0aWZpY2F0aW9u
-IEF1dGhvcml0eTAeFw0wODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIG9MQswCQYDVQQGEwJV
-UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
-cmsxOjA4BgNVBAsTMShjKSAyMDA4IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
-IG9ubHkxODA2BgNVBAMTL1ZlcmlTaWduIFVuaXZlcnNhbCBSb290IENlcnRpZmljYXRpb24gQXV0
-aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx2E3XrEBNNti1xWb/1hajCMj
-1mCOkdeQmIN65lgZOIzF9uVkhbSicfvtvbnazU0AtMgtc6XHaXGVHzk8skQHnOgO+k1KxCHfKWGP
-MiJhgsWHH26MfF8WIFFE0XBPV+rjHOPMee5Y2A7Cs0WTwCznmhcrewA3ekEzeOEz4vMQGn+HLL72
-9fdC4uW/h2KJXwBL38Xd5HVEMkE6HnFuacsLdUYI0crSK5XQz/u5QGtkjFdN/BMReYTtXlT2NJ8I
-AfMQJQYXStrxHXpma5hgZqTZ79IugvHw7wnqRMkVauIDbjPTrJ9VAMf2CGqUuV/c4DPxhGD5WycR
-tPwW8rtWaoAljQIDAQABo4GyMIGvMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMG0G
-CCsGAQUFBwEMBGEwX6FdoFswWTBXMFUWCWltYWdlL2dpZjAhMB8wBwYFKw4DAhoEFI/l0xqGrI2O
-a8PPgGrUSBgsexkuMCUWI2h0dHA6Ly9sb2dvLnZlcmlzaWduLmNvbS92c2xvZ28uZ2lmMB0GA1Ud
-DgQWBBS2d/ppSEefUxLVwuoHMnYH0ZcHGTANBgkqhkiG9w0BAQsFAAOCAQEASvj4sAPmLGd75JR3
-Y8xuTPl9Dg3cyLk1uXBPY/ok+myDjEedO2Pzmvl2MpWRsXe8rJq+seQxIcaBlVZaDrHC1LGmWazx
-Y8u4TB1ZkErvkBYoH1quEPuBUDgMbMzxPcP1Y+Oz4yHJJDnp/RVmRvQbEdBNc6N9Rvk97ahfYtTx
-P/jgdFcrGJ2BtMQo2pSXpXDrrB2+BxHw1dvd5Yzw1TKwg+ZX4o+/vqGqvz0dtdQ46tewXDpPaj+P
-wGZsY6rp2aQW9IHRlRQOfc2VNNnSj3BzgXucfr2YYdhFh5iQxeuGMMY1v/D/w1WIg0vvBZIGcfK4
-mJO37M2CYfE45k+XmCpajQ==
------END CERTIFICATE-----
-
-VeriSign Class 3 Public Primary Certification Authority - G4
-============================================================
------BEGIN CERTIFICATE-----
-MIIDhDCCAwqgAwIBAgIQL4D+I4wOIg9IZxIokYesszAKBggqhkjOPQQDAzCByjELMAkGA1UEBhMC
-VVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3
-b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVz
-ZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmlj
-YXRpb24gQXV0aG9yaXR5IC0gRzQwHhcNMDcxMTA1MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCByjEL
-MAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBU
-cnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRo
-b3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5
-IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzQwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASnVnp8
-Utpkmw4tXNherJI9/gHmGUo9FANL+mAnINmDiWn6VMaaGF5VKmTeBvaNSjutEDxlPZCIBIngMGGz
-rl0Bp3vefLK+ymVhAIau2o970ImtTR1ZmkGxvEeA3J5iw/mjgbIwga8wDwYDVR0TAQH/BAUwAwEB
-/zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2UvZ2lmMCEw
-HzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVyaXNpZ24u
-Y29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFLMWkf3upm7ktS5Jj4d4gYDs5bG1MAoGCCqGSM49BAMD
-A2gAMGUCMGYhDBgmYFo4e1ZC4Kf8NoRRkSAsdk1DPcQdhCPQrNZ8NQbOzWm9kA3bbEhCHQ6qQgIx
-AJw9SDkjOVgaFRJZap7v1VmyHVIsmXHNxynfGyphe3HR3vPA5Q06Sqotp9iGKt0uEA==
------END CERTIFICATE-----
-
-NetLock Arany (Class Gold) Főtanúsítvány
-============================================
------BEGIN CERTIFICATE-----
-MIIEFTCCAv2gAwIBAgIGSUEs5AAQMA0GCSqGSIb3DQEBCwUAMIGnMQswCQYDVQQGEwJIVTERMA8G
-A1UEBwwIQnVkYXBlc3QxFTATBgNVBAoMDE5ldExvY2sgS2Z0LjE3MDUGA1UECwwuVGFuw7pzw610
-dsOhbnlraWFkw7NrIChDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzKTE1MDMGA1UEAwwsTmV0TG9jayBB
-cmFueSAoQ2xhc3MgR29sZCkgRsWRdGFuw7pzw610dsOhbnkwHhcNMDgxMjExMTUwODIxWhcNMjgx
-MjA2MTUwODIxWjCBpzELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MRUwEwYDVQQKDAxO
-ZXRMb2NrIEtmdC4xNzA1BgNVBAsMLlRhbsO6c8OtdHbDoW55a2lhZMOzayAoQ2VydGlmaWNhdGlv
-biBTZXJ2aWNlcykxNTAzBgNVBAMMLE5ldExvY2sgQXJhbnkgKENsYXNzIEdvbGQpIEbFkXRhbsO6
-c8OtdHbDoW55MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxCRec75LbRTDofTjl5Bu
-0jBFHjzuZ9lk4BqKf8owyoPjIMHj9DrTlF8afFttvzBPhCf2nx9JvMaZCpDyD/V/Q4Q3Y1GLeqVw
-/HpYzY6b7cNGbIRwXdrzAZAj/E4wqX7hJ2Pn7WQ8oLjJM2P+FpD/sLj916jAwJRDC7bVWaaeVtAk
-H3B5r9s5VA1lddkVQZQBr17s9o3x/61k/iCa11zr/qYfCGSji3ZVrR47KGAuhyXoqq8fxmRGILdw
-fzzeSNuWU7c5d+Qa4scWhHaXWy+7GRWF+GmF9ZmnqfI0p6m2pgP8b4Y9VHx2BJtr+UBdADTHLpl1
-neWIA6pN+APSQnbAGwIDAKiLo0UwQzASBgNVHRMBAf8ECDAGAQH/AgEEMA4GA1UdDwEB/wQEAwIB
-BjAdBgNVHQ4EFgQUzPpnk/C2uNClwB7zU/2MU9+D15YwDQYJKoZIhvcNAQELBQADggEBAKt/7hwW
-qZw8UQCgwBEIBaeZ5m8BiFRhbvG5GK1Krf6BQCOUL/t1fC8oS2IkgYIL9WHxHG64YTjrgfpioTta
-YtOUZcTh5m2C+C8lcLIhJsFyUR+MLMOEkMNaj7rP9KdlpeuY0fsFskZ1FSNqb4VjMIDw1Z4fKRzC
-bLBQWV2QWzuoDTDPv31/zvGdg73JRm4gpvlhUbohL3u+pRVjodSVh/GeufOJ8z2FuLjbvrW5Kfna
-NwUASZQDhETnv0Mxz3WLJdH0pmT1kvarBes96aULNmLazAZfNou2XjG4Kvte9nHfRCaexOYNkbQu
-dZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E=
------END CERTIFICATE-----
-
-Staat der Nederlanden Root CA - G2
-==================================
------BEGIN CERTIFICATE-----
-MIIFyjCCA7KgAwIBAgIEAJiWjDANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE
-CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
-Um9vdCBDQSAtIEcyMB4XDTA4MDMyNjExMTgxN1oXDTIwMDMyNTExMDMxMFowWjELMAkGA1UEBhMC
-TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l
-ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMVZ
-5291qj5LnLW4rJ4L5PnZyqtdj7U5EILXr1HgO+EASGrP2uEGQxGZqhQlEq0i6ABtQ8SpuOUfiUtn
-vWFI7/3S4GCI5bkYYCjDdyutsDeqN95kWSpGV+RLufg3fNU254DBtvPUZ5uW6M7XxgpT0GtJlvOj
-CwV3SPcl5XCsMBQgJeN/dVrlSPhOewMHBPqCYYdu8DvEpMfQ9XQ+pV0aCPKbJdL2rAQmPlU6Yiil
-e7Iwr/g3wtG61jj99O9JMDeZJiFIhQGp5Rbn3JBV3w/oOM2ZNyFPXfUib2rFEhZgF1XyZWampzCR
-OME4HYYEhLoaJXhena/MUGDWE4dS7WMfbWV9whUYdMrhfmQpjHLYFhN9C0lK8SgbIHRrxT3dsKpI
-CT0ugpTNGmXZK4iambwYfp/ufWZ8Pr2UuIHOzZgweMFvZ9C+X+Bo7d7iscksWXiSqt8rYGPy5V65
-48r6f1CGPqI0GAwJaCgRHOThuVw+R7oyPxjMW4T182t0xHJ04eOLoEq9jWYv6q012iDTiIJh8BIi
-trzQ1aTsr1SIJSQ8p22xcik/Plemf1WvbibG/ufMQFxRRIEKeN5KzlW/HdXZt1bv8Hb/C3m1r737
-qWmRRpdogBQ2HbN/uymYNqUg+oJgYjOk7Na6B6duxc8UpufWkjTYgfX8HV2qXB72o007uPc5AgMB
-AAGjgZcwgZQwDwYDVR0TAQH/BAUwAwEB/zBSBgNVHSAESzBJMEcGBFUdIAAwPzA9BggrBgEFBQcC
-ARYxaHR0cDovL3d3dy5wa2lvdmVyaGVpZC5ubC9wb2xpY2llcy9yb290LXBvbGljeS1HMjAOBgNV
-HQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJFoMocVHYnitfGsNig0jQt8YojrMA0GCSqGSIb3DQEBCwUA
-A4ICAQCoQUpnKpKBglBu4dfYszk78wIVCVBR7y29JHuIhjv5tLySCZa59sCrI2AGeYwRTlHSeYAz
-+51IvuxBQ4EffkdAHOV6CMqqi3WtFMTC6GY8ggen5ieCWxjmD27ZUD6KQhgpxrRW/FYQoAUXvQwj
-f/ST7ZwaUb7dRUG/kSS0H4zpX897IZmflZ85OkYcbPnNe5yQzSipx6lVu6xiNGI1E0sUOlWDuYaN
-kqbG9AclVMwWVxJKgnjIFNkXgiYtXSAfea7+1HAWFpWD2DU5/1JddRwWxRNVz0fMdWVSSt7wsKfk
-CpYL+63C4iWEst3kvX5ZbJvw8NjnyvLplzh+ib7M+zkXYT9y2zqR2GUBGR2tUKRXCnxLvJxxcypF
-URmFzI79R6d0lR2o0a9OF7FpJsKqeFdbxU2n5Z4FF5TKsl+gSRiNNOkmbEgeqmiSBeGCc1qb3Adb
-CG19ndeNIdn8FCCqwkXfP+cAslHkwvgFuXkajDTznlvkN1trSt8sV4pAWja63XVECDdCcAz+3F4h
-oKOKwJCcaNpQ5kUQR3i2TtJlycM33+FCY7BXN0Ute4qcvwXqZVUz9zkQxSgqIXobisQk+T8VyJoV
-IPVVYpbtbZNQvOSqeK3Zywplh6ZmwcSBo3c6WB4L7oOLnR7SUqTMHW+wmG2UMbX4cQrcufx9MmDm
-66+KAQ==
------END CERTIFICATE-----
-
-CA Disig
-========
------BEGIN CERTIFICATE-----
-MIIEDzCCAvegAwIBAgIBATANBgkqhkiG9w0BAQUFADBKMQswCQYDVQQGEwJTSzETMBEGA1UEBxMK
-QnJhdGlzbGF2YTETMBEGA1UEChMKRGlzaWcgYS5zLjERMA8GA1UEAxMIQ0EgRGlzaWcwHhcNMDYw
-MzIyMDEzOTM0WhcNMTYwMzIyMDEzOTM0WjBKMQswCQYDVQQGEwJTSzETMBEGA1UEBxMKQnJhdGlz
-bGF2YTETMBEGA1UEChMKRGlzaWcgYS5zLjERMA8GA1UEAxMIQ0EgRGlzaWcwggEiMA0GCSqGSIb3
-DQEBAQUAA4IBDwAwggEKAoIBAQCS9jHBfYj9mQGp2HvycXXxMcbzdWb6UShGhJd4NLxs/LxFWYgm
-GErENx+hSkS943EE9UQX4j/8SFhvXJ56CbpRNyIjZkMhsDxkovhqFQ4/61HhVKndBpnXmjxUizkD
-Pw/Fzsbrg3ICqB9x8y34dQjbYkzo+s7552oftms1grrijxaSfQUMbEYDXcDtab86wYqg6I7ZuUUo
-hwjstMoVvoLdtUSLLa2GDGhibYVW8qwUYzrG0ZmsNHhWS8+2rT+MitcE5eN4TPWGqvWP+j1scaMt
-ymfraHtuM6kMgiioTGohQBUgDCZbg8KpFhXAJIJdKxatymP2dACw30PEEGBWZ2NFAgMBAAGjgf8w
-gfwwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUjbJJaJ1yCCW5wCf1UJNWSEZx+Y8wDgYDVR0P
-AQH/BAQDAgEGMDYGA1UdEQQvMC2BE2Nhb3BlcmF0b3JAZGlzaWcuc2uGFmh0dHA6Ly93d3cuZGlz
-aWcuc2svY2EwZgYDVR0fBF8wXTAtoCugKYYnaHR0cDovL3d3dy5kaXNpZy5zay9jYS9jcmwvY2Ff
-ZGlzaWcuY3JsMCygKqAohiZodHRwOi8vY2EuZGlzaWcuc2svY2EvY3JsL2NhX2Rpc2lnLmNybDAa
-BgNVHSAEEzARMA8GDSuBHpGT5goAAAABAQEwDQYJKoZIhvcNAQEFBQADggEBAF00dGFMrzvY/59t
-WDYcPQuBDRIrRhCA/ec8J9B6yKm2fnQwM6M6int0wHl5QpNt/7EpFIKrIYwvF/k/Ji/1WcbvgAa3
-mkkp7M5+cTxqEEHA9tOasnxakZzArFvITV734VP/Q3f8nktnbNfzg9Gg4H8l37iYC5oyOGwwoPP/
-CBUz91BKez6jPiCp3C9WgArtQVCwyfTssuMmRAAOb54GvCKWU3BlxFAKRmukLyeBEicTXxChds6K
-ezfqwzlhA5WYOudsiCUI/HloDYd9Yvi0X/vF2Ey9WLw/Q1vUHgFNPGO+I++MzVpQuGhU+QqZMxEA
-4Z7CRneC9VkGjCFMhwnN5ag=
------END CERTIFICATE-----
-
-Juur-SK
-=======
------BEGIN CERTIFICATE-----
-MIIE5jCCA86gAwIBAgIEO45L/DANBgkqhkiG9w0BAQUFADBdMRgwFgYJKoZIhvcNAQkBFglwa2lA
-c2suZWUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKExlBUyBTZXJ0aWZpdHNlZXJpbWlza2Vza3VzMRAw
-DgYDVQQDEwdKdXVyLVNLMB4XDTAxMDgzMDE0MjMwMVoXDTE2MDgyNjE0MjMwMVowXTEYMBYGCSqG
-SIb3DQEJARYJcGtpQHNrLmVlMQswCQYDVQQGEwJFRTEiMCAGA1UEChMZQVMgU2VydGlmaXRzZWVy
-aW1pc2tlc2t1czEQMA4GA1UEAxMHSnV1ci1TSzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
-ggEBAIFxNj4zB9bjMI0TfncyRsvPGbJgMUaXhvSYRqTCZUXP00B841oiqBB4M8yIsdOBSvZiF3tf
-TQou0M+LI+5PAk676w7KvRhj6IAcjeEcjT3g/1tf6mTll+g/mX8MCgkzABpTpyHhOEvWgxutr2TC
-+Rx6jGZITWYfGAriPrsfB2WThbkasLnE+w0R9vXW+RvHLCu3GFH+4Hv2qEivbDtPL+/40UceJlfw
-UR0zlv/vWT3aTdEVNMfqPxZIe5EcgEMPPbgFPtGzlc3Yyg/CQ2fbt5PgIoIuvvVoKIO5wTtpeyDa
-Tpxt4brNj3pssAki14sL2xzVWiZbDcDq5WDQn/413z8CAwEAAaOCAawwggGoMA8GA1UdEwEB/wQF
-MAMBAf8wggEWBgNVHSAEggENMIIBCTCCAQUGCisGAQQBzh8BAQEwgfYwgdAGCCsGAQUFBwICMIHD
-HoHAAFMAZQBlACAAcwBlAHIAdABpAGYAaQBrAGEAYQB0ACAAbwBuACAAdgDkAGwAagBhAHMAdABh
-AHQAdQBkACAAQQBTAC0AaQBzACAAUwBlAHIAdABpAGYAaQB0AHMAZQBlAHIAaQBtAGkAcwBrAGUA
-cwBrAHUAcwAgAGEAbABhAG0ALQBTAEsAIABzAGUAcgB0AGkAZgBpAGsAYQBhAHQAaQBkAGUAIABr
-AGkAbgBuAGkAdABhAG0AaQBzAGUAawBzMCEGCCsGAQUFBwIBFhVodHRwOi8vd3d3LnNrLmVlL2Nw
-cy8wKwYDVR0fBCQwIjAgoB6gHIYaaHR0cDovL3d3dy5zay5lZS9qdXVyL2NybC8wHQYDVR0OBBYE
-FASqekej5ImvGs8KQKcYP2/v6X2+MB8GA1UdIwQYMBaAFASqekej5ImvGs8KQKcYP2/v6X2+MA4G
-A1UdDwEB/wQEAwIB5jANBgkqhkiG9w0BAQUFAAOCAQEAe8EYlFOiCfP+JmeaUOTDBS8rNXiRTHyo
-ERF5TElZrMj3hWVcRrs7EKACr81Ptcw2Kuxd/u+gkcm2k298gFTsxwhwDY77guwqYHhpNjbRxZyL
-abVAyJRld/JXIWY7zoVAtjNjGr95HvxcHdMdkxuLDF2FvZkwMhgJkVLpfKG6/2SSmuz+Ne6ML678
-IIbsSt4beDI3poHSna9aEhbKmVv8b20OxaAehsmR0FyYgl9jDIpaq9iVpszLita/ZEuOyoqysOkh
-Mp6qqIWYNIE5ITuoOlIyPfZrN4YGWhWY3PARZv40ILcD9EEQfTmEeZZyY7aWAuVrua0ZTbvGRNs2
-yyqcjg==
------END CERTIFICATE-----
-
-Hongkong Post Root CA 1
-=======================
------BEGIN CERTIFICATE-----
-MIIDMDCCAhigAwIBAgICA+gwDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoT
-DUhvbmdrb25nIFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMB4XDTAzMDUx
-NTA1MTMxNFoXDTIzMDUxNTA0NTIyOVowRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoTDUhvbmdrb25n
-IFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMIIBIjANBgkqhkiG9w0BAQEF
-AAOCAQ8AMIIBCgKCAQEArP84tulmAknjorThkPlAj3n54r15/gK97iSSHSL22oVyaf7XPwnU3ZG1
-ApzQjVrhVcNQhrkpJsLj2aDxaQMoIIBFIi1WpztUlVYiWR8o3x8gPW2iNr4joLFutbEnPzlTCeqr
-auh0ssJlXI6/fMN4hM2eFvz1Lk8gKgifd/PFHsSaUmYeSF7jEAaPIpjhZY4bXSNmO7ilMlHIhqqh
-qZ5/dpTCpmy3QfDVyAY45tQM4vM7TG1QjMSDJ8EThFk9nnV0ttgCXjqQesBCNnLsak3c78QA3xMY
-V18meMjWCnl3v/evt3a5pQuEF10Q6m/hq5URX208o1xNg1vysxmKgIsLhwIDAQABoyYwJDASBgNV
-HRMBAf8ECDAGAQH/AgEDMA4GA1UdDwEB/wQEAwIBxjANBgkqhkiG9w0BAQUFAAOCAQEADkbVPK7i
-h9legYsCmEEIjEy82tvuJxuC52pF7BaLT4Wg87JwvVqWuspube5Gi27nKi6Wsxkz67SfqLI37pio
-l7Yutmcn1KZJ/RyTZXaeQi/cImyaT/JaFTmxcdcrUehtHJjA2Sr0oYJ71clBoiMBdDhViw+5Lmei
-IAQ32pwL0xch4I+XeTRvhEgCIDMb5jREn5Fw9IBehEPCKdJsEhTkYY2sEJCehFC78JZvRZ+K88ps
-T/oROhUVRsPNH4NbLUES7VBnQRM9IauUiqpOfMGx+6fWtScvl6tu4B3i0RwsH0Ti/L6RoZz71ilT
-c4afU9hDDl3WY4JxHYB0yvbiAmvZWg==
------END CERTIFICATE-----
-
-SecureSign RootCA11
-===================
------BEGIN CERTIFICATE-----
-MIIDbTCCAlWgAwIBAgIBATANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQGEwJKUDErMCkGA1UEChMi
-SmFwYW4gQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcywgSW5jLjEcMBoGA1UEAxMTU2VjdXJlU2lnbiBS
-b290Q0ExMTAeFw0wOTA0MDgwNDU2NDdaFw0yOTA0MDgwNDU2NDdaMFgxCzAJBgNVBAYTAkpQMSsw
-KQYDVQQKEyJKYXBhbiBDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzLCBJbmMuMRwwGgYDVQQDExNTZWN1
-cmVTaWduIFJvb3RDQTExMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA/XeqpRyQBTvL
-TJszi1oURaTnkBbR31fSIRCkF/3frNYfp+TbfPfs37gD2pRY/V1yfIw/XwFndBWW4wI8h9uuywGO
-wvNmxoVF9ALGOrVisq/6nL+k5tSAMJjzDbaTj6nU2DbysPyKyiyhFTOVMdrAG/LuYpmGYz+/3ZMq
-g6h2uRMft85OQoWPIucuGvKVCbIFtUROd6EgvanyTgp9UK31BQ1FT0Zx/Sg+U/sE2C3XZR1KG/rP
-O7AxmjVuyIsG0wCR8pQIZUyxNAYAeoni8McDWc/V1uinMrPmmECGxc0nEovMe863ETxiYAcjPitA
-bpSACW22s293bzUIUPsCh8U+iQIDAQABo0IwQDAdBgNVHQ4EFgQUW/hNT7KlhtQ60vFjmqC+CfZX
-t94wDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAKCh
-OBZmLqdWHyGcBvod7bkixTgm2E5P7KN/ed5GIaGHd48HCJqypMWvDzKYC3xmKbabfSVSSUOrTC4r
-bnpwrxYO4wJs+0LmGJ1F2FXI6Dvd5+H0LgscNFxsWEr7jIhQX5Ucv+2rIrVls4W6ng+4reV6G4pQ
-Oh29Dbx7VFALuUKvVaAYga1lme++5Jy/xIWrQbJUb9wlze144o4MjQlJ3WN7WmmWAiGovVJZ6X01
-y8hSyn+B/tlr0/cR7SXf+Of5pPpyl4RTDaXQMhhRdlkUbA/r7F+AjHVDg8OFmP9Mni0N5HeDk061
-lgeLKBObjBmNQSdJQO7e5iNEOdyhIta6A/I=
------END CERTIFICATE-----
-
-ACEDICOM Root
-=============
------BEGIN CERTIFICATE-----
-MIIFtTCCA52gAwIBAgIIYY3HhjsBggUwDQYJKoZIhvcNAQEFBQAwRDEWMBQGA1UEAwwNQUNFRElD
-T00gUm9vdDEMMAoGA1UECwwDUEtJMQ8wDQYDVQQKDAZFRElDT00xCzAJBgNVBAYTAkVTMB4XDTA4
-MDQxODE2MjQyMloXDTI4MDQxMzE2MjQyMlowRDEWMBQGA1UEAwwNQUNFRElDT00gUm9vdDEMMAoG
-A1UECwwDUEtJMQ8wDQYDVQQKDAZFRElDT00xCzAJBgNVBAYTAkVTMIICIjANBgkqhkiG9w0BAQEF
-AAOCAg8AMIICCgKCAgEA/5KV4WgGdrQsyFhIyv2AVClVYyT/kGWbEHV7w2rbYgIB8hiGtXxaOLHk
-WLn709gtn70yN78sFW2+tfQh0hOR2QetAQXW8713zl9CgQr5auODAKgrLlUTY4HKRxx7XBZXehuD
-YAQ6PmXDzQHe3qTWDLqO3tkE7hdWIpuPY/1NFgu3e3eM+SW10W2ZEi5PGrjm6gSSrj0RuVFCPYew
-MYWveVqc/udOXpJPQ/yrOq2lEiZmueIM15jO1FillUAKt0SdE3QrwqXrIhWYENiLxQSfHY9g5QYb
-m8+5eaA9oiM/Qj9r+hwDezCNzmzAv+YbX79nuIQZ1RXve8uQNjFiybwCq0Zfm/4aaJQ0PZCOrfbk
-HQl/Sog4P75n/TSW9R28MHTLOO7VbKvU/PQAtwBbhTIWdjPp2KOZnQUAqhbm84F9b32qhm2tFXTT
-xKJxqvQUfecyuB+81fFOvW8XAjnXDpVCOscAPukmYxHqC9FK/xidstd7LzrZlvvoHpKuE1XI2Sf2
-3EgbsCTBheN3nZqk8wwRHQ3ItBTutYJXCb8gWH8vIiPYcMt5bMlL8qkqyPyHK9caUPgn6C9D4zq9
-2Fdx/c6mUlv53U3t5fZvie27k5x2IXXwkkwp9y+cAS7+UEaeZAwUswdbxcJzbPEHXEUkFDWug/Fq
-TYl6+rPYLWbwNof1K1MCAwEAAaOBqjCBpzAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKaz
-4SsrSbbXc6GqlPUB53NlTKxQMA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUprPhKytJttdzoaqU
-9QHnc2VMrFAwRAYDVR0gBD0wOzA5BgRVHSAAMDEwLwYIKwYBBQUHAgEWI2h0dHA6Ly9hY2VkaWNv
-bS5lZGljb21ncm91cC5jb20vZG9jMA0GCSqGSIb3DQEBBQUAA4ICAQDOLAtSUWImfQwng4/F9tqg
-aHtPkl7qpHMyEVNEskTLnewPeUKzEKbHDZ3Ltvo/Onzqv4hTGzz3gvoFNTPhNahXwOf9jU8/kzJP
-eGYDdwdY6ZXIfj7QeQCM8htRM5u8lOk6e25SLTKeI6RF+7YuE7CLGLHdztUdp0J/Vb77W7tH1Pwk
-zQSulgUV1qzOMPPKC8W64iLgpq0i5ALudBF/TP94HTXa5gI06xgSYXcGCRZj6hitoocf8seACQl1
-ThCojz2GuHURwCRiipZ7SkXp7FnFvmuD5uHorLUwHv4FB4D54SMNUI8FmP8sX+g7tq3PgbUhh8oI
-KiMnMCArz+2UW6yyetLHKKGKC5tNSixthT8Jcjxn4tncB7rrZXtaAWPWkFtPF2Y9fwsZo5NjEFIq
-nxQWWOLcpfShFosOkYuByptZ+thrkQdlVV9SH686+5DdaaVbnG0OLLb6zqylfDJKZ0DcMDQj3dcE
-I2bw/FWAp/tmGYI1Z2JwOV5vx+qQQEQIHriy1tvuWacNGHk0vFQYXlPKNFHtRQrmjseCNj6nOGOp
-MCwXEGCSn1WHElkQwg9naRHMTh5+Spqtr0CodaxWkHS4oJyleW/c6RrIaQXpuvoDs3zk4E7Czp3o
-tkYNbn5XOmeUwssfnHdKZ05phkOTOPu220+DkdRgfks+KzgHVZhepA==
------END CERTIFICATE-----
-
-Verisign Class 3 Public Primary Certification Authority
-=======================================================
------BEGIN CERTIFICATE-----
-MIICPDCCAaUCEDyRMcsf9tAbDpq40ES/Er4wDQYJKoZIhvcNAQEFBQAwXzELMAkGA1UEBhMCVVMx
-FzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmltYXJ5
-IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2MDEyOTAwMDAwMFoXDTI4MDgwMjIzNTk1OVow
-XzELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAz
-IFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUA
-A4GNADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhEBarsAx94
-f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/isI19wKTakyYbnsZogy1Ol
-hec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBABByUqkFFBky
-CEHwxWsKzH4PIRnN5GfcX6kb5sroc50i2JhucwNhkcV8sEVAbkSdjbCxlnRhLQ2pRdKkkirWmnWX
-bj9T/UWZYB2oK0z5XqcJ2HUw19JlYD1n1khVdWk/kfVIC0dpImmClr7JyDiGSnoscxlIaU5rfGW/
-D/xwzoiQ
------END CERTIFICATE-----
-
-Microsec e-Szigno Root CA 2009
-==============================
------BEGIN CERTIFICATE-----
-MIIECjCCAvKgAwIBAgIJAMJ+QwRORz8ZMA0GCSqGSIb3DQEBCwUAMIGCMQswCQYDVQQGEwJIVTER
-MA8GA1UEBwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jv
-c2VjIGUtU3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5o
-dTAeFw0wOTA2MTYxMTMwMThaFw0yOTEyMzAxMTMwMThaMIGCMQswCQYDVQQGEwJIVTERMA8GA1UE
-BwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUt
-U3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5odTCCASIw
-DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOn4j/NjrdqG2KfgQvvPkd6mJviZpWNwrZuuyjNA
-fW2WbqEORO7hE52UQlKavXWFdCyoDh2Tthi3jCyoz/tccbna7P7ofo/kLx2yqHWH2Leh5TvPmUpG
-0IMZfcChEhyVbUr02MelTTMuhTlAdX4UfIASmFDHQWe4oIBhVKZsTh/gnQ4H6cm6M+f+wFUoLAKA
-pxn1ntxVUwOXewdI/5n7N4okxFnMUBBjjqqpGrCEGob5X7uxUG6k0QrM1XF+H6cbfPVTbiJfyyvm
-1HxdrtbCxkzlBQHZ7Vf8wSN5/PrIJIOV87VqUQHQd9bpEqH5GoP7ghu5sJf0dgYzQ0mg/wu1+rUC
-AwEAAaOBgDB+MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTLD8bf
-QkPMPcu1SCOhGnqmKrs0aDAfBgNVHSMEGDAWgBTLD8bfQkPMPcu1SCOhGnqmKrs0aDAbBgNVHREE
-FDASgRBpbmZvQGUtc3ppZ25vLmh1MA0GCSqGSIb3DQEBCwUAA4IBAQDJ0Q5eLtXMs3w+y/w9/w0o
-lZMEyL/azXm4Q5DwpL7v8u8hmLzU1F0G9u5C7DBsoKqpyvGvivo/C3NqPuouQH4frlRheesuCDfX
-I/OMn74dseGkddug4lQUsbocKaQY9hK6ohQU4zE1yED/t+AFdlfBHFny+L/k7SViXITwfn4fs775
-tyERzAMBVnCnEJIeGzSBHq2cGsMEPO0CYdYeBvNfOofyK/FFh+U9rNHHV4S9a67c2Pm2G2JwCz02
-yULyMtd6YebS2z3PyKnJm9zbWETXbzivf3jTo60adbocwTZ8jx5tHMN1Rq41Bab2XD0h7lbwyYIi
-LXpUq3DDfSJlgnCW
------END CERTIFICATE-----
-
-E-Guven Kok Elektronik Sertifika Hizmet Saglayicisi
-===================================================
------BEGIN CERTIFICATE-----
-MIIDtjCCAp6gAwIBAgIQRJmNPMADJ72cdpW56tustTANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQG
-EwJUUjEoMCYGA1UEChMfRWxla3Ryb25payBCaWxnaSBHdXZlbmxpZ2kgQS5TLjE8MDoGA1UEAxMz
-ZS1HdXZlbiBLb2sgRWxla3Ryb25payBTZXJ0aWZpa2EgSGl6bWV0IFNhZ2xheWljaXNpMB4XDTA3
-MDEwNDExMzI0OFoXDTE3MDEwNDExMzI0OFowdTELMAkGA1UEBhMCVFIxKDAmBgNVBAoTH0VsZWt0
-cm9uaWsgQmlsZ2kgR3V2ZW5saWdpIEEuUy4xPDA6BgNVBAMTM2UtR3V2ZW4gS29rIEVsZWt0cm9u
-aWsgU2VydGlmaWthIEhpem1ldCBTYWdsYXlpY2lzaTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
-AQoCggEBAMMSIJ6wXgBljU5Gu4Bc6SwGl9XzcslwuedLZYDBS75+PNdUMZTe1RK6UxYC6lhj71vY
-8+0qGqpxSKPcEC1fX+tcS5yWCEIlKBHMilpiAVDV6wlTL/jDj/6z/P2douNffb7tC+Bg62nsM+3Y
-jfsSSYMAyYuXjDtzKjKzEve5TfL0TW3H5tYmNwjy2f1rXKPlSFxYvEK+A1qBuhw1DADT9SN+cTAI
-JjjcJRFHLfO6IxClv7wC90Nex/6wN1CZew+TzuZDLMN+DfIcQ2Zgy2ExR4ejT669VmxMvLz4Bcpk
-9Ok0oSy1c+HCPujIyTQlCFzz7abHlJ+tiEMl1+E5YP6sOVkCAwEAAaNCMEAwDgYDVR0PAQH/BAQD
-AgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFJ/uRLOU1fqRTy7ZVZoEVtstxNulMA0GCSqG
-SIb3DQEBBQUAA4IBAQB/X7lTW2M9dTLn+sR0GstG30ZpHFLPqk/CaOv/gKlR6D1id4k9CnU58W5d
-F4dvaAXBlGzZXd/aslnLpRCKysw5zZ/rTt5S/wzw9JKp8mxTq5vSR6AfdPebmvEvFZ96ZDAYBzwq
-D2fK/A+JYZ1lpTzlvBNbCNvj/+27BrtqBrF6T2XGgv0enIu1De5Iu7i9qgi0+6N8y5/NkHZchpZ4
-Vwpm+Vganf2XKWDeEaaQHBkc7gGWIjQ0LpH5t8Qn0Xvmv/uARFoW5evg1Ao4vOSR49XrXMGs3xtq
-fJ7lddK2l4fbzIcrQzqECK+rPNv3PGYxhrCdU3nt+CPeQuMtgvEP5fqX
------END CERTIFICATE-----
-
-GlobalSign Root CA - R3
-=======================
------BEGIN CERTIFICATE-----
-MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4GA1UECxMXR2xv
-YmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
-bFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
-aWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
-bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWt
-iHL8RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsTgHeMCOFJ
-0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmmKPZpO/bLyCiR5Z2KYVc3
-rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zdQQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjl
-OCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZXriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2
-xmmFghcCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
-FI/wS3+oLkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZURUm7
-lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMpjjM5RcOO5LlXbKr8
-EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK6fBdRoyV3XpYKBovHd7NADdBj+1E
-bddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQXmcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18
-YIvDQVETI53O9zJrlAGomecsMx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7r
-kpeDMdmztcpHWD9f
------END CERTIFICATE-----
-
-TC TrustCenter Universal CA III
-===============================
------BEGIN CERTIFICATE-----
-MIID4TCCAsmgAwIBAgIOYyUAAQACFI0zFQLkbPQwDQYJKoZIhvcNAQEFBQAwezELMAkGA1UEBhMC
-REUxHDAaBgNVBAoTE1RDIFRydXN0Q2VudGVyIEdtYkgxJDAiBgNVBAsTG1RDIFRydXN0Q2VudGVy
-IFVuaXZlcnNhbCBDQTEoMCYGA1UEAxMfVEMgVHJ1c3RDZW50ZXIgVW5pdmVyc2FsIENBIElJSTAe
-Fw0wOTA5MDkwODE1MjdaFw0yOTEyMzEyMzU5NTlaMHsxCzAJBgNVBAYTAkRFMRwwGgYDVQQKExNU
-QyBUcnVzdENlbnRlciBHbWJIMSQwIgYDVQQLExtUQyBUcnVzdENlbnRlciBVbml2ZXJzYWwgQ0Ex
-KDAmBgNVBAMTH1RDIFRydXN0Q2VudGVyIFVuaXZlcnNhbCBDQSBJSUkwggEiMA0GCSqGSIb3DQEB
-AQUAA4IBDwAwggEKAoIBAQDC2pxisLlxErALyBpXsq6DFJmzNEubkKLF5+cvAqBNLaT6hdqbJYUt
-QCggbergvbFIgyIpRJ9Og+41URNzdNW88jBmlFPAQDYvDIRlzg9uwliT6CwLOunBjvvya8o84pxO
-juT5fdMnnxvVZ3iHLX8LR7PH6MlIfK8vzArZQe+f/prhsq75U7Xl6UafYOPfjdN/+5Z+s7Vy+Eut
-CHnNaYlAJ/Uqwa1D7KRTyGG299J5KmcYdkhtWyUB0SbFt1dpIxVbYYqt8Bst2a9c8SaQaanVDED1
-M4BDj5yjdipFtK+/fz6HP3bFzSreIMUWWMv5G/UPyw0RUmS40nZid4PxWJ//AgMBAAGjYzBhMB8G
-A1UdIwQYMBaAFFbn4VslQ4Dg9ozhcbyO5YAvxEjiMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/
-BAQDAgEGMB0GA1UdDgQWBBRW5+FbJUOA4PaM4XG8juWAL8RI4jANBgkqhkiG9w0BAQUFAAOCAQEA
-g8ev6n9NCjw5sWi+e22JLumzCecYV42FmhfzdkJQEw/HkG8zrcVJYCtsSVgZ1OK+t7+rSbyUyKu+
-KGwWaODIl0YgoGhnYIg5IFHYaAERzqf2EQf27OysGh+yZm5WZ2B6dF7AbZc2rrUNXWZzwCUyRdhK
-BgePxLcHsU0GDeGl6/R1yrqc0L2z0zIkTO5+4nYES0lT2PLpVDP85XEfPRRclkvxOvIAu2y0+pZV
-CIgJwcyRGSmwIC3/yzikQOEXvnlhgP8HA4ZMTnsGnxGGjYnuJ8Tb4rwZjgvDwxPHLQNjO9Po5KIq
-woIIlBZU8O8fJ5AluA0OKBtHd0e9HKgl8ZS0Zg==
------END CERTIFICATE-----
-
-Autoridad de Certificacion Firmaprofesional CIF A62634068
-=========================================================
------BEGIN CERTIFICATE-----
-MIIGFDCCA/ygAwIBAgIIU+w77vuySF8wDQYJKoZIhvcNAQEFBQAwUTELMAkGA1UEBhMCRVMxQjBA
-BgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1hcHJvZmVzaW9uYWwgQ0lGIEE2
-MjYzNDA2ODAeFw0wOTA1MjAwODM4MTVaFw0zMDEyMzEwODM4MTVaMFExCzAJBgNVBAYTAkVTMUIw
-QAYDVQQDDDlBdXRvcmlkYWQgZGUgQ2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBB
-NjI2MzQwNjgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDD
-Utd9thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQMcas9UX4P
-B99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefGL9ItWY16Ck6WaVICqjaY
-7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15iNA9wBj4gGFrO93IbJWyTdBSTo3OxDqqH
-ECNZXyAFGUftaI6SEspd/NYrspI8IM/hX68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyI
-plD9amML9ZMWGxmPsu2bm8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctX
-MbScyJCyZ/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirjaEbsX
-LZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/TKI8xWVvTyQKmtFLK
-bpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF6NkBiDkal4ZkQdU7hwxu+g/GvUgU
-vzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVhOSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMBIGA1Ud
-EwEB/wQIMAYBAf8CAQEwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRlzeurNR4APn7VdMActHNH
-DhpkLzCBpgYDVR0gBIGeMIGbMIGYBgRVHSAAMIGPMC8GCCsGAQUFBwIBFiNodHRwOi8vd3d3LmZp
-cm1hcHJvZmVzaW9uYWwuY29tL2NwczBcBggrBgEFBQcCAjBQHk4AUABhAHMAZQBvACAAZABlACAA
-bABhACAAQgBvAG4AYQBuAG8AdgBhACAANAA3ACAAQgBhAHIAYwBlAGwAbwBuAGEAIAAwADgAMAAx
-ADcwDQYJKoZIhvcNAQEFBQADggIBABd9oPm03cXF661LJLWhAqvdpYhKsg9VSytXjDvlMd3+xDLx
-51tkljYyGOylMnfX40S2wBEqgLk9am58m9Ot/MPWo+ZkKXzR4Tgegiv/J2Wv+xYVxC5xhOW1//qk
-R71kMrv2JYSiJ0L1ILDCExARzRAVukKQKtJE4ZYm6zFIEv0q2skGz3QeqUvVhyj5eTSSPi5E6PaP
-T481PyWzOdxjKpBrIF/EUhJOlywqrJ2X3kjyo2bbwtKDlaZmp54lD+kLM5FlClrD2VQS3a/DTg4f
-Jl4N3LON7NWBcN7STyQF82xO9UxJZo3R/9ILJUFI/lGExkKvgATP0H5kSeTy36LssUzAKh3ntLFl
-osS88Zj0qnAHY7S42jtM+kAiMFsRpvAFDsYCA0irhpuF3dvd6qJ2gHN99ZwExEWN57kci57q13XR
-crHedUTnQn3iV2t93Jm8PYMo6oCTjcVMZcFwgbg4/EMxsvYDNEeyrPsiBsse3RdHHF9mudMaotoR
-saS8I8nkvof/uZS2+F0gStRf571oe2XyFR7SOqkt6dhrJKyXWERHrVkY8SFlcN7ONGCoQPHzPKTD
-KCOM/iczQ0CgFzzr6juwcqajuUpLXhZI9LK8yIySxZ2frHI2vDSANGupi5LAuBft7HZT9SQBjLMi
-6Et8Vcad+qMUu2WFbm5PEn4KPJ2V
------END CERTIFICATE-----
-
-Izenpe.com
-==========
------BEGIN CERTIFICATE-----
-MIIF8TCCA9mgAwIBAgIQALC3WhZIX7/hy/WL1xnmfTANBgkqhkiG9w0BAQsFADA4MQswCQYDVQQG
-EwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wHhcNMDcxMjEz
-MTMwODI4WhcNMzcxMjEzMDgyNzI1WjA4MQswCQYDVQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMu
-QS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDJ
-03rKDx6sp4boFmVqscIbRTJxldn+EFvMr+eleQGPicPK8lVx93e+d5TzcqQsRNiekpsUOqHnJJAK
-ClaOxdgmlOHZSOEtPtoKct2jmRXagaKH9HtuJneJWK3W6wyyQXpzbm3benhB6QiIEn6HLmYRY2xU
-+zydcsC8Lv/Ct90NduM61/e0aL6i9eOBbsFGb12N4E3GVFWJGjMxCrFXuaOKmMPsOzTFlUFpfnXC
-PCDFYbpRR6AgkJOhkEvzTnyFRVSa0QUmQbC1TR0zvsQDyCV8wXDbO/QJLVQnSKwv4cSsPsjLkkxT
-OTcj7NMB+eAJRE1NZMDhDVqHIrytG6P+JrUV86f8hBnp7KGItERphIPzidF0BqnMC9bC3ieFUCbK
-F7jJeodWLBoBHmy+E60QrLUk9TiRodZL2vG70t5HtfG8gfZZa88ZU+mNFctKy6lvROUbQc/hhqfK
-0GqfvEyNBjNaooXlkDWgYlwWTvDjovoDGrQscbNYLN57C9saD+veIR8GdwYDsMnvmfzAuU8Lhij+
-0rnq49qlw0dpEuDb8PYZi+17cNcC1u2HGCgsBCRMd+RIihrGO5rUD8r6ddIBQFqNeb+Lz0vPqhbB
-leStTIo+F5HUsWLlguWABKQDfo2/2n+iD5dPDNMN+9fR5XJ+HMh3/1uaD7euBUbl8agW7EekFwID
-AQABo4H2MIHzMIGwBgNVHREEgagwgaWBD2luZm9AaXplbnBlLmNvbaSBkTCBjjFHMEUGA1UECgw+
-SVpFTlBFIFMuQS4gLSBDSUYgQTAxMzM3MjYwLVJNZXJjLlZpdG9yaWEtR2FzdGVpeiBUMTA1NSBG
-NjIgUzgxQzBBBgNVBAkMOkF2ZGEgZGVsIE1lZGl0ZXJyYW5lbyBFdG9yYmlkZWEgMTQgLSAwMTAx
-MCBWaXRvcmlhLUdhc3RlaXowDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
-BBYEFB0cZQ6o8iV7tJHP5LGx5r1VdGwFMA0GCSqGSIb3DQEBCwUAA4ICAQB4pgwWSp9MiDrAyw6l
-Fn2fuUhfGI8NYjb2zRlrrKvV9pF9rnHzP7MOeIWblaQnIUdCSnxIOvVFfLMMjlF4rJUT3sb9fbga
-kEyrkgPH7UIBzg/YsfqikuFgba56awmqxinuaElnMIAkejEWOVt+8Rwu3WwJrfIxwYJOubv5vr8q
-hT/AQKM6WfxZSzwoJNu0FXWuDYi6LnPAvViH5ULy617uHjAimcs30cQhbIHsvm0m5hzkQiCeR7Cs
-g1lwLDXWrzY0tM07+DKo7+N4ifuNRSzanLh+QBxh5z6ikixL8s36mLYp//Pye6kfLqCTVyvehQP5
-aTfLnnhqBbTFMXiJ7HqnheG5ezzevh55hM6fcA5ZwjUukCox2eRFekGkLhObNA5me0mrZJfQRsN5
-nXJQY6aYWwa9SG3YOYNw6DXwBdGqvOPbyALqfP2C2sJbUjWumDqtujWTI6cfSN01RpiyEGjkpTHC
-ClguGYEQyVB1/OpaFs4R1+7vUIgtYf8/QnMFlEPVjjxOAToZpR9GTnfQXeWBIiGH/pR9hNiTrdZo
-Q0iy2+tzJOeRf1SktoA+naM8THLCV8Sg1Mw4J87VBp6iSNnpn86CcDaTmjvfliHjWbcM2pE38P1Z
-WrOZyGlsQyYBNWNgVYkDOnXYukrZVP/u3oDYLdE41V4tC5h9Pmzb/CaIxw==
------END CERTIFICATE-----
-
-Chambers of Commerce Root - 2008
-================================
------BEGIN CERTIFICATE-----
-MIIHTzCCBTegAwIBAgIJAKPaQn6ksa7aMA0GCSqGSIb3DQEBBQUAMIGuMQswCQYDVQQGEwJFVTFD
-MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
-bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
-QS4xKTAnBgNVBAMTIENoYW1iZXJzIG9mIENvbW1lcmNlIFJvb3QgLSAyMDA4MB4XDTA4MDgwMTEy
-Mjk1MFoXDTM4MDczMTEyMjk1MFowga4xCzAJBgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNl
-ZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNhbWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQF
-EwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENhbWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJl
-cnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC
-AQCvAMtwNyuAWko6bHiUfaN/Gh/2NdW928sNRHI+JrKQUrpjOyhYb6WzbZSm891kDFX29ufyIiKA
-XuFixrYp4YFs8r/lfTJqVKAyGVn+H4vXPWCGhSRv4xGzdz4gljUha7MI2XAuZPeEklPWDrCQiorj
-h40G072QDuKZoRuGDtqaCrsLYVAGUvGef3bsyw/QHg3PmTA9HMRFEFis1tPo1+XqxQEHd9ZR5gN/
-ikilTWh1uem8nk4ZcfUyS5xtYBkL+8ydddy/Js2Pk3g5eXNeJQ7KXOt3EgfLZEFHcpOrUMPrCXZk
-NNI5t3YRCQ12RcSprj1qr7V9ZS+UWBDsXHyvfuK2GNnQm05aSd+pZgvMPMZ4fKecHePOjlO+Bd5g
-D2vlGts/4+EhySnB8esHnFIbAURRPHsl18TlUlRdJQfKFiC4reRB7noI/plvg6aRArBsNlVq5331
-lubKgdaX8ZSD6e2wsWsSaR6s+12pxZjptFtYer49okQ6Y1nUCyXeG0+95QGezdIp1Z8XGQpvvwyQ
-0wlf2eOKNcx5Wk0ZN5K3xMGtr/R5JJqyAQuxr1yW84Ay+1w9mPGgP0revq+ULtlVmhduYJ1jbLhj
-ya6BXBg14JC7vjxPNyK5fuvPnnchpj04gftI2jE9K+OJ9dC1vX7gUMQSibMjmhAxhduub+84Mxh2
-EQIDAQABo4IBbDCCAWgwEgYDVR0TAQH/BAgwBgEB/wIBDDAdBgNVHQ4EFgQU+SSsD7K1+HnA+mCI
-G8TZTQKeFxkwgeMGA1UdIwSB2zCB2IAU+SSsD7K1+HnA+mCIG8TZTQKeFxmhgbSkgbEwga4xCzAJ
-BgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNlZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNh
-bWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQFEwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENh
-bWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDiC
-CQCj2kJ+pLGu2jAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUH
-AgEWHGh0dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAJASryI1
-wqM58C7e6bXpeHxIvj99RZJe6dqxGfwWPJ+0W2aeaufDuV2I6A+tzyMP3iU6XsxPpcG1Lawk0lgH
-3qLPaYRgM+gQDROpI9CF5Y57pp49chNyM/WqfcZjHwj0/gF/JM8rLFQJ3uIrbZLGOU8W6jx+ekbU
-RWpGqOt1glanq6B8aBMz9p0w8G8nOSQjKpD9kCk18pPfNKXG9/jvjA9iSnyu0/VU+I22mlaHFoI6
-M6taIgj3grrqLuBHmrS1RaMFO9ncLkVAO+rcf+g769HsJtg1pDDFOqxXnrN2pSB7+R5KBWIBpih1
-YJeSDW4+TTdDDZIVnBgizVGZoCkaPF+KMjNbMMeJL0eYD6MDxvbxrN8y8NmBGuScvfaAFPDRLLmF
-9dijscilIeUcE5fuDr3fKanvNFNb0+RqE4QGtjICxFKuItLcsiFCGtpA8CnJ7AoMXOLQusxI0zcK
-zBIKinmwPQN/aUv0NCB9szTqjktk9T79syNnFQ0EuPAtwQlRPLJsFfClI9eDdOTlLsn+mCdCxqvG
-nrDQWzilm1DefhiYtUU79nm06PcaewaD+9CL2rvHvRirCG88gGtAPxkZumWK5r7VXNM21+9AUiRg
-OGcEMeyP84LG3rlV8zsxkVrctQgVrXYlCg17LofiDKYGvCYQbTed7N14jHyAxfDZd0jQ
------END CERTIFICATE-----
-
-Global Chambersign Root - 2008
-==============================
------BEGIN CERTIFICATE-----
-MIIHSTCCBTGgAwIBAgIJAMnN0+nVfSPOMA0GCSqGSIb3DQEBBQUAMIGsMQswCQYDVQQGEwJFVTFD
-MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
-bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
-QS4xJzAlBgNVBAMTHkdsb2JhbCBDaGFtYmVyc2lnbiBSb290IC0gMjAwODAeFw0wODA4MDExMjMx
-NDBaFw0zODA3MzExMjMxNDBaMIGsMQswCQYDVQQGEwJFVTFDMEEGA1UEBxM6TWFkcmlkIChzZWUg
-Y3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNvbS9hZGRyZXNzKTESMBAGA1UEBRMJ
-QTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMuQS4xJzAlBgNVBAMTHkdsb2JhbCBD
-aGFtYmVyc2lnbiBSb290IC0gMjAwODCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMDf
-VtPkOpt2RbQT2//BthmLN0EYlVJH6xedKYiONWwGMi5HYvNJBL99RDaxccy9Wglz1dmFRP+RVyXf
-XjaOcNFccUMd2drvXNL7G706tcuto8xEpw2uIRU/uXpbknXYpBI4iRmKt4DS4jJvVpyR1ogQC7N0
-ZJJ0YPP2zxhPYLIj0Mc7zmFLmY/CDNBAspjcDahOo7kKrmCgrUVSY7pmvWjg+b4aqIG7HkF4ddPB
-/gBVsIdU6CeQNR1MM62X/JcumIS/LMmjv9GYERTtY/jKmIhYF5ntRQOXfjyGHoiMvvKRhI9lNNgA
-TH23MRdaKXoKGCQwoze1eqkBfSbW+Q6OWfH9GzO1KTsXO0G2Id3UwD2ln58fQ1DJu7xsepeY7s2M
-H/ucUa6LcL0nn3HAa6x9kGbo1106DbDVwo3VyJ2dwW3Q0L9R5OP4wzg2rtandeavhENdk5IMagfe
-Ox2YItaswTXbo6Al/3K1dh3ebeksZixShNBFks4c5eUzHdwHU1SjqoI7mjcv3N2gZOnm3b2u/GSF
-HTynyQbehP9r6GsaPMWis0L7iwk+XwhSx2LE1AVxv8Rk5Pihg+g+EpuoHtQ2TS9x9o0o9oOpE9Jh
-wZG7SMA0j0GMS0zbaRL/UJScIINZc+18ofLx/d33SdNDWKBWY8o9PeU1VlnpDsogzCtLkykPAgMB
-AAGjggFqMIIBZjASBgNVHRMBAf8ECDAGAQH/AgEMMB0GA1UdDgQWBBS5CcqcHtvTbDprru1U8VuT
-BjUuXjCB4QYDVR0jBIHZMIHWgBS5CcqcHtvTbDprru1U8VuTBjUuXqGBsqSBrzCBrDELMAkGA1UE
-BhMCRVUxQzBBBgNVBAcTOk1hZHJpZCAoc2VlIGN1cnJlbnQgYWRkcmVzcyBhdCB3d3cuY2FtZXJm
-aXJtYS5jb20vYWRkcmVzcykxEjAQBgNVBAUTCUE4Mjc0MzI4NzEbMBkGA1UEChMSQUMgQ2FtZXJm
-aXJtYSBTLkEuMScwJQYDVQQDEx5HbG9iYWwgQ2hhbWJlcnNpZ24gUm9vdCAtIDIwMDiCCQDJzdPp
-1X0jzjAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUHAgEWHGh0
-dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAICIf3DekijZBZRG
-/5BXqfEv3xoNa/p8DhxJJHkn2EaqbylZUohwEurdPfWbU1Rv4WCiqAm57OtZfMY18dwY6fFn5a+6
-ReAJ3spED8IXDneRRXozX1+WLGiLwUePmJs9wOzL9dWCkoQ10b42OFZyMVtHLaoXpGNR6woBrX/s
-dZ7LoR/xfxKxueRkf2fWIyr0uDldmOghp+G9PUIadJpwr2hsUF1Jz//7Dl3mLEfXgTpZALVza2Mg
-9jFFCDkO9HB+QHBaP9BrQql0PSgvAm11cpUJjUhjxsYjV5KTXjXBjfkK9yydYhz2rXzdpjEetrHH
-foUm+qRqtdpjMNHvkzeyZi99Bffnt0uYlDXA2TopwZ2yUDMdSqlapskD7+3056huirRXhOukP9Du
-qqqHW2Pok+JrqNS4cnhrG+055F3Lm6qH1U9OAP7Zap88MQ8oAgF9mOinsKJknnn4SPIVqczmyETr
-P3iZ8ntxPjzxmKfFGBI/5rsoM0LpRQp8bfKGeS/Fghl9CYl8slR2iK7ewfPM4W7bMdaTrpmg7yVq
-c5iJWzouE4gev8CSlDQb4ye3ix5vQv/n6TebUB0tovkC7stYWDpxvGjjqsGvHCgfotwjZT+B6q6Z
-09gwzxMNTxXJhLynSC34MCN32EZLeW32jO06f2ARePTpm67VVMB0gNELQp/B
------END CERTIFICATE-----
-
-Go Daddy Root Certificate Authority - G2
-========================================
------BEGIN CERTIFICATE-----
-MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
-B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoTEUdvRGFkZHkuY29tLCBJbmMu
-MTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5
-MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6
-b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8G
-A1UEAxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZI
-hvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKDE6bFIEMBO4Tx5oVJnyfq
-9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH/PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD
-+qK+ihVqf94Lw7YZFAXK6sOoBJQ7RnwyDfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutd
-fMh8+7ArU6SSYmlRJQVhGkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMl
-NAJWJwGRtDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEAAaNC
-MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFDqahQcQZyi27/a9
-BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmXWWcDYfF+OwYxdS2hII5PZYe096ac
-vNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r
-5N9ss4UXnT3ZJE95kTXWXwTrgIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYV
-N8Gb5DKj7Tjo2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO
-LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI4uJEvlz36hz1
------END CERTIFICATE-----
-
-Starfield Root Certificate Authority - G2
-=========================================
------BEGIN CERTIFICATE-----
-MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
-B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
-b2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVsZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0
-eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgY8xCzAJBgNVBAYTAlVTMRAw
-DgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQg
-VGVjaG5vbG9naWVzLCBJbmMuMTIwMAYDVQQDEylTdGFyZmllbGQgUm9vdCBDZXJ0aWZpY2F0ZSBB
-dXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL3twQP89o/8ArFv
-W59I2Z154qK3A2FWGMNHttfKPTUuiUP3oWmb3ooa/RMgnLRJdzIpVv257IzdIvpy3Cdhl+72WoTs
-bhm5iSzchFvVdPtrX8WJpRBSiUZV9Lh1HOZ/5FSuS/hVclcCGfgXcVnrHigHdMWdSL5stPSksPNk
-N3mSwOxGXn/hbVNMYq/NHwtjuzqd+/x5AJhhdM8mgkBj87JyahkNmcrUDnXMN/uLicFZ8WJ/X7Nf
-ZTD4p7dNdloedl40wOiWVpmKs/B/pM293DIxfJHP4F8R+GuqSVzRmZTRouNjWwl2tVZi4Ut0HZbU
-JtQIBFnQmA4O5t78w+wfkPECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
-AQYwHQYDVR0OBBYEFHwMMh+n2TB/xH1oo2Kooc6rB1snMA0GCSqGSIb3DQEBCwUAA4IBAQARWfol
-TwNvlJk7mh+ChTnUdgWUXuEok21iXQnCoKjUsHU48TRqneSfioYmUeYs0cYtbpUgSpIB7LiKZ3sx
-4mcujJUDJi5DnUox9g61DLu34jd/IroAow57UvtruzvE03lRTs2Q9GcHGcg8RnoNAX3FWOdt5oUw
-F5okxBDgBPfg8n/Uqgr/Qh037ZTlZFkSIHc40zI+OIF1lnP6aI+xy84fxez6nH7PfrHxBy22/L/K
-pL/QlwVKvOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1mMpYjn0q7pBZ
-c2T5NnReJaH1ZgUufzkVqSr7UIuOhWn0
------END CERTIFICATE-----
-
-Starfield Services Root Certificate Authority - G2
-==================================================
------BEGIN CERTIFICATE-----
-MIID7zCCAtegAwIBAgIBADANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
-B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
-b2dpZXMsIEluYy4xOzA5BgNVBAMTMlN0YXJmaWVsZCBTZXJ2aWNlcyBSb290IENlcnRpZmljYXRl
-IEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgZgxCzAJBgNV
-BAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxT
-dGFyZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTswOQYDVQQDEzJTdGFyZmllbGQgU2VydmljZXMg
-Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
-AQoCggEBANUMOsQq+U7i9b4Zl1+OiFOxHz/Lz58gE20pOsgPfTz3a3Y4Y9k2YKibXlwAgLIvWX/2
-h/klQ4bnaRtSmpDhcePYLQ1Ob/bISdm28xpWriu2dBTrz/sm4xq6HZYuajtYlIlHVv8loJNwU4Pa
-hHQUw2eeBGg6345AWh1KTs9DkTvnVtYAcMtS7nt9rjrnvDH5RfbCYM8TWQIrgMw0R9+53pBlbQLP
-LJGmpufehRhJfGZOozptqbXuNC66DQO4M99H67FrjSXZm86B0UVGMpZwh94CDklDhbZsc7tk6mFB
-rMnUVN+HL8cisibMn1lUaJ/8viovxFUcdUBgF4UCVTmLfwUCAwEAAaNCMEAwDwYDVR0TAQH/BAUw
-AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJxfAN+qAdcwKziIorhtSpzyEZGDMA0GCSqG
-SIb3DQEBCwUAA4IBAQBLNqaEd2ndOxmfZyMIbw5hyf2E3F/YNoHN2BtBLZ9g3ccaaNnRbobhiCPP
-E95Dz+I0swSdHynVv/heyNXBve6SbzJ08pGCL72CQnqtKrcgfU28elUSwhXqvfdqlS5sdJ/PHLTy
-xQGjhdByPq1zqwubdQxtRbeOlKyWN7Wg0I8VRw7j6IPdj/3vQQF3zCepYoUz8jcI73HPdwbeyBkd
-iEDPfUYd/x7H4c7/I9vG+o1VTqkC50cRRj70/b17KSa7qWFiNyi2LSr2EIZkyXCn0q23KXB56jza
-YyWf/Wi3MOxw+3WKt21gZ7IeyLnp2KhvAotnDU0mV3HaIPzBSlCNsSi6
------END CERTIFICATE-----
-
-AffirmTrust Commercial
-======================
------BEGIN CERTIFICATE-----
-MIIDTDCCAjSgAwIBAgIId3cGJyapsXwwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UEBhMCVVMxFDAS
-BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMB4XDTEw
-MDEyOTE0MDYwNloXDTMwMTIzMTE0MDYwNlowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
-bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMIIBIjANBgkqhkiG9w0BAQEF
-AAOCAQ8AMIIBCgKCAQEA9htPZwcroRX1BiLLHwGy43NFBkRJLLtJJRTWzsO3qyxPxkEylFf6Eqdb
-DuKPHx6GGaeqtS25Xw2Kwq+FNXkyLbscYjfysVtKPcrNcV/pQr6U6Mje+SJIZMblq8Yrba0F8PrV
-C8+a5fBQpIs7R6UjW3p6+DM/uO+Zl+MgwdYoic+U+7lF7eNAFxHUdPALMeIrJmqbTFeurCA+ukV6
-BfO9m2kVrn1OIGPENXY6BwLJN/3HR+7o8XYdcxXyl6S1yHp52UKqK39c/s4mT6NmgTWvRLpUHhww
-MmWd5jyTXlBOeuM61G7MGvv50jeuJCqrVwMiKA1JdX+3KNp1v47j3A55MQIDAQABo0IwQDAdBgNV
-HQ4EFgQUnZPGU4teyq8/nx4P5ZmVvCT2lI8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
-AQYwDQYJKoZIhvcNAQELBQADggEBAFis9AQOzcAN/wr91LoWXym9e2iZWEnStB03TX8nfUYGXUPG
-hi4+c7ImfU+TqbbEKpqrIZcUsd6M06uJFdhrJNTxFq7YpFzUf1GO7RgBsZNjvbz4YYCanrHOQnDi
-qX0GJX0nof5v7LMeJNrjS1UaADs1tDvZ110w/YETifLCBivtZ8SOyUOyXGsViQK8YvxO8rUzqrJv
-0wqiUOP2O+guRMLbZjipM1ZI8W0bM40NjD9gN53Tym1+NH4Nn3J2ixufcv1SNUFFApYvHLKac0kh
-sUlHRUe072o0EclNmsxZt9YCnlpOZbWUrhvfKbAW8b8Angc6F2S1BLUjIZkKlTuXfO8=
------END CERTIFICATE-----
-
-AffirmTrust Networking
-======================
------BEGIN CERTIFICATE-----
-MIIDTDCCAjSgAwIBAgIIfE8EORzUmS0wDQYJKoZIhvcNAQEFBQAwRDELMAkGA1UEBhMCVVMxFDAS
-BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMB4XDTEw
-MDEyOTE0MDgyNFoXDTMwMTIzMTE0MDgyNFowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
-bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMIIBIjANBgkqhkiG9w0BAQEF
-AAOCAQ8AMIIBCgKCAQEAtITMMxcua5Rsa2FSoOujz3mUTOWUgJnLVWREZY9nZOIG41w3SfYvm4SE
-Hi3yYJ0wTsyEheIszx6e/jarM3c1RNg1lho9Nuh6DtjVR6FqaYvZ/Ls6rnla1fTWcbuakCNrmreI
-dIcMHl+5ni36q1Mr3Lt2PpNMCAiMHqIjHNRqrSK6mQEubWXLviRmVSRLQESxG9fhwoXA3hA/Pe24
-/PHxI1Pcv2WXb9n5QHGNfb2V1M6+oF4nI979ptAmDgAp6zxG8D1gvz9Q0twmQVGeFDdCBKNwV6gb
-h+0t+nvujArjqWaJGctB+d1ENmHP4ndGyH329JKBNv3bNPFyfvMMFr20FQIDAQABo0IwQDAdBgNV
-HQ4EFgQUBx/S55zawm6iQLSwelAQUHTEyL0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
-AQYwDQYJKoZIhvcNAQEFBQADggEBAIlXshZ6qML91tmbmzTCnLQyFE2npN/svqe++EPbkTfOtDIu
-UFUaNU52Q3Eg75N3ThVwLofDwR1t3Mu1J9QsVtFSUzpE0nPIxBsFZVpikpzuQY0x2+c06lkh1QF6
-12S4ZDnNye2v7UsDSKegmQGA3GWjNq5lWUhPgkvIZfFXHeVZLgo/bNjR9eUJtGxUAArgFU2HdW23
-WJZa3W3SAKD0m0i+wzekujbgfIeFlxoVot4uolu9rxj5kFDNcFn4J2dHy8egBzp90SxdbBk6ZrV9
-/ZFvgrG+CJPbFEfxojfHRZ48x3evZKiT3/Zpg4Jg8klCNO1aAFSFHBY2kgxc+qatv9s=
------END CERTIFICATE-----
-
-AffirmTrust Premium
-===================
------BEGIN CERTIFICATE-----
-MIIFRjCCAy6gAwIBAgIIbYwURrGmCu4wDQYJKoZIhvcNAQEMBQAwQTELMAkGA1UEBhMCVVMxFDAS
-BgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMB4XDTEwMDEy
-OTE0MTAzNloXDTQwMTIzMTE0MTAzNlowQTELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRy
-dXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
-MIICCgKCAgEAxBLfqV/+Qd3d9Z+K4/as4Tx4mrzY8H96oDMq3I0gW64tb+eT2TZwamjPjlGjhVtn
-BKAQJG9dKILBl1fYSCkTtuG+kU3fhQxTGJoeJKJPj/CihQvL9Cl/0qRY7iZNyaqoe5rZ+jjeRFcV
-5fiMyNlI4g0WJx0eyIOFJbe6qlVBzAMiSy2RjYvmia9mx+n/K+k8rNrSs8PhaJyJ+HoAVt70VZVs
-+7pk3WKL3wt3MutizCaam7uqYoNMtAZ6MMgpv+0GTZe5HMQxK9VfvFMSF5yZVylmd2EhMQcuJUmd
-GPLu8ytxjLW6OQdJd/zvLpKQBY0tL3d770O/Nbua2Plzpyzy0FfuKE4mX4+QaAkvuPjcBukumj5R
-p9EixAqnOEhss/n/fauGV+O61oV4d7pD6kh/9ti+I20ev9E2bFhc8e6kGVQa9QPSdubhjL08s9NI
-S+LI+H+SqHZGnEJlPqQewQcDWkYtuJfzt9WyVSHvutxMAJf7FJUnM7/oQ0dG0giZFmA7mn7S5u04
-6uwBHjxIVkkJx0w3AJ6IDsBz4W9m6XJHMD4Q5QsDyZpCAGzFlH5hxIrff4IaC1nEWTJ3s7xgaVY5
-/bQGeyzWZDbZvUjthB9+pSKPKrhC9IK31FOQeE4tGv2Bb0TXOwF0lkLgAOIua+rF7nKsu7/+6qqo
-+Nz2snmKtmcCAwEAAaNCMEAwHQYDVR0OBBYEFJ3AZ6YMItkm9UWrpmVSESfYRaxjMA8GA1UdEwEB
-/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBDAUAA4ICAQCzV00QYk465KzquByv
-MiPIs0laUZx2KI15qldGF9X1Uva3ROgIRL8YhNILgM3FEv0AVQVhh0HctSSePMTYyPtwni94loMg
-Nt58D2kTiKV1NpgIpsbfrM7jWNa3Pt668+s0QNiigfV4Py/VpfzZotReBA4Xrf5B8OWycvpEgjNC
-6C1Y91aMYj+6QrCcDFx+LmUmXFNPALJ4fqENmS2NuB2OosSw/WDQMKSOyARiqcTtNd56l+0OOF6S
-L5Nwpamcb6d9Ex1+xghIsV5n61EIJenmJWtSKZGc0jlzCFfemQa0W50QBuHCAKi4HEoCChTQwUHK
-+4w1IX2COPKpVJEZNZOUbWo6xbLQu4mGk+ibyQ86p3q4ofB4Rvr8Ny/lioTz3/4E2aFooC8k4gmV
-BtWVyuEklut89pMFu+1z6S3RdTnX5yTb2E5fQ4+e0BQ5v1VwSJlXMbSc7kqYA5YwH2AG7hsj/oFg
-IxpHYoWlzBk0gG+zrBrjn/B7SK3VAdlntqlyk+otZrWyuOQ9PLLvTIzq6we/qzWaVYa8GKa1qF60
-g2xraUDTn9zxw2lrueFtCfTxqlB2Cnp9ehehVZZCmTEJ3WARjQUwfuaORtGdFNrHF+QFlozEJLUb
-zxQHskD4o55BhrwE0GuWyCqANP2/7waj3VjFhT0+j/6eKeC2uAloGRwYQw==
------END CERTIFICATE-----
-
-AffirmTrust Premium ECC
-=======================
------BEGIN CERTIFICATE-----
-MIIB/jCCAYWgAwIBAgIIdJclisc/elQwCgYIKoZIzj0EAwMwRTELMAkGA1UEBhMCVVMxFDASBgNV
-BAoMC0FmZmlybVRydXN0MSAwHgYDVQQDDBdBZmZpcm1UcnVzdCBQcmVtaXVtIEVDQzAeFw0xMDAx
-MjkxNDIwMjRaFw00MDEyMzExNDIwMjRaMEUxCzAJBgNVBAYTAlVTMRQwEgYDVQQKDAtBZmZpcm1U
-cnVzdDEgMB4GA1UEAwwXQWZmaXJtVHJ1c3QgUHJlbWl1bSBFQ0MwdjAQBgcqhkjOPQIBBgUrgQQA
-IgNiAAQNMF4bFZ0D0KF5Nbc6PJJ6yhUczWLznCZcBz3lVPqj1swS6vQUX+iOGasvLkjmrBhDeKzQ
-N8O9ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0GA1UdDgQW
-BBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAK
-BggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/VsaobgxCd05DhT1wV/GzTjxi+zygk8N53X
-57hG8f2h4nECMEJZh0PUUd+60wkyWs6Iflc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKM
-eQ==
------END CERTIFICATE-----
-
-Certum Trusted Network CA
-=========================
------BEGIN CERTIFICATE-----
-MIIDuzCCAqOgAwIBAgIDBETAMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNVBAYTAlBMMSIwIAYDVQQK
-ExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlv
-biBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBUcnVzdGVkIE5ldHdvcmsgQ0EwHhcNMDgxMDIy
-MTIwNzM3WhcNMjkxMjMxMTIwNzM3WjB+MQswCQYDVQQGEwJQTDEiMCAGA1UEChMZVW5pemV0byBU
-ZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
-MSIwIAYDVQQDExlDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENBMIIBIjANBgkqhkiG9w0BAQEFAAOC
-AQ8AMIIBCgKCAQEA4/t9o3K6wvDJFIf1awFO4W5AB7ptJ11/91sts1rHUV+rpDKmYYe2bg+G0jAC
-l/jXaVehGDldamR5xgFZrDwxSjh80gTSSyjoIF87B6LMTXPb865Px1bVWqeWifrzq2jUI4ZZJ88J
-J7ysbnKDHDBy3+Ci6dLhdHUZvSqeexVUBBvXQzmtVSjF4hq79MDkrjhJM8x2hZ85RdKknvISjFH4
-fOQtf/WsX+sWn7Et0brMkUJ3TCXJkDhv2/DM+44el1k+1WBO5gUo7Ul5E0u6SNsv+XLTOcr+H9g0
-cvW0QM8xAcPs3hEtF10fuFDRXhmnad4HMyjKUJX5p1TLVIZQRan5SQIDAQABo0IwQDAPBgNVHRMB
-Af8EBTADAQH/MB0GA1UdDgQWBBQIds3LB/8k9sXN7buQvOKEN0Z19zAOBgNVHQ8BAf8EBAMCAQYw
-DQYJKoZIhvcNAQEFBQADggEBAKaorSLOAT2mo/9i0Eidi15ysHhE49wcrwn9I0j6vSrEuVUEtRCj
-jSfeC4Jj0O7eDDd5QVsisrCaQVymcODU0HfLI9MA4GxWL+FpDQ3Zqr8hgVDZBqWo/5U30Kr+4rP1
-mS1FhIrlQgnXdAIv94nYmem8J9RHjboNRhx3zxSkHLmkMcScKHQDNP8zGSal6Q10tz6XxnboJ5aj
-Zt3hrvJBW8qYVoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI
-03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw=
------END CERTIFICATE-----
-
-Certinomis - Autorité Racine
-=============================
------BEGIN CERTIFICATE-----
-MIIFnDCCA4SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJGUjETMBEGA1UEChMK
-Q2VydGlub21pczEXMBUGA1UECxMOMDAwMiA0MzM5OTg5MDMxJjAkBgNVBAMMHUNlcnRpbm9taXMg
-LSBBdXRvcml0w6kgUmFjaW5lMB4XDTA4MDkxNzA4Mjg1OVoXDTI4MDkxNzA4Mjg1OVowYzELMAkG
-A1UEBhMCRlIxEzARBgNVBAoTCkNlcnRpbm9taXMxFzAVBgNVBAsTDjAwMDIgNDMzOTk4OTAzMSYw
-JAYDVQQDDB1DZXJ0aW5vbWlzIC0gQXV0b3JpdMOpIFJhY2luZTCCAiIwDQYJKoZIhvcNAQEBBQAD
-ggIPADCCAgoCggIBAJ2Fn4bT46/HsmtuM+Cet0I0VZ35gb5j2CN2DpdUzZlMGvE5x4jYF1AMnmHa
-wE5V3udauHpOd4cN5bjr+p5eex7Ezyh0x5P1FMYiKAT5kcOrJ3NqDi5N8y4oH3DfVS9O7cdxbwly
-Lu3VMpfQ8Vh30WC8Tl7bmoT2R2FFK/ZQpn9qcSdIhDWerP5pqZ56XjUl+rSnSTV3lqc2W+HN3yNw
-2F1MpQiD8aYkOBOo7C+ooWfHpi2GR+6K/OybDnT0K0kCe5B1jPyZOQE51kqJ5Z52qz6WKDgmi92N
-jMD2AR5vpTESOH2VwnHu7XSu5DaiQ3XV8QCb4uTXzEIDS3h65X27uK4uIJPT5GHfceF2Z5c/tt9q
-c1pkIuVC28+BA5PY9OMQ4HL2AHCs8MF6DwV/zzRpRbWT5BnbUhYjBYkOjUjkJW+zeL9i9Qf6lSTC
-lrLooyPCXQP8w9PlfMl1I9f09bze5N/NgL+RiH2nE7Q5uiy6vdFrzPOlKO1Enn1So2+WLhl+HPNb
-xxaOu2B9d2ZHVIIAEWBsMsGoOBvrbpgT1u449fCfDu/+MYHB0iSVL1N6aaLwD4ZFjliCK0wi1F6g
-530mJ0jfJUaNSih8hp75mxpZuWW/Bd22Ql095gBIgl4g9xGC3srYn+Y3RyYe63j3YcNBZFgCQfna
-4NH4+ej9Uji29YnfAgMBAAGjWzBZMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0G
-A1UdDgQWBBQNjLZh2kS40RR9w759XkjwzspqsDAXBgNVHSAEEDAOMAwGCiqBegFWAgIAAQEwDQYJ
-KoZIhvcNAQEFBQADggIBACQ+YAZ+He86PtvqrxyaLAEL9MW12Ukx9F1BjYkMTv9sov3/4gbIOZ/x
-WqndIlgVqIrTseYyCYIDbNc/CMf4uboAbbnW/FIyXaR/pDGUu7ZMOH8oMDX/nyNTt7buFHAAQCva
-R6s0fl6nVjBhK4tDrP22iCj1a7Y+YEq6QpA0Z43q619FVDsXrIvkxmUP7tCMXWY5zjKn2BCXwH40
-nJ+U8/aGH88bc62UeYdocMMzpXDn2NU4lG9jeeu/Cg4I58UvD0KgKxRA/yHgBcUn4YQRE7rWhh1B
-CxMjidPJC+iKunqjo3M3NYB9Ergzd0A4wPpeMNLytqOx1qKVl4GbUu1pTP+A5FPbVFsDbVRfsbjv
-JL1vnxHDx2TCDyhihWZeGnuyt++uNckZM6i4J9szVb9o4XVIRFb7zdNIu0eJOqxp9YDG5ERQL1TE
-qkPFMTFYvZbF6nVsmnWxTfj3l/+WFvKXTej28xH5On2KOG4Ey+HTRRWqpdEdnV1j6CTmNhTih60b
-WfVEm/vXd3wfAXBioSAaosUaKPQhA+4u2cGA6rnZgtZbdsLLO7XSAPCjDuGtbkD326C00EauFddE
-wk01+dIL8hf2rGbVJLJP0RyZwG71fet0BLj5TXcJ17TPBzAJ8bgAVtkXFhYKK4bfjwEZGuW7gmP/
-vgt2Fl43N+bYdJeimUV5
------END CERTIFICATE-----
-
-Root CA Generalitat Valenciana
-==============================
------BEGIN CERTIFICATE-----
-MIIGizCCBXOgAwIBAgIEO0XlaDANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJFUzEfMB0GA1UE
-ChMWR2VuZXJhbGl0YXQgVmFsZW5jaWFuYTEPMA0GA1UECxMGUEtJR1ZBMScwJQYDVQQDEx5Sb290
-IENBIEdlbmVyYWxpdGF0IFZhbGVuY2lhbmEwHhcNMDEwNzA2MTYyMjQ3WhcNMjEwNzAxMTUyMjQ3
-WjBoMQswCQYDVQQGEwJFUzEfMB0GA1UEChMWR2VuZXJhbGl0YXQgVmFsZW5jaWFuYTEPMA0GA1UE
-CxMGUEtJR1ZBMScwJQYDVQQDEx5Sb290IENBIEdlbmVyYWxpdGF0IFZhbGVuY2lhbmEwggEiMA0G
-CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDGKqtXETcvIorKA3Qdyu0togu8M1JAJke+WmmmO3I2
-F0zo37i7L3bhQEZ0ZQKQUgi0/6iMweDHiVYQOTPvaLRfX9ptI6GJXiKjSgbwJ/BXufjpTjJ3Cj9B
-ZPPrZe52/lSqfR0grvPXdMIKX/UIKFIIzFVd0g/bmoGlu6GzwZTNVOAydTGRGmKy3nXiz0+J2ZGQ
-D0EbtFpKd71ng+CT516nDOeB0/RSrFOyA8dEJvt55cs0YFAQexvba9dHq198aMpunUEDEO5rmXte
-JajCq+TA81yc477OMUxkHl6AovWDfgzWyoxVjr7gvkkHD6MkQXpYHYTqWBLI4bft75PelAgxAgMB
-AAGjggM7MIIDNzAyBggrBgEFBQcBAQQmMCQwIgYIKwYBBQUHMAGGFmh0dHA6Ly9vY3NwLnBraS5n
-dmEuZXMwEgYDVR0TAQH/BAgwBgEB/wIBAjCCAjQGA1UdIASCAiswggInMIICIwYKKwYBBAG/VQIB
-ADCCAhMwggHoBggrBgEFBQcCAjCCAdoeggHWAEEAdQB0AG8AcgBpAGQAYQBkACAAZABlACAAQwBl
-AHIAdABpAGYAaQBjAGEAYwBpAPMAbgAgAFIAYQDtAHoAIABkAGUAIABsAGEAIABHAGUAbgBlAHIA
-YQBsAGkAdABhAHQAIABWAGEAbABlAG4AYwBpAGEAbgBhAC4ADQAKAEwAYQAgAEQAZQBjAGwAYQBy
-AGEAYwBpAPMAbgAgAGQAZQAgAFAAcgDhAGMAdABpAGMAYQBzACAAZABlACAAQwBlAHIAdABpAGYA
-aQBjAGEAYwBpAPMAbgAgAHEAdQBlACAAcgBpAGcAZQAgAGUAbAAgAGYAdQBuAGMAaQBvAG4AYQBt
-AGkAZQBuAHQAbwAgAGQAZQAgAGwAYQAgAHAAcgBlAHMAZQBuAHQAZQAgAEEAdQB0AG8AcgBpAGQA
-YQBkACAAZABlACAAQwBlAHIAdABpAGYAaQBjAGEAYwBpAPMAbgAgAHMAZQAgAGUAbgBjAHUAZQBu
-AHQAcgBhACAAZQBuACAAbABhACAAZABpAHIAZQBjAGMAaQDzAG4AIAB3AGUAYgAgAGgAdAB0AHAA
-OgAvAC8AdwB3AHcALgBwAGsAaQAuAGcAdgBhAC4AZQBzAC8AYwBwAHMwJQYIKwYBBQUHAgEWGWh0
-dHA6Ly93d3cucGtpLmd2YS5lcy9jcHMwHQYDVR0OBBYEFHs100DSHHgZZu90ECjcPk+yeAT8MIGV
-BgNVHSMEgY0wgYqAFHs100DSHHgZZu90ECjcPk+yeAT8oWykajBoMQswCQYDVQQGEwJFUzEfMB0G
-A1UEChMWR2VuZXJhbGl0YXQgVmFsZW5jaWFuYTEPMA0GA1UECxMGUEtJR1ZBMScwJQYDVQQDEx5S
-b290IENBIEdlbmVyYWxpdGF0IFZhbGVuY2lhbmGCBDtF5WgwDQYJKoZIhvcNAQEFBQADggEBACRh
-TvW1yEICKrNcda3FbcrnlD+laJWIwVTAEGmiEi8YPyVQqHxK6sYJ2fR1xkDar1CdPaUWu20xxsdz
-Ckj+IHLtb8zog2EWRpABlUt9jppSCS/2bxzkoXHPjCpaF3ODR00PNvsETUlR4hTJZGH71BTg9J63
-NI8KJr2XXPR5OkowGcytT6CYirQxlyric21+eLj4iIlPsSKRZEv1UN4D2+XFducTZnV+ZfsBn5OH
-iJ35Rld8TWCvmHMTI6QgkYH60GFmuH3Rr9ZvHmw96RH9qfmCIoaZM3Fa6hlXPZHNqcCjbgcTpsnt
-+GijnsNacgmHKNHEc8RzGF9QdRYxn7fofMM=
------END CERTIFICATE-----
-
-A-Trust-nQual-03
-================
------BEGIN CERTIFICATE-----
-MIIDzzCCAregAwIBAgIDAWweMA0GCSqGSIb3DQEBBQUAMIGNMQswCQYDVQQGEwJBVDFIMEYGA1UE
-Cgw/QS1UcnVzdCBHZXMuIGYuIFNpY2hlcmhlaXRzc3lzdGVtZSBpbSBlbGVrdHIuIERhdGVudmVy
-a2VociBHbWJIMRkwFwYDVQQLDBBBLVRydXN0LW5RdWFsLTAzMRkwFwYDVQQDDBBBLVRydXN0LW5R
-dWFsLTAzMB4XDTA1MDgxNzIyMDAwMFoXDTE1MDgxNzIyMDAwMFowgY0xCzAJBgNVBAYTAkFUMUgw
-RgYDVQQKDD9BLVRydXN0IEdlcy4gZi4gU2ljaGVyaGVpdHNzeXN0ZW1lIGltIGVsZWt0ci4gRGF0
-ZW52ZXJrZWhyIEdtYkgxGTAXBgNVBAsMEEEtVHJ1c3QtblF1YWwtMDMxGTAXBgNVBAMMEEEtVHJ1
-c3QtblF1YWwtMDMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtPWFuA/OQO8BBC4SA
-zewqo51ru27CQoT3URThoKgtUaNR8t4j8DRE/5TrzAUjlUC5B3ilJfYKvUWG6Nm9wASOhURh73+n
-yfrBJcyFLGM/BWBzSQXgYHiVEEvc+RFZznF/QJuKqiTfC0Li21a8StKlDJu3Qz7dg9MmEALP6iPE
-SU7l0+m0iKsMrmKS1GWH2WrX9IWf5DMiJaXlyDO6w8dB3F/GaswADm0yqLaHNgBid5seHzTLkDx4
-iHQF63n1k3Flyp3HaxgtPVxO59X4PzF9j4fsCiIvI+n+u33J4PTs63zEsMMtYrWacdaxaujs2e3V
-cuy+VwHOBVWf3tFgiBCzAgMBAAGjNjA0MA8GA1UdEwEB/wQFMAMBAf8wEQYDVR0OBAoECERqlWdV
-eRFPMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAVdRU0VlIXLOThaq/Yy/kgM40
-ozRiPvbY7meIMQQDbwvUB/tOdQ/TLtPAF8fGKOwGDREkDg6lXb+MshOWcdzUzg4NCmgybLlBMRmr
-sQd7TZjTXLDR8KdCoLXEjq/+8T/0709GAHbrAvv5ndJAlseIOrifEXnzgGWovR/TeIGgUUw3tKZd
-JXDRZslo+S4RFGjxVJgIrCaSD96JntT6s3kr0qN51OyLrIdTaEJMUVF0HhsnLuP1Hyl0Te2v9+GS
-mYHovjrHF1D2t8b8m7CKa9aIA5GPBnc6hQLdmNVDeD/GMBWsm2vLV7eJUYs66MmEDNuxUCAKGkq6
-ahq97BvIxYSazQ==
------END CERTIFICATE-----
-
-TWCA Root Certification Authority
-=================================
------BEGIN CERTIFICATE-----
-MIIDezCCAmOgAwIBAgIBATANBgkqhkiG9w0BAQUFADBfMQswCQYDVQQGEwJUVzESMBAGA1UECgwJ
-VEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NBIFJvb3QgQ2VydGlmaWNh
-dGlvbiBBdXRob3JpdHkwHhcNMDgwODI4MDcyNDMzWhcNMzAxMjMxMTU1OTU5WjBfMQswCQYDVQQG
-EwJUVzESMBAGA1UECgwJVEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NB
-IFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
-AoIBAQCwfnK4pAOU5qfeCTiRShFAh6d8WWQUe7UREN3+v9XAu1bihSX0NXIP+FPQQeFEAcK0HMMx
-QhZHhTMidrIKbw/lJVBPhYa+v5guEGcevhEFhgWQxFnQfHgQsIBct+HHK3XLfJ+utdGdIzdjp9xC
-oi2SBBtQwXu4PhvJVgSLL1KbralW6cH/ralYhzC2gfeXRfwZVzsrb+RH9JlF/h3x+JejiB03HFyP
-4HYlmlD4oFT/RJB2I9IyxsOrBr/8+7/zrX2SYgJbKdM1o5OaQ2RgXbL6Mv87BK9NQGr5x+PvI/1r
-y+UPizgN7gr8/g+YnzAx3WxSZfmLgb4i4RxYA7qRG4kHAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIB
-BjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqOFsmjd6LWvJPelSDGRjjCDWmujANBgkqhkiG
-9w0BAQUFAAOCAQEAPNV3PdrfibqHDAhUaiBQkr6wQT25JmSDCi/oQMCXKCeCMErJk/9q56YAf4lC
-mtYR5VPOL8zy2gXE/uJQxDqGfczafhAJO5I1KlOy/usrBdlsXebQ79NqZp4VKIV66IIArB6nCWlW
-QtNoURi+VJq/REG6Sb4gumlc7rh3zc5sH62Dlhh9DrUUOYTxKOkto557HnpyWoOzeW/vtPzQCqVY
-T0bf+215WfKEIlKuD8z7fDvnaspHYcN6+NOSBB+4IIThNlQWx0DeO4pz3N/GCUzf7Nr/1FNCocny
-Yh0igzyXxfkZYiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw==
------END CERTIFICATE-----
-
-Security Communication RootCA2
-==============================
------BEGIN CERTIFICATE-----
-MIIDdzCCAl+gAwIBAgIBADANBgkqhkiG9w0BAQsFADBdMQswCQYDVQQGEwJKUDElMCMGA1UEChMc
-U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UECxMeU2VjdXJpdHkgQ29tbXVuaWNh
-dGlvbiBSb290Q0EyMB4XDTA5MDUyOTA1MDAzOVoXDTI5MDUyOTA1MDAzOVowXTELMAkGA1UEBhMC
-SlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xJzAlBgNVBAsTHlNlY3Vy
-aXR5IENvbW11bmljYXRpb24gUm9vdENBMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
-ANAVOVKxUrO6xVmCxF1SrjpDZYBLx/KWvNs2l9amZIyoXvDjChz335c9S672XewhtUGrzbl+dp++
-+T42NKA7wfYxEUV0kz1XgMX5iZnK5atq1LXaQZAQwdbWQonCv/Q4EpVMVAX3NuRFg3sUZdbcDE3R
-3n4MqzvEFb46VqZab3ZpUql6ucjrappdUtAtCms1FgkQhNBqyjoGADdH5H5XTz+L62e4iKrFvlNV
-spHEfbmwhRkGeC7bYRr6hfVKkaHnFtWOojnflLhwHyg/i/xAXmODPIMqGplrz95Zajv8bxbXH/1K
-EOtOghY6rCcMU/Gt1SSwawNQwS08Ft1ENCcadfsCAwEAAaNCMEAwHQYDVR0OBBYEFAqFqXdlBZh8
-QIH4D5csOPEK7DzPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEB
-CwUAA4IBAQBMOqNErLlFsceTfsgLCkLfZOoc7llsCLqJX2rKSpWeeo8HxdpFcoJxDjrSzG+ntKEj
-u/Ykn8sX/oymzsLS28yN/HH8AynBbF0zX2S2ZTuJbxh2ePXcokgfGT+Ok+vx+hfuzU7jBBJV1uXk
-3fs+BXziHV7Gp7yXT2g69ekuCkO2r1dcYmh8t/2jioSgrGK+KwmHNPBqAbubKVY8/gA3zyNs8U6q
-tnRGEmyR7jTV7JqR50S+kDFy1UkC9gLl9B/rfNmWVan/7Ir5mUf/NVoCqgTLiluHcSmRvaS0eg29
-mvVXIwAHIRc/SjnRBUkLp7Y3gaVdjKozXoEofKd9J+sAro03
------END CERTIFICATE-----
-
-EC-ACC
-======
------BEGIN CERTIFICATE-----
-MIIFVjCCBD6gAwIBAgIQ7is969Qh3hSoYqwE893EATANBgkqhkiG9w0BAQUFADCB8zELMAkGA1UE
-BhMCRVMxOzA5BgNVBAoTMkFnZW5jaWEgQ2F0YWxhbmEgZGUgQ2VydGlmaWNhY2lvIChOSUYgUS0w
-ODAxMTc2LUkpMSgwJgYDVQQLEx9TZXJ2ZWlzIFB1YmxpY3MgZGUgQ2VydGlmaWNhY2lvMTUwMwYD
-VQQLEyxWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5ldC92ZXJhcnJlbCAoYykwMzE1MDMGA1UE
-CxMsSmVyYXJxdWlhIEVudGl0YXRzIGRlIENlcnRpZmljYWNpbyBDYXRhbGFuZXMxDzANBgNVBAMT
-BkVDLUFDQzAeFw0wMzAxMDcyMzAwMDBaFw0zMTAxMDcyMjU5NTlaMIHzMQswCQYDVQQGEwJFUzE7
-MDkGA1UEChMyQWdlbmNpYSBDYXRhbGFuYSBkZSBDZXJ0aWZpY2FjaW8gKE5JRiBRLTA4MDExNzYt
-SSkxKDAmBgNVBAsTH1NlcnZlaXMgUHVibGljcyBkZSBDZXJ0aWZpY2FjaW8xNTAzBgNVBAsTLFZl
-Z2V1IGh0dHBzOi8vd3d3LmNhdGNlcnQubmV0L3ZlcmFycmVsIChjKTAzMTUwMwYDVQQLEyxKZXJh
-cnF1aWEgRW50aXRhdHMgZGUgQ2VydGlmaWNhY2lvIENhdGFsYW5lczEPMA0GA1UEAxMGRUMtQUND
-MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsyLHT+KXQpWIR4NA9h0X84NzJB5R85iK
-w5K4/0CQBXCHYMkAqbWUZRkiFRfCQ2xmRJoNBD45b6VLeqpjt4pEndljkYRm4CgPukLjbo73FCeT
-ae6RDqNfDrHrZqJyTxIThmV6PttPB/SnCWDaOkKZx7J/sxaVHMf5NLWUhdWZXqBIoH7nF2W4onW4
-HvPlQn2v7fOKSGRdghST2MDk/7NQcvJ29rNdQlB50JQ+awwAvthrDk4q7D7SzIKiGGUzE3eeml0a
-E9jD2z3Il3rucO2n5nzbcc8tlGLfbdb1OL4/pYUKGbio2Al1QnDE6u/LDsg0qBIimAy4E5S2S+zw
-0JDnJwIDAQABo4HjMIHgMB0GA1UdEQQWMBSBEmVjX2FjY0BjYXRjZXJ0Lm5ldDAPBgNVHRMBAf8E
-BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUoMOLRKo3pUW/l4Ba0fF4opvpXY0wfwYD
-VR0gBHgwdjB0BgsrBgEEAfV4AQMBCjBlMCwGCCsGAQUFBwIBFiBodHRwczovL3d3dy5jYXRjZXJ0
-Lm5ldC92ZXJhcnJlbDA1BggrBgEFBQcCAjApGidWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5l
-dC92ZXJhcnJlbCAwDQYJKoZIhvcNAQEFBQADggEBAKBIW4IB9k1IuDlVNZyAelOZ1Vr/sXE7zDkJ
-lF7W2u++AVtd0x7Y/X1PzaBB4DSTv8vihpw3kpBWHNzrKQXlxJ7HNd+KDM3FIUPpqojlNcAZQmNa
-Al6kSBg6hW/cnbw/nZzBh7h6YQjpdwt/cKt63dmXLGQehb+8dJahw3oS7AwaboMMPOhyRp/7SNVe
-l+axofjk70YllJyJ22k4vuxcDlbHZVHlUIiIv0LVKz3l+bqeLrPK9HOSAgu+TGbrIP65y7WZf+a2
-E/rKS03Z7lNGBjvGTq2TWoF+bCpLagVFjPIhpDGQh2xlnJ2lYJU6Un/10asIbvPuW/mIPX64b24D
-5EI=
------END CERTIFICATE-----
-
-Hellenic Academic and Research Institutions RootCA 2011
-=======================================================
------BEGIN CERTIFICATE-----
-MIIEMTCCAxmgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBlTELMAkGA1UEBhMCR1IxRDBCBgNVBAoT
-O0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9y
-aXR5MUAwPgYDVQQDEzdIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
-IFJvb3RDQSAyMDExMB4XDTExMTIwNjEzNDk1MloXDTMxMTIwMTEzNDk1MlowgZUxCzAJBgNVBAYT
-AkdSMUQwQgYDVQQKEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
-IENlcnQuIEF1dGhvcml0eTFAMD4GA1UEAxM3SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNo
-IEluc3RpdHV0aW9ucyBSb290Q0EgMjAxMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
-AKlTAOMupvaO+mDYLZU++CwqVE7NuYRhlFhPjz2L5EPzdYmNUeTDN9KKiE15HrcS3UN4SoqS5tdI
-1Q+kOilENbgH9mgdVc04UfCMJDGFr4PJfel3r+0ae50X+bOdOFAPplp5kYCvN66m0zH7tSYJnTxa
-71HFK9+WXesyHgLacEnsbgzImjeN9/E2YEsmLIKe0HjzDQ9jpFEw4fkrJxIH2Oq9GGKYsFk3fb7u
-8yBRQlqD75O6aRXxYp2fmTmCobd0LovUxQt7L/DICto9eQqakxylKHJzkUOap9FNhYS5qXSPFEDH
-3N6sQWRstBmbAmNtJGSPRLIl6s5ddAxjMlyNh+UCAwEAAaOBiTCBhjAPBgNVHRMBAf8EBTADAQH/
-MAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQUppFC/RNhSiOeCKQp5dgTBCPuQSUwRwYDVR0eBEAwPqA8
-MAWCAy5ncjAFggMuZXUwBoIELmVkdTAGggQub3JnMAWBAy5ncjAFgQMuZXUwBoEELmVkdTAGgQQu
-b3JnMA0GCSqGSIb3DQEBBQUAA4IBAQAf73lB4XtuP7KMhjdCSk4cNx6NZrokgclPEg8hwAOXhiVt
-XdMiKahsog2p6z0GW5k6x8zDmjR/qw7IThzh+uTczQ2+vyT+bOdrwg3IBp5OjWEopmr95fZi6hg8
-TqBTnbI6nOulnJEWtk2C4AwFSKls9cz4y51JtPACpf1wA+2KIaWuE4ZJwzNzvoc7dIsXRSZMFpGD
-/md9zU1jZ/rzAxKWeAaNsWftjj++n08C9bMJL/NMh98qy5V8AcysNnq/onN694/BtZqhFLKPM58N
-7yLcZnuEvUUXBj08yrl3NI/K6s8/MT7jiOOASSXIl7WdmplNsDz4SgCbZN2fOUvRJ9e4
------END CERTIFICATE-----
diff --git a/3rdparty/aws-sdk/lib/requestcore/requestcore.class.php b/3rdparty/aws-sdk/lib/requestcore/requestcore.class.php
deleted file mode 100755
index 087694f08cd..00000000000
--- a/3rdparty/aws-sdk/lib/requestcore/requestcore.class.php
+++ /dev/null
@@ -1,1028 +0,0 @@
-<?php
-/**
- * Handles all HTTP requests using cURL and manages the responses.
- *
- * @version 2012.01.17
- * @copyright 2006-2011 Ryan Parman
- * @copyright 2006-2010 Foleeo Inc.
- * @copyright 2010-2011 Amazon.com, Inc. or its affiliates.
- * @copyright 2008-2011 Contributors
- * @license http://opensource.org/licenses/bsd-license.php Simplified BSD License
- */
-class RequestCore
-{
- /**
- * The URL being requested.
- */
- public $request_url;
-
- /**
- * The headers being sent in the request.
- */
- public $request_headers;
-
- /**
- * The body being sent in the request.
- */
- public $request_body;
-
- /**
- * The response returned by the request.
- */
- public $response;
-
- /**
- * The headers returned by the request.
- */
- public $response_headers;
-
- /**
- * The body returned by the request.
- */
- public $response_body;
-
- /**
- * The HTTP status code returned by the request.
- */
- public $response_code;
-
- /**
- * Additional response data.
- */
- public $response_info;
-
- /**
- * The handle for the cURL object.
- */
- public $curl_handle;
-
- /**
- * The method by which the request is being made.
- */
- public $method;
-
- /**
- * Stores the proxy settings to use for the request.
- */
- public $proxy = null;
-
- /**
- * The username to use for the request.
- */
- public $username = null;
-
- /**
- * The password to use for the request.
- */
- public $password = null;
-
- /**
- * Custom CURLOPT settings.
- */
- public $curlopts = null;
-
- /**
- * The state of debug mode.
- */
- public $debug_mode = false;
-
- /**
- * The default class to use for HTTP Requests (defaults to <RequestCore>).
- */
- public $request_class = 'RequestCore';
-
- /**
- * The default class to use for HTTP Responses (defaults to <ResponseCore>).
- */
- public $response_class = 'ResponseCore';
-
- /**
- * Default useragent string to use.
- */
- public $useragent = 'RequestCore/1.4.4';
-
- /**
- * File to read from while streaming up.
- */
- public $read_file = null;
-
- /**
- * The resource to read from while streaming up.
- */
- public $read_stream = null;
-
- /**
- * The size of the stream to read from.
- */
- public $read_stream_size = null;
-
- /**
- * The length already read from the stream.
- */
- public $read_stream_read = 0;
-
- /**
- * File to write to while streaming down.
- */
- public $write_file = null;
-
- /**
- * The resource to write to while streaming down.
- */
- public $write_stream = null;
-
- /**
- * Stores the intended starting seek position.
- */
- public $seek_position = null;
-
- /**
- * The location of the cacert.pem file to use.
- */
- public $cacert_location = false;
-
- /**
- * The state of SSL certificate verification.
- */
- public $ssl_verification = true;
-
- /**
- * The user-defined callback function to call when a stream is read from.
- */
- public $registered_streaming_read_callback = null;
-
- /**
- * The user-defined callback function to call when a stream is written to.
- */
- public $registered_streaming_write_callback = null;
-
-
- /*%******************************************************************************************%*/
- // CONSTANTS
-
- /**
- * GET HTTP Method
- */
- const HTTP_GET = 'GET';
-
- /**
- * POST HTTP Method
- */
- const HTTP_POST = 'POST';
-
- /**
- * PUT HTTP Method
- */
- const HTTP_PUT = 'PUT';
-
- /**
- * DELETE HTTP Method
- */
- const HTTP_DELETE = 'DELETE';
-
- /**
- * HEAD HTTP Method
- */
- const HTTP_HEAD = 'HEAD';
-
-
- /*%******************************************************************************************%*/
- // CONSTRUCTOR/DESTRUCTOR
-
- /**
- * Constructs a new instance of this class.
- *
- * @param string $url (Optional) The URL to request or service endpoint to query.
- * @param string $proxy (Optional) The faux-url to use for proxy settings. Takes the following format: `proxy://user:pass@hostname:port`
- * @param array $helpers (Optional) An associative array of classnames to use for request, and response functionality. Gets passed in automatically by the calling class.
- * @return $this A reference to the current instance.
- */
- public function __construct($url = null, $proxy = null, $helpers = null)
- {
- // Set some default values.
- $this->request_url = $url;
- $this->method = self::HTTP_GET;
- $this->request_headers = array();
- $this->request_body = '';
-
- // Set a new Request class if one was set.
- if (isset($helpers['request']) && !empty($helpers['request']))
- {
- $this->request_class = $helpers['request'];
- }
-
- // Set a new Request class if one was set.
- if (isset($helpers['response']) && !empty($helpers['response']))
- {
- $this->response_class = $helpers['response'];
- }
-
- if ($proxy)
- {
- $this->set_proxy($proxy);
- }
-
- return $this;
- }
-
- /**
- * Destructs the instance. Closes opened file handles.
- *
- * @return $this A reference to the current instance.
- */
- public function __destruct()
- {
- if (isset($this->read_file) && isset($this->read_stream))
- {
- fclose($this->read_stream);
- }
-
- if (isset($this->write_file) && isset($this->write_stream))
- {
- fclose($this->write_stream);
- }
-
- return $this;
- }
-
-
- /*%******************************************************************************************%*/
- // REQUEST METHODS
-
- /**
- * Sets the credentials to use for authentication.
- *
- * @param string $user (Required) The username to authenticate with.
- * @param string $pass (Required) The password to authenticate with.
- * @return $this A reference to the current instance.
- */
- public function set_credentials($user, $pass)
- {
- $this->username = $user;
- $this->password = $pass;
- return $this;
- }
-
- /**
- * Adds a custom HTTP header to the cURL request.
- *
- * @param string $key (Required) The custom HTTP header to set.
- * @param mixed $value (Required) The value to assign to the custom HTTP header.
- * @return $this A reference to the current instance.
- */
- public function add_header($key, $value)
- {
- $this->request_headers[$key] = $value;
- return $this;
- }
-
- /**
- * Removes an HTTP header from the cURL request.
- *
- * @param string $key (Required) The custom HTTP header to set.
- * @return $this A reference to the current instance.
- */
- public function remove_header($key)
- {
- if (isset($this->request_headers[$key]))
- {
- unset($this->request_headers[$key]);
- }
- return $this;
- }
-
- /**
- * Set the method type for the request.
- *
- * @param string $method (Required) One of the following constants: <HTTP_GET>, <HTTP_POST>, <HTTP_PUT>, <HTTP_HEAD>, <HTTP_DELETE>.
- * @return $this A reference to the current instance.
- */
- public function set_method($method)
- {
- $this->method = strtoupper($method);
- return $this;
- }
-
- /**
- * Sets a custom useragent string for the class.
- *
- * @param string $ua (Required) The useragent string to use.
- * @return $this A reference to the current instance.
- */
- public function set_useragent($ua)
- {
- $this->useragent = $ua;
- return $this;
- }
-
- /**
- * Set the body to send in the request.
- *
- * @param string $body (Required) The textual content to send along in the body of the request.
- * @return $this A reference to the current instance.
- */
- public function set_body($body)
- {
- $this->request_body = $body;
- return $this;
- }
-
- /**
- * Set the URL to make the request to.
- *
- * @param string $url (Required) The URL to make the request to.
- * @return $this A reference to the current instance.
- */
- public function set_request_url($url)
- {
- $this->request_url = $url;
- return $this;
- }
-
- /**
- * Set additional CURLOPT settings. These will merge with the default settings, and override if
- * there is a duplicate.
- *
- * @param array $curlopts (Optional) A set of key-value pairs that set `CURLOPT` options. These will merge with the existing CURLOPTs, and ones passed here will override the defaults. Keys should be the `CURLOPT_*` constants, not strings.
- * @return $this A reference to the current instance.
- */
- public function set_curlopts($curlopts)
- {
- $this->curlopts = $curlopts;
- return $this;
- }
-
- /**
- * Sets the length in bytes to read from the stream while streaming up.
- *
- * @param integer $size (Required) The length in bytes to read from the stream.
- * @return $this A reference to the current instance.
- */
- public function set_read_stream_size($size)
- {
- $this->read_stream_size = $size;
-
- return $this;
- }
-
- /**
- * Sets the resource to read from while streaming up. Reads the stream from its current position until
- * EOF or `$size` bytes have been read. If `$size` is not given it will be determined by <php:fstat()> and
- * <php:ftell()>.
- *
- * @param resource $resource (Required) The readable resource to read from.
- * @param integer $size (Optional) The size of the stream to read.
- * @return $this A reference to the current instance.
- */
- public function set_read_stream($resource, $size = null)
- {
- if (!isset($size) || $size < 0)
- {
- $stats = fstat($resource);
-
- if ($stats && $stats['size'] >= 0)
- {
- $position = ftell($resource);
-
- if ($position !== false && $position >= 0)
- {
- $size = $stats['size'] - $position;
- }
- }
- }
-
- $this->read_stream = $resource;
-
- return $this->set_read_stream_size($size);
- }
-
- /**
- * Sets the file to read from while streaming up.
- *
- * @param string $location (Required) The readable location to read from.
- * @return $this A reference to the current instance.
- */
- public function set_read_file($location)
- {
- $this->read_file = $location;
- $read_file_handle = fopen($location, 'r');
-
- return $this->set_read_stream($read_file_handle);
- }
-
- /**
- * Sets the resource to write to while streaming down.
- *
- * @param resource $resource (Required) The writeable resource to write to.
- * @return $this A reference to the current instance.
- */
- public function set_write_stream($resource)
- {
- $this->write_stream = $resource;
-
- return $this;
- }
-
- /**
- * Sets the file to write to while streaming down.
- *
- * @param string $location (Required) The writeable location to write to.
- * @return $this A reference to the current instance.
- */
- public function set_write_file($location)
- {
- $this->write_file = $location;
- $write_file_handle = fopen($location, 'w');
-
- return $this->set_write_stream($write_file_handle);
- }
-
- /**
- * Set the proxy to use for making requests.
- *
- * @param string $proxy (Required) The faux-url to use for proxy settings. Takes the following format: `proxy://user:pass@hostname:port`
- * @return $this A reference to the current instance.
- */
- public function set_proxy($proxy)
- {
- $proxy = parse_url($proxy);
- $proxy['user'] = isset($proxy['user']) ? $proxy['user'] : null;
- $proxy['pass'] = isset($proxy['pass']) ? $proxy['pass'] : null;
- $proxy['port'] = isset($proxy['port']) ? $proxy['port'] : null;
- $this->proxy = $proxy;
- return $this;
- }
-
- /**
- * Set the intended starting seek position.
- *
- * @param integer $position (Required) The byte-position of the stream to begin reading from.
- * @return $this A reference to the current instance.
- */
- public function set_seek_position($position)
- {
- $this->seek_position = isset($position) ? (integer) $position : null;
-
- return $this;
- }
-
- /**
- * Register a callback function to execute whenever a data stream is read from using
- * <CFRequest::streaming_read_callback()>.
- *
- * The user-defined callback function should accept three arguments:
- *
- * <ul>
- * <li><code>$curl_handle</code> - <code>resource</code> - Required - The cURL handle resource that represents the in-progress transfer.</li>
- * <li><code>$file_handle</code> - <code>resource</code> - Required - The file handle resource that represents the file on the local file system.</li>
- * <li><code>$length</code> - <code>integer</code> - Required - The length in kilobytes of the data chunk that was transferred.</li>
- * </ul>
- *
- * @param string|array|function $callback (Required) The callback function is called by <php:call_user_func()>, so you can pass the following values: <ul>
- * <li>The name of a global function to execute, passed as a string.</li>
- * <li>A method to execute, passed as <code>array('ClassName', 'MethodName')</code>.</li>
- * <li>An anonymous function (PHP 5.3+).</li></ul>
- * @return $this A reference to the current instance.
- */
- public function register_streaming_read_callback($callback)
- {
- $this->registered_streaming_read_callback = $callback;
-
- return $this;
- }
-
- /**
- * Register a callback function to execute whenever a data stream is written to using
- * <CFRequest::streaming_write_callback()>.
- *
- * The user-defined callback function should accept two arguments:
- *
- * <ul>
- * <li><code>$curl_handle</code> - <code>resource</code> - Required - The cURL handle resource that represents the in-progress transfer.</li>
- * <li><code>$length</code> - <code>integer</code> - Required - The length in kilobytes of the data chunk that was transferred.</li>
- * </ul>
- *
- * @param string|array|function $callback (Required) The callback function is called by <php:call_user_func()>, so you can pass the following values: <ul>
- * <li>The name of a global function to execute, passed as a string.</li>
- * <li>A method to execute, passed as <code>array('ClassName', 'MethodName')</code>.</li>
- * <li>An anonymous function (PHP 5.3+).</li></ul>
- * @return $this A reference to the current instance.
- */
- public function register_streaming_write_callback($callback)
- {
- $this->registered_streaming_write_callback = $callback;
-
- return $this;
- }
-
-
- /*%******************************************************************************************%*/
- // PREPARE, SEND, AND PROCESS REQUEST
-
- /**
- * A callback function that is invoked by cURL for streaming up.
- *
- * @param resource $curl_handle (Required) The cURL handle for the request.
- * @param resource $file_handle (Required) The open file handle resource.
- * @param integer $length (Required) The maximum number of bytes to read.
- * @return binary Binary data from a stream.
- */
- public function streaming_read_callback($curl_handle, $file_handle, $length)
- {
- // Once we've sent as much as we're supposed to send...
- if ($this->read_stream_read >= $this->read_stream_size)
- {
- // Send EOF
- return '';
- }
-
- // If we're at the beginning of an upload and need to seek...
- if ($this->read_stream_read == 0 && isset($this->seek_position) && $this->seek_position !== ftell($this->read_stream))
- {
- if (fseek($this->read_stream, $this->seek_position) !== 0)
- {
- throw new RequestCore_Exception('The stream does not support seeking and is either not at the requested position or the position is unknown.');
- }
- }
-
- $read = fread($this->read_stream, min($this->read_stream_size - $this->read_stream_read, $length)); // Remaining upload data or cURL's requested chunk size
- $this->read_stream_read += strlen($read);
-
- $out = $read === false ? '' : $read;
-
- // Execute callback function
- if ($this->registered_streaming_read_callback)
- {
- call_user_func($this->registered_streaming_read_callback, $curl_handle, $file_handle, $out);
- }
-
- return $out;
- }
-
- /**
- * A callback function that is invoked by cURL for streaming down.
- *
- * @param resource $curl_handle (Required) The cURL handle for the request.
- * @param binary $data (Required) The data to write.
- * @return integer The number of bytes written.
- */
- public function streaming_write_callback($curl_handle, $data)
- {
- $length = strlen($data);
- $written_total = 0;
- $written_last = 0;
-
- while ($written_total < $length)
- {
- $written_last = fwrite($this->write_stream, substr($data, $written_total));
-
- if ($written_last === false)
- {
- return $written_total;
- }
-
- $written_total += $written_last;
- }
-
- // Execute callback function
- if ($this->registered_streaming_write_callback)
- {
- call_user_func($this->registered_streaming_write_callback, $curl_handle, $written_total);
- }
-
- return $written_total;
- }
-
- /**
- * Prepares and adds the details of the cURL request. This can be passed along to a <php:curl_multi_exec()>
- * function.
- *
- * @return resource The handle for the cURL object.
- */
- public function prep_request()
- {
- $curl_handle = curl_init();
-
- // Set default options.
- curl_setopt($curl_handle, CURLOPT_URL, $this->request_url);
- curl_setopt($curl_handle, CURLOPT_FILETIME, true);
- curl_setopt($curl_handle, CURLOPT_FRESH_CONNECT, false);
- curl_setopt($curl_handle, CURLOPT_CLOSEPOLICY, CURLCLOSEPOLICY_LEAST_RECENTLY_USED);
- curl_setopt($curl_handle, CURLOPT_MAXREDIRS, 5);
- curl_setopt($curl_handle, CURLOPT_HEADER, true);
- curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($curl_handle, CURLOPT_TIMEOUT, 5184000);
- curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 120);
- curl_setopt($curl_handle, CURLOPT_NOSIGNAL, true);
- curl_setopt($curl_handle, CURLOPT_REFERER, $this->request_url);
- curl_setopt($curl_handle, CURLOPT_USERAGENT, $this->useragent);
- curl_setopt($curl_handle, CURLOPT_READFUNCTION, array($this, 'streaming_read_callback'));
-
- // Verification of the SSL cert
- if ($this->ssl_verification)
- {
- curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, true);
- curl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, 2);
- }
- else
- {
- curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, false);
- }
-
- // chmod the file as 0755
- if ($this->cacert_location === true)
- {
- curl_setopt($curl_handle, CURLOPT_CAINFO, dirname(__FILE__) . '/cacert.pem');
- }
- elseif (is_string($this->cacert_location))
- {
- curl_setopt($curl_handle, CURLOPT_CAINFO, $this->cacert_location);
- }
-
- // Debug mode
- if ($this->debug_mode)
- {
- curl_setopt($curl_handle, CURLOPT_VERBOSE, true);
- }
-
- // Handle open_basedir & safe mode
- if (!ini_get('safe_mode') && !ini_get('open_basedir'))
- {
- curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, true);
- }
-
- // Enable a proxy connection if requested.
- if ($this->proxy)
- {
- curl_setopt($curl_handle, CURLOPT_HTTPPROXYTUNNEL, true);
-
- $host = $this->proxy['host'];
- $host .= ($this->proxy['port']) ? ':' . $this->proxy['port'] : '';
- curl_setopt($curl_handle, CURLOPT_PROXY, $host);
-
- if (isset($this->proxy['user']) && isset($this->proxy['pass']))
- {
- curl_setopt($curl_handle, CURLOPT_PROXYUSERPWD, $this->proxy['user'] . ':' . $this->proxy['pass']);
- }
- }
-
- // Set credentials for HTTP Basic/Digest Authentication.
- if ($this->username && $this->password)
- {
- curl_setopt($curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
- curl_setopt($curl_handle, CURLOPT_USERPWD, $this->username . ':' . $this->password);
- }
-
- // Handle the encoding if we can.
- if (extension_loaded('zlib'))
- {
- curl_setopt($curl_handle, CURLOPT_ENCODING, 'gzip, deflate');
- }
-
- // Process custom headers
- if (isset($this->request_headers) && count($this->request_headers))
- {
- $temp_headers = array();
-
- foreach ($this->request_headers as $k => $v)
- {
- $temp_headers[] = $k . ': ' . $v;
- }
-
- curl_setopt($curl_handle, CURLOPT_HTTPHEADER, $temp_headers);
- }
-
- switch ($this->method)
- {
- case self::HTTP_PUT:
- curl_setopt($curl_handle, CURLOPT_CUSTOMREQUEST, 'PUT');
- if (isset($this->read_stream))
- {
- if (!isset($this->read_stream_size) || $this->read_stream_size < 0)
- {
- throw new RequestCore_Exception('The stream size for the streaming upload cannot be determined.');
- }
-
- curl_setopt($curl_handle, CURLOPT_INFILESIZE, $this->read_stream_size);
- curl_setopt($curl_handle, CURLOPT_UPLOAD, true);
- }
- else
- {
- curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $this->request_body);
- }
- break;
-
- case self::HTTP_POST:
- curl_setopt($curl_handle, CURLOPT_POST, true);
- curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $this->request_body);
- break;
-
- case self::HTTP_HEAD:
- curl_setopt($curl_handle, CURLOPT_CUSTOMREQUEST, self::HTTP_HEAD);
- curl_setopt($curl_handle, CURLOPT_NOBODY, 1);
- break;
-
- default: // Assumed GET
- curl_setopt($curl_handle, CURLOPT_CUSTOMREQUEST, $this->method);
- if (isset($this->write_stream))
- {
- curl_setopt($curl_handle, CURLOPT_WRITEFUNCTION, array($this, 'streaming_write_callback'));
- curl_setopt($curl_handle, CURLOPT_HEADER, false);
- }
- else
- {
- curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $this->request_body);
- }
- break;
- }
-
- // Merge in the CURLOPTs
- if (isset($this->curlopts) && sizeof($this->curlopts) > 0)
- {
- foreach ($this->curlopts as $k => $v)
- {
- curl_setopt($curl_handle, $k, $v);
- }
- }
-
- return $curl_handle;
- }
-
- /**
- * Take the post-processed cURL data and break it down into useful header/body/info chunks. Uses the
- * data stored in the `curl_handle` and `response` properties unless replacement data is passed in via
- * parameters.
- *
- * @param resource $curl_handle (Optional) The reference to the already executed cURL request.
- * @param string $response (Optional) The actual response content itself that needs to be parsed.
- * @return ResponseCore A <ResponseCore> object containing a parsed HTTP response.
- */
- public function process_response($curl_handle = null, $response = null)
- {
- // Accept a custom one if it's passed.
- if ($curl_handle && $response)
- {
- $this->curl_handle = $curl_handle;
- $this->response = $response;
- }
-
- // As long as this came back as a valid resource...
- if (is_resource($this->curl_handle))
- {
- // Determine what's what.
- $header_size = curl_getinfo($this->curl_handle, CURLINFO_HEADER_SIZE);
- $this->response_headers = substr($this->response, 0, $header_size);
- $this->response_body = substr($this->response, $header_size);
- $this->response_code = curl_getinfo($this->curl_handle, CURLINFO_HTTP_CODE);
- $this->response_info = curl_getinfo($this->curl_handle);
-
- // Parse out the headers
- $this->response_headers = explode("\r\n\r\n", trim($this->response_headers));
- $this->response_headers = array_pop($this->response_headers);
- $this->response_headers = explode("\r\n", $this->response_headers);
- array_shift($this->response_headers);
-
- // Loop through and split up the headers.
- $header_assoc = array();
- foreach ($this->response_headers as $header)
- {
- $kv = explode(': ', $header);
- $header_assoc[strtolower($kv[0])] = $kv[1];
- }
-
- // Reset the headers to the appropriate property.
- $this->response_headers = $header_assoc;
- $this->response_headers['_info'] = $this->response_info;
- $this->response_headers['_info']['method'] = $this->method;
-
- if ($curl_handle && $response)
- {
- return new $this->response_class($this->response_headers, $this->response_body, $this->response_code, $this->curl_handle);
- }
- }
-
- // Return false
- return false;
- }
-
- /**
- * Sends the request, calling necessary utility functions to update built-in properties.
- *
- * @param boolean $parse (Optional) Whether to parse the response with ResponseCore or not.
- * @return string The resulting unparsed data from the request.
- */
- public function send_request($parse = false)
- {
- set_time_limit(0);
-
- $curl_handle = $this->prep_request();
- $this->response = curl_exec($curl_handle);
-
- if ($this->response === false)
- {
- throw new cURL_Exception('cURL resource: ' . (string) $curl_handle . '; cURL error: ' . curl_error($curl_handle) . ' (cURL error code ' . curl_errno($curl_handle) . '). See http://curl.haxx.se/libcurl/c/libcurl-errors.html for an explanation of error codes.');
- }
-
- $parsed_response = $this->process_response($curl_handle, $this->response);
-
- curl_close($curl_handle);
-
- if ($parse)
- {
- return $parsed_response;
- }
-
- return $this->response;
- }
-
- /**
- * Sends the request using <php:curl_multi_exec()>, enabling parallel requests. Uses the "rolling" method.
- *
- * @param array $handles (Required) An indexed array of cURL handles to process simultaneously.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>callback</code> - <code>string|array</code> - Optional - The string name of a function to pass the response data to. If this is a method, pass an array where the <code>[0]</code> index is the class and the <code>[1]</code> index is the method name.</li>
- * <li><code>limit</code> - <code>integer</code> - Optional - The number of simultaneous requests to make. This can be useful for scaling around slow server responses. Defaults to trusting cURLs judgement as to how many to use.</li></ul>
- * @return array Post-processed cURL responses.
- */
- public function send_multi_request($handles, $opt = null)
- {
- set_time_limit(0);
-
- // Skip everything if there are no handles to process.
- if (count($handles) === 0) return array();
-
- if (!$opt) $opt = array();
-
- // Initialize any missing options
- $limit = isset($opt['limit']) ? $opt['limit'] : -1;
-
- // Initialize
- $handle_list = $handles;
- $http = new $this->request_class();
- $multi_handle = curl_multi_init();
- $handles_post = array();
- $added = count($handles);
- $last_handle = null;
- $count = 0;
- $i = 0;
-
- // Loop through the cURL handles and add as many as it set by the limit parameter.
- while ($i < $added)
- {
- if ($limit > 0 && $i >= $limit) break;
- curl_multi_add_handle($multi_handle, array_shift($handles));
- $i++;
- }
-
- do
- {
- $active = false;
-
- // Start executing and wait for a response.
- while (($status = curl_multi_exec($multi_handle, $active)) === CURLM_CALL_MULTI_PERFORM)
- {
- // Start looking for possible responses immediately when we have to add more handles
- if (count($handles) > 0) break;
- }
-
- // Figure out which requests finished.
- $to_process = array();
-
- while ($done = curl_multi_info_read($multi_handle))
- {
- // Since curl_errno() isn't reliable for handles that were in multirequests, we check the 'result' of the info read, which contains the curl error number, (listed here http://curl.haxx.se/libcurl/c/libcurl-errors.html )
- if ($done['result'] > 0)
- {
- throw new cURL_Multi_Exception('cURL resource: ' . (string) $done['handle'] . '; cURL error: ' . curl_error($done['handle']) . ' (cURL error code ' . $done['result'] . '). See http://curl.haxx.se/libcurl/c/libcurl-errors.html for an explanation of error codes.');
- }
-
- // Because curl_multi_info_read() might return more than one message about a request, we check to see if this request is already in our array of completed requests
- elseif (!isset($to_process[(int) $done['handle']]))
- {
- $to_process[(int) $done['handle']] = $done;
- }
- }
-
- // Actually deal with the request
- foreach ($to_process as $pkey => $done)
- {
- $response = $http->process_response($done['handle'], curl_multi_getcontent($done['handle']));
- $key = array_search($done['handle'], $handle_list, true);
- $handles_post[$key] = $response;
-
- if (count($handles) > 0)
- {
- curl_multi_add_handle($multi_handle, array_shift($handles));
- }
-
- curl_multi_remove_handle($multi_handle, $done['handle']);
- curl_close($done['handle']);
- }
- }
- while ($active || count($handles_post) < $added);
-
- curl_multi_close($multi_handle);
-
- ksort($handles_post, SORT_NUMERIC);
- return $handles_post;
- }
-
-
- /*%******************************************************************************************%*/
- // RESPONSE METHODS
-
- /**
- * Get the HTTP response headers from the request.
- *
- * @param string $header (Optional) A specific header value to return. Defaults to all headers.
- * @return string|array All or selected header values.
- */
- public function get_response_header($header = null)
- {
- if ($header)
- {
- return $this->response_headers[strtolower($header)];
- }
- return $this->response_headers;
- }
-
- /**
- * Get the HTTP response body from the request.
- *
- * @return string The response body.
- */
- public function get_response_body()
- {
- return $this->response_body;
- }
-
- /**
- * Get the HTTP response code from the request.
- *
- * @return string The HTTP response code.
- */
- public function get_response_code()
- {
- return $this->response_code;
- }
-}
-
-
-/**
- * Container for all response-related methods.
- */
-class ResponseCore
-{
- /**
- * Stores the HTTP header information.
- */
- public $header;
-
- /**
- * Stores the SimpleXML response.
- */
- public $body;
-
- /**
- * Stores the HTTP response code.
- */
- public $status;
-
- /**
- * Constructs a new instance of this class.
- *
- * @param array $header (Required) Associative array of HTTP headers (typically returned by <RequestCore::get_response_header()>).
- * @param string $body (Required) XML-formatted response from AWS.
- * @param integer $status (Optional) HTTP response status code from the request.
- * @return object Contains an <php:array> `header` property (HTTP headers as an associative array), a <php:SimpleXMLElement> or <php:string> `body` property, and an <php:integer> `status` code.
- */
- public function __construct($header, $body, $status = null)
- {
- $this->header = $header;
- $this->body = $body;
- $this->status = $status;
-
- return $this;
- }
-
- /**
- * Did we receive the status code we expected?
- *
- * @param integer|array $codes (Optional) The status code(s) to expect. Pass an <php:integer> for a single acceptable value, or an <php:array> of integers for multiple acceptable values.
- * @return boolean Whether we received the expected status code or not.
- */
- public function isOK($codes = array(200, 201, 204, 206))
- {
- if (is_array($codes))
- {
- return in_array($this->status, $codes);
- }
-
- return $this->status === $codes;
- }
-}
-
-class cURL_Exception extends Exception {}
-class cURL_Multi_Exception extends cURL_Exception {}
-class RequestCore_Exception extends Exception {}
diff --git a/3rdparty/aws-sdk/lib/yaml/LICENSE b/3rdparty/aws-sdk/lib/yaml/LICENSE
deleted file mode 100644
index 3cef853170e..00000000000
--- a/3rdparty/aws-sdk/lib/yaml/LICENSE
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (c) 2008-2009 Fabien Potencier
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is furnished
-to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/3rdparty/aws-sdk/lib/yaml/README.markdown b/3rdparty/aws-sdk/lib/yaml/README.markdown
deleted file mode 100644
index e4f80cfbac4..00000000000
--- a/3rdparty/aws-sdk/lib/yaml/README.markdown
+++ /dev/null
@@ -1,15 +0,0 @@
-Symfony YAML: A PHP library that speaks YAML
-============================================
-
-Symfony YAML is a PHP library that parses YAML strings and converts them to
-PHP arrays. It can also converts PHP arrays to YAML strings. Its official
-website is at http://components.symfony-project.org/yaml/.
-
-The documentation is to be found in the `doc/` directory.
-
-Symfony YAML is licensed under the MIT license (see LICENSE file).
-
-The Symfony YAML library is developed and maintained by the
-[symfony](http://www.symfony-project.org/) project team. It has been extracted
-from symfony to be used as a standalone library. Symfony YAML is part of the
-[symfony components project](http://components.symfony-project.org/).
diff --git a/3rdparty/aws-sdk/lib/yaml/lib/sfYaml.php b/3rdparty/aws-sdk/lib/yaml/lib/sfYaml.php
deleted file mode 100644
index 1d89ccc9736..00000000000
--- a/3rdparty/aws-sdk/lib/yaml/lib/sfYaml.php
+++ /dev/null
@@ -1,135 +0,0 @@
-<?php
-
-/*
- * This file is part of the symfony package.
- * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-/**
- * sfYaml offers convenience methods to load and dump YAML.
- *
- * @package symfony
- * @subpackage yaml
- * @author Fabien Potencier <fabien.potencier@symfony-project.com>
- * @version SVN: $Id: sfYaml.class.php 8988 2008-05-15 20:24:26Z fabien $
- */
-class sfYaml
-{
- static protected
- $spec = '1.2';
-
- /**
- * Sets the YAML specification version to use.
- *
- * @param string $version The YAML specification version
- */
- static public function setSpecVersion($version)
- {
- if (!in_array($version, array('1.1', '1.2')))
- {
- throw new InvalidArgumentException(sprintf('Version %s of the YAML specifications is not supported', $version));
- }
-
- self::$spec = $version;
- }
-
- /**
- * Gets the YAML specification version to use.
- *
- * @return string The YAML specification version
- */
- static public function getSpecVersion()
- {
- return self::$spec;
- }
-
- /**
- * Loads YAML into a PHP array.
- *
- * The load method, when supplied with a YAML stream (string or file),
- * will do its best to convert YAML in a file into a PHP array.
- *
- * Usage:
- * <code>
- * $array = sfYaml::load('config.yml');
- * print_r($array);
- * </code>
- *
- * @param string $input Path of YAML file or string containing YAML
- *
- * @return array The YAML converted to a PHP array
- *
- * @throws InvalidArgumentException If the YAML is not valid
- */
- public static function load($input)
- {
- $file = '';
-
- // if input is a file, process it
- if (strpos($input, "\n") === false && is_file($input))
- {
- $file = $input;
-
- ob_start();
- $retval = include($input);
- $content = ob_get_clean();
-
- // if an array is returned by the config file assume it's in plain php form else in YAML
- $input = is_array($retval) ? $retval : $content;
- }
-
- // if an array is returned by the config file assume it's in plain php form else in YAML
- if (is_array($input))
- {
- return $input;
- }
-
- require_once dirname(__FILE__).'/sfYamlParser.php';
-
- $yaml = new sfYamlParser();
-
- try
- {
- $ret = $yaml->parse($input);
- }
- catch (Exception $e)
- {
- throw new InvalidArgumentException(sprintf('Unable to parse %s: %s', $file ? sprintf('file "%s"', $file) : 'string', $e->getMessage()));
- }
-
- return $ret;
- }
-
- /**
- * Dumps a PHP array to a YAML string.
- *
- * The dump method, when supplied with an array, will do its best
- * to convert the array into friendly YAML.
- *
- * @param array $array PHP array
- * @param integer $inline The level where you switch to inline YAML
- *
- * @return string A YAML string representing the original PHP array
- */
- public static function dump($array, $inline = 2)
- {
- require_once dirname(__FILE__).'/sfYamlDumper.php';
-
- $yaml = new sfYamlDumper();
-
- return $yaml->dump($array, $inline);
- }
-}
-
-/**
- * Wraps echo to automatically provide a newline.
- *
- * @param string $string The string to echo with new line
- */
-function echoln($string)
-{
- echo $string."\n";
-}
diff --git a/3rdparty/aws-sdk/lib/yaml/lib/sfYamlDumper.php b/3rdparty/aws-sdk/lib/yaml/lib/sfYamlDumper.php
deleted file mode 100644
index 0ada2b37d21..00000000000
--- a/3rdparty/aws-sdk/lib/yaml/lib/sfYamlDumper.php
+++ /dev/null
@@ -1,60 +0,0 @@
-<?php
-
-/*
- * This file is part of the symfony package.
- * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-require_once(dirname(__FILE__).'/sfYamlInline.php');
-
-/**
- * sfYamlDumper dumps PHP variables to YAML strings.
- *
- * @package symfony
- * @subpackage yaml
- * @author Fabien Potencier <fabien.potencier@symfony-project.com>
- * @version SVN: $Id: sfYamlDumper.class.php 10575 2008-08-01 13:08:42Z nicolas $
- */
-class sfYamlDumper
-{
- /**
- * Dumps a PHP value to YAML.
- *
- * @param mixed $input The PHP value
- * @param integer $inline The level where you switch to inline YAML
- * @param integer $indent The level o indentation indentation (used internally)
- *
- * @return string The YAML representation of the PHP value
- */
- public function dump($input, $inline = 0, $indent = 0)
- {
- $output = '';
- $prefix = $indent ? str_repeat(' ', $indent) : '';
-
- if ($inline <= 0 || !is_array($input) || empty($input))
- {
- $output .= $prefix.sfYamlInline::dump($input);
- }
- else
- {
- $isAHash = array_keys($input) !== range(0, count($input) - 1);
-
- foreach ($input as $key => $value)
- {
- $willBeInlined = $inline - 1 <= 0 || !is_array($value) || empty($value);
-
- $output .= sprintf('%s%s%s%s',
- $prefix,
- $isAHash ? sfYamlInline::dump($key).':' : '-',
- $willBeInlined ? ' ' : "\n",
- $this->dump($value, $inline - 1, $willBeInlined ? 0 : $indent + 2)
- ).($willBeInlined ? "\n" : '');
- }
- }
-
- return $output;
- }
-}
diff --git a/3rdparty/aws-sdk/lib/yaml/lib/sfYamlInline.php b/3rdparty/aws-sdk/lib/yaml/lib/sfYamlInline.php
deleted file mode 100644
index 66edb4f07ab..00000000000
--- a/3rdparty/aws-sdk/lib/yaml/lib/sfYamlInline.php
+++ /dev/null
@@ -1,442 +0,0 @@
-<?php
-
-/*
- * This file is part of the symfony package.
- * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-require_once dirname(__FILE__).'/sfYaml.php';
-
-/**
- * sfYamlInline implements a YAML parser/dumper for the YAML inline syntax.
- *
- * @package symfony
- * @subpackage yaml
- * @author Fabien Potencier <fabien.potencier@symfony-project.com>
- * @version SVN: $Id: sfYamlInline.class.php 16177 2009-03-11 08:32:48Z fabien $
- */
-class sfYamlInline
-{
- const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\']*(?:\'\'[^\']*)*)\')';
-
- /**
- * Convert a YAML string to a PHP array.
- *
- * @param string $value A YAML string
- *
- * @return array A PHP array representing the YAML string
- */
- static public function load($value)
- {
- $value = trim($value);
-
- if (0 == strlen($value))
- {
- return '';
- }
-
- if (function_exists('mb_internal_encoding') && ((int) ini_get('mbstring.func_overload')) & 2)
- {
- $mbEncoding = mb_internal_encoding();
- mb_internal_encoding('ASCII');
- }
-
- switch ($value[0])
- {
- case '[':
- $result = self::parseSequence($value);
- break;
- case '{':
- $result = self::parseMapping($value);
- break;
- default:
- $result = self::parseScalar($value);
- }
-
- if (isset($mbEncoding))
- {
- mb_internal_encoding($mbEncoding);
- }
-
- return $result;
- }
-
- /**
- * Dumps a given PHP variable to a YAML string.
- *
- * @param mixed $value The PHP variable to convert
- *
- * @return string The YAML string representing the PHP array
- */
- static public function dump($value)
- {
- if ('1.1' === sfYaml::getSpecVersion())
- {
- $trueValues = array('true', 'on', '+', 'yes', 'y');
- $falseValues = array('false', 'off', '-', 'no', 'n');
- }
- else
- {
- $trueValues = array('true');
- $falseValues = array('false');
- }
-
- switch (true)
- {
- case is_resource($value):
- throw new InvalidArgumentException('Unable to dump PHP resources in a YAML file.');
- case is_object($value):
- return '!!php/object:'.serialize($value);
- case is_array($value):
- return self::dumpArray($value);
- case null === $value:
- return 'null';
- case true === $value:
- return 'true';
- case false === $value:
- return 'false';
- case ctype_digit($value):
- return is_string($value) ? "'$value'" : (int) $value;
- case is_numeric($value):
- return is_infinite($value) ? str_ireplace('INF', '.Inf', strval($value)) : (is_string($value) ? "'$value'" : $value);
- case false !== strpos($value, "\n") || false !== strpos($value, "\r"):
- return sprintf('"%s"', str_replace(array('"', "\n", "\r"), array('\\"', '\n', '\r'), $value));
- case preg_match('/[ \s \' " \: \{ \} \[ \] , & \* \# \?] | \A[ - ? | < > = ! % @ ` ]/x', $value):
- return sprintf("'%s'", str_replace('\'', '\'\'', $value));
- case '' == $value:
- return "''";
- case preg_match(self::getTimestampRegex(), $value):
- return "'$value'";
- case in_array(strtolower($value), $trueValues):
- return "'$value'";
- case in_array(strtolower($value), $falseValues):
- return "'$value'";
- case in_array(strtolower($value), array('null', '~')):
- return "'$value'";
- default:
- return $value;
- }
- }
-
- /**
- * Dumps a PHP array to a YAML string.
- *
- * @param array $value The PHP array to dump
- *
- * @return string The YAML string representing the PHP array
- */
- static protected function dumpArray($value)
- {
- // array
- $keys = array_keys($value);
- if (
- (1 == count($keys) && '0' == $keys[0])
- ||
- (count($keys) > 1 && array_reduce($keys, create_function('$v,$w', 'return (integer) $v + $w;'), 0) == count($keys) * (count($keys) - 1) / 2))
- {
- $output = array();
- foreach ($value as $val)
- {
- $output[] = self::dump($val);
- }
-
- return sprintf('[%s]', implode(', ', $output));
- }
-
- // mapping
- $output = array();
- foreach ($value as $key => $val)
- {
- $output[] = sprintf('%s: %s', self::dump($key), self::dump($val));
- }
-
- return sprintf('{ %s }', implode(', ', $output));
- }
-
- /**
- * Parses a scalar to a YAML string.
- *
- * @param scalar $scalar
- * @param string $delimiters
- * @param array $stringDelimiter
- * @param integer $i
- * @param boolean $evaluate
- *
- * @return string A YAML string
- */
- static public function parseScalar($scalar, $delimiters = null, $stringDelimiters = array('"', "'"), &$i = 0, $evaluate = true)
- {
- if (in_array($scalar[$i], $stringDelimiters))
- {
- // quoted scalar
- $output = self::parseQuotedScalar($scalar, $i);
- }
- else
- {
- // "normal" string
- if (!$delimiters)
- {
- $output = substr($scalar, $i);
- $i += strlen($output);
-
- // remove comments
- if (false !== $strpos = strpos($output, ' #'))
- {
- $output = rtrim(substr($output, 0, $strpos));
- }
- }
- else if (preg_match('/^(.+?)('.implode('|', $delimiters).')/', substr($scalar, $i), $match))
- {
- $output = $match[1];
- $i += strlen($output);
- }
- else
- {
- throw new InvalidArgumentException(sprintf('Malformed inline YAML string (%s).', $scalar));
- }
-
- $output = $evaluate ? self::evaluateScalar($output) : $output;
- }
-
- return $output;
- }
-
- /**
- * Parses a quoted scalar to YAML.
- *
- * @param string $scalar
- * @param integer $i
- *
- * @return string A YAML string
- */
- static protected function parseQuotedScalar($scalar, &$i)
- {
- if (!preg_match('/'.self::REGEX_QUOTED_STRING.'/A', substr($scalar, $i), $match))
- {
- throw new InvalidArgumentException(sprintf('Malformed inline YAML string (%s).', substr($scalar, $i)));
- }
-
- $output = substr($match[0], 1, strlen($match[0]) - 2);
-
- if ('"' == $scalar[$i])
- {
- // evaluate the string
- $output = str_replace(array('\\"', '\\n', '\\r'), array('"', "\n", "\r"), $output);
- }
- else
- {
- // unescape '
- $output = str_replace('\'\'', '\'', $output);
- }
-
- $i += strlen($match[0]);
-
- return $output;
- }
-
- /**
- * Parses a sequence to a YAML string.
- *
- * @param string $sequence
- * @param integer $i
- *
- * @return string A YAML string
- */
- static protected function parseSequence($sequence, &$i = 0)
- {
- $output = array();
- $len = strlen($sequence);
- $i += 1;
-
- // [foo, bar, ...]
- while ($i < $len)
- {
- switch ($sequence[$i])
- {
- case '[':
- // nested sequence
- $output[] = self::parseSequence($sequence, $i);
- break;
- case '{':
- // nested mapping
- $output[] = self::parseMapping($sequence, $i);
- break;
- case ']':
- return $output;
- case ',':
- case ' ':
- break;
- default:
- $isQuoted = in_array($sequence[$i], array('"', "'"));
- $value = self::parseScalar($sequence, array(',', ']'), array('"', "'"), $i);
-
- if (!$isQuoted && false !== strpos($value, ': '))
- {
- // embedded mapping?
- try
- {
- $value = self::parseMapping('{'.$value.'}');
- }
- catch (InvalidArgumentException $e)
- {
- // no, it's not
- }
- }
-
- $output[] = $value;
-
- --$i;
- }
-
- ++$i;
- }
-
- throw new InvalidArgumentException(sprintf('Malformed inline YAML string %s', $sequence));
- }
-
- /**
- * Parses a mapping to a YAML string.
- *
- * @param string $mapping
- * @param integer $i
- *
- * @return string A YAML string
- */
- static protected function parseMapping($mapping, &$i = 0)
- {
- $output = array();
- $len = strlen($mapping);
- $i += 1;
-
- // {foo: bar, bar:foo, ...}
- while ($i < $len)
- {
- switch ($mapping[$i])
- {
- case ' ':
- case ',':
- ++$i;
- continue 2;
- case '}':
- return $output;
- }
-
- // key
- $key = self::parseScalar($mapping, array(':', ' '), array('"', "'"), $i, false);
-
- // value
- $done = false;
- while ($i < $len)
- {
- switch ($mapping[$i])
- {
- case '[':
- // nested sequence
- $output[$key] = self::parseSequence($mapping, $i);
- $done = true;
- break;
- case '{':
- // nested mapping
- $output[$key] = self::parseMapping($mapping, $i);
- $done = true;
- break;
- case ':':
- case ' ':
- break;
- default:
- $output[$key] = self::parseScalar($mapping, array(',', '}'), array('"', "'"), $i);
- $done = true;
- --$i;
- }
-
- ++$i;
-
- if ($done)
- {
- continue 2;
- }
- }
- }
-
- throw new InvalidArgumentException(sprintf('Malformed inline YAML string %s', $mapping));
- }
-
- /**
- * Evaluates scalars and replaces magic values.
- *
- * @param string $scalar
- *
- * @return string A YAML string
- */
- static protected function evaluateScalar($scalar)
- {
- $scalar = trim($scalar);
-
- if ('1.1' === sfYaml::getSpecVersion())
- {
- $trueValues = array('true', 'on', '+', 'yes', 'y');
- $falseValues = array('false', 'off', '-', 'no', 'n');
- }
- else
- {
- $trueValues = array('true');
- $falseValues = array('false');
- }
-
- switch (true)
- {
- case 'null' == strtolower($scalar):
- case '' == $scalar:
- case '~' == $scalar:
- return null;
- case 0 === strpos($scalar, '!str'):
- return (string) substr($scalar, 5);
- case 0 === strpos($scalar, '! '):
- return intval(self::parseScalar(substr($scalar, 2)));
- case 0 === strpos($scalar, '!!php/object:'):
- return unserialize(substr($scalar, 13));
- case ctype_digit($scalar):
- $raw = $scalar;
- $cast = intval($scalar);
- return '0' == $scalar[0] ? octdec($scalar) : (((string) $raw == (string) $cast) ? $cast : $raw);
- case in_array(strtolower($scalar), $trueValues):
- return true;
- case in_array(strtolower($scalar), $falseValues):
- return false;
- case is_numeric($scalar):
- return '0x' == $scalar[0].$scalar[1] ? hexdec($scalar) : floatval($scalar);
- case 0 == strcasecmp($scalar, '.inf'):
- case 0 == strcasecmp($scalar, '.NaN'):
- return -log(0);
- case 0 == strcasecmp($scalar, '-.inf'):
- return log(0);
- case preg_match('/^(-|\+)?[0-9,]+(\.[0-9]+)?$/', $scalar):
- return floatval(str_replace(',', '', $scalar));
- case preg_match(self::getTimestampRegex(), $scalar):
- return strtotime($scalar);
- default:
- return (string) $scalar;
- }
- }
-
- static protected function getTimestampRegex()
- {
- return <<<EOF
- ~^
- (?P<year>[0-9][0-9][0-9][0-9])
- -(?P<month>[0-9][0-9]?)
- -(?P<day>[0-9][0-9]?)
- (?:(?:[Tt]|[ \t]+)
- (?P<hour>[0-9][0-9]?)
- :(?P<minute>[0-9][0-9])
- :(?P<second>[0-9][0-9])
- (?:\.(?P<fraction>[0-9]*))?
- (?:[ \t]*(?P<tz>Z|(?P<tz_sign>[-+])(?P<tz_hour>[0-9][0-9]?)
- (?::(?P<tz_minute>[0-9][0-9]))?))?)?
- $~x
-EOF;
- }
-}
diff --git a/3rdparty/aws-sdk/lib/yaml/lib/sfYamlParser.php b/3rdparty/aws-sdk/lib/yaml/lib/sfYamlParser.php
deleted file mode 100644
index 4c56a56db07..00000000000
--- a/3rdparty/aws-sdk/lib/yaml/lib/sfYamlParser.php
+++ /dev/null
@@ -1,612 +0,0 @@
-<?php
-
-/*
- * This file is part of the symfony package.
- * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-require_once(dirname(__FILE__).'/sfYamlInline.php');
-
-if (!defined('PREG_BAD_UTF8_OFFSET_ERROR'))
-{
- define('PREG_BAD_UTF8_OFFSET_ERROR', 5);
-}
-
-/**
- * sfYamlParser parses YAML strings to convert them to PHP arrays.
- *
- * @package symfony
- * @subpackage yaml
- * @author Fabien Potencier <fabien.potencier@symfony-project.com>
- * @version SVN: $Id: sfYamlParser.class.php 10832 2008-08-13 07:46:08Z fabien $
- */
-class sfYamlParser
-{
- protected
- $offset = 0,
- $lines = array(),
- $currentLineNb = -1,
- $currentLine = '',
- $refs = array();
-
- /**
- * Constructor
- *
- * @param integer $offset The offset of YAML document (used for line numbers in error messages)
- */
- public function __construct($offset = 0)
- {
- $this->offset = $offset;
- }
-
- /**
- * Parses a YAML string to a PHP value.
- *
- * @param string $value A YAML string
- *
- * @return mixed A PHP value
- *
- * @throws InvalidArgumentException If the YAML is not valid
- */
- public function parse($value)
- {
- $value = str_replace("\t", ' ', $value); // Convert tabs to spaces.
-
- $this->currentLineNb = -1;
- $this->currentLine = '';
- $this->lines = explode("\n", $this->cleanup($value));
-
- if (function_exists('mb_internal_encoding') && ((int) ini_get('mbstring.func_overload')) & 2)
- {
- $mbEncoding = mb_internal_encoding();
- mb_internal_encoding('ASCII');
- }
-
- $data = array();
- while ($this->moveToNextLine())
- {
- if ($this->isCurrentLineEmpty())
- {
- continue;
- }
-
- // tab?
- if (preg_match('#^\t+#', $this->currentLine))
- {
- throw new InvalidArgumentException(sprintf('A YAML file cannot contain tabs as indentation at line %d (%s).', $this->getRealCurrentLineNb() + 1, $this->currentLine));
- }
-
- $isRef = $isInPlace = $isProcessed = false;
- if (preg_match('#^\-((?P<leadspaces>\s+)(?P<value>.+?))?\s*$#', $this->currentLine, $values))
- {
- if (isset($values['value']) && preg_match('#^&(?P<ref>[^ ]+) *(?P<value>.*)#', $values['value'], $matches))
- {
- $isRef = $matches['ref'];
- $values['value'] = $matches['value'];
- }
-
- // array
- if (!isset($values['value']) || '' == trim($values['value'], ' ') || 0 === strpos(ltrim($values['value'], ' '), '#'))
- {
- $c = $this->getRealCurrentLineNb() + 1;
- $parser = new sfYamlParser($c);
- $parser->refs =& $this->refs;
- $data[] = $parser->parse($this->getNextEmbedBlock());
- }
- else
- {
- if (isset($values['leadspaces'])
- && ' ' == $values['leadspaces']
- && preg_match('#^(?P<key>'.sfYamlInline::REGEX_QUOTED_STRING.'|[^ \'"\{].*?) *\:(\s+(?P<value>.+?))?\s*$#', $values['value'], $matches))
- {
- // this is a compact notation element, add to next block and parse
- $c = $this->getRealCurrentLineNb();
- $parser = new sfYamlParser($c);
- $parser->refs =& $this->refs;
-
- $block = $values['value'];
- if (!$this->isNextLineIndented())
- {
- $block .= "\n".$this->getNextEmbedBlock($this->getCurrentLineIndentation() + 2);
- }
-
- $data[] = $parser->parse($block);
- }
- else
- {
- $data[] = $this->parseValue($values['value']);
- }
- }
- }
- else if (preg_match('#^(?P<key>'.sfYamlInline::REGEX_QUOTED_STRING.'|[^ \'"].*?) *\:(\s+(?P<value>.+?))?\s*$#', $this->currentLine, $values))
- {
- $key = sfYamlInline::parseScalar($values['key']);
-
- if ('<<' === $key)
- {
- if (isset($values['value']) && '*' === substr($values['value'], 0, 1))
- {
- $isInPlace = substr($values['value'], 1);
- if (!array_key_exists($isInPlace, $this->refs))
- {
- throw new InvalidArgumentException(sprintf('Reference "%s" does not exist at line %s (%s).', $isInPlace, $this->getRealCurrentLineNb() + 1, $this->currentLine));
- }
- }
- else
- {
- if (isset($values['value']) && $values['value'] !== '')
- {
- $value = $values['value'];
- }
- else
- {
- $value = $this->getNextEmbedBlock();
- }
- $c = $this->getRealCurrentLineNb() + 1;
- $parser = new sfYamlParser($c);
- $parser->refs =& $this->refs;
- $parsed = $parser->parse($value);
-
- $merged = array();
- if (!is_array($parsed))
- {
- throw new InvalidArgumentException(sprintf("YAML merge keys used with a scalar value instead of an array at line %s (%s)", $this->getRealCurrentLineNb() + 1, $this->currentLine));
- }
- else if (isset($parsed[0]))
- {
- // Numeric array, merge individual elements
- foreach (array_reverse($parsed) as $parsedItem)
- {
- if (!is_array($parsedItem))
- {
- throw new InvalidArgumentException(sprintf("Merge items must be arrays at line %s (%s).", $this->getRealCurrentLineNb() + 1, $parsedItem));
- }
- $merged = array_merge($parsedItem, $merged);
- }
- }
- else
- {
- // Associative array, merge
- $merged = array_merge($merge, $parsed);
- }
-
- $isProcessed = $merged;
- }
- }
- else if (isset($values['value']) && preg_match('#^&(?P<ref>[^ ]+) *(?P<value>.*)#', $values['value'], $matches))
- {
- $isRef = $matches['ref'];
- $values['value'] = $matches['value'];
- }
-
- if ($isProcessed)
- {
- // Merge keys
- $data = $isProcessed;
- }
- // hash
- else if (!isset($values['value']) || '' == trim($values['value'], ' ') || 0 === strpos(ltrim($values['value'], ' '), '#'))
- {
- // if next line is less indented or equal, then it means that the current value is null
- if ($this->isNextLineIndented())
- {
- $data[$key] = null;
- }
- else
- {
- $c = $this->getRealCurrentLineNb() + 1;
- $parser = new sfYamlParser($c);
- $parser->refs =& $this->refs;
- $data[$key] = $parser->parse($this->getNextEmbedBlock());
- }
- }
- else
- {
- if ($isInPlace)
- {
- $data = $this->refs[$isInPlace];
- }
- else
- {
- $data[$key] = $this->parseValue($values['value']);
- }
- }
- }
- else
- {
- // 1-liner followed by newline
- if (2 == count($this->lines) && empty($this->lines[1]))
- {
- $value = sfYamlInline::load($this->lines[0]);
- if (is_array($value))
- {
- $first = reset($value);
- if ('*' === substr($first, 0, 1))
- {
- $data = array();
- foreach ($value as $alias)
- {
- $data[] = $this->refs[substr($alias, 1)];
- }
- $value = $data;
- }
- }
-
- if (isset($mbEncoding))
- {
- mb_internal_encoding($mbEncoding);
- }
-
- return $value;
- }
-
- switch (preg_last_error())
- {
- case PREG_INTERNAL_ERROR:
- $error = 'Internal PCRE error on line';
- break;
- case PREG_BACKTRACK_LIMIT_ERROR:
- $error = 'pcre.backtrack_limit reached on line';
- break;
- case PREG_RECURSION_LIMIT_ERROR:
- $error = 'pcre.recursion_limit reached on line';
- break;
- case PREG_BAD_UTF8_ERROR:
- $error = 'Malformed UTF-8 data on line';
- break;
- case PREG_BAD_UTF8_OFFSET_ERROR:
- $error = 'Offset doesn\'t correspond to the begin of a valid UTF-8 code point on line';
- break;
- default:
- $error = 'Unable to parse line';
- }
-
- throw new InvalidArgumentException(sprintf('%s %d (%s).', $error, $this->getRealCurrentLineNb() + 1, $this->currentLine));
- }
-
- if ($isRef)
- {
- $this->refs[$isRef] = end($data);
- }
- }
-
- if (isset($mbEncoding))
- {
- mb_internal_encoding($mbEncoding);
- }
-
- return empty($data) ? null : $data;
- }
-
- /**
- * Returns the current line number (takes the offset into account).
- *
- * @return integer The current line number
- */
- protected function getRealCurrentLineNb()
- {
- return $this->currentLineNb + $this->offset;
- }
-
- /**
- * Returns the current line indentation.
- *
- * @return integer The current line indentation
- */
- protected function getCurrentLineIndentation()
- {
- return strlen($this->currentLine) - strlen(ltrim($this->currentLine, ' '));
- }
-
- /**
- * Returns the next embed block of YAML.
- *
- * @param integer $indentation The indent level at which the block is to be read, or null for default
- *
- * @return string A YAML string
- */
- protected function getNextEmbedBlock($indentation = null)
- {
- $this->moveToNextLine();
-
- if (null === $indentation)
- {
- $newIndent = $this->getCurrentLineIndentation();
-
- if (!$this->isCurrentLineEmpty() && 0 == $newIndent)
- {
- throw new InvalidArgumentException(sprintf('Indentation problem at line %d (%s)', $this->getRealCurrentLineNb() + 1, $this->currentLine));
- }
- }
- else
- {
- $newIndent = $indentation;
- }
-
- $data = array(substr($this->currentLine, $newIndent));
-
- while ($this->moveToNextLine())
- {
- if ($this->isCurrentLineEmpty())
- {
- if ($this->isCurrentLineBlank())
- {
- $data[] = substr($this->currentLine, $newIndent);
- }
-
- continue;
- }
-
- $indent = $this->getCurrentLineIndentation();
-
- if (preg_match('#^(?P<text> *)$#', $this->currentLine, $match))
- {
- // empty line
- $data[] = $match['text'];
- }
- else if ($indent >= $newIndent)
- {
- $data[] = substr($this->currentLine, $newIndent);
- }
- else if (0 == $indent)
- {
- $this->moveToPreviousLine();
-
- break;
- }
- else
- {
- throw new InvalidArgumentException(sprintf('Indentation problem at line %d (%s)', $this->getRealCurrentLineNb() + 1, $this->currentLine));
- }
- }
-
- return implode("\n", $data);
- }
-
- /**
- * Moves the parser to the next line.
- */
- protected function moveToNextLine()
- {
- if ($this->currentLineNb >= count($this->lines) - 1)
- {
- return false;
- }
-
- $this->currentLine = $this->lines[++$this->currentLineNb];
-
- return true;
- }
-
- /**
- * Moves the parser to the previous line.
- */
- protected function moveToPreviousLine()
- {
- $this->currentLine = $this->lines[--$this->currentLineNb];
- }
-
- /**
- * Parses a YAML value.
- *
- * @param string $value A YAML value
- *
- * @return mixed A PHP value
- */
- protected function parseValue($value)
- {
- if ('*' === substr($value, 0, 1))
- {
- if (false !== $pos = strpos($value, '#'))
- {
- $value = substr($value, 1, $pos - 2);
- }
- else
- {
- $value = substr($value, 1);
- }
-
- if (!array_key_exists($value, $this->refs))
- {
- throw new InvalidArgumentException(sprintf('Reference "%s" does not exist (%s).', $value, $this->currentLine));
- }
- return $this->refs[$value];
- }
-
- if (preg_match('/^(?P<separator>\||>)(?P<modifiers>\+|\-|\d+|\+\d+|\-\d+|\d+\+|\d+\-)?(?P<comments> +#.*)?$/', $value, $matches))
- {
- $modifiers = isset($matches['modifiers']) ? $matches['modifiers'] : '';
-
- return $this->parseFoldedScalar($matches['separator'], preg_replace('#\d+#', '', $modifiers), intval(abs($modifiers)));
- }
- else
- {
- return sfYamlInline::load($value);
- }
- }
-
- /**
- * Parses a folded scalar.
- *
- * @param string $separator The separator that was used to begin this folded scalar (| or >)
- * @param string $indicator The indicator that was used to begin this folded scalar (+ or -)
- * @param integer $indentation The indentation that was used to begin this folded scalar
- *
- * @return string The text value
- */
- protected function parseFoldedScalar($separator, $indicator = '', $indentation = 0)
- {
- $separator = '|' == $separator ? "\n" : ' ';
- $text = '';
-
- $notEOF = $this->moveToNextLine();
-
- while ($notEOF && $this->isCurrentLineBlank())
- {
- $text .= "\n";
-
- $notEOF = $this->moveToNextLine();
- }
-
- if (!$notEOF)
- {
- return '';
- }
-
- if (!preg_match('#^(?P<indent>'.($indentation ? str_repeat(' ', $indentation) : ' +').')(?P<text>.*)$#', $this->currentLine, $matches))
- {
- $this->moveToPreviousLine();
-
- return '';
- }
-
- $textIndent = $matches['indent'];
- $previousIndent = 0;
-
- $text .= $matches['text'].$separator;
- while ($this->currentLineNb + 1 < count($this->lines))
- {
- $this->moveToNextLine();
-
- if (preg_match('#^(?P<indent> {'.strlen($textIndent).',})(?P<text>.+)$#', $this->currentLine, $matches))
- {
- if (' ' == $separator && $previousIndent != $matches['indent'])
- {
- $text = substr($text, 0, -1)."\n";
- }
- $previousIndent = $matches['indent'];
-
- $text .= str_repeat(' ', $diff = strlen($matches['indent']) - strlen($textIndent)).$matches['text'].($diff ? "\n" : $separator);
- }
- else if (preg_match('#^(?P<text> *)$#', $this->currentLine, $matches))
- {
- $text .= preg_replace('#^ {1,'.strlen($textIndent).'}#', '', $matches['text'])."\n";
- }
- else
- {
- $this->moveToPreviousLine();
-
- break;
- }
- }
-
- if (' ' == $separator)
- {
- // replace last separator by a newline
- $text = preg_replace('/ (\n*)$/', "\n$1", $text);
- }
-
- switch ($indicator)
- {
- case '':
- $text = preg_replace('#\n+$#s', "\n", $text);
- break;
- case '+':
- break;
- case '-':
- $text = preg_replace('#\n+$#s', '', $text);
- break;
- }
-
- return $text;
- }
-
- /**
- * Returns true if the next line is indented.
- *
- * @return Boolean Returns true if the next line is indented, false otherwise
- */
- protected function isNextLineIndented()
- {
- $currentIndentation = $this->getCurrentLineIndentation();
- $notEOF = $this->moveToNextLine();
-
- while ($notEOF && $this->isCurrentLineEmpty())
- {
- $notEOF = $this->moveToNextLine();
- }
-
- if (false === $notEOF)
- {
- return false;
- }
-
- $ret = false;
- if ($this->getCurrentLineIndentation() <= $currentIndentation)
- {
- $ret = true;
- }
-
- $this->moveToPreviousLine();
-
- return $ret;
- }
-
- /**
- * Returns true if the current line is blank or if it is a comment line.
- *
- * @return Boolean Returns true if the current line is empty or if it is a comment line, false otherwise
- */
- protected function isCurrentLineEmpty()
- {
- return $this->isCurrentLineBlank() || $this->isCurrentLineComment();
- }
-
- /**
- * Returns true if the current line is blank.
- *
- * @return Boolean Returns true if the current line is blank, false otherwise
- */
- protected function isCurrentLineBlank()
- {
- return '' == trim($this->currentLine, ' ');
- }
-
- /**
- * Returns true if the current line is a comment line.
- *
- * @return Boolean Returns true if the current line is a comment line, false otherwise
- */
- protected function isCurrentLineComment()
- {
- //checking explicitly the first char of the trim is faster than loops or strpos
- $ltrimmedLine = ltrim($this->currentLine, ' ');
- return $ltrimmedLine[0] === '#';
- }
-
- /**
- * Cleanups a YAML string to be parsed.
- *
- * @param string $value The input YAML string
- *
- * @return string A cleaned up YAML string
- */
- protected function cleanup($value)
- {
- $value = str_replace(array("\r\n", "\r"), "\n", $value);
-
- if (!preg_match("#\n$#", $value))
- {
- $value .= "\n";
- }
-
- // strip YAML header
- $count = 0;
- $value = preg_replace('#^\%YAML[: ][\d\.]+.*\n#s', '', $value, -1, $count);
- $this->offset += $count;
-
- // remove leading comments and/or ---
- $trimmedValue = preg_replace('#^((\#.*?\n)|(\-\-\-.*?\n))*#s', '', $value, -1, $count);
- if ($count == 1)
- {
- // items have been removed, update the offset
- $this->offset += substr_count($value, "\n") - substr_count($trimmedValue, "\n");
- $value = $trimmedValue;
- }
-
- return $value;
- }
-}
diff --git a/3rdparty/aws-sdk/sdk.class.php b/3rdparty/aws-sdk/sdk.class.php
deleted file mode 100755
index 8dcb7bf252f..00000000000
--- a/3rdparty/aws-sdk/sdk.class.php
+++ /dev/null
@@ -1,1435 +0,0 @@
-<?php
-/*
- * Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License").
- * You may not use this file except in compliance with the License.
- * A copy of the License is located at
- *
- * http://aws.amazon.com/apache2.0
- *
- * or in the "license" file accompanying this file. This file is distributed
- * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-
-/*%******************************************************************************************%*/
-// EXCEPTIONS
-
-/**
- * Default CFRuntime Exception.
- */
-class CFRuntime_Exception extends Exception {}
-
-/**
- * Parsing Exception.
- */
-class Parser_Exception extends Exception {}
-
-
-/*%******************************************************************************************%*/
-// DETERMINE WHAT ENVIRONMENT DATA TO ADD TO THE USERAGENT FOR METRIC TRACKING
-
-/*
- Define a temporary callback function for this calculation. Get the PHP version and any
- required/optional extensions that are leveraged.
-
- Tracking this data gives Amazon better metrics about what configurations are being used
- so that forward-looking plans for the code can be made with more certainty (e.g. What
- version of PHP are most people running? Do they tend to have the latest PCRE?).
-*/
-function __aws_sdk_ua_callback()
-{
- $ua_append = '';
- $extensions = get_loaded_extensions();
- $sorted_extensions = array();
-
- if ($extensions)
- {
- foreach ($extensions as $extension)
- {
- if ($extension === 'curl' && function_exists('curl_version'))
- {
- $curl_version = curl_version();
- $sorted_extensions[strtolower($extension)] = $curl_version['version'];
- }
- elseif ($extension === 'pcre' && defined('PCRE_VERSION'))
- {
- $pcre_version = explode(' ', PCRE_VERSION);
- $sorted_extensions[strtolower($extension)] = $pcre_version[0];
- }
- elseif ($extension === 'openssl' && defined('OPENSSL_VERSION_TEXT'))
- {
- $openssl_version = explode(' ', OPENSSL_VERSION_TEXT);
- $sorted_extensions[strtolower($extension)] = $openssl_version[1];
- }
- else
- {
- $sorted_extensions[strtolower($extension)] = phpversion($extension);
- }
- }
- }
-
- foreach (array('simplexml', 'json', 'pcre', 'spl', 'curl', 'openssl', 'apc', 'xcache', 'memcache', 'memcached', 'pdo', 'pdo_sqlite', 'sqlite', 'sqlite3', 'zlib', 'xdebug') as $ua_ext)
- {
- if (isset($sorted_extensions[$ua_ext]) && $sorted_extensions[$ua_ext])
- {
- $ua_append .= ' ' . $ua_ext . '/' . $sorted_extensions[$ua_ext];
- }
- elseif (isset($sorted_extensions[$ua_ext]))
- {
- $ua_append .= ' ' . $ua_ext . '/0';
- }
- }
-
- foreach (array('memory_limit', 'date.timezone', 'open_basedir', 'safe_mode', 'zend.enable_gc') as $cfg)
- {
- $cfg_value = ini_get($cfg);
-
- if (in_array($cfg, array('memory_limit', 'date.timezone'), true))
- {
- $ua_append .= ' ' . $cfg . '/' . str_replace('/', '.', $cfg_value);
- }
- elseif (in_array($cfg, array('open_basedir', 'safe_mode', 'zend.enable_gc'), true))
- {
- if ($cfg_value === false || $cfg_value === '' || $cfg_value === 0)
- {
- $cfg_value = 'off';
- }
- elseif ($cfg_value === true || $cfg_value === '1' || $cfg_value === 1)
- {
- $cfg_value = 'on';
- }
-
- $ua_append .= ' ' . $cfg . '/' . $cfg_value;
- }
- }
-
- return $ua_append;
-}
-
-
-/*%******************************************************************************************%*/
-// INTERMEDIARY CONSTANTS
-
-define('CFRUNTIME_NAME', 'aws-sdk-php');
-define('CFRUNTIME_VERSION', '1.5.6.2');
-define('CFRUNTIME_BUILD', '20120529180000');
-define('CFRUNTIME_USERAGENT', CFRUNTIME_NAME . '/' . CFRUNTIME_VERSION . ' PHP/' . PHP_VERSION . ' ' . str_replace(' ', '_', php_uname('s')) . '/' . str_replace(' ', '_', php_uname('r')) . ' Arch/' . php_uname('m') . ' SAPI/' . php_sapi_name() . ' Integer/' . PHP_INT_MAX . ' Build/' . CFRUNTIME_BUILD . __aws_sdk_ua_callback());
-
-
-/*%******************************************************************************************%*/
-// CLASS
-
-/**
- * Core functionality and default settings shared across all SDK classes. All methods and properties in this
- * class are inherited by the service-specific classes.
- *
- * @version 2012.05.29
- * @license See the included NOTICE.md file for more information.
- * @copyright See the included NOTICE.md file for more information.
- * @link http://aws.amazon.com/php/ PHP Developer Center
- */
-class CFRuntime
-{
- /*%******************************************************************************************%*/
- // CONSTANTS
-
- /**
- * Name of the software.
- */
- const NAME = CFRUNTIME_NAME;
-
- /**
- * Version of the software.
- */
- const VERSION = CFRUNTIME_VERSION;
-
- /**
- * Build ID of the software.
- */
- const BUILD = CFRUNTIME_BUILD;
-
- /**
- * User agent string used to identify the software.
- */
- const USERAGENT = CFRUNTIME_USERAGENT;
-
-
- /*%******************************************************************************************%*/
- // PROPERTIES
-
- /**
- * The Amazon API Key.
- */
- public $key;
-
- /**
- * The Amazon API Secret Key.
- */
- public $secret_key;
-
- /**
- * The Amazon Authentication Token.
- */
- public $auth_token;
-
- /**
- * Handle for the utility functions.
- */
- public $util;
-
- /**
- * An identifier for the current AWS service.
- */
- public $service = null;
-
- /**
- * The supported API version.
- */
- public $api_version = null;
-
- /**
- * The state of whether auth should be handled as AWS Query.
- */
- public $use_aws_query = true;
-
- /**
- * The default class to use for utilities (defaults to <CFUtilities>).
- */
- public $utilities_class = 'CFUtilities';
-
- /**
- * The default class to use for HTTP requests (defaults to <CFRequest>).
- */
- public $request_class = 'CFRequest';
-
- /**
- * The default class to use for HTTP responses (defaults to <CFResponse>).
- */
- public $response_class = 'CFResponse';
-
- /**
- * The default class to use for parsing XML (defaults to <CFSimpleXML>).
- */
- public $parser_class = 'CFSimpleXML';
-
- /**
- * The default class to use for handling batch requests (defaults to <CFBatchRequest>).
- */
- public $batch_class = 'CFBatchRequest';
-
- /**
- * The state of SSL/HTTPS use.
- */
- public $use_ssl = true;
-
- /**
- * The state of SSL certificate verification.
- */
- public $ssl_verification = true;
-
- /**
- * The proxy to use for connecting.
- */
- public $proxy = null;
-
- /**
- * The alternate hostname to use, if any.
- */
- public $hostname = null;
-
- /**
- * The state of the capability to override the hostname with <set_hostname()>.
- */
- public $override_hostname = true;
-
- /**
- * The alternate port number to use, if any.
- */
- public $port_number = null;
-
- /**
- * The alternate resource prefix to use, if any.
- */
- public $resource_prefix = null;
-
- /**
- * The state of cache flow usage.
- */
- public $use_cache_flow = false;
-
- /**
- * The caching class to use.
- */
- public $cache_class = null;
-
- /**
- * The caching location to use.
- */
- public $cache_location = null;
-
- /**
- * When the cache should be considered stale.
- */
- public $cache_expires = null;
-
- /**
- * The state of cache compression.
- */
- public $cache_compress = null;
-
- /**
- * The current instantiated cache object.
- */
- public $cache_object = null;
-
- /**
- * The current instantiated batch request object.
- */
- public $batch_object = null;
-
- /**
- * The internally instantiated batch request object.
- */
- public $internal_batch_object = null;
-
- /**
- * The state of batch flow usage.
- */
- public $use_batch_flow = false;
-
- /**
- * The state of the cache deletion setting.
- */
- public $delete_cache = false;
-
- /**
- * The state of the debug mode setting.
- */
- public $debug_mode = false;
-
- /**
- * The number of times to retry failed requests.
- */
- public $max_retries = 3;
-
- /**
- * The user-defined callback function to call when a stream is read from.
- */
- public $registered_streaming_read_callback = null;
-
- /**
- * The user-defined callback function to call when a stream is written to.
- */
- public $registered_streaming_write_callback = null;
-
- /**
- * The credentials to use for authentication.
- */
- public $credentials = array();
-
- /**
- * The authentication class to use.
- */
- public $auth_class = null;
-
- /**
- * The operation to execute.
- */
- public $operation = null;
-
- /**
- * The payload to send.
- */
- public $payload = array();
-
- /**
- * The string prefix to prepend to the operation name.
- */
- public $operation_prefix = '';
-
- /**
- * The number of times a request has been retried.
- */
- public $redirects = 0;
-
- /**
- * The state of whether the response should be parsed or not.
- */
- public $parse_the_response = true;
-
-
- /*%******************************************************************************************%*/
- // CONSTRUCTOR
-
- /**
- * The constructor. This class should not be instantiated directly. Rather, a service-specific class
- * should be instantiated.
- *
- * @param array $options (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>certificate_authority</code> - <code>boolean</code> - Optional - Determines which Cerificate Authority file to use. A value of boolean <code>false</code> will use the Certificate Authority file available on the system. A value of boolean <code>true</code> will use the Certificate Authority provided by the SDK. Passing a file system path to a Certificate Authority file (chmodded to <code>0755</code>) will use that. Leave this set to <code>false</code> if you're not sure.</li>
- * <li><code>credentials</code> - <code>string</code> - Optional - The name of the credential set to use for authentication.</li>
- * <li><code>default_cache_config</code> - <code>string</code> - Optional - This option allows a preferred storage type to be configured for long-term caching. This can be changed later using the <set_cache_config()> method. Valid values are: <code>apc</code>, <code>xcache</code>, or a file system path such as <code>./cache</code> or <code>/tmp/cache/</code>.</li>
- * <li><code>key</code> - <code>string</code> - Optional - Your AWS key, or a session key. If blank, the default credential set will be used.</li>
- * <li><code>secret</code> - <code>string</code> - Optional - Your AWS secret key, or a session secret key. If blank, the default credential set will be used.</li>
- * <li><code>token</code> - <code>string</code> - Optional - An AWS session token.</li></ul>
- * @return void
- */
- public function __construct(array $options = array())
- {
- // Instantiate the utilities class.
- $this->util = new $this->utilities_class();
-
- // Determine the current service.
- $this->service = get_class($this);
-
- // Create credentials based on the options
- $instance_credentials = new CFCredential($options);
-
- // Retreive a credential set from config.inc.php if it exists
- if (isset($options['credentials']))
- {
- // Use a specific credential set and merge with the instance credentials
- $this->credentials = CFCredentials::get($options['credentials'])
- ->merge($instance_credentials);
- }
- else
- {
- try
- {
- // Use the default credential set and merge with the instance credentials
- $this->credentials = CFCredentials::get(CFCredentials::DEFAULT_KEY)
- ->merge($instance_credentials);
- }
- catch (CFCredentials_Exception $e)
- {
- if (isset($options['key']) && isset($options['secret']))
- {
- // Only the instance credentials were provided
- $this->credentials = $instance_credentials;
- }
- else
- {
- // No credentials provided in the config file or constructor
- throw new CFCredentials_Exception('No credentials were provided to ' . $this->service . '.');
- }
- }
- }
-
- // Set internal credentials after they are resolved
- $this->key = $this->credentials->key;
- $this->secret_key = $this->credentials->secret;
- $this->auth_token = $this->credentials->token;
-
- // Automatically enable whichever caching mechanism is set to default.
- $this->set_cache_config($this->credentials->default_cache_config);
- }
-
- /**
- * Alternate approach to constructing a new instance. Supports chaining.
- *
- * @param array $options (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>certificate_authority</code> - <code>boolean</code> - Optional - Determines which Cerificate Authority file to use. A value of boolean <code>false</code> will use the Certificate Authority file available on the system. A value of boolean <code>true</code> will use the Certificate Authority provided by the SDK. Passing a file system path to a Certificate Authority file (chmodded to <code>0755</code>) will use that. Leave this set to <code>false</code> if you're not sure.</li>
- * <li><code>credentials</code> - <code>string</code> - Optional - The name of the credential set to use for authentication.</li>
- * <li><code>default_cache_config</code> - <code>string</code> - Optional - This option allows a preferred storage type to be configured for long-term caching. This can be changed later using the <set_cache_config()> method. Valid values are: <code>apc</code>, <code>xcache</code>, or a file system path such as <code>./cache</code> or <code>/tmp/cache/</code>.</li>
- * <li><code>key</code> - <code>string</code> - Optional - Your AWS key, or a session key. If blank, the default credential set will be used.</li>
- * <li><code>secret</code> - <code>string</code> - Optional - Your AWS secret key, or a session secret key. If blank, the default credential set will be used.</li>
- * <li><code>token</code> - <code>string</code> - Optional - An AWS session token.</li></ul>
- * @return void
- */
- public static function factory(array $options = array())
- {
- if (version_compare(PHP_VERSION, '5.3.0', '<'))
- {
- throw new Exception('PHP 5.3 or newer is required to instantiate a new class with CLASS::factory().');
- }
-
- $self = get_called_class();
- return new $self($options);
- }
-
-
- /*%******************************************************************************************%*/
- // MAGIC METHODS
-
- /**
- * A magic method that allows `camelCase` method names to be translated into `snake_case` names.
- *
- * @param string $name (Required) The name of the method.
- * @param array $arguments (Required) The arguments passed to the method.
- * @return mixed The results of the intended method.
- */
- public function __call($name, $arguments)
- {
- // Convert camelCase method calls to snake_case.
- $method_name = strtolower(preg_replace('/([a-z])([A-Z])/', '$1_$2', $name));
-
- if (method_exists($this, $method_name))
- {
- return call_user_func_array(array($this, $method_name), $arguments);
- }
-
- throw new CFRuntime_Exception('The method ' . $name . '() is undefined. Attempted to map to ' . $method_name . '() which is also undefined. Error occurred');
- }
-
-
- /*%******************************************************************************************%*/
- // SET CUSTOM SETTINGS
-
- /**
- * Set the proxy settings to use.
- *
- * @param string $proxy (Required) Accepts proxy credentials in the following format: `proxy://user:pass@hostname:port`
- * @return $this A reference to the current instance.
- */
- public function set_proxy($proxy)
- {
- $this->proxy = $proxy;
- return $this;
- }
-
- /**
- * Set the hostname to connect to. This is useful for alternate services that are API-compatible with
- * AWS, but run from a different hostname.
- *
- * @param string $hostname (Required) The alternate hostname to use in place of the default one. Useful for mock or test applications living on different hostnames.
- * @param integer $port_number (Optional) The alternate port number to use in place of the default one. Useful for mock or test applications living on different port numbers.
- * @return $this A reference to the current instance.
- */
- public function set_hostname($hostname, $port_number = null)
- {
- if ($this->override_hostname)
- {
- $this->hostname = $hostname;
-
- if ($port_number)
- {
- $this->port_number = $port_number;
- $this->hostname .= ':' . (string) $this->port_number;
- }
- }
-
- return $this;
- }
-
- /**
- * Set the resource prefix to use. This method is useful for alternate services that are API-compatible
- * with AWS.
- *
- * @param string $prefix (Required) An alternate prefix to prepend to the resource path. Useful for mock or test applications.
- * @return $this A reference to the current instance.
- */
- public function set_resource_prefix($prefix)
- {
- $this->resource_prefix = $prefix;
- return $this;
- }
-
- /**
- * Disables any subsequent use of the <set_hostname()> method.
- *
- * @param boolean $override (Optional) Whether or not subsequent calls to <set_hostname()> should be obeyed. A `false` value disables the further effectiveness of <set_hostname()>. Defaults to `true`.
- * @return $this A reference to the current instance.
- */
- public function allow_hostname_override($override = true)
- {
- $this->override_hostname = $override;
- return $this;
- }
-
- /**
- * Disables SSL/HTTPS connections for hosts that don't support them. Some services, however, still
- * require SSL support.
- *
- * This method will throw a user warning when invoked, which can be hidden by changing your
- * <php:error_reporting()> settings.
- *
- * @return $this A reference to the current instance.
- */
- public function disable_ssl()
- {
- trigger_error('Disabling SSL connections is potentially unsafe and highly discouraged.', E_USER_WARNING);
- $this->use_ssl = false;
- return $this;
- }
-
- /**
- * Disables the verification of the SSL Certificate Authority. Doing so can enable an attacker to carry
- * out a man-in-the-middle attack.
- *
- * https://secure.wikimedia.org/wikipedia/en/wiki/Man-in-the-middle_attack
- *
- * This method will throw a user warning when invoked, which can be hidden by changing your
- * <php:error_reporting()> settings.
- *
- * @return $this A reference to the current instance.
- */
- public function disable_ssl_verification($ssl_verification = false)
- {
- trigger_error('Disabling the verification of SSL certificates can lead to man-in-the-middle attacks. It is potentially unsafe and highly discouraged.', E_USER_WARNING);
- $this->ssl_verification = $ssl_verification;
- return $this;
- }
-
- /**
- * Enables HTTP request/response header logging to `STDERR`.
- *
- * @param boolean $enabled (Optional) Whether or not to enable debug mode. Defaults to `true`.
- * @return $this A reference to the current instance.
- */
- public function enable_debug_mode($enabled = true)
- {
- $this->debug_mode = $enabled;
- return $this;
- }
-
- /**
- * Sets the maximum number of times to retry failed requests.
- *
- * @param integer $retries (Optional) The maximum number of times to retry failed requests. Defaults to `3`.
- * @return $this A reference to the current instance.
- */
- public function set_max_retries($retries = 3)
- {
- $this->max_retries = $retries;
- return $this;
- }
-
- /**
- * Set the caching configuration to use for response caching.
- *
- * @param string $location (Required) <p>The location to store the cache object in. This may vary by cache method.</p><ul><li>File - The local file system paths such as <code>./cache</code> (relative) or <code>/tmp/cache/</code> (absolute). The location must be server-writable.</li><li>APC - Pass in <code>apc</code> to use this lightweight cache. You must have the <a href="http://php.net/apc">APC extension</a> installed.</li><li>XCache - Pass in <code>xcache</code> to use this lightweight cache. You must have the <a href="http://xcache.lighttpd.net">XCache</a> extension installed.</li><li>Memcached - Pass in an indexed array of associative arrays. Each associative array should have a <code>host</code> and a <code>port</code> value representing a <a href="http://php.net/memcached">Memcached</a> server to connect to.</li><li>PDO - A URL-style string (e.g. <code>pdo.mysql://user:pass@localhost/cache</code>) or a standard DSN-style string (e.g. <code>pdo.sqlite:/sqlite/cache.db</code>). MUST be prefixed with <code>pdo.</code>. See <code>CachePDO</code> and <a href="http://php.net/pdo">PDO</a> for more details.</li></ul>
- * @param boolean $gzip (Optional) Whether or not data should be gzipped before being stored. A value of `true` will compress the contents before caching them. A value of `false` will leave the contents uncompressed. Defaults to `true`.
- * @return $this A reference to the current instance.
- */
- public function set_cache_config($location, $gzip = true)
- {
- // If we have an array, we're probably passing in Memcached servers and ports.
- if (is_array($location))
- {
- $this->cache_class = 'CacheMC';
- }
- else
- {
- // I would expect locations like `/tmp/cache`, `pdo.mysql://user:pass@hostname:port`, `pdo.sqlite:memory:`, and `apc`.
- $type = strtolower(substr($location, 0, 3));
- switch ($type)
- {
- case 'apc':
- $this->cache_class = 'CacheAPC';
- break;
-
- case 'xca': // First three letters of `xcache`
- $this->cache_class = 'CacheXCache';
- break;
-
- case 'pdo':
- $this->cache_class = 'CachePDO';
- $location = substr($location, 4);
- break;
-
- default:
- $this->cache_class = 'CacheFile';
- break;
- }
- }
-
- // Set the remaining cache information.
- $this->cache_location = $location;
- $this->cache_compress = $gzip;
-
- return $this;
- }
-
- /**
- * Register a callback function to execute whenever a data stream is read from using
- * <CFRequest::streaming_read_callback()>.
- *
- * The user-defined callback function should accept three arguments:
- *
- * <ul>
- * <li><code>$curl_handle</code> - <code>resource</code> - Required - The cURL handle resource that represents the in-progress transfer.</li>
- * <li><code>$file_handle</code> - <code>resource</code> - Required - The file handle resource that represents the file on the local file system.</li>
- * <li><code>$length</code> - <code>integer</code> - Required - The length in kilobytes of the data chunk that was transferred.</li>
- * </ul>
- *
- * @param string|array|function $callback (Required) The callback function is called by <php:call_user_func()>, so you can pass the following values: <ul>
- * <li>The name of a global function to execute, passed as a string.</li>
- * <li>A method to execute, passed as <code>array('ClassName', 'MethodName')</code>.</li>
- * <li>An anonymous function (PHP 5.3+).</li></ul>
- * @return $this A reference to the current instance.
- */
- public function register_streaming_read_callback($callback)
- {
- $this->registered_streaming_read_callback = $callback;
- return $this;
- }
-
- /**
- * Register a callback function to execute whenever a data stream is written to using
- * <CFRequest::streaming_write_callback()>.
- *
- * The user-defined callback function should accept two arguments:
- *
- * <ul>
- * <li><code>$curl_handle</code> - <code>resource</code> - Required - The cURL handle resource that represents the in-progress transfer.</li>
- * <li><code>$length</code> - <code>integer</code> - Required - The length in kilobytes of the data chunk that was transferred.</li>
- * </ul>
- *
- * @param string|array|function $callback (Required) The callback function is called by <php:call_user_func()>, so you can pass the following values: <ul>
- * <li>The name of a global function to execute, passed as a string.</li>
- * <li>A method to execute, passed as <code>array('ClassName', 'MethodName')</code>.</li>
- * <li>An anonymous function (PHP 5.3+).</li></ul>
- * @return $this A reference to the current instance.
- */
- public function register_streaming_write_callback($callback)
- {
- $this->registered_streaming_write_callback = $callback;
- return $this;
- }
-
- /**
- * Fetches and caches STS credentials. This is meant to be used by the constructor, and is not to be
- * manually invoked.
- *
- * @param CacheCore $cache (Required) The a reference to the cache object that is being used to handle the caching.
- * @param array $options (Required) The options that were passed into the constructor.
- * @return mixed The data to be cached, or NULL.
- */
- public function cache_sts_credentials($cache, $options)
- {
- $token = new AmazonSTS($options);
- $response = $token->get_session_token();
-
- if ($response->isOK())
- {
- // Update the expiration
- $expiration_time = strtotime((string) $response->body->GetSessionTokenResult->Credentials->Expiration);
- $expiration_duration = round(($expiration_time - time()) * 0.85);
- $cache->expire_in($expiration_duration);
-
- // Return the important data
- return array(
- 'key' => (string) $response->body->GetSessionTokenResult->Credentials->AccessKeyId,
- 'secret' => (string) $response->body->GetSessionTokenResult->Credentials->SecretAccessKey,
- 'token' => (string) $response->body->GetSessionTokenResult->Credentials->SessionToken,
- 'expires' => (string) $response->body->GetSessionTokenResult->Credentials->Expiration,
- );
- }
-
- return null;
- }
-
-
- /*%******************************************************************************************%*/
- // SET CUSTOM CLASSES
-
- /**
- * Set a custom class for this functionality. Use this method when extending/overriding existing classes
- * with new functionality.
- *
- * The replacement class must extend from <CFUtilities>.
- *
- * @param string $class (Optional) The name of the new class to use for this functionality.
- * @return $this A reference to the current instance.
- */
- public function set_utilities_class($class = 'CFUtilities')
- {
- $this->utilities_class = $class;
- $this->util = new $this->utilities_class();
- return $this;
- }
-
- /**
- * Set a custom class for this functionality. Use this method when extending/overriding existing classes
- * with new functionality.
- *
- * The replacement class must extend from <CFRequest>.
- *
- * @param string $class (Optional) The name of the new class to use for this functionality.
- * @param $this A reference to the current instance.
- */
- public function set_request_class($class = 'CFRequest')
- {
- $this->request_class = $class;
- return $this;
- }
-
- /**
- * Set a custom class for this functionality. Use this method when extending/overriding existing classes
- * with new functionality.
- *
- * The replacement class must extend from <CFResponse>.
- *
- * @param string $class (Optional) The name of the new class to use for this functionality.
- * @return $this A reference to the current instance.
- */
- public function set_response_class($class = 'CFResponse')
- {
- $this->response_class = $class;
- return $this;
- }
-
- /**
- * Set a custom class for this functionality. Use this method when extending/overriding existing classes
- * with new functionality.
- *
- * The replacement class must extend from <CFSimpleXML>.
- *
- * @param string $class (Optional) The name of the new class to use for this functionality.
- * @return $this A reference to the current instance.
- */
- public function set_parser_class($class = 'CFSimpleXML')
- {
- $this->parser_class = $class;
- return $this;
- }
-
- /**
- * Set a custom class for this functionality. Use this method when extending/overriding existing classes
- * with new functionality.
- *
- * The replacement class must extend from <CFBatchRequest>.
- *
- * @param string $class (Optional) The name of the new class to use for this functionality.
- * @return $this A reference to the current instance.
- */
- public function set_batch_class($class = 'CFBatchRequest')
- {
- $this->batch_class = $class;
- return $this;
- }
-
-
- /*%******************************************************************************************%*/
- // AUTHENTICATION
-
- /**
- * Default, shared method for authenticating a connection to AWS.
- *
- * @param string $operation (Required) Indicates the operation to perform.
- * @param array $payload (Required) An associative array of parameters for authenticating. See the individual methods for allowed keys.
- * @return CFResponse Object containing a parsed HTTP response.
- */
- public function authenticate($operation, $payload)
- {
- $original_payload = $payload;
- $method_arguments = func_get_args();
- $curlopts = array();
- $return_curl_handle = false;
-
- if (substr($operation, 0, strlen($this->operation_prefix)) !== $this->operation_prefix)
- {
- $operation = $this->operation_prefix . $operation;
- }
-
- // Extract the custom CURLOPT settings from the payload
- if (is_array($payload) && isset($payload['curlopts']))
- {
- $curlopts = $payload['curlopts'];
- unset($payload['curlopts']);
- }
-
- // Determine whether the response or curl handle should be returned
- if (is_array($payload) && isset($payload['returnCurlHandle']))
- {
- $return_curl_handle = isset($payload['returnCurlHandle']) ? $payload['returnCurlHandle'] : false;
- unset($payload['returnCurlHandle']);
- }
-
- // Use the caching flow to determine if we need to do a round-trip to the server.
- if ($this->use_cache_flow)
- {
- // Generate an identifier specific to this particular set of arguments.
- $cache_id = $this->key . '_' . get_class($this) . '_' . $operation . '_' . sha1(serialize($method_arguments));
-
- // Instantiate the appropriate caching object.
- $this->cache_object = new $this->cache_class($cache_id, $this->cache_location, $this->cache_expires, $this->cache_compress);
-
- if ($this->delete_cache)
- {
- $this->use_cache_flow = false;
- $this->delete_cache = false;
- return $this->cache_object->delete();
- }
-
- // Invoke the cache callback function to determine whether to pull data from the cache or make a fresh request.
- $data = $this->cache_object->response_manager(array($this, 'cache_callback'), $method_arguments);
-
- // Parse the XML body
- $data = $this->parse_callback($data);
-
- // End!
- return $data;
- }
-
- /*%******************************************************************************************%*/
-
- // Signer
- $signer = new $this->auth_class($this->hostname, $operation, $payload, $this->credentials);
- $signer->key = $this->key;
- $signer->secret_key = $this->secret_key;
- $signer->auth_token = $this->auth_token;
- $signer->api_version = $this->api_version;
- $signer->utilities_class = $this->utilities_class;
- $signer->request_class = $this->request_class;
- $signer->response_class = $this->response_class;
- $signer->use_ssl = $this->use_ssl;
- $signer->proxy = $this->proxy;
- $signer->util = $this->util;
- $signer->registered_streaming_read_callback = $this->registered_streaming_read_callback;
- $signer->registered_streaming_write_callback = $this->registered_streaming_write_callback;
- $request = $signer->authenticate();
-
- // Update RequestCore settings
- $request->request_class = $this->request_class;
- $request->response_class = $this->response_class;
- $request->ssl_verification = $this->ssl_verification;
-
- /*%******************************************************************************************%*/
-
- // Debug mode
- if ($this->debug_mode)
- {
- $request->debug_mode = $this->debug_mode;
- }
-
- // Set custom CURLOPT settings
- if (count($curlopts))
- {
- $request->set_curlopts($curlopts);
- }
-
- // Manage the (newer) batch request API or the (older) returnCurlHandle setting.
- if ($this->use_batch_flow)
- {
- $handle = $request->prep_request();
- $this->batch_object->add($handle);
- $this->use_batch_flow = false;
-
- return $handle;
- }
- elseif ($return_curl_handle)
- {
- return $request->prep_request();
- }
-
- // Send!
- $request->send_request();
-
- // Prepare the response.
- $headers = $request->get_response_header();
- $headers['x-aws-stringtosign'] = $signer->string_to_sign;
-
- if (isset($signer->canonical_request))
- {
- $headers['x-aws-canonicalrequest'] = $signer->canonical_request;
- }
-
- $headers['x-aws-request-headers'] = $request->request_headers;
- $headers['x-aws-body'] = $signer->querystring;
-
- $data = new $this->response_class($headers, ($this->parse_the_response === true) ? $this->parse_callback($request->get_response_body()) : $request->get_response_body(), $request->get_response_code());
-
- // Was it Amazon's fault the request failed? Retry the request until we reach $max_retries.
- if (
- (integer) $request->get_response_code() === 500 || // Internal Error (presumably transient)
- (integer) $request->get_response_code() === 503) // Service Unavailable (presumably transient)
- {
- if ($this->redirects <= $this->max_retries)
- {
- // Exponential backoff
- $delay = (integer) (pow(4, $this->redirects) * 100000);
- usleep($delay);
- $this->redirects++;
- $data = $this->authenticate($operation, $original_payload);
- }
- }
-
- // DynamoDB has custom logic
- elseif (
- (integer) $request->get_response_code() === 400 &&
- stripos((string) $request->get_response_body(), 'com.amazonaws.dynamodb.') !== false && (
- stripos((string) $request->get_response_body(), 'ProvisionedThroughputExceededException') !== false
- )
- )
- {
- if ($this->redirects === 0)
- {
- $this->redirects++;
- $data = $this->authenticate($operation, $original_payload);
- }
- elseif ($this->redirects <= max($this->max_retries, 10))
- {
- // Exponential backoff
- $delay = (integer) (pow(2, ($this->redirects - 1)) * 50000);
- usleep($delay);
- $this->redirects++;
- $data = $this->authenticate($operation, $original_payload);
- }
- }
-
- $this->redirects = 0;
- return $data;
- }
-
-
- /*%******************************************************************************************%*/
- // BATCH REQUEST LAYER
-
- /**
- * Specifies that the intended request should be queued for a later batch request.
- *
- * @param CFBatchRequest $queue (Optional) The <CFBatchRequest> instance to use for managing batch requests. If not available, it generates a new instance of <CFBatchRequest>.
- * @return $this A reference to the current instance.
- */
- public function batch(CFBatchRequest &$queue = null)
- {
- if ($queue)
- {
- $this->batch_object = $queue;
- }
- elseif ($this->internal_batch_object)
- {
- $this->batch_object = &$this->internal_batch_object;
- }
- else
- {
- $this->internal_batch_object = new $this->batch_class();
- $this->batch_object = &$this->internal_batch_object;
- }
-
- $this->use_batch_flow = true;
-
- return $this;
- }
-
- /**
- * Executes the batch request queue by sending all queued requests.
- *
- * @param boolean $clear_after_send (Optional) Whether or not to clear the batch queue after sending a request. Defaults to `true`. Set this to `false` if you are caching batch responses and want to retrieve results later.
- * @return array An array of <CFResponse> objects.
- */
- public function send($clear_after_send = true)
- {
- if ($this->use_batch_flow)
- {
- // When we send the request, disable batch flow.
- $this->use_batch_flow = false;
-
- // If we're not caching, simply send the request.
- if (!$this->use_cache_flow)
- {
- $response = $this->batch_object->send();
- $parsed_data = array_map(array($this, 'parse_callback'), $response);
- $parsed_data = new CFArray($parsed_data);
-
- // Clear the queue
- if ($clear_after_send)
- {
- $this->batch_object->queue = array();
- }
-
- return $parsed_data;
- }
-
- // Generate an identifier specific to this particular set of arguments.
- $cache_id = $this->key . '_' . get_class($this) . '_' . sha1(serialize($this->batch_object));
-
- // Instantiate the appropriate caching object.
- $this->cache_object = new $this->cache_class($cache_id, $this->cache_location, $this->cache_expires, $this->cache_compress);
-
- if ($this->delete_cache)
- {
- $this->use_cache_flow = false;
- $this->delete_cache = false;
- return $this->cache_object->delete();
- }
-
- // Invoke the cache callback function to determine whether to pull data from the cache or make a fresh request.
- $data_set = $this->cache_object->response_manager(array($this, 'cache_callback_batch'), array($this->batch_object));
- $parsed_data = array_map(array($this, 'parse_callback'), $data_set);
- $parsed_data = new CFArray($parsed_data);
-
- // Clear the queue
- if ($clear_after_send)
- {
- $this->batch_object->queue = array();
- }
-
- // End!
- return $parsed_data;
- }
-
- // Load the class
- $null = new CFBatchRequest();
- unset($null);
-
- throw new CFBatchRequest_Exception('You must use $object->batch()->send()');
- }
-
- /**
- * Parses a response body into a PHP object if appropriate.
- *
- * @param CFResponse|string $response (Required) The <CFResponse> object to parse, or an XML string that would otherwise be a response body.
- * @param string $content_type (Optional) The content-type to use when determining how to parse the content.
- * @return CFResponse|string A parsed <CFResponse> object, or parsed XML.
- */
- public function parse_callback($response, $headers = null)
- {
- // Bail out
- if (!$this->parse_the_response) return $response;
-
- // Shorten this so we have a (mostly) single code path
- if (isset($response->body))
- {
- if (is_string($response->body))
- {
- $body = $response->body;
- }
- else
- {
- return $response;
- }
- }
- elseif (is_string($response))
- {
- $body = $response;
- }
- else
- {
- return $response;
- }
-
- // Decompress gzipped content
- if (isset($headers['content-encoding']))
- {
- switch (strtolower(trim($headers['content-encoding'], "\x09\x0A\x0D\x20")))
- {
- case 'gzip':
- case 'x-gzip':
- $decoder = new CFGzipDecode($body);
- if ($decoder->parse())
- {
- $body = $decoder->data;
- }
- break;
-
- case 'deflate':
- if (($uncompressed = gzuncompress($body)) !== false)
- {
- $body = $uncompressed;
- }
- elseif (($uncompressed = gzinflate($body)) !== false)
- {
- $body = $uncompressed;
- }
- break;
- }
- }
-
- // Look for XML cues
- if (
- (isset($headers['content-type']) && ($headers['content-type'] === 'text/xml' || $headers['content-type'] === 'application/xml')) || // We know it's XML
- (!isset($headers['content-type']) && (stripos($body, '<?xml') === 0 || strpos($body, '<Error>') === 0) || preg_match('/^<(\w*) xmlns="http(s?):\/\/(\w*).amazon(aws)?.com/im', $body)) // Sniff for XML
- )
- {
- // Strip the default XML namespace to simplify XPath expressions
- $body = str_replace("xmlns=", "ns=", $body);
-
- try {
- // Parse the XML body
- $body = new $this->parser_class($body);
- }
- catch (Exception $e)
- {
- throw new Parser_Exception($e->getMessage());
- }
- }
- // Look for JSON cues
- elseif (
- (isset($headers['content-type']) && ($headers['content-type'] === 'application/json') || $headers['content-type'] === 'application/x-amz-json-1.0') || // We know it's JSON
- (!isset($headers['content-type']) && $this->util->is_json($body)) // Sniff for JSON
- )
- {
- // Normalize JSON to a CFSimpleXML object
- $body = CFJSON::to_xml($body, $this->parser_class);
- }
-
- // Put the parsed data back where it goes
- if (isset($response->body))
- {
- $response->body = $body;
- }
- else
- {
- $response = $body;
- }
-
- return $response;
- }
-
-
- /*%******************************************************************************************%*/
- // CACHING LAYER
-
- /**
- * Specifies that the resulting <CFResponse> object should be cached according to the settings from
- * <set_cache_config()>.
- *
- * @param string|integer $expires (Required) The time the cache is to expire. Accepts a number of seconds as an integer, or an amount of time, as a string, that is understood by <php:strtotime()> (e.g. "1 hour").
- * @param $this A reference to the current instance.
- * @return $this
- */
- public function cache($expires)
- {
- // Die if they haven't used set_cache_config().
- if (!$this->cache_class)
- {
- throw new CFRuntime_Exception('Must call set_cache_config() before using cache()');
- }
-
- if (is_string($expires))
- {
- $expires = strtotime($expires);
- $this->cache_expires = $expires - time();
- }
- elseif (is_int($expires))
- {
- $this->cache_expires = $expires;
- }
-
- $this->use_cache_flow = true;
-
- return $this;
- }
-
- /**
- * The callback function that is executed when the cache doesn't exist or has expired. The response of
- * this method is cached. Accepts identical parameters as the <authenticate()> method. Never call this
- * method directly -- it is used internally by the caching system.
- *
- * @param string $operation (Required) Indicates the operation to perform.
- * @param array $payload (Required) An associative array of parameters for authenticating. See the individual methods for allowed keys.
- * @return CFResponse A parsed HTTP response.
- */
- public function cache_callback($operation, $payload)
- {
- // Disable the cache flow since it's already been handled.
- $this->use_cache_flow = false;
-
- // Make the request
- $response = $this->authenticate($operation, $payload);
-
- // If this is an XML document, convert it back to a string.
- if (isset($response->body) && ($response->body instanceof SimpleXMLElement))
- {
- $response->body = $response->body->asXML();
- }
-
- return $response;
- }
-
- /**
- * Used for caching the results of a batch request. Never call this method directly; it is used
- * internally by the caching system.
- *
- * @param CFBatchRequest $batch (Required) The batch request object to send.
- * @return CFResponse A parsed HTTP response.
- */
- public function cache_callback_batch(CFBatchRequest $batch)
- {
- return $batch->send();
- }
-
- /**
- * Deletes a cached <CFResponse> object using the specified cache storage type.
- *
- * @return boolean A value of `true` if cached object exists and is successfully deleted, otherwise `false`.
- */
- public function delete_cache()
- {
- $this->use_cache_flow = true;
- $this->delete_cache = true;
-
- return $this;
- }
-}
-
-
-/**
- * Contains the functionality for auto-loading service classes.
- */
-class CFLoader
-{
- /*%******************************************************************************************%*/
- // AUTO-LOADER
-
- /**
- * Automatically load classes that aren't included.
- *
- * @param string $class (Required) The classname to load.
- * @return boolean Whether or not the file was successfully loaded.
- */
- public static function autoloader($class)
- {
- $path = dirname(__FILE__) . DIRECTORY_SEPARATOR;
-
- // Amazon SDK classes
- if (strstr($class, 'Amazon'))
- {
- if (file_exists($require_this = $path . 'services' . DIRECTORY_SEPARATOR . str_ireplace('Amazon', '', strtolower($class)) . '.class.php'))
- {
- require_once $require_this;
- return true;
- }
-
- return false;
- }
-
- // Utility classes
- elseif (strstr($class, 'CF'))
- {
- if (file_exists($require_this = $path . 'utilities' . DIRECTORY_SEPARATOR . str_ireplace('CF', '', strtolower($class)) . '.class.php'))
- {
- require_once $require_this;
- return true;
- }
-
- return false;
- }
-
- // Load CacheCore
- elseif (strstr($class, 'Cache'))
- {
- if (file_exists($require_this = $path . 'lib' . DIRECTORY_SEPARATOR . 'cachecore' . DIRECTORY_SEPARATOR . strtolower($class) . '.class.php'))
- {
- require_once $require_this;
- return true;
- }
-
- return false;
- }
-
- // Load RequestCore
- elseif (strstr($class, 'RequestCore') || strstr($class, 'ResponseCore'))
- {
- if (file_exists($require_this = $path . 'lib' . DIRECTORY_SEPARATOR . 'requestcore' . DIRECTORY_SEPARATOR . 'requestcore.class.php'))
- {
- require_once $require_this;
- return true;
- }
-
- return false;
- }
-
- // Load array-to-domdocument
- elseif (strstr($class, 'Array2DOM'))
- {
- if (file_exists($require_this = $path . 'lib' . DIRECTORY_SEPARATOR . 'dom' . DIRECTORY_SEPARATOR . 'ArrayToDOMDocument.php'))
- {
- require_once $require_this;
- return true;
- }
-
- return false;
- }
-
- // Load Authentication Signers
- elseif (strstr($class, 'Auth'))
- {
- if (file_exists($require_this = $path . 'authentication' . DIRECTORY_SEPARATOR . str_replace('auth', 'signature_', strtolower($class)) . '.class.php'))
- {
- require_once $require_this;
- return true;
- }
-
- return false;
- }
-
- // Load Signer interface
- elseif ($class === 'Signer')
- {
- if (!interface_exists('Signable', false) &&
- file_exists($require_this = $path . 'authentication' . DIRECTORY_SEPARATOR . 'signable.interface.php'))
- {
- require_once $require_this;
- }
-
- if (file_exists($require_this = $path . 'authentication' . DIRECTORY_SEPARATOR . 'signer.abstract.php'))
- {
- require_once $require_this;
- return true;
- }
-
- return false;
- }
-
- // Load Symfony YAML classes
- elseif (strstr($class, 'sfYaml'))
- {
- if (file_exists($require_this = $path . 'lib' . DIRECTORY_SEPARATOR . 'yaml' . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'sfYaml.php'))
- {
- require_once $require_this;
- return true;
- }
-
- return false;
- }
-
- return false;
- }
-}
-
-// Register the autoloader.
-spl_autoload_register(array('CFLoader', 'autoloader'));
-
-// Don't look for any configuration files, the Amazon S3 storage backend handles configuration
-
-// /*%******************************************************************************************%*/
-// // CONFIGURATION
-//
-// // Look for include file in the same directory (e.g. `./config.inc.php`).
-// if (file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'config.inc.php'))
-// {
-// include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'config.inc.php';
-// }
-// // Fallback to `~/.aws/sdk/config.inc.php`
-// else
-// {
-// if (!isset($_ENV['HOME']) && isset($_SERVER['HOME']))
-// {
-// $_ENV['HOME'] = $_SERVER['HOME'];
-// }
-// elseif (!isset($_ENV['HOME']) && !isset($_SERVER['HOME']))
-// {
-// $_ENV['HOME'] = `cd ~ && pwd`;
-// if (!$_ENV['HOME'])
-// {
-// switch (strtolower(PHP_OS))
-// {
-// case 'darwin':
-// $_ENV['HOME'] = '/Users/' . get_current_user();
-// break;
-//
-// case 'windows':
-// case 'winnt':
-// case 'win32':
-// $_ENV['HOME'] = 'c:' . DIRECTORY_SEPARATOR . 'Documents and Settings' . DIRECTORY_SEPARATOR . get_current_user();
-// break;
-//
-// default:
-// $_ENV['HOME'] = '/home/' . get_current_user();
-// break;
-// }
-// }
-// }
-//
-// if (getenv('HOME') && file_exists(getenv('HOME') . DIRECTORY_SEPARATOR . '.aws' . DIRECTORY_SEPARATOR . 'sdk' . DIRECTORY_SEPARATOR . 'config.inc.php'))
-// {
-// include_once getenv('HOME') . DIRECTORY_SEPARATOR . '.aws' . DIRECTORY_SEPARATOR . 'sdk' . DIRECTORY_SEPARATOR . 'config.inc.php';
-// }
-// }
diff --git a/3rdparty/aws-sdk/services/s3.class.php b/3rdparty/aws-sdk/services/s3.class.php
deleted file mode 100755
index 2e9e1cd52b1..00000000000
--- a/3rdparty/aws-sdk/services/s3.class.php
+++ /dev/null
@@ -1,3979 +0,0 @@
-<?php
-/*
- * Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License").
- * You may not use this file except in compliance with the License.
- * A copy of the License is located at
- *
- * http://aws.amazon.com/apache2.0
- *
- * or in the "license" file accompanying this file. This file is distributed
- * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-
-/*%******************************************************************************************%*/
-// EXCEPTIONS
-
-/**
- * Default S3 Exception.
- */
-class S3_Exception extends Exception {}
-
-
-/*%******************************************************************************************%*/
-// MAIN CLASS
-
-/**
- * Amazon S3 is a web service that enables you to store data in the cloud. You can then download the data
- * or use the data with other AWS services, such as Amazon Elastic Cloud Computer (EC2).
- *
- * Amazon Simple Storage Service (Amazon S3) is storage for the Internet. You can use Amazon S3 to store
- * and retrieve any amount of data at any time, from anywhere on the web. You can accomplish these tasks
- * using the AWS Management Console, which is a simple and intuitive web interface.
- *
- * To get the most out of Amazon S3, you need to understand a few simple concepts. Amazon S3 stores data
- * as objects in buckets. An object is comprised of a file and optionally any metadata that describes
- * that file.
- *
- * To store an object in Amazon S3, you upload the file you want to store to a bucket. When you upload a
- * file, you can set permissions on the object as well as any metadata.
- *
- * Buckets are the containers for objects. You can have one or more buckets. For each bucket, you can control
- * access to the bucket (who can create, delete, and list objects in the bucket), view access logs for the
- * bucket and its objects, and choose the geographical region where Amazon S3 will store the bucket and its
- * contents.
- *
- * Visit <http://aws.amazon.com/s3/> for more information.
- *
- * @version 2012.01.17
- * @license See the included NOTICE.md file for more information.
- * @copyright See the included NOTICE.md file for more information.
- * @link http://aws.amazon.com/s3/ Amazon Simple Storage Service
- * @link http://aws.amazon.com/documentation/s3/ Amazon Simple Storage Service documentation
- */
-class AmazonS3 extends CFRuntime
-{
- /*%******************************************************************************************%*/
- // REGIONAL ENDPOINTS
-
- /**
- * Specify the queue URL for the US-Standard (Northern Virginia & Washington State) Region.
- */
- const REGION_US_E1 = 's3.amazonaws.com';
-
- /**
- * Specify the queue URL for the US-Standard (Northern Virginia & Washington State) Region.
- */
- const REGION_VIRGINIA = self::REGION_US_E1;
-
- /**
- * Specify the queue URL for the US-Standard (Northern Virginia & Washington State) Region.
- */
- const REGION_US_STANDARD = self::REGION_US_E1;
-
- /**
- * Specify the queue URL for the US-West 1 (Northern California) Region.
- */
- const REGION_US_W1 = 's3-us-west-1.amazonaws.com';
-
- /**
- * Specify the queue URL for the US-West 1 (Northern California) Region.
- */
- const REGION_CALIFORNIA = self::REGION_US_W1;
-
- /**
- * Specify the queue URL for the US-West 2 (Oregon) Region.
- */
- const REGION_US_W2 = 's3-us-west-2.amazonaws.com';
-
- /**
- * Specify the queue URL for the US-West 2 (Oregon) Region.
- */
- const REGION_OREGON = self::REGION_US_W2;
-
- /**
- * Specify the queue URL for the EU (Ireland) Region.
- */
- const REGION_EU_W1 = 's3-eu-west-1.amazonaws.com';
-
- /**
- * Specify the queue URL for the EU (Ireland) Region.
- */
- const REGION_IRELAND = self::REGION_EU_W1;
-
- /**
- * Specify the queue URL for the Asia Pacific (Singapore) Region.
- */
- const REGION_APAC_SE1 = 's3-ap-southeast-1.amazonaws.com';
-
- /**
- * Specify the queue URL for the Asia Pacific (Singapore) Region.
- */
- const REGION_SINGAPORE = self::REGION_APAC_SE1;
-
- /**
- * Specify the queue URL for the Asia Pacific (Japan) Region.
- */
- const REGION_APAC_NE1 = 's3-ap-northeast-1.amazonaws.com';
-
- /**
- * Specify the queue URL for the Asia Pacific (Japan) Region.
- */
- const REGION_TOKYO = self::REGION_APAC_NE1;
-
- /**
- * Specify the queue URL for the South America (Sao Paulo) Region.
- */
- const REGION_SA_E1 = 's3-sa-east-1.amazonaws.com';
-
- /**
- * Specify the queue URL for the South America (Sao Paulo) Region.
- */
- const REGION_SAO_PAULO = self::REGION_SA_E1;
-
- /**
- * Specify the queue URL for the United States GovCloud Region.
- */
- const REGION_US_GOV1 = 's3-us-gov-west-1.amazonaws.com';
-
- /**
- * Specify the queue URL for the United States GovCloud FIPS 140-2 Region.
- */
- const REGION_US_GOV1_FIPS = 's3-fips-us-gov-west-1.amazonaws.com';
-
- /**
- * The default endpoint.
- */
- const DEFAULT_URL = self::REGION_US_E1;
-
-
- /*%******************************************************************************************%*/
- // REGIONAL WEBSITE ENDPOINTS
-
- /**
- * Specify the queue URL for the US-Standard (Northern Virginia & Washington State) Website Region.
- */
- const REGION_US_E1_WEBSITE = 's3-website-us-east-1.amazonaws.com';
-
- /**
- * Specify the queue URL for the US-Standard (Northern Virginia & Washington State) Website Region.
- */
- const REGION_VIRGINIA_WEBSITE = self::REGION_US_E1_WEBSITE;
-
- /**
- * Specify the queue URL for the US-Standard (Northern Virginia & Washington State) Website Region.
- */
- const REGION_US_STANDARD_WEBSITE = self::REGION_US_E1_WEBSITE;
-
- /**
- * Specify the queue URL for the US-West 1 (Northern California) Website Region.
- */
- const REGION_US_W1_WEBSITE = 's3-website-us-west-1.amazonaws.com';
-
- /**
- * Specify the queue URL for the US-West 1 (Northern California) Website Region.
- */
- const REGION_CALIFORNIA_WEBSITE = self::REGION_US_W1_WEBSITE;
-
- /**
- * Specify the queue URL for the US-West 2 (Oregon) Website Region.
- */
- const REGION_US_W2_WEBSITE = 's3-website-us-west-2.amazonaws.com';
-
- /**
- * Specify the queue URL for the US-West 2 (Oregon) Website Region.
- */
- const REGION_OREGON_WEBSITE = self::REGION_US_W2_WEBSITE;
-
- /**
- * Specify the queue URL for the EU (Ireland) Website Region.
- */
- const REGION_EU_W1_WEBSITE = 's3-website-eu-west-1.amazonaws.com';
-
- /**
- * Specify the queue URL for the EU (Ireland) Website Region.
- */
- const REGION_IRELAND_WEBSITE = self::REGION_EU_W1_WEBSITE;
-
- /**
- * Specify the queue URL for the Asia Pacific (Singapore) Website Region.
- */
- const REGION_APAC_SE1_WEBSITE = 's3-website-ap-southeast-1.amazonaws.com';
-
- /**
- * Specify the queue URL for the Asia Pacific (Singapore) Website Region.
- */
- const REGION_SINGAPORE_WEBSITE = self::REGION_APAC_SE1_WEBSITE;
-
- /**
- * Specify the queue URL for the Asia Pacific (Japan) Website Region.
- */
- const REGION_APAC_NE1_WEBSITE = 's3-website-ap-northeast-1.amazonaws.com';
-
- /**
- * Specify the queue URL for the Asia Pacific (Japan) Website Region.
- */
- const REGION_TOKYO_WEBSITE = self::REGION_APAC_NE1_WEBSITE;
-
- /**
- * Specify the queue URL for the South America (Sao Paulo) Website Region.
- */
- const REGION_SA_E1_WEBSITE = 's3-website-sa-east-1.amazonaws.com';
-
- /**
- * Specify the queue URL for the South America (Sao Paulo) Website Region.
- */
- const REGION_SAO_PAULO_WEBSITE = self::REGION_SA_E1_WEBSITE;
-
- /**
- * Specify the queue URL for the United States GovCloud Website Region.
- */
- const REGION_US_GOV1_WEBSITE = 's3-website-us-gov-west-1.amazonaws.com';
-
-
- /*%******************************************************************************************%*/
- // ACL
-
- /**
- * ACL: Owner-only read/write.
- */
- const ACL_PRIVATE = 'private';
-
- /**
- * ACL: Owner read/write, public read.
- */
- const ACL_PUBLIC = 'public-read';
-
- /**
- * ACL: Public read/write.
- */
- const ACL_OPEN = 'public-read-write';
-
- /**
- * ACL: Owner read/write, authenticated read.
- */
- const ACL_AUTH_READ = 'authenticated-read';
-
- /**
- * ACL: Bucket owner read.
- */
- const ACL_OWNER_READ = 'bucket-owner-read';
-
- /**
- * ACL: Bucket owner full control.
- */
- const ACL_OWNER_FULL_CONTROL = 'bucket-owner-full-control';
-
-
- /*%******************************************************************************************%*/
- // GRANTS
-
- /**
- * When applied to a bucket, grants permission to list the bucket. When applied to an object, this
- * grants permission to read the object data and/or metadata.
- */
- const GRANT_READ = 'READ';
-
- /**
- * When applied to a bucket, grants permission to create, overwrite, and delete any object in the
- * bucket. This permission is not supported for objects.
- */
- const GRANT_WRITE = 'WRITE';
-
- /**
- * Grants permission to read the ACL for the applicable bucket or object. The owner of a bucket or
- * object always has this permission implicitly.
- */
- const GRANT_READ_ACP = 'READ_ACP';
-
- /**
- * Gives permission to overwrite the ACP for the applicable bucket or object. The owner of a bucket
- * or object always has this permission implicitly. Granting this permission is equivalent to granting
- * FULL_CONTROL because the grant recipient can make any changes to the ACP.
- */
- const GRANT_WRITE_ACP = 'WRITE_ACP';
-
- /**
- * Provides READ, WRITE, READ_ACP, and WRITE_ACP permissions. It does not convey additional rights and
- * is provided only for convenience.
- */
- const GRANT_FULL_CONTROL = 'FULL_CONTROL';
-
-
- /*%******************************************************************************************%*/
- // USERS
-
- /**
- * The "AuthenticatedUsers" group for access control policies.
- */
- const USERS_AUTH = 'http://acs.amazonaws.com/groups/global/AuthenticatedUsers';
-
- /**
- * The "AllUsers" group for access control policies.
- */
- const USERS_ALL = 'http://acs.amazonaws.com/groups/global/AllUsers';
-
- /**
- * The "LogDelivery" group for access control policies.
- */
- const USERS_LOGGING = 'http://acs.amazonaws.com/groups/s3/LogDelivery';
-
-
- /*%******************************************************************************************%*/
- // PATTERNS
-
- /**
- * PCRE: Match all items
- */
- const PCRE_ALL = '/.*/i';
-
-
- /*%******************************************************************************************%*/
- // STORAGE
-
- /**
- * Standard storage redundancy.
- */
- const STORAGE_STANDARD = 'STANDARD';
-
- /**
- * Reduced storage redundancy.
- */
- const STORAGE_REDUCED = 'REDUCED_REDUNDANCY';
-
-
- /*%******************************************************************************************%*/
- // PROPERTIES
-
- /**
- * The request URL.
- */
- public $request_url;
-
- /**
- * The virtual host setting.
- */
- public $vhost;
-
- /**
- * The base XML elements to use for access control policy methods.
- */
- public $base_acp_xml;
-
- /**
- * The base XML elements to use for creating buckets in regions.
- */
- public $base_location_constraint;
-
- /**
- * The base XML elements to use for logging methods.
- */
- public $base_logging_xml;
-
- /**
- * The base XML elements to use for notifications.
- */
- public $base_notification_xml;
-
- /**
- * The base XML elements to use for versioning.
- */
- public $base_versioning_xml;
-
- /**
- * The base XML elements to use for completing a multipart upload.
- */
- public $complete_mpu_xml;
-
- /**
- * The base XML elements to use for website support.
- */
- public $website_config_xml;
-
- /**
- * The base XML elements to use for multi-object delete support.
- */
- public $multi_object_delete_xml;
-
- /**
- * The base XML elements to use for object expiration support.
- */
- public $object_expiration_xml;
-
- /**
- * The DNS vs. Path-style setting.
- */
- public $path_style = false;
-
- /**
- * The state of whether the prefix change is temporary or permanent.
- */
- public $temporary_prefix = false;
-
-
- /*%******************************************************************************************%*/
- // CONSTRUCTOR
-
- /**
- * Constructs a new instance of <AmazonS3>.
- *
- * @param array $options (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>certificate_authority</code> - <code>boolean</code> - Optional - Determines which Cerificate Authority file to use. A value of boolean <code>false</code> will use the Certificate Authority file available on the system. A value of boolean <code>true</code> will use the Certificate Authority provided by the SDK. Passing a file system path to a Certificate Authority file (chmodded to <code>0755</code>) will use that. Leave this set to <code>false</code> if you're not sure.</li>
- * <li><code>credentials</code> - <code>string</code> - Optional - The name of the credential set to use for authentication.</li>
- * <li><code>default_cache_config</code> - <code>string</code> - Optional - This option allows a preferred storage type to be configured for long-term caching. This can be changed later using the <set_cache_config()> method. Valid values are: <code>apc</code>, <code>xcache</code>, or a file system path such as <code>./cache</code> or <code>/tmp/cache/</code>.</li>
- * <li><code>key</code> - <code>string</code> - Optional - Your AWS key, or a session key. If blank, the default credential set will be used.</li>
- * <li><code>secret</code> - <code>string</code> - Optional - Your AWS secret key, or a session secret key. If blank, the default credential set will be used.</li>
- * <li><code>token</code> - <code>string</code> - Optional - An AWS session token.</li></ul>
- * @return void
- */
- public function __construct(array $options = array())
- {
- $this->vhost = null;
- $this->api_version = '2006-03-01';
- $this->hostname = self::DEFAULT_URL;
-
- $this->base_acp_xml = '<?xml version="1.0" encoding="UTF-8"?><AccessControlPolicy xmlns="http://s3.amazonaws.com/doc/latest/"></AccessControlPolicy>';
- $this->base_location_constraint = '<?xml version="1.0" encoding="UTF-8"?><CreateBucketConfiguration xmlns="http://s3.amazonaws.com/doc/' . $this->api_version . '/"><LocationConstraint></LocationConstraint></CreateBucketConfiguration>';
- $this->base_logging_xml = '<?xml version="1.0" encoding="utf-8"?><BucketLoggingStatus xmlns="http://doc.s3.amazonaws.com/' . $this->api_version . '"></BucketLoggingStatus>';
- $this->base_notification_xml = '<?xml version="1.0" encoding="utf-8"?><NotificationConfiguration></NotificationConfiguration>';
- $this->base_versioning_xml = '<?xml version="1.0" encoding="utf-8"?><VersioningConfiguration xmlns="http://s3.amazonaws.com/doc/' . $this->api_version . '/"></VersioningConfiguration>';
- $this->complete_mpu_xml = '<?xml version="1.0" encoding="utf-8"?><CompleteMultipartUpload></CompleteMultipartUpload>';
- $this->website_config_xml = '<?xml version="1.0" encoding="utf-8"?><WebsiteConfiguration xmlns="http://s3.amazonaws.com/doc/' . $this->api_version . '/"><IndexDocument><Suffix>index.html</Suffix></IndexDocument><ErrorDocument><Key>error.html</Key></ErrorDocument></WebsiteConfiguration>';
- $this->multi_object_delete_xml = '<?xml version="1.0" encoding="utf-8"?><Delete></Delete>';
- $this->object_expiration_xml = '<?xml version="1.0" encoding="utf-8"?><LifecycleConfiguration></LifecycleConfiguration>';
-
- parent::__construct($options);
- }
-
-
- /*%******************************************************************************************%*/
- // AUTHENTICATION
-
- /**
- * Authenticates a connection to Amazon S3. Do not use directly unless implementing custom methods for
- * this class.
- *
- * @param string $operation (Required) The name of the bucket to operate on (S3 Only).
- * @param array $payload (Required) An associative array of parameters for authenticating. See inline comments for allowed keys.
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- * @link http://docs.amazonwebservices.com/AmazonS3/latest/dev/S3_Authentication.html REST authentication
- */
- public function authenticate($operation, $payload)
- {
- /*
- * Overriding or extending this class? You can pass the following "magic" keys into $opt.
- *
- * ## verb, resource, sub_resource and query_string ##
- * <verb> /<resource>?<sub_resource>&<query_string>
- * GET /filename.txt?versions&prefix=abc&max-items=1
- *
- * ## versionId, uploadId, partNumber, response-* ##
- * These don't follow the same rules as above, in that the they needs to be signed, while
- * other query_string values do not.
- *
- * ## curlopts ##
- * These values get passed directly to the cURL methods in RequestCore.
- *
- * ## fileUpload, fileDownload, seekTo ##
- * These are slightly modified and then passed to the cURL methods in RequestCore.
- *
- * ## headers ##
- * $opt['headers'] is an array, whose keys are HTTP headers to be sent.
- *
- * ## body ##
- * This is the request body that is sent to the server via PUT/POST.
- *
- * ## preauth ##
- * This is a hook that tells authenticate() to generate a pre-authenticated URL.
- *
- * ## returnCurlHandle ##
- * Tells authenticate() to return the cURL handle for the request instead of executing it.
- */
-
- // Rename variables (to overcome inheritence issues)
- $bucket = $operation;
- $opt = $payload;
-
- // Validate the S3 bucket name
- if (!$this->validate_bucketname_support($bucket))
- {
- // @codeCoverageIgnoreStart
- throw new S3_Exception('S3 does not support "' . $bucket . '" as a valid bucket name. Review "Bucket Restrictions and Limitations" in the S3 Developer Guide for more information.');
- // @codeCoverageIgnoreEnd
- }
-
- // Die if $opt isn't set.
- if (!$opt) return false;
-
- $method_arguments = func_get_args();
-
- // Use the caching flow to determine if we need to do a round-trip to the server.
- if ($this->use_cache_flow)
- {
- // Generate an identifier specific to this particular set of arguments.
- $cache_id = $this->key . '_' . get_class($this) . '_' . $bucket . '_' . sha1(serialize($method_arguments));
-
- // Instantiate the appropriate caching object.
- $this->cache_object = new $this->cache_class($cache_id, $this->cache_location, $this->cache_expires, $this->cache_compress);
-
- if ($this->delete_cache)
- {
- $this->use_cache_flow = false;
- $this->delete_cache = false;
- return $this->cache_object->delete();
- }
-
- // Invoke the cache callback function to determine whether to pull data from the cache or make a fresh request.
- $data = $this->cache_object->response_manager(array($this, 'cache_callback'), $method_arguments);
-
- if ($this->parse_the_response)
- {
- // Parse the XML body
- $data = $this->parse_callback($data);
- }
-
- // End!
- return $data;
- }
-
- // If we haven't already set a resource prefix and the bucket name isn't DNS-valid...
- if ((!$this->resource_prefix && !$this->validate_bucketname_create($bucket)) || $this->path_style)
- {
- // Fall back to the older path-style URI
- $this->set_resource_prefix('/' . $bucket);
- $this->temporary_prefix = true;
- }
-
- // Determine hostname
- $scheme = $this->use_ssl ? 'https://' : 'http://';
- if ($this->resource_prefix || $this->path_style) // Use bucket-in-path method.
- {
- $hostname = $this->hostname . $this->resource_prefix . (($bucket === '' || $this->resource_prefix === '/' . $bucket) ? '' : ('/' . $bucket));
- }
- else
- {
- $hostname = $this->vhost ? $this->vhost : (($bucket === '') ? $this->hostname : ($bucket . '.') . $this->hostname);
- }
-
- // Get the UTC timestamp in RFC 2616 format
- $date = gmdate(CFUtilities::DATE_FORMAT_RFC2616, time());
-
- // Storage for request parameters.
- $resource = '';
- $sub_resource = '';
- $querystringparams = array();
- $signable_querystringparams = array();
- $string_to_sign = '';
- $headers = array(
- 'Content-MD5' => '',
- 'Content-Type' => 'application/x-www-form-urlencoded',
- 'Date' => $date
- );
-
- /*%******************************************************************************************%*/
-
- // Do we have an authentication token?
- if ($this->auth_token)
- {
- $headers['X-Amz-Security-Token'] = $this->auth_token;
- }
-
- // Handle specific resources
- if (isset($opt['resource']))
- {
- $resource .= $opt['resource'];
- }
-
- // Merge query string values
- if (isset($opt['query_string']))
- {
- $querystringparams = array_merge($querystringparams, $opt['query_string']);
- }
- $query_string = $this->util->to_query_string($querystringparams);
-
- // Merge the signable query string values. Must be alphabetical.
- $signable_list = array(
- 'partNumber',
- 'response-cache-control',
- 'response-content-disposition',
- 'response-content-encoding',
- 'response-content-language',
- 'response-content-type',
- 'response-expires',
- 'uploadId',
- 'versionId'
- );
- foreach ($signable_list as $item)
- {
- if (isset($opt[$item]))
- {
- $signable_querystringparams[$item] = $opt[$item];
- }
- }
- $signable_query_string = $this->util->to_query_string($signable_querystringparams);
-
- // Merge the HTTP headers
- if (isset($opt['headers']))
- {
- $headers = array_merge($headers, $opt['headers']);
- }
-
- // Compile the URI to request
- $conjunction = '?';
- $signable_resource = '/' . str_replace('%2F', '/', rawurlencode($resource));
- $non_signable_resource = '';
-
- if (isset($opt['sub_resource']))
- {
- $signable_resource .= $conjunction . rawurlencode($opt['sub_resource']);
- $conjunction = '&';
- }
- if ($signable_query_string !== '')
- {
- $signable_query_string = $conjunction . $signable_query_string;
- $conjunction = '&';
- }
- if ($query_string !== '')
- {
- $non_signable_resource .= $conjunction . $query_string;
- $conjunction = '&';
- }
- if (substr($hostname, -1) === substr($signable_resource, 0, 1))
- {
- $signable_resource = ltrim($signable_resource, '/');
- }
-
- $this->request_url = $scheme . $hostname . $signable_resource . $signable_query_string . $non_signable_resource;
-
- if (isset($opt['location']))
- {
- $this->request_url = $opt['location'];
- }
-
- // Gather information to pass along to other classes.
- $helpers = array(
- 'utilities' => $this->utilities_class,
- 'request' => $this->request_class,
- 'response' => $this->response_class,
- );
-
- // Instantiate the request class
- $request = new $this->request_class($this->request_url, $this->proxy, $helpers, $this->credentials);
-
- // Update RequestCore settings
- $request->request_class = $this->request_class;
- $request->response_class = $this->response_class;
- $request->ssl_verification = $this->ssl_verification;
-
- // Pass along registered stream callbacks
- if ($this->registered_streaming_read_callback)
- {
- $request->register_streaming_read_callback($this->registered_streaming_read_callback);
- }
-
- if ($this->registered_streaming_write_callback)
- {
- $request->register_streaming_write_callback($this->registered_streaming_write_callback);
- }
-
- // Streaming uploads
- if (isset($opt['fileUpload']))
- {
- if (is_resource($opt['fileUpload']))
- {
- // Determine the length to read from the stream
- $length = null; // From current position until EOF by default, size determined by set_read_stream()
-
- if (isset($headers['Content-Length']))
- {
- $length = $headers['Content-Length'];
- }
- elseif (isset($opt['seekTo']))
- {
- // Read from seekTo until EOF by default
- $stats = fstat($opt['fileUpload']);
-
- if ($stats && $stats['size'] >= 0)
- {
- $length = $stats['size'] - (integer) $opt['seekTo'];
- }
- }
-
- $request->set_read_stream($opt['fileUpload'], $length);
-
- if ($headers['Content-Type'] === 'application/x-www-form-urlencoded')
- {
- $headers['Content-Type'] = 'application/octet-stream';
- }
- }
- else
- {
- $request->set_read_file($opt['fileUpload']);
-
- // Determine the length to read from the file
- $length = $request->read_stream_size; // The file size by default
-
- if (isset($headers['Content-Length']))
- {
- $length = $headers['Content-Length'];
- }
- elseif (isset($opt['seekTo']) && isset($length))
- {
- // Read from seekTo until EOF by default
- $length -= (integer) $opt['seekTo'];
- }
-
- $request->set_read_stream_size($length);
-
- // Attempt to guess the correct mime-type
- if ($headers['Content-Type'] === 'application/x-www-form-urlencoded')
- {
- $extension = explode('.', $opt['fileUpload']);
- $extension = array_pop($extension);
- $mime_type = CFMimeTypes::get_mimetype($extension);
- $headers['Content-Type'] = $mime_type;
- }
- }
-
- $headers['Content-Length'] = $request->read_stream_size;
- $headers['Content-MD5'] = '';
- }
-
- // Handle streaming file offsets
- if (isset($opt['seekTo']))
- {
- // Pass the seek position to RequestCore
- $request->set_seek_position((integer) $opt['seekTo']);
- }
-
- // Streaming downloads
- if (isset($opt['fileDownload']))
- {
- if (is_resource($opt['fileDownload']))
- {
- $request->set_write_stream($opt['fileDownload']);
- }
- else
- {
- $request->set_write_file($opt['fileDownload']);
- }
- }
-
- $curlopts = array();
-
- // Set custom CURLOPT settings
- if (isset($opt['curlopts']))
- {
- $curlopts = $opt['curlopts'];
- }
-
- // Debug mode
- if ($this->debug_mode)
- {
- $curlopts[CURLOPT_VERBOSE] = true;
- }
-
- // Set the curl options.
- if (count($curlopts))
- {
- $request->set_curlopts($curlopts);
- }
-
- // Do we have a verb?
- if (isset($opt['verb']))
- {
- $request->set_method($opt['verb']);
- $string_to_sign .= $opt['verb'] . "\n";
- }
-
- // Add headers and content when we have a body
- if (isset($opt['body']))
- {
- $request->set_body($opt['body']);
- $headers['Content-Length'] = strlen($opt['body']);
-
- if ($headers['Content-Type'] === 'application/x-www-form-urlencoded')
- {
- $headers['Content-Type'] = 'application/octet-stream';
- }
-
- if (!isset($opt['NoContentMD5']) || $opt['NoContentMD5'] !== true)
- {
- $headers['Content-MD5'] = $this->util->hex_to_base64(md5($opt['body']));
- }
- }
-
- // Handle query-string authentication
- if (isset($opt['preauth']) && (integer) $opt['preauth'] > 0)
- {
- unset($headers['Date']);
- $headers['Content-Type'] = '';
- $headers['Expires'] = is_int($opt['preauth']) ? $opt['preauth'] : strtotime($opt['preauth']);
- }
-
- // Sort headers
- uksort($headers, 'strnatcasecmp');
-
- // Add headers to request and compute the string to sign
- foreach ($headers as $header_key => $header_value)
- {
- // Strip linebreaks from header values as they're illegal and can allow for security issues
- $header_value = str_replace(array("\r", "\n"), '', $header_value);
-
- // Add the header if it has a value
- if ($header_value !== '')
- {
- $request->add_header($header_key, $header_value);
- }
-
- // Generate the string to sign
- if (
- strtolower($header_key) === 'content-md5' ||
- strtolower($header_key) === 'content-type' ||
- strtolower($header_key) === 'date' ||
- (strtolower($header_key) === 'expires' && isset($opt['preauth']) && (integer) $opt['preauth'] > 0)
- )
- {
- $string_to_sign .= $header_value . "\n";
- }
- elseif (substr(strtolower($header_key), 0, 6) === 'x-amz-')
- {
- $string_to_sign .= strtolower($header_key) . ':' . $header_value . "\n";
- }
- }
-
- // Add the signable resource location
- $string_to_sign .= ($this->resource_prefix ? $this->resource_prefix : '');
- $string_to_sign .= (($bucket === '' || $this->resource_prefix === '/' . $bucket) ? '' : ('/' . $bucket)) . $signable_resource . urldecode($signable_query_string);
-
- // Hash the AWS secret key and generate a signature for the request.
- $signature = base64_encode(hash_hmac('sha1', $string_to_sign, $this->secret_key, true));
- $request->add_header('Authorization', 'AWS ' . $this->key . ':' . $signature);
-
- // If we're generating a URL, return the URL to the calling method.
- if (isset($opt['preauth']) && (integer) $opt['preauth'] > 0)
- {
- $query_params = array(
- 'AWSAccessKeyId' => $this->key,
- 'Expires' => $headers['Expires'],
- 'Signature' => $signature,
- );
-
- // If using short-term credentials, add the token to the query string
- if ($this->auth_token)
- {
- $query_params['x-amz-security-token'] = $this->auth_token;
- }
-
- return $this->request_url . $conjunction . http_build_query($query_params, '', '&');
- }
- elseif (isset($opt['preauth']))
- {
- return $this->request_url;
- }
-
- /*%******************************************************************************************%*/
-
- // If our changes were temporary, reset them.
- if ($this->temporary_prefix)
- {
- $this->temporary_prefix = false;
- $this->resource_prefix = null;
- }
-
- // Manage the (newer) batch request API or the (older) returnCurlHandle setting.
- if ($this->use_batch_flow)
- {
- $handle = $request->prep_request();
- $this->batch_object->add($handle);
- $this->use_batch_flow = false;
-
- return $handle;
- }
- elseif (isset($opt['returnCurlHandle']) && $opt['returnCurlHandle'] === true)
- {
- return $request->prep_request();
- }
-
- // Send!
- $request->send_request();
-
- // Prepare the response
- $headers = $request->get_response_header();
- $headers['x-aws-request-url'] = $this->request_url;
- $headers['x-aws-redirects'] = $this->redirects;
- $headers['x-aws-stringtosign'] = $string_to_sign;
- $headers['x-aws-requestheaders'] = $request->request_headers;
-
- // Did we have a request body?
- if (isset($opt['body']))
- {
- $headers['x-aws-requestbody'] = $opt['body'];
- }
-
- $data = new $this->response_class($headers, $this->parse_callback($request->get_response_body()), $request->get_response_code());
-
- // Did Amazon tell us to redirect? Typically happens for multiple rapid requests EU datacenters.
- // @see: http://docs.amazonwebservices.com/AmazonS3/latest/dev/Redirects.html
- // @codeCoverageIgnoreStart
- if ((integer) $request->get_response_code() === 307) // Temporary redirect to new endpoint.
- {
- $this->redirects++;
- $opt['location'] = $headers['location'];
- $data = $this->authenticate($bucket, $opt);
- }
-
- // Was it Amazon's fault the request failed? Retry the request until we reach $max_retries.
- elseif ((integer) $request->get_response_code() === 500 || (integer) $request->get_response_code() === 503)
- {
- if ($this->redirects <= $this->max_retries)
- {
- // Exponential backoff
- $delay = (integer) (pow(4, $this->redirects) * 100000);
- usleep($delay);
- $this->redirects++;
- $data = $this->authenticate($bucket, $opt);
- }
- }
- // @codeCoverageIgnoreEnd
-
- // Return!
- $this->redirects = 0;
- return $data;
- }
-
- /**
- * Validates whether or not the specified Amazon S3 bucket name is valid for DNS-style access. This
- * method is leveraged by any method that creates buckets.
- *
- * @param string $bucket (Required) The name of the bucket to validate.
- * @return boolean Whether or not the specified Amazon S3 bucket name is valid for DNS-style access. A value of <code>true</code> means that the bucket name is valid. A value of <code>false</code> means that the bucket name is invalid.
- */
- public function validate_bucketname_create($bucket)
- {
- // list_buckets() uses this. Let it pass.
- if ($bucket === '') return true;
-
- if (
- ($bucket === null || $bucket === false) || // Must not be null or false
- preg_match('/[^(a-z0-9\-\.)]/', $bucket) || // Must be in the lowercase Roman alphabet, period or hyphen
- !preg_match('/^([a-z]|\d)/', $bucket) || // Must start with a number or letter
- !(strlen($bucket) >= 3 && strlen($bucket) <= 63) || // Must be between 3 and 63 characters long
- (strpos($bucket, '..') !== false) || // Bucket names cannot contain two, adjacent periods
- (strpos($bucket, '-.') !== false) || // Bucket names cannot contain dashes next to periods
- (strpos($bucket, '.-') !== false) || // Bucket names cannot contain dashes next to periods
- preg_match('/(-|\.)$/', $bucket) || // Bucket names should not end with a dash or period
- preg_match('/^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$/', $bucket) // Must not be formatted as an IP address
- ) return false;
-
- return true;
- }
-
- /**
- * Validates whether or not the specified Amazon S3 bucket name is valid for path-style access. This
- * method is leveraged by any method that reads from buckets.
- *
- * @param string $bucket (Required) The name of the bucket to validate.
- * @return boolean Whether or not the bucket name is valid. A value of <code>true</code> means that the bucket name is valid. A value of <code>false</code> means that the bucket name is invalid.
- */
- public function validate_bucketname_support($bucket)
- {
- // list_buckets() uses this. Let it pass.
- if ($bucket === '') return true;
-
- // Validate
- if (
- ($bucket === null || $bucket === false) || // Must not be null or false
- preg_match('/[^(a-z0-9_\-\.)]/i', $bucket) || // Must be in the Roman alphabet, period, hyphen or underscore
- !preg_match('/^([a-z]|\d)/i', $bucket) || // Must start with a number or letter
- !(strlen($bucket) >= 3 && strlen($bucket) <= 255) || // Must be between 3 and 255 characters long
- preg_match('/^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$/', $bucket) // Must not be formatted as an IP address
- ) return false;
-
- return true;
- }
-
- /*%******************************************************************************************%*/
- // SETTERS
-
- /**
- * Sets the region to use for subsequent Amazon S3 operations. This will also reset any prior use of
- * <enable_path_style()>.
- *
- * @param string $region (Required) The region to use for subsequent Amazon S3 operations. For a complete list of REGION constants, see the <code>AmazonS3</code> Constants page in the API reference.
- * @return $this A reference to the current instance.
- */
- public function set_region($region)
- {
- // @codeCoverageIgnoreStart
- $this->set_hostname($region);
-
- switch ($region)
- {
- case self::REGION_US_E1: // Northern Virginia
- $this->enable_path_style(false);
- break;
-
- case self::REGION_EU_W1: // Ireland
- $this->enable_path_style(); // Always use path-style access for EU endpoint.
- break;
-
- default:
- $this->enable_path_style(false);
- break;
-
- }
- // @codeCoverageIgnoreEnd
-
- return $this;
- }
-
- /**
- * Sets the virtual host to use in place of the default `bucket.s3.amazonaws.com` domain.
- *
- * @param string $vhost (Required) The virtual host to use in place of the default `bucket.s3.amazonaws.com` domain.
- * @return $this A reference to the current instance.
- * @link http://docs.amazonwebservices.com/AmazonS3/latest/dev/VirtualHosting.html Virtual Hosting of Buckets
- */
- public function set_vhost($vhost)
- {
- $this->vhost = $vhost;
- return $this;
- }
-
- /**
- * Enables the use of the older path-style URI access for all requests.
- *
- * @param string $style (Optional) Whether or not to enable path-style URI access for all requests. The default value is <code>true</code>.
- * @return $this A reference to the current instance.
- */
- public function enable_path_style($style = true)
- {
- $this->path_style = $style;
- return $this;
- }
-
-
- /*%******************************************************************************************%*/
- // BUCKET METHODS
-
- /**
- * Creates an Amazon S3 bucket.
- *
- * Every object stored in Amazon S3 is contained in a bucket. Buckets partition the namespace of
- * objects stored in Amazon S3 at the top level. in a bucket, any name can be used for objects.
- * However, bucket names must be unique across all of Amazon S3.
- *
- * @param string $bucket (Required) The name of the bucket to create.
- * @param string $region (Required) The preferred geographical location for the bucket. [Allowed values: `AmazonS3::REGION_US_E1 `, `AmazonS3::REGION_US_W1`, `AmazonS3::REGION_EU_W1`, `AmazonS3::REGION_APAC_SE1`, `AmazonS3::REGION_APAC_NE1`]
- * @param string $acl (Optional) The ACL settings for the specified bucket. [Allowed values: <code>AmazonS3::ACL_PRIVATE</code>, <code>AmazonS3::ACL_PUBLIC</code>, <code>AmazonS3::ACL_OPEN</code>, <code>AmazonS3::ACL_AUTH_READ</code>, <code>AmazonS3::ACL_OWNER_READ</code>, <code>AmazonS3::ACL_OWNER_FULL_CONTROL</code>]. The default value is <ACL_PRIVATE>.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- * @link http://docs.amazonwebservices.com/AmazonS3/latest/dev/UsingBucket.html Working with Amazon S3 Buckets
- */
- public function create_bucket($bucket, $region, $acl = self::ACL_PRIVATE, $opt = null)
- {
- // If the bucket contains uppercase letters...
- if (preg_match('/[A-Z]/', $bucket))
- {
- // Throw a warning
- trigger_error('Since DNS-valid bucket names cannot contain uppercase characters, "' . $bucket . '" has been automatically converted to "' . strtolower($bucket) . '"', E_USER_WARNING);
-
- // Force the bucketname to lowercase
- $bucket = strtolower($bucket);
- }
-
- // Validate the S3 bucket name for creation
- if (!$this->validate_bucketname_create($bucket))
- {
- // @codeCoverageIgnoreStart
- throw new S3_Exception('"' . $bucket . '" is not DNS-valid (i.e., <bucketname>.s3.amazonaws.com), and cannot be used as an S3 bucket name. Review "Bucket Restrictions and Limitations" in the S3 Developer Guide for more information.');
- // @codeCoverageIgnoreEnd
- }
-
- if (!$opt) $opt = array();
- $opt['verb'] = 'PUT';
- $opt['headers'] = array(
- 'Content-Type' => 'application/xml',
- 'x-amz-acl' => $acl
- );
-
- // Defaults
- $this->set_region($region); // Also sets path-style
- $xml = simplexml_load_string($this->base_location_constraint);
-
- switch ($region)
- {
- case self::REGION_US_E1: // Northern Virginia
- $opt['body'] = '';
- break;
-
- case self::REGION_EU_W1: // Ireland
- $xml->LocationConstraint = 'EU';
- $opt['body'] = $xml->asXML();
- break;
-
- default:
- $xml->LocationConstraint = str_replace(array('s3-', '.amazonaws.com'), '', $region);
- $opt['body'] = $xml->asXML();
- break;
- }
-
- $response = $this->authenticate($bucket, $opt);
-
- // Make sure we're set back to DNS-style URLs
- $this->enable_path_style(false);
-
- return $response;
- }
-
- /**
- * Gets the region in which the specified Amazon S3 bucket is located.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>preauth</code> - <code>integer|string</code> - Optional - Specifies that a presigned URL for this request should be returned. May be passed as a number of seconds since UNIX Epoch, or any string compatible with <php:strtotime()>.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- */
- public function get_bucket_region($bucket, $opt = null)
- {
- // Add this to our request
- if (!$opt) $opt = array();
- $opt['verb'] = 'GET';
- $opt['sub_resource'] = 'location';
-
- // Authenticate to S3
- $response = $this->authenticate($bucket, $opt);
-
- if ($response->isOK())
- {
- // Handle body
- $response->body = (string) $response->body;
- }
-
- return $response;
- }
-
- /**
- * Gets the HTTP headers for the specified Amazon S3 bucket.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>preauth</code> - <code>integer|string</code> - Optional - Specifies that a presigned URL for this request should be returned. May be passed as a number of seconds since UNIX Epoch, or any string compatible with <php:strtotime()>.</li>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- */
- public function get_bucket_headers($bucket, $opt = null)
- {
- if (!$opt) $opt = array();
- $opt['verb'] = 'HEAD';
-
- return $this->authenticate($bucket, $opt);
- }
-
- /**
- * Deletes a bucket from an Amazon S3 account. A bucket must be empty before the bucket itself can be deleted.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param boolean $force (Optional) Whether to force-delete the bucket and all of its contents. The default value is <code>false</code>.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return mixed A <CFResponse> object if the bucket was deleted successfully. Returns boolean <code>false</code> if otherwise.
- */
- public function delete_bucket($bucket, $force = false, $opt = null)
- {
- // Set default value
- $success = true;
-
- if ($force)
- {
- // Delete all of the items from the bucket.
- $success = $this->delete_all_object_versions($bucket);
- }
-
- // As long as we were successful...
- if ($success)
- {
- if (!$opt) $opt = array();
- $opt['verb'] = 'DELETE';
-
- return $this->authenticate($bucket, $opt);
- }
-
- // @codeCoverageIgnoreStart
- return false;
- // @codeCoverageIgnoreEnd
- }
-
- /**
- * Gets a list of all buckets contained in the caller's Amazon S3 account.
- *
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>preauth</code> - <code>integer|string</code> - Optional - Specifies that a presigned URL for this request should be returned. May be passed as a number of seconds since UNIX Epoch, or any string compatible with <php:strtotime()>.</li>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- */
- public function list_buckets($opt = null)
- {
- if (!$opt) $opt = array();
- $opt['verb'] = 'GET';
-
- return $this->authenticate('', $opt);
- }
-
- /**
- * Gets the access control list (ACL) settings for the specified Amazon S3 bucket.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>preauth</code> - <code>integer|string</code> - Optional - Specifies that a presigned URL for this request should be returned. May be passed as a number of seconds since UNIX Epoch, or any string compatible with <php:strtotime()>.</li>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- * @link http://docs.amazonwebservices.com/AmazonS3/latest/dev/RESTAccessPolicy.html REST Access Control Policy
- */
- public function get_bucket_acl($bucket, $opt = null)
- {
- // Add this to our request
- if (!$opt) $opt = array();
- $opt['verb'] = 'GET';
- $opt['sub_resource'] = 'acl';
-
- // Authenticate to S3
- return $this->authenticate($bucket, $opt);
- }
-
- /**
- * Sets the access control list (ACL) settings for the specified Amazon S3 bucket.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param string $acl (Optional) The ACL settings for the specified bucket. [Allowed values: <code>AmazonS3::ACL_PRIVATE</code>, <code>AmazonS3::ACL_PUBLIC</code>, <code>AmazonS3::ACL_OPEN</code>, <code>AmazonS3::ACL_AUTH_READ</code>, <code>AmazonS3::ACL_OWNER_READ</code>, <code>AmazonS3::ACL_OWNER_FULL_CONTROL</code>]. Alternatively, an array of associative arrays. Each associative array contains an `id` and a `permission` key. The default value is <ACL_PRIVATE>.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- * @link http://docs.amazonwebservices.com/AmazonS3/latest/dev/RESTAccessPolicy.html REST Access Control Policy
- */
- public function set_bucket_acl($bucket, $acl = self::ACL_PRIVATE, $opt = null)
- {
- // Add this to our request
- if (!$opt) $opt = array();
- $opt['verb'] = 'PUT';
- $opt['sub_resource'] = 'acl';
- $opt['headers'] = array(
- 'Content-Type' => 'application/xml'
- );
-
- // Make sure these are defined.
- // @codeCoverageIgnoreStart
- if (!$this->credentials->canonical_id || !$this->credentials->canonical_name)
- {
- // Fetch the data live.
- $canonical = $this->get_canonical_user_id();
- $this->credentials->canonical_id = $canonical['id'];
- $this->credentials->canonical_name = $canonical['display_name'];
- }
- // @codeCoverageIgnoreEnd
-
- if (is_array($acl))
- {
- $opt['body'] = $this->generate_access_policy($this->credentials->canonical_id, $this->credentials->canonical_name, $acl);
- }
- else
- {
- $opt['body'] = '';
- $opt['headers']['x-amz-acl'] = $acl;
- }
-
- // Authenticate to S3
- return $this->authenticate($bucket, $opt);
- }
-
-
- /*%******************************************************************************************%*/
- // OBJECT METHODS
-
- /**
- * Creates an Amazon S3 object. After an Amazon S3 bucket is created, objects can be stored in it.
- *
- * Each standard object can hold up to 5 GB of data. When an object is stored in Amazon S3, the data is streamed
- * to multiple storage servers in multiple data centers. This ensures the data remains available in the
- * event of internal network or hardware failure.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param string $filename (Required) The file name for the object.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>body</code> - <code>string</code> - Required; Conditional - The data to be stored in the object. Either this parameter or <code>fileUpload</code> must be specified.</li>
- * <li><code>fileUpload</code> - <code>string|resource</code> - Required; Conditional - The URL/path for the file to upload, or an open resource. Either this parameter or <code>body</code> is required.</li>
- * <li><code>acl</code> - <code>string</code> - Optional - The ACL settings for the specified object. [Allowed values: <code>AmazonS3::ACL_PRIVATE</code>, <code>AmazonS3::ACL_PUBLIC</code>, <code>AmazonS3::ACL_OPEN</code>, <code>AmazonS3::ACL_AUTH_READ</code>, <code>AmazonS3::ACL_OWNER_READ</code>, <code>AmazonS3::ACL_OWNER_FULL_CONTROL</code>]. The default value is <code>ACL_PRIVATE</code>.</li>
- * <li><code>contentType</code> - <code>string</code> - Optional - The type of content that is being sent in the body. If a file is being uploaded via <code>fileUpload</code> as a file system path, it will attempt to determine the correct mime-type based on the file extension. The default value is <code>application/octet-stream</code>.</li>
- * <li><code>encryption</code> - <code>string</code> - Optional - The algorithm to use for encrypting the object. [Allowed values: <code>AES256</code>]</li>
- * <li><code>headers</code> - <code>array</code> - Optional - Standard HTTP headers to send along in the request. Accepts an associative array of key-value pairs.</li>
- * <li><code>length</code> - <code>integer</code> - Optional - The size of the object in bytes. For more information, see <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13">RFC 2616, section 14.13</a>. The value can also be passed to the <code>header</code> option as <code>Content-Length</code>.</li>
- * <li><code>meta</code> - <code>array</code> - Optional - An associative array of key-value pairs. Represented by <code>x-amz-meta-:</code>. Any header starting with this prefix is considered user metadata. It will be stored with the object and returned when you retrieve the object. The total size of the HTTP request, not including the body, must be less than 4 KB.</li>
- * <li><code>seekTo</code> - <code>integer</code> - Optional - The starting position in bytes within the file/stream to upload from.</li>
- * <li><code>storage</code> - <code>string</code> - Optional - Whether to use Standard or Reduced Redundancy storage. [Allowed values: <code>AmazonS3::STORAGE_STANDARD</code>, <code>AmazonS3::STORAGE_REDUCED</code>]. The default value is <code>STORAGE_STANDARD</code>.</li>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- * @link http://docs.amazonwebservices.com/AmazonS3/latest/dev/RESTAccessPolicy.html REST Access Control Policy
- */
- public function create_object($bucket, $filename, $opt = null)
- {
- if (!$opt) $opt = array();
-
- // Add this to our request
- $opt['verb'] = 'PUT';
- $opt['resource'] = $filename;
-
- // Handle content length. Can also be passed as an HTTP header.
- if (isset($opt['length']))
- {
- $opt['headers']['Content-Length'] = $opt['length'];
- unset($opt['length']);
- }
-
- // Handle content type. Can also be passed as an HTTP header.
- if (isset($opt['contentType']))
- {
- $opt['headers']['Content-Type'] = $opt['contentType'];
- unset($opt['contentType']);
- }
-
- // Handle Access Control Lists. Can also be passed as an HTTP header.
- if (isset($opt['acl']))
- {
- $opt['headers']['x-amz-acl'] = $opt['acl'];
- unset($opt['acl']);
- }
-
- // Handle storage settings. Can also be passed as an HTTP header.
- if (isset($opt['storage']))
- {
- $opt['headers']['x-amz-storage-class'] = $opt['storage'];
- unset($opt['storage']);
- }
-
- // Handle encryption settings. Can also be passed as an HTTP header.
- if (isset($opt['encryption']))
- {
- $opt['headers']['x-amz-server-side-encryption'] = $opt['encryption'];
- unset($opt['encryption']);
- }
-
- // Handle meta tags. Can also be passed as an HTTP header.
- if (isset($opt['meta']))
- {
- foreach ($opt['meta'] as $meta_key => $meta_value)
- {
- // e.g., `My Meta Header` is converted to `x-amz-meta-my-meta-header`.
- $opt['headers']['x-amz-meta-' . strtolower(str_replace(' ', '-', $meta_key))] = $meta_value;
- }
- unset($opt['meta']);
- }
-
- $opt['headers']['Expect'] = '100-continue';
-
- // Authenticate to S3
- return $this->authenticate($bucket, $opt);
- }
-
- /**
- * Gets the contents of an Amazon S3 object in the specified bucket.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param string $filename (Required) The file name for the object.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>etag</code> - <code>string</code> - Optional - The <code>ETag</code> header passed in from a previous request. If specified, request <code>LastModified</code> option must be specified as well. Will trigger a <code>304 Not Modified</code> status code if the file hasn't changed.</li>
- * <li><code>fileDownload</code> - <code>string|resource</code> - Optional - The file system location to download the file to, or an open file resource. Must be a server-writable location.</li>
- * <li><code>headers</code> - <code>array</code> - Optional - Standard HTTP headers to send along in the request. Accepts an associative array of key-value pairs.</li>
- * <li><code>lastmodified</code> - <code>string</code> - Optional - The <code>LastModified</code> header passed in from a previous request. If specified, request <code>ETag</code> option must be specified as well. Will trigger a <code>304 Not Modified</code> status code if the file hasn't changed.</li>
- * <li><code>preauth</code> - <code>integer|string</code> - Optional - Specifies that a presigned URL for this request should be returned. May be passed as a number of seconds since UNIX Epoch, or any string compatible with <php:strtotime()>.</li>
- * <li><code>range</code> - <code>string</code> - Optional - The range of bytes to fetch from the object. Specify this parameter when downloading partial bits or completing incomplete object downloads. The specified range must be notated with a hyphen (e.g., 0-10485759). Defaults to the byte range of the complete Amazon S3 object.</li>
- * <li><code>response</code> - <code>array</code> - Optional - Allows adjustments to specific response headers. Pass an associative array where each key is one of the following: <code>cache-control</code>, <code>content-disposition</code>, <code>content-encoding</code>, <code>content-language</code>, <code>content-type</code>, <code>expires</code>. The <code>expires</code> value should use <php:gmdate()> and be formatted with the <code>DATE_RFC2822</code> constant.</li>
- * <li><code>versionId</code> - <code>string</code> - Optional - The version of the object to retrieve. Version IDs are returned in the <code>x-amz-version-id</code> header of any previous object-related request.</li>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- */
- public function get_object($bucket, $filename, $opt = null)
- {
- if (!$opt) $opt = array();
-
- // Add this to our request
- $opt['verb'] = 'GET';
- $opt['resource'] = $filename;
-
- if (!isset($opt['headers']) || !is_array($opt['headers']))
- {
- $opt['headers'] = array();
- }
-
- if (isset($opt['lastmodified']))
- {
- $opt['headers']['If-Modified-Since'] = $opt['lastmodified'];
- }
-
- if (isset($opt['etag']))
- {
- $opt['headers']['If-None-Match'] = $opt['etag'];
- }
-
- // Partial content range
- if (isset($opt['range']))
- {
- $opt['headers']['Range'] = 'bytes=' . $opt['range'];
- }
-
- // GET responses
- if (isset($opt['response']))
- {
- foreach ($opt['response'] as $key => $value)
- {
- $opt['response-' . $key] = $value;
- unset($opt['response'][$key]);
- }
- }
-
- // Authenticate to S3
- $this->parse_the_response = false;
- $response = $this->authenticate($bucket, $opt);
- $this->parse_the_response = true;
-
- return $response;
- }
-
- /**
- * Gets the HTTP headers for the specified Amazon S3 object.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param string $filename (Required) The file name for the object.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>versionId</code> - <code>string</code> - Optional - The version of the object to retrieve. Version IDs are returned in the <code>x-amz-version-id</code> header of any previous object-related request.</li>
- * <li><code>preauth</code> - <code>integer|string</code> - Optional - Specifies that a presigned URL for this request should be returned. May be passed as a number of seconds since UNIX Epoch, or any string compatible with <php:strtotime()>.</li>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- */
- public function get_object_headers($bucket, $filename, $opt = null)
- {
- // Add this to our request
- if (!$opt) $opt = array();
- $opt['verb'] = 'HEAD';
- $opt['resource'] = $filename;
-
- // Authenticate to S3
- return $this->authenticate($bucket, $opt);
- }
-
- /**
- * Deletes an Amazon S3 object from the specified bucket.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param string $filename (Required) The file name for the object.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>versionId</code> - <code>string</code> - Optional - The version of the object to delete. Version IDs are returned in the <code>x-amz-version-id</code> header of any previous object-related request.</li>
- * <li><code>MFASerial</code> - <code>string</code> - Optional - The serial number on the back of the Gemalto device. <code>MFASerial</code> and <code>MFAToken</code> must both be set for MFA to work.</li>
- * <li><code>MFAToken</code> - <code>string</code> - Optional - The current token displayed on the Gemalto device. <code>MFASerial</code> and <code>MFAToken</code> must both be set for MFA to work.</li>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- * @link http://aws.amazon.com/mfa/ Multi-Factor Authentication
- */
- public function delete_object($bucket, $filename, $opt = null)
- {
- // Add this to our request
- if (!$opt) $opt = array();
- $opt['verb'] = 'DELETE';
- $opt['resource'] = $filename;
-
- // Enable MFA delete?
- // @codeCoverageIgnoreStart
- if (isset($opt['MFASerial']) && isset($opt['MFAToken']))
- {
- $opt['headers'] = array(
- 'x-amz-mfa' => ($opt['MFASerial'] . ' ' . $opt['MFAToken'])
- );
- }
- // @codeCoverageIgnoreEnd
-
- // Authenticate to S3
- return $this->authenticate($bucket, $opt);
- }
-
- /**
- * Deletes two or more specified Amazon S3 objects from the specified bucket.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>objects</code> - <code>array</code> - Required - The object references to delete from the bucket. <ul>
- * <li><code>key</code> - <code>string</code> - Required - The name of the object (e.g., the "key") to delete. This should include the entire file path including all "subdirectories".</li>
- * <li><code>version_id</code> - <code>string</code> - Optional - If the object is versioned, include the version ID to delete.</li>
- * </ul></li>
- * <li><code>quiet</code> - <code>boolean</code> - Optional - Whether or not Amazon S3 should use "Quiet" mode for this operation. A value of <code>true</code> will enable Quiet mode. A value of <code>false</code> will use Verbose mode. The default value is <code>false</code>.</li>
- * <li><code>MFASerial</code> - <code>string</code> - Optional - The serial number on the back of the Gemalto device. <code>MFASerial</code> and <code>MFAToken</code> must both be set for MFA to work.</li>
- * <li><code>MFAToken</code> - <code>string</code> - Optional - The current token displayed on the Gemalto device. <code>MFASerial</code> and <code>MFAToken</code> must both be set for MFA to work.</li>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- * @link http://aws.amazon.com/mfa/ Multi-Factor Authentication
- */
- public function delete_objects($bucket, $opt = null)
- {
- // Add this to our request
- if (!$opt) $opt = array();
- $opt['verb'] = 'POST';
- $opt['sub_resource'] = 'delete';
- $opt['body'] = '';
-
- // Bail out
- if (!isset($opt['objects']) || !is_array($opt['objects']))
- {
- throw new S3_Exception('The ' . __FUNCTION__ . ' method requires the "objects" option to be set as an array.');
- }
-
- $xml = new SimpleXMLElement($this->multi_object_delete_xml);
-
- // Add the objects
- foreach ($opt['objects'] as $object)
- {
- $xobject = $xml->addChild('Object');
- $xobject->addChild('Key', $object['key']);
-
- if (isset($object['version_id']))
- {
- $xobject->addChild('VersionId', $object['version_id']);
- }
- }
-
- // Quiet mode?
- if (isset($opt['quiet']))
- {
- $quiet = 'false';
- if (is_bool($opt['quiet'])) // Boolean
- {
- $quiet = $opt['quiet'] ? 'true' : 'false';
- }
- elseif (is_string($opt['quiet'])) // String
- {
- $quiet = ($opt['quiet'] === 'true') ? 'true' : 'false';
- }
-
- $xml->addChild('Quiet', $quiet);
- }
-
- // Enable MFA delete?
- // @codeCoverageIgnoreStart
- if (isset($opt['MFASerial']) && isset($opt['MFAToken']))
- {
- $opt['headers'] = array(
- 'x-amz-mfa' => ($opt['MFASerial'] . ' ' . $opt['MFAToken'])
- );
- }
- // @codeCoverageIgnoreEnd
-
- $opt['body'] = $xml->asXML();
-
- // Authenticate to S3
- return $this->authenticate($bucket, $opt);
- }
-
- /**
- * Gets a list of all Amazon S3 objects in the specified bucket.
- *
- * NOTE: <strong>This method is paginated</strong>, and will not return more than <code>max-keys</code> keys. If you want to retrieve a list of all keys, you will need to make multiple calls to this function using the <code>marker</code> option to specify the pagination offset (the key of the last processed key--lexically ordered) and the <code>IsTruncated</code> response key to detect when all results have been processed. See: <a href="http://docs.amazonwebservices.com/AmazonS3/latest/API/index.html?RESTBucketGET.html">the S3 REST documentation for get_bucket</a> for more information.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>delimiter</code> - <code>string</code> - Optional - Keys that contain the same string between the prefix and the first occurrence of the delimiter will be rolled up into a single result element in the CommonPrefixes collection.</li>
- * <li><code>marker</code> - <code>string</code> - Optional - Restricts the response to contain results that only occur alphabetically after the value of the marker.</li>
- * <li><code>max-keys</code> - <code>string</code> - Optional - The maximum number of results returned by the method call. The returned list will contain no more results than the specified value, but may return fewer. The default value is 1000.</li>
- * <li><code>preauth</code> - <code>integer|string</code> - Optional - Specifies that a presigned URL for this request should be returned. May be passed as a number of seconds since UNIX Epoch, or any string compatible with <php:strtotime()>.</li>
- * <li><code>prefix</code> - <code>string</code> - Optional - Restricts the response to contain results that begin only with the specified prefix.</li>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- */
- public function list_objects($bucket, $opt = null)
- {
- if (!$opt) $opt = array();
-
- // Add this to our request
- $opt['verb'] = 'GET';
-
- foreach (array('delimiter', 'marker', 'max-keys', 'prefix') as $param)
- {
- if (isset($opt[$param]))
- {
- $opt['query_string'][$param] = $opt[$param];
- unset($opt[$param]);
- }
- }
-
- // Authenticate to S3
- return $this->authenticate($bucket, $opt);
- }
-
- /**
- * Copies an Amazon S3 object to a new location, whether in the same Amazon S3 region, bucket, or otherwise.
- *
- * @param array $source (Required) The bucket and file name to copy from. The following keys must be set: <ul>
- * <li><code>bucket</code> - <code>string</code> - Required - Specifies the name of the bucket containing the source object.</li>
- * <li><code>filename</code> - <code>string</code> - Required - Specifies the file name of the source object to copy.</li></ul>
- * @param array $dest (Required) The bucket and file name to copy to. The following keys must be set: <ul>
- * <li><code>bucket</code> - <code>string</code> - Required - Specifies the name of the bucket to copy the object to.</li>
- * <li><code>filename</code> - <code>string</code> - Required - Specifies the file name to copy the object to.</li></ul>
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>acl</code> - <code>string</code> - Optional - The ACL settings for the specified object. [Allowed values: <code>AmazonS3::ACL_PRIVATE</code>, <code>AmazonS3::ACL_PUBLIC</code>, <code>AmazonS3::ACL_OPEN</code>, <code>AmazonS3::ACL_AUTH_READ</code>, <code>AmazonS3::ACL_OWNER_READ</code>, <code>AmazonS3::ACL_OWNER_FULL_CONTROL</code>]. Alternatively, an array of associative arrays. Each associative array contains an <code>id</code> and a <code>permission</code> key. The default value is <code>ACL_PRIVATE</code>.</li>
- * <li><code>encryption</code> - <code>string</code> - Optional - The algorithm to use for encrypting the object. [Allowed values: <code>AES256</code>]</li>
- * <li><code>storage</code> - <code>string</code> - Optional - Whether to use Standard or Reduced Redundancy storage. [Allowed values: <code>AmazonS3::STORAGE_STANDARD</code>, <code>AmazonS3::STORAGE_REDUCED</code>]. The default value is <code>STORAGE_STANDARD</code>.</li>
- * <li><code>versionId</code> - <code>string</code> - Optional - The version of the object to copy. Version IDs are returned in the <code>x-amz-version-id</code> header of any previous object-related request.</li>
- * <li><code>ifMatch</code> - <code>string</code> - Optional - The ETag header from a previous request. Copies the object if its entity tag (ETag) matches the specified tag; otherwise, the request returns a <code>412</code> HTTP status code error (precondition failed). Used in conjunction with <code>ifUnmodifiedSince</code>.</li>
- * <li><code>ifUnmodifiedSince</code> - <code>string</code> - Optional - The LastModified header from a previous request. Copies the object if it hasn't been modified since the specified time; otherwise, the request returns a <code>412</code> HTTP status code error (precondition failed). Used in conjunction with <code>ifMatch</code>.</li>
- * <li><code>ifNoneMatch</code> - <code>string</code> - Optional - The ETag header from a previous request. Copies the object if its entity tag (ETag) is different than the specified ETag; otherwise, the request returns a <code>412</code> HTTP status code error (failed condition). Used in conjunction with <code>ifModifiedSince</code>.</li>
- * <li><code>ifModifiedSince</code> - <code>string</code> - Optional - The LastModified header from a previous request. Copies the object if it has been modified since the specified time; otherwise, the request returns a <code>412</code> HTTP status code error (failed condition). Used in conjunction with <code>ifNoneMatch</code>.</li>
- * <li><code>headers</code> - <code>array</code> - Optional - Standard HTTP headers to send along in the request. Accepts an associative array of key-value pairs.</li>
- * <li><code>meta</code> - <code>array</code> - Optional - Associative array of key-value pairs. Represented by <code>x-amz-meta-:</code> Any header starting with this prefix is considered user metadata. It will be stored with the object and returned when you retrieve the object. The total size of the HTTP request, not including the body, must be less than 4 KB.</li>
- * <li><code>metadataDirective</code> - <code>string</code> - Optional - Accepts either COPY or REPLACE. You will likely never need to use this, as it manages itself with no issues.</li>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- * @link http://docs.amazonwebservices.com/AmazonS3/latest/dev/API/RESTObjectCOPY.html Copying Amazon S3 Objects
- */
- public function copy_object($source, $dest, $opt = null)
- {
- if (!$opt) $opt = array();
- $batch = array();
-
- // Add this to our request
- $opt['verb'] = 'PUT';
- $opt['resource'] = $dest['filename'];
- $opt['body'] = '';
-
- // Handle copy source
- if (isset($source['bucket']) && isset($source['filename']))
- {
- $opt['headers']['x-amz-copy-source'] = '/' . $source['bucket'] . '/' . rawurlencode($source['filename'])
- . (isset($opt['versionId']) ? ('?' . 'versionId=' . rawurlencode($opt['versionId'])) : ''); // Append the versionId to copy, if available
- unset($opt['versionId']);
-
- // Determine if we need to lookup the pre-existing content-type.
- if (
- (!$this->use_batch_flow && !isset($opt['returnCurlHandle'])) &&
- !in_array(strtolower('content-type'), array_map('strtolower', array_keys($opt['headers'])))
- )
- {
- $response = $this->get_object_headers($source['bucket'], $source['filename']);
- if ($response->isOK())
- {
- $opt['headers']['Content-Type'] = $response->header['content-type'];
- }
- }
- }
-
- // Handle metadata directive
- $opt['headers']['x-amz-metadata-directive'] = 'COPY';
- if ($source['bucket'] === $dest['bucket'] && $source['filename'] === $dest['filename'])
- {
- $opt['headers']['x-amz-metadata-directive'] = 'REPLACE';
- }
- if (isset($opt['metadataDirective']))
- {
- $opt['headers']['x-amz-metadata-directive'] = $opt['metadataDirective'];
- unset($opt['metadataDirective']);
- }
-
- // Handle Access Control Lists. Can also pass canned ACLs as an HTTP header.
- if (isset($opt['acl']) && is_array($opt['acl']))
- {
- $batch[] = $this->set_object_acl($dest['bucket'], $dest['filename'], $opt['acl'], array(
- 'returnCurlHandle' => true
- ));
- unset($opt['acl']);
- }
- elseif (isset($opt['acl']))
- {
- $opt['headers']['x-amz-acl'] = $opt['acl'];
- unset($opt['acl']);
- }
-
- // Handle storage settings. Can also be passed as an HTTP header.
- if (isset($opt['storage']))
- {
- $opt['headers']['x-amz-storage-class'] = $opt['storage'];
- unset($opt['storage']);
- }
-
- // Handle encryption settings. Can also be passed as an HTTP header.
- if (isset($opt['encryption']))
- {
- $opt['headers']['x-amz-server-side-encryption'] = $opt['encryption'];
- unset($opt['encryption']);
- }
-
- // Handle conditional-copy parameters
- if (isset($opt['ifMatch']))
- {
- $opt['headers']['x-amz-copy-source-if-match'] = $opt['ifMatch'];
- unset($opt['ifMatch']);
- }
- if (isset($opt['ifNoneMatch']))
- {
- $opt['headers']['x-amz-copy-source-if-none-match'] = $opt['ifNoneMatch'];
- unset($opt['ifNoneMatch']);
- }
- if (isset($opt['ifUnmodifiedSince']))
- {
- $opt['headers']['x-amz-copy-source-if-unmodified-since'] = $opt['ifUnmodifiedSince'];
- unset($opt['ifUnmodifiedSince']);
- }
- if (isset($opt['ifModifiedSince']))
- {
- $opt['headers']['x-amz-copy-source-if-modified-since'] = $opt['ifModifiedSince'];
- unset($opt['ifModifiedSince']);
- }
-
- // Handle meta tags. Can also be passed as an HTTP header.
- if (isset($opt['meta']))
- {
- foreach ($opt['meta'] as $meta_key => $meta_value)
- {
- // e.g., `My Meta Header` is converted to `x-amz-meta-my-meta-header`.
- $opt['headers']['x-amz-meta-' . strtolower(str_replace(' ', '-', $meta_key))] = $meta_value;
- }
- unset($opt['meta']);
- }
-
- // Authenticate to S3
- $response = $this->authenticate($dest['bucket'], $opt);
-
- // Attempt to reset ACLs
- $http = new RequestCore();
- $http->send_multi_request($batch);
-
- return $response;
- }
-
- /**
- * Updates an Amazon S3 object with new headers or other metadata. To replace the content of the
- * specified Amazon S3 object, call <create_object()> with the same bucket and file name parameters.
- *
- * @param string $bucket (Required) The name of the bucket that contains the source file.
- * @param string $filename (Required) The source file name that you want to update.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>acl</code> - <code>string</code> - Optional - The ACL settings for the specified object. [Allowed values: <code>AmazonS3::ACL_PRIVATE</code>, <code>AmazonS3::ACL_PUBLIC</code>, <code>AmazonS3::ACL_OPEN</code>, <code>AmazonS3::ACL_AUTH_READ</code>, <code>AmazonS3::ACL_OWNER_READ</code>, <code>AmazonS3::ACL_OWNER_FULL_CONTROL</code>]. The default value is <ACL_PRIVATE>.</li>
- * <li><code>headers</code> - <code>array</code> - Optional - Standard HTTP headers to send along in the request. Accepts an associative array of key-value pairs.</li>
- * <li><code>meta</code> - <code>array</code> - Optional - An associative array of key-value pairs. Any header with the <code>x-amz-meta-</code> prefix is considered user metadata and is stored with the Amazon S3 object. It will be stored with the object and returned when you retrieve the object. The total size of the HTTP request, not including the body, must be less than 4 KB.</li>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- * @link http://docs.amazonwebservices.com/AmazonS3/latest/dev/API/RESTObjectCOPY.html Copying Amazon S3 Objects
- */
- public function update_object($bucket, $filename, $opt = null)
- {
- if (!$opt) $opt = array();
- $opt['metadataDirective'] = 'REPLACE';
-
- // Authenticate to S3
- return $this->copy_object(
- array('bucket' => $bucket, 'filename' => $filename),
- array('bucket' => $bucket, 'filename' => $filename),
- $opt
- );
- }
-
-
- /*%******************************************************************************************%*/
- // ACCESS CONTROL LISTS
-
- /**
- * Gets the access control list (ACL) settings for the specified Amazon S3 object.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param string $filename (Required) The file name for the object.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>versionId</code> - <code>string</code> - Optional - The version of the object to retrieve. Version IDs are returned in the <code>x-amz-version-id</code> header of any previous object-related request.</li>
- * <li><code>preauth</code> - <code>integer|string</code> - Optional - Specifies that a presigned URL for this request should be returned. May be passed as a number of seconds since UNIX Epoch, or any string compatible with <php:strtotime()>.</li>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- * @link http://docs.amazonwebservices.com/AmazonS3/latest/dev/RESTAccessPolicy.html REST Access Control Policy
- */
- public function get_object_acl($bucket, $filename, $opt = null)
- {
- // Add this to our request
- if (!$opt) $opt = array();
- $opt['verb'] = 'GET';
- $opt['resource'] = $filename;
- $opt['sub_resource'] = 'acl';
-
- // Authenticate to S3
- return $this->authenticate($bucket, $opt);
- }
-
- /**
- * Sets the access control list (ACL) settings for the specified Amazon S3 object.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param string $filename (Required) The file name for the object.
- * @param string $acl (Optional) The ACL settings for the specified object. Accepts any of the following constants: [Allowed values: <code>AmazonS3::ACL_PRIVATE</code>, <code>AmazonS3::ACL_PUBLIC</code>, <code>AmazonS3::ACL_OPEN</code>, <code>AmazonS3::ACL_AUTH_READ</code>, <code>AmazonS3::ACL_OWNER_READ</code>, <code>AmazonS3::ACL_OWNER_FULL_CONTROL</code>]. Alternatively, an array of associative arrays. Each associative array contains an <code>id</code> and a <code>permission</code> key. The default value is <code>ACL_PRIVATE</code>.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- * @link http://docs.amazonwebservices.com/AmazonS3/latest/dev/RESTAccessPolicy.html REST Access Control Policy
- */
- public function set_object_acl($bucket, $filename, $acl = self::ACL_PRIVATE, $opt = null)
- {
- // Add this to our request
- if (!$opt) $opt = array();
- $opt['verb'] = 'PUT';
- $opt['resource'] = $filename;
- $opt['sub_resource'] = 'acl';
-
- // Retrieve the original metadata
- $metadata = $this->get_object_metadata($bucket, $filename);
- if ($metadata && $metadata['ContentType'])
- {
- $opt['headers']['Content-Type'] = $metadata['ContentType'];
- }
- if ($metadata && $metadata['StorageClass'])
- {
- $opt['headers']['x-amz-storage-class'] = $metadata['StorageClass'];
- }
-
- // Make sure these are defined.
- // @codeCoverageIgnoreStart
- if (!$this->credentials->canonical_id || !$this->credentials->canonical_name)
- {
- // Fetch the data live.
- $canonical = $this->get_canonical_user_id();
- $this->credentials->canonical_id = $canonical['id'];
- $this->credentials->canonical_name = $canonical['display_name'];
- }
- // @codeCoverageIgnoreEnd
-
- if (is_array($acl))
- {
- $opt['body'] = $this->generate_access_policy($this->credentials->canonical_id, $this->credentials->canonical_name, $acl);
- }
- else
- {
- $opt['body'] = '';
- $opt['headers']['x-amz-acl'] = $acl;
- }
-
- // Authenticate to S3
- return $this->authenticate($bucket, $opt);
- }
-
- /**
- * Generates the XML to be used for the Access Control Policy.
- *
- * @param string $canonical_id (Required) The canonical ID for the bucket owner. This is provided as the `id` return value from <get_canonical_user_id()>.
- * @param string $canonical_name (Required) The canonical display name for the bucket owner. This is provided as the `display_name` value from <get_canonical_user_id()>.
- * @param array $users (Optional) An array of associative arrays. Each associative array contains an `id` value and a `permission` value.
- * @return string Access Control Policy XML.
- * @link http://docs.amazonwebservices.com/AmazonS3/latest/dev/S3_ACLs.html Access Control Lists
- */
- public function generate_access_policy($canonical_id, $canonical_name, $users)
- {
- $xml = simplexml_load_string($this->base_acp_xml);
- $owner = $xml->addChild('Owner');
- $owner->addChild('ID', $canonical_id);
- $owner->addChild('DisplayName', $canonical_name);
- $acl = $xml->addChild('AccessControlList');
-
- foreach ($users as $user)
- {
- $grant = $acl->addChild('Grant');
- $grantee = $grant->addChild('Grantee');
-
- switch ($user['id'])
- {
- // Authorized Users
- case self::USERS_AUTH:
- $grantee->addAttribute('xsi:type', 'Group', 'http://www.w3.org/2001/XMLSchema-instance');
- $grantee->addChild('URI', self::USERS_AUTH);
- break;
-
- // All Users
- case self::USERS_ALL:
- $grantee->addAttribute('xsi:type', 'Group', 'http://www.w3.org/2001/XMLSchema-instance');
- $grantee->addChild('URI', self::USERS_ALL);
- break;
-
- // The Logging User
- case self::USERS_LOGGING:
- $grantee->addAttribute('xsi:type', 'Group', 'http://www.w3.org/2001/XMLSchema-instance');
- $grantee->addChild('URI', self::USERS_LOGGING);
- break;
-
- // Email Address or Canonical Id
- default:
- if (strpos($user['id'], '@'))
- {
- $grantee->addAttribute('xsi:type', 'AmazonCustomerByEmail', 'http://www.w3.org/2001/XMLSchema-instance');
- $grantee->addChild('EmailAddress', $user['id']);
- }
- else
- {
- // Assume Canonical Id
- $grantee->addAttribute('xsi:type', 'CanonicalUser', 'http://www.w3.org/2001/XMLSchema-instance');
- $grantee->addChild('ID', $user['id']);
- }
- break;
- }
-
- $grant->addChild('Permission', $user['permission']);
- }
-
- return $xml->asXML();
- }
-
-
- /*%******************************************************************************************%*/
- // LOGGING METHODS
-
- /**
- * Gets the access logs associated with the specified Amazon S3 bucket.
- *
- * @param string $bucket (Required) The name of the bucket to use. Pass a `null` value when using the <set_vhost()> method.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>preauth</code> - <code>integer|string</code> - Optional - Specifies that a presigned URL for this request should be returned. May be passed as a number of seconds since UNIX Epoch, or any string compatible with <php:strtotime()>.</li>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- * @link http://docs.amazonwebservices.com/AmazonS3/latest/dev/ServerLogs.html Server Access Logging
- */
- public function get_logs($bucket, $opt = null)
- {
- // Add this to our request
- if (!$opt) $opt = array();
- $opt['verb'] = 'GET';
- $opt['sub_resource'] = 'logging';
-
- // Authenticate to S3
- return $this->authenticate($bucket, $opt);
- }
-
- /**
- * Enables access logging for the specified Amazon S3 bucket.
- *
- * @param string $bucket (Required) The name of the bucket to enable logging for. Pass a `null` value when using the <set_vhost()> method.
- * @param string $target_bucket (Required) The name of the bucket to store the logs in.
- * @param string $target_prefix (Required) The prefix to give to the log file names.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>users</code> - <code>array</code> - Optional - An array of associative arrays specifying any user to give access to. Each associative array contains an <code>id</code> and <code>permission</code> value.</li>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- * @link http://docs.amazonwebservices.com/AmazonS3/latest/dev/LoggingAPI.html Server Access Logging Configuration API
- */
- public function enable_logging($bucket, $target_bucket, $target_prefix, $opt = null)
- {
- // Add this to our request
- if (!$opt) $opt = array();
- $opt['verb'] = 'PUT';
- $opt['sub_resource'] = 'logging';
- $opt['headers'] = array(
- 'Content-Type' => 'application/xml'
- );
-
- $xml = simplexml_load_string($this->base_logging_xml);
- $LoggingEnabled = $xml->addChild('LoggingEnabled');
- $LoggingEnabled->addChild('TargetBucket', $target_bucket);
- $LoggingEnabled->addChild('TargetPrefix', $target_prefix);
- $TargetGrants = $LoggingEnabled->addChild('TargetGrants');
-
- if (isset($opt['users']) && is_array($opt['users']))
- {
- foreach ($opt['users'] as $user)
- {
- $grant = $TargetGrants->addChild('Grant');
- $grantee = $grant->addChild('Grantee');
-
- switch ($user['id'])
- {
- // Authorized Users
- case self::USERS_AUTH:
- $grantee->addAttribute('xsi:type', 'Group', 'http://www.w3.org/2001/XMLSchema-instance');
- $grantee->addChild('URI', self::USERS_AUTH);
- break;
-
- // All Users
- case self::USERS_ALL:
- $grantee->addAttribute('xsi:type', 'Group', 'http://www.w3.org/2001/XMLSchema-instance');
- $grantee->addChild('URI', self::USERS_ALL);
- break;
-
- // The Logging User
- case self::USERS_LOGGING:
- $grantee->addAttribute('xsi:type', 'Group', 'http://www.w3.org/2001/XMLSchema-instance');
- $grantee->addChild('URI', self::USERS_LOGGING);
- break;
-
- // Email Address or Canonical Id
- default:
- if (strpos($user['id'], '@'))
- {
- $grantee->addAttribute('xsi:type', 'AmazonCustomerByEmail', 'http://www.w3.org/2001/XMLSchema-instance');
- $grantee->addChild('EmailAddress', $user['id']);
- }
- else
- {
- // Assume Canonical Id
- $grantee->addAttribute('xsi:type', 'CanonicalUser', 'http://www.w3.org/2001/XMLSchema-instance');
- $grantee->addChild('ID', $user['id']);
- }
- break;
- }
-
- $grant->addChild('Permission', $user['permission']);
- }
- }
-
- $opt['body'] = $xml->asXML();
-
- // Authenticate to S3
- return $this->authenticate($bucket, $opt);
- }
-
- /**
- * Disables access logging for the specified Amazon S3 bucket.
- *
- * @param string $bucket (Required) The name of the bucket to use. Pass `null` if using <set_vhost()>.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- * @link http://docs.amazonwebservices.com/AmazonS3/latest/dev/LoggingAPI.html Server Access Logging Configuration API
- */
- public function disable_logging($bucket, $opt = null)
- {
- // Add this to our request
- if (!$opt) $opt = array();
- $opt['verb'] = 'PUT';
- $opt['sub_resource'] = 'logging';
- $opt['headers'] = array(
- 'Content-Type' => 'application/xml'
- );
- $opt['body'] = $this->base_logging_xml;
-
- // Authenticate to S3
- return $this->authenticate($bucket, $opt);
- }
-
-
- /*%******************************************************************************************%*/
- // CONVENIENCE METHODS
-
- /**
- * Gets whether or not the specified Amazon S3 bucket exists in Amazon S3. This includes buckets
- * that do not belong to the caller.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @return boolean A value of <code>true</code> if the bucket exists, or a value of <code>false</code> if it does not.
- */
- public function if_bucket_exists($bucket)
- {
- if ($this->use_batch_flow)
- {
- throw new S3_Exception(__FUNCTION__ . '() cannot be batch requested');
- }
-
- $header = $this->get_bucket_headers($bucket);
- return (bool) $header->isOK();
- }
-
- /**
- * Gets whether or not the specified Amazon S3 object exists in the specified bucket.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param string $filename (Required) The file name for the object.
- * @return boolean A value of <code>true</code> if the object exists, or a value of <code>false</code> if it does not.
- */
- public function if_object_exists($bucket, $filename)
- {
- if ($this->use_batch_flow)
- {
- throw new S3_Exception(__FUNCTION__ . '() cannot be batch requested');
- }
-
- $header = $this->get_object_headers($bucket, $filename);
-
- if ($header->isOK()) { return true; }
- elseif ($header->status === 404) { return false; }
-
- // @codeCoverageIgnoreStart
- return null;
- // @codeCoverageIgnoreEnd
- }
-
- /**
- * Gets whether or not the specified Amazon S3 bucket has a bucket policy associated with it.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @return boolean A value of <code>true</code> if a bucket policy exists, or a value of <code>false</code> if one does not.
- */
- public function if_bucket_policy_exists($bucket)
- {
- if ($this->use_batch_flow)
- {
- // @codeCoverageIgnoreStart
- throw new S3_Exception(__FUNCTION__ . '() cannot be batch requested');
- // @codeCoverageIgnoreEnd
- }
-
- $response = $this->get_bucket_policy($bucket);
-
- if ($response->isOK()) { return true; }
- elseif ($response->status === 404) { return false; }
-
- // @codeCoverageIgnoreStart
- return null;
- // @codeCoverageIgnoreEnd
- }
-
- /**
- * Gets the number of Amazon S3 objects in the specified bucket.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @return integer The number of Amazon S3 objects in the bucket.
- */
- public function get_bucket_object_count($bucket)
- {
- if ($this->use_batch_flow)
- {
- // @codeCoverageIgnoreStart
- throw new S3_Exception(__FUNCTION__ . '() cannot be batch requested');
- // @codeCoverageIgnoreEnd
- }
-
- return count($this->get_object_list($bucket));
- }
-
- /**
- * Gets the cumulative file size of the contents of the Amazon S3 bucket.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param boolean $friendly_format (Optional) A value of <code>true</code> will format the return value to 2 decimal points using the largest possible unit (i.e., 3.42 GB). A value of <code>false</code> will format the return value as the raw number of bytes.
- * @return integer|string The number of bytes as an integer, or the friendly format as a string.
- */
- public function get_bucket_filesize($bucket, $friendly_format = false)
- {
- if ($this->use_batch_flow)
- {
- throw new S3_Exception(__FUNCTION__ . '() cannot be batch requested');
- }
-
- $filesize = 0;
- $list = $this->list_objects($bucket);
-
- foreach ($list->body->Contents as $filename)
- {
- $filesize += (integer) $filename->Size;
- }
-
- while ((string) $list->body->IsTruncated === 'true')
- {
- $body = (array) $list->body;
- $list = $this->list_objects($bucket, array(
- 'marker' => (string) end($body['Contents'])->Key
- ));
-
- foreach ($list->body->Contents as $object)
- {
- $filesize += (integer) $object->Size;
- }
- }
-
- if ($friendly_format)
- {
- $filesize = $this->util->size_readable($filesize);
- }
-
- return $filesize;
- }
-
- /**
- * Gets the file size of the specified Amazon S3 object.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param string $filename (Required) The file name for the object.
- * @param boolean $friendly_format (Optional) A value of <code>true</code> will format the return value to 2 decimal points using the largest possible unit (i.e., 3.42 GB). A value of <code>false</code> will format the return value as the raw number of bytes.
- * @return integer|string The number of bytes as an integer, or the friendly format as a string.
- */
- public function get_object_filesize($bucket, $filename, $friendly_format = false)
- {
- if ($this->use_batch_flow)
- {
- throw new S3_Exception(__FUNCTION__ . '() cannot be batch requested');
- }
-
- $object = $this->get_object_headers($bucket, $filename);
- $filesize = (integer) $object->header['content-length'];
-
- if ($friendly_format)
- {
- $filesize = $this->util->size_readable($filesize);
- }
-
- return $filesize;
- }
-
- /**
- * Changes the content type for an existing Amazon S3 object.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param string $filename (Required) The file name for the object.
- * @param string $contentType (Required) The content-type to apply to the object.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- */
- public function change_content_type($bucket, $filename, $contentType, $opt = null)
- {
- if (!$opt) $opt = array();
-
- // Retrieve the original metadata
- $metadata = $this->get_object_metadata($bucket, $filename);
- if ($metadata && $metadata['ACL'])
- {
- $opt['acl'] = $metadata['ACL'];
- }
- if ($metadata && $metadata['StorageClass'])
- {
- $opt['headers']['x-amz-storage-class'] = $metadata['StorageClass'];
- }
-
- // Merge optional parameters
- $opt = array_merge_recursive(array(
- 'headers' => array(
- 'Content-Type' => $contentType
- ),
- 'metadataDirective' => 'COPY'
- ), $opt);
-
- return $this->copy_object(
- array('bucket' => $bucket, 'filename' => $filename),
- array('bucket' => $bucket, 'filename' => $filename),
- $opt
- );
- }
-
- /**
- * Changes the storage redundancy for an existing object.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param string $filename (Required) The file name for the object.
- * @param string $storage (Required) The storage setting to apply to the object. [Allowed values: <code>AmazonS3::STORAGE_STANDARD</code>, <code>AmazonS3::STORAGE_REDUCED</code>]
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- */
- public function change_storage_redundancy($bucket, $filename, $storage, $opt = null)
- {
- if (!$opt) $opt = array();
-
- // Retrieve the original metadata
- $metadata = $this->get_object_metadata($bucket, $filename);
- if ($metadata && $metadata['ACL'])
- {
- $opt['acl'] = $metadata['ACL'];
- }
- if ($metadata && $metadata['ContentType'])
- {
- $opt['headers']['Content-Type'] = $metadata['ContentType'];
- }
-
- // Merge optional parameters
- $opt = array_merge(array(
- 'storage' => $storage,
- 'metadataDirective' => 'COPY',
- ), $opt);
-
- return $this->copy_object(
- array('bucket' => $bucket, 'filename' => $filename),
- array('bucket' => $bucket, 'filename' => $filename),
- $opt
- );
- }
-
- /**
- * Gets a simplified list of bucket names on an Amazon S3 account.
- *
- * @param string $pcre (Optional) A Perl-Compatible Regular Expression (PCRE) to filter the bucket names against.
- * @return array The list of matching bucket names. If there are no results, the method will return an empty array.
- * @link http://php.net/pcre Regular Expressions (Perl-Compatible)
- */
- public function get_bucket_list($pcre = null)
- {
- if ($this->use_batch_flow)
- {
- throw new S3_Exception(__FUNCTION__ . '() cannot be batch requested');
- }
-
- // Get a list of buckets.
- $list = $this->list_buckets();
- if ($list = $list->body->query('descendant-or-self::Name'))
- {
- $list = $list->map_string($pcre);
- return $list;
- }
-
- // @codeCoverageIgnoreStart
- return array();
- // @codeCoverageIgnoreEnd
- }
-
- /**
- * Gets a simplified list of Amazon S3 object file names contained in a bucket.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>delimiter</code> - <code>string</code> - Optional - Keys that contain the same string between the prefix and the first occurrence of the delimiter will be rolled up into a single result element in the CommonPrefixes collection.</li>
- * <li><code>marker</code> - <code>string</code> - Optional - Restricts the response to contain results that only occur alphabetically after the value of the marker.</li>
- * <li><code>max-keys</code> - <code>integer</code> - Optional - The maximum number of results returned by the method call. The returned list will contain no more results than the specified value, but may return less. A value of zero is treated as if you did not specify max-keys.</li>
- * <li><code>pcre</code> - <code>string</code> - Optional - A Perl-Compatible Regular Expression (PCRE) to filter the names against. This is applied only AFTER any native Amazon S3 filtering from specified <code>prefix</code>, <code>marker</code>, <code>max-keys</code>, or <code>delimiter</code> values are applied.</li>
- * <li><code>prefix</code> - <code>string</code> - Optional - Restricts the response to contain results that begin only with the specified prefix.</li>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * @return array The list of matching object names. If there are no results, the method will return an empty array.
- * @link http://php.net/pcre Regular Expressions (Perl-Compatible)
- */
- public function get_object_list($bucket, $opt = null)
- {
- if ($this->use_batch_flow)
- {
- throw new S3_Exception(__FUNCTION__ . '() cannot be batch requested');
- }
-
- if (!$opt) $opt = array();
- unset($opt['returnCurlHandle']); // This would cause problems
-
- // Set some default values
- $pcre = isset($opt['pcre']) ? $opt['pcre'] : null;
- $max_keys = (isset($opt['max-keys']) && is_int($opt['max-keys'])) ? $opt['max-keys'] : null;
- $objects = array();
-
- if (!$max_keys)
- {
- // No max-keys specified. Get everything.
- do
- {
- $list = $this->list_objects($bucket, $opt);
- if ($keys = $list->body->query('descendant-or-self::Key')->map_string($pcre))
- {
- $objects = array_merge($objects, $keys);
- }
-
- $body = (array) $list->body;
- $opt = array_merge($opt, array(
- 'marker' => (isset($body['Contents']) && is_array($body['Contents'])) ?
- ((string) end($body['Contents'])->Key) :
- ((string) $list->body->Contents->Key)
- ));
- }
- while ((string) $list->body->IsTruncated === 'true');
- }
- else
- {
- // Max-keys specified. Approximate number of loops and make the requests.
-
- $max_keys = $opt['max-keys'];
- $loops = ceil($max_keys / 1000);
-
- do
- {
- $list = $this->list_objects($bucket, $opt);
- $keys = $list->body->query('descendant-or-self::Key')->map_string($pcre);
-
- if ($count = count($keys))
- {
- $objects = array_merge($objects, $keys);
-
- if ($count < 1000)
- {
- break;
- }
- }
-
- if ($max_keys > 1000)
- {
- $max_keys -= 1000;
- }
-
- $body = (array) $list->body;
- $opt = array_merge($opt, array(
- 'max-keys' => $max_keys,
- 'marker' => (isset($body['Contents']) && is_array($body['Contents'])) ?
- ((string) end($body['Contents'])->Key) :
- ((string) $list->body->Contents->Key)
- ));
- }
- while (--$loops);
- }
-
- return $objects;
- }
-
- /**
- * Deletes all Amazon S3 objects inside the specified bucket.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param string $pcre (Optional) A Perl-Compatible Regular Expression (PCRE) to filter the names against. The default value is <PCRE_ALL>.
- * @return boolean A value of <code>true</code> means that all objects were successfully deleted. A value of <code>false</code> means that at least one object failed to delete.
- * @link http://php.net/pcre Regular Expressions (Perl-Compatible)
- */
- public function delete_all_objects($bucket, $pcre = self::PCRE_ALL)
- {
- // Collect all matches
- $list = $this->get_object_list($bucket, array('pcre' => $pcre));
-
- // As long as we have at least one match...
- if (count($list) > 0)
- {
- $objects = array();
-
- foreach ($list as $object)
- {
- $objects[] = array('key' => $object);
- }
-
- $batch = new CFBatchRequest();
- $batch->use_credentials($this->credentials);
-
- foreach (array_chunk($objects, 1000) as $object_set)
- {
- $this->batch($batch)->delete_objects($bucket, array(
- 'objects' => $object_set
- ));
- }
-
- $responses = $this->batch($batch)->send();
- $is_ok = true;
-
- foreach ($responses as $response)
- {
- if (!$response->isOK() || isset($response->body->Error))
- {
- $is_ok = false;
- }
- }
-
- return $is_ok;
- }
-
- // If there are no matches, return true
- return true;
- }
-
- /**
- * Deletes all of the versions of all Amazon S3 objects inside the specified bucket.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param string $pcre (Optional) A Perl-Compatible Regular Expression (PCRE) to filter the names against. The default value is <PCRE_ALL>.
- * @return boolean A value of <code>true</code> means that all object versions were successfully deleted. A value of <code>false</code> means that at least one object/version failed to delete.
- * @link http://php.net/pcre Regular Expressions (Perl-Compatible)
- */
- public function delete_all_object_versions($bucket, $pcre = null)
- {
- // Instantiate
- $versions = $this->list_bucket_object_versions($bucket);
-
- // Gather all nodes together into a single array
- if ($versions->body->DeleteMarker() && $versions->body->Version())
- {
- $markers = array_merge($versions->body->DeleteMarker()->getArrayCopy(), $versions->body->Version()->getArrayCopy());
- }
- elseif ($versions->body->DeleteMarker())
- {
- $markers = $versions->body->DeleteMarker()->getArrayCopy();
- }
- elseif ($versions->body->Version())
- {
- $markers = $versions->body->Version()->getArrayCopy();
- }
- else
- {
- $markers = array();
- }
-
- while ((string) $versions->body->IsTruncated === 'true')
- {
- $versions = $this->list_bucket_object_versions($bucket, array(
- 'key-marker' => (string) $versions->body->NextKeyMarker
- ));
-
- // Gather all nodes together into a single array
- if ($versions->body->DeleteMarker() && $versions->body->Version())
- {
- $markers = array_merge($markers, $versions->body->DeleteMarker()->getArrayCopy(), $versions->body->Version()->getArrayCopy());
- }
- elseif ($versions->body->DeleteMarker())
- {
- $markers = array_merge($markers, $versions->body->DeleteMarker()->getArrayCopy());
- }
- elseif ($versions->body->Version())
- {
- $markers = array_merge($markers, $versions->body->Version()->getArrayCopy());
- }
- }
-
- $objects = array();
-
- // Loop through markers
- foreach ($markers as $marker)
- {
- if ($pcre)
- {
- if (preg_match($pcre, (string) $marker->Key))
- {
- $xx = array('key' => (string) $marker->Key);
- if ((string) $marker->VersionId !== 'null')
- {
- $xx['version_id'] = (string) $marker->VersionId;
- }
- $objects[] = $xx;
- unset($xx);
- }
- }
- else
- {
- $xx = array('key' => (string) $marker->Key);
- if ((string) $marker->VersionId !== 'null')
- {
- $xx['version_id'] = (string) $marker->VersionId;
- }
- $objects[] = $xx;
- unset($xx);
- }
- }
-
- $batch = new CFBatchRequest();
- $batch->use_credentials($this->credentials);
-
- foreach (array_chunk($objects, 1000) as $object_set)
- {
- $this->batch($batch)->delete_objects($bucket, array(
- 'objects' => $object_set
- ));
- }
-
- $responses = $this->batch($batch)->send();
- $is_ok = true;
-
- foreach ($responses as $response)
- {
- if (!$response->isOK() || isset($response->body->Error))
- {
- $is_ok = false;
- }
- }
-
- return $is_ok;
- }
-
- /**
- * Gets the collective metadata for the given Amazon S3 object.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param string $filename (Required) The file name for the Amazon S3 object.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>versionId</code> - <code>string</code> - Optional - The version of the object to retrieve. Version IDs are returned in the <code>x-amz-version-id</code> header of any previous object-related request.</li>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return mixed If the object exists, the method returns the collective metadata for the Amazon S3 object. If the object does not exist, the method returns boolean <code>false</code>.
- */
- public function get_object_metadata($bucket, $filename, $opt = null)
- {
- $batch = new CFBatchRequest();
- $this->batch($batch)->get_object_acl($bucket, $filename); // Get ACL info
- $this->batch($batch)->get_object_headers($bucket, $filename); // Get content-type
- $this->batch($batch)->list_objects($bucket, array( // Get other metadata
- 'max-keys' => 1,
- 'prefix' => $filename
- ));
- $response = $this->batch($batch)->send();
-
- // Fail if any requests were unsuccessful
- if (!$response->areOK())
- {
- return false;
- }
-
- $data = array(
- 'ACL' => array(),
- 'ContentType' => null,
- 'ETag' => null,
- 'Headers' => null,
- 'Key' => null,
- 'LastModified' => null,
- 'Owner' => array(),
- 'Size' => null,
- 'StorageClass' => null,
- );
-
- // Add the content type
- $data['ContentType'] = (string) $response[1]->header['content-type'];
-
- // Add the other metadata (including storage type)
- $contents = json_decode(json_encode($response[2]->body->query('descendant-or-self::Contents')->first()), true);
- $data = array_merge($data, (is_array($contents) ? $contents : array()));
-
- // Add ACL info
- $grants = $response[0]->body->query('descendant-or-self::Grant');
- $max = count($grants);
-
- // Add raw header info
- $data['Headers'] = $response[1]->header;
- foreach (array('_info', 'x-amz-id-2', 'x-amz-request-id', 'cneonction', 'server', 'content-length', 'content-type', 'etag') as $header)
- {
- unset($data['Headers'][$header]);
- }
- ksort($data['Headers']);
-
- if (count($grants) > 0)
- {
- foreach ($grants as $grant)
- {
- $dgrant = array(
- 'id' => (string) $this->util->try_these(array('ID', 'URI'), $grant->Grantee),
- 'permission' => (string) $grant->Permission
- );
-
- $data['ACL'][] = $dgrant;
- }
- }
-
- return $data;
- }
-
-
- /*%******************************************************************************************%*/
- // URLS
-
- /**
- * Gets the web-accessible URL for the Amazon S3 object or generates a time-limited signed request for
- * a private file.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param string $filename (Required) The file name for the Amazon S3 object.
- * @param integer|string $preauth (Optional) Specifies that a presigned URL for this request should be returned. May be passed as a number of seconds since UNIX Epoch, or any string compatible with <php:strtotime()>.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>https</code> - <code>boolean</code> - Optional - Set to <code>true</code> if you would like the URL be in https mode. Otherwise, the default behavior is always to use http regardless of your SSL settings.
- * <li><code>method</code> - <code>string</code> - Optional - The HTTP method to use for the request. Defaults to a value of <code>GET</code>.</li>
- * <li><code>response</code> - <code>array</code> - Optional - Allows adjustments to specific response headers. Pass an associative array where each key is one of the following: <code>cache-control</code>, <code>content-disposition</code>, <code>content-encoding</code>, <code>content-language</code>, <code>content-type</code>, <code>expires</code>. The <code>expires</code> value should use <php:gmdate()> and be formatted with the <code>DATE_RFC2822</code> constant.</li>
- * <li><code>torrent</code> - <code>boolean</code> - Optional - A value of <code>true</code> will return a URL to a torrent of the Amazon S3 object. A value of <code>false</code> will return a non-torrent URL. Defaults to <code>false</code>.</li>
- * <li><code>versionId</code> - <code>string</code> - Optional - The version of the object. Version IDs are returned in the <code>x-amz-version-id</code> header of any previous object-related request.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return string The file URL, with authentication and/or torrent parameters if requested.
- * @link http://docs.amazonwebservices.com/AmazonS3/latest/dev/S3_QSAuth.html Using Query String Authentication
- */
- public function get_object_url($bucket, $filename, $preauth = 0, $opt = null)
- {
- // Add this to our request
- if (!$opt) $opt = array();
- $opt['verb'] = isset($opt['method']) ? $opt['method'] : 'GET';
- $opt['resource'] = $filename;
- $opt['preauth'] = $preauth;
-
- if (isset($opt['torrent']) && $opt['torrent'])
- {
- $opt['sub_resource'] = 'torrent';
- unset($opt['torrent']);
- }
-
- // GET responses
- if (isset($opt['response']))
- {
- foreach ($opt['response'] as $key => $value)
- {
- $opt['response-' . $key] = $value;
- unset($opt['response'][$key]);
- }
- }
-
- // Determine whether or not to use SSL
- $use_ssl = isset($opt['https']) ? (bool) $opt['https'] : false;
- unset($opt['https']);
- $current_use_ssl_setting = $this->use_ssl;
-
- // Authenticate to S3
- $this->use_ssl = $use_ssl;
- $response = $this->authenticate($bucket, $opt);
- $this->use_ssl = $current_use_ssl_setting;
-
- return $response;
- }
-
- /**
- * Gets the web-accessible URL to a torrent of the Amazon S3 object. The Amazon S3 object's access
- * control list settings (ACL) MUST be set to <ACL_PUBLIC> for a valid URL to be returned.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param string $filename (Required) The file name for the object.
- * @param integer|string $preauth (Optional) Specifies that a presigned URL for this request should be returned. May be passed as a number of seconds since UNIX Epoch, or any string compatible with <php:strtotime()>.
- * @return string The torrent URL, with authentication parameters if requested.
- * @link http://docs.amazonwebservices.com/AmazonS3/latest/dev/index.html?S3TorrentRetrieve.html Using BitTorrent to Retrieve Objects Stored in Amazon S3
- */
- public function get_torrent_url($bucket, $filename, $preauth = 0)
- {
- return $this->get_object_url($bucket, $filename, $preauth, array(
- 'torrent' => true
- ));
- }
-
-
- /*%******************************************************************************************%*/
- // VERSIONING
-
- /**
- * Enables versioning support for the specified Amazon S3 bucket.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>MFASerial</code> - string (Optional) The serial number on the back of the Gemalto device. <code>MFASerial</code>, <code>MFAToken</code> and <code>MFAStatus</code> must all be set for MFA to work.</li>
- * <li><code>MFAToken</code> - string (Optional) The current token displayed on the Gemalto device. <code>MFASerial</code>, <code>MFAToken</code> and <code>MFAStatus</code> must all be set for MFA to work.</li>
- * <li><code>MFAStatus</code> - string (Optional) The MFA Delete status. Can be <code>Enabled</code> or <code>Disabled</code>. <code>MFASerial</code>, <code>MFAToken</code> and <code>MFAStatus</code> must all be set for MFA to work.</li>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- * @link http://aws.amazon.com/mfa/ Multi-Factor Authentication
- */
- public function enable_versioning($bucket, $opt = null)
- {
- if (!$opt) $opt = array();
-
- // Add this to our request
- $opt['verb'] = 'PUT';
- $opt['sub_resource'] = 'versioning';
- $opt['headers'] = array(
- 'Content-Type' => 'application/xml'
- );
-
- $xml = simplexml_load_string($this->base_versioning_xml);
- $xml->addChild('Status', 'Enabled');
-
- // Enable MFA delete?
- // @codeCoverageIgnoreStart
- if (isset($opt['MFASerial']) && isset($opt['MFAToken']) && isset($opt['MFAStatus']))
- {
- $xml->addChild('MfaDelete', $opt['MFAStatus']);
- $opt['headers']['x-amz-mfa'] = ($opt['MFASerial'] . ' ' . $opt['MFAToken']);
- }
- // @codeCoverageIgnoreEnd
-
- $opt['body'] = $xml->asXML();
-
- // Authenticate to S3
- return $this->authenticate($bucket, $opt);
- }
-
- /**
- * Disables versioning support for the specified Amazon S3 bucket.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>MFASerial</code> - <code>string</code> - Optional - The serial number on the back of the Gemalto device. <code>MFASerial</code>, <code>MFAToken</code> and <code>MFAStatus</code> must all be set for MFA to work.</li>
- * <li><code>MFAToken</code> - <code>string</code> - Optional - The current token displayed on the Gemalto device. <code>MFASerial</code>, <code>MFAToken</code> and <code>MFAStatus</code> must all be set for MFA to work.</li>
- * <li><code>MFAStatus</code> - <code>string</code> - Optional - The MFA Delete status. Can be <code>Enabled</code> or <code>Disabled</code>. <code>MFASerial</code>, <code>MFAToken</code> and <code>MFAStatus</code> must all be set for MFA to work.</li>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- * @link http://aws.amazon.com/mfa/ Multi-Factor Authentication
- */
- public function disable_versioning($bucket, $opt = null)
- {
- if (!$opt) $opt = array();
-
- // Add this to our request
- $opt['verb'] = 'PUT';
- $opt['sub_resource'] = 'versioning';
- $opt['headers'] = array(
- 'Content-Type' => 'application/xml'
- );
-
- $xml = simplexml_load_string($this->base_versioning_xml);
- $xml->addChild('Status', 'Suspended');
-
- // Enable MFA delete?
- // @codeCoverageIgnoreStart
- if (isset($opt['MFASerial']) && isset($opt['MFAToken']) && isset($opt['MFAStatus']))
- {
- $xml->addChild('MfaDelete', $opt['MFAStatus']);
- $opt['headers']['x-amz-mfa'] = ($opt['MFASerial'] . ' ' . $opt['MFAToken']);
- }
- // @codeCoverageIgnoreEnd
-
- $opt['body'] = $xml->asXML();
-
- // Authenticate to S3
- return $this->authenticate($bucket, $opt);
- }
-
- /**
- * Gets an Amazon S3 bucket's versioning status.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>preauth</code> - <code>integer|string</code> - Optional - Specifies that a presigned URL for this request should be returned. May be passed as a number of seconds since UNIX Epoch, or any string compatible with <php:strtotime()>.</li>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- */
- public function get_versioning_status($bucket, $opt = null)
- {
- if (!$opt) $opt = array();
- $opt['verb'] = 'GET';
- $opt['sub_resource'] = 'versioning';
-
- // Authenticate to S3
- return $this->authenticate($bucket, $opt);
- }
-
- /**
- * Gets a list of all the versions of Amazon S3 objects in the specified bucket.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>delimiter</code> - <code>string</code> - Optional - Unicode string parameter. Keys that contain the same string between the prefix and the first occurrence of the delimiter will be rolled up into a single result element in the CommonPrefixes collection.</li>
- * <li><code>key-marker</code> - <code>string</code> - Optional - Restricts the response to contain results that only occur alphabetically after the value of the <code>key-marker</code>.</li>
- * <li><code>max-keys</code> - <code>string</code> - Optional - Limits the number of results returned in response to your query. Will return no more than this number of results, but possibly less.</li>
- * <li><code>prefix</code> - <code>string</code> - Optional - Restricts the response to only contain results that begin with the specified prefix.</li>
- * <li><code>version-id-marker</code> - <code>string</code> - Optional - Restricts the response to contain results that only occur alphabetically after the value of the <code>version-id-marker</code>.</li>
- * <li><code>preauth</code> - <code>integer|string</code> - Optional - Specifies that a presigned URL for this request should be returned. May be passed as a number of seconds since UNIX Epoch, or any string compatible with <php:strtotime()>.</li>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- */
- public function list_bucket_object_versions($bucket, $opt = null)
- {
- if (!$opt) $opt = array();
- $opt['verb'] = 'GET';
- $opt['sub_resource'] = 'versions';
-
- foreach (array('delimiter', 'key-marker', 'max-keys', 'prefix', 'version-id-marker') as $param)
- {
- if (isset($opt[$param]))
- {
- $opt['query_string'][$param] = $opt[$param];
- unset($opt[$param]);
- }
- }
-
- // Authenticate to S3
- return $this->authenticate($bucket, $opt);
- }
-
-
- /*%******************************************************************************************%*/
- // BUCKET POLICIES
-
- /**
- * Sets the policy sub-resource for the specified Amazon S3 bucket. The specified policy replaces any
- * policy the bucket already has.
- *
- * To perform this operation, the caller must be authorized to set a policy for the bucket and have
- * PutPolicy permissions. If the caller does not have PutPolicy permissions for the bucket, Amazon S3
- * returns a `403 Access Denied` error. If the caller has the correct permissions but has not been
- * authorized by the bucket owner, Amazon S3 returns a `405 Method Not Allowed` error.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param CFPolicy $policy (Required) The JSON policy to use.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- * @link http://docs.amazonwebservices.com/AmazonS3/latest/dev/AccessPolicyLanguage.html Appendix: The Access Policy Language
- */
- public function set_bucket_policy($bucket, CFPolicy $policy, $opt = null)
- {
- if (!$opt) $opt = array();
- $opt['verb'] = 'PUT';
- $opt['sub_resource'] = 'policy';
- $opt['body'] = $policy->get_json();
-
- // Authenticate to S3
- return $this->authenticate($bucket, $opt);
- }
-
- /**
- * Gets the policy of the specified Amazon S3 bucket.
- *
- * To use this operation, the caller must have GetPolicy permissions for the specified bucket and must be
- * the bucket owner. If the caller does not have GetPolicy permissions, this method will generate a
- * `403 Access Denied` error. If the caller has the correct permissions but is not the bucket owner, this
- * method will generate a `405 Method Not Allowed` error. If the bucket does not have a policy defined for
- * it, this method will generate a `404 Policy Not Found` error.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- */
- public function get_bucket_policy($bucket, $opt = null)
- {
- if (!$opt) $opt = array();
- $opt['verb'] = 'GET';
- $opt['sub_resource'] = 'policy';
-
- // Authenticate to S3
- return $this->authenticate($bucket, $opt);
- }
-
- /**
- * Deletes the bucket policy for the specified Amazon S3 bucket. To delete the policy, the caller must
- * be the bucket owner and have `DeletePolicy` permissions for the specified bucket.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response. If you do not have `DeletePolicy` permissions, Amazon S3 returns a `403 Access Denied` error. If you have the correct permissions, but are not the bucket owner, Amazon S3 returns a `405 Method Not Allowed` error. If the bucket doesn't have a policy, Amazon S3 returns a `204 No Content` error.
- */
- public function delete_bucket_policy($bucket, $opt = null)
- {
- if (!$opt) $opt = array();
- $opt['verb'] = 'DELETE';
- $opt['sub_resource'] = 'policy';
-
- // Authenticate to S3
- return $this->authenticate($bucket, $opt);
- }
-
-
- /*%******************************************************************************************%*/
- // BUCKET NOTIFICATIONS
-
- /**
- * Enables notifications of specified events for an Amazon S3 bucket. Currently, the
- * `s3:ReducedRedundancyLostObject` event is the only event supported for notifications. The
- * `s3:ReducedRedundancyLostObject` event is triggered when Amazon S3 detects that it has lost all
- * copies of an Amazon S3 object and can no longer service requests for that object.
- *
- * If the bucket owner and Amazon SNS topic owner are the same, the bucket owner has permission to
- * publish notifications to the topic by default. Otherwise, the owner of the topic must create a
- * policy to enable the bucket owner to publish to the topic.
- *
- * By default, only the bucket owner can configure notifications on a bucket. However, bucket owners
- * can use bucket policies to grant permission to other users to set this configuration with the
- * `s3:PutBucketNotification` permission.
- *
- * After a PUT operation is called to configure notifications on a bucket, Amazon S3 publishes a test
- * notification to ensure that the topic exists and that the bucket owner has permission to publish
- * to the specified topic. If the notification is successfully published to the SNS topic, the PUT
- * operation updates the bucket configuration and returns the 200 OK responses with a
- * `x-amz-sns-test-message-id` header containing the message ID of the test notification sent to topic.
- *
- * @param string $bucket (Required) The name of the bucket to create bucket notifications for.
- * @param string $topic_arn (Required) The SNS topic ARN to send notifications to.
- * @param string $event (Required) The event type to listen for.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- * @link http://docs.amazonwebservices.com/AmazonS3/latest/dev/NotificationHowTo.html Setting Up Notification of Bucket Events
- */
- public function create_bucket_notification($bucket, $topic_arn, $event, $opt = null)
- {
- if (!$opt) $opt = array();
- $opt['verb'] = 'PUT';
- $opt['sub_resource'] = 'notification';
- $opt['headers'] = array(
- 'Content-Type' => 'application/xml'
- );
-
- $xml = simplexml_load_string($this->base_notification_xml);
- $topic_config = $xml->addChild('TopicConfiguration');
- $topic_config->addChild('Topic', $topic_arn);
- $topic_config->addChild('Event', $event);
-
- $opt['body'] = $xml->asXML();
-
- // Authenticate to S3
- return $this->authenticate($bucket, $opt);
- }
-
- /**
- * Gets the notification configuration of a bucket. Currently, the `s3:ReducedRedundancyLostObject` event
- * is the only event supported for notifications. The `s3:ReducedRedundancyLostObject` event is triggered
- * when Amazon S3 detects that it has lost all replicas of a Reduced Redundancy Storage object and can no
- * longer service requests for that object.
- *
- * If notifications are not enabled on the bucket, the operation returns an empty
- * `NotificatonConfiguration` element.
- *
- * By default, you must be the bucket owner to read the notification configuration of a bucket. However,
- * the bucket owner can use a bucket policy to grant permission to other users to read this configuration
- * with the `s3:GetBucketNotification` permission.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- * @link http://docs.amazonwebservices.com/AmazonS3/latest/dev/NotificationHowTo.html Setting Up Notification of Bucket Events
- */
- public function get_bucket_notifications($bucket, $opt = null)
- {
- if (!$opt) $opt = array();
- $opt['verb'] = 'GET';
- $opt['sub_resource'] = 'notification';
-
- // Authenticate to S3
- return $this->authenticate($bucket, $opt);
- }
-
- /**
- * Empties the list of SNS topics to send notifications to.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- * @link http://docs.amazonwebservices.com/AmazonS3/latest/dev/NotificationHowTo.html Setting Up Notification of Bucket Events
- */
- public function delete_bucket_notification($bucket, $opt = null)
- {
- if (!$opt) $opt = array();
- $opt['verb'] = 'PUT';
- $opt['sub_resource'] = 'notification';
- $opt['body'] = $this->base_notification_xml;
-
- // Authenticate to S3
- return $this->authenticate($bucket, $opt);
- }
-
-
- /*%******************************************************************************************%*/
- // MULTIPART UPLOAD
-
- /**
- * Calculates the correct values for sequentially reading a file for multipart upload. This method should
- * be used in conjunction with <upload_part()>.
- *
- * @param integer $filesize (Required) The size in bytes of the entire file.
- * @param integer $part_size (Required) The size in bytes of the part of the file to send.
- * @return array An array containing key-value pairs. The keys are `seekTo` and `length`.
- */
- public function get_multipart_counts($filesize, $part_size)
- {
- $i = 0;
- $sizecount = $filesize;
- $values = array();
-
- while ($sizecount > 0)
- {
- $sizecount -= $part_size;
- $values[] = array(
- 'seekTo' => ($part_size * $i),
- 'length' => (($sizecount > 0) ? $part_size : ($sizecount + $part_size)),
- );
- $i++;
- }
-
- return $values;
- }
-
- /**
- * Initiates a multipart upload and returns an `UploadId`.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param string $filename (Required) The file name for the object.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>acl</code> - <code>string</code> - Optional - The ACL settings for the specified object. [Allowed values: <code>AmazonS3::ACL_PRIVATE</code>, <code>AmazonS3::ACL_PUBLIC</code>, <code>AmazonS3::ACL_OPEN</code>, <code>AmazonS3::ACL_AUTH_READ</code>, <code>AmazonS3::ACL_OWNER_READ</code>, <code>AmazonS3::ACL_OWNER_FULL_CONTROL</code>]. The default value is <code>ACL_PRIVATE</code>.</li>
- * <li><code>contentType</code> - <code>string</code> - Optional - The type of content that is being sent. The default value is <code>application/octet-stream</code>.</li>
- * <li><code>encryption</code> - <code>string</code> - Optional - The algorithm to use for encrypting the object. [Allowed values: <code>AES256</code>]</li>
- * <li><code>headers</code> - <code>array</code> - Optional - Standard HTTP headers to send along in the request. Accepts an associative array of key-value pairs.</li>
- * <li><code>meta</code> - <code>array</code> - Optional - An associative array of key-value pairs. Any header starting with <code>x-amz-meta-:</code> is considered user metadata. It will be stored with the object and returned when you retrieve the object. The total size of the HTTP request, not including the body, must be less than 4 KB.</li>
- * <li><code>storage</code> - <code>string</code> - Optional - Whether to use Standard or Reduced Redundancy storage. [Allowed values: <code>AmazonS3::STORAGE_STANDARD</code>, <code>AmazonS3::STORAGE_REDUCED</code>]. The default value is <code>STORAGE_STANDARD</code>.</li>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- * @link http://docs.amazonwebservices.com/AmazonS3/latest/dev/RESTAccessPolicy.html REST Access Control Policy
- */
- public function initiate_multipart_upload($bucket, $filename, $opt = null)
- {
- if (!$opt) $opt = array();
-
- // Add this to our request
- $opt['verb'] = 'POST';
- $opt['resource'] = $filename;
- $opt['sub_resource'] = 'uploads';
- $opt['body'] = '';
-
- // Handle content type. Can also be passed as an HTTP header.
- if (isset($opt['contentType']))
- {
- $opt['headers']['Content-Type'] = $opt['contentType'];
- unset($opt['contentType']);
- }
-
- // Set a default content type.
- if (!isset($opt['headers']['Content-Type']))
- {
- $opt['headers']['Content-Type'] = 'application/octet-stream';
- }
-
- // Handle Access Control Lists. Can also be passed as an HTTP header.
- if (isset($opt['acl']))
- {
- $opt['headers']['x-amz-acl'] = $opt['acl'];
- unset($opt['acl']);
- }
-
- // Handle storage settings. Can also be passed as an HTTP header.
- if (isset($opt['storage']))
- {
- $opt['headers']['x-amz-storage-class'] = $opt['storage'];
- unset($opt['storage']);
- }
-
- // Handle encryption settings. Can also be passed as an HTTP header.
- if (isset($opt['encryption']))
- {
- $opt['headers']['x-amz-server-side-encryption'] = $opt['encryption'];
- unset($opt['encryption']);
- }
-
- // Handle meta tags. Can also be passed as an HTTP header.
- if (isset($opt['meta']))
- {
- foreach ($opt['meta'] as $meta_key => $meta_value)
- {
- // e.g., `My Meta Header` is converted to `x-amz-meta-my-meta-header`.
- $opt['headers']['x-amz-meta-' . strtolower(str_replace(' ', '-', $meta_key))] = $meta_value;
- }
- unset($opt['meta']);
- }
-
- // Authenticate to S3
- return $this->authenticate($bucket, $opt);
- }
-
- /**
- * Uploads a single part of a multipart upload. The part size cannot be smaller than 5 MB
- * or larger than 5 TB. A multipart upload can have no more than 10,000 parts.
- *
- * Amazon S3 charges for storage as well as requests to the service. Smaller part sizes (and more
- * requests) allow for faster failures and better upload reliability. Larger part sizes (and fewer
- * requests) costs slightly less but has lower upload reliability.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param string $filename (Required) The file name for the object.
- * @param string $upload_id (Required) The upload ID identifying the multipart upload whose parts are being listed. The upload ID is retrieved from a call to <initiate_multipart_upload()>.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>fileUpload</code> - <code>string|resource</code> - Required - The URL/path for the file to upload or an open resource.</li>
- * <li><code>partNumber</code> - <code>integer</code> - Required - The part number order of the multipart upload.</li>
- * <li><code>expect</code> - <code>string</code> - Optional - Specifies that the SDK not send the request body until it receives an acknowledgement. If the message is rejected based on the headers, the body of the message is not sent. For more information, see <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.20">RFC 2616, section 14.20</a>. The value can also be passed to the <code>header</code> option as <code>Expect</code>. [Allowed values: <code>100-continue</code>]</li>
- * <li><code>headers</code> - <code>array</code> - Optional - Standard HTTP headers to send along in the request. Accepts an associative array of key-value pairs.</li>
- * <li><code>length</code> - <code>integer</code> - Optional - The size of the part in bytes. For more information, see <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13">RFC 2616, section 14.13</a>. The value can also be passed to the <code>header</code> option as <code>Content-Length</code>.</li>
- * <li><code>md5</code> - <code>string</code> - Optional - The base64 encoded 128-bit MD5 digest of the part data. This header can be used as a message integrity check to verify that the part data is the same data that was originally sent. Although it is optional, we recommend using this mechanism as an end-to-end integrity check. For more information, see <a href="http://www.ietf.org/rfc/rfc1864.txt">RFC 1864</a>. The value can also be passed to the <code>header</code> option as <code>Content-MD5</code>.</li>
- * <li><code>seekTo</code> - <code>integer</code> - Optional - The starting position in bytes for the piece of the file/stream to upload.</li>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- */
- public function upload_part($bucket, $filename, $upload_id, $opt = null)
- {
- if (!$opt) $opt = array();
-
- // Add this to our request
- $opt['verb'] = 'PUT';
- $opt['resource'] = $filename;
- $opt['uploadId'] = $upload_id;
-
- if (!isset($opt['fileUpload']) || !isset($opt['partNumber']))
- {
- throw new S3_Exception('The `fileUpload` and `partNumber` options are both required in ' . __FUNCTION__ . '().');
- }
-
- // Handle expectation. Can also be passed as an HTTP header.
- if (isset($opt['expect']))
- {
- $opt['headers']['Expect'] = $opt['expect'];
- unset($opt['expect']);
- }
-
- // Handle content length. Can also be passed as an HTTP header.
- if (isset($opt['length']))
- {
- $opt['headers']['Content-Length'] = $opt['length'];
- unset($opt['length']);
- }
-
- // Handle content md5. Can also be passed as an HTTP header.
- if (isset($opt['md5']))
- {
- $opt['headers']['Content-MD5'] = $opt['md5'];
- unset($opt['md5']);
- }
-
- $opt['headers']['Expect'] = '100-continue';
-
- // Authenticate to S3
- return $this->authenticate($bucket, $opt);
- }
-
- /**
- * Lists the completed parts of an in-progress multipart upload.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param string $filename (Required) The file name for the object.
- * @param string $upload_id (Required) The upload ID identifying the multipart upload whose parts are being listed. The upload ID is retrieved from a call to <initiate_multipart_upload()>.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>max-parts</code> - <code>integer</code> - Optional - The maximum number of parts to return in the response body.</li>
- * <li><code>part-number-marker</code> - <code>string</code> - Optional - Restricts the response to contain results that only occur numerically after the value of the <code>part-number-marker</code>.</li>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- */
- public function list_parts($bucket, $filename, $upload_id, $opt = null)
- {
- if (!$opt) $opt = array();
-
- // Add this to our request
- $opt['verb'] = 'GET';
- $opt['resource'] = $filename;
- $opt['uploadId'] = $upload_id;
- $opt['query_string'] = array();
-
- foreach (array('max-parts', 'part-number-marker') as $param)
- {
- if (isset($opt[$param]))
- {
- $opt['query_string'][$param] = $opt[$param];
- unset($opt[$param]);
- }
- }
-
- // Authenticate to S3
- return $this->authenticate($bucket, $opt);
- }
-
- /**
- * Aborts an in-progress multipart upload. This operation cannot be reversed.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param string $filename (Required) The file name for the object.
- * @param string $upload_id (Required) The upload ID identifying the multipart upload whose parts are being listed. The upload ID is retrieved from a call to <initiate_multipart_upload()>.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- */
- public function abort_multipart_upload($bucket, $filename, $upload_id, $opt = null)
- {
- if (!$opt) $opt = array();
-
- // Add this to our request
- $opt['verb'] = 'DELETE';
- $opt['resource'] = $filename;
- $opt['uploadId'] = $upload_id;
-
- // Authenticate to S3
- return $this->authenticate($bucket, $opt);
- }
-
- /**
- * Completes an in-progress multipart upload. A multipart upload is completed by describing the part
- * numbers and corresponding ETag values in order, and submitting that data to Amazon S3 as an XML document.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param string $filename (Required) The file name for the object.
- * @param string $upload_id (Required) The upload ID identifying the multipart upload whose parts are being listed. The upload ID is retrieved from a call to <initiate_multipart_upload()>.
- * @param string|array|SimpleXMLElement|CFResponse $parts (Required) The completion XML document. This document can be provided in multiple ways; as a string of XML, as a <php:SimpleXMLElement> object representing the XML document, as an indexed array of associative arrays where the keys are <code>PartNumber</code> and <code>ETag</code>, or as a <CFResponse> object returned by <list_parts()>.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- */
- public function complete_multipart_upload($bucket, $filename, $upload_id, $parts, $opt = null)
- {
- if (!$opt) $opt = array();
-
- // Add this to our request
- $opt['verb'] = 'POST';
- $opt['resource'] = $filename;
- $opt['uploadId'] = $upload_id;
- $opt['headers'] = array(
- 'Content-Type' => 'application/xml'
- );
-
- // Disable Content-MD5 calculation for this operation
- $opt['NoContentMD5'] = true;
-
- if (is_string($parts))
- {
- // Assume it's the intended XML.
- $opt['body'] = $parts;
- }
- elseif ($parts instanceof SimpleXMLElement)
- {
- // Assume it's a SimpleXMLElement object representing the XML.
- $opt['body'] = $parts->asXML();
- }
- elseif (is_array($parts) || $parts instanceof CFResponse)
- {
- $xml = simplexml_load_string($this->complete_mpu_xml);
-
- if (is_array($parts))
- {
- // Generate the appropriate XML.
- foreach ($parts as $node)
- {
- $part = $xml->addChild('Part');
- $part->addChild('PartNumber', $node['PartNumber']);
- $part->addChild('ETag', $node['ETag']);
- }
-
- }
- elseif ($parts instanceof CFResponse)
- {
- // Assume it's a response from list_parts().
- foreach ($parts->body->Part as $node)
- {
- $part = $xml->addChild('Part');
- $part->addChild('PartNumber', (string) $node->PartNumber);
- $part->addChild('ETag', (string) $node->ETag);
- }
- }
-
- $opt['body'] = $xml->asXML();
- }
-
- // Authenticate to S3
- return $this->authenticate($bucket, $opt);
- }
-
- /**
- * Lists the in-progress multipart uploads.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>delimiter</code> - <code>string</code> - Optional - Keys that contain the same string between the prefix and the first occurrence of the delimiter will be rolled up into a single result element in the CommonPrefixes collection.</li>
- * <li><code>key-marker</code> - <code>string</code> - Optional - Restricts the response to contain results that only occur alphabetically after the value of the <code>key-marker</code>. If used in conjunction with <code>upload-id-marker</code>, the results will be filtered to include keys whose upload ID is alphabetically after the value of <code>upload-id-marker</code>.</li>
- * <li><code>upload-id-marker</code> - <code>string</code> - Optional - Restricts the response to contain results that only occur alphabetically after the value of the <code>upload-id-marker</code>. Must be used in conjunction with <code>key-marker</code>.</li>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- */
- public function list_multipart_uploads($bucket, $opt = null)
- {
- if (!$opt) $opt = array();
-
- // Add this to our request
- $opt['verb'] = 'GET';
- $opt['sub_resource'] = 'uploads';
-
- foreach (array('key-marker', 'max-uploads', 'upload-id-marker') as $param)
- {
- if (isset($opt[$param]))
- {
- $opt['query_string'][$param] = $opt[$param];
- unset($opt[$param]);
- }
- }
-
- // Authenticate to S3
- return $this->authenticate($bucket, $opt);
- }
-
- /**
- * Since Amazon S3's standard <copy_object()> operation only supports copying objects that are smaller than
- * 5 GB, the ability to copy large objects (greater than 5 GB) requires the use of "Multipart Copy".
- *
- * Copying large objects requires the developer to initiate a new multipart "upload", copy pieces of the
- * large object (specifying a range of bytes up to 5 GB from the large source file), then complete the
- * multipart "upload".
- *
- * NOTE: <strong>This is a synchronous operation</strong>, not an <em>asynchronous</em> operation, which means
- * that Amazon S3 will not return a response for this operation until the copy has completed across the Amazon
- * S3 server fleet. Copying objects within a single region will complete more quickly than copying objects
- * <em>across</em> regions. The synchronous nature of this operation is different from other services where
- * responses are typically returned immediately, even if the operation itself has not yet been completed on
- * the server-side.
- *
- * @param array $source (Required) The bucket and file name to copy from. The following keys must be set: <ul>
- * <li><code>bucket</code> - <code>string</code> - Required - Specifies the name of the bucket containing the source object.</li>
- * <li><code>filename</code> - <code>string</code> - Required - Specifies the file name of the source object to copy.</li></ul>
- * @param array $dest (Required) The bucket and file name to copy to. The following keys must be set: <ul>
- * <li><code>bucket</code> - <code>string</code> - Required - Specifies the name of the bucket to copy the object to.</li>
- * <li><code>filename</code> - <code>string</code> - Required - Specifies the file name to copy the object to.</li></ul>
- * @param string $upload_id (Required) The upload ID identifying the multipart upload whose parts are being listed. The upload ID is retrieved from a call to <initiate_multipart_upload()>.
- * @param integer $part_number (Required) A part number uniquely identifies a part and defines its position within the destination object. When you complete a multipart upload, a complete object is created by concatenating parts in ascending order based on part number. If you copy a new part using the same part number as a previously copied/uploaded part, the previously written part is overwritten.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>ifMatch</code> - <code>string</code> - Optional - The ETag header from a previous request. Copies the object if its entity tag (ETag) matches the specified tag; otherwise, the request returns a <code>412</code> HTTP status code error (precondition failed). Used in conjunction with <code>ifUnmodifiedSince</code>.</li>
- * <li><code>ifUnmodifiedSince</code> - <code>string</code> - Optional - The LastModified header from a previous request. Copies the object if it hasn't been modified since the specified time; otherwise, the request returns a <code>412</code> HTTP status code error (precondition failed). Used in conjunction with <code>ifMatch</code>.</li>
- * <li><code>ifNoneMatch</code> - <code>string</code> - Optional - The ETag header from a previous request. Copies the object if its entity tag (ETag) is different than the specified ETag; otherwise, the request returns a <code>412</code> HTTP status code error (failed condition). Used in conjunction with <code>ifModifiedSince</code>.</li>
- * <li><code>ifModifiedSince</code> - <code>string</code> - Optional - The LastModified header from a previous request. Copies the object if it has been modified since the specified time; otherwise, the request returns a <code>412</code> HTTP status code error (failed condition). Used in conjunction with <code>ifNoneMatch</code>.</li>
- * <li><code>range</code> - <code>string</code> - Optional - The range of bytes to copy from the object. Specify this parameter when copying partial bits. The specified range must be notated with a hyphen (e.g., 0-10485759). Defaults to the byte range of the complete Amazon S3 object.</li>
- * <li><code>versionId</code> - <code>string</code> - Optional - The version of the object to copy. Version IDs are returned in the <code>x-amz-version-id</code> header of any previous object-related request.</li>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- */
- public function copy_part($source, $dest, $upload_id, $part_number, $opt = null)
- {
- if (!$opt) $opt = array();
-
- // Add this to our request
- $opt['verb'] = 'PUT';
- $opt['resource'] = $dest['filename'];
- $opt['uploadId'] = $upload_id;
- $opt['partNumber'] = $part_number;
-
- // Handle copy source
- if (isset($source['bucket']) && isset($source['filename']))
- {
- $opt['headers']['x-amz-copy-source'] = '/' . $source['bucket'] . '/' . rawurlencode($source['filename'])
- . (isset($opt['versionId']) ? ('?' . 'versionId=' . rawurlencode($opt['versionId'])) : ''); // Append the versionId to copy, if available
- unset($opt['versionId']);
- }
-
- // Handle conditional-copy parameters
- if (isset($opt['ifMatch']))
- {
- $opt['headers']['x-amz-copy-source-if-match'] = $opt['ifMatch'];
- unset($opt['ifMatch']);
- }
- if (isset($opt['ifNoneMatch']))
- {
- $opt['headers']['x-amz-copy-source-if-none-match'] = $opt['ifNoneMatch'];
- unset($opt['ifNoneMatch']);
- }
- if (isset($opt['ifUnmodifiedSince']))
- {
- $opt['headers']['x-amz-copy-source-if-unmodified-since'] = $opt['ifUnmodifiedSince'];
- unset($opt['ifUnmodifiedSince']);
- }
- if (isset($opt['ifModifiedSince']))
- {
- $opt['headers']['x-amz-copy-source-if-modified-since'] = $opt['ifModifiedSince'];
- unset($opt['ifModifiedSince']);
- }
-
- // Partial content range
- if (isset($opt['range']))
- {
- $opt['headers']['x-amz-copy-source-range'] = 'bytes=' . $opt['range'];
- }
-
- // Authenticate to S3
- return $this->authenticate($dest['bucket'], $opt);
- }
-
- /**
- * Creates an Amazon S3 object using the multipart upload APIs. It is analogous to <create_object()>.
- *
- * While each individual part of a multipart upload can hold up to 5 GB of data, this method limits the
- * part size to a maximum of 500 MB. The combined size of all parts can not exceed 5 TB of data. When an
- * object is stored in Amazon S3, the data is streamed to multiple storage servers in multiple data
- * centers. This ensures the data remains available in the event of internal network or hardware failure.
- *
- * Amazon S3 charges for storage as well as requests to the service. Smaller part sizes (and more
- * requests) allow for faster failures and better upload reliability. Larger part sizes (and fewer
- * requests) costs slightly less but has lower upload reliability.
- *
- * In certain cases with large objects, it's possible for this method to attempt to open more file system
- * connections than allowed by the OS. In this case, either
- * <a href="https://forums.aws.amazon.com/thread.jspa?threadID=70216">increase the number of connections
- * allowed</a> or increase the value of the <code>partSize</code> parameter to use a larger part size.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param string $filename (Required) The file name for the object.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>fileUpload</code> - <code>string|resource</code> - Required - The URL/path for the file to upload, or an open resource.</li>
- * <li><code>acl</code> - <code>string</code> - Optional - The ACL settings for the specified object. [Allowed values: <code>AmazonS3::ACL_PRIVATE</code>, <code>AmazonS3::ACL_PUBLIC</code>, <code>AmazonS3::ACL_OPEN</code>, <code>AmazonS3::ACL_AUTH_READ</code>, <code>AmazonS3::ACL_OWNER_READ</code>, <code>AmazonS3::ACL_OWNER_FULL_CONTROL</code>]. The default value is <code>ACL_PRIVATE</code>.</li>
- * <li><code>contentType</code> - <code>string</code> - Optional - The type of content that is being sent in the body. The default value is <code>application/octet-stream</code>.</li>
- * <li><code>headers</code> - <code>array</code> - Optional - Standard HTTP headers to send along in the request. Accepts an associative array of key-value pairs.</li>
- * <li><code>length</code> - <code>integer</code> - Optional - The size of the object in bytes. For more information, see <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13">RFC 2616, section 14.13</a>. The value can also be passed to the <code>header</code> option as <code>Content-Length</code>.</li>
- * <li><code>limit</code> - <code>integer</code> - Optional - The maximum number of concurrent uploads done by cURL. Gets passed to <code>CFBatchRequest</code>.</li>
- * <li><code>meta</code> - <code>array</code> - Optional - An associative array of key-value pairs. Any header starting with <code>x-amz-meta-:</code> is considered user metadata. It will be stored with the object and returned when you retrieve the object. The total size of the HTTP request, not including the body, must be less than 4 KB.</li>
- * <li><code>partSize</code> - <code>integer</code> - Optional - The size of an individual part. The size may not be smaller than 5 MB or larger than 500 MB. The default value is 50 MB.</li>
- * <li><code>seekTo</code> - <code>integer</code> - Optional - The starting position in bytes for the first piece of the file/stream to upload.</li>
- * <li><code>storage</code> - <code>string</code> - Optional - Whether to use Standard or Reduced Redundancy storage. [Allowed values: <code>AmazonS3::STORAGE_STANDARD</code>, <code>AmazonS3::STORAGE_REDUCED</code>]. The default value is <code>STORAGE_STANDARD</code>.</li>
- * <li><code>uploadId</code> - <code>string</code> - Optional - An upload ID identifying an existing multipart upload to use. If this option is not set, one will be created automatically.</li>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- * @link http://docs.amazonwebservices.com/AmazonS3/latest/dev/RESTAccessPolicy.html REST Access Control Policy
- */
- public function create_mpu_object($bucket, $filename, $opt = null)
- {
- if ($this->use_batch_flow)
- {
- throw new S3_Exception(__FUNCTION__ . '() cannot be batch requested');
- }
-
- if (!$opt) $opt = array();
-
- // Handle content length. Can also be passed as an HTTP header.
- if (isset($opt['length']))
- {
- $opt['headers']['Content-Length'] = $opt['length'];
- unset($opt['length']);
- }
-
- if (!isset($opt['fileUpload']))
- {
- throw new S3_Exception('The `fileUpload` option is required in ' . __FUNCTION__ . '().');
- }
- elseif (is_resource($opt['fileUpload']))
- {
- $opt['limit'] = 1; // We can only read from this one resource.
- $upload_position = isset($opt['seekTo']) ? (integer) $opt['seekTo'] : ftell($opt['fileUpload']);
- $upload_filesize = isset($opt['headers']['Content-Length']) ? (integer) $opt['headers']['Content-Length'] : null;
-
- if (!isset($upload_filesize) && $upload_position !== false)
- {
- $stats = fstat($opt['fileUpload']);
-
- if ($stats && $stats['size'] >= 0)
- {
- $upload_filesize = $stats['size'] - $upload_position;
- }
- }
- }
- else
- {
- $upload_position = isset($opt['seekTo']) ? (integer) $opt['seekTo'] : 0;
-
- if (isset($opt['headers']['Content-Length']))
- {
- $upload_filesize = (integer) $opt['headers']['Content-Length'];
- }
- else
- {
- $upload_filesize = filesize($opt['fileUpload']);
-
- if ($upload_filesize !== false)
- {
- $upload_filesize -= $upload_position;
- }
- }
- }
-
- if ($upload_position === false || !isset($upload_filesize) || $upload_filesize === false || $upload_filesize < 0)
- {
- throw new S3_Exception('The size of `fileUpload` cannot be determined in ' . __FUNCTION__ . '().');
- }
-
- // Handle part size
- if (isset($opt['partSize']))
- {
- // If less that 5 MB...
- if ((integer) $opt['partSize'] < 5242880)
- {
- $opt['partSize'] = 5242880; // 5 MB
- }
- // If more than 500 MB...
- elseif ((integer) $opt['partSize'] > 524288000)
- {
- $opt['partSize'] = 524288000; // 500 MB
- }
- }
- else
- {
- $opt['partSize'] = 52428800; // 50 MB
- }
-
- // If the upload size is smaller than the piece size, failover to create_object().
- if ($upload_filesize < $opt['partSize'] && !isset($opt['uploadId']))
- {
- return $this->create_object($bucket, $filename, $opt);
- }
-
- // Initiate multipart upload
- if (isset($opt['uploadId']))
- {
- $upload_id = $opt['uploadId'];
- }
- else
- {
- // Compose options for initiate_multipart_upload().
- $_opt = array();
- foreach (array('contentType', 'acl', 'storage', 'headers', 'meta') as $param)
- {
- if (isset($opt[$param]))
- {
- $_opt[$param] = $opt[$param];
- }
- }
-
- $upload = $this->initiate_multipart_upload($bucket, $filename, $_opt);
- if (!$upload->isOK())
- {
- return $upload;
- }
-
- // Fetch the UploadId
- $upload_id = (string) $upload->body->UploadId;
- }
-
- // Get the list of pieces
- $pieces = $this->get_multipart_counts($upload_filesize, (integer) $opt['partSize']);
-
- // Queue batch requests
- $batch = new CFBatchRequest(isset($opt['limit']) ? (integer) $opt['limit'] : null);
- foreach ($pieces as $i => $piece)
- {
- $this->batch($batch)->upload_part($bucket, $filename, $upload_id, array(
- 'expect' => '100-continue',
- 'fileUpload' => $opt['fileUpload'],
- 'partNumber' => ($i + 1),
- 'seekTo' => $upload_position + (integer) $piece['seekTo'],
- 'length' => (integer) $piece['length'],
- ));
- }
-
- // Send batch requests
- $batch_responses = $this->batch($batch)->send();
- if (!$batch_responses->areOK())
- {
- return $batch_responses;
- }
-
- // Compose completion XML
- $parts = array();
- foreach ($batch_responses as $i => $response)
- {
- $parts[] = array('PartNumber' => ($i + 1), 'ETag' => $response->header['etag']);
- }
-
- return $this->complete_multipart_upload($bucket, $filename, $upload_id, $parts);
- }
-
- /**
- * Aborts all multipart uploads initiated before the specified date. This operation cannot be reversed.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param string|integer $when (Optional) The time and date to use for comparison. Accepts any value that <php:strtotime()> understands.
- * @return CFArray A <CFArray> containing a series of 0 or more <CFResponse> objects, containing a parsed HTTP response.
- */
- public function abort_multipart_uploads_by_date($bucket, $when = null)
- {
- if ($this->use_batch_flow)
- {
- // @codeCoverageIgnoreStart
- throw new S3_Exception(__FUNCTION__ . '() cannot be batch requested');
- // @codeCoverageIgnoreEnd
- }
-
- $when = $when ? $when : time();
- $handles = array();
- $data = $this->list_multipart_uploads($bucket)->body;
- $when = is_int($when) ? $when : strtotime($when);
-
- if (!($data instanceof CFSimpleXML))
- {
- return false;
- }
-
- $list = $data->query('descendant-or-self::Upload/Initiated');
-
- if (count($list) > 0)
- {
- foreach ($list as $node)
- {
- if (strtotime((string) $node) < $when)
- {
- $q = new CFBatchRequest();
- $parent = $node->parent();
-
- $upload_id = $parent
- ->query('descendant-or-self::UploadId')
- ->first()
- ->to_string();
-
- $filename = $parent
- ->query('descendant-or-self::Key')
- ->first()
- ->to_string();
-
- $handles[] = $this->abort_multipart_upload($bucket, $filename, $upload_id, array(
- 'returnCurlHandle' => true
- ));
- }
- }
-
- $http = new CFRequest();
- $responses = $http->send_multi_request($handles);
-
- if (is_array($responses) && count($responses) > 0)
- {
- return new CFArray($responses);
- }
- }
-
- return new CFArray();
- }
-
-
- /*%******************************************************************************************%*/
- // WEBSITE CONFIGURATION
-
- /**
- * Enables and configures an Amazon S3 website using the corresponding bucket as the content source.
- * The website will have one default domain name associated with it, which is the bucket name. If you
- * attempt to configure an Amazon S3 website for a bucket whose name is not compatible with DNS,
- * Amazon S3 returns an <code>InvalidBucketName</code> error. For more information on bucket names and DNS,
- * refer to <a href="http://docs.amazonwebservices.com/AmazonS3/latest/dev/BucketRestrictions.html">Bucket Restrictions and Limitations.</a>
- *
- * To visit the bucket as a website a new endpoint is created in the following pattern:
- * <code>http://&lt;bucketName&gt;.s3-website-&lt;region&gt;.amazonaws.com</code>. This is a sample URL
- * for a bucket called <code>example-bucket</code> in the <code>us-east-1</code> region.
- * (e.g., <code>http://example-bucket.s3-website-us-east-1.amazonaws.com</code>)
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>indexDocument</code> - <code>string</code> - Optional - The file path to use as the root document. The default value is <code>index.html</code>.</li>
- * <li><code>errorDocument</code> - <code>string</code> - Optional - The file path to use as the error document. The default value is <code>error.html</code>.</li>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- */
- public function create_website_config($bucket, $opt = null)
- {
- if (!$opt) $opt = array();
- $opt['verb'] = 'PUT';
- $opt['sub_resource'] = 'website';
-
- $xml = simplexml_load_string($this->website_config_xml);
- if (isset($opt['indexDocument']))
- {
- $xml->IndexDocument->Suffix = $opt['indexDocument'];
- }
- if (isset($opt['errorDocument']))
- {
- $xml->ErrorDocument->Key = $opt['errorDocument'];
- }
-
- $opt['body'] = $xml->asXML();
-
- // Authenticate to S3
- return $this->authenticate($bucket, $opt);
- }
-
- /**
- * Retrieves the website configuration for a bucket. The contents of this response are identical to the
- * content submitted by the user during the website creation operation. If a website configuration has
- * never been set, Amazon S3 will return a 404 error.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- */
- public function get_website_config($bucket, $opt = null)
- {
- if (!$opt) $opt = array();
- $opt['verb'] = 'GET';
- $opt['sub_resource'] = 'website';
- $opt['headers'] = array(
- 'Content-Type' => 'application/xml'
- );
-
- // Authenticate to S3
- return $this->authenticate($bucket, $opt);
- }
-
- /**
- * Removes the website configuration for a bucket.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- */
- public function delete_website_config($bucket, $opt = null)
- {
- if (!$opt) $opt = array();
- $opt['verb'] = 'DELETE';
- $opt['sub_resource'] = 'website';
-
- // Authenticate to S3
- return $this->authenticate($bucket, $opt);
- }
-
-
- /*%******************************************************************************************%*/
- // OBJECT EXPIRATION
-
- /**
- * Enables the ability to specify an expiry period for objects when an object should be deleted,
- * measured as number of days from creation time. Amazon S3 guarantees that the object will be
- * deleted when the expiration time is passed.
- *
- * @param string $bucket (Required) The name of the bucket to use.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>rules</code> - <code>string</code> - Required - The object expiration rule-sets to apply to the bucket. <ul>
- * <li><code>x</code> - <code>array</code> - Required - This represents a simple array index. <ul>
- * <li><code>id</code> - <code>string</code> - Optional - Unique identifier for the rule. The value cannot be longer than 255 characters.
- * <li><code>prefix</code> - <code>string</code> - Required - The Amazon S3 object prefix which targets the file(s) for expiration.</li>
- * <li><code>expiration</code> - <code>array</code> - Required - The container for the unit of measurement by which the expiration time is calculated. <ul>
- * <li><code>days</code> - <code>integer</code> - Required - The number of days until the targetted objects expire from the bucket.</li>
- * </ul></li>
- * <li><code>enabled</code> - <code>boolean</code> - Optional - Whether or not to enable this rule-set. A value of <code>true</code> enables the rule-set. A value of <code>false</code> disables the rule-set. The default value is <code>true</code>.</li>
- * </ul></li>
- * </ul></li>
- * <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
- * <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
- * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
- */
- public function create_object_expiration_config($bucket, $opt = null)
- {
- if (!$opt) $opt = array();
- $opt['verb'] = 'PUT';
- $opt['sub_resource'] = 'lifecycle';
- $opt['headers'] = array(
- 'Content-Type' => 'application/xml'
- );
-
- $xml = simplexml_load_string($this->object_expiration_xml, $this->parser_class);
-
- if (isset($opt['rules']) && is_array($opt['rules']) && count($opt['rules']))
- {
- foreach ($opt['rules'] as $rule)
- {
- $xrule = $xml->addChild('Rule');
-
- // ID
- if (isset($rule['id']))
- {
- if (strlen($rule['id']) > 255)
- {
- throw new S3_Exception('The "id" for a rule must not be more than 255 characters in the ' . __FUNCTION__ . ' method.');
- }
-
- $xrule->addChild('ID', $rule['id']);
- }
-
- // Prefix
- if (isset($rule['prefix']))
- {
- $xrule->addChild('Prefix', $rule['prefix']);
- }
- else
- {
- throw new S3_Exception('Each rule requires a "prefix" in the ' . __FUNCTION__ . ' method.');
- }
-
- // Status
- $enabled = 'Enabled';
- if (isset($rule['enabled']))
- {
- if (is_bool($rule['enabled'])) // Boolean
- {
- $enabled = $rule['enabled'] ? 'Enabled' : 'Disabled';
- }
- elseif (is_string($rule['enabled'])) // String
- {
- $enabled = (strtolower($rule['enabled']) === 'true') ? 'Enabled' : 'Disabled';
- }
-
- $xrule->addChild('Status', $enabled);
- }
- else
- {
- $xrule->addChild('Status', 'Enabled');
- }
-
- // Expiration
- if (isset($rule['expiration']))
- {
- $xexpiration = $xrule->addChild('Expiration');
-
- if (isset($rule['expiration']['days']))
- {
- $xexpiration->addChild('Days', $rule['expiration']['days']);
- }
- }
- else
- {
- throw new S3_Exception('Each rule requires a "expiration" in the ' . __FUNCTION__ . ' method.');
- }
- }
- }
-
- $opt['body'] = $xml->asXML();
-
- // Authenticate to S3
- return $this->authenticate($bucket, $opt);
- }
-
- public function get_object_expiration_config($bucket, $opt = null)
- {
- if (!$opt) $opt = array();
- $opt['verb'] = 'GET';
- $opt['sub_resource'] = 'lifecycle';
-
- // Authenticate to S3
- return $this->authenticate($bucket, $opt);
- }
-
- public function delete_object_expiration_config($bucket, $opt = null)
- {
- if (!$opt) $opt = array();
- $opt['verb'] = 'DELETE';
- $opt['sub_resource'] = 'lifecycle';
-
- // Authenticate to S3
- return $this->authenticate($bucket, $opt);
- }
-
-
- /*%******************************************************************************************%*/
- // MISCELLANEOUS
-
- /**
- * Gets the canonical user ID and display name from the Amazon S3 server.
- *
- * @return array An associative array containing the `id` and `display_name` values.
- */
- public function get_canonical_user_id()
- {
- if ($this->use_batch_flow)
- {
- throw new S3_Exception(__FUNCTION__ . '() cannot be batch requested');
- }
-
- $id = $this->list_buckets();
-
- return array(
- 'id' => (string) $id->body->Owner->ID,
- 'display_name' => (string) $id->body->Owner->DisplayName
- );
- }
-
- /**
- * Loads and registers the S3StreamWrapper class as a stream wrapper.
- *
- * @param string $protocol (Optional) The name of the protocol to register.
- * @return boolean Whether or not the registration succeeded.
- */
- public function register_stream_wrapper($protocol = 's3')
- {
- require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'extensions'
- . DIRECTORY_SEPARATOR . 's3streamwrapper.class.php';
-
- return S3StreamWrapper::register($this, $protocol);
- }
-}
diff --git a/3rdparty/aws-sdk/utilities/array.class.php b/3rdparty/aws-sdk/utilities/array.class.php
deleted file mode 100644
index dea673546f8..00000000000
--- a/3rdparty/aws-sdk/utilities/array.class.php
+++ /dev/null
@@ -1,312 +0,0 @@
-<?php
-/*
- * Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License").
- * You may not use this file except in compliance with the License.
- * A copy of the License is located at
- *
- * http://aws.amazon.com/apache2.0
- *
- * or in the "license" file accompanying this file. This file is distributed
- * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-
-/*%******************************************************************************************%*/
-// CLASS
-
-/**
- * The <CFArray> object extends PHP's built-in <php:ArrayObject> object by providing convenience methods for
- * rapidly manipulating array data. Specifically, the `CFArray` object is intended for working with
- * <CFResponse> and <CFSimpleXML> objects that are returned by AWS services.
- *
- * @version 2012.01.17
- * @license See the included NOTICE.md file for more information.
- * @copyright See the included NOTICE.md file for more information.
- * @link http://aws.amazon.com/php/ PHP Developer Center
- * @link http://php.net/ArrayObject ArrayObject
- */
-class CFArray extends ArrayObject
-{
- /**
- * Constructs a new instance of <CFArray>.
- *
- * @param mixed $input (Optional) The input parameter accepts an array or an Object. The default value is an empty array.
- * @param integer $flags (Optional) Flags to control the behavior of the ArrayObject object. Defaults to <STD_PROP_LIST>.
- * @param string $iterator_class (Optional) Specify the class that will be used for iteration of the <php:ArrayObject> object. <php:ArrayIterator> is the default class used.
- * @return mixed Either an array of matches, or a single <CFSimpleXML> element.
- */
- public function __construct($input = array(), $flags = self::STD_PROP_LIST, $iterator_class = 'ArrayIterator')
- {
- // Provide a default value
- $input = $input ? $input : array();
-
- try {
- return parent::__construct($input, $flags, $iterator_class);
- }
- catch (InvalidArgumentException $e)
- {
- throw new CFArray_Exception($e->getMessage());
- }
- }
-
- /**
- * Alternate approach to constructing a new instance. Supports chaining.
- *
- * @param mixed $input (Optional) The input parameter accepts an array or an Object. The default value is an empty array.
- * @param integer $flags (Optional) Flags to control the behavior of the ArrayObject object. Defaults to <STD_PROP_LIST>.
- * @param string $iterator_class (Optional) Specify the class that will be used for iteration of the <php:ArrayObject> object. <php:ArrayIterator> is the default class used.
- * @return mixed Either an array of matches, or a single <CFSimpleXML> element.
- */
- public static function init($input = array(), $flags = self::STD_PROP_LIST, $iterator_class = 'ArrayIterator')
- {
- if (version_compare(PHP_VERSION, '5.3.0', '<'))
- {
- throw new Exception('PHP 5.3 or newer is required to instantiate a new class with CLASS::init().');
- }
-
- $self = get_called_class();
- return new $self($input, $flags, $iterator_class);
- }
-
- /**
- * Handles how the object is rendered when cast as a string.
- *
- * @return string The word "Array".
- */
- public function __toString()
- {
- return 'Array';
- }
-
-
- /*%******************************************************************************************%*/
- // REFORMATTING
-
- /**
- * Maps each element in the <CFArray> object as an integer.
- *
- * @return array The contents of the <CFArray> object mapped as integers.
- */
- public function map_integer()
- {
- return array_map('intval', $this->getArrayCopy());
- }
-
- /**
- * Maps each element in the CFArray object as a string.
- *
- * @param string $pcre (Optional) A Perl-Compatible Regular Expression (PCRE) to filter the names against.
- * @return array The contents of the <CFArray> object mapped as strings. If there are no results, the method will return an empty array.
- */
- public function map_string($pcre = null)
- {
- $list = array_map('strval', $this->getArrayCopy());
- $dlist = array();
-
- if ($pcre)
- {
- foreach ($list as $item)
- {
- $dlist[] = preg_match($pcre, $item) ? $item : null;
- }
-
- $list = array_values(array_filter($dlist));
- }
-
- return $list;
- }
-
-
- /*%******************************************************************************************%*/
- // CONFIRMATION
-
- /**
- * Verifies that _all_ responses were successful. A single failed request will cause <areOK()> to return false. Equivalent to <CFResponse::isOK()>, except it applies to all responses.
- *
- * @return boolean Whether _all_ requests were successful or not.
- */
- public function areOK()
- {
- $dlist = array();
- $list = $this->getArrayCopy();
-
- foreach ($list as $response)
- {
- if ($response instanceof CFResponse)
- {
- $dlist[] = $response->isOK();
- }
- }
-
- return (array_search(false, $dlist, true) !== false) ? false : true;
- }
-
-
- /*%******************************************************************************************%*/
- // ITERATING AND EXECUTING
-
- /**
- * Iterates over a <CFArray> object, and executes a function for each matched element.
- *
- * The callback function takes three parameters: <ul>
- * <li><code>$item</code> - <code>mixed</code> - Optional - The individual node in the array.</li>
- * <li><code>$key</code> - <code>mixed</code> - Optional - The key for the array node.</li>
- * <li><code>$bind</code> - <code>mixed</code> - Optional - The variable that was passed into the $bind parameter.</li></ul>
- *
- * @param string|function $callback (Required) The callback function to execute. PHP 5.3 or newer can use an anonymous function.
- * @param mixed $bind (Optional) A variable from the calling scope to pass-by-reference into the local scope of the callback function.
- * @return CFArray The original <CFArray> object.
- */
- public function each($callback, &$bind = null)
- {
- $items = $this->getArrayCopy();
-
- foreach ($items as $key => &$item)
- {
- $callback($item, $key, $bind);
- }
-
- return $this;
- }
-
- /**
- * Passes each element in the current <CFArray> object through a function, and produces a new <CFArray> object containing the return values.
- *
- * The callback function takes three parameters: <ul>
- * <li><code>$item</code> - <code>mixed</code> - Optional - The individual node in the array.</li>
- * <li><code>$key</code> - <code>mixed</code> - Optional - The key for the array node.</li>
- * <li><code>$bind</code> - <code>mixed</code> - Optional - The variable that was passed into the $bind parameter.</li></ul>
- *
- * @param string|function $callback (Required) The callback function to execute. PHP 5.3 or newer can use an anonymous function.
- * @param mixed $bind (Optional) A variable from the calling scope to pass-by-reference into the local scope of the callback function.
- * @return CFArray A new <CFArray> object containing the return values.
- */
- public function map($callback, &$bind = null)
- {
- $items = $this->getArrayCopy();
- $collect = array();
-
- foreach ($items as $key => &$item)
- {
- $collect[] = $callback($item, $key, $bind);
- }
-
- return new CFArray($collect);
- }
-
- /**
- * Filters the list of nodes by passing each value in the current <CFArray> object through a function. The node will be removed if the function returns `false`.
- *
- * The callback function takes three parameters: <ul>
- * <li><code>$item</code> - <code>mixed</code> - Optional - The individual node in the array.</li>
- * <li><code>$key</code> - <code>mixed</code> - Optional - The key for the array node.</li>
- * <li><code>$bind</code> - <code>mixed</code> - Optional - The variable that was passed into the $bind parameter.</li></ul>
- *
- * @param string|function $callback (Required) The callback function to execute. PHP 5.3 or newer can use an anonymous function.
- * @param mixed $bind (Optional) A variable from the calling scope to pass-by-reference into the local scope of the callback function.
- * @return CFArray A new <CFArray> object containing the return values.
- */
- public function filter($callback, &$bind = null)
- {
- $items = $this->getArrayCopy();
- $collect = array();
-
- foreach ($items as $key => &$item)
- {
- if ($callback($item, $key, $bind) !== false)
- {
- $collect[] = $item;
- }
- }
-
- return new CFArray($collect);
- }
-
- /**
- * Alias for <filter()>. This functionality was incorrectly named _reduce_ in earlier versions of the SDK.
- *
- * @param string|function $callback (Required) The callback function to execute. PHP 5.3 or newer can use an anonymous function.
- * @param mixed $bind (Optional) A variable from the calling scope to pass-by-reference into the local scope of the callback function.
- * @return CFArray A new <CFArray> object containing the return values.
- */
- public function reduce($callback, &$bind = null)
- {
- return $this->filter($callback, $bind);
- }
-
-
- /*%******************************************************************************************%*/
- // TRAVERSAL
-
- /**
- * Gets the first result in the array.
- *
- * @return mixed The first result in the <CFArray> object. Returns `false` if there are no items in the array.
- */
- public function first()
- {
- $items = $this->getArrayCopy();
- return count($items) ? $items[0] : false;
- }
-
- /**
- * Gets the last result in the array.
- *
- * @return mixed The last result in the <CFArray> object. Returns `false` if there are no items in the array.
- */
- public function last()
- {
- $items = $this->getArrayCopy();
- return count($items) ? end($items) : false;
- }
-
- /**
- * Removes all `null` values from an array.
- *
- * @return CFArray A new <CFArray> object containing the non-null values.
- */
- public function compress()
- {
- return new CFArray(array_filter($this->getArrayCopy()));
- }
-
- /**
- * Reindexes the array, starting from zero.
- *
- * @return CFArray A new <CFArray> object with indexes starting at zero.
- */
- public function reindex()
- {
- return new CFArray(array_values($this->getArrayCopy()));
- }
-
-
- /*%******************************************************************************************%*/
- // ALTERNATE FORMATS
-
- /**
- * Gets the current XML node as a JSON string.
- *
- * @return string The current XML node as a JSON string.
- */
- public function to_json()
- {
- return json_encode($this->getArrayCopy());
- }
-
- /**
- * Gets the current XML node as a YAML string.
- *
- * @return string The current XML node as a YAML string.
- */
- public function to_yaml()
- {
- return sfYaml::dump($this->getArrayCopy(), 5);
- }
-}
-
-class CFArray_Exception extends Exception {}
diff --git a/3rdparty/aws-sdk/utilities/batchrequest.class.php b/3rdparty/aws-sdk/utilities/batchrequest.class.php
deleted file mode 100644
index 978283471a4..00000000000
--- a/3rdparty/aws-sdk/utilities/batchrequest.class.php
+++ /dev/null
@@ -1,126 +0,0 @@
-<?php
-/*
- * Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License").
- * You may not use this file except in compliance with the License.
- * A copy of the License is located at
- *
- * http://aws.amazon.com/apache2.0
- *
- * or in the "license" file accompanying this file. This file is distributed
- * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-
-/*%******************************************************************************************%*/
-// EXCEPTIONS
-
-/**
- * Default CFBatchRequest Exception.
- */
-class CFBatchRequest_Exception extends Exception {}
-
-
-/*%******************************************************************************************%*/
-// CLASS
-
-/**
- * Simplifies the flow involved with managing and executing a batch request queue. Batch requesting is the
- * ability to queue up a series of requests and execute them all in parallel. This allows for faster
- * application performance when a lot of requests are involved.
- *
- * @version 2011.12.02
- * @license See the included NOTICE.md file for more information.
- * @copyright See the included NOTICE.md file for more information.
- * @link http://aws.amazon.com/php/ PHP Developer Center
- */
-class CFBatchRequest extends CFRuntime
-{
- /**
- * Stores the cURL handles that are to be processed.
- */
- public $queue;
-
- /**
- * Stores the size of the request window.
- */
- public $limit;
-
- /**
- * The proxy to use for connecting.
- */
- public $proxy = null;
-
- /**
- * The helpers to use when connecting.
- */
- public $helpers = null;
-
- /**
- * The active credential set.
- */
- public $credentials;
-
-
- /*%******************************************************************************************%*/
- // CONSTRUCTOR
-
- /**
- * Constructs a new instance of this class.
- *
- * @param integer $limit (Optional) The size of the request window. Defaults to unlimited.
- * @return boolean `false` if no valid values are set, otherwise `true`.
- */
- public function __construct($limit = null)
- {
- $this->queue = array();
- $this->limit = $limit ? $limit : -1;
- $this->credentials = new CFCredential(array());
- return $this;
- }
-
- /**
- * Sets the AWS credentials to use for the batch request.
- *
- * @param CFCredential $credentials (Required) The credentials to use for signing and making requests.
- * @return $this A reference to the current instance.
- */
- public function use_credentials(CFCredential $credentials)
- {
- $this->credentials = $credentials;
- return $this;
- }
-
- /**
- * Adds a new cURL handle to the request queue.
- *
- * @param resource $handle (Required) A cURL resource to add to the queue.
- * @return $this A reference to the current instance.
- */
- public function add($handle)
- {
- $this->queue[] = $handle;
- return $this;
- }
-
- /**
- * Executes the batch request queue.
- *
- * @param array $opt (DO NOT USE) Enabled for compatibility with the method this overrides, although any values passed will be ignored.
- * @return array An indexed array of <CFResponse> objects.
- */
- public function send($opt = null)
- {
- $http = new $this->request_class(null, $this->proxy, null, $this->credentials);
-
- // Make the request
- $response = $http->send_multi_request($this->queue, array(
- 'limit' => $this->limit
- ));
-
- return $response;
- }
-}
diff --git a/3rdparty/aws-sdk/utilities/complextype.class.php b/3rdparty/aws-sdk/utilities/complextype.class.php
deleted file mode 100644
index e0509b9e368..00000000000
--- a/3rdparty/aws-sdk/utilities/complextype.class.php
+++ /dev/null
@@ -1,123 +0,0 @@
-<?php
-/*
- * Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License").
- * You may not use this file except in compliance with the License.
- * A copy of the License is located at
- *
- * http://aws.amazon.com/apache2.0
- *
- * or in the "license" file accompanying this file. This file is distributed
- * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-
-/*%******************************************************************************************%*/
-// CLASS
-
-/**
- * Contains utility methods used for converting array, JSON, and YAML data types into query string keys.
- *
- * @version 2010.11.11
- * @license See the included NOTICE.md file for more information.
- * @copyright See the included NOTICE.md file for more information.
- * @link http://aws.amazon.com/php/ PHP Developer Center
- */
-class CFComplexType
-{
- /**
- * Takes a JSON object, as a string, to convert to query string keys.
- *
- * @param string $json (Required) A JSON object. The JSON string should use canonical rules (e.g., double quotes, quoted keys) as is required by PHP's <php:json_encode()> function.
- * @param string $member (Optional) The name of the "member" property that AWS uses for lists in certain services. Defaults to an empty string.
- * @param string $default_key (Optional) The default key to use when the value for `$data` is a string. Defaults to an empty string.
- * @return array The option group parameters to merge into another method's `$opt` parameter.
- */
- public static function json($json, $member = '', $default_key = '')
- {
- return self::option_group(json_decode($json, true), $member, $default_key);
- }
-
- /**
- * Takes a YAML object, as a string, to convert to query string keys.
- *
- * @param string $yaml (Required) A YAML object.
- * @param string $member (Optional) The name of the "member" property that AWS uses for lists in certain services. Defaults to an empty string.
- * @param string $default_key (Optional) The default key to use when the value for `$data` is a string. Defaults to an empty string.
- * @return array The option group parameters to merge into another method's `$opt` parameter.
- */
- public static function yaml($yaml, $member = '', $default_key = '')
- {
- return self::option_group(sfYaml::load($yaml), $member, $default_key);
- }
-
- /**
- * Takes an associative array to convert to query string keys.
- *
- * @param array $map (Required) An associative array.
- * @param string $member (Optional) The name of the "member" property that AWS uses for lists in certain services. Defaults to an empty string.
- * @param string $default_key (Optional) The default key to use when the value for `$data` is a string. Defaults to an empty string.
- * @return array The option group parameters to merge into another method's `$opt` parameter.
- */
- public static function map($map, $member = '', $default_key = '')
- {
- return self::option_group($map, $member, $default_key);
- }
-
- /**
- * A protected method that is used by <json()>, <yaml()> and <map()>.
- *
- * @param string|array $data (Required) The data to iterate over.
- * @param string $member (Optional) The name of the "member" property that AWS uses for lists in certain services. Defaults to an empty string.
- * @param string $key (Optional) The default key to use when the value for `$data` is a string. Defaults to an empty string.
- * @param array $out (Optional) INTERNAL ONLY. The array that contains the calculated values up to this point.
- * @return array The option group parameters to merge into another method's `$opt` parameter.
- */
- public static function option_group($data, $member = '', $key = '', &$out = array())
- {
- $reset = $key;
-
- if (is_array($data))
- {
- foreach ($data as $k => $v)
- {
- // Avoid 0-based indexes.
- if (is_int($k))
- {
- $k = $k + 1;
-
- if ($member !== '')
- {
- $key .= '.' . $member;
- }
- }
-
- $key .= ($key === '' ? $k : '.' . $k);
-
- if (is_array($v))
- {
- self::option_group($v, $member, $key, $out);
- }
- elseif ($v instanceof CFStepConfig)
- {
- self::option_group($v->get_config(), $member, $key, $out);
- }
- else
- {
- $out[$key] = $v;
- }
-
- $key = $reset;
- }
- }
- else
- {
- $out[$key] = $data;
- }
-
- return $out;
- }
-}
diff --git a/3rdparty/aws-sdk/utilities/credential.class.php b/3rdparty/aws-sdk/utilities/credential.class.php
deleted file mode 100644
index 05c0ffcf6d8..00000000000
--- a/3rdparty/aws-sdk/utilities/credential.class.php
+++ /dev/null
@@ -1,157 +0,0 @@
-<?php
-/*
- * Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License").
- * You may not use this file except in compliance with the License.
- * A copy of the License is located at
- *
- * http://aws.amazon.com/apache2.0
- *
- * or in the "license" file accompanying this file. This file is distributed
- * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-
-/*%******************************************************************************************%*/
-// CLASS
-
-/**
- * The <CFCredential> class represents an individual credential set.
- *
- * @version 2011.11.15
- * @license See the included NOTICE.md file for more information.
- * @copyright See the included NOTICE.md file for more information.
- * @link http://aws.amazon.com/php/ PHP Developer Center
- */
-class CFCredential implements ArrayAccess
-{
- /**
- * Stores the internal <php:ArrayObject> representation of the collection.
- */
- private $collection;
-
- /**
- * Default getter. Enables syntax such as $object->method->chained_method();. Also supports
- * $object->key. Matching methods are prioritized over matching keys.
- *
- * @param string $name (Required) The name of the method to execute or key to retrieve.
- * @return mixed The results of calling the function <code>$name()</code>, or the value of the key <code>$object[$name]</code>.
- */
- public function __get($name)
- {
- return $this[$name];
- }
-
- /**
- * Default setter.
- *
- * @param string $name (Required) The name of the method to execute.
- * @param string $value (Required) The value to pass to the method.
- * @return mixed The results of calling the function, <code>$name</code>.
- */
- public function __set($name, $value)
- {
- $this[$name] = $value;
- return $this;
- }
-
- /**
- * Create a clone of the object.
- *
- * @return CFCredential A clone of the current instance.
- */
- public function __clone()
- {
- $this->collection = clone $this->collection;
- }
-
-
- /*%******************************************************************************************%*/
- // CONSTRUCTOR
-
- /**
- * Constructs a new instance of the <CFCredential> class.
- */
- public function __construct($value = array())
- {
- $this->collection = new ArrayObject($value, ArrayObject::ARRAY_AS_PROPS);
- }
-
- /**
- * Check whether or not a specific offset exists.
- *
- * @param integer $offset (Required) The location in the collection to verify the existence of.
- * @return boolean A value of <code>true</code> indicates that the collection offset exists. A value of <code>false</code> indicates that it does not.
- */
- public function offsetExists($offset)
- {
- return $this->collection->offsetExists($offset);
- }
-
- /**
- * Get the value for a specific offset.
- *
- * @param integer $offset (Required) The location in the collection to retrieve the value for.
- * @return mixed The value of the collection offset. <code>NULL</code> is returned if the offset does not exist.
- */
- public function offsetGet($offset)
- {
- if ($this->collection->offsetExists($offset))
- {
- return $this->collection->offsetGet($offset);
- }
-
- return null;
- }
-
- /**
- * Set the value for a specific offset.
- *
- * @param integer $offset (Required) The location in the collection to set a new value for.
- * @param mixed $value (Required) The new value for the collection location.
- * @return CFCredential A reference to the current collection.
- */
- public function offsetSet($offset, $value)
- {
- $this->collection->offsetSet($offset, $value);
- return $this;
- }
-
- /**
- * Unset the value for a specific offset.
- *
- * @param integer $offset (Required) The location in the collection to unset.
- * @return CFCredential A reference to the current collection.
- */
- public function offsetUnset($offset)
- {
- $this->collection->offsetUnset($offset);
- return $this;
- }
-
- /**
- * Merge another instance of <CFCredential> onto this one.
- *
- * @param CFCredential $credential (Required) Another instance of <CFCredential>.
- * @return CFCredential A reference to the current collection.
- */
- public function merge(CFCredential $credential)
- {
- $merged = array_merge($this->to_array(), $credential->to_array());
- $this->collection->exchangeArray($merged);
- return $this;
- }
-
- /**
- * Retrieves the data as a standard array.
- *
- * @return array The data as an array.
- */
- public function to_array()
- {
- return $this->collection->getArrayCopy();
- }
-}
diff --git a/3rdparty/aws-sdk/utilities/credentials.class.php b/3rdparty/aws-sdk/utilities/credentials.class.php
deleted file mode 100644
index 2504a081b23..00000000000
--- a/3rdparty/aws-sdk/utilities/credentials.class.php
+++ /dev/null
@@ -1,125 +0,0 @@
-<?php
-/*
- * Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License").
- * You may not use this file except in compliance with the License.
- * A copy of the License is located at
- *
- * http://aws.amazon.com/apache2.0
- *
- * or in the "license" file accompanying this file. This file is distributed
- * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-
-/*%******************************************************************************************%*/
-// CLASS
-
-/**
- * The <CFCredentials> class enables developers to easily switch between multiple sets of credentials.
- *
- * @version 2011.11.15
- * @license See the included NOTICE.md file for more information.
- * @copyright See the included NOTICE.md file for more information.
- * @link http://aws.amazon.com/php/ PHP Developer Center
- */
-class CFCredentials
-{
- /**
- * The key used to specify the default credential set
- */
- const DEFAULT_KEY = '@default';
-
- /**
- * The key used to identify inherited credentials
- */
- const INHERIT_KEY = '@inherit';
-
- /**
- * Stores the credentials
- */
- protected static $credentials = array();
-
- /**
- * Prevents this class from being constructed
- */
- final private function __construct() {}
-
- /**
- * Stores the credentials for re-use.
- *
- * @param array $credential_sets (Required) The named credential sets that should be made available to the application.
- * @return void
- */
- public static function set(array $credential_sets)
- {
- // Make sure a default credential set is specified or can be inferred
- if (count($credential_sets) === 1)
- {
- $credential_sets[self::DEFAULT_KEY] = reset($credential_sets);
- }
- elseif (!isset($credential_sets[self::DEFAULT_KEY]))
- {
- throw new CFCredentials_Exception('If more than one credential set is provided, a default credential set (identified by the key "' . self::DEFAULT_KEY . '") must be specified.');
- }
-
- // Resolve any @inherit tags
- foreach ($credential_sets as $credential_name => &$credential_set)
- {
- if (is_array($credential_set))
- {
- foreach ($credential_set as $credential_key => &$credential_value)
- {
- if ($credential_key === self::INHERIT_KEY)
- {
- if (!isset($credential_sets[$credential_value]))
- {
- throw new CFCredentials_Exception('The credential set, "' . $credential_value . '", does not exist and cannot be inherited.');
- }
-
- $credential_set = array_merge($credential_sets[$credential_value], $credential_set);
- unset($credential_set[self::INHERIT_KEY]);
- }
- }
- }
- }
-
- // Normalize the value of the @default credential set
- $default = $credential_sets[self::DEFAULT_KEY];
- if (is_string($default))
- {
- if (!isset($credential_sets[$default]))
- {
- throw new CFCredentials_Exception('The credential set, "' . $default . '", does not exist and cannot be used as the default credential set.');
- }
-
- $credential_sets[self::DEFAULT_KEY] = $credential_sets[$default];
- }
-
- // Store the credentials
- self::$credentials = $credential_sets;
- }
-
- /**
- * Retrieves the requested credentials from the internal credential store.
- *
- * @param string $credential_set (Optional) The name of the credential set to retrieve. The default value is set in DEFAULT_KEY.
- * @return stdClass A stdClass object where the properties represent the keys that were provided.
- */
- public static function get($credential_name = self::DEFAULT_KEY)
- {
- // Make sure the credential set exists
- if (!isset(self::$credentials[$credential_name]))
- {
- throw new CFCredentials_Exception('The credential set, "' . $credential_name . '", does not exist and cannot be retrieved.');
- }
-
- // Return the credential set as an object
- return new CFCredential(self::$credentials[$credential_name]);
- }
-}
-
-class CFCredentials_Exception extends Exception {}
diff --git a/3rdparty/aws-sdk/utilities/gzipdecode.class.php b/3rdparty/aws-sdk/utilities/gzipdecode.class.php
deleted file mode 100644
index f80822a7048..00000000000
--- a/3rdparty/aws-sdk/utilities/gzipdecode.class.php
+++ /dev/null
@@ -1,377 +0,0 @@
-<?php
-/*
- * Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License").
- * You may not use this file except in compliance with the License.
- * A copy of the License is located at
- *
- * http://aws.amazon.com/apache2.0
- *
- * or in the "license" file accompanying this file. This file is distributed
- * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-/**
- * SimplePie
- *
- * A PHP-Based RSS and Atom Feed Framework.
- * Takes the hard work out of managing a complete RSS/Atom solution.
- *
- * Copyright (c) 2004-2010, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright notice, this list of
- * conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright notice, this list
- * of conditions and the following disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * * Neither the name of the SimplePie Team nor the names of its contributors may be used
- * to endorse or promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * @package SimplePie
- * @version 1.3-dev
- * @copyright 2004-2010 Ryan Parman, Geoffrey Sneddon, Ryan McCue
- * @author Ryan Parman
- * @author Geoffrey Sneddon
- * @author Ryan McCue
- * @link http://simplepie.org/ SimplePie
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- * @todo phpDoc comments
- */
-
-
-/*%******************************************************************************************%*/
-// CLASS
-
-/**
- * Handles a variety of primary and edge cases around gzip/deflate decoding in PHP.
- *
- * @version 2011.02.21
- * @license See the included NOTICE.md file for more information.
- * @copyright See the included NOTICE.md file for more information.
- * @link http://aws.amazon.com/php/ PHP Developer Center
- * @link https://github.com/simplepie/simplepie/blob/master/SimplePie/gzdecode.php SimplePie_gzdecode
- */
-class CFGzipDecode
-{
- /**
- * Compressed data
- *
- * @access private
- * @see gzdecode::$data
- */
- public $compressed_data;
-
- /**
- * Size of compressed data
- *
- * @access private
- */
- public $compressed_size;
-
- /**
- * Minimum size of a valid gzip string
- *
- * @access private
- */
- public $min_compressed_size = 18;
-
- /**
- * Current position of pointer
- *
- * @access private
- */
- public $position = 0;
-
- /**
- * Flags (FLG)
- *
- * @access private
- */
- public $flags;
-
- /**
- * Uncompressed data
- *
- * @access public
- * @see gzdecode::$compressed_data
- */
- public $data;
-
- /**
- * Modified time
- *
- * @access public
- */
- public $MTIME;
-
- /**
- * Extra Flags
- *
- * @access public
- */
- public $XFL;
-
- /**
- * Operating System
- *
- * @access public
- */
- public $OS;
-
- /**
- * Subfield ID 1
- *
- * @access public
- * @see gzdecode::$extra_field
- * @see gzdecode::$SI2
- */
- public $SI1;
-
- /**
- * Subfield ID 2
- *
- * @access public
- * @see gzdecode::$extra_field
- * @see gzdecode::$SI1
- */
- public $SI2;
-
- /**
- * Extra field content
- *
- * @access public
- * @see gzdecode::$SI1
- * @see gzdecode::$SI2
- */
- public $extra_field;
-
- /**
- * Original filename
- *
- * @access public
- */
- public $filename;
-
- /**
- * Human readable comment
- *
- * @access public
- */
- public $comment;
-
- /**
- * Don't allow anything to be set
- *
- * @access public
- */
- public function __set($name, $value)
- {
- trigger_error("Cannot write property $name", E_USER_ERROR);
- }
-
- /**
- * Set the compressed string and related properties
- *
- * @access public
- */
- public function __construct($data)
- {
- $this->compressed_data = $data;
- $this->compressed_size = strlen($data);
- }
-
- /**
- * Decode the GZIP stream
- *
- * @access public
- */
- public function parse()
- {
- if ($this->compressed_size >= $this->min_compressed_size)
- {
- // Check ID1, ID2, and CM
- if (substr($this->compressed_data, 0, 3) !== "\x1F\x8B\x08")
- {
- return false;
- }
-
- // Get the FLG (FLaGs)
- $this->flags = ord($this->compressed_data[3]);
-
- // FLG bits above (1 << 4) are reserved
- if ($this->flags > 0x1F)
- {
- return false;
- }
-
- // Advance the pointer after the above
- $this->position += 4;
-
- // MTIME
- $mtime = substr($this->compressed_data, $this->position, 4);
- // Reverse the string if we're on a big-endian arch because l is the only signed long and is machine endianness
- if (current(unpack('S', "\x00\x01")) === 1)
- {
- $mtime = strrev($mtime);
- }
- $this->MTIME = current(unpack('l', $mtime));
- $this->position += 4;
-
- // Get the XFL (eXtra FLags)
- $this->XFL = ord($this->compressed_data[$this->position++]);
-
- // Get the OS (Operating System)
- $this->OS = ord($this->compressed_data[$this->position++]);
-
- // Parse the FEXTRA
- if ($this->flags & 4)
- {
- // Read subfield IDs
- $this->SI1 = $this->compressed_data[$this->position++];
- $this->SI2 = $this->compressed_data[$this->position++];
-
- // SI2 set to zero is reserved for future use
- if ($this->SI2 === "\x00")
- {
- return false;
- }
-
- // Get the length of the extra field
- $len = current(unpack('v', substr($this->compressed_data, $this->position, 2)));
- $position += 2;
-
- // Check the length of the string is still valid
- $this->min_compressed_size += $len + 4;
- if ($this->compressed_size >= $this->min_compressed_size)
- {
- // Set the extra field to the given data
- $this->extra_field = substr($this->compressed_data, $this->position, $len);
- $this->position += $len;
- }
- else
- {
- return false;
- }
- }
-
- // Parse the FNAME
- if ($this->flags & 8)
- {
- // Get the length of the filename
- $len = strcspn($this->compressed_data, "\x00", $this->position);
-
- // Check the length of the string is still valid
- $this->min_compressed_size += $len + 1;
- if ($this->compressed_size >= $this->min_compressed_size)
- {
- // Set the original filename to the given string
- $this->filename = substr($this->compressed_data, $this->position, $len);
- $this->position += $len + 1;
- }
- else
- {
- return false;
- }
- }
-
- // Parse the FCOMMENT
- if ($this->flags & 16)
- {
- // Get the length of the comment
- $len = strcspn($this->compressed_data, "\x00", $this->position);
-
- // Check the length of the string is still valid
- $this->min_compressed_size += $len + 1;
- if ($this->compressed_size >= $this->min_compressed_size)
- {
- // Set the original comment to the given string
- $this->comment = substr($this->compressed_data, $this->position, $len);
- $this->position += $len + 1;
- }
- else
- {
- return false;
- }
- }
-
- // Parse the FHCRC
- if ($this->flags & 2)
- {
- // Check the length of the string is still valid
- $this->min_compressed_size += $len + 2;
- if ($this->compressed_size >= $this->min_compressed_size)
- {
- // Read the CRC
- $crc = current(unpack('v', substr($this->compressed_data, $this->position, 2)));
-
- // Check the CRC matches
- if ((crc32(substr($this->compressed_data, 0, $this->position)) & 0xFFFF) === $crc)
- {
- $this->position += 2;
- }
- else
- {
- return false;
- }
- }
- else
- {
- return false;
- }
- }
-
- // Decompress the actual data
- if (($this->data = gzinflate(substr($this->compressed_data, $this->position, -8))) === false)
- {
- return false;
- }
- else
- {
- $this->position = $this->compressed_size - 8;
- }
-
- // Check CRC of data
- $crc = current(unpack('V', substr($this->compressed_data, $this->position, 4)));
- $this->position += 4;
- /*if (extension_loaded('hash') && sprintf('%u', current(unpack('V', hash('crc32b', $this->data)))) !== sprintf('%u', $crc))
- {
- return false;
- }*/
-
- // Check ISIZE of data
- $isize = current(unpack('V', substr($this->compressed_data, $this->position, 4)));
- $this->position += 4;
- if (sprintf('%u', strlen($this->data) & 0xFFFFFFFF) !== sprintf('%u', $isize))
- {
- return false;
- }
-
- // Wow, against all odds, we've actually got a valid gzip string
- return true;
- }
- else
- {
- return false;
- }
- }
-}
diff --git a/3rdparty/aws-sdk/utilities/hadoopbase.class.php b/3rdparty/aws-sdk/utilities/hadoopbase.class.php
deleted file mode 100644
index eb8bc5c3a81..00000000000
--- a/3rdparty/aws-sdk/utilities/hadoopbase.class.php
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-/*
- * Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License").
- * You may not use this file except in compliance with the License.
- * A copy of the License is located at
- *
- * http://aws.amazon.com/apache2.0
- *
- * or in the "license" file accompanying this file. This file is distributed
- * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-
-/*%******************************************************************************************%*/
-// CLASS
-
-/**
- * Contains core functionality for Hadoop helpers.
- *
- * @version 2011.05.03
- * @license See the included NOTICE.md file for more information.
- * @copyright See the included NOTICE.md file for more information.
- * @link http://aws.amazon.com/php/ PHP Developer Center
- * @link http://hadoop.apache.org Apache Hadoop
- */
-class CFHadoopBase
-{
- /**
- * Runs a specified script on the master node of your cluster.
- *
- * @param string $script (Required) The script to run with `script-runner.jar`.
- * @param array $args (Optional) An indexed array of arguments to pass to the script.
- * @return array A standard array that is intended to be passed into a <CFStepConfig> object.
- */
- public static function script_runner($script, $args = null)
- {
- if (!$args) $args = array();
- array_unshift($args, $script);
-
- return array(
- 'Jar' => 's3://us-east-1.elasticmapreduce/libs/script-runner/script-runner.jar',
- 'Args' => $args
- );
- }
-
- /**
- * Prepares a Hive or Pig script before passing it to the script runner.
- *
- * @param string $type (Required) The type of script to run. [Allowed values: `hive`, `pig`].
- * @param array $args (Optional) An indexed array of arguments to pass to the script.
- * @return array A standard array that is intended to be passed into a <CFStepConfig> object.
- * @link http://hive.apache.org Apache Hive
- * @link http://pig.apache.org Apache Pig
- */
- public static function hive_pig_script($type, $args = null)
- {
- if (!$args) $args = array();
- $args = is_array($args) ? $args : array($args);
- $args = array_merge(array('--base-path', 's3://us-east-1.elasticmapreduce/libs/' . $type . '/'), $args);
-
- return self::script_runner('s3://us-east-1.elasticmapreduce/libs/' . $type . '/' . $type . '-script', $args);
- }
-}
diff --git a/3rdparty/aws-sdk/utilities/hadoopbootstrap.class.php b/3rdparty/aws-sdk/utilities/hadoopbootstrap.class.php
deleted file mode 100644
index baaa0c08d4b..00000000000
--- a/3rdparty/aws-sdk/utilities/hadoopbootstrap.class.php
+++ /dev/null
@@ -1,127 +0,0 @@
-<?php
-/*
- * Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License").
- * You may not use this file except in compliance with the License.
- * A copy of the License is located at
- *
- * http://aws.amazon.com/apache2.0
- *
- * or in the "license" file accompanying this file. This file is distributed
- * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-
-/*%******************************************************************************************%*/
-// CLASS
-
-/**
- * Contains a set of pre-built Amazon EMR Hadoop Bootstrap Actions.
- *
- * @version 2011.05.03
- * @license See the included NOTICE.md file for more information.
- * @copyright See the included NOTICE.md file for more information.
- * @link http://aws.amazon.com/php/ PHP Developer Center
- * @link http://hadoop.apache.org Apache Hadoop
- */
-class CFHadoopBootstrap extends CFHadoopBase
-{
- // Config file types
- const CONFIG_SITE = 'S';
- const CONFIG_DEFAULT = 'D';
- const CONFIG_CORE = 'C';
- const CONFIG_HDFS = 'H';
- const CONFIG_MAPREDUCE = 'M';
-
- // Daemon types
- const DAEMON_NAME_NODE = 'namenode';
- const DAEMON_DATA_NODE = 'datanode';
- const DAEMON_JOB_TRACKER = 'jobtracker';
- const DAEMON_TASK_TRACKER = 'tasktracker';
- const DAEMON_CLIENT = 'client';
-
- /**
- * Create a new run-if bootstrap action which lets you conditionally run bootstrap actions.
- *
- * @param string $condition (Required) The condition to evaluate. If <code>true</code>, the bootstrap action executes.
- * @param array $args (Optional) An indexed array of arguments to pass to the script.
- * @return array A configuration set to be provided when running a job flow.
- */
- public static function run_if($condition, $args = null)
- {
- if (!$args) $args = array();
- $args = is_array($args) ? $args : array($args);
-
- return self::script_runner('s3://us-east-1.elasticmapreduce/bootstrap-actions/run-if', $args);
- }
-
- /**
- * Specify options to merge with Hadoop's default configuration.
- *
- * @param string $file (Required) The Hadoop configuration file to merge with. [Allowed values: <code>CFHadoopBootstrap::CONFIG_SITE</code>, <code>CFHadoopBootstrap::CONFIG_DEFAULT</code>, <code>CFHadoopBootstrap::CONFIG_CORE</code>, <code>CFHadoopBootstrap::CONFIG_HDFS</code>, <code>CFHadoopBootstrap::CONFIG_MAPREDUCE</code>]
- * @param string|array $config (Required) This can either be an XML file in S3 (as <code>s3://bucket/path</code>), or an associative array of key-value pairs.
- * @return array A configuration set to be provided when running a job flow.
- */
- public static function configure($file, $config)
- {
- $args = array();
- $file_arg = '-' . $file;
-
- if (is_string($config))
- {
- $args[] = $file_arg;
- $args[] = $config;
- }
- elseif (is_array($config))
- {
- foreach ($config as $key => $value)
- {
- $args[] = $file_arg;
- $args[] = $key . '=' . $value;
- }
- }
-
- return self::script_runner('s3://us-east-1.elasticmapreduce/bootstrap-actions/configure-hadoop', $args);
- }
-
- /**
- * Create a new bootstrap action which lets you configure Hadoop's daemons. The options are written to
- * the <code>hadoop-user-env.sh</code> file.
- *
- * @param string $daemon_type (Required) The Hadoop daemon to configure.
- * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
- * <li><code>HeapSize</code> - <code>integer</code> - Optional - The requested heap size of the daemon, in megabytes.</li>
- * <li><code>CLIOptions</code> - <code>string</code> - Optional - Additional Java command line arguments to pass to the daemon.</li>
- * <li><code>Replace</code> - <code>boolean</code> - Optional - Whether or not the file should be replaced. A value of <code>true</code> will replace the existing configuration file. A value of <code>false</code> will append the options to the configuration file.</li></ul>
- * @return array A configuration set to be provided when running a job flow.
- */
- public static function daemon($daemon_type, $opt = null)
- {
- if (!$opt) $opt = array();
- $args = array();
-
- foreach ($opt as $key => $value)
- {
- switch ($key)
- {
- case 'HeapSize':
- $args[] = '--' . $daemon_type . '-heap-size=' . $value;
- break;
- case 'CLIOptions':
- $args[] = '--' . $daemon_type . '-opts="' . $value . '"';
- break;
- case 'Replace':
- if ((is_string($value) && $value === 'true') || (is_bool($value) && $value === true))
- {
- $args[] = '--replace';
- }
- break;
- }
- }
-
- return self::script_runner('s3://us-east-1.elasticmapreduce/bootstrap-actions/configure-daemons', $args);
- }
-}
diff --git a/3rdparty/aws-sdk/utilities/hadoopstep.class.php b/3rdparty/aws-sdk/utilities/hadoopstep.class.php
deleted file mode 100644
index 2371e007489..00000000000
--- a/3rdparty/aws-sdk/utilities/hadoopstep.class.php
+++ /dev/null
@@ -1,98 +0,0 @@
-<?php
-/*
- * Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License").
- * You may not use this file except in compliance with the License.
- * A copy of the License is located at
- *
- * http://aws.amazon.com/apache2.0
- *
- * or in the "license" file accompanying this file. This file is distributed
- * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-
-/*%******************************************************************************************%*/
-// CLASS
-
-/**
- * Contains a set of pre-built Amazon EMR Hadoop steps.
- *
- * @version 2011.05.03
- * @license See the included NOTICE.md file for more information.
- * @copyright See the included NOTICE.md file for more information.
- * @link http://aws.amazon.com/php/ PHP Developer Center
- * @link http://hadoop.apache.org Apache Hadoop
- */
-class CFHadoopStep extends CFHadoopBase
-{
- /**
- * When ran as the first step in your job flow, enables the Hadoop debugging UI in the AWS
- * Management Console.
- *
- * @return array A standard array that is intended to be passed into a <CFStepConfig> object.
- */
- public static function enable_debugging()
- {
- return self::script_runner('s3://us-east-1.elasticmapreduce/libs/state-pusher/0.1/fetch');
- }
-
- /**
- * Step that installs Hive on your job flow.
- *
- * @return array A standard array that is intended to be passed into a <CFStepConfig> object.
- * @link http://hive.apache.org Apache Hive
- */
- public static function install_hive()
- {
- return self::hive_pig_script('hive', '--install-hive');
- }
-
- /**
- * Step that runs a Hive script on your job flow.
- *
- * @param string $script (Required) The script to run with `script-runner.jar`.
- * @param array $args (Optional) An indexed array of arguments to pass to the script.
- * @return array A standard array that is intended to be passed into a <CFStepConfig> object.
- * @link http://hive.apache.org Apache Hive
- */
- public static function run_hive_script($script, $args = null)
- {
- if (!$args) $args = array();
- $args = is_array($args) ? $args : array($args);
- $args = array_merge(array('--run-hive-script', '--args', '-f', $script), $args);
-
- return self::hive_pig_script('hive', $args);
- }
-
- /**
- * Step that installs Pig on your job flow.
- *
- * @return array A standard array that is intended to be passed into a <CFStepConfig> object.
- * @link http://pig.apache.org Apache Pig
- */
- public static function install_pig()
- {
- return self::hive_pig_script('pig', '--install-pig');
- }
-
- /**
- * Step that runs a Pig script on your job flow.
- *
- * @param string $script (Required) The script to run with `script-runner.jar`.
- * @param array $args (Optional) An indexed array of arguments to pass to the script.
- * @return array A standard array that is intended to be passed into a <CFStepConfig> object.
- * @link http://pig.apache.org Apache Pig
- */
- public static function run_pig_script($script, $args = null)
- {
- if (!$args) $args = array();
- $args = is_array($args) ? $args : array($args);
- $args = array_merge(array('--run-pig-script', '--args', '-f', $script), $args);
-
- return self::hive_pig_script('pig', $args);
- }
-}
diff --git a/3rdparty/aws-sdk/utilities/info.class.php b/3rdparty/aws-sdk/utilities/info.class.php
deleted file mode 100644
index 2ba289a5f01..00000000000
--- a/3rdparty/aws-sdk/utilities/info.class.php
+++ /dev/null
@@ -1,69 +0,0 @@
-<?php
-/*
- * Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License").
- * You may not use this file except in compliance with the License.
- * A copy of the License is located at
- *
- * http://aws.amazon.com/apache2.0
- *
- * or in the "license" file accompanying this file. This file is distributed
- * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-
-/*%******************************************************************************************%*/
-// CLASS
-
-/**
- * Contains a series of methods that provide information about the SDK.
- *
- * @version 2010.10.01
- * @license See the included NOTICE.md file for more information.
- * @copyright See the included NOTICE.md file for more information.
- * @link http://aws.amazon.com/php/ PHP Developer Center
- */
-class CFInfo
-{
- /**
- * Gets information about the web service APIs that the SDK supports.
- *
- * @return array An associative array containing service classes and API versions.
- */
- public static function api_support()
- {
- $existing_classes = get_declared_classes();
-
- foreach (glob(dirname(dirname(__FILE__)) . '/services/*.class.php') as $file)
- {
- include $file;
- }
-
- $with_sdk_classes = get_declared_classes();
- $new_classes = array_diff($with_sdk_classes, $existing_classes);
- $filtered_classes = array();
- $collect = array();
-
- foreach ($new_classes as $class)
- {
- if (strpos($class, 'Amazon') !== false)
- {
- $filtered_classes[] = $class;
- }
- }
-
- $filtered_classes = array_values($filtered_classes);
-
- foreach ($filtered_classes as $class)
- {
- $obj = new $class();
- $collect[get_class($obj)] = $obj->api_version;
- unset($obj);
- }
-
- return $collect;
- }
-}
diff --git a/3rdparty/aws-sdk/utilities/json.class.php b/3rdparty/aws-sdk/utilities/json.class.php
deleted file mode 100644
index dfa83839863..00000000000
--- a/3rdparty/aws-sdk/utilities/json.class.php
+++ /dev/null
@@ -1,89 +0,0 @@
-<?php
-/*
- * Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License").
- * You may not use this file except in compliance with the License.
- * A copy of the License is located at
- *
- * http://aws.amazon.com/apache2.0
- *
- * or in the "license" file accompanying this file. This file is distributed
- * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-
-/*%******************************************************************************************%*/
-// CLASS
-
-/**
- * Handles the conversion of data from JSON to other formats.
- *
- * @version 2012.01.27
- * @license See the included NOTICE.md file for more information.
- * @copyright See the included NOTICE.md file for more information.
- * @link http://aws.amazon.com/php/ PHP Developer Center
- */
-class CFJSON
-{
- /**
- * Converts a JSON string to a CFSimpleXML object.
- *
- * @param string|array $json (Required) Pass either a valid JSON-formatted string, or an associative array.
- * @param string $parser (Optional) The name of the class to use to parse the XML. This class should extend <code>SimpleXMLElement</code>. Has a default value of <code>CFSimpleXML</code>.
- * @return CFSimpleXML An XML representation of the data.
- */
- public static function to_xml($json, $parser = 'CFSimpleXML')
- {
- // If we haven't parsed the JSON, do it
- if (!is_array($json))
- {
- // Handle the case of JSON-encoded NULL value
- if ($json === 'null')
- {
- $json = null;
- }
- else
- {
- $json = json_decode($json, true);
-
- if (function_exists('json_last_error'))
- {
- // Did we encounter an error?
- switch (json_last_error())
- {
- case JSON_ERROR_DEPTH:
- throw new JSON_Exception('Maximum stack depth exceeded.');
-
- case JSON_ERROR_CTRL_CHAR:
- throw new JSON_Exception('Unexpected control character found.');
-
- case JSON_ERROR_SYNTAX:
- throw new JSON_Exception('Syntax error; Malformed JSON.');
-
- case JSON_ERROR_STATE_MISMATCH:
- throw new JSON_Exception('Invalid or malformed JSON.');
- }
- }
- // json_last_error() not available?
- elseif ($json === null)
- {
- throw new JSON_Exception('Unknown JSON error. Be sure to validate your JSON and read the notes on http://php.net/json_decode.');
- }
- }
- }
-
- // Hand off for the recursive work
- $string = Array2DOM::arrayToXMLString($json, 'rootElement', true);
-
- return simplexml_load_string($string, $parser, LIBXML_NOCDATA);
- }
-}
-
-
-/**
- * Default JSON Exception.
- */
-class JSON_Exception extends Exception {}
diff --git a/3rdparty/aws-sdk/utilities/manifest.class.php b/3rdparty/aws-sdk/utilities/manifest.class.php
deleted file mode 100644
index 82410a328db..00000000000
--- a/3rdparty/aws-sdk/utilities/manifest.class.php
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php
-/*
- * Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License").
- * You may not use this file except in compliance with the License.
- * A copy of the License is located at
- *
- * http://aws.amazon.com/apache2.0
- *
- * or in the "license" file accompanying this file. This file is distributed
- * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-
-/*%******************************************************************************************%*/
-// CLASS
-
-/**
- * Simplifies the process of generating manifests for the AWS Import/Export service.
- *
- * @version 2010.11.22
- * @license See the included NOTICE.md file for more information.
- * @copyright See the included NOTICE.md file for more information.
- * @link http://aws.amazon.com/php/ PHP Developer Center
- */
-class CFManifest
-{
-
- /**
- * Takes a JSON object as a string to convert to a YAML manifest.
- *
- * @param string $json (Required) A JSON object. The JSON string should use canonical rules (e.g., double quotes, quoted keys) as is required by PHP's <php:json_encode()> function.
- * @return string A YAML manifest document.
- */
- public static function json($json)
- {
- $map = json_decode($json, true);
- return sfYaml::dump($map);
- }
-
- /**
- * Takes an associative array to convert to a YAML manifest.
- *
- * @param array $map (Required) An associative array.
- * @return string A YAML manifest document.
- */
- public static function map($map)
- {
- return sfYaml::dump($map);
- }
-}
diff --git a/3rdparty/aws-sdk/utilities/mimetypes.class.php b/3rdparty/aws-sdk/utilities/mimetypes.class.php
deleted file mode 100644
index 5fa23d3942a..00000000000
--- a/3rdparty/aws-sdk/utilities/mimetypes.class.php
+++ /dev/null
@@ -1,223 +0,0 @@
-<?php
-/*
- * Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License").
- * You may not use this file except in compliance with the License.
- * A copy of the License is located at
- *
- * http://aws.amazon.com/apache2.0
- *
- * or in the "license" file accompanying this file. This file is distributed
- * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-
-/*%******************************************************************************************%*/
-// CLASS
-
-/**
- * Simplifies the process of looking up the content-types for a variety of file extensions.
- *
- * @version 2010.07.20
- * @license See the included NOTICE.md file for more information.
- * @copyright See the included NOTICE.md file for more information.
- * @link http://aws.amazon.com/php/ PHP Developer Center
- */
-class CFMimeTypes
-{
- /**
- * Map of the extension-to-mime-types that we support.
- */
- public static $mime_types = array(
- '3gp' => 'video/3gpp',
- 'ai' => 'application/postscript',
- 'aif' => 'audio/x-aiff',
- 'aifc' => 'audio/x-aiff',
- 'aiff' => 'audio/x-aiff',
- 'asc' => 'text/plain',
- 'atom' => 'application/atom+xml',
- 'au' => 'audio/basic',
- 'avi' => 'video/x-msvideo',
- 'bcpio' => 'application/x-bcpio',
- 'bin' => 'application/octet-stream',
- 'bmp' => 'image/bmp',
- 'cdf' => 'application/x-netcdf',
- 'cgm' => 'image/cgm',
- 'class' => 'application/octet-stream',
- 'cpio' => 'application/x-cpio',
- 'cpt' => 'application/mac-compactpro',
- 'csh' => 'application/x-csh',
- 'css' => 'text/css',
- 'dcr' => 'application/x-director',
- 'dif' => 'video/x-dv',
- 'dir' => 'application/x-director',
- 'djv' => 'image/vnd.djvu',
- 'djvu' => 'image/vnd.djvu',
- 'dll' => 'application/octet-stream',
- 'dmg' => 'application/octet-stream',
- 'dms' => 'application/octet-stream',
- 'doc' => 'application/msword',
- 'dtd' => 'application/xml-dtd',
- 'dv' => 'video/x-dv',
- 'dvi' => 'application/x-dvi',
- 'dxr' => 'application/x-director',
- 'eps' => 'application/postscript',
- 'etx' => 'text/x-setext',
- 'exe' => 'application/octet-stream',
- 'ez' => 'application/andrew-inset',
- 'flv' => 'video/x-flv',
- 'gif' => 'image/gif',
- 'gram' => 'application/srgs',
- 'grxml' => 'application/srgs+xml',
- 'gtar' => 'application/x-gtar',
- 'gz' => 'application/x-gzip',
- 'hdf' => 'application/x-hdf',
- 'hqx' => 'application/mac-binhex40',
- 'htm' => 'text/html',
- 'html' => 'text/html',
- 'ice' => 'x-conference/x-cooltalk',
- 'ico' => 'image/x-icon',
- 'ics' => 'text/calendar',
- 'ief' => 'image/ief',
- 'ifb' => 'text/calendar',
- 'iges' => 'model/iges',
- 'igs' => 'model/iges',
- 'jnlp' => 'application/x-java-jnlp-file',
- 'jp2' => 'image/jp2',
- 'jpe' => 'image/jpeg',
- 'jpeg' => 'image/jpeg',
- 'jpg' => 'image/jpeg',
- 'js' => 'application/x-javascript',
- 'kar' => 'audio/midi',
- 'latex' => 'application/x-latex',
- 'lha' => 'application/octet-stream',
- 'lzh' => 'application/octet-stream',
- 'm3u' => 'audio/x-mpegurl',
- 'm4a' => 'audio/mp4a-latm',
- 'm4p' => 'audio/mp4a-latm',
- 'm4u' => 'video/vnd.mpegurl',
- 'm4v' => 'video/x-m4v',
- 'mac' => 'image/x-macpaint',
- 'man' => 'application/x-troff-man',
- 'mathml' => 'application/mathml+xml',
- 'me' => 'application/x-troff-me',
- 'mesh' => 'model/mesh',
- 'mid' => 'audio/midi',
- 'midi' => 'audio/midi',
- 'mif' => 'application/vnd.mif',
- 'mov' => 'video/quicktime',
- 'movie' => 'video/x-sgi-movie',
- 'mp2' => 'audio/mpeg',
- 'mp3' => 'audio/mpeg',
- 'mp4' => 'video/mp4',
- 'mpe' => 'video/mpeg',
- 'mpeg' => 'video/mpeg',
- 'mpg' => 'video/mpeg',
- 'mpga' => 'audio/mpeg',
- 'ms' => 'application/x-troff-ms',
- 'msh' => 'model/mesh',
- 'mxu' => 'video/vnd.mpegurl',
- 'nc' => 'application/x-netcdf',
- 'oda' => 'application/oda',
- 'ogg' => 'application/ogg',
- 'ogv' => 'video/ogv',
- 'pbm' => 'image/x-portable-bitmap',
- 'pct' => 'image/pict',
- 'pdb' => 'chemical/x-pdb',
- 'pdf' => 'application/pdf',
- 'pgm' => 'image/x-portable-graymap',
- 'pgn' => 'application/x-chess-pgn',
- 'pic' => 'image/pict',
- 'pict' => 'image/pict',
- 'png' => 'image/png',
- 'pnm' => 'image/x-portable-anymap',
- 'pnt' => 'image/x-macpaint',
- 'pntg' => 'image/x-macpaint',
- 'ppm' => 'image/x-portable-pixmap',
- 'ppt' => 'application/vnd.ms-powerpoint',
- 'ps' => 'application/postscript',
- 'qt' => 'video/quicktime',
- 'qti' => 'image/x-quicktime',
- 'qtif' => 'image/x-quicktime',
- 'ra' => 'audio/x-pn-realaudio',
- 'ram' => 'audio/x-pn-realaudio',
- 'ras' => 'image/x-cmu-raster',
- 'rdf' => 'application/rdf+xml',
- 'rgb' => 'image/x-rgb',
- 'rm' => 'application/vnd.rn-realmedia',
- 'roff' => 'application/x-troff',
- 'rtf' => 'text/rtf',
- 'rtx' => 'text/richtext',
- 'sgm' => 'text/sgml',
- 'sgml' => 'text/sgml',
- 'sh' => 'application/x-sh',
- 'shar' => 'application/x-shar',
- 'silo' => 'model/mesh',
- 'sit' => 'application/x-stuffit',
- 'skd' => 'application/x-koan',
- 'skm' => 'application/x-koan',
- 'skp' => 'application/x-koan',
- 'skt' => 'application/x-koan',
- 'smi' => 'application/smil',
- 'smil' => 'application/smil',
- 'snd' => 'audio/basic',
- 'so' => 'application/octet-stream',
- 'spl' => 'application/x-futuresplash',
- 'src' => 'application/x-wais-source',
- 'sv4cpio' => 'application/x-sv4cpio',
- 'sv4crc' => 'application/x-sv4crc',
- 'svg' => 'image/svg+xml',
- 'swf' => 'application/x-shockwave-flash',
- 't' => 'application/x-troff',
- 'tar' => 'application/x-tar',
- 'tcl' => 'application/x-tcl',
- 'tex' => 'application/x-tex',
- 'texi' => 'application/x-texinfo',
- 'texinfo' => 'application/x-texinfo',
- 'tif' => 'image/tiff',
- 'tiff' => 'image/tiff',
- 'tr' => 'application/x-troff',
- 'tsv' => 'text/tab-separated-values',
- 'txt' => 'text/plain',
- 'ustar' => 'application/x-ustar',
- 'vcd' => 'application/x-cdlink',
- 'vrml' => 'model/vrml',
- 'vxml' => 'application/voicexml+xml',
- 'wav' => 'audio/x-wav',
- 'wbmp' => 'image/vnd.wap.wbmp',
- 'wbxml' => 'application/vnd.wap.wbxml',
- 'webm' => 'video/webm',
- 'wml' => 'text/vnd.wap.wml',
- 'wmlc' => 'application/vnd.wap.wmlc',
- 'wmls' => 'text/vnd.wap.wmlscript',
- 'wmlsc' => 'application/vnd.wap.wmlscriptc',
- 'wmv' => 'video/x-ms-wmv',
- 'wrl' => 'model/vrml',
- 'xbm' => 'image/x-xbitmap',
- 'xht' => 'application/xhtml+xml',
- 'xhtml' => 'application/xhtml+xml',
- 'xls' => 'application/vnd.ms-excel',
- 'xml' => 'application/xml',
- 'xpm' => 'image/x-xpixmap',
- 'xsl' => 'application/xml',
- 'xslt' => 'application/xslt+xml',
- 'xul' => 'application/vnd.mozilla.xul+xml',
- 'xwd' => 'image/x-xwindowdump',
- 'xyz' => 'chemical/x-xyz',
- 'zip' => 'application/zip',
- );
-
- /**
- * Attempt to match the file extension to a known mime-type.
- *
- * @param string $ext (Required) The file extension to attempt to map.
- * @return string The mime-type to use for the file extension.
- */
- public static function get_mimetype($ext)
- {
- return (isset(self::$mime_types[$ext]) ? self::$mime_types[$ext] : 'application/octet-stream');
- }
-}
diff --git a/3rdparty/aws-sdk/utilities/policy.class.php b/3rdparty/aws-sdk/utilities/policy.class.php
deleted file mode 100644
index 9c53fee0d72..00000000000
--- a/3rdparty/aws-sdk/utilities/policy.class.php
+++ /dev/null
@@ -1,134 +0,0 @@
-<?php
-/*
- * Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License").
- * You may not use this file except in compliance with the License.
- * A copy of the License is located at
- *
- * http://aws.amazon.com/apache2.0
- *
- * or in the "license" file accompanying this file. This file is distributed
- * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-
-/*%******************************************************************************************%*/
-// CLASS
-
-/**
- * Simplifies the process of signing JSON policy documents.
- *
- * @version 2011.04.25
- * @license See the included NOTICE.md file for more information.
- * @copyright See the included NOTICE.md file for more information.
- * @link http://aws.amazon.com/php/ PHP Developer Center
- */
-class CFPolicy
-{
- /**
- * Stores the object that contains the authentication credentials.
- */
- public $auth;
-
- /**
- * Stores the policy object that we're working with.
- */
- public $json_policy;
-
- /**
- * Constructs a new instance of this class.
- *
- * @param CFRuntime $auth (Required) An instance of any authenticated AWS object that is an instance of <CFRuntime> (e.g. <AmazonEC2>, <AmazonS3>).
- * @param string|array $policy (Required) The associative array representing the S3 policy to use, or a string of JSON content.
- * @return $this A reference to the current instance.
- * @link http://docs.amazonwebservices.com/AmazonS3/2006-03-01/dev/index.html?HTTPPOSTForms.html S3 Policies
- * @link http://docs.amazonwebservices.com/AmazonS3/latest/dev/index.html?AccessPolicyLanguage.html Access Policy Language
- */
- public function __construct($auth, $policy)
- {
- $this->auth = $auth;
-
- if (is_array($policy)) // We received an associative array...
- {
- $this->json_policy = json_encode($policy);
- }
- else // We received a valid, parseable JSON string...
- {
- $this->json_policy = json_encode(json_decode($policy, true));
- }
-
- return $this;
- }
-
- /**
- * Alternate approach to constructing a new instance. Supports chaining.
- *
- * @param CFRuntime $auth (Required) An instance of any authenticated AWS object that is an instance of <CFRuntime> (e.g. <AmazonEC2>, <AmazonS3>).
- * @param string|array $policy (Required) The associative array representing the S3 policy to use, or a string of JSON content.
- * @return $this A reference to the current instance.
- */
- public static function init($auth, $policy)
- {
- if (version_compare(PHP_VERSION, '5.3.0', '<'))
- {
- throw new Exception('PHP 5.3 or newer is required to instantiate a new class with CLASS::init().');
- }
-
- $self = get_called_class();
- return new $self($auth, $policy);
- }
-
- /**
- * Get the key from the authenticated instance.
- *
- * @return string The key from the authenticated instance.
- */
- public function get_key()
- {
- return $this->auth->key;
- }
-
- /**
- * Base64-encodes the JSON string.
- *
- * @return string The Base64-encoded version of the JSON string.
- */
- public function get_policy()
- {
- return base64_encode($this->json_policy);
- }
-
- /**
- * Gets the JSON string with the whitespace removed.
- *
- * @return string The JSON string without extraneous whitespace.
- */
- public function get_json()
- {
- return $this->json_policy;
- }
-
- /**
- * Gets the JSON string with the whitespace removed.
- *
- * @return string The Base64-encoded, signed JSON string.
- */
- public function get_policy_signature()
- {
- return base64_encode(hash_hmac('sha1', $this->get_policy(), $this->auth->secret_key));
- }
-
- /**
- * Decode a policy that was returned from the service.
- *
- * @param string $response (Required) The policy returned by AWS that you want to decode into an object.
- * @return string The Base64-encoded, signed JSON string.
- */
- public static function decode_policy($response)
- {
- return json_decode(urldecode($response), true);
- }
-}
diff --git a/3rdparty/aws-sdk/utilities/request.class.php b/3rdparty/aws-sdk/utilities/request.class.php
deleted file mode 100644
index 8e049fb5169..00000000000
--- a/3rdparty/aws-sdk/utilities/request.class.php
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-/*
- * Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License").
- * You may not use this file except in compliance with the License.
- * A copy of the License is located at
- *
- * http://aws.amazon.com/apache2.0
- *
- * or in the "license" file accompanying this file. This file is distributed
- * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-
-/*%******************************************************************************************%*/
-// CLASS
-
-/**
- * Wraps the underlying `RequestCore` class with some AWS-specific customizations.
- *
- * @version 2011.12.02
- * @license See the included NOTICE.md file for more information.
- * @copyright See the included NOTICE.md file for more information.
- * @link http://aws.amazon.com/php/ PHP Developer Center
- */
-class CFRequest extends RequestCore
-{
- /**
- * The default class to use for HTTP Requests (defaults to <CFRequest>).
- */
- public $request_class = 'CFRequest';
-
- /**
- * The default class to use for HTTP Responses (defaults to <CFResponse>).
- */
- public $response_class = 'CFResponse';
-
- /**
- * The active credential set.
- */
- public $credentials;
-
-
- /*%******************************************************************************************%*/
- // CONSTRUCTOR
-
- /**
- * Constructs a new instance of this class.
- *
- * @param string $url (Optional) The URL to request or service endpoint to query.
- * @param string $proxy (Optional) The faux-url to use for proxy settings. Takes the following format: `proxy://user:pass@hostname:port`
- * @param array $helpers (Optional) An associative array of classnames to use for request, and response functionality. Gets passed in automatically by the calling class.
- * @param CFCredential $credentials (Required) The credentials to use for signing and making requests.
- * @return $this A reference to the current instance.
- */
- public function __construct($url = null, $proxy = null, $helpers = null, CFCredential $credentials = null)
- {
- parent::__construct($url, $proxy, $helpers);
-
- // Standard settings for all requests
- $this->set_useragent(CFRUNTIME_USERAGENT);
- $this->credentials = $credentials;
- $this->cacert_location = ($this->credentials['certificate_authority'] ? $this->credentials['certificate_authority'] : false);
-
- return $this;
- }
-}
diff --git a/3rdparty/aws-sdk/utilities/response.class.php b/3rdparty/aws-sdk/utilities/response.class.php
deleted file mode 100644
index 740d55d5d94..00000000000
--- a/3rdparty/aws-sdk/utilities/response.class.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-/*
- * Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License").
- * You may not use this file except in compliance with the License.
- * A copy of the License is located at
- *
- * http://aws.amazon.com/apache2.0
- *
- * or in the "license" file accompanying this file. This file is distributed
- * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-
-/*%******************************************************************************************%*/
-// CLASS
-
-/**
- * Wraps the underlying `ResponseCore` class with some AWS-specific customizations.
- *
- * @version 2010.10.11
- * @license See the included NOTICE.md file for more information.
- * @copyright See the included NOTICE.md file for more information.
- * @link http://aws.amazon.com/php/ PHP Developer Center
- */
-class CFResponse extends ResponseCore {}
diff --git a/3rdparty/aws-sdk/utilities/simplexml.class.php b/3rdparty/aws-sdk/utilities/simplexml.class.php
deleted file mode 100644
index ba93b9ea3c0..00000000000
--- a/3rdparty/aws-sdk/utilities/simplexml.class.php
+++ /dev/null
@@ -1,248 +0,0 @@
-<?php
-/*
- * Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License").
- * You may not use this file except in compliance with the License.
- * A copy of the License is located at
- *
- * http://aws.amazon.com/apache2.0
- *
- * or in the "license" file accompanying this file. This file is distributed
- * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-
-/*%******************************************************************************************%*/
-// CLASS
-
-/**
- * Wraps the underlying `SimpleXMLIterator` class with enhancements for rapidly traversing the DOM tree,
- * converting types, and comparisons.
- *
- * @version 2012.01.17
- * @license See the included NOTICE.md file for more information.
- * @copyright See the included NOTICE.md file for more information.
- * @link http://aws.amazon.com/php/ PHP Developer Center
- * @link http://php.net/SimpleXML SimpleXML
- */
-class CFSimpleXML extends SimpleXMLIterator
-{
- /**
- * Stores the namespace name to use in XPath queries.
- */
- public $xml_ns;
-
- /**
- * Stores the namespace URI to use in XPath queries.
- */
- public $xml_ns_url;
-
- /**
- * Catches requests made to methods that don't exist. Specifically, looks for child nodes via XPath.
- *
- * @param string $name (Required) The name of the method.
- * @param array $arguments (Required) The arguments passed to the method.
- * @return mixed Either an array of matches, or a single <CFSimpleXML> element.
- */
- public function __call($name, $arguments)
- {
- // Remap $this
- $self = $this;
-
- // Re-base the XML
- $self = new CFSimpleXML($self->asXML());
-
- // Determine XPath query
- $self->xpath_expression = 'descendant-or-self::' . $name;
-
- // Get the results and augment with CFArray
- $results = $self->xpath($self->xpath_expression);
- if (!count($results)) return false;
- $results = new CFArray($results);
-
- // If an integer was passed, return only that result
- if (isset($arguments[0]) && is_int($arguments[0]))
- {
- if (isset($results[$arguments[0]]))
- {
- return $results[$arguments[0]];
- }
-
- return false;
- }
-
- return $results;
- }
-
- /**
- * Alternate approach to constructing a new instance. Supports chaining.
- *
- * @param string $data (Required) A well-formed XML string or the path or URL to an XML document if $data_is_url is <code>true</code>.
- * @param integer $options (Optional) Used to specify additional LibXML parameters. The default value is <code>0</code>.
- * @param boolean $data_is_url (Optional) Specify a value of <code>true</code> to specify that data is a path or URL to an XML document instead of string data. The default value is <code>false</code>.
- * @param string $ns (Optional) The XML namespace to return values for.
- * @param boolean $is_prefix (Optional) (No description provided by PHP.net.)
- * @return CFSimpleXML Creates a new <CFSimpleXML> element.
- */
- public static function init($data, $options = 0, $data_is_url, $ns, $is_prefix = false)
- {
- if (version_compare(PHP_VERSION, '5.3.0', '<'))
- {
- throw new Exception('PHP 5.3 or newer is required to instantiate a new class with CLASS::init().');
- }
-
- $self = get_called_class();
- return new $self($data, $options, $data_is_url, $ns, $is_prefix);
- }
-
-
- /*%******************************************************************************************%*/
- // TRAVERSAL
-
- /**
- * Wraps the results of an XPath query in a <CFArray> object.
- *
- * @param string $expr (Required) The XPath expression to use to query the XML response.
- * @return CFArray A <CFArray> object containing the results of the XPath query.
- */
- public function query($expr)
- {
- return new CFArray($this->xpath($expr));
- }
-
- /**
- * Gets the parent or a preferred ancestor of the current element.
- *
- * @param string $node (Optional) Name of the ancestor element to match and return.
- * @return CFSimpleXML A <CFSimpleXML> object containing the requested node.
- */
- public function parent($node = null)
- {
- if ($node)
- {
- $parents = $this->xpath('ancestor-or-self::' . $node);
- }
- else
- {
- $parents = $this->xpath('parent::*');
- }
-
- return $parents[0];
- }
-
-
- /*%******************************************************************************************%*/
- // ALTERNATE FORMATS
-
- /**
- * Gets the current XML node as a true string.
- *
- * @return string The current XML node as a true string.
- */
- public function to_string()
- {
- return (string) $this;
- }
-
- /**
- * Gets the current XML node as <CFArray>, a child class of PHP's <php:ArrayObject> class.
- *
- * @return CFArray The current XML node as a <CFArray> object.
- */
- public function to_array()
- {
- return new CFArray(json_decode(json_encode($this), true));
- }
-
- /**
- * Gets the current XML node as a stdClass object.
- *
- * @return array The current XML node as a stdClass object.
- */
- public function to_stdClass()
- {
- return json_decode(json_encode($this));
- }
-
- /**
- * Gets the current XML node as a JSON string.
- *
- * @return string The current XML node as a JSON string.
- */
- public function to_json()
- {
- return json_encode($this);
- }
-
- /**
- * Gets the current XML node as a YAML string.
- *
- * @return string The current XML node as a YAML string.
- */
- public function to_yaml()
- {
- return sfYaml::dump(json_decode(json_encode($this), true), 5);
- }
-
-
- /*%******************************************************************************************%*/
- // COMPARISONS
-
- /**
- * Whether or not the current node exactly matches the compared value.
- *
- * @param string $value (Required) The value to compare the current node to.
- * @return boolean Whether or not the current node exactly matches the compared value.
- */
- public function is($value)
- {
- return ((string) $this === $value);
- }
-
- /**
- * Whether or not the current node contains the compared value.
- *
- * @param string $value (Required) The value to use to determine whether it is contained within the node.
- * @return boolean Whether or not the current node contains the compared value.
- */
- public function contains($value)
- {
- return (stripos((string) $this, $value) !== false);
- }
-
- /**
- * Whether or not the current node matches the regular expression pattern.
- *
- * @param string $pattern (Required) The pattern to match the current node against.
- * @return boolean Whether or not the current node matches the pattern.
- */
- public function matches($pattern)
- {
- return (bool) preg_match($pattern, (string) $this);
- }
-
- /**
- * Whether or not the current node starts with the compared value.
- *
- * @param string $value (Required) The value to compare the current node to.
- * @return boolean Whether or not the current node starts with the compared value.
- */
- public function starts_with($value)
- {
- return $this->matches("@^$value@u");
- }
-
- /**
- * Whether or not the current node ends with the compared value.
- *
- * @param string $value (Required) The value to compare the current node to.
- * @return boolean Whether or not the current node ends with the compared value.
- */
- public function ends_with($value)
- {
- return $this->matches("@$value$@u");
- }
-}
diff --git a/3rdparty/aws-sdk/utilities/stacktemplate.class.php b/3rdparty/aws-sdk/utilities/stacktemplate.class.php
deleted file mode 100644
index 1e29ef34036..00000000000
--- a/3rdparty/aws-sdk/utilities/stacktemplate.class.php
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-/*
- * Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License").
- * You may not use this file except in compliance with the License.
- * A copy of the License is located at
- *
- * http://aws.amazon.com/apache2.0
- *
- * or in the "license" file accompanying this file. This file is distributed
- * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-
-/*%******************************************************************************************%*/
-// CLASS
-
-/**
- * Simplifies the process of preparing JSON stack templates.
- *
- * @version 2011.02.03
- * @license See the included NOTICE.md file for more information.
- * @copyright See the included NOTICE.md file for more information.
- * @link http://aws.amazon.com/php/ PHP Developer Center
- */
-class CFStackTemplate
-{
- /**
- * Removes whitespace from a JSON template.
- *
- * @param string $template (Required) A JSON representation of the stack template. Must have <a href="http://docs.php.net/manual/en/function.json-decode.php#refsect1-function.json-decode-examples">strict JSON-specific formatting</a>.
- * @return string A JSON representation of the template.
- */
- public static function json($template)
- {
- return json_encode(json_decode($template, true));
- }
-
- /**
- * Converts an associative array (map) of the template into a JSON string.
- *
- * @param array $template (Required) An associative array that maps directly to its JSON counterpart.
- * @return string A JSON representation of the template.
- */
- public static function map($template)
- {
- return json_encode($template);
- }
-}
diff --git a/3rdparty/aws-sdk/utilities/stepconfig.class.php b/3rdparty/aws-sdk/utilities/stepconfig.class.php
deleted file mode 100644
index 71492995f44..00000000000
--- a/3rdparty/aws-sdk/utilities/stepconfig.class.php
+++ /dev/null
@@ -1,91 +0,0 @@
-<?php
-/*
- * Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License").
- * You may not use this file except in compliance with the License.
- * A copy of the License is located at
- *
- * http://aws.amazon.com/apache2.0
- *
- * or in the "license" file accompanying this file. This file is distributed
- * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-
-/*%******************************************************************************************%*/
-// CLASS
-
-/**
- * Contains functionality for simplifying Amazon EMR Hadoop steps.
- *
- * @version 2010.11.16
- * @license See the included NOTICE.md file for more information.
- * @copyright See the included NOTICE.md file for more information.
- * @link http://aws.amazon.com/php/ PHP Developer Center
- */
-class CFStepConfig
-{
-
- /**
- * Stores the configuration map.
- */
- public $config;
-
- /**
- * Constructs a new instance of this class.
- *
- * @param array $config (Required) An associative array representing the Hadoop step configuration.
- * @return $this A reference to the current instance.
- */
- public function __construct($config)
- {
- // Handle Hadoop jar arguments
- if (isset($config['HadoopJarStep']['Args']) && $args = $config['HadoopJarStep']['Args'])
- {
- $config['HadoopJarStep']['Args'] = is_array($args) ? $args : array($args);
- }
-
- $this->config = $config;
- }
-
- /**
- * Constructs a new instance of this class, and allows chaining.
- *
- * @param array $config (Required) An associative array representing the Hadoop step configuration.
- * @return $this A reference to the current instance.
- */
- public static function init($config)
- {
- if (version_compare(PHP_VERSION, '5.3.0', '<'))
- {
- throw new Exception('PHP 5.3 or newer is required to instantiate a new class with CLASS::init().');
- }
-
- $self = get_called_class();
- return new $self($config);
- }
-
- /**
- * Returns a JSON representation of the object when typecast as a string.
- *
- * @return string A JSON representation of the object.
- * @link http://www.php.net/manual/en/language.oop5.magic.php#language.oop5.magic.tostring PHP Magic Methods
- */
- public function __toString()
- {
- return json_encode($this->config);
- }
-
- /**
- * Returns the configuration data.
- *
- * @return array The configuration data.
- */
- public function get_config()
- {
- return $this->config;
- }
-}
diff --git a/3rdparty/aws-sdk/utilities/utilities.class.php b/3rdparty/aws-sdk/utilities/utilities.class.php
deleted file mode 100755
index d4d1120abff..00000000000
--- a/3rdparty/aws-sdk/utilities/utilities.class.php
+++ /dev/null
@@ -1,399 +0,0 @@
-<?php
-/*
- * Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License").
- * You may not use this file except in compliance with the License.
- * A copy of the License is located at
- *
- * http://aws.amazon.com/apache2.0
- *
- * or in the "license" file accompanying this file. This file is distributed
- * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-
-/*%******************************************************************************************%*/
-// CLASS
-
-/**
- * Contains a set of utility methods for connecting to, and working with, AWS.
- *
- * @version 2010.09.30
- * @license See the included NOTICE.md file for more information.
- * @copyright See the included NOTICE.md file for more information.
- * @link http://aws.amazon.com/php/ PHP Developer Center
- */
-class CFUtilities
-{
-
- /*%******************************************************************************************%*/
- // CONSTANTS
-
- /**
- * Define the RFC 2616-compliant date format.
- */
- const DATE_FORMAT_RFC2616 = 'D, d M Y H:i:s \G\M\T';
-
- /**
- * Define the ISO-8601-compliant date format.
- */
- const DATE_FORMAT_ISO8601 = 'Y-m-d\TH:i:s\Z';
-
- /**
- * Define the MySQL-compliant date format.
- */
- const DATE_FORMAT_MYSQL = 'Y-m-d H:i:s';
-
- /**
- * Define the Signature v4 date format.
- */
- const DATE_FORMAT_SIGV4 = 'Ymd\THis\Z';
-
-
- /*%******************************************************************************************%*/
- // METHODS
-
- /**
- * Constructs a new instance of this class.
- *
- * @return $this A reference to the current instance.
- */
- public function __construct()
- {
- return $this;
- }
-
- /**
- * Retrieves the value of a class constant, while avoiding the `T_PAAMAYIM_NEKUDOTAYIM` error. Misspelled because `const` is a reserved word.
- *
- * @param object $class (Required) An instance of the class containing the constant.
- * @param string $const (Required) The name of the constant to retrieve.
- * @return mixed The value of the class constant.
- */
- public function konst($class, $const)
- {
- if (is_string($class))
- {
- $ref = new ReflectionClass($class);
- }
- else
- {
- $ref = new ReflectionObject($class);
- }
-
- return $ref->getConstant($const);
- }
-
- /**
- * Convert a HEX value to Base64.
- *
- * @param string $str (Required) Value to convert.
- * @return string Base64-encoded string.
- */
- public function hex_to_base64($str)
- {
- $raw = '';
-
- for ($i = 0; $i < strlen($str); $i += 2)
- {
- $raw .= chr(hexdec(substr($str, $i, 2)));
- }
-
- return base64_encode($raw);
- }
-
- /**
- * Convert an associative array into a query string.
- *
- * @param array $array (Required) Array to convert.
- * @return string URL-friendly query string.
- */
- public function to_query_string($array)
- {
- $temp = array();
-
- foreach ($array as $key => $value)
- {
- if (is_string($key) && !is_array($value))
- {
- $temp[] = rawurlencode($key) . '=' . rawurlencode($value);
- }
- }
-
- return implode('&', $temp);
- }
-
- /**
- * Convert an associative array into a sign-able string.
- *
- * @param array $array (Required) Array to convert.
- * @return string URL-friendly sign-able string.
- */
- public function to_signable_string($array)
- {
- $t = array();
-
- foreach ($array as $k => $v)
- {
- $t[] = $this->encode_signature2($k) . '=' . $this->encode_signature2($v);
- }
-
- return implode('&', $t);
- }
-
- /**
- * Encode the value according to RFC 3986.
- *
- * @param string $string (Required) String to convert.
- * @return string URL-friendly sign-able string.
- */
- public function encode_signature2($string)
- {
- $string = rawurlencode($string);
- return str_replace('%7E', '~', $string);
- }
-
- /**
- * Convert a query string into an associative array. Multiple, identical keys will become an indexed array.
- *
- * @param string $qs (Required) Query string to convert.
- * @return array Associative array of keys and values.
- */
- public function query_to_array($qs)
- {
- $query = explode('&', $qs);
- $data = array();
-
- foreach ($query as $q)
- {
- $q = explode('=', $q);
-
- if (isset($data[$q[0]]) && is_array($data[$q[0]]))
- {
- $data[$q[0]][] = urldecode($q[1]);
- }
- else if (isset($data[$q[0]]) && !is_array($data[$q[0]]))
- {
- $data[$q[0]] = array($data[$q[0]]);
- $data[$q[0]][] = urldecode($q[1]);
- }
- else
- {
- $data[urldecode($q[0])] = urldecode($q[1]);
- }
- }
- return $data;
- }
-
- /**
- * Return human readable file sizes.
- *
- * @author Aidan Lister <aidan@php.net>
- * @author Ryan Parman <ryan@getcloudfusion.com>
- * @license http://www.php.net/license/3_01.txt PHP License
- * @param integer $size (Required) Filesize in bytes.
- * @param string $unit (Optional) The maximum unit to use. Defaults to the largest appropriate unit.
- * @param string $default (Optional) The format for the return string. Defaults to `%01.2f %s`.
- * @return string The human-readable file size.
- * @link http://aidanlister.com/repos/v/function.size_readable.php Original Function
- */
- public function size_readable($size, $unit = null, $default = null)
- {
- // Units
- $sizes = array('B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB');
- $mod = 1024;
- $ii = count($sizes) - 1;
-
- // Max unit
- $unit = array_search((string) $unit, $sizes);
- if ($unit === null || $unit === false)
- {
- $unit = $ii;
- }
-
- // Return string
- if ($default === null)
- {
- $default = '%01.2f %s';
- }
-
- // Loop
- $i = 0;
- while ($unit != $i && $size >= 1024 && $i < $ii)
- {
- $size /= $mod;
- $i++;
- }
-
- return sprintf($default, $size, $sizes[$i]);
- }
-
- /**
- * Convert a number of seconds into Hours:Minutes:Seconds.
- *
- * @param integer $seconds (Required) The number of seconds to convert.
- * @return string The formatted time.
- */
- public function time_hms($seconds)
- {
- $time = '';
-
- // First pass
- $hours = (int) ($seconds / 3600);
- $seconds = $seconds % 3600;
- $minutes = (int) ($seconds / 60);
- $seconds = $seconds % 60;
-
- // Cleanup
- $time .= ($hours) ? $hours . ':' : '';
- $time .= ($minutes < 10 && $hours > 0) ? '0' . $minutes : $minutes;
- $time .= ':';
- $time .= ($seconds < 10) ? '0' . $seconds : $seconds;
-
- return $time;
- }
-
- /**
- * Returns the first value that is set. Based on [Try.these()](http://api.prototypejs.org/language/Try/these/) from [Prototype](http://prototypejs.org).
- *
- * @param array $attrs (Required) The attributes to test, as strings. Intended for testing properties of the $base object, but also works with variables if you place an @ symbol at the beginning of the command.
- * @param object $base (Optional) The base object to use, if any.
- * @param mixed $default (Optional) What to return if there are no matches. Defaults to `null`.
- * @return mixed Either a matching property of a given object, boolean `false`, or any other data type you might choose.
- */
- public function try_these($attrs, $base = null, $default = null)
- {
- if ($base)
- {
- foreach ($attrs as $attr)
- {
- if (isset($base->$attr))
- {
- return $base->$attr;
- }
- }
- }
- else
- {
- foreach ($attrs as $attr)
- {
- if (isset($attr))
- {
- return $attr;
- }
- }
- }
-
- return $default;
- }
-
- /**
- * Can be removed once all calls are updated.
- *
- * @deprecated Use <php:json_encode()> instead.
- * @param mixed $obj (Required) The PHP object to convert into a JSON string.
- * @return string A JSON string.
- */
- public function json_encode($obj)
- {
- return json_encode($obj);
- }
-
- /**
- * Converts a SimpleXML response to an array structure.
- *
- * @param ResponseCore $response (Required) A response value.
- * @return array The response value as a standard, multi-dimensional array.
- */
- public function convert_response_to_array(ResponseCore $response)
- {
- return json_decode(json_encode($response), true);
- }
-
- /**
- * Checks to see if a date stamp is ISO-8601 formatted, and if not, makes it so.
- *
- * @param string $datestamp (Required) A date stamp, or a string that can be parsed into a date stamp.
- * @return string An ISO-8601 formatted date stamp.
- */
- public function convert_date_to_iso8601($datestamp)
- {
- if (!preg_match('/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}((\+|-)\d{2}:\d{2}|Z)/m', $datestamp))
- {
- return gmdate(self::DATE_FORMAT_ISO8601, strtotime($datestamp));
- }
-
- return $datestamp;
- }
-
- /**
- * Determines whether the data is Base64 encoded or not.
- *
- * @license http://us.php.net/manual/en/function.base64-decode.php#81425 PHP License
- * @param string $s (Required) The string to test.
- * @return boolean Whether the string is Base64 encoded or not.
- */
- public function is_base64($s)
- {
- return (bool) preg_match('/^[a-zA-Z0-9\/\r\n+]*={0,2}$/', $s);
- }
-
- /**
- * Determines whether the data is a JSON string or not.
- *
- * @param string $s (Required) The string to test.
- * @return boolean Whether the string is a valid JSON object or not.
- */
- public function is_json($s)
- {
- return !!(json_decode($s) instanceof stdClass);
- }
-
- /**
- * Decodes `\uXXXX` entities into their real unicode character equivalents.
- *
- * @param string $s (Required) The string to decode.
- * @return string The decoded string.
- */
- public function decode_uhex($s)
- {
- preg_match_all('/\\\u([0-9a-f]{4})/i', $s, $matches);
- $matches = $matches[count($matches) - 1];
- $map = array();
-
- foreach ($matches as $match)
- {
- if (!isset($map[$match]))
- {
- $map['\u' . $match] = html_entity_decode('&#' . hexdec($match) . ';', ENT_NOQUOTES, 'UTF-8');
- }
- }
-
- return str_replace(array_keys($map), $map, $s);
- }
-
- /**
- * Generates a random GUID.
- *
- * @author Alix Axel <http://www.php.net/manual/en/function.com-create-guid.php#99425>
- * @license http://www.php.net/license/3_01.txt PHP License
- * @return string A random GUID.
- */
- public function generate_guid()
- {
- return sprintf(
- '%04X%04X-%04X-%04X-%04X-%04X%04X%04X',
- mt_rand(0, 65535),
- mt_rand(0, 65535),
- mt_rand(0, 65535),
- mt_rand(16384, 20479),
- mt_rand(32768, 49151),
- mt_rand(0, 65535),
- mt_rand(0, 65535),
- mt_rand(0, 65535)
- );
- }
-}
diff --git a/3rdparty/class.phpmailer.php b/3rdparty/class.phpmailer.php
deleted file mode 100644
index af089d59789..00000000000
--- a/3rdparty/class.phpmailer.php
+++ /dev/null
@@ -1,2532 +0,0 @@
-<?php
-/*~ class.phpmailer.php
-.---------------------------------------------------------------------------.
-| Software: PHPMailer - PHP email class |
-| Version: 5.2.1 |
-| Site: https://code.google.com/a/apache-extras.org/p/phpmailer/ |
-| ------------------------------------------------------------------------- |
-| Admin: Jim Jagielski (project admininistrator) |
-| Authors: Andy Prevost (codeworxtech) codeworxtech@users.sourceforge.net |
-| : Marcus Bointon (coolbru) coolbru@users.sourceforge.net |
-| : Jim Jagielski (jimjag) jimjag@gmail.com |
-| Founder: Brent R. Matzelle (original founder) |
-| Copyright (c) 2010-2012, Jim Jagielski. All Rights Reserved. |
-| Copyright (c) 2004-2009, Andy Prevost. All Rights Reserved. |
-| Copyright (c) 2001-2003, Brent R. Matzelle |
-| ------------------------------------------------------------------------- |
-| License: Distributed under the Lesser General Public License (LGPL) |
-| http://www.gnu.org/copyleft/lesser.html |
-| This program is distributed in the hope that it will be useful - WITHOUT |
-| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
-| FITNESS FOR A PARTICULAR PURPOSE. |
-'---------------------------------------------------------------------------'
-*/
-
-/**
- * PHPMailer - PHP email transport class
- * NOTE: Requires PHP version 5 or later
- * @package PHPMailer
- * @author Andy Prevost
- * @author Marcus Bointon
- * @author Jim Jagielski
- * @copyright 2010 - 2012 Jim Jagielski
- * @copyright 2004 - 2009 Andy Prevost
- * @version $Id: class.phpmailer.php 450 2010-06-23 16:46:33Z coolbru $
- * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
- */
-
-if (version_compare(PHP_VERSION, '5.0.0', '<') ) exit("Sorry, this version of PHPMailer will only run on PHP version 5 or greater!\n");
-
-class PHPMailer {
-
- /////////////////////////////////////////////////
- // PROPERTIES, PUBLIC
- /////////////////////////////////////////////////
-
- /**
- * Email priority (1 = High, 3 = Normal, 5 = low).
- * @var int
- */
- public $Priority = 3;
-
- /**
- * Sets the CharSet of the message.
- * @var string
- */
- public $CharSet = 'iso-8859-1';
-
- /**
- * Sets the Content-type of the message.
- * @var string
- */
- public $ContentType = 'text/plain';
-
- /**
- * Sets the Encoding of the message. Options for this are
- * "8bit", "7bit", "binary", "base64", and "quoted-printable".
- * @var string
- */
- public $Encoding = '8bit';
-
- /**
- * Holds the most recent mailer error message.
- * @var string
- */
- public $ErrorInfo = '';
-
- /**
- * Sets the From email address for the message.
- * @var string
- */
- public $From = 'root@localhost';
-
- /**
- * Sets the From name of the message.
- * @var string
- */
- public $FromName = 'Root User';
-
- /**
- * Sets the Sender email (Return-Path) of the message. If not empty,
- * will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
- * @var string
- */
- public $Sender = '';
-
- /**
- * Sets the Subject of the message.
- * @var string
- */
- public $Subject = '';
-
- /**
- * Sets the Body of the message. This can be either an HTML or text body.
- * If HTML then run IsHTML(true).
- * @var string
- */
- public $Body = '';
-
- /**
- * Sets the text-only body of the message. This automatically sets the
- * email to multipart/alternative. This body can be read by mail
- * clients that do not have HTML email capability such as mutt. Clients
- * that can read HTML will view the normal Body.
- * @var string
- */
- public $AltBody = '';
-
- /**
- * Stores the complete compiled MIME message body.
- * @var string
- * @access protected
- */
- protected $MIMEBody = '';
-
- /**
- * Stores the complete compiled MIME message headers.
- * @var string
- * @access protected
- */
- protected $MIMEHeader = '';
-
- /**
- * Stores the complete sent MIME message (Body and Headers)
- * @var string
- * @access protected
- */
- protected $SentMIMEMessage = '';
-
- /**
- * Sets word wrapping on the body of the message to a given number of
- * characters.
- * @var int
- */
- public $WordWrap = 0;
-
- /**
- * Method to send mail: ("mail", "sendmail", or "smtp").
- * @var string
- */
- public $Mailer = 'mail';
-
- /**
- * Sets the path of the sendmail program.
- * @var string
- */
- public $Sendmail = '/usr/sbin/sendmail';
-
- /**
- * Path to PHPMailer plugins. Useful if the SMTP class
- * is in a different directory than the PHP include path.
- * @var string
- */
- public $PluginDir = '';
-
- /**
- * Sets the email address that a reading confirmation will be sent.
- * @var string
- */
- public $ConfirmReadingTo = '';
-
- /**
- * Sets the hostname to use in Message-Id and Received headers
- * and as default HELO string. If empty, the value returned
- * by SERVER_NAME is used or 'localhost.localdomain'.
- * @var string
- */
- public $Hostname = '';
-
- /**
- * Sets the message ID to be used in the Message-Id header.
- * If empty, a unique id will be generated.
- * @var string
- */
- public $MessageID = '';
-
- /////////////////////////////////////////////////
- // PROPERTIES FOR SMTP
- /////////////////////////////////////////////////
-
- /**
- * Sets the SMTP hosts. All hosts must be separated by a
- * semicolon. You can also specify a different port
- * for each host by using this format: [hostname:port]
- * (e.g. "smtp1.example.com:25;smtp2.example.com").
- * Hosts will be tried in order.
- * @var string
- */
- public $Host = 'localhost';
-
- /**
- * Sets the default SMTP server port.
- * @var int
- */
- public $Port = 25;
-
- /**
- * Sets the SMTP HELO of the message (Default is $Hostname).
- * @var string
- */
- public $Helo = '';
-
- /**
- * Sets connection prefix.
- * Options are "", "ssl" or "tls"
- * @var string
- */
- public $SMTPSecure = '';
-
- /**
- * Sets SMTP authentication. Utilizes the Username and Password variables.
- * @var bool
- */
- public $SMTPAuth = false;
-
- /**
- * Sets SMTP username.
- * @var string
- */
- public $Username = '';
-
- /**
- * Sets SMTP password.
- * @var string
- */
- public $Password = '';
-
- /**
- * Sets the SMTP server timeout in seconds.
- * This function will not work with the win32 version.
- * @var int
- */
- public $Timeout = 10;
-
- /**
- * Sets SMTP class debugging on or off.
- * @var bool
- */
- public $SMTPDebug = false;
-
- /**
- * Prevents the SMTP connection from being closed after each mail
- * sending. If this is set to true then to close the connection
- * requires an explicit call to SmtpClose().
- * @var bool
- */
- public $SMTPKeepAlive = false;
-
- /**
- * Provides the ability to have the TO field process individual
- * emails, instead of sending to entire TO addresses
- * @var bool
- */
- public $SingleTo = false;
-
- /**
- * If SingleTo is true, this provides the array to hold the email addresses
- * @var bool
- */
- public $SingleToArray = array();
-
- /**
- * Provides the ability to change the line ending
- * @var string
- */
- public $LE = "\n";
-
- /**
- * Used with DKIM DNS Resource Record
- * @var string
- */
- public $DKIM_selector = 'phpmailer';
-
- /**
- * Used with DKIM DNS Resource Record
- * optional, in format of email address 'you@yourdomain.com'
- * @var string
- */
- public $DKIM_identity = '';
-
- /**
- * Used with DKIM DNS Resource Record
- * @var string
- */
- public $DKIM_passphrase = '';
-
- /**
- * Used with DKIM DNS Resource Record
- * optional, in format of email address 'you@yourdomain.com'
- * @var string
- */
- public $DKIM_domain = '';
-
- /**
- * Used with DKIM DNS Resource Record
- * optional, in format of email address 'you@yourdomain.com'
- * @var string
- */
- public $DKIM_private = '';
-
- /**
- * Callback Action function name
- * the function that handles the result of the send email action. Parameters:
- * bool $result result of the send action
- * string $to email address of the recipient
- * string $cc cc email addresses
- * string $bcc bcc email addresses
- * string $subject the subject
- * string $body the email body
- * @var string
- */
- public $action_function = ''; //'callbackAction';
-
- /**
- * Sets the PHPMailer Version number
- * @var string
- */
- public $Version = '5.2.1';
-
- /**
- * What to use in the X-Mailer header
- * @var string
- */
- public $XMailer = '';
-
- /////////////////////////////////////////////////
- // PROPERTIES, PRIVATE AND PROTECTED
- /////////////////////////////////////////////////
-
- protected $smtp = NULL;
- protected $to = array();
- protected $cc = array();
- protected $bcc = array();
- protected $ReplyTo = array();
- protected $all_recipients = array();
- protected $attachment = array();
- protected $CustomHeader = array();
- protected $message_type = '';
- protected $boundary = array();
- protected $language = array();
- protected $error_count = 0;
- protected $sign_cert_file = '';
- protected $sign_key_file = '';
- protected $sign_key_pass = '';
- protected $exceptions = false;
-
- /////////////////////////////////////////////////
- // CONSTANTS
- /////////////////////////////////////////////////
-
- const STOP_MESSAGE = 0; // message only, continue processing
- const STOP_CONTINUE = 1; // message?, likely ok to continue processing
- const STOP_CRITICAL = 2; // message, plus full stop, critical error reached
-
- /////////////////////////////////////////////////
- // METHODS, VARIABLES
- /////////////////////////////////////////////////
-
- /**
- * Constructor
- * @param boolean $exceptions Should we throw external exceptions?
- */
- public function __construct($exceptions = false) {
- $this->exceptions = ($exceptions == true);
- }
-
- /**
- * Sets message type to HTML.
- * @param bool $ishtml
- * @return void
- */
- public function IsHTML($ishtml = true) {
- if ($ishtml) {
- $this->ContentType = 'text/html';
- } else {
- $this->ContentType = 'text/plain';
- }
- }
-
- /**
- * Sets Mailer to send message using SMTP.
- * @return void
- */
- public function IsSMTP() {
- $this->Mailer = 'smtp';
- }
-
- /**
- * Sets Mailer to send message using PHP mail() function.
- * @return void
- */
- public function IsMail() {
- $this->Mailer = 'mail';
- }
-
- /**
- * Sets Mailer to send message using the $Sendmail program.
- * @return void
- */
- public function IsSendmail() {
- if (!stristr(ini_get('sendmail_path'), 'sendmail')) {
- $this->Sendmail = '/var/qmail/bin/sendmail';
- }
- $this->Mailer = 'sendmail';
- }
-
- /**
- * Sets Mailer to send message using the qmail MTA.
- * @return void
- */
- public function IsQmail() {
- if (stristr(ini_get('sendmail_path'), 'qmail')) {
- $this->Sendmail = '/var/qmail/bin/sendmail';
- }
- $this->Mailer = 'sendmail';
- }
-
- /////////////////////////////////////////////////
- // METHODS, RECIPIENTS
- /////////////////////////////////////////////////
-
- /**
- * Adds a "To" address.
- * @param string $address
- * @param string $name
- * @return boolean true on success, false if address already used
- */
- public function AddAddress($address, $name = '') {
- return $this->AddAnAddress('to', $address, $name);
- }
-
- /**
- * Adds a "Cc" address.
- * Note: this function works with the SMTP mailer on win32, not with the "mail" mailer.
- * @param string $address
- * @param string $name
- * @return boolean true on success, false if address already used
- */
- public function AddCC($address, $name = '') {
- return $this->AddAnAddress('cc', $address, $name);
- }
-
- /**
- * Adds a "Bcc" address.
- * Note: this function works with the SMTP mailer on win32, not with the "mail" mailer.
- * @param string $address
- * @param string $name
- * @return boolean true on success, false if address already used
- */
- public function AddBCC($address, $name = '') {
- return $this->AddAnAddress('bcc', $address, $name);
- }
-
- /**
- * Adds a "Reply-to" address.
- * @param string $address
- * @param string $name
- * @return boolean
- */
- public function AddReplyTo($address, $name = '') {
- return $this->AddAnAddress('Reply-To', $address, $name);
- }
-
- /**
- * Adds an address to one of the recipient arrays
- * Addresses that have been added already return false, but do not throw exceptions
- * @param string $kind One of 'to', 'cc', 'bcc', 'ReplyTo'
- * @param string $address The email address to send to
- * @param string $name
- * @return boolean true on success, false if address already used or invalid in some way
- * @access protected
- */
- protected function AddAnAddress($kind, $address, $name = '') {
- if (!preg_match('/^(to|cc|bcc|Reply-To)$/', $kind)) {
- $this->SetError($this->Lang('Invalid recipient array').': '.$kind);
- if ($this->exceptions) {
- throw new phpmailerException('Invalid recipient array: ' . $kind);
- }
- if ($this->SMTPDebug) {
- echo $this->Lang('Invalid recipient array').': '.$kind;
- }
- return false;
- }
- $address = trim($address);
- $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
- if (!self::ValidateAddress($address)) {
- $this->SetError($this->Lang('invalid_address').': '. $address);
- if ($this->exceptions) {
- throw new phpmailerException($this->Lang('invalid_address').': '.$address);
- }
- if ($this->SMTPDebug) {
- echo $this->Lang('invalid_address').': '.$address;
- }
- return false;
- }
- if ($kind != 'Reply-To') {
- if (!isset($this->all_recipients[strtolower($address)])) {
- array_push($this->$kind, array($address, $name));
- $this->all_recipients[strtolower($address)] = true;
- return true;
- }
- } else {
- if (!array_key_exists(strtolower($address), $this->ReplyTo)) {
- $this->ReplyTo[strtolower($address)] = array($address, $name);
- return true;
- }
- }
- return false;
-}
-
-/**
- * Set the From and FromName properties
- * @param string $address
- * @param string $name
- * @return boolean
- */
- public function SetFrom($address, $name = '', $auto = 1) {
- $address = trim($address);
- $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
- if (!self::ValidateAddress($address)) {
- $this->SetError($this->Lang('invalid_address').': '. $address);
- if ($this->exceptions) {
- throw new phpmailerException($this->Lang('invalid_address').': '.$address);
- }
- if ($this->SMTPDebug) {
- echo $this->Lang('invalid_address').': '.$address;
- }
- return false;
- }
- $this->From = $address;
- $this->FromName = $name;
- if ($auto) {
- if (empty($this->ReplyTo)) {
- $this->AddAnAddress('Reply-To', $address, $name);
- }
- if (empty($this->Sender)) {
- $this->Sender = $address;
- }
- }
- return true;
- }
-
- /**
- * Check that a string looks roughly like an email address should
- * Static so it can be used without instantiation
- * Tries to use PHP built-in validator in the filter extension (from PHP 5.2), falls back to a reasonably competent regex validator
- * Conforms approximately to RFC2822
- * @link http://www.hexillion.com/samples/#Regex Original pattern found here
- * @param string $address The email address to check
- * @return boolean
- * @static
- * @access public
- */
- public static function ValidateAddress($address) {
- if (function_exists('filter_var')) { //Introduced in PHP 5.2
- if(filter_var($address, FILTER_VALIDATE_EMAIL) === FALSE) {
- return false;
- } else {
- return true;
- }
- } else {
- return preg_match('/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!\.)){0,61}[a-zA-Z0-9_-]?\.)+[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!$)){0,61}[a-zA-Z0-9_]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/', $address);
- }
- }
-
- /////////////////////////////////////////////////
- // METHODS, MAIL SENDING
- /////////////////////////////////////////////////
-
- /**
- * Creates message and assigns Mailer. If the message is
- * not sent successfully then it returns false. Use the ErrorInfo
- * variable to view description of the error.
- * @return bool
- */
- public function Send() {
- try {
- if(!$this->PreSend()) return false;
- return $this->PostSend();
- } catch (phpmailerException $e) {
- $this->SentMIMEMessage = '';
- $this->SetError($e->getMessage());
- if ($this->exceptions) {
- throw $e;
- }
- return false;
- }
- }
-
- protected function PreSend() {
- try {
- $mailHeader = "";
- if ((count($this->to) + count($this->cc) + count($this->bcc)) < 1) {
- throw new phpmailerException($this->Lang('provide_address'), self::STOP_CRITICAL);
- }
-
- // Set whether the message is multipart/alternative
- if(!empty($this->AltBody)) {
- $this->ContentType = 'multipart/alternative';
- }
-
- $this->error_count = 0; // reset errors
- $this->SetMessageType();
- //Refuse to send an empty message
- if (empty($this->Body)) {
- throw new phpmailerException($this->Lang('empty_message'), self::STOP_CRITICAL);
- }
-
- $this->MIMEHeader = $this->CreateHeader();
- $this->MIMEBody = $this->CreateBody();
-
- // To capture the complete message when using mail(), create
- // an extra header list which CreateHeader() doesn't fold in
- if ($this->Mailer == 'mail') {
- if (count($this->to) > 0) {
- $mailHeader .= $this->AddrAppend("To", $this->to);
- } else {
- $mailHeader .= $this->HeaderLine("To", "undisclosed-recipients:;");
- }
- $mailHeader .= $this->HeaderLine('Subject', $this->EncodeHeader($this->SecureHeader(trim($this->Subject))));
- // if(count($this->cc) > 0) {
- // $mailHeader .= $this->AddrAppend("Cc", $this->cc);
- // }
- }
-
- // digitally sign with DKIM if enabled
- if ($this->DKIM_domain && $this->DKIM_private) {
- $header_dkim = $this->DKIM_Add($this->MIMEHeader, $this->EncodeHeader($this->SecureHeader($this->Subject)), $this->MIMEBody);
- $this->MIMEHeader = str_replace("\r\n", "\n", $header_dkim) . $this->MIMEHeader;
- }
-
- $this->SentMIMEMessage = sprintf("%s%s\r\n\r\n%s",$this->MIMEHeader,$mailHeader,$this->MIMEBody);
- return true;
-
- } catch (phpmailerException $e) {
- $this->SetError($e->getMessage());
- if ($this->exceptions) {
- throw $e;
- }
- return false;
- }
- }
-
- protected function PostSend() {
- try {
- // Choose the mailer and send through it
- switch($this->Mailer) {
- case 'sendmail':
- return $this->SendmailSend($this->MIMEHeader, $this->MIMEBody);
- case 'smtp':
- return $this->SmtpSend($this->MIMEHeader, $this->MIMEBody);
- case 'mail':
- return $this->MailSend($this->MIMEHeader, $this->MIMEBody);
- default:
- return $this->MailSend($this->MIMEHeader, $this->MIMEBody);
- }
-
- } catch (phpmailerException $e) {
- $this->SetError($e->getMessage());
- if ($this->exceptions) {
- throw $e;
- }
- if ($this->SMTPDebug) {
- echo $e->getMessage()."\n";
- }
- return false;
- }
- }
-
- /**
- * Sends mail using the $Sendmail program.
- * @param string $header The message headers
- * @param string $body The message body
- * @access protected
- * @return bool
- */
- protected function SendmailSend($header, $body) {
- if ($this->Sender != '') {
- $sendmail = sprintf("%s -oi -f %s -t", escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender));
- } else {
- $sendmail = sprintf("%s -oi -t", escapeshellcmd($this->Sendmail));
- }
- if ($this->SingleTo === true) {
- foreach ($this->SingleToArray as $key => $val) {
- if(!@$mail = popen($sendmail, 'w')) {
- throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
- }
- fputs($mail, "To: " . $val . "\n");
- fputs($mail, $header);
- fputs($mail, $body);
- $result = pclose($mail);
- // implement call back function if it exists
- $isSent = ($result == 0) ? 1 : 0;
- $this->doCallback($isSent, $val, $this->cc, $this->bcc, $this->Subject, $body);
- if($result != 0) {
- throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
- }
- }
- } else {
- if(!@$mail = popen($sendmail, 'w')) {
- throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
- }
- fputs($mail, $header);
- fputs($mail, $body);
- $result = pclose($mail);
- // implement call back function if it exists
- $isSent = ($result == 0) ? 1 : 0;
- $this->doCallback($isSent, $this->to, $this->cc, $this->bcc, $this->Subject, $body);
- if($result != 0) {
- throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
- }
- }
- return true;
- }
-
- /**
- * Sends mail using the PHP mail() function.
- * @param string $header The message headers
- * @param string $body The message body
- * @access protected
- * @return bool
- */
- protected function MailSend($header, $body) {
- $toArr = array();
- foreach($this->to as $t) {
- $toArr[] = $this->AddrFormat($t);
- }
- $to = implode(', ', $toArr);
-
- if (empty($this->Sender)) {
- $params = "-oi ";
- } else {
- $params = sprintf("-oi -f %s", $this->Sender);
- }
- if ($this->Sender != '' and !ini_get('safe_mode')) {
- $old_from = ini_get('sendmail_from');
- ini_set('sendmail_from', $this->Sender);
- if ($this->SingleTo === true && count($toArr) > 1) {
- foreach ($toArr as $key => $val) {
- $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
- // implement call back function if it exists
- $isSent = ($rt == 1) ? 1 : 0;
- $this->doCallback($isSent, $val, $this->cc, $this->bcc, $this->Subject, $body);
- }
- } else {
- $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
- // implement call back function if it exists
- $isSent = ($rt == 1) ? 1 : 0;
- $this->doCallback($isSent, $to, $this->cc, $this->bcc, $this->Subject, $body);
- }
- } else {
- if ($this->SingleTo === true && count($toArr) > 1) {
- foreach ($toArr as $key => $val) {
- $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
- // implement call back function if it exists
- $isSent = ($rt == 1) ? 1 : 0;
- $this->doCallback($isSent, $val, $this->cc, $this->bcc, $this->Subject, $body);
- }
- } else {
- $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
- // implement call back function if it exists
- $isSent = ($rt == 1) ? 1 : 0;
- $this->doCallback($isSent, $to, $this->cc, $this->bcc, $this->Subject, $body);
- }
- }
- if (isset($old_from)) {
- ini_set('sendmail_from', $old_from);
- }
- if(!$rt) {
- throw new phpmailerException($this->Lang('instantiate'), self::STOP_CRITICAL);
- }
- return true;
- }
-
- /**
- * Sends mail via SMTP using PhpSMTP
- * Returns false if there is a bad MAIL FROM, RCPT, or DATA input.
- * @param string $header The message headers
- * @param string $body The message body
- * @uses SMTP
- * @access protected
- * @return bool
- */
- protected function SmtpSend($header, $body) {
- require_once $this->PluginDir . 'class.smtp.php';
- $bad_rcpt = array();
-
- if(!$this->SmtpConnect()) {
- throw new phpmailerException($this->Lang('smtp_connect_failed'), self::STOP_CRITICAL);
- }
- $smtp_from = ($this->Sender == '') ? $this->From : $this->Sender;
- if(!$this->smtp->Mail($smtp_from)) {
- throw new phpmailerException($this->Lang('from_failed') . $smtp_from, self::STOP_CRITICAL);
- }
-
- // Attempt to send attach all recipients
- foreach($this->to as $to) {
- if (!$this->smtp->Recipient($to[0])) {
- $bad_rcpt[] = $to[0];
- // implement call back function if it exists
- $isSent = 0;
- $this->doCallback($isSent, $to[0], '', '', $this->Subject, $body);
- } else {
- // implement call back function if it exists
- $isSent = 1;
- $this->doCallback($isSent, $to[0], '', '', $this->Subject, $body);
- }
- }
- foreach($this->cc as $cc) {
- if (!$this->smtp->Recipient($cc[0])) {
- $bad_rcpt[] = $cc[0];
- // implement call back function if it exists
- $isSent = 0;
- $this->doCallback($isSent, '', $cc[0], '', $this->Subject, $body);
- } else {
- // implement call back function if it exists
- $isSent = 1;
- $this->doCallback($isSent, '', $cc[0], '', $this->Subject, $body);
- }
- }
- foreach($this->bcc as $bcc) {
- if (!$this->smtp->Recipient($bcc[0])) {
- $bad_rcpt[] = $bcc[0];
- // implement call back function if it exists
- $isSent = 0;
- $this->doCallback($isSent, '', '', $bcc[0], $this->Subject, $body);
- } else {
- // implement call back function if it exists
- $isSent = 1;
- $this->doCallback($isSent, '', '', $bcc[0], $this->Subject, $body);
- }
- }
-
-
- if (count($bad_rcpt) > 0 ) { //Create error message for any bad addresses
- $badaddresses = implode(', ', $bad_rcpt);
- throw new phpmailerException($this->Lang('recipients_failed') . $badaddresses);
- }
- if(!$this->smtp->Data($header . $body)) {
- throw new phpmailerException($this->Lang('data_not_accepted'), self::STOP_CRITICAL);
- }
- if($this->SMTPKeepAlive == true) {
- $this->smtp->Reset();
- }
- return true;
- }
-
- /**
- * Initiates a connection to an SMTP server.
- * Returns false if the operation failed.
- * @uses SMTP
- * @access public
- * @return bool
- */
- public function SmtpConnect() {
- if(is_null($this->smtp)) {
- $this->smtp = new SMTP();
- }
-
- $this->smtp->do_debug = $this->SMTPDebug;
- $hosts = explode(';', $this->Host);
- $index = 0;
- $connection = $this->smtp->Connected();
-
- // Retry while there is no connection
- try {
- while($index < count($hosts) && !$connection) {
- $hostinfo = array();
- if (preg_match('/^(.+):([0-9]+)$/', $hosts[$index], $hostinfo)) {
- $host = $hostinfo[1];
- $port = $hostinfo[2];
- } else {
- $host = $hosts[$index];
- $port = $this->Port;
- }
-
- $tls = ($this->SMTPSecure == 'tls');
- $ssl = ($this->SMTPSecure == 'ssl');
-
- if ($this->smtp->Connect(($ssl ? 'ssl://':'').$host, $port, $this->Timeout)) {
-
- $hello = ($this->Helo != '' ? $this->Helo : $this->ServerHostname());
- $this->smtp->Hello($hello);
-
- if ($tls) {
- if (!$this->smtp->StartTLS()) {
- throw new phpmailerException($this->Lang('tls'));
- }
-
- //We must resend HELO after tls negotiation
- $this->smtp->Hello($hello);
- }
-
- $connection = true;
- if ($this->SMTPAuth) {
- if (!$this->smtp->Authenticate($this->Username, $this->Password)) {
- throw new phpmailerException($this->Lang('authenticate'));
- }
- }
- }
- $index++;
- if (!$connection) {
- throw new phpmailerException($this->Lang('connect_host'));
- }
- }
- } catch (phpmailerException $e) {
- $this->smtp->Reset();
- if ($this->exceptions) {
- throw $e;
- }
- }
- return true;
- }
-
- /**
- * Closes the active SMTP session if one exists.
- * @return void
- */
- public function SmtpClose() {
- if(!is_null($this->smtp)) {
- if($this->smtp->Connected()) {
- $this->smtp->Quit();
- $this->smtp->Close();
- }
- }
- }
-
- /**
- * Sets the language for all class error messages.
- * Returns false if it cannot load the language file. The default language is English.
- * @param string $langcode ISO 639-1 2-character language code (e.g. Portuguese: "br")
- * @param string $lang_path Path to the language file directory
- * @access public
- */
- function SetLanguage($langcode = 'en', $lang_path = 'language/') {
- //Define full set of translatable strings
- $PHPMAILER_LANG = array(
- 'provide_address' => 'You must provide at least one recipient email address.',
- 'mailer_not_supported' => ' mailer is not supported.',
- 'execute' => 'Could not execute: ',
- 'instantiate' => 'Could not instantiate mail function.',
- 'authenticate' => 'SMTP Error: Could not authenticate.',
- 'from_failed' => 'The following From address failed: ',
- 'recipients_failed' => 'SMTP Error: The following recipients failed: ',
- 'data_not_accepted' => 'SMTP Error: Data not accepted.',
- 'connect_host' => 'SMTP Error: Could not connect to SMTP host.',
- 'file_access' => 'Could not access file: ',
- 'file_open' => 'File Error: Could not open file: ',
- 'encoding' => 'Unknown encoding: ',
- 'signing' => 'Signing Error: ',
- 'smtp_error' => 'SMTP server error: ',
- 'empty_message' => 'Message body empty',
- 'invalid_address' => 'Invalid address',
- 'variable_set' => 'Cannot set or reset variable: '
- );
- //Overwrite language-specific strings. This way we'll never have missing translations - no more "language string failed to load"!
- $l = true;
- if ($langcode != 'en') { //There is no English translation file
- $l = @include $lang_path.'phpmailer.lang-'.$langcode.'.php';
- }
- $this->language = $PHPMAILER_LANG;
- return ($l == true); //Returns false if language not found
- }
-
- /**
- * Return the current array of language strings
- * @return array
- */
- public function GetTranslations() {
- return $this->language;
- }
-
- /////////////////////////////////////////////////
- // METHODS, MESSAGE CREATION
- /////////////////////////////////////////////////
-
- /**
- * Creates recipient headers.
- * @access public
- * @return string
- */
- public function AddrAppend($type, $addr) {
- $addr_str = $type . ': ';
- $addresses = array();
- foreach ($addr as $a) {
- $addresses[] = $this->AddrFormat($a);
- }
- $addr_str .= implode(', ', $addresses);
- $addr_str .= $this->LE;
-
- return $addr_str;
- }
-
- /**
- * Formats an address correctly.
- * @access public
- * @return string
- */
- public function AddrFormat($addr) {
- if (empty($addr[1])) {
- return $this->SecureHeader($addr[0]);
- } else {
- return $this->EncodeHeader($this->SecureHeader($addr[1]), 'phrase') . " <" . $this->SecureHeader($addr[0]) . ">";
- }
- }
-
- /**
- * Wraps message for use with mailers that do not
- * automatically perform wrapping and for quoted-printable.
- * Original written by philippe.
- * @param string $message The message to wrap
- * @param integer $length The line length to wrap to
- * @param boolean $qp_mode Whether to run in Quoted-Printable mode
- * @access public
- * @return string
- */
- public function WrapText($message, $length, $qp_mode = false) {
- $soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE;
- // If utf-8 encoding is used, we will need to make sure we don't
- // split multibyte characters when we wrap
- $is_utf8 = (strtolower($this->CharSet) == "utf-8");
-
- $message = $this->FixEOL($message);
- if (substr($message, -1) == $this->LE) {
- $message = substr($message, 0, -1);
- }
-
- $line = explode($this->LE, $message);
- $message = '';
- for ($i = 0 ;$i < count($line); $i++) {
- $line_part = explode(' ', $line[$i]);
- $buf = '';
- for ($e = 0; $e<count($line_part); $e++) {
- $word = $line_part[$e];
- if ($qp_mode and (strlen($word) > $length)) {
- $space_left = $length - strlen($buf) - 1;
- if ($e != 0) {
- if ($space_left > 20) {
- $len = $space_left;
- if ($is_utf8) {
- $len = $this->UTF8CharBoundary($word, $len);
- } elseif (substr($word, $len - 1, 1) == "=") {
- $len--;
- } elseif (substr($word, $len - 2, 1) == "=") {
- $len -= 2;
- }
- $part = substr($word, 0, $len);
- $word = substr($word, $len);
- $buf .= ' ' . $part;
- $message .= $buf . sprintf("=%s", $this->LE);
- } else {
- $message .= $buf . $soft_break;
- }
- $buf = '';
- }
- while (strlen($word) > 0) {
- $len = $length;
- if ($is_utf8) {
- $len = $this->UTF8CharBoundary($word, $len);
- } elseif (substr($word, $len - 1, 1) == "=") {
- $len--;
- } elseif (substr($word, $len - 2, 1) == "=") {
- $len -= 2;
- }
- $part = substr($word, 0, $len);
- $word = substr($word, $len);
-
- if (strlen($word) > 0) {
- $message .= $part . sprintf("=%s", $this->LE);
- } else {
- $buf = $part;
- }
- }
- } else {
- $buf_o = $buf;
- $buf .= ($e == 0) ? $word : (' ' . $word);
-
- if (strlen($buf) > $length and $buf_o != '') {
- $message .= $buf_o . $soft_break;
- $buf = $word;
- }
- }
- }
- $message .= $buf . $this->LE;
- }
-
- return $message;
- }
-
- /**
- * Finds last character boundary prior to maxLength in a utf-8
- * quoted (printable) encoded string.
- * Original written by Colin Brown.
- * @access public
- * @param string $encodedText utf-8 QP text
- * @param int $maxLength find last character boundary prior to this length
- * @return int
- */
- public function UTF8CharBoundary($encodedText, $maxLength) {
- $foundSplitPos = false;
- $lookBack = 3;
- while (!$foundSplitPos) {
- $lastChunk = substr($encodedText, $maxLength - $lookBack, $lookBack);
- $encodedCharPos = strpos($lastChunk, "=");
- if ($encodedCharPos !== false) {
- // Found start of encoded character byte within $lookBack block.
- // Check the encoded byte value (the 2 chars after the '=')
- $hex = substr($encodedText, $maxLength - $lookBack + $encodedCharPos + 1, 2);
- $dec = hexdec($hex);
- if ($dec < 128) { // Single byte character.
- // If the encoded char was found at pos 0, it will fit
- // otherwise reduce maxLength to start of the encoded char
- $maxLength = ($encodedCharPos == 0) ? $maxLength :
- $maxLength - ($lookBack - $encodedCharPos);
- $foundSplitPos = true;
- } elseif ($dec >= 192) { // First byte of a multi byte character
- // Reduce maxLength to split at start of character
- $maxLength = $maxLength - ($lookBack - $encodedCharPos);
- $foundSplitPos = true;
- } elseif ($dec < 192) { // Middle byte of a multi byte character, look further back
- $lookBack += 3;
- }
- } else {
- // No encoded character found
- $foundSplitPos = true;
- }
- }
- return $maxLength;
- }
-
-
- /**
- * Set the body wrapping.
- * @access public
- * @return void
- */
- public function SetWordWrap() {
- if($this->WordWrap < 1) {
- return;
- }
-
- switch($this->message_type) {
- case 'alt':
- case 'alt_inline':
- case 'alt_attach':
- case 'alt_inline_attach':
- $this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap);
- break;
- default:
- $this->Body = $this->WrapText($this->Body, $this->WordWrap);
- break;
- }
- }
-
- /**
- * Assembles message header.
- * @access public
- * @return string The assembled header
- */
- public function CreateHeader() {
- $result = '';
-
- // Set the boundaries
- $uniq_id = md5(uniqid(time()));
- $this->boundary[1] = 'b1_' . $uniq_id;
- $this->boundary[2] = 'b2_' . $uniq_id;
- $this->boundary[3] = 'b3_' . $uniq_id;
-
- $result .= $this->HeaderLine('Date', self::RFCDate());
- if($this->Sender == '') {
- $result .= $this->HeaderLine('Return-Path', trim($this->From));
- } else {
- $result .= $this->HeaderLine('Return-Path', trim($this->Sender));
- }
-
- // To be created automatically by mail()
- if($this->Mailer != 'mail') {
- if ($this->SingleTo === true) {
- foreach($this->to as $t) {
- $this->SingleToArray[] = $this->AddrFormat($t);
- }
- } else {
- if(count($this->to) > 0) {
- $result .= $this->AddrAppend('To', $this->to);
- } elseif (count($this->cc) == 0) {
- $result .= $this->HeaderLine('To', 'undisclosed-recipients:;');
- }
- }
- }
-
- $from = array();
- $from[0][0] = trim($this->From);
- $from[0][1] = $this->FromName;
- $result .= $this->AddrAppend('From', $from);
-
- // sendmail and mail() extract Cc from the header before sending
- if(count($this->cc) > 0) {
- $result .= $this->AddrAppend('Cc', $this->cc);
- }
-
- // sendmail and mail() extract Bcc from the header before sending
- if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->bcc) > 0)) {
- $result .= $this->AddrAppend('Bcc', $this->bcc);
- }
-
- if(count($this->ReplyTo) > 0) {
- $result .= $this->AddrAppend('Reply-To', $this->ReplyTo);
- }
-
- // mail() sets the subject itself
- if($this->Mailer != 'mail') {
- $result .= $this->HeaderLine('Subject', $this->EncodeHeader($this->SecureHeader($this->Subject)));
- }
-
- if($this->MessageID != '') {
- $result .= $this->HeaderLine('Message-ID', $this->MessageID);
- } else {
- $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE);
- }
- $result .= $this->HeaderLine('X-Priority', $this->Priority);
- if($this->XMailer) {
- $result .= $this->HeaderLine('X-Mailer', $this->XMailer);
- } else {
- $result .= $this->HeaderLine('X-Mailer', 'PHPMailer '.$this->Version.' (http://code.google.com/a/apache-extras.org/p/phpmailer/)');
- }
-
- if($this->ConfirmReadingTo != '') {
- $result .= $this->HeaderLine('Disposition-Notification-To', '<' . trim($this->ConfirmReadingTo) . '>');
- }
-
- // Add custom headers
- for($index = 0; $index < count($this->CustomHeader); $index++) {
- $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), $this->EncodeHeader(trim($this->CustomHeader[$index][1])));
- }
- if (!$this->sign_key_file) {
- $result .= $this->HeaderLine('MIME-Version', '1.0');
- $result .= $this->GetMailMIME();
- }
-
- return $result;
- }
-
- /**
- * Returns the message MIME.
- * @access public
- * @return string
- */
- public function GetMailMIME() {
- $result = '';
- switch($this->message_type) {
- case 'plain':
- $result .= $this->HeaderLine('Content-Transfer-Encoding', $this->Encoding);
- $result .= $this->TextLine('Content-Type: '.$this->ContentType.'; charset="'.$this->CharSet.'"');
- break;
- case 'inline':
- $result .= $this->HeaderLine('Content-Type', 'multipart/related;');
- $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
- break;
- case 'attach':
- case 'inline_attach':
- case 'alt_attach':
- case 'alt_inline_attach':
- $result .= $this->HeaderLine('Content-Type', 'multipart/mixed;');
- $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
- break;
- case 'alt':
- case 'alt_inline':
- $result .= $this->HeaderLine('Content-Type', 'multipart/alternative;');
- $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
- break;
- }
-
- if($this->Mailer != 'mail') {
- $result .= $this->LE.$this->LE;
- }
-
- return $result;
- }
-
- /**
- * Returns the MIME message (headers and body). Only really valid post PreSend().
- * @access public
- * @return string
- */
- public function GetSentMIMEMessage() {
- return $this->SentMIMEMessage;
- }
-
-
- /**
- * Assembles the message body. Returns an empty string on failure.
- * @access public
- * @return string The assembled message body
- */
- public function CreateBody() {
- $body = '';
-
- if ($this->sign_key_file) {
- $body .= $this->GetMailMIME();
- }
-
- $this->SetWordWrap();
-
- switch($this->message_type) {
- case 'plain':
- $body .= $this->EncodeString($this->Body, $this->Encoding);
- break;
- case 'inline':
- $body .= $this->GetBoundary($this->boundary[1], '', '', '');
- $body .= $this->EncodeString($this->Body, $this->Encoding);
- $body .= $this->LE.$this->LE;
- $body .= $this->AttachAll("inline", $this->boundary[1]);
- break;
- case 'attach':
- $body .= $this->GetBoundary($this->boundary[1], '', '', '');
- $body .= $this->EncodeString($this->Body, $this->Encoding);
- $body .= $this->LE.$this->LE;
- $body .= $this->AttachAll("attachment", $this->boundary[1]);
- break;
- case 'inline_attach':
- $body .= $this->TextLine("--" . $this->boundary[1]);
- $body .= $this->HeaderLine('Content-Type', 'multipart/related;');
- $body .= $this->TextLine("\tboundary=\"" . $this->boundary[2] . '"');
- $body .= $this->LE;
- $body .= $this->GetBoundary($this->boundary[2], '', '', '');
- $body .= $this->EncodeString($this->Body, $this->Encoding);
- $body .= $this->LE.$this->LE;
- $body .= $this->AttachAll("inline", $this->boundary[2]);
- $body .= $this->LE;
- $body .= $this->AttachAll("attachment", $this->boundary[1]);
- break;
- case 'alt':
- $body .= $this->GetBoundary($this->boundary[1], '', 'text/plain', '');
- $body .= $this->EncodeString($this->AltBody, $this->Encoding);
- $body .= $this->LE.$this->LE;
- $body .= $this->GetBoundary($this->boundary[1], '', 'text/html', '');
- $body .= $this->EncodeString($this->Body, $this->Encoding);
- $body .= $this->LE.$this->LE;
- $body .= $this->EndBoundary($this->boundary[1]);
- break;
- case 'alt_inline':
- $body .= $this->GetBoundary($this->boundary[1], '', 'text/plain', '');
- $body .= $this->EncodeString($this->AltBody, $this->Encoding);
- $body .= $this->LE.$this->LE;
- $body .= $this->TextLine("--" . $this->boundary[1]);
- $body .= $this->HeaderLine('Content-Type', 'multipart/related;');
- $body .= $this->TextLine("\tboundary=\"" . $this->boundary[2] . '"');
- $body .= $this->LE;
- $body .= $this->GetBoundary($this->boundary[2], '', 'text/html', '');
- $body .= $this->EncodeString($this->Body, $this->Encoding);
- $body .= $this->LE.$this->LE;
- $body .= $this->AttachAll("inline", $this->boundary[2]);
- $body .= $this->LE;
- $body .= $this->EndBoundary($this->boundary[1]);
- break;
- case 'alt_attach':
- $body .= $this->TextLine("--" . $this->boundary[1]);
- $body .= $this->HeaderLine('Content-Type', 'multipart/alternative;');
- $body .= $this->TextLine("\tboundary=\"" . $this->boundary[2] . '"');
- $body .= $this->LE;
- $body .= $this->GetBoundary($this->boundary[2], '', 'text/plain', '');
- $body .= $this->EncodeString($this->AltBody, $this->Encoding);
- $body .= $this->LE.$this->LE;
- $body .= $this->GetBoundary($this->boundary[2], '', 'text/html', '');
- $body .= $this->EncodeString($this->Body, $this->Encoding);
- $body .= $this->LE.$this->LE;
- $body .= $this->EndBoundary($this->boundary[2]);
- $body .= $this->LE;
- $body .= $this->AttachAll("attachment", $this->boundary[1]);
- break;
- case 'alt_inline_attach':
- $body .= $this->TextLine("--" . $this->boundary[1]);
- $body .= $this->HeaderLine('Content-Type', 'multipart/alternative;');
- $body .= $this->TextLine("\tboundary=\"" . $this->boundary[2] . '"');
- $body .= $this->LE;
- $body .= $this->GetBoundary($this->boundary[2], '', 'text/plain', '');
- $body .= $this->EncodeString($this->AltBody, $this->Encoding);
- $body .= $this->LE.$this->LE;
- $body .= $this->TextLine("--" . $this->boundary[2]);
- $body .= $this->HeaderLine('Content-Type', 'multipart/related;');
- $body .= $this->TextLine("\tboundary=\"" . $this->boundary[3] . '"');
- $body .= $this->LE;
- $body .= $this->GetBoundary($this->boundary[3], '', 'text/html', '');
- $body .= $this->EncodeString($this->Body, $this->Encoding);
- $body .= $this->LE.$this->LE;
- $body .= $this->AttachAll("inline", $this->boundary[3]);
- $body .= $this->LE;
- $body .= $this->EndBoundary($this->boundary[2]);
- $body .= $this->LE;
- $body .= $this->AttachAll("attachment", $this->boundary[1]);
- break;
- }
-
- if ($this->IsError()) {
- $body = '';
- } elseif ($this->sign_key_file) {
- try {
- $file = tempnam('', 'mail');
- file_put_contents($file, $body); //TODO check this worked
- $signed = tempnam("", "signed");
- if (@openssl_pkcs7_sign($file, $signed, "file://".$this->sign_cert_file, array("file://".$this->sign_key_file, $this->sign_key_pass), NULL)) {
- @unlink($file);
- $body = file_get_contents($signed);
- @unlink($signed);
- } else {
- @unlink($file);
- @unlink($signed);
- throw new phpmailerException($this->Lang("signing").openssl_error_string());
- }
- } catch (phpmailerException $e) {
- $body = '';
- if ($this->exceptions) {
- throw $e;
- }
- }
- }
-
- return $body;
- }
-
- /**
- * Returns the start of a message boundary.
- * @access protected
- * @return string
- */
- protected function GetBoundary($boundary, $charSet, $contentType, $encoding) {
- $result = '';
- if($charSet == '') {
- $charSet = $this->CharSet;
- }
- if($contentType == '') {
- $contentType = $this->ContentType;
- }
- if($encoding == '') {
- $encoding = $this->Encoding;
- }
- $result .= $this->TextLine('--' . $boundary);
- $result .= sprintf("Content-Type: %s; charset=\"%s\"", $contentType, $charSet);
- $result .= $this->LE;
- $result .= $this->HeaderLine('Content-Transfer-Encoding', $encoding);
- $result .= $this->LE;
-
- return $result;
- }
-
- /**
- * Returns the end of a message boundary.
- * @access protected
- * @return string
- */
- protected function EndBoundary($boundary) {
- return $this->LE . '--' . $boundary . '--' . $this->LE;
- }
-
- /**
- * Sets the message type.
- * @access protected
- * @return void
- */
- protected function SetMessageType() {
- $this->message_type = array();
- if($this->AlternativeExists()) $this->message_type[] = "alt";
- if($this->InlineImageExists()) $this->message_type[] = "inline";
- if($this->AttachmentExists()) $this->message_type[] = "attach";
- $this->message_type = implode("_", $this->message_type);
- if($this->message_type == "") $this->message_type = "plain";
- }
-
- /**
- * Returns a formatted header line.
- * @access public
- * @return string
- */
- public function HeaderLine($name, $value) {
- return $name . ': ' . $value . $this->LE;
- }
-
- /**
- * Returns a formatted mail line.
- * @access public
- * @return string
- */
- public function TextLine($value) {
- return $value . $this->LE;
- }
-
- /////////////////////////////////////////////////
- // CLASS METHODS, ATTACHMENTS
- /////////////////////////////////////////////////
-
- /**
- * Adds an attachment from a path on the filesystem.
- * Returns false if the file could not be found
- * or accessed.
- * @param string $path Path to the attachment.
- * @param string $name Overrides the attachment name.
- * @param string $encoding File encoding (see $Encoding).
- * @param string $type File extension (MIME) type.
- * @return bool
- */
- public function AddAttachment($path, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
- try {
- if ( !@is_file($path) ) {
- throw new phpmailerException($this->Lang('file_access') . $path, self::STOP_CONTINUE);
- }
- $filename = basename($path);
- if ( $name == '' ) {
- $name = $filename;
- }
-
- $this->attachment[] = array(
- 0 => $path,
- 1 => $filename,
- 2 => $name,
- 3 => $encoding,
- 4 => $type,
- 5 => false, // isStringAttachment
- 6 => 'attachment',
- 7 => 0
- );
-
- } catch (phpmailerException $e) {
- $this->SetError($e->getMessage());
- if ($this->exceptions) {
- throw $e;
- }
- if ($this->SMTPDebug) {
- echo $e->getMessage()."\n";
- }
- if ( $e->getCode() == self::STOP_CRITICAL ) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Return the current array of attachments
- * @return array
- */
- public function GetAttachments() {
- return $this->attachment;
- }
-
- /**
- * Attaches all fs, string, and binary attachments to the message.
- * Returns an empty string on failure.
- * @access protected
- * @return string
- */
- protected function AttachAll($disposition_type, $boundary) {
- // Return text of body
- $mime = array();
- $cidUniq = array();
- $incl = array();
-
- // Add all attachments
- foreach ($this->attachment as $attachment) {
- // CHECK IF IT IS A VALID DISPOSITION_FILTER
- if($attachment[6] == $disposition_type) {
- // Check for string attachment
- $bString = $attachment[5];
- if ($bString) {
- $string = $attachment[0];
- } else {
- $path = $attachment[0];
- }
-
- $inclhash = md5(serialize($attachment));
- if (in_array($inclhash, $incl)) { continue; }
- $incl[] = $inclhash;
- $filename = $attachment[1];
- $name = $attachment[2];
- $encoding = $attachment[3];
- $type = $attachment[4];
- $disposition = $attachment[6];
- $cid = $attachment[7];
- if ( $disposition == 'inline' && isset($cidUniq[$cid]) ) { continue; }
- $cidUniq[$cid] = true;
-
- $mime[] = sprintf("--%s%s", $boundary, $this->LE);
- $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $this->EncodeHeader($this->SecureHeader($name)), $this->LE);
- $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE);
-
- if($disposition == 'inline') {
- $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE);
- }
-
- $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $this->EncodeHeader($this->SecureHeader($name)), $this->LE.$this->LE);
-
- // Encode as string attachment
- if($bString) {
- $mime[] = $this->EncodeString($string, $encoding);
- if($this->IsError()) {
- return '';
- }
- $mime[] = $this->LE.$this->LE;
- } else {
- $mime[] = $this->EncodeFile($path, $encoding);
- if($this->IsError()) {
- return '';
- }
- $mime[] = $this->LE.$this->LE;
- }
- }
- }
-
- $mime[] = sprintf("--%s--%s", $boundary, $this->LE);
-
- return implode("", $mime);
- }
-
- /**
- * Encodes attachment in requested format.
- * Returns an empty string on failure.
- * @param string $path The full path to the file
- * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
- * @see EncodeFile()
- * @access protected
- * @return string
- */
- protected function EncodeFile($path, $encoding = 'base64') {
- try {
- if (!is_readable($path)) {
- throw new phpmailerException($this->Lang('file_open') . $path, self::STOP_CONTINUE);
- }
- if (function_exists('get_magic_quotes')) {
- function get_magic_quotes() {
- return false;
- }
- }
- $magic_quotes = get_magic_quotes_runtime();
- if ($magic_quotes) {
- if (version_compare(PHP_VERSION, '5.3.0', '<')) {
- set_magic_quotes_runtime(0);
- } else {
- ini_set('magic_quotes_runtime', 0);
- }
- }
- $file_buffer = file_get_contents($path);
- $file_buffer = $this->EncodeString($file_buffer, $encoding);
- if ($magic_quotes) {
- if (version_compare(PHP_VERSION, '5.3.0', '<')) {
- set_magic_quotes_runtime($magic_quotes);
- } else {
- ini_set('magic_quotes_runtime', $magic_quotes);
- }
- }
- return $file_buffer;
- } catch (Exception $e) {
- $this->SetError($e->getMessage());
- return '';
- }
- }
-
- /**
- * Encodes string to requested format.
- * Returns an empty string on failure.
- * @param string $str The text to encode
- * @param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
- * @access public
- * @return string
- */
- public function EncodeString($str, $encoding = 'base64') {
- $encoded = '';
- switch(strtolower($encoding)) {
- case 'base64':
- $encoded = chunk_split(base64_encode($str), 76, $this->LE);
- break;
- case '7bit':
- case '8bit':
- $encoded = $this->FixEOL($str);
- //Make sure it ends with a line break
- if (substr($encoded, -(strlen($this->LE))) != $this->LE)
- $encoded .= $this->LE;
- break;
- case 'binary':
- $encoded = $str;
- break;
- case 'quoted-printable':
- $encoded = $this->EncodeQP($str);
- break;
- default:
- $this->SetError($this->Lang('encoding') . $encoding);
- break;
- }
- return $encoded;
- }
-
- /**
- * Encode a header string to best (shortest) of Q, B, quoted or none.
- * @access public
- * @return string
- */
- public function EncodeHeader($str, $position = 'text') {
- $x = 0;
-
- switch (strtolower($position)) {
- case 'phrase':
- if (!preg_match('/[\200-\377]/', $str)) {
- // Can't use addslashes as we don't know what value has magic_quotes_sybase
- $encoded = addcslashes($str, "\0..\37\177\\\"");
- if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) {
- return ($encoded);
- } else {
- return ("\"$encoded\"");
- }
- }
- $x = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches);
- break;
- case 'comment':
- $x = preg_match_all('/[()"]/', $str, $matches);
- // Fall-through
- case 'text':
- default:
- $x += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches);
- break;
- }
-
- if ($x == 0) {
- return ($str);
- }
-
- $maxlen = 75 - 7 - strlen($this->CharSet);
- // Try to select the encoding which should produce the shortest output
- if (strlen($str)/3 < $x) {
- $encoding = 'B';
- if (function_exists('mb_strlen') && $this->HasMultiBytes($str)) {
- // Use a custom function which correctly encodes and wraps long
- // multibyte strings without breaking lines within a character
- $encoded = $this->Base64EncodeWrapMB($str);
- } else {
- $encoded = base64_encode($str);
- $maxlen -= $maxlen % 4;
- $encoded = trim(chunk_split($encoded, $maxlen, "\n"));
- }
- } else {
- $encoding = 'Q';
- $encoded = $this->EncodeQ($str, $position);
- $encoded = $this->WrapText($encoded, $maxlen, true);
- $encoded = str_replace('='.$this->LE, "\n", trim($encoded));
- }
-
- $encoded = preg_replace('/^(.*)$/m', " =?".$this->CharSet."?$encoding?\\1?=", $encoded);
- $encoded = trim(str_replace("\n", $this->LE, $encoded));
-
- return $encoded;
- }
-
- /**
- * Checks if a string contains multibyte characters.
- * @access public
- * @param string $str multi-byte text to wrap encode
- * @return bool
- */
- public function HasMultiBytes($str) {
- if (function_exists('mb_strlen')) {
- return (strlen($str) > mb_strlen($str, $this->CharSet));
- } else { // Assume no multibytes (we can't handle without mbstring functions anyway)
- return false;
- }
- }
-
- /**
- * Correctly encodes and wraps long multibyte strings for mail headers
- * without breaking lines within a character.
- * Adapted from a function by paravoid at http://uk.php.net/manual/en/function.mb-encode-mimeheader.php
- * @access public
- * @param string $str multi-byte text to wrap encode
- * @return string
- */
- public function Base64EncodeWrapMB($str) {
- $start = "=?".$this->CharSet."?B?";
- $end = "?=";
- $encoded = "";
-
- $mb_length = mb_strlen($str, $this->CharSet);
- // Each line must have length <= 75, including $start and $end
- $length = 75 - strlen($start) - strlen($end);
- // Average multi-byte ratio
- $ratio = $mb_length / strlen($str);
- // Base64 has a 4:3 ratio
- $offset = $avgLength = floor($length * $ratio * .75);
-
- for ($i = 0; $i < $mb_length; $i += $offset) {
- $lookBack = 0;
-
- do {
- $offset = $avgLength - $lookBack;
- $chunk = mb_substr($str, $i, $offset, $this->CharSet);
- $chunk = base64_encode($chunk);
- $lookBack++;
- }
- while (strlen($chunk) > $length);
-
- $encoded .= $chunk . $this->LE;
- }
-
- // Chomp the last linefeed
- $encoded = substr($encoded, 0, -strlen($this->LE));
- return $encoded;
- }
-
- /**
- * Encode string to quoted-printable.
- * Only uses standard PHP, slow, but will always work
- * @access public
- * @param string $string the text to encode
- * @param integer $line_max Number of chars allowed on a line before wrapping
- * @return string
- */
- public function EncodeQPphp( $input = '', $line_max = 76, $space_conv = false) {
- $hex = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F');
- $lines = preg_split('/(?:\r\n|\r|\n)/', $input);
- $eol = "\r\n";
- $escape = '=';
- $output = '';
- while( list(, $line) = each($lines) ) {
- $linlen = strlen($line);
- $newline = '';
- for($i = 0; $i < $linlen; $i++) {
- $c = substr( $line, $i, 1 );
- $dec = ord( $c );
- if ( ( $i == 0 ) && ( $dec == 46 ) ) { // convert first point in the line into =2E
- $c = '=2E';
- }
- if ( $dec == 32 ) {
- if ( $i == ( $linlen - 1 ) ) { // convert space at eol only
- $c = '=20';
- } else if ( $space_conv ) {
- $c = '=20';
- }
- } elseif ( ($dec == 61) || ($dec < 32 ) || ($dec > 126) ) { // always encode "\t", which is *not* required
- $h2 = floor($dec/16);
- $h1 = floor($dec%16);
- $c = $escape.$hex[$h2].$hex[$h1];
- }
- if ( (strlen($newline) + strlen($c)) >= $line_max ) { // CRLF is not counted
- $output .= $newline.$escape.$eol; // soft line break; " =\r\n" is okay
- $newline = '';
- // check if newline first character will be point or not
- if ( $dec == 46 ) {
- $c = '=2E';
- }
- }
- $newline .= $c;
- } // end of for
- $output .= $newline.$eol;
- } // end of while
- return $output;
- }
-
- /**
- * Encode string to RFC2045 (6.7) quoted-printable format
- * Uses a PHP5 stream filter to do the encoding about 64x faster than the old version
- * Also results in same content as you started with after decoding
- * @see EncodeQPphp()
- * @access public
- * @param string $string the text to encode
- * @param integer $line_max Number of chars allowed on a line before wrapping
- * @param boolean $space_conv Dummy param for compatibility with existing EncodeQP function
- * @return string
- * @author Marcus Bointon
- */
- public function EncodeQP($string, $line_max = 76, $space_conv = false) {
- if (function_exists('quoted_printable_encode')) { //Use native function if it's available (>= PHP5.3)
- return quoted_printable_encode($string);
- }
- $filters = stream_get_filters();
- if (!in_array('convert.*', $filters)) { //Got convert stream filter?
- return $this->EncodeQPphp($string, $line_max, $space_conv); //Fall back to old implementation
- }
- $fp = fopen('php://temp/', 'r+');
- $string = preg_replace('/\r\n?/', $this->LE, $string); //Normalise line breaks
- $params = array('line-length' => $line_max, 'line-break-chars' => $this->LE);
- $s = stream_filter_append($fp, 'convert.quoted-printable-encode', STREAM_FILTER_READ, $params);
- fputs($fp, $string);
- rewind($fp);
- $out = stream_get_contents($fp);
- stream_filter_remove($s);
- $out = preg_replace('/^\./m', '=2E', $out); //Encode . if it is first char on a line, workaround for bug in Exchange
- fclose($fp);
- return $out;
- }
-
- /**
- * Encode string to q encoding.
- * @link http://tools.ietf.org/html/rfc2047
- * @param string $str the text to encode
- * @param string $position Where the text is going to be used, see the RFC for what that means
- * @access public
- * @return string
- */
- public function EncodeQ($str, $position = 'text') {
- // There should not be any EOL in the string
- $encoded = preg_replace('/[\r\n]*/', '', $str);
-
- switch (strtolower($position)) {
- case 'phrase':
- $encoded = preg_replace("/([^A-Za-z0-9!*+\/ -])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
- break;
- case 'comment':
- $encoded = preg_replace("/([\(\)\"])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
- case 'text':
- default:
- // Replace every high ascii, control =, ? and _ characters
- //TODO using /e (equivalent to eval()) is probably not a good idea
- $encoded = preg_replace('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/e',
- "'='.sprintf('%02X', ord(stripslashes('\\1')))", $encoded);
- break;
- }
-
- // Replace every spaces to _ (more readable than =20)
- $encoded = str_replace(' ', '_', $encoded);
-
- return $encoded;
- }
-
- /**
- * Adds a string or binary attachment (non-filesystem) to the list.
- * This method can be used to attach ascii or binary data,
- * such as a BLOB record from a database.
- * @param string $string String attachment data.
- * @param string $filename Name of the attachment.
- * @param string $encoding File encoding (see $Encoding).
- * @param string $type File extension (MIME) type.
- * @return void
- */
- public function AddStringAttachment($string, $filename, $encoding = 'base64', $type = 'application/octet-stream') {
- // Append to $attachment array
- $this->attachment[] = array(
- 0 => $string,
- 1 => $filename,
- 2 => basename($filename),
- 3 => $encoding,
- 4 => $type,
- 5 => true, // isStringAttachment
- 6 => 'attachment',
- 7 => 0
- );
- }
-
- /**
- * Adds an embedded attachment. This can include images, sounds, and
- * just about any other document. Make sure to set the $type to an
- * image type. For JPEG images use "image/jpeg" and for GIF images
- * use "image/gif".
- * @param string $path Path to the attachment.
- * @param string $cid Content ID of the attachment. Use this to identify
- * the Id for accessing the image in an HTML form.
- * @param string $name Overrides the attachment name.
- * @param string $encoding File encoding (see $Encoding).
- * @param string $type File extension (MIME) type.
- * @return bool
- */
- public function AddEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
-
- if ( !@is_file($path) ) {
- $this->SetError($this->Lang('file_access') . $path);
- return false;
- }
-
- $filename = basename($path);
- if ( $name == '' ) {
- $name = $filename;
- }
-
- // Append to $attachment array
- $this->attachment[] = array(
- 0 => $path,
- 1 => $filename,
- 2 => $name,
- 3 => $encoding,
- 4 => $type,
- 5 => false, // isStringAttachment
- 6 => 'inline',
- 7 => $cid
- );
-
- return true;
- }
-
- public function AddStringEmbeddedImage($string, $cid, $filename = '', $encoding = 'base64', $type = 'application/octet-stream') {
- // Append to $attachment array
- $this->attachment[] = array(
- 0 => $string,
- 1 => $filename,
- 2 => basename($filename),
- 3 => $encoding,
- 4 => $type,
- 5 => true, // isStringAttachment
- 6 => 'inline',
- 7 => $cid
- );
- }
-
- /**
- * Returns true if an inline attachment is present.
- * @access public
- * @return bool
- */
- public function InlineImageExists() {
- foreach($this->attachment as $attachment) {
- if ($attachment[6] == 'inline') {
- return true;
- }
- }
- return false;
- }
-
- public function AttachmentExists() {
- foreach($this->attachment as $attachment) {
- if ($attachment[6] == 'attachment') {
- return true;
- }
- }
- return false;
- }
-
- public function AlternativeExists() {
- return strlen($this->AltBody)>0;
- }
-
- /////////////////////////////////////////////////
- // CLASS METHODS, MESSAGE RESET
- /////////////////////////////////////////////////
-
- /**
- * Clears all recipients assigned in the TO array. Returns void.
- * @return void
- */
- public function ClearAddresses() {
- foreach($this->to as $to) {
- unset($this->all_recipients[strtolower($to[0])]);
- }
- $this->to = array();
- }
-
- /**
- * Clears all recipients assigned in the CC array. Returns void.
- * @return void
- */
- public function ClearCCs() {
- foreach($this->cc as $cc) {
- unset($this->all_recipients[strtolower($cc[0])]);
- }
- $this->cc = array();
- }
-
- /**
- * Clears all recipients assigned in the BCC array. Returns void.
- * @return void
- */
- public function ClearBCCs() {
- foreach($this->bcc as $bcc) {
- unset($this->all_recipients[strtolower($bcc[0])]);
- }
- $this->bcc = array();
- }
-
- /**
- * Clears all recipients assigned in the ReplyTo array. Returns void.
- * @return void
- */
- public function ClearReplyTos() {
- $this->ReplyTo = array();
- }
-
- /**
- * Clears all recipients assigned in the TO, CC and BCC
- * array. Returns void.
- * @return void
- */
- public function ClearAllRecipients() {
- $this->to = array();
- $this->cc = array();
- $this->bcc = array();
- $this->all_recipients = array();
- }
-
- /**
- * Clears all previously set filesystem, string, and binary
- * attachments. Returns void.
- * @return void
- */
- public function ClearAttachments() {
- $this->attachment = array();
- }
-
- /**
- * Clears all custom headers. Returns void.
- * @return void
- */
- public function ClearCustomHeaders() {
- $this->CustomHeader = array();
- }
-
- /////////////////////////////////////////////////
- // CLASS METHODS, MISCELLANEOUS
- /////////////////////////////////////////////////
-
- /**
- * Adds the error message to the error container.
- * @access protected
- * @return void
- */
- protected function SetError($msg) {
- $this->error_count++;
- if ($this->Mailer == 'smtp' and !is_null($this->smtp)) {
- $lasterror = $this->smtp->getError();
- if (!empty($lasterror) and array_key_exists('smtp_msg', $lasterror)) {
- $msg .= '<p>' . $this->Lang('smtp_error') . $lasterror['smtp_msg'] . "</p>\n";
- }
- }
- $this->ErrorInfo = $msg;
- }
-
- /**
- * Returns the proper RFC 822 formatted date.
- * @access public
- * @return string
- * @static
- */
- public static function RFCDate() {
- $tz = date('Z');
- $tzs = ($tz < 0) ? '-' : '+';
- $tz = abs($tz);
- $tz = (int)($tz/3600)*100 + ($tz%3600)/60;
- $result = sprintf("%s %s%04d", date('D, j M Y H:i:s'), $tzs, $tz);
-
- return $result;
- }
-
- /**
- * Returns the server hostname or 'localhost.localdomain' if unknown.
- * @access protected
- * @return string
- */
- protected function ServerHostname() {
- if (!empty($this->Hostname)) {
- $result = $this->Hostname;
- } elseif (isset($_SERVER['SERVER_NAME'])) {
- $result = $_SERVER['SERVER_NAME'];
- } else {
- $result = 'localhost.localdomain';
- }
-
- return $result;
- }
-
- /**
- * Returns a message in the appropriate language.
- * @access protected
- * @return string
- */
- protected function Lang($key) {
- if(count($this->language) < 1) {
- $this->SetLanguage('en'); // set the default language
- }
-
- if(isset($this->language[$key])) {
- return $this->language[$key];
- } else {
- return 'Language string failed to load: ' . $key;
- }
- }
-
- /**
- * Returns true if an error occurred.
- * @access public
- * @return bool
- */
- public function IsError() {
- return ($this->error_count > 0);
- }
-
- /**
- * Changes every end of line from CR or LF to CRLF.
- * @access public
- * @return string
- */
- public function FixEOL($str) {
- $str = str_replace("\r\n", "\n", $str);
- $str = str_replace("\r", "\n", $str);
- $str = str_replace("\n", $this->LE, $str);
- return $str;
- }
-
- /**
- * Adds a custom header.
- * @access public
- * @return void
- */
- public function AddCustomHeader($custom_header) {
- $this->CustomHeader[] = explode(':', $custom_header, 2);
- }
-
- /**
- * Evaluates the message and returns modifications for inline images and backgrounds
- * @access public
- * @return $message
- */
- public function MsgHTML($message, $basedir = '') {
- preg_match_all("/(src|background)=[\"'](.*)[\"']/Ui", $message, $images);
- if(isset($images[2])) {
- foreach($images[2] as $i => $url) {
- // do not change urls for absolute images (thanks to corvuscorax)
- if (!preg_match('#^[A-z]+://#', $url)) {
- $filename = basename($url);
- $directory = dirname($url);
- ($directory == '.') ? $directory='': '';
- $cid = 'cid:' . md5($filename);
- $ext = pathinfo($filename, PATHINFO_EXTENSION);
- $mimeType = self::_mime_types($ext);
- if ( strlen($basedir) > 1 && substr($basedir, -1) != '/') { $basedir .= '/'; }
- if ( strlen($directory) > 1 && substr($directory, -1) != '/') { $directory .= '/'; }
- if ( $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64', $mimeType) ) {
- $message = preg_replace("/".$images[1][$i]."=[\"']".preg_quote($url, '/')."[\"']/Ui", $images[1][$i]."=\"".$cid."\"", $message);
- }
- }
- }
- }
- $this->IsHTML(true);
- $this->Body = $message;
- if (empty($this->AltBody)) {
- $textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s', '', $message)));
- if (!empty($textMsg)) {
- $this->AltBody = html_entity_decode($textMsg, ENT_QUOTES, $this->CharSet);
- }
- }
- if (empty($this->AltBody)) {
- $this->AltBody = 'To view this email message, open it in a program that understands HTML!' . "\n\n";
- }
- return $message;
- }
-
- /**
- * Gets the MIME type of the embedded or inline image
- * @param string File extension
- * @access public
- * @return string MIME type of ext
- * @static
- */
- public static function _mime_types($ext = '') {
- $mimes = array(
- 'hqx' => 'application/mac-binhex40',
- 'cpt' => 'application/mac-compactpro',
- 'doc' => 'application/msword',
- 'bin' => 'application/macbinary',
- 'dms' => 'application/octet-stream',
- 'lha' => 'application/octet-stream',
- 'lzh' => 'application/octet-stream',
- 'exe' => 'application/octet-stream',
- 'class' => 'application/octet-stream',
- 'psd' => 'application/octet-stream',
- 'so' => 'application/octet-stream',
- 'sea' => 'application/octet-stream',
- 'dll' => 'application/octet-stream',
- 'oda' => 'application/oda',
- 'pdf' => 'application/pdf',
- 'ai' => 'application/postscript',
- 'eps' => 'application/postscript',
- 'ps' => 'application/postscript',
- 'smi' => 'application/smil',
- 'smil' => 'application/smil',
- 'mif' => 'application/vnd.mif',
- 'xls' => 'application/vnd.ms-excel',
- 'ppt' => 'application/vnd.ms-powerpoint',
- 'wbxml' => 'application/vnd.wap.wbxml',
- 'wmlc' => 'application/vnd.wap.wmlc',
- 'dcr' => 'application/x-director',
- 'dir' => 'application/x-director',
- 'dxr' => 'application/x-director',
- 'dvi' => 'application/x-dvi',
- 'gtar' => 'application/x-gtar',
- 'php' => 'application/x-httpd-php',
- 'php4' => 'application/x-httpd-php',
- 'php3' => 'application/x-httpd-php',
- 'phtml' => 'application/x-httpd-php',
- 'phps' => 'application/x-httpd-php-source',
- 'js' => 'application/x-javascript',
- 'swf' => 'application/x-shockwave-flash',
- 'sit' => 'application/x-stuffit',
- 'tar' => 'application/x-tar',
- 'tgz' => 'application/x-tar',
- 'xhtml' => 'application/xhtml+xml',
- 'xht' => 'application/xhtml+xml',
- 'zip' => 'application/zip',
- 'mid' => 'audio/midi',
- 'midi' => 'audio/midi',
- 'mpga' => 'audio/mpeg',
- 'mp2' => 'audio/mpeg',
- 'mp3' => 'audio/mpeg',
- 'aif' => 'audio/x-aiff',
- 'aiff' => 'audio/x-aiff',
- 'aifc' => 'audio/x-aiff',
- 'ram' => 'audio/x-pn-realaudio',
- 'rm' => 'audio/x-pn-realaudio',
- 'rpm' => 'audio/x-pn-realaudio-plugin',
- 'ra' => 'audio/x-realaudio',
- 'rv' => 'video/vnd.rn-realvideo',
- 'wav' => 'audio/x-wav',
- 'bmp' => 'image/bmp',
- 'gif' => 'image/gif',
- 'jpeg' => 'image/jpeg',
- 'jpg' => 'image/jpeg',
- 'jpe' => 'image/jpeg',
- 'png' => 'image/png',
- 'tiff' => 'image/tiff',
- 'tif' => 'image/tiff',
- 'css' => 'text/css',
- 'html' => 'text/html',
- 'htm' => 'text/html',
- 'shtml' => 'text/html',
- 'txt' => 'text/plain',
- 'text' => 'text/plain',
- 'log' => 'text/plain',
- 'rtx' => 'text/richtext',
- 'rtf' => 'text/rtf',
- 'xml' => 'text/xml',
- 'xsl' => 'text/xml',
- 'mpeg' => 'video/mpeg',
- 'mpg' => 'video/mpeg',
- 'mpe' => 'video/mpeg',
- 'qt' => 'video/quicktime',
- 'mov' => 'video/quicktime',
- 'avi' => 'video/x-msvideo',
- 'movie' => 'video/x-sgi-movie',
- 'doc' => 'application/msword',
- 'word' => 'application/msword',
- 'xl' => 'application/excel',
- 'eml' => 'message/rfc822'
- );
- return (!isset($mimes[strtolower($ext)])) ? 'application/octet-stream' : $mimes[strtolower($ext)];
- }
-
- /**
- * Set (or reset) Class Objects (variables)
- *
- * Usage Example:
- * $page->set('X-Priority', '3');
- *
- * @access public
- * @param string $name Parameter Name
- * @param mixed $value Parameter Value
- * NOTE: will not work with arrays, there are no arrays to set/reset
- * @todo Should this not be using __set() magic function?
- */
- public function set($name, $value = '') {
- try {
- if (isset($this->$name) ) {
- $this->$name = $value;
- } else {
- throw new phpmailerException($this->Lang('variable_set') . $name, self::STOP_CRITICAL);
- }
- } catch (Exception $e) {
- $this->SetError($e->getMessage());
- if ($e->getCode() == self::STOP_CRITICAL) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Strips newlines to prevent header injection.
- * @access public
- * @param string $str String
- * @return string
- */
- public function SecureHeader($str) {
- $str = str_replace("\r", '', $str);
- $str = str_replace("\n", '', $str);
- return trim($str);
- }
-
- /**
- * Set the private key file and password to sign the message.
- *
- * @access public
- * @param string $key_filename Parameter File Name
- * @param string $key_pass Password for private key
- */
- public function Sign($cert_filename, $key_filename, $key_pass) {
- $this->sign_cert_file = $cert_filename;
- $this->sign_key_file = $key_filename;
- $this->sign_key_pass = $key_pass;
- }
-
- /**
- * Set the private key file and password to sign the message.
- *
- * @access public
- * @param string $key_filename Parameter File Name
- * @param string $key_pass Password for private key
- */
- public function DKIM_QP($txt) {
- $tmp = '';
- $line = '';
- for ($i = 0; $i < strlen($txt); $i++) {
- $ord = ord($txt[$i]);
- if ( ((0x21 <= $ord) && ($ord <= 0x3A)) || $ord == 0x3C || ((0x3E <= $ord) && ($ord <= 0x7E)) ) {
- $line .= $txt[$i];
- } else {
- $line .= "=".sprintf("%02X", $ord);
- }
- }
- return $line;
- }
-
- /**
- * Generate DKIM signature
- *
- * @access public
- * @param string $s Header
- */
- public function DKIM_Sign($s) {
- $privKeyStr = file_get_contents($this->DKIM_private);
- if ($this->DKIM_passphrase != '') {
- $privKey = openssl_pkey_get_private($privKeyStr, $this->DKIM_passphrase);
- } else {
- $privKey = $privKeyStr;
- }
- if (openssl_sign($s, $signature, $privKey)) {
- return base64_encode($signature);
- }
- }
-
- /**
- * Generate DKIM Canonicalization Header
- *
- * @access public
- * @param string $s Header
- */
- public function DKIM_HeaderC($s) {
- $s = preg_replace("/\r\n\s+/", " ", $s);
- $lines = explode("\r\n", $s);
- foreach ($lines as $key => $line) {
- list($heading, $value) = explode(":", $line, 2);
- $heading = strtolower($heading);
- $value = preg_replace("/\s+/", " ", $value) ; // Compress useless spaces
- $lines[$key] = $heading.":".trim($value) ; // Don't forget to remove WSP around the value
- }
- $s = implode("\r\n", $lines);
- return $s;
- }
-
- /**
- * Generate DKIM Canonicalization Body
- *
- * @access public
- * @param string $body Message Body
- */
- public function DKIM_BodyC($body) {
- if ($body == '') return "\r\n";
- // stabilize line endings
- $body = str_replace("\r\n", "\n", $body);
- $body = str_replace("\n", "\r\n", $body);
- // END stabilize line endings
- while (substr($body, strlen($body) - 4, 4) == "\r\n\r\n") {
- $body = substr($body, 0, strlen($body) - 2);
- }
- return $body;
- }
-
- /**
- * Create the DKIM header, body, as new header
- *
- * @access public
- * @param string $headers_line Header lines
- * @param string $subject Subject
- * @param string $body Body
- */
- public function DKIM_Add($headers_line, $subject, $body) {
- $DKIMsignatureType = 'rsa-sha1'; // Signature & hash algorithms
- $DKIMcanonicalization = 'relaxed/simple'; // Canonicalization of header/body
- $DKIMquery = 'dns/txt'; // Query method
- $DKIMtime = time() ; // Signature Timestamp = seconds since 00:00:00 - Jan 1, 1970 (UTC time zone)
- $subject_header = "Subject: $subject";
- $headers = explode($this->LE, $headers_line);
- foreach($headers as $header) {
- if (strpos($header, 'From:') === 0) {
- $from_header = $header;
- } elseif (strpos($header, 'To:') === 0) {
- $to_header = $header;
- }
- }
- $from = str_replace('|', '=7C', $this->DKIM_QP($from_header));
- $to = str_replace('|', '=7C', $this->DKIM_QP($to_header));
- $subject = str_replace('|', '=7C', $this->DKIM_QP($subject_header)) ; // Copied header fields (dkim-quoted-printable
- $body = $this->DKIM_BodyC($body);
- $DKIMlen = strlen($body) ; // Length of body
- $DKIMb64 = base64_encode(pack("H*", sha1($body))) ; // Base64 of packed binary SHA-1 hash of body
- $ident = ($this->DKIM_identity == '')? '' : " i=" . $this->DKIM_identity . ";";
- $dkimhdrs = "DKIM-Signature: v=1; a=" . $DKIMsignatureType . "; q=" . $DKIMquery . "; l=" . $DKIMlen . "; s=" . $this->DKIM_selector . ";\r\n".
- "\tt=" . $DKIMtime . "; c=" . $DKIMcanonicalization . ";\r\n".
- "\th=From:To:Subject;\r\n".
- "\td=" . $this->DKIM_domain . ";" . $ident . "\r\n".
- "\tz=$from\r\n".
- "\t|$to\r\n".
- "\t|$subject;\r\n".
- "\tbh=" . $DKIMb64 . ";\r\n".
- "\tb=";
- $toSign = $this->DKIM_HeaderC($from_header . "\r\n" . $to_header . "\r\n" . $subject_header . "\r\n" . $dkimhdrs);
- $signed = $this->DKIM_Sign($toSign);
- return "X-PHPMAILER-DKIM: phpmailer.worxware.com\r\n".$dkimhdrs.$signed."\r\n";
- }
-
- protected function doCallback($isSent, $to, $cc, $bcc, $subject, $body) {
- if (!empty($this->action_function) && function_exists($this->action_function)) {
- $params = array($isSent, $to, $cc, $bcc, $subject, $body);
- call_user_func_array($this->action_function, $params);
- }
- }
-}
-
-class phpmailerException extends Exception {
- public function errorMessage() {
- $errorMsg = '<strong>' . $this->getMessage() . "</strong><br />\n";
- return $errorMsg;
- }
-}
-?>
diff --git a/3rdparty/class.smtp.php b/3rdparty/class.smtp.php
deleted file mode 100644
index 6977bffad14..00000000000
--- a/3rdparty/class.smtp.php
+++ /dev/null
@@ -1,818 +0,0 @@
-<?php
-/*~ class.smtp.php
-.---------------------------------------------------------------------------.
-| Software: PHPMailer - PHP email class |
-| Version: 5.2.1 |
-| Site: https://code.google.com/a/apache-extras.org/p/phpmailer/ |
-| ------------------------------------------------------------------------- |
-| Admin: Jim Jagielski (project admininistrator) |
-| Authors: Andy Prevost (codeworxtech) codeworxtech@users.sourceforge.net |
-| : Marcus Bointon (coolbru) coolbru@users.sourceforge.net |
-| : Jim Jagielski (jimjag) jimjag@gmail.com |
-| Founder: Brent R. Matzelle (original founder) |
-| Copyright (c) 2010-2012, Jim Jagielski. All Rights Reserved. |
-| Copyright (c) 2004-2009, Andy Prevost. All Rights Reserved. |
-| Copyright (c) 2001-2003, Brent R. Matzelle |
-| ------------------------------------------------------------------------- |
-| License: Distributed under the Lesser General Public License (LGPL) |
-| http://www.gnu.org/copyleft/lesser.html |
-| This program is distributed in the hope that it will be useful - WITHOUT |
-| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
-| FITNESS FOR A PARTICULAR PURPOSE. |
-'---------------------------------------------------------------------------'
-*/
-
-/**
- * PHPMailer - PHP SMTP email transport class
- * NOTE: Designed for use with PHP version 5 and up
- * @package PHPMailer
- * @author Andy Prevost
- * @author Marcus Bointon
- * @copyright 2004 - 2008 Andy Prevost
- * @author Jim Jagielski
- * @copyright 2010 - 2012 Jim Jagielski
- * @license http://www.gnu.org/copyleft/lesser.html Distributed under the Lesser General Public License (LGPL)
- * @version $Id: class.smtp.php 450 2010-06-23 16:46:33Z coolbru $
- */
-
-/**
- * SMTP is rfc 821 compliant and implements all the rfc 821 SMTP
- * commands except TURN which will always return a not implemented
- * error. SMTP also provides some utility methods for sending mail
- * to an SMTP server.
- * original author: Chris Ryan
- */
-
-class SMTP {
- /**
- * SMTP server port
- * @var int
- */
- public $SMTP_PORT = 25;
-
- /**
- * SMTP reply line ending
- * @var string
- */
- public $CRLF = "\r\n";
-
- /**
- * Sets whether debugging is turned on
- * @var bool
- */
- public $do_debug; // the level of debug to perform
-
- /**
- * Sets VERP use on/off (default is off)
- * @var bool
- */
- public $do_verp = false;
-
- /**
- * Sets the SMTP PHPMailer Version number
- * @var string
- */
- public $Version = '5.2.1';
-
- /////////////////////////////////////////////////
- // PROPERTIES, PRIVATE AND PROTECTED
- /////////////////////////////////////////////////
-
- private $smtp_conn; // the socket to the server
- private $error; // error if any on the last call
- private $helo_rply; // the reply the server sent to us for HELO
-
- /**
- * Initialize the class so that the data is in a known state.
- * @access public
- * @return void
- */
- public function __construct() {
- $this->smtp_conn = 0;
- $this->error = null;
- $this->helo_rply = null;
-
- $this->do_debug = 0;
- }
-
- /////////////////////////////////////////////////
- // CONNECTION FUNCTIONS
- /////////////////////////////////////////////////
-
- /**
- * Connect to the server specified on the port specified.
- * If the port is not specified use the default SMTP_PORT.
- * If tval is specified then a connection will try and be
- * established with the server for that number of seconds.
- * If tval is not specified the default is 30 seconds to
- * try on the connection.
- *
- * SMTP CODE SUCCESS: 220
- * SMTP CODE FAILURE: 421
- * @access public
- * @return bool
- */
- public function Connect($host, $port = 0, $tval = 30) {
- // set the error val to null so there is no confusion
- $this->error = null;
-
- // make sure we are __not__ connected
- if($this->connected()) {
- // already connected, generate error
- $this->error = array("error" => "Already connected to a server");
- return false;
- }
-
- if(empty($port)) {
- $port = $this->SMTP_PORT;
- }
-
- // connect to the smtp server
- $this->smtp_conn = @fsockopen($host, // the host of the server
- $port, // the port to use
- $errno, // error number if any
- $errstr, // error message if any
- $tval); // give up after ? secs
- // verify we connected properly
- if(empty($this->smtp_conn)) {
- $this->error = array("error" => "Failed to connect to server",
- "errno" => $errno,
- "errstr" => $errstr);
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] . ": $errstr ($errno)" . $this->CRLF . '<br />';
- }
- return false;
- }
-
- // SMTP server can take longer to respond, give longer timeout for first read
- // Windows does not have support for this timeout function
- if(substr(PHP_OS, 0, 3) != "WIN")
- socket_set_timeout($this->smtp_conn, $tval, 0);
-
- // get any announcement
- $announce = $this->get_lines();
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $announce . $this->CRLF . '<br />';
- }
-
- return true;
- }
-
- /**
- * Initiate a TLS communication with the server.
- *
- * SMTP CODE 220 Ready to start TLS
- * SMTP CODE 501 Syntax error (no parameters allowed)
- * SMTP CODE 454 TLS not available due to temporary reason
- * @access public
- * @return bool success
- */
- public function StartTLS() {
- $this->error = null; # to avoid confusion
-
- if(!$this->connected()) {
- $this->error = array("error" => "Called StartTLS() without being connected");
- return false;
- }
-
- fputs($this->smtp_conn,"STARTTLS" . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
- }
-
- if($code != 220) {
- $this->error =
- array("error" => "STARTTLS not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
- }
- return false;
- }
-
- // Begin encrypted connection
- if(!stream_socket_enable_crypto($this->smtp_conn, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) {
- return false;
- }
-
- return true;
- }
-
- /**
- * Performs SMTP authentication. Must be run after running the
- * Hello() method. Returns true if successfully authenticated.
- * @access public
- * @return bool
- */
- public function Authenticate($username, $password) {
- // Start authentication
- fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($code != 334) {
- $this->error =
- array("error" => "AUTH not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
- }
- return false;
- }
-
- // Send encoded username
- fputs($this->smtp_conn, base64_encode($username) . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($code != 334) {
- $this->error =
- array("error" => "Username not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
- }
- return false;
- }
-
- // Send encoded password
- fputs($this->smtp_conn, base64_encode($password) . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($code != 235) {
- $this->error =
- array("error" => "Password not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
- }
- return false;
- }
-
- return true;
- }
-
- /**
- * Returns true if connected to a server otherwise false
- * @access public
- * @return bool
- */
- public function Connected() {
- if(!empty($this->smtp_conn)) {
- $sock_status = socket_get_status($this->smtp_conn);
- if($sock_status["eof"]) {
- // the socket is valid but we are not connected
- if($this->do_debug >= 1) {
- echo "SMTP -> NOTICE:" . $this->CRLF . "EOF caught while checking if connected";
- }
- $this->Close();
- return false;
- }
- return true; // everything looks good
- }
- return false;
- }
-
- /**
- * Closes the socket and cleans up the state of the class.
- * It is not considered good to use this function without
- * first trying to use QUIT.
- * @access public
- * @return void
- */
- public function Close() {
- $this->error = null; // so there is no confusion
- $this->helo_rply = null;
- if(!empty($this->smtp_conn)) {
- // close the connection and cleanup
- fclose($this->smtp_conn);
- $this->smtp_conn = 0;
- }
- }
-
- /////////////////////////////////////////////////
- // SMTP COMMANDS
- /////////////////////////////////////////////////
-
- /**
- * Issues a data command and sends the msg_data to the server
- * finializing the mail transaction. $msg_data is the message
- * that is to be send with the headers. Each header needs to be
- * on a single line followed by a <CRLF> with the message headers
- * and the message body being seperated by and additional <CRLF>.
- *
- * Implements rfc 821: DATA <CRLF>
- *
- * SMTP CODE INTERMEDIATE: 354
- * [data]
- * <CRLF>.<CRLF>
- * SMTP CODE SUCCESS: 250
- * SMTP CODE FAILURE: 552,554,451,452
- * SMTP CODE FAILURE: 451,554
- * SMTP CODE ERROR : 500,501,503,421
- * @access public
- * @return bool
- */
- public function Data($msg_data) {
- $this->error = null; // so no confusion is caused
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called Data() without being connected");
- return false;
- }
-
- fputs($this->smtp_conn,"DATA" . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
- }
-
- if($code != 354) {
- $this->error =
- array("error" => "DATA command not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
- }
- return false;
- }
-
- /* the server is ready to accept data!
- * according to rfc 821 we should not send more than 1000
- * including the CRLF
- * characters on a single line so we will break the data up
- * into lines by \r and/or \n then if needed we will break
- * each of those into smaller lines to fit within the limit.
- * in addition we will be looking for lines that start with
- * a period '.' and append and additional period '.' to that
- * line. NOTE: this does not count towards limit.
- */
-
- // normalize the line breaks so we know the explode works
- $msg_data = str_replace("\r\n","\n",$msg_data);
- $msg_data = str_replace("\r","\n",$msg_data);
- $lines = explode("\n",$msg_data);
-
- /* we need to find a good way to determine is headers are
- * in the msg_data or if it is a straight msg body
- * currently I am assuming rfc 822 definitions of msg headers
- * and if the first field of the first line (':' sperated)
- * does not contain a space then it _should_ be a header
- * and we can process all lines before a blank "" line as
- * headers.
- */
-
- $field = substr($lines[0],0,strpos($lines[0],":"));
- $in_headers = false;
- if(!empty($field) && !strstr($field," ")) {
- $in_headers = true;
- }
-
- $max_line_length = 998; // used below; set here for ease in change
-
- while(list(,$line) = @each($lines)) {
- $lines_out = null;
- if($line == "" && $in_headers) {
- $in_headers = false;
- }
- // ok we need to break this line up into several smaller lines
- while(strlen($line) > $max_line_length) {
- $pos = strrpos(substr($line,0,$max_line_length)," ");
-
- // Patch to fix DOS attack
- if(!$pos) {
- $pos = $max_line_length - 1;
- $lines_out[] = substr($line,0,$pos);
- $line = substr($line,$pos);
- } else {
- $lines_out[] = substr($line,0,$pos);
- $line = substr($line,$pos + 1);
- }
-
- /* if processing headers add a LWSP-char to the front of new line
- * rfc 822 on long msg headers
- */
- if($in_headers) {
- $line = "\t" . $line;
- }
- }
- $lines_out[] = $line;
-
- // send the lines to the server
- while(list(,$line_out) = @each($lines_out)) {
- if(strlen($line_out) > 0)
- {
- if(substr($line_out, 0, 1) == ".") {
- $line_out = "." . $line_out;
- }
- }
- fputs($this->smtp_conn,$line_out . $this->CRLF);
- }
- }
-
- // message data has been sent
- fputs($this->smtp_conn, $this->CRLF . "." . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
- }
-
- if($code != 250) {
- $this->error =
- array("error" => "DATA not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
- }
- return false;
- }
- return true;
- }
-
- /**
- * Sends the HELO command to the smtp server.
- * This makes sure that we and the server are in
- * the same known state.
- *
- * Implements from rfc 821: HELO <SP> <domain> <CRLF>
- *
- * SMTP CODE SUCCESS: 250
- * SMTP CODE ERROR : 500, 501, 504, 421
- * @access public
- * @return bool
- */
- public function Hello($host = '') {
- $this->error = null; // so no confusion is caused
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called Hello() without being connected");
- return false;
- }
-
- // if hostname for HELO was not specified send default
- if(empty($host)) {
- // determine appropriate default to send to server
- $host = "localhost";
- }
-
- // Send extended hello first (RFC 2821)
- if(!$this->SendHello("EHLO", $host)) {
- if(!$this->SendHello("HELO", $host)) {
- return false;
- }
- }
-
- return true;
- }
-
- /**
- * Sends a HELO/EHLO command.
- * @access private
- * @return bool
- */
- private function SendHello($hello, $host) {
- fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER: " . $rply . $this->CRLF . '<br />';
- }
-
- if($code != 250) {
- $this->error =
- array("error" => $hello . " not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
- }
- return false;
- }
-
- $this->helo_rply = $rply;
-
- return true;
- }
-
- /**
- * Starts a mail transaction from the email address specified in
- * $from. Returns true if successful or false otherwise. If True
- * the mail transaction is started and then one or more Recipient
- * commands may be called followed by a Data command.
- *
- * Implements rfc 821: MAIL <SP> FROM:<reverse-path> <CRLF>
- *
- * SMTP CODE SUCCESS: 250
- * SMTP CODE SUCCESS: 552,451,452
- * SMTP CODE SUCCESS: 500,501,421
- * @access public
- * @return bool
- */
- public function Mail($from) {
- $this->error = null; // so no confusion is caused
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called Mail() without being connected");
- return false;
- }
-
- $useVerp = ($this->do_verp ? "XVERP" : "");
- fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $useVerp . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
- }
-
- if($code != 250) {
- $this->error =
- array("error" => "MAIL not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
- }
- return false;
- }
- return true;
- }
-
- /**
- * Sends the quit command to the server and then closes the socket
- * if there is no error or the $close_on_error argument is true.
- *
- * Implements from rfc 821: QUIT <CRLF>
- *
- * SMTP CODE SUCCESS: 221
- * SMTP CODE ERROR : 500
- * @access public
- * @return bool
- */
- public function Quit($close_on_error = true) {
- $this->error = null; // so there is no confusion
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called Quit() without being connected");
- return false;
- }
-
- // send the quit command to the server
- fputs($this->smtp_conn,"quit" . $this->CRLF);
-
- // get any good-bye messages
- $byemsg = $this->get_lines();
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $byemsg . $this->CRLF . '<br />';
- }
-
- $rval = true;
- $e = null;
-
- $code = substr($byemsg,0,3);
- if($code != 221) {
- // use e as a tmp var cause Close will overwrite $this->error
- $e = array("error" => "SMTP server rejected quit command",
- "smtp_code" => $code,
- "smtp_rply" => substr($byemsg,4));
- $rval = false;
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $e["error"] . ": " . $byemsg . $this->CRLF . '<br />';
- }
- }
-
- if(empty($e) || $close_on_error) {
- $this->Close();
- }
-
- return $rval;
- }
-
- /**
- * Sends the command RCPT to the SMTP server with the TO: argument of $to.
- * Returns true if the recipient was accepted false if it was rejected.
- *
- * Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF>
- *
- * SMTP CODE SUCCESS: 250,251
- * SMTP CODE FAILURE: 550,551,552,553,450,451,452
- * SMTP CODE ERROR : 500,501,503,421
- * @access public
- * @return bool
- */
- public function Recipient($to) {
- $this->error = null; // so no confusion is caused
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called Recipient() without being connected");
- return false;
- }
-
- fputs($this->smtp_conn,"RCPT TO:<" . $to . ">" . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
- }
-
- if($code != 250 && $code != 251) {
- $this->error =
- array("error" => "RCPT not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
- }
- return false;
- }
- return true;
- }
-
- /**
- * Sends the RSET command to abort and transaction that is
- * currently in progress. Returns true if successful false
- * otherwise.
- *
- * Implements rfc 821: RSET <CRLF>
- *
- * SMTP CODE SUCCESS: 250
- * SMTP CODE ERROR : 500,501,504,421
- * @access public
- * @return bool
- */
- public function Reset() {
- $this->error = null; // so no confusion is caused
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called Reset() without being connected");
- return false;
- }
-
- fputs($this->smtp_conn,"RSET" . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
- }
-
- if($code != 250) {
- $this->error =
- array("error" => "RSET failed",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
- }
- return false;
- }
-
- return true;
- }
-
- /**
- * Starts a mail transaction from the email address specified in
- * $from. Returns true if successful or false otherwise. If True
- * the mail transaction is started and then one or more Recipient
- * commands may be called followed by a Data command. This command
- * will send the message to the users terminal if they are logged
- * in and send them an email.
- *
- * Implements rfc 821: SAML <SP> FROM:<reverse-path> <CRLF>
- *
- * SMTP CODE SUCCESS: 250
- * SMTP CODE SUCCESS: 552,451,452
- * SMTP CODE SUCCESS: 500,501,502,421
- * @access public
- * @return bool
- */
- public function SendAndMail($from) {
- $this->error = null; // so no confusion is caused
-
- if(!$this->connected()) {
- $this->error = array(
- "error" => "Called SendAndMail() without being connected");
- return false;
- }
-
- fputs($this->smtp_conn,"SAML FROM:" . $from . $this->CRLF);
-
- $rply = $this->get_lines();
- $code = substr($rply,0,3);
-
- if($this->do_debug >= 2) {
- echo "SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />';
- }
-
- if($code != 250) {
- $this->error =
- array("error" => "SAML not accepted from server",
- "smtp_code" => $code,
- "smtp_msg" => substr($rply,4));
- if($this->do_debug >= 1) {
- echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />';
- }
- return false;
- }
- return true;
- }
-
- /**
- * This is an optional command for SMTP that this class does not
- * support. This method is here to make the RFC821 Definition
- * complete for this class and __may__ be implimented in the future
- *
- * Implements from rfc 821: TURN <CRLF>
- *
- * SMTP CODE SUCCESS: 250
- * SMTP CODE FAILURE: 502
- * SMTP CODE ERROR : 500, 503
- * @access public
- * @return bool
- */
- public function Turn() {
- $this->error = array("error" => "This method, TURN, of the SMTP ".
- "is not implemented");
- if($this->do_debug >= 1) {
- echo "SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF . '<br />';
- }
- return false;
- }
-
- /**
- * Get the current error
- * @access public
- * @return array
- */
- public function getError() {
- return $this->error;
- }
-
- /////////////////////////////////////////////////
- // INTERNAL FUNCTIONS
- /////////////////////////////////////////////////
-
- /**
- * Read in as many lines as possible
- * either before eof or socket timeout occurs on the operation.
- * With SMTP we can tell if we have more lines to read if the
- * 4th character is '-' symbol. If it is a space then we don't
- * need to read anything else.
- * @access private
- * @return string
- */
- private function get_lines() {
- $data = "";
- while(!feof($this->smtp_conn)) {
- $str = @fgets($this->smtp_conn,515);
- if($this->do_debug >= 4) {
- echo "SMTP -> get_lines(): \$data was \"$data\"" . $this->CRLF . '<br />';
- echo "SMTP -> get_lines(): \$str is \"$str\"" . $this->CRLF . '<br />';
- }
- $data .= $str;
- if($this->do_debug >= 4) {
- echo "SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF . '<br />';
- }
- // if 4th character is a space, we are done reading, break the loop
- if(substr($str,3,1) == " ") { break; }
- }
- return $data;
- }
-
-}
-
-?>
diff --git a/3rdparty/css/chosen-sprite.png b/3rdparty/css/chosen-sprite.png
deleted file mode 100755
index 113dc9885a6..00000000000
--- a/3rdparty/css/chosen-sprite.png
+++ /dev/null
Binary files differ
diff --git a/3rdparty/css/chosen.css b/3rdparty/css/chosen.css
deleted file mode 100755
index 89b5970e57c..00000000000
--- a/3rdparty/css/chosen.css
+++ /dev/null
@@ -1,392 +0,0 @@
-/* @group Base */
-.chzn-container {
- font-size: 13px;
- position: relative;
- display: inline-block;
- zoom: 1;
- *display: inline;
-}
-.chzn-container .chzn-drop {
- background: #fff;
- border: 1px solid #aaa;
- border-top: 0;
- position: absolute;
- top: 29px;
- left: 0;
- -webkit-box-shadow: 0 4px 5px rgba(0,0,0,.15);
- -moz-box-shadow : 0 4px 5px rgba(0,0,0,.15);
- -o-box-shadow : 0 4px 5px rgba(0,0,0,.15);
- box-shadow : 0 4px 5px rgba(0,0,0,.15);
- z-index: 999;
-}
-/* @end */
-
-/* @group Single Chosen */
-.chzn-container-single .chzn-single {
- background-color: #ffffff;
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0 );
- background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #ffffff), color-stop(50%, #f6f6f6), color-stop(52%, #eeeeee), color-stop(100%, #f4f4f4));
- background-image: -webkit-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
- background-image: -moz-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
- background-image: -o-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
- background-image: -ms-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
- background-image: linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
- -webkit-border-radius: 5px;
- -moz-border-radius : 5px;
- border-radius : 5px;
- -moz-background-clip : padding;
- -webkit-background-clip: padding-box;
- background-clip : padding-box;
- border: 1px solid #aaaaaa;
- -webkit-box-shadow: 0 0 3px #ffffff inset, 0 1px 1px rgba(0,0,0,0.1);
- -moz-box-shadow : 0 0 3px #ffffff inset, 0 1px 1px rgba(0,0,0,0.1);
- box-shadow : 0 0 3px #ffffff inset, 0 1px 1px rgba(0,0,0,0.1);
- display: block;
- overflow: hidden;
- white-space: nowrap;
- position: relative;
- height: 23px;
- line-height: 24px;
- padding: 0 0 0 8px;
- color: #444444;
- text-decoration: none;
-}
-.chzn-container-single .chzn-default {
- color: #999;
-}
-.chzn-container-single .chzn-single span {
- margin-right: 26px;
- display: block;
- overflow: hidden;
- white-space: nowrap;
- -o-text-overflow: ellipsis;
- -ms-text-overflow: ellipsis;
- text-overflow: ellipsis;
-}
-.chzn-container-single .chzn-single abbr {
- display: block;
- position: absolute;
- right: 26px;
- top: 6px;
- width: 12px;
- height: 13px;
- font-size: 1px;
- background: url(chosen-sprite.png) right top no-repeat;
-}
-.chzn-container-single .chzn-single abbr:hover {
- background-position: right -11px;
-}
-.chzn-container-single .chzn-single div {
- position: absolute;
- right: 0;
- top: 0;
- display: block;
- height: 100%;
- width: 18px;
-}
-.chzn-container-single .chzn-single div b {
- background: url('chosen-sprite.png') no-repeat 0 0;
- display: block;
- width: 100%;
- height: 100%;
-}
-.chzn-container-single .chzn-search {
- padding: 3px 4px;
- position: relative;
- margin: 0;
- white-space: nowrap;
- z-index: 1010;
-}
-.chzn-container-single .chzn-search input {
- background: #fff url('chosen-sprite.png') no-repeat 100% -22px;
- background: url('chosen-sprite.png') no-repeat 100% -22px, -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
- background: url('chosen-sprite.png') no-repeat 100% -22px, -webkit-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- background: url('chosen-sprite.png') no-repeat 100% -22px, -moz-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- background: url('chosen-sprite.png') no-repeat 100% -22px, -o-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- background: url('chosen-sprite.png') no-repeat 100% -22px, -ms-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- background: url('chosen-sprite.png') no-repeat 100% -22px, linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- margin: 1px 0;
- padding: 4px 20px 4px 5px;
- outline: 0;
- border: 1px solid #aaa;
- font-family: sans-serif;
- font-size: 1em;
-}
-.chzn-container-single .chzn-drop {
- -webkit-border-radius: 0 0 4px 4px;
- -moz-border-radius : 0 0 4px 4px;
- border-radius : 0 0 4px 4px;
- -moz-background-clip : padding;
- -webkit-background-clip: padding-box;
- background-clip : padding-box;
-}
-/* @end */
-
-.chzn-container-single-nosearch .chzn-search input {
- position: absolute;
- left: -9000px;
-}
-
-/* @group Multi Chosen */
-.chzn-container-multi .chzn-choices {
- background-color: #fff;
- background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
- background-image: -webkit-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- background-image: -moz-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- background-image: -o-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- background-image: -ms-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- background-image: linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- border: 1px solid #aaa;
- margin: 0;
- padding: 0;
- cursor: text;
- overflow: hidden;
- height: auto !important;
- height: 1%;
- position: relative;
-}
-.chzn-container-multi .chzn-choices li {
- float: left;
- list-style: none;
-}
-.chzn-container-multi .chzn-choices .search-field {
- white-space: nowrap;
- margin: 0;
- padding: 0;
-}
-.chzn-container-multi .chzn-choices .search-field input {
- color: #666;
- background: transparent !important;
- border: 0 !important;
- font-family: sans-serif;
- font-size: 100%;
- height: 15px;
- padding: 5px;
- margin: 1px 0;
- outline: 0;
- -webkit-box-shadow: none;
- -moz-box-shadow : none;
- -o-box-shadow : none;
- box-shadow : none;
-}
-.chzn-container-multi .chzn-choices .search-field .default {
- color: #999;
-}
-.chzn-container-multi .chzn-choices .search-choice {
- -webkit-border-radius: 3px;
- -moz-border-radius : 3px;
- border-radius : 3px;
- -moz-background-clip : padding;
- -webkit-background-clip: padding-box;
- background-clip : padding-box;
- background-color: #e4e4e4;
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f4f4f4', endColorstr='#eeeeee', GradientType=0 );
- background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
- background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
- background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
- background-image: -o-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
- background-image: -ms-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
- background-image: linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
- -webkit-box-shadow: 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05);
- -moz-box-shadow : 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05);
- box-shadow : 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05);
- color: #333;
- border: 1px solid #aaaaaa;
- line-height: 13px;
- padding: 3px 20px 3px 5px;
- margin: 3px 0 3px 5px;
- position: relative;
- cursor: default;
-}
-.chzn-container-multi .chzn-choices .search-choice-focus {
- background: #d4d4d4;
-}
-.chzn-container-multi .chzn-choices .search-choice .search-choice-close {
- display: block;
- position: absolute;
- right: 3px;
- top: 4px;
- width: 12px;
- height: 13px;
- font-size: 1px;
- background: url(chosen-sprite.png) right top no-repeat;
-}
-.chzn-container-multi .chzn-choices .search-choice .search-choice-close:hover {
- background-position: right -11px;
-}
-.chzn-container-multi .chzn-choices .search-choice-focus .search-choice-close {
- background-position: right -11px;
-}
-/* @end */
-
-/* @group Results */
-.chzn-container .chzn-results {
- margin: 0 4px 4px 0;
- max-height: 240px;
- padding: 0 0 0 4px;
- position: relative;
- overflow-x: hidden;
- overflow-y: auto;
-}
-.chzn-container-multi .chzn-results {
- margin: -1px 0 0;
- padding: 0;
-}
-.chzn-container .chzn-results li {
- display: none;
- line-height: 15px;
- padding: 5px 6px;
- margin: 0;
- list-style: none;
-}
-.chzn-container .chzn-results .active-result {
- cursor: pointer;
- display: list-item;
-}
-.chzn-container .chzn-results .highlighted {
- background-color: #3875d7;
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#3875d7', endColorstr='#2a62bc', GradientType=0 );
- background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #3875d7), color-stop(90%, #2a62bc));
- background-image: -webkit-linear-gradient(top, #3875d7 20%, #2a62bc 90%);
- background-image: -moz-linear-gradient(top, #3875d7 20%, #2a62bc 90%);
- background-image: -o-linear-gradient(top, #3875d7 20%, #2a62bc 90%);
- background-image: -ms-linear-gradient(top, #3875d7 20%, #2a62bc 90%);
- background-image: linear-gradient(top, #3875d7 20%, #2a62bc 90%);
- color: #fff;
-}
-.chzn-container .chzn-results li em {
- background: #feffde;
- font-style: normal;
-}
-.chzn-container .chzn-results .highlighted em {
- background: transparent;
-}
-.chzn-container .chzn-results .no-results {
- background: #f4f4f4;
- display: list-item;
-}
-.chzn-container .chzn-results .group-result {
- cursor: default;
- color: #999;
- font-weight: bold;
-}
-.chzn-container .chzn-results .group-option {
- padding-left: 15px;
-}
-.chzn-container-multi .chzn-drop .result-selected {
- display: none;
-}
-.chzn-container .chzn-results-scroll {
- background: white;
- margin: 0 4px;
- position: absolute;
- text-align: center;
- width: 321px; /* This should by dynamic with js */
- z-index: 1;
-}
-.chzn-container .chzn-results-scroll span {
- display: inline-block;
- height: 17px;
- text-indent: -5000px;
- width: 9px;
-}
-.chzn-container .chzn-results-scroll-down {
- bottom: 0;
-}
-.chzn-container .chzn-results-scroll-down span {
- background: url('chosen-sprite.png') no-repeat -4px -3px;
-}
-.chzn-container .chzn-results-scroll-up span {
- background: url('chosen-sprite.png') no-repeat -22px -3px;
-}
-/* @end */
-
-/* @group Active */
-.chzn-container-active .chzn-single {
- -webkit-box-shadow: 0 0 5px rgba(0,0,0,.3);
- -moz-box-shadow : 0 0 5px rgba(0,0,0,.3);
- -o-box-shadow : 0 0 5px rgba(0,0,0,.3);
- box-shadow : 0 0 5px rgba(0,0,0,.3);
- border: 1px solid #5897fb;
-}
-.chzn-container-active .chzn-single-with-drop {
- border: 1px solid #aaa;
- -webkit-box-shadow: 0 1px 0 #fff inset;
- -moz-box-shadow : 0 1px 0 #fff inset;
- -o-box-shadow : 0 1px 0 #fff inset;
- box-shadow : 0 1px 0 #fff inset;
- background-color: #eee;
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#ffffff', GradientType=0 );
- background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #eeeeee), color-stop(80%, #ffffff));
- background-image: -webkit-linear-gradient(top, #eeeeee 20%, #ffffff 80%);
- background-image: -moz-linear-gradient(top, #eeeeee 20%, #ffffff 80%);
- background-image: -o-linear-gradient(top, #eeeeee 20%, #ffffff 80%);
- background-image: -ms-linear-gradient(top, #eeeeee 20%, #ffffff 80%);
- background-image: linear-gradient(top, #eeeeee 20%, #ffffff 80%);
- -webkit-border-bottom-left-radius : 0;
- -webkit-border-bottom-right-radius: 0;
- -moz-border-radius-bottomleft : 0;
- -moz-border-radius-bottomright: 0;
- border-bottom-left-radius : 0;
- border-bottom-right-radius: 0;
-}
-.chzn-container-active .chzn-single-with-drop div {
- background: transparent;
- border-left: none;
-}
-.chzn-container-active .chzn-single-with-drop div b {
- background-position: -18px 1px;
-}
-.chzn-container-active .chzn-choices {
- -webkit-box-shadow: 0 0 5px rgba(0,0,0,.3);
- -moz-box-shadow : 0 0 5px rgba(0,0,0,.3);
- -o-box-shadow : 0 0 5px rgba(0,0,0,.3);
- box-shadow : 0 0 5px rgba(0,0,0,.3);
- border: 1px solid #5897fb;
-}
-.chzn-container-active .chzn-choices .search-field input {
- color: #111 !important;
-}
-/* @end */
-
-/* @group Disabled Support */
-.chzn-disabled {
- cursor: default;
- opacity:0.5 !important;
-}
-.chzn-disabled .chzn-single {
- cursor: default;
-}
-.chzn-disabled .chzn-choices .search-choice .search-choice-close {
- cursor: default;
-}
-
-/* @group Right to Left */
-.chzn-rtl { text-align: right; }
-.chzn-rtl .chzn-single { padding: 0 8px 0 0; overflow: visible; }
-.chzn-rtl .chzn-single span { margin-left: 26px; margin-right: 0; direction: rtl; }
-
-.chzn-rtl .chzn-single div { left: 3px; right: auto; }
-.chzn-rtl .chzn-single abbr {
- left: 26px;
- right: auto;
-}
-.chzn-rtl .chzn-choices .search-field input { direction: rtl; }
-.chzn-rtl .chzn-choices li { float: right; }
-.chzn-rtl .chzn-choices .search-choice { padding: 3px 5px 3px 19px; margin: 3px 5px 3px 0; }
-.chzn-rtl .chzn-choices .search-choice .search-choice-close { left: 4px; right: auto; background-position: right top;}
-.chzn-rtl.chzn-container-single .chzn-results { margin: 0 0 4px 4px; padding: 0 4px 0 0; }
-.chzn-rtl .chzn-results .group-option { padding-left: 0; padding-right: 15px; }
-.chzn-rtl.chzn-container-active .chzn-single-with-drop div { border-right: none; }
-.chzn-rtl .chzn-search input {
- background: #fff url('chosen-sprite.png') no-repeat -38px -22px;
- background: url('chosen-sprite.png') no-repeat -38px -22px, -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
- background: url('chosen-sprite.png') no-repeat -38px -22px, -webkit-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- background: url('chosen-sprite.png') no-repeat -38px -22px, -moz-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- background: url('chosen-sprite.png') no-repeat -38px -22px, -o-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- background: url('chosen-sprite.png') no-repeat -38px -22px, -ms-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- background: url('chosen-sprite.png') no-repeat -38px -22px, linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- padding: 4px 5px 4px 20px;
- direction: rtl;
-}
-/* @end */
diff --git a/3rdparty/css/chosen/chosen-sprite.png b/3rdparty/css/chosen/chosen-sprite.png
deleted file mode 100644
index 9edce05a6a8..00000000000
--- a/3rdparty/css/chosen/chosen-sprite.png
+++ /dev/null
Binary files differ
diff --git a/3rdparty/css/chosen/chosen.css b/3rdparty/css/chosen/chosen.css
deleted file mode 100755
index 89b5970e57c..00000000000
--- a/3rdparty/css/chosen/chosen.css
+++ /dev/null
@@ -1,392 +0,0 @@
-/* @group Base */
-.chzn-container {
- font-size: 13px;
- position: relative;
- display: inline-block;
- zoom: 1;
- *display: inline;
-}
-.chzn-container .chzn-drop {
- background: #fff;
- border: 1px solid #aaa;
- border-top: 0;
- position: absolute;
- top: 29px;
- left: 0;
- -webkit-box-shadow: 0 4px 5px rgba(0,0,0,.15);
- -moz-box-shadow : 0 4px 5px rgba(0,0,0,.15);
- -o-box-shadow : 0 4px 5px rgba(0,0,0,.15);
- box-shadow : 0 4px 5px rgba(0,0,0,.15);
- z-index: 999;
-}
-/* @end */
-
-/* @group Single Chosen */
-.chzn-container-single .chzn-single {
- background-color: #ffffff;
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0 );
- background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #ffffff), color-stop(50%, #f6f6f6), color-stop(52%, #eeeeee), color-stop(100%, #f4f4f4));
- background-image: -webkit-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
- background-image: -moz-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
- background-image: -o-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
- background-image: -ms-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
- background-image: linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
- -webkit-border-radius: 5px;
- -moz-border-radius : 5px;
- border-radius : 5px;
- -moz-background-clip : padding;
- -webkit-background-clip: padding-box;
- background-clip : padding-box;
- border: 1px solid #aaaaaa;
- -webkit-box-shadow: 0 0 3px #ffffff inset, 0 1px 1px rgba(0,0,0,0.1);
- -moz-box-shadow : 0 0 3px #ffffff inset, 0 1px 1px rgba(0,0,0,0.1);
- box-shadow : 0 0 3px #ffffff inset, 0 1px 1px rgba(0,0,0,0.1);
- display: block;
- overflow: hidden;
- white-space: nowrap;
- position: relative;
- height: 23px;
- line-height: 24px;
- padding: 0 0 0 8px;
- color: #444444;
- text-decoration: none;
-}
-.chzn-container-single .chzn-default {
- color: #999;
-}
-.chzn-container-single .chzn-single span {
- margin-right: 26px;
- display: block;
- overflow: hidden;
- white-space: nowrap;
- -o-text-overflow: ellipsis;
- -ms-text-overflow: ellipsis;
- text-overflow: ellipsis;
-}
-.chzn-container-single .chzn-single abbr {
- display: block;
- position: absolute;
- right: 26px;
- top: 6px;
- width: 12px;
- height: 13px;
- font-size: 1px;
- background: url(chosen-sprite.png) right top no-repeat;
-}
-.chzn-container-single .chzn-single abbr:hover {
- background-position: right -11px;
-}
-.chzn-container-single .chzn-single div {
- position: absolute;
- right: 0;
- top: 0;
- display: block;
- height: 100%;
- width: 18px;
-}
-.chzn-container-single .chzn-single div b {
- background: url('chosen-sprite.png') no-repeat 0 0;
- display: block;
- width: 100%;
- height: 100%;
-}
-.chzn-container-single .chzn-search {
- padding: 3px 4px;
- position: relative;
- margin: 0;
- white-space: nowrap;
- z-index: 1010;
-}
-.chzn-container-single .chzn-search input {
- background: #fff url('chosen-sprite.png') no-repeat 100% -22px;
- background: url('chosen-sprite.png') no-repeat 100% -22px, -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
- background: url('chosen-sprite.png') no-repeat 100% -22px, -webkit-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- background: url('chosen-sprite.png') no-repeat 100% -22px, -moz-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- background: url('chosen-sprite.png') no-repeat 100% -22px, -o-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- background: url('chosen-sprite.png') no-repeat 100% -22px, -ms-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- background: url('chosen-sprite.png') no-repeat 100% -22px, linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- margin: 1px 0;
- padding: 4px 20px 4px 5px;
- outline: 0;
- border: 1px solid #aaa;
- font-family: sans-serif;
- font-size: 1em;
-}
-.chzn-container-single .chzn-drop {
- -webkit-border-radius: 0 0 4px 4px;
- -moz-border-radius : 0 0 4px 4px;
- border-radius : 0 0 4px 4px;
- -moz-background-clip : padding;
- -webkit-background-clip: padding-box;
- background-clip : padding-box;
-}
-/* @end */
-
-.chzn-container-single-nosearch .chzn-search input {
- position: absolute;
- left: -9000px;
-}
-
-/* @group Multi Chosen */
-.chzn-container-multi .chzn-choices {
- background-color: #fff;
- background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
- background-image: -webkit-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- background-image: -moz-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- background-image: -o-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- background-image: -ms-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- background-image: linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- border: 1px solid #aaa;
- margin: 0;
- padding: 0;
- cursor: text;
- overflow: hidden;
- height: auto !important;
- height: 1%;
- position: relative;
-}
-.chzn-container-multi .chzn-choices li {
- float: left;
- list-style: none;
-}
-.chzn-container-multi .chzn-choices .search-field {
- white-space: nowrap;
- margin: 0;
- padding: 0;
-}
-.chzn-container-multi .chzn-choices .search-field input {
- color: #666;
- background: transparent !important;
- border: 0 !important;
- font-family: sans-serif;
- font-size: 100%;
- height: 15px;
- padding: 5px;
- margin: 1px 0;
- outline: 0;
- -webkit-box-shadow: none;
- -moz-box-shadow : none;
- -o-box-shadow : none;
- box-shadow : none;
-}
-.chzn-container-multi .chzn-choices .search-field .default {
- color: #999;
-}
-.chzn-container-multi .chzn-choices .search-choice {
- -webkit-border-radius: 3px;
- -moz-border-radius : 3px;
- border-radius : 3px;
- -moz-background-clip : padding;
- -webkit-background-clip: padding-box;
- background-clip : padding-box;
- background-color: #e4e4e4;
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f4f4f4', endColorstr='#eeeeee', GradientType=0 );
- background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
- background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
- background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
- background-image: -o-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
- background-image: -ms-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
- background-image: linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
- -webkit-box-shadow: 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05);
- -moz-box-shadow : 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05);
- box-shadow : 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05);
- color: #333;
- border: 1px solid #aaaaaa;
- line-height: 13px;
- padding: 3px 20px 3px 5px;
- margin: 3px 0 3px 5px;
- position: relative;
- cursor: default;
-}
-.chzn-container-multi .chzn-choices .search-choice-focus {
- background: #d4d4d4;
-}
-.chzn-container-multi .chzn-choices .search-choice .search-choice-close {
- display: block;
- position: absolute;
- right: 3px;
- top: 4px;
- width: 12px;
- height: 13px;
- font-size: 1px;
- background: url(chosen-sprite.png) right top no-repeat;
-}
-.chzn-container-multi .chzn-choices .search-choice .search-choice-close:hover {
- background-position: right -11px;
-}
-.chzn-container-multi .chzn-choices .search-choice-focus .search-choice-close {
- background-position: right -11px;
-}
-/* @end */
-
-/* @group Results */
-.chzn-container .chzn-results {
- margin: 0 4px 4px 0;
- max-height: 240px;
- padding: 0 0 0 4px;
- position: relative;
- overflow-x: hidden;
- overflow-y: auto;
-}
-.chzn-container-multi .chzn-results {
- margin: -1px 0 0;
- padding: 0;
-}
-.chzn-container .chzn-results li {
- display: none;
- line-height: 15px;
- padding: 5px 6px;
- margin: 0;
- list-style: none;
-}
-.chzn-container .chzn-results .active-result {
- cursor: pointer;
- display: list-item;
-}
-.chzn-container .chzn-results .highlighted {
- background-color: #3875d7;
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#3875d7', endColorstr='#2a62bc', GradientType=0 );
- background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #3875d7), color-stop(90%, #2a62bc));
- background-image: -webkit-linear-gradient(top, #3875d7 20%, #2a62bc 90%);
- background-image: -moz-linear-gradient(top, #3875d7 20%, #2a62bc 90%);
- background-image: -o-linear-gradient(top, #3875d7 20%, #2a62bc 90%);
- background-image: -ms-linear-gradient(top, #3875d7 20%, #2a62bc 90%);
- background-image: linear-gradient(top, #3875d7 20%, #2a62bc 90%);
- color: #fff;
-}
-.chzn-container .chzn-results li em {
- background: #feffde;
- font-style: normal;
-}
-.chzn-container .chzn-results .highlighted em {
- background: transparent;
-}
-.chzn-container .chzn-results .no-results {
- background: #f4f4f4;
- display: list-item;
-}
-.chzn-container .chzn-results .group-result {
- cursor: default;
- color: #999;
- font-weight: bold;
-}
-.chzn-container .chzn-results .group-option {
- padding-left: 15px;
-}
-.chzn-container-multi .chzn-drop .result-selected {
- display: none;
-}
-.chzn-container .chzn-results-scroll {
- background: white;
- margin: 0 4px;
- position: absolute;
- text-align: center;
- width: 321px; /* This should by dynamic with js */
- z-index: 1;
-}
-.chzn-container .chzn-results-scroll span {
- display: inline-block;
- height: 17px;
- text-indent: -5000px;
- width: 9px;
-}
-.chzn-container .chzn-results-scroll-down {
- bottom: 0;
-}
-.chzn-container .chzn-results-scroll-down span {
- background: url('chosen-sprite.png') no-repeat -4px -3px;
-}
-.chzn-container .chzn-results-scroll-up span {
- background: url('chosen-sprite.png') no-repeat -22px -3px;
-}
-/* @end */
-
-/* @group Active */
-.chzn-container-active .chzn-single {
- -webkit-box-shadow: 0 0 5px rgba(0,0,0,.3);
- -moz-box-shadow : 0 0 5px rgba(0,0,0,.3);
- -o-box-shadow : 0 0 5px rgba(0,0,0,.3);
- box-shadow : 0 0 5px rgba(0,0,0,.3);
- border: 1px solid #5897fb;
-}
-.chzn-container-active .chzn-single-with-drop {
- border: 1px solid #aaa;
- -webkit-box-shadow: 0 1px 0 #fff inset;
- -moz-box-shadow : 0 1px 0 #fff inset;
- -o-box-shadow : 0 1px 0 #fff inset;
- box-shadow : 0 1px 0 #fff inset;
- background-color: #eee;
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#ffffff', GradientType=0 );
- background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #eeeeee), color-stop(80%, #ffffff));
- background-image: -webkit-linear-gradient(top, #eeeeee 20%, #ffffff 80%);
- background-image: -moz-linear-gradient(top, #eeeeee 20%, #ffffff 80%);
- background-image: -o-linear-gradient(top, #eeeeee 20%, #ffffff 80%);
- background-image: -ms-linear-gradient(top, #eeeeee 20%, #ffffff 80%);
- background-image: linear-gradient(top, #eeeeee 20%, #ffffff 80%);
- -webkit-border-bottom-left-radius : 0;
- -webkit-border-bottom-right-radius: 0;
- -moz-border-radius-bottomleft : 0;
- -moz-border-radius-bottomright: 0;
- border-bottom-left-radius : 0;
- border-bottom-right-radius: 0;
-}
-.chzn-container-active .chzn-single-with-drop div {
- background: transparent;
- border-left: none;
-}
-.chzn-container-active .chzn-single-with-drop div b {
- background-position: -18px 1px;
-}
-.chzn-container-active .chzn-choices {
- -webkit-box-shadow: 0 0 5px rgba(0,0,0,.3);
- -moz-box-shadow : 0 0 5px rgba(0,0,0,.3);
- -o-box-shadow : 0 0 5px rgba(0,0,0,.3);
- box-shadow : 0 0 5px rgba(0,0,0,.3);
- border: 1px solid #5897fb;
-}
-.chzn-container-active .chzn-choices .search-field input {
- color: #111 !important;
-}
-/* @end */
-
-/* @group Disabled Support */
-.chzn-disabled {
- cursor: default;
- opacity:0.5 !important;
-}
-.chzn-disabled .chzn-single {
- cursor: default;
-}
-.chzn-disabled .chzn-choices .search-choice .search-choice-close {
- cursor: default;
-}
-
-/* @group Right to Left */
-.chzn-rtl { text-align: right; }
-.chzn-rtl .chzn-single { padding: 0 8px 0 0; overflow: visible; }
-.chzn-rtl .chzn-single span { margin-left: 26px; margin-right: 0; direction: rtl; }
-
-.chzn-rtl .chzn-single div { left: 3px; right: auto; }
-.chzn-rtl .chzn-single abbr {
- left: 26px;
- right: auto;
-}
-.chzn-rtl .chzn-choices .search-field input { direction: rtl; }
-.chzn-rtl .chzn-choices li { float: right; }
-.chzn-rtl .chzn-choices .search-choice { padding: 3px 5px 3px 19px; margin: 3px 5px 3px 0; }
-.chzn-rtl .chzn-choices .search-choice .search-choice-close { left: 4px; right: auto; background-position: right top;}
-.chzn-rtl.chzn-container-single .chzn-results { margin: 0 0 4px 4px; padding: 0 4px 0 0; }
-.chzn-rtl .chzn-results .group-option { padding-left: 0; padding-right: 15px; }
-.chzn-rtl.chzn-container-active .chzn-single-with-drop div { border-right: none; }
-.chzn-rtl .chzn-search input {
- background: #fff url('chosen-sprite.png') no-repeat -38px -22px;
- background: url('chosen-sprite.png') no-repeat -38px -22px, -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
- background: url('chosen-sprite.png') no-repeat -38px -22px, -webkit-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- background: url('chosen-sprite.png') no-repeat -38px -22px, -moz-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- background: url('chosen-sprite.png') no-repeat -38px -22px, -o-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- background: url('chosen-sprite.png') no-repeat -38px -22px, -ms-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- background: url('chosen-sprite.png') no-repeat -38px -22px, linear-gradient(top, #eeeeee 1%, #ffffff 15%);
- padding: 4px 5px 4px 20px;
- direction: rtl;
-}
-/* @end */
diff --git a/3rdparty/fullcalendar/GPL-LICENSE.txt b/3rdparty/fullcalendar/GPL-LICENSE.txt
deleted file mode 100644
index 11dddd00ef0..00000000000
--- a/3rdparty/fullcalendar/GPL-LICENSE.txt
+++ /dev/null
@@ -1,278 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Lesser General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
diff --git a/3rdparty/fullcalendar/MIT-LICENSE.txt b/3rdparty/fullcalendar/MIT-LICENSE.txt
deleted file mode 100644
index 46d47544964..00000000000
--- a/3rdparty/fullcalendar/MIT-LICENSE.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (c) 2009 Adam Shaw
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/3rdparty/fullcalendar/css/fullcalendar.css b/3rdparty/fullcalendar/css/fullcalendar.css
deleted file mode 100644
index 1f02ba428ea..00000000000
--- a/3rdparty/fullcalendar/css/fullcalendar.css
+++ /dev/null
@@ -1,618 +0,0 @@
-/*
- * FullCalendar v1.5.4 Stylesheet
- *
- * Copyright (c) 2011 Adam Shaw
- * Dual licensed under the MIT and GPL licenses, located in
- * MIT-LICENSE.txt and GPL-LICENSE.txt respectively.
- *
- * Date: Tue Sep 4 23:38:33 2012 -0700
- *
- */
-
-
-.fc {
- direction: ltr;
- text-align: left;
- }
-
-.fc table {
- border-collapse: collapse;
- border-spacing: 0;
- }
-
-html .fc,
-.fc table {
- font-size: 1em;
- }
-
-.fc td,
-.fc th {
- padding: 0;
- vertical-align: top;
- }
-
-
-
-/* Header
-------------------------------------------------------------------------*/
-
-.fc-header td {
- white-space: nowrap;
- }
-
-.fc-header-left {
- width: 25%;
- text-align: left;
- }
-
-.fc-header-center {
- text-align: center;
- }
-
-.fc-header-right {
- width: 25%;
- text-align: right;
- }
-
-.fc-header-title {
- display: inline-block;
- vertical-align: top;
- }
-
-.fc-header-title h2 {
- margin-top: 0;
- white-space: nowrap;
- }
-
-.fc .fc-header-space {
- padding-left: 10px;
- }
-
-.fc-header .fc-button {
- margin-bottom: 1em;
- vertical-align: top;
- }
-
-/* buttons edges butting together */
-
-.fc-header .fc-button {
- margin-right: -1px;
- }
-
-.fc-header .fc-corner-right {
- margin-right: 1px; /* back to normal */
- }
-
-.fc-header .ui-corner-right {
- margin-right: 0; /* back to normal */
- }
-
-/* button layering (for border precedence) */
-
-.fc-header .fc-state-hover,
-.fc-header .ui-state-hover {
- z-index: 2;
- }
-
-.fc-header .fc-state-down {
- z-index: 3;
- }
-
-.fc-header .fc-state-active,
-.fc-header .ui-state-active {
- z-index: 4;
- }
-
-
-
-/* Content
-------------------------------------------------------------------------*/
-
-.fc-content {
- clear: both;
- }
-
-.fc-view {
- width: 100%; /* needed for view switching (when view is absolute) */
- overflow: hidden;
- }
-
-
-
-/* Cell Styles
-------------------------------------------------------------------------*/
-
-.fc-widget-header, /* <th>, usually */
-.fc-widget-content { /* <td>, usually */
- border: 1px solid #ccc;
- }
-
-.fc-state-highlight { /* <td> today cell */ /* TODO: add .fc-today to <th> */
- background: #ffc;
- }
-
-.fc-cell-overlay { /* semi-transparent rectangle while dragging */
- background: #9cf;
- opacity: .2;
- filter: alpha(opacity=20); /* for IE */
- }
-
-
-
-/* Buttons
-------------------------------------------------------------------------*/
-
-.fc-button {
- position: relative;
- display: inline-block;
- cursor: pointer;
- }
-
-.fc-state-default { /* non-theme */
- border-style: solid;
- border-width: 1px 0;
- }
-
-.fc-button-inner {
- position: relative;
- float: left;
- overflow: hidden;
- }
-
-.fc-state-default .fc-button-inner { /* non-theme */
- border-style: solid;
- border-width: 0 1px;
- }
-
-.fc-button-content {
- position: relative;
- float: left;
- height: 1.9em;
- line-height: 1.9em;
- padding: 0 .6em;
- white-space: nowrap;
- }
-
-/* icon (for jquery ui) */
-
-.fc-button-content .fc-icon-wrap {
- position: relative;
- float: left;
- top: 50%;
- }
-
-.fc-button-content .ui-icon {
- position: relative;
- float: left;
- margin-top: -50%;
- *margin-top: 0;
- *top: -50%;
- }
-
-/* gloss effect */
-
-.fc-state-default .fc-button-effect {
- position: absolute;
- top: 50%;
- left: 0;
- }
-
-.fc-state-default .fc-button-effect span {
- position: absolute;
- top: -100px;
- left: 0;
- width: 500px;
- height: 100px;
- border-width: 100px 0 0 1px;
- border-style: solid;
- border-color: #fff;
- background: #444;
- opacity: .09;
- filter: alpha(opacity=9);
- }
-
-/* button states (determines colors) */
-
-.fc-state-default,
-.fc-state-default .fc-button-inner {
- border-style: solid;
- border-color: #ccc #bbb #aaa;
- background: #F3F3F3;
- color: #000;
- }
-
-.fc-state-hover,
-.fc-state-hover .fc-button-inner {
- border-color: #999;
- }
-
-.fc-state-down,
-.fc-state-down .fc-button-inner {
- border-color: #555;
- background: #777;
- }
-
-.fc-state-active,
-.fc-state-active .fc-button-inner {
- border-color: #555;
- background: #777;
- color: #fff;
- }
-
-.fc-state-disabled,
-.fc-state-disabled .fc-button-inner {
- color: #999;
- border-color: #ddd;
- }
-
-.fc-state-disabled {
- cursor: default;
- }
-
-.fc-state-disabled .fc-button-effect {
- display: none;
- }
-
-
-
-/* Global Event Styles
-------------------------------------------------------------------------*/
-
-.fc-event {
- border-style: solid;
- border-width: 0;
- font-size: .85em;
- cursor: default;
- }
-
-a.fc-event,
-.fc-event-draggable {
- cursor: pointer;
- }
-
-a.fc-event {
- text-decoration: none;
- }
-
-.fc-rtl .fc-event {
- text-align: right;
- }
-
-.fc-event-skin {
- border-color: #36c; /* default BORDER color */
- background-color: #36c; /* default BACKGROUND color */
- color: #fff; /* default TEXT color */
- }
-
-.fc-event-inner {
- position: relative;
- width: 100%;
- height: 100%;
- border-style: solid;
- border-width: 0;
- overflow: hidden;
- }
-
-.fc-event-time,
-.fc-event-title {
- padding: 0 1px;
- }
-
-.fc .ui-resizable-handle { /*** TODO: don't use ui-resizable anymore, change class ***/
- display: block;
- position: absolute;
- z-index: 99999;
- overflow: hidden; /* hacky spaces (IE6/7) */
- font-size: 300%; /* */
- line-height: 50%; /* */
- }
-
-
-
-/* Horizontal Events
-------------------------------------------------------------------------*/
-
-.fc-event-hori {
- border-width: 1px 0;
- margin-bottom: 1px;
- }
-
-/* resizable */
-
-.fc-event-hori .ui-resizable-e {
- top: 0 !important; /* importants override pre jquery ui 1.7 styles */
- right: -3px !important;
- width: 7px !important;
- height: 100% !important;
- cursor: e-resize;
- }
-
-.fc-event-hori .ui-resizable-w {
- top: 0 !important;
- left: -3px !important;
- width: 7px !important;
- height: 100% !important;
- cursor: w-resize;
- }
-
-.fc-event-hori .ui-resizable-handle {
- _padding-bottom: 14px; /* IE6 had 0 height */
- }
-
-
-
-/* Fake Rounded Corners (for buttons and events)
-------------------------------------------------------------*/
-
-.fc-corner-left {
- margin-left: 1px;
- }
-
-.fc-corner-left .fc-button-inner,
-.fc-corner-left .fc-event-inner {
- margin-left: -1px;
- }
-
-.fc-corner-right {
- margin-right: 1px;
- }
-
-.fc-corner-right .fc-button-inner,
-.fc-corner-right .fc-event-inner {
- margin-right: -1px;
- }
-
-.fc-corner-top {
- margin-top: 1px;
- }
-
-.fc-corner-top .fc-event-inner {
- margin-top: -1px;
- }
-
-.fc-corner-bottom {
- margin-bottom: 1px;
- }
-
-.fc-corner-bottom .fc-event-inner {
- margin-bottom: -1px;
- }
-
-
-
-/* Fake Rounded Corners SPECIFICALLY FOR EVENTS
------------------------------------------------------------------*/
-
-.fc-corner-left .fc-event-inner {
- border-left-width: 1px;
- }
-
-.fc-corner-right .fc-event-inner {
- border-right-width: 1px;
- }
-
-.fc-corner-top .fc-event-inner {
- border-top-width: 1px;
- }
-
-.fc-corner-bottom .fc-event-inner {
- border-bottom-width: 1px;
- }
-
-
-
-/* Reusable Separate-border Table
-------------------------------------------------------------*/
-
-table.fc-border-separate {
- border-collapse: separate;
- }
-
-.fc-border-separate th,
-.fc-border-separate td {
- border-width: 1px 0 0 1px;
- }
-
-.fc-border-separate th.fc-last,
-.fc-border-separate td.fc-last {
- border-right-width: 1px;
- }
-
-.fc-border-separate tr.fc-last th,
-.fc-border-separate tr.fc-last td {
- border-bottom-width: 1px;
- }
-
-.fc-border-separate tbody tr.fc-first td,
-.fc-border-separate tbody tr.fc-first th {
- border-top-width: 0;
- }
-
-
-
-/* Month View, Basic Week View, Basic Day View
-------------------------------------------------------------------------*/
-
-.fc-grid th {
- text-align: center;
- }
-
-.fc-grid .fc-day-number {
- float: right;
- padding: 0 2px;
- }
-
-.fc-grid .fc-other-month .fc-day-number {
- opacity: 0.3;
- filter: alpha(opacity=30); /* for IE */
- /* opacity with small font can sometimes look too faded
- might want to set the 'color' property instead
- making day-numbers bold also fixes the problem */
- }
-
-.fc-grid .fc-day-content {
- clear: both;
- padding: 2px 2px 1px; /* distance between events and day edges */
- }
-
-/* event styles */
-
-.fc-grid .fc-event-time {
- font-weight: bold;
- }
-
-/* right-to-left */
-
-.fc-rtl .fc-grid .fc-day-number {
- float: left;
- }
-
-.fc-rtl .fc-grid .fc-event-time {
- float: right;
- }
-
-
-
-/* Agenda Week View, Agenda Day View
-------------------------------------------------------------------------*/
-
-.fc-agenda table {
- border-collapse: separate;
- }
-
-.fc-agenda-days th {
- text-align: center;
- }
-
-.fc-agenda .fc-agenda-axis {
- width: 50px;
- padding: 0 4px;
- vertical-align: middle;
- text-align: right;
- white-space: nowrap;
- font-weight: normal;
- }
-
-.fc-agenda .fc-day-content {
- padding: 2px 2px 1px;
- }
-
-/* make axis border take precedence */
-
-.fc-agenda-days .fc-agenda-axis {
- border-right-width: 1px;
- }
-
-.fc-agenda-days .fc-col0 {
- border-left-width: 0;
- }
-
-/* all-day area */
-
-.fc-agenda-allday th {
- border-width: 0 1px;
- }
-
-.fc-agenda-allday .fc-day-content {
- min-height: 34px; /* TODO: doesnt work well in quirksmode */
- _height: 34px;
- }
-
-/* divider (between all-day and slots) */
-
-.fc-agenda-divider-inner {
- height: 2px;
- overflow: hidden;
- }
-
-.fc-widget-header .fc-agenda-divider-inner {
- background: #eee;
- }
-
-/* slot rows */
-
-.fc-agenda-slots th {
- border-width: 1px 1px 0;
- }
-
-.fc-agenda-slots td {
- border-width: 1px 0 0;
- background: none;
- }
-
-.fc-agenda-slots td div {
- height: 20px;
- }
-
-.fc-agenda-slots tr.fc-slot0 th,
-.fc-agenda-slots tr.fc-slot0 td {
- border-top-width: 0;
- }
-
-.fc-agenda-slots tr.fc-minor th,
-.fc-agenda-slots tr.fc-minor td {
- border-top-style: dotted;
- }
-
-.fc-agenda-slots tr.fc-minor th.ui-widget-header {
- *border-top-style: solid; /* doesn't work with background in IE6/7 */
- }
-
-
-
-/* Vertical Events
-------------------------------------------------------------------------*/
-
-.fc-event-vert {
- border-width: 0 1px;
- }
-
-.fc-event-vert .fc-event-head,
-.fc-event-vert .fc-event-content {
- position: relative;
- z-index: 2;
- width: 100%;
- overflow: hidden;
- }
-
-.fc-event-vert .fc-event-time {
- white-space: nowrap;
- font-size: 10px;
- }
-
-.fc-event-vert .fc-event-bg { /* makes the event lighter w/ a semi-transparent overlay */
- position: absolute;
- z-index: 1;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- background: #fff;
- opacity: .3;
- filter: alpha(opacity=30);
- }
-
-.fc .ui-draggable-dragging .fc-event-bg, /* TODO: something nicer like .fc-opacity */
-.fc-select-helper .fc-event-bg {
- display: none\9; /* for IE6/7/8. nested opacity filters while dragging don't work */
- }
-
-/* resizable */
-
-.fc-event-vert .ui-resizable-s {
- bottom: 0 !important; /* importants override pre jquery ui 1.7 styles */
- width: 100% !important;
- height: 8px !important;
- overflow: hidden !important;
- line-height: 8px !important;
- font-size: 11px !important;
- font-family: monospace;
- text-align: center;
- cursor: s-resize;
- }
-
-.fc-agenda .ui-resizable-resizing { /* TODO: better selector */
- _overflow: hidden;
- }
-
-
diff --git a/3rdparty/fullcalendar/css/fullcalendar.print.css b/3rdparty/fullcalendar/css/fullcalendar.print.css
deleted file mode 100644
index 227b80e0bca..00000000000
--- a/3rdparty/fullcalendar/css/fullcalendar.print.css
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * FullCalendar v1.5.4 Print Stylesheet
- *
- * Include this stylesheet on your page to get a more printer-friendly calendar.
- * When including this stylesheet, use the media='print' attribute of the <link> tag.
- * Make sure to include this stylesheet IN ADDITION to the regular fullcalendar.css.
- *
- * Copyright (c) 2011 Adam Shaw
- * Dual licensed under the MIT and GPL licenses, located in
- * MIT-LICENSE.txt and GPL-LICENSE.txt respectively.
- *
- * Date: Tue Sep 4 23:38:33 2012 -0700
- *
- */
-
-
- /* Events
------------------------------------------------------*/
-
-.fc-event-skin {
- background: none !important;
- color: #000 !important;
- }
-
-/* horizontal events */
-
-.fc-event-hori {
- border-width: 0 0 1px 0 !important;
- border-bottom-style: dotted !important;
- border-bottom-color: #000 !important;
- padding: 1px 0 0 0 !important;
- }
-
-.fc-event-hori .fc-event-inner {
- border-width: 0 !important;
- padding: 0 1px !important;
- }
-
-/* vertical events */
-
-.fc-event-vert {
- border-width: 0 0 0 1px !important;
- border-left-style: dotted !important;
- border-left-color: #000 !important;
- padding: 0 1px 0 0 !important;
- }
-
-.fc-event-vert .fc-event-inner {
- border-width: 0 !important;
- padding: 1px 0 !important;
- }
-
-.fc-event-bg {
- display: none !important;
- }
-
-.fc-event .ui-resizable-handle {
- display: none !important;
- }
-
-
diff --git a/3rdparty/fullcalendar/js/fullcalendar.js b/3rdparty/fullcalendar/js/fullcalendar.js
deleted file mode 100644
index d59de77c844..00000000000
--- a/3rdparty/fullcalendar/js/fullcalendar.js
+++ /dev/null
@@ -1,5220 +0,0 @@
-/**
- * @preserve
- * FullCalendar v1.5.4
- * http://arshaw.com/fullcalendar/
- *
- * Use fullcalendar.css for basic styling.
- * For event drag & drop, requires jQuery UI draggable.
- * For event resizing, requires jQuery UI resizable.
- *
- * Copyright (c) 2011 Adam Shaw
- * Dual licensed under the MIT and GPL licenses, located in
- * MIT-LICENSE.txt and GPL-LICENSE.txt respectively.
- *
- * Date: Tue Sep 4 23:38:33 2012 -0700
- *
- */
-
-(function($, undefined) {
-
-
-var defaults = {
-
- // display
- defaultView: 'month',
- aspectRatio: 1.35,
- header: {
- left: 'title',
- center: '',
- right: 'today prev,next'
- },
- weekends: true,
-
- // editing
- //editable: false,
- //disableDragging: false,
- //disableResizing: false,
-
- allDayDefault: true,
- ignoreTimezone: true,
-
- // event ajax
- lazyFetching: true,
- startParam: 'start',
- endParam: 'end',
-
- // time formats
- titleFormat: {
- month: 'MMMM yyyy',
- week: "MMM d[ yyyy]{ '&#8212;'[ MMM] d yyyy}",
- day: 'dddd, MMM d, yyyy'
- },
- columnFormat: {
- month: 'ddd',
- week: 'ddd M/d',
- day: 'dddd M/d'
- },
- timeFormat: { // for event elements
- '': 'h(:mm)t' // default
- },
-
- // locale
- isRTL: false,
- firstDay: 0,
- monthNames: ['January','February','March','April','May','June','July','August','September','October','November','December'],
- monthNamesShort: ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
- dayNames: ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],
- dayNamesShort: ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],
- buttonText: {
- prev: '&nbsp;&#9668;&nbsp;',
- next: '&nbsp;&#9658;&nbsp;',
- prevYear: '&nbsp;&lt;&lt;&nbsp;',
- nextYear: '&nbsp;&gt;&gt;&nbsp;',
- today: 'today',
- month: 'month',
- week: 'week',
- day: 'day'
- },
-
- // jquery-ui theming
- theme: false,
- buttonIcons: {
- prev: 'circle-triangle-w',
- next: 'circle-triangle-e'
- },
-
- //selectable: false,
- unselectAuto: true,
-
- dropAccept: '*'
-
-};
-
-// right-to-left defaults
-var rtlDefaults = {
- header: {
- left: 'next,prev today',
- center: '',
- right: 'title'
- },
- buttonText: {
- prev: '&nbsp;&#9658;&nbsp;',
- next: '&nbsp;&#9668;&nbsp;',
- prevYear: '&nbsp;&gt;&gt;&nbsp;',
- nextYear: '&nbsp;&lt;&lt;&nbsp;'
- },
- buttonIcons: {
- prev: 'circle-triangle-e',
- next: 'circle-triangle-w'
- }
-};
-
-
-
-var fc = $.fullCalendar = { version: "1.5.4" };
-var fcViews = fc.views = {};
-
-
-$.fn.fullCalendar = function(options) {
-
-
- // method calling
- if (typeof options == 'string') {
- var args = Array.prototype.slice.call(arguments, 1);
- var res;
- this.each(function() {
- var calendar = $.data(this, 'fullCalendar');
- if (calendar && $.isFunction(calendar[options])) {
- var r = calendar[options].apply(calendar, args);
- if (res === undefined) {
- res = r;
- }
- if (options == 'destroy') {
- $.removeData(this, 'fullCalendar');
- }
- }
- });
- if (res !== undefined) {
- return res;
- }
- return this;
- }
-
-
- // would like to have this logic in EventManager, but needs to happen before options are recursively extended
- var eventSources = options.eventSources || [];
- delete options.eventSources;
- if (options.events) {
- eventSources.push(options.events);
- delete options.events;
- }
-
-
- options = $.extend(true, {},
- defaults,
- (options.isRTL || options.isRTL===undefined && defaults.isRTL) ? rtlDefaults : {},
- options
- );
-
-
- this.each(function(i, _element) {
- var element = $(_element);
- var calendar = new Calendar(element, options, eventSources);
- element.data('fullCalendar', calendar); // TODO: look into memory leak implications
- calendar.render();
- });
-
-
- return this;
-
-};
-
-
-// function for adding/overriding defaults
-function setDefaults(d) {
- $.extend(true, defaults, d);
-}
-
-
-
-
-function Calendar(element, options, eventSources) {
- var t = this;
-
-
- // exports
- t.options = options;
- t.render = render;
- t.destroy = destroy;
- t.refetchEvents = refetchEvents;
- t.reportEvents = reportEvents;
- t.reportEventChange = reportEventChange;
- t.rerenderEvents = rerenderEvents;
- t.changeView = changeView;
- t.select = select;
- t.unselect = unselect;
- t.prev = prev;
- t.next = next;
- t.prevYear = prevYear;
- t.nextYear = nextYear;
- t.today = today;
- t.gotoDate = gotoDate;
- t.incrementDate = incrementDate;
- t.formatDate = function(format, date) { return formatDate(format, date, options) };
- t.formatDates = function(format, date1, date2) { return formatDates(format, date1, date2, options) };
- t.getDate = getDate;
- t.getView = getView;
- t.option = option;
- t.trigger = trigger;
-
-
- // imports
- EventManager.call(t, options, eventSources);
- var isFetchNeeded = t.isFetchNeeded;
- var fetchEvents = t.fetchEvents;
-
-
- // locals
- var _element = element[0];
- var header;
- var headerElement;
- var content;
- var tm; // for making theme classes
- var currentView;
- var viewInstances = {};
- var elementOuterWidth;
- var suggestedViewHeight;
- var absoluteViewElement;
- var resizeUID = 0;
- var ignoreWindowResize = 0;
- var date = new Date();
- var events = [];
- var _dragElement;
-
-
-
- /* Main Rendering
- -----------------------------------------------------------------------------*/
-
-
- setYMD(date, options.year, options.month, options.date);
-
-
- function render(inc) {
- if (!content) {
- initialRender();
- }else{
- calcSize();
- markSizesDirty();
- markEventsDirty();
- renderView(inc);
- }
- }
-
-
- function initialRender() {
- tm = options.theme ? 'ui' : 'fc';
- element.addClass('fc');
- if (options.isRTL) {
- element.addClass('fc-rtl');
- }
- if (options.theme) {
- element.addClass('ui-widget');
- }
- content = $("<div class='fc-content' style='position:relative'/>")
- .prependTo(element);
- header = new Header(t, options);
- headerElement = header.render();
- if (headerElement) {
- element.prepend(headerElement);
- }
- changeView(options.defaultView);
- $(window).resize(windowResize);
- // needed for IE in a 0x0 iframe, b/c when it is resized, never triggers a windowResize
- if (!bodyVisible()) {
- lateRender();
- }
- }
-
-
- // called when we know the calendar couldn't be rendered when it was initialized,
- // but we think it's ready now
- function lateRender() {
- setTimeout(function() { // IE7 needs this so dimensions are calculated correctly
- if (!currentView.start && bodyVisible()) { // !currentView.start makes sure this never happens more than once
- renderView();
- }
- },0);
- }
-
-
- function destroy() {
- $(window).unbind('resize', windowResize);
- header.destroy();
- content.remove();
- element.removeClass('fc fc-rtl ui-widget');
- }
-
-
-
- function elementVisible() {
- return _element.offsetWidth !== 0;
- }
-
-
- function bodyVisible() {
- return $('body')[0].offsetWidth !== 0;
- }
-
-
-
- /* View Rendering
- -----------------------------------------------------------------------------*/
-
- // TODO: improve view switching (still weird transition in IE, and FF has whiteout problem)
-
- function changeView(newViewName) {
- if (!currentView || newViewName != currentView.name) {
- ignoreWindowResize++; // because setMinHeight might change the height before render (and subsequently setSize) is reached
-
- unselect();
-
- var oldView = currentView;
- var newViewElement;
-
- if (oldView) {
- (oldView.beforeHide || noop)(); // called before changing min-height. if called after, scroll state is reset (in Opera)
- setMinHeight(content, content.height());
- oldView.element.hide();
- }else{
- setMinHeight(content, 1); // needs to be 1 (not 0) for IE7, or else view dimensions miscalculated
- }
- content.css('overflow', 'hidden');
-
- currentView = viewInstances[newViewName];
- if (currentView) {
- currentView.element.show();
- }else{
- currentView = viewInstances[newViewName] = new fcViews[newViewName](
- newViewElement = absoluteViewElement =
- $("<div class='fc-view fc-view-" + newViewName + "' style='position:absolute'/>")
- .appendTo(content),
- t // the calendar object
- );
- }
-
- if (oldView) {
- header.deactivateButton(oldView.name);
- }
- header.activateButton(newViewName);
-
- renderView(); // after height has been set, will make absoluteViewElement's position=relative, then set to null
-
- content.css('overflow', '');
- if (oldView) {
- setMinHeight(content, 1);
- }
-
- if (!newViewElement) {
- (currentView.afterShow || noop)(); // called after setting min-height/overflow, so in final scroll state (for Opera)
- }
-
- ignoreWindowResize--;
- }
- }
-
-
-
- function renderView(inc) {
- if (elementVisible()) {
- ignoreWindowResize++; // because renderEvents might temporarily change the height before setSize is reached
-
- unselect();
-
- if (suggestedViewHeight === undefined) {
- calcSize();
- }
-
- var forceEventRender = false;
- if (!currentView.start || inc || date < currentView.start || date >= currentView.end) {
- // view must render an entire new date range (and refetch/render events)
- currentView.render(date, inc || 0); // responsible for clearing events
- setSize(true);
- forceEventRender = true;
- }
- else if (currentView.sizeDirty) {
- // view must resize (and rerender events)
- currentView.clearEvents();
- setSize();
- forceEventRender = true;
- }
- else if (currentView.eventsDirty) {
- currentView.clearEvents();
- forceEventRender = true;
- }
- currentView.sizeDirty = false;
- currentView.eventsDirty = false;
- updateEvents(forceEventRender);
-
- elementOuterWidth = element.outerWidth();
-
- header.updateTitle(currentView.title);
- var today = new Date();
- if (today >= currentView.start && today < currentView.end) {
- header.disableButton('today');
- }else{
- header.enableButton('today');
- }
-
- ignoreWindowResize--;
- currentView.trigger('viewDisplay', _element);
- }
- }
-
-
-
- /* Resizing
- -----------------------------------------------------------------------------*/
-
-
- function updateSize() {
- markSizesDirty();
- if (elementVisible()) {
- calcSize();
- setSize();
- unselect();
- currentView.clearEvents();
- currentView.renderEvents(events);
- currentView.sizeDirty = false;
- }
- }
-
-
- function markSizesDirty() {
- $.each(viewInstances, function(i, inst) {
- inst.sizeDirty = true;
- });
- }
-
-
- function calcSize() {
- if (options.contentHeight) {
- suggestedViewHeight = options.contentHeight;
- }
- else if (options.height) {
- suggestedViewHeight = options.height - (headerElement ? headerElement.height() : 0) - vsides(content);
- }
- else {
- suggestedViewHeight = Math.round(content.width() / Math.max(options.aspectRatio, .5));
- }
- }
-
-
- function setSize(dateChanged) { // todo: dateChanged?
- ignoreWindowResize++;
- currentView.setHeight(suggestedViewHeight, dateChanged);
- if (absoluteViewElement) {
- absoluteViewElement.css('position', 'relative');
- absoluteViewElement = null;
- }
- currentView.setWidth(content.width(), dateChanged);
- ignoreWindowResize--;
- }
-
-
- function windowResize() {
- if (!ignoreWindowResize) {
- if (currentView.start) { // view has already been rendered
- var uid = ++resizeUID;
- setTimeout(function() { // add a delay
- if (uid == resizeUID && !ignoreWindowResize && elementVisible()) {
- if (elementOuterWidth != (elementOuterWidth = element.outerWidth())) {
- ignoreWindowResize++; // in case the windowResize callback changes the height
- updateSize();
- currentView.trigger('windowResize', _element);
- ignoreWindowResize--;
- }
- }
- }, 200);
- }else{
- // calendar must have been initialized in a 0x0 iframe that has just been resized
- lateRender();
- }
- }
- }
-
-
-
- /* Event Fetching/Rendering
- -----------------------------------------------------------------------------*/
-
-
- // fetches events if necessary, rerenders events if necessary (or if forced)
- function updateEvents(forceRender) {
- if (!options.lazyFetching || isFetchNeeded(currentView.visStart, currentView.visEnd)) {
- refetchEvents();
- }
- else if (forceRender) {
- rerenderEvents();
- }
- }
-
-
- function refetchEvents() {
- fetchEvents(currentView.visStart, currentView.visEnd); // will call reportEvents
- }
-
-
- // called when event data arrives
- function reportEvents(_events) {
- events = _events;
- rerenderEvents();
- }
-
-
- // called when a single event's data has been changed
- function reportEventChange(eventID) {
- rerenderEvents(eventID);
- }
-
-
- // attempts to rerenderEvents
- function rerenderEvents(modifiedEventID) {
- markEventsDirty();
- if (elementVisible()) {
- currentView.clearEvents();
- currentView.renderEvents(events, modifiedEventID);
- currentView.eventsDirty = false;
- }
- }
-
-
- function markEventsDirty() {
- $.each(viewInstances, function(i, inst) {
- inst.eventsDirty = true;
- });
- }
-
-
-
- /* Selection
- -----------------------------------------------------------------------------*/
-
-
- function select(start, end, allDay) {
- currentView.select(start, end, allDay===undefined ? true : allDay);
- }
-
-
- function unselect() { // safe to be called before renderView
- if (currentView) {
- currentView.unselect();
- }
- }
-
-
-
- /* Date
- -----------------------------------------------------------------------------*/
-
-
- function prev() {
- renderView(-1);
- }
-
-
- function next() {
- renderView(1);
- }
-
-
- function prevYear() {
- addYears(date, -1);
- renderView();
- }
-
-
- function nextYear() {
- addYears(date, 1);
- renderView();
- }
-
-
- function today() {
- date = new Date();
- renderView();
- }
-
-
- function gotoDate(year, month, dateOfMonth) {
- if (year instanceof Date) {
- date = cloneDate(year); // provided 1 argument, a Date
- }else{
- setYMD(date, year, month, dateOfMonth);
- }
- renderView();
- }
-
-
- function incrementDate(years, months, days) {
- if (years !== undefined) {
- addYears(date, years);
- }
- if (months !== undefined) {
- addMonths(date, months);
- }
- if (days !== undefined) {
- addDays(date, days);
- }
- renderView();
- }
-
-
- function getDate() {
- return cloneDate(date);
- }
-
-
-
- /* Misc
- -----------------------------------------------------------------------------*/
-
-
- function getView() {
- return currentView;
- }
-
-
- function option(name, value) {
- if (value === undefined) {
- return options[name];
- }
- if (name == 'height' || name == 'contentHeight' || name == 'aspectRatio') {
- options[name] = value;
- updateSize();
- }
- }
-
-
- function trigger(name, thisObj) {
- if (options[name]) {
- return options[name].apply(
- thisObj || _element,
- Array.prototype.slice.call(arguments, 2)
- );
- }
- }
-
-
-
- /* External Dragging
- ------------------------------------------------------------------------*/
-
- if (options.droppable) {
- $(document)
- .bind('dragstart', function(ev, ui) {
- var _e = ev.target;
- var e = $(_e);
- if (!e.parents('.fc').length) { // not already inside a calendar
- var accept = options.dropAccept;
- if ($.isFunction(accept) ? accept.call(_e, e) : e.is(accept)) {
- _dragElement = _e;
- currentView.dragStart(_dragElement, ev, ui);
- }
- }
- })
- .bind('dragstop', function(ev, ui) {
- if (_dragElement) {
- currentView.dragStop(_dragElement, ev, ui);
- _dragElement = null;
- }
- });
- }
-
-
-}
-
-function Header(calendar, options) {
- var t = this;
-
-
- // exports
- t.render = render;
- t.destroy = destroy;
- t.updateTitle = updateTitle;
- t.activateButton = activateButton;
- t.deactivateButton = deactivateButton;
- t.disableButton = disableButton;
- t.enableButton = enableButton;
-
-
- // locals
- var element = $([]);
- var tm;
-
-
-
- function render() {
- tm = options.theme ? 'ui' : 'fc';
- var sections = options.header;
- if (sections) {
- element = $("<table class='fc-header' style='width:100%'/>")
- .append(
- $("<tr/>")
- .append(renderSection('left'))
- .append(renderSection('center'))
- .append(renderSection('right'))
- );
- return element;
- }
- }
-
-
- function destroy() {
- element.remove();
- }
-
-
- function renderSection(position) {
- var e = $("<td class='fc-header-" + position + "'/>");
- var buttonStr = options.header[position];
- if (buttonStr) {
- $.each(buttonStr.split(' '), function(i) {
- if (i > 0) {
- e.append("<span class='fc-header-space'/>");
- }
- var prevButton;
- $.each(this.split(','), function(j, buttonName) {
- if (buttonName == 'title') {
- e.append("<span class='fc-header-title'><h2>&nbsp;</h2></span>");
- if (prevButton) {
- prevButton.addClass(tm + '-corner-right');
- }
- prevButton = null;
- }else{
- var buttonClick;
- if (calendar[buttonName]) {
- buttonClick = calendar[buttonName]; // calendar method
- }
- else if (fcViews[buttonName]) {
- buttonClick = function() {
- button.removeClass(tm + '-state-hover'); // forget why
- calendar.changeView(buttonName);
- };
- }
- if (buttonClick) {
- var icon = options.theme ? smartProperty(options.buttonIcons, buttonName) : null; // why are we using smartProperty here?
- var text = smartProperty(options.buttonText, buttonName); // why are we using smartProperty here?
- var button = $(
- "<span class='fc-button fc-button-" + buttonName + " " + tm + "-state-default'>" +
- "<span class='fc-button-inner'>" +
- "<span class='fc-button-content'>" +
- (icon ?
- "<span class='fc-icon-wrap'>" +
- "<span class='ui-icon ui-icon-" + icon + "'/>" +
- "</span>" :
- text
- ) +
- "</span>" +
- "<span class='fc-button-effect'><span></span></span>" +
- "</span>" +
- "</span>"
- );
- if (button) {
- button
- .click(function() {
- if (!button.hasClass(tm + '-state-disabled')) {
- buttonClick();
- }
- })
- .mousedown(function() {
- button
- .not('.' + tm + '-state-active')
- .not('.' + tm + '-state-disabled')
- .addClass(tm + '-state-down');
- })
- .mouseup(function() {
- button.removeClass(tm + '-state-down');
- })
- .hover(
- function() {
- button
- .not('.' + tm + '-state-active')
- .not('.' + tm + '-state-disabled')
- .addClass(tm + '-state-hover');
- },
- function() {
- button
- .removeClass(tm + '-state-hover')
- .removeClass(tm + '-state-down');
- }
- )
- .appendTo(e);
- if (!prevButton) {
- button.addClass(tm + '-corner-left');
- }
- prevButton = button;
- }
- }
- }
- });
- if (prevButton) {
- prevButton.addClass(tm + '-corner-right');
- }
- });
- }
- return e;
- }
-
-
- function updateTitle(html) {
- element.find('h2')
- .html(html);
- }
-
-
- function activateButton(buttonName) {
- element.find('span.fc-button-' + buttonName)
- .addClass(tm + '-state-active');
- }
-
-
- function deactivateButton(buttonName) {
- element.find('span.fc-button-' + buttonName)
- .removeClass(tm + '-state-active');
- }
-
-
- function disableButton(buttonName) {
- element.find('span.fc-button-' + buttonName)
- .addClass(tm + '-state-disabled');
- }
-
-
- function enableButton(buttonName) {
- element.find('span.fc-button-' + buttonName)
- .removeClass(tm + '-state-disabled');
- }
-
-
-}
-
-fc.sourceNormalizers = [];
-fc.sourceFetchers = [];
-
-var ajaxDefaults = {
- dataType: 'json',
- cache: false
-};
-
-var eventGUID = 1;
-
-
-function EventManager(options, _sources) {
- var t = this;
-
-
- // exports
- t.isFetchNeeded = isFetchNeeded;
- t.fetchEvents = fetchEvents;
- t.addEventSource = addEventSource;
- t.removeEventSource = removeEventSource;
- t.updateEvent = updateEvent;
- t.renderEvent = renderEvent;
- t.removeEvents = removeEvents;
- t.clientEvents = clientEvents;
- t.normalizeEvent = normalizeEvent;
-
-
- // imports
- var trigger = t.trigger;
- var getView = t.getView;
- var reportEvents = t.reportEvents;
-
-
- // locals
- var stickySource = { events: [] };
- var sources = [ stickySource ];
- var rangeStart, rangeEnd;
- var currentFetchID = 0;
- var pendingSourceCnt = 0;
- var loadingLevel = 0;
- var cache = [];
-
-
- for (var i=0; i<_sources.length; i++) {
- _addEventSource(_sources[i]);
- }
-
-
-
- /* Fetching
- -----------------------------------------------------------------------------*/
-
-
- function isFetchNeeded(start, end) {
- return !rangeStart || start < rangeStart || end > rangeEnd;
- }
-
-
- function fetchEvents(start, end) {
- rangeStart = start;
- rangeEnd = end;
- cache = [];
- var fetchID = ++currentFetchID;
- var len = sources.length;
- pendingSourceCnt = len;
- for (var i=0; i<len; i++) {
- fetchEventSource(sources[i], fetchID);
- }
- }
-
-
- function fetchEventSource(source, fetchID) {
- _fetchEventSource(source, function(events) {
- if (fetchID == currentFetchID) {
- if (events) {
- for (var i=0; i<events.length; i++) {
- events[i].source = source;
- normalizeEvent(events[i]);
- }
- cache = cache.concat(events);
- }
- pendingSourceCnt--;
- if (!pendingSourceCnt) {
- reportEvents(cache);
- }
- }
- });
- }
-
-
- function _fetchEventSource(source, callback) {
- var i;
- var fetchers = fc.sourceFetchers;
- var res;
- for (i=0; i<fetchers.length; i++) {
- res = fetchers[i](source, rangeStart, rangeEnd, callback);
- if (res === true) {
- // the fetcher is in charge. made its own async request
- return;
- }
- else if (typeof res == 'object') {
- // the fetcher returned a new source. process it
- _fetchEventSource(res, callback);
- return;
- }
- }
- var events = source.events;
- if (events) {
- if ($.isFunction(events)) {
- pushLoading();
- events(cloneDate(rangeStart), cloneDate(rangeEnd), function(events) {
- callback(events);
- popLoading();
- });
- }
- else if ($.isArray(events)) {
- callback(events);
- }
- else {
- callback();
- }
- }else{
- var url = source.url;
- if (url) {
- var success = source.success;
- var error = source.error;
- var complete = source.complete;
- var data = $.extend({}, source.data || {});
- var startParam = firstDefined(source.startParam, options.startParam);
- var endParam = firstDefined(source.endParam, options.endParam);
- if (startParam) {
- data[startParam] = Math.round(+rangeStart / 1000);
- }
- if (endParam) {
- data[endParam] = Math.round(+rangeEnd / 1000);
- }
- pushLoading();
- $.ajax($.extend({}, ajaxDefaults, source, {
- data: data,
- success: function(events) {
- events = events || [];
- var res = applyAll(success, this, arguments);
- if ($.isArray(res)) {
- events = res;
- }
- callback(events);
- },
- error: function() {
- applyAll(error, this, arguments);
- callback();
- },
- complete: function() {
- applyAll(complete, this, arguments);
- popLoading();
- }
- }));
- }else{
- callback();
- }
- }
- }
-
-
-
- /* Sources
- -----------------------------------------------------------------------------*/
-
-
- function addEventSource(source) {
- source = _addEventSource(source);
- if (source) {
- pendingSourceCnt++;
- fetchEventSource(source, currentFetchID); // will eventually call reportEvents
- }
- }
-
-
- function _addEventSource(source) {
- if ($.isFunction(source) || $.isArray(source)) {
- source = { events: source };
- }
- else if (typeof source == 'string') {
- source = { url: source };
- }
- if (typeof source == 'object') {
- normalizeSource(source);
- sources.push(source);
- return source;
- }
- }
-
-
- function removeEventSource(source) {
- sources = $.grep(sources, function(src) {
- return !isSourcesEqual(src, source);
- });
- // remove all client events from that source
- cache = $.grep(cache, function(e) {
- return !isSourcesEqual(e.source, source);
- });
- reportEvents(cache);
- }
-
-
-
- /* Manipulation
- -----------------------------------------------------------------------------*/
-
-
- function updateEvent(event) { // update an existing event
- var i, len = cache.length, e,
- defaultEventEnd = getView().defaultEventEnd, // getView???
- startDelta = event.start - event._start,
- endDelta = event.end ?
- (event.end - (event._end || defaultEventEnd(event))) // event._end would be null if event.end
- : 0; // was null and event was just resized
- for (i=0; i<len; i++) {
- e = cache[i];
- if (e._id == event._id && e != event) {
- e.start = new Date(+e.start + startDelta);
- if (event.end) {
- if (e.end) {
- e.end = new Date(+e.end + endDelta);
- }else{
- e.end = new Date(+defaultEventEnd(e) + endDelta);
- }
- }else{
- e.end = null;
- }
- e.title = event.title;
- e.url = event.url;
- e.allDay = event.allDay;
- e.className = event.className;
- e.editable = event.editable;
- e.color = event.color;
- e.backgroudColor = event.backgroudColor;
- e.borderColor = event.borderColor;
- e.textColor = event.textColor;
- normalizeEvent(e);
- }
- }
- normalizeEvent(event);
- reportEvents(cache);
- }
-
-
- function renderEvent(event, stick) {
- normalizeEvent(event);
- if (!event.source) {
- if (stick) {
- stickySource.events.push(event);
- event.source = stickySource;
- }
- cache.push(event);
- }
- reportEvents(cache);
- }
-
-
- function removeEvents(filter) {
- if (!filter) { // remove all
- cache = [];
- // clear all array sources
- for (var i=0; i<sources.length; i++) {
- if ($.isArray(sources[i].events)) {
- sources[i].events = [];
- }
- }
- }else{
- if (!$.isFunction(filter)) { // an event ID
- var id = filter + '';
- filter = function(e) {
- return e._id == id;
- };
- }
- cache = $.grep(cache, filter, true);
- // remove events from array sources
- for (var i=0; i<sources.length; i++) {
- if ($.isArray(sources[i].events)) {
- sources[i].events = $.grep(sources[i].events, filter, true);
- }
- }
- }
- reportEvents(cache);
- }
-
-
- function clientEvents(filter) {
- if ($.isFunction(filter)) {
- return $.grep(cache, filter);
- }
- else if (filter) { // an event ID
- filter += '';
- return $.grep(cache, function(e) {
- return e._id == filter;
- });
- }
- return cache; // else, return all
- }
-
-
-
- /* Loading State
- -----------------------------------------------------------------------------*/
-
-
- function pushLoading() {
- if (!loadingLevel++) {
- trigger('loading', null, true);
- }
- }
-
-
- function popLoading() {
- if (!--loadingLevel) {
- trigger('loading', null, false);
- }
- }
-
-
-
- /* Event Normalization
- -----------------------------------------------------------------------------*/
-
-
- function normalizeEvent(event) {
- var source = event.source || {};
- var ignoreTimezone = firstDefined(source.ignoreTimezone, options.ignoreTimezone);
- event._id = event._id || (event.id === undefined ? '_fc' + eventGUID++ : event.id + '');
- if (event.date) {
- if (!event.start) {
- event.start = event.date;
- }
- delete event.date;
- }
- event._start = cloneDate(event.start = parseDate(event.start, ignoreTimezone));
- event.end = parseDate(event.end, ignoreTimezone);
- if (event.end && event.end <= event.start) {
- event.end = null;
- }
- event._end = event.end ? cloneDate(event.end) : null;
- if (event.allDay === undefined) {
- event.allDay = firstDefined(source.allDayDefault, options.allDayDefault);
- }
- if (event.className) {
- if (typeof event.className == 'string') {
- event.className = event.className.split(/\s+/);
- }
- }else{
- event.className = [];
- }
- // TODO: if there is no start date, return false to indicate an invalid event
- }
-
-
-
- /* Utils
- ------------------------------------------------------------------------------*/
-
-
- function normalizeSource(source) {
- if (source.className) {
- // TODO: repeat code, same code for event classNames
- if (typeof source.className == 'string') {
- source.className = source.className.split(/\s+/);
- }
- }else{
- source.className = [];
- }
- var normalizers = fc.sourceNormalizers;
- for (var i=0; i<normalizers.length; i++) {
- normalizers[i](source);
- }
- }
-
-
- function isSourcesEqual(source1, source2) {
- return source1 && source2 && getSourcePrimitive(source1) == getSourcePrimitive(source2);
- }
-
-
- function getSourcePrimitive(source) {
- return ((typeof source == 'object') ? (source.events || source.url) : '') || source;
- }
-
-
-}
-
-
-fc.addDays = addDays;
-fc.cloneDate = cloneDate;
-fc.parseDate = parseDate;
-fc.parseISO8601 = parseISO8601;
-fc.parseTime = parseTime;
-fc.formatDate = formatDate;
-fc.formatDates = formatDates;
-
-
-
-/* Date Math
------------------------------------------------------------------------------*/
-
-var dayIDs = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'],
- DAY_MS = 86400000,
- HOUR_MS = 3600000,
- MINUTE_MS = 60000;
-
-
-function addYears(d, n, keepTime) {
- d.setFullYear(d.getFullYear() + n);
- if (!keepTime) {
- clearTime(d);
- }
- return d;
-}
-
-
-function addMonths(d, n, keepTime) { // prevents day overflow/underflow
- if (+d) { // prevent infinite looping on invalid dates
- var m = d.getMonth() + n,
- check = cloneDate(d);
- check.setDate(1);
- check.setMonth(m);
- d.setMonth(m);
- if (!keepTime) {
- clearTime(d);
- }
- while (d.getMonth() != check.getMonth()) {
- d.setDate(d.getDate() + (d < check ? 1 : -1));
- }
- }
- return d;
-}
-
-
-function addDays(d, n, keepTime) { // deals with daylight savings
- if (+d) {
- var dd = d.getDate() + n,
- check = cloneDate(d);
- check.setHours(9); // set to middle of day
- check.setDate(dd);
- d.setDate(dd);
- if (!keepTime) {
- clearTime(d);
- }
- fixDate(d, check);
- }
- return d;
-}
-
-
-function fixDate(d, check) { // force d to be on check's YMD, for daylight savings purposes
- if (+d) { // prevent infinite looping on invalid dates
- while (d.getDate() != check.getDate()) {
- d.setTime(+d + (d < check ? 1 : -1) * HOUR_MS);
- }
- }
-}
-
-
-function addMinutes(d, n) {
- d.setMinutes(d.getMinutes() + n);
- return d;
-}
-
-
-function clearTime(d) {
- d.setHours(0);
- d.setMinutes(0);
- d.setSeconds(0);
- d.setMilliseconds(0);
- return d;
-}
-
-
-function cloneDate(d, dontKeepTime) {
- if (dontKeepTime) {
- return clearTime(new Date(+d));
- }
- return new Date(+d);
-}
-
-
-function zeroDate() { // returns a Date with time 00:00:00 and dateOfMonth=1
- var i=0, d;
- do {
- d = new Date(1970, i++, 1);
- } while (d.getHours()); // != 0
- return d;
-}
-
-
-function skipWeekend(date, inc, excl) {
- inc = inc || 1;
- while (!date.getDay() || (excl && date.getDay()==1 || !excl && date.getDay()==6)) {
- addDays(date, inc);
- }
- return date;
-}
-
-
-function dayDiff(d1, d2) { // d1 - d2
- return Math.round((cloneDate(d1, true) - cloneDate(d2, true)) / DAY_MS);
-}
-
-
-function setYMD(date, y, m, d) {
- if (y !== undefined && y != date.getFullYear()) {
- date.setDate(1);
- date.setMonth(0);
- date.setFullYear(y);
- }
- if (m !== undefined && m != date.getMonth()) {
- date.setDate(1);
- date.setMonth(m);
- }
- if (d !== undefined) {
- date.setDate(d);
- }
-}
-
-
-
-/* Date Parsing
------------------------------------------------------------------------------*/
-
-
-function parseDate(s, ignoreTimezone) { // ignoreTimezone defaults to true
- if (typeof s == 'object') { // already a Date object
- return s;
- }
- if (typeof s == 'number') { // a UNIX timestamp
- return new Date(s * 1000);
- }
- if (typeof s == 'string') {
- if (s.match(/^\d+(\.\d+)?$/)) { // a UNIX timestamp
- return new Date(parseFloat(s) * 1000);
- }
- if (ignoreTimezone === undefined) {
- ignoreTimezone = true;
- }
- return parseISO8601(s, ignoreTimezone) || (s ? new Date(s) : null);
- }
- // TODO: never return invalid dates (like from new Date(<string>)), return null instead
- return null;
-}
-
-
-function parseISO8601(s, ignoreTimezone) { // ignoreTimezone defaults to false
- // derived from http://delete.me.uk/2005/03/iso8601.html
- // TODO: for a know glitch/feature, read tests/issue_206_parseDate_dst.html
- var m = s.match(/^([0-9]{4})(-([0-9]{2})(-([0-9]{2})([T ]([0-9]{2}):([0-9]{2})(:([0-9]{2})(\.([0-9]+))?)?(Z|(([-+])([0-9]{2})(:?([0-9]{2}))?))?)?)?)?$/);
- if (!m) {
- return null;
- }
- var date = new Date(m[1], 0, 1);
- if (ignoreTimezone || !m[13]) {
- var check = new Date(m[1], 0, 1, 9, 0);
- if (m[3]) {
- date.setMonth(m[3] - 1);
- check.setMonth(m[3] - 1);
- }
- if (m[5]) {
- date.setDate(m[5]);
- check.setDate(m[5]);
- }
- fixDate(date, check);
- if (m[7]) {
- date.setHours(m[7]);
- }
- if (m[8]) {
- date.setMinutes(m[8]);
- }
- if (m[10]) {
- date.setSeconds(m[10]);
- }
- if (m[12]) {
- date.setMilliseconds(Number("0." + m[12]) * 1000);
- }
- fixDate(date, check);
- }else{
- date.setUTCFullYear(
- m[1],
- m[3] ? m[3] - 1 : 0,
- m[5] || 1
- );
- date.setUTCHours(
- m[7] || 0,
- m[8] || 0,
- m[10] || 0,
- m[12] ? Number("0." + m[12]) * 1000 : 0
- );
- if (m[14]) {
- var offset = Number(m[16]) * 60 + (m[18] ? Number(m[18]) : 0);
- offset *= m[15] == '-' ? 1 : -1;
- date = new Date(+date + (offset * 60 * 1000));
- }
- }
- return date;
-}
-
-
-function parseTime(s) { // returns minutes since start of day
- if (typeof s == 'number') { // an hour
- return s * 60;
- }
- if (typeof s == 'object') { // a Date object
- return s.getHours() * 60 + s.getMinutes();
- }
- var m = s.match(/(\d+)(?::(\d+))?\s*(\w+)?/);
- if (m) {
- var h = parseInt(m[1], 10);
- if (m[3]) {
- h %= 12;
- if (m[3].toLowerCase().charAt(0) == 'p') {
- h += 12;
- }
- }
- return h * 60 + (m[2] ? parseInt(m[2], 10) : 0);
- }
-}
-
-
-
-/* Date Formatting
------------------------------------------------------------------------------*/
-// TODO: use same function formatDate(date, [date2], format, [options])
-
-
-function formatDate(date, format, options) {
- return formatDates(date, null, format, options);
-}
-
-
-function formatDates(date1, date2, format, options) {
- options = options || defaults;
- var date = date1,
- otherDate = date2,
- i, len = format.length, c,
- i2, formatter,
- res = '';
- for (i=0; i<len; i++) {
- c = format.charAt(i);
- if (c == "'") {
- for (i2=i+1; i2<len; i2++) {
- if (format.charAt(i2) == "'") {
- if (date) {
- if (i2 == i+1) {
- res += "'";
- }else{
- res += format.substring(i+1, i2);
- }
- i = i2;
- }
- break;
- }
- }
- }
- else if (c == '(') {
- for (i2=i+1; i2<len; i2++) {
- if (format.charAt(i2) == ')') {
- var subres = formatDate(date, format.substring(i+1, i2), options);
- if (parseInt(subres.replace(/\D/, ''), 10)) {
- res += subres;
- }
- i = i2;
- break;
- }
- }
- }
- else if (c == '[') {
- for (i2=i+1; i2<len; i2++) {
- if (format.charAt(i2) == ']') {
- var subformat = format.substring(i+1, i2);
- var subres = formatDate(date, subformat, options);
- if (subres != formatDate(otherDate, subformat, options)) {
- res += subres;
- }
- i = i2;
- break;
- }
- }
- }
- else if (c == '{') {
- date = date2;
- otherDate = date1;
- }
- else if (c == '}') {
- date = date1;
- otherDate = date2;
- }
- else {
- for (i2=len; i2>i; i2--) {
- if (formatter = dateFormatters[format.substring(i, i2)]) {
- if (date) {
- res += formatter(date, options);
- }
- i = i2 - 1;
- break;
- }
- }
- if (i2 == i) {
- if (date) {
- res += c;
- }
- }
- }
- }
- return res;
-};
-
-
-var dateFormatters = {
- s : function(d) { return d.getSeconds() },
- ss : function(d) { return zeroPad(d.getSeconds()) },
- m : function(d) { return d.getMinutes() },
- mm : function(d) { return zeroPad(d.getMinutes()) },
- h : function(d) { return d.getHours() % 12 || 12 },
- hh : function(d) { return zeroPad(d.getHours() % 12 || 12) },
- H : function(d) { return d.getHours() },
- HH : function(d) { return zeroPad(d.getHours()) },
- d : function(d) { return d.getDate() },
- dd : function(d) { return zeroPad(d.getDate()) },
- ddd : function(d,o) { return o.dayNamesShort[d.getDay()] },
- dddd: function(d,o) { return o.dayNames[d.getDay()] },
- M : function(d) { return d.getMonth() + 1 },
- MM : function(d) { return zeroPad(d.getMonth() + 1) },
- MMM : function(d,o) { return o.monthNamesShort[d.getMonth()] },
- MMMM: function(d,o) { return o.monthNames[d.getMonth()] },
- yy : function(d) { return (d.getFullYear()+'').substring(2) },
- yyyy: function(d) { return d.getFullYear() },
- t : function(d) { return d.getHours() < 12 ? 'a' : 'p' },
- tt : function(d) { return d.getHours() < 12 ? 'am' : 'pm' },
- T : function(d) { return d.getHours() < 12 ? 'A' : 'P' },
- TT : function(d) { return d.getHours() < 12 ? 'AM' : 'PM' },
- u : function(d) { return formatDate(d, "yyyy-MM-dd'T'HH:mm:ss'Z'") },
- S : function(d) {
- var date = d.getDate();
- if (date > 10 && date < 20) {
- return 'th';
- }
- return ['st', 'nd', 'rd'][date%10-1] || 'th';
- }
-};
-
-
-
-fc.applyAll = applyAll;
-
-
-/* Event Date Math
------------------------------------------------------------------------------*/
-
-
-function exclEndDay(event) {
- if (event.end) {
- return _exclEndDay(event.end, event.allDay);
- }else{
- return addDays(cloneDate(event.start), 1);
- }
-}
-
-
-function _exclEndDay(end, allDay) {
- end = cloneDate(end);
- return allDay || end.getHours() || end.getMinutes() ? addDays(end, 1) : clearTime(end);
-}
-
-
-function segCmp(a, b) {
- return (b.msLength - a.msLength) * 100 + (a.event.start - b.event.start);
-}
-
-
-function segsCollide(seg1, seg2) {
- return seg1.end > seg2.start && seg1.start < seg2.end;
-}
-
-
-
-/* Event Sorting
------------------------------------------------------------------------------*/
-
-
-// event rendering utilities
-function sliceSegs(events, visEventEnds, start, end) {
- var segs = [],
- i, len=events.length, event,
- eventStart, eventEnd,
- segStart, segEnd,
- isStart, isEnd;
- for (i=0; i<len; i++) {
- event = events[i];
- eventStart = event.start;
- eventEnd = visEventEnds[i];
- if (eventEnd > start && eventStart < end) {
- if (eventStart < start) {
- segStart = cloneDate(start);
- isStart = false;
- }else{
- segStart = eventStart;
- isStart = true;
- }
- if (eventEnd > end) {
- segEnd = cloneDate(end);
- isEnd = false;
- }else{
- segEnd = eventEnd;
- isEnd = true;
- }
- segs.push({
- event: event,
- start: segStart,
- end: segEnd,
- isStart: isStart,
- isEnd: isEnd,
- msLength: segEnd - segStart
- });
- }
- }
- return segs.sort(segCmp);
-}
-
-
-// event rendering calculation utilities
-function stackSegs(segs) {
- var levels = [],
- i, len = segs.length, seg,
- j, collide, k;
- for (i=0; i<len; i++) {
- seg = segs[i];
- j = 0; // the level index where seg should belong
- while (true) {
- collide = false;
- if (levels[j]) {
- for (k=0; k<levels[j].length; k++) {
- if (segsCollide(levels[j][k], seg)) {
- collide = true;
- break;
- }
- }
- }
- if (collide) {
- j++;
- }else{
- break;
- }
- }
- if (levels[j]) {
- levels[j].push(seg);
- }else{
- levels[j] = [seg];
- }
- }
- return levels;
-}
-
-
-
-/* Event Element Binding
------------------------------------------------------------------------------*/
-
-
-function lazySegBind(container, segs, bindHandlers) {
- container.unbind('mouseover').mouseover(function(ev) {
- var parent=ev.target, e,
- i, seg;
- while (parent != this) {
- e = parent;
- parent = parent.parentNode;
- }
- if ((i = e._fci) !== undefined) {
- e._fci = undefined;
- seg = segs[i];
- bindHandlers(seg.event, seg.element, seg);
- $(ev.target).trigger(ev);
- }
- ev.stopPropagation();
- });
-}
-
-
-
-/* Element Dimensions
------------------------------------------------------------------------------*/
-
-
-function setOuterWidth(element, width, includeMargins) {
- for (var i=0, e; i<element.length; i++) {
- e = $(element[i]);
- e.width(Math.max(0, width - hsides(e, includeMargins)));
- }
-}
-
-
-function setOuterHeight(element, height, includeMargins) {
- for (var i=0, e; i<element.length; i++) {
- e = $(element[i]);
- e.height(Math.max(0, height - vsides(e, includeMargins)));
- }
-}
-
-
-function hsides(element, includeMargins) {
- return hpadding(element) + hborders(element) + (includeMargins ? hmargins(element) : 0);
-}
-
-
-function hpadding(element) {
- return (parseFloat($.css(element[0], 'paddingLeft', true)) || 0) +
- (parseFloat($.css(element[0], 'paddingRight', true)) || 0);
-}
-
-
-function hmargins(element) {
- return (parseFloat($.css(element[0], 'marginLeft', true)) || 0) +
- (parseFloat($.css(element[0], 'marginRight', true)) || 0);
-}
-
-
-function hborders(element) {
- return (parseFloat($.css(element[0], 'borderLeftWidth', true)) || 0) +
- (parseFloat($.css(element[0], 'borderRightWidth', true)) || 0);
-}
-
-
-function vsides(element, includeMargins) {
- return vpadding(element) + vborders(element) + (includeMargins ? vmargins(element) : 0);
-}
-
-
-function vpadding(element) {
- return (parseFloat($.css(element[0], 'paddingTop', true)) || 0) +
- (parseFloat($.css(element[0], 'paddingBottom', true)) || 0);
-}
-
-
-function vmargins(element) {
- return (parseFloat($.css(element[0], 'marginTop', true)) || 0) +
- (parseFloat($.css(element[0], 'marginBottom', true)) || 0);
-}
-
-
-function vborders(element) {
- return (parseFloat($.css(element[0], 'borderTopWidth', true)) || 0) +
- (parseFloat($.css(element[0], 'borderBottomWidth', true)) || 0);
-}
-
-
-function setMinHeight(element, height) {
- height = (typeof height == 'number' ? height + 'px' : height);
- element.each(function(i, _element) {
- _element.style.cssText += ';min-height:' + height + ';_height:' + height;
- // why can't we just use .css() ? i forget
- });
-}
-
-
-
-/* Misc Utils
------------------------------------------------------------------------------*/
-
-
-//TODO: arraySlice
-//TODO: isFunction, grep ?
-
-
-function noop() { }
-
-
-function cmp(a, b) {
- return a - b;
-}
-
-
-function arrayMax(a) {
- return Math.max.apply(Math, a);
-}
-
-
-function zeroPad(n) {
- return (n < 10 ? '0' : '') + n;
-}
-
-
-function smartProperty(obj, name) { // get a camel-cased/namespaced property of an object
- if (obj[name] !== undefined) {
- return obj[name];
- }
- var parts = name.split(/(?=[A-Z])/),
- i=parts.length-1, res;
- for (; i>=0; i--) {
- res = obj[parts[i].toLowerCase()];
- if (res !== undefined) {
- return res;
- }
- }
- return obj[''];
-}
-
-
-function htmlEscape(s) {
- return s.replace(/&/g, '&amp;')
- .replace(/</g, '&lt;')
- .replace(/>/g, '&gt;')
- .replace(/'/g, '&#039;')
- .replace(/"/g, '&quot;')
- .replace(/\n/g, '<br />');
-}
-
-
-function cssKey(_element) {
- return _element.id + '/' + _element.className + '/' + _element.style.cssText.replace(/(^|;)\s*(top|left|width|height)\s*:[^;]*/ig, '');
-}
-
-
-function disableTextSelection(element) {
- element
- .attr('unselectable', 'on')
- .css('MozUserSelect', 'none')
- .bind('selectstart.ui', function() { return false; });
-}
-
-
-/*
-function enableTextSelection(element) {
- element
- .attr('unselectable', 'off')
- .css('MozUserSelect', '')
- .unbind('selectstart.ui');
-}
-*/
-
-
-function markFirstLast(e) {
- e.children()
- .removeClass('fc-first fc-last')
- .filter(':first-child')
- .addClass('fc-first')
- .end()
- .filter(':last-child')
- .addClass('fc-last');
-}
-
-
-function setDayID(cell, date) {
- cell.each(function(i, _cell) {
- _cell.className = _cell.className.replace(/^fc-\w*/, 'fc-' + dayIDs[date.getDay()]);
- // TODO: make a way that doesn't rely on order of classes
- });
-}
-
-
-function getSkinCss(event, opt) {
- var source = event.source || {};
- var eventColor = event.color;
- var sourceColor = source.color;
- var optionColor = opt('eventColor');
- var backgroundColor =
- event.backgroundColor ||
- eventColor ||
- source.backgroundColor ||
- sourceColor ||
- opt('eventBackgroundColor') ||
- optionColor;
- var borderColor =
- event.borderColor ||
- eventColor ||
- source.borderColor ||
- sourceColor ||
- opt('eventBorderColor') ||
- optionColor;
- var textColor =
- event.textColor ||
- source.textColor ||
- opt('eventTextColor');
- var statements = [];
- if (backgroundColor) {
- statements.push('background-color:' + backgroundColor);
- }
- if (borderColor) {
- statements.push('border-color:' + borderColor);
- }
- if (textColor) {
- statements.push('color:' + textColor);
- }
- return statements.join(';');
-}
-
-
-function applyAll(functions, thisObj, args) {
- if ($.isFunction(functions)) {
- functions = [ functions ];
- }
- if (functions) {
- var i;
- var ret;
- for (i=0; i<functions.length; i++) {
- ret = functions[i].apply(thisObj, args) || ret;
- }
- return ret;
- }
-}
-
-
-function firstDefined() {
- for (var i=0; i<arguments.length; i++) {
- if (arguments[i] !== undefined) {
- return arguments[i];
- }
- }
-}
-
-
-fcViews.month = MonthView;
-
-function MonthView(element, calendar) {
- var t = this;
-
-
- // exports
- t.render = render;
-
-
- // imports
- BasicView.call(t, element, calendar, 'month');
- var opt = t.opt;
- var renderBasic = t.renderBasic;
- var formatDate = calendar.formatDate;
-
-
-
- function render(date, delta) {
- if (delta) {
- addMonths(date, delta);
- date.setDate(1);
- }
- var start = cloneDate(date, true);
- start.setDate(1);
- var end = addMonths(cloneDate(start), 1);
- var visStart = cloneDate(start);
- var visEnd = cloneDate(end);
- var firstDay = opt('firstDay');
- var nwe = opt('weekends') ? 0 : 1;
- if (nwe) {
- skipWeekend(visStart);
- skipWeekend(visEnd, -1, true);
- }
- addDays(visStart, -((visStart.getDay() - Math.max(firstDay, nwe) + 7) % 7));
- addDays(visEnd, (7 - visEnd.getDay() + Math.max(firstDay, nwe)) % 7);
- var rowCnt = Math.round((visEnd - visStart) / (DAY_MS * 7));
- if (opt('weekMode') == 'fixed') {
- addDays(visEnd, (6 - rowCnt) * 7);
- rowCnt = 6;
- }
- t.title = formatDate(start, opt('titleFormat'));
- t.start = start;
- t.end = end;
- t.visStart = visStart;
- t.visEnd = visEnd;
- renderBasic(6, rowCnt, nwe ? 5 : 7, true);
- }
-
-
-}
-
-fcViews.basicWeek = BasicWeekView;
-
-function BasicWeekView(element, calendar) {
- var t = this;
-
-
- // exports
- t.render = render;
-
-
- // imports
- BasicView.call(t, element, calendar, 'basicWeek');
- var opt = t.opt;
- var renderBasic = t.renderBasic;
- var formatDates = calendar.formatDates;
-
-
-
- function render(date, delta) {
- if (delta) {
- addDays(date, delta * 7);
- }
- var start = addDays(cloneDate(date), -((date.getDay() - opt('firstDay') + 7) % 7));
- var end = addDays(cloneDate(start), 7);
- var visStart = cloneDate(start);
- var visEnd = cloneDate(end);
- var weekends = opt('weekends');
- if (!weekends) {
- skipWeekend(visStart);
- skipWeekend(visEnd, -1, true);
- }
- t.title = formatDates(
- visStart,
- addDays(cloneDate(visEnd), -1),
- opt('titleFormat')
- );
- t.start = start;
- t.end = end;
- t.visStart = visStart;
- t.visEnd = visEnd;
- renderBasic(1, 1, weekends ? 7 : 5, false);
- }
-
-
-}
-
-fcViews.basicDay = BasicDayView;
-
-//TODO: when calendar's date starts out on a weekend, shouldn't happen
-
-
-function BasicDayView(element, calendar) {
- var t = this;
-
-
- // exports
- t.render = render;
-
-
- // imports
- BasicView.call(t, element, calendar, 'basicDay');
- var opt = t.opt;
- var renderBasic = t.renderBasic;
- var formatDate = calendar.formatDate;
-
-
-
- function render(date, delta) {
- if (delta) {
- addDays(date, delta);
- if (!opt('weekends')) {
- skipWeekend(date, delta < 0 ? -1 : 1);
- }
- }
- t.title = formatDate(date, opt('titleFormat'));
- t.start = t.visStart = cloneDate(date, true);
- t.end = t.visEnd = addDays(cloneDate(t.start), 1);
- renderBasic(1, 1, 1, false);
- }
-
-
-}
-
-setDefaults({
- weekMode: 'fixed'
-});
-
-
-function BasicView(element, calendar, viewName) {
- var t = this;
-
-
- // exports
- t.renderBasic = renderBasic;
- t.setHeight = setHeight;
- t.setWidth = setWidth;
- t.renderDayOverlay = renderDayOverlay;
- t.defaultSelectionEnd = defaultSelectionEnd;
- t.renderSelection = renderSelection;
- t.clearSelection = clearSelection;
- t.reportDayClick = reportDayClick; // for selection (kinda hacky)
- t.dragStart = dragStart;
- t.dragStop = dragStop;
- t.defaultEventEnd = defaultEventEnd;
- t.getHoverListener = function() { return hoverListener };
- t.colContentLeft = colContentLeft;
- t.colContentRight = colContentRight;
- t.dayOfWeekCol = dayOfWeekCol;
- t.dateCell = dateCell;
- t.cellDate = cellDate;
- t.cellIsAllDay = function() { return true };
- t.allDayRow = allDayRow;
- t.allDayBounds = allDayBounds;
- t.getRowCnt = function() { return rowCnt };
- t.getColCnt = function() { return colCnt };
- t.getColWidth = function() { return colWidth };
- t.getDaySegmentContainer = function() { return daySegmentContainer };
-
-
- // imports
- View.call(t, element, calendar, viewName);
- OverlayManager.call(t);
- SelectionManager.call(t);
- BasicEventRenderer.call(t);
- var opt = t.opt;
- var trigger = t.trigger;
- var clearEvents = t.clearEvents;
- var renderOverlay = t.renderOverlay;
- var clearOverlays = t.clearOverlays;
- var daySelectionMousedown = t.daySelectionMousedown;
- var formatDate = calendar.formatDate;
-
-
- // locals
-
- var head;
- var headCells;
- var body;
- var bodyRows;
- var bodyCells;
- var bodyFirstCells;
- var bodyCellTopInners;
- var daySegmentContainer;
-
- var viewWidth;
- var viewHeight;
- var colWidth;
-
- var rowCnt, colCnt;
- var coordinateGrid;
- var hoverListener;
- var colContentPositions;
-
- var rtl, dis, dit;
- var firstDay;
- var nwe;
- var tm;
- var colFormat;
-
-
-
- /* Rendering
- ------------------------------------------------------------*/
-
-
- disableTextSelection(element.addClass('fc-grid'));
-
-
- function renderBasic(maxr, r, c, showNumbers) {
- rowCnt = r;
- colCnt = c;
- updateOptions();
- var firstTime = !body;
- if (firstTime) {
- buildSkeleton(maxr, showNumbers);
- }else{
- clearEvents();
- }
- updateCells(firstTime);
- }
-
-
-
- function updateOptions() {
- rtl = opt('isRTL');
- if (rtl) {
- dis = -1;
- dit = colCnt - 1;
- }else{
- dis = 1;
- dit = 0;
- }
- firstDay = opt('firstDay');
- nwe = opt('weekends') ? 0 : 1;
- tm = opt('theme') ? 'ui' : 'fc';
- colFormat = opt('columnFormat');
- }
-
-
-
- function buildSkeleton(maxRowCnt, showNumbers) {
- var s;
- var headerClass = tm + "-widget-header";
- var contentClass = tm + "-widget-content";
- var i, j;
- var table;
-
- s =
- "<table class='fc-border-separate' style='width:100%' cellspacing='0'>" +
- "<thead>" +
- "<tr>";
- for (i=0; i<colCnt; i++) {
- s +=
- "<th class='fc- " + headerClass + "'/>"; // need fc- for setDayID
- }
- s +=
- "</tr>" +
- "</thead>" +
- "<tbody>";
- for (i=0; i<maxRowCnt; i++) {
- s +=
- "<tr class='fc-week" + i + "'>";
- for (j=0; j<colCnt; j++) {
- s +=
- "<td class='fc- " + contentClass + " fc-day" + (i*colCnt+j) + "'>" + // need fc- for setDayID
- "<div>" +
- (showNumbers ?
- "<div class='fc-day-number'/>" :
- ''
- ) +
- "<div class='fc-day-content'>" +
- "<div style='position:relative'>&nbsp;</div>" +
- "</div>" +
- "</div>" +
- "</td>";
- }
- s +=
- "</tr>";
- }
- s +=
- "</tbody>" +
- "</table>";
- table = $(s).appendTo(element);
-
- head = table.find('thead');
- headCells = head.find('th');
- body = table.find('tbody');
- bodyRows = body.find('tr');
- bodyCells = body.find('td');
- bodyFirstCells = bodyCells.filter(':first-child');
- bodyCellTopInners = bodyRows.eq(0).find('div.fc-day-content div');
-
- markFirstLast(head.add(head.find('tr'))); // marks first+last tr/th's
- markFirstLast(bodyRows); // marks first+last td's
- bodyRows.eq(0).addClass('fc-first'); // fc-last is done in updateCells
-
- dayBind(bodyCells);
-
- daySegmentContainer =
- $("<div style='position:absolute;z-index:8;top:0;left:0'/>")
- .appendTo(element);
- }
-
-
-
- function updateCells(firstTime) {
- var dowDirty = firstTime || rowCnt == 1; // could the cells' day-of-weeks need updating?
- var month = t.start.getMonth();
- var today = clearTime(new Date());
- var cell;
- var date;
- var row;
-
- if (dowDirty) {
- headCells.each(function(i, _cell) {
- cell = $(_cell);
- date = indexDate(i);
- cell.html(formatDate(date, colFormat));
- setDayID(cell, date);
- });
- }
-
- bodyCells.each(function(i, _cell) {
- cell = $(_cell);
- date = indexDate(i);
- if (date.getMonth() == month) {
- cell.removeClass('fc-other-month');
- }else{
- cell.addClass('fc-other-month');
- }
- if (+date == +today) {
- cell.addClass(tm + '-state-highlight fc-today');
- }else{
- cell.removeClass(tm + '-state-highlight fc-today');
- }
- cell.find('div.fc-day-number').text(date.getDate());
- if (dowDirty) {
- setDayID(cell, date);
- }
- });
-
- bodyRows.each(function(i, _row) {
- row = $(_row);
- if (i < rowCnt) {
- row.show();
- if (i == rowCnt-1) {
- row.addClass('fc-last');
- }else{
- row.removeClass('fc-last');
- }
- }else{
- row.hide();
- }
- });
- }
-
-
-
- function setHeight(height) {
- viewHeight = height;
-
- var bodyHeight = viewHeight - head.height();
- var rowHeight;
- var rowHeightLast;
- var cell;
-
- if (opt('weekMode') == 'variable') {
- rowHeight = rowHeightLast = Math.floor(bodyHeight / (rowCnt==1 ? 2 : 6));
- }else{
- rowHeight = Math.floor(bodyHeight / rowCnt);
- rowHeightLast = bodyHeight - rowHeight * (rowCnt-1);
- }
-
- bodyFirstCells.each(function(i, _cell) {
- if (i < rowCnt) {
- cell = $(_cell);
- setMinHeight(
- cell.find('> div'),
- (i==rowCnt-1 ? rowHeightLast : rowHeight) - vsides(cell)
- );
- }
- });
-
- }
-
-
- function setWidth(width) {
- viewWidth = width;
- colContentPositions.clear();
- colWidth = Math.floor(viewWidth / colCnt);
- setOuterWidth(headCells.slice(0, -1), colWidth);
- }
-
-
-
- /* Day clicking and binding
- -----------------------------------------------------------*/
-
-
- function dayBind(days) {
- days.click(dayClick)
- .mousedown(daySelectionMousedown);
- }
-
-
- function dayClick(ev) {
- if (!opt('selectable')) { // if selectable, SelectionManager will worry about dayClick
- var index = parseInt(this.className.match(/fc\-day(\d+)/)[1]); // TODO: maybe use .data
- var date = indexDate(index);
- trigger('dayClick', this, date, true, ev);
- }
- }
-
-
-
- /* Semi-transparent Overlay Helpers
- ------------------------------------------------------*/
-
-
- function renderDayOverlay(overlayStart, overlayEnd, refreshCoordinateGrid) { // overlayEnd is exclusive
- if (refreshCoordinateGrid) {
- coordinateGrid.build();
- }
- var rowStart = cloneDate(t.visStart);
- var rowEnd = addDays(cloneDate(rowStart), colCnt);
- for (var i=0; i<rowCnt; i++) {
- var stretchStart = new Date(Math.max(rowStart, overlayStart));
- var stretchEnd = new Date(Math.min(rowEnd, overlayEnd));
- if (stretchStart < stretchEnd) {
- var colStart, colEnd;
- if (rtl) {
- colStart = dayDiff(stretchEnd, rowStart)*dis+dit+1;
- colEnd = dayDiff(stretchStart, rowStart)*dis+dit+1;
- }else{
- colStart = dayDiff(stretchStart, rowStart);
- colEnd = dayDiff(stretchEnd, rowStart);
- }
- dayBind(
- renderCellOverlay(i, colStart, i, colEnd-1)
- );
- }
- addDays(rowStart, 7);
- addDays(rowEnd, 7);
- }
- }
-
-
- function renderCellOverlay(row0, col0, row1, col1) { // row1,col1 is inclusive
- var rect = coordinateGrid.rect(row0, col0, row1, col1, element);
- return renderOverlay(rect, element);
- }
-
-
-
- /* Selection
- -----------------------------------------------------------------------*/
-
-
- function defaultSelectionEnd(startDate, allDay) {
- return cloneDate(startDate);
- }
-
-
- function renderSelection(startDate, endDate, allDay) {
- renderDayOverlay(startDate, addDays(cloneDate(endDate), 1), true); // rebuild every time???
- }
-
-
- function clearSelection() {
- clearOverlays();
- }
-
-
- function reportDayClick(date, allDay, ev) {
- var cell = dateCell(date);
- var _element = bodyCells[cell.row*colCnt + cell.col];
- trigger('dayClick', _element, date, allDay, ev);
- }
-
-
-
- /* External Dragging
- -----------------------------------------------------------------------*/
-
-
- function dragStart(_dragElement, ev, ui) {
- hoverListener.start(function(cell) {
- clearOverlays();
- if (cell) {
- renderCellOverlay(cell.row, cell.col, cell.row, cell.col);
- }
- }, ev);
- }
-
-
- function dragStop(_dragElement, ev, ui) {
- var cell = hoverListener.stop();
- clearOverlays();
- if (cell) {
- var d = cellDate(cell);
- trigger('drop', _dragElement, d, true, ev, ui);
- }
- }
-
-
-
- /* Utilities
- --------------------------------------------------------*/
-
-
- function defaultEventEnd(event) {
- return cloneDate(event.start);
- }
-
-
- coordinateGrid = new CoordinateGrid(function(rows, cols) {
- var e, n, p;
- headCells.each(function(i, _e) {
- e = $(_e);
- n = e.offset().left;
- if (i) {
- p[1] = n;
- }
- p = [n];
- cols[i] = p;
- });
- p[1] = n + e.outerWidth();
- bodyRows.each(function(i, _e) {
- if (i < rowCnt) {
- e = $(_e);
- n = e.offset().top;
- if (i) {
- p[1] = n;
- }
- p = [n];
- rows[i] = p;
- }
- });
- p[1] = n + e.outerHeight();
- });
-
-
- hoverListener = new HoverListener(coordinateGrid);
-
-
- colContentPositions = new HorizontalPositionCache(function(col) {
- return bodyCellTopInners.eq(col);
- });
-
-
- function colContentLeft(col) {
- return colContentPositions.left(col);
- }
-
-
- function colContentRight(col) {
- return colContentPositions.right(col);
- }
-
-
-
-
- function dateCell(date) {
- return {
- row: Math.floor(dayDiff(date, t.visStart) / 7),
- col: dayOfWeekCol(date.getDay())
- };
- }
-
-
- function cellDate(cell) {
- return _cellDate(cell.row, cell.col);
- }
-
-
- function _cellDate(row, col) {
- return addDays(cloneDate(t.visStart), row*7 + col*dis+dit);
- // what about weekends in middle of week?
- }
-
-
- function indexDate(index) {
- return _cellDate(Math.floor(index/colCnt), index%colCnt);
- }
-
-
- function dayOfWeekCol(dayOfWeek) {
- return ((dayOfWeek - Math.max(firstDay, nwe) + colCnt) % colCnt) * dis + dit;
- }
-
-
-
-
- function allDayRow(i) {
- return bodyRows.eq(i);
- }
-
-
- function allDayBounds(i) {
- return {
- left: 0,
- right: viewWidth
- };
- }
-
-
-}
-
-function BasicEventRenderer() {
- var t = this;
-
-
- // exports
- t.renderEvents = renderEvents;
- t.compileDaySegs = compileSegs; // for DayEventRenderer
- t.clearEvents = clearEvents;
- t.bindDaySeg = bindDaySeg;
-
-
- // imports
- DayEventRenderer.call(t);
- var opt = t.opt;
- var trigger = t.trigger;
- //var setOverflowHidden = t.setOverflowHidden;
- var isEventDraggable = t.isEventDraggable;
- var isEventResizable = t.isEventResizable;
- var reportEvents = t.reportEvents;
- var reportEventClear = t.reportEventClear;
- var eventElementHandlers = t.eventElementHandlers;
- var showEvents = t.showEvents;
- var hideEvents = t.hideEvents;
- var eventDrop = t.eventDrop;
- var getDaySegmentContainer = t.getDaySegmentContainer;
- var getHoverListener = t.getHoverListener;
- var renderDayOverlay = t.renderDayOverlay;
- var clearOverlays = t.clearOverlays;
- var getRowCnt = t.getRowCnt;
- var getColCnt = t.getColCnt;
- var renderDaySegs = t.renderDaySegs;
- var resizableDayEvent = t.resizableDayEvent;
-
-
-
- /* Rendering
- --------------------------------------------------------------------*/
-
-
- function renderEvents(events, modifiedEventId) {
- reportEvents(events);
- renderDaySegs(compileSegs(events), modifiedEventId);
- }
-
-
- function clearEvents() {
- reportEventClear();
- getDaySegmentContainer().empty();
- }
-
-
- function compileSegs(events) {
- var rowCnt = getRowCnt(),
- colCnt = getColCnt(),
- d1 = cloneDate(t.visStart),
- d2 = addDays(cloneDate(d1), colCnt),
- visEventsEnds = $.map(events, exclEndDay),
- i, row,
- j, level,
- k, seg,
- segs=[];
- for (i=0; i<rowCnt; i++) {
- row = stackSegs(sliceSegs(events, visEventsEnds, d1, d2));
- for (j=0; j<row.length; j++) {
- level = row[j];
- for (k=0; k<level.length; k++) {
- seg = level[k];
- seg.row = i;
- seg.level = j; // not needed anymore
- segs.push(seg);
- }
- }
- addDays(d1, 7);
- addDays(d2, 7);
- }
- return segs;
- }
-
-
- function bindDaySeg(event, eventElement, seg) {
- if (isEventDraggable(event)) {
- draggableDayEvent(event, eventElement);
- }
- if (seg.isEnd && isEventResizable(event)) {
- resizableDayEvent(event, eventElement, seg);
- }
- eventElementHandlers(event, eventElement);
- // needs to be after, because resizableDayEvent might stopImmediatePropagation on click
- }
-
-
-
- /* Dragging
- ----------------------------------------------------------------------------*/
-
-
- function draggableDayEvent(event, eventElement) {
- var hoverListener = getHoverListener();
- var dayDelta;
- eventElement.draggable({
- zIndex: 9,
- delay: 50,
- opacity: opt('dragOpacity'),
- revertDuration: opt('dragRevertDuration'),
- start: function(ev, ui) {
- trigger('eventDragStart', eventElement, event, ev, ui);
- hideEvents(event, eventElement);
- hoverListener.start(function(cell, origCell, rowDelta, colDelta) {
- eventElement.draggable('option', 'revert', !cell || !rowDelta && !colDelta);
- clearOverlays();
- if (cell) {
- //setOverflowHidden(true);
- dayDelta = rowDelta*7 + colDelta * (opt('isRTL') ? -1 : 1);
- renderDayOverlay(
- addDays(cloneDate(event.start), dayDelta),
- addDays(exclEndDay(event), dayDelta)
- );
- }else{
- //setOverflowHidden(false);
- dayDelta = 0;
- }
- }, ev, 'drag');
- },
- stop: function(ev, ui) {
- hoverListener.stop();
- clearOverlays();
- trigger('eventDragStop', eventElement, event, ev, ui);
- if (dayDelta) {
- eventDrop(this, event, dayDelta, 0, event.allDay, ev, ui);
- }else{
- eventElement.css('filter', ''); // clear IE opacity side-effects
- showEvents(event, eventElement);
- }
- //setOverflowHidden(false);
- }
- });
- }
-
-
-}
-
-fcViews.agendaWeek = AgendaWeekView;
-
-function AgendaWeekView(element, calendar) {
- var t = this;
-
-
- // exports
- t.render = render;
-
-
- // imports
- AgendaView.call(t, element, calendar, 'agendaWeek');
- var opt = t.opt;
- var renderAgenda = t.renderAgenda;
- var formatDates = calendar.formatDates;
-
-
-
- function render(date, delta) {
- if (delta) {
- addDays(date, delta * 7);
- }
- var start = addDays(cloneDate(date), -((date.getDay() - opt('firstDay') + 7) % 7));
- var end = addDays(cloneDate(start), 7);
- var visStart = cloneDate(start);
- var visEnd = cloneDate(end);
- var weekends = opt('weekends');
- if (!weekends) {
- skipWeekend(visStart);
- skipWeekend(visEnd, -1, true);
- }
- t.title = formatDates(
- visStart,
- addDays(cloneDate(visEnd), -1),
- opt('titleFormat')
- );
- t.start = start;
- t.end = end;
- t.visStart = visStart;
- t.visEnd = visEnd;
- renderAgenda(weekends ? 7 : 5);
- }
-
-
-}
-
-fcViews.agendaDay = AgendaDayView;
-
-function AgendaDayView(element, calendar) {
- var t = this;
-
-
- // exports
- t.render = render;
-
-
- // imports
- AgendaView.call(t, element, calendar, 'agendaDay');
- var opt = t.opt;
- var renderAgenda = t.renderAgenda;
- var formatDate = calendar.formatDate;
-
-
-
- function render(date, delta) {
- if (delta) {
- addDays(date, delta);
- if (!opt('weekends')) {
- skipWeekend(date, delta < 0 ? -1 : 1);
- }
- }
- var start = cloneDate(date, true);
- var end = addDays(cloneDate(start), 1);
- t.title = formatDate(date, opt('titleFormat'));
- t.start = t.visStart = start;
- t.end = t.visEnd = end;
- renderAgenda(1);
- }
-
-
-}
-
-setDefaults({
- allDaySlot: true,
- allDayText: 'all-day',
- firstHour: 6,
- slotMinutes: 30,
- defaultEventMinutes: 120,
- axisFormat: 'h(:mm)tt',
- timeFormat: {
- agenda: 'h:mm{ - h:mm}'
- },
- dragOpacity: {
- agenda: .5
- },
- minTime: 0,
- maxTime: 24
-});
-
-
-// TODO: make it work in quirks mode (event corners, all-day height)
-// TODO: test liquid width, especially in IE6
-
-
-function AgendaView(element, calendar, viewName) {
- var t = this;
-
-
- // exports
- t.renderAgenda = renderAgenda;
- t.setWidth = setWidth;
- t.setHeight = setHeight;
- t.beforeHide = beforeHide;
- t.afterShow = afterShow;
- t.defaultEventEnd = defaultEventEnd;
- t.timePosition = timePosition;
- t.dayOfWeekCol = dayOfWeekCol;
- t.dateCell = dateCell;
- t.cellDate = cellDate;
- t.cellIsAllDay = cellIsAllDay;
- t.allDayRow = getAllDayRow;
- t.allDayBounds = allDayBounds;
- t.getHoverListener = function() { return hoverListener };
- t.colContentLeft = colContentLeft;
- t.colContentRight = colContentRight;
- t.getDaySegmentContainer = function() { return daySegmentContainer };
- t.getSlotSegmentContainer = function() { return slotSegmentContainer };
- t.getMinMinute = function() { return minMinute };
- t.getMaxMinute = function() { return maxMinute };
- t.getBodyContent = function() { return slotContent }; // !!??
- t.getRowCnt = function() { return 1 };
- t.getColCnt = function() { return colCnt };
- t.getColWidth = function() { return colWidth };
- t.getSlotHeight = function() { return slotHeight };
- t.defaultSelectionEnd = defaultSelectionEnd;
- t.renderDayOverlay = renderDayOverlay;
- t.renderSelection = renderSelection;
- t.clearSelection = clearSelection;
- t.reportDayClick = reportDayClick; // selection mousedown hack
- t.dragStart = dragStart;
- t.dragStop = dragStop;
-
-
- // imports
- View.call(t, element, calendar, viewName);
- OverlayManager.call(t);
- SelectionManager.call(t);
- AgendaEventRenderer.call(t);
- var opt = t.opt;
- var trigger = t.trigger;
- var clearEvents = t.clearEvents;
- var renderOverlay = t.renderOverlay;
- var clearOverlays = t.clearOverlays;
- var reportSelection = t.reportSelection;
- var unselect = t.unselect;
- var daySelectionMousedown = t.daySelectionMousedown;
- var slotSegHtml = t.slotSegHtml;
- var formatDate = calendar.formatDate;
-
-
- // locals
-
- var dayTable;
- var dayHead;
- var dayHeadCells;
- var dayBody;
- var dayBodyCells;
- var dayBodyCellInners;
- var dayBodyFirstCell;
- var dayBodyFirstCellStretcher;
- var slotLayer;
- var daySegmentContainer;
- var allDayTable;
- var allDayRow;
- var slotScroller;
- var slotContent;
- var slotSegmentContainer;
- var slotTable;
- var slotTableFirstInner;
- var axisFirstCells;
- var gutterCells;
- var selectionHelper;
-
- var viewWidth;
- var viewHeight;
- var axisWidth;
- var colWidth;
- var gutterWidth;
- var slotHeight; // TODO: what if slotHeight changes? (see issue 650)
- var savedScrollTop;
-
- var colCnt;
- var slotCnt;
- var coordinateGrid;
- var hoverListener;
- var colContentPositions;
- var slotTopCache = {};
-
- var tm;
- var firstDay;
- var nwe; // no weekends (int)
- var rtl, dis, dit; // day index sign / translate
- var minMinute, maxMinute;
- var colFormat;
-
-
-
- /* Rendering
- -----------------------------------------------------------------------------*/
-
-
- disableTextSelection(element.addClass('fc-agenda'));
-
-
- function renderAgenda(c) {
- colCnt = c;
- updateOptions();
- if (!dayTable) {
- buildSkeleton();
- }else{
- clearEvents();
- }
- updateCells();
- }
-
-
-
- function updateOptions() {
- tm = opt('theme') ? 'ui' : 'fc';
- nwe = opt('weekends') ? 0 : 1;
- firstDay = opt('firstDay');
- if (rtl = opt('isRTL')) {
- dis = -1;
- dit = colCnt - 1;
- }else{
- dis = 1;
- dit = 0;
- }
- minMinute = parseTime(opt('minTime'));
- maxMinute = parseTime(opt('maxTime'));
- colFormat = opt('columnFormat');
- }
-
-
-
- function buildSkeleton() {
- var headerClass = tm + "-widget-header";
- var contentClass = tm + "-widget-content";
- var s;
- var i;
- var d;
- var maxd;
- var minutes;
- var slotNormal = opt('slotMinutes') % 15 == 0;
-
- s =
- "<table style='width:100%' class='fc-agenda-days fc-border-separate' cellspacing='0'>" +
- "<thead>" +
- "<tr>" +
- "<th class='fc-agenda-axis " + headerClass + "'>&nbsp;</th>";
- for (i=0; i<colCnt; i++) {
- s +=
- "<th class='fc- fc-col" + i + ' ' + headerClass + "'/>"; // fc- needed for setDayID
- }
- s +=
- "<th class='fc-agenda-gutter " + headerClass + "'>&nbsp;</th>" +
- "</tr>" +
- "</thead>" +
- "<tbody>" +
- "<tr>" +
- "<th class='fc-agenda-axis " + headerClass + "'>&nbsp;</th>";
- for (i=0; i<colCnt; i++) {
- s +=
- "<td class='fc- fc-col" + i + ' ' + contentClass + "'>" + // fc- needed for setDayID
- "<div>" +
- "<div class='fc-day-content'>" +
- "<div style='position:relative'>&nbsp;</div>" +
- "</div>" +
- "</div>" +
- "</td>";
- }
- s +=
- "<td class='fc-agenda-gutter " + contentClass + "'>&nbsp;</td>" +
- "</tr>" +
- "</tbody>" +
- "</table>";
- dayTable = $(s).appendTo(element);
- dayHead = dayTable.find('thead');
- dayHeadCells = dayHead.find('th').slice(1, -1);
- dayBody = dayTable.find('tbody');
- dayBodyCells = dayBody.find('td').slice(0, -1);
- dayBodyCellInners = dayBodyCells.find('div.fc-day-content div');
- dayBodyFirstCell = dayBodyCells.eq(0);
- dayBodyFirstCellStretcher = dayBodyFirstCell.find('> div');
-
- markFirstLast(dayHead.add(dayHead.find('tr')));
- markFirstLast(dayBody.add(dayBody.find('tr')));
-
- axisFirstCells = dayHead.find('th:first');
- gutterCells = dayTable.find('.fc-agenda-gutter');
-
- slotLayer =
- $("<div style='position:absolute;z-index:2;left:0;width:100%'/>")
- .appendTo(element);
-
- if (opt('allDaySlot')) {
-
- daySegmentContainer =
- $("<div style='position:absolute;z-index:8;top:0;left:0'/>")
- .appendTo(slotLayer);
-
- s =
- "<table style='width:100%' class='fc-agenda-allday' cellspacing='0'>" +
- "<tr>" +
- "<th class='" + headerClass + " fc-agenda-axis'>" + opt('allDayText') + "</th>" +
- "<td>" +
- "<div class='fc-day-content'><div style='position:relative'/></div>" +
- "</td>" +
- "<th class='" + headerClass + " fc-agenda-gutter'>&nbsp;</th>" +
- "</tr>" +
- "</table>";
- allDayTable = $(s).appendTo(slotLayer);
- allDayRow = allDayTable.find('tr');
-
- dayBind(allDayRow.find('td'));
-
- axisFirstCells = axisFirstCells.add(allDayTable.find('th:first'));
- gutterCells = gutterCells.add(allDayTable.find('th.fc-agenda-gutter'));
-
- slotLayer.append(
- "<div class='fc-agenda-divider " + headerClass + "'>" +
- "<div class='fc-agenda-divider-inner'/>" +
- "</div>"
- );
-
- }else{
-
- daySegmentContainer = $([]); // in jQuery 1.4, we can just do $()
-
- }
-
- slotScroller =
- $("<div style='position:absolute;width:100%;overflow-x:hidden;overflow-y:auto'/>")
- .appendTo(slotLayer);
-
- slotContent =
- $("<div style='position:relative;width:100%;overflow:hidden'/>")
- .appendTo(slotScroller);
-
- slotSegmentContainer =
- $("<div style='position:absolute;z-index:8;top:0;left:0'/>")
- .appendTo(slotContent);
-
- s =
- "<table class='fc-agenda-slots' style='width:100%' cellspacing='0'>" +
- "<tbody>";
- d = zeroDate();
- maxd = addMinutes(cloneDate(d), maxMinute);
- addMinutes(d, minMinute);
- slotCnt = 0;
- for (i=0; d < maxd; i++) {
- minutes = d.getMinutes();
- s +=
- "<tr class='fc-slot" + i + ' ' + (!minutes ? '' : 'fc-minor') + "'>" +
- "<th class='fc-agenda-axis " + headerClass + "'>" +
- ((!slotNormal || !minutes) ? formatDate(d, opt('axisFormat')) : '&nbsp;') +
- "</th>" +
- "<td class='" + contentClass + "'>" +
- "<div style='position:relative'>&nbsp;</div>" +
- "</td>" +
- "</tr>";
- addMinutes(d, opt('slotMinutes'));
- slotCnt++;
- }
- s +=
- "</tbody>" +
- "</table>";
- slotTable = $(s).appendTo(slotContent);
- slotTableFirstInner = slotTable.find('div:first');
-
- slotBind(slotTable.find('td'));
-
- axisFirstCells = axisFirstCells.add(slotTable.find('th:first'));
- }
-
-
-
- function updateCells() {
- var i;
- var headCell;
- var bodyCell;
- var date;
- var today = clearTime(new Date());
- for (i=0; i<colCnt; i++) {
- date = colDate(i);
- headCell = dayHeadCells.eq(i);
- headCell.html(formatDate(date, colFormat));
- bodyCell = dayBodyCells.eq(i);
- if (+date == +today) {
- bodyCell.addClass(tm + '-state-highlight fc-today');
- }else{
- bodyCell.removeClass(tm + '-state-highlight fc-today');
- }
- setDayID(headCell.add(bodyCell), date);
- }
- }
-
-
-
- function setHeight(height, dateChanged) {
- if (height === undefined) {
- height = viewHeight;
- }
- viewHeight = height;
- slotTopCache = {};
-
- var headHeight = dayBody.position().top;
- var allDayHeight = slotScroller.position().top; // including divider
- var bodyHeight = Math.min( // total body height, including borders
- height - headHeight, // when scrollbars
- slotTable.height() + allDayHeight + 1 // when no scrollbars. +1 for bottom border
- );
-
- dayBodyFirstCellStretcher
- .height(bodyHeight - vsides(dayBodyFirstCell));
-
- slotLayer.css('top', headHeight);
-
- slotScroller.height(bodyHeight - allDayHeight - 1);
-
- slotHeight = slotTableFirstInner.height() + 1; // +1 for border
-
- if (dateChanged) {
- resetScroll();
- }
- }
-
-
-
- function setWidth(width) {
- viewWidth = width;
- colContentPositions.clear();
-
- axisWidth = 0;
- setOuterWidth(
- axisFirstCells
- .width('')
- .each(function(i, _cell) {
- axisWidth = Math.max(axisWidth, $(_cell).outerWidth());
- }),
- axisWidth
- );
-
- var slotTableWidth = slotScroller[0].clientWidth; // needs to be done after axisWidth (for IE7)
- //slotTable.width(slotTableWidth);
-
- gutterWidth = slotScroller.width() - slotTableWidth;
- if (gutterWidth) {
- setOuterWidth(gutterCells, gutterWidth);
- gutterCells
- .show()
- .prev()
- .removeClass('fc-last');
- }else{
- gutterCells
- .hide()
- .prev()
- .addClass('fc-last');
- }
-
- colWidth = Math.floor((slotTableWidth - axisWidth) / colCnt);
- setOuterWidth(dayHeadCells.slice(0, -1), colWidth);
- }
-
-
-
- function resetScroll() {
- var d0 = zeroDate();
- var scrollDate = cloneDate(d0);
- scrollDate.setHours(opt('firstHour'));
- var top = timePosition(d0, scrollDate) + 1; // +1 for the border
- function scroll() {
- slotScroller.scrollTop(top);
- }
- scroll();
- setTimeout(scroll, 0); // overrides any previous scroll state made by the browser
- }
-
-
- function beforeHide() {
- savedScrollTop = slotScroller.scrollTop();
- }
-
-
- function afterShow() {
- slotScroller.scrollTop(savedScrollTop);
- }
-
-
-
- /* Slot/Day clicking and binding
- -----------------------------------------------------------------------*/
-
-
- function dayBind(cells) {
- cells.click(slotClick)
- .mousedown(daySelectionMousedown);
- }
-
-
- function slotBind(cells) {
- cells.click(slotClick)
- .mousedown(slotSelectionMousedown);
- }
-
-
- function slotClick(ev) {
- if (!opt('selectable')) { // if selectable, SelectionManager will worry about dayClick
- var col = Math.min(colCnt-1, Math.floor((ev.pageX - dayTable.offset().left - axisWidth) / colWidth));
- var date = colDate(col);
- var rowMatch = this.parentNode.className.match(/fc-slot(\d+)/); // TODO: maybe use data
- if (rowMatch) {
- var mins = parseInt(rowMatch[1]) * opt('slotMinutes');
- var hours = Math.floor(mins/60);
- date.setHours(hours);
- date.setMinutes(mins%60 + minMinute);
- trigger('dayClick', dayBodyCells[col], date, false, ev);
- }else{
- trigger('dayClick', dayBodyCells[col], date, true, ev);
- }
- }
- }
-
-
-
- /* Semi-transparent Overlay Helpers
- -----------------------------------------------------*/
-
-
- function renderDayOverlay(startDate, endDate, refreshCoordinateGrid) { // endDate is exclusive
- if (refreshCoordinateGrid) {
- coordinateGrid.build();
- }
- var visStart = cloneDate(t.visStart);
- var startCol, endCol;
- if (rtl) {
- startCol = dayDiff(endDate, visStart)*dis+dit+1;
- endCol = dayDiff(startDate, visStart)*dis+dit+1;
- }else{
- startCol = dayDiff(startDate, visStart);
- endCol = dayDiff(endDate, visStart);
- }
- startCol = Math.max(0, startCol);
- endCol = Math.min(colCnt, endCol);
- if (startCol < endCol) {
- dayBind(
- renderCellOverlay(0, startCol, 0, endCol-1)
- );
- }
- }
-
-
- function renderCellOverlay(row0, col0, row1, col1) { // only for all-day?
- var rect = coordinateGrid.rect(row0, col0, row1, col1, slotLayer);
- return renderOverlay(rect, slotLayer);
- }
-
-
- function renderSlotOverlay(overlayStart, overlayEnd) {
- var dayStart = cloneDate(t.visStart);
- var dayEnd = addDays(cloneDate(dayStart), 1);
- for (var i=0; i<colCnt; i++) {
- var stretchStart = new Date(Math.max(dayStart, overlayStart));
- var stretchEnd = new Date(Math.min(dayEnd, overlayEnd));
- if (stretchStart < stretchEnd) {
- var col = i*dis+dit;
- var rect = coordinateGrid.rect(0, col, 0, col, slotContent); // only use it for horizontal coords
- var top = timePosition(dayStart, stretchStart);
- var bottom = timePosition(dayStart, stretchEnd);
- rect.top = top;
- rect.height = bottom - top;
- slotBind(
- renderOverlay(rect, slotContent)
- );
- }
- addDays(dayStart, 1);
- addDays(dayEnd, 1);
- }
- }
-
-
-
- /* Coordinate Utilities
- -----------------------------------------------------------------------------*/
-
-
- coordinateGrid = new CoordinateGrid(function(rows, cols) {
- var e, n, p;
- dayHeadCells.each(function(i, _e) {
- e = $(_e);
- n = e.offset().left;
- if (i) {
- p[1] = n;
- }
- p = [n];
- cols[i] = p;
- });
- p[1] = n + e.outerWidth();
- if (opt('allDaySlot')) {
- e = allDayRow;
- n = e.offset().top;
- rows[0] = [n, n+e.outerHeight()];
- }
- var slotTableTop = slotContent.offset().top;
- var slotScrollerTop = slotScroller.offset().top;
- var slotScrollerBottom = slotScrollerTop + slotScroller.outerHeight();
- function constrain(n) {
- return Math.max(slotScrollerTop, Math.min(slotScrollerBottom, n));
- }
- for (var i=0; i<slotCnt; i++) {
- rows.push([
- constrain(slotTableTop + slotHeight*i),
- constrain(slotTableTop + slotHeight*(i+1))
- ]);
- }
- });
-
-
- hoverListener = new HoverListener(coordinateGrid);
-
-
- colContentPositions = new HorizontalPositionCache(function(col) {
- return dayBodyCellInners.eq(col);
- });
-
-
- function colContentLeft(col) {
- return colContentPositions.left(col);
- }
-
-
- function colContentRight(col) {
- return colContentPositions.right(col);
- }
-
-
-
-
- function dateCell(date) { // "cell" terminology is now confusing
- return {
- row: Math.floor(dayDiff(date, t.visStart) / 7),
- col: dayOfWeekCol(date.getDay())
- };
- }
-
-
- function cellDate(cell) {
- var d = colDate(cell.col);
- var slotIndex = cell.row;
- if (opt('allDaySlot')) {
- slotIndex--;
- }
- if (slotIndex >= 0) {
- addMinutes(d, minMinute + slotIndex * opt('slotMinutes'));
- }
- return d;
- }
-
-
- function colDate(col) { // returns dates with 00:00:00
- return addDays(cloneDate(t.visStart), col*dis+dit);
- }
-
-
- function cellIsAllDay(cell) {
- return opt('allDaySlot') && !cell.row;
- }
-
-
- function dayOfWeekCol(dayOfWeek) {
- return ((dayOfWeek - Math.max(firstDay, nwe) + colCnt) % colCnt)*dis+dit;
- }
-
-
-
-
- // get the Y coordinate of the given time on the given day (both Date objects)
- function timePosition(day, time) { // both date objects. day holds 00:00 of current day
- day = cloneDate(day, true);
- if (time < addMinutes(cloneDate(day), minMinute)) {
- return 0;
- }
- if (time >= addMinutes(cloneDate(day), maxMinute)) {
- return slotTable.height();
- }
- var slotMinutes = opt('slotMinutes'),
- minutes = time.getHours()*60 + time.getMinutes() - minMinute,
- slotI = Math.floor(minutes / slotMinutes),
- slotTop = slotTopCache[slotI];
- if (slotTop === undefined) {
- slotTop = slotTopCache[slotI] = slotTable.find('tr:eq(' + slotI + ') td div')[0].offsetTop; //.position().top; // need this optimization???
- }
- return Math.max(0, Math.round(
- slotTop - 1 + slotHeight * ((minutes % slotMinutes) / slotMinutes)
- ));
- }
-
-
- function allDayBounds() {
- return {
- left: axisWidth,
- right: viewWidth - gutterWidth
- }
- }
-
-
- function getAllDayRow(index) {
- return allDayRow;
- }
-
-
- function defaultEventEnd(event) {
- var start = cloneDate(event.start);
- if (event.allDay) {
- return start;
- }
- return addMinutes(start, opt('defaultEventMinutes'));
- }
-
-
-
- /* Selection
- ---------------------------------------------------------------------------------*/
-
-
- function defaultSelectionEnd(startDate, allDay) {
- if (allDay) {
- return cloneDate(startDate);
- }
- return addMinutes(cloneDate(startDate), opt('slotMinutes'));
- }
-
-
- function renderSelection(startDate, endDate, allDay) { // only for all-day
- if (allDay) {
- if (opt('allDaySlot')) {
- renderDayOverlay(startDate, addDays(cloneDate(endDate), 1), true);
- }
- }else{
- renderSlotSelection(startDate, endDate);
- }
- }
-
-
- function renderSlotSelection(startDate, endDate) {
- var helperOption = opt('selectHelper');
- coordinateGrid.build();
- if (helperOption) {
- var col = dayDiff(startDate, t.visStart) * dis + dit;
- if (col >= 0 && col < colCnt) { // only works when times are on same day
- var rect = coordinateGrid.rect(0, col, 0, col, slotContent); // only for horizontal coords
- var top = timePosition(startDate, startDate);
- var bottom = timePosition(startDate, endDate);
- if (bottom > top) { // protect against selections that are entirely before or after visible range
- rect.top = top;
- rect.height = bottom - top;
- rect.left += 2;
- rect.width -= 5;
- if ($.isFunction(helperOption)) {
- var helperRes = helperOption(startDate, endDate);
- if (helperRes) {
- rect.position = 'absolute';
- rect.zIndex = 8;
- selectionHelper = $(helperRes)
- .css(rect)
- .appendTo(slotContent);
- }
- }else{
- rect.isStart = true; // conside rect a "seg" now
- rect.isEnd = true; //
- selectionHelper = $(slotSegHtml(
- {
- title: '',
- start: startDate,
- end: endDate,
- className: ['fc-select-helper'],
- editable: false
- },
- rect
- ));
- selectionHelper.css('opacity', opt('dragOpacity'));
- }
- if (selectionHelper) {
- slotBind(selectionHelper);
- slotContent.append(selectionHelper);
- setOuterWidth(selectionHelper, rect.width, true); // needs to be after appended
- setOuterHeight(selectionHelper, rect.height, true);
- }
- }
- }
- }else{
- renderSlotOverlay(startDate, endDate);
- }
- }
-
-
- function clearSelection() {
- clearOverlays();
- if (selectionHelper) {
- selectionHelper.remove();
- selectionHelper = null;
- }
- }
-
-
- function slotSelectionMousedown(ev) {
- if (ev.which == 1 && opt('selectable')) { // ev.which==1 means left mouse button
- unselect(ev);
- var dates;
- hoverListener.start(function(cell, origCell) {
- clearSelection();
- if (cell && cell.col == origCell.col && !cellIsAllDay(cell)) {
- var d1 = cellDate(origCell);
- var d2 = cellDate(cell);
- dates = [
- d1,
- addMinutes(cloneDate(d1), opt('slotMinutes')),
- d2,
- addMinutes(cloneDate(d2), opt('slotMinutes'))
- ].sort(cmp);
- renderSlotSelection(dates[0], dates[3]);
- }else{
- dates = null;
- }
- }, ev);
- $(document).one('mouseup', function(ev) {
- hoverListener.stop();
- if (dates) {
- if (+dates[0] == +dates[1]) {
- reportDayClick(dates[0], false, ev);
- }
- reportSelection(dates[0], dates[3], false, ev);
- }
- });
- }
- }
-
-
- function reportDayClick(date, allDay, ev) {
- trigger('dayClick', dayBodyCells[dayOfWeekCol(date.getDay())], date, allDay, ev);
- }
-
-
-
- /* External Dragging
- --------------------------------------------------------------------------------*/
-
-
- function dragStart(_dragElement, ev, ui) {
- hoverListener.start(function(cell) {
- clearOverlays();
- if (cell) {
- if (cellIsAllDay(cell)) {
- renderCellOverlay(cell.row, cell.col, cell.row, cell.col);
- }else{
- var d1 = cellDate(cell);
- var d2 = addMinutes(cloneDate(d1), opt('defaultEventMinutes'));
- renderSlotOverlay(d1, d2);
- }
- }
- }, ev);
- }
-
-
- function dragStop(_dragElement, ev, ui) {
- var cell = hoverListener.stop();
- clearOverlays();
- if (cell) {
- trigger('drop', _dragElement, cellDate(cell), cellIsAllDay(cell), ev, ui);
- }
- }
-
-
-}
-
-function AgendaEventRenderer() {
- var t = this;
-
-
- // exports
- t.renderEvents = renderEvents;
- t.compileDaySegs = compileDaySegs; // for DayEventRenderer
- t.clearEvents = clearEvents;
- t.slotSegHtml = slotSegHtml;
- t.bindDaySeg = bindDaySeg;
-
-
- // imports
- DayEventRenderer.call(t);
- var opt = t.opt;
- var trigger = t.trigger;
- //var setOverflowHidden = t.setOverflowHidden;
- var isEventDraggable = t.isEventDraggable;
- var isEventResizable = t.isEventResizable;
- var eventEnd = t.eventEnd;
- var reportEvents = t.reportEvents;
- var reportEventClear = t.reportEventClear;
- var eventElementHandlers = t.eventElementHandlers;
- var setHeight = t.setHeight;
- var getDaySegmentContainer = t.getDaySegmentContainer;
- var getSlotSegmentContainer = t.getSlotSegmentContainer;
- var getHoverListener = t.getHoverListener;
- var getMaxMinute = t.getMaxMinute;
- var getMinMinute = t.getMinMinute;
- var timePosition = t.timePosition;
- var colContentLeft = t.colContentLeft;
- var colContentRight = t.colContentRight;
- var renderDaySegs = t.renderDaySegs;
- var resizableDayEvent = t.resizableDayEvent; // TODO: streamline binding architecture
- var getColCnt = t.getColCnt;
- var getColWidth = t.getColWidth;
- var getSlotHeight = t.getSlotHeight;
- var getBodyContent = t.getBodyContent;
- var reportEventElement = t.reportEventElement;
- var showEvents = t.showEvents;
- var hideEvents = t.hideEvents;
- var eventDrop = t.eventDrop;
- var eventResize = t.eventResize;
- var renderDayOverlay = t.renderDayOverlay;
- var clearOverlays = t.clearOverlays;
- var calendar = t.calendar;
- var formatDate = calendar.formatDate;
- var formatDates = calendar.formatDates;
-
-
-
- /* Rendering
- ----------------------------------------------------------------------------*/
-
-
- function renderEvents(events, modifiedEventId) {
- reportEvents(events);
- var i, len=events.length,
- dayEvents=[],
- slotEvents=[];
- for (i=0; i<len; i++) {
- if (events[i].allDay) {
- dayEvents.push(events[i]);
- }else{
- slotEvents.push(events[i]);
- }
- }
- if (opt('allDaySlot')) {
- renderDaySegs(compileDaySegs(dayEvents), modifiedEventId);
- setHeight(); // no params means set to viewHeight
- }
- renderSlotSegs(compileSlotSegs(slotEvents), modifiedEventId);
- }
-
-
- function clearEvents() {
- reportEventClear();
- getDaySegmentContainer().empty();
- getSlotSegmentContainer().empty();
- }
-
-
- function compileDaySegs(events) {
- var levels = stackSegs(sliceSegs(events, $.map(events, exclEndDay), t.visStart, t.visEnd)),
- i, levelCnt=levels.length, level,
- j, seg,
- segs=[];
- for (i=0; i<levelCnt; i++) {
- level = levels[i];
- for (j=0; j<level.length; j++) {
- seg = level[j];
- seg.row = 0;
- seg.level = i; // not needed anymore
- segs.push(seg);
- }
- }
- return segs;
- }
-
-
- function compileSlotSegs(events) {
- var colCnt = getColCnt(),
- minMinute = getMinMinute(),
- maxMinute = getMaxMinute(),
- d = addMinutes(cloneDate(t.visStart), minMinute),
- visEventEnds = $.map(events, slotEventEnd),
- i, col,
- j, level,
- k, seg,
- segs=[];
- for (i=0; i<colCnt; i++) {
- col = stackSegs(sliceSegs(events, visEventEnds, d, addMinutes(cloneDate(d), maxMinute-minMinute)));
- countForwardSegs(col);
- for (j=0; j<col.length; j++) {
- level = col[j];
- for (k=0; k<level.length; k++) {
- seg = level[k];
- seg.col = i;
- seg.level = j;
- segs.push(seg);
- }
- }
- addDays(d, 1, true);
- }
- return segs;
- }
-
-
- function slotEventEnd(event) {
- if (event.end) {
- return cloneDate(event.end);
- }else{
- return addMinutes(cloneDate(event.start), opt('defaultEventMinutes'));
- }
- }
-
-
- // renders events in the 'time slots' at the bottom
-
- function renderSlotSegs(segs, modifiedEventId) {
-
- var i, segCnt=segs.length, seg,
- event,
- classes,
- top, bottom,
- colI, levelI, forward,
- leftmost,
- availWidth,
- outerWidth,
- left,
- html='',
- eventElements,
- eventElement,
- triggerRes,
- vsideCache={},
- hsideCache={},
- key, val,
- contentElement,
- height,
- slotSegmentContainer = getSlotSegmentContainer(),
- rtl, dis, dit,
- colCnt = getColCnt();
-
- if (rtl = opt('isRTL')) {
- dis = -1;
- dit = colCnt - 1;
- }else{
- dis = 1;
- dit = 0;
- }
-
- // calculate position/dimensions, create html
- for (i=0; i<segCnt; i++) {
- seg = segs[i];
- event = seg.event;
- top = timePosition(seg.start, seg.start);
- bottom = timePosition(seg.start, seg.end);
- colI = seg.col;
- levelI = seg.level;
- forward = seg.forward || 0;
- leftmost = colContentLeft(colI*dis + dit);
- availWidth = colContentRight(colI*dis + dit) - leftmost;
- availWidth = Math.min(availWidth-6, availWidth*.95); // TODO: move this to CSS
- if (levelI) {
- // indented and thin
- outerWidth = availWidth / (levelI + forward + 1);
- }else{
- if (forward) {
- // moderately wide, aligned left still
- outerWidth = ((availWidth / (forward + 1)) - (12/2)) * 2; // 12 is the predicted width of resizer =
- }else{
- // can be entire width, aligned left
- outerWidth = availWidth;
- }
- }
- left = leftmost + // leftmost possible
- (availWidth / (levelI + forward + 1) * levelI) // indentation
- * dis + (rtl ? availWidth - outerWidth : 0); // rtl
- seg.top = top;
- seg.left = left;
- seg.outerWidth = outerWidth;
- seg.outerHeight = bottom - top;
- html += slotSegHtml(event, seg);
- }
- slotSegmentContainer[0].innerHTML = html; // faster than html()
- eventElements = slotSegmentContainer.children();
-
- // retrieve elements, run through eventRender callback, bind event handlers
- for (i=0; i<segCnt; i++) {
- seg = segs[i];
- event = seg.event;
- eventElement = $(eventElements[i]); // faster than eq()
- triggerRes = trigger('eventRender', event, event, eventElement);
- if (triggerRes === false) {
- eventElement.remove();
- }else{
- if (triggerRes && triggerRes !== true) {
- eventElement.remove();
- eventElement = $(triggerRes)
- .css({
- position: 'absolute',
- top: seg.top,
- left: seg.left
- })
- .appendTo(slotSegmentContainer);
- }
- seg.element = eventElement;
- if (event._id === modifiedEventId) {
- bindSlotSeg(event, eventElement, seg);
- }else{
- eventElement[0]._fci = i; // for lazySegBind
- }
- reportEventElement(event, eventElement);
- }
- }
-
- lazySegBind(slotSegmentContainer, segs, bindSlotSeg);
-
- // record event sides and title positions
- for (i=0; i<segCnt; i++) {
- seg = segs[i];
- if (eventElement = seg.element) {
- val = vsideCache[key = seg.key = cssKey(eventElement[0])];
- seg.vsides = val === undefined ? (vsideCache[key] = vsides(eventElement, true)) : val;
- val = hsideCache[key];
- seg.hsides = val === undefined ? (hsideCache[key] = hsides(eventElement, true)) : val;
- contentElement = eventElement.find('div.fc-event-content');
- if (contentElement.length) {
- seg.contentTop = contentElement[0].offsetTop;
- }
- }
- }
-
- // set all positions/dimensions at once
- for (i=0; i<segCnt; i++) {
- seg = segs[i];
- if (eventElement = seg.element) {
- eventElement[0].style.width = Math.max(0, seg.outerWidth - seg.hsides) + 'px';
- height = Math.max(0, seg.outerHeight - seg.vsides);
- eventElement[0].style.height = height + 'px';
- event = seg.event;
- if (seg.contentTop !== undefined && height - seg.contentTop < 10) {
- // not enough room for title, put it in the time header
- eventElement.find('div.fc-event-time')
- .text(formatDate(event.start, opt('timeFormat')) + ' - ' + event.title);
- eventElement.find('div.fc-event-title')
- .remove();
- }
- trigger('eventAfterRender', event, event, eventElement);
- }
- }
-
- }
-
-
- function slotSegHtml(event, seg) {
- var html = "<";
- var url = event.url;
- var skinCss = getSkinCss(event, opt);
- var skinCssAttr = (skinCss ? " style='" + skinCss + "'" : '');
- var classes = ['fc-event', 'fc-event-skin', 'fc-event-vert'];
- if (isEventDraggable(event)) {
- classes.push('fc-event-draggable');
- }
- if (seg.isStart) {
- classes.push('fc-corner-top');
- }
- if (seg.isEnd) {
- classes.push('fc-corner-bottom');
- }
- classes = classes.concat(event.className);
- if (event.source) {
- classes = classes.concat(event.source.className || []);
- }
- if (url) {
- html += "a href='" + htmlEscape(event.url) + "'";
- }else{
- html += "div";
- }
- html +=
- " class='" + classes.join(' ') + "'" +
- " style='position:absolute;z-index:8;top:" + seg.top + "px;left:" + seg.left + "px;" + skinCss + "'" +
- ">" +
- "<div class='fc-event-inner fc-event-skin'" + skinCssAttr + ">" +
- "<div class='fc-event-head fc-event-skin'" + skinCssAttr + ">" +
- "<div class='fc-event-time'>" +
- htmlEscape(formatDates(event.start, event.end, opt('timeFormat'))) +
- "</div>" +
- "</div>" +
- "<div class='fc-event-content'>" +
- "<div class='fc-event-title'>" +
- htmlEscape(event.title) +
- "</div>" +
- "</div>" +
- "<div class='fc-event-bg'></div>" +
- "</div>"; // close inner
- if (seg.isEnd && isEventResizable(event)) {
- html +=
- "<div class='ui-resizable-handle ui-resizable-s'>=</div>";
- }
- html +=
- "</" + (url ? "a" : "div") + ">";
- return html;
- }
-
-
- function bindDaySeg(event, eventElement, seg) {
- if (isEventDraggable(event)) {
- draggableDayEvent(event, eventElement, seg.isStart);
- }
- if (seg.isEnd && isEventResizable(event)) {
- resizableDayEvent(event, eventElement, seg);
- }
- eventElementHandlers(event, eventElement);
- // needs to be after, because resizableDayEvent might stopImmediatePropagation on click
- }
-
-
- function bindSlotSeg(event, eventElement, seg) {
- var timeElement = eventElement.find('div.fc-event-time');
- if (isEventDraggable(event)) {
- draggableSlotEvent(event, eventElement, timeElement);
- }
- if (seg.isEnd && isEventResizable(event)) {
- resizableSlotEvent(event, eventElement, timeElement);
- }
- eventElementHandlers(event, eventElement);
- }
-
-
-
- /* Dragging
- -----------------------------------------------------------------------------------*/
-
-
- // when event starts out FULL-DAY
-
- function draggableDayEvent(event, eventElement, isStart) {
- var origWidth;
- var revert;
- var allDay=true;
- var dayDelta;
- var dis = opt('isRTL') ? -1 : 1;
- var hoverListener = getHoverListener();
- var colWidth = getColWidth();
- var slotHeight = getSlotHeight();
- var minMinute = getMinMinute();
- eventElement.draggable({
- zIndex: 9,
- opacity: opt('dragOpacity', 'month'), // use whatever the month view was using
- revertDuration: opt('dragRevertDuration'),
- start: function(ev, ui) {
- trigger('eventDragStart', eventElement, event, ev, ui);
- hideEvents(event, eventElement);
- origWidth = eventElement.width();
- hoverListener.start(function(cell, origCell, rowDelta, colDelta) {
- clearOverlays();
- if (cell) {
- //setOverflowHidden(true);
- revert = false;
- dayDelta = colDelta * dis;
- if (!cell.row) {
- // on full-days
- renderDayOverlay(
- addDays(cloneDate(event.start), dayDelta),
- addDays(exclEndDay(event), dayDelta)
- );
- resetElement();
- }else{
- // mouse is over bottom slots
- if (isStart) {
- if (allDay) {
- // convert event to temporary slot-event
- eventElement.width(colWidth - 10); // don't use entire width
- setOuterHeight(
- eventElement,
- slotHeight * Math.round(
- (event.end ? ((event.end - event.start) / MINUTE_MS) : opt('defaultEventMinutes'))
- / opt('slotMinutes')
- )
- );
- eventElement.draggable('option', 'grid', [colWidth, 1]);
- allDay = false;
- }
- }else{
- revert = true;
- }
- }
- revert = revert || (allDay && !dayDelta);
- }else{
- resetElement();
- //setOverflowHidden(false);
- revert = true;
- }
- eventElement.draggable('option', 'revert', revert);
- }, ev, 'drag');
- },
- stop: function(ev, ui) {
- hoverListener.stop();
- clearOverlays();
- trigger('eventDragStop', eventElement, event, ev, ui);
- if (revert) {
- // hasn't moved or is out of bounds (draggable has already reverted)
- resetElement();
- eventElement.css('filter', ''); // clear IE opacity side-effects
- showEvents(event, eventElement);
- }else{
- // changed!
- var minuteDelta = 0;
- if (!allDay) {
- minuteDelta = Math.round((eventElement.offset().top - getBodyContent().offset().top) / slotHeight)
- * opt('slotMinutes')
- + minMinute
- - (event.start.getHours() * 60 + event.start.getMinutes());
- }
- eventDrop(this, event, dayDelta, minuteDelta, allDay, ev, ui);
- }
- //setOverflowHidden(false);
- }
- });
- function resetElement() {
- if (!allDay) {
- eventElement
- .width(origWidth)
- .height('')
- .draggable('option', 'grid', null);
- allDay = true;
- }
- }
- }
-
-
- // when event starts out IN TIMESLOTS
-
- function draggableSlotEvent(event, eventElement, timeElement) {
- var origPosition;
- var allDay=false;
- var dayDelta;
- var minuteDelta;
- var prevMinuteDelta;
- var dis = opt('isRTL') ? -1 : 1;
- var hoverListener = getHoverListener();
- var colCnt = getColCnt();
- var colWidth = getColWidth();
- var slotHeight = getSlotHeight();
- eventElement.draggable({
- zIndex: 9,
- scroll: false,
- grid: [colWidth, slotHeight],
- axis: colCnt==1 ? 'y' : false,
- opacity: opt('dragOpacity'),
- revertDuration: opt('dragRevertDuration'),
- start: function(ev, ui) {
- trigger('eventDragStart', eventElement, event, ev, ui);
- hideEvents(event, eventElement);
- origPosition = eventElement.position();
- minuteDelta = prevMinuteDelta = 0;
- hoverListener.start(function(cell, origCell, rowDelta, colDelta) {
- eventElement.draggable('option', 'revert', !cell);
- clearOverlays();
- if (cell) {
- dayDelta = colDelta * dis;
- if (opt('allDaySlot') && !cell.row) {
- // over full days
- if (!allDay) {
- // convert to temporary all-day event
- allDay = true;
- timeElement.hide();
- eventElement.draggable('option', 'grid', null);
- }
- renderDayOverlay(
- addDays(cloneDate(event.start), dayDelta),
- addDays(exclEndDay(event), dayDelta)
- );
- }else{
- // on slots
- resetElement();
- }
- }
- }, ev, 'drag');
- },
- drag: function(ev, ui) {
- minuteDelta = Math.round((ui.position.top - origPosition.top) / slotHeight) * opt('slotMinutes');
- if (minuteDelta != prevMinuteDelta) {
- if (!allDay) {
- updateTimeText(minuteDelta);
- }
- prevMinuteDelta = minuteDelta;
- }
- },
- stop: function(ev, ui) {
- var cell = hoverListener.stop();
- clearOverlays();
- trigger('eventDragStop', eventElement, event, ev, ui);
- if (cell && (dayDelta || minuteDelta || allDay)) {
- // changed!
- eventDrop(this, event, dayDelta, allDay ? 0 : minuteDelta, allDay, ev, ui);
- }else{
- // either no change or out-of-bounds (draggable has already reverted)
- resetElement();
- eventElement.css('filter', ''); // clear IE opacity side-effects
- eventElement.css(origPosition); // sometimes fast drags make event revert to wrong position
- updateTimeText(0);
- showEvents(event, eventElement);
- }
- }
- });
- function updateTimeText(minuteDelta) {
- var newStart = addMinutes(cloneDate(event.start), minuteDelta);
- var newEnd;
- if (event.end) {
- newEnd = addMinutes(cloneDate(event.end), minuteDelta);
- }
- timeElement.text(formatDates(newStart, newEnd, opt('timeFormat')));
- }
- function resetElement() {
- // convert back to original slot-event
- if (allDay) {
- timeElement.css('display', ''); // show() was causing display=inline
- eventElement.draggable('option', 'grid', [colWidth, slotHeight]);
- allDay = false;
- }
- }
- }
-
-
-
- /* Resizing
- --------------------------------------------------------------------------------------*/
-
-
- function resizableSlotEvent(event, eventElement, timeElement) {
- var slotDelta, prevSlotDelta;
- var slotHeight = getSlotHeight();
- eventElement.resizable({
- handles: {
- s: 'div.ui-resizable-s'
- },
- grid: slotHeight,
- start: function(ev, ui) {
- slotDelta = prevSlotDelta = 0;
- hideEvents(event, eventElement);
- eventElement.css('z-index', 9);
- trigger('eventResizeStart', this, event, ev, ui);
- },
- resize: function(ev, ui) {
- // don't rely on ui.size.height, doesn't take grid into account
- slotDelta = Math.round((Math.max(slotHeight, eventElement.height()) - ui.originalSize.height) / slotHeight);
- if (slotDelta != prevSlotDelta) {
- timeElement.text(
- formatDates(
- event.start,
- (!slotDelta && !event.end) ? null : // no change, so don't display time range
- addMinutes(eventEnd(event), opt('slotMinutes')*slotDelta),
- opt('timeFormat')
- )
- );
- prevSlotDelta = slotDelta;
- }
- },
- stop: function(ev, ui) {
- trigger('eventResizeStop', this, event, ev, ui);
- if (slotDelta) {
- eventResize(this, event, 0, opt('slotMinutes')*slotDelta, ev, ui);
- }else{
- eventElement.css('z-index', 8);
- showEvents(event, eventElement);
- // BUG: if event was really short, need to put title back in span
- }
- }
- });
- }
-
-
-}
-
-
-function countForwardSegs(levels) {
- var i, j, k, level, segForward, segBack;
- for (i=levels.length-1; i>0; i--) {
- level = levels[i];
- for (j=0; j<level.length; j++) {
- segForward = level[j];
- for (k=0; k<levels[i-1].length; k++) {
- segBack = levels[i-1][k];
- if (segsCollide(segForward, segBack)) {
- segBack.forward = Math.max(segBack.forward||0, (segForward.forward||0)+1);
- }
- }
- }
- }
-}
-
-
-
-
-function View(element, calendar, viewName) {
- var t = this;
-
-
- // exports
- t.element = element;
- t.calendar = calendar;
- t.name = viewName;
- t.opt = opt;
- t.trigger = trigger;
- //t.setOverflowHidden = setOverflowHidden;
- t.isEventDraggable = isEventDraggable;
- t.isEventResizable = isEventResizable;
- t.reportEvents = reportEvents;
- t.eventEnd = eventEnd;
- t.reportEventElement = reportEventElement;
- t.reportEventClear = reportEventClear;
- t.eventElementHandlers = eventElementHandlers;
- t.showEvents = showEvents;
- t.hideEvents = hideEvents;
- t.eventDrop = eventDrop;
- t.eventResize = eventResize;
- // t.title
- // t.start, t.end
- // t.visStart, t.visEnd
-
-
- // imports
- var defaultEventEnd = t.defaultEventEnd;
- var normalizeEvent = calendar.normalizeEvent; // in EventManager
- var reportEventChange = calendar.reportEventChange;
-
-
- // locals
- var eventsByID = {};
- var eventElements = [];
- var eventElementsByID = {};
- var options = calendar.options;
-
-
-
- function opt(name, viewNameOverride) {
- var v = options[name];
- if (typeof v == 'object') {
- return smartProperty(v, viewNameOverride || viewName);
- }
- return v;
- }
-
-
- function trigger(name, thisObj) {
- return calendar.trigger.apply(
- calendar,
- [name, thisObj || t].concat(Array.prototype.slice.call(arguments, 2), [t])
- );
- }
-
-
- /*
- function setOverflowHidden(bool) {
- element.css('overflow', bool ? 'hidden' : '');
- }
- */
-
-
- function isEventDraggable(event) {
- return isEventEditable(event) && !opt('disableDragging');
- }
-
-
- function isEventResizable(event) { // but also need to make sure the seg.isEnd == true
- return isEventEditable(event) && !opt('disableResizing');
- }
-
-
- function isEventEditable(event) {
- return firstDefined(event.editable, (event.source || {}).editable, opt('editable'));
- }
-
-
-
- /* Event Data
- ------------------------------------------------------------------------------*/
-
-
- // report when view receives new events
- function reportEvents(events) { // events are already normalized at this point
- eventsByID = {};
- var i, len=events.length, event;
- for (i=0; i<len; i++) {
- event = events[i];
- if (eventsByID[event._id]) {
- eventsByID[event._id].push(event);
- }else{
- eventsByID[event._id] = [event];
- }
- }
- }
-
-
- // returns a Date object for an event's end
- function eventEnd(event) {
- return event.end ? cloneDate(event.end) : defaultEventEnd(event);
- }
-
-
-
- /* Event Elements
- ------------------------------------------------------------------------------*/
-
-
- // report when view creates an element for an event
- function reportEventElement(event, element) {
- eventElements.push(element);
- if (eventElementsByID[event._id]) {
- eventElementsByID[event._id].push(element);
- }else{
- eventElementsByID[event._id] = [element];
- }
- }
-
-
- function reportEventClear() {
- eventElements = [];
- eventElementsByID = {};
- }
-
-
- // attaches eventClick, eventMouseover, eventMouseout
- function eventElementHandlers(event, eventElement) {
- eventElement
- .click(function(ev) {
- if (!eventElement.hasClass('ui-draggable-dragging') &&
- !eventElement.hasClass('ui-resizable-resizing')) {
- return trigger('eventClick', this, event, ev);
- }
- })
- .hover(
- function(ev) {
- trigger('eventMouseover', this, event, ev);
- },
- function(ev) {
- trigger('eventMouseout', this, event, ev);
- }
- );
- // TODO: don't fire eventMouseover/eventMouseout *while* dragging is occuring (on subject element)
- // TODO: same for resizing
- }
-
-
- function showEvents(event, exceptElement) {
- eachEventElement(event, exceptElement, 'show');
- }
-
-
- function hideEvents(event, exceptElement) {
- eachEventElement(event, exceptElement, 'hide');
- }
-
-
- function eachEventElement(event, exceptElement, funcName) {
- var elements = eventElementsByID[event._id],
- i, len = elements.length;
- for (i=0; i<len; i++) {
- if (!exceptElement || elements[i][0] != exceptElement[0]) {
- elements[i][funcName]();
- }
- }
- }
-
-
-
- /* Event Modification Reporting
- ---------------------------------------------------------------------------------*/
-
-
- function eventDrop(e, event, dayDelta, minuteDelta, allDay, ev, ui) {
- var oldAllDay = event.allDay;
- var eventId = event._id;
- moveEvents(eventsByID[eventId], dayDelta, minuteDelta, allDay);
- trigger(
- 'eventDrop',
- e,
- event,
- dayDelta,
- minuteDelta,
- allDay,
- function() {
- // TODO: investigate cases where this inverse technique might not work
- moveEvents(eventsByID[eventId], -dayDelta, -minuteDelta, oldAllDay);
- reportEventChange(eventId);
- },
- ev,
- ui
- );
- reportEventChange(eventId);
- }
-
-
- function eventResize(e, event, dayDelta, minuteDelta, ev, ui) {
- var eventId = event._id;
- elongateEvents(eventsByID[eventId], dayDelta, minuteDelta);
- trigger(
- 'eventResize',
- e,
- event,
- dayDelta,
- minuteDelta,
- function() {
- // TODO: investigate cases where this inverse technique might not work
- elongateEvents(eventsByID[eventId], -dayDelta, -minuteDelta);
- reportEventChange(eventId);
- },
- ev,
- ui
- );
- reportEventChange(eventId);
- }
-
-
-
- /* Event Modification Math
- ---------------------------------------------------------------------------------*/
-
-
- function moveEvents(events, dayDelta, minuteDelta, allDay) {
- minuteDelta = minuteDelta || 0;
- for (var e, len=events.length, i=0; i<len; i++) {
- e = events[i];
- if (allDay !== undefined) {
- e.allDay = allDay;
- }
- addMinutes(addDays(e.start, dayDelta, true), minuteDelta);
- if (e.end) {
- e.end = addMinutes(addDays(e.end, dayDelta, true), minuteDelta);
- }
- normalizeEvent(e, options);
- }
- }
-
-
- function elongateEvents(events, dayDelta, minuteDelta) {
- minuteDelta = minuteDelta || 0;
- for (var e, len=events.length, i=0; i<len; i++) {
- e = events[i];
- e.end = addMinutes(addDays(eventEnd(e), dayDelta, true), minuteDelta);
- normalizeEvent(e, options);
- }
- }
-
-
-}
-
-function DayEventRenderer() {
- var t = this;
-
-
- // exports
- t.renderDaySegs = renderDaySegs;
- t.resizableDayEvent = resizableDayEvent;
-
-
- // imports
- var opt = t.opt;
- var trigger = t.trigger;
- var isEventDraggable = t.isEventDraggable;
- var isEventResizable = t.isEventResizable;
- var eventEnd = t.eventEnd;
- var reportEventElement = t.reportEventElement;
- var showEvents = t.showEvents;
- var hideEvents = t.hideEvents;
- var eventResize = t.eventResize;
- var getRowCnt = t.getRowCnt;
- var getColCnt = t.getColCnt;
- var getColWidth = t.getColWidth;
- var allDayRow = t.allDayRow;
- var allDayBounds = t.allDayBounds;
- var colContentLeft = t.colContentLeft;
- var colContentRight = t.colContentRight;
- var dayOfWeekCol = t.dayOfWeekCol;
- var dateCell = t.dateCell;
- var compileDaySegs = t.compileDaySegs;
- var getDaySegmentContainer = t.getDaySegmentContainer;
- var bindDaySeg = t.bindDaySeg; //TODO: streamline this
- var formatDates = t.calendar.formatDates;
- var renderDayOverlay = t.renderDayOverlay;
- var clearOverlays = t.clearOverlays;
- var clearSelection = t.clearSelection;
-
-
-
- /* Rendering
- -----------------------------------------------------------------------------*/
-
-
- function renderDaySegs(segs, modifiedEventId) {
- var segmentContainer = getDaySegmentContainer();
- var rowDivs;
- var rowCnt = getRowCnt();
- var colCnt = getColCnt();
- var i = 0;
- var rowI;
- var levelI;
- var colHeights;
- var j;
- var segCnt = segs.length;
- var seg;
- var top;
- var k;
- segmentContainer[0].innerHTML = daySegHTML(segs); // faster than .html()
- daySegElementResolve(segs, segmentContainer.children());
- daySegElementReport(segs);
- daySegHandlers(segs, segmentContainer, modifiedEventId);
- daySegCalcHSides(segs);
- daySegSetWidths(segs);
- daySegCalcHeights(segs);
- rowDivs = getRowDivs();
- // set row heights, calculate event tops (in relation to row top)
- for (rowI=0; rowI<rowCnt; rowI++) {
- levelI = 0;
- colHeights = [];
- for (j=0; j<colCnt; j++) {
- colHeights[j] = 0;
- }
- while (i<segCnt && (seg = segs[i]).row == rowI) {
- // loop through segs in a row
- top = arrayMax(colHeights.slice(seg.startCol, seg.endCol));
- seg.top = top;
- top += seg.outerHeight;
- for (k=seg.startCol; k<seg.endCol; k++) {
- colHeights[k] = top;
- }
- i++;
- }
- rowDivs[rowI].height(arrayMax(colHeights));
- }
- daySegSetTops(segs, getRowTops(rowDivs));
- }
-
-
- function renderTempDaySegs(segs, adjustRow, adjustTop) {
- var tempContainer = $("<div/>");
- var elements;
- var segmentContainer = getDaySegmentContainer();
- var i;
- var segCnt = segs.length;
- var element;
- tempContainer[0].innerHTML = daySegHTML(segs); // faster than .html()
- elements = tempContainer.children();
- segmentContainer.append(elements);
- daySegElementResolve(segs, elements);
- daySegCalcHSides(segs);
- daySegSetWidths(segs);
- daySegCalcHeights(segs);
- daySegSetTops(segs, getRowTops(getRowDivs()));
- elements = [];
- for (i=0; i<segCnt; i++) {
- element = segs[i].element;
- if (element) {
- if (segs[i].row === adjustRow) {
- element.css('top', adjustTop);
- }
- elements.push(element[0]);
- }
- }
- return $(elements);
- }
-
-
- function daySegHTML(segs) { // also sets seg.left and seg.outerWidth
- var rtl = opt('isRTL');
- var i;
- var segCnt=segs.length;
- var seg;
- var event;
- var url;
- var classes;
- var bounds = allDayBounds();
- var minLeft = bounds.left;
- var maxLeft = bounds.right;
- var leftCol;
- var rightCol;
- var left;
- var right;
- var skinCss;
- var html = '';
- // calculate desired position/dimensions, create html
- for (i=0; i<segCnt; i++) {
- seg = segs[i];
- event = seg.event;
- classes = ['fc-event', 'fc-event-skin', 'fc-event-hori'];
- if (isEventDraggable(event)) {
- classes.push('fc-event-draggable');
- }
- if (rtl) {
- if (seg.isStart) {
- classes.push('fc-corner-right');
- }
- if (seg.isEnd) {
- classes.push('fc-corner-left');
- }
- leftCol = dayOfWeekCol(seg.end.getDay()-1);
- rightCol = dayOfWeekCol(seg.start.getDay());
- left = seg.isEnd ? colContentLeft(leftCol) : minLeft;
- right = seg.isStart ? colContentRight(rightCol) : maxLeft;
- }else{
- if (seg.isStart) {
- classes.push('fc-corner-left');
- }
- if (seg.isEnd) {
- classes.push('fc-corner-right');
- }
- leftCol = dayOfWeekCol(seg.start.getDay());
- rightCol = dayOfWeekCol(seg.end.getDay()-1);
- left = seg.isStart ? colContentLeft(leftCol) : minLeft;
- right = seg.isEnd ? colContentRight(rightCol) : maxLeft;
- }
- classes = classes.concat(event.className);
- if (event.source) {
- classes = classes.concat(event.source.className || []);
- }
- url = event.url;
- skinCss = getSkinCss(event, opt);
- if (url) {
- html += "<a href='" + htmlEscape(url) + "'";
- }else{
- html += "<div";
- }
- html +=
- " class='" + classes.join(' ') + "'" +
- " style='position:absolute;z-index:8;left:"+left+"px;" + skinCss + "'" +
- ">" +
- "<div" +
- " class='fc-event-inner fc-event-skin'" +
- (skinCss ? " style='" + skinCss + "'" : '') +
- ">";
- if (!event.allDay && seg.isStart) {
- html +=
- "<span class='fc-event-time'>" +
- htmlEscape(formatDates(event.start, event.end, opt('timeFormat'))) +
- "</span>";
- }
- html +=
- "<span class='fc-event-title'>" + htmlEscape(event.title) + "</span>" +
- "</div>";
- if (seg.isEnd && isEventResizable(event)) {
- html +=
- "<div class='ui-resizable-handle ui-resizable-" + (rtl ? 'w' : 'e') + "'>" +
- "&nbsp;&nbsp;&nbsp;" + // makes hit area a lot better for IE6/7
- "</div>";
- }
- html +=
- "</" + (url ? "a" : "div" ) + ">";
- seg.left = left;
- seg.outerWidth = right - left;
- seg.startCol = leftCol;
- seg.endCol = rightCol + 1; // needs to be exclusive
- }
- return html;
- }
-
-
- function daySegElementResolve(segs, elements) { // sets seg.element
- var i;
- var segCnt = segs.length;
- var seg;
- var event;
- var element;
- var triggerRes;
- for (i=0; i<segCnt; i++) {
- seg = segs[i];
- event = seg.event;
- element = $(elements[i]); // faster than .eq()
- triggerRes = trigger('eventRender', event, event, element);
- if (triggerRes === false) {
- element.remove();
- }else{
- if (triggerRes && triggerRes !== true) {
- triggerRes = $(triggerRes)
- .css({
- position: 'absolute',
- left: seg.left
- });
- element.replaceWith(triggerRes);
- element = triggerRes;
- }
- seg.element = element;
- }
- }
- }
-
-
- function daySegElementReport(segs) {
- var i;
- var segCnt = segs.length;
- var seg;
- var element;
- for (i=0; i<segCnt; i++) {
- seg = segs[i];
- element = seg.element;
- if (element) {
- reportEventElement(seg.event, element);
- }
- }
- }
-
-
- function daySegHandlers(segs, segmentContainer, modifiedEventId) {
- var i;
- var segCnt = segs.length;
- var seg;
- var element;
- var event;
- // retrieve elements, run through eventRender callback, bind handlers
- for (i=0; i<segCnt; i++) {
- seg = segs[i];
- element = seg.element;
- if (element) {
- event = seg.event;
- if (event._id === modifiedEventId) {
- bindDaySeg(event, element, seg);
- }else{
- element[0]._fci = i; // for lazySegBind
- }
- }
- }
- lazySegBind(segmentContainer, segs, bindDaySeg);
- }
-
-
- function daySegCalcHSides(segs) { // also sets seg.key
- var i;
- var segCnt = segs.length;
- var seg;
- var element;
- var key, val;
- var hsideCache = {};
- // record event horizontal sides
- for (i=0; i<segCnt; i++) {
- seg = segs[i];
- element = seg.element;
- if (element) {
- key = seg.key = cssKey(element[0]);
- val = hsideCache[key];
- if (val === undefined) {
- val = hsideCache[key] = hsides(element, true);
- }
- seg.hsides = val;
- }
- }
- }
-
-
- function daySegSetWidths(segs) {
- var i;
- var segCnt = segs.length;
- var seg;
- var element;
- for (i=0; i<segCnt; i++) {
- seg = segs[i];
- element = seg.element;
- if (element) {
- element[0].style.width = Math.max(0, seg.outerWidth - seg.hsides) + 'px';
- }
- }
- }
-
-
- function daySegCalcHeights(segs) {
- var i;
- var segCnt = segs.length;
- var seg;
- var element;
- var key, val;
- var vmarginCache = {};
- // record event heights
- for (i=0; i<segCnt; i++) {
- seg = segs[i];
- element = seg.element;
- if (element) {
- key = seg.key; // created in daySegCalcHSides
- val = vmarginCache[key];
- if (val === undefined) {
- val = vmarginCache[key] = vmargins(element);
- }
- seg.outerHeight = element[0].offsetHeight + val;
- }
- }
- }
-
-
- function getRowDivs() {
- var i;
- var rowCnt = getRowCnt();
- var rowDivs = [];
- for (i=0; i<rowCnt; i++) {
- rowDivs[i] = allDayRow(i)
- .find('td:first div.fc-day-content > div'); // optimal selector?
- }
- return rowDivs;
- }
-
-
- function getRowTops(rowDivs) {
- var i;
- var rowCnt = rowDivs.length;
- var tops = [];
- for (i=0; i<rowCnt; i++) {
- tops[i] = rowDivs[i][0].offsetTop; // !!?? but this means the element needs position:relative if in a table cell!!!!
- }
- return tops;
- }
-
-
- function daySegSetTops(segs, rowTops) { // also triggers eventAfterRender
- var i;
- var segCnt = segs.length;
- var seg;
- var element;
- var event;
- for (i=0; i<segCnt; i++) {
- seg = segs[i];
- element = seg.element;
- if (element) {
- element[0].style.top = rowTops[seg.row] + (seg.top||0) + 'px';
- event = seg.event;
- trigger('eventAfterRender', event, event, element);
- }
- }
- }
-
-
-
- /* Resizing
- -----------------------------------------------------------------------------------*/
-
-
- function resizableDayEvent(event, element, seg) {
- var rtl = opt('isRTL');
- var direction = rtl ? 'w' : 'e';
- var handle = element.find('div.ui-resizable-' + direction);
- var isResizing = false;
-
- // TODO: look into using jquery-ui mouse widget for this stuff
- disableTextSelection(element); // prevent native <a> selection for IE
- element
- .mousedown(function(ev) { // prevent native <a> selection for others
- ev.preventDefault();
- })
- .click(function(ev) {
- if (isResizing) {
- ev.preventDefault(); // prevent link from being visited (only method that worked in IE6)
- ev.stopImmediatePropagation(); // prevent fullcalendar eventClick handler from being called
- // (eventElementHandlers needs to be bound after resizableDayEvent)
- }
- });
-
- handle.mousedown(function(ev) {
- if (ev.which != 1) {
- return; // needs to be left mouse button
- }
- isResizing = true;
- var hoverListener = t.getHoverListener();
- var rowCnt = getRowCnt();
- var colCnt = getColCnt();
- var dis = rtl ? -1 : 1;
- var dit = rtl ? colCnt-1 : 0;
- var elementTop = element.css('top');
- var dayDelta;
- var helpers;
- var eventCopy = $.extend({}, event);
- var minCell = dateCell(event.start);
- clearSelection();
- $('body')
- .css('cursor', direction + '-resize')
- .one('mouseup', mouseup);
- trigger('eventResizeStart', this, event, ev);
- hoverListener.start(function(cell, origCell) {
- if (cell) {
- var r = Math.max(minCell.row, cell.row);
- var c = cell.col;
- if (rowCnt == 1) {
- r = 0; // hack for all-day area in agenda views
- }
- if (r == minCell.row) {
- if (rtl) {
- c = Math.min(minCell.col, c);
- }else{
- c = Math.max(minCell.col, c);
- }
- }
- dayDelta = (r*7 + c*dis+dit) - (origCell.row*7 + origCell.col*dis+dit);
- var newEnd = addDays(eventEnd(event), dayDelta, true);
- if (dayDelta) {
- eventCopy.end = newEnd;
- var oldHelpers = helpers;
- helpers = renderTempDaySegs(compileDaySegs([eventCopy]), seg.row, elementTop);
- helpers.find('*').css('cursor', direction + '-resize');
- if (oldHelpers) {
- oldHelpers.remove();
- }
- hideEvents(event);
- }else{
- if (helpers) {
- showEvents(event);
- helpers.remove();
- helpers = null;
- }
- }
- clearOverlays();
- renderDayOverlay(event.start, addDays(cloneDate(newEnd), 1)); // coordinate grid already rebuild at hoverListener.start
- }
- }, ev);
-
- function mouseup(ev) {
- trigger('eventResizeStop', this, event, ev);
- $('body').css('cursor', '');
- hoverListener.stop();
- clearOverlays();
- if (dayDelta) {
- eventResize(this, event, dayDelta, 0, ev);
- // event redraw will clear helpers
- }
- // otherwise, the drag handler already restored the old events
-
- setTimeout(function() { // make this happen after the element's click event
- isResizing = false;
- },0);
- }
-
- });
- }
-
-
-}
-
-//BUG: unselect needs to be triggered when events are dragged+dropped
-
-function SelectionManager() {
- var t = this;
-
-
- // exports
- t.select = select;
- t.unselect = unselect;
- t.reportSelection = reportSelection;
- t.daySelectionMousedown = daySelectionMousedown;
-
-
- // imports
- var opt = t.opt;
- var trigger = t.trigger;
- var defaultSelectionEnd = t.defaultSelectionEnd;
- var renderSelection = t.renderSelection;
- var clearSelection = t.clearSelection;
-
-
- // locals
- var selected = false;
-
-
-
- // unselectAuto
- if (opt('selectable') && opt('unselectAuto')) {
- $(document).mousedown(function(ev) {
- var ignore = opt('unselectCancel');
- if (ignore) {
- if ($(ev.target).parents(ignore).length) { // could be optimized to stop after first match
- return;
- }
- }
- unselect(ev);
- });
- }
-
-
- function select(startDate, endDate, allDay) {
- unselect();
- if (!endDate) {
- endDate = defaultSelectionEnd(startDate, allDay);
- }
- renderSelection(startDate, endDate, allDay);
- reportSelection(startDate, endDate, allDay);
- }
-
-
- function unselect(ev) {
- if (selected) {
- selected = false;
- clearSelection();
- trigger('unselect', null, ev);
- }
- }
-
-
- function reportSelection(startDate, endDate, allDay, ev) {
- selected = true;
- trigger('select', null, startDate, endDate, allDay, ev);
- }
-
-
- function daySelectionMousedown(ev) { // not really a generic manager method, oh well
- var cellDate = t.cellDate;
- var cellIsAllDay = t.cellIsAllDay;
- var hoverListener = t.getHoverListener();
- var reportDayClick = t.reportDayClick; // this is hacky and sort of weird
- if (ev.which == 1 && opt('selectable')) { // which==1 means left mouse button
- unselect(ev);
- var _mousedownElement = this;
- var dates;
- hoverListener.start(function(cell, origCell) { // TODO: maybe put cellDate/cellIsAllDay info in cell
- clearSelection();
- if (cell && cellIsAllDay(cell)) {
- dates = [ cellDate(origCell), cellDate(cell) ].sort(cmp);
- renderSelection(dates[0], dates[1], true);
- }else{
- dates = null;
- }
- }, ev);
- $(document).one('mouseup', function(ev) {
- hoverListener.stop();
- if (dates) {
- if (+dates[0] == +dates[1]) {
- reportDayClick(dates[0], true, ev);
- }
- reportSelection(dates[0], dates[1], true, ev);
- }
- });
- }
- }
-
-
-}
-
-function OverlayManager() {
- var t = this;
-
-
- // exports
- t.renderOverlay = renderOverlay;
- t.clearOverlays = clearOverlays;
-
-
- // locals
- var usedOverlays = [];
- var unusedOverlays = [];
-
-
- function renderOverlay(rect, parent) {
- var e = unusedOverlays.shift();
- if (!e) {
- e = $("<div class='fc-cell-overlay' style='position:absolute;z-index:3'/>");
- }
- if (e[0].parentNode != parent[0]) {
- e.appendTo(parent);
- }
- usedOverlays.push(e.css(rect).show());
- return e;
- }
-
-
- function clearOverlays() {
- var e;
- while (e = usedOverlays.shift()) {
- unusedOverlays.push(e.hide().unbind());
- }
- }
-
-
-}
-
-function CoordinateGrid(buildFunc) {
-
- var t = this;
- var rows;
- var cols;
-
-
- t.build = function() {
- rows = [];
- cols = [];
- buildFunc(rows, cols);
- };
-
-
- t.cell = function(x, y) {
- var rowCnt = rows.length;
- var colCnt = cols.length;
- var i, r=-1, c=-1;
- for (i=0; i<rowCnt; i++) {
- if (y >= rows[i][0] && y < rows[i][1]) {
- r = i;
- break;
- }
- }
- for (i=0; i<colCnt; i++) {
- if (x >= cols[i][0] && x < cols[i][1]) {
- c = i;
- break;
- }
- }
- return (r>=0 && c>=0) ? { row:r, col:c } : null;
- };
-
-
- t.rect = function(row0, col0, row1, col1, originElement) { // row1,col1 is inclusive
- var origin = originElement.offset();
- return {
- top: rows[row0][0] - origin.top,
- left: cols[col0][0] - origin.left,
- width: cols[col1][1] - cols[col0][0],
- height: rows[row1][1] - rows[row0][0]
- };
- };
-
-}
-
-function HoverListener(coordinateGrid) {
-
-
- var t = this;
- var bindType;
- var change;
- var firstCell;
- var cell;
-
-
- t.start = function(_change, ev, _bindType) {
- change = _change;
- firstCell = cell = null;
- coordinateGrid.build();
- mouse(ev);
- bindType = _bindType || 'mousemove';
- $(document).bind(bindType, mouse);
- };
-
-
- function mouse(ev) {
- _fixUIEvent(ev); // see below
- var newCell = coordinateGrid.cell(ev.pageX, ev.pageY);
- if (!newCell != !cell || newCell && (newCell.row != cell.row || newCell.col != cell.col)) {
- if (newCell) {
- if (!firstCell) {
- firstCell = newCell;
- }
- change(newCell, firstCell, newCell.row-firstCell.row, newCell.col-firstCell.col);
- }else{
- change(newCell, firstCell);
- }
- cell = newCell;
- }
- }
-
-
- t.stop = function() {
- $(document).unbind(bindType, mouse);
- return cell;
- };
-
-
-}
-
-
-
-// this fix was only necessary for jQuery UI 1.8.16 (and jQuery 1.7 or 1.7.1)
-// upgrading to jQuery UI 1.8.17 (and using either jQuery 1.7 or 1.7.1) fixed the problem
-// but keep this in here for 1.8.16 users
-// and maybe remove it down the line
-
-function _fixUIEvent(event) { // for issue 1168
- if (event.pageX === undefined) {
- event.pageX = event.originalEvent.pageX;
- event.pageY = event.originalEvent.pageY;
- }
-}
-function HorizontalPositionCache(getElement) {
-
- var t = this,
- elements = {},
- lefts = {},
- rights = {};
-
- function e(i) {
- return elements[i] = elements[i] || getElement(i);
- }
-
- t.left = function(i) {
- return lefts[i] = lefts[i] === undefined ? e(i).position().left : lefts[i];
- };
-
- t.right = function(i) {
- return rights[i] = rights[i] === undefined ? t.left(i) + e(i).width() : rights[i];
- };
-
- t.clear = function() {
- elements = {};
- lefts = {};
- rights = {};
- };
-
-}
-
-})(jQuery);
diff --git a/3rdparty/fullcalendar/js/fullcalendar.min.js b/3rdparty/fullcalendar/js/fullcalendar.min.js
deleted file mode 100644
index da6c7c09fda..00000000000
--- a/3rdparty/fullcalendar/js/fullcalendar.min.js
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
-
- FullCalendar v1.5.4
- http://arshaw.com/fullcalendar/
-
- Use fullcalendar.css for basic styling.
- For event drag & drop, requires jQuery UI draggable.
- For event resizing, requires jQuery UI resizable.
-
- Copyright (c) 2011 Adam Shaw
- Dual licensed under the MIT and GPL licenses, located in
- MIT-LICENSE.txt and GPL-LICENSE.txt respectively.
-
- Date: Tue Sep 4 23:38:33 2012 -0700
-
-*/
-(function(m,ma){function wb(a){m.extend(true,Ya,a)}function Yb(a,b,e){function d(k){if(E){u();q();na();S(k)}else f()}function f(){B=b.theme?"ui":"fc";a.addClass("fc");b.isRTL&&a.addClass("fc-rtl");b.theme&&a.addClass("ui-widget");E=m("<div class='fc-content' style='position:relative'/>").prependTo(a);C=new Zb(X,b);(P=C.render())&&a.prepend(P);y(b.defaultView);m(window).resize(oa);t()||g()}function g(){setTimeout(function(){!n.start&&t()&&S()},0)}function l(){m(window).unbind("resize",oa);C.destroy();
-E.remove();a.removeClass("fc fc-rtl ui-widget")}function j(){return i.offsetWidth!==0}function t(){return m("body")[0].offsetWidth!==0}function y(k){if(!n||k!=n.name){F++;pa();var D=n,Z;if(D){(D.beforeHide||xb)();Za(E,E.height());D.element.hide()}else Za(E,1);E.css("overflow","hidden");if(n=Y[k])n.element.show();else n=Y[k]=new Ja[k](Z=s=m("<div class='fc-view fc-view-"+k+"' style='position:absolute'/>").appendTo(E),X);D&&C.deactivateButton(D.name);C.activateButton(k);S();E.css("overflow","");D&&
-Za(E,1);Z||(n.afterShow||xb)();F--}}function S(k){if(j()){F++;pa();o===ma&&u();var D=false;if(!n.start||k||r<n.start||r>=n.end){n.render(r,k||0);fa(true);D=true}else if(n.sizeDirty){n.clearEvents();fa();D=true}else if(n.eventsDirty){n.clearEvents();D=true}n.sizeDirty=false;n.eventsDirty=false;ga(D);W=a.outerWidth();C.updateTitle(n.title);k=new Date;k>=n.start&&k<n.end?C.disableButton("today"):C.enableButton("today");F--;n.trigger("viewDisplay",i)}}function Q(){q();if(j()){u();fa();pa();n.clearEvents();
-n.renderEvents(J);n.sizeDirty=false}}function q(){m.each(Y,function(k,D){D.sizeDirty=true})}function u(){o=b.contentHeight?b.contentHeight:b.height?b.height-(P?P.height():0)-Sa(E):Math.round(E.width()/Math.max(b.aspectRatio,0.5))}function fa(k){F++;n.setHeight(o,k);if(s){s.css("position","relative");s=null}n.setWidth(E.width(),k);F--}function oa(){if(!F)if(n.start){var k=++v;setTimeout(function(){if(k==v&&!F&&j())if(W!=(W=a.outerWidth())){F++;Q();n.trigger("windowResize",i);F--}},200)}else g()}function ga(k){if(!b.lazyFetching||
-ya(n.visStart,n.visEnd))ra();else k&&da()}function ra(){K(n.visStart,n.visEnd)}function sa(k){J=k;da()}function ha(k){da(k)}function da(k){na();if(j()){n.clearEvents();n.renderEvents(J,k);n.eventsDirty=false}}function na(){m.each(Y,function(k,D){D.eventsDirty=true})}function ua(k,D,Z){n.select(k,D,Z===ma?true:Z)}function pa(){n&&n.unselect()}function U(){S(-1)}function ca(){S(1)}function ka(){gb(r,-1);S()}function qa(){gb(r,1);S()}function G(){r=new Date;S()}function p(k,D,Z){if(k instanceof Date)r=
-N(k);else yb(r,k,D,Z);S()}function L(k,D,Z){k!==ma&&gb(r,k);D!==ma&&hb(r,D);Z!==ma&&ba(r,Z);S()}function c(){return N(r)}function z(){return n}function H(k,D){if(D===ma)return b[k];if(k=="height"||k=="contentHeight"||k=="aspectRatio"){b[k]=D;Q()}}function T(k,D){if(b[k])return b[k].apply(D||i,Array.prototype.slice.call(arguments,2))}var X=this;X.options=b;X.render=d;X.destroy=l;X.refetchEvents=ra;X.reportEvents=sa;X.reportEventChange=ha;X.rerenderEvents=da;X.changeView=y;X.select=ua;X.unselect=pa;
-X.prev=U;X.next=ca;X.prevYear=ka;X.nextYear=qa;X.today=G;X.gotoDate=p;X.incrementDate=L;X.formatDate=function(k,D){return Oa(k,D,b)};X.formatDates=function(k,D,Z){return ib(k,D,Z,b)};X.getDate=c;X.getView=z;X.option=H;X.trigger=T;$b.call(X,b,e);var ya=X.isFetchNeeded,K=X.fetchEvents,i=a[0],C,P,E,B,n,Y={},W,o,s,v=0,F=0,r=new Date,J=[],M;yb(r,b.year,b.month,b.date);b.droppable&&m(document).bind("dragstart",function(k,D){var Z=k.target,ja=m(Z);if(!ja.parents(".fc").length){var ia=b.dropAccept;if(m.isFunction(ia)?
-ia.call(Z,ja):ja.is(ia)){M=Z;n.dragStart(M,k,D)}}}).bind("dragstop",function(k,D){if(M){n.dragStop(M,k,D);M=null}})}function Zb(a,b){function e(){q=b.theme?"ui":"fc";if(b.header)return Q=m("<table class='fc-header' style='width:100%'/>").append(m("<tr/>").append(f("left")).append(f("center")).append(f("right")))}function d(){Q.remove()}function f(u){var fa=m("<td class='fc-header-"+u+"'/>");(u=b.header[u])&&m.each(u.split(" "),function(oa){oa>0&&fa.append("<span class='fc-header-space'/>");var ga;
-m.each(this.split(","),function(ra,sa){if(sa=="title"){fa.append("<span class='fc-header-title'><h2>&nbsp;</h2></span>");ga&&ga.addClass(q+"-corner-right");ga=null}else{var ha;if(a[sa])ha=a[sa];else if(Ja[sa])ha=function(){na.removeClass(q+"-state-hover");a.changeView(sa)};if(ha){ra=b.theme?jb(b.buttonIcons,sa):null;var da=jb(b.buttonText,sa),na=m("<span class='fc-button fc-button-"+sa+" "+q+"-state-default'><span class='fc-button-inner'><span class='fc-button-content'>"+(ra?"<span class='fc-icon-wrap'><span class='ui-icon ui-icon-"+
-ra+"'/></span>":da)+"</span><span class='fc-button-effect'><span></span></span></span></span>");if(na){na.click(function(){na.hasClass(q+"-state-disabled")||ha()}).mousedown(function(){na.not("."+q+"-state-active").not("."+q+"-state-disabled").addClass(q+"-state-down")}).mouseup(function(){na.removeClass(q+"-state-down")}).hover(function(){na.not("."+q+"-state-active").not("."+q+"-state-disabled").addClass(q+"-state-hover")},function(){na.removeClass(q+"-state-hover").removeClass(q+"-state-down")}).appendTo(fa);
-ga||na.addClass(q+"-corner-left");ga=na}}}});ga&&ga.addClass(q+"-corner-right")});return fa}function g(u){Q.find("h2").html(u)}function l(u){Q.find("span.fc-button-"+u).addClass(q+"-state-active")}function j(u){Q.find("span.fc-button-"+u).removeClass(q+"-state-active")}function t(u){Q.find("span.fc-button-"+u).addClass(q+"-state-disabled")}function y(u){Q.find("span.fc-button-"+u).removeClass(q+"-state-disabled")}var S=this;S.render=e;S.destroy=d;S.updateTitle=g;S.activateButton=l;S.deactivateButton=
-j;S.disableButton=t;S.enableButton=y;var Q=m([]),q}function $b(a,b){function e(c,z){return!ca||c<ca||z>ka}function d(c,z){ca=c;ka=z;L=[];c=++qa;G=z=U.length;for(var H=0;H<z;H++)f(U[H],c)}function f(c,z){g(c,function(H){if(z==qa){if(H){for(var T=0;T<H.length;T++){H[T].source=c;oa(H[T])}L=L.concat(H)}G--;G||ua(L)}})}function g(c,z){var H,T=Aa.sourceFetchers,X;for(H=0;H<T.length;H++){X=T[H](c,ca,ka,z);if(X===true)return;else if(typeof X=="object"){g(X,z);return}}if(H=c.events)if(m.isFunction(H)){u();
-H(N(ca),N(ka),function(C){z(C);fa()})}else m.isArray(H)?z(H):z();else if(c.url){var ya=c.success,K=c.error,i=c.complete;H=m.extend({},c.data||{});T=Ta(c.startParam,a.startParam);X=Ta(c.endParam,a.endParam);if(T)H[T]=Math.round(+ca/1E3);if(X)H[X]=Math.round(+ka/1E3);u();m.ajax(m.extend({},ac,c,{data:H,success:function(C){C=C||[];var P=$a(ya,this,arguments);if(m.isArray(P))C=P;z(C)},error:function(){$a(K,this,arguments);z()},complete:function(){$a(i,this,arguments);fa()}}))}else z()}function l(c){if(c=
-j(c)){G++;f(c,qa)}}function j(c){if(m.isFunction(c)||m.isArray(c))c={events:c};else if(typeof c=="string")c={url:c};if(typeof c=="object"){ga(c);U.push(c);return c}}function t(c){U=m.grep(U,function(z){return!ra(z,c)});L=m.grep(L,function(z){return!ra(z.source,c)});ua(L)}function y(c){var z,H=L.length,T,X=na().defaultEventEnd,ya=c.start-c._start,K=c.end?c.end-(c._end||X(c)):0;for(z=0;z<H;z++){T=L[z];if(T._id==c._id&&T!=c){T.start=new Date(+T.start+ya);T.end=c.end?T.end?new Date(+T.end+K):new Date(+X(T)+
-K):null;T.title=c.title;T.url=c.url;T.allDay=c.allDay;T.className=c.className;T.editable=c.editable;T.color=c.color;T.backgroudColor=c.backgroudColor;T.borderColor=c.borderColor;T.textColor=c.textColor;oa(T)}}oa(c);ua(L)}function S(c,z){oa(c);if(!c.source){if(z){pa.events.push(c);c.source=pa}L.push(c)}ua(L)}function Q(c){if(c){if(!m.isFunction(c)){var z=c+"";c=function(T){return T._id==z}}L=m.grep(L,c,true);for(H=0;H<U.length;H++)if(m.isArray(U[H].events))U[H].events=m.grep(U[H].events,c,true)}else{L=
-[];for(var H=0;H<U.length;H++)if(m.isArray(U[H].events))U[H].events=[]}ua(L)}function q(c){if(m.isFunction(c))return m.grep(L,c);else if(c){c+="";return m.grep(L,function(z){return z._id==c})}return L}function u(){p++||da("loading",null,true)}function fa(){--p||da("loading",null,false)}function oa(c){var z=c.source||{},H=Ta(z.ignoreTimezone,a.ignoreTimezone);c._id=c._id||(c.id===ma?"_fc"+bc++:c.id+"");if(c.date){if(!c.start)c.start=c.date;delete c.date}c._start=N(c.start=kb(c.start,H));c.end=kb(c.end,
-H);if(c.end&&c.end<=c.start)c.end=null;c._end=c.end?N(c.end):null;if(c.allDay===ma)c.allDay=Ta(z.allDayDefault,a.allDayDefault);if(c.className){if(typeof c.className=="string")c.className=c.className.split(/\s+/)}else c.className=[]}function ga(c){if(c.className){if(typeof c.className=="string")c.className=c.className.split(/\s+/)}else c.className=[];for(var z=Aa.sourceNormalizers,H=0;H<z.length;H++)z[H](c)}function ra(c,z){return c&&z&&sa(c)==sa(z)}function sa(c){return(typeof c=="object"?c.events||
-c.url:"")||c}var ha=this;ha.isFetchNeeded=e;ha.fetchEvents=d;ha.addEventSource=l;ha.removeEventSource=t;ha.updateEvent=y;ha.renderEvent=S;ha.removeEvents=Q;ha.clientEvents=q;ha.normalizeEvent=oa;var da=ha.trigger,na=ha.getView,ua=ha.reportEvents,pa={events:[]},U=[pa],ca,ka,qa=0,G=0,p=0,L=[];for(ha=0;ha<b.length;ha++)j(b[ha])}function gb(a,b,e){a.setFullYear(a.getFullYear()+b);e||Ka(a);return a}function hb(a,b,e){if(+a){b=a.getMonth()+b;var d=N(a);d.setDate(1);d.setMonth(b);a.setMonth(b);for(e||Ka(a);a.getMonth()!=
-d.getMonth();)a.setDate(a.getDate()+(a<d?1:-1))}return a}function ba(a,b,e){if(+a){b=a.getDate()+b;var d=N(a);d.setHours(9);d.setDate(b);a.setDate(b);e||Ka(a);lb(a,d)}return a}function lb(a,b){if(+a)for(;a.getDate()!=b.getDate();)a.setTime(+a+(a<b?1:-1)*cc)}function xa(a,b){a.setMinutes(a.getMinutes()+b);return a}function Ka(a){a.setHours(0);a.setMinutes(0);a.setSeconds(0);a.setMilliseconds(0);return a}function N(a,b){if(b)return Ka(new Date(+a));return new Date(+a)}function zb(){var a=0,b;do b=new Date(1970,
-a++,1);while(b.getHours());return b}function Fa(a,b,e){for(b=b||1;!a.getDay()||e&&a.getDay()==1||!e&&a.getDay()==6;)ba(a,b);return a}function Ca(a,b){return Math.round((N(a,true)-N(b,true))/Ab)}function yb(a,b,e,d){if(b!==ma&&b!=a.getFullYear()){a.setDate(1);a.setMonth(0);a.setFullYear(b)}if(e!==ma&&e!=a.getMonth()){a.setDate(1);a.setMonth(e)}d!==ma&&a.setDate(d)}function kb(a,b){if(typeof a=="object")return a;if(typeof a=="number")return new Date(a*1E3);if(typeof a=="string"){if(a.match(/^\d+(\.\d+)?$/))return new Date(parseFloat(a)*
-1E3);if(b===ma)b=true;return Bb(a,b)||(a?new Date(a):null)}return null}function Bb(a,b){a=a.match(/^([0-9]{4})(-([0-9]{2})(-([0-9]{2})([T ]([0-9]{2}):([0-9]{2})(:([0-9]{2})(\.([0-9]+))?)?(Z|(([-+])([0-9]{2})(:?([0-9]{2}))?))?)?)?)?$/);if(!a)return null;var e=new Date(a[1],0,1);if(b||!a[13]){b=new Date(a[1],0,1,9,0);if(a[3]){e.setMonth(a[3]-1);b.setMonth(a[3]-1)}if(a[5]){e.setDate(a[5]);b.setDate(a[5])}lb(e,b);a[7]&&e.setHours(a[7]);a[8]&&e.setMinutes(a[8]);a[10]&&e.setSeconds(a[10]);a[12]&&e.setMilliseconds(Number("0."+
-a[12])*1E3);lb(e,b)}else{e.setUTCFullYear(a[1],a[3]?a[3]-1:0,a[5]||1);e.setUTCHours(a[7]||0,a[8]||0,a[10]||0,a[12]?Number("0."+a[12])*1E3:0);if(a[14]){b=Number(a[16])*60+(a[18]?Number(a[18]):0);b*=a[15]=="-"?1:-1;e=new Date(+e+b*60*1E3)}}return e}function mb(a){if(typeof a=="number")return a*60;if(typeof a=="object")return a.getHours()*60+a.getMinutes();if(a=a.match(/(\d+)(?::(\d+))?\s*(\w+)?/)){var b=parseInt(a[1],10);if(a[3]){b%=12;if(a[3].toLowerCase().charAt(0)=="p")b+=12}return b*60+(a[2]?parseInt(a[2],
-10):0)}}function Oa(a,b,e){return ib(a,null,b,e)}function ib(a,b,e,d){d=d||Ya;var f=a,g=b,l,j=e.length,t,y,S,Q="";for(l=0;l<j;l++){t=e.charAt(l);if(t=="'")for(y=l+1;y<j;y++){if(e.charAt(y)=="'"){if(f){Q+=y==l+1?"'":e.substring(l+1,y);l=y}break}}else if(t=="(")for(y=l+1;y<j;y++){if(e.charAt(y)==")"){l=Oa(f,e.substring(l+1,y),d);if(parseInt(l.replace(/\D/,""),10))Q+=l;l=y;break}}else if(t=="[")for(y=l+1;y<j;y++){if(e.charAt(y)=="]"){t=e.substring(l+1,y);l=Oa(f,t,d);if(l!=Oa(g,t,d))Q+=l;l=y;break}}else if(t==
-"{"){f=b;g=a}else if(t=="}"){f=a;g=b}else{for(y=j;y>l;y--)if(S=dc[e.substring(l,y)]){if(f)Q+=S(f,d);l=y-1;break}if(y==l)if(f)Q+=t}}return Q}function Ua(a){return a.end?ec(a.end,a.allDay):ba(N(a.start),1)}function ec(a,b){a=N(a);return b||a.getHours()||a.getMinutes()?ba(a,1):Ka(a)}function fc(a,b){return(b.msLength-a.msLength)*100+(a.event.start-b.event.start)}function Cb(a,b){return a.end>b.start&&a.start<b.end}function nb(a,b,e,d){var f=[],g,l=a.length,j,t,y,S,Q;for(g=0;g<l;g++){j=a[g];t=j.start;
-y=b[g];if(y>e&&t<d){if(t<e){t=N(e);S=false}else{t=t;S=true}if(y>d){y=N(d);Q=false}else{y=y;Q=true}f.push({event:j,start:t,end:y,isStart:S,isEnd:Q,msLength:y-t})}}return f.sort(fc)}function ob(a){var b=[],e,d=a.length,f,g,l,j;for(e=0;e<d;e++){f=a[e];for(g=0;;){l=false;if(b[g])for(j=0;j<b[g].length;j++)if(Cb(b[g][j],f)){l=true;break}if(l)g++;else break}if(b[g])b[g].push(f);else b[g]=[f]}return b}function Db(a,b,e){a.unbind("mouseover").mouseover(function(d){for(var f=d.target,g;f!=this;){g=f;f=f.parentNode}if((f=
-g._fci)!==ma){g._fci=ma;g=b[f];e(g.event,g.element,g);m(d.target).trigger(d)}d.stopPropagation()})}function Va(a,b,e){for(var d=0,f;d<a.length;d++){f=m(a[d]);f.width(Math.max(0,b-pb(f,e)))}}function Eb(a,b,e){for(var d=0,f;d<a.length;d++){f=m(a[d]);f.height(Math.max(0,b-Sa(f,e)))}}function pb(a,b){return gc(a)+hc(a)+(b?ic(a):0)}function gc(a){return(parseFloat(m.css(a[0],"paddingLeft",true))||0)+(parseFloat(m.css(a[0],"paddingRight",true))||0)}function ic(a){return(parseFloat(m.css(a[0],"marginLeft",
-true))||0)+(parseFloat(m.css(a[0],"marginRight",true))||0)}function hc(a){return(parseFloat(m.css(a[0],"borderLeftWidth",true))||0)+(parseFloat(m.css(a[0],"borderRightWidth",true))||0)}function Sa(a,b){return jc(a)+kc(a)+(b?Fb(a):0)}function jc(a){return(parseFloat(m.css(a[0],"paddingTop",true))||0)+(parseFloat(m.css(a[0],"paddingBottom",true))||0)}function Fb(a){return(parseFloat(m.css(a[0],"marginTop",true))||0)+(parseFloat(m.css(a[0],"marginBottom",true))||0)}function kc(a){return(parseFloat(m.css(a[0],
-"borderTopWidth",true))||0)+(parseFloat(m.css(a[0],"borderBottomWidth",true))||0)}function Za(a,b){b=typeof b=="number"?b+"px":b;a.each(function(e,d){d.style.cssText+=";min-height:"+b+";_height:"+b})}function xb(){}function Gb(a,b){return a-b}function Hb(a){return Math.max.apply(Math,a)}function Pa(a){return(a<10?"0":"")+a}function jb(a,b){if(a[b]!==ma)return a[b];b=b.split(/(?=[A-Z])/);for(var e=b.length-1,d;e>=0;e--){d=a[b[e].toLowerCase()];if(d!==ma)return d}return a[""]}function Qa(a){return a.replace(/&/g,
-"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#039;").replace(/"/g,"&quot;").replace(/\n/g,"<br />")}function Ib(a){return a.id+"/"+a.className+"/"+a.style.cssText.replace(/(^|;)\s*(top|left|width|height)\s*:[^;]*/ig,"")}function qb(a){a.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})}function ab(a){a.children().removeClass("fc-first fc-last").filter(":first-child").addClass("fc-first").end().filter(":last-child").addClass("fc-last")}
-function rb(a,b){a.each(function(e,d){d.className=d.className.replace(/^fc-\w*/,"fc-"+lc[b.getDay()])})}function Jb(a,b){var e=a.source||{},d=a.color,f=e.color,g=b("eventColor"),l=a.backgroundColor||d||e.backgroundColor||f||b("eventBackgroundColor")||g;d=a.borderColor||d||e.borderColor||f||b("eventBorderColor")||g;a=a.textColor||e.textColor||b("eventTextColor");b=[];l&&b.push("background-color:"+l);d&&b.push("border-color:"+d);a&&b.push("color:"+a);return b.join(";")}function $a(a,b,e){if(m.isFunction(a))a=
-[a];if(a){var d,f;for(d=0;d<a.length;d++)f=a[d].apply(b,e)||f;return f}}function Ta(){for(var a=0;a<arguments.length;a++)if(arguments[a]!==ma)return arguments[a]}function mc(a,b){function e(j,t){if(t){hb(j,t);j.setDate(1)}j=N(j,true);j.setDate(1);t=hb(N(j),1);var y=N(j),S=N(t),Q=f("firstDay"),q=f("weekends")?0:1;if(q){Fa(y);Fa(S,-1,true)}ba(y,-((y.getDay()-Math.max(Q,q)+7)%7));ba(S,(7-S.getDay()+Math.max(Q,q))%7);Q=Math.round((S-y)/(Ab*7));if(f("weekMode")=="fixed"){ba(S,(6-Q)*7);Q=6}d.title=l(j,
-f("titleFormat"));d.start=j;d.end=t;d.visStart=y;d.visEnd=S;g(6,Q,q?5:7,true)}var d=this;d.render=e;sb.call(d,a,b,"month");var f=d.opt,g=d.renderBasic,l=b.formatDate}function nc(a,b){function e(j,t){t&&ba(j,t*7);j=ba(N(j),-((j.getDay()-f("firstDay")+7)%7));t=ba(N(j),7);var y=N(j),S=N(t),Q=f("weekends");if(!Q){Fa(y);Fa(S,-1,true)}d.title=l(y,ba(N(S),-1),f("titleFormat"));d.start=j;d.end=t;d.visStart=y;d.visEnd=S;g(1,1,Q?7:5,false)}var d=this;d.render=e;sb.call(d,a,b,"basicWeek");var f=d.opt,g=d.renderBasic,
-l=b.formatDates}function oc(a,b){function e(j,t){if(t){ba(j,t);f("weekends")||Fa(j,t<0?-1:1)}d.title=l(j,f("titleFormat"));d.start=d.visStart=N(j,true);d.end=d.visEnd=ba(N(d.start),1);g(1,1,1,false)}var d=this;d.render=e;sb.call(d,a,b,"basicDay");var f=d.opt,g=d.renderBasic,l=b.formatDate}function sb(a,b,e){function d(w,I,R,V){v=I;F=R;f();(I=!C)?g(w,V):z();l(I)}function f(){if(k=L("isRTL")){D=-1;Z=F-1}else{D=1;Z=0}ja=L("firstDay");ia=L("weekends")?0:1;la=L("theme")?"ui":"fc";$=L("columnFormat")}function g(w,
-I){var R,V=la+"-widget-header",ea=la+"-widget-content",aa;R="<table class='fc-border-separate' style='width:100%' cellspacing='0'><thead><tr>";for(aa=0;aa<F;aa++)R+="<th class='fc- "+V+"'/>";R+="</tr></thead><tbody>";for(aa=0;aa<w;aa++){R+="<tr class='fc-week"+aa+"'>";for(V=0;V<F;V++)R+="<td class='fc- "+ea+" fc-day"+(aa*F+V)+"'><div>"+(I?"<div class='fc-day-number'/>":"")+"<div class='fc-day-content'><div style='position:relative'>&nbsp;</div></div></div></td>";R+="</tr>"}R+="</tbody></table>";w=
-m(R).appendTo(a);K=w.find("thead");i=K.find("th");C=w.find("tbody");P=C.find("tr");E=C.find("td");B=E.filter(":first-child");n=P.eq(0).find("div.fc-day-content div");ab(K.add(K.find("tr")));ab(P);P.eq(0).addClass("fc-first");y(E);Y=m("<div style='position:absolute;z-index:8;top:0;left:0'/>").appendTo(a)}function l(w){var I=w||v==1,R=p.start.getMonth(),V=Ka(new Date),ea,aa,va;I&&i.each(function(wa,Ga){ea=m(Ga);aa=ca(wa);ea.html(ya(aa,$));rb(ea,aa)});E.each(function(wa,Ga){ea=m(Ga);aa=ca(wa);aa.getMonth()==
-R?ea.removeClass("fc-other-month"):ea.addClass("fc-other-month");+aa==+V?ea.addClass(la+"-state-highlight fc-today"):ea.removeClass(la+"-state-highlight fc-today");ea.find("div.fc-day-number").text(aa.getDate());I&&rb(ea,aa)});P.each(function(wa,Ga){va=m(Ga);if(wa<v){va.show();wa==v-1?va.addClass("fc-last"):va.removeClass("fc-last")}else va.hide()})}function j(w){o=w;w=o-K.height();var I,R,V;if(L("weekMode")=="variable")I=R=Math.floor(w/(v==1?2:6));else{I=Math.floor(w/v);R=w-I*(v-1)}B.each(function(ea,
-aa){if(ea<v){V=m(aa);Za(V.find("> div"),(ea==v-1?R:I)-Sa(V))}})}function t(w){W=w;M.clear();s=Math.floor(W/F);Va(i.slice(0,-1),s)}function y(w){w.click(S).mousedown(X)}function S(w){if(!L("selectable")){var I=parseInt(this.className.match(/fc\-day(\d+)/)[1]);I=ca(I);c("dayClick",this,I,true,w)}}function Q(w,I,R){R&&r.build();R=N(p.visStart);for(var V=ba(N(R),F),ea=0;ea<v;ea++){var aa=new Date(Math.max(R,w)),va=new Date(Math.min(V,I));if(aa<va){var wa;if(k){wa=Ca(va,R)*D+Z+1;aa=Ca(aa,R)*D+Z+1}else{wa=
-Ca(aa,R);aa=Ca(va,R)}y(q(ea,wa,ea,aa-1))}ba(R,7);ba(V,7)}}function q(w,I,R,V){w=r.rect(w,I,R,V,a);return H(w,a)}function u(w){return N(w)}function fa(w,I){Q(w,ba(N(I),1),true)}function oa(){T()}function ga(w,I,R){var V=ua(w);c("dayClick",E[V.row*F+V.col],w,I,R)}function ra(w,I){J.start(function(R){T();R&&q(R.row,R.col,R.row,R.col)},I)}function sa(w,I,R){var V=J.stop();T();if(V){V=pa(V);c("drop",w,V,true,I,R)}}function ha(w){return N(w.start)}function da(w){return M.left(w)}function na(w){return M.right(w)}
-function ua(w){return{row:Math.floor(Ca(w,p.visStart)/7),col:ka(w.getDay())}}function pa(w){return U(w.row,w.col)}function U(w,I){return ba(N(p.visStart),w*7+I*D+Z)}function ca(w){return U(Math.floor(w/F),w%F)}function ka(w){return(w-Math.max(ja,ia)+F)%F*D+Z}function qa(w){return P.eq(w)}function G(){return{left:0,right:W}}var p=this;p.renderBasic=d;p.setHeight=j;p.setWidth=t;p.renderDayOverlay=Q;p.defaultSelectionEnd=u;p.renderSelection=fa;p.clearSelection=oa;p.reportDayClick=ga;p.dragStart=ra;p.dragStop=
-sa;p.defaultEventEnd=ha;p.getHoverListener=function(){return J};p.colContentLeft=da;p.colContentRight=na;p.dayOfWeekCol=ka;p.dateCell=ua;p.cellDate=pa;p.cellIsAllDay=function(){return true};p.allDayRow=qa;p.allDayBounds=G;p.getRowCnt=function(){return v};p.getColCnt=function(){return F};p.getColWidth=function(){return s};p.getDaySegmentContainer=function(){return Y};Kb.call(p,a,b,e);Lb.call(p);Mb.call(p);pc.call(p);var L=p.opt,c=p.trigger,z=p.clearEvents,H=p.renderOverlay,T=p.clearOverlays,X=p.daySelectionMousedown,
-ya=b.formatDate,K,i,C,P,E,B,n,Y,W,o,s,v,F,r,J,M,k,D,Z,ja,ia,la,$;qb(a.addClass("fc-grid"));r=new Nb(function(w,I){var R,V,ea;i.each(function(aa,va){R=m(va);V=R.offset().left;if(aa)ea[1]=V;ea=[V];I[aa]=ea});ea[1]=V+R.outerWidth();P.each(function(aa,va){if(aa<v){R=m(va);V=R.offset().top;if(aa)ea[1]=V;ea=[V];w[aa]=ea}});ea[1]=V+R.outerHeight()});J=new Ob(r);M=new Pb(function(w){return n.eq(w)})}function pc(){function a(U,ca){S(U);ua(e(U),ca)}function b(){Q();ga().empty()}function e(U){var ca=da(),ka=
-na(),qa=N(g.visStart);ka=ba(N(qa),ka);var G=m.map(U,Ua),p,L,c,z,H,T,X=[];for(p=0;p<ca;p++){L=ob(nb(U,G,qa,ka));for(c=0;c<L.length;c++){z=L[c];for(H=0;H<z.length;H++){T=z[H];T.row=p;T.level=c;X.push(T)}}ba(qa,7);ba(ka,7)}return X}function d(U,ca,ka){t(U)&&f(U,ca);ka.isEnd&&y(U)&&pa(U,ca,ka);q(U,ca)}function f(U,ca){var ka=ra(),qa;ca.draggable({zIndex:9,delay:50,opacity:l("dragOpacity"),revertDuration:l("dragRevertDuration"),start:function(G,p){j("eventDragStart",ca,U,G,p);fa(U,ca);ka.start(function(L,
-c,z,H){ca.draggable("option","revert",!L||!z&&!H);ha();if(L){qa=z*7+H*(l("isRTL")?-1:1);sa(ba(N(U.start),qa),ba(Ua(U),qa))}else qa=0},G,"drag")},stop:function(G,p){ka.stop();ha();j("eventDragStop",ca,U,G,p);if(qa)oa(this,U,qa,0,U.allDay,G,p);else{ca.css("filter","");u(U,ca)}}})}var g=this;g.renderEvents=a;g.compileDaySegs=e;g.clearEvents=b;g.bindDaySeg=d;Qb.call(g);var l=g.opt,j=g.trigger,t=g.isEventDraggable,y=g.isEventResizable,S=g.reportEvents,Q=g.reportEventClear,q=g.eventElementHandlers,u=g.showEvents,
-fa=g.hideEvents,oa=g.eventDrop,ga=g.getDaySegmentContainer,ra=g.getHoverListener,sa=g.renderDayOverlay,ha=g.clearOverlays,da=g.getRowCnt,na=g.getColCnt,ua=g.renderDaySegs,pa=g.resizableDayEvent}function qc(a,b){function e(j,t){t&&ba(j,t*7);j=ba(N(j),-((j.getDay()-f("firstDay")+7)%7));t=ba(N(j),7);var y=N(j),S=N(t),Q=f("weekends");if(!Q){Fa(y);Fa(S,-1,true)}d.title=l(y,ba(N(S),-1),f("titleFormat"));d.start=j;d.end=t;d.visStart=y;d.visEnd=S;g(Q?7:5)}var d=this;d.render=e;Rb.call(d,a,b,"agendaWeek");
-var f=d.opt,g=d.renderAgenda,l=b.formatDates}function rc(a,b){function e(j,t){if(t){ba(j,t);f("weekends")||Fa(j,t<0?-1:1)}t=N(j,true);var y=ba(N(t),1);d.title=l(j,f("titleFormat"));d.start=d.visStart=t;d.end=d.visEnd=y;g(1)}var d=this;d.render=e;Rb.call(d,a,b,"agendaDay");var f=d.opt,g=d.renderAgenda,l=b.formatDate}function Rb(a,b,e){function d(h){Ba=h;f();v?P():g();l()}function f(){Wa=i("theme")?"ui":"fc";Sb=i("weekends")?0:1;Tb=i("firstDay");if(Ub=i("isRTL")){Ha=-1;Ia=Ba-1}else{Ha=1;Ia=0}La=mb(i("minTime"));
-bb=mb(i("maxTime"));Vb=i("columnFormat")}function g(){var h=Wa+"-widget-header",O=Wa+"-widget-content",x,A,ta,za,Da,Ea=i("slotMinutes")%15==0;x="<table style='width:100%' class='fc-agenda-days fc-border-separate' cellspacing='0'><thead><tr><th class='fc-agenda-axis "+h+"'>&nbsp;</th>";for(A=0;A<Ba;A++)x+="<th class='fc- fc-col"+A+" "+h+"'/>";x+="<th class='fc-agenda-gutter "+h+"'>&nbsp;</th></tr></thead><tbody><tr><th class='fc-agenda-axis "+h+"'>&nbsp;</th>";for(A=0;A<Ba;A++)x+="<td class='fc- fc-col"+
-A+" "+O+"'><div><div class='fc-day-content'><div style='position:relative'>&nbsp;</div></div></div></td>";x+="<td class='fc-agenda-gutter "+O+"'>&nbsp;</td></tr></tbody></table>";v=m(x).appendTo(a);F=v.find("thead");r=F.find("th").slice(1,-1);J=v.find("tbody");M=J.find("td").slice(0,-1);k=M.find("div.fc-day-content div");D=M.eq(0);Z=D.find("> div");ab(F.add(F.find("tr")));ab(J.add(J.find("tr")));aa=F.find("th:first");va=v.find(".fc-agenda-gutter");ja=m("<div style='position:absolute;z-index:2;left:0;width:100%'/>").appendTo(a);
-if(i("allDaySlot")){ia=m("<div style='position:absolute;z-index:8;top:0;left:0'/>").appendTo(ja);x="<table style='width:100%' class='fc-agenda-allday' cellspacing='0'><tr><th class='"+h+" fc-agenda-axis'>"+i("allDayText")+"</th><td><div class='fc-day-content'><div style='position:relative'/></div></td><th class='"+h+" fc-agenda-gutter'>&nbsp;</th></tr></table>";la=m(x).appendTo(ja);$=la.find("tr");q($.find("td"));aa=aa.add(la.find("th:first"));va=va.add(la.find("th.fc-agenda-gutter"));ja.append("<div class='fc-agenda-divider "+
-h+"'><div class='fc-agenda-divider-inner'/></div>")}else ia=m([]);w=m("<div style='position:absolute;width:100%;overflow-x:hidden;overflow-y:auto'/>").appendTo(ja);I=m("<div style='position:relative;width:100%;overflow:hidden'/>").appendTo(w);R=m("<div style='position:absolute;z-index:8;top:0;left:0'/>").appendTo(I);x="<table class='fc-agenda-slots' style='width:100%' cellspacing='0'><tbody>";ta=zb();za=xa(N(ta),bb);xa(ta,La);for(A=tb=0;ta<za;A++){Da=ta.getMinutes();x+="<tr class='fc-slot"+A+" "+
-(!Da?"":"fc-minor")+"'><th class='fc-agenda-axis "+h+"'>"+(!Ea||!Da?s(ta,i("axisFormat")):"&nbsp;")+"</th><td class='"+O+"'><div style='position:relative'>&nbsp;</div></td></tr>";xa(ta,i("slotMinutes"));tb++}x+="</tbody></table>";V=m(x).appendTo(I);ea=V.find("div:first");u(V.find("td"));aa=aa.add(V.find("th:first"))}function l(){var h,O,x,A,ta=Ka(new Date);for(h=0;h<Ba;h++){A=ua(h);O=r.eq(h);O.html(s(A,Vb));x=M.eq(h);+A==+ta?x.addClass(Wa+"-state-highlight fc-today"):x.removeClass(Wa+"-state-highlight fc-today");
-rb(O.add(x),A)}}function j(h,O){if(h===ma)h=Wb;Wb=h;ub={};var x=J.position().top,A=w.position().top;h=Math.min(h-x,V.height()+A+1);Z.height(h-Sa(D));ja.css("top",x);w.height(h-A-1);Xa=ea.height()+1;O&&y()}function t(h){Ga=h;cb.clear();Ma=0;Va(aa.width("").each(function(O,x){Ma=Math.max(Ma,m(x).outerWidth())}),Ma);h=w[0].clientWidth;if(vb=w.width()-h){Va(va,vb);va.show().prev().removeClass("fc-last")}else va.hide().prev().addClass("fc-last");db=Math.floor((h-Ma)/Ba);Va(r.slice(0,-1),db)}function y(){function h(){w.scrollTop(A)}
-var O=zb(),x=N(O);x.setHours(i("firstHour"));var A=ca(O,x)+1;h();setTimeout(h,0)}function S(){Xb=w.scrollTop()}function Q(){w.scrollTop(Xb)}function q(h){h.click(fa).mousedown(W)}function u(h){h.click(fa).mousedown(H)}function fa(h){if(!i("selectable")){var O=Math.min(Ba-1,Math.floor((h.pageX-v.offset().left-Ma)/db)),x=ua(O),A=this.parentNode.className.match(/fc-slot(\d+)/);if(A){A=parseInt(A[1])*i("slotMinutes");var ta=Math.floor(A/60);x.setHours(ta);x.setMinutes(A%60+La);C("dayClick",M[O],x,false,
-h)}else C("dayClick",M[O],x,true,h)}}function oa(h,O,x){x&&Na.build();var A=N(K.visStart);if(Ub){x=Ca(O,A)*Ha+Ia+1;h=Ca(h,A)*Ha+Ia+1}else{x=Ca(h,A);h=Ca(O,A)}x=Math.max(0,x);h=Math.min(Ba,h);x<h&&q(ga(0,x,0,h-1))}function ga(h,O,x,A){h=Na.rect(h,O,x,A,ja);return E(h,ja)}function ra(h,O){for(var x=N(K.visStart),A=ba(N(x),1),ta=0;ta<Ba;ta++){var za=new Date(Math.max(x,h)),Da=new Date(Math.min(A,O));if(za<Da){var Ea=ta*Ha+Ia;Ea=Na.rect(0,Ea,0,Ea,I);za=ca(x,za);Da=ca(x,Da);Ea.top=za;Ea.height=Da-za;u(E(Ea,
-I))}ba(x,1);ba(A,1)}}function sa(h){return cb.left(h)}function ha(h){return cb.right(h)}function da(h){return{row:Math.floor(Ca(h,K.visStart)/7),col:U(h.getDay())}}function na(h){var O=ua(h.col);h=h.row;i("allDaySlot")&&h--;h>=0&&xa(O,La+h*i("slotMinutes"));return O}function ua(h){return ba(N(K.visStart),h*Ha+Ia)}function pa(h){return i("allDaySlot")&&!h.row}function U(h){return(h-Math.max(Tb,Sb)+Ba)%Ba*Ha+Ia}function ca(h,O){h=N(h,true);if(O<xa(N(h),La))return 0;if(O>=xa(N(h),bb))return V.height();
-h=i("slotMinutes");O=O.getHours()*60+O.getMinutes()-La;var x=Math.floor(O/h),A=ub[x];if(A===ma)A=ub[x]=V.find("tr:eq("+x+") td div")[0].offsetTop;return Math.max(0,Math.round(A-1+Xa*(O%h/h)))}function ka(){return{left:Ma,right:Ga-vb}}function qa(){return $}function G(h){var O=N(h.start);if(h.allDay)return O;return xa(O,i("defaultEventMinutes"))}function p(h,O){if(O)return N(h);return xa(N(h),i("slotMinutes"))}function L(h,O,x){if(x)i("allDaySlot")&&oa(h,ba(N(O),1),true);else c(h,O)}function c(h,O){var x=
-i("selectHelper");Na.build();if(x){var A=Ca(h,K.visStart)*Ha+Ia;if(A>=0&&A<Ba){A=Na.rect(0,A,0,A,I);var ta=ca(h,h),za=ca(h,O);if(za>ta){A.top=ta;A.height=za-ta;A.left+=2;A.width-=5;if(m.isFunction(x)){if(h=x(h,O)){A.position="absolute";A.zIndex=8;wa=m(h).css(A).appendTo(I)}}else{A.isStart=true;A.isEnd=true;wa=m(o({title:"",start:h,end:O,className:["fc-select-helper"],editable:false},A));wa.css("opacity",i("dragOpacity"))}if(wa){u(wa);I.append(wa);Va(wa,A.width,true);Eb(wa,A.height,true)}}}}else ra(h,
-O)}function z(){B();if(wa){wa.remove();wa=null}}function H(h){if(h.which==1&&i("selectable")){Y(h);var O;Ra.start(function(x,A){z();if(x&&x.col==A.col&&!pa(x)){A=na(A);x=na(x);O=[A,xa(N(A),i("slotMinutes")),x,xa(N(x),i("slotMinutes"))].sort(Gb);c(O[0],O[3])}else O=null},h);m(document).one("mouseup",function(x){Ra.stop();if(O){+O[0]==+O[1]&&T(O[0],false,x);n(O[0],O[3],false,x)}})}}function T(h,O,x){C("dayClick",M[U(h.getDay())],h,O,x)}function X(h,O){Ra.start(function(x){B();if(x)if(pa(x))ga(x.row,
-x.col,x.row,x.col);else{x=na(x);var A=xa(N(x),i("defaultEventMinutes"));ra(x,A)}},O)}function ya(h,O,x){var A=Ra.stop();B();A&&C("drop",h,na(A),pa(A),O,x)}var K=this;K.renderAgenda=d;K.setWidth=t;K.setHeight=j;K.beforeHide=S;K.afterShow=Q;K.defaultEventEnd=G;K.timePosition=ca;K.dayOfWeekCol=U;K.dateCell=da;K.cellDate=na;K.cellIsAllDay=pa;K.allDayRow=qa;K.allDayBounds=ka;K.getHoverListener=function(){return Ra};K.colContentLeft=sa;K.colContentRight=ha;K.getDaySegmentContainer=function(){return ia};
-K.getSlotSegmentContainer=function(){return R};K.getMinMinute=function(){return La};K.getMaxMinute=function(){return bb};K.getBodyContent=function(){return I};K.getRowCnt=function(){return 1};K.getColCnt=function(){return Ba};K.getColWidth=function(){return db};K.getSlotHeight=function(){return Xa};K.defaultSelectionEnd=p;K.renderDayOverlay=oa;K.renderSelection=L;K.clearSelection=z;K.reportDayClick=T;K.dragStart=X;K.dragStop=ya;Kb.call(K,a,b,e);Lb.call(K);Mb.call(K);sc.call(K);var i=K.opt,C=K.trigger,
-P=K.clearEvents,E=K.renderOverlay,B=K.clearOverlays,n=K.reportSelection,Y=K.unselect,W=K.daySelectionMousedown,o=K.slotSegHtml,s=b.formatDate,v,F,r,J,M,k,D,Z,ja,ia,la,$,w,I,R,V,ea,aa,va,wa,Ga,Wb,Ma,db,vb,Xa,Xb,Ba,tb,Na,Ra,cb,ub={},Wa,Tb,Sb,Ub,Ha,Ia,La,bb,Vb;qb(a.addClass("fc-agenda"));Na=new Nb(function(h,O){function x(eb){return Math.max(Ea,Math.min(tc,eb))}var A,ta,za;r.each(function(eb,uc){A=m(uc);ta=A.offset().left;if(eb)za[1]=ta;za=[ta];O[eb]=za});za[1]=ta+A.outerWidth();if(i("allDaySlot")){A=
-$;ta=A.offset().top;h[0]=[ta,ta+A.outerHeight()]}for(var Da=I.offset().top,Ea=w.offset().top,tc=Ea+w.outerHeight(),fb=0;fb<tb;fb++)h.push([x(Da+Xa*fb),x(Da+Xa*(fb+1))])});Ra=new Ob(Na);cb=new Pb(function(h){return k.eq(h)})}function sc(){function a(o,s){sa(o);var v,F=o.length,r=[],J=[];for(v=0;v<F;v++)o[v].allDay?r.push(o[v]):J.push(o[v]);if(u("allDaySlot")){L(e(r),s);na()}g(d(J),s)}function b(){ha();ua().empty();pa().empty()}function e(o){o=ob(nb(o,m.map(o,Ua),q.visStart,q.visEnd));var s,v=o.length,
-F,r,J,M=[];for(s=0;s<v;s++){F=o[s];for(r=0;r<F.length;r++){J=F[r];J.row=0;J.level=s;M.push(J)}}return M}function d(o){var s=z(),v=ka(),F=ca(),r=xa(N(q.visStart),v),J=m.map(o,f),M,k,D,Z,ja,ia,la=[];for(M=0;M<s;M++){k=ob(nb(o,J,r,xa(N(r),F-v)));vc(k);for(D=0;D<k.length;D++){Z=k[D];for(ja=0;ja<Z.length;ja++){ia=Z[ja];ia.col=M;ia.level=D;la.push(ia)}}ba(r,1,true)}return la}function f(o){return o.end?N(o.end):xa(N(o.start),u("defaultEventMinutes"))}function g(o,s){var v,F=o.length,r,J,M,k,D,Z,ja,ia,la,
-$="",w,I,R={},V={},ea=pa(),aa;v=z();if(w=u("isRTL")){I=-1;aa=v-1}else{I=1;aa=0}for(v=0;v<F;v++){r=o[v];J=r.event;M=qa(r.start,r.start);k=qa(r.start,r.end);D=r.col;Z=r.level;ja=r.forward||0;ia=G(D*I+aa);la=p(D*I+aa)-ia;la=Math.min(la-6,la*0.95);D=Z?la/(Z+ja+1):ja?(la/(ja+1)-6)*2:la;Z=ia+la/(Z+ja+1)*Z*I+(w?la-D:0);r.top=M;r.left=Z;r.outerWidth=D;r.outerHeight=k-M;$+=l(J,r)}ea[0].innerHTML=$;w=ea.children();for(v=0;v<F;v++){r=o[v];J=r.event;$=m(w[v]);I=fa("eventRender",J,J,$);if(I===false)$.remove();
-else{if(I&&I!==true){$.remove();$=m(I).css({position:"absolute",top:r.top,left:r.left}).appendTo(ea)}r.element=$;if(J._id===s)t(J,$,r);else $[0]._fci=v;ya(J,$)}}Db(ea,o,t);for(v=0;v<F;v++){r=o[v];if($=r.element){J=R[s=r.key=Ib($[0])];r.vsides=J===ma?(R[s]=Sa($,true)):J;J=V[s];r.hsides=J===ma?(V[s]=pb($,true)):J;s=$.find("div.fc-event-content");if(s.length)r.contentTop=s[0].offsetTop}}for(v=0;v<F;v++){r=o[v];if($=r.element){$[0].style.width=Math.max(0,r.outerWidth-r.hsides)+"px";R=Math.max(0,r.outerHeight-
-r.vsides);$[0].style.height=R+"px";J=r.event;if(r.contentTop!==ma&&R-r.contentTop<10){$.find("div.fc-event-time").text(Y(J.start,u("timeFormat"))+" - "+J.title);$.find("div.fc-event-title").remove()}fa("eventAfterRender",J,J,$)}}}function l(o,s){var v="<",F=o.url,r=Jb(o,u),J=r?" style='"+r+"'":"",M=["fc-event","fc-event-skin","fc-event-vert"];oa(o)&&M.push("fc-event-draggable");s.isStart&&M.push("fc-corner-top");s.isEnd&&M.push("fc-corner-bottom");M=M.concat(o.className);if(o.source)M=M.concat(o.source.className||
-[]);v+=F?"a href='"+Qa(o.url)+"'":"div";v+=" class='"+M.join(" ")+"' style='position:absolute;z-index:8;top:"+s.top+"px;left:"+s.left+"px;"+r+"'><div class='fc-event-inner fc-event-skin'"+J+"><div class='fc-event-head fc-event-skin'"+J+"><div class='fc-event-time'>"+Qa(W(o.start,o.end,u("timeFormat")))+"</div></div><div class='fc-event-content'><div class='fc-event-title'>"+Qa(o.title)+"</div></div><div class='fc-event-bg'></div></div>";if(s.isEnd&&ga(o))v+="<div class='ui-resizable-handle ui-resizable-s'>=</div>";
-v+="</"+(F?"a":"div")+">";return v}function j(o,s,v){oa(o)&&y(o,s,v.isStart);v.isEnd&&ga(o)&&c(o,s,v);da(o,s)}function t(o,s,v){var F=s.find("div.fc-event-time");oa(o)&&S(o,s,F);v.isEnd&&ga(o)&&Q(o,s,F);da(o,s)}function y(o,s,v){function F(){if(!M){s.width(r).height("").draggable("option","grid",null);M=true}}var r,J,M=true,k,D=u("isRTL")?-1:1,Z=U(),ja=H(),ia=T(),la=ka();s.draggable({zIndex:9,opacity:u("dragOpacity","month"),revertDuration:u("dragRevertDuration"),start:function($,w){fa("eventDragStart",
-s,o,$,w);i(o,s);r=s.width();Z.start(function(I,R,V,ea){B();if(I){J=false;k=ea*D;if(I.row)if(v){if(M){s.width(ja-10);Eb(s,ia*Math.round((o.end?(o.end-o.start)/wc:u("defaultEventMinutes"))/u("slotMinutes")));s.draggable("option","grid",[ja,1]);M=false}}else J=true;else{E(ba(N(o.start),k),ba(Ua(o),k));F()}J=J||M&&!k}else{F();J=true}s.draggable("option","revert",J)},$,"drag")},stop:function($,w){Z.stop();B();fa("eventDragStop",s,o,$,w);if(J){F();s.css("filter","");K(o,s)}else{var I=0;M||(I=Math.round((s.offset().top-
-X().offset().top)/ia)*u("slotMinutes")+la-(o.start.getHours()*60+o.start.getMinutes()));C(this,o,k,I,M,$,w)}}})}function S(o,s,v){function F(I){var R=xa(N(o.start),I),V;if(o.end)V=xa(N(o.end),I);v.text(W(R,V,u("timeFormat")))}function r(){if(M){v.css("display","");s.draggable("option","grid",[$,w]);M=false}}var J,M=false,k,D,Z,ja=u("isRTL")?-1:1,ia=U(),la=z(),$=H(),w=T();s.draggable({zIndex:9,scroll:false,grid:[$,w],axis:la==1?"y":false,opacity:u("dragOpacity"),revertDuration:u("dragRevertDuration"),
-start:function(I,R){fa("eventDragStart",s,o,I,R);i(o,s);J=s.position();D=Z=0;ia.start(function(V,ea,aa,va){s.draggable("option","revert",!V);B();if(V){k=va*ja;if(u("allDaySlot")&&!V.row){if(!M){M=true;v.hide();s.draggable("option","grid",null)}E(ba(N(o.start),k),ba(Ua(o),k))}else r()}},I,"drag")},drag:function(I,R){D=Math.round((R.position.top-J.top)/w)*u("slotMinutes");if(D!=Z){M||F(D);Z=D}},stop:function(I,R){var V=ia.stop();B();fa("eventDragStop",s,o,I,R);if(V&&(k||D||M))C(this,o,k,M?0:D,M,I,R);
-else{r();s.css("filter","");s.css(J);F(0);K(o,s)}}})}function Q(o,s,v){var F,r,J=T();s.resizable({handles:{s:"div.ui-resizable-s"},grid:J,start:function(M,k){F=r=0;i(o,s);s.css("z-index",9);fa("eventResizeStart",this,o,M,k)},resize:function(M,k){F=Math.round((Math.max(J,s.height())-k.originalSize.height)/J);if(F!=r){v.text(W(o.start,!F&&!o.end?null:xa(ra(o),u("slotMinutes")*F),u("timeFormat")));r=F}},stop:function(M,k){fa("eventResizeStop",this,o,M,k);if(F)P(this,o,0,u("slotMinutes")*F,M,k);else{s.css("z-index",
-8);K(o,s)}}})}var q=this;q.renderEvents=a;q.compileDaySegs=e;q.clearEvents=b;q.slotSegHtml=l;q.bindDaySeg=j;Qb.call(q);var u=q.opt,fa=q.trigger,oa=q.isEventDraggable,ga=q.isEventResizable,ra=q.eventEnd,sa=q.reportEvents,ha=q.reportEventClear,da=q.eventElementHandlers,na=q.setHeight,ua=q.getDaySegmentContainer,pa=q.getSlotSegmentContainer,U=q.getHoverListener,ca=q.getMaxMinute,ka=q.getMinMinute,qa=q.timePosition,G=q.colContentLeft,p=q.colContentRight,L=q.renderDaySegs,c=q.resizableDayEvent,z=q.getColCnt,
-H=q.getColWidth,T=q.getSlotHeight,X=q.getBodyContent,ya=q.reportEventElement,K=q.showEvents,i=q.hideEvents,C=q.eventDrop,P=q.eventResize,E=q.renderDayOverlay,B=q.clearOverlays,n=q.calendar,Y=n.formatDate,W=n.formatDates}function vc(a){var b,e,d,f,g,l;for(b=a.length-1;b>0;b--){f=a[b];for(e=0;e<f.length;e++){g=f[e];for(d=0;d<a[b-1].length;d++){l=a[b-1][d];if(Cb(g,l))l.forward=Math.max(l.forward||0,(g.forward||0)+1)}}}}function Kb(a,b,e){function d(G,p){G=qa[G];if(typeof G=="object")return jb(G,p||e);
-return G}function f(G,p){return b.trigger.apply(b,[G,p||da].concat(Array.prototype.slice.call(arguments,2),[da]))}function g(G){return j(G)&&!d("disableDragging")}function l(G){return j(G)&&!d("disableResizing")}function j(G){return Ta(G.editable,(G.source||{}).editable,d("editable"))}function t(G){U={};var p,L=G.length,c;for(p=0;p<L;p++){c=G[p];if(U[c._id])U[c._id].push(c);else U[c._id]=[c]}}function y(G){return G.end?N(G.end):na(G)}function S(G,p){ca.push(p);if(ka[G._id])ka[G._id].push(p);else ka[G._id]=
-[p]}function Q(){ca=[];ka={}}function q(G,p){p.click(function(L){if(!p.hasClass("ui-draggable-dragging")&&!p.hasClass("ui-resizable-resizing"))return f("eventClick",this,G,L)}).hover(function(L){f("eventMouseover",this,G,L)},function(L){f("eventMouseout",this,G,L)})}function u(G,p){oa(G,p,"show")}function fa(G,p){oa(G,p,"hide")}function oa(G,p,L){G=ka[G._id];var c,z=G.length;for(c=0;c<z;c++)if(!p||G[c][0]!=p[0])G[c][L]()}function ga(G,p,L,c,z,H,T){var X=p.allDay,ya=p._id;sa(U[ya],L,c,z);f("eventDrop",
-G,p,L,c,z,function(){sa(U[ya],-L,-c,X);pa(ya)},H,T);pa(ya)}function ra(G,p,L,c,z,H){var T=p._id;ha(U[T],L,c);f("eventResize",G,p,L,c,function(){ha(U[T],-L,-c);pa(T)},z,H);pa(T)}function sa(G,p,L,c){L=L||0;for(var z,H=G.length,T=0;T<H;T++){z=G[T];if(c!==ma)z.allDay=c;xa(ba(z.start,p,true),L);if(z.end)z.end=xa(ba(z.end,p,true),L);ua(z,qa)}}function ha(G,p,L){L=L||0;for(var c,z=G.length,H=0;H<z;H++){c=G[H];c.end=xa(ba(y(c),p,true),L);ua(c,qa)}}var da=this;da.element=a;da.calendar=b;da.name=e;da.opt=
-d;da.trigger=f;da.isEventDraggable=g;da.isEventResizable=l;da.reportEvents=t;da.eventEnd=y;da.reportEventElement=S;da.reportEventClear=Q;da.eventElementHandlers=q;da.showEvents=u;da.hideEvents=fa;da.eventDrop=ga;da.eventResize=ra;var na=da.defaultEventEnd,ua=b.normalizeEvent,pa=b.reportEventChange,U={},ca=[],ka={},qa=b.options}function Qb(){function a(i,C){var P=z(),E=pa(),B=U(),n=0,Y,W,o=i.length,s,v;P[0].innerHTML=e(i);d(i,P.children());f(i);g(i,P,C);l(i);j(i);t(i);C=y();for(P=0;P<E;P++){Y=[];for(W=
-0;W<B;W++)Y[W]=0;for(;n<o&&(s=i[n]).row==P;){W=Hb(Y.slice(s.startCol,s.endCol));s.top=W;W+=s.outerHeight;for(v=s.startCol;v<s.endCol;v++)Y[v]=W;n++}C[P].height(Hb(Y))}Q(i,S(C))}function b(i,C,P){var E=m("<div/>"),B=z(),n=i.length,Y;E[0].innerHTML=e(i);E=E.children();B.append(E);d(i,E);l(i);j(i);t(i);Q(i,S(y()));E=[];for(B=0;B<n;B++)if(Y=i[B].element){i[B].row===C&&Y.css("top",P);E.push(Y[0])}return m(E)}function e(i){var C=fa("isRTL"),P,E=i.length,B,n,Y,W;P=ka();var o=P.left,s=P.right,v,F,r,J,M,k=
-"";for(P=0;P<E;P++){B=i[P];n=B.event;W=["fc-event","fc-event-skin","fc-event-hori"];ga(n)&&W.push("fc-event-draggable");if(C){B.isStart&&W.push("fc-corner-right");B.isEnd&&W.push("fc-corner-left");v=p(B.end.getDay()-1);F=p(B.start.getDay());r=B.isEnd?qa(v):o;J=B.isStart?G(F):s}else{B.isStart&&W.push("fc-corner-left");B.isEnd&&W.push("fc-corner-right");v=p(B.start.getDay());F=p(B.end.getDay()-1);r=B.isStart?qa(v):o;J=B.isEnd?G(F):s}W=W.concat(n.className);if(n.source)W=W.concat(n.source.className||
-[]);Y=n.url;M=Jb(n,fa);k+=Y?"<a href='"+Qa(Y)+"'":"<div";k+=" class='"+W.join(" ")+"' style='position:absolute;z-index:8;left:"+r+"px;"+M+"'><div class='fc-event-inner fc-event-skin'"+(M?" style='"+M+"'":"")+">";if(!n.allDay&&B.isStart)k+="<span class='fc-event-time'>"+Qa(T(n.start,n.end,fa("timeFormat")))+"</span>";k+="<span class='fc-event-title'>"+Qa(n.title)+"</span></div>";if(B.isEnd&&ra(n))k+="<div class='ui-resizable-handle ui-resizable-"+(C?"w":"e")+"'>&nbsp;&nbsp;&nbsp;</div>";k+="</"+(Y?
-"a":"div")+">";B.left=r;B.outerWidth=J-r;B.startCol=v;B.endCol=F+1}return k}function d(i,C){var P,E=i.length,B,n,Y;for(P=0;P<E;P++){B=i[P];n=B.event;Y=m(C[P]);n=oa("eventRender",n,n,Y);if(n===false)Y.remove();else{if(n&&n!==true){n=m(n).css({position:"absolute",left:B.left});Y.replaceWith(n);Y=n}B.element=Y}}}function f(i){var C,P=i.length,E,B;for(C=0;C<P;C++){E=i[C];(B=E.element)&&ha(E.event,B)}}function g(i,C,P){var E,B=i.length,n,Y,W;for(E=0;E<B;E++){n=i[E];if(Y=n.element){W=n.event;if(W._id===
-P)H(W,Y,n);else Y[0]._fci=E}}Db(C,i,H)}function l(i){var C,P=i.length,E,B,n,Y,W={};for(C=0;C<P;C++){E=i[C];if(B=E.element){n=E.key=Ib(B[0]);Y=W[n];if(Y===ma)Y=W[n]=pb(B,true);E.hsides=Y}}}function j(i){var C,P=i.length,E,B;for(C=0;C<P;C++){E=i[C];if(B=E.element)B[0].style.width=Math.max(0,E.outerWidth-E.hsides)+"px"}}function t(i){var C,P=i.length,E,B,n,Y,W={};for(C=0;C<P;C++){E=i[C];if(B=E.element){n=E.key;Y=W[n];if(Y===ma)Y=W[n]=Fb(B);E.outerHeight=B[0].offsetHeight+Y}}}function y(){var i,C=pa(),
-P=[];for(i=0;i<C;i++)P[i]=ca(i).find("td:first div.fc-day-content > div");return P}function S(i){var C,P=i.length,E=[];for(C=0;C<P;C++)E[C]=i[C][0].offsetTop;return E}function Q(i,C){var P,E=i.length,B,n;for(P=0;P<E;P++){B=i[P];if(n=B.element){n[0].style.top=C[B.row]+(B.top||0)+"px";B=B.event;oa("eventAfterRender",B,B,n)}}}function q(i,C,P){var E=fa("isRTL"),B=E?"w":"e",n=C.find("div.ui-resizable-"+B),Y=false;qb(C);C.mousedown(function(W){W.preventDefault()}).click(function(W){if(Y){W.preventDefault();
-W.stopImmediatePropagation()}});n.mousedown(function(W){function o(ia){oa("eventResizeStop",this,i,ia);m("body").css("cursor","");s.stop();ya();k&&ua(this,i,k,0,ia);setTimeout(function(){Y=false},0)}if(W.which==1){Y=true;var s=u.getHoverListener(),v=pa(),F=U(),r=E?-1:1,J=E?F-1:0,M=C.css("top"),k,D,Z=m.extend({},i),ja=L(i.start);K();m("body").css("cursor",B+"-resize").one("mouseup",o);oa("eventResizeStart",this,i,W);s.start(function(ia,la){if(ia){var $=Math.max(ja.row,ia.row);ia=ia.col;if(v==1)$=0;
-if($==ja.row)ia=E?Math.min(ja.col,ia):Math.max(ja.col,ia);k=$*7+ia*r+J-(la.row*7+la.col*r+J);la=ba(sa(i),k,true);if(k){Z.end=la;$=D;D=b(c([Z]),P.row,M);D.find("*").css("cursor",B+"-resize");$&&$.remove();na(i)}else if(D){da(i);D.remove();D=null}ya();X(i.start,ba(N(la),1))}},W)}})}var u=this;u.renderDaySegs=a;u.resizableDayEvent=q;var fa=u.opt,oa=u.trigger,ga=u.isEventDraggable,ra=u.isEventResizable,sa=u.eventEnd,ha=u.reportEventElement,da=u.showEvents,na=u.hideEvents,ua=u.eventResize,pa=u.getRowCnt,
-U=u.getColCnt,ca=u.allDayRow,ka=u.allDayBounds,qa=u.colContentLeft,G=u.colContentRight,p=u.dayOfWeekCol,L=u.dateCell,c=u.compileDaySegs,z=u.getDaySegmentContainer,H=u.bindDaySeg,T=u.calendar.formatDates,X=u.renderDayOverlay,ya=u.clearOverlays,K=u.clearSelection}function Mb(){function a(Q,q,u){b();q||(q=j(Q,u));t(Q,q,u);e(Q,q,u)}function b(Q){if(S){S=false;y();l("unselect",null,Q)}}function e(Q,q,u,fa){S=true;l("select",null,Q,q,u,fa)}function d(Q){var q=f.cellDate,u=f.cellIsAllDay,fa=f.getHoverListener(),
-oa=f.reportDayClick;if(Q.which==1&&g("selectable")){b(Q);var ga;fa.start(function(ra,sa){y();if(ra&&u(ra)){ga=[q(sa),q(ra)].sort(Gb);t(ga[0],ga[1],true)}else ga=null},Q);m(document).one("mouseup",function(ra){fa.stop();if(ga){+ga[0]==+ga[1]&&oa(ga[0],true,ra);e(ga[0],ga[1],true,ra)}})}}var f=this;f.select=a;f.unselect=b;f.reportSelection=e;f.daySelectionMousedown=d;var g=f.opt,l=f.trigger,j=f.defaultSelectionEnd,t=f.renderSelection,y=f.clearSelection,S=false;g("selectable")&&g("unselectAuto")&&m(document).mousedown(function(Q){var q=
-g("unselectCancel");if(q)if(m(Q.target).parents(q).length)return;b(Q)})}function Lb(){function a(g,l){var j=f.shift();j||(j=m("<div class='fc-cell-overlay' style='position:absolute;z-index:3'/>"));j[0].parentNode!=l[0]&&j.appendTo(l);d.push(j.css(g).show());return j}function b(){for(var g;g=d.shift();)f.push(g.hide().unbind())}var e=this;e.renderOverlay=a;e.clearOverlays=b;var d=[],f=[]}function Nb(a){var b=this,e,d;b.build=function(){e=[];d=[];a(e,d)};b.cell=function(f,g){var l=e.length,j=d.length,
-t,y=-1,S=-1;for(t=0;t<l;t++)if(g>=e[t][0]&&g<e[t][1]){y=t;break}for(t=0;t<j;t++)if(f>=d[t][0]&&f<d[t][1]){S=t;break}return y>=0&&S>=0?{row:y,col:S}:null};b.rect=function(f,g,l,j,t){t=t.offset();return{top:e[f][0]-t.top,left:d[g][0]-t.left,width:d[j][1]-d[g][0],height:e[l][1]-e[f][0]}}}function Ob(a){function b(j){xc(j);j=a.cell(j.pageX,j.pageY);if(!j!=!l||j&&(j.row!=l.row||j.col!=l.col)){if(j){g||(g=j);f(j,g,j.row-g.row,j.col-g.col)}else f(j,g);l=j}}var e=this,d,f,g,l;e.start=function(j,t,y){f=j;
-g=l=null;a.build();b(t);d=y||"mousemove";m(document).bind(d,b)};e.stop=function(){m(document).unbind(d,b);return l}}function xc(a){if(a.pageX===ma){a.pageX=a.originalEvent.pageX;a.pageY=a.originalEvent.pageY}}function Pb(a){function b(l){return d[l]=d[l]||a(l)}var e=this,d={},f={},g={};e.left=function(l){return f[l]=f[l]===ma?b(l).position().left:f[l]};e.right=function(l){return g[l]=g[l]===ma?e.left(l)+b(l).width():g[l]};e.clear=function(){d={};f={};g={}}}var Ya={defaultView:"month",aspectRatio:1.35,
-header:{left:"title",center:"",right:"today prev,next"},weekends:true,allDayDefault:true,ignoreTimezone:true,lazyFetching:true,startParam:"start",endParam:"end",titleFormat:{month:"MMMM yyyy",week:"MMM d[ yyyy]{ '&#8212;'[ MMM] d yyyy}",day:"dddd, MMM d, yyyy"},columnFormat:{month:"ddd",week:"ddd M/d",day:"dddd M/d"},timeFormat:{"":"h(:mm)t"},isRTL:false,firstDay:0,monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan",
-"Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],buttonText:{prev:"&nbsp;&#9668;&nbsp;",next:"&nbsp;&#9658;&nbsp;",prevYear:"&nbsp;&lt;&lt;&nbsp;",nextYear:"&nbsp;&gt;&gt;&nbsp;",today:"today",month:"month",week:"week",day:"day"},theme:false,buttonIcons:{prev:"circle-triangle-w",next:"circle-triangle-e"},unselectAuto:true,dropAccept:"*"},yc=
-{header:{left:"next,prev today",center:"",right:"title"},buttonText:{prev:"&nbsp;&#9658;&nbsp;",next:"&nbsp;&#9668;&nbsp;",prevYear:"&nbsp;&gt;&gt;&nbsp;",nextYear:"&nbsp;&lt;&lt;&nbsp;"},buttonIcons:{prev:"circle-triangle-e",next:"circle-triangle-w"}},Aa=m.fullCalendar={version:"1.5.4"},Ja=Aa.views={};m.fn.fullCalendar=function(a){if(typeof a=="string"){var b=Array.prototype.slice.call(arguments,1),e;this.each(function(){var f=m.data(this,"fullCalendar");if(f&&m.isFunction(f[a])){f=f[a].apply(f,
-b);if(e===ma)e=f;a=="destroy"&&m.removeData(this,"fullCalendar")}});if(e!==ma)return e;return this}var d=a.eventSources||[];delete a.eventSources;if(a.events){d.push(a.events);delete a.events}a=m.extend(true,{},Ya,a.isRTL||a.isRTL===ma&&Ya.isRTL?yc:{},a);this.each(function(f,g){f=m(g);g=new Yb(f,a,d);f.data("fullCalendar",g);g.render()});return this};Aa.sourceNormalizers=[];Aa.sourceFetchers=[];var ac={dataType:"json",cache:false},bc=1;Aa.addDays=ba;Aa.cloneDate=N;Aa.parseDate=kb;Aa.parseISO8601=
-Bb;Aa.parseTime=mb;Aa.formatDate=Oa;Aa.formatDates=ib;var lc=["sun","mon","tue","wed","thu","fri","sat"],Ab=864E5,cc=36E5,wc=6E4,dc={s:function(a){return a.getSeconds()},ss:function(a){return Pa(a.getSeconds())},m:function(a){return a.getMinutes()},mm:function(a){return Pa(a.getMinutes())},h:function(a){return a.getHours()%12||12},hh:function(a){return Pa(a.getHours()%12||12)},H:function(a){return a.getHours()},HH:function(a){return Pa(a.getHours())},d:function(a){return a.getDate()},dd:function(a){return Pa(a.getDate())},
-ddd:function(a,b){return b.dayNamesShort[a.getDay()]},dddd:function(a,b){return b.dayNames[a.getDay()]},M:function(a){return a.getMonth()+1},MM:function(a){return Pa(a.getMonth()+1)},MMM:function(a,b){return b.monthNamesShort[a.getMonth()]},MMMM:function(a,b){return b.monthNames[a.getMonth()]},yy:function(a){return(a.getFullYear()+"").substring(2)},yyyy:function(a){return a.getFullYear()},t:function(a){return a.getHours()<12?"a":"p"},tt:function(a){return a.getHours()<12?"am":"pm"},T:function(a){return a.getHours()<
-12?"A":"P"},TT:function(a){return a.getHours()<12?"AM":"PM"},u:function(a){return Oa(a,"yyyy-MM-dd'T'HH:mm:ss'Z'")},S:function(a){a=a.getDate();if(a>10&&a<20)return"th";return["st","nd","rd"][a%10-1]||"th"}};Aa.applyAll=$a;Ja.month=mc;Ja.basicWeek=nc;Ja.basicDay=oc;wb({weekMode:"fixed"});Ja.agendaWeek=qc;Ja.agendaDay=rc;wb({allDaySlot:true,allDayText:"all-day",firstHour:6,slotMinutes:30,defaultEventMinutes:120,axisFormat:"h(:mm)tt",timeFormat:{agenda:"h:mm{ - h:mm}"},dragOpacity:{agenda:0.5},minTime:0,
-maxTime:24})})(jQuery);
diff --git a/3rdparty/fullcalendar/js/gcal.js b/3rdparty/fullcalendar/js/gcal.js
deleted file mode 100644
index ba42ac56047..00000000000
--- a/3rdparty/fullcalendar/js/gcal.js
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * FullCalendar v1.5.4 Google Calendar Plugin
- *
- * Copyright (c) 2011 Adam Shaw
- * Dual licensed under the MIT and GPL licenses, located in
- * MIT-LICENSE.txt and GPL-LICENSE.txt respectively.
- *
- * Date: Tue Sep 4 23:38:33 2012 -0700
- *
- */
-
-(function($) {
-
-
-var fc = $.fullCalendar;
-var formatDate = fc.formatDate;
-var parseISO8601 = fc.parseISO8601;
-var addDays = fc.addDays;
-var applyAll = fc.applyAll;
-
-
-fc.sourceNormalizers.push(function(sourceOptions) {
- if (sourceOptions.dataType == 'gcal' ||
- sourceOptions.dataType === undefined &&
- (sourceOptions.url || '').match(/^(http|https):\/\/www.google.com\/calendar\/feeds\//)) {
- sourceOptions.dataType = 'gcal';
- if (sourceOptions.editable === undefined) {
- sourceOptions.editable = false;
- }
- }
-});
-
-
-fc.sourceFetchers.push(function(sourceOptions, start, end) {
- if (sourceOptions.dataType == 'gcal') {
- return transformOptions(sourceOptions, start, end);
- }
-});
-
-
-function transformOptions(sourceOptions, start, end) {
-
- var success = sourceOptions.success;
- var data = $.extend({}, sourceOptions.data || {}, {
- 'start-min': formatDate(start, 'u'),
- 'start-max': formatDate(end, 'u'),
- 'singleevents': true,
- 'max-results': 9999
- });
-
- var ctz = sourceOptions.currentTimezone;
- if (ctz) {
- data.ctz = ctz = ctz.replace(' ', '_');
- }
-
- return $.extend({}, sourceOptions, {
- url: sourceOptions.url.replace(/\/basic$/, '/full') + '?alt=json-in-script&callback=?',
- dataType: 'jsonp',
- data: data,
- startParam: false,
- endParam: false,
- success: function(data) {
- var events = [];
- if (data.feed.entry) {
- $.each(data.feed.entry, function(i, entry) {
- var startStr = entry['gd$when'][0]['startTime'];
- var start = parseISO8601(startStr, true);
- var end = parseISO8601(entry['gd$when'][0]['endTime'], true);
- var allDay = startStr.indexOf('T') == -1;
- var url;
- $.each(entry.link, function(i, link) {
- if (link.type == 'text/html') {
- url = link.href;
- if (ctz) {
- url += (url.indexOf('?') == -1 ? '?' : '&') + 'ctz=' + ctz;
- }
- }
- });
- if (allDay) {
- addDays(end, -1); // make inclusive
- }
- events.push({
- id: entry['gCal$uid']['value'],
- title: entry['title']['$t'],
- url: url,
- start: start,
- end: end,
- allDay: allDay,
- location: entry['gd$where'][0]['valueString'],
- description: entry['content']['$t']
- });
- });
- }
- var args = [events].concat(Array.prototype.slice.call(arguments, 1));
- var res = applyAll(success, this, args);
- if ($.isArray(res)) {
- return res;
- }
- return events;
- }
- });
-
-}
-
-
-// legacy
-fc.gcalFeed = function(url, sourceOptions) {
- return $.extend({}, sourceOptions, { url: url, dataType: 'gcal' });
-};
-
-
-})(jQuery);
diff --git a/3rdparty/getid3/extension.cache.dbm.php b/3rdparty/getid3/extension.cache.dbm.php
deleted file mode 100644
index 9a88c22b246..00000000000
--- a/3rdparty/getid3/extension.cache.dbm.php
+++ /dev/null
@@ -1,211 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// //
-// extension.cache.dbm.php - part of getID3() //
-// Please see readme.txt for more information //
-// ///
-/////////////////////////////////////////////////////////////////
-// //
-// This extension written by Allan Hansen <ahartemis*dk> //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-/**
-* This is a caching extension for getID3(). It works the exact same
-* way as the getID3 class, but return cached information very fast
-*
-* Example:
-*
-* Normal getID3 usage (example):
-*
-* require_once 'getid3/getid3.php';
-* $getID3 = new getID3;
-* $getID3->encoding = 'UTF-8';
-* $info1 = $getID3->analyze('file1.flac');
-* $info2 = $getID3->analyze('file2.wv');
-*
-* getID3_cached usage:
-*
-* require_once 'getid3/getid3.php';
-* require_once 'getid3/getid3/extension.cache.dbm.php';
-* $getID3 = new getID3_cached('db3', '/tmp/getid3_cache.dbm',
-* '/tmp/getid3_cache.lock');
-* $getID3->encoding = 'UTF-8';
-* $info1 = $getID3->analyze('file1.flac');
-* $info2 = $getID3->analyze('file2.wv');
-*
-*
-* Supported Cache Types
-*
-* SQL Databases: (use extension.cache.mysql)
-*
-* cache_type cache_options
-* -------------------------------------------------------------------
-* mysql host, database, username, password
-*
-*
-* DBM-Style Databases: (this extension)
-*
-* cache_type cache_options
-* -------------------------------------------------------------------
-* gdbm dbm_filename, lock_filename
-* ndbm dbm_filename, lock_filename
-* db2 dbm_filename, lock_filename
-* db3 dbm_filename, lock_filename
-* db4 dbm_filename, lock_filename (PHP5 required)
-*
-* PHP must have write access to both dbm_filename and lock_filename.
-*
-*
-* Recommended Cache Types
-*
-* Infrequent updates, many reads any DBM
-* Frequent updates mysql
-*/
-
-
-class getID3_cached_dbm extends getID3
-{
-
- // public: constructor - see top of this file for cache type and cache_options
- function getID3_cached_dbm($cache_type, $dbm_filename, $lock_filename) {
-
- // Check for dba extension
- if (!extension_loaded('dba')) {
- throw new Exception('PHP is not compiled with dba support, required to use DBM style cache.');
- }
-
- // Check for specific dba driver
- if (!function_exists('dba_handlers') || !in_array($cache_type, dba_handlers())) {
- throw new Exception('PHP is not compiled --with '.$cache_type.' support, required to use DBM style cache.');
- }
-
- // Create lock file if needed
- if (!file_exists($lock_filename)) {
- if (!touch($lock_filename)) {
- throw new Exception('failed to create lock file: '.$lock_filename);
- }
- }
-
- // Open lock file for writing
- if (!is_writeable($lock_filename)) {
- throw new Exception('lock file: '.$lock_filename.' is not writable');
- }
- $this->lock = fopen($lock_filename, 'w');
-
- // Acquire exclusive write lock to lock file
- flock($this->lock, LOCK_EX);
-
- // Create dbm-file if needed
- if (!file_exists($dbm_filename)) {
- if (!touch($dbm_filename)) {
- throw new Exception('failed to create dbm file: '.$dbm_filename);
- }
- }
-
- // Try to open dbm file for writing
- $this->dba = dba_open($dbm_filename, 'w', $cache_type);
- if (!$this->dba) {
-
- // Failed - create new dbm file
- $this->dba = dba_open($dbm_filename, 'n', $cache_type);
-
- if (!$this->dba) {
- throw new Exception('failed to create dbm file: '.$dbm_filename);
- }
-
- // Insert getID3 version number
- dba_insert(getID3::VERSION, getID3::VERSION, $this->dba);
- }
-
- // Init misc values
- $this->cache_type = $cache_type;
- $this->dbm_filename = $dbm_filename;
-
- // Register destructor
- register_shutdown_function(array($this, '__destruct'));
-
- // Check version number and clear cache if changed
- if (dba_fetch(getID3::VERSION, $this->dba) != getID3::VERSION) {
- $this->clear_cache();
- }
-
- parent::getID3();
- }
-
-
-
- // public: destuctor
- function __destruct() {
-
- // Close dbm file
- dba_close($this->dba);
-
- // Release exclusive lock
- flock($this->lock, LOCK_UN);
-
- // Close lock file
- fclose($this->lock);
- }
-
-
-
- // public: clear cache
- function clear_cache() {
-
- // Close dbm file
- dba_close($this->dba);
-
- // Create new dbm file
- $this->dba = dba_open($this->dbm_filename, 'n', $this->cache_type);
-
- if (!$this->dba) {
- throw new Exception('failed to clear cache/recreate dbm file: '.$this->dbm_filename);
- }
-
- // Insert getID3 version number
- dba_insert(getID3::VERSION, getID3::VERSION, $this->dba);
-
- // Re-register shutdown function
- register_shutdown_function(array($this, '__destruct'));
- }
-
-
-
- // public: analyze file
- function analyze($filename) {
-
- if (file_exists($filename)) {
-
- // Calc key filename::mod_time::size - should be unique
- $key = $filename.'::'.filemtime($filename).'::'.filesize($filename);
-
- // Loopup key
- $result = dba_fetch($key, $this->dba);
-
- // Hit
- if ($result !== false) {
- return unserialize($result);
- }
- }
-
- // Miss
- $result = parent::analyze($filename);
-
- // Save result
- if (file_exists($filename)) {
- dba_insert($key, serialize($result), $this->dba);
- }
-
- return $result;
- }
-
-}
-
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/extension.cache.mysql.php b/3rdparty/getid3/extension.cache.mysql.php
deleted file mode 100644
index 1e1f91fa14a..00000000000
--- a/3rdparty/getid3/extension.cache.mysql.php
+++ /dev/null
@@ -1,173 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// //
-// extension.cache.mysql.php - part of getID3() //
-// Please see readme.txt for more information //
-// ///
-/////////////////////////////////////////////////////////////////
-// //
-// This extension written by Allan Hansen <ahartemis*dk> //
-// Table name mod by Carlo Capocasa <calrocarlocapocasa*com> //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-/**
-* This is a caching extension for getID3(). It works the exact same
-* way as the getID3 class, but return cached information very fast
-*
-* Example: (see also demo.cache.mysql.php in /demo/)
-*
-* Normal getID3 usage (example):
-*
-* require_once 'getid3/getid3.php';
-* $getID3 = new getID3;
-* $getID3->encoding = 'UTF-8';
-* $info1 = $getID3->analyze('file1.flac');
-* $info2 = $getID3->analyze('file2.wv');
-*
-* getID3_cached usage:
-*
-* require_once 'getid3/getid3.php';
-* require_once 'getid3/getid3/extension.cache.mysql.php';
-* // 5th parameter (tablename) is optional, default is 'getid3_cache'
-* $getID3 = new getID3_cached_mysql('localhost', 'database', 'username', 'password', 'tablename');
-* $getID3->encoding = 'UTF-8';
-* $info1 = $getID3->analyze('file1.flac');
-* $info2 = $getID3->analyze('file2.wv');
-*
-*
-* Supported Cache Types (this extension)
-*
-* SQL Databases:
-*
-* cache_type cache_options
-* -------------------------------------------------------------------
-* mysql host, database, username, password
-*
-*
-* DBM-Style Databases: (use extension.cache.dbm)
-*
-* cache_type cache_options
-* -------------------------------------------------------------------
-* gdbm dbm_filename, lock_filename
-* ndbm dbm_filename, lock_filename
-* db2 dbm_filename, lock_filename
-* db3 dbm_filename, lock_filename
-* db4 dbm_filename, lock_filename (PHP5 required)
-*
-* PHP must have write access to both dbm_filename and lock_filename.
-*
-*
-* Recommended Cache Types
-*
-* Infrequent updates, many reads any DBM
-* Frequent updates mysql
-*/
-
-
-class getID3_cached_mysql extends getID3
-{
-
- // private vars
- var $cursor;
- var $connection;
-
-
- // public: constructor - see top of this file for cache type and cache_options
- function getID3_cached_mysql($host, $database, $username, $password, $table='getid3_cache') {
-
- // Check for mysql support
- if (!function_exists('mysql_pconnect')) {
- throw new Exception('PHP not compiled with mysql support.');
- }
-
- // Connect to database
- $this->connection = mysql_pconnect($host, $username, $password);
- if (!$this->connection) {
- throw new Exception('mysql_pconnect() failed - check permissions and spelling.');
- }
-
- // Select database
- if (!mysql_select_db($database, $this->connection)) {
- throw new Exception('Cannot use database '.$database);
- }
-
- // Set table
- $this->table = $table;
-
- // Create cache table if not exists
- $this->create_table();
-
- // Check version number and clear cache if changed
- $version = '';
- if ($this->cursor = mysql_query("SELECT `value` FROM `".mysql_real_escape_string($this->table)."` WHERE (`filename` = '".mysql_real_escape_string(getID3::VERSION)."') AND (`filesize` = '-1') AND (`filetime` = '-1') AND (`analyzetime` = '-1')", $this->connection)) {
- list($version) = mysql_fetch_array($this->cursor);
- }
- if ($version != getID3::VERSION) {
- $this->clear_cache();
- }
-
- parent::getID3();
- }
-
-
-
- // public: clear cache
- function clear_cache() {
-
- $this->cursor = mysql_query("DELETE FROM `".mysql_real_escape_string($this->table)."`", $this->connection);
- $this->cursor = mysql_query("INSERT INTO `".mysql_real_escape_string($this->table)."` VALUES ('".getID3::VERSION."', -1, -1, -1, '".getID3::VERSION."')", $this->connection);
- }
-
-
-
- // public: analyze file
- function analyze($filename) {
-
- if (file_exists($filename)) {
-
- // Short-hands
- $filetime = filemtime($filename);
- $filesize = filesize($filename);
-
- // Lookup file
- $this->cursor = mysql_query("SELECT `value` FROM `".mysql_real_escape_string($this->table)."` WHERE (`filename` = '".mysql_real_escape_string($filename)."') AND (`filesize` = '".mysql_real_escape_string($filesize)."') AND (`filetime` = '".mysql_real_escape_string($filetime)."')", $this->connection);
- if (mysql_num_rows($this->cursor) > 0) {
- // Hit
- list($result) = mysql_fetch_array($this->cursor);
- return unserialize(base64_decode($result));
- }
- }
-
- // Miss
- $analysis = parent::analyze($filename);
-
- // Save result
- if (file_exists($filename)) {
- $this->cursor = mysql_query("INSERT INTO `".mysql_real_escape_string($this->table)."` (`filename`, `filesize`, `filetime`, `analyzetime`, `value`) VALUES ('".mysql_real_escape_string($filename)."', '".mysql_real_escape_string($filesize)."', '".mysql_real_escape_string($filetime)."', '".mysql_real_escape_string(time())."', '".mysql_real_escape_string(base64_encode(serialize($analysis)))."')", $this->connection);
- }
- return $analysis;
- }
-
-
-
- // private: (re)create sql table
- function create_table($drop=false) {
-
- $this->cursor = mysql_query("CREATE TABLE IF NOT EXISTS `".mysql_real_escape_string($this->table)."` (
- `filename` VARCHAR(255) NOT NULL DEFAULT '',
- `filesize` INT(11) NOT NULL DEFAULT '0',
- `filetime` INT(11) NOT NULL DEFAULT '0',
- `analyzetime` INT(11) NOT NULL DEFAULT '0',
- `value` TEXT NOT NULL,
- PRIMARY KEY (`filename`,`filesize`,`filetime`)) TYPE=MyISAM", $this->connection);
- echo mysql_error($this->connection);
- }
-}
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/getid3.lib.php b/3rdparty/getid3/getid3.lib.php
deleted file mode 100644
index 723e2e24c20..00000000000
--- a/3rdparty/getid3/getid3.lib.php
+++ /dev/null
@@ -1,1317 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// //
-// getid3.lib.php - part of getID3() //
-// See readme.txt for more details //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_lib
-{
-
- static function PrintHexBytes($string, $hex=true, $spaces=true, $htmlencoding='UTF-8') {
- $returnstring = '';
- for ($i = 0; $i < strlen($string); $i++) {
- if ($hex) {
- $returnstring .= str_pad(dechex(ord($string{$i})), 2, '0', STR_PAD_LEFT);
- } else {
- $returnstring .= ' '.(preg_match("#[\x20-\x7E]#", $string{$i}) ? $string{$i} : '');
- }
- if ($spaces) {
- $returnstring .= ' ';
- }
- }
- if (!empty($htmlencoding)) {
- if ($htmlencoding === true) {
- $htmlencoding = 'UTF-8'; // prior to getID3 v1.9.0 the function's 4th parameter was boolean
- }
- $returnstring = htmlentities($returnstring, ENT_QUOTES, $htmlencoding);
- }
- return $returnstring;
- }
-
- static function trunc($floatnumber) {
- // truncates a floating-point number at the decimal point
- // returns int (if possible, otherwise float)
- if ($floatnumber >= 1) {
- $truncatednumber = floor($floatnumber);
- } elseif ($floatnumber <= -1) {
- $truncatednumber = ceil($floatnumber);
- } else {
- $truncatednumber = 0;
- }
- if (getid3_lib::intValueSupported($truncatednumber)) {
- $truncatednumber = (int) $truncatednumber;
- }
- return $truncatednumber;
- }
-
-
- static function safe_inc(&$variable, $increment=1) {
- if (isset($variable)) {
- $variable += $increment;
- } else {
- $variable = $increment;
- }
- return true;
- }
-
- static function CastAsInt($floatnum) {
- // convert to float if not already
- $floatnum = (float) $floatnum;
-
- // convert a float to type int, only if possible
- if (getid3_lib::trunc($floatnum) == $floatnum) {
- // it's not floating point
- if (getid3_lib::intValueSupported($floatnum)) {
- // it's within int range
- $floatnum = (int) $floatnum;
- }
- }
- return $floatnum;
- }
-
- public static function intValueSupported($num) {
- // check if integers are 64-bit
- static $hasINT64 = null;
- if ($hasINT64 === null) { // 10x faster than is_null()
- $hasINT64 = is_int(pow(2, 31)); // 32-bit int are limited to (2^31)-1
- if (!$hasINT64 && !defined('PHP_INT_MIN')) {
- define('PHP_INT_MIN', ~PHP_INT_MAX);
- }
- }
- // if integers are 64-bit - no other check required
- if ($hasINT64 || (($num <= PHP_INT_MAX) && ($num >= PHP_INT_MIN))) {
- return true;
- }
- return false;
- }
-
- static function DecimalizeFraction($fraction) {
- list($numerator, $denominator) = explode('/', $fraction);
- return $numerator / ($denominator ? $denominator : 1);
- }
-
-
- static function DecimalBinary2Float($binarynumerator) {
- $numerator = getid3_lib::Bin2Dec($binarynumerator);
- $denominator = getid3_lib::Bin2Dec('1'.str_repeat('0', strlen($binarynumerator)));
- return ($numerator / $denominator);
- }
-
-
- static function NormalizeBinaryPoint($binarypointnumber, $maxbits=52) {
- // http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/binary.html
- if (strpos($binarypointnumber, '.') === false) {
- $binarypointnumber = '0.'.$binarypointnumber;
- } elseif ($binarypointnumber{0} == '.') {
- $binarypointnumber = '0'.$binarypointnumber;
- }
- $exponent = 0;
- while (($binarypointnumber{0} != '1') || (substr($binarypointnumber, 1, 1) != '.')) {
- if (substr($binarypointnumber, 1, 1) == '.') {
- $exponent--;
- $binarypointnumber = substr($binarypointnumber, 2, 1).'.'.substr($binarypointnumber, 3);
- } else {
- $pointpos = strpos($binarypointnumber, '.');
- $exponent += ($pointpos - 1);
- $binarypointnumber = str_replace('.', '', $binarypointnumber);
- $binarypointnumber = $binarypointnumber{0}.'.'.substr($binarypointnumber, 1);
- }
- }
- $binarypointnumber = str_pad(substr($binarypointnumber, 0, $maxbits + 2), $maxbits + 2, '0', STR_PAD_RIGHT);
- return array('normalized'=>$binarypointnumber, 'exponent'=>(int) $exponent);
- }
-
-
- static function Float2BinaryDecimal($floatvalue) {
- // http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/binary.html
- $maxbits = 128; // to how many bits of precision should the calculations be taken?
- $intpart = getid3_lib::trunc($floatvalue);
- $floatpart = abs($floatvalue - $intpart);
- $pointbitstring = '';
- while (($floatpart != 0) && (strlen($pointbitstring) < $maxbits)) {
- $floatpart *= 2;
- $pointbitstring .= (string) getid3_lib::trunc($floatpart);
- $floatpart -= getid3_lib::trunc($floatpart);
- }
- $binarypointnumber = decbin($intpart).'.'.$pointbitstring;
- return $binarypointnumber;
- }
-
-
- static function Float2String($floatvalue, $bits) {
- // http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/ieee-expl.html
- switch ($bits) {
- case 32:
- $exponentbits = 8;
- $fractionbits = 23;
- break;
-
- case 64:
- $exponentbits = 11;
- $fractionbits = 52;
- break;
-
- default:
- return false;
- break;
- }
- if ($floatvalue >= 0) {
- $signbit = '0';
- } else {
- $signbit = '1';
- }
- $normalizedbinary = getid3_lib::NormalizeBinaryPoint(getid3_lib::Float2BinaryDecimal($floatvalue), $fractionbits);
- $biasedexponent = pow(2, $exponentbits - 1) - 1 + $normalizedbinary['exponent']; // (127 or 1023) +/- exponent
- $exponentbitstring = str_pad(decbin($biasedexponent), $exponentbits, '0', STR_PAD_LEFT);
- $fractionbitstring = str_pad(substr($normalizedbinary['normalized'], 2), $fractionbits, '0', STR_PAD_RIGHT);
-
- return getid3_lib::BigEndian2String(getid3_lib::Bin2Dec($signbit.$exponentbitstring.$fractionbitstring), $bits % 8, false);
- }
-
-
- static function LittleEndian2Float($byteword) {
- return getid3_lib::BigEndian2Float(strrev($byteword));
- }
-
-
- static function BigEndian2Float($byteword) {
- // ANSI/IEEE Standard 754-1985, Standard for Binary Floating Point Arithmetic
- // http://www.psc.edu/general/software/packages/ieee/ieee.html
- // http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/ieee.html
-
- $bitword = getid3_lib::BigEndian2Bin($byteword);
- if (!$bitword) {
- return 0;
- }
- $signbit = $bitword{0};
-
- switch (strlen($byteword) * 8) {
- case 32:
- $exponentbits = 8;
- $fractionbits = 23;
- break;
-
- case 64:
- $exponentbits = 11;
- $fractionbits = 52;
- break;
-
- case 80:
- // 80-bit Apple SANE format
- // http://www.mactech.com/articles/mactech/Vol.06/06.01/SANENormalized/
- $exponentstring = substr($bitword, 1, 15);
- $isnormalized = intval($bitword{16});
- $fractionstring = substr($bitword, 17, 63);
- $exponent = pow(2, getid3_lib::Bin2Dec($exponentstring) - 16383);
- $fraction = $isnormalized + getid3_lib::DecimalBinary2Float($fractionstring);
- $floatvalue = $exponent * $fraction;
- if ($signbit == '1') {
- $floatvalue *= -1;
- }
- return $floatvalue;
- break;
-
- default:
- return false;
- break;
- }
- $exponentstring = substr($bitword, 1, $exponentbits);
- $fractionstring = substr($bitword, $exponentbits + 1, $fractionbits);
- $exponent = getid3_lib::Bin2Dec($exponentstring);
- $fraction = getid3_lib::Bin2Dec($fractionstring);
-
- if (($exponent == (pow(2, $exponentbits) - 1)) && ($fraction != 0)) {
- // Not a Number
- $floatvalue = false;
- } elseif (($exponent == (pow(2, $exponentbits) - 1)) && ($fraction == 0)) {
- if ($signbit == '1') {
- $floatvalue = '-infinity';
- } else {
- $floatvalue = '+infinity';
- }
- } elseif (($exponent == 0) && ($fraction == 0)) {
- if ($signbit == '1') {
- $floatvalue = -0;
- } else {
- $floatvalue = 0;
- }
- $floatvalue = ($signbit ? 0 : -0);
- } elseif (($exponent == 0) && ($fraction != 0)) {
- // These are 'unnormalized' values
- $floatvalue = pow(2, (-1 * (pow(2, $exponentbits - 1) - 2))) * getid3_lib::DecimalBinary2Float($fractionstring);
- if ($signbit == '1') {
- $floatvalue *= -1;
- }
- } elseif ($exponent != 0) {
- $floatvalue = pow(2, ($exponent - (pow(2, $exponentbits - 1) - 1))) * (1 + getid3_lib::DecimalBinary2Float($fractionstring));
- if ($signbit == '1') {
- $floatvalue *= -1;
- }
- }
- return (float) $floatvalue;
- }
-
-
- static function BigEndian2Int($byteword, $synchsafe=false, $signed=false) {
- $intvalue = 0;
- $bytewordlen = strlen($byteword);
- if ($bytewordlen == 0) {
- return false;
- }
- for ($i = 0; $i < $bytewordlen; $i++) {
- if ($synchsafe) { // disregard MSB, effectively 7-bit bytes
- //$intvalue = $intvalue | (ord($byteword{$i}) & 0x7F) << (($bytewordlen - 1 - $i) * 7); // faster, but runs into problems past 2^31 on 32-bit systems
- $intvalue += (ord($byteword{$i}) & 0x7F) * pow(2, ($bytewordlen - 1 - $i) * 7);
- } else {
- $intvalue += ord($byteword{$i}) * pow(256, ($bytewordlen - 1 - $i));
- }
- }
- if ($signed && !$synchsafe) {
- // synchsafe ints are not allowed to be signed
- if ($bytewordlen <= PHP_INT_SIZE) {
- $signMaskBit = 0x80 << (8 * ($bytewordlen - 1));
- if ($intvalue & $signMaskBit) {
- $intvalue = 0 - ($intvalue & ($signMaskBit - 1));
- }
- } else {
- throw new Exception('ERROR: Cannot have signed integers larger than '.(8 * PHP_INT_SIZE).'-bits ('.strlen($byteword).') in getid3_lib::BigEndian2Int()');
- break;
- }
- }
- return getid3_lib::CastAsInt($intvalue);
- }
-
-
- static function LittleEndian2Int($byteword, $signed=false) {
- return getid3_lib::BigEndian2Int(strrev($byteword), false, $signed);
- }
-
-
- static function BigEndian2Bin($byteword) {
- $binvalue = '';
- $bytewordlen = strlen($byteword);
- for ($i = 0; $i < $bytewordlen; $i++) {
- $binvalue .= str_pad(decbin(ord($byteword{$i})), 8, '0', STR_PAD_LEFT);
- }
- return $binvalue;
- }
-
-
- static function BigEndian2String($number, $minbytes=1, $synchsafe=false, $signed=false) {
- if ($number < 0) {
- throw new Exception('ERROR: getid3_lib::BigEndian2String() does not support negative numbers');
- }
- $maskbyte = (($synchsafe || $signed) ? 0x7F : 0xFF);
- $intstring = '';
- if ($signed) {
- if ($minbytes > PHP_INT_SIZE) {
- throw new Exception('ERROR: Cannot have signed integers larger than '.(8 * PHP_INT_SIZE).'-bits in getid3_lib::BigEndian2String()');
- }
- $number = $number & (0x80 << (8 * ($minbytes - 1)));
- }
- while ($number != 0) {
- $quotient = ($number / ($maskbyte + 1));
- $intstring = chr(ceil(($quotient - floor($quotient)) * $maskbyte)).$intstring;
- $number = floor($quotient);
- }
- return str_pad($intstring, $minbytes, "\x00", STR_PAD_LEFT);
- }
-
-
- static function Dec2Bin($number) {
- while ($number >= 256) {
- $bytes[] = (($number / 256) - (floor($number / 256))) * 256;
- $number = floor($number / 256);
- }
- $bytes[] = $number;
- $binstring = '';
- for ($i = 0; $i < count($bytes); $i++) {
- $binstring = (($i == count($bytes) - 1) ? decbin($bytes[$i]) : str_pad(decbin($bytes[$i]), 8, '0', STR_PAD_LEFT)).$binstring;
- }
- return $binstring;
- }
-
-
- static function Bin2Dec($binstring, $signed=false) {
- $signmult = 1;
- if ($signed) {
- if ($binstring{0} == '1') {
- $signmult = -1;
- }
- $binstring = substr($binstring, 1);
- }
- $decvalue = 0;
- for ($i = 0; $i < strlen($binstring); $i++) {
- $decvalue += ((int) substr($binstring, strlen($binstring) - $i - 1, 1)) * pow(2, $i);
- }
- return getid3_lib::CastAsInt($decvalue * $signmult);
- }
-
-
- static function Bin2String($binstring) {
- // return 'hi' for input of '0110100001101001'
- $string = '';
- $binstringreversed = strrev($binstring);
- for ($i = 0; $i < strlen($binstringreversed); $i += 8) {
- $string = chr(getid3_lib::Bin2Dec(strrev(substr($binstringreversed, $i, 8)))).$string;
- }
- return $string;
- }
-
-
- static function LittleEndian2String($number, $minbytes=1, $synchsafe=false) {
- $intstring = '';
- while ($number > 0) {
- if ($synchsafe) {
- $intstring = $intstring.chr($number & 127);
- $number >>= 7;
- } else {
- $intstring = $intstring.chr($number & 255);
- $number >>= 8;
- }
- }
- return str_pad($intstring, $minbytes, "\x00", STR_PAD_RIGHT);
- }
-
-
- static function array_merge_clobber($array1, $array2) {
- // written by kchireability*com
- // taken from http://www.php.net/manual/en/function.array-merge-recursive.php
- if (!is_array($array1) || !is_array($array2)) {
- return false;
- }
- $newarray = $array1;
- foreach ($array2 as $key => $val) {
- if (is_array($val) && isset($newarray[$key]) && is_array($newarray[$key])) {
- $newarray[$key] = getid3_lib::array_merge_clobber($newarray[$key], $val);
- } else {
- $newarray[$key] = $val;
- }
- }
- return $newarray;
- }
-
-
- static function array_merge_noclobber($array1, $array2) {
- if (!is_array($array1) || !is_array($array2)) {
- return false;
- }
- $newarray = $array1;
- foreach ($array2 as $key => $val) {
- if (is_array($val) && isset($newarray[$key]) && is_array($newarray[$key])) {
- $newarray[$key] = getid3_lib::array_merge_noclobber($newarray[$key], $val);
- } elseif (!isset($newarray[$key])) {
- $newarray[$key] = $val;
- }
- }
- return $newarray;
- }
-
-
- static function ksort_recursive(&$theArray) {
- ksort($theArray);
- foreach ($theArray as $key => $value) {
- if (is_array($value)) {
- self::ksort_recursive($theArray[$key]);
- }
- }
- return true;
- }
-
- static function fileextension($filename, $numextensions=1) {
- if (strstr($filename, '.')) {
- $reversedfilename = strrev($filename);
- $offset = 0;
- for ($i = 0; $i < $numextensions; $i++) {
- $offset = strpos($reversedfilename, '.', $offset + 1);
- if ($offset === false) {
- return '';
- }
- }
- return strrev(substr($reversedfilename, 0, $offset));
- }
- return '';
- }
-
-
- static function PlaytimeString($seconds) {
- $sign = (($seconds < 0) ? '-' : '');
- $seconds = abs($seconds);
- $H = floor( $seconds / 3600);
- $M = floor(($seconds - (3600 * $H) ) / 60);
- $S = round( $seconds - (3600 * $H) - (60 * $M) );
- return $sign.($H ? $H.':' : '').($H ? str_pad($M, 2, '0', STR_PAD_LEFT) : intval($M)).':'.str_pad($S, 2, 0, STR_PAD_LEFT);
- }
-
-
- static function DateMac2Unix($macdate) {
- // Macintosh timestamp: seconds since 00:00h January 1, 1904
- // UNIX timestamp: seconds since 00:00h January 1, 1970
- return getid3_lib::CastAsInt($macdate - 2082844800);
- }
-
-
- static function FixedPoint8_8($rawdata) {
- return getid3_lib::BigEndian2Int(substr($rawdata, 0, 1)) + (float) (getid3_lib::BigEndian2Int(substr($rawdata, 1, 1)) / pow(2, 8));
- }
-
-
- static function FixedPoint16_16($rawdata) {
- return getid3_lib::BigEndian2Int(substr($rawdata, 0, 2)) + (float) (getid3_lib::BigEndian2Int(substr($rawdata, 2, 2)) / pow(2, 16));
- }
-
-
- static function FixedPoint2_30($rawdata) {
- $binarystring = getid3_lib::BigEndian2Bin($rawdata);
- return getid3_lib::Bin2Dec(substr($binarystring, 0, 2)) + (float) (getid3_lib::Bin2Dec(substr($binarystring, 2, 30)) / pow(2, 30));
- }
-
-
- static function CreateDeepArray($ArrayPath, $Separator, $Value) {
- // assigns $Value to a nested array path:
- // $foo = getid3_lib::CreateDeepArray('/path/to/my', '/', 'file.txt')
- // is the same as:
- // $foo = array('path'=>array('to'=>'array('my'=>array('file.txt'))));
- // or
- // $foo['path']['to']['my'] = 'file.txt';
- while ($ArrayPath && ($ArrayPath{0} == $Separator)) {
- $ArrayPath = substr($ArrayPath, 1);
- }
- if (($pos = strpos($ArrayPath, $Separator)) !== false) {
- $ReturnedArray[substr($ArrayPath, 0, $pos)] = getid3_lib::CreateDeepArray(substr($ArrayPath, $pos + 1), $Separator, $Value);
- } else {
- $ReturnedArray[$ArrayPath] = $Value;
- }
- return $ReturnedArray;
- }
-
- static function array_max($arraydata, $returnkey=false) {
- $maxvalue = false;
- $maxkey = false;
- foreach ($arraydata as $key => $value) {
- if (!is_array($value)) {
- if ($value > $maxvalue) {
- $maxvalue = $value;
- $maxkey = $key;
- }
- }
- }
- return ($returnkey ? $maxkey : $maxvalue);
- }
-
- static function array_min($arraydata, $returnkey=false) {
- $minvalue = false;
- $minkey = false;
- foreach ($arraydata as $key => $value) {
- if (!is_array($value)) {
- if ($value > $minvalue) {
- $minvalue = $value;
- $minkey = $key;
- }
- }
- }
- return ($returnkey ? $minkey : $minvalue);
- }
-
- static function XML2array($XMLstring) {
- if (function_exists('simplexml_load_string')) {
- if (function_exists('get_object_vars')) {
- $XMLobject = simplexml_load_string($XMLstring);
- return self::SimpleXMLelement2array($XMLobject);
- }
- }
- return false;
- }
-
- static function SimpleXMLelement2array($XMLobject) {
- if (!is_object($XMLobject) && !is_array($XMLobject)) {
- return $XMLobject;
- }
- $XMLarray = (is_object($XMLobject) ? get_object_vars($XMLobject) : $XMLobject);
- foreach ($XMLarray as $key => $value) {
- $XMLarray[$key] = self::SimpleXMLelement2array($value);
- }
- return $XMLarray;
- }
-
-
- // Allan Hansen <ahartemis*dk>
- // getid3_lib::md5_data() - returns md5sum for a file from startuing position to absolute end position
- static function hash_data($file, $offset, $end, $algorithm) {
- static $tempdir = '';
- if (!getid3_lib::intValueSupported($end)) {
- return false;
- }
- switch ($algorithm) {
- case 'md5':
- $hash_function = 'md5_file';
- $unix_call = 'md5sum';
- $windows_call = 'md5sum.exe';
- $hash_length = 32;
- break;
-
- case 'sha1':
- $hash_function = 'sha1_file';
- $unix_call = 'sha1sum';
- $windows_call = 'sha1sum.exe';
- $hash_length = 40;
- break;
-
- default:
- throw new Exception('Invalid algorithm ('.$algorithm.') in getid3_lib::hash_data()');
- break;
- }
- $size = $end - $offset;
- while (true) {
- if (GETID3_OS_ISWINDOWS) {
-
- // It seems that sha1sum.exe for Windows only works on physical files, does not accept piped data
- // Fall back to create-temp-file method:
- if ($algorithm == 'sha1') {
- break;
- }
-
- $RequiredFiles = array('cygwin1.dll', 'head.exe', 'tail.exe', $windows_call);
- foreach ($RequiredFiles as $required_file) {
- if (!is_readable(GETID3_HELPERAPPSDIR.$required_file)) {
- // helper apps not available - fall back to old method
- break;
- }
- }
- $commandline = GETID3_HELPERAPPSDIR.'head.exe -c '.$end.' "'.escapeshellarg(str_replace('/', DIRECTORY_SEPARATOR, $file)).'" | ';
- $commandline .= GETID3_HELPERAPPSDIR.'tail.exe -c '.$size.' | ';
- $commandline .= GETID3_HELPERAPPSDIR.$windows_call;
-
- } else {
-
- $commandline = 'head -c'.$end.' '.escapeshellarg($file).' | ';
- $commandline .= 'tail -c'.$size.' | ';
- $commandline .= $unix_call;
-
- }
- if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) {
- //throw new Exception('PHP running in Safe Mode - backtick operator not available, using slower non-system-call '.$algorithm.' algorithm');
- break;
- }
- return substr(`$commandline`, 0, $hash_length);
- }
-
- if (empty($tempdir)) {
- // yes this is ugly, feel free to suggest a better way
- require_once(dirname(__FILE__).'/getid3.php');
- $getid3_temp = new getID3();
- $tempdir = $getid3_temp->tempdir;
- unset($getid3_temp);
- }
- // try to create a temporary file in the system temp directory - invalid dirname should force to system temp dir
- if (($data_filename = tempnam($tempdir, 'gI3')) === false) {
- // can't find anywhere to create a temp file, just fail
- return false;
- }
-
- // Init
- $result = false;
-
- // copy parts of file
- try {
- getid3_lib::CopyFileParts($file, $data_filename, $offset, $end - $offset);
- $result = $hash_function($data_filename);
- } catch (Exception $e) {
- throw new Exception('getid3_lib::CopyFileParts() failed in getid_lib::hash_data(): '.$e->getMessage());
- }
- unlink($data_filename);
- return $result;
- }
-
- static function CopyFileParts($filename_source, $filename_dest, $offset, $length) {
- if (!getid3_lib::intValueSupported($offset + $length)) {
- throw new Exception('cannot copy file portion, it extends beyond the '.round(PHP_INT_MAX / 1073741824).'GB limit');
- }
- if (is_readable($filename_source) && is_file($filename_source) && ($fp_src = fopen($filename_source, 'rb'))) {
- if (($fp_dest = fopen($filename_dest, 'wb'))) {
- if (fseek($fp_src, $offset, SEEK_SET) == 0) {
- $byteslefttowrite = $length;
- while (($byteslefttowrite > 0) && ($buffer = fread($fp_src, min($byteslefttowrite, getID3::FREAD_BUFFER_SIZE)))) {
- $byteswritten = fwrite($fp_dest, $buffer, $byteslefttowrite);
- $byteslefttowrite -= $byteswritten;
- }
- return true;
- } else {
- throw new Exception('failed to seek to offset '.$offset.' in '.$filename_source);
- }
- fclose($fp_dest);
- } else {
- throw new Exception('failed to create file for writing '.$filename_dest);
- }
- fclose($fp_src);
- } else {
- throw new Exception('failed to open file for reading '.$filename_source);
- }
- return false;
- }
-
- static function iconv_fallback_int_utf8($charval) {
- if ($charval < 128) {
- // 0bbbbbbb
- $newcharstring = chr($charval);
- } elseif ($charval < 2048) {
- // 110bbbbb 10bbbbbb
- $newcharstring = chr(($charval >> 6) | 0xC0);
- $newcharstring .= chr(($charval & 0x3F) | 0x80);
- } elseif ($charval < 65536) {
- // 1110bbbb 10bbbbbb 10bbbbbb
- $newcharstring = chr(($charval >> 12) | 0xE0);
- $newcharstring .= chr(($charval >> 6) | 0xC0);
- $newcharstring .= chr(($charval & 0x3F) | 0x80);
- } else {
- // 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb
- $newcharstring = chr(($charval >> 18) | 0xF0);
- $newcharstring .= chr(($charval >> 12) | 0xC0);
- $newcharstring .= chr(($charval >> 6) | 0xC0);
- $newcharstring .= chr(($charval & 0x3F) | 0x80);
- }
- return $newcharstring;
- }
-
- // ISO-8859-1 => UTF-8
- static function iconv_fallback_iso88591_utf8($string, $bom=false) {
- if (function_exists('utf8_encode')) {
- return utf8_encode($string);
- }
- // utf8_encode() unavailable, use getID3()'s iconv_fallback() conversions (possibly PHP is compiled without XML support)
- $newcharstring = '';
- if ($bom) {
- $newcharstring .= "\xEF\xBB\xBF";
- }
- for ($i = 0; $i < strlen($string); $i++) {
- $charval = ord($string{$i});
- $newcharstring .= getid3_lib::iconv_fallback_int_utf8($charval);
- }
- return $newcharstring;
- }
-
- // ISO-8859-1 => UTF-16BE
- static function iconv_fallback_iso88591_utf16be($string, $bom=false) {
- $newcharstring = '';
- if ($bom) {
- $newcharstring .= "\xFE\xFF";
- }
- for ($i = 0; $i < strlen($string); $i++) {
- $newcharstring .= "\x00".$string{$i};
- }
- return $newcharstring;
- }
-
- // ISO-8859-1 => UTF-16LE
- static function iconv_fallback_iso88591_utf16le($string, $bom=false) {
- $newcharstring = '';
- if ($bom) {
- $newcharstring .= "\xFF\xFE";
- }
- for ($i = 0; $i < strlen($string); $i++) {
- $newcharstring .= $string{$i}."\x00";
- }
- return $newcharstring;
- }
-
- // ISO-8859-1 => UTF-16LE (BOM)
- static function iconv_fallback_iso88591_utf16($string) {
- return getid3_lib::iconv_fallback_iso88591_utf16le($string, true);
- }
-
- // UTF-8 => ISO-8859-1
- static function iconv_fallback_utf8_iso88591($string) {
- if (function_exists('utf8_decode')) {
- return utf8_decode($string);
- }
- // utf8_decode() unavailable, use getID3()'s iconv_fallback() conversions (possibly PHP is compiled without XML support)
- $newcharstring = '';
- $offset = 0;
- $stringlength = strlen($string);
- while ($offset < $stringlength) {
- if ((ord($string{$offset}) | 0x07) == 0xF7) {
- // 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb
- $charval = ((ord($string{($offset + 0)}) & 0x07) << 18) &
- ((ord($string{($offset + 1)}) & 0x3F) << 12) &
- ((ord($string{($offset + 2)}) & 0x3F) << 6) &
- (ord($string{($offset + 3)}) & 0x3F);
- $offset += 4;
- } elseif ((ord($string{$offset}) | 0x0F) == 0xEF) {
- // 1110bbbb 10bbbbbb 10bbbbbb
- $charval = ((ord($string{($offset + 0)}) & 0x0F) << 12) &
- ((ord($string{($offset + 1)}) & 0x3F) << 6) &
- (ord($string{($offset + 2)}) & 0x3F);
- $offset += 3;
- } elseif ((ord($string{$offset}) | 0x1F) == 0xDF) {
- // 110bbbbb 10bbbbbb
- $charval = ((ord($string{($offset + 0)}) & 0x1F) << 6) &
- (ord($string{($offset + 1)}) & 0x3F);
- $offset += 2;
- } elseif ((ord($string{$offset}) | 0x7F) == 0x7F) {
- // 0bbbbbbb
- $charval = ord($string{$offset});
- $offset += 1;
- } else {
- // error? throw some kind of warning here?
- $charval = false;
- $offset += 1;
- }
- if ($charval !== false) {
- $newcharstring .= (($charval < 256) ? chr($charval) : '?');
- }
- }
- return $newcharstring;
- }
-
- // UTF-8 => UTF-16BE
- static function iconv_fallback_utf8_utf16be($string, $bom=false) {
- $newcharstring = '';
- if ($bom) {
- $newcharstring .= "\xFE\xFF";
- }
- $offset = 0;
- $stringlength = strlen($string);
- while ($offset < $stringlength) {
- if ((ord($string{$offset}) | 0x07) == 0xF7) {
- // 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb
- $charval = ((ord($string{($offset + 0)}) & 0x07) << 18) &
- ((ord($string{($offset + 1)}) & 0x3F) << 12) &
- ((ord($string{($offset + 2)}) & 0x3F) << 6) &
- (ord($string{($offset + 3)}) & 0x3F);
- $offset += 4;
- } elseif ((ord($string{$offset}) | 0x0F) == 0xEF) {
- // 1110bbbb 10bbbbbb 10bbbbbb
- $charval = ((ord($string{($offset + 0)}) & 0x0F) << 12) &
- ((ord($string{($offset + 1)}) & 0x3F) << 6) &
- (ord($string{($offset + 2)}) & 0x3F);
- $offset += 3;
- } elseif ((ord($string{$offset}) | 0x1F) == 0xDF) {
- // 110bbbbb 10bbbbbb
- $charval = ((ord($string{($offset + 0)}) & 0x1F) << 6) &
- (ord($string{($offset + 1)}) & 0x3F);
- $offset += 2;
- } elseif ((ord($string{$offset}) | 0x7F) == 0x7F) {
- // 0bbbbbbb
- $charval = ord($string{$offset});
- $offset += 1;
- } else {
- // error? throw some kind of warning here?
- $charval = false;
- $offset += 1;
- }
- if ($charval !== false) {
- $newcharstring .= (($charval < 65536) ? getid3_lib::BigEndian2String($charval, 2) : "\x00".'?');
- }
- }
- return $newcharstring;
- }
-
- // UTF-8 => UTF-16LE
- static function iconv_fallback_utf8_utf16le($string, $bom=false) {
- $newcharstring = '';
- if ($bom) {
- $newcharstring .= "\xFF\xFE";
- }
- $offset = 0;
- $stringlength = strlen($string);
- while ($offset < $stringlength) {
- if ((ord($string{$offset}) | 0x07) == 0xF7) {
- // 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb
- $charval = ((ord($string{($offset + 0)}) & 0x07) << 18) &
- ((ord($string{($offset + 1)}) & 0x3F) << 12) &
- ((ord($string{($offset + 2)}) & 0x3F) << 6) &
- (ord($string{($offset + 3)}) & 0x3F);
- $offset += 4;
- } elseif ((ord($string{$offset}) | 0x0F) == 0xEF) {
- // 1110bbbb 10bbbbbb 10bbbbbb
- $charval = ((ord($string{($offset + 0)}) & 0x0F) << 12) &
- ((ord($string{($offset + 1)}) & 0x3F) << 6) &
- (ord($string{($offset + 2)}) & 0x3F);
- $offset += 3;
- } elseif ((ord($string{$offset}) | 0x1F) == 0xDF) {
- // 110bbbbb 10bbbbbb
- $charval = ((ord($string{($offset + 0)}) & 0x1F) << 6) &
- (ord($string{($offset + 1)}) & 0x3F);
- $offset += 2;
- } elseif ((ord($string{$offset}) | 0x7F) == 0x7F) {
- // 0bbbbbbb
- $charval = ord($string{$offset});
- $offset += 1;
- } else {
- // error? maybe throw some warning here?
- $charval = false;
- $offset += 1;
- }
- if ($charval !== false) {
- $newcharstring .= (($charval < 65536) ? getid3_lib::LittleEndian2String($charval, 2) : '?'."\x00");
- }
- }
- return $newcharstring;
- }
-
- // UTF-8 => UTF-16LE (BOM)
- static function iconv_fallback_utf8_utf16($string) {
- return getid3_lib::iconv_fallback_utf8_utf16le($string, true);
- }
-
- // UTF-16BE => UTF-8
- static function iconv_fallback_utf16be_utf8($string) {
- if (substr($string, 0, 2) == "\xFE\xFF") {
- // strip BOM
- $string = substr($string, 2);
- }
- $newcharstring = '';
- for ($i = 0; $i < strlen($string); $i += 2) {
- $charval = getid3_lib::BigEndian2Int(substr($string, $i, 2));
- $newcharstring .= getid3_lib::iconv_fallback_int_utf8($charval);
- }
- return $newcharstring;
- }
-
- // UTF-16LE => UTF-8
- static function iconv_fallback_utf16le_utf8($string) {
- if (substr($string, 0, 2) == "\xFF\xFE") {
- // strip BOM
- $string = substr($string, 2);
- }
- $newcharstring = '';
- for ($i = 0; $i < strlen($string); $i += 2) {
- $charval = getid3_lib::LittleEndian2Int(substr($string, $i, 2));
- $newcharstring .= getid3_lib::iconv_fallback_int_utf8($charval);
- }
- return $newcharstring;
- }
-
- // UTF-16BE => ISO-8859-1
- static function iconv_fallback_utf16be_iso88591($string) {
- if (substr($string, 0, 2) == "\xFE\xFF") {
- // strip BOM
- $string = substr($string, 2);
- }
- $newcharstring = '';
- for ($i = 0; $i < strlen($string); $i += 2) {
- $charval = getid3_lib::BigEndian2Int(substr($string, $i, 2));
- $newcharstring .= (($charval < 256) ? chr($charval) : '?');
- }
- return $newcharstring;
- }
-
- // UTF-16LE => ISO-8859-1
- static function iconv_fallback_utf16le_iso88591($string) {
- if (substr($string, 0, 2) == "\xFF\xFE") {
- // strip BOM
- $string = substr($string, 2);
- }
- $newcharstring = '';
- for ($i = 0; $i < strlen($string); $i += 2) {
- $charval = getid3_lib::LittleEndian2Int(substr($string, $i, 2));
- $newcharstring .= (($charval < 256) ? chr($charval) : '?');
- }
- return $newcharstring;
- }
-
- // UTF-16 (BOM) => ISO-8859-1
- static function iconv_fallback_utf16_iso88591($string) {
- $bom = substr($string, 0, 2);
- if ($bom == "\xFE\xFF") {
- return getid3_lib::iconv_fallback_utf16be_iso88591(substr($string, 2));
- } elseif ($bom == "\xFF\xFE") {
- return getid3_lib::iconv_fallback_utf16le_iso88591(substr($string, 2));
- }
- return $string;
- }
-
- // UTF-16 (BOM) => UTF-8
- static function iconv_fallback_utf16_utf8($string) {
- $bom = substr($string, 0, 2);
- if ($bom == "\xFE\xFF") {
- return getid3_lib::iconv_fallback_utf16be_utf8(substr($string, 2));
- } elseif ($bom == "\xFF\xFE") {
- return getid3_lib::iconv_fallback_utf16le_utf8(substr($string, 2));
- }
- return $string;
- }
-
- static function iconv_fallback($in_charset, $out_charset, $string) {
-
- if ($in_charset == $out_charset) {
- return $string;
- }
-
- // iconv() availble
- if (function_exists('iconv')) {
- if ($converted_string = @iconv($in_charset, $out_charset.'//TRANSLIT', $string)) {
- switch ($out_charset) {
- case 'ISO-8859-1':
- $converted_string = rtrim($converted_string, "\x00");
- break;
- }
- return $converted_string;
- }
-
- // iconv() may sometimes fail with "illegal character in input string" error message
- // and return an empty string, but returning the unconverted string is more useful
- return $string;
- }
-
-
- // iconv() not available
- static $ConversionFunctionList = array();
- if (empty($ConversionFunctionList)) {
- $ConversionFunctionList['ISO-8859-1']['UTF-8'] = 'iconv_fallback_iso88591_utf8';
- $ConversionFunctionList['ISO-8859-1']['UTF-16'] = 'iconv_fallback_iso88591_utf16';
- $ConversionFunctionList['ISO-8859-1']['UTF-16BE'] = 'iconv_fallback_iso88591_utf16be';
- $ConversionFunctionList['ISO-8859-1']['UTF-16LE'] = 'iconv_fallback_iso88591_utf16le';
- $ConversionFunctionList['UTF-8']['ISO-8859-1'] = 'iconv_fallback_utf8_iso88591';
- $ConversionFunctionList['UTF-8']['UTF-16'] = 'iconv_fallback_utf8_utf16';
- $ConversionFunctionList['UTF-8']['UTF-16BE'] = 'iconv_fallback_utf8_utf16be';
- $ConversionFunctionList['UTF-8']['UTF-16LE'] = 'iconv_fallback_utf8_utf16le';
- $ConversionFunctionList['UTF-16']['ISO-8859-1'] = 'iconv_fallback_utf16_iso88591';
- $ConversionFunctionList['UTF-16']['UTF-8'] = 'iconv_fallback_utf16_utf8';
- $ConversionFunctionList['UTF-16LE']['ISO-8859-1'] = 'iconv_fallback_utf16le_iso88591';
- $ConversionFunctionList['UTF-16LE']['UTF-8'] = 'iconv_fallback_utf16le_utf8';
- $ConversionFunctionList['UTF-16BE']['ISO-8859-1'] = 'iconv_fallback_utf16be_iso88591';
- $ConversionFunctionList['UTF-16BE']['UTF-8'] = 'iconv_fallback_utf16be_utf8';
- }
- if (isset($ConversionFunctionList[strtoupper($in_charset)][strtoupper($out_charset)])) {
- $ConversionFunction = $ConversionFunctionList[strtoupper($in_charset)][strtoupper($out_charset)];
- return getid3_lib::$ConversionFunction($string);
- }
- throw new Exception('PHP does not have iconv() support - cannot convert from '.$in_charset.' to '.$out_charset);
- }
-
-
- static function MultiByteCharString2HTML($string, $charset='ISO-8859-1') {
- $string = (string) $string; // in case trying to pass a numeric (float, int) string, would otherwise return an empty string
- $HTMLstring = '';
-
- switch ($charset) {
- case '1251':
- case '1252':
- case '866':
- case '932':
- case '936':
- case '950':
- case 'BIG5':
- case 'BIG5-HKSCS':
- case 'cp1251':
- case 'cp1252':
- case 'cp866':
- case 'EUC-JP':
- case 'EUCJP':
- case 'GB2312':
- case 'ibm866':
- case 'ISO-8859-1':
- case 'ISO-8859-15':
- case 'ISO8859-1':
- case 'ISO8859-15':
- case 'KOI8-R':
- case 'koi8-ru':
- case 'koi8r':
- case 'Shift_JIS':
- case 'SJIS':
- case 'win-1251':
- case 'Windows-1251':
- case 'Windows-1252':
- $HTMLstring = htmlentities($string, ENT_COMPAT, $charset);
- break;
-
- case 'UTF-8':
- $strlen = strlen($string);
- for ($i = 0; $i < $strlen; $i++) {
- $char_ord_val = ord($string{$i});
- $charval = 0;
- if ($char_ord_val < 0x80) {
- $charval = $char_ord_val;
- } elseif ((($char_ord_val & 0xF0) >> 4) == 0x0F && $i+3 < $strlen) {
- $charval = (($char_ord_val & 0x07) << 18);
- $charval += ((ord($string{++$i}) & 0x3F) << 12);
- $charval += ((ord($string{++$i}) & 0x3F) << 6);
- $charval += (ord($string{++$i}) & 0x3F);
- } elseif ((($char_ord_val & 0xE0) >> 5) == 0x07 && $i+2 < $strlen) {
- $charval = (($char_ord_val & 0x0F) << 12);
- $charval += ((ord($string{++$i}) & 0x3F) << 6);
- $charval += (ord($string{++$i}) & 0x3F);
- } elseif ((($char_ord_val & 0xC0) >> 6) == 0x03 && $i+1 < $strlen) {
- $charval = (($char_ord_val & 0x1F) << 6);
- $charval += (ord($string{++$i}) & 0x3F);
- }
- if (($charval >= 32) && ($charval <= 127)) {
- $HTMLstring .= htmlentities(chr($charval));
- } else {
- $HTMLstring .= '&#'.$charval.';';
- }
- }
- break;
-
- case 'UTF-16LE':
- for ($i = 0; $i < strlen($string); $i += 2) {
- $charval = getid3_lib::LittleEndian2Int(substr($string, $i, 2));
- if (($charval >= 32) && ($charval <= 127)) {
- $HTMLstring .= chr($charval);
- } else {
- $HTMLstring .= '&#'.$charval.';';
- }
- }
- break;
-
- case 'UTF-16BE':
- for ($i = 0; $i < strlen($string); $i += 2) {
- $charval = getid3_lib::BigEndian2Int(substr($string, $i, 2));
- if (($charval >= 32) && ($charval <= 127)) {
- $HTMLstring .= chr($charval);
- } else {
- $HTMLstring .= '&#'.$charval.';';
- }
- }
- break;
-
- default:
- $HTMLstring = 'ERROR: Character set "'.$charset.'" not supported in MultiByteCharString2HTML()';
- break;
- }
- return $HTMLstring;
- }
-
-
-
- static function RGADnameLookup($namecode) {
- static $RGADname = array();
- if (empty($RGADname)) {
- $RGADname[0] = 'not set';
- $RGADname[1] = 'Track Gain Adjustment';
- $RGADname[2] = 'Album Gain Adjustment';
- }
-
- return (isset($RGADname[$namecode]) ? $RGADname[$namecode] : '');
- }
-
-
- static function RGADoriginatorLookup($originatorcode) {
- static $RGADoriginator = array();
- if (empty($RGADoriginator)) {
- $RGADoriginator[0] = 'unspecified';
- $RGADoriginator[1] = 'pre-set by artist/producer/mastering engineer';
- $RGADoriginator[2] = 'set by user';
- $RGADoriginator[3] = 'determined automatically';
- }
-
- return (isset($RGADoriginator[$originatorcode]) ? $RGADoriginator[$originatorcode] : '');
- }
-
-
- static function RGADadjustmentLookup($rawadjustment, $signbit) {
- $adjustment = $rawadjustment / 10;
- if ($signbit == 1) {
- $adjustment *= -1;
- }
- return (float) $adjustment;
- }
-
-
- static function RGADgainString($namecode, $originatorcode, $replaygain) {
- if ($replaygain < 0) {
- $signbit = '1';
- } else {
- $signbit = '0';
- }
- $storedreplaygain = intval(round($replaygain * 10));
- $gainstring = str_pad(decbin($namecode), 3, '0', STR_PAD_LEFT);
- $gainstring .= str_pad(decbin($originatorcode), 3, '0', STR_PAD_LEFT);
- $gainstring .= $signbit;
- $gainstring .= str_pad(decbin($storedreplaygain), 9, '0', STR_PAD_LEFT);
-
- return $gainstring;
- }
-
- static function RGADamplitude2dB($amplitude) {
- return 20 * log10($amplitude);
- }
-
-
- static function GetDataImageSize($imgData, &$imageinfo) {
- static $tempdir = '';
- if (empty($tempdir)) {
- // yes this is ugly, feel free to suggest a better way
- require_once(dirname(__FILE__).'/getid3.php');
- $getid3_temp = new getID3();
- $tempdir = $getid3_temp->tempdir;
- unset($getid3_temp);
- }
- $GetDataImageSize = false;
- if ($tempfilename = tempnam($tempdir, 'gI3')) {
- if (is_writable($tempfilename) && is_file($tempfilename) && ($tmp = fopen($tempfilename, 'wb'))) {
- fwrite($tmp, $imgData);
- fclose($tmp);
- $GetDataImageSize = @GetImageSize($tempfilename, $imageinfo);
- }
- unlink($tempfilename);
- }
- return $GetDataImageSize;
- }
-
- static function ImageTypesLookup($imagetypeid) {
- static $ImageTypesLookup = array();
- if (empty($ImageTypesLookup)) {
- $ImageTypesLookup[1] = 'gif';
- $ImageTypesLookup[2] = 'jpeg';
- $ImageTypesLookup[3] = 'png';
- $ImageTypesLookup[4] = 'swf';
- $ImageTypesLookup[5] = 'psd';
- $ImageTypesLookup[6] = 'bmp';
- $ImageTypesLookup[7] = 'tiff (little-endian)';
- $ImageTypesLookup[8] = 'tiff (big-endian)';
- $ImageTypesLookup[9] = 'jpc';
- $ImageTypesLookup[10] = 'jp2';
- $ImageTypesLookup[11] = 'jpx';
- $ImageTypesLookup[12] = 'jb2';
- $ImageTypesLookup[13] = 'swc';
- $ImageTypesLookup[14] = 'iff';
- }
- return (isset($ImageTypesLookup[$imagetypeid]) ? $ImageTypesLookup[$imagetypeid] : '');
- }
-
- static function CopyTagsToComments(&$ThisFileInfo) {
-
- // Copy all entries from ['tags'] into common ['comments']
- if (!empty($ThisFileInfo['tags'])) {
- foreach ($ThisFileInfo['tags'] as $tagtype => $tagarray) {
- foreach ($tagarray as $tagname => $tagdata) {
- foreach ($tagdata as $key => $value) {
- if (!empty($value)) {
- if (empty($ThisFileInfo['comments'][$tagname])) {
-
- // fall through and append value
-
- } elseif ($tagtype == 'id3v1') {
-
- $newvaluelength = strlen(trim($value));
- foreach ($ThisFileInfo['comments'][$tagname] as $existingkey => $existingvalue) {
- $oldvaluelength = strlen(trim($existingvalue));
- if (($newvaluelength <= $oldvaluelength) && (substr($existingvalue, 0, $newvaluelength) == trim($value))) {
- // new value is identical but shorter-than (or equal-length to) one already in comments - skip
- break 2;
- }
- }
-
- } elseif (!is_array($value)) {
-
- $newvaluelength = strlen(trim($value));
- foreach ($ThisFileInfo['comments'][$tagname] as $existingkey => $existingvalue) {
- $oldvaluelength = strlen(trim($existingvalue));
- if (($newvaluelength > $oldvaluelength) && (substr(trim($value), 0, strlen($existingvalue)) == $existingvalue)) {
- $ThisFileInfo['comments'][$tagname][$existingkey] = trim($value);
- break 2;
- }
- }
-
- }
- if (is_array($value) || empty($ThisFileInfo['comments'][$tagname]) || !in_array(trim($value), $ThisFileInfo['comments'][$tagname])) {
- $value = (is_string($value) ? trim($value) : $value);
- $ThisFileInfo['comments'][$tagname][] = $value;
- }
- }
- }
- }
- }
-
- // Copy to ['comments_html']
- foreach ($ThisFileInfo['comments'] as $field => $values) {
- if ($field == 'picture') {
- // pictures can take up a lot of space, and we don't need multiple copies of them
- // let there be a single copy in [comments][picture], and not elsewhere
- continue;
- }
- foreach ($values as $index => $value) {
- if (is_array($value)) {
- $ThisFileInfo['comments_html'][$field][$index] = $value;
- } else {
- $ThisFileInfo['comments_html'][$field][$index] = str_replace('&#0;', '', getid3_lib::MultiByteCharString2HTML($value, $ThisFileInfo['encoding']));
- }
- }
- }
- }
- return true;
- }
-
-
- static function EmbeddedLookup($key, $begin, $end, $file, $name) {
-
- // Cached
- static $cache;
- if (isset($cache[$file][$name])) {
- return (isset($cache[$file][$name][$key]) ? $cache[$file][$name][$key] : '');
- }
-
- // Init
- $keylength = strlen($key);
- $line_count = $end - $begin - 7;
-
- // Open php file
- $fp = fopen($file, 'r');
-
- // Discard $begin lines
- for ($i = 0; $i < ($begin + 3); $i++) {
- fgets($fp, 1024);
- }
-
- // Loop thru line
- while (0 < $line_count--) {
-
- // Read line
- $line = ltrim(fgets($fp, 1024), "\t ");
-
- // METHOD A: only cache the matching key - less memory but slower on next lookup of not-previously-looked-up key
- //$keycheck = substr($line, 0, $keylength);
- //if ($key == $keycheck) {
- // $cache[$file][$name][$keycheck] = substr($line, $keylength + 1);
- // break;
- //}
-
- // METHOD B: cache all keys in this lookup - more memory but faster on next lookup of not-previously-looked-up key
- //$cache[$file][$name][substr($line, 0, $keylength)] = trim(substr($line, $keylength + 1));
- $explodedLine = explode("\t", $line, 2);
- $ThisKey = (isset($explodedLine[0]) ? $explodedLine[0] : '');
- $ThisValue = (isset($explodedLine[1]) ? $explodedLine[1] : '');
- $cache[$file][$name][$ThisKey] = trim($ThisValue);
- }
-
- // Close and return
- fclose($fp);
- return (isset($cache[$file][$name][$key]) ? $cache[$file][$name][$key] : '');
- }
-
- static function IncludeDependency($filename, $sourcefile, $DieOnFailure=false) {
- global $GETID3_ERRORARRAY;
-
- if (file_exists($filename)) {
- if (include_once($filename)) {
- return true;
- } else {
- $diemessage = basename($sourcefile).' depends on '.$filename.', which has errors';
- }
- } else {
- $diemessage = basename($sourcefile).' depends on '.$filename.', which is missing';
- }
- if ($DieOnFailure) {
- throw new Exception($diemessage);
- } else {
- $GETID3_ERRORARRAY[] = $diemessage;
- }
- return false;
- }
-
- public static function trimNullByte($string) {
- return trim($string, "\x00");
- }
-
-}
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/getid3.php b/3rdparty/getid3/getid3.php
deleted file mode 100644
index e8a3f7e2de6..00000000000
--- a/3rdparty/getid3/getid3.php
+++ /dev/null
@@ -1,1744 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// //
-// Please see readme.txt for more information //
-// ///
-/////////////////////////////////////////////////////////////////
-
-// attempt to define temp dir as something flexible but reliable
-$temp_dir = ini_get('upload_tmp_dir');
-if ($temp_dir && (!is_dir($temp_dir) || !is_readable($temp_dir))) {
- $temp_dir = '';
-}
-if (!$temp_dir && function_exists('sys_get_temp_dir')) {
- // PHP v5.2.1+
- // sys_get_temp_dir() may give inaccessible temp dir, e.g. with open_basedir on virtual hosts
- $temp_dir = sys_get_temp_dir();
-}
-$temp_dir = realpath($temp_dir);
-$open_basedir = ini_get('open_basedir');
-if ($open_basedir) {
- // e.g. "/var/www/vhosts/getid3.org/httpdocs/:/tmp/"
- $temp_dir = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $temp_dir);
- $open_basedir = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $open_basedir);
- if (substr($temp_dir, -1, 1) != DIRECTORY_SEPARATOR) {
- $temp_dir .= DIRECTORY_SEPARATOR;
- }
- $found_valid_tempdir = false;
- $open_basedirs = explode(':', $open_basedir);
- foreach ($open_basedirs as $basedir) {
- if (substr($basedir, -1, 1) != DIRECTORY_SEPARATOR) {
- $basedir .= DIRECTORY_SEPARATOR;
- }
- if (preg_match('#^'.preg_quote($basedir).'#', $temp_dir)) {
- $found_valid_tempdir = true;
- break;
- }
- }
- if (!$found_valid_tempdir) {
- $temp_dir = '';
- }
- unset($open_basedirs, $found_valid_tempdir, $basedir);
-}
-if (!$temp_dir) {
- $temp_dir = '*'; // invalid directory name should force tempnam() to use system default temp dir
-}
-// $temp_dir = '/something/else/'; // feel free to override temp dir here if it works better for your system
-define('GETID3_TEMP_DIR', $temp_dir);
-unset($open_basedir, $temp_dir);
-
-
-// define a constant rather than looking up every time it is needed
-if (!defined('GETID3_OS_ISWINDOWS')) {
- if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
- define('GETID3_OS_ISWINDOWS', true);
- } else {
- define('GETID3_OS_ISWINDOWS', false);
- }
-}
-
-// Get base path of getID3() - ONCE
-if (!defined('GETID3_INCLUDEPATH')) {
- foreach (get_included_files() as $key => $val) {
- if (basename($val) == 'getid3.php') {
- define('GETID3_INCLUDEPATH', dirname($val).DIRECTORY_SEPARATOR);
- break;
- }
- }
-}
-
-// End: Defines
-
-
-class getID3
-{
- // public: Settings
- public $encoding = 'UTF-8'; // CASE SENSITIVE! - i.e. (must be supported by iconv()). Examples: ISO-8859-1 UTF-8 UTF-16 UTF-16BE
- public $encoding_id3v1 = 'ISO-8859-1'; // Should always be 'ISO-8859-1', but some tags may be written in other encodings such as 'EUC-CN' or 'CP1252'
-
- // public: Optional tag checks - disable for speed.
- public $option_tag_id3v1 = true; // Read and process ID3v1 tags
- public $option_tag_id3v2 = true; // Read and process ID3v2 tags
- public $option_tag_lyrics3 = true; // Read and process Lyrics3 tags
- public $option_tag_apetag = true; // Read and process APE tags
- public $option_tags_process = true; // Copy tags to root key 'tags' and encode to $this->encoding
- public $option_tags_html = true; // Copy tags to root key 'tags_html' properly translated from various encodings to HTML entities
-
- // public: Optional tag/comment calucations
- public $option_extra_info = true; // Calculate additional info such as bitrate, channelmode etc
-
- // public: Optional handling of embedded attachments (e.g. images)
- public $option_save_attachments = true; // defaults to true (ATTACHMENTS_INLINE) for backward compatibility
-
- // public: Optional calculations
- public $option_md5_data = false; // Get MD5 sum of data part - slow
- public $option_md5_data_source = false; // Use MD5 of source file if availble - only FLAC and OptimFROG
- public $option_sha1_data = false; // Get SHA1 sum of data part - slow
- public $option_max_2gb_check = null; // Check whether file is larger than 2GB and thus not supported by 32-bit PHP (null: auto-detect based on PHP_INT_MAX)
-
- // public: Read buffer size in bytes
- public $option_fread_buffer_size = 32768;
-
- // Public variables
- public $filename; // Filename of file being analysed.
- public $fp; // Filepointer to file being analysed.
- public $info; // Result array.
-
- // Protected variables
- protected $startup_error = '';
- protected $startup_warning = '';
- protected $memory_limit = 0;
-
- const VERSION = '1.9.3-20111213';
- const FREAD_BUFFER_SIZE = 32768;
- var $tempdir = GETID3_TEMP_DIR;
-
- const ATTACHMENTS_NONE = false;
- const ATTACHMENTS_INLINE = true;
-
- // public: constructor
- public function __construct() {
-
- // Check for PHP version
- $required_php_version = '5.0.5';
- if (version_compare(PHP_VERSION, $required_php_version, '<')) {
- $this->startup_error .= 'getID3() requires PHP v'.$required_php_version.' or higher - you are running v'.PHP_VERSION;
- return false;
- }
-
- // Check memory
- $this->memory_limit = ini_get('memory_limit');
- if (preg_match('#([0-9]+)M#i', $this->memory_limit, $matches)) {
- // could be stored as "16M" rather than 16777216 for example
- $this->memory_limit = $matches[1] * 1048576;
- } elseif (preg_match('#([0-9]+)G#i', $this->memory_limit, $matches)) { // The 'G' modifier is available since PHP 5.1.0
- // could be stored as "2G" rather than 2147483648 for example
- $this->memory_limit = $matches[1] * 1073741824;
- }
- if ($this->memory_limit <= 0) {
- // memory limits probably disabled
- } elseif ($this->memory_limit <= 4194304) {
- $this->startup_error .= 'PHP has less than 4MB available memory and will very likely run out. Increase memory_limit in php.ini';
- } elseif ($this->memory_limit <= 12582912) {
- $this->startup_warning .= 'PHP has less than 12MB available memory and might run out if all modules are loaded. Increase memory_limit in php.ini';
- }
-
- // Check safe_mode off
- if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) {
- $this->warning('WARNING: Safe mode is on, shorten support disabled, md5data/sha1data for ogg vorbis disabled, ogg vorbos/flac tag writing disabled.');
- }
-
- if (intval(ini_get('mbstring.func_overload')) > 0) {
- $this->warning('WARNING: php.ini contains "mbstring.func_overload = '.ini_get('mbstring.func_overload').'", this may break things.');
- }
-
- // Check for magic_quotes_runtime
- if (function_exists('get_magic_quotes_runtime')) {
- if (get_magic_quotes_runtime()) {
- return $this->startup_error('magic_quotes_runtime must be disabled before running getID3(). Surround getid3 block by set_magic_quotes_runtime(0) and set_magic_quotes_runtime(1).');
- }
- }
-
- // Check for magic_quotes_gpc
- if (function_exists('magic_quotes_gpc')) {
- if (get_magic_quotes_gpc()) {
- return $this->startup_error('magic_quotes_gpc must be disabled before running getID3(). Surround getid3 block by set_magic_quotes_gpc(0) and set_magic_quotes_gpc(1).');
- }
- }
-
- // Load support library
- if (!include_once(GETID3_INCLUDEPATH.'getid3.lib.php')) {
- $this->startup_error .= 'getid3.lib.php is missing or corrupt';
- }
-
- if ($this->option_max_2gb_check === null) {
- $this->option_max_2gb_check = (PHP_INT_MAX <= 2147483647);
- }
-
-
- // Needed for Windows only:
- // Define locations of helper applications for Shorten, VorbisComment, MetaFLAC
- // as well as other helper functions such as head, tail, md5sum, etc
- // This path cannot contain spaces, but the below code will attempt to get the
- // 8.3-equivalent path automatically
- // IMPORTANT: This path must include the trailing slash
- if (GETID3_OS_ISWINDOWS && !defined('GETID3_HELPERAPPSDIR')) {
-
- $helperappsdir = GETID3_INCLUDEPATH.'..'.DIRECTORY_SEPARATOR.'helperapps'; // must not have any space in this path
-
- if (!is_dir($helperappsdir)) {
- $this->startup_warning .= '"'.$helperappsdir.'" cannot be defined as GETID3_HELPERAPPSDIR because it does not exist';
- } elseif (strpos(realpath($helperappsdir), ' ') !== false) {
- $DirPieces = explode(DIRECTORY_SEPARATOR, realpath($helperappsdir));
- $path_so_far = array();
- foreach ($DirPieces as $key => $value) {
- if (strpos($value, ' ') !== false) {
- if (!empty($path_so_far)) {
- $commandline = 'dir /x '.escapeshellarg(implode(DIRECTORY_SEPARATOR, $path_so_far));
- $dir_listing = `$commandline`;
- $lines = explode("\n", $dir_listing);
- foreach ($lines as $line) {
- $line = trim($line);
- if (preg_match('#^([0-9/]{10}) +([0-9:]{4,5}( [AP]M)?) +(<DIR>|[0-9,]+) +([^ ]{0,11}) +(.+)$#', $line, $matches)) {
- list($dummy, $date, $time, $ampm, $filesize, $shortname, $filename) = $matches;
- if ((strtoupper($filesize) == '<DIR>') && (strtolower($filename) == strtolower($value))) {
- $value = $shortname;
- }
- }
- }
- } else {
- $this->startup_warning .= 'GETID3_HELPERAPPSDIR must not have any spaces in it - use 8dot3 naming convention if neccesary. You can run "dir /x" from the commandline to see the correct 8.3-style names.';
- }
- }
- $path_so_far[] = $value;
- }
- $helperappsdir = implode(DIRECTORY_SEPARATOR, $path_so_far);
- }
- define('GETID3_HELPERAPPSDIR', $helperappsdir.DIRECTORY_SEPARATOR);
- }
-
- return true;
- }
-
- public function version() {
- return self::VERSION;
- }
-
- public function fread_buffer_size() {
- return $this->option_fread_buffer_size;
- }
-
-
- // public: setOption
- function setOption($optArray) {
- if (!is_array($optArray) || empty($optArray)) {
- return false;
- }
- foreach ($optArray as $opt => $val) {
- if (isset($this->$opt) === false) {
- continue;
- }
- $this->$opt = $val;
- }
- return true;
- }
-
-
- public function openfile($filename) {
- try {
- if (!empty($this->startup_error)) {
- throw new getid3_exception($this->startup_error);
- }
- if (!empty($this->startup_warning)) {
- $this->warning($this->startup_warning);
- }
-
- // init result array and set parameters
- $this->filename = $filename;
- $this->info = array();
- $this->info['GETID3_VERSION'] = $this->version();
- $this->info['php_memory_limit'] = $this->memory_limit;
-
- // remote files not supported
- if (preg_match('/^(ht|f)tp:\/\//', $filename)) {
- throw new getid3_exception('Remote files are not supported - please copy the file locally first');
- }
-
- $filename = str_replace('/', DIRECTORY_SEPARATOR, $filename);
- $filename = preg_replace('#(.+)'.preg_quote(DIRECTORY_SEPARATOR).'{2,}#U', '\1'.DIRECTORY_SEPARATOR, $filename);
-
- // open local file
- if (is_readable($filename) && is_file($filename) && ($this->fp = fopen($filename, 'rb'))) {
- // great
- } else {
- throw new getid3_exception('Could not open "'.$filename.'" (does not exist, or is not a file)');
- }
-
- $this->info['filesize'] = filesize($filename);
- // set redundant parameters - might be needed in some include file
- $this->info['filename'] = basename($filename);
- $this->info['filepath'] = str_replace('\\', '/', realpath(dirname($filename)));
- $this->info['filenamepath'] = $this->info['filepath'].'/'.$this->info['filename'];
-
-
- // option_max_2gb_check
- if ($this->option_max_2gb_check) {
- // PHP (32-bit all, and 64-bit Windows) doesn't support integers larger than 2^31 (~2GB)
- // filesize() simply returns (filesize % (pow(2, 32)), no matter the actual filesize
- // ftell() returns 0 if seeking to the end is beyond the range of unsigned integer
- $fseek = fseek($this->fp, 0, SEEK_END);
- if (($fseek < 0) || (($this->info['filesize'] != 0) && (ftell($this->fp) == 0)) ||
- ($this->info['filesize'] < 0) ||
- (ftell($this->fp) < 0)) {
- $real_filesize = false;
- if (GETID3_OS_ISWINDOWS) {
- $commandline = 'dir /-C "'.str_replace('/', DIRECTORY_SEPARATOR, $filename).'"';
- $dir_output = `$commandline`;
- if (preg_match('#1 File\(s\)[ ]+([0-9]+) bytes#i', $dir_output, $matches)) {
- $real_filesize = (float) $matches[1];
- }
- } else {
- $commandline = 'ls -o -g -G --time-style=long-iso '.escapeshellarg($filename);
- $dir_output = `$commandline`;
- if (preg_match('#([0-9]+) ([0-9]{4}-[0-9]{2}\-[0-9]{2} [0-9]{2}:[0-9]{2}) '.str_replace('#', '\\#', preg_quote($filename)).'$#', $dir_output, $matches)) {
- $real_filesize = (float) $matches[1];
- }
- }
- if ($real_filesize === false) {
- unset($this->info['filesize']);
- fclose($this->fp);
- throw new getid3_exception('Unable to determine actual filesize. File is most likely larger than '.round(PHP_INT_MAX / 1073741824).'GB and is not supported by PHP.');
- } elseif (getid3_lib::intValueSupported($real_filesize)) {
- unset($this->info['filesize']);
- fclose($this->fp);
- throw new getid3_exception('PHP seems to think the file is larger than '.round(PHP_INT_MAX / 1073741824).'GB, but filesystem reports it as '.number_format($real_filesize, 3).'GB, please report to info@getid3.org');
- }
- $this->info['filesize'] = $real_filesize;
- $this->error('File is larger than '.round(PHP_INT_MAX / 1073741824).'GB (filesystem reports it as '.number_format($real_filesize, 3).'GB) and is not properly supported by PHP.');
- }
- }
-
- // set more parameters
- $this->info['avdataoffset'] = 0;
- $this->info['avdataend'] = $this->info['filesize'];
- $this->info['fileformat'] = ''; // filled in later
- $this->info['audio']['dataformat'] = ''; // filled in later, unset if not used
- $this->info['video']['dataformat'] = ''; // filled in later, unset if not used
- $this->info['tags'] = array(); // filled in later, unset if not used
- $this->info['error'] = array(); // filled in later, unset if not used
- $this->info['warning'] = array(); // filled in later, unset if not used
- $this->info['comments'] = array(); // filled in later, unset if not used
- $this->info['encoding'] = $this->encoding; // required by id3v2 and iso modules - can be unset at the end if desired
-
- return true;
-
- } catch (Exception $e) {
- $this->error($e->getMessage());
- }
- return false;
- }
-
- // public: analyze file
- function analyze($filename) {
- try {
- if (!$this->openfile($filename)) {
- return $this->info;
- }
-
- // Handle tags
- foreach (array('id3v2'=>'id3v2', 'id3v1'=>'id3v1', 'apetag'=>'ape', 'lyrics3'=>'lyrics3') as $tag_name => $tag_key) {
- $option_tag = 'option_tag_'.$tag_name;
- if ($this->$option_tag) {
- $this->include_module('tag.'.$tag_name);
- try {
- $tag_class = 'getid3_'.$tag_name;
- $tag = new $tag_class($this);
- $tag->Analyze();
- }
- catch (getid3_exception $e) {
- throw $e;
- }
- }
- }
- if (isset($this->info['id3v2']['tag_offset_start'])) {
- $this->info['avdataoffset'] = max($this->info['avdataoffset'], $this->info['id3v2']['tag_offset_end']);
- }
- foreach (array('id3v1'=>'id3v1', 'apetag'=>'ape', 'lyrics3'=>'lyrics3') as $tag_name => $tag_key) {
- if (isset($this->info[$tag_key]['tag_offset_start'])) {
- $this->info['avdataend'] = min($this->info['avdataend'], $this->info[$tag_key]['tag_offset_start']);
- }
- }
-
- // ID3v2 detection (NOT parsing), even if ($this->option_tag_id3v2 == false) done to make fileformat easier
- if (!$this->option_tag_id3v2) {
- fseek($this->fp, 0, SEEK_SET);
- $header = fread($this->fp, 10);
- if ((substr($header, 0, 3) == 'ID3') && (strlen($header) == 10)) {
- $this->info['id3v2']['header'] = true;
- $this->info['id3v2']['majorversion'] = ord($header{3});
- $this->info['id3v2']['minorversion'] = ord($header{4});
- $this->info['avdataoffset'] += getid3_lib::BigEndian2Int(substr($header, 6, 4), 1) + 10; // length of ID3v2 tag in 10-byte header doesn't include 10-byte header length
- }
- }
-
- // read 32 kb file data
- fseek($this->fp, $this->info['avdataoffset'], SEEK_SET);
- $formattest = fread($this->fp, 32774);
-
- // determine format
- $determined_format = $this->GetFileFormat($formattest, $filename);
-
- // unable to determine file format
- if (!$determined_format) {
- fclose($this->fp);
- return $this->error('unable to determine file format');
- }
-
- // check for illegal ID3 tags
- if (isset($determined_format['fail_id3']) && (in_array('id3v1', $this->info['tags']) || in_array('id3v2', $this->info['tags']))) {
- if ($determined_format['fail_id3'] === 'ERROR') {
- fclose($this->fp);
- return $this->error('ID3 tags not allowed on this file type.');
- } elseif ($determined_format['fail_id3'] === 'WARNING') {
- $this->warning('ID3 tags not allowed on this file type.');
- }
- }
-
- // check for illegal APE tags
- if (isset($determined_format['fail_ape']) && in_array('ape', $this->info['tags'])) {
- if ($determined_format['fail_ape'] === 'ERROR') {
- fclose($this->fp);
- return $this->error('APE tags not allowed on this file type.');
- } elseif ($determined_format['fail_ape'] === 'WARNING') {
- $this->warning('APE tags not allowed on this file type.');
- }
- }
-
- // set mime type
- $this->info['mime_type'] = $determined_format['mime_type'];
-
- // supported format signature pattern detected, but module deleted
- if (!file_exists(GETID3_INCLUDEPATH.$determined_format['include'])) {
- fclose($this->fp);
- return $this->error('Format not supported, module "'.$determined_format['include'].'" was removed.');
- }
-
- // module requires iconv support
- // Check encoding/iconv support
- if (!empty($determined_format['iconv_req']) && !function_exists('iconv') && !in_array($this->encoding, array('ISO-8859-1', 'UTF-8', 'UTF-16LE', 'UTF-16BE', 'UTF-16'))) {
- $errormessage = 'iconv() support is required for this module ('.$determined_format['include'].') for encodings other than ISO-8859-1, UTF-8, UTF-16LE, UTF16-BE, UTF-16. ';
- if (GETID3_OS_ISWINDOWS) {
- $errormessage .= 'PHP does not have iconv() support. Please enable php_iconv.dll in php.ini, and copy iconv.dll from c:/php/dlls to c:/windows/system32';
- } else {
- $errormessage .= 'PHP is not compiled with iconv() support. Please recompile with the --with-iconv switch';
- }
- return $this->error($errormessage);
- }
-
- // include module
- include_once(GETID3_INCLUDEPATH.$determined_format['include']);
-
- // instantiate module class
- $class_name = 'getid3_'.$determined_format['module'];
- if (!class_exists($class_name)) {
- return $this->error('Format not supported, module "'.$determined_format['include'].'" is corrupt.');
- }
- //if (isset($determined_format['option'])) {
- // //$class = new $class_name($this->fp, $this->info, $determined_format['option']);
- //} else {
- //$class = new $class_name($this->fp, $this->info);
- $class = new $class_name($this);
- //}
-
- if (!empty($determined_format['set_inline_attachments'])) {
- $class->inline_attachments = $this->option_save_attachments;
- }
- $class->Analyze();
-
- unset($class);
-
- // close file
- fclose($this->fp);
-
- // process all tags - copy to 'tags' and convert charsets
- if ($this->option_tags_process) {
- $this->HandleAllTags();
- }
-
- // perform more calculations
- if ($this->option_extra_info) {
- $this->ChannelsBitratePlaytimeCalculations();
- $this->CalculateCompressionRatioVideo();
- $this->CalculateCompressionRatioAudio();
- $this->CalculateReplayGain();
- $this->ProcessAudioStreams();
- }
-
- // get the MD5 sum of the audio/video portion of the file - without ID3/APE/Lyrics3/etc header/footer tags
- if ($this->option_md5_data) {
- // do not cald md5_data if md5_data_source is present - set by flac only - future MPC/SV8 too
- if (!$this->option_md5_data_source || empty($this->info['md5_data_source'])) {
- $this->getHashdata('md5');
- }
- }
-
- // get the SHA1 sum of the audio/video portion of the file - without ID3/APE/Lyrics3/etc header/footer tags
- if ($this->option_sha1_data) {
- $this->getHashdata('sha1');
- }
-
- // remove undesired keys
- $this->CleanUp();
-
- } catch (Exception $e) {
- $this->error('Caught exception: '.$e->getMessage());
- }
-
- // return info array
- return $this->info;
- }
-
-
- // private: error handling
- function error($message) {
- $this->CleanUp();
- if (!isset($this->info['error'])) {
- $this->info['error'] = array();
- }
- $this->info['error'][] = $message;
- return $this->info;
- }
-
-
- // private: warning handling
- function warning($message) {
- $this->info['warning'][] = $message;
- return true;
- }
-
-
- // private: CleanUp
- function CleanUp() {
-
- // remove possible empty keys
- $AVpossibleEmptyKeys = array('dataformat', 'bits_per_sample', 'encoder_options', 'streams', 'bitrate');
- foreach ($AVpossibleEmptyKeys as $dummy => $key) {
- if (empty($this->info['audio'][$key]) && isset($this->info['audio'][$key])) {
- unset($this->info['audio'][$key]);
- }
- if (empty($this->info['video'][$key]) && isset($this->info['video'][$key])) {
- unset($this->info['video'][$key]);
- }
- }
-
- // remove empty root keys
- if (!empty($this->info)) {
- foreach ($this->info as $key => $value) {
- if (empty($this->info[$key]) && ($this->info[$key] !== 0) && ($this->info[$key] !== '0')) {
- unset($this->info[$key]);
- }
- }
- }
-
- // remove meaningless entries from unknown-format files
- if (empty($this->info['fileformat'])) {
- if (isset($this->info['avdataoffset'])) {
- unset($this->info['avdataoffset']);
- }
- if (isset($this->info['avdataend'])) {
- unset($this->info['avdataend']);
- }
- }
-
- // remove possible duplicated identical entries
- if (!empty($this->info['error'])) {
- $this->info['error'] = array_values(array_unique($this->info['error']));
- }
- if (!empty($this->info['warning'])) {
- $this->info['warning'] = array_values(array_unique($this->info['warning']));
- }
-
- // remove "global variable" type keys
- unset($this->info['php_memory_limit']);
-
- return true;
- }
-
-
- // return array containing information about all supported formats
- function GetFileFormatArray() {
- static $format_info = array();
- if (empty($format_info)) {
- $format_info = array(
-
- // Audio formats
-
- // AC-3 - audio - Dolby AC-3 / Dolby Digital
- 'ac3' => array(
- 'pattern' => '^\x0B\x77',
- 'group' => 'audio',
- 'module' => 'ac3',
- 'mime_type' => 'audio/ac3',
- ),
-
- // AAC - audio - Advanced Audio Coding (AAC) - ADIF format
- 'adif' => array(
- 'pattern' => '^ADIF',
- 'group' => 'audio',
- 'module' => 'aac',
- 'mime_type' => 'application/octet-stream',
- 'fail_ape' => 'WARNING',
- ),
-
-
- // AA - audio - Audible Audiobook
- 'adts' => array(
- 'pattern' => '^.{4}\x57\x90\x75\x36',
- 'group' => 'audio',
- 'module' => 'aa',
- 'mime_type' => 'audio/audible ',
- ),
-
- // AAC - audio - Advanced Audio Coding (AAC) - ADTS format (very similar to MP3)
- 'adts' => array(
- 'pattern' => '^\xFF[\xF0-\xF1\xF8-\xF9]',
- 'group' => 'audio',
- 'module' => 'aac',
- 'mime_type' => 'application/octet-stream',
- 'fail_ape' => 'WARNING',
- ),
-
-
- // AU - audio - NeXT/Sun AUdio (AU)
- 'au' => array(
- 'pattern' => '^\.snd',
- 'group' => 'audio',
- 'module' => 'au',
- 'mime_type' => 'audio/basic',
- ),
-
- // AVR - audio - Audio Visual Research
- 'avr' => array(
- 'pattern' => '^2BIT',
- 'group' => 'audio',
- 'module' => 'avr',
- 'mime_type' => 'application/octet-stream',
- ),
-
- // BONK - audio - Bonk v0.9+
- 'bonk' => array(
- 'pattern' => '^\x00(BONK|INFO|META| ID3)',
- 'group' => 'audio',
- 'module' => 'bonk',
- 'mime_type' => 'audio/xmms-bonk',
- ),
-
- // DSS - audio - Digital Speech Standard
- 'dss' => array(
- 'pattern' => '^[\x02-\x03]dss',
- 'group' => 'audio',
- 'module' => 'dss',
- 'mime_type' => 'application/octet-stream',
- ),
-
- // DTS - audio - Dolby Theatre System
- 'dts' => array(
- 'pattern' => '^\x7F\xFE\x80\x01',
- 'group' => 'audio',
- 'module' => 'dts',
- 'mime_type' => 'audio/dts',
- ),
-
- // FLAC - audio - Free Lossless Audio Codec
- 'flac' => array(
- 'pattern' => '^fLaC',
- 'group' => 'audio',
- 'module' => 'flac',
- 'mime_type' => 'audio/x-flac',
- 'set_inline_attachments' => true,
- ),
-
- // LA - audio - Lossless Audio (LA)
- 'la' => array(
- 'pattern' => '^LA0[2-4]',
- 'group' => 'audio',
- 'module' => 'la',
- 'mime_type' => 'application/octet-stream',
- ),
-
- // LPAC - audio - Lossless Predictive Audio Compression (LPAC)
- 'lpac' => array(
- 'pattern' => '^LPAC',
- 'group' => 'audio',
- 'module' => 'lpac',
- 'mime_type' => 'application/octet-stream',
- ),
-
- // MIDI - audio - MIDI (Musical Instrument Digital Interface)
- 'midi' => array(
- 'pattern' => '^MThd',
- 'group' => 'audio',
- 'module' => 'midi',
- 'mime_type' => 'audio/midi',
- ),
-
- // MAC - audio - Monkey's Audio Compressor
- 'mac' => array(
- 'pattern' => '^MAC ',
- 'group' => 'audio',
- 'module' => 'monkey',
- 'mime_type' => 'application/octet-stream',
- ),
-
-// has been known to produce false matches in random files (e.g. JPEGs), leave out until more precise matching available
-// // MOD - audio - MODule (assorted sub-formats)
-// 'mod' => array(
-// 'pattern' => '^.{1080}(M\\.K\\.|M!K!|FLT4|FLT8|[5-9]CHN|[1-3][0-9]CH)',
-// 'group' => 'audio',
-// 'module' => 'mod',
-// 'option' => 'mod',
-// 'mime_type' => 'audio/mod',
-// ),
-
- // MOD - audio - MODule (Impulse Tracker)
- 'it' => array(
- 'pattern' => '^IMPM',
- 'group' => 'audio',
- 'module' => 'mod',
- //'option' => 'it',
- 'mime_type' => 'audio/it',
- ),
-
- // MOD - audio - MODule (eXtended Module, various sub-formats)
- 'xm' => array(
- 'pattern' => '^Extended Module',
- 'group' => 'audio',
- 'module' => 'mod',
- //'option' => 'xm',
- 'mime_type' => 'audio/xm',
- ),
-
- // MOD - audio - MODule (ScreamTracker)
- 's3m' => array(
- 'pattern' => '^.{44}SCRM',
- 'group' => 'audio',
- 'module' => 'mod',
- //'option' => 's3m',
- 'mime_type' => 'audio/s3m',
- ),
-
- // MPC - audio - Musepack / MPEGplus
- 'mpc' => array(
- 'pattern' => '^(MPCK|MP\+|[\x00\x01\x10\x11\x40\x41\x50\x51\x80\x81\x90\x91\xC0\xC1\xD0\xD1][\x20-37][\x00\x20\x40\x60\x80\xA0\xC0\xE0])',
- 'group' => 'audio',
- 'module' => 'mpc',
- 'mime_type' => 'audio/x-musepack',
- ),
-
- // MP3 - audio - MPEG-audio Layer 3 (very similar to AAC-ADTS)
- 'mp3' => array(
- 'pattern' => '^\xFF[\xE2-\xE7\xF2-\xF7\xFA-\xFF][\x00-\x0B\x10-\x1B\x20-\x2B\x30-\x3B\x40-\x4B\x50-\x5B\x60-\x6B\x70-\x7B\x80-\x8B\x90-\x9B\xA0-\xAB\xB0-\xBB\xC0-\xCB\xD0-\xDB\xE0-\xEB\xF0-\xFB]',
- 'group' => 'audio',
- 'module' => 'mp3',
- 'mime_type' => 'audio/mpeg',
- ),
-
- // OFR - audio - OptimFROG
- 'ofr' => array(
- 'pattern' => '^(\*RIFF|OFR)',
- 'group' => 'audio',
- 'module' => 'optimfrog',
- 'mime_type' => 'application/octet-stream',
- ),
-
- // RKAU - audio - RKive AUdio compressor
- 'rkau' => array(
- 'pattern' => '^RKA',
- 'group' => 'audio',
- 'module' => 'rkau',
- 'mime_type' => 'application/octet-stream',
- ),
-
- // SHN - audio - Shorten
- 'shn' => array(
- 'pattern' => '^ajkg',
- 'group' => 'audio',
- 'module' => 'shorten',
- 'mime_type' => 'audio/xmms-shn',
- 'fail_id3' => 'ERROR',
- 'fail_ape' => 'ERROR',
- ),
-
- // TTA - audio - TTA Lossless Audio Compressor (http://tta.corecodec.org)
- 'tta' => array(
- 'pattern' => '^TTA', // could also be '^TTA(\x01|\x02|\x03|2|1)'
- 'group' => 'audio',
- 'module' => 'tta',
- 'mime_type' => 'application/octet-stream',
- ),
-
- // VOC - audio - Creative Voice (VOC)
- 'voc' => array(
- 'pattern' => '^Creative Voice File',
- 'group' => 'audio',
- 'module' => 'voc',
- 'mime_type' => 'audio/voc',
- ),
-
- // VQF - audio - transform-domain weighted interleave Vector Quantization Format (VQF)
- 'vqf' => array(
- 'pattern' => '^TWIN',
- 'group' => 'audio',
- 'module' => 'vqf',
- 'mime_type' => 'application/octet-stream',
- ),
-
- // WV - audio - WavPack (v4.0+)
- 'wv' => array(
- 'pattern' => '^wvpk',
- 'group' => 'audio',
- 'module' => 'wavpack',
- 'mime_type' => 'application/octet-stream',
- ),
-
-
- // Audio-Video formats
-
- // ASF - audio/video - Advanced Streaming Format, Windows Media Video, Windows Media Audio
- 'asf' => array(
- 'pattern' => '^\x30\x26\xB2\x75\x8E\x66\xCF\x11\xA6\xD9\x00\xAA\x00\x62\xCE\x6C',
- 'group' => 'audio-video',
- 'module' => 'asf',
- 'mime_type' => 'video/x-ms-asf',
- 'iconv_req' => false,
- ),
-
- // BINK - audio/video - Bink / Smacker
- 'bink' => array(
- 'pattern' => '^(BIK|SMK)',
- 'group' => 'audio-video',
- 'module' => 'bink',
- 'mime_type' => 'application/octet-stream',
- ),
-
- // FLV - audio/video - FLash Video
- 'flv' => array(
- 'pattern' => '^FLV\x01',
- 'group' => 'audio-video',
- 'module' => 'flv',
- 'mime_type' => 'video/x-flv',
- ),
-
- // MKAV - audio/video - Mastroka
- 'matroska' => array(
- 'pattern' => '^\x1A\x45\xDF\xA3',
- 'group' => 'audio-video',
- 'module' => 'matroska',
- 'mime_type' => 'video/x-matroska', // may also be audio/x-matroska
- 'set_inline_attachments' => true,
- ),
-
- // MPEG - audio/video - MPEG (Moving Pictures Experts Group)
- 'mpeg' => array(
- 'pattern' => '^\x00\x00\x01(\xBA|\xB3)',
- 'group' => 'audio-video',
- 'module' => 'mpeg',
- 'mime_type' => 'video/mpeg',
- ),
-
- // NSV - audio/video - Nullsoft Streaming Video (NSV)
- 'nsv' => array(
- 'pattern' => '^NSV[sf]',
- 'group' => 'audio-video',
- 'module' => 'nsv',
- 'mime_type' => 'application/octet-stream',
- ),
-
- // Ogg - audio/video - Ogg (Ogg-Vorbis, Ogg-FLAC, Speex, Ogg-Theora(*), Ogg-Tarkin(*))
- 'ogg' => array(
- 'pattern' => '^OggS',
- 'group' => 'audio',
- 'module' => 'ogg',
- 'mime_type' => 'application/ogg',
- 'fail_id3' => 'WARNING',
- 'fail_ape' => 'WARNING',
- 'set_inline_attachments' => true,
- ),
-
- // QT - audio/video - Quicktime
- 'quicktime' => array(
- 'pattern' => '^.{4}(cmov|free|ftyp|mdat|moov|pnot|skip|wide)',
- 'group' => 'audio-video',
- 'module' => 'quicktime',
- 'mime_type' => 'video/quicktime',
- ),
-
- // RIFF - audio/video - Resource Interchange File Format (RIFF) / WAV / AVI / CD-audio / SDSS = renamed variant used by SmartSound QuickTracks (www.smartsound.com) / FORM = Audio Interchange File Format (AIFF)
- 'riff' => array(
- 'pattern' => '^(RIFF|SDSS|FORM)',
- 'group' => 'audio-video',
- 'module' => 'riff',
- 'mime_type' => 'audio/x-wave',
- 'fail_ape' => 'WARNING',
- ),
-
- // Real - audio/video - RealAudio, RealVideo
- 'real' => array(
- 'pattern' => '^(\\.RMF|\\.ra)',
- 'group' => 'audio-video',
- 'module' => 'real',
- 'mime_type' => 'audio/x-realaudio',
- ),
-
- // SWF - audio/video - ShockWave Flash
- 'swf' => array(
- 'pattern' => '^(F|C)WS',
- 'group' => 'audio-video',
- 'module' => 'swf',
- 'mime_type' => 'application/x-shockwave-flash',
- ),
-
-
- // Still-Image formats
-
- // BMP - still image - Bitmap (Windows, OS/2; uncompressed, RLE8, RLE4)
- 'bmp' => array(
- 'pattern' => '^BM',
- 'group' => 'graphic',
- 'module' => 'bmp',
- 'mime_type' => 'image/bmp',
- 'fail_id3' => 'ERROR',
- 'fail_ape' => 'ERROR',
- ),
-
- // GIF - still image - Graphics Interchange Format
- 'gif' => array(
- 'pattern' => '^GIF',
- 'group' => 'graphic',
- 'module' => 'gif',
- 'mime_type' => 'image/gif',
- 'fail_id3' => 'ERROR',
- 'fail_ape' => 'ERROR',
- ),
-
- // JPEG - still image - Joint Photographic Experts Group (JPEG)
- 'jpg' => array(
- 'pattern' => '^\xFF\xD8\xFF',
- 'group' => 'graphic',
- 'module' => 'jpg',
- 'mime_type' => 'image/jpeg',
- 'fail_id3' => 'ERROR',
- 'fail_ape' => 'ERROR',
- ),
-
- // PCD - still image - Kodak Photo CD
- 'pcd' => array(
- 'pattern' => '^.{2048}PCD_IPI\x00',
- 'group' => 'graphic',
- 'module' => 'pcd',
- 'mime_type' => 'image/x-photo-cd',
- 'fail_id3' => 'ERROR',
- 'fail_ape' => 'ERROR',
- ),
-
-
- // PNG - still image - Portable Network Graphics (PNG)
- 'png' => array(
- 'pattern' => '^\x89\x50\x4E\x47\x0D\x0A\x1A\x0A',
- 'group' => 'graphic',
- 'module' => 'png',
- 'mime_type' => 'image/png',
- 'fail_id3' => 'ERROR',
- 'fail_ape' => 'ERROR',
- ),
-
-
- // SVG - still image - Scalable Vector Graphics (SVG)
- 'svg' => array(
- 'pattern' => '(<!DOCTYPE svg PUBLIC |xmlns="http:\/\/www\.w3\.org\/2000\/svg")',
- 'group' => 'graphic',
- 'module' => 'svg',
- 'mime_type' => 'image/svg+xml',
- 'fail_id3' => 'ERROR',
- 'fail_ape' => 'ERROR',
- ),
-
-
- // TIFF - still image - Tagged Information File Format (TIFF)
- 'tiff' => array(
- 'pattern' => '^(II\x2A\x00|MM\x00\x2A)',
- 'group' => 'graphic',
- 'module' => 'tiff',
- 'mime_type' => 'image/tiff',
- 'fail_id3' => 'ERROR',
- 'fail_ape' => 'ERROR',
- ),
-
-
- // EFAX - still image - eFax (TIFF derivative)
- 'bmp' => array(
- 'pattern' => '^\xDC\xFE',
- 'group' => 'graphic',
- 'module' => 'efax',
- 'mime_type' => 'image/efax',
- 'fail_id3' => 'ERROR',
- 'fail_ape' => 'ERROR',
- ),
-
-
- // Data formats
-
- // ISO - data - International Standards Organization (ISO) CD-ROM Image
- 'iso' => array(
- 'pattern' => '^.{32769}CD001',
- 'group' => 'misc',
- 'module' => 'iso',
- 'mime_type' => 'application/octet-stream',
- 'fail_id3' => 'ERROR',
- 'fail_ape' => 'ERROR',
- 'iconv_req' => false,
- ),
-
- // RAR - data - RAR compressed data
- 'rar' => array(
- 'pattern' => '^Rar\!',
- 'group' => 'archive',
- 'module' => 'rar',
- 'mime_type' => 'application/octet-stream',
- 'fail_id3' => 'ERROR',
- 'fail_ape' => 'ERROR',
- ),
-
- // SZIP - audio/data - SZIP compressed data
- 'szip' => array(
- 'pattern' => '^SZ\x0A\x04',
- 'group' => 'archive',
- 'module' => 'szip',
- 'mime_type' => 'application/octet-stream',
- 'fail_id3' => 'ERROR',
- 'fail_ape' => 'ERROR',
- ),
-
- // TAR - data - TAR compressed data
- 'tar' => array(
- 'pattern' => '^.{100}[0-9\x20]{7}\x00[0-9\x20]{7}\x00[0-9\x20]{7}\x00[0-9\x20\x00]{12}[0-9\x20\x00]{12}',
- 'group' => 'archive',
- 'module' => 'tar',
- 'mime_type' => 'application/x-tar',
- 'fail_id3' => 'ERROR',
- 'fail_ape' => 'ERROR',
- ),
-
- // GZIP - data - GZIP compressed data
- 'gz' => array(
- 'pattern' => '^\x1F\x8B\x08',
- 'group' => 'archive',
- 'module' => 'gzip',
- 'mime_type' => 'application/x-gzip',
- 'fail_id3' => 'ERROR',
- 'fail_ape' => 'ERROR',
- ),
-
- // ZIP - data - ZIP compressed data
- 'zip' => array(
- 'pattern' => '^PK\x03\x04',
- 'group' => 'archive',
- 'module' => 'zip',
- 'mime_type' => 'application/zip',
- 'fail_id3' => 'ERROR',
- 'fail_ape' => 'ERROR',
- ),
-
-
- // Misc other formats
-
- // PAR2 - data - Parity Volume Set Specification 2.0
- 'par2' => array (
- 'pattern' => '^PAR2\x00PKT',
- 'group' => 'misc',
- 'module' => 'par2',
- 'mime_type' => 'application/octet-stream',
- 'fail_id3' => 'ERROR',
- 'fail_ape' => 'ERROR',
- ),
-
- // PDF - data - Portable Document Format
- 'pdf' => array(
- 'pattern' => '^\x25PDF',
- 'group' => 'misc',
- 'module' => 'pdf',
- 'mime_type' => 'application/pdf',
- 'fail_id3' => 'ERROR',
- 'fail_ape' => 'ERROR',
- ),
-
- // MSOFFICE - data - ZIP compressed data
- 'msoffice' => array(
- 'pattern' => '^\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1', // D0CF11E == DOCFILE == Microsoft Office Document
- 'group' => 'misc',
- 'module' => 'msoffice',
- 'mime_type' => 'application/octet-stream',
- 'fail_id3' => 'ERROR',
- 'fail_ape' => 'ERROR',
- ),
-
- // CUE - data - CUEsheet (index to single-file disc images)
- 'cue' => array(
- 'pattern' => '', // empty pattern means cannot be automatically detected, will fall through all other formats and match based on filename and very basic file contents
- 'group' => 'misc',
- 'module' => 'cue',
- 'mime_type' => 'application/octet-stream',
- ),
-
- );
- }
-
- return $format_info;
- }
-
-
-
- function GetFileFormat(&$filedata, $filename='') {
- // this function will determine the format of a file based on usually
- // the first 2-4 bytes of the file (8 bytes for PNG, 16 bytes for JPG,
- // and in the case of ISO CD image, 6 bytes offset 32kb from the start
- // of the file).
-
- // Identify file format - loop through $format_info and detect with reg expr
- foreach ($this->GetFileFormatArray() as $format_name => $info) {
- // The /s switch on preg_match() forces preg_match() NOT to treat
- // newline (0x0A) characters as special chars but do a binary match
- if (!empty($info['pattern']) && preg_match('#'.$info['pattern'].'#s', $filedata)) {
- $info['include'] = 'module.'.$info['group'].'.'.$info['module'].'.php';
- return $info;
- }
- }
-
-
- if (preg_match('#\.mp[123a]$#i', $filename)) {
- // Too many mp3 encoders on the market put gabage in front of mpeg files
- // use assume format on these if format detection failed
- $GetFileFormatArray = $this->GetFileFormatArray();
- $info = $GetFileFormatArray['mp3'];
- $info['include'] = 'module.'.$info['group'].'.'.$info['module'].'.php';
- return $info;
- } elseif (preg_match('/\.cue$/i', $filename) && preg_match('#FILE "[^"]+" (BINARY|MOTOROLA|AIFF|WAVE|MP3)#', $filedata)) {
- // there's not really a useful consistent "magic" at the beginning of .cue files to identify them
- // so until I think of something better, just go by filename if all other format checks fail
- // and verify there's at least one instance of "TRACK xx AUDIO" in the file
- $GetFileFormatArray = $this->GetFileFormatArray();
- $info = $GetFileFormatArray['cue'];
- $info['include'] = 'module.'.$info['group'].'.'.$info['module'].'.php';
- return $info;
- }
-
- return false;
- }
-
-
- // converts array to $encoding charset from $this->encoding
- function CharConvert(&$array, $encoding) {
-
- // identical encoding - end here
- if ($encoding == $this->encoding) {
- return;
- }
-
- // loop thru array
- foreach ($array as $key => $value) {
-
- // go recursive
- if (is_array($value)) {
- $this->CharConvert($array[$key], $encoding);
- }
-
- // convert string
- elseif (is_string($value)) {
- $array[$key] = trim(getid3_lib::iconv_fallback($encoding, $this->encoding, $value));
- }
- }
- }
-
-
- function HandleAllTags() {
-
- // key name => array (tag name, character encoding)
- static $tags;
- if (empty($tags)) {
- $tags = array(
- 'asf' => array('asf' , 'UTF-16LE'),
- 'midi' => array('midi' , 'ISO-8859-1'),
- 'nsv' => array('nsv' , 'ISO-8859-1'),
- 'ogg' => array('vorbiscomment' , 'UTF-8'),
- 'png' => array('png' , 'UTF-8'),
- 'tiff' => array('tiff' , 'ISO-8859-1'),
- 'quicktime' => array('quicktime' , 'UTF-8'),
- 'real' => array('real' , 'ISO-8859-1'),
- 'vqf' => array('vqf' , 'ISO-8859-1'),
- 'zip' => array('zip' , 'ISO-8859-1'),
- 'riff' => array('riff' , 'ISO-8859-1'),
- 'lyrics3' => array('lyrics3' , 'ISO-8859-1'),
- 'id3v1' => array('id3v1' , $this->encoding_id3v1),
- 'id3v2' => array('id3v2' , 'UTF-8'), // not according to the specs (every frame can have a different encoding), but getID3() force-converts all encodings to UTF-8
- 'ape' => array('ape' , 'UTF-8'),
- 'cue' => array('cue' , 'ISO-8859-1'),
- 'matroska' => array('matroska' , 'UTF-8'),
- );
- }
-
- // loop through comments array
- foreach ($tags as $comment_name => $tagname_encoding_array) {
- list($tag_name, $encoding) = $tagname_encoding_array;
-
- // fill in default encoding type if not already present
- if (isset($this->info[$comment_name]) && !isset($this->info[$comment_name]['encoding'])) {
- $this->info[$comment_name]['encoding'] = $encoding;
- }
-
- // copy comments if key name set
- if (!empty($this->info[$comment_name]['comments'])) {
-
- foreach ($this->info[$comment_name]['comments'] as $tag_key => $valuearray) {
- foreach ($valuearray as $key => $value) {
- if (is_string($value)) {
- $value = trim($value, " \r\n\t"); // do not trim nulls from $value!! Unicode characters will get mangled if trailing nulls are removed!
- }
- if ($value) {
- $this->info['tags'][trim($tag_name)][trim($tag_key)][] = $value;
- }
- }
- }
-
- if (!isset($this->info['tags'][$tag_name])) {
- // comments are set but contain nothing but empty strings, so skip
- continue;
- }
-
- if ($this->option_tags_html) {
- foreach ($this->info['tags'][$tag_name] as $tag_key => $valuearray) {
- foreach ($valuearray as $key => $value) {
- if (is_string($value)) {
- //$this->info['tags_html'][$tag_name][$tag_key][$key] = getid3_lib::MultiByteCharString2HTML($value, $encoding);
- $this->info['tags_html'][$tag_name][$tag_key][$key] = str_replace('&#0;', '', trim(getid3_lib::MultiByteCharString2HTML($value, $encoding)));
- } else {
- $this->info['tags_html'][$tag_name][$tag_key][$key] = $value;
- }
- }
- }
- }
-
- $this->CharConvert($this->info['tags'][$tag_name], $encoding); // only copy gets converted!
- }
-
- }
-
- // pictures can take up a lot of space, and we don't need multiple copies of them
- // let there be a single copy in [comments][picture], and not elsewhere
- if (!empty($this->info['tags'])) {
- $unset_keys = array('tags', 'tags_html');
- foreach ($this->info['tags'] as $tagtype => $tagarray) {
- foreach ($tagarray as $tagname => $tagdata) {
- if ($tagname == 'picture') {
- foreach ($tagdata as $key => $tagarray) {
- $this->info['comments']['picture'][] = $tagarray;
- if (isset($tagarray['data']) && isset($tagarray['image_mime'])) {
- if (isset($this->info['tags'][$tagtype][$tagname][$key])) {
- unset($this->info['tags'][$tagtype][$tagname][$key]);
- }
- if (isset($this->info['tags_html'][$tagtype][$tagname][$key])) {
- unset($this->info['tags_html'][$tagtype][$tagname][$key]);
- }
- }
- }
- }
- }
- foreach ($unset_keys as $unset_key) {
- // remove possible empty keys from (e.g. [tags][id3v2][picture])
- if (empty($this->info[$unset_key][$tagtype]['picture'])) {
- unset($this->info[$unset_key][$tagtype]['picture']);
- }
- if (empty($this->info[$unset_key][$tagtype])) {
- unset($this->info[$unset_key][$tagtype]);
- }
- if (empty($this->info[$unset_key])) {
- unset($this->info[$unset_key]);
- }
- }
- // remove duplicate copy of picture data from (e.g. [id3v2][comments][picture])
- if (isset($this->info[$tagtype]['comments']['picture'])) {
- unset($this->info[$tagtype]['comments']['picture']);
- }
- if (empty($this->info[$tagtype]['comments'])) {
- unset($this->info[$tagtype]['comments']);
- }
- if (empty($this->info[$tagtype])) {
- unset($this->info[$tagtype]);
- }
- }
- }
- return true;
- }
-
-
- function getHashdata($algorithm) {
- switch ($algorithm) {
- case 'md5':
- case 'sha1':
- break;
-
- default:
- return $this->error('bad algorithm "'.$algorithm.'" in getHashdata()');
- break;
- }
-
- if (!empty($this->info['fileformat']) && !empty($this->info['dataformat']) && ($this->info['fileformat'] == 'ogg') && ($this->info['audio']['dataformat'] == 'vorbis')) {
-
- // We cannot get an identical md5_data value for Ogg files where the comments
- // span more than 1 Ogg page (compared to the same audio data with smaller
- // comments) using the normal getID3() method of MD5'ing the data between the
- // end of the comments and the end of the file (minus any trailing tags),
- // because the page sequence numbers of the pages that the audio data is on
- // do not match. Under normal circumstances, where comments are smaller than
- // the nominal 4-8kB page size, then this is not a problem, but if there are
- // very large comments, the only way around it is to strip off the comment
- // tags with vorbiscomment and MD5 that file.
- // This procedure must be applied to ALL Ogg files, not just the ones with
- // comments larger than 1 page, because the below method simply MD5's the
- // whole file with the comments stripped, not just the portion after the
- // comments block (which is the standard getID3() method.
-
- // The above-mentioned problem of comments spanning multiple pages and changing
- // page sequence numbers likely happens for OggSpeex and OggFLAC as well, but
- // currently vorbiscomment only works on OggVorbis files.
-
- if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) {
-
- $this->warning('Failed making system call to vorbiscomment.exe - '.$algorithm.'_data is incorrect - error returned: PHP running in Safe Mode (backtick operator not available)');
- $this->info[$algorithm.'_data'] = false;
-
- } else {
-
- // Prevent user from aborting script
- $old_abort = ignore_user_abort(true);
-
- // Create empty file
- $empty = tempnam(GETID3_TEMP_DIR, 'getID3');
- touch($empty);
-
- // Use vorbiscomment to make temp file without comments
- $temp = tempnam(GETID3_TEMP_DIR, 'getID3');
- $file = $this->info['filenamepath'];
-
- if (GETID3_OS_ISWINDOWS) {
-
- if (file_exists(GETID3_HELPERAPPSDIR.'vorbiscomment.exe')) {
-
- $commandline = '"'.GETID3_HELPERAPPSDIR.'vorbiscomment.exe" -w -c "'.$empty.'" "'.$file.'" "'.$temp.'"';
- $VorbisCommentError = `$commandline`;
-
- } else {
-
- $VorbisCommentError = 'vorbiscomment.exe not found in '.GETID3_HELPERAPPSDIR;
-
- }
-
- } else {
-
- $commandline = 'vorbiscomment -w -c "'.$empty.'" "'.$file.'" "'.$temp.'" 2>&1';
- $commandline = 'vorbiscomment -w -c '.escapeshellarg($empty).' '.escapeshellarg($file).' '.escapeshellarg($temp).' 2>&1';
- $VorbisCommentError = `$commandline`;
-
- }
-
- if (!empty($VorbisCommentError)) {
-
- $this->info['warning'][] = 'Failed making system call to vorbiscomment(.exe) - '.$algorithm.'_data will be incorrect. If vorbiscomment is unavailable, please download from http://www.vorbis.com/download.psp and put in the getID3() directory. Error returned: '.$VorbisCommentError;
- $this->info[$algorithm.'_data'] = false;
-
- } else {
-
- // Get hash of newly created file
- switch ($algorithm) {
- case 'md5':
- $this->info[$algorithm.'_data'] = md5_file($temp);
- break;
-
- case 'sha1':
- $this->info[$algorithm.'_data'] = sha1_file($temp);
- break;
- }
- }
-
- // Clean up
- unlink($empty);
- unlink($temp);
-
- // Reset abort setting
- ignore_user_abort($old_abort);
-
- }
-
- } else {
-
- if (!empty($this->info['avdataoffset']) || (isset($this->info['avdataend']) && ($this->info['avdataend'] < $this->info['filesize']))) {
-
- // get hash from part of file
- $this->info[$algorithm.'_data'] = getid3_lib::hash_data($this->info['filenamepath'], $this->info['avdataoffset'], $this->info['avdataend'], $algorithm);
-
- } else {
-
- // get hash from whole file
- switch ($algorithm) {
- case 'md5':
- $this->info[$algorithm.'_data'] = md5_file($this->info['filenamepath']);
- break;
-
- case 'sha1':
- $this->info[$algorithm.'_data'] = sha1_file($this->info['filenamepath']);
- break;
- }
- }
-
- }
- return true;
- }
-
-
- function ChannelsBitratePlaytimeCalculations() {
-
- // set channelmode on audio
- if (!empty($this->info['audio']['channelmode']) || !isset($this->info['audio']['channels'])) {
- // ignore
- } elseif ($this->info['audio']['channels'] == 1) {
- $this->info['audio']['channelmode'] = 'mono';
- } elseif ($this->info['audio']['channels'] == 2) {
- $this->info['audio']['channelmode'] = 'stereo';
- }
-
- // Calculate combined bitrate - audio + video
- $CombinedBitrate = 0;
- $CombinedBitrate += (isset($this->info['audio']['bitrate']) ? $this->info['audio']['bitrate'] : 0);
- $CombinedBitrate += (isset($this->info['video']['bitrate']) ? $this->info['video']['bitrate'] : 0);
- if (($CombinedBitrate > 0) && empty($this->info['bitrate'])) {
- $this->info['bitrate'] = $CombinedBitrate;
- }
- //if ((isset($this->info['video']) && !isset($this->info['video']['bitrate'])) || (isset($this->info['audio']) && !isset($this->info['audio']['bitrate']))) {
- // // for example, VBR MPEG video files cannot determine video bitrate:
- // // should not set overall bitrate and playtime from audio bitrate only
- // unset($this->info['bitrate']);
- //}
-
- // video bitrate undetermined, but calculable
- if (isset($this->info['video']['dataformat']) && $this->info['video']['dataformat'] && (!isset($this->info['video']['bitrate']) || ($this->info['video']['bitrate'] == 0))) {
- // if video bitrate not set
- if (isset($this->info['audio']['bitrate']) && ($this->info['audio']['bitrate'] > 0) && ($this->info['audio']['bitrate'] == $this->info['bitrate'])) {
- // AND if audio bitrate is set to same as overall bitrate
- if (isset($this->info['playtime_seconds']) && ($this->info['playtime_seconds'] > 0)) {
- // AND if playtime is set
- if (isset($this->info['avdataend']) && isset($this->info['avdataoffset'])) {
- // AND if AV data offset start/end is known
- // THEN we can calculate the video bitrate
- $this->info['bitrate'] = round((($this->info['avdataend'] - $this->info['avdataoffset']) * 8) / $this->info['playtime_seconds']);
- $this->info['video']['bitrate'] = $this->info['bitrate'] - $this->info['audio']['bitrate'];
- }
- }
- }
- }
-
- if ((!isset($this->info['playtime_seconds']) || ($this->info['playtime_seconds'] <= 0)) && !empty($this->info['bitrate'])) {
- $this->info['playtime_seconds'] = (($this->info['avdataend'] - $this->info['avdataoffset']) * 8) / $this->info['bitrate'];
- }
-
- if (!isset($this->info['bitrate']) && !empty($this->info['playtime_seconds'])) {
- $this->info['bitrate'] = (($this->info['avdataend'] - $this->info['avdataoffset']) * 8) / $this->info['playtime_seconds'];
- }
- if (isset($this->info['bitrate']) && empty($this->info['audio']['bitrate']) && empty($this->info['video']['bitrate'])) {
- if (isset($this->info['audio']['dataformat']) && empty($this->info['video']['resolution_x'])) {
- // audio only
- $this->info['audio']['bitrate'] = $this->info['bitrate'];
- } elseif (isset($this->info['video']['resolution_x']) && empty($this->info['audio']['dataformat'])) {
- // video only
- $this->info['video']['bitrate'] = $this->info['bitrate'];
- }
- }
-
- // Set playtime string
- if (!empty($this->info['playtime_seconds']) && empty($this->info['playtime_string'])) {
- $this->info['playtime_string'] = getid3_lib::PlaytimeString($this->info['playtime_seconds']);
- }
- }
-
-
- function CalculateCompressionRatioVideo() {
- if (empty($this->info['video'])) {
- return false;
- }
- if (empty($this->info['video']['resolution_x']) || empty($this->info['video']['resolution_y'])) {
- return false;
- }
- if (empty($this->info['video']['bits_per_sample'])) {
- return false;
- }
-
- switch ($this->info['video']['dataformat']) {
- case 'bmp':
- case 'gif':
- case 'jpeg':
- case 'jpg':
- case 'png':
- case 'tiff':
- $FrameRate = 1;
- $PlaytimeSeconds = 1;
- $BitrateCompressed = $this->info['filesize'] * 8;
- break;
-
- default:
- if (!empty($this->info['video']['frame_rate'])) {
- $FrameRate = $this->info['video']['frame_rate'];
- } else {
- return false;
- }
- if (!empty($this->info['playtime_seconds'])) {
- $PlaytimeSeconds = $this->info['playtime_seconds'];
- } else {
- return false;
- }
- if (!empty($this->info['video']['bitrate'])) {
- $BitrateCompressed = $this->info['video']['bitrate'];
- } else {
- return false;
- }
- break;
- }
- $BitrateUncompressed = $this->info['video']['resolution_x'] * $this->info['video']['resolution_y'] * $this->info['video']['bits_per_sample'] * $FrameRate;
-
- $this->info['video']['compression_ratio'] = $BitrateCompressed / $BitrateUncompressed;
- return true;
- }
-
-
- function CalculateCompressionRatioAudio() {
- if (empty($this->info['audio']['bitrate']) || empty($this->info['audio']['channels']) || empty($this->info['audio']['sample_rate'])) {
- return false;
- }
- $this->info['audio']['compression_ratio'] = $this->info['audio']['bitrate'] / ($this->info['audio']['channels'] * $this->info['audio']['sample_rate'] * (!empty($this->info['audio']['bits_per_sample']) ? $this->info['audio']['bits_per_sample'] : 16));
-
- if (!empty($this->info['audio']['streams'])) {
- foreach ($this->info['audio']['streams'] as $streamnumber => $streamdata) {
- if (!empty($streamdata['bitrate']) && !empty($streamdata['channels']) && !empty($streamdata['sample_rate'])) {
- $this->info['audio']['streams'][$streamnumber]['compression_ratio'] = $streamdata['bitrate'] / ($streamdata['channels'] * $streamdata['sample_rate'] * (!empty($streamdata['bits_per_sample']) ? $streamdata['bits_per_sample'] : 16));
- }
- }
- }
- return true;
- }
-
-
- function CalculateReplayGain() {
- if (isset($this->info['replay_gain'])) {
- if (!isset($this->info['replay_gain']['reference_volume'])) {
- $this->info['replay_gain']['reference_volume'] = (double) 89.0;
- }
- if (isset($this->info['replay_gain']['track']['adjustment'])) {
- $this->info['replay_gain']['track']['volume'] = $this->info['replay_gain']['reference_volume'] - $this->info['replay_gain']['track']['adjustment'];
- }
- if (isset($this->info['replay_gain']['album']['adjustment'])) {
- $this->info['replay_gain']['album']['volume'] = $this->info['replay_gain']['reference_volume'] - $this->info['replay_gain']['album']['adjustment'];
- }
-
- if (isset($this->info['replay_gain']['track']['peak'])) {
- $this->info['replay_gain']['track']['max_noclip_gain'] = 0 - getid3_lib::RGADamplitude2dB($this->info['replay_gain']['track']['peak']);
- }
- if (isset($this->info['replay_gain']['album']['peak'])) {
- $this->info['replay_gain']['album']['max_noclip_gain'] = 0 - getid3_lib::RGADamplitude2dB($this->info['replay_gain']['album']['peak']);
- }
- }
- return true;
- }
-
- function ProcessAudioStreams() {
- if (!empty($this->info['audio']['bitrate']) || !empty($this->info['audio']['channels']) || !empty($this->info['audio']['sample_rate'])) {
- if (!isset($this->info['audio']['streams'])) {
- foreach ($this->info['audio'] as $key => $value) {
- if ($key != 'streams') {
- $this->info['audio']['streams'][0][$key] = $value;
- }
- }
- }
- }
- return true;
- }
-
- function getid3_tempnam() {
- return tempnam($this->tempdir, 'gI3');
- }
-
-
- public function saveAttachment(&$ThisFileInfoIndex, $filename, $offset, $length) {
- try {
- if (!getid3_lib::intValueSupported($offset + $length)) {
- throw new Exception('cannot extract attachment, it extends beyond the '.round(PHP_INT_MAX / 1073741824).'GB limit');
- }
-
- // do not extract at all
- if ($this->option_save_attachments === getID3::ATTACHMENTS_NONE) {
-
- unset($ThisFileInfoIndex); // do not set any
-
- // extract to return array
- } elseif ($this->option_save_attachments === getID3::ATTACHMENTS_INLINE) {
-
- // get whole data in one pass, till it is anyway stored in memory
- $ThisFileInfoIndex = file_get_contents($this->info['filenamepath'], false, null, $offset, $length);
- if (($ThisFileInfoIndex === false) || (strlen($ThisFileInfoIndex) != $length)) { // verify
- throw new Exception('failed to read attachment data');
- }
-
- // assume directory path is given
- } else {
-
- $dir = rtrim(str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $this->option_save_attachments), DIRECTORY_SEPARATOR);
- // check supplied directory
- if (!is_dir($dir) || !is_writable($dir)) {
- throw new Exception('getID3::saveAttachment() -- supplied path ('.$dir.') does not exist, or is not writable');
- }
-
- // set up destination path
- $dest = $dir.DIRECTORY_SEPARATOR.$filename;
-
- // optimize speed if read buffer size is configured to be large enough
- // here stream_copy_to_stream() may also be used. need to do speed-compare tests
- if ($length <= $this->fread_buffer_size()) {
- $data = file_get_contents($this->info['filenamepath'], false, null, $offset, $length);
- if (($data === false) || (strlen($data) != $length)) { // verify
- throw new Exception('failed to read attachment data');
- }
- if (!file_put_contents($dest, $data)) {
- throw new Exception('failed to create file '.$dest);
- }
- } else {
- // optimization not available - copy data in loop
- // here stream_copy_to_stream() shouldn't be used because it's internal read buffer may be larger than ours!
- getid3_lib::CopyFileParts($this->info['filenamepath'], $dest, $offset, $length);
- }
- $ThisFileInfoIndex = $dest;
- }
-
- } catch (Exception $e) {
-
- unset($ThisFileInfoIndex); // do not set any is case of error
- $this->warning('Failed to extract attachment '.$filename.': '.$e->getMessage());
- return false;
-
- }
- return true;
- }
-
-
- public function include_module($name) {
- //if (!file_exists($this->include_path.'module.'.$name.'.php')) {
- if (!file_exists(GETID3_INCLUDEPATH.'module.'.$name.'.php')) {
- throw new getid3_exception('Required module.'.$name.'.php is missing.');
- }
- include_once(GETID3_INCLUDEPATH.'module.'.$name.'.php');
- return true;
- }
-
-}
-
-
-abstract class getid3_handler
-{
- protected $getid3; // pointer
-
- protected $data_string_flag = false; // analyzing filepointer or string
- protected $data_string; // string to analyze
- protected $data_string_position = 0; // seek position in string
-
-
- public function __construct(getID3 $getid3) {
- $this->getid3 = $getid3;
- }
-
-
- // Analyze from file pointer
- abstract public function Analyze();
-
-
- // Analyze from string instead
- public function AnalyzeString(&$string) {
- // Enter string mode
- $this->data_string_flag = true;
- $this->data_string = $string;
-
- // Save info
- $saved_avdataoffset = $this->getid3->info['avdataoffset'];
- $saved_avdataend = $this->getid3->info['avdataend'];
- $saved_filesize = $this->getid3->info['filesize'];
-
- // Reset some info
- $this->getid3->info['avdataoffset'] = 0;
- $this->getid3->info['avdataend'] = $this->getid3->info['filesize'] = strlen($string);
-
- // Analyze
- $this->Analyze();
-
- // Restore some info
- $this->getid3->info['avdataoffset'] = $saved_avdataoffset;
- $this->getid3->info['avdataend'] = $saved_avdataend;
- $this->getid3->info['filesize'] = $saved_filesize;
-
- // Exit string mode
- $this->data_string_flag = false;
- }
-
-
- protected function ftell() {
- if ($this->data_string_flag) {
- return $this->data_string_position;
- }
- return ftell($this->getid3->fp);
- }
-
-
- protected function fread($bytes) {
- if ($this->data_string_flag) {
- $this->data_string_position += $bytes;
- return substr($this->data_string, $this->data_string_position - $bytes, $bytes);
- }
- return fread($this->getid3->fp, $bytes);
- }
-
-
- protected function fseek($bytes, $whence = SEEK_SET) {
- if ($this->data_string_flag) {
- switch ($whence) {
- case SEEK_SET:
- $this->data_string_position = $bytes;
- return;
-
- case SEEK_CUR:
- $this->data_string_position += $bytes;
- return;
-
- case SEEK_END:
- $this->data_string_position = strlen($this->data_string) + $bytes;
- return;
- }
- }
- return fseek($this->getid3->fp, $bytes, $whence);
- }
-
-}
-
-
-class getid3_exception extends Exception
-{
- public $message;
-}
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/license.txt b/3rdparty/getid3/license.txt
deleted file mode 100644
index 9fec8082904..00000000000
--- a/3rdparty/getid3/license.txt
+++ /dev/null
@@ -1,340 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) year name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
-Public License instead of this License.
diff --git a/3rdparty/getid3/module.archive.gzip.php b/3rdparty/getid3/module.archive.gzip.php
deleted file mode 100644
index c30052eda40..00000000000
--- a/3rdparty/getid3/module.archive.gzip.php
+++ /dev/null
@@ -1,280 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.archive.gzip.php //
-// module for analyzing GZIP files //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-// //
-// Module originally written by //
-// Mike Mozolin <teddybearmail*ru> //
-// //
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_gzip extends getid3_handler {
-
- // public: Optional file list - disable for speed.
- var $option_gzip_parse_contents = false; // decode gzipped files, if possible, and parse recursively (.tar.gz for example)
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- $info['fileformat'] = 'gzip';
-
- $start_length = 10;
- $unpack_header = 'a1id1/a1id2/a1cmethod/a1flags/a4mtime/a1xflags/a1os';
- //+---+---+---+---+---+---+---+---+---+---+
- //|ID1|ID2|CM |FLG| MTIME |XFL|OS |
- //+---+---+---+---+---+---+---+---+---+---+
-
- if ($info['filesize'] > $info['php_memory_limit']) {
- $info['error'][] = 'File is too large ('.number_format($info['filesize']).' bytes) to read into memory (limit: '.number_format($info['php_memory_limit'] / 1048576).'MB)';
- return false;
- }
- fseek($this->getid3->fp, 0);
- $buffer = fread($this->getid3->fp, $info['filesize']);
-
- $arr_members = explode("\x1F\x8B\x08", $buffer);
- while (true) {
- $is_wrong_members = false;
- $num_members = intval(count($arr_members));
- for ($i = 0; $i < $num_members; $i++) {
- if (strlen($arr_members[$i]) == 0) {
- continue;
- }
- $buf = "\x1F\x8B\x08".$arr_members[$i];
-
- $attr = unpack($unpack_header, substr($buf, 0, $start_length));
- if (!$this->get_os_type(ord($attr['os']))) {
- // Merge member with previous if wrong OS type
- $arr_members[$i - 1] .= $buf;
- $arr_members[$i] = '';
- $is_wrong_members = true;
- continue;
- }
- }
- if (!$is_wrong_members) {
- break;
- }
- }
-
- $info['gzip']['files'] = array();
-
- $fpointer = 0;
- $idx = 0;
- for ($i = 0; $i < $num_members; $i++) {
- if (strlen($arr_members[$i]) == 0) {
- continue;
- }
- $thisInfo = &$info['gzip']['member_header'][++$idx];
-
- $buff = "\x1F\x8B\x08".$arr_members[$i];
-
- $attr = unpack($unpack_header, substr($buff, 0, $start_length));
- $thisInfo['filemtime'] = getid3_lib::LittleEndian2Int($attr['mtime']);
- $thisInfo['raw']['id1'] = ord($attr['cmethod']);
- $thisInfo['raw']['id2'] = ord($attr['cmethod']);
- $thisInfo['raw']['cmethod'] = ord($attr['cmethod']);
- $thisInfo['raw']['os'] = ord($attr['os']);
- $thisInfo['raw']['xflags'] = ord($attr['xflags']);
- $thisInfo['raw']['flags'] = ord($attr['flags']);
-
- $thisInfo['flags']['crc16'] = (bool) ($thisInfo['raw']['flags'] & 0x02);
- $thisInfo['flags']['extra'] = (bool) ($thisInfo['raw']['flags'] & 0x04);
- $thisInfo['flags']['filename'] = (bool) ($thisInfo['raw']['flags'] & 0x08);
- $thisInfo['flags']['comment'] = (bool) ($thisInfo['raw']['flags'] & 0x10);
-
- $thisInfo['compression'] = $this->get_xflag_type($thisInfo['raw']['xflags']);
-
- $thisInfo['os'] = $this->get_os_type($thisInfo['raw']['os']);
- if (!$thisInfo['os']) {
- $info['error'][] = 'Read error on gzip file';
- return false;
- }
-
- $fpointer = 10;
- $arr_xsubfield = array();
- // bit 2 - FLG.FEXTRA
- //+---+---+=================================+
- //| XLEN |...XLEN bytes of "extra field"...|
- //+---+---+=================================+
- if ($thisInfo['flags']['extra']) {
- $w_xlen = substr($buff, $fpointer, 2);
- $xlen = getid3_lib::LittleEndian2Int($w_xlen);
- $fpointer += 2;
-
- $thisInfo['raw']['xfield'] = substr($buff, $fpointer, $xlen);
- // Extra SubFields
- //+---+---+---+---+==================================+
- //|SI1|SI2| LEN |... LEN bytes of subfield data ...|
- //+---+---+---+---+==================================+
- $idx = 0;
- while (true) {
- if ($idx >= $xlen) {
- break;
- }
- $si1 = ord(substr($buff, $fpointer + $idx++, 1));
- $si2 = ord(substr($buff, $fpointer + $idx++, 1));
- if (($si1 == 0x41) && ($si2 == 0x70)) {
- $w_xsublen = substr($buff, $fpointer + $idx, 2);
- $xsublen = getid3_lib::LittleEndian2Int($w_xsublen);
- $idx += 2;
- $arr_xsubfield[] = substr($buff, $fpointer + $idx, $xsublen);
- $idx += $xsublen;
- } else {
- break;
- }
- }
- $fpointer += $xlen;
- }
- // bit 3 - FLG.FNAME
- //+=========================================+
- //|...original file name, zero-terminated...|
- //+=========================================+
- // GZIP files may have only one file, with no filename, so assume original filename is current filename without .gz
- $thisInfo['filename'] = preg_replace('#\.gz$#i', '', $info['filename']);
- if ($thisInfo['flags']['filename']) {
- while (true) {
- if (ord($buff[$fpointer]) == 0) {
- $fpointer++;
- break;
- }
- $thisInfo['filename'] .= $buff[$fpointer];
- $fpointer++;
- }
- }
- // bit 4 - FLG.FCOMMENT
- //+===================================+
- //|...file comment, zero-terminated...|
- //+===================================+
- if ($thisInfo['flags']['comment']) {
- while (true) {
- if (ord($buff[$fpointer]) == 0) {
- $fpointer++;
- break;
- }
- $thisInfo['comment'] .= $buff[$fpointer];
- $fpointer++;
- }
- }
- // bit 1 - FLG.FHCRC
- //+---+---+
- //| CRC16 |
- //+---+---+
- if ($thisInfo['flags']['crc16']) {
- $w_crc = substr($buff, $fpointer, 2);
- $thisInfo['crc16'] = getid3_lib::LittleEndian2Int($w_crc);
- $fpointer += 2;
- }
- // bit 0 - FLG.FTEXT
- //if ($thisInfo['raw']['flags'] & 0x01) {
- // Ignored...
- //}
- // bits 5, 6, 7 - reserved
-
- $thisInfo['crc32'] = getid3_lib::LittleEndian2Int(substr($buff, strlen($buff) - 8, 4));
- $thisInfo['filesize'] = getid3_lib::LittleEndian2Int(substr($buff, strlen($buff) - 4));
-
- $info['gzip']['files'] = getid3_lib::array_merge_clobber($info['gzip']['files'], getid3_lib::CreateDeepArray($thisInfo['filename'], '/', $thisInfo['filesize']));
-
- if ($this->option_gzip_parse_contents) {
- // Try to inflate GZip
- $csize = 0;
- $inflated = '';
- $chkcrc32 = '';
- if (function_exists('gzinflate')) {
- $cdata = substr($buff, $fpointer);
- $cdata = substr($cdata, 0, strlen($cdata) - 8);
- $csize = strlen($cdata);
- $inflated = gzinflate($cdata);
-
- // Calculate CRC32 for inflated content
- $thisInfo['crc32_valid'] = (bool) (sprintf('%u', crc32($inflated)) == $thisInfo['crc32']);
-
- // determine format
- $formattest = substr($inflated, 0, 32774);
- $getid3_temp = new getID3();
- $determined_format = $getid3_temp->GetFileFormat($formattest);
- unset($getid3_temp);
-
- // file format is determined
- $determined_format['module'] = (isset($determined_format['module']) ? $determined_format['module'] : '');
- switch ($determined_format['module']) {
- case 'tar':
- // view TAR-file info
- if (file_exists(GETID3_INCLUDEPATH.$determined_format['include']) && include_once(GETID3_INCLUDEPATH.$determined_format['include'])) {
- if (($temp_tar_filename = tempnam(GETID3_TEMP_DIR, 'getID3')) === false) {
- // can't find anywhere to create a temp file, abort
- $info['error'][] = 'Unable to create temp file to parse TAR inside GZIP file';
- break;
- }
- if ($fp_temp_tar = fopen($temp_tar_filename, 'w+b')) {
- fwrite($fp_temp_tar, $inflated);
- fclose($fp_temp_tar);
- $getid3_temp = new getID3();
- $getid3_temp->openfile($temp_tar_filename);
- $getid3_tar = new getid3_tar($getid3_temp);
- $getid3_tar->Analyze();
- $info['gzip']['member_header'][$idx]['tar'] = $getid3_temp->info['tar'];
- unset($getid3_temp, $getid3_tar);
- unlink($temp_tar_filename);
- } else {
- $info['error'][] = 'Unable to fopen() temp file to parse TAR inside GZIP file';
- break;
- }
- }
- break;
-
- case '':
- default:
- // unknown or unhandled format
- break;
- }
- }
- }
- }
- return true;
- }
-
- // Converts the OS type
- function get_os_type($key) {
- static $os_type = array(
- '0' => 'FAT filesystem (MS-DOS, OS/2, NT/Win32)',
- '1' => 'Amiga',
- '2' => 'VMS (or OpenVMS)',
- '3' => 'Unix',
- '4' => 'VM/CMS',
- '5' => 'Atari TOS',
- '6' => 'HPFS filesystem (OS/2, NT)',
- '7' => 'Macintosh',
- '8' => 'Z-System',
- '9' => 'CP/M',
- '10' => 'TOPS-20',
- '11' => 'NTFS filesystem (NT)',
- '12' => 'QDOS',
- '13' => 'Acorn RISCOS',
- '255' => 'unknown'
- );
- return (isset($os_type[$key]) ? $os_type[$key] : '');
- }
-
- // Converts the eXtra FLags
- function get_xflag_type($key) {
- static $xflag_type = array(
- '0' => 'unknown',
- '2' => 'maximum compression',
- '4' => 'fastest algorithm'
- );
- return (isset($xflag_type[$key]) ? $xflag_type[$key] : '');
- }
-}
-
-?>
diff --git a/3rdparty/getid3/module.archive.rar.php b/3rdparty/getid3/module.archive.rar.php
deleted file mode 100644
index 4f5d46f8373..00000000000
--- a/3rdparty/getid3/module.archive.rar.php
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.archive.rar.php //
-// module for analyzing RAR files //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_rar extends getid3_handler
-{
-
- var $option_use_rar_extension = false;
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- $info['fileformat'] = 'rar';
-
- if ($this->option_use_rar_extension === true) {
- if (function_exists('rar_open')) {
- if ($rp = rar_open($info['filenamepath'])) {
- $info['rar']['files'] = array();
- $entries = rar_list($rp);
- foreach ($entries as $entry) {
- $info['rar']['files'] = getid3_lib::array_merge_clobber($info['rar']['files'], getid3_lib::CreateDeepArray($entry->getName(), '/', $entry->getUnpackedSize()));
- }
- rar_close($rp);
- return true;
- } else {
- $info['error'][] = 'failed to rar_open('.$info['filename'].')';
- }
- } else {
- $info['error'][] = 'RAR support does not appear to be available in this PHP installation';
- }
- } else {
- $info['error'][] = 'PHP-RAR processing has been disabled (set $getid3_rar->option_use_rar_extension=true to enable)';
- }
- return false;
-
- }
-
-}
-
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.archive.szip.php b/3rdparty/getid3/module.archive.szip.php
deleted file mode 100644
index 3be6253263e..00000000000
--- a/3rdparty/getid3/module.archive.szip.php
+++ /dev/null
@@ -1,96 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.archive.szip.php //
-// module for analyzing SZIP compressed files //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_szip extends getid3_handler
-{
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
- $SZIPHeader = fread($this->getid3->fp, 6);
- if (substr($SZIPHeader, 0, 4) != "SZ\x0A\x04") {
- $info['error'][] = 'Expecting "53 5A 0A 04" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes(substr($SZIPHeader, 0, 4)).'"';
- return false;
- }
- $info['fileformat'] = 'szip';
- $info['szip']['major_version'] = getid3_lib::BigEndian2Int(substr($SZIPHeader, 4, 1));
- $info['szip']['minor_version'] = getid3_lib::BigEndian2Int(substr($SZIPHeader, 5, 1));
-
- while (!feof($this->getid3->fp)) {
- $NextBlockID = fread($this->getid3->fp, 2);
- switch ($NextBlockID) {
- case 'SZ':
- // Note that szip files can be concatenated, this has the same effect as
- // concatenating the files. this also means that global header blocks
- // might be present between directory/data blocks.
- fseek($this->getid3->fp, 4, SEEK_CUR);
- break;
-
- case 'BH':
- $BHheaderbytes = getid3_lib::BigEndian2Int(fread($this->getid3->fp, 3));
- $BHheaderdata = fread($this->getid3->fp, $BHheaderbytes);
- $BHheaderoffset = 0;
- while (strpos($BHheaderdata, "\x00", $BHheaderoffset) > 0) {
- //filename as \0 terminated string (empty string indicates end)
- //owner as \0 terminated string (empty is same as last file)
- //group as \0 terminated string (empty is same as last file)
- //3 byte filelength in this block
- //2 byte access flags
- //4 byte creation time (like in unix)
- //4 byte modification time (like in unix)
- //4 byte access time (like in unix)
-
- $BHdataArray['filename'] = substr($BHheaderdata, $BHheaderoffset, strcspn($BHheaderdata, "\x00"));
- $BHheaderoffset += (strlen($BHdataArray['filename']) + 1);
-
- $BHdataArray['owner'] = substr($BHheaderdata, $BHheaderoffset, strcspn($BHheaderdata, "\x00"));
- $BHheaderoffset += (strlen($BHdataArray['owner']) + 1);
-
- $BHdataArray['group'] = substr($BHheaderdata, $BHheaderoffset, strcspn($BHheaderdata, "\x00"));
- $BHheaderoffset += (strlen($BHdataArray['group']) + 1);
-
- $BHdataArray['filelength'] = getid3_lib::BigEndian2Int(substr($BHheaderdata, $BHheaderoffset, 3));
- $BHheaderoffset += 3;
-
- $BHdataArray['access_flags'] = getid3_lib::BigEndian2Int(substr($BHheaderdata, $BHheaderoffset, 2));
- $BHheaderoffset += 2;
-
- $BHdataArray['creation_time'] = getid3_lib::BigEndian2Int(substr($BHheaderdata, $BHheaderoffset, 4));
- $BHheaderoffset += 4;
-
- $BHdataArray['modification_time'] = getid3_lib::BigEndian2Int(substr($BHheaderdata, $BHheaderoffset, 4));
- $BHheaderoffset += 4;
-
- $BHdataArray['access_time'] = getid3_lib::BigEndian2Int(substr($BHheaderdata, $BHheaderoffset, 4));
- $BHheaderoffset += 4;
-
- $info['szip']['BH'][] = $BHdataArray;
- }
- break;
-
- default:
- break 2;
- }
- }
-
- return true;
-
- }
-
-}
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.archive.tar.php b/3rdparty/getid3/module.archive.tar.php
deleted file mode 100644
index 94d32039899..00000000000
--- a/3rdparty/getid3/module.archive.tar.php
+++ /dev/null
@@ -1,178 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.archive.tar.php //
-// module for analyzing TAR files //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-// //
-// Module originally written by //
-// Mike Mozolin <teddybearmail*ru> //
-// //
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_tar extends getid3_handler
-{
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- $info['fileformat'] = 'tar';
- $info['tar']['files'] = array();
-
- $unpack_header = 'a100fname/a8mode/a8uid/a8gid/a12size/a12mtime/a8chksum/a1typflag/a100lnkname/a6magic/a2ver/a32uname/a32gname/a8devmaj/a8devmin/a155prefix';
- $null_512k = str_repeat("\x00", 512); // end-of-file marker
-
- fseek($this->getid3->fp, 0);
- while (!feof($this->getid3->fp)) {
- $buffer = fread($this->getid3->fp, 512);
- if (strlen($buffer) < 512) {
- break;
- }
-
- // check the block
- $checksum = 0;
- for ($i = 0; $i < 148; $i++) {
- $checksum += ord($buffer{$i});
- }
- for ($i = 148; $i < 156; $i++) {
- $checksum += ord(' ');
- }
- for ($i = 156; $i < 512; $i++) {
- $checksum += ord($buffer{$i});
- }
- $attr = unpack($unpack_header, $buffer);
- $name = (isset($attr['fname'] ) ? trim($attr['fname'] ) : '');
- $mode = octdec(isset($attr['mode'] ) ? trim($attr['mode'] ) : '');
- $uid = octdec(isset($attr['uid'] ) ? trim($attr['uid'] ) : '');
- $gid = octdec(isset($attr['gid'] ) ? trim($attr['gid'] ) : '');
- $size = octdec(isset($attr['size'] ) ? trim($attr['size'] ) : '');
- $mtime = octdec(isset($attr['mtime'] ) ? trim($attr['mtime'] ) : '');
- $chksum = octdec(isset($attr['chksum'] ) ? trim($attr['chksum'] ) : '');
- $typflag = (isset($attr['typflag']) ? trim($attr['typflag']) : '');
- $lnkname = (isset($attr['lnkname']) ? trim($attr['lnkname']) : '');
- $magic = (isset($attr['magic'] ) ? trim($attr['magic'] ) : '');
- $ver = (isset($attr['ver'] ) ? trim($attr['ver'] ) : '');
- $uname = (isset($attr['uname'] ) ? trim($attr['uname'] ) : '');
- $gname = (isset($attr['gname'] ) ? trim($attr['gname'] ) : '');
- $devmaj = octdec(isset($attr['devmaj'] ) ? trim($attr['devmaj'] ) : '');
- $devmin = octdec(isset($attr['devmin'] ) ? trim($attr['devmin'] ) : '');
- $prefix = (isset($attr['prefix'] ) ? trim($attr['prefix'] ) : '');
- if (($checksum == 256) && ($chksum == 0)) {
- // EOF Found
- break;
- }
- if ($prefix) {
- $name = $prefix.'/'.$name;
- }
- if ((preg_match('#/$#', $name)) && !$name) {
- $typeflag = 5;
- }
- if ($buffer == $null_512k) {
- // it's the end of the tar-file...
- break;
- }
-
- // Read to the next chunk
- fseek($this->getid3->fp, $size, SEEK_CUR);
-
- $diff = $size % 512;
- if ($diff != 0) {
- // Padding, throw away
- fseek($this->getid3->fp, (512 - $diff), SEEK_CUR);
- }
- // Protect against tar-files with garbage at the end
- if ($name == '') {
- break;
- }
- $info['tar']['file_details'][$name] = array (
- 'name' => $name,
- 'mode_raw' => $mode,
- 'mode' => getid3_tar::display_perms($mode),
- 'uid' => $uid,
- 'gid' => $gid,
- 'size' => $size,
- 'mtime' => $mtime,
- 'chksum' => $chksum,
- 'typeflag' => getid3_tar::get_flag_type($typflag),
- 'linkname' => $lnkname,
- 'magic' => $magic,
- 'version' => $ver,
- 'uname' => $uname,
- 'gname' => $gname,
- 'devmajor' => $devmaj,
- 'devminor' => $devmin
- );
- $info['tar']['files'] = getid3_lib::array_merge_clobber($info['tar']['files'], getid3_lib::CreateDeepArray($info['tar']['file_details'][$name]['name'], '/', $size));
- }
- return true;
- }
-
- // Parses the file mode to file permissions
- function display_perms($mode) {
- // Determine Type
- if ($mode & 0x1000) $type='p'; // FIFO pipe
- elseif ($mode & 0x2000) $type='c'; // Character special
- elseif ($mode & 0x4000) $type='d'; // Directory
- elseif ($mode & 0x6000) $type='b'; // Block special
- elseif ($mode & 0x8000) $type='-'; // Regular
- elseif ($mode & 0xA000) $type='l'; // Symbolic Link
- elseif ($mode & 0xC000) $type='s'; // Socket
- else $type='u'; // UNKNOWN
-
- // Determine permissions
- $owner['read'] = (($mode & 00400) ? 'r' : '-');
- $owner['write'] = (($mode & 00200) ? 'w' : '-');
- $owner['execute'] = (($mode & 00100) ? 'x' : '-');
- $group['read'] = (($mode & 00040) ? 'r' : '-');
- $group['write'] = (($mode & 00020) ? 'w' : '-');
- $group['execute'] = (($mode & 00010) ? 'x' : '-');
- $world['read'] = (($mode & 00004) ? 'r' : '-');
- $world['write'] = (($mode & 00002) ? 'w' : '-');
- $world['execute'] = (($mode & 00001) ? 'x' : '-');
-
- // Adjust for SUID, SGID and sticky bit
- if ($mode & 0x800) $owner['execute'] = ($owner['execute'] == 'x') ? 's' : 'S';
- if ($mode & 0x400) $group['execute'] = ($group['execute'] == 'x') ? 's' : 'S';
- if ($mode & 0x200) $world['execute'] = ($world['execute'] == 'x') ? 't' : 'T';
-
- $s = sprintf('%1s', $type);
- $s .= sprintf('%1s%1s%1s', $owner['read'], $owner['write'], $owner['execute']);
- $s .= sprintf('%1s%1s%1s', $group['read'], $group['write'], $group['execute']);
- $s .= sprintf('%1s%1s%1s'."\n", $world['read'], $world['write'], $world['execute']);
- return $s;
- }
-
- // Converts the file type
- function get_flag_type($typflag) {
- static $flag_types = array(
- '0' => 'LF_NORMAL',
- '1' => 'LF_LINK',
- '2' => 'LF_SYNLINK',
- '3' => 'LF_CHR',
- '4' => 'LF_BLK',
- '5' => 'LF_DIR',
- '6' => 'LF_FIFO',
- '7' => 'LF_CONFIG',
- 'D' => 'LF_DUMPDIR',
- 'K' => 'LF_LONGLINK',
- 'L' => 'LF_LONGNAME',
- 'M' => 'LF_MULTIVOL',
- 'N' => 'LF_NAMES',
- 'S' => 'LF_SPARSE',
- 'V' => 'LF_VOLHDR'
- );
- return (isset($flag_types[$typflag]) ? $flag_types[$typflag] : '');
- }
-
-}
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.archive.zip.php b/3rdparty/getid3/module.archive.zip.php
deleted file mode 100644
index 7db8fd23f13..00000000000
--- a/3rdparty/getid3/module.archive.zip.php
+++ /dev/null
@@ -1,424 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.archive.zip.php //
-// module for analyzing pkZip files //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_zip extends getid3_handler
-{
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- $info['fileformat'] = 'zip';
- $info['zip']['encoding'] = 'ISO-8859-1';
- $info['zip']['files'] = array();
-
- $info['zip']['compressed_size'] = 0;
- $info['zip']['uncompressed_size'] = 0;
- $info['zip']['entries_count'] = 0;
-
- if (!getid3_lib::intValueSupported($info['filesize'])) {
- $info['error'][] = 'File is larger than '.round(PHP_INT_MAX / 1073741824).'GB, not supported by PHP';
- return false;
- } else {
- $EOCDsearchData = '';
- $EOCDsearchCounter = 0;
- while ($EOCDsearchCounter++ < 512) {
-
- fseek($this->getid3->fp, -128 * $EOCDsearchCounter, SEEK_END);
- $EOCDsearchData = fread($this->getid3->fp, 128).$EOCDsearchData;
-
- if (strstr($EOCDsearchData, 'PK'."\x05\x06")) {
-
- $EOCDposition = strpos($EOCDsearchData, 'PK'."\x05\x06");
- fseek($this->getid3->fp, (-128 * $EOCDsearchCounter) + $EOCDposition, SEEK_END);
- $info['zip']['end_central_directory'] = $this->ZIPparseEndOfCentralDirectory();
-
- fseek($this->getid3->fp, $info['zip']['end_central_directory']['directory_offset'], SEEK_SET);
- $info['zip']['entries_count'] = 0;
- while ($centraldirectoryentry = $this->ZIPparseCentralDirectory($this->getid3->fp)) {
- $info['zip']['central_directory'][] = $centraldirectoryentry;
- $info['zip']['entries_count']++;
- $info['zip']['compressed_size'] += $centraldirectoryentry['compressed_size'];
- $info['zip']['uncompressed_size'] += $centraldirectoryentry['uncompressed_size'];
-
- if ($centraldirectoryentry['uncompressed_size'] > 0) {
- $info['zip']['files'] = getid3_lib::array_merge_clobber($info['zip']['files'], getid3_lib::CreateDeepArray($centraldirectoryentry['filename'], '/', $centraldirectoryentry['uncompressed_size']));
- }
- }
-
- if ($info['zip']['entries_count'] == 0) {
- $info['error'][] = 'No Central Directory entries found (truncated file?)';
- return false;
- }
-
- if (!empty($info['zip']['end_central_directory']['comment'])) {
- $info['zip']['comments']['comment'][] = $info['zip']['end_central_directory']['comment'];
- }
-
- if (isset($info['zip']['central_directory'][0]['compression_method'])) {
- $info['zip']['compression_method'] = $info['zip']['central_directory'][0]['compression_method'];
- }
- if (isset($info['zip']['central_directory'][0]['flags']['compression_speed'])) {
- $info['zip']['compression_speed'] = $info['zip']['central_directory'][0]['flags']['compression_speed'];
- }
- if (isset($info['zip']['compression_method']) && ($info['zip']['compression_method'] == 'store') && !isset($info['zip']['compression_speed'])) {
- $info['zip']['compression_speed'] = 'store';
- }
-
- return true;
-
- }
- }
- }
-
- if ($this->getZIPentriesFilepointer()) {
-
- // central directory couldn't be found and/or parsed
- // scan through actual file data entries, recover as much as possible from probable trucated file
- if ($info['zip']['compressed_size'] > ($info['filesize'] - 46 - 22)) {
- $info['error'][] = 'Warning: Truncated file! - Total compressed file sizes ('.$info['zip']['compressed_size'].' bytes) is greater than filesize minus Central Directory and End Of Central Directory structures ('.($info['filesize'] - 46 - 22).' bytes)';
- }
- $info['error'][] = 'Cannot find End Of Central Directory - returned list of files in [zip][entries] array may not be complete';
- foreach ($info['zip']['entries'] as $key => $valuearray) {
- $info['zip']['files'][$valuearray['filename']] = $valuearray['uncompressed_size'];
- }
- return true;
-
- } else {
-
- unset($info['zip']);
- $info['fileformat'] = '';
- $info['error'][] = 'Cannot find End Of Central Directory (truncated file?)';
- return false;
-
- }
- }
-
-
- function getZIPHeaderFilepointerTopDown() {
- $info = &$this->getid3->info;
-
- $info['fileformat'] = 'zip';
-
- $info['zip']['compressed_size'] = 0;
- $info['zip']['uncompressed_size'] = 0;
- $info['zip']['entries_count'] = 0;
-
- rewind($this->getid3->fp);
- while ($fileentry = $this->ZIPparseLocalFileHeader()) {
- $info['zip']['entries'][] = $fileentry;
- $info['zip']['entries_count']++;
- }
- if ($info['zip']['entries_count'] == 0) {
- $info['error'][] = 'No Local File Header entries found';
- return false;
- }
-
- $info['zip']['entries_count'] = 0;
- while ($centraldirectoryentry = $this->ZIPparseCentralDirectory($this->getid3->fp)) {
- $info['zip']['central_directory'][] = $centraldirectoryentry;
- $info['zip']['entries_count']++;
- $info['zip']['compressed_size'] += $centraldirectoryentry['compressed_size'];
- $info['zip']['uncompressed_size'] += $centraldirectoryentry['uncompressed_size'];
- }
- if ($info['zip']['entries_count'] == 0) {
- $info['error'][] = 'No Central Directory entries found (truncated file?)';
- return false;
- }
-
- if ($EOCD = $this->ZIPparseEndOfCentralDirectory()) {
- $info['zip']['end_central_directory'] = $EOCD;
- } else {
- $info['error'][] = 'No End Of Central Directory entry found (truncated file?)';
- return false;
- }
-
- if (!empty($info['zip']['end_central_directory']['comment'])) {
- $info['zip']['comments']['comment'][] = $info['zip']['end_central_directory']['comment'];
- }
-
- return true;
- }
-
-
- function getZIPentriesFilepointer() {
- $info = &$this->getid3->info;
-
- $info['zip']['compressed_size'] = 0;
- $info['zip']['uncompressed_size'] = 0;
- $info['zip']['entries_count'] = 0;
-
- rewind($this->getid3->fp);
- while ($fileentry = $this->ZIPparseLocalFileHeader()) {
- $info['zip']['entries'][] = $fileentry;
- $info['zip']['entries_count']++;
- $info['zip']['compressed_size'] += $fileentry['compressed_size'];
- $info['zip']['uncompressed_size'] += $fileentry['uncompressed_size'];
- }
- if ($info['zip']['entries_count'] == 0) {
- $info['error'][] = 'No Local File Header entries found';
- return false;
- }
-
- return true;
- }
-
-
- function ZIPparseLocalFileHeader() {
- $LocalFileHeader['offset'] = ftell($this->getid3->fp);
-
- $ZIPlocalFileHeader = fread($this->getid3->fp, 30);
-
- $LocalFileHeader['raw']['signature'] = getid3_lib::LittleEndian2Int(substr($ZIPlocalFileHeader, 0, 4));
- if ($LocalFileHeader['raw']['signature'] != 0x04034B50) {
- // invalid Local File Header Signature
- fseek($this->getid3->fp, $LocalFileHeader['offset'], SEEK_SET); // seek back to where filepointer originally was so it can be handled properly
- return false;
- }
- $LocalFileHeader['raw']['extract_version'] = getid3_lib::LittleEndian2Int(substr($ZIPlocalFileHeader, 4, 2));
- $LocalFileHeader['raw']['general_flags'] = getid3_lib::LittleEndian2Int(substr($ZIPlocalFileHeader, 6, 2));
- $LocalFileHeader['raw']['compression_method'] = getid3_lib::LittleEndian2Int(substr($ZIPlocalFileHeader, 8, 2));
- $LocalFileHeader['raw']['last_mod_file_time'] = getid3_lib::LittleEndian2Int(substr($ZIPlocalFileHeader, 10, 2));
- $LocalFileHeader['raw']['last_mod_file_date'] = getid3_lib::LittleEndian2Int(substr($ZIPlocalFileHeader, 12, 2));
- $LocalFileHeader['raw']['crc_32'] = getid3_lib::LittleEndian2Int(substr($ZIPlocalFileHeader, 14, 4));
- $LocalFileHeader['raw']['compressed_size'] = getid3_lib::LittleEndian2Int(substr($ZIPlocalFileHeader, 18, 4));
- $LocalFileHeader['raw']['uncompressed_size'] = getid3_lib::LittleEndian2Int(substr($ZIPlocalFileHeader, 22, 4));
- $LocalFileHeader['raw']['filename_length'] = getid3_lib::LittleEndian2Int(substr($ZIPlocalFileHeader, 26, 2));
- $LocalFileHeader['raw']['extra_field_length'] = getid3_lib::LittleEndian2Int(substr($ZIPlocalFileHeader, 28, 2));
-
- $LocalFileHeader['extract_version'] = sprintf('%1.1f', $LocalFileHeader['raw']['extract_version'] / 10);
- $LocalFileHeader['host_os'] = $this->ZIPversionOSLookup(($LocalFileHeader['raw']['extract_version'] & 0xFF00) >> 8);
- $LocalFileHeader['compression_method'] = $this->ZIPcompressionMethodLookup($LocalFileHeader['raw']['compression_method']);
- $LocalFileHeader['compressed_size'] = $LocalFileHeader['raw']['compressed_size'];
- $LocalFileHeader['uncompressed_size'] = $LocalFileHeader['raw']['uncompressed_size'];
- $LocalFileHeader['flags'] = $this->ZIPparseGeneralPurposeFlags($LocalFileHeader['raw']['general_flags'], $LocalFileHeader['raw']['compression_method']);
- $LocalFileHeader['last_modified_timestamp'] = $this->DOStime2UNIXtime($LocalFileHeader['raw']['last_mod_file_date'], $LocalFileHeader['raw']['last_mod_file_time']);
-
- $FilenameExtrafieldLength = $LocalFileHeader['raw']['filename_length'] + $LocalFileHeader['raw']['extra_field_length'];
- if ($FilenameExtrafieldLength > 0) {
- $ZIPlocalFileHeader .= fread($this->getid3->fp, $FilenameExtrafieldLength);
-
- if ($LocalFileHeader['raw']['filename_length'] > 0) {
- $LocalFileHeader['filename'] = substr($ZIPlocalFileHeader, 30, $LocalFileHeader['raw']['filename_length']);
- }
- if ($LocalFileHeader['raw']['extra_field_length'] > 0) {
- $LocalFileHeader['raw']['extra_field_data'] = substr($ZIPlocalFileHeader, 30 + $LocalFileHeader['raw']['filename_length'], $LocalFileHeader['raw']['extra_field_length']);
- }
- }
-
- $LocalFileHeader['data_offset'] = ftell($this->getid3->fp);
- //$LocalFileHeader['compressed_data'] = fread($this->getid3->fp, $LocalFileHeader['raw']['compressed_size']);
- fseek($this->getid3->fp, $LocalFileHeader['raw']['compressed_size'], SEEK_CUR);
-
- if ($LocalFileHeader['flags']['data_descriptor_used']) {
- $DataDescriptor = fread($this->getid3->fp, 12);
- $LocalFileHeader['data_descriptor']['crc_32'] = getid3_lib::LittleEndian2Int(substr($DataDescriptor, 0, 4));
- $LocalFileHeader['data_descriptor']['compressed_size'] = getid3_lib::LittleEndian2Int(substr($DataDescriptor, 4, 4));
- $LocalFileHeader['data_descriptor']['uncompressed_size'] = getid3_lib::LittleEndian2Int(substr($DataDescriptor, 8, 4));
- }
-
- return $LocalFileHeader;
- }
-
-
- function ZIPparseCentralDirectory() {
- $CentralDirectory['offset'] = ftell($this->getid3->fp);
-
- $ZIPcentralDirectory = fread($this->getid3->fp, 46);
-
- $CentralDirectory['raw']['signature'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 0, 4));
- if ($CentralDirectory['raw']['signature'] != 0x02014B50) {
- // invalid Central Directory Signature
- fseek($this->getid3->fp, $CentralDirectory['offset'], SEEK_SET); // seek back to where filepointer originally was so it can be handled properly
- return false;
- }
- $CentralDirectory['raw']['create_version'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 4, 2));
- $CentralDirectory['raw']['extract_version'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 6, 2));
- $CentralDirectory['raw']['general_flags'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 8, 2));
- $CentralDirectory['raw']['compression_method'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 10, 2));
- $CentralDirectory['raw']['last_mod_file_time'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 12, 2));
- $CentralDirectory['raw']['last_mod_file_date'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 14, 2));
- $CentralDirectory['raw']['crc_32'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 16, 4));
- $CentralDirectory['raw']['compressed_size'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 20, 4));
- $CentralDirectory['raw']['uncompressed_size'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 24, 4));
- $CentralDirectory['raw']['filename_length'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 28, 2));
- $CentralDirectory['raw']['extra_field_length'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 30, 2));
- $CentralDirectory['raw']['file_comment_length'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 32, 2));
- $CentralDirectory['raw']['disk_number_start'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 34, 2));
- $CentralDirectory['raw']['internal_file_attrib'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 36, 2));
- $CentralDirectory['raw']['external_file_attrib'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 38, 4));
- $CentralDirectory['raw']['local_header_offset'] = getid3_lib::LittleEndian2Int(substr($ZIPcentralDirectory, 42, 4));
-
- $CentralDirectory['entry_offset'] = $CentralDirectory['raw']['local_header_offset'];
- $CentralDirectory['create_version'] = sprintf('%1.1f', $CentralDirectory['raw']['create_version'] / 10);
- $CentralDirectory['extract_version'] = sprintf('%1.1f', $CentralDirectory['raw']['extract_version'] / 10);
- $CentralDirectory['host_os'] = $this->ZIPversionOSLookup(($CentralDirectory['raw']['extract_version'] & 0xFF00) >> 8);
- $CentralDirectory['compression_method'] = $this->ZIPcompressionMethodLookup($CentralDirectory['raw']['compression_method']);
- $CentralDirectory['compressed_size'] = $CentralDirectory['raw']['compressed_size'];
- $CentralDirectory['uncompressed_size'] = $CentralDirectory['raw']['uncompressed_size'];
- $CentralDirectory['flags'] = $this->ZIPparseGeneralPurposeFlags($CentralDirectory['raw']['general_flags'], $CentralDirectory['raw']['compression_method']);
- $CentralDirectory['last_modified_timestamp'] = $this->DOStime2UNIXtime($CentralDirectory['raw']['last_mod_file_date'], $CentralDirectory['raw']['last_mod_file_time']);
-
- $FilenameExtrafieldCommentLength = $CentralDirectory['raw']['filename_length'] + $CentralDirectory['raw']['extra_field_length'] + $CentralDirectory['raw']['file_comment_length'];
- if ($FilenameExtrafieldCommentLength > 0) {
- $FilenameExtrafieldComment = fread($this->getid3->fp, $FilenameExtrafieldCommentLength);
-
- if ($CentralDirectory['raw']['filename_length'] > 0) {
- $CentralDirectory['filename'] = substr($FilenameExtrafieldComment, 0, $CentralDirectory['raw']['filename_length']);
- }
- if ($CentralDirectory['raw']['extra_field_length'] > 0) {
- $CentralDirectory['raw']['extra_field_data'] = substr($FilenameExtrafieldComment, $CentralDirectory['raw']['filename_length'], $CentralDirectory['raw']['extra_field_length']);
- }
- if ($CentralDirectory['raw']['file_comment_length'] > 0) {
- $CentralDirectory['file_comment'] = substr($FilenameExtrafieldComment, $CentralDirectory['raw']['filename_length'] + $CentralDirectory['raw']['extra_field_length'], $CentralDirectory['raw']['file_comment_length']);
- }
- }
-
- return $CentralDirectory;
- }
-
- function ZIPparseEndOfCentralDirectory() {
- $EndOfCentralDirectory['offset'] = ftell($this->getid3->fp);
-
- $ZIPendOfCentralDirectory = fread($this->getid3->fp, 22);
-
- $EndOfCentralDirectory['signature'] = getid3_lib::LittleEndian2Int(substr($ZIPendOfCentralDirectory, 0, 4));
- if ($EndOfCentralDirectory['signature'] != 0x06054B50) {
- // invalid End Of Central Directory Signature
- fseek($this->getid3->fp, $EndOfCentralDirectory['offset'], SEEK_SET); // seek back to where filepointer originally was so it can be handled properly
- return false;
- }
- $EndOfCentralDirectory['disk_number_current'] = getid3_lib::LittleEndian2Int(substr($ZIPendOfCentralDirectory, 4, 2));
- $EndOfCentralDirectory['disk_number_start_directory'] = getid3_lib::LittleEndian2Int(substr($ZIPendOfCentralDirectory, 6, 2));
- $EndOfCentralDirectory['directory_entries_this_disk'] = getid3_lib::LittleEndian2Int(substr($ZIPendOfCentralDirectory, 8, 2));
- $EndOfCentralDirectory['directory_entries_total'] = getid3_lib::LittleEndian2Int(substr($ZIPendOfCentralDirectory, 10, 2));
- $EndOfCentralDirectory['directory_size'] = getid3_lib::LittleEndian2Int(substr($ZIPendOfCentralDirectory, 12, 4));
- $EndOfCentralDirectory['directory_offset'] = getid3_lib::LittleEndian2Int(substr($ZIPendOfCentralDirectory, 16, 4));
- $EndOfCentralDirectory['comment_length'] = getid3_lib::LittleEndian2Int(substr($ZIPendOfCentralDirectory, 20, 2));
-
- if ($EndOfCentralDirectory['comment_length'] > 0) {
- $EndOfCentralDirectory['comment'] = fread($this->getid3->fp, $EndOfCentralDirectory['comment_length']);
- }
-
- return $EndOfCentralDirectory;
- }
-
-
- static function ZIPparseGeneralPurposeFlags($flagbytes, $compressionmethod) {
- $ParsedFlags['encrypted'] = (bool) ($flagbytes & 0x0001);
-
- switch ($compressionmethod) {
- case 6:
- $ParsedFlags['dictionary_size'] = (($flagbytes & 0x0002) ? 8192 : 4096);
- $ParsedFlags['shannon_fano_trees'] = (($flagbytes & 0x0004) ? 3 : 2);
- break;
-
- case 8:
- case 9:
- switch (($flagbytes & 0x0006) >> 1) {
- case 0:
- $ParsedFlags['compression_speed'] = 'normal';
- break;
- case 1:
- $ParsedFlags['compression_speed'] = 'maximum';
- break;
- case 2:
- $ParsedFlags['compression_speed'] = 'fast';
- break;
- case 3:
- $ParsedFlags['compression_speed'] = 'superfast';
- break;
- }
- break;
- }
- $ParsedFlags['data_descriptor_used'] = (bool) ($flagbytes & 0x0008);
-
- return $ParsedFlags;
- }
-
-
- static function ZIPversionOSLookup($index) {
- static $ZIPversionOSLookup = array(
- 0 => 'MS-DOS and OS/2 (FAT / VFAT / FAT32 file systems)',
- 1 => 'Amiga',
- 2 => 'OpenVMS',
- 3 => 'Unix',
- 4 => 'VM/CMS',
- 5 => 'Atari ST',
- 6 => 'OS/2 H.P.F.S.',
- 7 => 'Macintosh',
- 8 => 'Z-System',
- 9 => 'CP/M',
- 10 => 'Windows NTFS',
- 11 => 'MVS',
- 12 => 'VSE',
- 13 => 'Acorn Risc',
- 14 => 'VFAT',
- 15 => 'Alternate MVS',
- 16 => 'BeOS',
- 17 => 'Tandem'
- );
-
- return (isset($ZIPversionOSLookup[$index]) ? $ZIPversionOSLookup[$index] : '[unknown]');
- }
-
- static function ZIPcompressionMethodLookup($index) {
- static $ZIPcompressionMethodLookup = array(
- 0 => 'store',
- 1 => 'shrink',
- 2 => 'reduce-1',
- 3 => 'reduce-2',
- 4 => 'reduce-3',
- 5 => 'reduce-4',
- 6 => 'implode',
- 7 => 'tokenize',
- 8 => 'deflate',
- 9 => 'deflate64',
- 10 => 'PKWARE Date Compression Library Imploding'
- );
-
- return (isset($ZIPcompressionMethodLookup[$index]) ? $ZIPcompressionMethodLookup[$index] : '[unknown]');
- }
-
- static function DOStime2UNIXtime($DOSdate, $DOStime) {
- // wFatDate
- // Specifies the MS-DOS date. The date is a packed 16-bit value with the following format:
- // Bits Contents
- // 0-4 Day of the month (1-31)
- // 5-8 Month (1 = January, 2 = February, and so on)
- // 9-15 Year offset from 1980 (add 1980 to get actual year)
-
- $UNIXday = ($DOSdate & 0x001F);
- $UNIXmonth = (($DOSdate & 0x01E0) >> 5);
- $UNIXyear = (($DOSdate & 0xFE00) >> 9) + 1980;
-
- // wFatTime
- // Specifies the MS-DOS time. The time is a packed 16-bit value with the following format:
- // Bits Contents
- // 0-4 Second divided by 2
- // 5-10 Minute (0-59)
- // 11-15 Hour (0-23 on a 24-hour clock)
-
- $UNIXsecond = ($DOStime & 0x001F) * 2;
- $UNIXminute = (($DOStime & 0x07E0) >> 5);
- $UNIXhour = (($DOStime & 0xF800) >> 11);
-
- return gmmktime($UNIXhour, $UNIXminute, $UNIXsecond, $UNIXmonth, $UNIXday, $UNIXyear);
- }
-
-}
-
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.audio-video.asf.php b/3rdparty/getid3/module.audio-video.asf.php
deleted file mode 100644
index 0bb095f52ee..00000000000
--- a/3rdparty/getid3/module.audio-video.asf.php
+++ /dev/null
@@ -1,2021 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.audio-video.asf.php //
-// module for analyzing ASF, WMA and WMV files //
-// dependencies: module.audio-video.riff.php //
-// ///
-/////////////////////////////////////////////////////////////////
-
-getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, true);
-
-class getid3_asf extends getid3_handler
-{
-
- function __construct(getID3 $getid3) {
- parent::__construct($getid3); // extends getid3_handler::__construct()
-
- // initialize all GUID constants
- $GUIDarray = $this->KnownGUIDs();
- foreach ($GUIDarray as $GUIDname => $hexstringvalue) {
- if (!defined($GUIDname)) {
- define($GUIDname, $this->GUIDtoBytestring($hexstringvalue));
- }
- }
- }
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- // Shortcuts
- $thisfile_audio = &$info['audio'];
- $thisfile_video = &$info['video'];
- $info['asf'] = array();
- $thisfile_asf = &$info['asf'];
- $thisfile_asf['comments'] = array();
- $thisfile_asf_comments = &$thisfile_asf['comments'];
- $thisfile_asf['header_object'] = array();
- $thisfile_asf_headerobject = &$thisfile_asf['header_object'];
-
-
- // ASF structure:
- // * Header Object [required]
- // * File Properties Object [required] (global file attributes)
- // * Stream Properties Object [required] (defines media stream & characteristics)
- // * Header Extension Object [required] (additional functionality)
- // * Content Description Object (bibliographic information)
- // * Script Command Object (commands for during playback)
- // * Marker Object (named jumped points within the file)
- // * Data Object [required]
- // * Data Packets
- // * Index Object
-
- // Header Object: (mandatory, one only)
- // Field Name Field Type Size (bits)
- // Object ID GUID 128 // GUID for header object - GETID3_ASF_Header_Object
- // Object Size QWORD 64 // size of header object, including 30 bytes of Header Object header
- // Number of Header Objects DWORD 32 // number of objects in header object
- // Reserved1 BYTE 8 // hardcoded: 0x01
- // Reserved2 BYTE 8 // hardcoded: 0x02
-
- $info['fileformat'] = 'asf';
-
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
- $HeaderObjectData = fread($this->getid3->fp, 30);
-
- $thisfile_asf_headerobject['objectid'] = substr($HeaderObjectData, 0, 16);
- $thisfile_asf_headerobject['objectid_guid'] = $this->BytestringToGUID($thisfile_asf_headerobject['objectid']);
- if ($thisfile_asf_headerobject['objectid'] != GETID3_ASF_Header_Object) {
- $info['warning'][] = 'ASF header GUID {'.$this->BytestringToGUID($thisfile_asf_headerobject['objectid']).'} does not match expected "GETID3_ASF_Header_Object" GUID {'.$this->BytestringToGUID(GETID3_ASF_Header_Object).'}';
- unset($info['fileformat']);
- unset($info['asf']);
- return false;
- break;
- }
- $thisfile_asf_headerobject['objectsize'] = getid3_lib::LittleEndian2Int(substr($HeaderObjectData, 16, 8));
- $thisfile_asf_headerobject['headerobjects'] = getid3_lib::LittleEndian2Int(substr($HeaderObjectData, 24, 4));
- $thisfile_asf_headerobject['reserved1'] = getid3_lib::LittleEndian2Int(substr($HeaderObjectData, 28, 1));
- $thisfile_asf_headerobject['reserved2'] = getid3_lib::LittleEndian2Int(substr($HeaderObjectData, 29, 1));
-
- $NextObjectOffset = ftell($this->getid3->fp);
- $ASFHeaderData = fread($this->getid3->fp, $thisfile_asf_headerobject['objectsize'] - 30);
- $offset = 0;
-
- for ($HeaderObjectsCounter = 0; $HeaderObjectsCounter < $thisfile_asf_headerobject['headerobjects']; $HeaderObjectsCounter++) {
- $NextObjectGUID = substr($ASFHeaderData, $offset, 16);
- $offset += 16;
- $NextObjectGUIDtext = $this->BytestringToGUID($NextObjectGUID);
- $NextObjectSize = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8));
- $offset += 8;
- switch ($NextObjectGUID) {
-
- case GETID3_ASF_File_Properties_Object:
- // File Properties Object: (mandatory, one only)
- // Field Name Field Type Size (bits)
- // Object ID GUID 128 // GUID for file properties object - GETID3_ASF_File_Properties_Object
- // Object Size QWORD 64 // size of file properties object, including 104 bytes of File Properties Object header
- // File ID GUID 128 // unique ID - identical to File ID in Data Object
- // File Size QWORD 64 // entire file in bytes. Invalid if Broadcast Flag == 1
- // Creation Date QWORD 64 // date & time of file creation. Maybe invalid if Broadcast Flag == 1
- // Data Packets Count QWORD 64 // number of data packets in Data Object. Invalid if Broadcast Flag == 1
- // Play Duration QWORD 64 // playtime, in 100-nanosecond units. Invalid if Broadcast Flag == 1
- // Send Duration QWORD 64 // time needed to send file, in 100-nanosecond units. Players can ignore this value. Invalid if Broadcast Flag == 1
- // Preroll QWORD 64 // time to buffer data before starting to play file, in 1-millisecond units. If <> 0, PlayDuration and PresentationTime have been offset by this amount
- // Flags DWORD 32 //
- // * Broadcast Flag bits 1 (0x01) // file is currently being written, some header values are invalid
- // * Seekable Flag bits 1 (0x02) // is file seekable
- // * Reserved bits 30 (0xFFFFFFFC) // reserved - set to zero
- // Minimum Data Packet Size DWORD 32 // in bytes. should be same as Maximum Data Packet Size. Invalid if Broadcast Flag == 1
- // Maximum Data Packet Size DWORD 32 // in bytes. should be same as Minimum Data Packet Size. Invalid if Broadcast Flag == 1
- // Maximum Bitrate DWORD 32 // maximum instantaneous bitrate in bits per second for entire file, including all data streams and ASF overhead
-
- // shortcut
- $thisfile_asf['file_properties_object'] = array();
- $thisfile_asf_filepropertiesobject = &$thisfile_asf['file_properties_object'];
-
- $thisfile_asf_filepropertiesobject['offset'] = $NextObjectOffset + $offset;
- $thisfile_asf_filepropertiesobject['objectid'] = $NextObjectGUID;
- $thisfile_asf_filepropertiesobject['objectid_guid'] = $NextObjectGUIDtext;
- $thisfile_asf_filepropertiesobject['objectsize'] = $NextObjectSize;
- $thisfile_asf_filepropertiesobject['fileid'] = substr($ASFHeaderData, $offset, 16);
- $offset += 16;
- $thisfile_asf_filepropertiesobject['fileid_guid'] = $this->BytestringToGUID($thisfile_asf_filepropertiesobject['fileid']);
- $thisfile_asf_filepropertiesobject['filesize'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8));
- $offset += 8;
- $thisfile_asf_filepropertiesobject['creation_date'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8));
- $thisfile_asf_filepropertiesobject['creation_date_unix'] = $this->FILETIMEtoUNIXtime($thisfile_asf_filepropertiesobject['creation_date']);
- $offset += 8;
- $thisfile_asf_filepropertiesobject['data_packets'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8));
- $offset += 8;
- $thisfile_asf_filepropertiesobject['play_duration'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8));
- $offset += 8;
- $thisfile_asf_filepropertiesobject['send_duration'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8));
- $offset += 8;
- $thisfile_asf_filepropertiesobject['preroll'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8));
- $offset += 8;
- $thisfile_asf_filepropertiesobject['flags_raw'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4));
- $offset += 4;
- $thisfile_asf_filepropertiesobject['flags']['broadcast'] = (bool) ($thisfile_asf_filepropertiesobject['flags_raw'] & 0x0001);
- $thisfile_asf_filepropertiesobject['flags']['seekable'] = (bool) ($thisfile_asf_filepropertiesobject['flags_raw'] & 0x0002);
-
- $thisfile_asf_filepropertiesobject['min_packet_size'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4));
- $offset += 4;
- $thisfile_asf_filepropertiesobject['max_packet_size'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4));
- $offset += 4;
- $thisfile_asf_filepropertiesobject['max_bitrate'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4));
- $offset += 4;
-
- if ($thisfile_asf_filepropertiesobject['flags']['broadcast']) {
-
- // broadcast flag is set, some values invalid
- unset($thisfile_asf_filepropertiesobject['filesize']);
- unset($thisfile_asf_filepropertiesobject['data_packets']);
- unset($thisfile_asf_filepropertiesobject['play_duration']);
- unset($thisfile_asf_filepropertiesobject['send_duration']);
- unset($thisfile_asf_filepropertiesobject['min_packet_size']);
- unset($thisfile_asf_filepropertiesobject['max_packet_size']);
-
- } else {
-
- // broadcast flag NOT set, perform calculations
- $info['playtime_seconds'] = ($thisfile_asf_filepropertiesobject['play_duration'] / 10000000) - ($thisfile_asf_filepropertiesobject['preroll'] / 1000);
-
- //$info['bitrate'] = $thisfile_asf_filepropertiesobject['max_bitrate'];
- $info['bitrate'] = ((isset($thisfile_asf_filepropertiesobject['filesize']) ? $thisfile_asf_filepropertiesobject['filesize'] : $info['filesize']) * 8) / $info['playtime_seconds'];
- }
- break;
-
- case GETID3_ASF_Stream_Properties_Object:
- // Stream Properties Object: (mandatory, one per media stream)
- // Field Name Field Type Size (bits)
- // Object ID GUID 128 // GUID for stream properties object - GETID3_ASF_Stream_Properties_Object
- // Object Size QWORD 64 // size of stream properties object, including 78 bytes of Stream Properties Object header
- // Stream Type GUID 128 // GETID3_ASF_Audio_Media, GETID3_ASF_Video_Media or GETID3_ASF_Command_Media
- // Error Correction Type GUID 128 // GETID3_ASF_Audio_Spread for audio-only streams, GETID3_ASF_No_Error_Correction for other stream types
- // Time Offset QWORD 64 // 100-nanosecond units. typically zero. added to all timestamps of samples in the stream
- // Type-Specific Data Length DWORD 32 // number of bytes for Type-Specific Data field
- // Error Correction Data Length DWORD 32 // number of bytes for Error Correction Data field
- // Flags WORD 16 //
- // * Stream Number bits 7 (0x007F) // number of this stream. 1 <= valid <= 127
- // * Reserved bits 8 (0x7F80) // reserved - set to zero
- // * Encrypted Content Flag bits 1 (0x8000) // stream contents encrypted if set
- // Reserved DWORD 32 // reserved - set to zero
- // Type-Specific Data BYTESTREAM variable // type-specific format data, depending on value of Stream Type
- // Error Correction Data BYTESTREAM variable // error-correction-specific format data, depending on value of Error Correct Type
-
- // There is one GETID3_ASF_Stream_Properties_Object for each stream (audio, video) but the
- // stream number isn't known until halfway through decoding the structure, hence it
- // it is decoded to a temporary variable and then stuck in the appropriate index later
-
- $StreamPropertiesObjectData['offset'] = $NextObjectOffset + $offset;
- $StreamPropertiesObjectData['objectid'] = $NextObjectGUID;
- $StreamPropertiesObjectData['objectid_guid'] = $NextObjectGUIDtext;
- $StreamPropertiesObjectData['objectsize'] = $NextObjectSize;
- $StreamPropertiesObjectData['stream_type'] = substr($ASFHeaderData, $offset, 16);
- $offset += 16;
- $StreamPropertiesObjectData['stream_type_guid'] = $this->BytestringToGUID($StreamPropertiesObjectData['stream_type']);
- $StreamPropertiesObjectData['error_correct_type'] = substr($ASFHeaderData, $offset, 16);
- $offset += 16;
- $StreamPropertiesObjectData['error_correct_guid'] = $this->BytestringToGUID($StreamPropertiesObjectData['error_correct_type']);
- $StreamPropertiesObjectData['time_offset'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8));
- $offset += 8;
- $StreamPropertiesObjectData['type_data_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4));
- $offset += 4;
- $StreamPropertiesObjectData['error_data_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4));
- $offset += 4;
- $StreamPropertiesObjectData['flags_raw'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
- $offset += 2;
- $StreamPropertiesObjectStreamNumber = $StreamPropertiesObjectData['flags_raw'] & 0x007F;
- $StreamPropertiesObjectData['flags']['encrypted'] = (bool) ($StreamPropertiesObjectData['flags_raw'] & 0x8000);
-
- $offset += 4; // reserved - DWORD
- $StreamPropertiesObjectData['type_specific_data'] = substr($ASFHeaderData, $offset, $StreamPropertiesObjectData['type_data_length']);
- $offset += $StreamPropertiesObjectData['type_data_length'];
- $StreamPropertiesObjectData['error_correct_data'] = substr($ASFHeaderData, $offset, $StreamPropertiesObjectData['error_data_length']);
- $offset += $StreamPropertiesObjectData['error_data_length'];
-
- switch ($StreamPropertiesObjectData['stream_type']) {
-
- case GETID3_ASF_Audio_Media:
- $thisfile_audio['dataformat'] = (!empty($thisfile_audio['dataformat']) ? $thisfile_audio['dataformat'] : 'asf');
- $thisfile_audio['bitrate_mode'] = (!empty($thisfile_audio['bitrate_mode']) ? $thisfile_audio['bitrate_mode'] : 'cbr');
-
- $audiodata = getid3_riff::RIFFparseWAVEFORMATex(substr($StreamPropertiesObjectData['type_specific_data'], 0, 16));
- unset($audiodata['raw']);
- $thisfile_audio = getid3_lib::array_merge_noclobber($audiodata, $thisfile_audio);
- break;
-
- case GETID3_ASF_Video_Media:
- $thisfile_video['dataformat'] = (!empty($thisfile_video['dataformat']) ? $thisfile_video['dataformat'] : 'asf');
- $thisfile_video['bitrate_mode'] = (!empty($thisfile_video['bitrate_mode']) ? $thisfile_video['bitrate_mode'] : 'cbr');
- break;
-
- case GETID3_ASF_Command_Media:
- default:
- // do nothing
- break;
-
- }
-
- $thisfile_asf['stream_properties_object'][$StreamPropertiesObjectStreamNumber] = $StreamPropertiesObjectData;
- unset($StreamPropertiesObjectData); // clear for next stream, if any
- break;
-
- case GETID3_ASF_Header_Extension_Object:
- // Header Extension Object: (mandatory, one only)
- // Field Name Field Type Size (bits)
- // Object ID GUID 128 // GUID for Header Extension object - GETID3_ASF_Header_Extension_Object
- // Object Size QWORD 64 // size of Header Extension object, including 46 bytes of Header Extension Object header
- // Reserved Field 1 GUID 128 // hardcoded: GETID3_ASF_Reserved_1
- // Reserved Field 2 WORD 16 // hardcoded: 0x00000006
- // Header Extension Data Size DWORD 32 // in bytes. valid: 0, or > 24. equals object size minus 46
- // Header Extension Data BYTESTREAM variable // array of zero or more extended header objects
-
- // shortcut
- $thisfile_asf['header_extension_object'] = array();
- $thisfile_asf_headerextensionobject = &$thisfile_asf['header_extension_object'];
-
- $thisfile_asf_headerextensionobject['offset'] = $NextObjectOffset + $offset;
- $thisfile_asf_headerextensionobject['objectid'] = $NextObjectGUID;
- $thisfile_asf_headerextensionobject['objectid_guid'] = $NextObjectGUIDtext;
- $thisfile_asf_headerextensionobject['objectsize'] = $NextObjectSize;
- $thisfile_asf_headerextensionobject['reserved_1'] = substr($ASFHeaderData, $offset, 16);
- $offset += 16;
- $thisfile_asf_headerextensionobject['reserved_1_guid'] = $this->BytestringToGUID($thisfile_asf_headerextensionobject['reserved_1']);
- if ($thisfile_asf_headerextensionobject['reserved_1'] != GETID3_ASF_Reserved_1) {
- $info['warning'][] = 'header_extension_object.reserved_1 GUID ('.$this->BytestringToGUID($thisfile_asf_headerextensionobject['reserved_1']).') does not match expected "GETID3_ASF_Reserved_1" GUID ('.$this->BytestringToGUID(GETID3_ASF_Reserved_1).')';
- //return false;
- break;
- }
- $thisfile_asf_headerextensionobject['reserved_2'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
- $offset += 2;
- if ($thisfile_asf_headerextensionobject['reserved_2'] != 6) {
- $info['warning'][] = 'header_extension_object.reserved_2 ('.getid3_lib::PrintHexBytes($thisfile_asf_headerextensionobject['reserved_2']).') does not match expected value of "6"';
- //return false;
- break;
- }
- $thisfile_asf_headerextensionobject['extension_data_size'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4));
- $offset += 4;
- $thisfile_asf_headerextensionobject['extension_data'] = substr($ASFHeaderData, $offset, $thisfile_asf_headerextensionobject['extension_data_size']);
- $unhandled_sections = 0;
- $thisfile_asf_headerextensionobject['extension_data_parsed'] = $this->ASF_HeaderExtensionObjectDataParse($thisfile_asf_headerextensionobject['extension_data'], $unhandled_sections);
- if ($unhandled_sections === 0) {
- unset($thisfile_asf_headerextensionobject['extension_data']);
- }
- $offset += $thisfile_asf_headerextensionobject['extension_data_size'];
- break;
-
- case GETID3_ASF_Codec_List_Object:
- // Codec List Object: (optional, one only)
- // Field Name Field Type Size (bits)
- // Object ID GUID 128 // GUID for Codec List object - GETID3_ASF_Codec_List_Object
- // Object Size QWORD 64 // size of Codec List object, including 44 bytes of Codec List Object header
- // Reserved GUID 128 // hardcoded: 86D15241-311D-11D0-A3A4-00A0C90348F6
- // Codec Entries Count DWORD 32 // number of entries in Codec Entries array
- // Codec Entries array of: variable //
- // * Type WORD 16 // 0x0001 = Video Codec, 0x0002 = Audio Codec, 0xFFFF = Unknown Codec
- // * Codec Name Length WORD 16 // number of Unicode characters stored in the Codec Name field
- // * Codec Name WCHAR variable // array of Unicode characters - name of codec used to create the content
- // * Codec Description Length WORD 16 // number of Unicode characters stored in the Codec Description field
- // * Codec Description WCHAR variable // array of Unicode characters - description of format used to create the content
- // * Codec Information Length WORD 16 // number of Unicode characters stored in the Codec Information field
- // * Codec Information BYTESTREAM variable // opaque array of information bytes about the codec used to create the content
-
- // shortcut
- $thisfile_asf['codec_list_object'] = array();
- $thisfile_asf_codeclistobject = &$thisfile_asf['codec_list_object'];
-
- $thisfile_asf_codeclistobject['offset'] = $NextObjectOffset + $offset;
- $thisfile_asf_codeclistobject['objectid'] = $NextObjectGUID;
- $thisfile_asf_codeclistobject['objectid_guid'] = $NextObjectGUIDtext;
- $thisfile_asf_codeclistobject['objectsize'] = $NextObjectSize;
- $thisfile_asf_codeclistobject['reserved'] = substr($ASFHeaderData, $offset, 16);
- $offset += 16;
- $thisfile_asf_codeclistobject['reserved_guid'] = $this->BytestringToGUID($thisfile_asf_codeclistobject['reserved']);
- if ($thisfile_asf_codeclistobject['reserved'] != $this->GUIDtoBytestring('86D15241-311D-11D0-A3A4-00A0C90348F6')) {
- $info['warning'][] = 'codec_list_object.reserved GUID {'.$this->BytestringToGUID($thisfile_asf_codeclistobject['reserved']).'} does not match expected "GETID3_ASF_Reserved_1" GUID {86D15241-311D-11D0-A3A4-00A0C90348F6}';
- //return false;
- break;
- }
- $thisfile_asf_codeclistobject['codec_entries_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4));
- $offset += 4;
- for ($CodecEntryCounter = 0; $CodecEntryCounter < $thisfile_asf_codeclistobject['codec_entries_count']; $CodecEntryCounter++) {
- // shortcut
- $thisfile_asf_codeclistobject['codec_entries'][$CodecEntryCounter] = array();
- $thisfile_asf_codeclistobject_codecentries_current = &$thisfile_asf_codeclistobject['codec_entries'][$CodecEntryCounter];
-
- $thisfile_asf_codeclistobject_codecentries_current['type_raw'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
- $offset += 2;
- $thisfile_asf_codeclistobject_codecentries_current['type'] = $this->ASFCodecListObjectTypeLookup($thisfile_asf_codeclistobject_codecentries_current['type_raw']);
-
- $CodecNameLength = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)) * 2; // 2 bytes per character
- $offset += 2;
- $thisfile_asf_codeclistobject_codecentries_current['name'] = substr($ASFHeaderData, $offset, $CodecNameLength);
- $offset += $CodecNameLength;
-
- $CodecDescriptionLength = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)) * 2; // 2 bytes per character
- $offset += 2;
- $thisfile_asf_codeclistobject_codecentries_current['description'] = substr($ASFHeaderData, $offset, $CodecDescriptionLength);
- $offset += $CodecDescriptionLength;
-
- $CodecInformationLength = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
- $offset += 2;
- $thisfile_asf_codeclistobject_codecentries_current['information'] = substr($ASFHeaderData, $offset, $CodecInformationLength);
- $offset += $CodecInformationLength;
-
- if ($thisfile_asf_codeclistobject_codecentries_current['type_raw'] == 2) { // audio codec
-
- if (strpos($thisfile_asf_codeclistobject_codecentries_current['description'], ',') === false) {
- $info['warning'][] = '[asf][codec_list_object][codec_entries]['.$CodecEntryCounter.'][description] expected to contain comma-seperated list of parameters: "'.$thisfile_asf_codeclistobject_codecentries_current['description'].'"';
- } else {
-
- list($AudioCodecBitrate, $AudioCodecFrequency, $AudioCodecChannels) = explode(',', $this->TrimConvert($thisfile_asf_codeclistobject_codecentries_current['description']));
- $thisfile_audio['codec'] = $this->TrimConvert($thisfile_asf_codeclistobject_codecentries_current['name']);
-
- if (!isset($thisfile_audio['bitrate']) && strstr($AudioCodecBitrate, 'kbps')) {
- $thisfile_audio['bitrate'] = (int) (trim(str_replace('kbps', '', $AudioCodecBitrate)) * 1000);
- }
- //if (!isset($thisfile_video['bitrate']) && isset($thisfile_audio['bitrate']) && isset($thisfile_asf['file_properties_object']['max_bitrate']) && ($thisfile_asf_codeclistobject['codec_entries_count'] > 1)) {
- if (empty($thisfile_video['bitrate']) && !empty($thisfile_audio['bitrate']) && !empty($info['bitrate'])) {
- //$thisfile_video['bitrate'] = $thisfile_asf['file_properties_object']['max_bitrate'] - $thisfile_audio['bitrate'];
- $thisfile_video['bitrate'] = $info['bitrate'] - $thisfile_audio['bitrate'];
- }
-
- $AudioCodecFrequency = (int) trim(str_replace('kHz', '', $AudioCodecFrequency));
- switch ($AudioCodecFrequency) {
- case 8:
- case 8000:
- $thisfile_audio['sample_rate'] = 8000;
- break;
-
- case 11:
- case 11025:
- $thisfile_audio['sample_rate'] = 11025;
- break;
-
- case 12:
- case 12000:
- $thisfile_audio['sample_rate'] = 12000;
- break;
-
- case 16:
- case 16000:
- $thisfile_audio['sample_rate'] = 16000;
- break;
-
- case 22:
- case 22050:
- $thisfile_audio['sample_rate'] = 22050;
- break;
-
- case 24:
- case 24000:
- $thisfile_audio['sample_rate'] = 24000;
- break;
-
- case 32:
- case 32000:
- $thisfile_audio['sample_rate'] = 32000;
- break;
-
- case 44:
- case 441000:
- $thisfile_audio['sample_rate'] = 44100;
- break;
-
- case 48:
- case 48000:
- $thisfile_audio['sample_rate'] = 48000;
- break;
-
- default:
- $info['warning'][] = 'unknown frequency: "'.$AudioCodecFrequency.'" ('.$this->TrimConvert($thisfile_asf_codeclistobject_codecentries_current['description']).')';
- break;
- }
-
- if (!isset($thisfile_audio['channels'])) {
- if (strstr($AudioCodecChannels, 'stereo')) {
- $thisfile_audio['channels'] = 2;
- } elseif (strstr($AudioCodecChannels, 'mono')) {
- $thisfile_audio['channels'] = 1;
- }
- }
-
- }
- }
- }
- break;
-
- case GETID3_ASF_Script_Command_Object:
- // Script Command Object: (optional, one only)
- // Field Name Field Type Size (bits)
- // Object ID GUID 128 // GUID for Script Command object - GETID3_ASF_Script_Command_Object
- // Object Size QWORD 64 // size of Script Command object, including 44 bytes of Script Command Object header
- // Reserved GUID 128 // hardcoded: 4B1ACBE3-100B-11D0-A39B-00A0C90348F6
- // Commands Count WORD 16 // number of Commands structures in the Script Commands Objects
- // Command Types Count WORD 16 // number of Command Types structures in the Script Commands Objects
- // Command Types array of: variable //
- // * Command Type Name Length WORD 16 // number of Unicode characters for Command Type Name
- // * Command Type Name WCHAR variable // array of Unicode characters - name of a type of command
- // Commands array of: variable //
- // * Presentation Time DWORD 32 // presentation time of that command, in milliseconds
- // * Type Index WORD 16 // type of this command, as a zero-based index into the array of Command Types of this object
- // * Command Name Length WORD 16 // number of Unicode characters for Command Name
- // * Command Name WCHAR variable // array of Unicode characters - name of this command
-
- // shortcut
- $thisfile_asf['script_command_object'] = array();
- $thisfile_asf_scriptcommandobject = &$thisfile_asf['script_command_object'];
-
- $thisfile_asf_scriptcommandobject['offset'] = $NextObjectOffset + $offset;
- $thisfile_asf_scriptcommandobject['objectid'] = $NextObjectGUID;
- $thisfile_asf_scriptcommandobject['objectid_guid'] = $NextObjectGUIDtext;
- $thisfile_asf_scriptcommandobject['objectsize'] = $NextObjectSize;
- $thisfile_asf_scriptcommandobject['reserved'] = substr($ASFHeaderData, $offset, 16);
- $offset += 16;
- $thisfile_asf_scriptcommandobject['reserved_guid'] = $this->BytestringToGUID($thisfile_asf_scriptcommandobject['reserved']);
- if ($thisfile_asf_scriptcommandobject['reserved'] != $this->GUIDtoBytestring('4B1ACBE3-100B-11D0-A39B-00A0C90348F6')) {
- $info['warning'][] = 'script_command_object.reserved GUID {'.$this->BytestringToGUID($thisfile_asf_scriptcommandobject['reserved']).'} does not match expected "GETID3_ASF_Reserved_1" GUID {4B1ACBE3-100B-11D0-A39B-00A0C90348F6}';
- //return false;
- break;
- }
- $thisfile_asf_scriptcommandobject['commands_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
- $offset += 2;
- $thisfile_asf_scriptcommandobject['command_types_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
- $offset += 2;
- for ($CommandTypesCounter = 0; $CommandTypesCounter < $thisfile_asf_scriptcommandobject['command_types_count']; $CommandTypesCounter++) {
- $CommandTypeNameLength = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)) * 2; // 2 bytes per character
- $offset += 2;
- $thisfile_asf_scriptcommandobject['command_types'][$CommandTypesCounter]['name'] = substr($ASFHeaderData, $offset, $CommandTypeNameLength);
- $offset += $CommandTypeNameLength;
- }
- for ($CommandsCounter = 0; $CommandsCounter < $thisfile_asf_scriptcommandobject['commands_count']; $CommandsCounter++) {
- $thisfile_asf_scriptcommandobject['commands'][$CommandsCounter]['presentation_time'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4));
- $offset += 4;
- $thisfile_asf_scriptcommandobject['commands'][$CommandsCounter]['type_index'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
- $offset += 2;
-
- $CommandTypeNameLength = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)) * 2; // 2 bytes per character
- $offset += 2;
- $thisfile_asf_scriptcommandobject['commands'][$CommandsCounter]['name'] = substr($ASFHeaderData, $offset, $CommandTypeNameLength);
- $offset += $CommandTypeNameLength;
- }
- break;
-
- case GETID3_ASF_Marker_Object:
- // Marker Object: (optional, one only)
- // Field Name Field Type Size (bits)
- // Object ID GUID 128 // GUID for Marker object - GETID3_ASF_Marker_Object
- // Object Size QWORD 64 // size of Marker object, including 48 bytes of Marker Object header
- // Reserved GUID 128 // hardcoded: 4CFEDB20-75F6-11CF-9C0F-00A0C90349CB
- // Markers Count DWORD 32 // number of Marker structures in Marker Object
- // Reserved WORD 16 // hardcoded: 0x0000
- // Name Length WORD 16 // number of bytes in the Name field
- // Name WCHAR variable // name of the Marker Object
- // Markers array of: variable //
- // * Offset QWORD 64 // byte offset into Data Object
- // * Presentation Time QWORD 64 // in 100-nanosecond units
- // * Entry Length WORD 16 // length in bytes of (Send Time + Flags + Marker Description Length + Marker Description + Padding)
- // * Send Time DWORD 32 // in milliseconds
- // * Flags DWORD 32 // hardcoded: 0x00000000
- // * Marker Description Length DWORD 32 // number of bytes in Marker Description field
- // * Marker Description WCHAR variable // array of Unicode characters - description of marker entry
- // * Padding BYTESTREAM variable // optional padding bytes
-
- // shortcut
- $thisfile_asf['marker_object'] = array();
- $thisfile_asf_markerobject = &$thisfile_asf['marker_object'];
-
- $thisfile_asf_markerobject['offset'] = $NextObjectOffset + $offset;
- $thisfile_asf_markerobject['objectid'] = $NextObjectGUID;
- $thisfile_asf_markerobject['objectid_guid'] = $NextObjectGUIDtext;
- $thisfile_asf_markerobject['objectsize'] = $NextObjectSize;
- $thisfile_asf_markerobject['reserved'] = substr($ASFHeaderData, $offset, 16);
- $offset += 16;
- $thisfile_asf_markerobject['reserved_guid'] = $this->BytestringToGUID($thisfile_asf_markerobject['reserved']);
- if ($thisfile_asf_markerobject['reserved'] != $this->GUIDtoBytestring('4CFEDB20-75F6-11CF-9C0F-00A0C90349CB')) {
- $info['warning'][] = 'marker_object.reserved GUID {'.$this->BytestringToGUID($thisfile_asf_markerobject['reserved_1']).'} does not match expected "GETID3_ASF_Reserved_1" GUID {4CFEDB20-75F6-11CF-9C0F-00A0C90349CB}';
- break;
- }
- $thisfile_asf_markerobject['markers_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4));
- $offset += 4;
- $thisfile_asf_markerobject['reserved_2'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
- $offset += 2;
- if ($thisfile_asf_markerobject['reserved_2'] != 0) {
- $info['warning'][] = 'marker_object.reserved_2 ('.getid3_lib::PrintHexBytes($thisfile_asf_markerobject['reserved_2']).') does not match expected value of "0"';
- break;
- }
- $thisfile_asf_markerobject['name_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
- $offset += 2;
- $thisfile_asf_markerobject['name'] = substr($ASFHeaderData, $offset, $thisfile_asf_markerobject['name_length']);
- $offset += $thisfile_asf_markerobject['name_length'];
- for ($MarkersCounter = 0; $MarkersCounter < $thisfile_asf_markerobject['markers_count']; $MarkersCounter++) {
- $thisfile_asf_markerobject['markers'][$MarkersCounter]['offset'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8));
- $offset += 8;
- $thisfile_asf_markerobject['markers'][$MarkersCounter]['presentation_time'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8));
- $offset += 8;
- $thisfile_asf_markerobject['markers'][$MarkersCounter]['entry_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
- $offset += 2;
- $thisfile_asf_markerobject['markers'][$MarkersCounter]['send_time'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4));
- $offset += 4;
- $thisfile_asf_markerobject['markers'][$MarkersCounter]['flags'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4));
- $offset += 4;
- $thisfile_asf_markerobject['markers'][$MarkersCounter]['marker_description_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4));
- $offset += 4;
- $thisfile_asf_markerobject['markers'][$MarkersCounter]['marker_description'] = substr($ASFHeaderData, $offset, $thisfile_asf_markerobject['markers'][$MarkersCounter]['marker_description_length']);
- $offset += $thisfile_asf_markerobject['markers'][$MarkersCounter]['marker_description_length'];
- $PaddingLength = $thisfile_asf_markerobject['markers'][$MarkersCounter]['entry_length'] - 4 - 4 - 4 - $thisfile_asf_markerobject['markers'][$MarkersCounter]['marker_description_length'];
- if ($PaddingLength > 0) {
- $thisfile_asf_markerobject['markers'][$MarkersCounter]['padding'] = substr($ASFHeaderData, $offset, $PaddingLength);
- $offset += $PaddingLength;
- }
- }
- break;
-
- case GETID3_ASF_Bitrate_Mutual_Exclusion_Object:
- // Bitrate Mutual Exclusion Object: (optional)
- // Field Name Field Type Size (bits)
- // Object ID GUID 128 // GUID for Bitrate Mutual Exclusion object - GETID3_ASF_Bitrate_Mutual_Exclusion_Object
- // Object Size QWORD 64 // size of Bitrate Mutual Exclusion object, including 42 bytes of Bitrate Mutual Exclusion Object header
- // Exlusion Type GUID 128 // nature of mutual exclusion relationship. one of: (GETID3_ASF_Mutex_Bitrate, GETID3_ASF_Mutex_Unknown)
- // Stream Numbers Count WORD 16 // number of video streams
- // Stream Numbers WORD variable // array of mutually exclusive video stream numbers. 1 <= valid <= 127
-
- // shortcut
- $thisfile_asf['bitrate_mutual_exclusion_object'] = array();
- $thisfile_asf_bitratemutualexclusionobject = &$thisfile_asf['bitrate_mutual_exclusion_object'];
-
- $thisfile_asf_bitratemutualexclusionobject['offset'] = $NextObjectOffset + $offset;
- $thisfile_asf_bitratemutualexclusionobject['objectid'] = $NextObjectGUID;
- $thisfile_asf_bitratemutualexclusionobject['objectid_guid'] = $NextObjectGUIDtext;
- $thisfile_asf_bitratemutualexclusionobject['objectsize'] = $NextObjectSize;
- $thisfile_asf_bitratemutualexclusionobject['reserved'] = substr($ASFHeaderData, $offset, 16);
- $thisfile_asf_bitratemutualexclusionobject['reserved_guid'] = $this->BytestringToGUID($thisfile_asf_bitratemutualexclusionobject['reserved']);
- $offset += 16;
- if (($thisfile_asf_bitratemutualexclusionobject['reserved'] != GETID3_ASF_Mutex_Bitrate) && ($thisfile_asf_bitratemutualexclusionobject['reserved'] != GETID3_ASF_Mutex_Unknown)) {
- $info['warning'][] = 'bitrate_mutual_exclusion_object.reserved GUID {'.$this->BytestringToGUID($thisfile_asf_bitratemutualexclusionobject['reserved']).'} does not match expected "GETID3_ASF_Mutex_Bitrate" GUID {'.$this->BytestringToGUID(GETID3_ASF_Mutex_Bitrate).'} or "GETID3_ASF_Mutex_Unknown" GUID {'.$this->BytestringToGUID(GETID3_ASF_Mutex_Unknown).'}';
- //return false;
- break;
- }
- $thisfile_asf_bitratemutualexclusionobject['stream_numbers_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
- $offset += 2;
- for ($StreamNumberCounter = 0; $StreamNumberCounter < $thisfile_asf_bitratemutualexclusionobject['stream_numbers_count']; $StreamNumberCounter++) {
- $thisfile_asf_bitratemutualexclusionobject['stream_numbers'][$StreamNumberCounter] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
- $offset += 2;
- }
- break;
-
- case GETID3_ASF_Error_Correction_Object:
- // Error Correction Object: (optional, one only)
- // Field Name Field Type Size (bits)
- // Object ID GUID 128 // GUID for Error Correction object - GETID3_ASF_Error_Correction_Object
- // Object Size QWORD 64 // size of Error Correction object, including 44 bytes of Error Correction Object header
- // Error Correction Type GUID 128 // type of error correction. one of: (GETID3_ASF_No_Error_Correction, GETID3_ASF_Audio_Spread)
- // Error Correction Data Length DWORD 32 // number of bytes in Error Correction Data field
- // Error Correction Data BYTESTREAM variable // structure depends on value of Error Correction Type field
-
- // shortcut
- $thisfile_asf['error_correction_object'] = array();
- $thisfile_asf_errorcorrectionobject = &$thisfile_asf['error_correction_object'];
-
- $thisfile_asf_errorcorrectionobject['offset'] = $NextObjectOffset + $offset;
- $thisfile_asf_errorcorrectionobject['objectid'] = $NextObjectGUID;
- $thisfile_asf_errorcorrectionobject['objectid_guid'] = $NextObjectGUIDtext;
- $thisfile_asf_errorcorrectionobject['objectsize'] = $NextObjectSize;
- $thisfile_asf_errorcorrectionobject['error_correction_type'] = substr($ASFHeaderData, $offset, 16);
- $offset += 16;
- $thisfile_asf_errorcorrectionobject['error_correction_guid'] = $this->BytestringToGUID($thisfile_asf_errorcorrectionobject['error_correction_type']);
- $thisfile_asf_errorcorrectionobject['error_correction_data_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4));
- $offset += 4;
- switch ($thisfile_asf_errorcorrectionobject['error_correction_type']) {
- case GETID3_ASF_No_Error_Correction:
- // should be no data, but just in case there is, skip to the end of the field
- $offset += $thisfile_asf_errorcorrectionobject['error_correction_data_length'];
- break;
-
- case GETID3_ASF_Audio_Spread:
- // Field Name Field Type Size (bits)
- // Span BYTE 8 // number of packets over which audio will be spread.
- // Virtual Packet Length WORD 16 // size of largest audio payload found in audio stream
- // Virtual Chunk Length WORD 16 // size of largest audio payload found in audio stream
- // Silence Data Length WORD 16 // number of bytes in Silence Data field
- // Silence Data BYTESTREAM variable // hardcoded: 0x00 * (Silence Data Length) bytes
-
- $thisfile_asf_errorcorrectionobject['span'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 1));
- $offset += 1;
- $thisfile_asf_errorcorrectionobject['virtual_packet_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
- $offset += 2;
- $thisfile_asf_errorcorrectionobject['virtual_chunk_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
- $offset += 2;
- $thisfile_asf_errorcorrectionobject['silence_data_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
- $offset += 2;
- $thisfile_asf_errorcorrectionobject['silence_data'] = substr($ASFHeaderData, $offset, $thisfile_asf_errorcorrectionobject['silence_data_length']);
- $offset += $thisfile_asf_errorcorrectionobject['silence_data_length'];
- break;
-
- default:
- $info['warning'][] = 'error_correction_object.error_correction_type GUID {'.$this->BytestringToGUID($thisfile_asf_errorcorrectionobject['reserved']).'} does not match expected "GETID3_ASF_No_Error_Correction" GUID {'.$this->BytestringToGUID(GETID3_ASF_No_Error_Correction).'} or "GETID3_ASF_Audio_Spread" GUID {'.$this->BytestringToGUID(GETID3_ASF_Audio_Spread).'}';
- //return false;
- break;
- }
-
- break;
-
- case GETID3_ASF_Content_Description_Object:
- // Content Description Object: (optional, one only)
- // Field Name Field Type Size (bits)
- // Object ID GUID 128 // GUID for Content Description object - GETID3_ASF_Content_Description_Object
- // Object Size QWORD 64 // size of Content Description object, including 34 bytes of Content Description Object header
- // Title Length WORD 16 // number of bytes in Title field
- // Author Length WORD 16 // number of bytes in Author field
- // Copyright Length WORD 16 // number of bytes in Copyright field
- // Description Length WORD 16 // number of bytes in Description field
- // Rating Length WORD 16 // number of bytes in Rating field
- // Title WCHAR 16 // array of Unicode characters - Title
- // Author WCHAR 16 // array of Unicode characters - Author
- // Copyright WCHAR 16 // array of Unicode characters - Copyright
- // Description WCHAR 16 // array of Unicode characters - Description
- // Rating WCHAR 16 // array of Unicode characters - Rating
-
- // shortcut
- $thisfile_asf['content_description_object'] = array();
- $thisfile_asf_contentdescriptionobject = &$thisfile_asf['content_description_object'];
-
- $thisfile_asf_contentdescriptionobject['offset'] = $NextObjectOffset + $offset;
- $thisfile_asf_contentdescriptionobject['objectid'] = $NextObjectGUID;
- $thisfile_asf_contentdescriptionobject['objectid_guid'] = $NextObjectGUIDtext;
- $thisfile_asf_contentdescriptionobject['objectsize'] = $NextObjectSize;
- $thisfile_asf_contentdescriptionobject['title_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
- $offset += 2;
- $thisfile_asf_contentdescriptionobject['author_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
- $offset += 2;
- $thisfile_asf_contentdescriptionobject['copyright_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
- $offset += 2;
- $thisfile_asf_contentdescriptionobject['description_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
- $offset += 2;
- $thisfile_asf_contentdescriptionobject['rating_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
- $offset += 2;
- $thisfile_asf_contentdescriptionobject['title'] = substr($ASFHeaderData, $offset, $thisfile_asf_contentdescriptionobject['title_length']);
- $offset += $thisfile_asf_contentdescriptionobject['title_length'];
- $thisfile_asf_contentdescriptionobject['author'] = substr($ASFHeaderData, $offset, $thisfile_asf_contentdescriptionobject['author_length']);
- $offset += $thisfile_asf_contentdescriptionobject['author_length'];
- $thisfile_asf_contentdescriptionobject['copyright'] = substr($ASFHeaderData, $offset, $thisfile_asf_contentdescriptionobject['copyright_length']);
- $offset += $thisfile_asf_contentdescriptionobject['copyright_length'];
- $thisfile_asf_contentdescriptionobject['description'] = substr($ASFHeaderData, $offset, $thisfile_asf_contentdescriptionobject['description_length']);
- $offset += $thisfile_asf_contentdescriptionobject['description_length'];
- $thisfile_asf_contentdescriptionobject['rating'] = substr($ASFHeaderData, $offset, $thisfile_asf_contentdescriptionobject['rating_length']);
- $offset += $thisfile_asf_contentdescriptionobject['rating_length'];
-
- $ASFcommentKeysToCopy = array('title'=>'title', 'author'=>'artist', 'copyright'=>'copyright', 'description'=>'comment', 'rating'=>'rating');
- foreach ($ASFcommentKeysToCopy as $keytocopyfrom => $keytocopyto) {
- if (!empty($thisfile_asf_contentdescriptionobject[$keytocopyfrom])) {
- $thisfile_asf_comments[$keytocopyto][] = $this->TrimTerm($thisfile_asf_contentdescriptionobject[$keytocopyfrom]);
- }
- }
- break;
-
- case GETID3_ASF_Extended_Content_Description_Object:
- // Extended Content Description Object: (optional, one only)
- // Field Name Field Type Size (bits)
- // Object ID GUID 128 // GUID for Extended Content Description object - GETID3_ASF_Extended_Content_Description_Object
- // Object Size QWORD 64 // size of ExtendedContent Description object, including 26 bytes of Extended Content Description Object header
- // Content Descriptors Count WORD 16 // number of entries in Content Descriptors list
- // Content Descriptors array of: variable //
- // * Descriptor Name Length WORD 16 // size in bytes of Descriptor Name field
- // * Descriptor Name WCHAR variable // array of Unicode characters - Descriptor Name
- // * Descriptor Value Data Type WORD 16 // Lookup array:
- // 0x0000 = Unicode String (variable length)
- // 0x0001 = BYTE array (variable length)
- // 0x0002 = BOOL (DWORD, 32 bits)
- // 0x0003 = DWORD (DWORD, 32 bits)
- // 0x0004 = QWORD (QWORD, 64 bits)
- // 0x0005 = WORD (WORD, 16 bits)
- // * Descriptor Value Length WORD 16 // number of bytes stored in Descriptor Value field
- // * Descriptor Value variable variable // value for Content Descriptor
-
- // shortcut
- $thisfile_asf['extended_content_description_object'] = array();
- $thisfile_asf_extendedcontentdescriptionobject = &$thisfile_asf['extended_content_description_object'];
-
- $thisfile_asf_extendedcontentdescriptionobject['offset'] = $NextObjectOffset + $offset;
- $thisfile_asf_extendedcontentdescriptionobject['objectid'] = $NextObjectGUID;
- $thisfile_asf_extendedcontentdescriptionobject['objectid_guid'] = $NextObjectGUIDtext;
- $thisfile_asf_extendedcontentdescriptionobject['objectsize'] = $NextObjectSize;
- $thisfile_asf_extendedcontentdescriptionobject['content_descriptors_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
- $offset += 2;
- for ($ExtendedContentDescriptorsCounter = 0; $ExtendedContentDescriptorsCounter < $thisfile_asf_extendedcontentdescriptionobject['content_descriptors_count']; $ExtendedContentDescriptorsCounter++) {
- // shortcut
- $thisfile_asf_extendedcontentdescriptionobject['content_descriptors'][$ExtendedContentDescriptorsCounter] = array();
- $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current = &$thisfile_asf_extendedcontentdescriptionobject['content_descriptors'][$ExtendedContentDescriptorsCounter];
-
- $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['base_offset'] = $offset + 30;
- $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['name_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
- $offset += 2;
- $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['name'] = substr($ASFHeaderData, $offset, $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['name_length']);
- $offset += $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['name_length'];
- $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_type'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
- $offset += 2;
- $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
- $offset += 2;
- $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'] = substr($ASFHeaderData, $offset, $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_length']);
- $offset += $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_length'];
- switch ($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_type']) {
- case 0x0000: // Unicode string
- break;
-
- case 0x0001: // BYTE array
- // do nothing
- break;
-
- case 0x0002: // BOOL
- $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'] = (bool) getid3_lib::LittleEndian2Int($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']);
- break;
-
- case 0x0003: // DWORD
- case 0x0004: // QWORD
- case 0x0005: // WORD
- $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'] = getid3_lib::LittleEndian2Int($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']);
- break;
-
- default:
- $info['warning'][] = 'extended_content_description.content_descriptors.'.$ExtendedContentDescriptorsCounter.'.value_type is invalid ('.$thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_type'].')';
- //return false;
- break;
- }
- switch ($this->TrimConvert(strtolower($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['name']))) {
-
- case 'wm/albumartist':
- case 'artist':
- // Note: not 'artist', that comes from 'author' tag
- $thisfile_asf_comments['albumartist'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']));
- break;
-
- case 'wm/albumtitle':
- case 'album':
- $thisfile_asf_comments['album'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']));
- break;
-
- case 'wm/genre':
- case 'genre':
- $thisfile_asf_comments['genre'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']));
- break;
-
- case 'wm/partofset':
- $thisfile_asf_comments['partofset'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']));
- break;
-
- case 'wm/tracknumber':
- case 'tracknumber':
- // be careful casting to int: casting unicode strings to int gives unexpected results (stops parsing at first non-numeric character)
- $thisfile_asf_comments['track'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']));
- foreach ($thisfile_asf_comments['track'] as $key => $value) {
- if (preg_match('/^[0-9\x00]+$/', $value)) {
- $thisfile_asf_comments['track'][$key] = intval(str_replace("\x00", '', $value));
- }
- }
- break;
-
- case 'wm/track':
- if (empty($thisfile_asf_comments['track'])) {
- $thisfile_asf_comments['track'] = array(1 + $this->TrimConvert($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']));
- }
- break;
-
- case 'wm/year':
- case 'year':
- case 'date':
- $thisfile_asf_comments['year'] = array( $this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']));
- break;
-
- case 'wm/lyrics':
- case 'lyrics':
- $thisfile_asf_comments['lyrics'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']));
- break;
-
- case 'isvbr':
- if ($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']) {
- $thisfile_audio['bitrate_mode'] = 'vbr';
- $thisfile_video['bitrate_mode'] = 'vbr';
- }
- break;
-
- case 'id3':
- // id3v2 module might not be loaded
- if (class_exists('getid3_id3v2')) {
- $tempfile = tempnam(GETID3_TEMP_DIR, 'getID3');
- $tempfilehandle = fopen($tempfile, 'wb');
- $tempThisfileInfo = array('encoding'=>$info['encoding']);
- fwrite($tempfilehandle, $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']);
- fclose($tempfilehandle);
-
- $getid3_temp = new getID3();
- $getid3_temp->openfile($tempfile);
- $getid3_id3v2 = new getid3_id3v2($getid3_temp);
- $getid3_id3v2->Analyze();
- $info['id3v2'] = $getid3_temp->info['id3v2'];
- unset($getid3_temp, $getid3_id3v2);
-
- unlink($tempfile);
- }
- break;
-
- case 'wm/encodingtime':
- $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['encoding_time_unix'] = $this->FILETIMEtoUNIXtime($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']);
- $thisfile_asf_comments['encoding_time_unix'] = array($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['encoding_time_unix']);
- break;
-
- case 'wm/picture':
- $WMpicture = $this->ASF_WMpicture($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']);
- foreach ($WMpicture as $key => $value) {
- $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[$key] = $value;
- }
- unset($WMpicture);
-/*
- $wm_picture_offset = 0;
- $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_type_id'] = getid3_lib::LittleEndian2Int(substr($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'], $wm_picture_offset, 1));
- $wm_picture_offset += 1;
- $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_type'] = $this->WMpictureTypeLookup($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_type_id']);
- $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_size'] = getid3_lib::LittleEndian2Int(substr($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'], $wm_picture_offset, 4));
- $wm_picture_offset += 4;
-
- $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_mime'] = '';
- do {
- $next_byte_pair = substr($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'], $wm_picture_offset, 2);
- $wm_picture_offset += 2;
- $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_mime'] .= $next_byte_pair;
- } while ($next_byte_pair !== "\x00\x00");
-
- $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_description'] = '';
- do {
- $next_byte_pair = substr($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'], $wm_picture_offset, 2);
- $wm_picture_offset += 2;
- $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_description'] .= $next_byte_pair;
- } while ($next_byte_pair !== "\x00\x00");
-
- $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['dataoffset'] = $wm_picture_offset;
- $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['data'] = substr($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'], $wm_picture_offset);
- unset($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']);
-
- $imageinfo = array();
- $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_mime'] = '';
- $imagechunkcheck = getid3_lib::GetDataImageSize($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['data'], $imageinfo);
- unset($imageinfo);
- if (!empty($imagechunkcheck)) {
- $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_mime'] = image_type_to_mime_type($imagechunkcheck[2]);
- }
- if (!isset($thisfile_asf_comments['picture'])) {
- $thisfile_asf_comments['picture'] = array();
- }
- $thisfile_asf_comments['picture'][] = array('data'=>$thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['data'], 'image_mime'=>$thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_mime']);
-*/
- break;
-
- default:
- switch ($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_type']) {
- case 0: // Unicode string
- if (substr($this->TrimConvert($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['name']), 0, 3) == 'WM/') {
- $thisfile_asf_comments[str_replace('wm/', '', strtolower($this->TrimConvert($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['name'])))] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']));
- }
- break;
-
- case 1:
- break;
- }
- break;
- }
-
- }
- break;
-
- case GETID3_ASF_Stream_Bitrate_Properties_Object:
- // Stream Bitrate Properties Object: (optional, one only)
- // Field Name Field Type Size (bits)
- // Object ID GUID 128 // GUID for Stream Bitrate Properties object - GETID3_ASF_Stream_Bitrate_Properties_Object
- // Object Size QWORD 64 // size of Extended Content Description object, including 26 bytes of Stream Bitrate Properties Object header
- // Bitrate Records Count WORD 16 // number of records in Bitrate Records
- // Bitrate Records array of: variable //
- // * Flags WORD 16 //
- // * * Stream Number bits 7 (0x007F) // number of this stream
- // * * Reserved bits 9 (0xFF80) // hardcoded: 0
- // * Average Bitrate DWORD 32 // in bits per second
-
- // shortcut
- $thisfile_asf['stream_bitrate_properties_object'] = array();
- $thisfile_asf_streambitratepropertiesobject = &$thisfile_asf['stream_bitrate_properties_object'];
-
- $thisfile_asf_streambitratepropertiesobject['offset'] = $NextObjectOffset + $offset;
- $thisfile_asf_streambitratepropertiesobject['objectid'] = $NextObjectGUID;
- $thisfile_asf_streambitratepropertiesobject['objectid_guid'] = $NextObjectGUIDtext;
- $thisfile_asf_streambitratepropertiesobject['objectsize'] = $NextObjectSize;
- $thisfile_asf_streambitratepropertiesobject['bitrate_records_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
- $offset += 2;
- for ($BitrateRecordsCounter = 0; $BitrateRecordsCounter < $thisfile_asf_streambitratepropertiesobject['bitrate_records_count']; $BitrateRecordsCounter++) {
- $thisfile_asf_streambitratepropertiesobject['bitrate_records'][$BitrateRecordsCounter]['flags_raw'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
- $offset += 2;
- $thisfile_asf_streambitratepropertiesobject['bitrate_records'][$BitrateRecordsCounter]['flags']['stream_number'] = $thisfile_asf_streambitratepropertiesobject['bitrate_records'][$BitrateRecordsCounter]['flags_raw'] & 0x007F;
- $thisfile_asf_streambitratepropertiesobject['bitrate_records'][$BitrateRecordsCounter]['bitrate'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4));
- $offset += 4;
- }
- break;
-
- case GETID3_ASF_Padding_Object:
- // Padding Object: (optional)
- // Field Name Field Type Size (bits)
- // Object ID GUID 128 // GUID for Padding object - GETID3_ASF_Padding_Object
- // Object Size QWORD 64 // size of Padding object, including 24 bytes of ASF Padding Object header
- // Padding Data BYTESTREAM variable // ignore
-
- // shortcut
- $thisfile_asf['padding_object'] = array();
- $thisfile_asf_paddingobject = &$thisfile_asf['padding_object'];
-
- $thisfile_asf_paddingobject['offset'] = $NextObjectOffset + $offset;
- $thisfile_asf_paddingobject['objectid'] = $NextObjectGUID;
- $thisfile_asf_paddingobject['objectid_guid'] = $NextObjectGUIDtext;
- $thisfile_asf_paddingobject['objectsize'] = $NextObjectSize;
- $thisfile_asf_paddingobject['padding_length'] = $thisfile_asf_paddingobject['objectsize'] - 16 - 8;
- $thisfile_asf_paddingobject['padding'] = substr($ASFHeaderData, $offset, $thisfile_asf_paddingobject['padding_length']);
- $offset += ($NextObjectSize - 16 - 8);
- break;
-
- case GETID3_ASF_Extended_Content_Encryption_Object:
- case GETID3_ASF_Content_Encryption_Object:
- // WMA DRM - just ignore
- $offset += ($NextObjectSize - 16 - 8);
- break;
-
- default:
- // Implementations shall ignore any standard or non-standard object that they do not know how to handle.
- if ($this->GUIDname($NextObjectGUIDtext)) {
- $info['warning'][] = 'unhandled GUID "'.$this->GUIDname($NextObjectGUIDtext).'" {'.$NextObjectGUIDtext.'} in ASF header at offset '.($offset - 16 - 8);
- } else {
- $info['warning'][] = 'unknown GUID {'.$NextObjectGUIDtext.'} in ASF header at offset '.($offset - 16 - 8);
- }
- $offset += ($NextObjectSize - 16 - 8);
- break;
- }
- }
- if (isset($thisfile_asf_streambitrateproperties['bitrate_records_count'])) {
- $ASFbitrateAudio = 0;
- $ASFbitrateVideo = 0;
- for ($BitrateRecordsCounter = 0; $BitrateRecordsCounter < $thisfile_asf_streambitrateproperties['bitrate_records_count']; $BitrateRecordsCounter++) {
- if (isset($thisfile_asf_codeclistobject['codec_entries'][$BitrateRecordsCounter])) {
- switch ($thisfile_asf_codeclistobject['codec_entries'][$BitrateRecordsCounter]['type_raw']) {
- case 1:
- $ASFbitrateVideo += $thisfile_asf_streambitrateproperties['bitrate_records'][$BitrateRecordsCounter]['bitrate'];
- break;
-
- case 2:
- $ASFbitrateAudio += $thisfile_asf_streambitrateproperties['bitrate_records'][$BitrateRecordsCounter]['bitrate'];
- break;
-
- default:
- // do nothing
- break;
- }
- }
- }
- if ($ASFbitrateAudio > 0) {
- $thisfile_audio['bitrate'] = $ASFbitrateAudio;
- }
- if ($ASFbitrateVideo > 0) {
- $thisfile_video['bitrate'] = $ASFbitrateVideo;
- }
- }
- if (isset($thisfile_asf['stream_properties_object']) && is_array($thisfile_asf['stream_properties_object'])) {
-
- $thisfile_audio['bitrate'] = 0;
- $thisfile_video['bitrate'] = 0;
-
- foreach ($thisfile_asf['stream_properties_object'] as $streamnumber => $streamdata) {
-
- switch ($streamdata['stream_type']) {
- case GETID3_ASF_Audio_Media:
- // Field Name Field Type Size (bits)
- // Codec ID / Format Tag WORD 16 // unique ID of audio codec - defined as wFormatTag field of WAVEFORMATEX structure
- // Number of Channels WORD 16 // number of channels of audio - defined as nChannels field of WAVEFORMATEX structure
- // Samples Per Second DWORD 32 // in Hertz - defined as nSamplesPerSec field of WAVEFORMATEX structure
- // Average number of Bytes/sec DWORD 32 // bytes/sec of audio stream - defined as nAvgBytesPerSec field of WAVEFORMATEX structure
- // Block Alignment WORD 16 // block size in bytes of audio codec - defined as nBlockAlign field of WAVEFORMATEX structure
- // Bits per sample WORD 16 // bits per sample of mono data. set to zero for variable bitrate codecs. defined as wBitsPerSample field of WAVEFORMATEX structure
- // Codec Specific Data Size WORD 16 // size in bytes of Codec Specific Data buffer - defined as cbSize field of WAVEFORMATEX structure
- // Codec Specific Data BYTESTREAM variable // array of codec-specific data bytes
-
- // shortcut
- $thisfile_asf['audio_media'][$streamnumber] = array();
- $thisfile_asf_audiomedia_currentstream = &$thisfile_asf['audio_media'][$streamnumber];
-
- $audiomediaoffset = 0;
-
- $thisfile_asf_audiomedia_currentstream = getid3_riff::RIFFparseWAVEFORMATex(substr($streamdata['type_specific_data'], $audiomediaoffset, 16));
- $audiomediaoffset += 16;
-
- $thisfile_audio['lossless'] = false;
- switch ($thisfile_asf_audiomedia_currentstream['raw']['wFormatTag']) {
- case 0x0001: // PCM
- case 0x0163: // WMA9 Lossless
- $thisfile_audio['lossless'] = true;
- break;
- }
-
- if (!empty($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'])) {
- foreach ($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'] as $dummy => $dataarray) {
- if (isset($dataarray['flags']['stream_number']) && ($dataarray['flags']['stream_number'] == $streamnumber)) {
- $thisfile_asf_audiomedia_currentstream['bitrate'] = $dataarray['bitrate'];
- $thisfile_audio['bitrate'] += $dataarray['bitrate'];
- break;
- }
- }
- } else {
- if (!empty($thisfile_asf_audiomedia_currentstream['bytes_sec'])) {
- $thisfile_audio['bitrate'] += $thisfile_asf_audiomedia_currentstream['bytes_sec'] * 8;
- } elseif (!empty($thisfile_asf_audiomedia_currentstream['bitrate'])) {
- $thisfile_audio['bitrate'] += $thisfile_asf_audiomedia_currentstream['bitrate'];
- }
- }
- $thisfile_audio['streams'][$streamnumber] = $thisfile_asf_audiomedia_currentstream;
- $thisfile_audio['streams'][$streamnumber]['wformattag'] = $thisfile_asf_audiomedia_currentstream['raw']['wFormatTag'];
- $thisfile_audio['streams'][$streamnumber]['lossless'] = $thisfile_audio['lossless'];
- $thisfile_audio['streams'][$streamnumber]['bitrate'] = $thisfile_audio['bitrate'];
- $thisfile_audio['streams'][$streamnumber]['dataformat'] = 'wma';
- unset($thisfile_audio['streams'][$streamnumber]['raw']);
-
- $thisfile_asf_audiomedia_currentstream['codec_data_size'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $audiomediaoffset, 2));
- $audiomediaoffset += 2;
- $thisfile_asf_audiomedia_currentstream['codec_data'] = substr($streamdata['type_specific_data'], $audiomediaoffset, $thisfile_asf_audiomedia_currentstream['codec_data_size']);
- $audiomediaoffset += $thisfile_asf_audiomedia_currentstream['codec_data_size'];
-
- break;
-
- case GETID3_ASF_Video_Media:
- // Field Name Field Type Size (bits)
- // Encoded Image Width DWORD 32 // width of image in pixels
- // Encoded Image Height DWORD 32 // height of image in pixels
- // Reserved Flags BYTE 8 // hardcoded: 0x02
- // Format Data Size WORD 16 // size of Format Data field in bytes
- // Format Data array of: variable //
- // * Format Data Size DWORD 32 // number of bytes in Format Data field, in bytes - defined as biSize field of BITMAPINFOHEADER structure
- // * Image Width LONG 32 // width of encoded image in pixels - defined as biWidth field of BITMAPINFOHEADER structure
- // * Image Height LONG 32 // height of encoded image in pixels - defined as biHeight field of BITMAPINFOHEADER structure
- // * Reserved WORD 16 // hardcoded: 0x0001 - defined as biPlanes field of BITMAPINFOHEADER structure
- // * Bits Per Pixel Count WORD 16 // bits per pixel - defined as biBitCount field of BITMAPINFOHEADER structure
- // * Compression ID FOURCC 32 // fourcc of video codec - defined as biCompression field of BITMAPINFOHEADER structure
- // * Image Size DWORD 32 // image size in bytes - defined as biSizeImage field of BITMAPINFOHEADER structure
- // * Horizontal Pixels / Meter DWORD 32 // horizontal resolution of target device in pixels per meter - defined as biXPelsPerMeter field of BITMAPINFOHEADER structure
- // * Vertical Pixels / Meter DWORD 32 // vertical resolution of target device in pixels per meter - defined as biYPelsPerMeter field of BITMAPINFOHEADER structure
- // * Colors Used Count DWORD 32 // number of color indexes in the color table that are actually used - defined as biClrUsed field of BITMAPINFOHEADER structure
- // * Important Colors Count DWORD 32 // number of color index required for displaying bitmap. if zero, all colors are required. defined as biClrImportant field of BITMAPINFOHEADER structure
- // * Codec Specific Data BYTESTREAM variable // array of codec-specific data bytes
-
- // shortcut
- $thisfile_asf['video_media'][$streamnumber] = array();
- $thisfile_asf_videomedia_currentstream = &$thisfile_asf['video_media'][$streamnumber];
-
- $videomediaoffset = 0;
- $thisfile_asf_videomedia_currentstream['image_width'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4));
- $videomediaoffset += 4;
- $thisfile_asf_videomedia_currentstream['image_height'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4));
- $videomediaoffset += 4;
- $thisfile_asf_videomedia_currentstream['flags'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 1));
- $videomediaoffset += 1;
- $thisfile_asf_videomedia_currentstream['format_data_size'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 2));
- $videomediaoffset += 2;
- $thisfile_asf_videomedia_currentstream['format_data']['format_data_size'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4));
- $videomediaoffset += 4;
- $thisfile_asf_videomedia_currentstream['format_data']['image_width'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4));
- $videomediaoffset += 4;
- $thisfile_asf_videomedia_currentstream['format_data']['image_height'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4));
- $videomediaoffset += 4;
- $thisfile_asf_videomedia_currentstream['format_data']['reserved'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 2));
- $videomediaoffset += 2;
- $thisfile_asf_videomedia_currentstream['format_data']['bits_per_pixel'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 2));
- $videomediaoffset += 2;
- $thisfile_asf_videomedia_currentstream['format_data']['codec_fourcc'] = substr($streamdata['type_specific_data'], $videomediaoffset, 4);
- $videomediaoffset += 4;
- $thisfile_asf_videomedia_currentstream['format_data']['image_size'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4));
- $videomediaoffset += 4;
- $thisfile_asf_videomedia_currentstream['format_data']['horizontal_pels'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4));
- $videomediaoffset += 4;
- $thisfile_asf_videomedia_currentstream['format_data']['vertical_pels'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4));
- $videomediaoffset += 4;
- $thisfile_asf_videomedia_currentstream['format_data']['colors_used'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4));
- $videomediaoffset += 4;
- $thisfile_asf_videomedia_currentstream['format_data']['colors_important'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4));
- $videomediaoffset += 4;
- $thisfile_asf_videomedia_currentstream['format_data']['codec_data'] = substr($streamdata['type_specific_data'], $videomediaoffset);
-
- if (!empty($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'])) {
- foreach ($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'] as $dummy => $dataarray) {
- if (isset($dataarray['flags']['stream_number']) && ($dataarray['flags']['stream_number'] == $streamnumber)) {
- $thisfile_asf_videomedia_currentstream['bitrate'] = $dataarray['bitrate'];
- $thisfile_video['streams'][$streamnumber]['bitrate'] = $dataarray['bitrate'];
- $thisfile_video['bitrate'] += $dataarray['bitrate'];
- break;
- }
- }
- }
-
- $thisfile_asf_videomedia_currentstream['format_data']['codec'] = getid3_riff::RIFFfourccLookup($thisfile_asf_videomedia_currentstream['format_data']['codec_fourcc']);
-
- $thisfile_video['streams'][$streamnumber]['fourcc'] = $thisfile_asf_videomedia_currentstream['format_data']['codec_fourcc'];
- $thisfile_video['streams'][$streamnumber]['codec'] = $thisfile_asf_videomedia_currentstream['format_data']['codec'];
- $thisfile_video['streams'][$streamnumber]['resolution_x'] = $thisfile_asf_videomedia_currentstream['image_width'];
- $thisfile_video['streams'][$streamnumber]['resolution_y'] = $thisfile_asf_videomedia_currentstream['image_height'];
- $thisfile_video['streams'][$streamnumber]['bits_per_sample'] = $thisfile_asf_videomedia_currentstream['format_data']['bits_per_pixel'];
- break;
-
- default:
- break;
- }
- }
- }
-
- while (ftell($this->getid3->fp) < $info['avdataend']) {
- $NextObjectDataHeader = fread($this->getid3->fp, 24);
- $offset = 0;
- $NextObjectGUID = substr($NextObjectDataHeader, 0, 16);
- $offset += 16;
- $NextObjectGUIDtext = $this->BytestringToGUID($NextObjectGUID);
- $NextObjectSize = getid3_lib::LittleEndian2Int(substr($NextObjectDataHeader, $offset, 8));
- $offset += 8;
-
- switch ($NextObjectGUID) {
- case GETID3_ASF_Data_Object:
- // Data Object: (mandatory, one only)
- // Field Name Field Type Size (bits)
- // Object ID GUID 128 // GUID for Data object - GETID3_ASF_Data_Object
- // Object Size QWORD 64 // size of Data object, including 50 bytes of Data Object header. may be 0 if FilePropertiesObject.BroadcastFlag == 1
- // File ID GUID 128 // unique identifier. identical to File ID field in Header Object
- // Total Data Packets QWORD 64 // number of Data Packet entries in Data Object. invalid if FilePropertiesObject.BroadcastFlag == 1
- // Reserved WORD 16 // hardcoded: 0x0101
-
- // shortcut
- $thisfile_asf['data_object'] = array();
- $thisfile_asf_dataobject = &$thisfile_asf['data_object'];
-
- $DataObjectData = $NextObjectDataHeader.fread($this->getid3->fp, 50 - 24);
- $offset = 24;
-
- $thisfile_asf_dataobject['objectid'] = $NextObjectGUID;
- $thisfile_asf_dataobject['objectid_guid'] = $NextObjectGUIDtext;
- $thisfile_asf_dataobject['objectsize'] = $NextObjectSize;
-
- $thisfile_asf_dataobject['fileid'] = substr($DataObjectData, $offset, 16);
- $offset += 16;
- $thisfile_asf_dataobject['fileid_guid'] = $this->BytestringToGUID($thisfile_asf_dataobject['fileid']);
- $thisfile_asf_dataobject['total_data_packets'] = getid3_lib::LittleEndian2Int(substr($DataObjectData, $offset, 8));
- $offset += 8;
- $thisfile_asf_dataobject['reserved'] = getid3_lib::LittleEndian2Int(substr($DataObjectData, $offset, 2));
- $offset += 2;
- if ($thisfile_asf_dataobject['reserved'] != 0x0101) {
- $info['warning'][] = 'data_object.reserved ('.getid3_lib::PrintHexBytes($thisfile_asf_dataobject['reserved']).') does not match expected value of "0x0101"';
- //return false;
- break;
- }
-
- // Data Packets array of: variable //
- // * Error Correction Flags BYTE 8 //
- // * * Error Correction Data Length bits 4 // if Error Correction Length Type == 00, size of Error Correction Data in bytes, else hardcoded: 0000
- // * * Opaque Data Present bits 1 //
- // * * Error Correction Length Type bits 2 // number of bits for size of the error correction data. hardcoded: 00
- // * * Error Correction Present bits 1 // If set, use Opaque Data Packet structure, else use Payload structure
- // * Error Correction Data
-
- $info['avdataoffset'] = ftell($this->getid3->fp);
- fseek($this->getid3->fp, ($thisfile_asf_dataobject['objectsize'] - 50), SEEK_CUR); // skip actual audio/video data
- $info['avdataend'] = ftell($this->getid3->fp);
- break;
-
- case GETID3_ASF_Simple_Index_Object:
- // Simple Index Object: (optional, recommended, one per video stream)
- // Field Name Field Type Size (bits)
- // Object ID GUID 128 // GUID for Simple Index object - GETID3_ASF_Data_Object
- // Object Size QWORD 64 // size of Simple Index object, including 56 bytes of Simple Index Object header
- // File ID GUID 128 // unique identifier. may be zero or identical to File ID field in Data Object and Header Object
- // Index Entry Time Interval QWORD 64 // interval between index entries in 100-nanosecond units
- // Maximum Packet Count DWORD 32 // maximum packet count for all index entries
- // Index Entries Count DWORD 32 // number of Index Entries structures
- // Index Entries array of: variable //
- // * Packet Number DWORD 32 // number of the Data Packet associated with this index entry
- // * Packet Count WORD 16 // number of Data Packets to sent at this index entry
-
- // shortcut
- $thisfile_asf['simple_index_object'] = array();
- $thisfile_asf_simpleindexobject = &$thisfile_asf['simple_index_object'];
-
- $SimpleIndexObjectData = $NextObjectDataHeader.fread($this->getid3->fp, 56 - 24);
- $offset = 24;
-
- $thisfile_asf_simpleindexobject['objectid'] = $NextObjectGUID;
- $thisfile_asf_simpleindexobject['objectid_guid'] = $NextObjectGUIDtext;
- $thisfile_asf_simpleindexobject['objectsize'] = $NextObjectSize;
-
- $thisfile_asf_simpleindexobject['fileid'] = substr($SimpleIndexObjectData, $offset, 16);
- $offset += 16;
- $thisfile_asf_simpleindexobject['fileid_guid'] = $this->BytestringToGUID($thisfile_asf_simpleindexobject['fileid']);
- $thisfile_asf_simpleindexobject['index_entry_time_interval'] = getid3_lib::LittleEndian2Int(substr($SimpleIndexObjectData, $offset, 8));
- $offset += 8;
- $thisfile_asf_simpleindexobject['maximum_packet_count'] = getid3_lib::LittleEndian2Int(substr($SimpleIndexObjectData, $offset, 4));
- $offset += 4;
- $thisfile_asf_simpleindexobject['index_entries_count'] = getid3_lib::LittleEndian2Int(substr($SimpleIndexObjectData, $offset, 4));
- $offset += 4;
-
- $IndexEntriesData = $SimpleIndexObjectData.fread($this->getid3->fp, 6 * $thisfile_asf_simpleindexobject['index_entries_count']);
- for ($IndexEntriesCounter = 0; $IndexEntriesCounter < $thisfile_asf_simpleindexobject['index_entries_count']; $IndexEntriesCounter++) {
- $thisfile_asf_simpleindexobject['index_entries'][$IndexEntriesCounter]['packet_number'] = getid3_lib::LittleEndian2Int(substr($IndexEntriesData, $offset, 4));
- $offset += 4;
- $thisfile_asf_simpleindexobject['index_entries'][$IndexEntriesCounter]['packet_count'] = getid3_lib::LittleEndian2Int(substr($IndexEntriesData, $offset, 4));
- $offset += 2;
- }
-
- break;
-
- case GETID3_ASF_Index_Object:
- // 6.2 ASF top-level Index Object (optional but recommended when appropriate, 0 or 1)
- // Field Name Field Type Size (bits)
- // Object ID GUID 128 // GUID for the Index Object - GETID3_ASF_Index_Object
- // Object Size QWORD 64 // Specifies the size, in bytes, of the Index Object, including at least 34 bytes of Index Object header
- // Index Entry Time Interval DWORD 32 // Specifies the time interval between each index entry in ms.
- // Index Specifiers Count WORD 16 // Specifies the number of Index Specifiers structures in this Index Object.
- // Index Blocks Count DWORD 32 // Specifies the number of Index Blocks structures in this Index Object.
-
- // Index Entry Time Interval DWORD 32 // Specifies the time interval between index entries in milliseconds. This value cannot be 0.
- // Index Specifiers Count WORD 16 // Specifies the number of entries in the Index Specifiers list. Valid values are 1 and greater.
- // Index Specifiers array of: varies //
- // * Stream Number WORD 16 // Specifies the stream number that the Index Specifiers refer to. Valid values are between 1 and 127.
- // * Index Type WORD 16 // Specifies Index Type values as follows:
- // 1 = Nearest Past Data Packet - indexes point to the data packet whose presentation time is closest to the index entry time.
- // 2 = Nearest Past Media Object - indexes point to the closest data packet containing an entire object or first fragment of an object.
- // 3 = Nearest Past Cleanpoint. - indexes point to the closest data packet containing an entire object (or first fragment of an object) that has the Cleanpoint Flag set.
- // Nearest Past Cleanpoint is the most common type of index.
- // Index Entry Count DWORD 32 // Specifies the number of Index Entries in the block.
- // * Block Positions QWORD varies // Specifies a list of byte offsets of the beginnings of the blocks relative to the beginning of the first Data Packet (i.e., the beginning of the Data Object + 50 bytes). The number of entries in this list is specified by the value of the Index Specifiers Count field. The order of those byte offsets is tied to the order in which Index Specifiers are listed.
- // * Index Entries array of: varies //
- // * * Offsets DWORD varies // An offset value of 0xffffffff indicates an invalid offset value
-
- // shortcut
- $thisfile_asf['asf_index_object'] = array();
- $thisfile_asf_asfindexobject = &$thisfile_asf['asf_index_object'];
-
- $ASFIndexObjectData = $NextObjectDataHeader.fread($this->getid3->fp, 34 - 24);
- $offset = 24;
-
- $thisfile_asf_asfindexobject['objectid'] = $NextObjectGUID;
- $thisfile_asf_asfindexobject['objectid_guid'] = $NextObjectGUIDtext;
- $thisfile_asf_asfindexobject['objectsize'] = $NextObjectSize;
-
- $thisfile_asf_asfindexobject['entry_time_interval'] = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 4));
- $offset += 4;
- $thisfile_asf_asfindexobject['index_specifiers_count'] = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 2));
- $offset += 2;
- $thisfile_asf_asfindexobject['index_blocks_count'] = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 4));
- $offset += 4;
-
- $ASFIndexObjectData .= fread($this->getid3->fp, 4 * $thisfile_asf_asfindexobject['index_specifiers_count']);
- for ($IndexSpecifiersCounter = 0; $IndexSpecifiersCounter < $thisfile_asf_asfindexobject['index_specifiers_count']; $IndexSpecifiersCounter++) {
- $IndexSpecifierStreamNumber = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 2));
- $offset += 2;
- $thisfile_asf_asfindexobject['index_specifiers'][$IndexSpecifiersCounter]['stream_number'] = $IndexSpecifierStreamNumber;
- $thisfile_asf_asfindexobject['index_specifiers'][$IndexSpecifiersCounter]['index_type'] = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 2));
- $offset += 2;
- $thisfile_asf_asfindexobject['index_specifiers'][$IndexSpecifiersCounter]['index_type_text'] = $this->ASFIndexObjectIndexTypeLookup($thisfile_asf_asfindexobject['index_specifiers'][$IndexSpecifiersCounter]['index_type']);
- }
-
- $ASFIndexObjectData .= fread($this->getid3->fp, 4);
- $thisfile_asf_asfindexobject['index_entry_count'] = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 4));
- $offset += 4;
-
- $ASFIndexObjectData .= fread($this->getid3->fp, 8 * $thisfile_asf_asfindexobject['index_specifiers_count']);
- for ($IndexSpecifiersCounter = 0; $IndexSpecifiersCounter < $thisfile_asf_asfindexobject['index_specifiers_count']; $IndexSpecifiersCounter++) {
- $thisfile_asf_asfindexobject['block_positions'][$IndexSpecifiersCounter] = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 8));
- $offset += 8;
- }
-
- $ASFIndexObjectData .= fread($this->getid3->fp, 4 * $thisfile_asf_asfindexobject['index_specifiers_count'] * $thisfile_asf_asfindexobject['index_entry_count']);
- for ($IndexEntryCounter = 0; $IndexEntryCounter < $thisfile_asf_asfindexobject['index_entry_count']; $IndexEntryCounter++) {
- for ($IndexSpecifiersCounter = 0; $IndexSpecifiersCounter < $thisfile_asf_asfindexobject['index_specifiers_count']; $IndexSpecifiersCounter++) {
- $thisfile_asf_asfindexobject['offsets'][$IndexSpecifiersCounter][$IndexEntryCounter] = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 4));
- $offset += 4;
- }
- }
- break;
-
-
- default:
- // Implementations shall ignore any standard or non-standard object that they do not know how to handle.
- if ($this->GUIDname($NextObjectGUIDtext)) {
- $info['warning'][] = 'unhandled GUID "'.$this->GUIDname($NextObjectGUIDtext).'" {'.$NextObjectGUIDtext.'} in ASF body at offset '.($offset - 16 - 8);
- } else {
- $info['warning'][] = 'unknown GUID {'.$NextObjectGUIDtext.'} in ASF body at offset '.(ftell($this->getid3->fp) - 16 - 8);
- }
- fseek($this->getid3->fp, ($NextObjectSize - 16 - 8), SEEK_CUR);
- break;
- }
- }
-
- if (isset($thisfile_asf_codeclistobject['codec_entries']) && is_array($thisfile_asf_codeclistobject['codec_entries'])) {
- foreach ($thisfile_asf_codeclistobject['codec_entries'] as $streamnumber => $streamdata) {
- switch ($streamdata['information']) {
- case 'WMV1':
- case 'WMV2':
- case 'WMV3':
- case 'MSS1':
- case 'MSS2':
- case 'WMVA':
- case 'WVC1':
- case 'WMVP':
- case 'WVP2':
- $thisfile_video['dataformat'] = 'wmv';
- $info['mime_type'] = 'video/x-ms-wmv';
- break;
-
- case 'MP42':
- case 'MP43':
- case 'MP4S':
- case 'mp4s':
- $thisfile_video['dataformat'] = 'asf';
- $info['mime_type'] = 'video/x-ms-asf';
- break;
-
- default:
- switch ($streamdata['type_raw']) {
- case 1:
- if (strstr($this->TrimConvert($streamdata['name']), 'Windows Media')) {
- $thisfile_video['dataformat'] = 'wmv';
- if ($info['mime_type'] == 'video/x-ms-asf') {
- $info['mime_type'] = 'video/x-ms-wmv';
- }
- }
- break;
-
- case 2:
- if (strstr($this->TrimConvert($streamdata['name']), 'Windows Media')) {
- $thisfile_audio['dataformat'] = 'wma';
- if ($info['mime_type'] == 'video/x-ms-asf') {
- $info['mime_type'] = 'audio/x-ms-wma';
- }
- }
- break;
-
- }
- break;
- }
- }
- }
-
- switch (isset($thisfile_audio['codec']) ? $thisfile_audio['codec'] : '') {
- case 'MPEG Layer-3':
- $thisfile_audio['dataformat'] = 'mp3';
- break;
-
- default:
- break;
- }
-
- if (isset($thisfile_asf_codeclistobject['codec_entries'])) {
- foreach ($thisfile_asf_codeclistobject['codec_entries'] as $streamnumber => $streamdata) {
- switch ($streamdata['type_raw']) {
-
- case 1: // video
- $thisfile_video['encoder'] = $this->TrimConvert($thisfile_asf_codeclistobject['codec_entries'][$streamnumber]['name']);
- break;
-
- case 2: // audio
- $thisfile_audio['encoder'] = $this->TrimConvert($thisfile_asf_codeclistobject['codec_entries'][$streamnumber]['name']);
-
- // AH 2003-10-01
- $thisfile_audio['encoder_options'] = $this->TrimConvert($thisfile_asf_codeclistobject['codec_entries'][0]['description']);
-
- $thisfile_audio['codec'] = $thisfile_audio['encoder'];
- break;
-
- default:
- $info['warning'][] = 'Unknown streamtype: [codec_list_object][codec_entries]['.$streamnumber.'][type_raw] == '.$streamdata['type_raw'];
- break;
-
- }
- }
- }
-
- if (isset($info['audio'])) {
- $thisfile_audio['lossless'] = (isset($thisfile_audio['lossless']) ? $thisfile_audio['lossless'] : false);
- $thisfile_audio['dataformat'] = (!empty($thisfile_audio['dataformat']) ? $thisfile_audio['dataformat'] : 'asf');
- }
- if (!empty($thisfile_video['dataformat'])) {
- $thisfile_video['lossless'] = (isset($thisfile_audio['lossless']) ? $thisfile_audio['lossless'] : false);
- $thisfile_video['pixel_aspect_ratio'] = (isset($thisfile_audio['pixel_aspect_ratio']) ? $thisfile_audio['pixel_aspect_ratio'] : (float) 1);
- $thisfile_video['dataformat'] = (!empty($thisfile_video['dataformat']) ? $thisfile_video['dataformat'] : 'asf');
- }
- if (!empty($thisfile_video['streams'])) {
- $thisfile_video['streams']['resolution_x'] = 0;
- $thisfile_video['streams']['resolution_y'] = 0;
- foreach ($thisfile_video['streams'] as $key => $valuearray) {
- if (($valuearray['resolution_x'] > $thisfile_video['streams']['resolution_x']) || ($valuearray['resolution_y'] > $thisfile_video['streams']['resolution_y'])) {
- $thisfile_video['resolution_x'] = $valuearray['resolution_x'];
- $thisfile_video['resolution_y'] = $valuearray['resolution_y'];
- }
- }
- }
- $info['bitrate'] = (isset($thisfile_audio['bitrate']) ? $thisfile_audio['bitrate'] : 0) + (isset($thisfile_video['bitrate']) ? $thisfile_video['bitrate'] : 0);
-
- if ((!isset($info['playtime_seconds']) || ($info['playtime_seconds'] <= 0)) && ($info['bitrate'] > 0)) {
- $info['playtime_seconds'] = ($info['filesize'] - $info['avdataoffset']) / ($info['bitrate'] / 8);
- }
-
- return true;
- }
-
- static function ASFCodecListObjectTypeLookup($CodecListType) {
- static $ASFCodecListObjectTypeLookup = array();
- if (empty($ASFCodecListObjectTypeLookup)) {
- $ASFCodecListObjectTypeLookup[0x0001] = 'Video Codec';
- $ASFCodecListObjectTypeLookup[0x0002] = 'Audio Codec';
- $ASFCodecListObjectTypeLookup[0xFFFF] = 'Unknown Codec';
- }
-
- return (isset($ASFCodecListObjectTypeLookup[$CodecListType]) ? $ASFCodecListObjectTypeLookup[$CodecListType] : 'Invalid Codec Type');
- }
-
- static function KnownGUIDs() {
- static $GUIDarray = array(
- 'GETID3_ASF_Extended_Stream_Properties_Object' => '14E6A5CB-C672-4332-8399-A96952065B5A',
- 'GETID3_ASF_Padding_Object' => '1806D474-CADF-4509-A4BA-9AABCB96AAE8',
- 'GETID3_ASF_Payload_Ext_Syst_Pixel_Aspect_Ratio' => '1B1EE554-F9EA-4BC8-821A-376B74E4C4B8',
- 'GETID3_ASF_Script_Command_Object' => '1EFB1A30-0B62-11D0-A39B-00A0C90348F6',
- 'GETID3_ASF_No_Error_Correction' => '20FB5700-5B55-11CF-A8FD-00805F5C442B',
- 'GETID3_ASF_Content_Branding_Object' => '2211B3FA-BD23-11D2-B4B7-00A0C955FC6E',
- 'GETID3_ASF_Content_Encryption_Object' => '2211B3FB-BD23-11D2-B4B7-00A0C955FC6E',
- 'GETID3_ASF_Digital_Signature_Object' => '2211B3FC-BD23-11D2-B4B7-00A0C955FC6E',
- 'GETID3_ASF_Extended_Content_Encryption_Object' => '298AE614-2622-4C17-B935-DAE07EE9289C',
- 'GETID3_ASF_Simple_Index_Object' => '33000890-E5B1-11CF-89F4-00A0C90349CB',
- 'GETID3_ASF_Degradable_JPEG_Media' => '35907DE0-E415-11CF-A917-00805F5C442B',
- 'GETID3_ASF_Payload_Extension_System_Timecode' => '399595EC-8667-4E2D-8FDB-98814CE76C1E',
- 'GETID3_ASF_Binary_Media' => '3AFB65E2-47EF-40F2-AC2C-70A90D71D343',
- 'GETID3_ASF_Timecode_Index_Object' => '3CB73FD0-0C4A-4803-953D-EDF7B6228F0C',
- 'GETID3_ASF_Metadata_Library_Object' => '44231C94-9498-49D1-A141-1D134E457054',
- 'GETID3_ASF_Reserved_3' => '4B1ACBE3-100B-11D0-A39B-00A0C90348F6',
- 'GETID3_ASF_Reserved_4' => '4CFEDB20-75F6-11CF-9C0F-00A0C90349CB',
- 'GETID3_ASF_Command_Media' => '59DACFC0-59E6-11D0-A3AC-00A0C90348F6',
- 'GETID3_ASF_Header_Extension_Object' => '5FBF03B5-A92E-11CF-8EE3-00C00C205365',
- 'GETID3_ASF_Media_Object_Index_Parameters_Obj' => '6B203BAD-3F11-4E84-ACA8-D7613DE2CFA7',
- 'GETID3_ASF_Header_Object' => '75B22630-668E-11CF-A6D9-00AA0062CE6C',
- 'GETID3_ASF_Content_Description_Object' => '75B22633-668E-11CF-A6D9-00AA0062CE6C',
- 'GETID3_ASF_Error_Correction_Object' => '75B22635-668E-11CF-A6D9-00AA0062CE6C',
- 'GETID3_ASF_Data_Object' => '75B22636-668E-11CF-A6D9-00AA0062CE6C',
- 'GETID3_ASF_Web_Stream_Media_Subtype' => '776257D4-C627-41CB-8F81-7AC7FF1C40CC',
- 'GETID3_ASF_Stream_Bitrate_Properties_Object' => '7BF875CE-468D-11D1-8D82-006097C9A2B2',
- 'GETID3_ASF_Language_List_Object' => '7C4346A9-EFE0-4BFC-B229-393EDE415C85',
- 'GETID3_ASF_Codec_List_Object' => '86D15240-311D-11D0-A3A4-00A0C90348F6',
- 'GETID3_ASF_Reserved_2' => '86D15241-311D-11D0-A3A4-00A0C90348F6',
- 'GETID3_ASF_File_Properties_Object' => '8CABDCA1-A947-11CF-8EE4-00C00C205365',
- 'GETID3_ASF_File_Transfer_Media' => '91BD222C-F21C-497A-8B6D-5AA86BFC0185',
- 'GETID3_ASF_Old_RTP_Extension_Data' => '96800C63-4C94-11D1-837B-0080C7A37F95',
- 'GETID3_ASF_Advanced_Mutual_Exclusion_Object' => 'A08649CF-4775-4670-8A16-6E35357566CD',
- 'GETID3_ASF_Bandwidth_Sharing_Object' => 'A69609E6-517B-11D2-B6AF-00C04FD908E9',
- 'GETID3_ASF_Reserved_1' => 'ABD3D211-A9BA-11cf-8EE6-00C00C205365',
- 'GETID3_ASF_Bandwidth_Sharing_Exclusive' => 'AF6060AA-5197-11D2-B6AF-00C04FD908E9',
- 'GETID3_ASF_Bandwidth_Sharing_Partial' => 'AF6060AB-5197-11D2-B6AF-00C04FD908E9',
- 'GETID3_ASF_JFIF_Media' => 'B61BE100-5B4E-11CF-A8FD-00805F5C442B',
- 'GETID3_ASF_Stream_Properties_Object' => 'B7DC0791-A9B7-11CF-8EE6-00C00C205365',
- 'GETID3_ASF_Video_Media' => 'BC19EFC0-5B4D-11CF-A8FD-00805F5C442B',
- 'GETID3_ASF_Audio_Spread' => 'BFC3CD50-618F-11CF-8BB2-00AA00B4E220',
- 'GETID3_ASF_Metadata_Object' => 'C5F8CBEA-5BAF-4877-8467-AA8C44FA4CCA',
- 'GETID3_ASF_Payload_Ext_Syst_Sample_Duration' => 'C6BD9450-867F-4907-83A3-C77921B733AD',
- 'GETID3_ASF_Group_Mutual_Exclusion_Object' => 'D1465A40-5A79-4338-B71B-E36B8FD6C249',
- 'GETID3_ASF_Extended_Content_Description_Object' => 'D2D0A440-E307-11D2-97F0-00A0C95EA850',
- 'GETID3_ASF_Stream_Prioritization_Object' => 'D4FED15B-88D3-454F-81F0-ED5C45999E24',
- 'GETID3_ASF_Payload_Ext_System_Content_Type' => 'D590DC20-07BC-436C-9CF7-F3BBFBF1A4DC',
- 'GETID3_ASF_Old_File_Properties_Object' => 'D6E229D0-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_ASF_Header_Object' => 'D6E229D1-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_ASF_Data_Object' => 'D6E229D2-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Index_Object' => 'D6E229D3-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_Stream_Properties_Object' => 'D6E229D4-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_Content_Description_Object' => 'D6E229D5-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_Script_Command_Object' => 'D6E229D6-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_Marker_Object' => 'D6E229D7-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_Component_Download_Object' => 'D6E229D8-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_Stream_Group_Object' => 'D6E229D9-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_Scalable_Object' => 'D6E229DA-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_Prioritization_Object' => 'D6E229DB-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Bitrate_Mutual_Exclusion_Object' => 'D6E229DC-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_Inter_Media_Dependency_Object' => 'D6E229DD-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_Rating_Object' => 'D6E229DE-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Index_Parameters_Object' => 'D6E229DF-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_Color_Table_Object' => 'D6E229E0-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_Language_List_Object' => 'D6E229E1-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_Audio_Media' => 'D6E229E2-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_Video_Media' => 'D6E229E3-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_Image_Media' => 'D6E229E4-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_Timecode_Media' => 'D6E229E5-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_Text_Media' => 'D6E229E6-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_MIDI_Media' => 'D6E229E7-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_Command_Media' => 'D6E229E8-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_No_Error_Concealment' => 'D6E229EA-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_Scrambled_Audio' => 'D6E229EB-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_No_Color_Table' => 'D6E229EC-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_SMPTE_Time' => 'D6E229ED-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_ASCII_Text' => 'D6E229EE-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_Unicode_Text' => 'D6E229EF-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_HTML_Text' => 'D6E229F0-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_URL_Command' => 'D6E229F1-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_Filename_Command' => 'D6E229F2-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_ACM_Codec' => 'D6E229F3-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_VCM_Codec' => 'D6E229F4-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_QuickTime_Codec' => 'D6E229F5-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_DirectShow_Transform_Filter' => 'D6E229F6-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_DirectShow_Rendering_Filter' => 'D6E229F7-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_No_Enhancement' => 'D6E229F8-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_Unknown_Enhancement_Type' => 'D6E229F9-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_Temporal_Enhancement' => 'D6E229FA-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_Spatial_Enhancement' => 'D6E229FB-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_Quality_Enhancement' => 'D6E229FC-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_Number_of_Channels_Enhancement' => 'D6E229FD-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_Frequency_Response_Enhancement' => 'D6E229FE-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_Media_Object' => 'D6E229FF-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Mutex_Language' => 'D6E22A00-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Mutex_Bitrate' => 'D6E22A01-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Mutex_Unknown' => 'D6E22A02-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_ASF_Placeholder_Object' => 'D6E22A0E-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Old_Data_Unit_Extension_Object' => 'D6E22A0F-35DA-11D1-9034-00A0C90349BE',
- 'GETID3_ASF_Web_Stream_Format' => 'DA1E6B13-8359-4050-B398-388E965BF00C',
- 'GETID3_ASF_Payload_Ext_System_File_Name' => 'E165EC0E-19ED-45D7-B4A7-25CBD1E28E9B',
- 'GETID3_ASF_Marker_Object' => 'F487CD01-A951-11CF-8EE6-00C00C205365',
- 'GETID3_ASF_Timecode_Index_Parameters_Object' => 'F55E496D-9797-4B5D-8C8B-604DFE9BFB24',
- 'GETID3_ASF_Audio_Media' => 'F8699E40-5B4D-11CF-A8FD-00805F5C442B',
- 'GETID3_ASF_Media_Object_Index_Object' => 'FEB103F8-12AD-4C64-840F-2A1D2F7AD48C',
- 'GETID3_ASF_Alt_Extended_Content_Encryption_Obj' => 'FF889EF1-ADEE-40DA-9E71-98704BB928CE',
- 'GETID3_ASF_Index_Placeholder_Object' => 'D9AADE20-7C17-4F9C-BC28-8555DD98E2A2', // http://cpan.uwinnipeg.ca/htdocs/Audio-WMA/Audio/WMA.pm.html
- 'GETID3_ASF_Compatibility_Object' => '26F18B5D-4584-47EC-9F5F-0E651F0452C9', // http://cpan.uwinnipeg.ca/htdocs/Audio-WMA/Audio/WMA.pm.html
- );
- return $GUIDarray;
- }
-
- static function GUIDname($GUIDstring) {
- static $GUIDarray = array();
- if (empty($GUIDarray)) {
- $GUIDarray = getid3_asf::KnownGUIDs();
- }
- return array_search($GUIDstring, $GUIDarray);
- }
-
- static function ASFIndexObjectIndexTypeLookup($id) {
- static $ASFIndexObjectIndexTypeLookup = array();
- if (empty($ASFIndexObjectIndexTypeLookup)) {
- $ASFIndexObjectIndexTypeLookup[1] = 'Nearest Past Data Packet';
- $ASFIndexObjectIndexTypeLookup[2] = 'Nearest Past Media Object';
- $ASFIndexObjectIndexTypeLookup[3] = 'Nearest Past Cleanpoint';
- }
- return (isset($ASFIndexObjectIndexTypeLookup[$id]) ? $ASFIndexObjectIndexTypeLookup[$id] : 'invalid');
- }
-
- static function GUIDtoBytestring($GUIDstring) {
- // Microsoft defines these 16-byte (128-bit) GUIDs in the strangest way:
- // first 4 bytes are in little-endian order
- // next 2 bytes are appended in little-endian order
- // next 2 bytes are appended in little-endian order
- // next 2 bytes are appended in big-endian order
- // next 6 bytes are appended in big-endian order
-
- // AaBbCcDd-EeFf-GgHh-IiJj-KkLlMmNnOoPp is stored as this 16-byte string:
- // $Dd $Cc $Bb $Aa $Ff $Ee $Hh $Gg $Ii $Jj $Kk $Ll $Mm $Nn $Oo $Pp
-
- $hexbytecharstring = chr(hexdec(substr($GUIDstring, 6, 2)));
- $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 4, 2)));
- $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 2, 2)));
- $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 0, 2)));
-
- $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 11, 2)));
- $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 9, 2)));
-
- $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 16, 2)));
- $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 14, 2)));
-
- $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 19, 2)));
- $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 21, 2)));
-
- $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 24, 2)));
- $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 26, 2)));
- $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 28, 2)));
- $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 30, 2)));
- $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 32, 2)));
- $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 34, 2)));
-
- return $hexbytecharstring;
- }
-
- static function BytestringToGUID($Bytestring) {
- $GUIDstring = str_pad(dechex(ord($Bytestring{3})), 2, '0', STR_PAD_LEFT);
- $GUIDstring .= str_pad(dechex(ord($Bytestring{2})), 2, '0', STR_PAD_LEFT);
- $GUIDstring .= str_pad(dechex(ord($Bytestring{1})), 2, '0', STR_PAD_LEFT);
- $GUIDstring .= str_pad(dechex(ord($Bytestring{0})), 2, '0', STR_PAD_LEFT);
- $GUIDstring .= '-';
- $GUIDstring .= str_pad(dechex(ord($Bytestring{5})), 2, '0', STR_PAD_LEFT);
- $GUIDstring .= str_pad(dechex(ord($Bytestring{4})), 2, '0', STR_PAD_LEFT);
- $GUIDstring .= '-';
- $GUIDstring .= str_pad(dechex(ord($Bytestring{7})), 2, '0', STR_PAD_LEFT);
- $GUIDstring .= str_pad(dechex(ord($Bytestring{6})), 2, '0', STR_PAD_LEFT);
- $GUIDstring .= '-';
- $GUIDstring .= str_pad(dechex(ord($Bytestring{8})), 2, '0', STR_PAD_LEFT);
- $GUIDstring .= str_pad(dechex(ord($Bytestring{9})), 2, '0', STR_PAD_LEFT);
- $GUIDstring .= '-';
- $GUIDstring .= str_pad(dechex(ord($Bytestring{10})), 2, '0', STR_PAD_LEFT);
- $GUIDstring .= str_pad(dechex(ord($Bytestring{11})), 2, '0', STR_PAD_LEFT);
- $GUIDstring .= str_pad(dechex(ord($Bytestring{12})), 2, '0', STR_PAD_LEFT);
- $GUIDstring .= str_pad(dechex(ord($Bytestring{13})), 2, '0', STR_PAD_LEFT);
- $GUIDstring .= str_pad(dechex(ord($Bytestring{14})), 2, '0', STR_PAD_LEFT);
- $GUIDstring .= str_pad(dechex(ord($Bytestring{15})), 2, '0', STR_PAD_LEFT);
-
- return strtoupper($GUIDstring);
- }
-
- static function FILETIMEtoUNIXtime($FILETIME, $round=true) {
- // FILETIME is a 64-bit unsigned integer representing
- // the number of 100-nanosecond intervals since January 1, 1601
- // UNIX timestamp is number of seconds since January 1, 1970
- // 116444736000000000 = 10000000 * 60 * 60 * 24 * 365 * 369 + 89 leap days
- if ($round) {
- return intval(round(($FILETIME - 116444736000000000) / 10000000));
- }
- return ($FILETIME - 116444736000000000) / 10000000;
- }
-
- static function WMpictureTypeLookup($WMpictureType) {
- static $WMpictureTypeLookup = array();
- if (empty($WMpictureTypeLookup)) {
- $WMpictureTypeLookup[0x03] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Front Cover');
- $WMpictureTypeLookup[0x04] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Back Cover');
- $WMpictureTypeLookup[0x00] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'User Defined');
- $WMpictureTypeLookup[0x05] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Leaflet Page');
- $WMpictureTypeLookup[0x06] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Media Label');
- $WMpictureTypeLookup[0x07] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Lead Artist');
- $WMpictureTypeLookup[0x08] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Artist');
- $WMpictureTypeLookup[0x09] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Conductor');
- $WMpictureTypeLookup[0x0A] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Band');
- $WMpictureTypeLookup[0x0B] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Composer');
- $WMpictureTypeLookup[0x0C] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Lyricist');
- $WMpictureTypeLookup[0x0D] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Recording Location');
- $WMpictureTypeLookup[0x0E] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'During Recording');
- $WMpictureTypeLookup[0x0F] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'During Performance');
- $WMpictureTypeLookup[0x10] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Video Screen Capture');
- $WMpictureTypeLookup[0x12] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Illustration');
- $WMpictureTypeLookup[0x13] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Band Logotype');
- $WMpictureTypeLookup[0x14] = getid3_lib::iconv_fallback('ISO-8859-1', 'UTF-16LE', 'Publisher Logotype');
- }
- return (isset($WMpictureTypeLookup[$WMpictureType]) ? $WMpictureTypeLookup[$WMpictureType] : '');
- }
-
- function ASF_HeaderExtensionObjectDataParse(&$asf_header_extension_object_data, &$unhandled_sections) {
- // http://msdn.microsoft.com/en-us/library/bb643323.aspx
-
- $offset = 0;
- $objectOffset = 0;
- $HeaderExtensionObjectParsed = array();
- while ($objectOffset < strlen($asf_header_extension_object_data)) {
- $offset = $objectOffset;
- $thisObject = array();
-
- $thisObject['guid'] = substr($asf_header_extension_object_data, $offset, 16);
- $offset += 16;
- $thisObject['guid_text'] = $this->BytestringToGUID($thisObject['guid']);
- $thisObject['guid_name'] = $this->GUIDname($thisObject['guid_text']);
-
- $thisObject['size'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 8));
- $offset += 8;
- if ($thisObject['size'] <= 0) {
- break;
- }
-
- switch ($thisObject['guid']) {
- case GETID3_ASF_Extended_Stream_Properties_Object:
- $thisObject['start_time'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 8));
- $offset += 8;
- $thisObject['start_time_unix'] = $this->FILETIMEtoUNIXtime($thisObject['start_time']);
-
- $thisObject['end_time'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 8));
- $offset += 8;
- $thisObject['end_time_unix'] = $this->FILETIMEtoUNIXtime($thisObject['end_time']);
-
- $thisObject['data_bitrate'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4));
- $offset += 4;
-
- $thisObject['buffer_size'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4));
- $offset += 4;
-
- $thisObject['initial_buffer_fullness'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4));
- $offset += 4;
-
- $thisObject['alternate_data_bitrate'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4));
- $offset += 4;
-
- $thisObject['alternate_buffer_size'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4));
- $offset += 4;
-
- $thisObject['alternate_initial_buffer_fullness'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4));
- $offset += 4;
-
- $thisObject['maximum_object_size'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4));
- $offset += 4;
-
- $thisObject['flags_raw'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4));
- $offset += 4;
- $thisObject['flags']['reliable'] = (bool) $thisObject['flags_raw'] & 0x00000001;
- $thisObject['flags']['seekable'] = (bool) $thisObject['flags_raw'] & 0x00000002;
- $thisObject['flags']['no_cleanpoints'] = (bool) $thisObject['flags_raw'] & 0x00000004;
- $thisObject['flags']['resend_live_cleanpoints'] = (bool) $thisObject['flags_raw'] & 0x00000008;
-
- $thisObject['stream_number'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
- $offset += 2;
-
- $thisObject['stream_language_id_index'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
- $offset += 2;
-
- $thisObject['average_time_per_frame'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4));
- $offset += 4;
-
- $thisObject['stream_name_count'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
- $offset += 2;
-
- $thisObject['payload_extension_system_count'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
- $offset += 2;
-
- for ($i = 0; $i < $thisObject['stream_name_count']; $i++) {
- $streamName = array();
-
- $streamName['language_id_index'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
- $offset += 2;
-
- $streamName['stream_name_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
- $offset += 2;
-
- $streamName['stream_name'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, $streamName['stream_name_length']));
- $offset += $streamName['stream_name_length'];
-
- $thisObject['stream_names'][$i] = $streamName;
- }
-
- for ($i = 0; $i < $thisObject['payload_extension_system_count']; $i++) {
- $payloadExtensionSystem = array();
-
- $payloadExtensionSystem['extension_system_id'] = substr($asf_header_extension_object_data, $offset, 16);
- $offset += 16;
- $payloadExtensionSystem['extension_system_id_text'] = $this->BytestringToGUID($payloadExtensionSystem['extension_system_id']);
-
- $payloadExtensionSystem['extension_system_size'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
- $offset += 2;
- if ($payloadExtensionSystem['extension_system_size'] <= 0) {
- break 2;
- }
-
- $payloadExtensionSystem['extension_system_info_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4));
- $offset += 4;
-
- $payloadExtensionSystem['extension_system_info_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, $payloadExtensionSystem['extension_system_info_length']));
- $offset += $payloadExtensionSystem['extension_system_info_length'];
-
- $thisObject['payload_extension_systems'][$i] = $payloadExtensionSystem;
- }
-
- break;
-
- case GETID3_ASF_Padding_Object:
- // padding, skip it
- break;
-
- case GETID3_ASF_Metadata_Object:
- $thisObject['description_record_counts'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
- $offset += 2;
-
- for ($i = 0; $i < $thisObject['description_record_counts']; $i++) {
- $descriptionRecord = array();
-
- $descriptionRecord['reserved_1'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); // must be zero
- $offset += 2;
-
- $descriptionRecord['stream_number'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
- $offset += 2;
-
- $descriptionRecord['name_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
- $offset += 2;
-
- $descriptionRecord['data_type'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
- $offset += 2;
- $descriptionRecord['data_type_text'] = $this->ASFmetadataLibraryObjectDataTypeLookup($descriptionRecord['data_type']);
-
- $descriptionRecord['data_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4));
- $offset += 4;
-
- $descriptionRecord['name'] = substr($asf_header_extension_object_data, $offset, $descriptionRecord['name_length']);
- $offset += $descriptionRecord['name_length'];
-
- $descriptionRecord['data'] = substr($asf_header_extension_object_data, $offset, $descriptionRecord['data_length']);
- $offset += $descriptionRecord['data_length'];
- switch ($descriptionRecord['data_type']) {
- case 0x0000: // Unicode string
- break;
-
- case 0x0001: // BYTE array
- // do nothing
- break;
-
- case 0x0002: // BOOL
- $descriptionRecord['data'] = (bool) getid3_lib::LittleEndian2Int($descriptionRecord['data']);
- break;
-
- case 0x0003: // DWORD
- case 0x0004: // QWORD
- case 0x0005: // WORD
- $descriptionRecord['data'] = getid3_lib::LittleEndian2Int($descriptionRecord['data']);
- break;
-
- case 0x0006: // GUID
- $descriptionRecord['data_text'] = $this->BytestringToGUID($descriptionRecord['data']);
- break;
- }
-
- $thisObject['description_record'][$i] = $descriptionRecord;
- }
- break;
-
- case GETID3_ASF_Language_List_Object:
- $thisObject['language_id_record_counts'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
- $offset += 2;
-
- for ($i = 0; $i < $thisObject['language_id_record_counts']; $i++) {
- $languageIDrecord = array();
-
- $languageIDrecord['language_id_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 1));
- $offset += 1;
-
- $languageIDrecord['language_id'] = substr($asf_header_extension_object_data, $offset, $languageIDrecord['language_id_length']);
- $offset += $languageIDrecord['language_id_length'];
-
- $thisObject['language_id_record'][$i] = $languageIDrecord;
- }
- break;
-
- case GETID3_ASF_Metadata_Library_Object:
- $thisObject['description_records_count'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
- $offset += 2;
-
- for ($i = 0; $i < $thisObject['description_records_count']; $i++) {
- $descriptionRecord = array();
-
- $descriptionRecord['language_list_index'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
- $offset += 2;
-
- $descriptionRecord['stream_number'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
- $offset += 2;
-
- $descriptionRecord['name_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
- $offset += 2;
-
- $descriptionRecord['data_type'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
- $offset += 2;
- $descriptionRecord['data_type_text'] = $this->ASFmetadataLibraryObjectDataTypeLookup($descriptionRecord['data_type']);
-
- $descriptionRecord['data_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4));
- $offset += 4;
-
- $descriptionRecord['name'] = substr($asf_header_extension_object_data, $offset, $descriptionRecord['name_length']);
- $offset += $descriptionRecord['name_length'];
-
- $descriptionRecord['data'] = substr($asf_header_extension_object_data, $offset, $descriptionRecord['data_length']);
- $offset += $descriptionRecord['data_length'];
-
- if (preg_match('#^WM/Picture$#', str_replace("\x00", '', trim($descriptionRecord['name'])))) {
- $WMpicture = $this->ASF_WMpicture($descriptionRecord['data']);
- foreach ($WMpicture as $key => $value) {
- $descriptionRecord['data'] = $WMpicture;
- }
- unset($WMpicture);
- }
-
- $thisObject['description_record'][$i] = $descriptionRecord;
- }
- break;
-
- default:
- $unhandled_sections++;
- if ($this->GUIDname($thisObject['guid_text'])) {
- $this->getid3->info['warning'][] = 'unhandled Header Extension Object GUID "'.$this->GUIDname($thisObject['guid_text']).'" {'.$thisObject['guid_text'].'} at offset '.($offset - 16 - 8);
- } else {
- $this->getid3->info['warning'][] = 'unknown Header Extension Object GUID {'.$thisObject['guid_text'].'} in at offset '.($offset - 16 - 8);
- }
- break;
- }
- $HeaderExtensionObjectParsed[] = $thisObject;
-
- $objectOffset += $thisObject['size'];
- }
- return $HeaderExtensionObjectParsed;
- }
-
-
- static function ASFmetadataLibraryObjectDataTypeLookup($id) {
- static $ASFmetadataLibraryObjectDataTypeLookup = array(
- 0x0000 => 'Unicode string', // The data consists of a sequence of Unicode characters
- 0x0001 => 'BYTE array', // The type of the data is implementation-specific
- 0x0002 => 'BOOL', // The data is 2 bytes long and should be interpreted as a 16-bit unsigned integer. Only 0x0000 or 0x0001 are permitted values
- 0x0003 => 'DWORD', // The data is 4 bytes long and should be interpreted as a 32-bit unsigned integer
- 0x0004 => 'QWORD', // The data is 8 bytes long and should be interpreted as a 64-bit unsigned integer
- 0x0005 => 'WORD', // The data is 2 bytes long and should be interpreted as a 16-bit unsigned integer
- 0x0006 => 'GUID', // The data is 16 bytes long and should be interpreted as a 128-bit GUID
- );
- return (isset($ASFmetadataLibraryObjectDataTypeLookup[$id]) ? $ASFmetadataLibraryObjectDataTypeLookup[$id] : 'invalid');
- }
-
- function ASF_WMpicture(&$data) {
- //typedef struct _WMPicture{
- // LPWSTR pwszMIMEType;
- // BYTE bPictureType;
- // LPWSTR pwszDescription;
- // DWORD dwDataLen;
- // BYTE* pbData;
- //} WM_PICTURE;
-
- $WMpicture = array();
-
- $offset = 0;
- $WMpicture['image_type_id'] = getid3_lib::LittleEndian2Int(substr($data, $offset, 1));
- $offset += 1;
- $WMpicture['image_type'] = $this->WMpictureTypeLookup($WMpicture['image_type_id']);
- $WMpicture['image_size'] = getid3_lib::LittleEndian2Int(substr($data, $offset, 4));
- $offset += 4;
-
- $WMpicture['image_mime'] = '';
- do {
- $next_byte_pair = substr($data, $offset, 2);
- $offset += 2;
- $WMpicture['image_mime'] .= $next_byte_pair;
- } while ($next_byte_pair !== "\x00\x00");
-
- $WMpicture['image_description'] = '';
- do {
- $next_byte_pair = substr($data, $offset, 2);
- $offset += 2;
- $WMpicture['image_description'] .= $next_byte_pair;
- } while ($next_byte_pair !== "\x00\x00");
-
- $WMpicture['dataoffset'] = $offset;
- $WMpicture['data'] = substr($data, $offset);
-
- $imageinfo = array();
- $WMpicture['image_mime'] = '';
- $imagechunkcheck = getid3_lib::GetDataImageSize($WMpicture['data'], $imageinfo);
- unset($imageinfo);
- if (!empty($imagechunkcheck)) {
- $WMpicture['image_mime'] = image_type_to_mime_type($imagechunkcheck[2]);
- }
- if (!isset($this->getid3->info['asf']['comments']['picture'])) {
- $this->getid3->info['asf']['comments']['picture'] = array();
- }
- $this->getid3->info['asf']['comments']['picture'][] = array('data'=>$WMpicture['data'], 'image_mime'=>$WMpicture['image_mime']);
-
- return $WMpicture;
- }
-
-
- // Remove terminator 00 00 and convert UTF-16LE to Latin-1
- static function TrimConvert($string) {
- return trim(getid3_lib::iconv_fallback('UTF-16LE', 'ISO-8859-1', getid3_asf::TrimTerm($string)), ' ');
- }
-
-
- // Remove terminator 00 00
- static function TrimTerm($string) {
- // remove terminator, only if present (it should be, but...)
- if (substr($string, -2) === "\x00\x00") {
- $string = substr($string, 0, -2);
- }
- return $string;
- }
-
-}
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.audio-video.bink.php b/3rdparty/getid3/module.audio-video.bink.php
deleted file mode 100644
index 0a321396765..00000000000
--- a/3rdparty/getid3/module.audio-video.bink.php
+++ /dev/null
@@ -1,73 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.audio.bink.php //
-// module for analyzing Bink or Smacker audio-video files //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_bink extends getid3_handler
-{
-
- function Analyze() {
- $info = &$this->getid3->info;
-
-$info['error'][] = 'Bink / Smacker files not properly processed by this version of getID3() ['.$this->getid3->version().']';
-
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
- $fileTypeID = fread($this->getid3->fp, 3);
- switch ($fileTypeID) {
- case 'BIK':
- return $this->ParseBink();
- break;
-
- case 'SMK':
- return $this->ParseSmacker();
- break;
-
- default:
- $info['error'][] = 'Expecting "BIK" or "SMK" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($fileTypeID).'"';
- return false;
- break;
- }
-
- return true;
-
- }
-
- function ParseBink() {
- $info = &$this->getid3->info;
- $info['fileformat'] = 'bink';
- $info['video']['dataformat'] = 'bink';
-
- $fileData = 'BIK'.fread($this->getid3->fp, 13);
-
- $info['bink']['data_size'] = getid3_lib::LittleEndian2Int(substr($fileData, 4, 4));
- $info['bink']['frame_count'] = getid3_lib::LittleEndian2Int(substr($fileData, 8, 2));
-
- if (($info['avdataend'] - $info['avdataoffset']) != ($info['bink']['data_size'] + 8)) {
- $info['error'][] = 'Probably truncated file: expecting '.$info['bink']['data_size'].' bytes, found '.($info['avdataend'] - $info['avdataoffset']);
- }
-
- return true;
- }
-
- function ParseSmacker() {
- $info = &$this->getid3->info;
- $info['fileformat'] = 'smacker';
- $info['video']['dataformat'] = 'smacker';
-
- return true;
- }
-
-}
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.audio-video.flv.php b/3rdparty/getid3/module.audio-video.flv.php
deleted file mode 100644
index ba3cd908df1..00000000000
--- a/3rdparty/getid3/module.audio-video.flv.php
+++ /dev/null
@@ -1,731 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-// //
-// FLV module by Seth Kaufman <seth@whirl-i-gig.com> //
-// //
-// * version 0.1 (26 June 2005) //
-// //
-// //
-// * version 0.1.1 (15 July 2005) //
-// minor modifications by James Heinrich <info@getid3.org> //
-// //
-// * version 0.2 (22 February 2006) //
-// Support for On2 VP6 codec and meta information //
-// by Steve Webster <steve.webster@featurecreep.com> //
-// //
-// * version 0.3 (15 June 2006) //
-// Modified to not read entire file into memory //
-// by James Heinrich <info@getid3.org> //
-// //
-// * version 0.4 (07 December 2007) //
-// Bugfixes for incorrectly parsed FLV dimensions //
-// and incorrect parsing of onMetaTag //
-// by Evgeny Moysevich <moysevich@gmail.com> //
-// //
-// * version 0.5 (21 May 2009) //
-// Fixed parsing of audio tags and added additional codec //
-// details. The duration is now read from onMetaTag (if //
-// exists), rather than parsing whole file //
-// by Nigel Barnes <ngbarnes@hotmail.com> //
-// //
-// * version 0.6 (24 May 2009) //
-// Better parsing of files with h264 video //
-// by Evgeny Moysevich <moysevichgmail*com> //
-// //
-// * version 0.6.1 (30 May 2011) //
-// prevent infinite loops in expGolombUe() //
-// //
-/////////////////////////////////////////////////////////////////
-// //
-// module.audio-video.flv.php //
-// module for analyzing Shockwave Flash Video files //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-
-define('GETID3_FLV_TAG_AUDIO', 8);
-define('GETID3_FLV_TAG_VIDEO', 9);
-define('GETID3_FLV_TAG_META', 18);
-
-define('GETID3_FLV_VIDEO_H263', 2);
-define('GETID3_FLV_VIDEO_SCREEN', 3);
-define('GETID3_FLV_VIDEO_VP6FLV', 4);
-define('GETID3_FLV_VIDEO_VP6FLV_ALPHA', 5);
-define('GETID3_FLV_VIDEO_SCREENV2', 6);
-define('GETID3_FLV_VIDEO_H264', 7);
-
-define('H264_AVC_SEQUENCE_HEADER', 0);
-define('H264_PROFILE_BASELINE', 66);
-define('H264_PROFILE_MAIN', 77);
-define('H264_PROFILE_EXTENDED', 88);
-define('H264_PROFILE_HIGH', 100);
-define('H264_PROFILE_HIGH10', 110);
-define('H264_PROFILE_HIGH422', 122);
-define('H264_PROFILE_HIGH444', 144);
-define('H264_PROFILE_HIGH444_PREDICTIVE', 244);
-
-class getid3_flv extends getid3_handler
-{
- var $max_frames = 100000; // break out of the loop if too many frames have been scanned; only scan this many if meta frame does not contain useful duration
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
-
- $FLVdataLength = $info['avdataend'] - $info['avdataoffset'];
- $FLVheader = fread($this->getid3->fp, 5);
-
- $info['fileformat'] = 'flv';
- $info['flv']['header']['signature'] = substr($FLVheader, 0, 3);
- $info['flv']['header']['version'] = getid3_lib::BigEndian2Int(substr($FLVheader, 3, 1));
- $TypeFlags = getid3_lib::BigEndian2Int(substr($FLVheader, 4, 1));
-
- $magic = 'FLV';
- if ($info['flv']['header']['signature'] != $magic) {
- $info['error'][] = 'Expecting "'.getid3_lib::PrintHexBytes($magic).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($info['flv']['header']['signature']).'"';
- unset($info['flv']);
- unset($info['fileformat']);
- return false;
- }
-
- $info['flv']['header']['hasAudio'] = (bool) ($TypeFlags & 0x04);
- $info['flv']['header']['hasVideo'] = (bool) ($TypeFlags & 0x01);
-
- $FrameSizeDataLength = getid3_lib::BigEndian2Int(fread($this->getid3->fp, 4));
- $FLVheaderFrameLength = 9;
- if ($FrameSizeDataLength > $FLVheaderFrameLength) {
- fseek($this->getid3->fp, $FrameSizeDataLength - $FLVheaderFrameLength, SEEK_CUR);
- }
- $Duration = 0;
- $found_video = false;
- $found_audio = false;
- $found_meta = false;
- $found_valid_meta_playtime = false;
- $tagParseCount = 0;
- $info['flv']['framecount'] = array('total'=>0, 'audio'=>0, 'video'=>0);
- $flv_framecount = &$info['flv']['framecount'];
- while (((ftell($this->getid3->fp) + 16) < $info['avdataend']) && (($tagParseCount++ <= $this->max_frames) || !$found_valid_meta_playtime)) {
- $ThisTagHeader = fread($this->getid3->fp, 16);
-
- $PreviousTagLength = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 0, 4));
- $TagType = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 4, 1));
- $DataLength = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 5, 3));
- $Timestamp = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 8, 3));
- $LastHeaderByte = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 15, 1));
- $NextOffset = ftell($this->getid3->fp) - 1 + $DataLength;
- if ($Timestamp > $Duration) {
- $Duration = $Timestamp;
- }
-
- $flv_framecount['total']++;
- switch ($TagType) {
- case GETID3_FLV_TAG_AUDIO:
- $flv_framecount['audio']++;
- if (!$found_audio) {
- $found_audio = true;
- $info['flv']['audio']['audioFormat'] = ($LastHeaderByte >> 4) & 0x0F;
- $info['flv']['audio']['audioRate'] = ($LastHeaderByte >> 2) & 0x03;
- $info['flv']['audio']['audioSampleSize'] = ($LastHeaderByte >> 1) & 0x01;
- $info['flv']['audio']['audioType'] = $LastHeaderByte & 0x01;
- }
- break;
-
- case GETID3_FLV_TAG_VIDEO:
- $flv_framecount['video']++;
- if (!$found_video) {
- $found_video = true;
- $info['flv']['video']['videoCodec'] = $LastHeaderByte & 0x07;
-
- $FLVvideoHeader = fread($this->getid3->fp, 11);
-
- if ($info['flv']['video']['videoCodec'] == GETID3_FLV_VIDEO_H264) {
- // this code block contributed by: moysevichgmail*com
-
- $AVCPacketType = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 0, 1));
- if ($AVCPacketType == H264_AVC_SEQUENCE_HEADER) {
- // read AVCDecoderConfigurationRecord
- $configurationVersion = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 4, 1));
- $AVCProfileIndication = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 5, 1));
- $profile_compatibility = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 6, 1));
- $lengthSizeMinusOne = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 7, 1));
- $numOfSequenceParameterSets = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 8, 1));
-
- if (($numOfSequenceParameterSets & 0x1F) != 0) {
- // there is at least one SequenceParameterSet
- // read size of the first SequenceParameterSet
- //$spsSize = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 9, 2));
- $spsSize = getid3_lib::LittleEndian2Int(substr($FLVvideoHeader, 9, 2));
- // read the first SequenceParameterSet
- $sps = fread($this->getid3->fp, $spsSize);
- if (strlen($sps) == $spsSize) { // make sure that whole SequenceParameterSet was red
- $spsReader = new AVCSequenceParameterSetReader($sps);
- $spsReader->readData();
- $info['video']['resolution_x'] = $spsReader->getWidth();
- $info['video']['resolution_y'] = $spsReader->getHeight();
- }
- }
- }
- // end: moysevichgmail*com
-
- } elseif ($info['flv']['video']['videoCodec'] == GETID3_FLV_VIDEO_H263) {
-
- $PictureSizeType = (getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 3, 2))) >> 7;
- $PictureSizeType = $PictureSizeType & 0x0007;
- $info['flv']['header']['videoSizeType'] = $PictureSizeType;
- switch ($PictureSizeType) {
- case 0:
- //$PictureSizeEnc = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 5, 2));
- //$PictureSizeEnc <<= 1;
- //$info['video']['resolution_x'] = ($PictureSizeEnc & 0xFF00) >> 8;
- //$PictureSizeEnc = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 6, 2));
- //$PictureSizeEnc <<= 1;
- //$info['video']['resolution_y'] = ($PictureSizeEnc & 0xFF00) >> 8;
-
- $PictureSizeEnc['x'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 4, 2));
- $PictureSizeEnc['y'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 5, 2));
- $PictureSizeEnc['x'] >>= 7;
- $PictureSizeEnc['y'] >>= 7;
- $info['video']['resolution_x'] = $PictureSizeEnc['x'] & 0xFF;
- $info['video']['resolution_y'] = $PictureSizeEnc['y'] & 0xFF;
- break;
-
- case 1:
- $PictureSizeEnc['x'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 4, 3));
- $PictureSizeEnc['y'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 6, 3));
- $PictureSizeEnc['x'] >>= 7;
- $PictureSizeEnc['y'] >>= 7;
- $info['video']['resolution_x'] = $PictureSizeEnc['x'] & 0xFFFF;
- $info['video']['resolution_y'] = $PictureSizeEnc['y'] & 0xFFFF;
- break;
-
- case 2:
- $info['video']['resolution_x'] = 352;
- $info['video']['resolution_y'] = 288;
- break;
-
- case 3:
- $info['video']['resolution_x'] = 176;
- $info['video']['resolution_y'] = 144;
- break;
-
- case 4:
- $info['video']['resolution_x'] = 128;
- $info['video']['resolution_y'] = 96;
- break;
-
- case 5:
- $info['video']['resolution_x'] = 320;
- $info['video']['resolution_y'] = 240;
- break;
-
- case 6:
- $info['video']['resolution_x'] = 160;
- $info['video']['resolution_y'] = 120;
- break;
-
- default:
- $info['video']['resolution_x'] = 0;
- $info['video']['resolution_y'] = 0;
- break;
-
- }
- }
- $info['video']['pixel_aspect_ratio'] = $info['video']['resolution_x'] / $info['video']['resolution_y'];
- }
- break;
-
- // Meta tag
- case GETID3_FLV_TAG_META:
- if (!$found_meta) {
- $found_meta = true;
- fseek($this->getid3->fp, -1, SEEK_CUR);
- $datachunk = fread($this->getid3->fp, $DataLength);
- $AMFstream = new AMFStream($datachunk);
- $reader = new AMFReader($AMFstream);
- $eventName = $reader->readData();
- $info['flv']['meta'][$eventName] = $reader->readData();
- unset($reader);
-
- $copykeys = array('framerate'=>'frame_rate', 'width'=>'resolution_x', 'height'=>'resolution_y', 'audiodatarate'=>'bitrate', 'videodatarate'=>'bitrate');
- foreach ($copykeys as $sourcekey => $destkey) {
- if (isset($info['flv']['meta']['onMetaData'][$sourcekey])) {
- switch ($sourcekey) {
- case 'width':
- case 'height':
- $info['video'][$destkey] = intval(round($info['flv']['meta']['onMetaData'][$sourcekey]));
- break;
- case 'audiodatarate':
- $info['audio'][$destkey] = getid3_lib::CastAsInt(round($info['flv']['meta']['onMetaData'][$sourcekey] * 1000));
- break;
- case 'videodatarate':
- case 'frame_rate':
- default:
- $info['video'][$destkey] = $info['flv']['meta']['onMetaData'][$sourcekey];
- break;
- }
- }
- }
- if (!empty($info['flv']['meta']['onMetaData']['duration'])) {
- $found_valid_meta_playtime = true;
- }
- }
- break;
-
- default:
- // noop
- break;
- }
- fseek($this->getid3->fp, $NextOffset, SEEK_SET);
- }
-
- $info['playtime_seconds'] = $Duration / 1000;
- if ($info['playtime_seconds'] > 0) {
- $info['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds'];
- }
-
- if ($info['flv']['header']['hasAudio']) {
- $info['audio']['codec'] = $this->FLVaudioFormat($info['flv']['audio']['audioFormat']);
- $info['audio']['sample_rate'] = $this->FLVaudioRate($info['flv']['audio']['audioRate']);
- $info['audio']['bits_per_sample'] = $this->FLVaudioBitDepth($info['flv']['audio']['audioSampleSize']);
-
- $info['audio']['channels'] = $info['flv']['audio']['audioType'] + 1; // 0=mono,1=stereo
- $info['audio']['lossless'] = ($info['flv']['audio']['audioFormat'] ? false : true); // 0=uncompressed
- $info['audio']['dataformat'] = 'flv';
- }
- if (!empty($info['flv']['header']['hasVideo'])) {
- $info['video']['codec'] = $this->FLVvideoCodec($info['flv']['video']['videoCodec']);
- $info['video']['dataformat'] = 'flv';
- $info['video']['lossless'] = false;
- }
-
- // Set information from meta
- if (!empty($info['flv']['meta']['onMetaData']['duration'])) {
- $info['playtime_seconds'] = $info['flv']['meta']['onMetaData']['duration'];
- $info['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds'];
- }
- if (isset($info['flv']['meta']['onMetaData']['audiocodecid'])) {
- $info['audio']['codec'] = $this->FLVaudioFormat($info['flv']['meta']['onMetaData']['audiocodecid']);
- }
- if (isset($info['flv']['meta']['onMetaData']['videocodecid'])) {
- $info['video']['codec'] = $this->FLVvideoCodec($info['flv']['meta']['onMetaData']['videocodecid']);
- }
- return true;
- }
-
-
- function FLVaudioFormat($id) {
- $FLVaudioFormat = array(
- 0 => 'Linear PCM, platform endian',
- 1 => 'ADPCM',
- 2 => 'mp3',
- 3 => 'Linear PCM, little endian',
- 4 => 'Nellymoser 16kHz mono',
- 5 => 'Nellymoser 8kHz mono',
- 6 => 'Nellymoser',
- 7 => 'G.711A-law logarithmic PCM',
- 8 => 'G.711 mu-law logarithmic PCM',
- 9 => 'reserved',
- 10 => 'AAC',
- 11 => false, // unknown?
- 12 => false, // unknown?
- 13 => false, // unknown?
- 14 => 'mp3 8kHz',
- 15 => 'Device-specific sound',
- );
- return (isset($FLVaudioFormat[$id]) ? $FLVaudioFormat[$id] : false);
- }
-
- function FLVaudioRate($id) {
- $FLVaudioRate = array(
- 0 => 5500,
- 1 => 11025,
- 2 => 22050,
- 3 => 44100,
- );
- return (isset($FLVaudioRate[$id]) ? $FLVaudioRate[$id] : false);
- }
-
- function FLVaudioBitDepth($id) {
- $FLVaudioBitDepth = array(
- 0 => 8,
- 1 => 16,
- );
- return (isset($FLVaudioBitDepth[$id]) ? $FLVaudioBitDepth[$id] : false);
- }
-
- function FLVvideoCodec($id) {
- $FLVvideoCodec = array(
- GETID3_FLV_VIDEO_H263 => 'Sorenson H.263',
- GETID3_FLV_VIDEO_SCREEN => 'Screen video',
- GETID3_FLV_VIDEO_VP6FLV => 'On2 VP6',
- GETID3_FLV_VIDEO_VP6FLV_ALPHA => 'On2 VP6 with alpha channel',
- GETID3_FLV_VIDEO_SCREENV2 => 'Screen video v2',
- GETID3_FLV_VIDEO_H264 => 'Sorenson H.264',
- );
- return (isset($FLVvideoCodec[$id]) ? $FLVvideoCodec[$id] : false);
- }
-}
-
-class AMFStream {
- var $bytes;
- var $pos;
-
- function AMFStream(&$bytes) {
- $this->bytes =& $bytes;
- $this->pos = 0;
- }
-
- function readByte() {
- return getid3_lib::BigEndian2Int(substr($this->bytes, $this->pos++, 1));
- }
-
- function readInt() {
- return ($this->readByte() << 8) + $this->readByte();
- }
-
- function readLong() {
- return ($this->readByte() << 24) + ($this->readByte() << 16) + ($this->readByte() << 8) + $this->readByte();
- }
-
- function readDouble() {
- return getid3_lib::BigEndian2Float($this->read(8));
- }
-
- function readUTF() {
- $length = $this->readInt();
- return $this->read($length);
- }
-
- function readLongUTF() {
- $length = $this->readLong();
- return $this->read($length);
- }
-
- function read($length) {
- $val = substr($this->bytes, $this->pos, $length);
- $this->pos += $length;
- return $val;
- }
-
- function peekByte() {
- $pos = $this->pos;
- $val = $this->readByte();
- $this->pos = $pos;
- return $val;
- }
-
- function peekInt() {
- $pos = $this->pos;
- $val = $this->readInt();
- $this->pos = $pos;
- return $val;
- }
-
- function peekLong() {
- $pos = $this->pos;
- $val = $this->readLong();
- $this->pos = $pos;
- return $val;
- }
-
- function peekDouble() {
- $pos = $this->pos;
- $val = $this->readDouble();
- $this->pos = $pos;
- return $val;
- }
-
- function peekUTF() {
- $pos = $this->pos;
- $val = $this->readUTF();
- $this->pos = $pos;
- return $val;
- }
-
- function peekLongUTF() {
- $pos = $this->pos;
- $val = $this->readLongUTF();
- $this->pos = $pos;
- return $val;
- }
-}
-
-class AMFReader {
- var $stream;
-
- function AMFReader(&$stream) {
- $this->stream =& $stream;
- }
-
- function readData() {
- $value = null;
-
- $type = $this->stream->readByte();
- switch ($type) {
-
- // Double
- case 0:
- $value = $this->readDouble();
- break;
-
- // Boolean
- case 1:
- $value = $this->readBoolean();
- break;
-
- // String
- case 2:
- $value = $this->readString();
- break;
-
- // Object
- case 3:
- $value = $this->readObject();
- break;
-
- // null
- case 6:
- return null;
- break;
-
- // Mixed array
- case 8:
- $value = $this->readMixedArray();
- break;
-
- // Array
- case 10:
- $value = $this->readArray();
- break;
-
- // Date
- case 11:
- $value = $this->readDate();
- break;
-
- // Long string
- case 13:
- $value = $this->readLongString();
- break;
-
- // XML (handled as string)
- case 15:
- $value = $this->readXML();
- break;
-
- // Typed object (handled as object)
- case 16:
- $value = $this->readTypedObject();
- break;
-
- // Long string
- default:
- $value = '(unknown or unsupported data type)';
- break;
- }
-
- return $value;
- }
-
- function readDouble() {
- return $this->stream->readDouble();
- }
-
- function readBoolean() {
- return $this->stream->readByte() == 1;
- }
-
- function readString() {
- return $this->stream->readUTF();
- }
-
- function readObject() {
- // Get highest numerical index - ignored
-// $highestIndex = $this->stream->readLong();
-
- $data = array();
-
- while ($key = $this->stream->readUTF()) {
- $data[$key] = $this->readData();
- }
- // Mixed array record ends with empty string (0x00 0x00) and 0x09
- if (($key == '') && ($this->stream->peekByte() == 0x09)) {
- // Consume byte
- $this->stream->readByte();
- }
- return $data;
- }
-
- function readMixedArray() {
- // Get highest numerical index - ignored
- $highestIndex = $this->stream->readLong();
-
- $data = array();
-
- while ($key = $this->stream->readUTF()) {
- if (is_numeric($key)) {
- $key = (float) $key;
- }
- $data[$key] = $this->readData();
- }
- // Mixed array record ends with empty string (0x00 0x00) and 0x09
- if (($key == '') && ($this->stream->peekByte() == 0x09)) {
- // Consume byte
- $this->stream->readByte();
- }
-
- return $data;
- }
-
- function readArray() {
- $length = $this->stream->readLong();
- $data = array();
-
- for ($i = 0; $i < $length; $i++) {
- $data[] = $this->readData();
- }
- return $data;
- }
-
- function readDate() {
- $timestamp = $this->stream->readDouble();
- $timezone = $this->stream->readInt();
- return $timestamp;
- }
-
- function readLongString() {
- return $this->stream->readLongUTF();
- }
-
- function readXML() {
- return $this->stream->readLongUTF();
- }
-
- function readTypedObject() {
- $className = $this->stream->readUTF();
- return $this->readObject();
- }
-}
-
-class AVCSequenceParameterSetReader {
- var $sps;
- var $start = 0;
- var $currentBytes = 0;
- var $currentBits = 0;
- var $width;
- var $height;
-
- function AVCSequenceParameterSetReader($sps) {
- $this->sps = $sps;
- }
-
- function readData() {
- $this->skipBits(8);
- $this->skipBits(8);
- $profile = $this->getBits(8); // read profile
- $this->skipBits(16);
- $this->expGolombUe(); // read sps id
- if (in_array($profile, array(H264_PROFILE_HIGH, H264_PROFILE_HIGH10, H264_PROFILE_HIGH422, H264_PROFILE_HIGH444, H264_PROFILE_HIGH444_PREDICTIVE))) {
- if ($this->expGolombUe() == 3) {
- $this->skipBits(1);
- }
- $this->expGolombUe();
- $this->expGolombUe();
- $this->skipBits(1);
- if ($this->getBit()) {
- for ($i = 0; $i < 8; $i++) {
- if ($this->getBit()) {
- $size = $i < 6 ? 16 : 64;
- $lastScale = 8;
- $nextScale = 8;
- for ($j = 0; $j < $size; $j++) {
- if ($nextScale != 0) {
- $deltaScale = $this->expGolombUe();
- $nextScale = ($lastScale + $deltaScale + 256) % 256;
- }
- if ($nextScale != 0) {
- $lastScale = $nextScale;
- }
- }
- }
- }
- }
- }
- $this->expGolombUe();
- $pocType = $this->expGolombUe();
- if ($pocType == 0) {
- $this->expGolombUe();
- } elseif ($pocType == 1) {
- $this->skipBits(1);
- $this->expGolombSe();
- $this->expGolombSe();
- $pocCycleLength = $this->expGolombUe();
- for ($i = 0; $i < $pocCycleLength; $i++) {
- $this->expGolombSe();
- }
- }
- $this->expGolombUe();
- $this->skipBits(1);
- $this->width = ($this->expGolombUe() + 1) * 16;
- $heightMap = $this->expGolombUe() + 1;
- $this->height = (2 - $this->getBit()) * $heightMap * 16;
- }
-
- function skipBits($bits) {
- $newBits = $this->currentBits + $bits;
- $this->currentBytes += (int)floor($newBits / 8);
- $this->currentBits = $newBits % 8;
- }
-
- function getBit() {
- $result = (getid3_lib::BigEndian2Int(substr($this->sps, $this->currentBytes, 1)) >> (7 - $this->currentBits)) & 0x01;
- $this->skipBits(1);
- return $result;
- }
-
- function getBits($bits) {
- $result = 0;
- for ($i = 0; $i < $bits; $i++) {
- $result = ($result << 1) + $this->getBit();
- }
- return $result;
- }
-
- function expGolombUe() {
- $significantBits = 0;
- $bit = $this->getBit();
- while ($bit == 0) {
- $significantBits++;
- $bit = $this->getBit();
-
- if ($significantBits > 31) {
- // something is broken, this is an emergency escape to prevent infinite loops
- return 0;
- }
- }
- return (1 << $significantBits) + $this->getBits($significantBits) - 1;
- }
-
- function expGolombSe() {
- $result = $this->expGolombUe();
- if (($result & 0x01) == 0) {
- return -($result >> 1);
- } else {
- return ($result + 1) >> 1;
- }
- }
-
- function getWidth() {
- return $this->width;
- }
-
- function getHeight() {
- return $this->height;
- }
-}
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.audio-video.matroska.php b/3rdparty/getid3/module.audio-video.matroska.php
deleted file mode 100644
index b7ab667989b..00000000000
--- a/3rdparty/getid3/module.audio-video.matroska.php
+++ /dev/null
@@ -1,1706 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.audio-video.matriska.php //
-// module for analyzing Matroska containers //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-// from: http://www.matroska.org/technical/specs/index.html
-define('EBML_ID_CHAPTERS', 0x0043A770); // [10][43][A7][70] -- A system to define basic menus and partition data. For more detailed information, look at the Chapters Explanation.
-define('EBML_ID_SEEKHEAD', 0x014D9B74); // [11][4D][9B][74] -- Contains the position of other level 1 elements.
-define('EBML_ID_TAGS', 0x0254C367); // [12][54][C3][67] -- Element containing elements specific to Tracks/Chapters. A list of valid tags can be found <http://www.matroska.org/technical/specs/tagging/index.html>.
-define('EBML_ID_INFO', 0x0549A966); // [15][49][A9][66] -- Contains miscellaneous general information and statistics on the file.
-define('EBML_ID_TRACKS', 0x0654AE6B); // [16][54][AE][6B] -- A top-level block of information with many tracks described.
-define('EBML_ID_SEGMENT', 0x08538067); // [18][53][80][67] -- This element contains all other top-level (level 1) elements. Typically a Matroska file is composed of 1 segment.
-define('EBML_ID_ATTACHMENTS', 0x0941A469); // [19][41][A4][69] -- Contain attached files.
-define('EBML_ID_EBML', 0x0A45DFA3); // [1A][45][DF][A3] -- Set the EBML characteristics of the data to follow. Each EBML document has to start with this.
-define('EBML_ID_CUES', 0x0C53BB6B); // [1C][53][BB][6B] -- A top-level element to speed seeking access. All entries are local to the segment.
-define('EBML_ID_CLUSTER', 0x0F43B675); // [1F][43][B6][75] -- The lower level element containing the (monolithic) Block structure.
-define('EBML_ID_LANGUAGE', 0x02B59C); // [22][B5][9C] -- Specifies the language of the track in the Matroska languages form.
-define('EBML_ID_TRACKTIMECODESCALE', 0x03314F); // [23][31][4F] -- The scale to apply on this track to work at normal speed in relation with other tracks (mostly used to adjust video speed when the audio length differs).
-define('EBML_ID_DEFAULTDURATION', 0x03E383); // [23][E3][83] -- Number of nanoseconds (i.e. not scaled) per frame.
-define('EBML_ID_CODECNAME', 0x058688); // [25][86][88] -- A human-readable string specifying the codec.
-define('EBML_ID_CODECDOWNLOADURL', 0x06B240); // [26][B2][40] -- A URL to download about the codec used.
-define('EBML_ID_TIMECODESCALE', 0x0AD7B1); // [2A][D7][B1] -- Timecode scale in nanoseconds (1.000.000 means all timecodes in the segment are expressed in milliseconds).
-define('EBML_ID_COLOURSPACE', 0x0EB524); // [2E][B5][24] -- Same value as in AVI (32 bits).
-define('EBML_ID_GAMMAVALUE', 0x0FB523); // [2F][B5][23] -- Gamma Value.
-define('EBML_ID_CODECSETTINGS', 0x1A9697); // [3A][96][97] -- A string describing the encoding setting used.
-define('EBML_ID_CODECINFOURL', 0x1B4040); // [3B][40][40] -- A URL to find information about the codec used.
-define('EBML_ID_PREVFILENAME', 0x1C83AB); // [3C][83][AB] -- An escaped filename corresponding to the previous segment.
-define('EBML_ID_PREVUID', 0x1CB923); // [3C][B9][23] -- A unique ID to identify the previous chained segment (128 bits).
-define('EBML_ID_NEXTFILENAME', 0x1E83BB); // [3E][83][BB] -- An escaped filename corresponding to the next segment.
-define('EBML_ID_NEXTUID', 0x1EB923); // [3E][B9][23] -- A unique ID to identify the next chained segment (128 bits).
-define('EBML_ID_CONTENTCOMPALGO', 0x0254); // [42][54] -- The compression algorithm used. Algorithms that have been specified so far are:
-define('EBML_ID_CONTENTCOMPSETTINGS', 0x0255); // [42][55] -- Settings that might be needed by the decompressor. For Header Stripping (ContentCompAlgo=3), the bytes that were removed from the beggining of each frames of the track.
-define('EBML_ID_DOCTYPE', 0x0282); // [42][82] -- A string that describes the type of document that follows this EBML header ('matroska' in our case).
-define('EBML_ID_DOCTYPEREADVERSION', 0x0285); // [42][85] -- The minimum DocType version an interpreter has to support to read this file.
-define('EBML_ID_EBMLVERSION', 0x0286); // [42][86] -- The version of EBML parser used to create the file.
-define('EBML_ID_DOCTYPEVERSION', 0x0287); // [42][87] -- The version of DocType interpreter used to create the file.
-define('EBML_ID_EBMLMAXIDLENGTH', 0x02F2); // [42][F2] -- The maximum length of the IDs you'll find in this file (4 or less in Matroska).
-define('EBML_ID_EBMLMAXSIZELENGTH', 0x02F3); // [42][F3] -- The maximum length of the sizes you'll find in this file (8 or less in Matroska). This does not override the element size indicated at the beginning of an element. Elements that have an indicated size which is larger than what is allowed by EBMLMaxSizeLength shall be considered invalid.
-define('EBML_ID_EBMLREADVERSION', 0x02F7); // [42][F7] -- The minimum EBML version a parser has to support to read this file.
-define('EBML_ID_CHAPLANGUAGE', 0x037C); // [43][7C] -- The languages corresponding to the string, in the bibliographic ISO-639-2 form.
-define('EBML_ID_CHAPCOUNTRY', 0x037E); // [43][7E] -- The countries corresponding to the string, same 2 octets as in Internet domains.
-define('EBML_ID_SEGMENTFAMILY', 0x0444); // [44][44] -- A randomly generated unique ID that all segments related to each other must use (128 bits).
-define('EBML_ID_DATEUTC', 0x0461); // [44][61] -- Date of the origin of timecode (value 0), i.e. production date.
-define('EBML_ID_TAGLANGUAGE', 0x047A); // [44][7A] -- Specifies the language of the tag specified, in the Matroska languages form.
-define('EBML_ID_TAGDEFAULT', 0x0484); // [44][84] -- Indication to know if this is the default/original language to use for the given tag.
-define('EBML_ID_TAGBINARY', 0x0485); // [44][85] -- The values of the Tag if it is binary. Note that this cannot be used in the same SimpleTag as TagString.
-define('EBML_ID_TAGSTRING', 0x0487); // [44][87] -- The value of the Tag.
-define('EBML_ID_DURATION', 0x0489); // [44][89] -- Duration of the segment (based on TimecodeScale).
-define('EBML_ID_CHAPPROCESSPRIVATE', 0x050D); // [45][0D] -- Some optional data attached to the ChapProcessCodecID information. For ChapProcessCodecID = 1, it is the "DVD level" equivalent.
-define('EBML_ID_CHAPTERFLAGENABLED', 0x0598); // [45][98] -- Specify wether the chapter is enabled. It can be enabled/disabled by a Control Track. When disabled, the movie should skip all the content between the TimeStart and TimeEnd of this chapter.
-define('EBML_ID_TAGNAME', 0x05A3); // [45][A3] -- The name of the Tag that is going to be stored.
-define('EBML_ID_EDITIONENTRY', 0x05B9); // [45][B9] -- Contains all information about a segment edition.
-define('EBML_ID_EDITIONUID', 0x05BC); // [45][BC] -- A unique ID to identify the edition. It's useful for tagging an edition.
-define('EBML_ID_EDITIONFLAGHIDDEN', 0x05BD); // [45][BD] -- If an edition is hidden (1), it should not be available to the user interface (but still to Control Tracks).
-define('EBML_ID_EDITIONFLAGDEFAULT', 0x05DB); // [45][DB] -- If a flag is set (1) the edition should be used as the default one.
-define('EBML_ID_EDITIONFLAGORDERED', 0x05DD); // [45][DD] -- Specify if the chapters can be defined multiple times and the order to play them is enforced.
-define('EBML_ID_FILEDATA', 0x065C); // [46][5C] -- The data of the file.
-define('EBML_ID_FILEMIMETYPE', 0x0660); // [46][60] -- MIME type of the file.
-define('EBML_ID_FILENAME', 0x066E); // [46][6E] -- Filename of the attached file.
-define('EBML_ID_FILEREFERRAL', 0x0675); // [46][75] -- A binary value that a track/codec can refer to when the attachment is needed.
-define('EBML_ID_FILEDESCRIPTION', 0x067E); // [46][7E] -- A human-friendly name for the attached file.
-define('EBML_ID_FILEUID', 0x06AE); // [46][AE] -- Unique ID representing the file, as random as possible.
-define('EBML_ID_CONTENTENCALGO', 0x07E1); // [47][E1] -- The encryption algorithm used. The value '0' means that the contents have not been encrypted but only signed. Predefined values:
-define('EBML_ID_CONTENTENCKEYID', 0x07E2); // [47][E2] -- For public key algorithms this is the ID of the public key the the data was encrypted with.
-define('EBML_ID_CONTENTSIGNATURE', 0x07E3); // [47][E3] -- A cryptographic signature of the contents.
-define('EBML_ID_CONTENTSIGKEYID', 0x07E4); // [47][E4] -- This is the ID of the private key the data was signed with.
-define('EBML_ID_CONTENTSIGALGO', 0x07E5); // [47][E5] -- The algorithm used for the signature. A value of '0' means that the contents have not been signed but only encrypted. Predefined values:
-define('EBML_ID_CONTENTSIGHASHALGO', 0x07E6); // [47][E6] -- The hash algorithm used for the signature. A value of '0' means that the contents have not been signed but only encrypted. Predefined values:
-define('EBML_ID_MUXINGAPP', 0x0D80); // [4D][80] -- Muxing application or library ("libmatroska-0.4.3").
-define('EBML_ID_SEEK', 0x0DBB); // [4D][BB] -- Contains a single seek entry to an EBML element.
-define('EBML_ID_CONTENTENCODINGORDER', 0x1031); // [50][31] -- Tells when this modification was used during encoding/muxing starting with 0 and counting upwards. The decoder/demuxer has to start with the highest order number it finds and work its way down. This value has to be unique over all ContentEncodingOrder elements in the segment.
-define('EBML_ID_CONTENTENCODINGSCOPE', 0x1032); // [50][32] -- A bit field that describes which elements have been modified in this way. Values (big endian) can be OR'ed. Possible values:
-define('EBML_ID_CONTENTENCODINGTYPE', 0x1033); // [50][33] -- A value describing what kind of transformation has been done. Possible values:
-define('EBML_ID_CONTENTCOMPRESSION', 0x1034); // [50][34] -- Settings describing the compression used. Must be present if the value of ContentEncodingType is 0 and absent otherwise. Each block must be decompressable even if no previous block is available in order not to prevent seeking.
-define('EBML_ID_CONTENTENCRYPTION', 0x1035); // [50][35] -- Settings describing the encryption used. Must be present if the value of ContentEncodingType is 1 and absent otherwise.
-define('EBML_ID_CUEREFNUMBER', 0x135F); // [53][5F] -- Number of the referenced Block of Track X in the specified Cluster.
-define('EBML_ID_NAME', 0x136E); // [53][6E] -- A human-readable track name.
-define('EBML_ID_CUEBLOCKNUMBER', 0x1378); // [53][78] -- Number of the Block in the specified Cluster.
-define('EBML_ID_TRACKOFFSET', 0x137F); // [53][7F] -- A value to add to the Block's Timecode. This can be used to adjust the playback offset of a track.
-define('EBML_ID_SEEKID', 0x13AB); // [53][AB] -- The binary ID corresponding to the element name.
-define('EBML_ID_SEEKPOSITION', 0x13AC); // [53][AC] -- The position of the element in the segment in octets (0 = first level 1 element).
-define('EBML_ID_STEREOMODE', 0x13B8); // [53][B8] -- Stereo-3D video mode on 2 bits (0: mono, 1: right eye, 2: left eye, 3: both eyes).
-define('EBML_ID_PIXELCROPBOTTOM', 0x14AA); // [54][AA] -- The number of video pixels to remove at the bottom of the image (for HDTV content).
-define('EBML_ID_DISPLAYWIDTH', 0x14B0); // [54][B0] -- Width of the video frames to display.
-define('EBML_ID_DISPLAYUNIT', 0x14B2); // [54][B2] -- Type of the unit for DisplayWidth/Height (0: pixels, 1: centimeters, 2: inches).
-define('EBML_ID_ASPECTRATIOTYPE', 0x14B3); // [54][B3] -- Specify the possible modifications to the aspect ratio (0: free resizing, 1: keep aspect ratio, 2: fixed).
-define('EBML_ID_DISPLAYHEIGHT', 0x14BA); // [54][BA] -- Height of the video frames to display.
-define('EBML_ID_PIXELCROPTOP', 0x14BB); // [54][BB] -- The number of video pixels to remove at the top of the image.
-define('EBML_ID_PIXELCROPLEFT', 0x14CC); // [54][CC] -- The number of video pixels to remove on the left of the image.
-define('EBML_ID_PIXELCROPRIGHT', 0x14DD); // [54][DD] -- The number of video pixels to remove on the right of the image.
-define('EBML_ID_FLAGFORCED', 0x15AA); // [55][AA] -- Set if that track MUST be used during playback. There can be many forced track for a kind (audio, video or subs), the player should select the one which language matches the user preference or the default + forced track. Overlay MAY happen between a forced and non-forced track of the same kind.
-define('EBML_ID_MAXBLOCKADDITIONID', 0x15EE); // [55][EE] -- The maximum value of BlockAddID. A value 0 means there is no BlockAdditions for this track.
-define('EBML_ID_WRITINGAPP', 0x1741); // [57][41] -- Writing application ("mkvmerge-0.3.3").
-define('EBML_ID_CLUSTERSILENTTRACKS', 0x1854); // [58][54] -- The list of tracks that are not used in that part of the stream. It is useful when using overlay tracks on seeking. Then you should decide what track to use.
-define('EBML_ID_CLUSTERSILENTTRACKNUMBER', 0x18D7); // [58][D7] -- One of the track number that are not used from now on in the stream. It could change later if not specified as silent in a further Cluster.
-define('EBML_ID_ATTACHEDFILE', 0x21A7); // [61][A7] -- An attached file.
-define('EBML_ID_CONTENTENCODING', 0x2240); // [62][40] -- Settings for one content encoding like compression or encryption.
-define('EBML_ID_BITDEPTH', 0x2264); // [62][64] -- Bits per sample, mostly used for PCM.
-define('EBML_ID_CODECPRIVATE', 0x23A2); // [63][A2] -- Private data only known to the codec.
-define('EBML_ID_TARGETS', 0x23C0); // [63][C0] -- Contain all UIDs where the specified meta data apply. It is void to describe everything in the segment.
-define('EBML_ID_CHAPTERPHYSICALEQUIV', 0x23C3); // [63][C3] -- Specify the physical equivalent of this ChapterAtom like "DVD" (60) or "SIDE" (50), see complete list of values.
-define('EBML_ID_TAGCHAPTERUID', 0x23C4); // [63][C4] -- A unique ID to identify the Chapter(s) the tags belong to. If the value is 0 at this level, the tags apply to all chapters in the Segment.
-define('EBML_ID_TAGTRACKUID', 0x23C5); // [63][C5] -- A unique ID to identify the Track(s) the tags belong to. If the value is 0 at this level, the tags apply to all tracks in the Segment.
-define('EBML_ID_TAGATTACHMENTUID', 0x23C6); // [63][C6] -- A unique ID to identify the Attachment(s) the tags belong to. If the value is 0 at this level, the tags apply to all the attachments in the Segment.
-define('EBML_ID_TAGEDITIONUID', 0x23C9); // [63][C9] -- A unique ID to identify the EditionEntry(s) the tags belong to. If the value is 0 at this level, the tags apply to all editions in the Segment.
-define('EBML_ID_TARGETTYPE', 0x23CA); // [63][CA] -- An informational string that can be used to display the logical level of the target like "ALBUM", "TRACK", "MOVIE", "CHAPTER", etc (see TargetType).
-define('EBML_ID_TRACKTRANSLATE', 0x2624); // [66][24] -- The track identification for the given Chapter Codec.
-define('EBML_ID_TRACKTRANSLATETRACKID', 0x26A5); // [66][A5] -- The binary value used to represent this track in the chapter codec data. The format depends on the ChapProcessCodecID used.
-define('EBML_ID_TRACKTRANSLATECODEC', 0x26BF); // [66][BF] -- The chapter codec using this ID (0: Matroska Script, 1: DVD-menu).
-define('EBML_ID_TRACKTRANSLATEEDITIONUID', 0x26FC); // [66][FC] -- Specify an edition UID on which this translation applies. When not specified, it means for all editions found in the segment.
-define('EBML_ID_SIMPLETAG', 0x27C8); // [67][C8] -- Contains general information about the target.
-define('EBML_ID_TARGETTYPEVALUE', 0x28CA); // [68][CA] -- A number to indicate the logical level of the target (see TargetType).
-define('EBML_ID_CHAPPROCESSCOMMAND', 0x2911); // [69][11] -- Contains all the commands associated to the Atom.
-define('EBML_ID_CHAPPROCESSTIME', 0x2922); // [69][22] -- Defines when the process command should be handled (0: during the whole chapter, 1: before starting playback, 2: after playback of the chapter).
-define('EBML_ID_CHAPTERTRANSLATE', 0x2924); // [69][24] -- A tuple of corresponding ID used by chapter codecs to represent this segment.
-define('EBML_ID_CHAPPROCESSDATA', 0x2933); // [69][33] -- Contains the command information. The data should be interpreted depending on the ChapProcessCodecID value. For ChapProcessCodecID = 1, the data correspond to the binary DVD cell pre/post commands.
-define('EBML_ID_CHAPPROCESS', 0x2944); // [69][44] -- Contains all the commands associated to the Atom.
-define('EBML_ID_CHAPPROCESSCODECID', 0x2955); // [69][55] -- Contains the type of the codec used for the processing. A value of 0 means native Matroska processing (to be defined), a value of 1 means the DVD command set is used. More codec IDs can be added later.
-define('EBML_ID_CHAPTERTRANSLATEID', 0x29A5); // [69][A5] -- The binary value used to represent this segment in the chapter codec data. The format depends on the ChapProcessCodecID used.
-define('EBML_ID_CHAPTERTRANSLATECODEC', 0x29BF); // [69][BF] -- The chapter codec using this ID (0: Matroska Script, 1: DVD-menu).
-define('EBML_ID_CHAPTERTRANSLATEEDITIONUID', 0x29FC); // [69][FC] -- Specify an edition UID on which this correspondance applies. When not specified, it means for all editions found in the segment.
-define('EBML_ID_CONTENTENCODINGS', 0x2D80); // [6D][80] -- Settings for several content encoding mechanisms like compression or encryption.
-define('EBML_ID_MINCACHE', 0x2DE7); // [6D][E7] -- The minimum number of frames a player should be able to cache during playback. If set to 0, the reference pseudo-cache system is not used.
-define('EBML_ID_MAXCACHE', 0x2DF8); // [6D][F8] -- The maximum cache size required to store referenced frames in and the current frame. 0 means no cache is needed.
-define('EBML_ID_CHAPTERSEGMENTUID', 0x2E67); // [6E][67] -- A segment to play in place of this chapter. Edition ChapterSegmentEditionUID should be used for this segment, otherwise no edition is used.
-define('EBML_ID_CHAPTERSEGMENTEDITIONUID', 0x2EBC); // [6E][BC] -- The edition to play from the segment linked in ChapterSegmentUID.
-define('EBML_ID_TRACKOVERLAY', 0x2FAB); // [6F][AB] -- Specify that this track is an overlay track for the Track specified (in the u-integer). That means when this track has a gap (see SilentTracks) the overlay track should be used instead. The order of multiple TrackOverlay matters, the first one is the one that should be used. If not found it should be the second, etc.
-define('EBML_ID_TAG', 0x3373); // [73][73] -- Element containing elements specific to Tracks/Chapters.
-define('EBML_ID_SEGMENTFILENAME', 0x3384); // [73][84] -- A filename corresponding to this segment.
-define('EBML_ID_SEGMENTUID', 0x33A4); // [73][A4] -- A randomly generated unique ID to identify the current segment between many others (128 bits).
-define('EBML_ID_CHAPTERUID', 0x33C4); // [73][C4] -- A unique ID to identify the Chapter.
-define('EBML_ID_TRACKUID', 0x33C5); // [73][C5] -- A unique ID to identify the Track. This should be kept the same when making a direct stream copy of the Track to another file.
-define('EBML_ID_ATTACHMENTLINK', 0x3446); // [74][46] -- The UID of an attachment that is used by this codec.
-define('EBML_ID_CLUSTERBLOCKADDITIONS', 0x35A1); // [75][A1] -- Contain additional blocks to complete the main one. An EBML parser that has no knowledge of the Block structure could still see and use/skip these data.
-define('EBML_ID_CHANNELPOSITIONS', 0x347B); // [7D][7B] -- Table of horizontal angles for each successive channel, see appendix.
-define('EBML_ID_OUTPUTSAMPLINGFREQUENCY', 0x38B5); // [78][B5] -- Real output sampling frequency in Hz (used for SBR techniques).
-define('EBML_ID_TITLE', 0x3BA9); // [7B][A9] -- General name of the segment.
-define('EBML_ID_CHAPTERDISPLAY', 0x00); // [80] -- Contains all possible strings to use for the chapter display.
-define('EBML_ID_TRACKTYPE', 0x03); // [83] -- A set of track types coded on 8 bits (1: video, 2: audio, 3: complex, 0x10: logo, 0x11: subtitle, 0x12: buttons, 0x20: control).
-define('EBML_ID_CHAPSTRING', 0x05); // [85] -- Contains the string to use as the chapter atom.
-define('EBML_ID_CODECID', 0x06); // [86] -- An ID corresponding to the codec, see the codec page for more info.
-define('EBML_ID_FLAGDEFAULT', 0x08); // [88] -- Set if that track (audio, video or subs) SHOULD be used if no language found matches the user preference.
-define('EBML_ID_CHAPTERTRACKNUMBER', 0x09); // [89] -- UID of the Track to apply this chapter too. In the absense of a control track, choosing this chapter will select the listed Tracks and deselect unlisted tracks. Absense of this element indicates that the Chapter should be applied to any currently used Tracks.
-define('EBML_ID_CLUSTERSLICES', 0x0E); // [8E] -- Contains slices description.
-define('EBML_ID_CHAPTERTRACK', 0x0F); // [8F] -- List of tracks on which the chapter applies. If this element is not present, all tracks apply
-define('EBML_ID_CHAPTERTIMESTART', 0x11); // [91] -- Timecode of the start of Chapter (not scaled).
-define('EBML_ID_CHAPTERTIMEEND', 0x12); // [92] -- Timecode of the end of Chapter (timecode excluded, not scaled).
-define('EBML_ID_CUEREFTIME', 0x16); // [96] -- Timecode of the referenced Block.
-define('EBML_ID_CUEREFCLUSTER', 0x17); // [97] -- Position of the Cluster containing the referenced Block.
-define('EBML_ID_CHAPTERFLAGHIDDEN', 0x18); // [98] -- If a chapter is hidden (1), it should not be available to the user interface (but still to Control Tracks).
-define('EBML_ID_FLAGINTERLACED', 0x1A); // [9A] -- Set if the video is interlaced.
-define('EBML_ID_CLUSTERBLOCKDURATION', 0x1B); // [9B] -- The duration of the Block (based on TimecodeScale). This element is mandatory when DefaultDuration is set for the track. When not written and with no DefaultDuration, the value is assumed to be the difference between the timecode of this Block and the timecode of the next Block in "display" order (not coding order). This element can be useful at the end of a Track (as there is not other Block available), or when there is a break in a track like for subtitle tracks.
-define('EBML_ID_FLAGLACING', 0x1C); // [9C] -- Set if the track may contain blocks using lacing.
-define('EBML_ID_CHANNELS', 0x1F); // [9F] -- Numbers of channels in the track.
-define('EBML_ID_CLUSTERBLOCKGROUP', 0x20); // [A0] -- Basic container of information containing a single Block or BlockVirtual, and information specific to that Block/VirtualBlock.
-define('EBML_ID_CLUSTERBLOCK', 0x21); // [A1] -- Block containing the actual data to be rendered and a timecode relative to the Cluster Timecode.
-define('EBML_ID_CLUSTERBLOCKVIRTUAL', 0x22); // [A2] -- A Block with no data. It must be stored in the stream at the place the real Block should be in display order.
-define('EBML_ID_CLUSTERSIMPLEBLOCK', 0x23); // [A3] -- Similar to Block but without all the extra information, mostly used to reduced overhead when no extra feature is needed.
-define('EBML_ID_CLUSTERCODECSTATE', 0x24); // [A4] -- The new codec state to use. Data interpretation is private to the codec. This information should always be referenced by a seek entry.
-define('EBML_ID_CLUSTERBLOCKADDITIONAL', 0x25); // [A5] -- Interpreted by the codec as it wishes (using the BlockAddID).
-define('EBML_ID_CLUSTERBLOCKMORE', 0x26); // [A6] -- Contain the BlockAdditional and some parameters.
-define('EBML_ID_CLUSTERPOSITION', 0x27); // [A7] -- Position of the Cluster in the segment (0 in live broadcast streams). It might help to resynchronise offset on damaged streams.
-define('EBML_ID_CODECDECODEALL', 0x2A); // [AA] -- The codec can decode potentially damaged data.
-define('EBML_ID_CLUSTERPREVSIZE', 0x2B); // [AB] -- Size of the previous Cluster, in octets. Can be useful for backward playing.
-define('EBML_ID_TRACKENTRY', 0x2E); // [AE] -- Describes a track with all elements.
-define('EBML_ID_CLUSTERENCRYPTEDBLOCK', 0x2F); // [AF] -- Similar to SimpleBlock but the data inside the Block are Transformed (encrypt and/or signed).
-define('EBML_ID_PIXELWIDTH', 0x30); // [B0] -- Width of the encoded video frames in pixels.
-define('EBML_ID_CUETIME', 0x33); // [B3] -- Absolute timecode according to the segment time base.
-define('EBML_ID_SAMPLINGFREQUENCY', 0x35); // [B5] -- Sampling frequency in Hz.
-define('EBML_ID_CHAPTERATOM', 0x36); // [B6] -- Contains the atom information to use as the chapter atom (apply to all tracks).
-define('EBML_ID_CUETRACKPOSITIONS', 0x37); // [B7] -- Contain positions for different tracks corresponding to the timecode.
-define('EBML_ID_FLAGENABLED', 0x39); // [B9] -- Set if the track is used.
-define('EBML_ID_PIXELHEIGHT', 0x3A); // [BA] -- Height of the encoded video frames in pixels.
-define('EBML_ID_CUEPOINT', 0x3B); // [BB] -- Contains all information relative to a seek point in the segment.
-define('EBML_ID_CRC32', 0x3F); // [BF] -- The CRC is computed on all the data of the Master element it's in, regardless of its position. It's recommended to put the CRC value at the beggining of the Master element for easier reading. All level 1 elements should include a CRC-32.
-define('EBML_ID_CLUSTERBLOCKADDITIONID', 0x4B); // [CB] -- The ID of the BlockAdditional element (0 is the main Block).
-define('EBML_ID_CLUSTERLACENUMBER', 0x4C); // [CC] -- The reverse number of the frame in the lace (0 is the last frame, 1 is the next to last, etc). While there are a few files in the wild with this element, it is no longer in use and has been deprecated. Being able to interpret this element is not required for playback.
-define('EBML_ID_CLUSTERFRAMENUMBER', 0x4D); // [CD] -- The number of the frame to generate from this lace with this delay (allow you to generate many frames from the same Block/Frame).
-define('EBML_ID_CLUSTERDELAY', 0x4E); // [CE] -- The (scaled) delay to apply to the element.
-define('EBML_ID_CLUSTERDURATION', 0x4F); // [CF] -- The (scaled) duration to apply to the element.
-define('EBML_ID_TRACKNUMBER', 0x57); // [D7] -- The track number as used in the Block Header (using more than 127 tracks is not encouraged, though the design allows an unlimited number).
-define('EBML_ID_CUEREFERENCE', 0x5B); // [DB] -- The Clusters containing the required referenced Blocks.
-define('EBML_ID_VIDEO', 0x60); // [E0] -- Video settings.
-define('EBML_ID_AUDIO', 0x61); // [E1] -- Audio settings.
-define('EBML_ID_CLUSTERTIMESLICE', 0x68); // [E8] -- Contains extra time information about the data contained in the Block. While there are a few files in the wild with this element, it is no longer in use and has been deprecated. Being able to interpret this element is not required for playback.
-define('EBML_ID_CUECODECSTATE', 0x6A); // [EA] -- The position of the Codec State corresponding to this Cue element. 0 means that the data is taken from the initial Track Entry.
-define('EBML_ID_CUEREFCODECSTATE', 0x6B); // [EB] -- The position of the Codec State corresponding to this referenced element. 0 means that the data is taken from the initial Track Entry.
-define('EBML_ID_VOID', 0x6C); // [EC] -- Used to void damaged data, to avoid unexpected behaviors when using damaged data. The content is discarded. Also used to reserve space in a sub-element for later use.
-define('EBML_ID_CLUSTERTIMECODE', 0x67); // [E7] -- Absolute timecode of the cluster (based on TimecodeScale).
-define('EBML_ID_CLUSTERBLOCKADDID', 0x6E); // [EE] -- An ID to identify the BlockAdditional level.
-define('EBML_ID_CUECLUSTERPOSITION', 0x71); // [F1] -- The position of the Cluster containing the required Block.
-define('EBML_ID_CUETRACK', 0x77); // [F7] -- The track for which a position is given.
-define('EBML_ID_CLUSTERREFERENCEPRIORITY', 0x7A); // [FA] -- This frame is referenced and has the specified cache priority. In cache only a frame of the same or higher priority can replace this frame. A value of 0 means the frame is not referenced.
-define('EBML_ID_CLUSTERREFERENCEBLOCK', 0x7B); // [FB] -- Timecode of another frame used as a reference (ie: B or P frame). The timecode is relative to the block it's attached to.
-define('EBML_ID_CLUSTERREFERENCEVIRTUAL', 0x7D); // [FD] -- Relative position of the data that should be in position of the virtual block.
-
-
-class getid3_matroska extends getid3_handler
-{
- // public options
- public static $hide_clusters = true; // if true, do not return information about CLUSTER chunks, since there's a lot of them and they're not usually useful [default: TRUE]
- public static $parse_whole_file = false; // true to parse the whole file, not only header [default: FALSE]
-
- // private parser settings/placeholders
- private $EBMLbuffer = '';
- private $EBMLbuffer_offset = 0;
- private $EBMLbuffer_length = 0;
- private $current_offset = 0;
- private $unuseful_elements = array(EBML_ID_CRC32, EBML_ID_VOID);
-
- public function Analyze()
- {
- $info = &$this->getid3->info;
-
- // parse container
- try {
- $this->parseEBML($info);
- }
- catch (Exception $e) {
- $info['error'][] = 'EBML parser: '.$e->getMessage();
- }
-
- // calculate playtime
- if (isset($info['matroska']['info']) && is_array($info['matroska']['info'])) {
- foreach ($info['matroska']['info'] as $key => $infoarray) {
- if (isset($infoarray['Duration'])) {
- // TimecodeScale is how many nanoseconds each Duration unit is
- $info['playtime_seconds'] = $infoarray['Duration'] * ((isset($infoarray['TimecodeScale']) ? $infoarray['TimecodeScale'] : 1000000) / 1000000000);
- break;
- }
- }
- }
-
- // extract tags
- if (isset($info['matroska']['tags']) && is_array($info['matroska']['tags'])) {
- foreach ($info['matroska']['tags'] as $key => $infoarray) {
- $this->ExtractCommentsSimpleTag($infoarray);
- }
- }
-
- // process tracks
- if (isset($info['matroska']['tracks']['tracks']) && is_array($info['matroska']['tracks']['tracks'])) {
- foreach ($info['matroska']['tracks']['tracks'] as $key => $trackarray) {
-
- $track_info = array();
- $track_info['dataformat'] = self::MatroskaCodecIDtoCommonName($trackarray['CodecID']);
- $track_info['default'] = (isset($trackarray['FlagDefault']) ? $trackarray['FlagDefault'] : true);
- if (isset($trackarray['Name'])) { $track_info['name'] = $trackarray['Name']; }
-
- switch ($trackarray['TrackType']) {
-
- case 1: // Video
- $track_info['resolution_x'] = $trackarray['PixelWidth'];
- $track_info['resolution_y'] = $trackarray['PixelHeight'];
- if (isset($trackarray['DisplayWidth'])) { $track_info['display_x'] = $trackarray['DisplayWidth']; }
- if (isset($trackarray['DisplayHeight'])) { $track_info['display_y'] = $trackarray['DisplayHeight']; }
- if (isset($trackarray['DefaultDuration'])) { $track_info['frame_rate'] = round(1000000000 / $trackarray['DefaultDuration'], 3); }
- //if (isset($trackarray['CodecName'])) { $track_info['codec'] = $trackarray['CodecName']; }
-
- switch ($trackarray['CodecID']) {
- case 'V_MS/VFW/FOURCC':
- if (!getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, false)) {
- $this->getid3->warning('Unable to parse codec private data ['.basename(__FILE__).':'.__LINE__.'] because cannot include "module.audio-video.riff.php"');
- break;
- }
- $parsed = getid3_riff::ParseBITMAPINFOHEADER($trackarray['CodecPrivate']);
- $track_info['codec'] = getid3_riff::RIFFfourccLookup($parsed['fourcc']);
- $info['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $parsed;
- break;
- }
-
- $info['video']['streams'][] = $track_info;
- break;
-
- case 2: // Audio
- $track_info['sample_rate'] = (isset($trackarray['SamplingFrequency']) ? $trackarray['SamplingFrequency'] : 8000.0);
- $track_info['channels'] = (isset($trackarray['Channels']) ? $trackarray['Channels'] : 1);
- $track_info['language'] = (isset($trackarray['Language']) ? $trackarray['Language'] : 'eng');
- if (isset($trackarray['BitDepth'])) { $track_info['bits_per_sample'] = $trackarray['BitDepth']; }
- //if (isset($trackarray['CodecName'])) { $track_info['codec'] = $trackarray['CodecName']; }
-
- switch ($trackarray['CodecID']) {
- case 'A_PCM/INT/LIT':
- case 'A_PCM/INT/BIG':
- $track_info['bitrate'] = $trackarray['SamplingFrequency'] * $trackarray['Channels'] * $trackarray['BitDepth'];
- break;
-
- case 'A_AC3':
- case 'A_DTS':
- case 'A_MPEG/L3':
- //case 'A_FLAC':
- if (!getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.'.$track_info['dataformat'].'.php', __FILE__, false)) {
- $this->getid3->warning('Unable to parse audio data ['.basename(__FILE__).':'.__LINE__.'] because cannot include "module.audio.'.$track_info['dataformat'].'.php"');
- break;
- }
-
- if (!isset($info['matroska']['track_data_offsets'][$trackarray['TrackNumber']])) {
- $this->getid3->warning('Unable to parse audio data ['.basename(__FILE__).':'.__LINE__.'] because $info[matroska][track_data_offsets]['.$trackarray['TrackNumber'].'] not set');
- break;
- }
-
- // create temp instance
- $getid3_temp = new getID3();
- $getid3_temp->openfile($this->getid3->filename);
- $getid3_temp->info['avdataoffset'] = $info['matroska']['track_data_offsets'][$trackarray['TrackNumber']]['offset'];
- if ($track_info['dataformat'] == 'mp3' || $track_info['dataformat'] == 'flac') {
- $getid3_temp->info['avdataend'] = $info['matroska']['track_data_offsets'][$trackarray['TrackNumber']]['offset'] + $info['matroska']['track_data_offsets'][$trackarray['TrackNumber']]['length'];
- }
-
- // analyze
- $class = 'getid3_'.$track_info['dataformat'];
- $header_data_key = $track_info['dataformat'] == 'mp3' ? 'mpeg' : $track_info['dataformat'];
- $getid3_audio = new $class($getid3_temp);
- if ($track_info['dataformat'] == 'mp3') {
- $getid3_audio->allow_bruteforce = true;
- }
- if ($track_info['dataformat'] == 'flac') {
- $getid3_audio->AnalyzeString($trackarray['CodecPrivate']);
- }
- else {
- $getid3_audio->Analyze();
- }
- if (!empty($getid3_temp->info[$header_data_key])) {
- unset($getid3_temp->info[$header_data_key]['GETID3_VERSION']);
- $info['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $getid3_temp->info[$header_data_key];
- if (isset($getid3_temp->info['audio']) && is_array($getid3_temp->info['audio'])) {
- foreach ($getid3_temp->info['audio'] as $key => $value) {
- $track_info[$key] = $value;
- }
- }
- }
- else {
- $this->getid3->warning('Unable to parse audio data ['.basename(__FILE__).':'.__LINE__.'] because '.$class.'::Analyze() failed at offset '.$getid3_temp->info['avdataoffset']);
- }
-
- // copy errors and warnings
- if (!empty($getid3_temp->info['error'])) {
- foreach ($getid3_temp->info['error'] as $newerror) {
- $this->getid3->warning($class.'() says: ['.$newerror.']');
- }
- }
- if (!empty($getid3_temp->info['warning'])) {
- foreach ($getid3_temp->info['warning'] as $newerror) {
- if ($track_info['dataformat'] == 'mp3' && preg_match('/^Probable truncated file: expecting \d+ bytes of audio data, only found \d+ \(short by \d+ bytes\)$/', $newerror)) {
- // LAME/Xing header is probably set, but audio data is chunked into Matroska file and near-impossible to verify if audio stream is complete, so ignore useless warning
- continue;
- }
- $this->getid3->warning($class.'() says: ['.$newerror.']');
- }
- }
- unset($getid3_temp, $getid3_audio);
- break;
-
- case 'A_AAC':
- case 'A_AAC/MPEG2/LC':
- case 'A_AAC/MPEG4/LC':
- case 'A_AAC/MPEG4/LC/SBR':
- $this->getid3->warning($trackarray['CodecID'].' audio data contains no header, audio/video bitrates can\'t be calculated');
- break;
-
- case 'A_VORBIS':
- if (!isset($trackarray['CodecPrivate'])) {
- $this->getid3->warning('Unable to parse audio data ['.basename(__FILE__).':'.__LINE__.'] because CodecPrivate data not set');
- break;
- }
- $vorbis_offset = strpos($trackarray['CodecPrivate'], 'vorbis', 1);
- if ($vorbis_offset === false) {
- $this->getid3->warning('Unable to parse audio data ['.basename(__FILE__).':'.__LINE__.'] because CodecPrivate data does not contain "vorbis" keyword');
- break;
- }
- $vorbis_offset -= 1;
-
- if (!getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.ogg.php', __FILE__, false)) {
- $this->getid3->warning('Unable to parse audio data ['.basename(__FILE__).':'.__LINE__.'] because cannot include "module.audio.ogg.php"');
- }
-
- // create temp instance
- $getid3_temp = new getID3();
- $getid3_temp->openfile($this->getid3->filename);
-
- // analyze
- $getid3_ogg = new getid3_ogg($getid3_temp);
- $oggpageinfo['page_seqno'] = 0;
- $getid3_ogg->ParseVorbisPageHeader($trackarray['CodecPrivate'], $vorbis_offset, $oggpageinfo);
- if (!empty($getid3_temp->info['ogg'])) {
- $info['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $getid3_temp->info['ogg'];
- if (isset($getid3_temp->info['audio']) && is_array($getid3_temp->info['audio'])) {
- foreach ($getid3_temp->info['audio'] as $key => $value) {
- $track_info[$key] = $value;
- }
- }
- }
-
- // copy errors and warnings
- if (!empty($getid3_temp->info['error'])) {
- foreach ($getid3_temp->info['error'] as $newerror) {
- $this->getid3->warning('getid3_ogg() says: ['.$newerror.']');
- }
- }
- if (!empty($getid3_temp->info['warning'])) {
- foreach ($getid3_temp->info['warning'] as $newerror) {
- $this->getid3->warning('getid3_ogg() says: ['.$newerror.']');
- }
- }
-
- if (!empty($getid3_temp->info['ogg']['bitrate_nominal'])) {
- $track_info['bitrate'] = $getid3_temp->info['ogg']['bitrate_nominal'];
- }
- unset($getid3_temp, $getid3_ogg, $oggpageinfo, $vorbis_offset);
- break;
-
- case 'A_MS/ACM':
- if (!getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, false)) {
- $this->getid3->warning('Unable to parse audio data ['.basename(__FILE__).':'.__LINE__.'] because cannot include "module.audio-video.riff.php"');
- break;
- }
-
- $parsed = getid3_riff::RIFFparseWAVEFORMATex($trackarray['CodecPrivate']);
- foreach ($parsed as $key => $value) {
- if ($key != 'raw') {
- $track_info[$key] = $value;
- }
- }
- $info['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $parsed;
- break;
-
- default:
- $this->getid3->warning('Unhandled audio type "'.(isset($trackarray['CodecID']) ? $trackarray['CodecID'] : '').'"');
- }
-
- $info['audio']['streams'][] = $track_info;
- break;
- }
- }
-
- if (!empty($info['video']['streams'])) {
- $info['video'] = self::getDefaultStreamInfo($info['video']['streams']);
- }
- if (!empty($info['audio']['streams'])) {
- $info['audio'] = self::getDefaultStreamInfo($info['audio']['streams']);
- }
- }
-
- // determine mime type
- if (!empty($info['video']['streams'])) {
- $info['mime_type'] = ($info['matroska']['doctype'] == 'webm' ? 'video/webm' : 'video/x-matroska');
- } elseif (!empty($info['audio']['streams'])) {
- $info['mime_type'] = ($info['matroska']['doctype'] == 'webm' ? 'audio/webm' : 'audio/x-matroska');
- } elseif (isset($info['mime_type'])) {
- unset($info['mime_type']);
- }
-
- return true;
- }
-
-
-///////////////////////////////////////
-
- private function parseEBML(&$info)
- {
- // http://www.matroska.org/technical/specs/index.html#EBMLBasics
- $this->current_offset = $info['avdataoffset'];
-
- while ($this->getEBMLelement($top_element, $info['avdataend'])) {
- switch ($top_element['id']) {
-
- case EBML_ID_EBML:
- $info['fileformat'] = 'matroska';
- $info['matroska']['header']['offset'] = $top_element['offset'];
- $info['matroska']['header']['length'] = $top_element['length'];
-
- while ($this->getEBMLelement($element_data, $top_element['end'], true)) {
- switch ($element_data['id']) {
-
- case EBML_ID_EBMLVERSION:
- case EBML_ID_EBMLREADVERSION:
- case EBML_ID_EBMLMAXIDLENGTH:
- case EBML_ID_EBMLMAXSIZELENGTH:
- case EBML_ID_DOCTYPEVERSION:
- case EBML_ID_DOCTYPEREADVERSION:
- $element_data['data'] = getid3_lib::BigEndian2Int($element_data['data']);
- break;
-
- case EBML_ID_DOCTYPE:
- $element_data['data'] = getid3_lib::trimNullByte($element_data['data']);
- $info['matroska']['doctype'] = $element_data['data'];
- break;
-
- case EBML_ID_CRC32: // not useful, ignore
- $this->current_offset = $element_data['end'];
- unset($element_data);
- break;
-
- default:
- $this->unhandledElement('header', __LINE__, $element_data);
- }
- if (!empty($element_data)) {
- unset($element_data['offset'], $element_data['end']);
- $info['matroska']['header']['elements'][] = $element_data;
- }
- }
- break;
-
- case EBML_ID_SEGMENT:
- $info['matroska']['segment'][0]['offset'] = $top_element['offset'];
- $info['matroska']['segment'][0]['length'] = $top_element['length'];
-
- while ($this->getEBMLelement($element_data, $top_element['end'])) {
- if ($element_data['id'] != EBML_ID_CLUSTER || !self::$hide_clusters) { // collect clusters only if required
- $info['matroska']['segments'][] = $element_data;
- }
- switch ($element_data['id']) {
-
- case EBML_ID_SEEKHEAD: // Contains the position of other level 1 elements.
-
- while ($this->getEBMLelement($seek_entry, $element_data['end'])) {
- switch ($seek_entry['id']) {
-
- case EBML_ID_SEEK: // Contains a single seek entry to an EBML element
- while ($this->getEBMLelement($sub_seek_entry, $seek_entry['end'], true)) {
-
- switch ($sub_seek_entry['id']) {
-
- case EBML_ID_SEEKID:
- $seek_entry['target_id'] = self::EBML2Int($sub_seek_entry['data']);
- $seek_entry['target_name'] = self::EBMLidName($seek_entry['target_id']);
- break;
-
- case EBML_ID_SEEKPOSITION:
- $seek_entry['target_offset'] = $element_data['offset'] + getid3_lib::BigEndian2Int($sub_seek_entry['data']);
- break;
-
- default:
- $this->unhandledElement('seekhead.seek', __LINE__, $sub_seek_entry); }
- }
-
- if ($seek_entry['target_id'] != EBML_ID_CLUSTER || !self::$hide_clusters) { // collect clusters only if required
- $info['matroska']['seek'][] = $seek_entry;
- }
- break;
-
- default:
- $this->unhandledElement('seekhead', __LINE__, $seek_entry);
- }
- }
- break;
-
- case EBML_ID_TRACKS: // A top-level block of information with many tracks described.
- $info['matroska']['tracks'] = $element_data;
-
- while ($this->getEBMLelement($track_entry, $element_data['end'])) {
- switch ($track_entry['id']) {
-
- case EBML_ID_TRACKENTRY: //subelements: Describes a track with all elements.
-
- while ($this->getEBMLelement($subelement, $track_entry['end'], array(EBML_ID_VIDEO, EBML_ID_AUDIO, EBML_ID_CONTENTENCODINGS))) {
- switch ($subelement['id']) {
-
- case EBML_ID_TRACKNUMBER:
- case EBML_ID_TRACKUID:
- case EBML_ID_TRACKTYPE:
- case EBML_ID_MINCACHE:
- case EBML_ID_MAXCACHE:
- case EBML_ID_MAXBLOCKADDITIONID:
- case EBML_ID_DEFAULTDURATION: // nanoseconds per frame
- $track_entry[$subelement['id_name']] = getid3_lib::BigEndian2Int($subelement['data']);
- break;
-
- case EBML_ID_TRACKTIMECODESCALE:
- $track_entry[$subelement['id_name']] = getid3_lib::BigEndian2Float($subelement['data']);
- break;
-
- case EBML_ID_CODECID:
- case EBML_ID_LANGUAGE:
- case EBML_ID_NAME:
- case EBML_ID_CODECNAME:
- $track_entry[$subelement['id_name']] = getid3_lib::trimNullByte($subelement['data']);
- break;
-
- case EBML_ID_CODECPRIVATE:
- $track_entry[$subelement['id_name']] = $subelement['data'];
- break;
-
- case EBML_ID_FLAGENABLED:
- case EBML_ID_FLAGDEFAULT:
- case EBML_ID_FLAGFORCED:
- case EBML_ID_FLAGLACING:
- case EBML_ID_CODECDECODEALL:
- $track_entry[$subelement['id_name']] = (bool) getid3_lib::BigEndian2Int($subelement['data']);
- break;
-
- case EBML_ID_VIDEO:
-
- while ($this->getEBMLelement($sub_subelement, $subelement['end'], true)) {
- switch ($sub_subelement['id']) {
-
- case EBML_ID_PIXELWIDTH:
- case EBML_ID_PIXELHEIGHT:
- case EBML_ID_STEREOMODE:
- case EBML_ID_PIXELCROPBOTTOM:
- case EBML_ID_PIXELCROPTOP:
- case EBML_ID_PIXELCROPLEFT:
- case EBML_ID_PIXELCROPRIGHT:
- case EBML_ID_DISPLAYWIDTH:
- case EBML_ID_DISPLAYHEIGHT:
- case EBML_ID_DISPLAYUNIT:
- case EBML_ID_ASPECTRATIOTYPE:
- $track_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_subelement['data']);
- break;
-
- case EBML_ID_FLAGINTERLACED:
- $track_entry[$sub_subelement['id_name']] = (bool)getid3_lib::BigEndian2Int($sub_subelement['data']);
- break;
-
- case EBML_ID_GAMMAVALUE:
- $track_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Float($sub_subelement['data']);
- break;
-
- case EBML_ID_COLOURSPACE:
- $track_entry[$sub_subelement['id_name']] = getid3_lib::trimNullByte($sub_subelement['data']);
- break;
-
- default:
- $this->unhandledElement('track.video', __LINE__, $sub_subelement);
- }
- }
- break;
-
- case EBML_ID_AUDIO:
-
- while ($this->getEBMLelement($sub_subelement, $subelement['end'], true)) {
- switch ($sub_subelement['id']) {
-
- case EBML_ID_CHANNELS:
- case EBML_ID_BITDEPTH:
- $track_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_subelement['data']);
- break;
-
- case EBML_ID_SAMPLINGFREQUENCY:
- case EBML_ID_OUTPUTSAMPLINGFREQUENCY:
- $track_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Float($sub_subelement['data']);
- break;
-
- case EBML_ID_CHANNELPOSITIONS:
- $track_entry[$sub_subelement['id_name']] = getid3_lib::trimNullByte($sub_subelement['data']);
- break;
-
- default:
- $this->unhandledElement('track.audio', __LINE__, $sub_subelement);
- }
- }
- break;
-
- case EBML_ID_CONTENTENCODINGS:
-
- while ($this->getEBMLelement($sub_subelement, $subelement['end'])) {
- switch ($sub_subelement['id']) {
-
- case EBML_ID_CONTENTENCODING:
-
- while ($this->getEBMLelement($sub_sub_subelement, $sub_subelement['end'], array(EBML_ID_CONTENTCOMPRESSION, EBML_ID_CONTENTENCRYPTION))) {
- switch ($sub_sub_subelement['id']) {
-
- case EBML_ID_CONTENTENCODINGORDER:
- case EBML_ID_CONTENTENCODINGSCOPE:
- case EBML_ID_CONTENTENCODINGTYPE:
- $track_entry[$sub_subelement['id_name']][$sub_sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_sub_subelement['data']);
- break;
-
- case EBML_ID_CONTENTCOMPRESSION:
-
- while ($this->getEBMLelement($sub_sub_sub_subelement, $sub_sub_subelement['end'], true)) {
- switch ($sub_sub_sub_subelement['id']) {
-
- case EBML_ID_CONTENTCOMPALGO:
- $track_entry[$sub_subelement['id_name']][$sub_sub_subelement['id_name']][$sub_sub_sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_sub_sub_subelement['data']);
- break;
-
- case EBML_ID_CONTENTCOMPSETTINGS:
- $track_entry[$sub_subelement['id_name']][$sub_sub_subelement['id_name']][$sub_sub_sub_subelement['id_name']] = $sub_sub_sub_subelement['data'];
- break;
-
- default:
- $this->unhandledElement('track.contentencodings.contentencoding.contentcompression', __LINE__, $sub_sub_sub_subelement);
- }
- }
- break;
-
- case EBML_ID_CONTENTENCRYPTION:
-
- while ($this->getEBMLelement($sub_sub_sub_subelement, $sub_sub_subelement['end'], true)) {
- switch ($sub_sub_sub_subelement['id']) {
-
- case EBML_ID_CONTENTENCALGO:
- case EBML_ID_CONTENTSIGALGO:
- case EBML_ID_CONTENTSIGHASHALGO:
- $track_entry[$sub_subelement['id_name']][$sub_sub_subelement['id_name']][$sub_sub_sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_sub_sub_subelement['data']);
- break;
-
- case EBML_ID_CONTENTENCKEYID:
- case EBML_ID_CONTENTSIGNATURE:
- case EBML_ID_CONTENTSIGKEYID:
- $track_entry[$sub_subelement['id_name']][$sub_sub_subelement['id_name']][$sub_sub_sub_subelement['id_name']] = $sub_sub_sub_subelement['data'];
- break;
-
- default:
- $this->unhandledElement('track.contentencodings.contentencoding.contentcompression', __LINE__, $sub_sub_sub_subelement);
- }
- }
- break;
-
- default:
- $this->unhandledElement('track.contentencodings.contentencoding', __LINE__, $sub_sub_subelement);
- }
- }
- break;
-
- default:
- $this->unhandledElement('track.contentencodings', __LINE__, $sub_subelement);
- }
- }
- break;
-
- default:
- $this->unhandledElement('track', __LINE__, $subelement);
- }
- }
-
- $info['matroska']['tracks']['tracks'][] = $track_entry;
- break;
-
- default:
- $this->unhandledElement('tracks', __LINE__, $track_entry);
- }
- }
- break;
-
- case EBML_ID_INFO: // Contains miscellaneous general information and statistics on the file.
- $info_entry = array();
-
- while ($this->getEBMLelement($subelement, $element_data['end'], true)) {
- switch ($subelement['id']) {
-
- case EBML_ID_CHAPTERTRANSLATEEDITIONUID:
- case EBML_ID_CHAPTERTRANSLATECODEC:
- case EBML_ID_TIMECODESCALE:
- $info_entry[$subelement['id_name']] = getid3_lib::BigEndian2Int($subelement['data']);
- break;
-
- case EBML_ID_DURATION:
- $info_entry[$subelement['id_name']] = getid3_lib::BigEndian2Float($subelement['data']);
- break;
-
- case EBML_ID_DATEUTC:
- $info_entry[$subelement['id_name']] = getid3_lib::BigEndian2Int($subelement['data']);
- $info_entry[$subelement['id_name'].'_unix'] = self::EBMLdate2unix($info_entry[$subelement['id_name']]);
- break;
-
- case EBML_ID_SEGMENTUID:
- case EBML_ID_PREVUID:
- case EBML_ID_NEXTUID:
- case EBML_ID_SEGMENTFAMILY:
- case EBML_ID_CHAPTERTRANSLATEID:
- $info_entry[$subelement['id_name']] = getid3_lib::trimNullByte($subelement['data']);
- break;
-
- case EBML_ID_SEGMENTFILENAME:
- case EBML_ID_PREVFILENAME:
- case EBML_ID_NEXTFILENAME:
- case EBML_ID_TITLE:
- case EBML_ID_MUXINGAPP:
- case EBML_ID_WRITINGAPP:
- $info_entry[$subelement['id_name']] = getid3_lib::trimNullByte($subelement['data']);
- $info['matroska']['comments'][strtolower($subelement['id_name'])][] = $info_entry[$subelement['id_name']];
- break;
-
- default:
- $this->unhandledElement('info', __LINE__, $subelement);
- }
- }
- $info['matroska']['info'][] = $info_entry;
- break;
-
- case EBML_ID_CUES: // A top-level element to speed seeking access. All entries are local to the segment. Should be mandatory for non "live" streams.
- if (self::$hide_clusters) { // do not parse cues if hide clusters is "ON" till they point to clusters anyway
- $this->current_offset = $element_data['end'];
- break;
- }
- $cues_entry = array();
-
- while ($this->getEBMLelement($subelement, $element_data['end'])) {
- switch ($subelement['id']) {
-
- case EBML_ID_CUEPOINT:
- $cuepoint_entry = array();
-
- while ($this->getEBMLelement($sub_subelement, $subelement['end'], array(EBML_ID_CUETRACKPOSITIONS))) {
- switch ($sub_subelement['id']) {
-
- case EBML_ID_CUETRACKPOSITIONS:
- $cuetrackpositions_entry = array();
-
- while ($this->getEBMLelement($sub_sub_subelement, $sub_subelement['end'], true)) {
- switch ($sub_sub_subelement['id']) {
-
- case EBML_ID_CUETRACK:
- case EBML_ID_CUECLUSTERPOSITION:
- case EBML_ID_CUEBLOCKNUMBER:
- case EBML_ID_CUECODECSTATE:
- $cuetrackpositions_entry[$sub_sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_sub_subelement['data']);
- break;
-
- default:
- $this->unhandledElement('cues.cuepoint.cuetrackpositions', __LINE__, $sub_sub_subelement);
- }
- }
- $cuepoint_entry[$sub_subelement['id_name']][] = $cuetrackpositions_entry;
- break;
-
- case EBML_ID_CUETIME:
- $cuepoint_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_subelement['data']);
- break;
-
- default:
- $this->unhandledElement('cues.cuepoint', __LINE__, $sub_subelement);
- }
- }
- $cues_entry[] = $cuepoint_entry;
- break;
-
- default:
- $this->unhandledElement('cues', __LINE__, $subelement);
- }
- }
- $info['matroska']['cues'] = $cues_entry;
- break;
-
- case EBML_ID_TAGS: // Element containing elements specific to Tracks/Chapters.
- $tags_entry = array();
-
- while ($this->getEBMLelement($subelement, $element_data['end'], false)) {
- switch ($subelement['id']) {
-
- case EBML_ID_TAG:
- $tag_entry = array();
-
- while ($this->getEBMLelement($sub_subelement, $subelement['end'], false)) {
- switch ($sub_subelement['id']) {
-
- case EBML_ID_TARGETS:
- $targets_entry = array();
-
- while ($this->getEBMLelement($sub_sub_subelement, $sub_subelement['end'], true)) {
- switch ($sub_sub_subelement['id']) {
-
- case EBML_ID_TARGETTYPEVALUE:
- $targets_entry[$sub_sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_sub_subelement['data']);
- $targets_entry[strtolower($sub_sub_subelement['id_name']).'_long'] = self::MatroskaTargetTypeValue($targets_entry[$sub_sub_subelement['id_name']]);
- break;
-
- case EBML_ID_TARGETTYPE:
- $targets_entry[$sub_sub_subelement['id_name']] = $sub_sub_subelement['data'];
- break;
-
- case EBML_ID_TAGTRACKUID:
- case EBML_ID_TAGEDITIONUID:
- case EBML_ID_TAGCHAPTERUID:
- case EBML_ID_TAGATTACHMENTUID:
- $targets_entry[$sub_sub_subelement['id_name']][] = getid3_lib::BigEndian2Int($sub_sub_subelement['data']);
- break;
-
- default:
- $this->unhandledElement('tags.tag.targets', __LINE__, $sub_sub_subelement);
- }
- }
- $tag_entry[$sub_subelement['id_name']] = $targets_entry;
- break;
-
- case EBML_ID_SIMPLETAG:
- $tag_entry[$sub_subelement['id_name']][] = $this->HandleEMBLSimpleTag($sub_subelement['end']);
- break;
-
- default:
- $this->unhandledElement('tags.tag', __LINE__, $sub_subelement);
- }
- }
- $tags_entry[] = $tag_entry;
- break;
-
- default:
- $this->unhandledElement('tags', __LINE__, $subelement);
- }
- }
- $info['matroska']['tags'] = $tags_entry;
- break;
-
- case EBML_ID_ATTACHMENTS: // Contain attached files.
-
- while ($this->getEBMLelement($subelement, $element_data['end'])) {
- switch ($subelement['id']) {
-
- case EBML_ID_ATTACHEDFILE:
- $attachedfile_entry = array();
-
- while ($this->getEBMLelement($sub_subelement, $subelement['end'], array(EBML_ID_FILEDATA))) {
- switch ($sub_subelement['id']) {
-
- case EBML_ID_FILEDESCRIPTION:
- case EBML_ID_FILENAME:
- case EBML_ID_FILEMIMETYPE:
- $attachedfile_entry[$sub_subelement['id_name']] = $sub_subelement['data'];
- break;
-
- case EBML_ID_FILEDATA:
- $attachedfile_entry['data_offset'] = $this->current_offset;
- $attachedfile_entry['data_length'] = $sub_subelement['length'];
-
- $this->getid3->saveAttachment(
- $attachedfile_entry[$sub_subelement['id_name']],
- $attachedfile_entry['FileName'],
- $attachedfile_entry['data_offset'],
- $attachedfile_entry['data_length']);
-
- if (@$attachedfile_entry[$sub_subelement['id_name']] && is_file($attachedfile_entry[$sub_subelement['id_name']])) {
- $attachedfile_entry[$sub_subelement['id_name'].'_filename'] = $attachedfile_entry[$sub_subelement['id_name']];
- unset($attachedfile_entry[$sub_subelement['id_name']]);
- }
-
- $this->current_offset = $sub_subelement['end'];
- break;
-
- case EBML_ID_FILEUID:
- $attachedfile_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_subelement['data']);
- break;
-
- default:
- $this->unhandledElement('attachments.attachedfile', __LINE__, $sub_subelement);
- }
- }
- if (!empty($attachedfile_entry['FileData']) && !empty($attachedfile_entry['FileMimeType']) && preg_match('#^image/#i', $attachedfile_entry['FileMimeType'])) {
- if ($this->getid3->option_save_attachments === getID3::ATTACHMENTS_INLINE) {
- $attachedfile_entry['data'] = $attachedfile_entry['FileData'];
- $attachedfile_entry['image_mime'] = $attachedfile_entry['FileMimeType'];
- $info['matroska']['comments']['picture'][] = array('data' => $attachedfile_entry['data'], 'image_mime' => $attachedfile_entry['image_mime'], 'filename' => (!empty($attachedfile_entry['FileName']) ? $attachedfile_entry['FileName'] : ''));
- unset($attachedfile_entry['FileData'], $attachedfile_entry['FileMimeType']);
- }
- }
- if (!empty($attachedfile_entry['image_mime']) && preg_match('#^image/#i', $attachedfile_entry['image_mime'])) {
- // don't add a second copy of attached images, which are grouped under the standard location [comments][picture]
- } else {
- $info['matroska']['attachments'][] = $attachedfile_entry;
- }
- break;
-
- default:
- $this->unhandledElement('attachments', __LINE__, $subelement);
- }
- }
- break;
-
- case EBML_ID_CHAPTERS:
-
- while ($this->getEBMLelement($subelement, $element_data['end'])) {
- switch ($subelement['id']) {
-
- case EBML_ID_EDITIONENTRY:
- $editionentry_entry = array();
-
- while ($this->getEBMLelement($sub_subelement, $subelement['end'], array(EBML_ID_CHAPTERATOM))) {
- switch ($sub_subelement['id']) {
-
- case EBML_ID_EDITIONUID:
- $editionentry_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_subelement['data']);
- break;
-
- case EBML_ID_EDITIONFLAGHIDDEN:
- case EBML_ID_EDITIONFLAGDEFAULT:
- case EBML_ID_EDITIONFLAGORDERED:
- $editionentry_entry[$sub_subelement['id_name']] = (bool)getid3_lib::BigEndian2Int($sub_subelement['data']);
- break;
-
- case EBML_ID_CHAPTERATOM:
- $chapteratom_entry = array();
-
- while ($this->getEBMLelement($sub_sub_subelement, $sub_subelement['end'], array(EBML_ID_CHAPTERTRACK, EBML_ID_CHAPTERDISPLAY))) {
- switch ($sub_sub_subelement['id']) {
-
- case EBML_ID_CHAPTERSEGMENTUID:
- case EBML_ID_CHAPTERSEGMENTEDITIONUID:
- $chapteratom_entry[$sub_sub_subelement['id_name']] = $sub_sub_subelement['data'];
- break;
-
- case EBML_ID_CHAPTERFLAGENABLED:
- case EBML_ID_CHAPTERFLAGHIDDEN:
- $chapteratom_entry[$sub_sub_subelement['id_name']] = (bool)getid3_lib::BigEndian2Int($sub_sub_subelement['data']);
- break;
-
- case EBML_ID_CHAPTERUID:
- case EBML_ID_CHAPTERTIMESTART:
- case EBML_ID_CHAPTERTIMEEND:
- $chapteratom_entry[$sub_sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_sub_subelement['data']);
- break;
-
- case EBML_ID_CHAPTERTRACK:
- $chaptertrack_entry = array();
-
- while ($this->getEBMLelement($sub_sub_sub_subelement, $sub_sub_subelement['end'], true)) {
- switch ($sub_sub_sub_subelement['id']) {
-
- case EBML_ID_CHAPTERTRACKNUMBER:
- $chaptertrack_entry[$sub_sub_sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_sub_sub_subelement['data']);
- break;
-
- default:
- $this->unhandledElement('chapters.editionentry.chapteratom.chaptertrack', __LINE__, $sub_sub_sub_subelement);
- }
- }
- $chapteratom_entry[$sub_sub_subelement['id_name']][] = $chaptertrack_entry;
- break;
-
- case EBML_ID_CHAPTERDISPLAY:
- $chapterdisplay_entry = array();
-
- while ($this->getEBMLelement($sub_sub_sub_subelement, $sub_sub_subelement['end'], true)) {
- switch ($sub_sub_sub_subelement['id']) {
-
- case EBML_ID_CHAPSTRING:
- case EBML_ID_CHAPLANGUAGE:
- case EBML_ID_CHAPCOUNTRY:
- $chapterdisplay_entry[$sub_sub_sub_subelement['id_name']] = $sub_sub_sub_subelement['data'];
- break;
-
- default:
- $this->unhandledElement('chapters.editionentry.chapteratom.chapterdisplay', __LINE__, $sub_sub_sub_subelement);
- }
- }
- $chapteratom_entry[$sub_sub_subelement['id_name']][] = $chapterdisplay_entry;
- break;
-
- default:
- $this->unhandledElement('chapters.editionentry.chapteratom', __LINE__, $sub_sub_subelement);
- }
- }
- $editionentry_entry[$sub_subelement['id_name']][] = $chapteratom_entry;
- break;
-
- default:
- $this->unhandledElement('chapters.editionentry', __LINE__, $sub_subelement);
- }
- }
- $info['matroska']['chapters'][] = $editionentry_entry;
- break;
-
- default:
- $this->unhandledElement('chapters', __LINE__, $subelement);
- }
- }
- break;
-
- case EBML_ID_CLUSTER: // The lower level element containing the (monolithic) Block structure.
- $cluster_entry = array();
-
- while ($this->getEBMLelement($subelement, $element_data['end'], array(EBML_ID_CLUSTERSILENTTRACKS, EBML_ID_CLUSTERBLOCKGROUP, EBML_ID_CLUSTERSIMPLEBLOCK))) {
- switch ($subelement['id']) {
-
- case EBML_ID_CLUSTERTIMECODE:
- case EBML_ID_CLUSTERPOSITION:
- case EBML_ID_CLUSTERPREVSIZE:
- $cluster_entry[$subelement['id_name']] = getid3_lib::BigEndian2Int($subelement['data']);
- break;
-
- case EBML_ID_CLUSTERSILENTTRACKS:
- $cluster_silent_tracks = array();
-
- while ($this->getEBMLelement($sub_subelement, $subelement['end'], true)) {
- switch ($sub_subelement['id']) {
-
- case EBML_ID_CLUSTERSILENTTRACKNUMBER:
- $cluster_silent_tracks[] = getid3_lib::BigEndian2Int($sub_subelement['data']);
- break;
-
- default:
- $this->unhandledElement('cluster.silenttracks', __LINE__, $sub_subelement);
- }
- }
- $cluster_entry[$subelement['id_name']][] = $cluster_silent_tracks;
- break;
-
- case EBML_ID_CLUSTERBLOCKGROUP:
- $cluster_block_group = array('offset' => $this->current_offset);
-
- while ($this->getEBMLelement($sub_subelement, $subelement['end'], array(EBML_ID_CLUSTERBLOCK))) {
- switch ($sub_subelement['id']) {
-
- case EBML_ID_CLUSTERBLOCK:
- $cluster_block_group[$sub_subelement['id_name']] = $this->HandleEMBLClusterBlock($sub_subelement, EBML_ID_CLUSTERBLOCK, $info);
- break;
-
- case EBML_ID_CLUSTERREFERENCEPRIORITY: // unsigned-int
- case EBML_ID_CLUSTERBLOCKDURATION: // unsigned-int
- $cluster_block_group[$sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_subelement['data']);
- break;
-
- case EBML_ID_CLUSTERREFERENCEBLOCK: // signed-int
- $cluster_block_group[$sub_subelement['id_name']][] = getid3_lib::BigEndian2Int($sub_subelement['data'], false, true);
- break;
-
- case EBML_ID_CLUSTERCODECSTATE:
- $cluster_block_group[$sub_subelement['id_name']] = getid3_lib::trimNullByte($sub_subelement['data']);
- break;
-
- default:
- $this->unhandledElement('clusters.blockgroup', __LINE__, $sub_subelement);
- }
- }
- $cluster_entry[$subelement['id_name']][] = $cluster_block_group;
- break;
-
- case EBML_ID_CLUSTERSIMPLEBLOCK:
- $cluster_entry[$subelement['id_name']][] = $this->HandleEMBLClusterBlock($subelement, EBML_ID_CLUSTERSIMPLEBLOCK, $info);
- break;
-
- default:
- $this->unhandledElement('cluster', __LINE__, $subelement);
- }
- $this->current_offset = $subelement['end'];
- }
- if (!self::$hide_clusters) {
- $info['matroska']['cluster'][] = $cluster_entry;
- }
-
- // check to see if all the data we need exists already, if so, break out of the loop
- if (!self::$parse_whole_file) {
- if (isset($info['matroska']['info']) && is_array($info['matroska']['info'])) {
- if (isset($info['matroska']['tracks']['tracks']) && is_array($info['matroska']['tracks']['tracks'])) {
- return;
- }
- }
- }
- break;
-
- default:
- $this->unhandledElement('segment', __LINE__, $element_data);
- }
- }
- break;
-
- default:
- $this->unhandledElement('root', __LINE__, $top_element);
- }
- }
- }
-
- private function EnsureBufferHasEnoughData($min_data = 1024)
- {
- if (($this->current_offset - $this->EBMLbuffer_offset) >= ($this->EBMLbuffer_length - $min_data)) {
-
- if (!getid3_lib::intValueSupported($this->current_offset + $this->getid3->fread_buffer_size())) {
- $this->getid3->info['error'][] = 'EBML parser: cannot read past '.$this->current_offset;
- return false;
- }
-
- fseek($this->getid3->fp, $this->current_offset, SEEK_SET);
- $this->EBMLbuffer_offset = $this->current_offset;
- $this->EBMLbuffer = fread($this->getid3->fp, max($min_data, $this->getid3->fread_buffer_size()));
- $this->EBMLbuffer_length = strlen($this->EBMLbuffer);
-
- if ($this->EBMLbuffer_length == 0 && feof($this->getid3->fp)) {
- $this->getid3->info['error'][] = 'EBML parser: ran out of file at offset '.$this->current_offset;
- return false;
- }
- }
-
- return true;
- }
-
- private function readEBMLint()
- {
- $actual_offset = $this->current_offset - $this->EBMLbuffer_offset;
-
- // get length of integer
- $first_byte_int = ord($this->EBMLbuffer[$actual_offset]);
- if (0x80 & $first_byte_int) {
- $length = 1;
- } elseif (0x40 & $first_byte_int) {
- $length = 2;
- } elseif (0x20 & $first_byte_int) {
- $length = 3;
- } elseif (0x10 & $first_byte_int) {
- $length = 4;
- } elseif (0x08 & $first_byte_int) {
- $length = 5;
- } elseif (0x04 & $first_byte_int) {
- $length = 6;
- } elseif (0x02 & $first_byte_int) {
- $length = 7;
- } elseif (0x01 & $first_byte_int) {
- $length = 8;
- } else {
- throw new Exception('invalid EBML integer (leading 0x00) at '.$this->current_offset);
- }
-
- // read
- $int_value = self::EBML2Int(substr($this->EBMLbuffer, $actual_offset, $length));
- $this->current_offset += $length;
-
- return $int_value;
- }
-
- private function readEBMLelementData($length)
- {
- $data = substr($this->EBMLbuffer, $this->current_offset - $this->EBMLbuffer_offset, $length);
- $this->current_offset += $length;
-
- return $data;
- }
-
- private function getEBMLelement(&$element, $parent_end, $get_data = false)
- {
- if ($this->current_offset >= $parent_end) {
- return false;
- }
-
- if (!$this->EnsureBufferHasEnoughData()) {
- $this->current_offset = PHP_INT_MAX; // do not exit parser right now, allow to finish current loop to gather maximum information
- return false;
- }
-
- $element = array();
-
- // set offset
- $element['offset'] = $this->current_offset;
-
- // get ID
- $element['id'] = $this->readEBMLint();
-
- // get name
- $element['id_name'] = self::EBMLidName($element['id']);
-
- // get length
- $element['length'] = $this->readEBMLint();
-
- // get end offset
- $element['end'] = $this->current_offset + $element['length'];
-
- // get raw data
- $dont_parse = (in_array($element['id'], $this->unuseful_elements) || $element['id_name'] == dechex($element['id']));
- if (($get_data === true || (is_array($get_data) && !in_array($element['id'], $get_data))) && !$dont_parse) {
- $element['data'] = $this->readEBMLelementData($element['length'], $element);
- }
-
- return true;
- }
-
- private function unhandledElement($type, $line, $element)
- {
- // warn only about unknown and missed elements, not about unuseful
- if (!in_array($element['id'], $this->unuseful_elements)) {
- $this->getid3->warning('Unhandled '.$type.' element ['.basename(__FILE__).':'.$line.'] ('.$element['id'].'::'.$element['id_name'].' ['.$element['length'].' bytes]) at '.$element['offset']);
- }
-
- // increase offset for unparsed elements
- if (!isset($element['data'])) {
- $this->current_offset = $element['end'];
- }
- }
-
- private function ExtractCommentsSimpleTag($SimpleTagArray)
- {
- if (!empty($SimpleTagArray['SimpleTag'])) {
- foreach ($SimpleTagArray['SimpleTag'] as $SimpleTagKey => $SimpleTagData) {
- if (!empty($SimpleTagData['TagName']) && !empty($SimpleTagData['TagString'])) {
- $this->getid3->info['matroska']['comments'][strtolower($SimpleTagData['TagName'])][] = $SimpleTagData['TagString'];
- }
- if (!empty($SimpleTagData['SimpleTag'])) {
- $this->ExtractCommentsSimpleTag($SimpleTagData);
- }
- }
- }
-
- return true;
- }
-
- private function HandleEMBLSimpleTag($parent_end)
- {
- $simpletag_entry = array();
-
- while ($this->getEBMLelement($element, $parent_end, array(EBML_ID_SIMPLETAG))) {
- switch ($element['id']) {
-
- case EBML_ID_TAGNAME:
- case EBML_ID_TAGLANGUAGE:
- case EBML_ID_TAGSTRING:
- case EBML_ID_TAGBINARY:
- $simpletag_entry[$element['id_name']] = $element['data'];
- break;
-
- case EBML_ID_SIMPLETAG:
- $simpletag_entry[$element['id_name']][] = $this->HandleEMBLSimpleTag($element['end']);
- break;
-
- case EBML_ID_TAGDEFAULT:
- $simpletag_entry[$element['id_name']] = (bool)getid3_lib::BigEndian2Int($element['data']);
- break;
-
- default:
- $this->unhandledElement('tag.simpletag', __LINE__, $element);
- }
- }
-
- return $simpletag_entry;
- }
-
- private function HandleEMBLClusterBlock($element, $block_type, &$info)
- {
- // http://www.matroska.org/technical/specs/index.html#block_structure
- // http://www.matroska.org/technical/specs/index.html#simpleblock_structure
-
- $cluster_block_data = array();
- $cluster_block_data['tracknumber'] = $this->readEBMLint();
- $cluster_block_data['timecode'] = getid3_lib::BigEndian2Int($this->readEBMLelementData(2));
- $cluster_block_data['flags_raw'] = getid3_lib::BigEndian2Int($this->readEBMLelementData(1));
-
- if ($block_type == EBML_ID_CLUSTERSIMPLEBLOCK) {
- $cluster_block_data['flags']['keyframe'] = (($cluster_block_data['flags_raw'] & 0x80) >> 7);
- //$cluster_block_data['flags']['reserved1'] = (($cluster_block_data['flags_raw'] & 0x70) >> 4);
- }
- else {
- //$cluster_block_data['flags']['reserved1'] = (($cluster_block_data['flags_raw'] & 0xF0) >> 4);
- }
- $cluster_block_data['flags']['invisible'] = (bool)(($cluster_block_data['flags_raw'] & 0x08) >> 3);
- $cluster_block_data['flags']['lacing'] = (($cluster_block_data['flags_raw'] & 0x06) >> 1); // 00=no lacing; 01=Xiph lacing; 11=EBML lacing; 10=fixed-size lacing
- if ($block_type == EBML_ID_CLUSTERSIMPLEBLOCK) {
- $cluster_block_data['flags']['discardable'] = (($cluster_block_data['flags_raw'] & 0x01));
- }
- else {
- //$cluster_block_data['flags']['reserved2'] = (($cluster_block_data['flags_raw'] & 0x01) >> 0);
- }
- $cluster_block_data['flags']['lacing_type'] = self::MatroskaBlockLacingType($cluster_block_data['flags']['lacing']);
-
- // Lace (when lacing bit is set)
- if ($cluster_block_data['flags']['lacing'] > 0) {
- $cluster_block_data['lace_frames'] = getid3_lib::BigEndian2Int($this->readEBMLelementData(1)) + 1; // Number of frames in the lace-1 (uint8)
- if ($cluster_block_data['flags']['lacing'] != 0x02) { // Lace-coded size of each frame of the lace, except for the last one (multiple uint8). *This is not used with Fixed-size lacing as it is calculated automatically from (total size of lace) / (number of frames in lace).
- for ($i = 1; $i < $cluster_block_data['lace_frames']; $i ++) {
- if ($cluster_block_data['flags']['lacing'] == 0x03) { // EBML lacing
- // TODO: read size correctly, calc size for the last frame. For now offsets are deteminded OK with readEBMLint() and that's the most important thing.
- $cluster_block_data['lace_frames_size'][$i] = $this->readEBMLint();
- }
- else { // Xiph lacing
- $cluster_block_data['lace_frames_size'][$i] = getid3_lib::BigEndian2Int($this->readEBMLelementData(1));
- }
- }
- }
- }
-
- if (!isset($info['matroska']['track_data_offsets'][$cluster_block_data['tracknumber']])) {
- $info['matroska']['track_data_offsets'][$cluster_block_data['tracknumber']]['offset'] = $this->current_offset;
- $info['matroska']['track_data_offsets'][$cluster_block_data['tracknumber']]['length'] = $element['end'] - $this->current_offset;
- }
-
- // set offset manually
- $this->current_offset = $element['end'];
-
- return $cluster_block_data;
- }
-
- private static function EBML2Int($EBMLstring) {
- // http://matroska.org/specs/
-
- // Element ID coded with an UTF-8 like system:
- // 1xxx xxxx - Class A IDs (2^7 -2 possible values) (base 0x8X)
- // 01xx xxxx xxxx xxxx - Class B IDs (2^14-2 possible values) (base 0x4X 0xXX)
- // 001x xxxx xxxx xxxx xxxx xxxx - Class C IDs (2^21-2 possible values) (base 0x2X 0xXX 0xXX)
- // 0001 xxxx xxxx xxxx xxxx xxxx xxxx xxxx - Class D IDs (2^28-2 possible values) (base 0x1X 0xXX 0xXX 0xXX)
- // Values with all x at 0 and 1 are reserved (hence the -2).
-
- // Data size, in octets, is also coded with an UTF-8 like system :
- // 1xxx xxxx - value 0 to 2^7-2
- // 01xx xxxx xxxx xxxx - value 0 to 2^14-2
- // 001x xxxx xxxx xxxx xxxx xxxx - value 0 to 2^21-2
- // 0001 xxxx xxxx xxxx xxxx xxxx xxxx xxxx - value 0 to 2^28-2
- // 0000 1xxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx - value 0 to 2^35-2
- // 0000 01xx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx - value 0 to 2^42-2
- // 0000 001x xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx - value 0 to 2^49-2
- // 0000 0001 xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx - value 0 to 2^56-2
-
- $first_byte_int = ord($EBMLstring[0]);
- if (0x80 & $first_byte_int) {
- $EBMLstring[0] = chr($first_byte_int & 0x7F);
- } elseif (0x40 & $first_byte_int) {
- $EBMLstring[0] = chr($first_byte_int & 0x3F);
- } elseif (0x20 & $first_byte_int) {
- $EBMLstring[0] = chr($first_byte_int & 0x1F);
- } elseif (0x10 & $first_byte_int) {
- $EBMLstring[0] = chr($first_byte_int & 0x0F);
- } elseif (0x08 & $first_byte_int) {
- $EBMLstring[0] = chr($first_byte_int & 0x07);
- } elseif (0x04 & $first_byte_int) {
- $EBMLstring[0] = chr($first_byte_int & 0x03);
- } elseif (0x02 & $first_byte_int) {
- $EBMLstring[0] = chr($first_byte_int & 0x01);
- } elseif (0x01 & $first_byte_int) {
- $EBMLstring[0] = chr($first_byte_int & 0x00);
- }
-
- return getid3_lib::BigEndian2Int($EBMLstring);
- }
-
- private static function EBMLdate2unix($EBMLdatestamp) {
- // Date - signed 8 octets integer in nanoseconds with 0 indicating the precise beginning of the millennium (at 2001-01-01T00:00:00,000000000 UTC)
- // 978307200 == mktime(0, 0, 0, 1, 1, 2001) == January 1, 2001 12:00:00am UTC
- return round(($EBMLdatestamp / 1000000000) + 978307200);
- }
-
- public static function MatroskaTargetTypeValue($target_type) {
- // http://www.matroska.org/technical/specs/tagging/index.html
- static $MatroskaTargetTypeValue = array();
- if (empty($MatroskaTargetTypeValue)) {
- $MatroskaTargetTypeValue[10] = 'A: ~ V:shot'; // the lowest hierarchy found in music or movies
- $MatroskaTargetTypeValue[20] = 'A:subtrack/part/movement ~ V:scene'; // corresponds to parts of a track for audio (like a movement)
- $MatroskaTargetTypeValue[30] = 'A:track/song ~ V:chapter'; // the common parts of an album or a movie
- $MatroskaTargetTypeValue[40] = 'A:part/session ~ V:part/session'; // when an album or episode has different logical parts
- $MatroskaTargetTypeValue[50] = 'A:album/opera/concert ~ V:movie/episode/concert'; // the most common grouping level of music and video (equals to an episode for TV series)
- $MatroskaTargetTypeValue[60] = 'A:edition/issue/volume/opus ~ V:season/sequel/volume'; // a list of lower levels grouped together
- $MatroskaTargetTypeValue[70] = 'A:collection ~ V:collection'; // the high hierarchy consisting of many different lower items
- }
- return (isset($MatroskaTargetTypeValue[$target_type]) ? $MatroskaTargetTypeValue[$target_type] : $target_type);
- }
-
- public static function MatroskaBlockLacingType($lacingtype) {
- // http://matroska.org/technical/specs/index.html#block_structure
- static $MatroskaBlockLacingType = array();
- if (empty($MatroskaBlockLacingType)) {
- $MatroskaBlockLacingType[0x00] = 'no lacing';
- $MatroskaBlockLacingType[0x01] = 'Xiph lacing';
- $MatroskaBlockLacingType[0x02] = 'fixed-size lacing';
- $MatroskaBlockLacingType[0x03] = 'EBML lacing';
- }
- return (isset($MatroskaBlockLacingType[$lacingtype]) ? $MatroskaBlockLacingType[$lacingtype] : $lacingtype);
- }
-
- public static function MatroskaCodecIDtoCommonName($codecid) {
- // http://www.matroska.org/technical/specs/codecid/index.html
- static $MatroskaCodecIDlist = array();
- if (empty($MatroskaCodecIDlist)) {
- $MatroskaCodecIDlist['A_AAC'] = 'aac';
- $MatroskaCodecIDlist['A_AAC/MPEG2/LC'] = 'aac';
- $MatroskaCodecIDlist['A_AC3'] = 'ac3';
- $MatroskaCodecIDlist['A_DTS'] = 'dts';
- $MatroskaCodecIDlist['A_FLAC'] = 'flac';
- $MatroskaCodecIDlist['A_MPEG/L1'] = 'mp1';
- $MatroskaCodecIDlist['A_MPEG/L2'] = 'mp2';
- $MatroskaCodecIDlist['A_MPEG/L3'] = 'mp3';
- $MatroskaCodecIDlist['A_PCM/INT/LIT'] = 'pcm'; // PCM Integer Little Endian
- $MatroskaCodecIDlist['A_PCM/INT/BIG'] = 'pcm'; // PCM Integer Big Endian
- $MatroskaCodecIDlist['A_QUICKTIME/QDMC'] = 'quicktime'; // Quicktime: QDesign Music
- $MatroskaCodecIDlist['A_QUICKTIME/QDM2'] = 'quicktime'; // Quicktime: QDesign Music v2
- $MatroskaCodecIDlist['A_VORBIS'] = 'vorbis';
- $MatroskaCodecIDlist['V_MPEG1'] = 'mpeg';
- $MatroskaCodecIDlist['V_THEORA'] = 'theora';
- $MatroskaCodecIDlist['V_REAL/RV40'] = 'real';
- $MatroskaCodecIDlist['V_REAL/RV10'] = 'real';
- $MatroskaCodecIDlist['V_REAL/RV20'] = 'real';
- $MatroskaCodecIDlist['V_REAL/RV30'] = 'real';
- $MatroskaCodecIDlist['V_QUICKTIME'] = 'quicktime'; // Quicktime
- $MatroskaCodecIDlist['V_MPEG4/ISO/AP'] = 'mpeg4';
- $MatroskaCodecIDlist['V_MPEG4/ISO/ASP'] = 'mpeg4';
- $MatroskaCodecIDlist['V_MPEG4/ISO/AVC'] = 'h264';
- $MatroskaCodecIDlist['V_MPEG4/ISO/SP'] = 'mpeg4';
- $MatroskaCodecIDlist['V_VP8'] = 'vp8';
- $MatroskaCodecIDlist['V_MS/VFW/FOURCC'] = 'riff';
- $MatroskaCodecIDlist['A_MS/ACM'] = 'riff';
- }
- return (isset($MatroskaCodecIDlist[$codecid]) ? $MatroskaCodecIDlist[$codecid] : $codecid);
- }
-
- private static function EBMLidName($value) {
- static $EBMLidList = array();
- if (empty($EBMLidList)) {
- $EBMLidList[EBML_ID_ASPECTRATIOTYPE] = 'AspectRatioType';
- $EBMLidList[EBML_ID_ATTACHEDFILE] = 'AttachedFile';
- $EBMLidList[EBML_ID_ATTACHMENTLINK] = 'AttachmentLink';
- $EBMLidList[EBML_ID_ATTACHMENTS] = 'Attachments';
- $EBMLidList[EBML_ID_AUDIO] = 'Audio';
- $EBMLidList[EBML_ID_BITDEPTH] = 'BitDepth';
- $EBMLidList[EBML_ID_CHANNELPOSITIONS] = 'ChannelPositions';
- $EBMLidList[EBML_ID_CHANNELS] = 'Channels';
- $EBMLidList[EBML_ID_CHAPCOUNTRY] = 'ChapCountry';
- $EBMLidList[EBML_ID_CHAPLANGUAGE] = 'ChapLanguage';
- $EBMLidList[EBML_ID_CHAPPROCESS] = 'ChapProcess';
- $EBMLidList[EBML_ID_CHAPPROCESSCODECID] = 'ChapProcessCodecID';
- $EBMLidList[EBML_ID_CHAPPROCESSCOMMAND] = 'ChapProcessCommand';
- $EBMLidList[EBML_ID_CHAPPROCESSDATA] = 'ChapProcessData';
- $EBMLidList[EBML_ID_CHAPPROCESSPRIVATE] = 'ChapProcessPrivate';
- $EBMLidList[EBML_ID_CHAPPROCESSTIME] = 'ChapProcessTime';
- $EBMLidList[EBML_ID_CHAPSTRING] = 'ChapString';
- $EBMLidList[EBML_ID_CHAPTERATOM] = 'ChapterAtom';
- $EBMLidList[EBML_ID_CHAPTERDISPLAY] = 'ChapterDisplay';
- $EBMLidList[EBML_ID_CHAPTERFLAGENABLED] = 'ChapterFlagEnabled';
- $EBMLidList[EBML_ID_CHAPTERFLAGHIDDEN] = 'ChapterFlagHidden';
- $EBMLidList[EBML_ID_CHAPTERPHYSICALEQUIV] = 'ChapterPhysicalEquiv';
- $EBMLidList[EBML_ID_CHAPTERS] = 'Chapters';
- $EBMLidList[EBML_ID_CHAPTERSEGMENTEDITIONUID] = 'ChapterSegmentEditionUID';
- $EBMLidList[EBML_ID_CHAPTERSEGMENTUID] = 'ChapterSegmentUID';
- $EBMLidList[EBML_ID_CHAPTERTIMEEND] = 'ChapterTimeEnd';
- $EBMLidList[EBML_ID_CHAPTERTIMESTART] = 'ChapterTimeStart';
- $EBMLidList[EBML_ID_CHAPTERTRACK] = 'ChapterTrack';
- $EBMLidList[EBML_ID_CHAPTERTRACKNUMBER] = 'ChapterTrackNumber';
- $EBMLidList[EBML_ID_CHAPTERTRANSLATE] = 'ChapterTranslate';
- $EBMLidList[EBML_ID_CHAPTERTRANSLATECODEC] = 'ChapterTranslateCodec';
- $EBMLidList[EBML_ID_CHAPTERTRANSLATEEDITIONUID] = 'ChapterTranslateEditionUID';
- $EBMLidList[EBML_ID_CHAPTERTRANSLATEID] = 'ChapterTranslateID';
- $EBMLidList[EBML_ID_CHAPTERUID] = 'ChapterUID';
- $EBMLidList[EBML_ID_CLUSTER] = 'Cluster';
- $EBMLidList[EBML_ID_CLUSTERBLOCK] = 'ClusterBlock';
- $EBMLidList[EBML_ID_CLUSTERBLOCKADDID] = 'ClusterBlockAddID';
- $EBMLidList[EBML_ID_CLUSTERBLOCKADDITIONAL] = 'ClusterBlockAdditional';
- $EBMLidList[EBML_ID_CLUSTERBLOCKADDITIONID] = 'ClusterBlockAdditionID';
- $EBMLidList[EBML_ID_CLUSTERBLOCKADDITIONS] = 'ClusterBlockAdditions';
- $EBMLidList[EBML_ID_CLUSTERBLOCKDURATION] = 'ClusterBlockDuration';
- $EBMLidList[EBML_ID_CLUSTERBLOCKGROUP] = 'ClusterBlockGroup';
- $EBMLidList[EBML_ID_CLUSTERBLOCKMORE] = 'ClusterBlockMore';
- $EBMLidList[EBML_ID_CLUSTERBLOCKVIRTUAL] = 'ClusterBlockVirtual';
- $EBMLidList[EBML_ID_CLUSTERCODECSTATE] = 'ClusterCodecState';
- $EBMLidList[EBML_ID_CLUSTERDELAY] = 'ClusterDelay';
- $EBMLidList[EBML_ID_CLUSTERDURATION] = 'ClusterDuration';
- $EBMLidList[EBML_ID_CLUSTERENCRYPTEDBLOCK] = 'ClusterEncryptedBlock';
- $EBMLidList[EBML_ID_CLUSTERFRAMENUMBER] = 'ClusterFrameNumber';
- $EBMLidList[EBML_ID_CLUSTERLACENUMBER] = 'ClusterLaceNumber';
- $EBMLidList[EBML_ID_CLUSTERPOSITION] = 'ClusterPosition';
- $EBMLidList[EBML_ID_CLUSTERPREVSIZE] = 'ClusterPrevSize';
- $EBMLidList[EBML_ID_CLUSTERREFERENCEBLOCK] = 'ClusterReferenceBlock';
- $EBMLidList[EBML_ID_CLUSTERREFERENCEPRIORITY] = 'ClusterReferencePriority';
- $EBMLidList[EBML_ID_CLUSTERREFERENCEVIRTUAL] = 'ClusterReferenceVirtual';
- $EBMLidList[EBML_ID_CLUSTERSILENTTRACKNUMBER] = 'ClusterSilentTrackNumber';
- $EBMLidList[EBML_ID_CLUSTERSILENTTRACKS] = 'ClusterSilentTracks';
- $EBMLidList[EBML_ID_CLUSTERSIMPLEBLOCK] = 'ClusterSimpleBlock';
- $EBMLidList[EBML_ID_CLUSTERTIMECODE] = 'ClusterTimecode';
- $EBMLidList[EBML_ID_CLUSTERTIMESLICE] = 'ClusterTimeSlice';
- $EBMLidList[EBML_ID_CODECDECODEALL] = 'CodecDecodeAll';
- $EBMLidList[EBML_ID_CODECDOWNLOADURL] = 'CodecDownloadURL';
- $EBMLidList[EBML_ID_CODECID] = 'CodecID';
- $EBMLidList[EBML_ID_CODECINFOURL] = 'CodecInfoURL';
- $EBMLidList[EBML_ID_CODECNAME] = 'CodecName';
- $EBMLidList[EBML_ID_CODECPRIVATE] = 'CodecPrivate';
- $EBMLidList[EBML_ID_CODECSETTINGS] = 'CodecSettings';
- $EBMLidList[EBML_ID_COLOURSPACE] = 'ColourSpace';
- $EBMLidList[EBML_ID_CONTENTCOMPALGO] = 'ContentCompAlgo';
- $EBMLidList[EBML_ID_CONTENTCOMPRESSION] = 'ContentCompression';
- $EBMLidList[EBML_ID_CONTENTCOMPSETTINGS] = 'ContentCompSettings';
- $EBMLidList[EBML_ID_CONTENTENCALGO] = 'ContentEncAlgo';
- $EBMLidList[EBML_ID_CONTENTENCKEYID] = 'ContentEncKeyID';
- $EBMLidList[EBML_ID_CONTENTENCODING] = 'ContentEncoding';
- $EBMLidList[EBML_ID_CONTENTENCODINGORDER] = 'ContentEncodingOrder';
- $EBMLidList[EBML_ID_CONTENTENCODINGS] = 'ContentEncodings';
- $EBMLidList[EBML_ID_CONTENTENCODINGSCOPE] = 'ContentEncodingScope';
- $EBMLidList[EBML_ID_CONTENTENCODINGTYPE] = 'ContentEncodingType';
- $EBMLidList[EBML_ID_CONTENTENCRYPTION] = 'ContentEncryption';
- $EBMLidList[EBML_ID_CONTENTSIGALGO] = 'ContentSigAlgo';
- $EBMLidList[EBML_ID_CONTENTSIGHASHALGO] = 'ContentSigHashAlgo';
- $EBMLidList[EBML_ID_CONTENTSIGKEYID] = 'ContentSigKeyID';
- $EBMLidList[EBML_ID_CONTENTSIGNATURE] = 'ContentSignature';
- $EBMLidList[EBML_ID_CRC32] = 'CRC32';
- $EBMLidList[EBML_ID_CUEBLOCKNUMBER] = 'CueBlockNumber';
- $EBMLidList[EBML_ID_CUECLUSTERPOSITION] = 'CueClusterPosition';
- $EBMLidList[EBML_ID_CUECODECSTATE] = 'CueCodecState';
- $EBMLidList[EBML_ID_CUEPOINT] = 'CuePoint';
- $EBMLidList[EBML_ID_CUEREFCLUSTER] = 'CueRefCluster';
- $EBMLidList[EBML_ID_CUEREFCODECSTATE] = 'CueRefCodecState';
- $EBMLidList[EBML_ID_CUEREFERENCE] = 'CueReference';
- $EBMLidList[EBML_ID_CUEREFNUMBER] = 'CueRefNumber';
- $EBMLidList[EBML_ID_CUEREFTIME] = 'CueRefTime';
- $EBMLidList[EBML_ID_CUES] = 'Cues';
- $EBMLidList[EBML_ID_CUETIME] = 'CueTime';
- $EBMLidList[EBML_ID_CUETRACK] = 'CueTrack';
- $EBMLidList[EBML_ID_CUETRACKPOSITIONS] = 'CueTrackPositions';
- $EBMLidList[EBML_ID_DATEUTC] = 'DateUTC';
- $EBMLidList[EBML_ID_DEFAULTDURATION] = 'DefaultDuration';
- $EBMLidList[EBML_ID_DISPLAYHEIGHT] = 'DisplayHeight';
- $EBMLidList[EBML_ID_DISPLAYUNIT] = 'DisplayUnit';
- $EBMLidList[EBML_ID_DISPLAYWIDTH] = 'DisplayWidth';
- $EBMLidList[EBML_ID_DOCTYPE] = 'DocType';
- $EBMLidList[EBML_ID_DOCTYPEREADVERSION] = 'DocTypeReadVersion';
- $EBMLidList[EBML_ID_DOCTYPEVERSION] = 'DocTypeVersion';
- $EBMLidList[EBML_ID_DURATION] = 'Duration';
- $EBMLidList[EBML_ID_EBML] = 'EBML';
- $EBMLidList[EBML_ID_EBMLMAXIDLENGTH] = 'EBMLMaxIDLength';
- $EBMLidList[EBML_ID_EBMLMAXSIZELENGTH] = 'EBMLMaxSizeLength';
- $EBMLidList[EBML_ID_EBMLREADVERSION] = 'EBMLReadVersion';
- $EBMLidList[EBML_ID_EBMLVERSION] = 'EBMLVersion';
- $EBMLidList[EBML_ID_EDITIONENTRY] = 'EditionEntry';
- $EBMLidList[EBML_ID_EDITIONFLAGDEFAULT] = 'EditionFlagDefault';
- $EBMLidList[EBML_ID_EDITIONFLAGHIDDEN] = 'EditionFlagHidden';
- $EBMLidList[EBML_ID_EDITIONFLAGORDERED] = 'EditionFlagOrdered';
- $EBMLidList[EBML_ID_EDITIONUID] = 'EditionUID';
- $EBMLidList[EBML_ID_FILEDATA] = 'FileData';
- $EBMLidList[EBML_ID_FILEDESCRIPTION] = 'FileDescription';
- $EBMLidList[EBML_ID_FILEMIMETYPE] = 'FileMimeType';
- $EBMLidList[EBML_ID_FILENAME] = 'FileName';
- $EBMLidList[EBML_ID_FILEREFERRAL] = 'FileReferral';
- $EBMLidList[EBML_ID_FILEUID] = 'FileUID';
- $EBMLidList[EBML_ID_FLAGDEFAULT] = 'FlagDefault';
- $EBMLidList[EBML_ID_FLAGENABLED] = 'FlagEnabled';
- $EBMLidList[EBML_ID_FLAGFORCED] = 'FlagForced';
- $EBMLidList[EBML_ID_FLAGINTERLACED] = 'FlagInterlaced';
- $EBMLidList[EBML_ID_FLAGLACING] = 'FlagLacing';
- $EBMLidList[EBML_ID_GAMMAVALUE] = 'GammaValue';
- $EBMLidList[EBML_ID_INFO] = 'Info';
- $EBMLidList[EBML_ID_LANGUAGE] = 'Language';
- $EBMLidList[EBML_ID_MAXBLOCKADDITIONID] = 'MaxBlockAdditionID';
- $EBMLidList[EBML_ID_MAXCACHE] = 'MaxCache';
- $EBMLidList[EBML_ID_MINCACHE] = 'MinCache';
- $EBMLidList[EBML_ID_MUXINGAPP] = 'MuxingApp';
- $EBMLidList[EBML_ID_NAME] = 'Name';
- $EBMLidList[EBML_ID_NEXTFILENAME] = 'NextFilename';
- $EBMLidList[EBML_ID_NEXTUID] = 'NextUID';
- $EBMLidList[EBML_ID_OUTPUTSAMPLINGFREQUENCY] = 'OutputSamplingFrequency';
- $EBMLidList[EBML_ID_PIXELCROPBOTTOM] = 'PixelCropBottom';
- $EBMLidList[EBML_ID_PIXELCROPLEFT] = 'PixelCropLeft';
- $EBMLidList[EBML_ID_PIXELCROPRIGHT] = 'PixelCropRight';
- $EBMLidList[EBML_ID_PIXELCROPTOP] = 'PixelCropTop';
- $EBMLidList[EBML_ID_PIXELHEIGHT] = 'PixelHeight';
- $EBMLidList[EBML_ID_PIXELWIDTH] = 'PixelWidth';
- $EBMLidList[EBML_ID_PREVFILENAME] = 'PrevFilename';
- $EBMLidList[EBML_ID_PREVUID] = 'PrevUID';
- $EBMLidList[EBML_ID_SAMPLINGFREQUENCY] = 'SamplingFrequency';
- $EBMLidList[EBML_ID_SEEK] = 'Seek';
- $EBMLidList[EBML_ID_SEEKHEAD] = 'SeekHead';
- $EBMLidList[EBML_ID_SEEKID] = 'SeekID';
- $EBMLidList[EBML_ID_SEEKPOSITION] = 'SeekPosition';
- $EBMLidList[EBML_ID_SEGMENT] = 'Segment';
- $EBMLidList[EBML_ID_SEGMENTFAMILY] = 'SegmentFamily';
- $EBMLidList[EBML_ID_SEGMENTFILENAME] = 'SegmentFilename';
- $EBMLidList[EBML_ID_SEGMENTUID] = 'SegmentUID';
- $EBMLidList[EBML_ID_SIMPLETAG] = 'SimpleTag';
- $EBMLidList[EBML_ID_CLUSTERSLICES] = 'ClusterSlices';
- $EBMLidList[EBML_ID_STEREOMODE] = 'StereoMode';
- $EBMLidList[EBML_ID_TAG] = 'Tag';
- $EBMLidList[EBML_ID_TAGATTACHMENTUID] = 'TagAttachmentUID';
- $EBMLidList[EBML_ID_TAGBINARY] = 'TagBinary';
- $EBMLidList[EBML_ID_TAGCHAPTERUID] = 'TagChapterUID';
- $EBMLidList[EBML_ID_TAGDEFAULT] = 'TagDefault';
- $EBMLidList[EBML_ID_TAGEDITIONUID] = 'TagEditionUID';
- $EBMLidList[EBML_ID_TAGLANGUAGE] = 'TagLanguage';
- $EBMLidList[EBML_ID_TAGNAME] = 'TagName';
- $EBMLidList[EBML_ID_TAGTRACKUID] = 'TagTrackUID';
- $EBMLidList[EBML_ID_TAGS] = 'Tags';
- $EBMLidList[EBML_ID_TAGSTRING] = 'TagString';
- $EBMLidList[EBML_ID_TARGETS] = 'Targets';
- $EBMLidList[EBML_ID_TARGETTYPE] = 'TargetType';
- $EBMLidList[EBML_ID_TARGETTYPEVALUE] = 'TargetTypeValue';
- $EBMLidList[EBML_ID_TIMECODESCALE] = 'TimecodeScale';
- $EBMLidList[EBML_ID_TITLE] = 'Title';
- $EBMLidList[EBML_ID_TRACKENTRY] = 'TrackEntry';
- $EBMLidList[EBML_ID_TRACKNUMBER] = 'TrackNumber';
- $EBMLidList[EBML_ID_TRACKOFFSET] = 'TrackOffset';
- $EBMLidList[EBML_ID_TRACKOVERLAY] = 'TrackOverlay';
- $EBMLidList[EBML_ID_TRACKS] = 'Tracks';
- $EBMLidList[EBML_ID_TRACKTIMECODESCALE] = 'TrackTimecodeScale';
- $EBMLidList[EBML_ID_TRACKTRANSLATE] = 'TrackTranslate';
- $EBMLidList[EBML_ID_TRACKTRANSLATECODEC] = 'TrackTranslateCodec';
- $EBMLidList[EBML_ID_TRACKTRANSLATEEDITIONUID] = 'TrackTranslateEditionUID';
- $EBMLidList[EBML_ID_TRACKTRANSLATETRACKID] = 'TrackTranslateTrackID';
- $EBMLidList[EBML_ID_TRACKTYPE] = 'TrackType';
- $EBMLidList[EBML_ID_TRACKUID] = 'TrackUID';
- $EBMLidList[EBML_ID_VIDEO] = 'Video';
- $EBMLidList[EBML_ID_VOID] = 'Void';
- $EBMLidList[EBML_ID_WRITINGAPP] = 'WritingApp';
- }
-
- return (isset($EBMLidList[$value]) ? $EBMLidList[$value] : dechex($value));
- }
-
- private static function getDefaultStreamInfo($streams)
- {
- foreach (array_reverse($streams) as $stream) {
- if ($stream['default']) {
- break;
- }
- }
- unset($stream['default']);
- if (isset($stream['name'])) {
- unset($stream['name']);
- }
-
- $info = $stream;
- $info['streams'] = $streams;
-
- return $info;
- }
-
-}
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.audio-video.mpeg.php b/3rdparty/getid3/module.audio-video.mpeg.php
deleted file mode 100644
index 499b740c390..00000000000
--- a/3rdparty/getid3/module.audio-video.mpeg.php
+++ /dev/null
@@ -1,299 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.audio-video.mpeg.php //
-// module for analyzing MPEG files //
-// dependencies: module.audio.mp3.php //
-// ///
-/////////////////////////////////////////////////////////////////
-
-getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.mp3.php', __FILE__, true);
-
-define('GETID3_MPEG_VIDEO_PICTURE_START', "\x00\x00\x01\x00");
-define('GETID3_MPEG_VIDEO_USER_DATA_START', "\x00\x00\x01\xB2");
-define('GETID3_MPEG_VIDEO_SEQUENCE_HEADER', "\x00\x00\x01\xB3");
-define('GETID3_MPEG_VIDEO_SEQUENCE_ERROR', "\x00\x00\x01\xB4");
-define('GETID3_MPEG_VIDEO_EXTENSION_START', "\x00\x00\x01\xB5");
-define('GETID3_MPEG_VIDEO_SEQUENCE_END', "\x00\x00\x01\xB7");
-define('GETID3_MPEG_VIDEO_GROUP_START', "\x00\x00\x01\xB8");
-define('GETID3_MPEG_AUDIO_START', "\x00\x00\x01\xC0");
-
-
-class getid3_mpeg extends getid3_handler
-{
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- if ($info['avdataend'] <= $info['avdataoffset']) {
- $info['error'][] = '"avdataend" ('.$info['avdataend'].') is unexpectedly less-than-or-equal-to "avdataoffset" ('.$info['avdataoffset'].')';
- return false;
- }
- $info['fileformat'] = 'mpeg';
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
- $MPEGstreamData = fread($this->getid3->fp, min(100000, $info['avdataend'] - $info['avdataoffset']));
- $MPEGstreamDataLength = strlen($MPEGstreamData);
-
- $foundVideo = true;
- $VideoChunkOffset = 0;
- while (substr($MPEGstreamData, $VideoChunkOffset++, 4) !== GETID3_MPEG_VIDEO_SEQUENCE_HEADER) {
- if ($VideoChunkOffset >= $MPEGstreamDataLength) {
- $foundVideo = false;
- break;
- }
- }
- if ($foundVideo) {
-
- // Start code 32 bits
- // horizontal frame size 12 bits
- // vertical frame size 12 bits
- // pixel aspect ratio 4 bits
- // frame rate 4 bits
- // bitrate 18 bits
- // marker bit 1 bit
- // VBV buffer size 10 bits
- // constrained parameter flag 1 bit
- // intra quant. matrix flag 1 bit
- // intra quant. matrix values 512 bits (present if matrix flag == 1)
- // non-intra quant. matrix flag 1 bit
- // non-intra quant. matrix values 512 bits (present if matrix flag == 1)
-
- $info['video']['dataformat'] = 'mpeg';
-
- $VideoChunkOffset += (strlen(GETID3_MPEG_VIDEO_SEQUENCE_HEADER) - 1);
-
- $FrameSizeDWORD = getid3_lib::BigEndian2Int(substr($MPEGstreamData, $VideoChunkOffset, 3));
- $VideoChunkOffset += 3;
-
- $AspectRatioFrameRateDWORD = getid3_lib::BigEndian2Int(substr($MPEGstreamData, $VideoChunkOffset, 1));
- $VideoChunkOffset += 1;
-
- $assortedinformation = getid3_lib::BigEndian2Bin(substr($MPEGstreamData, $VideoChunkOffset, 4));
- $VideoChunkOffset += 4;
-
- $info['mpeg']['video']['raw']['framesize_horizontal'] = ($FrameSizeDWORD & 0xFFF000) >> 12; // 12 bits for horizontal frame size
- $info['mpeg']['video']['raw']['framesize_vertical'] = ($FrameSizeDWORD & 0x000FFF); // 12 bits for vertical frame size
- $info['mpeg']['video']['raw']['pixel_aspect_ratio'] = ($AspectRatioFrameRateDWORD & 0xF0) >> 4;
- $info['mpeg']['video']['raw']['frame_rate'] = ($AspectRatioFrameRateDWORD & 0x0F);
-
- $info['mpeg']['video']['framesize_horizontal'] = $info['mpeg']['video']['raw']['framesize_horizontal'];
- $info['mpeg']['video']['framesize_vertical'] = $info['mpeg']['video']['raw']['framesize_vertical'];
-
- $info['mpeg']['video']['pixel_aspect_ratio'] = $this->MPEGvideoAspectRatioLookup($info['mpeg']['video']['raw']['pixel_aspect_ratio']);
- $info['mpeg']['video']['pixel_aspect_ratio_text'] = $this->MPEGvideoAspectRatioTextLookup($info['mpeg']['video']['raw']['pixel_aspect_ratio']);
- $info['mpeg']['video']['frame_rate'] = $this->MPEGvideoFramerateLookup($info['mpeg']['video']['raw']['frame_rate']);
-
- $info['mpeg']['video']['raw']['bitrate'] = getid3_lib::Bin2Dec(substr($assortedinformation, 0, 18));
- $info['mpeg']['video']['raw']['marker_bit'] = (bool) getid3_lib::Bin2Dec(substr($assortedinformation, 18, 1));
- $info['mpeg']['video']['raw']['vbv_buffer_size'] = getid3_lib::Bin2Dec(substr($assortedinformation, 19, 10));
- $info['mpeg']['video']['raw']['constrained_param_flag'] = (bool) getid3_lib::Bin2Dec(substr($assortedinformation, 29, 1));
- $info['mpeg']['video']['raw']['intra_quant_flag'] = (bool) getid3_lib::Bin2Dec(substr($assortedinformation, 30, 1));
- if ($info['mpeg']['video']['raw']['intra_quant_flag']) {
-
- // read 512 bits
- $info['mpeg']['video']['raw']['intra_quant'] = getid3_lib::BigEndian2Bin(substr($MPEGstreamData, $VideoChunkOffset, 64));
- $VideoChunkOffset += 64;
-
- $info['mpeg']['video']['raw']['non_intra_quant_flag'] = (bool) getid3_lib::Bin2Dec(substr($info['mpeg']['video']['raw']['intra_quant'], 511, 1));
- $info['mpeg']['video']['raw']['intra_quant'] = getid3_lib::Bin2Dec(substr($assortedinformation, 31, 1)).substr(getid3_lib::BigEndian2Bin(substr($MPEGstreamData, $VideoChunkOffset, 64)), 0, 511);
-
- if ($info['mpeg']['video']['raw']['non_intra_quant_flag']) {
- $info['mpeg']['video']['raw']['non_intra_quant'] = substr($MPEGstreamData, $VideoChunkOffset, 64);
- $VideoChunkOffset += 64;
- }
-
- } else {
-
- $info['mpeg']['video']['raw']['non_intra_quant_flag'] = (bool) getid3_lib::Bin2Dec(substr($assortedinformation, 31, 1));
- if ($info['mpeg']['video']['raw']['non_intra_quant_flag']) {
- $info['mpeg']['video']['raw']['non_intra_quant'] = substr($MPEGstreamData, $VideoChunkOffset, 64);
- $VideoChunkOffset += 64;
- }
-
- }
-
- if ($info['mpeg']['video']['raw']['bitrate'] == 0x3FFFF) { // 18 set bits
-
- $info['warning'][] = 'This version of getID3() ['.$this->getid3->version().'] cannot determine average bitrate of VBR MPEG video files';
- $info['mpeg']['video']['bitrate_mode'] = 'vbr';
-
- } else {
-
- $info['mpeg']['video']['bitrate'] = $info['mpeg']['video']['raw']['bitrate'] * 400;
- $info['mpeg']['video']['bitrate_mode'] = 'cbr';
- $info['video']['bitrate'] = $info['mpeg']['video']['bitrate'];
-
- }
-
- $info['video']['resolution_x'] = $info['mpeg']['video']['framesize_horizontal'];
- $info['video']['resolution_y'] = $info['mpeg']['video']['framesize_vertical'];
- $info['video']['frame_rate'] = $info['mpeg']['video']['frame_rate'];
- $info['video']['bitrate_mode'] = $info['mpeg']['video']['bitrate_mode'];
- $info['video']['pixel_aspect_ratio'] = $info['mpeg']['video']['pixel_aspect_ratio'];
- $info['video']['lossless'] = false;
- $info['video']['bits_per_sample'] = 24;
-
- } else {
-
- $info['error'][] = 'Could not find start of video block in the first 100,000 bytes (or before end of file) - this might not be an MPEG-video file?';
-
- }
-
- //0x000001B3 begins the sequence_header of every MPEG video stream.
- //But in MPEG-2, this header must immediately be followed by an
- //extension_start_code (0x000001B5) with a sequence_extension ID (1).
- //(This extension contains all the additional MPEG-2 stuff.)
- //MPEG-1 doesn't have this extension, so that's a sure way to tell the
- //difference between MPEG-1 and MPEG-2 video streams.
-
- if (substr($MPEGstreamData, $VideoChunkOffset, 4) == GETID3_MPEG_VIDEO_EXTENSION_START) {
- $info['video']['codec'] = 'MPEG-2';
- } else {
- $info['video']['codec'] = 'MPEG-1';
- }
-
-
- $AudioChunkOffset = 0;
- while (true) {
- while (substr($MPEGstreamData, $AudioChunkOffset++, 4) !== GETID3_MPEG_AUDIO_START) {
- if ($AudioChunkOffset >= $MPEGstreamDataLength) {
- break 2;
- }
- }
-
- $getid3_temp = new getID3();
- $getid3_temp->openfile($this->getid3->filename);
- $getid3_temp->info = $info;
- $getid3_mp3 = new getid3_mp3($getid3_temp);
- for ($i = 0; $i <= 7; $i++) {
- // some files have the MPEG-audio header 8 bytes after the end of the $00 $00 $01 $C0 signature, some have it up to 13 bytes (or more?) after
- // I have no idea why or what the difference is, so this is a stupid hack.
- // If anybody has any better idea of what's going on, please let me know - info@getid3.org
- fseek($getid3_temp->fp, ftell($this->getid3->fp), SEEK_SET);
- $getid3_temp->info = $info; // only overwrite real data if valid header found
- if ($getid3_mp3->decodeMPEGaudioHeader(($AudioChunkOffset + 3) + 8 + $i, $getid3_temp->info, false)) {
- $info = $getid3_temp->info;
- $info['audio']['bitrate_mode'] = 'cbr';
- $info['audio']['lossless'] = false;
- unset($getid3_temp, $getid3_mp3);
- break 2;
- }
- }
- unset($getid3_temp, $getid3_mp3);
- }
-
- // Temporary hack to account for interleaving overhead:
- if (!empty($info['video']['bitrate']) && !empty($info['audio']['bitrate'])) {
- $info['playtime_seconds'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / ($info['video']['bitrate'] + $info['audio']['bitrate']);
-
- // Interleaved MPEG audio/video files have a certain amount of overhead that varies
- // by both video and audio bitrates, and not in any sensible, linear/logarithmic patter
- // Use interpolated lookup tables to approximately guess how much is overhead, because
- // playtime is calculated as filesize / total-bitrate
- $info['playtime_seconds'] *= $this->MPEGsystemNonOverheadPercentage($info['video']['bitrate'], $info['audio']['bitrate']);
-
- //switch ($info['video']['bitrate']) {
- // case('5000000'):
- // $multiplier = 0.93292642112380355828048824319889;
- // break;
- // case('5500000'):
- // $multiplier = 0.93582895375200989965359777343219;
- // break;
- // case('6000000'):
- // $multiplier = 0.93796247714820932532911373859139;
- // break;
- // case('7000000'):
- // $multiplier = 0.9413264083635103463010117778776;
- // break;
- // default:
- // $multiplier = 1;
- // break;
- //}
- //$info['playtime_seconds'] *= $multiplier;
- //$info['warning'][] = 'Interleaved MPEG audio/video playtime may be inaccurate. With current hack should be within a few seconds of accurate. Report to info@getid3.org if off by more than 10 seconds.';
- if ($info['video']['bitrate'] < 50000) {
- $info['warning'][] = 'Interleaved MPEG audio/video playtime may be slightly inaccurate for video bitrates below 100kbps. Except in extreme low-bitrate situations, error should be less than 1%. Report to info@getid3.org if greater than this.';
- }
- }
-
- return true;
- }
-
-
- function MPEGsystemNonOverheadPercentage($VideoBitrate, $AudioBitrate) {
- $OverheadPercentage = 0;
-
- $AudioBitrate = max(min($AudioBitrate / 1000, 384), 32); // limit to range of 32kbps - 384kbps (should be only legal bitrates, but maybe VBR?)
- $VideoBitrate = max(min($VideoBitrate / 1000, 10000), 10); // limit to range of 10kbps - 10Mbps (beyond that curves flatten anyways, no big loss)
-
-
- //OMBB[audiobitrate] = array(video-10kbps, video-100kbps, video-1000kbps, video-10000kbps)
- $OverheadMultiplierByBitrate[32] = array(0, 0.9676287944368530, 0.9802276264360310, 0.9844916183244460, 0.9852821845179940);
- $OverheadMultiplierByBitrate[48] = array(0, 0.9779100089209830, 0.9787770035359320, 0.9846738664076130, 0.9852683013799960);
- $OverheadMultiplierByBitrate[56] = array(0, 0.9731249855367600, 0.9776624308938040, 0.9832606361852130, 0.9843922606633340);
- $OverheadMultiplierByBitrate[64] = array(0, 0.9755642683275760, 0.9795256705493390, 0.9836573009193170, 0.9851122539404470);
- $OverheadMultiplierByBitrate[96] = array(0, 0.9788025247497290, 0.9798553314148700, 0.9822956869792560, 0.9834815119124690);
- $OverheadMultiplierByBitrate[128] = array(0, 0.9816940050925480, 0.9821675936072120, 0.9829756927470870, 0.9839763420152050);
- $OverheadMultiplierByBitrate[160] = array(0, 0.9825894094561180, 0.9820913399073960, 0.9823907143253970, 0.9832821783651570);
- $OverheadMultiplierByBitrate[192] = array(0, 0.9832038474336260, 0.9825731694317960, 0.9821028622712400, 0.9828262076447620);
- $OverheadMultiplierByBitrate[224] = array(0, 0.9836516298538770, 0.9824718601823890, 0.9818302180625380, 0.9823735101626480);
- $OverheadMultiplierByBitrate[256] = array(0, 0.9845863022094920, 0.9837229411967540, 0.9824521662210830, 0.9828645172100790);
- $OverheadMultiplierByBitrate[320] = array(0, 0.9849565280263180, 0.9837683142805110, 0.9822885275960400, 0.9824424382727190);
- $OverheadMultiplierByBitrate[384] = array(0, 0.9856094774357600, 0.9844573394432720, 0.9825970399837330, 0.9824673808303890);
-
- $BitrateToUseMin = 32;
- $BitrateToUseMax = 32;
- $previousBitrate = 32;
- foreach ($OverheadMultiplierByBitrate as $key => $value) {
- if ($AudioBitrate >= $previousBitrate) {
- $BitrateToUseMin = $previousBitrate;
- }
- if ($AudioBitrate < $key) {
- $BitrateToUseMax = $key;
- break;
- }
- $previousBitrate = $key;
- }
- $FactorA = ($BitrateToUseMax - $AudioBitrate) / ($BitrateToUseMax - $BitrateToUseMin);
-
- $VideoBitrateLog10 = log10($VideoBitrate);
- $VideoFactorMin1 = $OverheadMultiplierByBitrate[$BitrateToUseMin][floor($VideoBitrateLog10)];
- $VideoFactorMin2 = $OverheadMultiplierByBitrate[$BitrateToUseMax][floor($VideoBitrateLog10)];
- $VideoFactorMax1 = $OverheadMultiplierByBitrate[$BitrateToUseMin][ceil($VideoBitrateLog10)];
- $VideoFactorMax2 = $OverheadMultiplierByBitrate[$BitrateToUseMax][ceil($VideoBitrateLog10)];
- $FactorV = $VideoBitrateLog10 - floor($VideoBitrateLog10);
-
- $OverheadPercentage = $VideoFactorMin1 * $FactorA * $FactorV;
- $OverheadPercentage += $VideoFactorMin2 * (1 - $FactorA) * $FactorV;
- $OverheadPercentage += $VideoFactorMax1 * $FactorA * (1 - $FactorV);
- $OverheadPercentage += $VideoFactorMax2 * (1 - $FactorA) * (1 - $FactorV);
-
- return $OverheadPercentage;
- }
-
-
- function MPEGvideoFramerateLookup($rawframerate) {
- $MPEGvideoFramerateLookup = array(0, 23.976, 24, 25, 29.97, 30, 50, 59.94, 60);
- return (isset($MPEGvideoFramerateLookup[$rawframerate]) ? (float) $MPEGvideoFramerateLookup[$rawframerate] : (float) 0);
- }
-
- function MPEGvideoAspectRatioLookup($rawaspectratio) {
- $MPEGvideoAspectRatioLookup = array(0, 1, 0.6735, 0.7031, 0.7615, 0.8055, 0.8437, 0.8935, 0.9157, 0.9815, 1.0255, 1.0695, 1.0950, 1.1575, 1.2015, 0);
- return (isset($MPEGvideoAspectRatioLookup[$rawaspectratio]) ? (float) $MPEGvideoAspectRatioLookup[$rawaspectratio] : (float) 0);
- }
-
- function MPEGvideoAspectRatioTextLookup($rawaspectratio) {
- $MPEGvideoAspectRatioTextLookup = array('forbidden', 'square pixels', '0.6735', '16:9, 625 line, PAL', '0.7615', '0.8055', '16:9, 525 line, NTSC', '0.8935', '4:3, 625 line, PAL, CCIR601', '0.9815', '1.0255', '1.0695', '4:3, 525 line, NTSC, CCIR601', '1.1575', '1.2015', 'reserved');
- return (isset($MPEGvideoAspectRatioTextLookup[$rawaspectratio]) ? $MPEGvideoAspectRatioTextLookup[$rawaspectratio] : '');
- }
-
-}
-
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.audio-video.nsv.php b/3rdparty/getid3/module.audio-video.nsv.php
deleted file mode 100644
index 5a587e67208..00000000000
--- a/3rdparty/getid3/module.audio-video.nsv.php
+++ /dev/null
@@ -1,226 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.audio.nsv.php //
-// module for analyzing Nullsoft NSV files //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_nsv extends getid3_handler
-{
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
- $NSVheader = fread($this->getid3->fp, 4);
-
- switch ($NSVheader) {
- case 'NSVs':
- if ($this->getNSVsHeaderFilepointer(0)) {
- $info['fileformat'] = 'nsv';
- $info['audio']['dataformat'] = 'nsv';
- $info['video']['dataformat'] = 'nsv';
- $info['audio']['lossless'] = false;
- $info['video']['lossless'] = false;
- }
- break;
-
- case 'NSVf':
- if ($this->getNSVfHeaderFilepointer(0)) {
- $info['fileformat'] = 'nsv';
- $info['audio']['dataformat'] = 'nsv';
- $info['video']['dataformat'] = 'nsv';
- $info['audio']['lossless'] = false;
- $info['video']['lossless'] = false;
- $this->getNSVsHeaderFilepointer($info['nsv']['NSVf']['header_length']);
- }
- break;
-
- default:
- $info['error'][] = 'Expecting "NSVs" or "NSVf" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($NSVheader).'"';
- return false;
- break;
- }
-
- if (!isset($info['nsv']['NSVf'])) {
- $info['warning'][] = 'NSVf header not present - cannot calculate playtime or bitrate';
- }
-
- return true;
- }
-
- function getNSVsHeaderFilepointer($fileoffset) {
- $info = &$this->getid3->info;
- fseek($this->getid3->fp, $fileoffset, SEEK_SET);
- $NSVsheader = fread($this->getid3->fp, 28);
- $offset = 0;
-
- $info['nsv']['NSVs']['identifier'] = substr($NSVsheader, $offset, 4);
- $offset += 4;
-
- if ($info['nsv']['NSVs']['identifier'] != 'NSVs') {
- $info['error'][] = 'expected "NSVs" at offset ('.$fileoffset.'), found "'.$info['nsv']['NSVs']['identifier'].'" instead';
- unset($info['nsv']['NSVs']);
- return false;
- }
-
- $info['nsv']['NSVs']['offset'] = $fileoffset;
-
- $info['nsv']['NSVs']['video_codec'] = substr($NSVsheader, $offset, 4);
- $offset += 4;
- $info['nsv']['NSVs']['audio_codec'] = substr($NSVsheader, $offset, 4);
- $offset += 4;
- $info['nsv']['NSVs']['resolution_x'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 2));
- $offset += 2;
- $info['nsv']['NSVs']['resolution_y'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 2));
- $offset += 2;
-
- $info['nsv']['NSVs']['framerate_index'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1));
- $offset += 1;
- //$info['nsv']['NSVs']['unknown1b'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1));
- $offset += 1;
- //$info['nsv']['NSVs']['unknown1c'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1));
- $offset += 1;
- //$info['nsv']['NSVs']['unknown1d'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1));
- $offset += 1;
- //$info['nsv']['NSVs']['unknown2a'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1));
- $offset += 1;
- //$info['nsv']['NSVs']['unknown2b'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1));
- $offset += 1;
- //$info['nsv']['NSVs']['unknown2c'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1));
- $offset += 1;
- //$info['nsv']['NSVs']['unknown2d'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1));
- $offset += 1;
-
- switch ($info['nsv']['NSVs']['audio_codec']) {
- case 'PCM ':
- $info['nsv']['NSVs']['bits_channel'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1));
- $offset += 1;
- $info['nsv']['NSVs']['channels'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 1));
- $offset += 1;
- $info['nsv']['NSVs']['sample_rate'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 2));
- $offset += 2;
-
- $info['audio']['sample_rate'] = $info['nsv']['NSVs']['sample_rate'];
- break;
-
- case 'MP3 ':
- case 'NONE':
- default:
- //$info['nsv']['NSVs']['unknown3'] = getid3_lib::LittleEndian2Int(substr($NSVsheader, $offset, 4));
- $offset += 4;
- break;
- }
-
- $info['video']['resolution_x'] = $info['nsv']['NSVs']['resolution_x'];
- $info['video']['resolution_y'] = $info['nsv']['NSVs']['resolution_y'];
- $info['nsv']['NSVs']['frame_rate'] = $this->NSVframerateLookup($info['nsv']['NSVs']['framerate_index']);
- $info['video']['frame_rate'] = $info['nsv']['NSVs']['frame_rate'];
- $info['video']['bits_per_sample'] = 24;
- $info['video']['pixel_aspect_ratio'] = (float) 1;
-
- return true;
- }
-
- function getNSVfHeaderFilepointer($fileoffset, $getTOCoffsets=false) {
- $info = &$this->getid3->info;
- fseek($this->getid3->fp, $fileoffset, SEEK_SET);
- $NSVfheader = fread($this->getid3->fp, 28);
- $offset = 0;
-
- $info['nsv']['NSVf']['identifier'] = substr($NSVfheader, $offset, 4);
- $offset += 4;
-
- if ($info['nsv']['NSVf']['identifier'] != 'NSVf') {
- $info['error'][] = 'expected "NSVf" at offset ('.$fileoffset.'), found "'.$info['nsv']['NSVf']['identifier'].'" instead';
- unset($info['nsv']['NSVf']);
- return false;
- }
-
- $info['nsv']['NSVs']['offset'] = $fileoffset;
-
- $info['nsv']['NSVf']['header_length'] = getid3_lib::LittleEndian2Int(substr($NSVfheader, $offset, 4));
- $offset += 4;
- $info['nsv']['NSVf']['file_size'] = getid3_lib::LittleEndian2Int(substr($NSVfheader, $offset, 4));
- $offset += 4;
-
- if ($info['nsv']['NSVf']['file_size'] > $info['avdataend']) {
- $info['warning'][] = 'truncated file - NSVf header indicates '.$info['nsv']['NSVf']['file_size'].' bytes, file actually '.$info['avdataend'].' bytes';
- }
-
- $info['nsv']['NSVf']['playtime_ms'] = getid3_lib::LittleEndian2Int(substr($NSVfheader, $offset, 4));
- $offset += 4;
- $info['nsv']['NSVf']['meta_size'] = getid3_lib::LittleEndian2Int(substr($NSVfheader, $offset, 4));
- $offset += 4;
- $info['nsv']['NSVf']['TOC_entries_1'] = getid3_lib::LittleEndian2Int(substr($NSVfheader, $offset, 4));
- $offset += 4;
- $info['nsv']['NSVf']['TOC_entries_2'] = getid3_lib::LittleEndian2Int(substr($NSVfheader, $offset, 4));
- $offset += 4;
-
- if ($info['nsv']['NSVf']['playtime_ms'] == 0) {
- $info['error'][] = 'Corrupt NSV file: NSVf.playtime_ms == zero';
- return false;
- }
-
- $NSVfheader .= fread($this->getid3->fp, $info['nsv']['NSVf']['meta_size'] + (4 * $info['nsv']['NSVf']['TOC_entries_1']) + (4 * $info['nsv']['NSVf']['TOC_entries_2']));
- $NSVfheaderlength = strlen($NSVfheader);
- $info['nsv']['NSVf']['metadata'] = substr($NSVfheader, $offset, $info['nsv']['NSVf']['meta_size']);
- $offset += $info['nsv']['NSVf']['meta_size'];
-
- if ($getTOCoffsets) {
- $TOCcounter = 0;
- while ($TOCcounter < $info['nsv']['NSVf']['TOC_entries_1']) {
- if ($TOCcounter < $info['nsv']['NSVf']['TOC_entries_1']) {
- $info['nsv']['NSVf']['TOC_1'][$TOCcounter] = getid3_lib::LittleEndian2Int(substr($NSVfheader, $offset, 4));
- $offset += 4;
- $TOCcounter++;
- }
- }
- }
-
- if (trim($info['nsv']['NSVf']['metadata']) != '') {
- $info['nsv']['NSVf']['metadata'] = str_replace('`', "\x01", $info['nsv']['NSVf']['metadata']);
- $CommentPairArray = explode("\x01".' ', $info['nsv']['NSVf']['metadata']);
- foreach ($CommentPairArray as $CommentPair) {
- if (strstr($CommentPair, '='."\x01")) {
- list($key, $value) = explode('='."\x01", $CommentPair, 2);
- $info['nsv']['comments'][strtolower($key)][] = trim(str_replace("\x01", '', $value));
- }
- }
- }
-
- $info['playtime_seconds'] = $info['nsv']['NSVf']['playtime_ms'] / 1000;
- $info['bitrate'] = ($info['nsv']['NSVf']['file_size'] * 8) / $info['playtime_seconds'];
-
- return true;
- }
-
-
- static function NSVframerateLookup($framerateindex) {
- if ($framerateindex <= 127) {
- return (float) $framerateindex;
- }
- static $NSVframerateLookup = array();
- if (empty($NSVframerateLookup)) {
- $NSVframerateLookup[129] = (float) 29.970;
- $NSVframerateLookup[131] = (float) 23.976;
- $NSVframerateLookup[133] = (float) 14.985;
- $NSVframerateLookup[197] = (float) 59.940;
- $NSVframerateLookup[199] = (float) 47.952;
- }
- return (isset($NSVframerateLookup[$framerateindex]) ? $NSVframerateLookup[$framerateindex] : false);
- }
-
-}
-
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.audio-video.quicktime.php b/3rdparty/getid3/module.audio-video.quicktime.php
deleted file mode 100644
index 3e96ea1a0c2..00000000000
--- a/3rdparty/getid3/module.audio-video.quicktime.php
+++ /dev/null
@@ -1,2134 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.audio-video.quicktime.php //
-// module for analyzing Quicktime and MP3-in-MP4 files //
-// dependencies: module.audio.mp3.php //
-// ///
-/////////////////////////////////////////////////////////////////
-
-getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.mp3.php', __FILE__, true);
-
-class getid3_quicktime extends getid3_handler
-{
-
- var $ReturnAtomData = true;
- var $ParseAllPossibleAtoms = false;
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- $info['fileformat'] = 'quicktime';
- $info['quicktime']['hinting'] = false;
- $info['quicktime']['controller'] = 'standard'; // may be overridden if 'ctyp' atom is present
-
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
-
- $offset = 0;
- $atomcounter = 0;
-
- while ($offset < $info['avdataend']) {
- if (!getid3_lib::intValueSupported($offset)) {
- $info['error'][] = 'Unable to parse atom at offset '.$offset.' because beyond '.round(PHP_INT_MAX / 1073741824).'GB limit of PHP filesystem functions';
- break;
- }
- fseek($this->getid3->fp, $offset, SEEK_SET);
- $AtomHeader = fread($this->getid3->fp, 8);
-
- $atomsize = getid3_lib::BigEndian2Int(substr($AtomHeader, 0, 4));
- $atomname = substr($AtomHeader, 4, 4);
-
- // 64-bit MOV patch by jlegatektnc*com
- if ($atomsize == 1) {
- $atomsize = getid3_lib::BigEndian2Int(fread($this->getid3->fp, 8));
- }
-
- $info['quicktime'][$atomname]['name'] = $atomname;
- $info['quicktime'][$atomname]['size'] = $atomsize;
- $info['quicktime'][$atomname]['offset'] = $offset;
-
- if (($offset + $atomsize) > $info['avdataend']) {
- $info['error'][] = 'Atom at offset '.$offset.' claims to go beyond end-of-file (length: '.$atomsize.' bytes)';
- return false;
- }
-
- if ($atomsize == 0) {
- // Furthermore, for historical reasons the list of atoms is optionally
- // terminated by a 32-bit integer set to 0. If you are writing a program
- // to read user data atoms, you should allow for the terminating 0.
- break;
- }
- switch ($atomname) {
- case 'mdat': // Media DATa atom
- // 'mdat' contains the actual data for the audio/video
- if (($atomsize > 8) && (!isset($info['avdataend_tmp']) || ($info['quicktime'][$atomname]['size'] > ($info['avdataend_tmp'] - $info['avdataoffset'])))) {
-
- $info['avdataoffset'] = $info['quicktime'][$atomname]['offset'] + 8;
- $OldAVDataEnd = $info['avdataend'];
- $info['avdataend'] = $info['quicktime'][$atomname]['offset'] + $info['quicktime'][$atomname]['size'];
-
- $getid3_temp = new getID3();
- $getid3_temp->openfile($this->getid3->filename);
- $getid3_temp->info['avdataoffset'] = $info['avdataoffset'];
- $getid3_temp->info['avdataend'] = $info['avdataend'];
- $getid3_mp3 = new getid3_mp3($getid3_temp);
- if ($getid3_mp3->MPEGaudioHeaderValid($getid3_mp3->MPEGaudioHeaderDecode(fread($this->getid3->fp, 4)))) {
- $getid3_mp3->getOnlyMPEGaudioInfo($getid3_temp->info['avdataoffset'], false);
- if (!empty($getid3_temp->info['warning'])) {
- foreach ($getid3_temp->info['warning'] as $value) {
- $info['warning'][] = $value;
- }
- }
- if (!empty($getid3_temp->info['mpeg'])) {
- $info['mpeg'] = $getid3_temp->info['mpeg'];
- if (isset($info['mpeg']['audio'])) {
- $info['audio']['dataformat'] = 'mp3';
- $info['audio']['codec'] = (!empty($info['mpeg']['audio']['encoder']) ? $info['mpeg']['audio']['encoder'] : (!empty($info['mpeg']['audio']['codec']) ? $info['mpeg']['audio']['codec'] : (!empty($info['mpeg']['audio']['LAME']) ? 'LAME' :'mp3')));
- $info['audio']['sample_rate'] = $info['mpeg']['audio']['sample_rate'];
- $info['audio']['channels'] = $info['mpeg']['audio']['channels'];
- $info['audio']['bitrate'] = $info['mpeg']['audio']['bitrate'];
- $info['audio']['bitrate_mode'] = strtolower($info['mpeg']['audio']['bitrate_mode']);
- $info['bitrate'] = $info['audio']['bitrate'];
- }
- }
- }
- unset($getid3_mp3, $getid3_temp);
- $info['avdataend'] = $OldAVDataEnd;
- unset($OldAVDataEnd);
-
- }
- break;
-
- case 'free': // FREE space atom
- case 'skip': // SKIP atom
- case 'wide': // 64-bit expansion placeholder atom
- // 'free', 'skip' and 'wide' are just padding, contains no useful data at all
- break;
-
- default:
- $atomHierarchy = array();
- $info['quicktime'][$atomname] = $this->QuicktimeParseAtom($atomname, $atomsize, fread($this->getid3->fp, $atomsize), $offset, $atomHierarchy, $this->ParseAllPossibleAtoms);
- break;
- }
-
- $offset += $atomsize;
- $atomcounter++;
- }
-
- if (!empty($info['avdataend_tmp'])) {
- // this value is assigned to a temp value and then erased because
- // otherwise any atoms beyond the 'mdat' atom would not get parsed
- $info['avdataend'] = $info['avdataend_tmp'];
- unset($info['avdataend_tmp']);
- }
-
- if (!isset($info['bitrate']) && isset($info['playtime_seconds'])) {
- $info['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds'];
- }
- if (isset($info['bitrate']) && !isset($info['audio']['bitrate']) && !isset($info['quicktime']['video'])) {
- $info['audio']['bitrate'] = $info['bitrate'];
- }
- if (!empty($info['playtime_seconds']) && !isset($info['video']['frame_rate']) && !empty($info['quicktime']['stts_framecount'])) {
- foreach ($info['quicktime']['stts_framecount'] as $key => $samples_count) {
- $samples_per_second = $samples_count / $info['playtime_seconds'];
- if ($samples_per_second > 240) {
- // has to be audio samples
- } else {
- $info['video']['frame_rate'] = $samples_per_second;
- break;
- }
- }
- }
- if (($info['audio']['dataformat'] == 'mp4') && empty($info['video']['resolution_x'])) {
- $info['fileformat'] = 'mp4';
- $info['mime_type'] = 'audio/mp4';
- unset($info['video']['dataformat']);
- }
-
- if (!$this->ReturnAtomData) {
- unset($info['quicktime']['moov']);
- }
-
- if (empty($info['audio']['dataformat']) && !empty($info['quicktime']['audio'])) {
- $info['audio']['dataformat'] = 'quicktime';
- }
- if (empty($info['video']['dataformat']) && !empty($info['quicktime']['video'])) {
- $info['video']['dataformat'] = 'quicktime';
- }
-
- return true;
- }
-
- function QuicktimeParseAtom($atomname, $atomsize, $atom_data, $baseoffset, &$atomHierarchy, $ParseAllPossibleAtoms) {
- // http://developer.apple.com/techpubs/quicktime/qtdevdocs/APIREF/INDEX/atomalphaindex.htm
-
- $info = &$this->getid3->info;
-
- $atom_parent = array_pop($atomHierarchy);
- array_push($atomHierarchy, $atomname);
- $atom_structure['hierarchy'] = implode(' ', $atomHierarchy);
- $atom_structure['name'] = $atomname;
- $atom_structure['size'] = $atomsize;
- $atom_structure['offset'] = $baseoffset;
-//echo getid3_lib::PrintHexBytes(substr($atom_data, 0, 8)).'<br>';
-//echo getid3_lib::PrintHexBytes(substr($atom_data, 0, 8), false).'<br><br>';
- switch ($atomname) {
- case 'moov': // MOVie container atom
- case 'trak': // TRAcK container atom
- case 'clip': // CLIPping container atom
- case 'matt': // track MATTe container atom
- case 'edts': // EDiTS container atom
- case 'tref': // Track REFerence container atom
- case 'mdia': // MeDIA container atom
- case 'minf': // Media INFormation container atom
- case 'dinf': // Data INFormation container atom
- case 'udta': // User DaTA container atom
- case 'cmov': // Compressed MOVie container atom
- case 'rmra': // Reference Movie Record Atom
- case 'rmda': // Reference Movie Descriptor Atom
- case 'gmhd': // Generic Media info HeaDer atom (seen on QTVR)
- $atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms);
- break;
-
- case 'ilst': // Item LiST container atom
- $atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms);
-
- // some "ilst" atoms contain data atoms that have a numeric name, and the data is far more accessible if the returned array is compacted
- $allnumericnames = true;
- foreach ($atom_structure['subatoms'] as $subatomarray) {
- if (!is_integer($subatomarray['name']) || (count($subatomarray['subatoms']) != 1)) {
- $allnumericnames = false;
- break;
- }
- }
- if ($allnumericnames) {
- $newData = array();
- foreach ($atom_structure['subatoms'] as $subatomarray) {
- foreach ($subatomarray['subatoms'] as $newData_subatomarray) {
- unset($newData_subatomarray['hierarchy'], $newData_subatomarray['name']);
- $newData[$subatomarray['name']] = $newData_subatomarray;
- break;
- }
- }
- $atom_structure['data'] = $newData;
- unset($atom_structure['subatoms']);
- }
- break;
-
- case "\x00\x00\x00\x01":
- case "\x00\x00\x00\x02":
- case "\x00\x00\x00\x03":
- case "\x00\x00\x00\x04":
- case "\x00\x00\x00\x05":
- $atomname = getid3_lib::BigEndian2Int($atomname);
- $atom_structure['name'] = $atomname;
- $atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms);
- break;
-
- case 'stbl': // Sample TaBLe container atom
- $atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms);
- $isVideo = false;
- $framerate = 0;
- $framecount = 0;
- foreach ($atom_structure['subatoms'] as $key => $value_array) {
- if (isset($value_array['sample_description_table'])) {
- foreach ($value_array['sample_description_table'] as $key2 => $value_array2) {
- if (isset($value_array2['data_format'])) {
- switch ($value_array2['data_format']) {
- case 'avc1':
- case 'mp4v':
- // video data
- $isVideo = true;
- break;
- case 'mp4a':
- // audio data
- break;
- }
- }
- }
- } elseif (isset($value_array['time_to_sample_table'])) {
- foreach ($value_array['time_to_sample_table'] as $key2 => $value_array2) {
- if (isset($value_array2['sample_count']) && isset($value_array2['sample_duration']) && ($value_array2['sample_duration'] > 0)) {
- $framerate = round($info['quicktime']['time_scale'] / $value_array2['sample_duration'], 3);
- $framecount = $value_array2['sample_count'];
- }
- }
- }
- }
- if ($isVideo && $framerate) {
- $info['quicktime']['video']['frame_rate'] = $framerate;
- $info['video']['frame_rate'] = $info['quicktime']['video']['frame_rate'];
- }
- if ($isVideo && $framecount) {
- $info['quicktime']['video']['frame_count'] = $framecount;
- }
- break;
-
-
- case 'aART': // Album ARTist
- case 'catg': // CaTeGory
- case 'covr': // COVeR artwork
- case 'cpil': // ComPILation
- case 'cprt': // CoPyRighT
- case 'desc': // DESCription
- case 'disk': // DISK number
- case 'egid': // Episode Global ID
- case 'gnre': // GeNRE
- case 'keyw': // KEYWord
- case 'ldes':
- case 'pcst': // PodCaST
- case 'pgap': // GAPless Playback
- case 'purd': // PURchase Date
- case 'purl': // Podcast URL
- case 'rati':
- case 'rndu':
- case 'rpdu':
- case 'rtng': // RaTiNG
- case 'stik':
- case 'tmpo': // TeMPO (BPM)
- case 'trkn': // TRacK Number
- case 'tves': // TV EpiSode
- case 'tvnn': // TV Network Name
- case 'tvsh': // TV SHow Name
- case 'tvsn': // TV SeasoN
- case 'akID': // iTunes store account type
- case 'apID':
- case 'atID':
- case 'cmID':
- case 'cnID':
- case 'geID':
- case 'plID':
- case 'sfID': // iTunes store country
- case 'alb': // ALBum
- case 'art': // ARTist
- case 'ART':
- case 'aut':
- case 'cmt': // CoMmenT
- case 'com': // COMposer
- case 'cpy':
- case 'day': // content created year
- case 'dir':
- case 'ed1':
- case 'ed2':
- case 'ed3':
- case 'ed4':
- case 'ed5':
- case 'ed6':
- case 'ed7':
- case 'ed8':
- case 'ed9':
- case 'enc':
- case 'fmt':
- case 'gen': // GENre
- case 'grp': // GRouPing
- case 'hst':
- case 'inf':
- case 'lyr': // LYRics
- case 'mak':
- case 'mod':
- case 'nam': // full NAMe
- case 'ope':
- case 'PRD':
- case 'prd':
- case 'prf':
- case 'req':
- case 'src':
- case 'swr':
- case 'too': // encoder
- case 'trk': // TRacK
- case 'url':
- case 'wrn':
- case 'wrt': // WRiTer
- case '----': // itunes specific
- if ($atom_parent == 'udta') {
- // User data atom handler
- $atom_structure['data_length'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 2));
- $atom_structure['language_id'] = getid3_lib::BigEndian2Int(substr($atom_data, 2, 2));
- $atom_structure['data'] = substr($atom_data, 4);
-
- $atom_structure['language'] = $this->QuicktimeLanguageLookup($atom_structure['language_id']);
- if (empty($info['comments']['language']) || (!in_array($atom_structure['language'], $info['comments']['language']))) {
- $info['comments']['language'][] = $atom_structure['language'];
- }
- } else {
- // Apple item list box atom handler
- $atomoffset = 0;
- if (substr($atom_data, 2, 2) == "\x10\xB5") {
- // not sure what it means, but observed on iPhone4 data.
- // Each $atom_data has 2 bytes of datasize, plus 0x10B5, then data
- while ($atomoffset < strlen($atom_data)) {
- $boxsmallsize = getid3_lib::BigEndian2Int(substr($atom_data, $atomoffset, 2));
- $boxsmalltype = substr($atom_data, $atomoffset + 2, 2);
- $boxsmalldata = substr($atom_data, $atomoffset + 4, $boxsmallsize);
- switch ($boxsmalltype) {
- case "\x10\xB5":
- $atom_structure['data'] = $boxsmalldata;
- break;
- default:
- $info['warning'][] = 'Unknown QuickTime smallbox type: "'.getid3_lib::PrintHexBytes($boxsmalltype).'" at offset '.$baseoffset;
- $atom_structure['data'] = $atom_data;
- break;
- }
- $atomoffset += (4 + $boxsmallsize);
- }
- } else {
- while ($atomoffset < strlen($atom_data)) {
- $boxsize = getid3_lib::BigEndian2Int(substr($atom_data, $atomoffset, 4));
- $boxtype = substr($atom_data, $atomoffset + 4, 4);
- $boxdata = substr($atom_data, $atomoffset + 8, $boxsize - 8);
-
- switch ($boxtype) {
- case 'mean':
- case 'name':
- $atom_structure[$boxtype] = substr($boxdata, 4);
- break;
-
- case 'data':
- $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($boxdata, 0, 1));
- $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($boxdata, 1, 3));
- switch ($atom_structure['flags_raw']) {
- case 0: // data flag
- case 21: // tmpo/cpil flag
- switch ($atomname) {
- case 'cpil':
- case 'pcst':
- case 'pgap':
- $atom_structure['data'] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 1));
- break;
-
- case 'tmpo':
- $atom_structure['data'] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 2));
- break;
-
- case 'disk':
- case 'trkn':
- $num = getid3_lib::BigEndian2Int(substr($boxdata, 10, 2));
- $num_total = getid3_lib::BigEndian2Int(substr($boxdata, 12, 2));
- $atom_structure['data'] = empty($num) ? '' : $num;
- $atom_structure['data'] .= empty($num_total) ? '' : '/'.$num_total;
- break;
-
- case 'gnre':
- $GenreID = getid3_lib::BigEndian2Int(substr($boxdata, 8, 4));
- $atom_structure['data'] = getid3_id3v1::LookupGenreName($GenreID - 1);
- break;
-
- case 'rtng':
- $atom_structure[$atomname] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 1));
- $atom_structure['data'] = $this->QuicktimeContentRatingLookup($atom_structure[$atomname]);
- break;
-
- case 'stik':
- $atom_structure[$atomname] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 1));
- $atom_structure['data'] = $this->QuicktimeSTIKLookup($atom_structure[$atomname]);
- break;
-
- case 'sfID':
- $atom_structure[$atomname] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 4));
- $atom_structure['data'] = $this->QuicktimeStoreFrontCodeLookup($atom_structure[$atomname]);
- break;
-
- case 'egid':
- case 'purl':
- $atom_structure['data'] = substr($boxdata, 8);
- break;
-
- default:
- $atom_structure['data'] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 4));
- }
- break;
-
- case 1: // text flag
- case 13: // image flag
- default:
- $atom_structure['data'] = substr($boxdata, 8);
- break;
-
- }
- break;
-
- default:
- $info['warning'][] = 'Unknown QuickTime box type: "'.getid3_lib::PrintHexBytes($boxtype).'" at offset '.$baseoffset;
- $atom_structure['data'] = $atom_data;
-
- }
- $atomoffset += $boxsize;
- }
- }
- }
- $this->CopyToAppropriateCommentsSection($atomname, $atom_structure['data'], $atom_structure['name']);
- break;
-
-
- case 'play': // auto-PLAY atom
- $atom_structure['autoplay'] = (bool) getid3_lib::BigEndian2Int(substr($atom_data, 0, 1));
-
- $info['quicktime']['autoplay'] = $atom_structure['autoplay'];
- break;
-
-
- case 'WLOC': // Window LOCation atom
- $atom_structure['location_x'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 2));
- $atom_structure['location_y'] = getid3_lib::BigEndian2Int(substr($atom_data, 2, 2));
- break;
-
-
- case 'LOOP': // LOOPing atom
- case 'SelO': // play SELection Only atom
- case 'AllF': // play ALL Frames atom
- $atom_structure['data'] = getid3_lib::BigEndian2Int($atom_data);
- break;
-
-
- case 'name': //
- case 'MCPS': // Media Cleaner PRo
- case '@PRM': // adobe PReMiere version
- case '@PRQ': // adobe PRemiere Quicktime version
- $atom_structure['data'] = $atom_data;
- break;
-
-
- case 'cmvd': // Compressed MooV Data atom
- // Code by ubergeekubergeek*tv based on information from
- // http://developer.apple.com/quicktime/icefloe/dispatch012.html
- $atom_structure['unCompressedSize'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4));
-
- $CompressedFileData = substr($atom_data, 4);
- if ($UncompressedHeader = @gzuncompress($CompressedFileData)) {
- $atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($UncompressedHeader, 0, $atomHierarchy, $ParseAllPossibleAtoms);
- } else {
- $info['warning'][] = 'Error decompressing compressed MOV atom at offset '.$atom_structure['offset'];
- }
- break;
-
-
- case 'dcom': // Data COMpression atom
- $atom_structure['compression_id'] = $atom_data;
- $atom_structure['compression_text'] = $this->QuicktimeDCOMLookup($atom_data);
- break;
-
-
- case 'rdrf': // Reference movie Data ReFerence atom
- $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1));
- $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3));
- $atom_structure['flags']['internal_data'] = (bool) ($atom_structure['flags_raw'] & 0x000001);
-
- $atom_structure['reference_type_name'] = substr($atom_data, 4, 4);
- $atom_structure['reference_length'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4));
- switch ($atom_structure['reference_type_name']) {
- case 'url ':
- $atom_structure['url'] = $this->NoNullString(substr($atom_data, 12));
- break;
-
- case 'alis':
- $atom_structure['file_alias'] = substr($atom_data, 12);
- break;
-
- case 'rsrc':
- $atom_structure['resource_alias'] = substr($atom_data, 12);
- break;
-
- default:
- $atom_structure['data'] = substr($atom_data, 12);
- break;
- }
- break;
-
-
- case 'rmqu': // Reference Movie QUality atom
- $atom_structure['movie_quality'] = getid3_lib::BigEndian2Int($atom_data);
- break;
-
-
- case 'rmcs': // Reference Movie Cpu Speed atom
- $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1));
- $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000
- $atom_structure['cpu_speed_rating'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2));
- break;
-
-
- case 'rmvc': // Reference Movie Version Check atom
- $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1));
- $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000
- $atom_structure['gestalt_selector'] = substr($atom_data, 4, 4);
- $atom_structure['gestalt_value_mask'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4));
- $atom_structure['gestalt_value'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4));
- $atom_structure['gestalt_check_type'] = getid3_lib::BigEndian2Int(substr($atom_data, 14, 2));
- break;
-
-
- case 'rmcd': // Reference Movie Component check atom
- $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1));
- $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000
- $atom_structure['component_type'] = substr($atom_data, 4, 4);
- $atom_structure['component_subtype'] = substr($atom_data, 8, 4);
- $atom_structure['component_manufacturer'] = substr($atom_data, 12, 4);
- $atom_structure['component_flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4));
- $atom_structure['component_flags_mask'] = getid3_lib::BigEndian2Int(substr($atom_data, 20, 4));
- $atom_structure['component_min_version'] = getid3_lib::BigEndian2Int(substr($atom_data, 24, 4));
- break;
-
-
- case 'rmdr': // Reference Movie Data Rate atom
- $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1));
- $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000
- $atom_structure['data_rate'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4));
-
- $atom_structure['data_rate_bps'] = $atom_structure['data_rate'] * 10;
- break;
-
-
- case 'rmla': // Reference Movie Language Atom
- $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1));
- $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000
- $atom_structure['language_id'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2));
-
- $atom_structure['language'] = $this->QuicktimeLanguageLookup($atom_structure['language_id']);
- if (empty($info['comments']['language']) || (!in_array($atom_structure['language'], $info['comments']['language']))) {
- $info['comments']['language'][] = $atom_structure['language'];
- }
- break;
-
-
- case 'rmla': // Reference Movie Language Atom
- $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1));
- $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000
- $atom_structure['track_id'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2));
- break;
-
-
- case 'ptv ': // Print To Video - defines a movie's full screen mode
- // http://developer.apple.com/documentation/QuickTime/APIREF/SOURCESIV/at_ptv-_pg.htm
- $atom_structure['display_size_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 2));
- $atom_structure['reserved_1'] = getid3_lib::BigEndian2Int(substr($atom_data, 2, 2)); // hardcoded: 0x0000
- $atom_structure['reserved_2'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); // hardcoded: 0x0000
- $atom_structure['slide_show_flag'] = getid3_lib::BigEndian2Int(substr($atom_data, 6, 1));
- $atom_structure['play_on_open_flag'] = getid3_lib::BigEndian2Int(substr($atom_data, 7, 1));
-
- $atom_structure['flags']['play_on_open'] = (bool) $atom_structure['play_on_open_flag'];
- $atom_structure['flags']['slide_show'] = (bool) $atom_structure['slide_show_flag'];
-
- $ptv_lookup[0] = 'normal';
- $ptv_lookup[1] = 'double';
- $ptv_lookup[2] = 'half';
- $ptv_lookup[3] = 'full';
- $ptv_lookup[4] = 'current';
- if (isset($ptv_lookup[$atom_structure['display_size_raw']])) {
- $atom_structure['display_size'] = $ptv_lookup[$atom_structure['display_size_raw']];
- } else {
- $info['warning'][] = 'unknown "ptv " display constant ('.$atom_structure['display_size_raw'].')';
- }
- break;
-
-
- case 'stsd': // Sample Table Sample Description atom
- $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1));
- $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000
- $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4));
- $stsdEntriesDataOffset = 8;
- for ($i = 0; $i < $atom_structure['number_entries']; $i++) {
- $atom_structure['sample_description_table'][$i]['size'] = getid3_lib::BigEndian2Int(substr($atom_data, $stsdEntriesDataOffset, 4));
- $stsdEntriesDataOffset += 4;
- $atom_structure['sample_description_table'][$i]['data_format'] = substr($atom_data, $stsdEntriesDataOffset, 4);
- $stsdEntriesDataOffset += 4;
- $atom_structure['sample_description_table'][$i]['reserved'] = getid3_lib::BigEndian2Int(substr($atom_data, $stsdEntriesDataOffset, 6));
- $stsdEntriesDataOffset += 6;
- $atom_structure['sample_description_table'][$i]['reference_index'] = getid3_lib::BigEndian2Int(substr($atom_data, $stsdEntriesDataOffset, 2));
- $stsdEntriesDataOffset += 2;
- $atom_structure['sample_description_table'][$i]['data'] = substr($atom_data, $stsdEntriesDataOffset, ($atom_structure['sample_description_table'][$i]['size'] - 4 - 4 - 6 - 2));
- $stsdEntriesDataOffset += ($atom_structure['sample_description_table'][$i]['size'] - 4 - 4 - 6 - 2);
-
- $atom_structure['sample_description_table'][$i]['encoder_version'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 0, 2));
- $atom_structure['sample_description_table'][$i]['encoder_revision'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 2, 2));
- $atom_structure['sample_description_table'][$i]['encoder_vendor'] = substr($atom_structure['sample_description_table'][$i]['data'], 4, 4);
-
- switch ($atom_structure['sample_description_table'][$i]['encoder_vendor']) {
-
- case "\x00\x00\x00\x00":
- // audio atom
- $atom_structure['sample_description_table'][$i]['audio_channels'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 8, 2));
- $atom_structure['sample_description_table'][$i]['audio_bit_depth'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 10, 2));
- $atom_structure['sample_description_table'][$i]['audio_compression_id'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 12, 2));
- $atom_structure['sample_description_table'][$i]['audio_packet_size'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 14, 2));
- $atom_structure['sample_description_table'][$i]['audio_sample_rate'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 16, 4));
-
- switch ($atom_structure['sample_description_table'][$i]['data_format']) {
- case 'avc1':
- case 'mp4v':
- $info['fileformat'] = 'mp4';
- $info['video']['fourcc'] = $atom_structure['sample_description_table'][$i]['data_format'];
- //$info['warning'][] = 'This version of getID3() ['.$this->getid3->version().'] does not fully support MPEG-4 audio/video streams'; // 2011-02-18: why am I warning about this again? What's not supported?
- break;
-
- case 'qtvr':
- $info['video']['dataformat'] = 'quicktimevr';
- break;
-
- case 'mp4a':
- default:
- $info['quicktime']['audio']['codec'] = $this->QuicktimeAudioCodecLookup($atom_structure['sample_description_table'][$i]['data_format']);
- $info['quicktime']['audio']['sample_rate'] = $atom_structure['sample_description_table'][$i]['audio_sample_rate'];
- $info['quicktime']['audio']['channels'] = $atom_structure['sample_description_table'][$i]['audio_channels'];
- $info['quicktime']['audio']['bit_depth'] = $atom_structure['sample_description_table'][$i]['audio_bit_depth'];
- $info['audio']['codec'] = $info['quicktime']['audio']['codec'];
- $info['audio']['sample_rate'] = $info['quicktime']['audio']['sample_rate'];
- $info['audio']['channels'] = $info['quicktime']['audio']['channels'];
- $info['audio']['bits_per_sample'] = $info['quicktime']['audio']['bit_depth'];
- switch ($atom_structure['sample_description_table'][$i]['data_format']) {
- case 'raw ': // PCM
- case 'alac': // Apple Lossless Audio Codec
- $info['audio']['lossless'] = true;
- break;
- default:
- $info['audio']['lossless'] = false;
- break;
- }
- break;
- }
- break;
-
- default:
- switch ($atom_structure['sample_description_table'][$i]['data_format']) {
- case 'mp4s':
- $info['fileformat'] = 'mp4';
- break;
-
- default:
- // video atom
- $atom_structure['sample_description_table'][$i]['video_temporal_quality'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 8, 4));
- $atom_structure['sample_description_table'][$i]['video_spatial_quality'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 12, 4));
- $atom_structure['sample_description_table'][$i]['video_frame_width'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 16, 2));
- $atom_structure['sample_description_table'][$i]['video_frame_height'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 18, 2));
- $atom_structure['sample_description_table'][$i]['video_resolution_x'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 20, 4));
- $atom_structure['sample_description_table'][$i]['video_resolution_y'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 24, 4));
- $atom_structure['sample_description_table'][$i]['video_data_size'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 28, 4));
- $atom_structure['sample_description_table'][$i]['video_frame_count'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 32, 2));
- $atom_structure['sample_description_table'][$i]['video_encoder_name_len'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 34, 1));
- $atom_structure['sample_description_table'][$i]['video_encoder_name'] = substr($atom_structure['sample_description_table'][$i]['data'], 35, $atom_structure['sample_description_table'][$i]['video_encoder_name_len']);
- $atom_structure['sample_description_table'][$i]['video_pixel_color_depth'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 66, 2));
- $atom_structure['sample_description_table'][$i]['video_color_table_id'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 68, 2));
-
- $atom_structure['sample_description_table'][$i]['video_pixel_color_type'] = (($atom_structure['sample_description_table'][$i]['video_pixel_color_depth'] > 32) ? 'grayscale' : 'color');
- $atom_structure['sample_description_table'][$i]['video_pixel_color_name'] = $this->QuicktimeColorNameLookup($atom_structure['sample_description_table'][$i]['video_pixel_color_depth']);
-
- if ($atom_structure['sample_description_table'][$i]['video_pixel_color_name'] != 'invalid') {
- $info['quicktime']['video']['codec_fourcc'] = $atom_structure['sample_description_table'][$i]['data_format'];
- $info['quicktime']['video']['codec_fourcc_lookup'] = $this->QuicktimeVideoCodecLookup($atom_structure['sample_description_table'][$i]['data_format']);
- $info['quicktime']['video']['codec'] = (($atom_structure['sample_description_table'][$i]['video_encoder_name_len'] > 0) ? $atom_structure['sample_description_table'][$i]['video_encoder_name'] : $atom_structure['sample_description_table'][$i]['data_format']);
- $info['quicktime']['video']['color_depth'] = $atom_structure['sample_description_table'][$i]['video_pixel_color_depth'];
- $info['quicktime']['video']['color_depth_name'] = $atom_structure['sample_description_table'][$i]['video_pixel_color_name'];
-
- $info['video']['codec'] = $info['quicktime']['video']['codec'];
- $info['video']['bits_per_sample'] = $info['quicktime']['video']['color_depth'];
- }
- $info['video']['lossless'] = false;
- $info['video']['pixel_aspect_ratio'] = (float) 1;
- break;
- }
- break;
- }
- switch (strtolower($atom_structure['sample_description_table'][$i]['data_format'])) {
- case 'mp4a':
- $info['audio']['dataformat'] = 'mp4';
- $info['quicktime']['audio']['codec'] = 'mp4';
- break;
-
- case '3ivx':
- case '3iv1':
- case '3iv2':
- $info['video']['dataformat'] = '3ivx';
- break;
-
- case 'xvid':
- $info['video']['dataformat'] = 'xvid';
- break;
-
- case 'mp4v':
- $info['video']['dataformat'] = 'mpeg4';
- break;
-
- case 'divx':
- case 'div1':
- case 'div2':
- case 'div3':
- case 'div4':
- case 'div5':
- case 'div6':
- $info['video']['dataformat'] = 'divx';
- break;
-
- default:
- // do nothing
- break;
- }
- unset($atom_structure['sample_description_table'][$i]['data']);
- }
- break;
-
-
- case 'stts': // Sample Table Time-to-Sample atom
- $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1));
- $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000
- $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4));
- $sttsEntriesDataOffset = 8;
- //$FrameRateCalculatorArray = array();
- $frames_count = 0;
- for ($i = 0; $i < $atom_structure['number_entries']; $i++) {
- $atom_structure['time_to_sample_table'][$i]['sample_count'] = getid3_lib::BigEndian2Int(substr($atom_data, $sttsEntriesDataOffset, 4));
- $sttsEntriesDataOffset += 4;
- $atom_structure['time_to_sample_table'][$i]['sample_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, $sttsEntriesDataOffset, 4));
- $sttsEntriesDataOffset += 4;
-
- $frames_count += $atom_structure['time_to_sample_table'][$i]['sample_count'];
-
- // THIS SECTION REPLACED WITH CODE IN "stbl" ATOM
- //if (!empty($info['quicktime']['time_scale']) && ($atom_structure['time_to_sample_table'][$i]['sample_duration'] > 0)) {
- // $stts_new_framerate = $info['quicktime']['time_scale'] / $atom_structure['time_to_sample_table'][$i]['sample_duration'];
- // if ($stts_new_framerate <= 60) {
- // // some atoms have durations of "1" giving a very large framerate, which probably is not right
- // $info['video']['frame_rate'] = max($info['video']['frame_rate'], $stts_new_framerate);
- // }
- //}
- //
- //$FrameRateCalculatorArray[($info['quicktime']['time_scale'] / $atom_structure['time_to_sample_table'][$i]['sample_duration'])] += $atom_structure['time_to_sample_table'][$i]['sample_count'];
- }
- $info['quicktime']['stts_framecount'][] = $frames_count;
- //$sttsFramesTotal = 0;
- //$sttsSecondsTotal = 0;
- //foreach ($FrameRateCalculatorArray as $frames_per_second => $frame_count) {
- // if (($frames_per_second > 60) || ($frames_per_second < 1)) {
- // // not video FPS information, probably audio information
- // $sttsFramesTotal = 0;
- // $sttsSecondsTotal = 0;
- // break;
- // }
- // $sttsFramesTotal += $frame_count;
- // $sttsSecondsTotal += $frame_count / $frames_per_second;
- //}
- //if (($sttsFramesTotal > 0) && ($sttsSecondsTotal > 0)) {
- // if (($sttsFramesTotal / $sttsSecondsTotal) > $info['video']['frame_rate']) {
- // $info['video']['frame_rate'] = $sttsFramesTotal / $sttsSecondsTotal;
- // }
- //}
- break;
-
-
- case 'stss': // Sample Table Sync Sample (key frames) atom
- if ($ParseAllPossibleAtoms) {
- $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1));
- $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000
- $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4));
- $stssEntriesDataOffset = 8;
- for ($i = 0; $i < $atom_structure['number_entries']; $i++) {
- $atom_structure['time_to_sample_table'][$i] = getid3_lib::BigEndian2Int(substr($atom_data, $stssEntriesDataOffset, 4));
- $stssEntriesDataOffset += 4;
- }
- }
- break;
-
-
- case 'stsc': // Sample Table Sample-to-Chunk atom
- if ($ParseAllPossibleAtoms) {
- $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1));
- $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000
- $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4));
- $stscEntriesDataOffset = 8;
- for ($i = 0; $i < $atom_structure['number_entries']; $i++) {
- $atom_structure['sample_to_chunk_table'][$i]['first_chunk'] = getid3_lib::BigEndian2Int(substr($atom_data, $stscEntriesDataOffset, 4));
- $stscEntriesDataOffset += 4;
- $atom_structure['sample_to_chunk_table'][$i]['samples_per_chunk'] = getid3_lib::BigEndian2Int(substr($atom_data, $stscEntriesDataOffset, 4));
- $stscEntriesDataOffset += 4;
- $atom_structure['sample_to_chunk_table'][$i]['sample_description'] = getid3_lib::BigEndian2Int(substr($atom_data, $stscEntriesDataOffset, 4));
- $stscEntriesDataOffset += 4;
- }
- }
- break;
-
-
- case 'stsz': // Sample Table SiZe atom
- if ($ParseAllPossibleAtoms) {
- $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1));
- $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000
- $atom_structure['sample_size'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4));
- $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4));
- $stszEntriesDataOffset = 12;
- if ($atom_structure['sample_size'] == 0) {
- for ($i = 0; $i < $atom_structure['number_entries']; $i++) {
- $atom_structure['sample_size_table'][$i] = getid3_lib::BigEndian2Int(substr($atom_data, $stszEntriesDataOffset, 4));
- $stszEntriesDataOffset += 4;
- }
- }
- }
- break;
-
-
- case 'stco': // Sample Table Chunk Offset atom
- if ($ParseAllPossibleAtoms) {
- $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1));
- $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000
- $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4));
- $stcoEntriesDataOffset = 8;
- for ($i = 0; $i < $atom_structure['number_entries']; $i++) {
- $atom_structure['chunk_offset_table'][$i] = getid3_lib::BigEndian2Int(substr($atom_data, $stcoEntriesDataOffset, 4));
- $stcoEntriesDataOffset += 4;
- }
- }
- break;
-
-
- case 'co64': // Chunk Offset 64-bit (version of "stco" that supports > 2GB files)
- if ($ParseAllPossibleAtoms) {
- $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1));
- $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000
- $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4));
- $stcoEntriesDataOffset = 8;
- for ($i = 0; $i < $atom_structure['number_entries']; $i++) {
- $atom_structure['chunk_offset_table'][$i] = getid3_lib::BigEndian2Int(substr($atom_data, $stcoEntriesDataOffset, 8));
- $stcoEntriesDataOffset += 8;
- }
- }
- break;
-
-
- case 'dref': // Data REFerence atom
- $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1));
- $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000
- $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4));
- $drefDataOffset = 8;
- for ($i = 0; $i < $atom_structure['number_entries']; $i++) {
- $atom_structure['data_references'][$i]['size'] = getid3_lib::BigEndian2Int(substr($atom_data, $drefDataOffset, 4));
- $drefDataOffset += 4;
- $atom_structure['data_references'][$i]['type'] = substr($atom_data, $drefDataOffset, 4);
- $drefDataOffset += 4;
- $atom_structure['data_references'][$i]['version'] = getid3_lib::BigEndian2Int(substr($atom_data, $drefDataOffset, 1));
- $drefDataOffset += 1;
- $atom_structure['data_references'][$i]['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, $drefDataOffset, 3)); // hardcoded: 0x0000
- $drefDataOffset += 3;
- $atom_structure['data_references'][$i]['data'] = substr($atom_data, $drefDataOffset, ($atom_structure['data_references'][$i]['size'] - 4 - 4 - 1 - 3));
- $drefDataOffset += ($atom_structure['data_references'][$i]['size'] - 4 - 4 - 1 - 3);
-
- $atom_structure['data_references'][$i]['flags']['self_reference'] = (bool) ($atom_structure['data_references'][$i]['flags_raw'] & 0x001);
- }
- break;
-
-
- case 'gmin': // base Media INformation atom
- $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1));
- $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000
- $atom_structure['graphics_mode'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2));
- $atom_structure['opcolor_red'] = getid3_lib::BigEndian2Int(substr($atom_data, 6, 2));
- $atom_structure['opcolor_green'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 2));
- $atom_structure['opcolor_blue'] = getid3_lib::BigEndian2Int(substr($atom_data, 10, 2));
- $atom_structure['balance'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 2));
- $atom_structure['reserved'] = getid3_lib::BigEndian2Int(substr($atom_data, 14, 2));
- break;
-
-
- case 'smhd': // Sound Media information HeaDer atom
- $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1));
- $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000
- $atom_structure['balance'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2));
- $atom_structure['reserved'] = getid3_lib::BigEndian2Int(substr($atom_data, 6, 2));
- break;
-
-
- case 'vmhd': // Video Media information HeaDer atom
- $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1));
- $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3));
- $atom_structure['graphics_mode'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2));
- $atom_structure['opcolor_red'] = getid3_lib::BigEndian2Int(substr($atom_data, 6, 2));
- $atom_structure['opcolor_green'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 2));
- $atom_structure['opcolor_blue'] = getid3_lib::BigEndian2Int(substr($atom_data, 10, 2));
-
- $atom_structure['flags']['no_lean_ahead'] = (bool) ($atom_structure['flags_raw'] & 0x001);
- break;
-
-
- case 'hdlr': // HanDLeR reference atom
- $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1));
- $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000
- $atom_structure['component_type'] = substr($atom_data, 4, 4);
- $atom_structure['component_subtype'] = substr($atom_data, 8, 4);
- $atom_structure['component_manufacturer'] = substr($atom_data, 12, 4);
- $atom_structure['component_flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4));
- $atom_structure['component_flags_mask'] = getid3_lib::BigEndian2Int(substr($atom_data, 20, 4));
- $atom_structure['component_name'] = $this->Pascal2String(substr($atom_data, 24));
-
- if (($atom_structure['component_subtype'] == 'STpn') && ($atom_structure['component_manufacturer'] == 'zzzz')) {
- $info['video']['dataformat'] = 'quicktimevr';
- }
- break;
-
-
- case 'mdhd': // MeDia HeaDer atom
- $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1));
- $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000
- $atom_structure['creation_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4));
- $atom_structure['modify_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4));
- $atom_structure['time_scale'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4));
- $atom_structure['duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4));
- $atom_structure['language_id'] = getid3_lib::BigEndian2Int(substr($atom_data, 20, 2));
- $atom_structure['quality'] = getid3_lib::BigEndian2Int(substr($atom_data, 22, 2));
-
- if ($atom_structure['time_scale'] == 0) {
- $info['error'][] = 'Corrupt Quicktime file: mdhd.time_scale == zero';
- return false;
- }
- $info['quicktime']['time_scale'] = (isset($info['quicktime']['time_scale']) ? max($info['quicktime']['time_scale'], $atom_structure['time_scale']) : $atom_structure['time_scale']);
-
- $atom_structure['creation_time_unix'] = getid3_lib::DateMac2Unix($atom_structure['creation_time']);
- $atom_structure['modify_time_unix'] = getid3_lib::DateMac2Unix($atom_structure['modify_time']);
- $atom_structure['playtime_seconds'] = $atom_structure['duration'] / $atom_structure['time_scale'];
- $atom_structure['language'] = $this->QuicktimeLanguageLookup($atom_structure['language_id']);
- if (empty($info['comments']['language']) || (!in_array($atom_structure['language'], $info['comments']['language']))) {
- $info['comments']['language'][] = $atom_structure['language'];
- }
- break;
-
-
- case 'pnot': // Preview atom
- $atom_structure['modification_date'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); // "standard Macintosh format"
- $atom_structure['version_number'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); // hardcoded: 0x00
- $atom_structure['atom_type'] = substr($atom_data, 6, 4); // usually: 'PICT'
- $atom_structure['atom_index'] = getid3_lib::BigEndian2Int(substr($atom_data, 10, 2)); // usually: 0x01
-
- $atom_structure['modification_date_unix'] = getid3_lib::DateMac2Unix($atom_structure['modification_date']);
- break;
-
-
- case 'crgn': // Clipping ReGioN atom
- $atom_structure['region_size'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 2)); // The Region size, Region boundary box,
- $atom_structure['boundary_box'] = getid3_lib::BigEndian2Int(substr($atom_data, 2, 8)); // and Clipping region data fields
- $atom_structure['clipping_data'] = substr($atom_data, 10); // constitute a QuickDraw region.
- break;
-
-
- case 'load': // track LOAD settings atom
- $atom_structure['preload_start_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4));
- $atom_structure['preload_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4));
- $atom_structure['preload_flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4));
- $atom_structure['default_hints_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4));
-
- $atom_structure['default_hints']['double_buffer'] = (bool) ($atom_structure['default_hints_raw'] & 0x0020);
- $atom_structure['default_hints']['high_quality'] = (bool) ($atom_structure['default_hints_raw'] & 0x0100);
- break;
-
-
- case 'tmcd': // TiMe CoDe atom
- case 'chap': // CHAPter list atom
- case 'sync': // SYNChronization atom
- case 'scpt': // tranSCriPT atom
- case 'ssrc': // non-primary SouRCe atom
- for ($i = 0; $i < (strlen($atom_data) % 4); $i++) {
- $atom_structure['track_id'][$i] = getid3_lib::BigEndian2Int(substr($atom_data, $i * 4, 4));
- }
- break;
-
-
- case 'elst': // Edit LiST atom
- $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1));
- $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000
- $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4));
- for ($i = 0; $i < $atom_structure['number_entries']; $i++ ) {
- $atom_structure['edit_list'][$i]['track_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($i * 12) + 0, 4));
- $atom_structure['edit_list'][$i]['media_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($i * 12) + 4, 4));
- $atom_structure['edit_list'][$i]['media_rate'] = getid3_lib::FixedPoint16_16(substr($atom_data, 8 + ($i * 12) + 8, 4));
- }
- break;
-
-
- case 'kmat': // compressed MATte atom
- $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1));
- $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000
- $atom_structure['matte_data_raw'] = substr($atom_data, 4);
- break;
-
-
- case 'ctab': // Color TABle atom
- $atom_structure['color_table_seed'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); // hardcoded: 0x00000000
- $atom_structure['color_table_flags'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); // hardcoded: 0x8000
- $atom_structure['color_table_size'] = getid3_lib::BigEndian2Int(substr($atom_data, 6, 2)) + 1;
- for ($colortableentry = 0; $colortableentry < $atom_structure['color_table_size']; $colortableentry++) {
- $atom_structure['color_table'][$colortableentry]['alpha'] = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($colortableentry * 8) + 0, 2));
- $atom_structure['color_table'][$colortableentry]['red'] = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($colortableentry * 8) + 2, 2));
- $atom_structure['color_table'][$colortableentry]['green'] = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($colortableentry * 8) + 4, 2));
- $atom_structure['color_table'][$colortableentry]['blue'] = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($colortableentry * 8) + 6, 2));
- }
- break;
-
-
- case 'mvhd': // MoVie HeaDer atom
- $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1));
- $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3));
- $atom_structure['creation_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4));
- $atom_structure['modify_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4));
- $atom_structure['time_scale'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4));
- $atom_structure['duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4));
- $atom_structure['preferred_rate'] = getid3_lib::FixedPoint16_16(substr($atom_data, 20, 4));
- $atom_structure['preferred_volume'] = getid3_lib::FixedPoint8_8(substr($atom_data, 24, 2));
- $atom_structure['reserved'] = substr($atom_data, 26, 10);
- $atom_structure['matrix_a'] = getid3_lib::FixedPoint16_16(substr($atom_data, 36, 4));
- $atom_structure['matrix_b'] = getid3_lib::FixedPoint16_16(substr($atom_data, 40, 4));
- $atom_structure['matrix_u'] = getid3_lib::FixedPoint2_30(substr($atom_data, 44, 4));
- $atom_structure['matrix_c'] = getid3_lib::FixedPoint16_16(substr($atom_data, 48, 4));
- $atom_structure['matrix_d'] = getid3_lib::FixedPoint16_16(substr($atom_data, 52, 4));
- $atom_structure['matrix_v'] = getid3_lib::FixedPoint2_30(substr($atom_data, 56, 4));
- $atom_structure['matrix_x'] = getid3_lib::FixedPoint16_16(substr($atom_data, 60, 4));
- $atom_structure['matrix_y'] = getid3_lib::FixedPoint16_16(substr($atom_data, 64, 4));
- $atom_structure['matrix_w'] = getid3_lib::FixedPoint2_30(substr($atom_data, 68, 4));
- $atom_structure['preview_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 72, 4));
- $atom_structure['preview_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 76, 4));
- $atom_structure['poster_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 80, 4));
- $atom_structure['selection_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 84, 4));
- $atom_structure['selection_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 88, 4));
- $atom_structure['current_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 92, 4));
- $atom_structure['next_track_id'] = getid3_lib::BigEndian2Int(substr($atom_data, 96, 4));
-
- if ($atom_structure['time_scale'] == 0) {
- $info['error'][] = 'Corrupt Quicktime file: mvhd.time_scale == zero';
- return false;
- }
- $atom_structure['creation_time_unix'] = getid3_lib::DateMac2Unix($atom_structure['creation_time']);
- $atom_structure['modify_time_unix'] = getid3_lib::DateMac2Unix($atom_structure['modify_time']);
- $info['quicktime']['time_scale'] = (isset($info['quicktime']['time_scale']) ? max($info['quicktime']['time_scale'], $atom_structure['time_scale']) : $atom_structure['time_scale']);
- $info['quicktime']['display_scale'] = $atom_structure['matrix_a'];
- $info['playtime_seconds'] = $atom_structure['duration'] / $atom_structure['time_scale'];
- break;
-
-
- case 'tkhd': // TracK HeaDer atom
- $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1));
- $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3));
- $atom_structure['creation_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4));
- $atom_structure['modify_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4));
- $atom_structure['trackid'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4));
- $atom_structure['reserved1'] = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4));
- $atom_structure['duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 20, 4));
- $atom_structure['reserved2'] = getid3_lib::BigEndian2Int(substr($atom_data, 24, 8));
- $atom_structure['layer'] = getid3_lib::BigEndian2Int(substr($atom_data, 32, 2));
- $atom_structure['alternate_group'] = getid3_lib::BigEndian2Int(substr($atom_data, 34, 2));
- $atom_structure['volume'] = getid3_lib::FixedPoint8_8(substr($atom_data, 36, 2));
- $atom_structure['reserved3'] = getid3_lib::BigEndian2Int(substr($atom_data, 38, 2));
- $atom_structure['matrix_a'] = getid3_lib::FixedPoint16_16(substr($atom_data, 40, 4));
- $atom_structure['matrix_b'] = getid3_lib::FixedPoint16_16(substr($atom_data, 44, 4));
- $atom_structure['matrix_u'] = getid3_lib::FixedPoint16_16(substr($atom_data, 48, 4));
- $atom_structure['matrix_c'] = getid3_lib::FixedPoint16_16(substr($atom_data, 52, 4));
- $atom_structure['matrix_d'] = getid3_lib::FixedPoint16_16(substr($atom_data, 56, 4));
- $atom_structure['matrix_v'] = getid3_lib::FixedPoint16_16(substr($atom_data, 60, 4));
- $atom_structure['matrix_x'] = getid3_lib::FixedPoint2_30(substr($atom_data, 64, 4));
- $atom_structure['matrix_y'] = getid3_lib::FixedPoint2_30(substr($atom_data, 68, 4));
- $atom_structure['matrix_w'] = getid3_lib::FixedPoint2_30(substr($atom_data, 72, 4));
- $atom_structure['width'] = getid3_lib::FixedPoint16_16(substr($atom_data, 76, 4));
- $atom_structure['height'] = getid3_lib::FixedPoint16_16(substr($atom_data, 80, 4));
-
- $atom_structure['flags']['enabled'] = (bool) ($atom_structure['flags_raw'] & 0x0001);
- $atom_structure['flags']['in_movie'] = (bool) ($atom_structure['flags_raw'] & 0x0002);
- $atom_structure['flags']['in_preview'] = (bool) ($atom_structure['flags_raw'] & 0x0004);
- $atom_structure['flags']['in_poster'] = (bool) ($atom_structure['flags_raw'] & 0x0008);
- $atom_structure['creation_time_unix'] = getid3_lib::DateMac2Unix($atom_structure['creation_time']);
- $atom_structure['modify_time_unix'] = getid3_lib::DateMac2Unix($atom_structure['modify_time']);
-
- if ($atom_structure['flags']['enabled'] == 1) {
- if (!isset($info['video']['resolution_x']) || !isset($info['video']['resolution_y'])) {
- $info['video']['resolution_x'] = $atom_structure['width'];
- $info['video']['resolution_y'] = $atom_structure['height'];
- }
- $info['video']['resolution_x'] = max($info['video']['resolution_x'], $atom_structure['width']);
- $info['video']['resolution_y'] = max($info['video']['resolution_y'], $atom_structure['height']);
- $info['quicktime']['video']['resolution_x'] = $info['video']['resolution_x'];
- $info['quicktime']['video']['resolution_y'] = $info['video']['resolution_y'];
- } else {
- if (isset($info['video']['resolution_x'])) { unset($info['video']['resolution_x']); }
- if (isset($info['video']['resolution_y'])) { unset($info['video']['resolution_y']); }
- if (isset($info['quicktime']['video'])) { unset($info['quicktime']['video']); }
- }
- break;
-
-
- case 'iods': // Initial Object DeScriptor atom
- // http://www.koders.com/c/fid1FAB3E762903DC482D8A246D4A4BF9F28E049594.aspx?s=windows.h
- // http://libquicktime.sourcearchive.com/documentation/1.0.2plus-pdebian/iods_8c-source.html
- $offset = 0;
- $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1));
- $offset += 1;
- $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 3));
- $offset += 3;
- $atom_structure['mp4_iod_tag'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1));
- $offset += 1;
- $atom_structure['length'] = $this->quicktime_read_mp4_descr_length($atom_data, $offset);
- //$offset already adjusted by quicktime_read_mp4_descr_length()
- $atom_structure['object_descriptor_id'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 2));
- $offset += 2;
- $atom_structure['od_profile_level'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1));
- $offset += 1;
- $atom_structure['scene_profile_level'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1));
- $offset += 1;
- $atom_structure['audio_profile_id'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1));
- $offset += 1;
- $atom_structure['video_profile_id'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1));
- $offset += 1;
- $atom_structure['graphics_profile_level'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1));
- $offset += 1;
-
- $atom_structure['num_iods_tracks'] = ($atom_structure['length'] - 7) / 6; // 6 bytes would only be right if all tracks use 1-byte length fields
- for ($i = 0; $i < $atom_structure['num_iods_tracks']; $i++) {
- $atom_structure['track'][$i]['ES_ID_IncTag'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1));
- $offset += 1;
- $atom_structure['track'][$i]['length'] = $this->quicktime_read_mp4_descr_length($atom_data, $offset);
- //$offset already adjusted by quicktime_read_mp4_descr_length()
- $atom_structure['track'][$i]['track_id'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 4));
- $offset += 4;
- }
-
- $atom_structure['audio_profile_name'] = $this->QuicktimeIODSaudioProfileName($atom_structure['audio_profile_id']);
- $atom_structure['video_profile_name'] = $this->QuicktimeIODSvideoProfileName($atom_structure['video_profile_id']);
- break;
-
- case 'ftyp': // FileTYPe (?) atom (for MP4 it seems)
- $atom_structure['signature'] = substr($atom_data, 0, 4);
- $atom_structure['unknown_1'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4));
- $atom_structure['fourcc'] = substr($atom_data, 8, 4);
- break;
-
- case 'mdat': // Media DATa atom
- case 'free': // FREE space atom
- case 'skip': // SKIP atom
- case 'wide': // 64-bit expansion placeholder atom
- // 'mdat' data is too big to deal with, contains no useful metadata
- // 'free', 'skip' and 'wide' are just padding, contains no useful data at all
-
- // When writing QuickTime files, it is sometimes necessary to update an atom's size.
- // It is impossible to update a 32-bit atom to a 64-bit atom since the 32-bit atom
- // is only 8 bytes in size, and the 64-bit atom requires 16 bytes. Therefore, QuickTime
- // puts an 8-byte placeholder atom before any atoms it may have to update the size of.
- // In this way, if the atom needs to be converted from a 32-bit to a 64-bit atom, the
- // placeholder atom can be overwritten to obtain the necessary 8 extra bytes.
- // The placeholder atom has a type of kWideAtomPlaceholderType ( 'wide' ).
- break;
-
-
- case 'nsav': // NoSAVe atom
- // http://developer.apple.com/technotes/tn/tn2038.html
- $atom_structure['data'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4));
- break;
-
- case 'ctyp': // Controller TYPe atom (seen on QTVR)
- // http://homepages.slingshot.co.nz/~helmboy/quicktime/formats/qtm-layout.txt
- // some controller names are:
- // 0x00 + 'std' for linear movie
- // 'none' for no controls
- $atom_structure['ctyp'] = substr($atom_data, 0, 4);
- $info['quicktime']['controller'] = $atom_structure['ctyp'];
- switch ($atom_structure['ctyp']) {
- case 'qtvr':
- $info['video']['dataformat'] = 'quicktimevr';
- break;
- }
- break;
-
- case 'pano': // PANOrama track (seen on QTVR)
- $atom_structure['pano'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4));
- break;
-
- case 'hint': // HINT track
- case 'hinf': //
- case 'hinv': //
- case 'hnti': //
- $info['quicktime']['hinting'] = true;
- break;
-
- case 'imgt': // IMaGe Track reference (kQTVRImageTrackRefType) (seen on QTVR)
- for ($i = 0; $i < ($atom_structure['size'] - 8); $i += 4) {
- $atom_structure['imgt'][] = getid3_lib::BigEndian2Int(substr($atom_data, $i, 4));
- }
- break;
-
-
- // Observed-but-not-handled atom types are just listed here to prevent warnings being generated
- case 'FXTC': // Something to do with Adobe After Effects (?)
- case 'PrmA':
- case 'code':
- case 'FIEL': // this is NOT "fiel" (Field Ordering) as describe here: http://developer.apple.com/documentation/QuickTime/QTFF/QTFFChap3/chapter_4_section_2.html
- case 'tapt': // TrackApertureModeDimensionsAID - http://developer.apple.com/documentation/QuickTime/Reference/QT7-1_Update_Reference/Constants/Constants.html
- // tapt seems to be used to compute the video size [http://www.getid3.org/phpBB3/viewtopic.php?t=838]
- // * http://lists.apple.com/archives/quicktime-api/2006/Aug/msg00014.html
- // * http://handbrake.fr/irclogs/handbrake-dev/handbrake-dev20080128_pg2.html
- case 'ctts':// STCompositionOffsetAID - http://developer.apple.com/documentation/QuickTime/Reference/QTRef_Constants/Reference/reference.html
- case 'cslg':// STCompositionShiftLeastGreatestAID - http://developer.apple.com/documentation/QuickTime/Reference/QTRef_Constants/Reference/reference.html
- case 'sdtp':// STSampleDependencyAID - http://developer.apple.com/documentation/QuickTime/Reference/QTRef_Constants/Reference/reference.html
- case 'stps':// STPartialSyncSampleAID - http://developer.apple.com/documentation/QuickTime/Reference/QTRef_Constants/Reference/reference.html
- //$atom_structure['data'] = $atom_data;
- break;
-
- case 'xyz': // GPS latitude+longitude+altitude
- $atom_structure['data'] = $atom_data;
- if (preg_match('#([\\+\\-][0-9\\.]+)([\\+\\-][0-9\\.]+)([\\+\\-][0-9\\.]+)?/$#i', $atom_data, $matches)) {
- @list($all, $latitude, $longitude, $altitude) = $matches;
- $info['quicktime']['comments']['gps_latitude'][] = floatval($latitude);
- $info['quicktime']['comments']['gps_longitude'][] = floatval($longitude);
- if (!empty($altitude)) {
- $info['quicktime']['comments']['gps_altitude'][] = floatval($altitude);
- }
- } else {
- $info['warning'][] = 'QuickTime atom "xyz" data does not match expected data pattern at offset '.$baseoffset.'. Please report as getID3() bug.';
- }
- break;
-
- case 'NCDT':
- // http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html
- // Nikon-specific QuickTime tags found in the NCDT atom of MOV videos from some Nikon cameras such as the Coolpix S8000 and D5100
- $atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 4, $atomHierarchy, $ParseAllPossibleAtoms);
- break;
- case 'NCTH': // Nikon Camera THumbnail image
- case 'NCVW': // Nikon Camera preVieW image
- // http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html
- if (preg_match('/^\xFF\xD8\xFF/', $atom_data)) {
- $atom_structure['data'] = $atom_data;
- $atom_structure['image_mime'] = 'image/jpeg';
- $atom_structure['description'] = (($atomname == 'NCTH') ? 'Nikon Camera Thumbnail Image' : (($atomname == 'NCVW') ? 'Nikon Camera Preview Image' : 'Nikon preview image'));
- $info['quicktime']['comments']['picture'][] = array('image_mime'=>$atom_structure['image_mime'], 'data'=>$atom_data, 'description'=>$atom_structure['description']);
- }
- break;
- case 'NCHD': // MakerNoteVersion
- // http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html
- $atom_structure['data'] = $atom_data;
- break;
- case 'NCTG': // NikonTags
- // http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html#NCTG
- $atom_structure['data'] = $this->QuicktimeParseNikonNCTG($atom_data);
- break;
- case 'NCDB': // NikonTags
- // http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html
- $atom_structure['data'] = $atom_data;
- break;
-
- case "\x00\x00\x00\x00":
- case 'meta': // METAdata atom
- // some kind of metacontainer, may contain a big data dump such as:
- // mdta keys  mdtacom.apple.quicktime.make (mdtacom.apple.quicktime.creationdate ,mdtacom.apple.quicktime.location.ISO6709 $mdtacom.apple.quicktime.software !mdtacom.apple.quicktime.model ilst   data DEApple 0  (data DE2011-05-11T17:54:04+0200 2  *data DE+52.4936+013.3897+040.247/   data DE4.3.1  data DEiPhone 4
- // http://www.geocities.com/xhelmboyx/quicktime/formats/qti-layout.txt
-
- $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1));
- $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3));
- $atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom(substr($atom_data, 4), $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms);
- //$atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms);
- break;
-
- case 'data': // metaDATA atom
- // seems to be 2 bytes language code (ASCII), 2 bytes unknown (set to 0x10B5 in sample I have), remainder is useful data
- $atom_structure['language'] = substr($atom_data, 4 + 0, 2);
- $atom_structure['unknown'] = getid3_lib::BigEndian2Int(substr($atom_data, 4 + 2, 2));
- $atom_structure['data'] = substr($atom_data, 4 + 4);
- break;
-
- default:
- $info['warning'][] = 'Unknown QuickTime atom type: "'.getid3_lib::PrintHexBytes($atomname).'" at offset '.$baseoffset;
- $atom_structure['data'] = $atom_data;
- break;
- }
- array_pop($atomHierarchy);
- return $atom_structure;
- }
-
- function QuicktimeParseContainerAtom($atom_data, $baseoffset, &$atomHierarchy, $ParseAllPossibleAtoms) {
-//echo 'QuicktimeParseContainerAtom('.substr($atom_data, 4, 4).') @ '.$baseoffset.'<br><br>';
- $atom_structure = false;
- $subatomoffset = 0;
- $subatomcounter = 0;
- if ((strlen($atom_data) == 4) && (getid3_lib::BigEndian2Int($atom_data) == 0x00000000)) {
- return false;
- }
- while ($subatomoffset < strlen($atom_data)) {
- $subatomsize = getid3_lib::BigEndian2Int(substr($atom_data, $subatomoffset + 0, 4));
- $subatomname = substr($atom_data, $subatomoffset + 4, 4);
- $subatomdata = substr($atom_data, $subatomoffset + 8, $subatomsize - 8);
- if ($subatomsize == 0) {
- // Furthermore, for historical reasons the list of atoms is optionally
- // terminated by a 32-bit integer set to 0. If you are writing a program
- // to read user data atoms, you should allow for the terminating 0.
- return $atom_structure;
- }
-
- $atom_structure[$subatomcounter] = $this->QuicktimeParseAtom($subatomname, $subatomsize, $subatomdata, $baseoffset + $subatomoffset, $atomHierarchy, $ParseAllPossibleAtoms);
-
- $subatomoffset += $subatomsize;
- $subatomcounter++;
- }
- return $atom_structure;
- }
-
-
- function quicktime_read_mp4_descr_length($data, &$offset) {
- // http://libquicktime.sourcearchive.com/documentation/2:1.0.2plus-pdebian-2build1/esds_8c-source.html
- $num_bytes = 0;
- $length = 0;
- do {
- $b = ord(substr($data, $offset++, 1));
- $length = ($length << 7) | ($b & 0x7F);
- } while (($b & 0x80) && ($num_bytes++ < 4));
- return $length;
- }
-
-
- function QuicktimeLanguageLookup($languageid) {
- static $QuicktimeLanguageLookup = array();
- if (empty($QuicktimeLanguageLookup)) {
- $QuicktimeLanguageLookup[0] = 'English';
- $QuicktimeLanguageLookup[1] = 'French';
- $QuicktimeLanguageLookup[2] = 'German';
- $QuicktimeLanguageLookup[3] = 'Italian';
- $QuicktimeLanguageLookup[4] = 'Dutch';
- $QuicktimeLanguageLookup[5] = 'Swedish';
- $QuicktimeLanguageLookup[6] = 'Spanish';
- $QuicktimeLanguageLookup[7] = 'Danish';
- $QuicktimeLanguageLookup[8] = 'Portuguese';
- $QuicktimeLanguageLookup[9] = 'Norwegian';
- $QuicktimeLanguageLookup[10] = 'Hebrew';
- $QuicktimeLanguageLookup[11] = 'Japanese';
- $QuicktimeLanguageLookup[12] = 'Arabic';
- $QuicktimeLanguageLookup[13] = 'Finnish';
- $QuicktimeLanguageLookup[14] = 'Greek';
- $QuicktimeLanguageLookup[15] = 'Icelandic';
- $QuicktimeLanguageLookup[16] = 'Maltese';
- $QuicktimeLanguageLookup[17] = 'Turkish';
- $QuicktimeLanguageLookup[18] = 'Croatian';
- $QuicktimeLanguageLookup[19] = 'Chinese (Traditional)';
- $QuicktimeLanguageLookup[20] = 'Urdu';
- $QuicktimeLanguageLookup[21] = 'Hindi';
- $QuicktimeLanguageLookup[22] = 'Thai';
- $QuicktimeLanguageLookup[23] = 'Korean';
- $QuicktimeLanguageLookup[24] = 'Lithuanian';
- $QuicktimeLanguageLookup[25] = 'Polish';
- $QuicktimeLanguageLookup[26] = 'Hungarian';
- $QuicktimeLanguageLookup[27] = 'Estonian';
- $QuicktimeLanguageLookup[28] = 'Lettish';
- $QuicktimeLanguageLookup[28] = 'Latvian';
- $QuicktimeLanguageLookup[29] = 'Saamisk';
- $QuicktimeLanguageLookup[29] = 'Lappish';
- $QuicktimeLanguageLookup[30] = 'Faeroese';
- $QuicktimeLanguageLookup[31] = 'Farsi';
- $QuicktimeLanguageLookup[31] = 'Persian';
- $QuicktimeLanguageLookup[32] = 'Russian';
- $QuicktimeLanguageLookup[33] = 'Chinese (Simplified)';
- $QuicktimeLanguageLookup[34] = 'Flemish';
- $QuicktimeLanguageLookup[35] = 'Irish';
- $QuicktimeLanguageLookup[36] = 'Albanian';
- $QuicktimeLanguageLookup[37] = 'Romanian';
- $QuicktimeLanguageLookup[38] = 'Czech';
- $QuicktimeLanguageLookup[39] = 'Slovak';
- $QuicktimeLanguageLookup[40] = 'Slovenian';
- $QuicktimeLanguageLookup[41] = 'Yiddish';
- $QuicktimeLanguageLookup[42] = 'Serbian';
- $QuicktimeLanguageLookup[43] = 'Macedonian';
- $QuicktimeLanguageLookup[44] = 'Bulgarian';
- $QuicktimeLanguageLookup[45] = 'Ukrainian';
- $QuicktimeLanguageLookup[46] = 'Byelorussian';
- $QuicktimeLanguageLookup[47] = 'Uzbek';
- $QuicktimeLanguageLookup[48] = 'Kazakh';
- $QuicktimeLanguageLookup[49] = 'Azerbaijani';
- $QuicktimeLanguageLookup[50] = 'AzerbaijanAr';
- $QuicktimeLanguageLookup[51] = 'Armenian';
- $QuicktimeLanguageLookup[52] = 'Georgian';
- $QuicktimeLanguageLookup[53] = 'Moldavian';
- $QuicktimeLanguageLookup[54] = 'Kirghiz';
- $QuicktimeLanguageLookup[55] = 'Tajiki';
- $QuicktimeLanguageLookup[56] = 'Turkmen';
- $QuicktimeLanguageLookup[57] = 'Mongolian';
- $QuicktimeLanguageLookup[58] = 'MongolianCyr';
- $QuicktimeLanguageLookup[59] = 'Pashto';
- $QuicktimeLanguageLookup[60] = 'Kurdish';
- $QuicktimeLanguageLookup[61] = 'Kashmiri';
- $QuicktimeLanguageLookup[62] = 'Sindhi';
- $QuicktimeLanguageLookup[63] = 'Tibetan';
- $QuicktimeLanguageLookup[64] = 'Nepali';
- $QuicktimeLanguageLookup[65] = 'Sanskrit';
- $QuicktimeLanguageLookup[66] = 'Marathi';
- $QuicktimeLanguageLookup[67] = 'Bengali';
- $QuicktimeLanguageLookup[68] = 'Assamese';
- $QuicktimeLanguageLookup[69] = 'Gujarati';
- $QuicktimeLanguageLookup[70] = 'Punjabi';
- $QuicktimeLanguageLookup[71] = 'Oriya';
- $QuicktimeLanguageLookup[72] = 'Malayalam';
- $QuicktimeLanguageLookup[73] = 'Kannada';
- $QuicktimeLanguageLookup[74] = 'Tamil';
- $QuicktimeLanguageLookup[75] = 'Telugu';
- $QuicktimeLanguageLookup[76] = 'Sinhalese';
- $QuicktimeLanguageLookup[77] = 'Burmese';
- $QuicktimeLanguageLookup[78] = 'Khmer';
- $QuicktimeLanguageLookup[79] = 'Lao';
- $QuicktimeLanguageLookup[80] = 'Vietnamese';
- $QuicktimeLanguageLookup[81] = 'Indonesian';
- $QuicktimeLanguageLookup[82] = 'Tagalog';
- $QuicktimeLanguageLookup[83] = 'MalayRoman';
- $QuicktimeLanguageLookup[84] = 'MalayArabic';
- $QuicktimeLanguageLookup[85] = 'Amharic';
- $QuicktimeLanguageLookup[86] = 'Tigrinya';
- $QuicktimeLanguageLookup[87] = 'Galla';
- $QuicktimeLanguageLookup[87] = 'Oromo';
- $QuicktimeLanguageLookup[88] = 'Somali';
- $QuicktimeLanguageLookup[89] = 'Swahili';
- $QuicktimeLanguageLookup[90] = 'Ruanda';
- $QuicktimeLanguageLookup[91] = 'Rundi';
- $QuicktimeLanguageLookup[92] = 'Chewa';
- $QuicktimeLanguageLookup[93] = 'Malagasy';
- $QuicktimeLanguageLookup[94] = 'Esperanto';
- $QuicktimeLanguageLookup[128] = 'Welsh';
- $QuicktimeLanguageLookup[129] = 'Basque';
- $QuicktimeLanguageLookup[130] = 'Catalan';
- $QuicktimeLanguageLookup[131] = 'Latin';
- $QuicktimeLanguageLookup[132] = 'Quechua';
- $QuicktimeLanguageLookup[133] = 'Guarani';
- $QuicktimeLanguageLookup[134] = 'Aymara';
- $QuicktimeLanguageLookup[135] = 'Tatar';
- $QuicktimeLanguageLookup[136] = 'Uighur';
- $QuicktimeLanguageLookup[137] = 'Dzongkha';
- $QuicktimeLanguageLookup[138] = 'JavaneseRom';
- }
- return (isset($QuicktimeLanguageLookup[$languageid]) ? $QuicktimeLanguageLookup[$languageid] : 'invalid');
- }
-
- function QuicktimeVideoCodecLookup($codecid) {
- static $QuicktimeVideoCodecLookup = array();
- if (empty($QuicktimeVideoCodecLookup)) {
- $QuicktimeVideoCodecLookup['.SGI'] = 'SGI';
- $QuicktimeVideoCodecLookup['3IV1'] = '3ivx MPEG-4 v1';
- $QuicktimeVideoCodecLookup['3IV2'] = '3ivx MPEG-4 v2';
- $QuicktimeVideoCodecLookup['3IVX'] = '3ivx MPEG-4';
- $QuicktimeVideoCodecLookup['8BPS'] = 'Planar RGB';
- $QuicktimeVideoCodecLookup['avc1'] = 'H.264/MPEG-4 AVC';
- $QuicktimeVideoCodecLookup['avr '] = 'AVR-JPEG';
- $QuicktimeVideoCodecLookup['b16g'] = '16Gray';
- $QuicktimeVideoCodecLookup['b32a'] = '32AlphaGray';
- $QuicktimeVideoCodecLookup['b48r'] = '48RGB';
- $QuicktimeVideoCodecLookup['b64a'] = '64ARGB';
- $QuicktimeVideoCodecLookup['base'] = 'Base';
- $QuicktimeVideoCodecLookup['clou'] = 'Cloud';
- $QuicktimeVideoCodecLookup['cmyk'] = 'CMYK';
- $QuicktimeVideoCodecLookup['cvid'] = 'Cinepak';
- $QuicktimeVideoCodecLookup['dmb1'] = 'OpenDML JPEG';
- $QuicktimeVideoCodecLookup['dvc '] = 'DVC-NTSC';
- $QuicktimeVideoCodecLookup['dvcp'] = 'DVC-PAL';
- $QuicktimeVideoCodecLookup['dvpn'] = 'DVCPro-NTSC';
- $QuicktimeVideoCodecLookup['dvpp'] = 'DVCPro-PAL';
- $QuicktimeVideoCodecLookup['fire'] = 'Fire';
- $QuicktimeVideoCodecLookup['flic'] = 'FLC';
- $QuicktimeVideoCodecLookup['gif '] = 'GIF';
- $QuicktimeVideoCodecLookup['h261'] = 'H261';
- $QuicktimeVideoCodecLookup['h263'] = 'H263';
- $QuicktimeVideoCodecLookup['IV41'] = 'Indeo4';
- $QuicktimeVideoCodecLookup['jpeg'] = 'JPEG';
- $QuicktimeVideoCodecLookup['kpcd'] = 'PhotoCD';
- $QuicktimeVideoCodecLookup['mjpa'] = 'Motion JPEG-A';
- $QuicktimeVideoCodecLookup['mjpb'] = 'Motion JPEG-B';
- $QuicktimeVideoCodecLookup['msvc'] = 'Microsoft Video1';
- $QuicktimeVideoCodecLookup['myuv'] = 'MPEG YUV420';
- $QuicktimeVideoCodecLookup['path'] = 'Vector';
- $QuicktimeVideoCodecLookup['png '] = 'PNG';
- $QuicktimeVideoCodecLookup['PNTG'] = 'MacPaint';
- $QuicktimeVideoCodecLookup['qdgx'] = 'QuickDrawGX';
- $QuicktimeVideoCodecLookup['qdrw'] = 'QuickDraw';
- $QuicktimeVideoCodecLookup['raw '] = 'RAW';
- $QuicktimeVideoCodecLookup['ripl'] = 'WaterRipple';
- $QuicktimeVideoCodecLookup['rpza'] = 'Video';
- $QuicktimeVideoCodecLookup['smc '] = 'Graphics';
- $QuicktimeVideoCodecLookup['SVQ1'] = 'Sorenson Video 1';
- $QuicktimeVideoCodecLookup['SVQ1'] = 'Sorenson Video 3';
- $QuicktimeVideoCodecLookup['syv9'] = 'Sorenson YUV9';
- $QuicktimeVideoCodecLookup['tga '] = 'Targa';
- $QuicktimeVideoCodecLookup['tiff'] = 'TIFF';
- $QuicktimeVideoCodecLookup['WRAW'] = 'Windows RAW';
- $QuicktimeVideoCodecLookup['WRLE'] = 'BMP';
- $QuicktimeVideoCodecLookup['y420'] = 'YUV420';
- $QuicktimeVideoCodecLookup['yuv2'] = 'ComponentVideo';
- $QuicktimeVideoCodecLookup['yuvs'] = 'ComponentVideoUnsigned';
- $QuicktimeVideoCodecLookup['yuvu'] = 'ComponentVideoSigned';
- }
- return (isset($QuicktimeVideoCodecLookup[$codecid]) ? $QuicktimeVideoCodecLookup[$codecid] : '');
- }
-
- function QuicktimeAudioCodecLookup($codecid) {
- static $QuicktimeAudioCodecLookup = array();
- if (empty($QuicktimeAudioCodecLookup)) {
- $QuicktimeAudioCodecLookup['.mp3'] = 'Fraunhofer MPEG Layer-III alias';
- $QuicktimeAudioCodecLookup['aac '] = 'ISO/IEC 14496-3 AAC';
- $QuicktimeAudioCodecLookup['agsm'] = 'Apple GSM 10:1';
- $QuicktimeAudioCodecLookup['alac'] = 'Apple Lossless Audio Codec';
- $QuicktimeAudioCodecLookup['alaw'] = 'A-law 2:1';
- $QuicktimeAudioCodecLookup['conv'] = 'Sample Format';
- $QuicktimeAudioCodecLookup['dvca'] = 'DV';
- $QuicktimeAudioCodecLookup['dvi '] = 'DV 4:1';
- $QuicktimeAudioCodecLookup['eqal'] = 'Frequency Equalizer';
- $QuicktimeAudioCodecLookup['fl32'] = '32-bit Floating Point';
- $QuicktimeAudioCodecLookup['fl64'] = '64-bit Floating Point';
- $QuicktimeAudioCodecLookup['ima4'] = 'Interactive Multimedia Association 4:1';
- $QuicktimeAudioCodecLookup['in24'] = '24-bit Integer';
- $QuicktimeAudioCodecLookup['in32'] = '32-bit Integer';
- $QuicktimeAudioCodecLookup['lpc '] = 'LPC 23:1';
- $QuicktimeAudioCodecLookup['MAC3'] = 'Macintosh Audio Compression/Expansion (MACE) 3:1';
- $QuicktimeAudioCodecLookup['MAC6'] = 'Macintosh Audio Compression/Expansion (MACE) 6:1';
- $QuicktimeAudioCodecLookup['mixb'] = '8-bit Mixer';
- $QuicktimeAudioCodecLookup['mixw'] = '16-bit Mixer';
- $QuicktimeAudioCodecLookup['mp4a'] = 'ISO/IEC 14496-3 AAC';
- $QuicktimeAudioCodecLookup['MS'."\x00\x02"] = 'Microsoft ADPCM';
- $QuicktimeAudioCodecLookup['MS'."\x00\x11"] = 'DV IMA';
- $QuicktimeAudioCodecLookup['MS'."\x00\x55"] = 'Fraunhofer MPEG Layer III';
- $QuicktimeAudioCodecLookup['NONE'] = 'No Encoding';
- $QuicktimeAudioCodecLookup['Qclp'] = 'Qualcomm PureVoice';
- $QuicktimeAudioCodecLookup['QDM2'] = 'QDesign Music 2';
- $QuicktimeAudioCodecLookup['QDMC'] = 'QDesign Music 1';
- $QuicktimeAudioCodecLookup['ratb'] = '8-bit Rate';
- $QuicktimeAudioCodecLookup['ratw'] = '16-bit Rate';
- $QuicktimeAudioCodecLookup['raw '] = 'raw PCM';
- $QuicktimeAudioCodecLookup['sour'] = 'Sound Source';
- $QuicktimeAudioCodecLookup['sowt'] = 'signed/two\'s complement (Little Endian)';
- $QuicktimeAudioCodecLookup['str1'] = 'Iomega MPEG layer II';
- $QuicktimeAudioCodecLookup['str2'] = 'Iomega MPEG *layer II';
- $QuicktimeAudioCodecLookup['str3'] = 'Iomega MPEG **layer II';
- $QuicktimeAudioCodecLookup['str4'] = 'Iomega MPEG ***layer II';
- $QuicktimeAudioCodecLookup['twos'] = 'signed/two\'s complement (Big Endian)';
- $QuicktimeAudioCodecLookup['ulaw'] = 'mu-law 2:1';
- }
- return (isset($QuicktimeAudioCodecLookup[$codecid]) ? $QuicktimeAudioCodecLookup[$codecid] : '');
- }
-
- function QuicktimeDCOMLookup($compressionid) {
- static $QuicktimeDCOMLookup = array();
- if (empty($QuicktimeDCOMLookup)) {
- $QuicktimeDCOMLookup['zlib'] = 'ZLib Deflate';
- $QuicktimeDCOMLookup['adec'] = 'Apple Compression';
- }
- return (isset($QuicktimeDCOMLookup[$compressionid]) ? $QuicktimeDCOMLookup[$compressionid] : '');
- }
-
- function QuicktimeColorNameLookup($colordepthid) {
- static $QuicktimeColorNameLookup = array();
- if (empty($QuicktimeColorNameLookup)) {
- $QuicktimeColorNameLookup[1] = '2-color (monochrome)';
- $QuicktimeColorNameLookup[2] = '4-color';
- $QuicktimeColorNameLookup[4] = '16-color';
- $QuicktimeColorNameLookup[8] = '256-color';
- $QuicktimeColorNameLookup[16] = 'thousands (16-bit color)';
- $QuicktimeColorNameLookup[24] = 'millions (24-bit color)';
- $QuicktimeColorNameLookup[32] = 'millions+ (32-bit color)';
- $QuicktimeColorNameLookup[33] = 'black & white';
- $QuicktimeColorNameLookup[34] = '4-gray';
- $QuicktimeColorNameLookup[36] = '16-gray';
- $QuicktimeColorNameLookup[40] = '256-gray';
- }
- return (isset($QuicktimeColorNameLookup[$colordepthid]) ? $QuicktimeColorNameLookup[$colordepthid] : 'invalid');
- }
-
- function QuicktimeSTIKLookup($stik) {
- static $QuicktimeSTIKLookup = array();
- if (empty($QuicktimeSTIKLookup)) {
- $QuicktimeSTIKLookup[0] = 'Movie';
- $QuicktimeSTIKLookup[1] = 'Normal';
- $QuicktimeSTIKLookup[2] = 'Audiobook';
- $QuicktimeSTIKLookup[5] = 'Whacked Bookmark';
- $QuicktimeSTIKLookup[6] = 'Music Video';
- $QuicktimeSTIKLookup[9] = 'Short Film';
- $QuicktimeSTIKLookup[10] = 'TV Show';
- $QuicktimeSTIKLookup[11] = 'Booklet';
- $QuicktimeSTIKLookup[14] = 'Ringtone';
- $QuicktimeSTIKLookup[21] = 'Podcast';
- }
- return (isset($QuicktimeSTIKLookup[$stik]) ? $QuicktimeSTIKLookup[$stik] : 'invalid');
- }
-
- function QuicktimeIODSaudioProfileName($audio_profile_id) {
- static $QuicktimeIODSaudioProfileNameLookup = array();
- if (empty($QuicktimeIODSaudioProfileNameLookup)) {
- $QuicktimeIODSaudioProfileNameLookup = array(
- 0x00 => 'ISO Reserved (0x00)',
- 0x01 => 'Main Audio Profile @ Level 1',
- 0x02 => 'Main Audio Profile @ Level 2',
- 0x03 => 'Main Audio Profile @ Level 3',
- 0x04 => 'Main Audio Profile @ Level 4',
- 0x05 => 'Scalable Audio Profile @ Level 1',
- 0x06 => 'Scalable Audio Profile @ Level 2',
- 0x07 => 'Scalable Audio Profile @ Level 3',
- 0x08 => 'Scalable Audio Profile @ Level 4',
- 0x09 => 'Speech Audio Profile @ Level 1',
- 0x0A => 'Speech Audio Profile @ Level 2',
- 0x0B => 'Synthetic Audio Profile @ Level 1',
- 0x0C => 'Synthetic Audio Profile @ Level 2',
- 0x0D => 'Synthetic Audio Profile @ Level 3',
- 0x0E => 'High Quality Audio Profile @ Level 1',
- 0x0F => 'High Quality Audio Profile @ Level 2',
- 0x10 => 'High Quality Audio Profile @ Level 3',
- 0x11 => 'High Quality Audio Profile @ Level 4',
- 0x12 => 'High Quality Audio Profile @ Level 5',
- 0x13 => 'High Quality Audio Profile @ Level 6',
- 0x14 => 'High Quality Audio Profile @ Level 7',
- 0x15 => 'High Quality Audio Profile @ Level 8',
- 0x16 => 'Low Delay Audio Profile @ Level 1',
- 0x17 => 'Low Delay Audio Profile @ Level 2',
- 0x18 => 'Low Delay Audio Profile @ Level 3',
- 0x19 => 'Low Delay Audio Profile @ Level 4',
- 0x1A => 'Low Delay Audio Profile @ Level 5',
- 0x1B => 'Low Delay Audio Profile @ Level 6',
- 0x1C => 'Low Delay Audio Profile @ Level 7',
- 0x1D => 'Low Delay Audio Profile @ Level 8',
- 0x1E => 'Natural Audio Profile @ Level 1',
- 0x1F => 'Natural Audio Profile @ Level 2',
- 0x20 => 'Natural Audio Profile @ Level 3',
- 0x21 => 'Natural Audio Profile @ Level 4',
- 0x22 => 'Mobile Audio Internetworking Profile @ Level 1',
- 0x23 => 'Mobile Audio Internetworking Profile @ Level 2',
- 0x24 => 'Mobile Audio Internetworking Profile @ Level 3',
- 0x25 => 'Mobile Audio Internetworking Profile @ Level 4',
- 0x26 => 'Mobile Audio Internetworking Profile @ Level 5',
- 0x27 => 'Mobile Audio Internetworking Profile @ Level 6',
- 0x28 => 'AAC Profile @ Level 1',
- 0x29 => 'AAC Profile @ Level 2',
- 0x2A => 'AAC Profile @ Level 4',
- 0x2B => 'AAC Profile @ Level 5',
- 0x2C => 'High Efficiency AAC Profile @ Level 2',
- 0x2D => 'High Efficiency AAC Profile @ Level 3',
- 0x2E => 'High Efficiency AAC Profile @ Level 4',
- 0x2F => 'High Efficiency AAC Profile @ Level 5',
- 0xFE => 'Not part of MPEG-4 audio profiles',
- 0xFF => 'No audio capability required',
- );
- }
- return (isset($QuicktimeIODSaudioProfileNameLookup[$audio_profile_id]) ? $QuicktimeIODSaudioProfileNameLookup[$audio_profile_id] : 'ISO Reserved / User Private');
- }
-
-
- function QuicktimeIODSvideoProfileName($video_profile_id) {
- static $QuicktimeIODSvideoProfileNameLookup = array();
- if (empty($QuicktimeIODSvideoProfileNameLookup)) {
- $QuicktimeIODSvideoProfileNameLookup = array(
- 0x00 => 'Reserved (0x00) Profile',
- 0x01 => 'Simple Profile @ Level 1',
- 0x02 => 'Simple Profile @ Level 2',
- 0x03 => 'Simple Profile @ Level 3',
- 0x08 => 'Simple Profile @ Level 0',
- 0x10 => 'Simple Scalable Profile @ Level 0',
- 0x11 => 'Simple Scalable Profile @ Level 1',
- 0x12 => 'Simple Scalable Profile @ Level 2',
- 0x15 => 'AVC/H264 Profile',
- 0x21 => 'Core Profile @ Level 1',
- 0x22 => 'Core Profile @ Level 2',
- 0x32 => 'Main Profile @ Level 2',
- 0x33 => 'Main Profile @ Level 3',
- 0x34 => 'Main Profile @ Level 4',
- 0x42 => 'N-bit Profile @ Level 2',
- 0x51 => 'Scalable Texture Profile @ Level 1',
- 0x61 => 'Simple Face Animation Profile @ Level 1',
- 0x62 => 'Simple Face Animation Profile @ Level 2',
- 0x63 => 'Simple FBA Profile @ Level 1',
- 0x64 => 'Simple FBA Profile @ Level 2',
- 0x71 => 'Basic Animated Texture Profile @ Level 1',
- 0x72 => 'Basic Animated Texture Profile @ Level 2',
- 0x81 => 'Hybrid Profile @ Level 1',
- 0x82 => 'Hybrid Profile @ Level 2',
- 0x91 => 'Advanced Real Time Simple Profile @ Level 1',
- 0x92 => 'Advanced Real Time Simple Profile @ Level 2',
- 0x93 => 'Advanced Real Time Simple Profile @ Level 3',
- 0x94 => 'Advanced Real Time Simple Profile @ Level 4',
- 0xA1 => 'Core Scalable Profile @ Level1',
- 0xA2 => 'Core Scalable Profile @ Level2',
- 0xA3 => 'Core Scalable Profile @ Level3',
- 0xB1 => 'Advanced Coding Efficiency Profile @ Level 1',
- 0xB2 => 'Advanced Coding Efficiency Profile @ Level 2',
- 0xB3 => 'Advanced Coding Efficiency Profile @ Level 3',
- 0xB4 => 'Advanced Coding Efficiency Profile @ Level 4',
- 0xC1 => 'Advanced Core Profile @ Level 1',
- 0xC2 => 'Advanced Core Profile @ Level 2',
- 0xD1 => 'Advanced Scalable Texture @ Level1',
- 0xD2 => 'Advanced Scalable Texture @ Level2',
- 0xE1 => 'Simple Studio Profile @ Level 1',
- 0xE2 => 'Simple Studio Profile @ Level 2',
- 0xE3 => 'Simple Studio Profile @ Level 3',
- 0xE4 => 'Simple Studio Profile @ Level 4',
- 0xE5 => 'Core Studio Profile @ Level 1',
- 0xE6 => 'Core Studio Profile @ Level 2',
- 0xE7 => 'Core Studio Profile @ Level 3',
- 0xE8 => 'Core Studio Profile @ Level 4',
- 0xF0 => 'Advanced Simple Profile @ Level 0',
- 0xF1 => 'Advanced Simple Profile @ Level 1',
- 0xF2 => 'Advanced Simple Profile @ Level 2',
- 0xF3 => 'Advanced Simple Profile @ Level 3',
- 0xF4 => 'Advanced Simple Profile @ Level 4',
- 0xF5 => 'Advanced Simple Profile @ Level 5',
- 0xF7 => 'Advanced Simple Profile @ Level 3b',
- 0xF8 => 'Fine Granularity Scalable Profile @ Level 0',
- 0xF9 => 'Fine Granularity Scalable Profile @ Level 1',
- 0xFA => 'Fine Granularity Scalable Profile @ Level 2',
- 0xFB => 'Fine Granularity Scalable Profile @ Level 3',
- 0xFC => 'Fine Granularity Scalable Profile @ Level 4',
- 0xFD => 'Fine Granularity Scalable Profile @ Level 5',
- 0xFE => 'Not part of MPEG-4 Visual profiles',
- 0xFF => 'No visual capability required',
- );
- }
- return (isset($QuicktimeIODSvideoProfileNameLookup[$video_profile_id]) ? $QuicktimeIODSvideoProfileNameLookup[$video_profile_id] : 'ISO Reserved Profile');
- }
-
-
- function QuicktimeContentRatingLookup($rtng) {
- static $QuicktimeContentRatingLookup = array();
- if (empty($QuicktimeContentRatingLookup)) {
- $QuicktimeContentRatingLookup[0] = 'None';
- $QuicktimeContentRatingLookup[2] = 'Clean';
- $QuicktimeContentRatingLookup[4] = 'Explicit';
- }
- return (isset($QuicktimeContentRatingLookup[$rtng]) ? $QuicktimeContentRatingLookup[$rtng] : 'invalid');
- }
-
- function QuicktimeStoreAccountTypeLookup($akid) {
- static $QuicktimeStoreAccountTypeLookup = array();
- if (empty($QuicktimeStoreAccountTypeLookup)) {
- $QuicktimeStoreAccountTypeLookup[0] = 'iTunes';
- $QuicktimeStoreAccountTypeLookup[1] = 'AOL';
- }
- return (isset($QuicktimeStoreAccountTypeLookup[$akid]) ? $QuicktimeStoreAccountTypeLookup[$akid] : 'invalid');
- }
-
- function QuicktimeStoreFrontCodeLookup($sfid) {
- static $QuicktimeStoreFrontCodeLookup = array();
- if (empty($QuicktimeStoreFrontCodeLookup)) {
- $QuicktimeStoreFrontCodeLookup[143460] = 'Australia';
- $QuicktimeStoreFrontCodeLookup[143445] = 'Austria';
- $QuicktimeStoreFrontCodeLookup[143446] = 'Belgium';
- $QuicktimeStoreFrontCodeLookup[143455] = 'Canada';
- $QuicktimeStoreFrontCodeLookup[143458] = 'Denmark';
- $QuicktimeStoreFrontCodeLookup[143447] = 'Finland';
- $QuicktimeStoreFrontCodeLookup[143442] = 'France';
- $QuicktimeStoreFrontCodeLookup[143443] = 'Germany';
- $QuicktimeStoreFrontCodeLookup[143448] = 'Greece';
- $QuicktimeStoreFrontCodeLookup[143449] = 'Ireland';
- $QuicktimeStoreFrontCodeLookup[143450] = 'Italy';
- $QuicktimeStoreFrontCodeLookup[143462] = 'Japan';
- $QuicktimeStoreFrontCodeLookup[143451] = 'Luxembourg';
- $QuicktimeStoreFrontCodeLookup[143452] = 'Netherlands';
- $QuicktimeStoreFrontCodeLookup[143461] = 'New Zealand';
- $QuicktimeStoreFrontCodeLookup[143457] = 'Norway';
- $QuicktimeStoreFrontCodeLookup[143453] = 'Portugal';
- $QuicktimeStoreFrontCodeLookup[143454] = 'Spain';
- $QuicktimeStoreFrontCodeLookup[143456] = 'Sweden';
- $QuicktimeStoreFrontCodeLookup[143459] = 'Switzerland';
- $QuicktimeStoreFrontCodeLookup[143444] = 'United Kingdom';
- $QuicktimeStoreFrontCodeLookup[143441] = 'United States';
- }
- return (isset($QuicktimeStoreFrontCodeLookup[$sfid]) ? $QuicktimeStoreFrontCodeLookup[$sfid] : 'invalid');
- }
-
- function QuicktimeParseNikonNCTG($atom_data) {
- // http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html#NCTG
- // Nikon-specific QuickTime tags found in the NCDT atom of MOV videos from some Nikon cameras such as the Coolpix S8000 and D5100
- // Data is stored as records of:
- // * 4 bytes record type
- // * 2 bytes size of data field type:
- // 0x0001 = flag (size field *= 1-byte)
- // 0x0002 = char (size field *= 1-byte)
- // 0x0003 = DWORD+ (size field *= 2-byte), values are stored CDAB
- // 0x0004 = QWORD+ (size field *= 4-byte), values are stored EFGHABCD
- // 0x0005 = float (size field *= 8-byte), values are stored aaaabbbb where value is aaaa/bbbb; possibly multiple sets of values appended together
- // 0x0007 = bytes (size field *= 1-byte), values are stored as ??????
- // 0x0008 = ????? (size field *= 2-byte), values are stored as ??????
- // * 2 bytes data size field
- // * ? bytes data (string data may be null-padded; datestamp fields are in the format "2011:05:25 20:24:15")
- // all integers are stored BigEndian
-
- $NCTGtagName = array(
- 0x00000001 => 'Make',
- 0x00000002 => 'Model',
- 0x00000003 => 'Software',
- 0x00000011 => 'CreateDate',
- 0x00000012 => 'DateTimeOriginal',
- 0x00000013 => 'FrameCount',
- 0x00000016 => 'FrameRate',
- 0x00000022 => 'FrameWidth',
- 0x00000023 => 'FrameHeight',
- 0x00000032 => 'AudioChannels',
- 0x00000033 => 'AudioBitsPerSample',
- 0x00000034 => 'AudioSampleRate',
- 0x02000001 => 'MakerNoteVersion',
- 0x02000005 => 'WhiteBalance',
- 0x0200000b => 'WhiteBalanceFineTune',
- 0x0200001e => 'ColorSpace',
- 0x02000023 => 'PictureControlData',
- 0x02000024 => 'WorldTime',
- 0x02000032 => 'UnknownInfo',
- 0x02000083 => 'LensType',
- 0x02000084 => 'Lens',
- );
-
- $offset = 0;
- $datalength = strlen($atom_data);
- $parsed = array();
- while ($offset < $datalength) {
-//echo getid3_lib::PrintHexBytes(substr($atom_data, $offset, 4)).'<br>';
- $record_type = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 4)); $offset += 4;
- $data_size_type = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 2)); $offset += 2;
- $data_size = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 2)); $offset += 2;
- switch ($data_size_type) {
- case 0x0001: // 0x0001 = flag (size field *= 1-byte)
- $data = getid3_lib::BigEndian2Int(substr($atom_data, $offset, $data_size * 1));
- $offset += ($data_size * 1);
- break;
- case 0x0002: // 0x0002 = char (size field *= 1-byte)
- $data = substr($atom_data, $offset, $data_size * 1);
- $offset += ($data_size * 1);
- $data = rtrim($data, "\x00");
- break;
- case 0x0003: // 0x0003 = DWORD+ (size field *= 2-byte), values are stored CDAB
- $data = '';
- for ($i = $data_size - 1; $i >= 0; $i--) {
- $data .= substr($atom_data, $offset + ($i * 2), 2);
- }
- $data = getid3_lib::BigEndian2Int($data);
- $offset += ($data_size * 2);
- break;
- case 0x0004: // 0x0004 = QWORD+ (size field *= 4-byte), values are stored EFGHABCD
- $data = '';
- for ($i = $data_size - 1; $i >= 0; $i--) {
- $data .= substr($atom_data, $offset + ($i * 4), 4);
- }
- $data = getid3_lib::BigEndian2Int($data);
- $offset += ($data_size * 4);
- break;
- case 0x0005: // 0x0005 = float (size field *= 8-byte), values are stored aaaabbbb where value is aaaa/bbbb; possibly multiple sets of values appended together
- $data = array();
- for ($i = 0; $i < $data_size; $i++) {
- $numerator = getid3_lib::BigEndian2Int(substr($atom_data, $offset + ($i * 8) + 0, 4));
- $denomninator = getid3_lib::BigEndian2Int(substr($atom_data, $offset + ($i * 8) + 4, 4));
- if ($denomninator == 0) {
- $data[$i] = false;
- } else {
- $data[$i] = (double) $numerator / $denomninator;
- }
- }
- $offset += (8 * $data_size);
- if (count($data) == 1) {
- $data = $data[0];
- }
- break;
- case 0x0007: // 0x0007 = bytes (size field *= 1-byte), values are stored as ??????
- $data = substr($atom_data, $offset, $data_size * 1);
- $offset += ($data_size * 1);
- break;
- case 0x0008: // 0x0008 = ????? (size field *= 2-byte), values are stored as ??????
- $data = substr($atom_data, $offset, $data_size * 2);
- $offset += ($data_size * 2);
- break;
- default:
-echo 'QuicktimeParseNikonNCTG()::unknown $data_size_type: '.$data_size_type.'<br>';
- break 2;
- }
-
- switch ($record_type) {
- case 0x00000011: // CreateDate
- case 0x00000012: // DateTimeOriginal
- $data = strtotime($data);
- break;
- case 0x0200001e: // ColorSpace
- switch ($data) {
- case 1:
- $data = 'sRGB';
- break;
- case 2:
- $data = 'Adobe RGB';
- break;
- }
- break;
- case 0x02000023: // PictureControlData
- $PictureControlAdjust = array(0=>'default', 1=>'quick', 2=>'full');
- $FilterEffect = array(0x80=>'off', 0x81=>'yellow', 0x82=>'orange', 0x83=>'red', 0x84=>'green', 0xff=>'n/a');
- $ToningEffect = array(0x80=>'b&w', 0x81=>'sepia', 0x82=>'cyanotype', 0x83=>'red', 0x84=>'yellow', 0x85=>'green', 0x86=>'blue-green', 0x87=>'blue', 0x88=>'purple-blue', 0x89=>'red-purple', 0xff=>'n/a');
- $data = array(
- 'PictureControlVersion' => substr($data, 0, 4),
- 'PictureControlName' => rtrim(substr($data, 4, 20), "\x00"),
- 'PictureControlBase' => rtrim(substr($data, 24, 20), "\x00"),
- //'?' => substr($data, 44, 4),
- 'PictureControlAdjust' => $PictureControlAdjust[ord(substr($data, 48, 1))],
- 'PictureControlQuickAdjust' => ord(substr($data, 49, 1)),
- 'Sharpness' => ord(substr($data, 50, 1)),
- 'Contrast' => ord(substr($data, 51, 1)),
- 'Brightness' => ord(substr($data, 52, 1)),
- 'Saturation' => ord(substr($data, 53, 1)),
- 'HueAdjustment' => ord(substr($data, 54, 1)),
- 'FilterEffect' => $FilterEffect[ord(substr($data, 55, 1))],
- 'ToningEffect' => $ToningEffect[ord(substr($data, 56, 1))],
- 'ToningSaturation' => ord(substr($data, 57, 1)),
- );
- break;
- case 0x02000024: // WorldTime
- // http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html#WorldTime
- // timezone is stored as offset from GMT in minutes
- $timezone = getid3_lib::BigEndian2Int(substr($data, 0, 2));
- if ($timezone & 0x8000) {
- $timezone = 0 - (0x10000 - $timezone);
- }
- $timezone /= 60;
-
- $dst = (bool) getid3_lib::BigEndian2Int(substr($data, 2, 1));
- switch (getid3_lib::BigEndian2Int(substr($data, 3, 1))) {
- case 2:
- $datedisplayformat = 'D/M/Y'; break;
- case 1:
- $datedisplayformat = 'M/D/Y'; break;
- case 0:
- default:
- $datedisplayformat = 'Y/M/D'; break;
- }
-
- $data = array('timezone'=>floatval($timezone), 'dst'=>$dst, 'display'=>$datedisplayformat);
- break;
- case 0x02000083: // LensType
- $data = array(
- //'_' => $data,
- 'mf' => (bool) ($data & 0x01),
- 'd' => (bool) ($data & 0x02),
- 'g' => (bool) ($data & 0x04),
- 'vr' => (bool) ($data & 0x08),
- );
- break;
- }
- $tag_name = (isset($NCTGtagName[$record_type]) ? $NCTGtagName[$record_type] : '0x'.str_pad(dechex($record_type), 8, '0', STR_PAD_LEFT));
- $parsed[$tag_name] = $data;
- }
- return $parsed;
- }
-
-
- function CopyToAppropriateCommentsSection($keyname, $data, $boxname='') {
- static $handyatomtranslatorarray = array();
- if (empty($handyatomtranslatorarray)) {
- $handyatomtranslatorarray['cpy'] = 'copyright';
- $handyatomtranslatorarray['day'] = 'creation_date'; // iTunes 4.0
- $handyatomtranslatorarray['dir'] = 'director';
- $handyatomtranslatorarray['ed1'] = 'edit1';
- $handyatomtranslatorarray['ed2'] = 'edit2';
- $handyatomtranslatorarray['ed3'] = 'edit3';
- $handyatomtranslatorarray['ed4'] = 'edit4';
- $handyatomtranslatorarray['ed5'] = 'edit5';
- $handyatomtranslatorarray['ed6'] = 'edit6';
- $handyatomtranslatorarray['ed7'] = 'edit7';
- $handyatomtranslatorarray['ed8'] = 'edit8';
- $handyatomtranslatorarray['ed9'] = 'edit9';
- $handyatomtranslatorarray['fmt'] = 'format';
- $handyatomtranslatorarray['inf'] = 'information';
- $handyatomtranslatorarray['prd'] = 'producer';
- $handyatomtranslatorarray['prf'] = 'performers';
- $handyatomtranslatorarray['req'] = 'system_requirements';
- $handyatomtranslatorarray['src'] = 'source_credit';
- $handyatomtranslatorarray['wrt'] = 'writer';
-
- // http://www.geocities.com/xhelmboyx/quicktime/formats/qtm-layout.txt
- $handyatomtranslatorarray['nam'] = 'title'; // iTunes 4.0
- $handyatomtranslatorarray['cmt'] = 'comment'; // iTunes 4.0
- $handyatomtranslatorarray['wrn'] = 'warning';
- $handyatomtranslatorarray['hst'] = 'host_computer';
- $handyatomtranslatorarray['mak'] = 'make';
- $handyatomtranslatorarray['mod'] = 'model';
- $handyatomtranslatorarray['PRD'] = 'product';
- $handyatomtranslatorarray['swr'] = 'software';
- $handyatomtranslatorarray['aut'] = 'author';
- $handyatomtranslatorarray['ART'] = 'artist';
- $handyatomtranslatorarray['trk'] = 'track';
- $handyatomtranslatorarray['alb'] = 'album'; // iTunes 4.0
- $handyatomtranslatorarray['com'] = 'comment';
- $handyatomtranslatorarray['gen'] = 'genre'; // iTunes 4.0
- $handyatomtranslatorarray['ope'] = 'composer';
- $handyatomtranslatorarray['url'] = 'url';
- $handyatomtranslatorarray['enc'] = 'encoder';
-
- // http://atomicparsley.sourceforge.net/mpeg-4files.html
- $handyatomtranslatorarray['art'] = 'artist'; // iTunes 4.0
- $handyatomtranslatorarray['aART'] = 'album_artist';
- $handyatomtranslatorarray['trkn'] = 'track_number'; // iTunes 4.0
- $handyatomtranslatorarray['disk'] = 'disc_number'; // iTunes 4.0
- $handyatomtranslatorarray['gnre'] = 'genre'; // iTunes 4.0
- $handyatomtranslatorarray['too'] = 'encoder'; // iTunes 4.0
- $handyatomtranslatorarray['tmpo'] = 'bpm'; // iTunes 4.0
- $handyatomtranslatorarray['cprt'] = 'copyright'; // iTunes 4.0?
- $handyatomtranslatorarray['cpil'] = 'compilation'; // iTunes 4.0
- $handyatomtranslatorarray['covr'] = 'picture'; // iTunes 4.0
- $handyatomtranslatorarray['rtng'] = 'rating'; // iTunes 4.0
- $handyatomtranslatorarray['grp'] = 'grouping'; // iTunes 4.2
- $handyatomtranslatorarray['stik'] = 'stik'; // iTunes 4.9
- $handyatomtranslatorarray['pcst'] = 'podcast'; // iTunes 4.9
- $handyatomtranslatorarray['catg'] = 'category'; // iTunes 4.9
- $handyatomtranslatorarray['keyw'] = 'keyword'; // iTunes 4.9
- $handyatomtranslatorarray['purl'] = 'podcast_url'; // iTunes 4.9
- $handyatomtranslatorarray['egid'] = 'episode_guid'; // iTunes 4.9
- $handyatomtranslatorarray['desc'] = 'description'; // iTunes 5.0
- $handyatomtranslatorarray['lyr'] = 'lyrics'; // iTunes 5.0
- $handyatomtranslatorarray['tvnn'] = 'tv_network_name'; // iTunes 6.0
- $handyatomtranslatorarray['tvsh'] = 'tv_show_name'; // iTunes 6.0
- $handyatomtranslatorarray['tvsn'] = 'tv_season'; // iTunes 6.0
- $handyatomtranslatorarray['tves'] = 'tv_episode'; // iTunes 6.0
- $handyatomtranslatorarray['purd'] = 'purchase_date'; // iTunes 6.0.2
- $handyatomtranslatorarray['pgap'] = 'gapless_playback'; // iTunes 7.0
-
- // http://www.geocities.com/xhelmboyx/quicktime/formats/mp4-layout.txt
-
-
-
- // boxnames:
- $handyatomtranslatorarray['iTunSMPB'] = 'iTunSMPB';
- $handyatomtranslatorarray['iTunNORM'] = 'iTunNORM';
- $handyatomtranslatorarray['Encoding Params'] = 'Encoding Params';
- $handyatomtranslatorarray['replaygain_track_gain'] = 'replaygain_track_gain';
- $handyatomtranslatorarray['replaygain_track_peak'] = 'replaygain_track_peak';
- $handyatomtranslatorarray['replaygain_track_minmax'] = 'replaygain_track_minmax';
- $handyatomtranslatorarray['MusicIP PUID'] = 'MusicIP PUID';
- $handyatomtranslatorarray['MusicBrainz Artist Id'] = 'MusicBrainz Artist Id';
- $handyatomtranslatorarray['MusicBrainz Album Id'] = 'MusicBrainz Album Id';
- $handyatomtranslatorarray['MusicBrainz Album Artist Id'] = 'MusicBrainz Album Artist Id';
- $handyatomtranslatorarray['MusicBrainz Track Id'] = 'MusicBrainz Track Id';
- $handyatomtranslatorarray['MusicBrainz Disc Id'] = 'MusicBrainz Disc Id';
- }
- $info = &$this->getid3->info;
- $comment_key = '';
- if ($boxname && ($boxname != $keyname) && isset($handyatomtranslatorarray[$boxname])) {
- $comment_key = $handyatomtranslatorarray[$boxname];
- } elseif (isset($handyatomtranslatorarray[$keyname])) {
- $comment_key = $handyatomtranslatorarray[$keyname];
- }
- if ($comment_key) {
- if ($comment_key == 'picture') {
- if (!is_array($data)) {
- $image_mime = '';
- if (preg_match('#^\x89\x50\x4E\x47\x0D\x0A\x1A\x0A#', $data)) {
- $image_mime = 'image/png';
- } elseif (preg_match('#^\xFF\xD8\xFF#', $data)) {
- $image_mime = 'image/jpeg';
- } elseif (preg_match('#^GIF#', $data)) {
- $image_mime = 'image/gif';
- } elseif (preg_match('#^BM#', $data)) {
- $image_mime = 'image/bmp';
- }
- $data = array('data'=>$data, 'image_mime'=>$image_mime);
- }
- }
- $info['quicktime']['comments'][$comment_key][] = $data;
- }
- return true;
- }
-
- function NoNullString($nullterminatedstring) {
- // remove the single null terminator on null terminated strings
- if (substr($nullterminatedstring, strlen($nullterminatedstring) - 1, 1) === "\x00") {
- return substr($nullterminatedstring, 0, strlen($nullterminatedstring) - 1);
- }
- return $nullterminatedstring;
- }
-
- function Pascal2String($pascalstring) {
- // Pascal strings have 1 unsigned byte at the beginning saying how many chars (1-255) are in the string
- return substr($pascalstring, 1);
- }
-
-}
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.audio-video.real.php b/3rdparty/getid3/module.audio-video.real.php
deleted file mode 100644
index d716e7da3c2..00000000000
--- a/3rdparty/getid3/module.audio-video.real.php
+++ /dev/null
@@ -1,530 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.audio-video.real.php //
-// module for analyzing Real Audio/Video files //
-// dependencies: module.audio-video.riff.php //
-// ///
-/////////////////////////////////////////////////////////////////
-
-getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, true);
-
-class getid3_real extends getid3_handler
-{
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- $info['fileformat'] = 'real';
- $info['bitrate'] = 0;
- $info['playtime_seconds'] = 0;
-
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
- $ChunkCounter = 0;
- while (ftell($this->getid3->fp) < $info['avdataend']) {
- $ChunkData = fread($this->getid3->fp, 8);
- $ChunkName = substr($ChunkData, 0, 4);
- $ChunkSize = getid3_lib::BigEndian2Int(substr($ChunkData, 4, 4));
-
- if ($ChunkName == '.ra'."\xFD") {
- $ChunkData .= fread($this->getid3->fp, $ChunkSize - 8);
- if ($this->ParseOldRAheader(substr($ChunkData, 0, 128), $info['real']['old_ra_header'])) {
- $info['audio']['dataformat'] = 'real';
- $info['audio']['lossless'] = false;
- $info['audio']['sample_rate'] = $info['real']['old_ra_header']['sample_rate'];
- $info['audio']['bits_per_sample'] = $info['real']['old_ra_header']['bits_per_sample'];
- $info['audio']['channels'] = $info['real']['old_ra_header']['channels'];
-
- $info['playtime_seconds'] = 60 * ($info['real']['old_ra_header']['audio_bytes'] / $info['real']['old_ra_header']['bytes_per_minute']);
- $info['audio']['bitrate'] = 8 * ($info['real']['old_ra_header']['audio_bytes'] / $info['playtime_seconds']);
- $info['audio']['codec'] = $this->RealAudioCodecFourCClookup($info['real']['old_ra_header']['fourcc'], $info['audio']['bitrate']);
-
- foreach ($info['real']['old_ra_header']['comments'] as $key => $valuearray) {
- if (strlen(trim($valuearray[0])) > 0) {
- $info['real']['comments'][$key][] = trim($valuearray[0]);
- }
- }
- return true;
- }
- $info['error'][] = 'There was a problem parsing this RealAudio file. Please submit it for analysis to info@getid3.org';
- unset($info['bitrate']);
- unset($info['playtime_seconds']);
- return false;
- }
-
- // shortcut
- $info['real']['chunks'][$ChunkCounter] = array();
- $thisfile_real_chunks_currentchunk = &$info['real']['chunks'][$ChunkCounter];
-
- $thisfile_real_chunks_currentchunk['name'] = $ChunkName;
- $thisfile_real_chunks_currentchunk['offset'] = ftell($this->getid3->fp) - 8;
- $thisfile_real_chunks_currentchunk['length'] = $ChunkSize;
- if (($thisfile_real_chunks_currentchunk['offset'] + $thisfile_real_chunks_currentchunk['length']) > $info['avdataend']) {
- $info['warning'][] = 'Chunk "'.$thisfile_real_chunks_currentchunk['name'].'" at offset '.$thisfile_real_chunks_currentchunk['offset'].' claims to be '.$thisfile_real_chunks_currentchunk['length'].' bytes long, which is beyond end of file';
- return false;
- }
-
- if ($ChunkSize > ($this->getid3->fread_buffer_size() + 8)) {
-
- $ChunkData .= fread($this->getid3->fp, $this->getid3->fread_buffer_size() - 8);
- fseek($this->getid3->fp, $thisfile_real_chunks_currentchunk['offset'] + $ChunkSize, SEEK_SET);
-
- } elseif(($ChunkSize - 8) > 0) {
-
- $ChunkData .= fread($this->getid3->fp, $ChunkSize - 8);
-
- }
- $offset = 8;
-
- switch ($ChunkName) {
-
- case '.RMF': // RealMedia File Header
- $thisfile_real_chunks_currentchunk['object_version'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 2));
- $offset += 2;
- switch ($thisfile_real_chunks_currentchunk['object_version']) {
-
- case 0:
- $thisfile_real_chunks_currentchunk['file_version'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4));
- $offset += 4;
- $thisfile_real_chunks_currentchunk['headers_count'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4));
- $offset += 4;
- break;
-
- default:
- //$info['warning'][] = 'Expected .RMF-object_version to be "0", actual value is "'.$thisfile_real_chunks_currentchunk['object_version'].'" (should not be a problem)';
- break;
-
- }
- break;
-
-
- case 'PROP': // Properties Header
- $thisfile_real_chunks_currentchunk['object_version'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 2));
- $offset += 2;
- if ($thisfile_real_chunks_currentchunk['object_version'] == 0) {
- $thisfile_real_chunks_currentchunk['max_bit_rate'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4));
- $offset += 4;
- $thisfile_real_chunks_currentchunk['avg_bit_rate'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4));
- $offset += 4;
- $thisfile_real_chunks_currentchunk['max_packet_size'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4));
- $offset += 4;
- $thisfile_real_chunks_currentchunk['avg_packet_size'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4));
- $offset += 4;
- $thisfile_real_chunks_currentchunk['num_packets'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4));
- $offset += 4;
- $thisfile_real_chunks_currentchunk['duration'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4));
- $offset += 4;
- $thisfile_real_chunks_currentchunk['preroll'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4));
- $offset += 4;
- $thisfile_real_chunks_currentchunk['index_offset'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4));
- $offset += 4;
- $thisfile_real_chunks_currentchunk['data_offset'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4));
- $offset += 4;
- $thisfile_real_chunks_currentchunk['num_streams'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 2));
- $offset += 2;
- $thisfile_real_chunks_currentchunk['flags_raw'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 2));
- $offset += 2;
- $info['playtime_seconds'] = $thisfile_real_chunks_currentchunk['duration'] / 1000;
- if ($thisfile_real_chunks_currentchunk['duration'] > 0) {
- $info['bitrate'] += $thisfile_real_chunks_currentchunk['avg_bit_rate'];
- }
- $thisfile_real_chunks_currentchunk['flags']['save_enabled'] = (bool) ($thisfile_real_chunks_currentchunk['flags_raw'] & 0x0001);
- $thisfile_real_chunks_currentchunk['flags']['perfect_play'] = (bool) ($thisfile_real_chunks_currentchunk['flags_raw'] & 0x0002);
- $thisfile_real_chunks_currentchunk['flags']['live_broadcast'] = (bool) ($thisfile_real_chunks_currentchunk['flags_raw'] & 0x0004);
- }
- break;
-
- case 'MDPR': // Media Properties Header
- $thisfile_real_chunks_currentchunk['object_version'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 2));
- $offset += 2;
- if ($thisfile_real_chunks_currentchunk['object_version'] == 0) {
- $thisfile_real_chunks_currentchunk['stream_number'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 2));
- $offset += 2;
- $thisfile_real_chunks_currentchunk['max_bit_rate'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4));
- $offset += 4;
- $thisfile_real_chunks_currentchunk['avg_bit_rate'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4));
- $offset += 4;
- $thisfile_real_chunks_currentchunk['max_packet_size'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4));
- $offset += 4;
- $thisfile_real_chunks_currentchunk['avg_packet_size'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4));
- $offset += 4;
- $thisfile_real_chunks_currentchunk['start_time'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4));
- $offset += 4;
- $thisfile_real_chunks_currentchunk['preroll'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4));
- $offset += 4;
- $thisfile_real_chunks_currentchunk['duration'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4));
- $offset += 4;
- $thisfile_real_chunks_currentchunk['stream_name_size'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 1));
- $offset += 1;
- $thisfile_real_chunks_currentchunk['stream_name'] = substr($ChunkData, $offset, $thisfile_real_chunks_currentchunk['stream_name_size']);
- $offset += $thisfile_real_chunks_currentchunk['stream_name_size'];
- $thisfile_real_chunks_currentchunk['mime_type_size'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 1));
- $offset += 1;
- $thisfile_real_chunks_currentchunk['mime_type'] = substr($ChunkData, $offset, $thisfile_real_chunks_currentchunk['mime_type_size']);
- $offset += $thisfile_real_chunks_currentchunk['mime_type_size'];
- $thisfile_real_chunks_currentchunk['type_specific_len'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4));
- $offset += 4;
- $thisfile_real_chunks_currentchunk['type_specific_data'] = substr($ChunkData, $offset, $thisfile_real_chunks_currentchunk['type_specific_len']);
- $offset += $thisfile_real_chunks_currentchunk['type_specific_len'];
-
- // shortcut
- $thisfile_real_chunks_currentchunk_typespecificdata = &$thisfile_real_chunks_currentchunk['type_specific_data'];
-
- switch ($thisfile_real_chunks_currentchunk['mime_type']) {
- case 'video/x-pn-realvideo':
- case 'video/x-pn-multirate-realvideo':
- // http://www.freelists.org/archives/matroska-devel/07-2003/msg00010.html
-
- // shortcut
- $thisfile_real_chunks_currentchunk['video_info'] = array();
- $thisfile_real_chunks_currentchunk_videoinfo = &$thisfile_real_chunks_currentchunk['video_info'];
-
- $thisfile_real_chunks_currentchunk_videoinfo['dwSize'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 0, 4));
- $thisfile_real_chunks_currentchunk_videoinfo['fourcc1'] = substr($thisfile_real_chunks_currentchunk_typespecificdata, 4, 4);
- $thisfile_real_chunks_currentchunk_videoinfo['fourcc2'] = substr($thisfile_real_chunks_currentchunk_typespecificdata, 8, 4);
- $thisfile_real_chunks_currentchunk_videoinfo['width'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 12, 2));
- $thisfile_real_chunks_currentchunk_videoinfo['height'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 14, 2));
- $thisfile_real_chunks_currentchunk_videoinfo['bits_per_sample'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 16, 2));
- //$thisfile_real_chunks_currentchunk_videoinfo['unknown1'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 18, 2));
- //$thisfile_real_chunks_currentchunk_videoinfo['unknown2'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 20, 2));
- $thisfile_real_chunks_currentchunk_videoinfo['frames_per_second'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 22, 2));
- //$thisfile_real_chunks_currentchunk_videoinfo['unknown3'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 24, 2));
- //$thisfile_real_chunks_currentchunk_videoinfo['unknown4'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 26, 2));
- //$thisfile_real_chunks_currentchunk_videoinfo['unknown5'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 28, 2));
- //$thisfile_real_chunks_currentchunk_videoinfo['unknown6'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 30, 2));
- //$thisfile_real_chunks_currentchunk_videoinfo['unknown7'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 32, 2));
- //$thisfile_real_chunks_currentchunk_videoinfo['unknown8'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 34, 2));
- //$thisfile_real_chunks_currentchunk_videoinfo['unknown9'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 36, 2));
-
- $thisfile_real_chunks_currentchunk_videoinfo['codec'] = getid3_riff::RIFFfourccLookup($thisfile_real_chunks_currentchunk_videoinfo['fourcc2']);
-
- $info['video']['resolution_x'] = $thisfile_real_chunks_currentchunk_videoinfo['width'];
- $info['video']['resolution_y'] = $thisfile_real_chunks_currentchunk_videoinfo['height'];
- $info['video']['frame_rate'] = (float) $thisfile_real_chunks_currentchunk_videoinfo['frames_per_second'];
- $info['video']['codec'] = $thisfile_real_chunks_currentchunk_videoinfo['codec'];
- $info['video']['bits_per_sample'] = $thisfile_real_chunks_currentchunk_videoinfo['bits_per_sample'];
- break;
-
- case 'audio/x-pn-realaudio':
- case 'audio/x-pn-multirate-realaudio':
- $this->ParseOldRAheader($thisfile_real_chunks_currentchunk_typespecificdata, $thisfile_real_chunks_currentchunk['parsed_audio_data']);
-
- $info['audio']['sample_rate'] = $thisfile_real_chunks_currentchunk['parsed_audio_data']['sample_rate'];
- $info['audio']['bits_per_sample'] = $thisfile_real_chunks_currentchunk['parsed_audio_data']['bits_per_sample'];
- $info['audio']['channels'] = $thisfile_real_chunks_currentchunk['parsed_audio_data']['channels'];
- if (!empty($info['audio']['dataformat'])) {
- foreach ($info['audio'] as $key => $value) {
- if ($key != 'streams') {
- $info['audio']['streams'][$thisfile_real_chunks_currentchunk['stream_number']][$key] = $value;
- }
- }
- }
- break;
-
- case 'logical-fileinfo':
- // shortcut
- $thisfile_real_chunks_currentchunk['logical_fileinfo'] = array();
- $thisfile_real_chunks_currentchunk_logicalfileinfo = &$thisfile_real_chunks_currentchunk['logical_fileinfo'];
-
- $thisfile_real_chunks_currentchunk_logicalfileinfo_offset = 0;
- $thisfile_real_chunks_currentchunk_logicalfileinfo['logical_fileinfo_length'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, $thisfile_real_chunks_currentchunk_logicalfileinfo_offset, 4));
- $thisfile_real_chunks_currentchunk_logicalfileinfo_offset += 4;
-
- //$thisfile_real_chunks_currentchunk_logicalfileinfo['unknown1'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, $thisfile_real_chunks_currentchunk_logicalfileinfo_offset, 4));
- $thisfile_real_chunks_currentchunk_logicalfileinfo_offset += 4;
-
- $thisfile_real_chunks_currentchunk_logicalfileinfo['num_tags'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, $thisfile_real_chunks_currentchunk_logicalfileinfo_offset, 4));
- $thisfile_real_chunks_currentchunk_logicalfileinfo_offset += 4;
-
- //$thisfile_real_chunks_currentchunk_logicalfileinfo['unknown2'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, $thisfile_real_chunks_currentchunk_logicalfileinfo_offset, 4));
- $thisfile_real_chunks_currentchunk_logicalfileinfo_offset += 4;
-
- //$thisfile_real_chunks_currentchunk_logicalfileinfo['d'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, $thisfile_real_chunks_currentchunk_logicalfileinfo_offset, 1));
-
- //$thisfile_real_chunks_currentchunk_logicalfileinfo['one_type'] = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, $thisfile_real_chunks_currentchunk_logicalfileinfo_offset, 4));
- //$thisfile_real_chunks_currentchunk_logicalfileinfo_thislength = getid3_lib::BigEndian2Int(substr($thisfile_real_chunks_currentchunk_typespecificdata, 4 + $thisfile_real_chunks_currentchunk_logicalfileinfo_offset, 2));
- //$thisfile_real_chunks_currentchunk_logicalfileinfo['one'] = substr($thisfile_real_chunks_currentchunk_typespecificdata, 6 + $thisfile_real_chunks_currentchunk_logicalfileinfo_offset, $thisfile_real_chunks_currentchunk_logicalfileinfo_thislength);
- //$thisfile_real_chunks_currentchunk_logicalfileinfo_offset += (6 + $thisfile_real_chunks_currentchunk_logicalfileinfo_thislength);
-
- break;
-
- }
-
-
- if (empty($info['playtime_seconds'])) {
- $info['playtime_seconds'] = max($info['playtime_seconds'], ($thisfile_real_chunks_currentchunk['duration'] + $thisfile_real_chunks_currentchunk['start_time']) / 1000);
- }
- if ($thisfile_real_chunks_currentchunk['duration'] > 0) {
- switch ($thisfile_real_chunks_currentchunk['mime_type']) {
- case 'audio/x-pn-realaudio':
- case 'audio/x-pn-multirate-realaudio':
- $info['audio']['bitrate'] = (isset($info['audio']['bitrate']) ? $info['audio']['bitrate'] : 0) + $thisfile_real_chunks_currentchunk['avg_bit_rate'];
- $info['audio']['codec'] = $this->RealAudioCodecFourCClookup($thisfile_real_chunks_currentchunk['parsed_audio_data']['fourcc'], $info['audio']['bitrate']);
- $info['audio']['dataformat'] = 'real';
- $info['audio']['lossless'] = false;
- break;
-
- case 'video/x-pn-realvideo':
- case 'video/x-pn-multirate-realvideo':
- $info['video']['bitrate'] = (isset($info['video']['bitrate']) ? $info['video']['bitrate'] : 0) + $thisfile_real_chunks_currentchunk['avg_bit_rate'];
- $info['video']['bitrate_mode'] = 'cbr';
- $info['video']['dataformat'] = 'real';
- $info['video']['lossless'] = false;
- $info['video']['pixel_aspect_ratio'] = (float) 1;
- break;
-
- case 'audio/x-ralf-mpeg4-generic':
- $info['audio']['bitrate'] = (isset($info['audio']['bitrate']) ? $info['audio']['bitrate'] : 0) + $thisfile_real_chunks_currentchunk['avg_bit_rate'];
- $info['audio']['codec'] = 'RealAudio Lossless';
- $info['audio']['dataformat'] = 'real';
- $info['audio']['lossless'] = true;
- break;
- }
- $info['bitrate'] = (isset($info['video']['bitrate']) ? $info['video']['bitrate'] : 0) + (isset($info['audio']['bitrate']) ? $info['audio']['bitrate'] : 0);
- }
- }
- break;
-
- case 'CONT': // Content Description Header (text comments)
- $thisfile_real_chunks_currentchunk['object_version'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 2));
- $offset += 2;
- if ($thisfile_real_chunks_currentchunk['object_version'] == 0) {
- $thisfile_real_chunks_currentchunk['title_len'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 2));
- $offset += 2;
- $thisfile_real_chunks_currentchunk['title'] = (string) substr($ChunkData, $offset, $thisfile_real_chunks_currentchunk['title_len']);
- $offset += $thisfile_real_chunks_currentchunk['title_len'];
-
- $thisfile_real_chunks_currentchunk['artist_len'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 2));
- $offset += 2;
- $thisfile_real_chunks_currentchunk['artist'] = (string) substr($ChunkData, $offset, $thisfile_real_chunks_currentchunk['artist_len']);
- $offset += $thisfile_real_chunks_currentchunk['artist_len'];
-
- $thisfile_real_chunks_currentchunk['copyright_len'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 2));
- $offset += 2;
- $thisfile_real_chunks_currentchunk['copyright'] = (string) substr($ChunkData, $offset, $thisfile_real_chunks_currentchunk['copyright_len']);
- $offset += $thisfile_real_chunks_currentchunk['copyright_len'];
-
- $thisfile_real_chunks_currentchunk['comment_len'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 2));
- $offset += 2;
- $thisfile_real_chunks_currentchunk['comment'] = (string) substr($ChunkData, $offset, $thisfile_real_chunks_currentchunk['comment_len']);
- $offset += $thisfile_real_chunks_currentchunk['comment_len'];
-
-
- $commentkeystocopy = array('title'=>'title', 'artist'=>'artist', 'copyright'=>'copyright', 'comment'=>'comment');
- foreach ($commentkeystocopy as $key => $val) {
- if ($thisfile_real_chunks_currentchunk[$key]) {
- $info['real']['comments'][$val][] = trim($thisfile_real_chunks_currentchunk[$key]);
- }
- }
-
- }
- break;
-
-
- case 'DATA': // Data Chunk Header
- // do nothing
- break;
-
- case 'INDX': // Index Section Header
- $thisfile_real_chunks_currentchunk['object_version'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 2));
- $offset += 2;
- if ($thisfile_real_chunks_currentchunk['object_version'] == 0) {
- $thisfile_real_chunks_currentchunk['num_indices'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4));
- $offset += 4;
- $thisfile_real_chunks_currentchunk['stream_number'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 2));
- $offset += 2;
- $thisfile_real_chunks_currentchunk['next_index_header'] = getid3_lib::BigEndian2Int(substr($ChunkData, $offset, 4));
- $offset += 4;
-
- if ($thisfile_real_chunks_currentchunk['next_index_header'] == 0) {
- // last index chunk found, ignore rest of file
- break 2;
- } else {
- // non-last index chunk, seek to next index chunk (skipping actual index data)
- fseek($this->getid3->fp, $thisfile_real_chunks_currentchunk['next_index_header'], SEEK_SET);
- }
- }
- break;
-
- default:
- $info['warning'][] = 'Unhandled RealMedia chunk "'.$ChunkName.'" at offset '.$thisfile_real_chunks_currentchunk['offset'];
- break;
- }
- $ChunkCounter++;
- }
-
- if (!empty($info['audio']['streams'])) {
- $info['audio']['bitrate'] = 0;
- foreach ($info['audio']['streams'] as $key => $valuearray) {
- $info['audio']['bitrate'] += $valuearray['bitrate'];
- }
- }
-
- return true;
- }
-
-
- function ParseOldRAheader($OldRAheaderData, &$ParsedArray) {
- // http://www.freelists.org/archives/matroska-devel/07-2003/msg00010.html
-
- $ParsedArray = array();
- $ParsedArray['magic'] = substr($OldRAheaderData, 0, 4);
- if ($ParsedArray['magic'] != '.ra'."\xFD") {
- return false;
- }
- $ParsedArray['version1'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 4, 2));
-
- if ($ParsedArray['version1'] < 3) {
-
- return false;
-
- } elseif ($ParsedArray['version1'] == 3) {
-
- $ParsedArray['fourcc1'] = '.ra3';
- $ParsedArray['bits_per_sample'] = 16; // hard-coded for old versions?
- $ParsedArray['sample_rate'] = 8000; // hard-coded for old versions?
-
- $ParsedArray['header_size'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 6, 2));
- $ParsedArray['channels'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 8, 2)); // always 1 (?)
- //$ParsedArray['unknown1'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 10, 2));
- //$ParsedArray['unknown2'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 12, 2));
- //$ParsedArray['unknown3'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 14, 2));
- $ParsedArray['bytes_per_minute'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 16, 2));
- $ParsedArray['audio_bytes'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 18, 4));
- $ParsedArray['comments_raw'] = substr($OldRAheaderData, 22, $ParsedArray['header_size'] - 22 + 1); // not including null terminator
-
- $commentoffset = 0;
- $commentlength = getid3_lib::BigEndian2Int(substr($ParsedArray['comments_raw'], $commentoffset++, 1));
- $ParsedArray['comments']['title'][] = substr($ParsedArray['comments_raw'], $commentoffset, $commentlength);
- $commentoffset += $commentlength;
-
- $commentlength = getid3_lib::BigEndian2Int(substr($ParsedArray['comments_raw'], $commentoffset++, 1));
- $ParsedArray['comments']['artist'][] = substr($ParsedArray['comments_raw'], $commentoffset, $commentlength);
- $commentoffset += $commentlength;
-
- $commentlength = getid3_lib::BigEndian2Int(substr($ParsedArray['comments_raw'], $commentoffset++, 1));
- $ParsedArray['comments']['copyright'][] = substr($ParsedArray['comments_raw'], $commentoffset, $commentlength);
- $commentoffset += $commentlength;
-
- $commentoffset++; // final null terminator (?)
- $commentoffset++; // fourcc length (?) should be 4
- $ParsedArray['fourcc'] = substr($OldRAheaderData, 23 + $commentoffset, 4);
-
- } elseif ($ParsedArray['version1'] <= 5) {
-
- //$ParsedArray['unknown1'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 6, 2));
- $ParsedArray['fourcc1'] = substr($OldRAheaderData, 8, 4);
- $ParsedArray['file_size'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 12, 4));
- $ParsedArray['version2'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 16, 2));
- $ParsedArray['header_size'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 18, 4));
- $ParsedArray['codec_flavor_id'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 22, 2));
- $ParsedArray['coded_frame_size'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 24, 4));
- $ParsedArray['audio_bytes'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 28, 4));
- $ParsedArray['bytes_per_minute'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 32, 4));
- //$ParsedArray['unknown5'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 36, 4));
- $ParsedArray['sub_packet_h'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 40, 2));
- $ParsedArray['frame_size'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 42, 2));
- $ParsedArray['sub_packet_size'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 44, 2));
- //$ParsedArray['unknown6'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 46, 2));
-
- switch ($ParsedArray['version1']) {
-
- case 4:
- $ParsedArray['sample_rate'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 48, 2));
- //$ParsedArray['unknown8'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 50, 2));
- $ParsedArray['bits_per_sample'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 52, 2));
- $ParsedArray['channels'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 54, 2));
- $ParsedArray['length_fourcc2'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 56, 1));
- $ParsedArray['fourcc2'] = substr($OldRAheaderData, 57, 4);
- $ParsedArray['length_fourcc3'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 61, 1));
- $ParsedArray['fourcc3'] = substr($OldRAheaderData, 62, 4);
- //$ParsedArray['unknown9'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 66, 1));
- //$ParsedArray['unknown10'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 67, 2));
- $ParsedArray['comments_raw'] = substr($OldRAheaderData, 69, $ParsedArray['header_size'] - 69 + 16);
-
- $commentoffset = 0;
- $commentlength = getid3_lib::BigEndian2Int(substr($ParsedArray['comments_raw'], $commentoffset++, 1));
- $ParsedArray['comments']['title'][] = substr($ParsedArray['comments_raw'], $commentoffset, $commentlength);
- $commentoffset += $commentlength;
-
- $commentlength = getid3_lib::BigEndian2Int(substr($ParsedArray['comments_raw'], $commentoffset++, 1));
- $ParsedArray['comments']['artist'][] = substr($ParsedArray['comments_raw'], $commentoffset, $commentlength);
- $commentoffset += $commentlength;
-
- $commentlength = getid3_lib::BigEndian2Int(substr($ParsedArray['comments_raw'], $commentoffset++, 1));
- $ParsedArray['comments']['copyright'][] = substr($ParsedArray['comments_raw'], $commentoffset, $commentlength);
- $commentoffset += $commentlength;
- break;
-
- case 5:
- $ParsedArray['sample_rate'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 48, 4));
- $ParsedArray['sample_rate2'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 52, 4));
- $ParsedArray['bits_per_sample'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 56, 4));
- $ParsedArray['channels'] = getid3_lib::BigEndian2Int(substr($OldRAheaderData, 60, 2));
- $ParsedArray['genr'] = substr($OldRAheaderData, 62, 4);
- $ParsedArray['fourcc3'] = substr($OldRAheaderData, 66, 4);
- $ParsedArray['comments'] = array();
- break;
- }
- $ParsedArray['fourcc'] = $ParsedArray['fourcc3'];
-
- }
- foreach ($ParsedArray['comments'] as $key => $value) {
- if ($ParsedArray['comments'][$key][0] === false) {
- $ParsedArray['comments'][$key][0] = '';
- }
- }
-
- return true;
- }
-
- function RealAudioCodecFourCClookup($fourcc, $bitrate) {
- static $RealAudioCodecFourCClookup = array();
- if (empty($RealAudioCodecFourCClookup)) {
- // http://www.its.msstate.edu/net/real/reports/config/tags.stats
- // http://www.freelists.org/archives/matroska-devel/06-2003/fullthread18.html
-
- $RealAudioCodecFourCClookup['14_4'][8000] = 'RealAudio v2 (14.4kbps)';
- $RealAudioCodecFourCClookup['14.4'][8000] = 'RealAudio v2 (14.4kbps)';
- $RealAudioCodecFourCClookup['lpcJ'][8000] = 'RealAudio v2 (14.4kbps)';
- $RealAudioCodecFourCClookup['28_8'][15200] = 'RealAudio v2 (28.8kbps)';
- $RealAudioCodecFourCClookup['28.8'][15200] = 'RealAudio v2 (28.8kbps)';
- $RealAudioCodecFourCClookup['sipr'][4933] = 'RealAudio v4 (5kbps Voice)';
- $RealAudioCodecFourCClookup['sipr'][6444] = 'RealAudio v4 (6.5kbps Voice)';
- $RealAudioCodecFourCClookup['sipr'][8444] = 'RealAudio v4 (8.5kbps Voice)';
- $RealAudioCodecFourCClookup['sipr'][16000] = 'RealAudio v4 (16kbps Wideband)';
- $RealAudioCodecFourCClookup['dnet'][8000] = 'RealAudio v3 (8kbps Music)';
- $RealAudioCodecFourCClookup['dnet'][16000] = 'RealAudio v3 (16kbps Music Low Response)';
- $RealAudioCodecFourCClookup['dnet'][15963] = 'RealAudio v3 (16kbps Music Mid/High Response)';
- $RealAudioCodecFourCClookup['dnet'][20000] = 'RealAudio v3 (20kbps Music Stereo)';
- $RealAudioCodecFourCClookup['dnet'][32000] = 'RealAudio v3 (32kbps Music Mono)';
- $RealAudioCodecFourCClookup['dnet'][31951] = 'RealAudio v3 (32kbps Music Stereo)';
- $RealAudioCodecFourCClookup['dnet'][39965] = 'RealAudio v3 (40kbps Music Mono)';
- $RealAudioCodecFourCClookup['dnet'][40000] = 'RealAudio v3 (40kbps Music Stereo)';
- $RealAudioCodecFourCClookup['dnet'][79947] = 'RealAudio v3 (80kbps Music Mono)';
- $RealAudioCodecFourCClookup['dnet'][80000] = 'RealAudio v3 (80kbps Music Stereo)';
-
- $RealAudioCodecFourCClookup['dnet'][0] = 'RealAudio v3';
- $RealAudioCodecFourCClookup['sipr'][0] = 'RealAudio v4';
- $RealAudioCodecFourCClookup['cook'][0] = 'RealAudio G2';
- $RealAudioCodecFourCClookup['atrc'][0] = 'RealAudio 8';
- }
- $roundbitrate = intval(round($bitrate));
- if (isset($RealAudioCodecFourCClookup[$fourcc][$roundbitrate])) {
- return $RealAudioCodecFourCClookup[$fourcc][$roundbitrate];
- } elseif (isset($RealAudioCodecFourCClookup[$fourcc][0])) {
- return $RealAudioCodecFourCClookup[$fourcc][0];
- }
- return $fourcc;
- }
-
-}
-
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.audio-video.riff.php b/3rdparty/getid3/module.audio-video.riff.php
deleted file mode 100644
index 8e8f53a403f..00000000000
--- a/3rdparty/getid3/module.audio-video.riff.php
+++ /dev/null
@@ -1,2409 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.audio-video.riff.php //
-// module for analyzing RIFF files //
-// multiple formats supported by this module: //
-// Wave, AVI, AIFF/AIFC, (MP3,AC3)/RIFF, Wavpack v3, 8SVX //
-// dependencies: module.audio.mp3.php //
-// module.audio.ac3.php (optional) //
-// module.audio.dts.php (optional) //
-// ///
-/////////////////////////////////////////////////////////////////
-
-getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.mp3.php', __FILE__, true);
-
-class getid3_riff extends getid3_handler
-{
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- // initialize these values to an empty array, otherwise they default to NULL
- // and you can't append array values to a NULL value
- $info['riff'] = array('raw'=>array());
-
- // Shortcuts
- $thisfile_riff = &$info['riff'];
- $thisfile_riff_raw = &$thisfile_riff['raw'];
- $thisfile_audio = &$info['audio'];
- $thisfile_video = &$info['video'];
- $thisfile_audio_dataformat = &$thisfile_audio['dataformat'];
- $thisfile_riff_audio = &$thisfile_riff['audio'];
- $thisfile_riff_video = &$thisfile_riff['video'];
-
-
- $Original['avdataoffset'] = $info['avdataoffset'];
- $Original['avdataend'] = $info['avdataend'];
-
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
- $RIFFheader = fread($this->getid3->fp, 12);
- $RIFFsubtype = substr($RIFFheader, 8, 4);
- switch (substr($RIFFheader, 0, 4)) {
- case 'FORM':
- $info['fileformat'] = 'aiff';
- $thisfile_riff['header_size'] = $this->EitherEndian2Int(substr($RIFFheader, 4, 4));
- $thisfile_riff[$RIFFsubtype] = $this->ParseRIFF($info['avdataoffset'] + 12, $info['avdataoffset'] + $thisfile_riff['header_size']);
- break;
-
- case 'RIFF': // AVI, WAV, etc
- case 'SDSS': // SDSS is identical to RIFF, just renamed. Used by SmartSound QuickTracks (www.smartsound.com)
- case 'RMP3': // RMP3 is identical to RIFF, just renamed. Used by [unknown program] when creating RIFF-MP3s
- $info['fileformat'] = 'riff';
- $thisfile_riff['header_size'] = $this->EitherEndian2Int(substr($RIFFheader, 4, 4));
- if ($RIFFsubtype == 'RMP3') {
- // RMP3 is identical to WAVE, just renamed. Used by [unknown program] when creating RIFF-MP3s
- $RIFFsubtype = 'WAVE';
- }
- $thisfile_riff[$RIFFsubtype] = $this->ParseRIFF($info['avdataoffset'] + 12, $info['avdataoffset'] + $thisfile_riff['header_size']);
- if (($info['avdataend'] - $info['filesize']) == 1) {
- // LiteWave appears to incorrectly *not* pad actual output file
- // to nearest WORD boundary so may appear to be short by one
- // byte, in which case - skip warning
- $info['avdataend'] = $info['filesize'];
- }
-
- $nextRIFFoffset = $Original['avdataoffset'] + 8 + $thisfile_riff['header_size']; // 8 = "RIFF" + 32-bit offset
- while ($nextRIFFoffset < min($info['filesize'], $info['avdataend'])) {
- if (!getid3_lib::intValueSupported($nextRIFFoffset + 1024)) {
- $info['error'][] = 'AVI extends beyond '.round(PHP_INT_MAX / 1073741824).'GB and PHP filesystem functions cannot read that far, playtime is probably wrong';
- $info['warning'][] = '[avdataend] value may be incorrect, multiple AVIX chunks may be present';
- break;
- } else {
- fseek($this->getid3->fp, $nextRIFFoffset, SEEK_SET);
- $nextRIFFheader = fread($this->getid3->fp, 12);
- if ($nextRIFFoffset == ($info['avdataend'] - 1)) {
- if (substr($nextRIFFheader, 0, 1) == "\x00") {
- // RIFF padded to WORD boundary, we're actually already at the end
- break;
- }
- }
- $nextRIFFheaderID = substr($nextRIFFheader, 0, 4);
- $nextRIFFsize = $this->EitherEndian2Int(substr($nextRIFFheader, 4, 4));
- $nextRIFFtype = substr($nextRIFFheader, 8, 4);
- $chunkdata = array();
- $chunkdata['offset'] = $nextRIFFoffset + 8;
- $chunkdata['size'] = $nextRIFFsize;
- $nextRIFFoffset = $chunkdata['offset'] + $chunkdata['size'];
- switch ($nextRIFFheaderID) {
- case 'RIFF':
- $info['avdataend'] = $nextRIFFoffset;
- if (!getid3_lib::intValueSupported($info['avdataend'])) {
- $info['error'][] = 'AVI extends beyond '.round(PHP_INT_MAX / 1073741824).'GB and PHP filesystem functions cannot read that far, playtime is probably wrong';
- $info['warning'][] = '[avdataend] value may be incorrect, multiple AVIX chunks may be present';
- }
- $chunkdata['chunks'] = $this->ParseRIFF($chunkdata['offset'] + 4, $chunkdata['offset'] + $chunkdata['size']);
-
- if (!isset($thisfile_riff[$nextRIFFtype])) {
- $thisfile_riff[$nextRIFFtype] = array();
- }
- $thisfile_riff[$nextRIFFtype][] = $chunkdata;
- break;
- case 'JUNK':
- // ignore
- $thisfile_riff[$nextRIFFheaderID][] = $chunkdata;
- break;
- default:
- if ($info['filesize'] == ($chunkdata['offset'] - 8 + 128)) {
- $DIVXTAG = $nextRIFFheader.fread($this->getid3->fp, 128 - 12);
- if (substr($DIVXTAG, -7) == 'DIVXTAG') {
- // DIVXTAG is supposed to be inside an IDVX chunk in a LIST chunk, but some bad encoders just slap it on the end of a file
- $info['warning'][] = 'Found wrongly-structured DIVXTAG at offset '.(ftell($this->getid3->fp) - 128 + 12).', parsing anyway';
- $thisfile_riff['DIVXTAG'] = $this->ParseDIVXTAG($DIVXTAG);
- foreach ($thisfile_riff['DIVXTAG'] as $key => $value) {
- if ($value && !preg_match('#_id$#', $key)) {
- $thisfile_riff['comments'][$key][] = $value;
- }
- }
- break 2;
- }
- }
- $info['warning'][] = 'expecting "RIFF" or "JUNK" at '.$nextRIFFoffset.', found '.getid3_lib::PrintHexBytes(substr($nextRIFFheader, 0, 4)).' - skipping rest of file';
- break 2;
- }
- }
- }
- if ($RIFFsubtype == 'WAVE') {
- $thisfile_riff_WAVE = &$thisfile_riff['WAVE'];
- }
- break;
-
- default:
- $info['error'][] = 'Cannot parse RIFF (this is maybe not a RIFF / WAV / AVI file?) - expecting "FORM|RIFF|SDSS|RMP3" found "'.$RIFFsubtype.'" instead';
- unset($info['fileformat']);
- return false;
- break;
- }
-
- $streamindex = 0;
- switch ($RIFFsubtype) {
- case 'WAVE':
- if (empty($thisfile_audio['bitrate_mode'])) {
- $thisfile_audio['bitrate_mode'] = 'cbr';
- }
- if (empty($thisfile_audio_dataformat)) {
- $thisfile_audio_dataformat = 'wav';
- }
-
- if (isset($thisfile_riff_WAVE['data'][0]['offset'])) {
- $info['avdataoffset'] = $thisfile_riff_WAVE['data'][0]['offset'] + 8;
- $info['avdataend'] = $info['avdataoffset'] + $thisfile_riff_WAVE['data'][0]['size'];
- }
- if (isset($thisfile_riff_WAVE['fmt '][0]['data'])) {
-
- $thisfile_riff_audio[$streamindex] = getid3_riff::RIFFparseWAVEFORMATex($thisfile_riff_WAVE['fmt '][0]['data']);
- $thisfile_audio['wformattag'] = $thisfile_riff_audio[$streamindex]['raw']['wFormatTag'];
- if (!isset($thisfile_riff_audio[$streamindex]['bitrate']) || ($thisfile_riff_audio[$streamindex]['bitrate'] == 0)) {
- $info['error'][] = 'Corrupt RIFF file: bitrate_audio == zero';
- return false;
- }
- $thisfile_riff_raw['fmt '] = $thisfile_riff_audio[$streamindex]['raw'];
- unset($thisfile_riff_audio[$streamindex]['raw']);
- $thisfile_audio['streams'][$streamindex] = $thisfile_riff_audio[$streamindex];
-
- $thisfile_audio = getid3_lib::array_merge_noclobber($thisfile_audio, $thisfile_riff_audio[$streamindex]);
- if (substr($thisfile_audio['codec'], 0, strlen('unknown: 0x')) == 'unknown: 0x') {
- $info['warning'][] = 'Audio codec = '.$thisfile_audio['codec'];
- }
- $thisfile_audio['bitrate'] = $thisfile_riff_audio[$streamindex]['bitrate'];
-
- $info['playtime_seconds'] = (float) ((($info['avdataend'] - $info['avdataoffset']) * 8) / $thisfile_audio['bitrate']);
-
- $thisfile_audio['lossless'] = false;
- if (isset($thisfile_riff_WAVE['data'][0]['offset']) && isset($thisfile_riff_raw['fmt ']['wFormatTag'])) {
- switch ($thisfile_riff_raw['fmt ']['wFormatTag']) {
-
- case 0x0001: // PCM
- $thisfile_audio['lossless'] = true;
- break;
-
- case 0x2000: // AC-3
- $thisfile_audio_dataformat = 'ac3';
- break;
-
- default:
- // do nothing
- break;
-
- }
- }
- $thisfile_audio['streams'][$streamindex]['wformattag'] = $thisfile_audio['wformattag'];
- $thisfile_audio['streams'][$streamindex]['bitrate_mode'] = $thisfile_audio['bitrate_mode'];
- $thisfile_audio['streams'][$streamindex]['lossless'] = $thisfile_audio['lossless'];
- $thisfile_audio['streams'][$streamindex]['dataformat'] = $thisfile_audio_dataformat;
- }
-
- if (isset($thisfile_riff_WAVE['rgad'][0]['data'])) {
-
- // shortcuts
- $rgadData = &$thisfile_riff_WAVE['rgad'][0]['data'];
- $thisfile_riff_raw['rgad'] = array('track'=>array(), 'album'=>array());
- $thisfile_riff_raw_rgad = &$thisfile_riff_raw['rgad'];
- $thisfile_riff_raw_rgad_track = &$thisfile_riff_raw_rgad['track'];
- $thisfile_riff_raw_rgad_album = &$thisfile_riff_raw_rgad['album'];
-
- $thisfile_riff_raw_rgad['fPeakAmplitude'] = getid3_lib::LittleEndian2Float(substr($rgadData, 0, 4));
- $thisfile_riff_raw_rgad['nRadioRgAdjust'] = $this->EitherEndian2Int(substr($rgadData, 4, 2));
- $thisfile_riff_raw_rgad['nAudiophileRgAdjust'] = $this->EitherEndian2Int(substr($rgadData, 6, 2));
-
- $nRadioRgAdjustBitstring = str_pad(getid3_lib::Dec2Bin($thisfile_riff_raw_rgad['nRadioRgAdjust']), 16, '0', STR_PAD_LEFT);
- $nAudiophileRgAdjustBitstring = str_pad(getid3_lib::Dec2Bin($thisfile_riff_raw_rgad['nAudiophileRgAdjust']), 16, '0', STR_PAD_LEFT);
- $thisfile_riff_raw_rgad_track['name'] = getid3_lib::Bin2Dec(substr($nRadioRgAdjustBitstring, 0, 3));
- $thisfile_riff_raw_rgad_track['originator'] = getid3_lib::Bin2Dec(substr($nRadioRgAdjustBitstring, 3, 3));
- $thisfile_riff_raw_rgad_track['signbit'] = getid3_lib::Bin2Dec(substr($nRadioRgAdjustBitstring, 6, 1));
- $thisfile_riff_raw_rgad_track['adjustment'] = getid3_lib::Bin2Dec(substr($nRadioRgAdjustBitstring, 7, 9));
- $thisfile_riff_raw_rgad_album['name'] = getid3_lib::Bin2Dec(substr($nAudiophileRgAdjustBitstring, 0, 3));
- $thisfile_riff_raw_rgad_album['originator'] = getid3_lib::Bin2Dec(substr($nAudiophileRgAdjustBitstring, 3, 3));
- $thisfile_riff_raw_rgad_album['signbit'] = getid3_lib::Bin2Dec(substr($nAudiophileRgAdjustBitstring, 6, 1));
- $thisfile_riff_raw_rgad_album['adjustment'] = getid3_lib::Bin2Dec(substr($nAudiophileRgAdjustBitstring, 7, 9));
-
- $thisfile_riff['rgad']['peakamplitude'] = $thisfile_riff_raw_rgad['fPeakAmplitude'];
- if (($thisfile_riff_raw_rgad_track['name'] != 0) && ($thisfile_riff_raw_rgad_track['originator'] != 0)) {
- $thisfile_riff['rgad']['track']['name'] = getid3_lib::RGADnameLookup($thisfile_riff_raw_rgad_track['name']);
- $thisfile_riff['rgad']['track']['originator'] = getid3_lib::RGADoriginatorLookup($thisfile_riff_raw_rgad_track['originator']);
- $thisfile_riff['rgad']['track']['adjustment'] = getid3_lib::RGADadjustmentLookup($thisfile_riff_raw_rgad_track['adjustment'], $thisfile_riff_raw_rgad_track['signbit']);
- }
- if (($thisfile_riff_raw_rgad_album['name'] != 0) && ($thisfile_riff_raw_rgad_album['originator'] != 0)) {
- $thisfile_riff['rgad']['album']['name'] = getid3_lib::RGADnameLookup($thisfile_riff_raw_rgad_album['name']);
- $thisfile_riff['rgad']['album']['originator'] = getid3_lib::RGADoriginatorLookup($thisfile_riff_raw_rgad_album['originator']);
- $thisfile_riff['rgad']['album']['adjustment'] = getid3_lib::RGADadjustmentLookup($thisfile_riff_raw_rgad_album['adjustment'], $thisfile_riff_raw_rgad_album['signbit']);
- }
- }
-
- if (isset($thisfile_riff_WAVE['fact'][0]['data'])) {
- $thisfile_riff_raw['fact']['NumberOfSamples'] = $this->EitherEndian2Int(substr($thisfile_riff_WAVE['fact'][0]['data'], 0, 4));
-
- // This should be a good way of calculating exact playtime,
- // but some sample files have had incorrect number of samples,
- // so cannot use this method
-
- // if (!empty($thisfile_riff_raw['fmt ']['nSamplesPerSec'])) {
- // $info['playtime_seconds'] = (float) $thisfile_riff_raw['fact']['NumberOfSamples'] / $thisfile_riff_raw['fmt ']['nSamplesPerSec'];
- // }
- }
- if (!empty($thisfile_riff_raw['fmt ']['nAvgBytesPerSec'])) {
- $thisfile_audio['bitrate'] = getid3_lib::CastAsInt($thisfile_riff_raw['fmt ']['nAvgBytesPerSec'] * 8);
- }
-
- if (isset($thisfile_riff_WAVE['bext'][0]['data'])) {
- // shortcut
- $thisfile_riff_WAVE_bext_0 = &$thisfile_riff_WAVE['bext'][0];
-
- $thisfile_riff_WAVE_bext_0['title'] = trim(substr($thisfile_riff_WAVE_bext_0['data'], 0, 256));
- $thisfile_riff_WAVE_bext_0['author'] = trim(substr($thisfile_riff_WAVE_bext_0['data'], 256, 32));
- $thisfile_riff_WAVE_bext_0['reference'] = trim(substr($thisfile_riff_WAVE_bext_0['data'], 288, 32));
- $thisfile_riff_WAVE_bext_0['origin_date'] = substr($thisfile_riff_WAVE_bext_0['data'], 320, 10);
- $thisfile_riff_WAVE_bext_0['origin_time'] = substr($thisfile_riff_WAVE_bext_0['data'], 330, 8);
- $thisfile_riff_WAVE_bext_0['time_reference'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_bext_0['data'], 338, 8));
- $thisfile_riff_WAVE_bext_0['bwf_version'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_bext_0['data'], 346, 1));
- $thisfile_riff_WAVE_bext_0['reserved'] = substr($thisfile_riff_WAVE_bext_0['data'], 347, 254);
- $thisfile_riff_WAVE_bext_0['coding_history'] = explode("\r\n", trim(substr($thisfile_riff_WAVE_bext_0['data'], 601)));
- if (preg_match('#^([0-9]{4}).([0-9]{2}).([0-9]{2})$#', $thisfile_riff_WAVE_bext_0['origin_date'], $matches_bext_date)) {
- if (preg_match('#^([0-9]{2}).([0-9]{2}).([0-9]{2})$#', $thisfile_riff_WAVE_bext_0['origin_time'], $matches_bext_time)) {
- list($dummy, $bext_timestamp['year'], $bext_timestamp['month'], $bext_timestamp['day']) = $matches_bext_date;
- list($dummy, $bext_timestamp['hour'], $bext_timestamp['minute'], $bext_timestamp['second']) = $matches_bext_time;
- $thisfile_riff_WAVE_bext_0['origin_date_unix'] = gmmktime($bext_timestamp['hour'], $bext_timestamp['minute'], $bext_timestamp['second'], $bext_timestamp['month'], $bext_timestamp['day'], $bext_timestamp['year']);
- } else {
- $info['warning'][] = 'RIFF.WAVE.BEXT.origin_time is invalid';
- }
- } else {
- $info['warning'][] = 'RIFF.WAVE.BEXT.origin_date is invalid';
- }
- $thisfile_riff['comments']['author'][] = $thisfile_riff_WAVE_bext_0['author'];
- $thisfile_riff['comments']['title'][] = $thisfile_riff_WAVE_bext_0['title'];
- }
-
- if (isset($thisfile_riff_WAVE['MEXT'][0]['data'])) {
- // shortcut
- $thisfile_riff_WAVE_MEXT_0 = &$thisfile_riff_WAVE['MEXT'][0];
-
- $thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_MEXT_0['data'], 0, 2));
- $thisfile_riff_WAVE_MEXT_0['flags']['homogenous'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0001);
- if ($thisfile_riff_WAVE_MEXT_0['flags']['homogenous']) {
- $thisfile_riff_WAVE_MEXT_0['flags']['padding'] = ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0002) ? false : true;
- $thisfile_riff_WAVE_MEXT_0['flags']['22_or_44'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0004);
- $thisfile_riff_WAVE_MEXT_0['flags']['free_format'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0008);
-
- $thisfile_riff_WAVE_MEXT_0['nominal_frame_size'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_MEXT_0['data'], 2, 2));
- }
- $thisfile_riff_WAVE_MEXT_0['anciliary_data_length'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_MEXT_0['data'], 6, 2));
- $thisfile_riff_WAVE_MEXT_0['raw']['anciliary_data_def'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_MEXT_0['data'], 8, 2));
- $thisfile_riff_WAVE_MEXT_0['flags']['anciliary_data_left'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['anciliary_data_def'] & 0x0001);
- $thisfile_riff_WAVE_MEXT_0['flags']['anciliary_data_free'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['anciliary_data_def'] & 0x0002);
- $thisfile_riff_WAVE_MEXT_0['flags']['anciliary_data_right'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['anciliary_data_def'] & 0x0004);
- }
-
- if (isset($thisfile_riff_WAVE['cart'][0]['data'])) {
- // shortcut
- $thisfile_riff_WAVE_cart_0 = &$thisfile_riff_WAVE['cart'][0];
-
- $thisfile_riff_WAVE_cart_0['version'] = substr($thisfile_riff_WAVE_cart_0['data'], 0, 4);
- $thisfile_riff_WAVE_cart_0['title'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 4, 64));
- $thisfile_riff_WAVE_cart_0['artist'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 68, 64));
- $thisfile_riff_WAVE_cart_0['cut_id'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 132, 64));
- $thisfile_riff_WAVE_cart_0['client_id'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 196, 64));
- $thisfile_riff_WAVE_cart_0['category'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 260, 64));
- $thisfile_riff_WAVE_cart_0['classification'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 324, 64));
- $thisfile_riff_WAVE_cart_0['out_cue'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 388, 64));
- $thisfile_riff_WAVE_cart_0['start_date'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 452, 10));
- $thisfile_riff_WAVE_cart_0['start_time'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 462, 8));
- $thisfile_riff_WAVE_cart_0['end_date'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 470, 10));
- $thisfile_riff_WAVE_cart_0['end_time'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 480, 8));
- $thisfile_riff_WAVE_cart_0['producer_app_id'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 488, 64));
- $thisfile_riff_WAVE_cart_0['producer_app_version'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 552, 64));
- $thisfile_riff_WAVE_cart_0['user_defined_text'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 616, 64));
- $thisfile_riff_WAVE_cart_0['zero_db_reference'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_cart_0['data'], 680, 4), true);
- for ($i = 0; $i < 8; $i++) {
- $thisfile_riff_WAVE_cart_0['post_time'][$i]['usage_fourcc'] = substr($thisfile_riff_WAVE_cart_0['data'], 684 + ($i * 8), 4);
- $thisfile_riff_WAVE_cart_0['post_time'][$i]['timer_value'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_cart_0['data'], 684 + ($i * 8) + 4, 4));
- }
- $thisfile_riff_WAVE_cart_0['url'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 748, 1024));
- $thisfile_riff_WAVE_cart_0['tag_text'] = explode("\r\n", trim(substr($thisfile_riff_WAVE_cart_0['data'], 1772)));
-
- $thisfile_riff['comments']['artist'][] = $thisfile_riff_WAVE_cart_0['artist'];
- $thisfile_riff['comments']['title'][] = $thisfile_riff_WAVE_cart_0['title'];
- }
-
- if (isset($thisfile_riff_WAVE['SNDM'][0]['data'])) {
- // SoundMiner metadata
-
- // shortcuts
- $thisfile_riff_WAVE_SNDM_0 = &$thisfile_riff_WAVE['SNDM'][0];
- $thisfile_riff_WAVE_SNDM_0_data = &$thisfile_riff_WAVE_SNDM_0['data'];
- $SNDM_startoffset = 0;
- $SNDM_endoffset = $thisfile_riff_WAVE_SNDM_0['size'];
-
- while ($SNDM_startoffset < $SNDM_endoffset) {
- $SNDM_thisTagOffset = 0;
- $SNDM_thisTagSize = getid3_lib::BigEndian2Int(substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, 4));
- $SNDM_thisTagOffset += 4;
- $SNDM_thisTagKey = substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, 4);
- $SNDM_thisTagOffset += 4;
- $SNDM_thisTagDataSize = getid3_lib::BigEndian2Int(substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, 2));
- $SNDM_thisTagOffset += 2;
- $SNDM_thisTagDataFlags = getid3_lib::BigEndian2Int(substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, 2));
- $SNDM_thisTagOffset += 2;
- $SNDM_thisTagDataText = substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, $SNDM_thisTagDataSize);
- $SNDM_thisTagOffset += $SNDM_thisTagDataSize;
-
- if ($SNDM_thisTagSize != (4 + 4 + 2 + 2 + $SNDM_thisTagDataSize)) {
- $info['warning'][] = 'RIFF.WAVE.SNDM.data contains tag not expected length (expected: '.$SNDM_thisTagSize.', found: '.(4 + 4 + 2 + 2 + $SNDM_thisTagDataSize).') at offset '.$SNDM_startoffset.' (file offset '.($thisfile_riff_WAVE_SNDM_0['offset'] + $SNDM_startoffset).')';
- break;
- } elseif ($SNDM_thisTagSize <= 0) {
- $info['warning'][] = 'RIFF.WAVE.SNDM.data contains zero-size tag at offset '.$SNDM_startoffset.' (file offset '.($thisfile_riff_WAVE_SNDM_0['offset'] + $SNDM_startoffset).')';
- break;
- }
- $SNDM_startoffset += $SNDM_thisTagSize;
-
- $thisfile_riff_WAVE_SNDM_0['parsed_raw'][$SNDM_thisTagKey] = $SNDM_thisTagDataText;
- if ($parsedkey = $this->RIFFwaveSNDMtagLookup($SNDM_thisTagKey)) {
- $thisfile_riff_WAVE_SNDM_0['parsed'][$parsedkey] = $SNDM_thisTagDataText;
- } else {
- $info['warning'][] = 'RIFF.WAVE.SNDM contains unknown tag "'.$SNDM_thisTagKey.'" at offset '.$SNDM_startoffset.' (file offset '.($thisfile_riff_WAVE_SNDM_0['offset'] + $SNDM_startoffset).')';
- }
- }
-
- $tagmapping = array(
- 'tracktitle'=>'title',
- 'category' =>'genre',
- 'cdtitle' =>'album',
- 'tracktitle'=>'title',
- );
- foreach ($tagmapping as $fromkey => $tokey) {
- if (isset($thisfile_riff_WAVE_SNDM_0['parsed'][$fromkey])) {
- $thisfile_riff['comments'][$tokey][] = $thisfile_riff_WAVE_SNDM_0['parsed'][$fromkey];
- }
- }
- }
-
- if (isset($thisfile_riff_WAVE['iXML'][0]['data'])) {
- // requires functions simplexml_load_string and get_object_vars
- if ($parsedXML = getid3_lib::XML2array($thisfile_riff_WAVE['iXML'][0]['data'])) {
- $thisfile_riff_WAVE['iXML'][0]['parsed'] = $parsedXML;
- if (isset($parsedXML['SPEED']['MASTER_SPEED'])) {
- @list($numerator, $denominator) = explode('/', $parsedXML['SPEED']['MASTER_SPEED']);
- $thisfile_riff_WAVE['iXML'][0]['master_speed'] = $numerator / ($denominator ? $denominator : 1000);
- }
- if (isset($parsedXML['SPEED']['TIMECODE_RATE'])) {
- @list($numerator, $denominator) = explode('/', $parsedXML['SPEED']['TIMECODE_RATE']);
- $thisfile_riff_WAVE['iXML'][0]['timecode_rate'] = $numerator / ($denominator ? $denominator : 1000);
- }
- if (isset($parsedXML['SPEED']['TIMESTAMP_SAMPLES_SINCE_MIDNIGHT_LO']) && !empty($parsedXML['SPEED']['TIMESTAMP_SAMPLE_RATE']) && !empty($thisfile_riff_WAVE['iXML'][0]['timecode_rate'])) {
- $samples_since_midnight = floatval(ltrim($parsedXML['SPEED']['TIMESTAMP_SAMPLES_SINCE_MIDNIGHT_HI'].$parsedXML['SPEED']['TIMESTAMP_SAMPLES_SINCE_MIDNIGHT_LO'], '0'));
- $thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] = $samples_since_midnight / $parsedXML['SPEED']['TIMESTAMP_SAMPLE_RATE'];
- $h = floor( $thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] / 3600);
- $m = floor(($thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] - ($h * 3600)) / 60);
- $s = floor( $thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] - ($h * 3600) - ($m * 60));
- $f = ($thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] - ($h * 3600) - ($m * 60) - $s) * $thisfile_riff_WAVE['iXML'][0]['timecode_rate'];
- $thisfile_riff_WAVE['iXML'][0]['timecode_string'] = sprintf('%02d:%02d:%02d:%05.2f', $h, $m, $s, $f);
- $thisfile_riff_WAVE['iXML'][0]['timecode_string_round'] = sprintf('%02d:%02d:%02d:%02d', $h, $m, $s, round($f));
- }
- unset($parsedXML);
- }
- }
-
-
-
- if (!isset($thisfile_audio['bitrate']) && isset($thisfile_riff_audio[$streamindex]['bitrate'])) {
- $thisfile_audio['bitrate'] = $thisfile_riff_audio[$streamindex]['bitrate'];
- $info['playtime_seconds'] = (float) ((($info['avdataend'] - $info['avdataoffset']) * 8) / $thisfile_audio['bitrate']);
- }
-
- if (!empty($info['wavpack'])) {
- $thisfile_audio_dataformat = 'wavpack';
- $thisfile_audio['bitrate_mode'] = 'vbr';
- $thisfile_audio['encoder'] = 'WavPack v'.$info['wavpack']['version'];
-
- // Reset to the way it was - RIFF parsing will have messed this up
- $info['avdataend'] = $Original['avdataend'];
- $thisfile_audio['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds'];
-
- fseek($this->getid3->fp, $info['avdataoffset'] - 44, SEEK_SET);
- $RIFFdata = fread($this->getid3->fp, 44);
- $OrignalRIFFheaderSize = getid3_lib::LittleEndian2Int(substr($RIFFdata, 4, 4)) + 8;
- $OrignalRIFFdataSize = getid3_lib::LittleEndian2Int(substr($RIFFdata, 40, 4)) + 44;
-
- if ($OrignalRIFFheaderSize > $OrignalRIFFdataSize) {
- $info['avdataend'] -= ($OrignalRIFFheaderSize - $OrignalRIFFdataSize);
- fseek($this->getid3->fp, $info['avdataend'], SEEK_SET);
- $RIFFdata .= fread($this->getid3->fp, $OrignalRIFFheaderSize - $OrignalRIFFdataSize);
- }
-
- // move the data chunk after all other chunks (if any)
- // so that the RIFF parser doesn't see EOF when trying
- // to skip over the data chunk
- $RIFFdata = substr($RIFFdata, 0, 36).substr($RIFFdata, 44).substr($RIFFdata, 36, 8);
- $getid3_riff = new getid3_riff($this->getid3);
- $getid3_riff->ParseRIFFdata($RIFFdata);
- unset($getid3_riff);
- }
-
- if (isset($thisfile_riff_raw['fmt ']['wFormatTag'])) {
- switch ($thisfile_riff_raw['fmt ']['wFormatTag']) {
- case 0x0001: // PCM
- if (!empty($info['ac3'])) {
- // Dolby Digital WAV files masquerade as PCM-WAV, but they're not
- $thisfile_audio['wformattag'] = 0x2000;
- $thisfile_audio['codec'] = $this->RIFFwFormatTagLookup($thisfile_audio['wformattag']);
- $thisfile_audio['lossless'] = false;
- $thisfile_audio['bitrate'] = $info['ac3']['bitrate'];
- $thisfile_audio['sample_rate'] = $info['ac3']['sample_rate'];
- }
- break;
- case 0x08AE: // ClearJump LiteWave
- $thisfile_audio['bitrate_mode'] = 'vbr';
- $thisfile_audio_dataformat = 'litewave';
-
- //typedef struct tagSLwFormat {
- // WORD m_wCompFormat; // low byte defines compression method, high byte is compression flags
- // DWORD m_dwScale; // scale factor for lossy compression
- // DWORD m_dwBlockSize; // number of samples in encoded blocks
- // WORD m_wQuality; // alias for the scale factor
- // WORD m_wMarkDistance; // distance between marks in bytes
- // WORD m_wReserved;
- //
- // //following paramters are ignored if CF_FILESRC is not set
- // DWORD m_dwOrgSize; // original file size in bytes
- // WORD m_bFactExists; // indicates if 'fact' chunk exists in the original file
- // DWORD m_dwRiffChunkSize; // riff chunk size in the original file
- //
- // PCMWAVEFORMAT m_OrgWf; // original wave format
- // }SLwFormat, *PSLwFormat;
-
- // shortcut
- $thisfile_riff['litewave']['raw'] = array();
- $thisfile_riff_litewave = &$thisfile_riff['litewave'];
- $thisfile_riff_litewave_raw = &$thisfile_riff_litewave['raw'];
-
- $thisfile_riff_litewave_raw['compression_method'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], 18, 1));
- $thisfile_riff_litewave_raw['compression_flags'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], 19, 1));
- $thisfile_riff_litewave_raw['m_dwScale'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], 20, 4));
- $thisfile_riff_litewave_raw['m_dwBlockSize'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], 24, 4));
- $thisfile_riff_litewave_raw['m_wQuality'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], 28, 2));
- $thisfile_riff_litewave_raw['m_wMarkDistance'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], 30, 2));
- $thisfile_riff_litewave_raw['m_wReserved'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], 32, 2));
- $thisfile_riff_litewave_raw['m_dwOrgSize'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], 34, 4));
- $thisfile_riff_litewave_raw['m_bFactExists'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], 38, 2));
- $thisfile_riff_litewave_raw['m_dwRiffChunkSize'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], 40, 4));
-
- //$thisfile_riff_litewave['quality_factor'] = intval(round((2000 - $thisfile_riff_litewave_raw['m_dwScale']) / 20));
- $thisfile_riff_litewave['quality_factor'] = $thisfile_riff_litewave_raw['m_wQuality'];
-
- $thisfile_riff_litewave['flags']['raw_source'] = ($thisfile_riff_litewave_raw['compression_flags'] & 0x01) ? false : true;
- $thisfile_riff_litewave['flags']['vbr_blocksize'] = ($thisfile_riff_litewave_raw['compression_flags'] & 0x02) ? false : true;
- $thisfile_riff_litewave['flags']['seekpoints'] = (bool) ($thisfile_riff_litewave_raw['compression_flags'] & 0x04);
-
- $thisfile_audio['lossless'] = (($thisfile_riff_litewave_raw['m_wQuality'] == 100) ? true : false);
- $thisfile_audio['encoder_options'] = '-q'.$thisfile_riff_litewave['quality_factor'];
- break;
-
- default:
- break;
- }
- }
- if ($info['avdataend'] > $info['filesize']) {
- switch (!empty($thisfile_audio_dataformat) ? $thisfile_audio_dataformat : '') {
- case 'wavpack': // WavPack
- case 'lpac': // LPAC
- case 'ofr': // OptimFROG
- case 'ofs': // OptimFROG DualStream
- // lossless compressed audio formats that keep original RIFF headers - skip warning
- break;
-
- case 'litewave':
- if (($info['avdataend'] - $info['filesize']) == 1) {
- // LiteWave appears to incorrectly *not* pad actual output file
- // to nearest WORD boundary so may appear to be short by one
- // byte, in which case - skip warning
- } else {
- // Short by more than one byte, throw warning
- $info['warning'][] = 'Probably truncated file - expecting '.$thisfile_riff[$RIFFsubtype]['data'][0]['size'].' bytes of data, only found '.($info['filesize'] - $info['avdataoffset']).' (short by '.($thisfile_riff[$RIFFsubtype]['data'][0]['size'] - ($info['filesize'] - $info['avdataoffset'])).' bytes)';
- $info['avdataend'] = $info['filesize'];
- }
- break;
-
- default:
- if ((($info['avdataend'] - $info['filesize']) == 1) && (($thisfile_riff[$RIFFsubtype]['data'][0]['size'] % 2) == 0) && ((($info['filesize'] - $info['avdataoffset']) % 2) == 1)) {
- // output file appears to be incorrectly *not* padded to nearest WORD boundary
- // Output less severe warning
- $info['warning'][] = 'File should probably be padded to nearest WORD boundary, but it is not (expecting '.$thisfile_riff[$RIFFsubtype]['data'][0]['size'].' bytes of data, only found '.($info['filesize'] - $info['avdataoffset']).' therefore short by '.($thisfile_riff[$RIFFsubtype]['data'][0]['size'] - ($info['filesize'] - $info['avdataoffset'])).' bytes)';
- $info['avdataend'] = $info['filesize'];
- } else {
- // Short by more than one byte, throw warning
- $info['warning'][] = 'Probably truncated file - expecting '.$thisfile_riff[$RIFFsubtype]['data'][0]['size'].' bytes of data, only found '.($info['filesize'] - $info['avdataoffset']).' (short by '.($thisfile_riff[$RIFFsubtype]['data'][0]['size'] - ($info['filesize'] - $info['avdataoffset'])).' bytes)';
- $info['avdataend'] = $info['filesize'];
- }
- break;
- }
- }
- if (!empty($info['mpeg']['audio']['LAME']['audio_bytes'])) {
- if ((($info['avdataend'] - $info['avdataoffset']) - $info['mpeg']['audio']['LAME']['audio_bytes']) == 1) {
- $info['avdataend']--;
- $info['warning'][] = 'Extra null byte at end of MP3 data assumed to be RIFF padding and therefore ignored';
- }
- }
- if (isset($thisfile_audio_dataformat) && ($thisfile_audio_dataformat == 'ac3')) {
- unset($thisfile_audio['bits_per_sample']);
- if (!empty($info['ac3']['bitrate']) && ($info['ac3']['bitrate'] != $thisfile_audio['bitrate'])) {
- $thisfile_audio['bitrate'] = $info['ac3']['bitrate'];
- }
- }
- break;
-
- case 'AVI ':
- $thisfile_video['bitrate_mode'] = 'vbr'; // maybe not, but probably
- $thisfile_video['dataformat'] = 'avi';
- $info['mime_type'] = 'video/avi';
-
- if (isset($thisfile_riff[$RIFFsubtype]['movi']['offset'])) {
- $info['avdataoffset'] = $thisfile_riff[$RIFFsubtype]['movi']['offset'] + 8;
- if (isset($thisfile_riff['AVIX'])) {
- $info['avdataend'] = $thisfile_riff['AVIX'][(count($thisfile_riff['AVIX']) - 1)]['chunks']['movi']['offset'] + $thisfile_riff['AVIX'][(count($thisfile_riff['AVIX']) - 1)]['chunks']['movi']['size'];
- } else {
- $info['avdataend'] = $thisfile_riff['AVI ']['movi']['offset'] + $thisfile_riff['AVI ']['movi']['size'];
- }
- if ($info['avdataend'] > $info['filesize']) {
- $info['warning'][] = 'Probably truncated file - expecting '.($info['avdataend'] - $info['avdataoffset']).' bytes of data, only found '.($info['filesize'] - $info['avdataoffset']).' (short by '.($info['avdataend'] - $info['filesize']).' bytes)';
- $info['avdataend'] = $info['filesize'];
- }
- }
-
- if (isset($thisfile_riff['AVI ']['hdrl']['strl']['indx'])) {
- //$bIndexType = array(
- // 0x00 => 'AVI_INDEX_OF_INDEXES',
- // 0x01 => 'AVI_INDEX_OF_CHUNKS',
- // 0x80 => 'AVI_INDEX_IS_DATA',
- //);
- //$bIndexSubtype = array(
- // 0x01 => array(
- // 0x01 => 'AVI_INDEX_2FIELD',
- // ),
- //);
- foreach ($thisfile_riff['AVI ']['hdrl']['strl']['indx'] as $streamnumber => $steamdataarray) {
- $thisfile_riff_avi_hdrl_strl_indx_stream_data = &$thisfile_riff['AVI ']['hdrl']['strl']['indx'][$streamnumber]['data'];
-
- $thisfile_riff_raw['indx'][$streamnumber]['wLongsPerEntry'] = $this->EitherEndian2Int(substr($thisfile_riff_avi_hdrl_strl_indx_stream_data, 0, 2));
- $thisfile_riff_raw['indx'][$streamnumber]['bIndexSubType'] = $this->EitherEndian2Int(substr($thisfile_riff_avi_hdrl_strl_indx_stream_data, 2, 1));
- $thisfile_riff_raw['indx'][$streamnumber]['bIndexType'] = $this->EitherEndian2Int(substr($thisfile_riff_avi_hdrl_strl_indx_stream_data, 3, 1));
- $thisfile_riff_raw['indx'][$streamnumber]['nEntriesInUse'] = $this->EitherEndian2Int(substr($thisfile_riff_avi_hdrl_strl_indx_stream_data, 4, 4));
- $thisfile_riff_raw['indx'][$streamnumber]['dwChunkId'] = substr($thisfile_riff_avi_hdrl_strl_indx_stream_data, 8, 4);
- $thisfile_riff_raw['indx'][$streamnumber]['dwReserved'] = $this->EitherEndian2Int(substr($thisfile_riff_avi_hdrl_strl_indx_stream_data, 12, 4));
-
- //$thisfile_riff_raw['indx'][$streamnumber]['bIndexType_name'] = $bIndexType[$thisfile_riff_raw['indx'][$streamnumber]['bIndexType']];
- //$thisfile_riff_raw['indx'][$streamnumber]['bIndexSubType_name'] = $bIndexSubtype[$thisfile_riff_raw['indx'][$streamnumber]['bIndexType']][$thisfile_riff_raw['indx'][$streamnumber]['bIndexSubType']];
-
- unset($thisfile_riff_avi_hdrl_strl_indx_stream_data);
- }
- }
- if (isset($thisfile_riff['AVI ']['hdrl']['avih'][$streamindex]['data'])) {
- $avihData = $thisfile_riff['AVI ']['hdrl']['avih'][$streamindex]['data'];
-
- // shortcut
- $thisfile_riff_raw['avih'] = array();
- $thisfile_riff_raw_avih = &$thisfile_riff_raw['avih'];
-
- $thisfile_riff_raw_avih['dwMicroSecPerFrame'] = $this->EitherEndian2Int(substr($avihData, 0, 4)); // frame display rate (or 0L)
- if ($thisfile_riff_raw_avih['dwMicroSecPerFrame'] == 0) {
- $info['error'][] = 'Corrupt RIFF file: avih.dwMicroSecPerFrame == zero';
- return false;
- }
- $thisfile_riff_raw_avih['dwMaxBytesPerSec'] = $this->EitherEndian2Int(substr($avihData, 4, 4)); // max. transfer rate
- $thisfile_riff_raw_avih['dwPaddingGranularity'] = $this->EitherEndian2Int(substr($avihData, 8, 4)); // pad to multiples of this size; normally 2K.
- $thisfile_riff_raw_avih['dwFlags'] = $this->EitherEndian2Int(substr($avihData, 12, 4)); // the ever-present flags
- $thisfile_riff_raw_avih['dwTotalFrames'] = $this->EitherEndian2Int(substr($avihData, 16, 4)); // # frames in file
- $thisfile_riff_raw_avih['dwInitialFrames'] = $this->EitherEndian2Int(substr($avihData, 20, 4));
- $thisfile_riff_raw_avih['dwStreams'] = $this->EitherEndian2Int(substr($avihData, 24, 4));
- $thisfile_riff_raw_avih['dwSuggestedBufferSize'] = $this->EitherEndian2Int(substr($avihData, 28, 4));
- $thisfile_riff_raw_avih['dwWidth'] = $this->EitherEndian2Int(substr($avihData, 32, 4));
- $thisfile_riff_raw_avih['dwHeight'] = $this->EitherEndian2Int(substr($avihData, 36, 4));
- $thisfile_riff_raw_avih['dwScale'] = $this->EitherEndian2Int(substr($avihData, 40, 4));
- $thisfile_riff_raw_avih['dwRate'] = $this->EitherEndian2Int(substr($avihData, 44, 4));
- $thisfile_riff_raw_avih['dwStart'] = $this->EitherEndian2Int(substr($avihData, 48, 4));
- $thisfile_riff_raw_avih['dwLength'] = $this->EitherEndian2Int(substr($avihData, 52, 4));
-
- $thisfile_riff_raw_avih['flags']['hasindex'] = (bool) ($thisfile_riff_raw_avih['dwFlags'] & 0x00000010);
- $thisfile_riff_raw_avih['flags']['mustuseindex'] = (bool) ($thisfile_riff_raw_avih['dwFlags'] & 0x00000020);
- $thisfile_riff_raw_avih['flags']['interleaved'] = (bool) ($thisfile_riff_raw_avih['dwFlags'] & 0x00000100);
- $thisfile_riff_raw_avih['flags']['trustcktype'] = (bool) ($thisfile_riff_raw_avih['dwFlags'] & 0x00000800);
- $thisfile_riff_raw_avih['flags']['capturedfile'] = (bool) ($thisfile_riff_raw_avih['dwFlags'] & 0x00010000);
- $thisfile_riff_raw_avih['flags']['copyrighted'] = (bool) ($thisfile_riff_raw_avih['dwFlags'] & 0x00020010);
-
- // shortcut
- $thisfile_riff_video[$streamindex] = array();
- $thisfile_riff_video_current = &$thisfile_riff_video[$streamindex];
-
- if ($thisfile_riff_raw_avih['dwWidth'] > 0) {
- $thisfile_riff_video_current['frame_width'] = $thisfile_riff_raw_avih['dwWidth'];
- $thisfile_video['resolution_x'] = $thisfile_riff_video_current['frame_width'];
- }
- if ($thisfile_riff_raw_avih['dwHeight'] > 0) {
- $thisfile_riff_video_current['frame_height'] = $thisfile_riff_raw_avih['dwHeight'];
- $thisfile_video['resolution_y'] = $thisfile_riff_video_current['frame_height'];
- }
- if ($thisfile_riff_raw_avih['dwTotalFrames'] > 0) {
- $thisfile_riff_video_current['total_frames'] = $thisfile_riff_raw_avih['dwTotalFrames'];
- $thisfile_video['total_frames'] = $thisfile_riff_video_current['total_frames'];
- }
-
- $thisfile_riff_video_current['frame_rate'] = round(1000000 / $thisfile_riff_raw_avih['dwMicroSecPerFrame'], 3);
- $thisfile_video['frame_rate'] = $thisfile_riff_video_current['frame_rate'];
- }
- if (isset($thisfile_riff['AVI ']['hdrl']['strl']['strh'][0]['data'])) {
- if (is_array($thisfile_riff['AVI ']['hdrl']['strl']['strh'])) {
- for ($i = 0; $i < count($thisfile_riff['AVI ']['hdrl']['strl']['strh']); $i++) {
- if (isset($thisfile_riff['AVI ']['hdrl']['strl']['strh'][$i]['data'])) {
- $strhData = $thisfile_riff['AVI ']['hdrl']['strl']['strh'][$i]['data'];
- $strhfccType = substr($strhData, 0, 4);
-
- if (isset($thisfile_riff['AVI ']['hdrl']['strl']['strf'][$i]['data'])) {
- $strfData = $thisfile_riff['AVI ']['hdrl']['strl']['strf'][$i]['data'];
-
- // shortcut
- $thisfile_riff_raw_strf_strhfccType_streamindex = &$thisfile_riff_raw['strf'][$strhfccType][$streamindex];
-
- switch ($strhfccType) {
- case 'auds':
- $thisfile_audio['bitrate_mode'] = 'cbr';
- $thisfile_audio_dataformat = 'wav';
- if (isset($thisfile_riff_audio) && is_array($thisfile_riff_audio)) {
- $streamindex = count($thisfile_riff_audio);
- }
-
- $thisfile_riff_audio[$streamindex] = getid3_riff::RIFFparseWAVEFORMATex($strfData);
- $thisfile_audio['wformattag'] = $thisfile_riff_audio[$streamindex]['raw']['wFormatTag'];
-
- // shortcut
- $thisfile_audio['streams'][$streamindex] = $thisfile_riff_audio[$streamindex];
- $thisfile_audio_streams_currentstream = &$thisfile_audio['streams'][$streamindex];
-
- if ($thisfile_audio_streams_currentstream['bits_per_sample'] == 0) {
- unset($thisfile_audio_streams_currentstream['bits_per_sample']);
- }
- $thisfile_audio_streams_currentstream['wformattag'] = $thisfile_audio_streams_currentstream['raw']['wFormatTag'];
- unset($thisfile_audio_streams_currentstream['raw']);
-
- // shortcut
- $thisfile_riff_raw['strf'][$strhfccType][$streamindex] = $thisfile_riff_audio[$streamindex]['raw'];
-
- unset($thisfile_riff_audio[$streamindex]['raw']);
- $thisfile_audio = getid3_lib::array_merge_noclobber($thisfile_audio, $thisfile_riff_audio[$streamindex]);
-
- $thisfile_audio['lossless'] = false;
- switch ($thisfile_riff_raw_strf_strhfccType_streamindex['wFormatTag']) {
- case 0x0001: // PCM
- $thisfile_audio_dataformat = 'wav';
- $thisfile_audio['lossless'] = true;
- break;
-
- case 0x0050: // MPEG Layer 2 or Layer 1
- $thisfile_audio_dataformat = 'mp2'; // Assume Layer-2
- break;
-
- case 0x0055: // MPEG Layer 3
- $thisfile_audio_dataformat = 'mp3';
- break;
-
- case 0x00FF: // AAC
- $thisfile_audio_dataformat = 'aac';
- break;
-
- case 0x0161: // Windows Media v7 / v8 / v9
- case 0x0162: // Windows Media Professional v9
- case 0x0163: // Windows Media Lossess v9
- $thisfile_audio_dataformat = 'wma';
- break;
-
- case 0x2000: // AC-3
- $thisfile_audio_dataformat = 'ac3';
- break;
-
- case 0x2001: // DTS
- $thisfile_audio_dataformat = 'dts';
- break;
-
- default:
- $thisfile_audio_dataformat = 'wav';
- break;
- }
- $thisfile_audio_streams_currentstream['dataformat'] = $thisfile_audio_dataformat;
- $thisfile_audio_streams_currentstream['lossless'] = $thisfile_audio['lossless'];
- $thisfile_audio_streams_currentstream['bitrate_mode'] = $thisfile_audio['bitrate_mode'];
- break;
-
-
- case 'iavs':
- case 'vids':
- // shortcut
- $thisfile_riff_raw['strh'][$i] = array();
- $thisfile_riff_raw_strh_current = &$thisfile_riff_raw['strh'][$i];
-
- $thisfile_riff_raw_strh_current['fccType'] = substr($strhData, 0, 4); // same as $strhfccType;
- $thisfile_riff_raw_strh_current['fccHandler'] = substr($strhData, 4, 4);
- $thisfile_riff_raw_strh_current['dwFlags'] = $this->EitherEndian2Int(substr($strhData, 8, 4)); // Contains AVITF_* flags
- $thisfile_riff_raw_strh_current['wPriority'] = $this->EitherEndian2Int(substr($strhData, 12, 2));
- $thisfile_riff_raw_strh_current['wLanguage'] = $this->EitherEndian2Int(substr($strhData, 14, 2));
- $thisfile_riff_raw_strh_current['dwInitialFrames'] = $this->EitherEndian2Int(substr($strhData, 16, 4));
- $thisfile_riff_raw_strh_current['dwScale'] = $this->EitherEndian2Int(substr($strhData, 20, 4));
- $thisfile_riff_raw_strh_current['dwRate'] = $this->EitherEndian2Int(substr($strhData, 24, 4));
- $thisfile_riff_raw_strh_current['dwStart'] = $this->EitherEndian2Int(substr($strhData, 28, 4));
- $thisfile_riff_raw_strh_current['dwLength'] = $this->EitherEndian2Int(substr($strhData, 32, 4));
- $thisfile_riff_raw_strh_current['dwSuggestedBufferSize'] = $this->EitherEndian2Int(substr($strhData, 36, 4));
- $thisfile_riff_raw_strh_current['dwQuality'] = $this->EitherEndian2Int(substr($strhData, 40, 4));
- $thisfile_riff_raw_strh_current['dwSampleSize'] = $this->EitherEndian2Int(substr($strhData, 44, 4));
- $thisfile_riff_raw_strh_current['rcFrame'] = $this->EitherEndian2Int(substr($strhData, 48, 4));
-
- $thisfile_riff_video_current['codec'] = getid3_riff::RIFFfourccLookup($thisfile_riff_raw_strh_current['fccHandler']);
- $thisfile_video['fourcc'] = $thisfile_riff_raw_strh_current['fccHandler'];
- if (!$thisfile_riff_video_current['codec'] && isset($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']) && getid3_riff::RIFFfourccLookup($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc'])) {
- $thisfile_riff_video_current['codec'] = getid3_riff::RIFFfourccLookup($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']);
- $thisfile_video['fourcc'] = $thisfile_riff_raw_strf_strhfccType_streamindex['fourcc'];
- }
- $thisfile_video['codec'] = $thisfile_riff_video_current['codec'];
- $thisfile_video['pixel_aspect_ratio'] = (float) 1;
- switch ($thisfile_riff_raw_strh_current['fccHandler']) {
- case 'HFYU': // Huffman Lossless Codec
- case 'IRAW': // Intel YUV Uncompressed
- case 'YUY2': // Uncompressed YUV 4:2:2
- $thisfile_video['lossless'] = true;
- break;
-
- default:
- $thisfile_video['lossless'] = false;
- break;
- }
-
- switch ($strhfccType) {
- case 'vids':
- $thisfile_riff_raw_strf_strhfccType_streamindex = getid3_riff::ParseBITMAPINFOHEADER(substr($strfData, 0, 40), ($info['fileformat'] == 'riff'));
-//echo '<pre>'.print_r($thisfile_riff_raw_strf_strhfccType_streamindex, true).'</pre>';
- $thisfile_video['bits_per_sample'] = $thisfile_riff_raw_strf_strhfccType_streamindex['biBitCount'];
-
- if ($thisfile_riff_video_current['codec'] == 'DV') {
- $thisfile_riff_video_current['dv_type'] = 2;
- }
- break;
-
- case 'iavs':
- $thisfile_riff_video_current['dv_type'] = 1;
- break;
- }
- break;
-
- default:
- $info['warning'][] = 'Unhandled fccType for stream ('.$i.'): "'.$strhfccType.'"';
- break;
-
- }
- }
- }
-
- if (isset($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc'])) {
-
- $thisfile_video['fourcc'] = $thisfile_riff_raw_strf_strhfccType_streamindex['fourcc'];
- if (getid3_riff::RIFFfourccLookup($thisfile_video['fourcc'])) {
- $thisfile_riff_video_current['codec'] = getid3_riff::RIFFfourccLookup($thisfile_video['fourcc']);
- $thisfile_video['codec'] = $thisfile_riff_video_current['codec'];
- }
-
- switch ($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']) {
- case 'HFYU': // Huffman Lossless Codec
- case 'IRAW': // Intel YUV Uncompressed
- case 'YUY2': // Uncompressed YUV 4:2:2
- $thisfile_video['lossless'] = true;
- //$thisfile_video['bits_per_sample'] = 24;
- break;
-
- default:
- $thisfile_video['lossless'] = false;
- //$thisfile_video['bits_per_sample'] = 24;
- break;
- }
-
- }
- }
- }
- }
- break;
-
- case 'CDDA':
- $thisfile_audio['bitrate_mode'] = 'cbr';
- $thisfile_audio_dataformat = 'cda';
- $thisfile_audio['lossless'] = true;
- unset($info['mime_type']);
-
- $info['avdataoffset'] = 44;
-
- if (isset($thisfile_riff['CDDA']['fmt '][0]['data'])) {
- // shortcut
- $thisfile_riff_CDDA_fmt_0 = &$thisfile_riff['CDDA']['fmt '][0];
-
- $thisfile_riff_CDDA_fmt_0['unknown1'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 0, 2));
- $thisfile_riff_CDDA_fmt_0['track_num'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 2, 2));
- $thisfile_riff_CDDA_fmt_0['disc_id'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 4, 4));
- $thisfile_riff_CDDA_fmt_0['start_offset_frame'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 8, 4));
- $thisfile_riff_CDDA_fmt_0['playtime_frames'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 12, 4));
- $thisfile_riff_CDDA_fmt_0['unknown6'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 16, 4));
- $thisfile_riff_CDDA_fmt_0['unknown7'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 20, 4));
-
- $thisfile_riff_CDDA_fmt_0['start_offset_seconds'] = (float) $thisfile_riff_CDDA_fmt_0['start_offset_frame'] / 75;
- $thisfile_riff_CDDA_fmt_0['playtime_seconds'] = (float) $thisfile_riff_CDDA_fmt_0['playtime_frames'] / 75;
- $info['comments']['track'] = $thisfile_riff_CDDA_fmt_0['track_num'];
- $info['playtime_seconds'] = $thisfile_riff_CDDA_fmt_0['playtime_seconds'];
-
- // hardcoded data for CD-audio
- $thisfile_audio['sample_rate'] = 44100;
- $thisfile_audio['channels'] = 2;
- $thisfile_audio['bits_per_sample'] = 16;
- $thisfile_audio['bitrate'] = $thisfile_audio['sample_rate'] * $thisfile_audio['channels'] * $thisfile_audio['bits_per_sample'];
- $thisfile_audio['bitrate_mode'] = 'cbr';
- }
- break;
-
-
- case 'AIFF':
- case 'AIFC':
- $thisfile_audio['bitrate_mode'] = 'cbr';
- $thisfile_audio_dataformat = 'aiff';
- $thisfile_audio['lossless'] = true;
- $info['mime_type'] = 'audio/x-aiff';
-
- if (isset($thisfile_riff[$RIFFsubtype]['SSND'][0]['offset'])) {
- $info['avdataoffset'] = $thisfile_riff[$RIFFsubtype]['SSND'][0]['offset'] + 8;
- $info['avdataend'] = $info['avdataoffset'] + $thisfile_riff[$RIFFsubtype]['SSND'][0]['size'];
- if ($info['avdataend'] > $info['filesize']) {
- if (($info['avdataend'] == ($info['filesize'] + 1)) && (($info['filesize'] % 2) == 1)) {
- // structures rounded to 2-byte boundary, but dumb encoders
- // forget to pad end of file to make this actually work
- } else {
- $info['warning'][] = 'Probable truncated AIFF file: expecting '.$thisfile_riff[$RIFFsubtype]['SSND'][0]['size'].' bytes of audio data, only '.($info['filesize'] - $info['avdataoffset']).' bytes found';
- }
- $info['avdataend'] = $info['filesize'];
- }
- }
-
- if (isset($thisfile_riff[$RIFFsubtype]['COMM'][0]['data'])) {
-
- // shortcut
- $thisfile_riff_RIFFsubtype_COMM_0_data = &$thisfile_riff[$RIFFsubtype]['COMM'][0]['data'];
-
- $thisfile_riff_audio['channels'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 0, 2), true);
- $thisfile_riff_audio['total_samples'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 2, 4), false);
- $thisfile_riff_audio['bits_per_sample'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 6, 2), true);
- $thisfile_riff_audio['sample_rate'] = (int) getid3_lib::BigEndian2Float(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 8, 10));
-
- if ($thisfile_riff[$RIFFsubtype]['COMM'][0]['size'] > 18) {
- $thisfile_riff_audio['codec_fourcc'] = substr($thisfile_riff_RIFFsubtype_COMM_0_data, 18, 4);
- $CodecNameSize = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 22, 1), false);
- $thisfile_riff_audio['codec_name'] = substr($thisfile_riff_RIFFsubtype_COMM_0_data, 23, $CodecNameSize);
- switch ($thisfile_riff_audio['codec_name']) {
- case 'NONE':
- $thisfile_audio['codec'] = 'Pulse Code Modulation (PCM)';
- $thisfile_audio['lossless'] = true;
- break;
-
- case '':
- switch ($thisfile_riff_audio['codec_fourcc']) {
- // http://developer.apple.com/qa/snd/snd07.html
- case 'sowt':
- $thisfile_riff_audio['codec_name'] = 'Two\'s Compliment Little-Endian PCM';
- $thisfile_audio['lossless'] = true;
- break;
-
- case 'twos':
- $thisfile_riff_audio['codec_name'] = 'Two\'s Compliment Big-Endian PCM';
- $thisfile_audio['lossless'] = true;
- break;
-
- default:
- break;
- }
- break;
-
- default:
- $thisfile_audio['codec'] = $thisfile_riff_audio['codec_name'];
- $thisfile_audio['lossless'] = false;
- break;
- }
- }
-
- $thisfile_audio['channels'] = $thisfile_riff_audio['channels'];
- if ($thisfile_riff_audio['bits_per_sample'] > 0) {
- $thisfile_audio['bits_per_sample'] = $thisfile_riff_audio['bits_per_sample'];
- }
- $thisfile_audio['sample_rate'] = $thisfile_riff_audio['sample_rate'];
- if ($thisfile_audio['sample_rate'] == 0) {
- $info['error'][] = 'Corrupted AIFF file: sample_rate == zero';
- return false;
- }
- $info['playtime_seconds'] = $thisfile_riff_audio['total_samples'] / $thisfile_audio['sample_rate'];
- }
-
- if (isset($thisfile_riff[$RIFFsubtype]['COMT'])) {
- $offset = 0;
- $CommentCount = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, 2), false);
- $offset += 2;
- for ($i = 0; $i < $CommentCount; $i++) {
- $info['comments_raw'][$i]['timestamp'] = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, 4), false);
- $offset += 4;
- $info['comments_raw'][$i]['marker_id'] = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, 2), true);
- $offset += 2;
- $CommentLength = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, 2), false);
- $offset += 2;
- $info['comments_raw'][$i]['comment'] = substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, $CommentLength);
- $offset += $CommentLength;
-
- $info['comments_raw'][$i]['timestamp_unix'] = getid3_lib::DateMac2Unix($info['comments_raw'][$i]['timestamp']);
- $thisfile_riff['comments']['comment'][] = $info['comments_raw'][$i]['comment'];
- }
- }
-
- $CommentsChunkNames = array('NAME'=>'title', 'author'=>'artist', '(c) '=>'copyright', 'ANNO'=>'comment');
- foreach ($CommentsChunkNames as $key => $value) {
- if (isset($thisfile_riff[$RIFFsubtype][$key][0]['data'])) {
- $thisfile_riff['comments'][$value][] = $thisfile_riff[$RIFFsubtype][$key][0]['data'];
- }
- }
-
- if (isset($thisfile_riff[$RIFFsubtype]['ID3 '])) {
- getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.id3v2.php', __FILE__, true);
- $getid3_temp = new getID3();
- $getid3_temp->openfile($this->getid3->filename);
- $getid3_id3v2 = new getid3_id3v2($getid3_temp);
- $getid3_id3v2->StartingOffset = $thisfile_riff[$RIFFsubtype]['ID3 '][0]['offset'] + 8;
- if ($thisfile_riff[$RIFFsubtype]['ID3 '][0]['valid'] = $getid3_id3v2->Analyze()) {
- $info['id3v2'] = $getid3_temp->info['id3v2'];
- }
- unset($getid3_temp, $getid3_id3v2);
- }
- break;
-
- case '8SVX':
- $thisfile_audio['bitrate_mode'] = 'cbr';
- $thisfile_audio_dataformat = '8svx';
- $thisfile_audio['bits_per_sample'] = 8;
- $thisfile_audio['channels'] = 1; // overridden below, if need be
- $info['mime_type'] = 'audio/x-aiff';
-
- if (isset($thisfile_riff[$RIFFsubtype]['BODY'][0]['offset'])) {
- $info['avdataoffset'] = $thisfile_riff[$RIFFsubtype]['BODY'][0]['offset'] + 8;
- $info['avdataend'] = $info['avdataoffset'] + $thisfile_riff[$RIFFsubtype]['BODY'][0]['size'];
- if ($info['avdataend'] > $info['filesize']) {
- $info['warning'][] = 'Probable truncated AIFF file: expecting '.$thisfile_riff[$RIFFsubtype]['BODY'][0]['size'].' bytes of audio data, only '.($info['filesize'] - $info['avdataoffset']).' bytes found';
- }
- }
-
- if (isset($thisfile_riff[$RIFFsubtype]['VHDR'][0]['offset'])) {
- // shortcut
- $thisfile_riff_RIFFsubtype_VHDR_0 = &$thisfile_riff[$RIFFsubtype]['VHDR'][0];
-
- $thisfile_riff_RIFFsubtype_VHDR_0['oneShotHiSamples'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 0, 4));
- $thisfile_riff_RIFFsubtype_VHDR_0['repeatHiSamples'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 4, 4));
- $thisfile_riff_RIFFsubtype_VHDR_0['samplesPerHiCycle'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 8, 4));
- $thisfile_riff_RIFFsubtype_VHDR_0['samplesPerSec'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 12, 2));
- $thisfile_riff_RIFFsubtype_VHDR_0['ctOctave'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 14, 1));
- $thisfile_riff_RIFFsubtype_VHDR_0['sCompression'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 15, 1));
- $thisfile_riff_RIFFsubtype_VHDR_0['Volume'] = getid3_lib::FixedPoint16_16(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 16, 4));
-
- $thisfile_audio['sample_rate'] = $thisfile_riff_RIFFsubtype_VHDR_0['samplesPerSec'];
-
- switch ($thisfile_riff_RIFFsubtype_VHDR_0['sCompression']) {
- case 0:
- $thisfile_audio['codec'] = 'Pulse Code Modulation (PCM)';
- $thisfile_audio['lossless'] = true;
- $ActualBitsPerSample = 8;
- break;
-
- case 1:
- $thisfile_audio['codec'] = 'Fibonacci-delta encoding';
- $thisfile_audio['lossless'] = false;
- $ActualBitsPerSample = 4;
- break;
-
- default:
- $info['warning'][] = 'Unexpected sCompression value in 8SVX.VHDR chunk - expecting 0 or 1, found "'.sCompression.'"';
- break;
- }
- }
-
- if (isset($thisfile_riff[$RIFFsubtype]['CHAN'][0]['data'])) {
- $ChannelsIndex = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['CHAN'][0]['data'], 0, 4));
- switch ($ChannelsIndex) {
- case 6: // Stereo
- $thisfile_audio['channels'] = 2;
- break;
-
- case 2: // Left channel only
- case 4: // Right channel only
- $thisfile_audio['channels'] = 1;
- break;
-
- default:
- $info['warning'][] = 'Unexpected value in 8SVX.CHAN chunk - expecting 2 or 4 or 6, found "'.$ChannelsIndex.'"';
- break;
- }
-
- }
-
- $CommentsChunkNames = array('NAME'=>'title', 'author'=>'artist', '(c) '=>'copyright', 'ANNO'=>'comment');
- foreach ($CommentsChunkNames as $key => $value) {
- if (isset($thisfile_riff[$RIFFsubtype][$key][0]['data'])) {
- $thisfile_riff['comments'][$value][] = $thisfile_riff[$RIFFsubtype][$key][0]['data'];
- }
- }
-
- $thisfile_audio['bitrate'] = $thisfile_audio['sample_rate'] * $ActualBitsPerSample * $thisfile_audio['channels'];
- if (!empty($thisfile_audio['bitrate'])) {
- $info['playtime_seconds'] = ($info['avdataend'] - $info['avdataoffset']) / ($thisfile_audio['bitrate'] / 8);
- }
- break;
-
-
- case 'CDXA':
- $info['mime_type'] = 'video/mpeg';
- if (!empty($thisfile_riff['CDXA']['data'][0]['size'])) {
- if (getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.mpeg.php', __FILE__, false)) {
- $getid3_temp = new getID3();
- $getid3_temp->openfile($this->getid3->filename);
- $getid3_mpeg = new getid3_mpeg($getid3_temp);
- $getid3_mpeg->Analyze();
- if (empty($getid3_temp->info['error'])) {
- $info['audio'] = $getid3_temp->info['audio'];
- $info['video'] = $getid3_temp->info['video'];
- $info['mpeg'] = $getid3_temp->info['mpeg'];
- $info['warning'] = $getid3_temp->info['warning'];
- }
- unset($getid3_temp, $getid3_mpeg);
- }
- }
- break;
-
-
- default:
- $info['error'][] = 'Unknown RIFF type: expecting one of (WAVE|RMP3|AVI |CDDA|AIFF|AIFC|8SVX|CDXA), found "'.$RIFFsubtype.'" instead';
- unset($info['fileformat']);
- break;
- }
-
- if (isset($thisfile_riff_raw['fmt ']['wFormatTag']) && ($thisfile_riff_raw['fmt ']['wFormatTag'] == 1)) {
- // http://www.mega-nerd.com/erikd/Blog/Windiots/dts.html
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
- $FirstFourBytes = fread($this->getid3->fp, 4);
- if (preg_match('/^\xFF\x1F\x00\xE8/s', $FirstFourBytes)) {
- // DTSWAV
- $thisfile_audio_dataformat = 'dts';
- } elseif (preg_match('/^\x7F\xFF\x80\x01/s', $FirstFourBytes)) {
- // DTS, but this probably shouldn't happen
- $thisfile_audio_dataformat = 'dts';
- }
- }
-
-
- if (isset($thisfile_riff_WAVE['DISP']) && is_array($thisfile_riff_WAVE['DISP'])) {
- $thisfile_riff['comments']['title'][] = trim(substr($thisfile_riff_WAVE['DISP'][count($thisfile_riff_WAVE['DISP']) - 1]['data'], 4));
- }
- if (isset($thisfile_riff_WAVE['INFO']) && is_array($thisfile_riff_WAVE['INFO'])) {
- $this->RIFFcommentsParse($thisfile_riff_WAVE['INFO'], $thisfile_riff['comments']);
- }
- if (isset($thisfile_riff['AVI ']['INFO']) && is_array($thisfile_riff['AVI ']['INFO'])) {
- $this->RIFFcommentsParse($thisfile_riff['AVI ']['INFO'], $thisfile_riff['comments']);
- }
-
- if (empty($thisfile_audio['encoder']) && !empty($info['mpeg']['audio']['LAME']['short_version'])) {
- $thisfile_audio['encoder'] = $info['mpeg']['audio']['LAME']['short_version'];
- }
-
- if (!isset($info['playtime_seconds'])) {
- $info['playtime_seconds'] = 0;
- }
- if (isset($thisfile_riff_raw['strh'][0]['dwLength']) && isset($thisfile_riff_raw['avih']['dwMicroSecPerFrame'])) {
- // needed for >2GB AVIs where 'avih' chunk only lists number of frames in that chunk, not entire movie
- $info['playtime_seconds'] = $thisfile_riff_raw['strh'][0]['dwLength'] * ($thisfile_riff_raw['avih']['dwMicroSecPerFrame'] / 1000000);
- } elseif (isset($thisfile_riff_raw['avih']['dwTotalFrames']) && isset($thisfile_riff_raw['avih']['dwMicroSecPerFrame'])) {
- $info['playtime_seconds'] = $thisfile_riff_raw['avih']['dwTotalFrames'] * ($thisfile_riff_raw['avih']['dwMicroSecPerFrame'] / 1000000);
- }
-
- if ($info['playtime_seconds'] > 0) {
- if (isset($thisfile_riff_audio) && isset($thisfile_riff_video)) {
-
- if (!isset($info['bitrate'])) {
- $info['bitrate'] = ((($info['avdataend'] - $info['avdataoffset']) / $info['playtime_seconds']) * 8);
- }
-
- } elseif (isset($thisfile_riff_audio) && !isset($thisfile_riff_video)) {
-
- if (!isset($thisfile_audio['bitrate'])) {
- $thisfile_audio['bitrate'] = ((($info['avdataend'] - $info['avdataoffset']) / $info['playtime_seconds']) * 8);
- }
-
- } elseif (!isset($thisfile_riff_audio) && isset($thisfile_riff_video)) {
-
- if (!isset($thisfile_video['bitrate'])) {
- $thisfile_video['bitrate'] = ((($info['avdataend'] - $info['avdataoffset']) / $info['playtime_seconds']) * 8);
- }
-
- }
- }
-
-
- if (isset($thisfile_riff_video) && isset($thisfile_audio['bitrate']) && ($thisfile_audio['bitrate'] > 0) && ($info['playtime_seconds'] > 0)) {
-
- $info['bitrate'] = ((($info['avdataend'] - $info['avdataoffset']) / $info['playtime_seconds']) * 8);
- $thisfile_audio['bitrate'] = 0;
- $thisfile_video['bitrate'] = $info['bitrate'];
- foreach ($thisfile_riff_audio as $channelnumber => $audioinfoarray) {
- $thisfile_video['bitrate'] -= $audioinfoarray['bitrate'];
- $thisfile_audio['bitrate'] += $audioinfoarray['bitrate'];
- }
- if ($thisfile_video['bitrate'] <= 0) {
- unset($thisfile_video['bitrate']);
- }
- if ($thisfile_audio['bitrate'] <= 0) {
- unset($thisfile_audio['bitrate']);
- }
- }
-
- if (isset($info['mpeg']['audio'])) {
- $thisfile_audio_dataformat = 'mp'.$info['mpeg']['audio']['layer'];
- $thisfile_audio['sample_rate'] = $info['mpeg']['audio']['sample_rate'];
- $thisfile_audio['channels'] = $info['mpeg']['audio']['channels'];
- $thisfile_audio['bitrate'] = $info['mpeg']['audio']['bitrate'];
- $thisfile_audio['bitrate_mode'] = strtolower($info['mpeg']['audio']['bitrate_mode']);
- if (!empty($info['mpeg']['audio']['codec'])) {
- $thisfile_audio['codec'] = $info['mpeg']['audio']['codec'].' '.$thisfile_audio['codec'];
- }
- if (!empty($thisfile_audio['streams'])) {
- foreach ($thisfile_audio['streams'] as $streamnumber => $streamdata) {
- if ($streamdata['dataformat'] == $thisfile_audio_dataformat) {
- $thisfile_audio['streams'][$streamnumber]['sample_rate'] = $thisfile_audio['sample_rate'];
- $thisfile_audio['streams'][$streamnumber]['channels'] = $thisfile_audio['channels'];
- $thisfile_audio['streams'][$streamnumber]['bitrate'] = $thisfile_audio['bitrate'];
- $thisfile_audio['streams'][$streamnumber]['bitrate_mode'] = $thisfile_audio['bitrate_mode'];
- $thisfile_audio['streams'][$streamnumber]['codec'] = $thisfile_audio['codec'];
- }
- }
- }
- $getid3_mp3 = new getid3_mp3($this->getid3);
- $thisfile_audio['encoder_options'] = $getid3_mp3->GuessEncoderOptions();
- unset($getid3_mp3);
- }
-
-
- if (!empty($thisfile_riff_raw['fmt ']['wBitsPerSample']) && ($thisfile_riff_raw['fmt ']['wBitsPerSample'] > 0)) {
- switch ($thisfile_audio_dataformat) {
- case 'ac3':
- // ignore bits_per_sample
- break;
-
- default:
- $thisfile_audio['bits_per_sample'] = $thisfile_riff_raw['fmt ']['wBitsPerSample'];
- break;
- }
- }
-
-
- if (empty($thisfile_riff_raw)) {
- unset($thisfile_riff['raw']);
- }
- if (empty($thisfile_riff_audio)) {
- unset($thisfile_riff['audio']);
- }
- if (empty($thisfile_riff_video)) {
- unset($thisfile_riff['video']);
- }
-
- return true;
- }
-
-
- static function RIFFcommentsParse(&$RIFFinfoArray, &$CommentsTargetArray) {
- $RIFFinfoKeyLookup = array(
- 'IARL'=>'archivallocation',
- 'IART'=>'artist',
- 'ICDS'=>'costumedesigner',
- 'ICMS'=>'commissionedby',
- 'ICMT'=>'comment',
- 'ICNT'=>'country',
- 'ICOP'=>'copyright',
- 'ICRD'=>'creationdate',
- 'IDIM'=>'dimensions',
- 'IDIT'=>'digitizationdate',
- 'IDPI'=>'resolution',
- 'IDST'=>'distributor',
- 'IEDT'=>'editor',
- 'IENG'=>'engineers',
- 'IFRM'=>'accountofparts',
- 'IGNR'=>'genre',
- 'IKEY'=>'keywords',
- 'ILGT'=>'lightness',
- 'ILNG'=>'language',
- 'IMED'=>'orignalmedium',
- 'IMUS'=>'composer',
- 'INAM'=>'title',
- 'IPDS'=>'productiondesigner',
- 'IPLT'=>'palette',
- 'IPRD'=>'product',
- 'IPRO'=>'producer',
- 'IPRT'=>'part',
- 'IRTD'=>'rating',
- 'ISBJ'=>'subject',
- 'ISFT'=>'software',
- 'ISGN'=>'secondarygenre',
- 'ISHP'=>'sharpness',
- 'ISRC'=>'sourcesupplier',
- 'ISRF'=>'digitizationsource',
- 'ISTD'=>'productionstudio',
- 'ISTR'=>'starring',
- 'ITCH'=>'encoded_by',
- 'IWEB'=>'url',
- 'IWRI'=>'writer'
- );
- foreach ($RIFFinfoKeyLookup as $key => $value) {
- if (isset($RIFFinfoArray[$key])) {
- foreach ($RIFFinfoArray[$key] as $commentid => $commentdata) {
- if (trim($commentdata['data']) != '') {
- if (isset($CommentsTargetArray[$value])) {
- $CommentsTargetArray[$value][] = trim($commentdata['data']);
- } else {
- $CommentsTargetArray[$value] = array(trim($commentdata['data']));
- }
- }
- }
- }
- }
- return true;
- }
-
- function ParseRIFF($startoffset, $maxoffset) {
- $info = &$this->getid3->info;
-
- $maxoffset = min($maxoffset, $info['avdataend']);
-
- $RIFFchunk = false;
- $FoundAllChunksWeNeed = false;
-
- if (($startoffset < 0) || !getid3_lib::intValueSupported($startoffset)) {
- $info['warning'][] = 'Unable to ParseRIFF() at '.$startoffset.' because beyond '.round(PHP_INT_MAX / 1073741824).'GB limit of PHP filesystem functions';
- return false;
- }
- $max_usable_offset = min(PHP_INT_MAX - 1024, $maxoffset);
- if ($maxoffset > $max_usable_offset) {
- $info['warning'][] = 'ParseRIFF() may return incomplete data for chunk starting at '.$startoffset.' because beyond it extends to '.$maxoffset.', which is beyond the '.round(PHP_INT_MAX / 1073741824).'GB limit of PHP filesystem functions';
- }
- fseek($this->getid3->fp, $startoffset, SEEK_SET);
-
- while (ftell($this->getid3->fp) < $max_usable_offset) {
- $chunknamesize = fread($this->getid3->fp, 8);
- $chunkname = substr($chunknamesize, 0, 4);
- $chunksize = $this->EitherEndian2Int(substr($chunknamesize, 4, 4));
- if (strlen($chunkname) < 4) {
- $info['error'][] = 'Expecting chunk name at offset '.(ftell($this->getid3->fp) - 4).' but found nothing. Aborting RIFF parsing.';
- break;
- }
- if ($chunksize == 0) {
- if ($chunkname == 'JUNK') {
- // we'll allow zero-size JUNK frames
- } else {
- $info['warning'][] = 'Chunk size at offset '.(ftell($this->getid3->fp) - 4).' is zero. Aborting RIFF parsing.';
- break;
- }
- }
- if (($chunksize % 2) != 0) {
- // all structures are packed on word boundaries
- $chunksize++;
- }
-
- switch ($chunkname) {
- case 'LIST':
- $listname = fread($this->getid3->fp, 4);
- if (preg_match('#^(movi|rec )$#i', $listname)) {
- $RIFFchunk[$listname]['offset'] = ftell($this->getid3->fp) - 4;
- $RIFFchunk[$listname]['size'] = $chunksize;
-
- if ($FoundAllChunksWeNeed) {
-
- // skip over
-
- } else {
-
- $WhereWeWere = ftell($this->getid3->fp);
- $AudioChunkHeader = fread($this->getid3->fp, 12);
- $AudioChunkStreamNum = substr($AudioChunkHeader, 0, 2);
- $AudioChunkStreamType = substr($AudioChunkHeader, 2, 2);
- $AudioChunkSize = getid3_lib::LittleEndian2Int(substr($AudioChunkHeader, 4, 4));
-
- if ($AudioChunkStreamType == 'wb') {
- $FirstFourBytes = substr($AudioChunkHeader, 8, 4);
- if (preg_match('/^\xFF[\xE2-\xE7\xF2-\xF7\xFA-\xFF][\x00-\xEB]/s', $FirstFourBytes)) {
- // MP3
- if (getid3_mp3::MPEGaudioHeaderBytesValid($FirstFourBytes)) {
- $getid3_temp = new getID3();
- $getid3_temp->openfile($this->getid3->filename);
- $getid3_temp->info['avdataoffset'] = ftell($this->getid3->fp) - 4;
- $getid3_temp->info['avdataend'] = ftell($this->getid3->fp) + $AudioChunkSize;
- $getid3_mp3 = new getid3_mp3($getid3_temp);
- $getid3_mp3->getOnlyMPEGaudioInfo($getid3_temp->info['avdataoffset'], false);
- if (isset($getid3_temp->info['mpeg']['audio'])) {
- $info['mpeg']['audio'] = $getid3_temp->info['mpeg']['audio'];
- $info['audio'] = $getid3_temp->info['audio'];
- $info['audio']['dataformat'] = 'mp'.$info['mpeg']['audio']['layer'];
- $info['audio']['sample_rate'] = $info['mpeg']['audio']['sample_rate'];
- $info['audio']['channels'] = $info['mpeg']['audio']['channels'];
- $info['audio']['bitrate'] = $info['mpeg']['audio']['bitrate'];
- $info['audio']['bitrate_mode'] = strtolower($info['mpeg']['audio']['bitrate_mode']);
- //$info['bitrate'] = $info['audio']['bitrate'];
- }
- unset($getid3_temp, $getid3_mp3);
- }
-
- } elseif (preg_match('/^\x0B\x77/s', $FirstFourBytes)) {
-
- // AC3
- if (getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.ac3.php', __FILE__, false)) {
- $getid3_temp = new getID3();
- $getid3_temp->openfile($this->getid3->filename);
- $getid3_temp->info['avdataoffset'] = ftell($this->getid3->fp) - 4;
- $getid3_temp->info['avdataend'] = ftell($this->getid3->fp) + $AudioChunkSize;
- $getid3_ac3 = new getid3_ac3($getid3_temp);
- $getid3_ac3->Analyze();
- if (empty($getid3_temp->info['error'])) {
- $info['audio'] = $getid3_temp->info['audio'];
- $info['ac3'] = $getid3_temp->info['ac3'];
- if (!empty($getid3_temp->info['warning'])) {
- foreach ($getid3_temp->info['warning'] as $key => $value) {
- $info['warning'][] = $value;
- }
- }
- }
- unset($getid3_temp, $getid3_ac3);
- }
-
- }
-
- }
-
- $FoundAllChunksWeNeed = true;
- fseek($this->getid3->fp, $WhereWeWere, SEEK_SET);
-
- }
- fseek($this->getid3->fp, $chunksize - 4, SEEK_CUR);
-
- //} elseif (preg_match('#^[0-9]{2}(wb|pc|dc|db)$#i', $listname)) {
- //
- // // data chunk, ignore
- //
- } else {
-
- if (!isset($RIFFchunk[$listname])) {
- $RIFFchunk[$listname] = array();
- }
- $LISTchunkParent = $listname;
- $LISTchunkMaxOffset = ftell($this->getid3->fp) - 4 + $chunksize;
- if ($parsedChunk = $this->ParseRIFF(ftell($this->getid3->fp), ftell($this->getid3->fp) + $chunksize - 4)) {
- $RIFFchunk[$listname] = array_merge_recursive($RIFFchunk[$listname], $parsedChunk);
- }
-
- }
- break;
-
- default:
- if (preg_match('#^[0-9]{2}(wb|pc|dc|db)$#', $chunkname)) {
- $nextoffset = ftell($this->getid3->fp) + $chunksize;
- if (($nextoffset < 0) || !getid3_lib::intValueSupported($nextoffset)) {
- $info['warning'][] = 'Unable to parse chunk at offset '.$nextoffset.' because beyond '.round(PHP_INT_MAX / 1073741824).'GB limit of PHP filesystem functions';
- break 2;
- }
- fseek($this->getid3->fp, $nextoffset, SEEK_SET);
- break;
- }
- $thisindex = 0;
- if (isset($RIFFchunk[$chunkname]) && is_array($RIFFchunk[$chunkname])) {
- $thisindex = count($RIFFchunk[$chunkname]);
- }
- $RIFFchunk[$chunkname][$thisindex]['offset'] = ftell($this->getid3->fp) - 8;
- $RIFFchunk[$chunkname][$thisindex]['size'] = $chunksize;
- switch ($chunkname) {
- case 'data':
- $info['avdataoffset'] = ftell($this->getid3->fp);
- $info['avdataend'] = $info['avdataoffset'] + $chunksize;
-
- $RIFFdataChunkContentsTest = fread($this->getid3->fp, 36);
-
- if ((strlen($RIFFdataChunkContentsTest) > 0) && preg_match('/^\xFF[\xE2-\xE7\xF2-\xF7\xFA-\xFF][\x00-\xEB]/s', substr($RIFFdataChunkContentsTest, 0, 4))) {
-
- // Probably is MP3 data
- if (getid3_mp3::MPEGaudioHeaderBytesValid(substr($RIFFdataChunkContentsTest, 0, 4))) {
- $getid3_temp = new getID3();
- $getid3_temp->openfile($this->getid3->filename);
- $getid3_temp->info['avdataoffset'] = $RIFFchunk[$chunkname][$thisindex]['offset'];
- $getid3_temp->info['avdataend'] = $RIFFchunk[$chunkname][$thisindex]['offset'] + $RIFFchunk[$chunkname][$thisindex]['size'];
- $getid3_mp3 = new getid3_mp3($getid3_temp);
- $getid3_mp3->getOnlyMPEGaudioInfo($RIFFchunk[$chunkname][$thisindex]['offset'], false);
- if (empty($getid3_temp->info['error'])) {
- $info['mpeg'] = $getid3_temp->info['mpeg'];
- $info['audio'] = $getid3_temp->info['audio'];
- }
- unset($getid3_temp, $getid3_mp3);
- }
-
- } elseif ((strlen($RIFFdataChunkContentsTest) > 0) && (substr($RIFFdataChunkContentsTest, 0, 2) == "\x0B\x77")) {
-
- // This is probably AC-3 data
- if (getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.ac3.php', __FILE__, false)) {
- $getid3_temp = new getID3();
- $getid3_temp->openfile($this->getid3->filename);
- $getid3_temp->info['avdataoffset'] = $RIFFchunk[$chunkname][$thisindex]['offset'];
- $getid3_temp->info['avdataend'] = $RIFFchunk[$chunkname][$thisindex]['offset'] + $RIFFchunk[$chunkname][$thisindex]['size'];
- $getid3_ac3 = new getid3_ac3($getid3_temp);
- $getid3_ac3->Analyze();
- if (empty($getid3_temp->info['error'])) {
- $info['audio'] = $getid3_temp->info['audio'];
- $info['ac3'] = $getid3_temp->info['ac3'];
- $info['warning'] = $getid3_temp->info['warning'];
- }
- unset($getid3_temp, $getid3_ac3);
- }
-
- } elseif ((strlen($RIFFdataChunkContentsTest) > 0) && (substr($RIFFdataChunkContentsTest, 8, 2) == "\x77\x0B")) {
-
- // Dolby Digital WAV
- // AC-3 content, but not encoded in same format as normal AC-3 file
- // For one thing, byte order is swapped
-
- if (getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.ac3.php', __FILE__, false)) {
-
- // ok to use tmpfile here - only 56 bytes
- if ($RIFFtempfilename = tempnam(GETID3_TEMP_DIR, 'id3')) {
- if ($fd_temp = fopen($RIFFtempfilename, 'wb')) {
- for ($i = 0; $i < 28; $i += 2) {
- // swap byte order
- fwrite($fd_temp, substr($RIFFdataChunkContentsTest, 8 + $i + 1, 1));
- fwrite($fd_temp, substr($RIFFdataChunkContentsTest, 8 + $i + 0, 1));
- }
- fclose($fd_temp);
-
- $getid3_temp = new getID3();
- $getid3_temp->openfile($RIFFtempfilename);
- $getid3_temp->info['avdataend'] = 20;
- $getid3_ac3 = new getid3_ac3($getid3_temp);
- $getid3_ac3->Analyze();
- if (empty($getid3_temp->info['error'])) {
- $info['audio'] = $getid3_temp->info['audio'];
- $info['ac3'] = $getid3_temp->info['ac3'];
- $info['warning'] = $getid3_temp->info['warning'];
- } else {
- $info['error'][] = 'Error parsing Dolby Digital WAV (AC3-in-RIFF): '.implode(';', $getid3_temp->info['error']);
- }
- unset($getid3_ac3, $getid3_temp);
- } else {
- $info['error'][] = 'Error parsing Dolby Digital WAV (AC3-in-RIFF): failed to write temp file';
- }
- unlink($RIFFtempfilename);
-
- } else {
- $info['error'][] = 'Error parsing Dolby Digital WAV (AC3-in-RIFF): failed to write temp file';
- }
-
- }
-
- } elseif ((strlen($RIFFdataChunkContentsTest) > 0) && (substr($RIFFdataChunkContentsTest, 0, 4) == 'wvpk')) {
-
- // This is WavPack data
- $info['wavpack']['offset'] = $RIFFchunk[$chunkname][$thisindex]['offset'];
- $info['wavpack']['size'] = getid3_lib::LittleEndian2Int(substr($RIFFdataChunkContentsTest, 4, 4));
- $this->RIFFparseWavPackHeader(substr($RIFFdataChunkContentsTest, 8, 28));
-
- } else {
-
- // This is some other kind of data (quite possibly just PCM)
- // do nothing special, just skip it
-
- }
- $nextoffset = $RIFFchunk[$chunkname][$thisindex]['offset'] + 8 + $chunksize;
- if (($nextoffset < 0) || !getid3_lib::intValueSupported($nextoffset)) {
- $info['warning'][] = 'Unable to parse chunk at offset '.$nextoffset.' because beyond '.round(PHP_INT_MAX / 1073741824).'GB limit of PHP filesystem functions';
- break 3;
- }
- fseek($this->getid3->fp, $RIFFchunk[$chunkname][$thisindex]['offset'] + 8 + $chunksize, SEEK_SET);
- break;
-
- case 'iXML':
- case 'bext':
- case 'cart':
- case 'fmt ':
- case 'strh':
- case 'strf':
- case 'indx':
- case 'MEXT':
- case 'DISP':
- // always read data in
- case 'JUNK':
- // should be: never read data in
- // but some programs write their version strings in a JUNK chunk (e.g. VirtualDub, AVIdemux, etc)
- if ($chunksize < 1048576) {
- if ($chunksize > 0) {
- $RIFFchunk[$chunkname][$thisindex]['data'] = fread($this->getid3->fp, $chunksize);
- if ($chunkname == 'JUNK') {
- if (preg_match('#^([\\x20-\\x7F]+)#', $RIFFchunk[$chunkname][$thisindex]['data'], $matches)) {
- // only keep text characters [chr(32)-chr(127)]
- $info['riff']['comments']['junk'][] = trim($matches[1]);
- }
- // but if nothing there, ignore
- // remove the key in either case
- unset($RIFFchunk[$chunkname][$thisindex]['data']);
- }
- }
- } else {
- $info['warning'][] = 'chunk "'.$chunkname.'" at offset '.ftell($this->getid3->fp).' is unexpectedly larger than 1MB (claims to be '.number_format($chunksize).' bytes), skipping data';
- $nextoffset = ftell($this->getid3->fp) + $chunksize;
- if (($nextoffset < 0) || !getid3_lib::intValueSupported($nextoffset)) {
- $info['warning'][] = 'Unable to parse chunk at offset '.$nextoffset.' because beyond '.round(PHP_INT_MAX / 1073741824).'GB limit of PHP filesystem functions';
- break 3;
- }
- fseek($this->getid3->fp, $nextoffset, SEEK_SET);
- }
- break;
-
- default:
- if (!preg_match('#^[0-9]{2}(wb|pc|dc|db)$#', $chunkname) && !empty($LISTchunkParent) && (($RIFFchunk[$chunkname][$thisindex]['offset'] + $RIFFchunk[$chunkname][$thisindex]['size']) <= $LISTchunkMaxOffset)) {
- $RIFFchunk[$LISTchunkParent][$chunkname][$thisindex]['offset'] = $RIFFchunk[$chunkname][$thisindex]['offset'];
- $RIFFchunk[$LISTchunkParent][$chunkname][$thisindex]['size'] = $RIFFchunk[$chunkname][$thisindex]['size'];
- unset($RIFFchunk[$chunkname][$thisindex]['offset']);
- unset($RIFFchunk[$chunkname][$thisindex]['size']);
- if (isset($RIFFchunk[$chunkname][$thisindex]) && empty($RIFFchunk[$chunkname][$thisindex])) {
- unset($RIFFchunk[$chunkname][$thisindex]);
- }
- if (isset($RIFFchunk[$chunkname]) && empty($RIFFchunk[$chunkname])) {
- unset($RIFFchunk[$chunkname]);
- }
- $RIFFchunk[$LISTchunkParent][$chunkname][$thisindex]['data'] = fread($this->getid3->fp, $chunksize);
- //} elseif (in_array($chunkname, array('ID3 ')) || (($chunksize > 0) && ($chunksize < 2048))) {
- } elseif (($chunksize > 0) && ($chunksize < 2048)) {
- // only read data in if smaller than 2kB
- $RIFFchunk[$chunkname][$thisindex]['data'] = fread($this->getid3->fp, $chunksize);
- } else {
- $nextoffset = ftell($this->getid3->fp) + $chunksize;
- if (($nextoffset < 0) || !getid3_lib::intValueSupported($nextoffset)) {
- $info['warning'][] = 'Unable to parse chunk at offset '.$nextoffset.' because beyond '.round(PHP_INT_MAX / 1073741824).'GB limit of PHP filesystem functions';
- break 3;
- }
- fseek($this->getid3->fp, $nextoffset, SEEK_SET);
- }
- break;
- }
- break;
-
- }
-
- }
-
- return $RIFFchunk;
- }
-
-
- function ParseRIFFdata(&$RIFFdata) {
- $info = &$this->getid3->info;
- if ($RIFFdata) {
- $tempfile = tempnam(GETID3_TEMP_DIR, 'getID3');
- $fp_temp = fopen($tempfile, 'wb');
- $RIFFdataLength = strlen($RIFFdata);
- $NewLengthString = getid3_lib::LittleEndian2String($RIFFdataLength, 4);
- for ($i = 0; $i < 4; $i++) {
- $RIFFdata{$i + 4} = $NewLengthString{$i};
- }
- fwrite($fp_temp, $RIFFdata);
- fclose($fp_temp);
-
- $getid3_temp = new getID3();
- $getid3_temp->openfile($tempfile);
- $getid3_temp->info['filesize'] = $RIFFdataLength;
- $getid3_temp->info['filenamepath'] = $info['filenamepath'];
- $getid3_temp->info['tags'] = $info['tags'];
- $getid3_temp->info['warning'] = $info['warning'];
- $getid3_temp->info['error'] = $info['error'];
- $getid3_temp->info['comments'] = $info['comments'];
- $getid3_temp->info['audio'] = (isset($info['audio']) ? $info['audio'] : array());
- $getid3_temp->info['video'] = (isset($info['video']) ? $info['video'] : array());
- $getid3_riff = new getid3_riff($getid3_temp);
- $getid3_riff->Analyze();
-
- $info['riff'] = $getid3_temp->info['riff'];
- $info['warning'] = $getid3_temp->info['warning'];
- $info['error'] = $getid3_temp->info['error'];
- $info['tags'] = $getid3_temp->info['tags'];
- $info['comments'] = $getid3_temp->info['comments'];
- unset($getid3_riff, $getid3_temp);
- unlink($tempfile);
- }
- return false;
- }
-
-
- public static function RIFFparseWAVEFORMATex($WaveFormatExData) {
- // shortcut
- $WaveFormatEx['raw'] = array();
- $WaveFormatEx_raw = &$WaveFormatEx['raw'];
-
- $WaveFormatEx_raw['wFormatTag'] = getid3_lib::LittleEndian2Int(substr($WaveFormatExData, 0, 2));
- $WaveFormatEx_raw['nChannels'] = getid3_lib::LittleEndian2Int(substr($WaveFormatExData, 2, 2));
- $WaveFormatEx_raw['nSamplesPerSec'] = getid3_lib::LittleEndian2Int(substr($WaveFormatExData, 4, 4));
- $WaveFormatEx_raw['nAvgBytesPerSec'] = getid3_lib::LittleEndian2Int(substr($WaveFormatExData, 8, 4));
- $WaveFormatEx_raw['nBlockAlign'] = getid3_lib::LittleEndian2Int(substr($WaveFormatExData, 12, 2));
- $WaveFormatEx_raw['wBitsPerSample'] = getid3_lib::LittleEndian2Int(substr($WaveFormatExData, 14, 2));
- if (strlen($WaveFormatExData) > 16) {
- $WaveFormatEx_raw['cbSize'] = getid3_lib::LittleEndian2Int(substr($WaveFormatExData, 16, 2));
- }
-
- $WaveFormatEx['codec'] = getid3_riff::RIFFwFormatTagLookup($WaveFormatEx_raw['wFormatTag']);
- $WaveFormatEx['channels'] = $WaveFormatEx_raw['nChannels'];
- $WaveFormatEx['sample_rate'] = $WaveFormatEx_raw['nSamplesPerSec'];
- $WaveFormatEx['bitrate'] = $WaveFormatEx_raw['nAvgBytesPerSec'] * 8;
- $WaveFormatEx['bits_per_sample'] = $WaveFormatEx_raw['wBitsPerSample'];
-
- return $WaveFormatEx;
- }
-
-
- function RIFFparseWavPackHeader($WavPackChunkData) {
- // typedef struct {
- // char ckID [4];
- // long ckSize;
- // short version;
- // short bits; // added for version 2.00
- // short flags, shift; // added for version 3.00
- // long total_samples, crc, crc2;
- // char extension [4], extra_bc, extras [3];
- // } WavpackHeader;
-
- // shortcut
- $info = &$this->getid3->info;
- $info['wavpack'] = array();
- $thisfile_wavpack = &$info['wavpack'];
-
- $thisfile_wavpack['version'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 0, 2));
- if ($thisfile_wavpack['version'] >= 2) {
- $thisfile_wavpack['bits'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 2, 2));
- }
- if ($thisfile_wavpack['version'] >= 3) {
- $thisfile_wavpack['flags_raw'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 4, 2));
- $thisfile_wavpack['shift'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 6, 2));
- $thisfile_wavpack['total_samples'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 8, 4));
- $thisfile_wavpack['crc1'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 12, 4));
- $thisfile_wavpack['crc2'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 16, 4));
- $thisfile_wavpack['extension'] = substr($WavPackChunkData, 20, 4);
- $thisfile_wavpack['extra_bc'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 24, 1));
- for ($i = 0; $i <= 2; $i++) {
- $thisfile_wavpack['extras'][] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 25 + $i, 1));
- }
-
- // shortcut
- $thisfile_wavpack['flags'] = array();
- $thisfile_wavpack_flags = &$thisfile_wavpack['flags'];
-
- $thisfile_wavpack_flags['mono'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000001);
- $thisfile_wavpack_flags['fast_mode'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000002);
- $thisfile_wavpack_flags['raw_mode'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000004);
- $thisfile_wavpack_flags['calc_noise'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000008);
- $thisfile_wavpack_flags['high_quality'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000010);
- $thisfile_wavpack_flags['3_byte_samples'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000020);
- $thisfile_wavpack_flags['over_20_bits'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000040);
- $thisfile_wavpack_flags['use_wvc'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000080);
- $thisfile_wavpack_flags['noiseshaping'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000100);
- $thisfile_wavpack_flags['very_fast_mode'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000200);
- $thisfile_wavpack_flags['new_high_quality'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000400);
- $thisfile_wavpack_flags['cancel_extreme'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000800);
- $thisfile_wavpack_flags['cross_decorrelation'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x001000);
- $thisfile_wavpack_flags['new_decorrelation'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x002000);
- $thisfile_wavpack_flags['joint_stereo'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x004000);
- $thisfile_wavpack_flags['extra_decorrelation'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x008000);
- $thisfile_wavpack_flags['override_noiseshape'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x010000);
- $thisfile_wavpack_flags['override_jointstereo'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x020000);
- $thisfile_wavpack_flags['copy_source_filetime'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x040000);
- $thisfile_wavpack_flags['create_exe'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x080000);
- }
-
- return true;
- }
-
- public static function ParseBITMAPINFOHEADER($BITMAPINFOHEADER, $littleEndian=true) {
-
- $functionname = ($littleEndian ? 'LittleEndian2Int' : 'BigEndian2Int');
- $parsed['biSize'] = getid3_lib::$functionname(substr($BITMAPINFOHEADER, 0, 4)); // number of bytes required by the BITMAPINFOHEADER structure
- $parsed['biWidth'] = getid3_lib::$functionname(substr($BITMAPINFOHEADER, 4, 4)); // width of the bitmap in pixels
- $parsed['biHeight'] = getid3_lib::$functionname(substr($BITMAPINFOHEADER, 8, 4)); // height of the bitmap in pixels. If biHeight is positive, the bitmap is a 'bottom-up' DIB and its origin is the lower left corner. If biHeight is negative, the bitmap is a 'top-down' DIB and its origin is the upper left corner
- $parsed['biPlanes'] = getid3_lib::$functionname(substr($BITMAPINFOHEADER, 12, 2)); // number of color planes on the target device. In most cases this value must be set to 1
- $parsed['biBitCount'] = getid3_lib::$functionname(substr($BITMAPINFOHEADER, 14, 2)); // Specifies the number of bits per pixels
- $parsed['fourcc'] = substr($BITMAPINFOHEADER, 16, 4); // compression identifier
- $parsed['biSizeImage'] = getid3_lib::$functionname(substr($BITMAPINFOHEADER, 20, 4)); // size of the bitmap data section of the image (the actual pixel data, excluding BITMAPINFOHEADER and RGBQUAD structures)
- $parsed['biXPelsPerMeter'] = getid3_lib::$functionname(substr($BITMAPINFOHEADER, 24, 4)); // horizontal resolution, in pixels per metre, of the target device
- $parsed['biYPelsPerMeter'] = getid3_lib::$functionname(substr($BITMAPINFOHEADER, 28, 4)); // vertical resolution, in pixels per metre, of the target device
- $parsed['biClrUsed'] = getid3_lib::$functionname(substr($BITMAPINFOHEADER, 32, 4)); // actual number of color indices in the color table used by the bitmap. If this value is zero, the bitmap uses the maximum number of colors corresponding to the value of the biBitCount member for the compression mode specified by biCompression
- $parsed['biClrImportant'] = getid3_lib::$functionname(substr($BITMAPINFOHEADER, 36, 4)); // number of color indices that are considered important for displaying the bitmap. If this value is zero, all colors are important
-
- return $parsed;
- }
-
- static function ParseDIVXTAG($DIVXTAG) {
- // structure from "IDivX" source, Form1.frm, by "Greg Frazier of Daemonic Software Group", email: gfrazier@icestorm.net, web: http://dsg.cjb.net/
- // source available at http://files.divx-digest.com/download/c663efe7ef8ad2e90bf4af4d3ea6188a/on0SWN2r/edit/IDivX.zip
- // 'Byte Layout: '1111111111111111
- // '32 for Movie - 1 '1111111111111111
- // '28 for Author - 6 '6666666666666666
- // '4 for year - 2 '6666666666662222
- // '3 for genre - 3 '7777777777777777
- // '48 for Comments - 7 '7777777777777777
- // '1 for Rating - 4 '7777777777777777
- // '5 for Future Additions - 0 '333400000DIVXTAG
- // '128 bytes total
-
- static $DIVXTAGgenre = array(
- 0 => 'Action',
- 1 => 'Action/Adventure',
- 2 => 'Adventure',
- 3 => 'Adult',
- 4 => 'Anime',
- 5 => 'Cartoon',
- 6 => 'Claymation',
- 7 => 'Comedy',
- 8 => 'Commercial',
- 9 => 'Documentary',
- 10 => 'Drama',
- 11 => 'Home Video',
- 12 => 'Horror',
- 13 => 'Infomercial',
- 14 => 'Interactive',
- 15 => 'Mystery',
- 16 => 'Music Video',
- 17 => 'Other',
- 18 => 'Religion',
- 19 => 'Sci Fi',
- 20 => 'Thriller',
- 21 => 'Western',
- );
- static $DIVXTAGrating = array(
- 0=>'Unrated',
- 1=>'G',
- 2=>'PG',
- 3=>'PG-13',
- 4=>'R',
- 5=>'NC-17'
- );
-
- $parsed['title'] = trim(substr($DIVXTAG, 0, 32));
- $parsed['artist'] = trim(substr($DIVXTAG, 32, 28));
- $parsed['year'] = intval(trim(substr($DIVXTAG, 60, 4)));
- $parsed['comment'] = trim(substr($DIVXTAG, 64, 48));
- $parsed['genre_id'] = intval(trim(substr($DIVXTAG, 112, 3)));
- $parsed['rating_id'] = ord(substr($DIVXTAG, 115, 1));
- //$parsed['padding'] = substr($DIVXTAG, 116, 5); // 5-byte null
- //$parsed['magic'] = substr($DIVXTAG, 121, 7); // "DIVXTAG"
-
- $parsed['genre'] = (isset($DIVXTAGgenre[$parsed['genre_id']]) ? $DIVXTAGgenre[$parsed['genre_id']] : $parsed['genre_id']);
- $parsed['rating'] = (isset($DIVXTAGrating[$parsed['rating_id']]) ? $DIVXTAGrating[$parsed['rating_id']] : $parsed['rating_id']);
- return $parsed;
- }
-
- static function RIFFwaveSNDMtagLookup($tagshortname) {
- $begin = __LINE__;
-
- /** This is not a comment!
-
- kwd keywords
- BPM bpm
- trt tracktitle
- des description
- gen category
- fin featuredinstrument
- LID longid
- bex bwdescription
- pub publisher
- cdt cdtitle
- alb library
- com composer
-
- */
-
- return getid3_lib::EmbeddedLookup($tagshortname, $begin, __LINE__, __FILE__, 'riff-sndm');
- }
-
- static function RIFFwFormatTagLookup($wFormatTag) {
-
- $begin = __LINE__;
-
- /** This is not a comment!
-
- 0x0000 Microsoft Unknown Wave Format
- 0x0001 Pulse Code Modulation (PCM)
- 0x0002 Microsoft ADPCM
- 0x0003 IEEE Float
- 0x0004 Compaq Computer VSELP
- 0x0005 IBM CVSD
- 0x0006 Microsoft A-Law
- 0x0007 Microsoft mu-Law
- 0x0008 Microsoft DTS
- 0x0010 OKI ADPCM
- 0x0011 Intel DVI/IMA ADPCM
- 0x0012 Videologic MediaSpace ADPCM
- 0x0013 Sierra Semiconductor ADPCM
- 0x0014 Antex Electronics G.723 ADPCM
- 0x0015 DSP Solutions DigiSTD
- 0x0016 DSP Solutions DigiFIX
- 0x0017 Dialogic OKI ADPCM
- 0x0018 MediaVision ADPCM
- 0x0019 Hewlett-Packard CU
- 0x0020 Yamaha ADPCM
- 0x0021 Speech Compression Sonarc
- 0x0022 DSP Group TrueSpeech
- 0x0023 Echo Speech EchoSC1
- 0x0024 Audiofile AF36
- 0x0025 Audio Processing Technology APTX
- 0x0026 AudioFile AF10
- 0x0027 Prosody 1612
- 0x0028 LRC
- 0x0030 Dolby AC2
- 0x0031 Microsoft GSM 6.10
- 0x0032 MSNAudio
- 0x0033 Antex Electronics ADPCME
- 0x0034 Control Resources VQLPC
- 0x0035 DSP Solutions DigiREAL
- 0x0036 DSP Solutions DigiADPCM
- 0x0037 Control Resources CR10
- 0x0038 Natural MicroSystems VBXADPCM
- 0x0039 Crystal Semiconductor IMA ADPCM
- 0x003A EchoSC3
- 0x003B Rockwell ADPCM
- 0x003C Rockwell Digit LK
- 0x003D Xebec
- 0x0040 Antex Electronics G.721 ADPCM
- 0x0041 G.728 CELP
- 0x0042 MSG723
- 0x0050 MPEG Layer-2 or Layer-1
- 0x0052 RT24
- 0x0053 PAC
- 0x0055 MPEG Layer-3
- 0x0059 Lucent G.723
- 0x0060 Cirrus
- 0x0061 ESPCM
- 0x0062 Voxware
- 0x0063 Canopus Atrac
- 0x0064 G.726 ADPCM
- 0x0065 G.722 ADPCM
- 0x0066 DSAT
- 0x0067 DSAT Display
- 0x0069 Voxware Byte Aligned
- 0x0070 Voxware AC8
- 0x0071 Voxware AC10
- 0x0072 Voxware AC16
- 0x0073 Voxware AC20
- 0x0074 Voxware MetaVoice
- 0x0075 Voxware MetaSound
- 0x0076 Voxware RT29HW
- 0x0077 Voxware VR12
- 0x0078 Voxware VR18
- 0x0079 Voxware TQ40
- 0x0080 Softsound
- 0x0081 Voxware TQ60
- 0x0082 MSRT24
- 0x0083 G.729A
- 0x0084 MVI MV12
- 0x0085 DF G.726
- 0x0086 DF GSM610
- 0x0088 ISIAudio
- 0x0089 Onlive
- 0x0091 SBC24
- 0x0092 Dolby AC3 SPDIF
- 0x0093 MediaSonic G.723
- 0x0094 Aculab PLC Prosody 8kbps
- 0x0097 ZyXEL ADPCM
- 0x0098 Philips LPCBB
- 0x0099 Packed
- 0x00FF AAC
- 0x0100 Rhetorex ADPCM
- 0x0101 IBM mu-law
- 0x0102 IBM A-law
- 0x0103 IBM AVC Adaptive Differential Pulse Code Modulation (ADPCM)
- 0x0111 Vivo G.723
- 0x0112 Vivo Siren
- 0x0123 Digital G.723
- 0x0125 Sanyo LD ADPCM
- 0x0130 Sipro Lab Telecom ACELP NET
- 0x0131 Sipro Lab Telecom ACELP 4800
- 0x0132 Sipro Lab Telecom ACELP 8V3
- 0x0133 Sipro Lab Telecom G.729
- 0x0134 Sipro Lab Telecom G.729A
- 0x0135 Sipro Lab Telecom Kelvin
- 0x0140 Windows Media Video V8
- 0x0150 Qualcomm PureVoice
- 0x0151 Qualcomm HalfRate
- 0x0155 Ring Zero Systems TUB GSM
- 0x0160 Microsoft Audio 1
- 0x0161 Windows Media Audio V7 / V8 / V9
- 0x0162 Windows Media Audio Professional V9
- 0x0163 Windows Media Audio Lossless V9
- 0x0200 Creative Labs ADPCM
- 0x0202 Creative Labs Fastspeech8
- 0x0203 Creative Labs Fastspeech10
- 0x0210 UHER Informatic GmbH ADPCM
- 0x0220 Quarterdeck
- 0x0230 I-link Worldwide VC
- 0x0240 Aureal RAW Sport
- 0x0250 Interactive Products HSX
- 0x0251 Interactive Products RPELP
- 0x0260 Consistent Software CS2
- 0x0270 Sony SCX
- 0x0300 Fujitsu FM Towns Snd
- 0x0400 BTV Digital
- 0x0401 Intel Music Coder
- 0x0450 QDesign Music
- 0x0680 VME VMPCM
- 0x0681 AT&T Labs TPC
- 0x08AE ClearJump LiteWave
- 0x1000 Olivetti GSM
- 0x1001 Olivetti ADPCM
- 0x1002 Olivetti CELP
- 0x1003 Olivetti SBC
- 0x1004 Olivetti OPR
- 0x1100 Lernout & Hauspie Codec (0x1100)
- 0x1101 Lernout & Hauspie CELP Codec (0x1101)
- 0x1102 Lernout & Hauspie SBC Codec (0x1102)
- 0x1103 Lernout & Hauspie SBC Codec (0x1103)
- 0x1104 Lernout & Hauspie SBC Codec (0x1104)
- 0x1400 Norris
- 0x1401 AT&T ISIAudio
- 0x1500 Soundspace Music Compression
- 0x181C VoxWare RT24 Speech
- 0x1FC4 NCT Soft ALF2CD (www.nctsoft.com)
- 0x2000 Dolby AC3
- 0x2001 Dolby DTS
- 0x2002 WAVE_FORMAT_14_4
- 0x2003 WAVE_FORMAT_28_8
- 0x2004 WAVE_FORMAT_COOK
- 0x2005 WAVE_FORMAT_DNET
- 0x674F Ogg Vorbis 1
- 0x6750 Ogg Vorbis 2
- 0x6751 Ogg Vorbis 3
- 0x676F Ogg Vorbis 1+
- 0x6770 Ogg Vorbis 2+
- 0x6771 Ogg Vorbis 3+
- 0x7A21 GSM-AMR (CBR, no SID)
- 0x7A22 GSM-AMR (VBR, including SID)
- 0xFFFE WAVE_FORMAT_EXTENSIBLE
- 0xFFFF WAVE_FORMAT_DEVELOPMENT
-
- */
-
- return getid3_lib::EmbeddedLookup('0x'.str_pad(strtoupper(dechex($wFormatTag)), 4, '0', STR_PAD_LEFT), $begin, __LINE__, __FILE__, 'riff-wFormatTag');
-
- }
-
-
- public static function RIFFfourccLookup($fourcc) {
-
- $begin = __LINE__;
-
- /** This is not a comment!
-
- swot http://developer.apple.com/qa/snd/snd07.html
- ____ No Codec (____)
- _BIT BI_BITFIELDS (Raw RGB)
- _JPG JPEG compressed
- _PNG PNG compressed W3C/ISO/IEC (RFC-2083)
- _RAW Full Frames (Uncompressed)
- _RGB Raw RGB Bitmap
- _RL4 RLE 4bpp RGB
- _RL8 RLE 8bpp RGB
- 3IV1 3ivx MPEG-4 v1
- 3IV2 3ivx MPEG-4 v2
- 3IVX 3ivx MPEG-4
- AASC Autodesk Animator
- ABYR Kensington ?ABYR?
- AEMI Array Microsystems VideoONE MPEG1-I Capture
- AFLC Autodesk Animator FLC
- AFLI Autodesk Animator FLI
- AMPG Array Microsystems VideoONE MPEG
- ANIM Intel RDX (ANIM)
- AP41 AngelPotion Definitive
- ASV1 Asus Video v1
- ASV2 Asus Video v2
- ASVX Asus Video 2.0 (audio)
- AUR2 AuraVision Aura 2 Codec - YUV 4:2:2
- AURA AuraVision Aura 1 Codec - YUV 4:1:1
- AVDJ Independent JPEG Group\'s codec (AVDJ)
- AVRN Independent JPEG Group\'s codec (AVRN)
- AYUV 4:4:4 YUV (AYUV)
- AZPR Quicktime Apple Video (AZPR)
- BGR Raw RGB32
- BLZ0 Blizzard DivX MPEG-4
- BTVC Conexant Composite Video
- BINK RAD Game Tools Bink Video
- BT20 Conexant Prosumer Video
- BTCV Conexant Composite Video Codec
- BW10 Data Translation Broadway MPEG Capture
- CC12 Intel YUV12
- CDVC Canopus DV
- CFCC Digital Processing Systems DPS Perception
- CGDI Microsoft Office 97 Camcorder Video
- CHAM Winnov Caviara Champagne
- CJPG Creative WebCam JPEG
- CLJR Cirrus Logic YUV 4:1:1
- CMYK Common Data Format in Printing (Colorgraph)
- CPLA Weitek 4:2:0 YUV Planar
- CRAM Microsoft Video 1 (CRAM)
- cvid Radius Cinepak
- CVID Radius Cinepak
- CWLT Microsoft Color WLT DIB
- CYUV Creative Labs YUV
- CYUY ATI YUV
- D261 H.261
- D263 H.263
- DIB Device Independent Bitmap
- DIV1 FFmpeg OpenDivX
- DIV2 Microsoft MPEG-4 v1/v2
- DIV3 DivX ;-) MPEG-4 v3.x Low-Motion
- DIV4 DivX ;-) MPEG-4 v3.x Fast-Motion
- DIV5 DivX MPEG-4 v5.x
- DIV6 DivX ;-) (MS MPEG-4 v3.x)
- DIVX DivX MPEG-4 v4 (OpenDivX / Project Mayo)
- divx DivX MPEG-4
- DMB1 Matrox Rainbow Runner hardware MJPEG
- DMB2 Paradigm MJPEG
- DSVD ?DSVD?
- DUCK Duck TrueMotion 1.0
- DPS0 DPS/Leitch Reality Motion JPEG
- DPSC DPS/Leitch PAR Motion JPEG
- DV25 Matrox DVCPRO codec
- DV50 Matrox DVCPRO50 codec
- DVC IEC 61834 and SMPTE 314M (DVC/DV Video)
- DVCP IEC 61834 and SMPTE 314M (DVC/DV Video)
- DVHD IEC Standard DV 1125 lines @ 30fps / 1250 lines @ 25fps
- DVMA Darim Vision DVMPEG (dummy for MPEG compressor) (www.darvision.com)
- DVSL IEC Standard DV compressed in SD (SDL)
- DVAN ?DVAN?
- DVE2 InSoft DVE-2 Videoconferencing
- dvsd IEC 61834 and SMPTE 314M DVC/DV Video
- DVSD IEC 61834 and SMPTE 314M DVC/DV Video
- DVX1 Lucent DVX1000SP Video Decoder
- DVX2 Lucent DVX2000S Video Decoder
- DVX3 Lucent DVX3000S Video Decoder
- DX50 DivX v5
- DXT1 Microsoft DirectX Compressed Texture (DXT1)
- DXT2 Microsoft DirectX Compressed Texture (DXT2)
- DXT3 Microsoft DirectX Compressed Texture (DXT3)
- DXT4 Microsoft DirectX Compressed Texture (DXT4)
- DXT5 Microsoft DirectX Compressed Texture (DXT5)
- DXTC Microsoft DirectX Compressed Texture (DXTC)
- DXTn Microsoft DirectX Compressed Texture (DXTn)
- EM2V Etymonix MPEG-2 I-frame (www.etymonix.com)
- EKQ0 Elsa ?EKQ0?
- ELK0 Elsa ?ELK0?
- ESCP Eidos Escape
- ETV1 eTreppid Video ETV1
- ETV2 eTreppid Video ETV2
- ETVC eTreppid Video ETVC
- FLIC Autodesk FLI/FLC Animation
- FLV1 Sorenson Spark
- FLV4 On2 TrueMotion VP6
- FRWT Darim Vision Forward Motion JPEG (www.darvision.com)
- FRWU Darim Vision Forward Uncompressed (www.darvision.com)
- FLJP D-Vision Field Encoded Motion JPEG
- FPS1 FRAPS v1
- FRWA SoftLab-Nsk Forward Motion JPEG w/ alpha channel
- FRWD SoftLab-Nsk Forward Motion JPEG
- FVF1 Iterated Systems Fractal Video Frame
- GLZW Motion LZW (gabest@freemail.hu)
- GPEG Motion JPEG (gabest@freemail.hu)
- GWLT Microsoft Greyscale WLT DIB
- H260 Intel ITU H.260 Videoconferencing
- H261 Intel ITU H.261 Videoconferencing
- H262 Intel ITU H.262 Videoconferencing
- H263 Intel ITU H.263 Videoconferencing
- H264 Intel ITU H.264 Videoconferencing
- H265 Intel ITU H.265 Videoconferencing
- H266 Intel ITU H.266 Videoconferencing
- H267 Intel ITU H.267 Videoconferencing
- H268 Intel ITU H.268 Videoconferencing
- H269 Intel ITU H.269 Videoconferencing
- HFYU Huffman Lossless Codec
- HMCR Rendition Motion Compensation Format (HMCR)
- HMRR Rendition Motion Compensation Format (HMRR)
- I263 FFmpeg I263 decoder
- IF09 Indeo YVU9 ("YVU9 with additional delta-frame info after the U plane")
- IUYV Interlaced version of UYVY (www.leadtools.com)
- IY41 Interlaced version of Y41P (www.leadtools.com)
- IYU1 12 bit format used in mode 2 of the IEEE 1394 Digital Camera 1.04 spec IEEE standard
- IYU2 24 bit format used in mode 2 of the IEEE 1394 Digital Camera 1.04 spec IEEE standard
- IYUV Planar YUV format (8-bpp Y plane, followed by 8-bpp 22 U and V planes)
- i263 Intel ITU H.263 Videoconferencing (i263)
- I420 Intel Indeo 4
- IAN Intel Indeo 4 (RDX)
- ICLB InSoft CellB Videoconferencing
- IGOR Power DVD
- IJPG Intergraph JPEG
- ILVC Intel Layered Video
- ILVR ITU-T H.263+
- IPDV I-O Data Device Giga AVI DV Codec
- IR21 Intel Indeo 2.1
- IRAW Intel YUV Uncompressed
- IV30 Intel Indeo 3.0
- IV31 Intel Indeo 3.1
- IV32 Ligos Indeo 3.2
- IV33 Ligos Indeo 3.3
- IV34 Ligos Indeo 3.4
- IV35 Ligos Indeo 3.5
- IV36 Ligos Indeo 3.6
- IV37 Ligos Indeo 3.7
- IV38 Ligos Indeo 3.8
- IV39 Ligos Indeo 3.9
- IV40 Ligos Indeo Interactive 4.0
- IV41 Ligos Indeo Interactive 4.1
- IV42 Ligos Indeo Interactive 4.2
- IV43 Ligos Indeo Interactive 4.3
- IV44 Ligos Indeo Interactive 4.4
- IV45 Ligos Indeo Interactive 4.5
- IV46 Ligos Indeo Interactive 4.6
- IV47 Ligos Indeo Interactive 4.7
- IV48 Ligos Indeo Interactive 4.8
- IV49 Ligos Indeo Interactive 4.9
- IV50 Ligos Indeo Interactive 5.0
- JBYR Kensington ?JBYR?
- JPEG Still Image JPEG DIB
- JPGL Pegasus Lossless Motion JPEG
- KMVC Team17 Software Karl Morton\'s Video Codec
- LSVM Vianet Lighting Strike Vmail (Streaming) (www.vianet.com)
- LEAD LEAD Video Codec
- Ljpg LEAD MJPEG Codec
- MDVD Alex MicroDVD Video (hacked MS MPEG-4) (www.tiasoft.de)
- MJPA Morgan Motion JPEG (MJPA) (www.morgan-multimedia.com)
- MJPB Morgan Motion JPEG (MJPB) (www.morgan-multimedia.com)
- MMES Matrox MPEG-2 I-frame
- MP2v Microsoft S-Mpeg 4 version 1 (MP2v)
- MP42 Microsoft S-Mpeg 4 version 2 (MP42)
- MP43 Microsoft S-Mpeg 4 version 3 (MP43)
- MP4S Microsoft S-Mpeg 4 version 3 (MP4S)
- MP4V FFmpeg MPEG-4
- MPG1 FFmpeg MPEG 1/2
- MPG2 FFmpeg MPEG 1/2
- MPG3 FFmpeg DivX ;-) (MS MPEG-4 v3)
- MPG4 Microsoft MPEG-4
- MPGI Sigma Designs MPEG
- MPNG PNG images decoder
- MSS1 Microsoft Windows Screen Video
- MSZH LCL (Lossless Codec Library) (www.geocities.co.jp/Playtown-Denei/2837/LRC.htm)
- M261 Microsoft H.261
- M263 Microsoft H.263
- M4S2 Microsoft Fully Compliant MPEG-4 v2 simple profile (M4S2)
- m4s2 Microsoft Fully Compliant MPEG-4 v2 simple profile (m4s2)
- MC12 ATI Motion Compensation Format (MC12)
- MCAM ATI Motion Compensation Format (MCAM)
- MJ2C Morgan Multimedia Motion JPEG2000
- mJPG IBM Motion JPEG w/ Huffman Tables
- MJPG Microsoft Motion JPEG DIB
- MP42 Microsoft MPEG-4 (low-motion)
- MP43 Microsoft MPEG-4 (fast-motion)
- MP4S Microsoft MPEG-4 (MP4S)
- mp4s Microsoft MPEG-4 (mp4s)
- MPEG Chromatic Research MPEG-1 Video I-Frame
- MPG4 Microsoft MPEG-4 Video High Speed Compressor
- MPGI Sigma Designs MPEG
- MRCA FAST Multimedia Martin Regen Codec
- MRLE Microsoft Run Length Encoding
- MSVC Microsoft Video 1
- MTX1 Matrox ?MTX1?
- MTX2 Matrox ?MTX2?
- MTX3 Matrox ?MTX3?
- MTX4 Matrox ?MTX4?
- MTX5 Matrox ?MTX5?
- MTX6 Matrox ?MTX6?
- MTX7 Matrox ?MTX7?
- MTX8 Matrox ?MTX8?
- MTX9 Matrox ?MTX9?
- MV12 Motion Pixels Codec (old)
- MWV1 Aware Motion Wavelets
- nAVI SMR Codec (hack of Microsoft MPEG-4) (IRC #shadowrealm)
- NT00 NewTek LightWave HDTV YUV w/ Alpha (www.newtek.com)
- NUV1 NuppelVideo
- NTN1 Nogatech Video Compression 1
- NVS0 nVidia GeForce Texture (NVS0)
- NVS1 nVidia GeForce Texture (NVS1)
- NVS2 nVidia GeForce Texture (NVS2)
- NVS3 nVidia GeForce Texture (NVS3)
- NVS4 nVidia GeForce Texture (NVS4)
- NVS5 nVidia GeForce Texture (NVS5)
- NVT0 nVidia GeForce Texture (NVT0)
- NVT1 nVidia GeForce Texture (NVT1)
- NVT2 nVidia GeForce Texture (NVT2)
- NVT3 nVidia GeForce Texture (NVT3)
- NVT4 nVidia GeForce Texture (NVT4)
- NVT5 nVidia GeForce Texture (NVT5)
- PIXL MiroXL, Pinnacle PCTV
- PDVC I-O Data Device Digital Video Capture DV codec
- PGVV Radius Video Vision
- PHMO IBM Photomotion
- PIM1 MPEG Realtime (Pinnacle Cards)
- PIM2 Pegasus Imaging ?PIM2?
- PIMJ Pegasus Imaging Lossless JPEG
- PVEZ Horizons Technology PowerEZ
- PVMM PacketVideo Corporation MPEG-4
- PVW2 Pegasus Imaging Wavelet Compression
- Q1.0 Q-Team\'s QPEG 1.0 (www.q-team.de)
- Q1.1 Q-Team\'s QPEG 1.1 (www.q-team.de)
- QPEG Q-Team QPEG 1.0
- qpeq Q-Team QPEG 1.1
- RGB Raw BGR32
- RGBA Raw RGB w/ Alpha
- RMP4 REALmagic MPEG-4 (unauthorized XVID copy) (www.sigmadesigns.com)
- ROQV Id RoQ File Video Decoder
- RPZA Quicktime Apple Video (RPZA)
- RUD0 Rududu video codec (http://rududu.ifrance.com/rududu/)
- RV10 RealVideo 1.0 (aka RealVideo 5.0)
- RV13 RealVideo 1.0 (RV13)
- RV20 RealVideo G2
- RV30 RealVideo 8
- RV40 RealVideo 9
- RGBT Raw RGB w/ Transparency
- RLE Microsoft Run Length Encoder
- RLE4 Run Length Encoded (4bpp, 16-color)
- RLE8 Run Length Encoded (8bpp, 256-color)
- RT21 Intel Indeo RealTime Video 2.1
- rv20 RealVideo G2
- rv30 RealVideo 8
- RVX Intel RDX (RVX )
- SMC Apple Graphics (SMC )
- SP54 Logitech Sunplus Sp54 Codec for Mustek GSmart Mini 2
- SPIG Radius Spigot
- SVQ3 Sorenson Video 3 (Apple Quicktime 5)
- s422 Tekram VideoCap C210 YUV 4:2:2
- SDCC Sun Communication Digital Camera Codec
- SFMC CrystalNet Surface Fitting Method
- SMSC Radius SMSC
- SMSD Radius SMSD
- smsv WorldConnect Wavelet Video
- SPIG Radius Spigot
- SPLC Splash Studios ACM Audio Codec (www.splashstudios.net)
- SQZ2 Microsoft VXTreme Video Codec V2
- STVA ST Microelectronics CMOS Imager Data (Bayer)
- STVB ST Microelectronics CMOS Imager Data (Nudged Bayer)
- STVC ST Microelectronics CMOS Imager Data (Bunched)
- STVX ST Microelectronics CMOS Imager Data (Extended CODEC Data Format)
- STVY ST Microelectronics CMOS Imager Data (Extended CODEC Data Format with Correction Data)
- SV10 Sorenson Video R1
- SVQ1 Sorenson Video
- T420 Toshiba YUV 4:2:0
- TM2A Duck TrueMotion Archiver 2.0 (www.duck.com)
- TVJP Pinnacle/Truevision Targa 2000 board (TVJP)
- TVMJ Pinnacle/Truevision Targa 2000 board (TVMJ)
- TY0N Tecomac Low-Bit Rate Codec (www.tecomac.com)
- TY2C Trident Decompression Driver
- TLMS TeraLogic Motion Intraframe Codec (TLMS)
- TLST TeraLogic Motion Intraframe Codec (TLST)
- TM20 Duck TrueMotion 2.0
- TM2X Duck TrueMotion 2X
- TMIC TeraLogic Motion Intraframe Codec (TMIC)
- TMOT Horizons Technology TrueMotion S
- tmot Horizons TrueMotion Video Compression
- TR20 Duck TrueMotion RealTime 2.0
- TSCC TechSmith Screen Capture Codec
- TV10 Tecomac Low-Bit Rate Codec
- TY2N Trident ?TY2N?
- U263 UB Video H.263/H.263+/H.263++ Decoder
- UMP4 UB Video MPEG 4 (www.ubvideo.com)
- UYNV Nvidia UYVY packed 4:2:2
- UYVP Evans & Sutherland YCbCr 4:2:2 extended precision
- UCOD eMajix.com ClearVideo
- ULTI IBM Ultimotion
- UYVY UYVY packed 4:2:2
- V261 Lucent VX2000S
- VIFP VFAPI Reader Codec (www.yks.ne.jp/~hori/)
- VIV1 FFmpeg H263+ decoder
- VIV2 Vivo H.263
- VQC2 Vector-quantised codec 2 (research) http://eprints.ecs.soton.ac.uk/archive/00001310/01/VTC97-js.pdf)
- VTLP Alaris VideoGramPiX
- VYU9 ATI YUV (VYU9)
- VYUY ATI YUV (VYUY)
- V261 Lucent VX2000S
- V422 Vitec Multimedia 24-bit YUV 4:2:2 Format
- V655 Vitec Multimedia 16-bit YUV 4:2:2 Format
- VCR1 ATI Video Codec 1
- VCR2 ATI Video Codec 2
- VCR3 ATI VCR 3.0
- VCR4 ATI VCR 4.0
- VCR5 ATI VCR 5.0
- VCR6 ATI VCR 6.0
- VCR7 ATI VCR 7.0
- VCR8 ATI VCR 8.0
- VCR9 ATI VCR 9.0
- VDCT Vitec Multimedia Video Maker Pro DIB
- VDOM VDOnet VDOWave
- VDOW VDOnet VDOLive (H.263)
- VDTZ Darim Vison VideoTizer YUV
- VGPX Alaris VideoGramPiX
- VIDS Vitec Multimedia YUV 4:2:2 CCIR 601 for V422
- VIVO Vivo H.263 v2.00
- vivo Vivo H.263
- VIXL Miro/Pinnacle Video XL
- VLV1 VideoLogic/PURE Digital Videologic Capture
- VP30 On2 VP3.0
- VP31 On2 VP3.1
- VP6F On2 TrueMotion VP6
- VX1K Lucent VX1000S Video Codec
- VX2K Lucent VX2000S Video Codec
- VXSP Lucent VX1000SP Video Codec
- WBVC Winbond W9960
- WHAM Microsoft Video 1 (WHAM)
- WINX Winnov Software Compression
- WJPG AverMedia Winbond JPEG
- WMV1 Windows Media Video V7
- WMV2 Windows Media Video V8
- WMV3 Windows Media Video V9
- WNV1 Winnov Hardware Compression
- XYZP Extended PAL format XYZ palette (www.riff.org)
- x263 Xirlink H.263
- XLV0 NetXL Video Decoder
- XMPG Xing MPEG (I-Frame only)
- XVID XviD MPEG-4 (www.xvid.org)
- XXAN ?XXAN?
- YU92 Intel YUV (YU92)
- YUNV Nvidia Uncompressed YUV 4:2:2
- YUVP Extended PAL format YUV palette (www.riff.org)
- Y211 YUV 2:1:1 Packed
- Y411 YUV 4:1:1 Packed
- Y41B Weitek YUV 4:1:1 Planar
- Y41P Brooktree PC1 YUV 4:1:1 Packed
- Y41T Brooktree PC1 YUV 4:1:1 with transparency
- Y42B Weitek YUV 4:2:2 Planar
- Y42T Brooktree UYUV 4:2:2 with transparency
- Y422 ADS Technologies Copy of UYVY used in Pyro WebCam firewire camera
- Y800 Simple, single Y plane for monochrome images
- Y8 Grayscale video
- YC12 Intel YUV 12 codec
- YUV8 Winnov Caviar YUV8
- YUV9 Intel YUV9
- YUY2 Uncompressed YUV 4:2:2
- YUYV Canopus YUV
- YV12 YVU12 Planar
- YVU9 Intel YVU9 Planar (8-bpp Y plane, followed by 8-bpp 4x4 U and V planes)
- YVYU YVYU 4:2:2 Packed
- ZLIB Lossless Codec Library zlib compression (www.geocities.co.jp/Playtown-Denei/2837/LRC.htm)
- ZPEG Metheus Video Zipper
-
- */
-
- return getid3_lib::EmbeddedLookup($fourcc, $begin, __LINE__, __FILE__, 'riff-fourcc');
- }
-
-
- function EitherEndian2Int($byteword, $signed=false) {
- if ($this->getid3->info['fileformat'] == 'riff') {
- return getid3_lib::LittleEndian2Int($byteword, $signed);
- }
- return getid3_lib::BigEndian2Int($byteword, false, $signed);
- }
-
-}
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.audio-video.swf.php b/3rdparty/getid3/module.audio-video.swf.php
deleted file mode 100644
index a3d49f9506a..00000000000
--- a/3rdparty/getid3/module.audio-video.swf.php
+++ /dev/null
@@ -1,142 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.audio-video.swf.php //
-// module for analyzing Shockwave Flash files //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_swf extends getid3_handler
-{
- var $ReturnAllTagData = false;
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- $info['fileformat'] = 'swf';
- $info['video']['dataformat'] = 'swf';
-
- // http://www.openswf.org/spec/SWFfileformat.html
-
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
-
- $SWFfileData = fread($this->getid3->fp, $info['avdataend'] - $info['avdataoffset']); // 8 + 2 + 2 + max(9) bytes NOT including Frame_Size RECT data
-
- $info['swf']['header']['signature'] = substr($SWFfileData, 0, 3);
- switch ($info['swf']['header']['signature']) {
- case 'FWS':
- $info['swf']['header']['compressed'] = false;
- break;
-
- case 'CWS':
- $info['swf']['header']['compressed'] = true;
- break;
-
- default:
- $info['error'][] = 'Expecting "FWS" or "CWS" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($info['swf']['header']['signature']).'"';
- unset($info['swf']);
- unset($info['fileformat']);
- return false;
- break;
- }
- $info['swf']['header']['version'] = getid3_lib::LittleEndian2Int(substr($SWFfileData, 3, 1));
- $info['swf']['header']['length'] = getid3_lib::LittleEndian2Int(substr($SWFfileData, 4, 4));
-
- if ($info['swf']['header']['compressed']) {
- $SWFHead = substr($SWFfileData, 0, 8);
- $SWFfileData = substr($SWFfileData, 8);
- if ($decompressed = @gzuncompress($SWFfileData)) {
- $SWFfileData = $SWFHead.$decompressed;
- } else {
- $info['error'][] = 'Error decompressing compressed SWF data ('.strlen($SWFfileData).' bytes compressed, should be '.($info['swf']['header']['length'] - 8).' bytes uncompressed)';
- return false;
- }
- }
-
- $FrameSizeBitsPerValue = (ord(substr($SWFfileData, 8, 1)) & 0xF8) >> 3;
- $FrameSizeDataLength = ceil((5 + (4 * $FrameSizeBitsPerValue)) / 8);
- $FrameSizeDataString = str_pad(decbin(ord(substr($SWFfileData, 8, 1)) & 0x07), 3, '0', STR_PAD_LEFT);
- for ($i = 1; $i < $FrameSizeDataLength; $i++) {
- $FrameSizeDataString .= str_pad(decbin(ord(substr($SWFfileData, 8 + $i, 1))), 8, '0', STR_PAD_LEFT);
- }
- list($X1, $X2, $Y1, $Y2) = explode("\n", wordwrap($FrameSizeDataString, $FrameSizeBitsPerValue, "\n", 1));
- $info['swf']['header']['frame_width'] = getid3_lib::Bin2Dec($X2);
- $info['swf']['header']['frame_height'] = getid3_lib::Bin2Dec($Y2);
-
- // http://www-lehre.informatik.uni-osnabrueck.de/~fbstark/diplom/docs/swf/Flash_Uncovered.htm
- // Next in the header is the frame rate, which is kind of weird.
- // It is supposed to be stored as a 16bit integer, but the first byte
- // (or last depending on how you look at it) is completely ignored.
- // Example: 0x000C -> 0x0C -> 12 So the frame rate is 12 fps.
-
- // Byte at (8 + $FrameSizeDataLength) is always zero and ignored
- $info['swf']['header']['frame_rate'] = getid3_lib::LittleEndian2Int(substr($SWFfileData, 9 + $FrameSizeDataLength, 1));
- $info['swf']['header']['frame_count'] = getid3_lib::LittleEndian2Int(substr($SWFfileData, 10 + $FrameSizeDataLength, 2));
-
- $info['video']['frame_rate'] = $info['swf']['header']['frame_rate'];
- $info['video']['resolution_x'] = intval(round($info['swf']['header']['frame_width'] / 20));
- $info['video']['resolution_y'] = intval(round($info['swf']['header']['frame_height'] / 20));
- $info['video']['pixel_aspect_ratio'] = (float) 1;
-
- if (($info['swf']['header']['frame_count'] > 0) && ($info['swf']['header']['frame_rate'] > 0)) {
- $info['playtime_seconds'] = $info['swf']['header']['frame_count'] / $info['swf']['header']['frame_rate'];
- }
-//echo __LINE__.'='.number_format(microtime(true) - $start_time, 3).'<br>';
-
-
- // SWF tags
-
- $CurrentOffset = 12 + $FrameSizeDataLength;
- $SWFdataLength = strlen($SWFfileData);
-
- while ($CurrentOffset < $SWFdataLength) {
-//echo __LINE__.'='.number_format(microtime(true) - $start_time, 3).'<br>';
-
- $TagIDTagLength = getid3_lib::LittleEndian2Int(substr($SWFfileData, $CurrentOffset, 2));
- $TagID = ($TagIDTagLength & 0xFFFC) >> 6;
- $TagLength = ($TagIDTagLength & 0x003F);
- $CurrentOffset += 2;
- if ($TagLength == 0x3F) {
- $TagLength = getid3_lib::LittleEndian2Int(substr($SWFfileData, $CurrentOffset, 4));
- $CurrentOffset += 4;
- }
-
- unset($TagData);
- $TagData['offset'] = $CurrentOffset;
- $TagData['size'] = $TagLength;
- $TagData['id'] = $TagID;
- $TagData['data'] = substr($SWFfileData, $CurrentOffset, $TagLength);
- switch ($TagID) {
- case 0: // end of movie
- break 2;
-
- case 9: // Set background color
- //$info['swf']['tags'][] = $TagData;
- $info['swf']['bgcolor'] = strtoupper(str_pad(dechex(getid3_lib::BigEndian2Int($TagData['data'])), 6, '0', STR_PAD_LEFT));
- break;
-
- default:
- if ($this->ReturnAllTagData) {
- $info['swf']['tags'][] = $TagData;
- }
- break;
- }
-
- $CurrentOffset += $TagLength;
- }
-
- return true;
- }
-
-}
-
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.audio.aa.php b/3rdparty/getid3/module.audio.aa.php
deleted file mode 100644
index 39cb77c859d..00000000000
--- a/3rdparty/getid3/module.audio.aa.php
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.audio.aa.php //
-// module for analyzing Audible Audiobook files //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_aa extends getid3_handler
-{
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
- $AAheader = fread($this->getid3->fp, 8);
-
- $magic = "\x57\x90\x75\x36";
- if (substr($AAheader, 4, 4) != $magic) {
- $info['error'][] = 'Expecting "'.getid3_lib::PrintHexBytes($magic).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes(substr($AAheader, 4, 4)).'"';
- return false;
- }
-
- // shortcut
- $info['aa'] = array();
- $thisfile_au = &$info['aa'];
-
- $info['fileformat'] = 'aa';
- $info['audio']['dataformat'] = 'aa';
- $info['audio']['bitrate_mode'] = 'cbr'; // is it?
- $thisfile_au['encoding'] = 'ISO-8859-1';
-
- $thisfile_au['filesize'] = getid3_lib::BigEndian2Int(substr($AUheader, 0, 4));
- if ($thisfile_au['filesize'] > ($info['avdataend'] - $info['avdataoffset'])) {
- $info['warning'][] = 'Possible truncated file - expecting "'.$thisfile_au['filesize'].'" bytes of data, only found '.($info['avdataend'] - $info['avdataoffset']).' bytes"';
- }
-
- $info['audio']['bits_per_sample'] = 16; // is it?
- $info['audio']['sample_rate'] = $thisfile_au['sample_rate'];
- $info['audio']['channels'] = $thisfile_au['channels'];
-
- //$info['playtime_seconds'] = 0;
- //$info['audio']['bitrate'] = 0;
-
- return true;
- }
-
-}
-
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.audio.aac.php b/3rdparty/getid3/module.audio.aac.php
deleted file mode 100644
index d573e11d783..00000000000
--- a/3rdparty/getid3/module.audio.aac.php
+++ /dev/null
@@ -1,515 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.audio.aac.php //
-// module for analyzing AAC Audio files //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_aac extends getid3_handler
-{
- function Analyze() {
- $info = &$this->getid3->info;
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
- if (fread($this->getid3->fp, 4) == 'ADIF') {
- $this->getAACADIFheaderFilepointer();
- } else {
- $this->getAACADTSheaderFilepointer();
- }
- return true;
- }
-
-
-
- function getAACADIFheaderFilepointer() {
- $info = &$this->getid3->info;
- $info['fileformat'] = 'aac';
- $info['audio']['dataformat'] = 'aac';
- $info['audio']['lossless'] = false;
-
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
- $AACheader = fread($this->getid3->fp, 1024);
- $offset = 0;
-
- if (substr($AACheader, 0, 4) == 'ADIF') {
-
- // http://faac.sourceforge.net/wiki/index.php?page=ADIF
-
- // http://libmpeg.org/mpeg4/doc/w2203tfs.pdf
- // adif_header() {
- // adif_id 32
- // copyright_id_present 1
- // if( copyright_id_present )
- // copyright_id 72
- // original_copy 1
- // home 1
- // bitstream_type 1
- // bitrate 23
- // num_program_config_elements 4
- // for (i = 0; i < num_program_config_elements + 1; i++ ) {
- // if( bitstream_type == '0' )
- // adif_buffer_fullness 20
- // program_config_element()
- // }
- // }
-
- $AACheaderBitstream = getid3_lib::BigEndian2Bin($AACheader);
- $bitoffset = 0;
-
- $info['aac']['header_type'] = 'ADIF';
- $bitoffset += 32;
- $info['aac']['header']['mpeg_version'] = 4;
-
- $info['aac']['header']['copyright'] = (bool) (substr($AACheaderBitstream, $bitoffset, 1) == '1');
- $bitoffset += 1;
- if ($info['aac']['header']['copyright']) {
- $info['aac']['header']['copyright_id'] = getid3_lib::Bin2String(substr($AACheaderBitstream, $bitoffset, 72));
- $bitoffset += 72;
- }
- $info['aac']['header']['original_copy'] = (bool) (substr($AACheaderBitstream, $bitoffset, 1) == '1');
- $bitoffset += 1;
- $info['aac']['header']['home'] = (bool) (substr($AACheaderBitstream, $bitoffset, 1) == '1');
- $bitoffset += 1;
- $info['aac']['header']['is_vbr'] = (bool) (substr($AACheaderBitstream, $bitoffset, 1) == '1');
- $bitoffset += 1;
- if ($info['aac']['header']['is_vbr']) {
- $info['audio']['bitrate_mode'] = 'vbr';
- $info['aac']['header']['bitrate_max'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 23));
- $bitoffset += 23;
- } else {
- $info['audio']['bitrate_mode'] = 'cbr';
- $info['aac']['header']['bitrate'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 23));
- $bitoffset += 23;
- $info['audio']['bitrate'] = $info['aac']['header']['bitrate'];
- }
- if ($info['audio']['bitrate'] == 0) {
- $info['error'][] = 'Corrupt AAC file: bitrate_audio == zero';
- return false;
- }
- $info['aac']['header']['num_program_configs'] = 1 + getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4));
- $bitoffset += 4;
-
- for ($i = 0; $i < $info['aac']['header']['num_program_configs']; $i++) {
- // http://www.audiocoding.com/wiki/index.php?page=program_config_element
-
- // buffer_fullness 20
-
- // element_instance_tag 4
- // object_type 2
- // sampling_frequency_index 4
- // num_front_channel_elements 4
- // num_side_channel_elements 4
- // num_back_channel_elements 4
- // num_lfe_channel_elements 2
- // num_assoc_data_elements 3
- // num_valid_cc_elements 4
- // mono_mixdown_present 1
- // mono_mixdown_element_number 4 if mono_mixdown_present == 1
- // stereo_mixdown_present 1
- // stereo_mixdown_element_number 4 if stereo_mixdown_present == 1
- // matrix_mixdown_idx_present 1
- // matrix_mixdown_idx 2 if matrix_mixdown_idx_present == 1
- // pseudo_surround_enable 1 if matrix_mixdown_idx_present == 1
- // for (i = 0; i < num_front_channel_elements; i++) {
- // front_element_is_cpe[i] 1
- // front_element_tag_select[i] 4
- // }
- // for (i = 0; i < num_side_channel_elements; i++) {
- // side_element_is_cpe[i] 1
- // side_element_tag_select[i] 4
- // }
- // for (i = 0; i < num_back_channel_elements; i++) {
- // back_element_is_cpe[i] 1
- // back_element_tag_select[i] 4
- // }
- // for (i = 0; i < num_lfe_channel_elements; i++) {
- // lfe_element_tag_select[i] 4
- // }
- // for (i = 0; i < num_assoc_data_elements; i++) {
- // assoc_data_element_tag_select[i] 4
- // }
- // for (i = 0; i < num_valid_cc_elements; i++) {
- // cc_element_is_ind_sw[i] 1
- // valid_cc_element_tag_select[i] 4
- // }
- // byte_alignment() VAR
- // comment_field_bytes 8
- // for (i = 0; i < comment_field_bytes; i++) {
- // comment_field_data[i] 8
- // }
-
- if (!$info['aac']['header']['is_vbr']) {
- $info['aac']['program_configs'][$i]['buffer_fullness'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 20));
- $bitoffset += 20;
- }
- $info['aac']['program_configs'][$i]['element_instance_tag'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4));
- $bitoffset += 4;
- $info['aac']['program_configs'][$i]['object_type'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 2));
- $bitoffset += 2;
- $info['aac']['program_configs'][$i]['sampling_frequency_index'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4));
- $bitoffset += 4;
- $info['aac']['program_configs'][$i]['num_front_channel_elements'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4));
- $bitoffset += 4;
- $info['aac']['program_configs'][$i]['num_side_channel_elements'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4));
- $bitoffset += 4;
- $info['aac']['program_configs'][$i]['num_back_channel_elements'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4));
- $bitoffset += 4;
- $info['aac']['program_configs'][$i]['num_lfe_channel_elements'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 2));
- $bitoffset += 2;
- $info['aac']['program_configs'][$i]['num_assoc_data_elements'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 3));
- $bitoffset += 3;
- $info['aac']['program_configs'][$i]['num_valid_cc_elements'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4));
- $bitoffset += 4;
- $info['aac']['program_configs'][$i]['mono_mixdown_present'] = (bool) getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 1));
- $bitoffset += 1;
- if ($info['aac']['program_configs'][$i]['mono_mixdown_present']) {
- $info['aac']['program_configs'][$i]['mono_mixdown_element_number'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4));
- $bitoffset += 4;
- }
- $info['aac']['program_configs'][$i]['stereo_mixdown_present'] = (bool) getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 1));
- $bitoffset += 1;
- if ($info['aac']['program_configs'][$i]['stereo_mixdown_present']) {
- $info['aac']['program_configs'][$i]['stereo_mixdown_element_number'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4));
- $bitoffset += 4;
- }
- $info['aac']['program_configs'][$i]['matrix_mixdown_idx_present'] = (bool) getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 1));
- $bitoffset += 1;
- if ($info['aac']['program_configs'][$i]['matrix_mixdown_idx_present']) {
- $info['aac']['program_configs'][$i]['matrix_mixdown_idx'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 2));
- $bitoffset += 2;
- $info['aac']['program_configs'][$i]['pseudo_surround_enable'] = (bool) getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 1));
- $bitoffset += 1;
- }
- for ($j = 0; $j < $info['aac']['program_configs'][$i]['num_front_channel_elements']; $j++) {
- $info['aac']['program_configs'][$i]['front_element_is_cpe'][$j] = (bool) getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 1));
- $bitoffset += 1;
- $info['aac']['program_configs'][$i]['front_element_tag_select'][$j] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4));
- $bitoffset += 4;
- }
- for ($j = 0; $j < $info['aac']['program_configs'][$i]['num_side_channel_elements']; $j++) {
- $info['aac']['program_configs'][$i]['side_element_is_cpe'][$j] = (bool) getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 1));
- $bitoffset += 1;
- $info['aac']['program_configs'][$i]['side_element_tag_select'][$j] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4));
- $bitoffset += 4;
- }
- for ($j = 0; $j < $info['aac']['program_configs'][$i]['num_back_channel_elements']; $j++) {
- $info['aac']['program_configs'][$i]['back_element_is_cpe'][$j] = (bool) getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 1));
- $bitoffset += 1;
- $info['aac']['program_configs'][$i]['back_element_tag_select'][$j] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4));
- $bitoffset += 4;
- }
- for ($j = 0; $j < $info['aac']['program_configs'][$i]['num_lfe_channel_elements']; $j++) {
- $info['aac']['program_configs'][$i]['lfe_element_tag_select'][$j] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4));
- $bitoffset += 4;
- }
- for ($j = 0; $j < $info['aac']['program_configs'][$i]['num_assoc_data_elements']; $j++) {
- $info['aac']['program_configs'][$i]['assoc_data_element_tag_select'][$j] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4));
- $bitoffset += 4;
- }
- for ($j = 0; $j < $info['aac']['program_configs'][$i]['num_valid_cc_elements']; $j++) {
- $info['aac']['program_configs'][$i]['cc_element_is_ind_sw'][$j] = (bool) getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 1));
- $bitoffset += 1;
- $info['aac']['program_configs'][$i]['valid_cc_element_tag_select'][$j] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 4));
- $bitoffset += 4;
- }
-
- $bitoffset = ceil($bitoffset / 8) * 8;
-
- $info['aac']['program_configs'][$i]['comment_field_bytes'] = getid3_lib::Bin2Dec(substr($AACheaderBitstream, $bitoffset, 8));
- $bitoffset += 8;
- $info['aac']['program_configs'][$i]['comment_field'] = getid3_lib::Bin2String(substr($AACheaderBitstream, $bitoffset, 8 * $info['aac']['program_configs'][$i]['comment_field_bytes']));
- $bitoffset += 8 * $info['aac']['program_configs'][$i]['comment_field_bytes'];
-
-
- $info['aac']['header']['profile'] = self::AACprofileLookup($info['aac']['program_configs'][$i]['object_type'], $info['aac']['header']['mpeg_version']);
- $info['aac']['program_configs'][$i]['sampling_frequency'] = self::AACsampleRateLookup($info['aac']['program_configs'][$i]['sampling_frequency_index']);
- $info['audio']['sample_rate'] = $info['aac']['program_configs'][$i]['sampling_frequency'];
- $info['audio']['channels'] = self::AACchannelCountCalculate($info['aac']['program_configs'][$i]);
- if ($info['aac']['program_configs'][$i]['comment_field']) {
- $info['aac']['comments'][] = $info['aac']['program_configs'][$i]['comment_field'];
- }
- }
- $info['playtime_seconds'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['audio']['bitrate'];
-
- $info['audio']['encoder_options'] = $info['aac']['header_type'].' '.$info['aac']['header']['profile'];
-
-
-
- return true;
-
- } else {
-
- unset($info['fileformat']);
- unset($info['aac']);
- $info['error'][] = 'AAC-ADIF synch not found at offset '.$info['avdataoffset'].' (expected "ADIF", found "'.substr($AACheader, 0, 4).'" instead)';
- return false;
-
- }
-
- }
-
-
- function getAACADTSheaderFilepointer($MaxFramesToScan=1000000, $ReturnExtendedInfo=false) {
- $info = &$this->getid3->info;
-
- // based loosely on code from AACfile by Jurgen Faul <jfaulgmx.de>
- // http://jfaul.de/atl or http://j-faul.virtualave.net/atl/atl.html
-
-
- // http://faac.sourceforge.net/wiki/index.php?page=ADTS // dead link
- // http://wiki.multimedia.cx/index.php?title=ADTS
-
- // * ADTS Fixed Header: these don't change from frame to frame
- // syncword 12 always: '111111111111'
- // ID 1 0: MPEG-4, 1: MPEG-2
- // MPEG layer 2 If you send AAC in MPEG-TS, set to 0
- // protection_absent 1 0: CRC present; 1: no CRC
- // profile 2 0: AAC Main; 1: AAC LC (Low Complexity); 2: AAC SSR (Scalable Sample Rate); 3: AAC LTP (Long Term Prediction)
- // sampling_frequency_index 4 15 not allowed
- // private_bit 1 usually 0
- // channel_configuration 3
- // original/copy 1 0: original; 1: copy
- // home 1 usually 0
- // emphasis 2 only if ID == 0 (ie MPEG-4) // not present in some documentation?
-
- // * ADTS Variable Header: these can change from frame to frame
- // copyright_identification_bit 1
- // copyright_identification_start 1
- // aac_frame_length 13 length of the frame including header (in bytes)
- // adts_buffer_fullness 11 0x7FF indicates VBR
- // no_raw_data_blocks_in_frame 2
-
- // * ADTS Error check
- // crc_check 16 only if protection_absent == 0
-
- $byteoffset = $info['avdataoffset'];
- $framenumber = 0;
-
- // Init bit pattern array
- static $decbin = array();
-
- // Populate $bindec
- for ($i = 0; $i < 256; $i++) {
- $decbin[chr($i)] = str_pad(decbin($i), 8, '0', STR_PAD_LEFT);
- }
-
- // used to calculate bitrate below
- $BitrateCache = array();
-
-
- while (true) {
- // breaks out when end-of-file encountered, or invalid data found,
- // or MaxFramesToScan frames have been scanned
-
- if (!getid3_lib::intValueSupported($byteoffset)) {
- $info['warning'][] = 'Unable to parse AAC file beyond '.ftell($this->getid3->fp).' (PHP does not support file operations beyond '.round(PHP_INT_MAX / 1073741824).'GB)';
- return false;
- }
- fseek($this->getid3->fp, $byteoffset, SEEK_SET);
-
- // First get substring
- $substring = fread($this->getid3->fp, 9); // header is 7 bytes (or 9 if CRC is present)
- $substringlength = strlen($substring);
- if ($substringlength != 9) {
- $info['error'][] = 'Failed to read 7 bytes at offset '.(ftell($this->getid3->fp) - $substringlength).' (only read '.$substringlength.' bytes)';
- return false;
- }
- // this would be easier with 64-bit math, but split it up to allow for 32-bit:
- $header1 = getid3_lib::BigEndian2Int(substr($substring, 0, 2));
- $header2 = getid3_lib::BigEndian2Int(substr($substring, 2, 4));
- $header3 = getid3_lib::BigEndian2Int(substr($substring, 6, 1));
-
- $info['aac']['header']['raw']['syncword'] = ($header1 & 0xFFF0) >> 4;
- if ($info['aac']['header']['raw']['syncword'] != 0x0FFF) {
- $info['error'][] = 'Synch pattern (0x0FFF) not found at offset '.(ftell($this->getid3->fp) - $substringlength).' (found 0x0'.strtoupper(dechex($info['aac']['header']['raw']['syncword'])).' instead)';
- //if ($info['fileformat'] == 'aac') {
- // return true;
- //}
- unset($info['aac']);
- return false;
- }
-
- // Gather info for first frame only - this takes time to do 1000 times!
- if ($framenumber == 0) {
- $info['aac']['header_type'] = 'ADTS';
- $info['fileformat'] = 'aac';
- $info['audio']['dataformat'] = 'aac';
-
- $info['aac']['header']['raw']['mpeg_version'] = ($header1 & 0x0008) >> 3;
- $info['aac']['header']['raw']['mpeg_layer'] = ($header1 & 0x0006) >> 1;
- $info['aac']['header']['raw']['protection_absent'] = ($header1 & 0x0001) >> 0;
-
- $info['aac']['header']['raw']['profile_code'] = ($header2 & 0xC0000000) >> 30;
- $info['aac']['header']['raw']['sample_rate_code'] = ($header2 & 0x3C000000) >> 26;
- $info['aac']['header']['raw']['private_stream'] = ($header2 & 0x02000000) >> 25;
- $info['aac']['header']['raw']['channels_code'] = ($header2 & 0x01C00000) >> 22;
- $info['aac']['header']['raw']['original'] = ($header2 & 0x00200000) >> 21;
- $info['aac']['header']['raw']['home'] = ($header2 & 0x00100000) >> 20;
- $info['aac']['header']['raw']['copyright_stream'] = ($header2 & 0x00080000) >> 19;
- $info['aac']['header']['raw']['copyright_start'] = ($header2 & 0x00040000) >> 18;
- $info['aac']['header']['raw']['frame_length'] = ($header2 & 0x0003FFE0) >> 5;
-
- $info['aac']['header']['mpeg_version'] = ($info['aac']['header']['raw']['mpeg_version'] ? 2 : 4);
- $info['aac']['header']['crc_present'] = ($info['aac']['header']['raw']['protection_absent'] ? false: true);
- $info['aac']['header']['profile'] = self::AACprofileLookup($info['aac']['header']['raw']['profile_code'], $info['aac']['header']['mpeg_version']);
- $info['aac']['header']['sample_frequency'] = self::AACsampleRateLookup($info['aac']['header']['raw']['sample_rate_code']);
- $info['aac']['header']['private'] = (bool) $info['aac']['header']['raw']['private_stream'];
- $info['aac']['header']['original'] = (bool) $info['aac']['header']['raw']['original'];
- $info['aac']['header']['home'] = (bool) $info['aac']['header']['raw']['home'];
- $info['aac']['header']['channels'] = (($info['aac']['header']['raw']['channels_code'] == 7) ? 8 : $info['aac']['header']['raw']['channels_code']);
- if ($ReturnExtendedInfo) {
- $info['aac'][$framenumber]['copyright_id_bit'] = (bool) $info['aac']['header']['raw']['copyright_stream'];
- $info['aac'][$framenumber]['copyright_id_start'] = (bool) $info['aac']['header']['raw']['copyright_start'];
- }
-
- if ($info['aac']['header']['raw']['mpeg_layer'] != 0) {
- $info['warning'][] = 'Layer error - expected "0", found "'.$info['aac']['header']['raw']['mpeg_layer'].'" instead';
- }
- if ($info['aac']['header']['sample_frequency'] == 0) {
- $info['error'][] = 'Corrupt AAC file: sample_frequency == zero';
- return false;
- }
-
- $info['audio']['sample_rate'] = $info['aac']['header']['sample_frequency'];
- $info['audio']['channels'] = $info['aac']['header']['channels'];
- }
-
- $FrameLength = ($header2 & 0x0003FFE0) >> 5;
-
- if (!isset($BitrateCache[$FrameLength])) {
- $BitrateCache[$FrameLength] = ($info['aac']['header']['sample_frequency'] / 1024) * $FrameLength * 8;
- }
- getid3_lib::safe_inc($info['aac']['bitrate_distribution'][$BitrateCache[$FrameLength]], 1);
-
- $info['aac'][$framenumber]['aac_frame_length'] = $FrameLength;
-
- $info['aac'][$framenumber]['adts_buffer_fullness'] = (($header2 & 0x0000001F) << 6) & (($header3 & 0xFC) >> 2);
- if ($info['aac'][$framenumber]['adts_buffer_fullness'] == 0x07FF) {
- $info['audio']['bitrate_mode'] = 'vbr';
- } else {
- $info['audio']['bitrate_mode'] = 'cbr';
- }
- $info['aac'][$framenumber]['num_raw_data_blocks'] = (($header3 & 0x03) >> 0);
-
- if ($info['aac']['header']['crc_present']) {
- //$info['aac'][$framenumber]['crc'] = getid3_lib::BigEndian2Int(substr($substring, 7, 2);
- }
-
- if (!$ReturnExtendedInfo) {
- unset($info['aac'][$framenumber]);
- }
-
- /*
- $rounded_precision = 5000;
- $info['aac']['bitrate_distribution_rounded'] = array();
- foreach ($info['aac']['bitrate_distribution'] as $bitrate => $count) {
- $rounded_bitrate = round($bitrate / $rounded_precision) * $rounded_precision;
- getid3_lib::safe_inc($info['aac']['bitrate_distribution_rounded'][$rounded_bitrate], $count);
- }
- ksort($info['aac']['bitrate_distribution_rounded']);
- */
-
- $byteoffset += $FrameLength;
- if ((++$framenumber < $MaxFramesToScan) && (($byteoffset + 10) < $info['avdataend'])) {
-
- // keep scanning
-
- } else {
-
- $info['aac']['frames'] = $framenumber;
- $info['playtime_seconds'] = ($info['avdataend'] / $byteoffset) * (($framenumber * 1024) / $info['aac']['header']['sample_frequency']); // (1 / % of file scanned) * (samples / (samples/sec)) = seconds
- if ($info['playtime_seconds'] == 0) {
- $info['error'][] = 'Corrupt AAC file: playtime_seconds == zero';
- return false;
- }
- $info['audio']['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds'];
- ksort($info['aac']['bitrate_distribution']);
-
- $info['audio']['encoder_options'] = $info['aac']['header_type'].' '.$info['aac']['header']['profile'];
-
- return true;
-
- }
- }
- // should never get here.
- }
-
- public static function AACsampleRateLookup($samplerateid) {
- static $AACsampleRateLookup = array();
- if (empty($AACsampleRateLookup)) {
- $AACsampleRateLookup[0] = 96000;
- $AACsampleRateLookup[1] = 88200;
- $AACsampleRateLookup[2] = 64000;
- $AACsampleRateLookup[3] = 48000;
- $AACsampleRateLookup[4] = 44100;
- $AACsampleRateLookup[5] = 32000;
- $AACsampleRateLookup[6] = 24000;
- $AACsampleRateLookup[7] = 22050;
- $AACsampleRateLookup[8] = 16000;
- $AACsampleRateLookup[9] = 12000;
- $AACsampleRateLookup[10] = 11025;
- $AACsampleRateLookup[11] = 8000;
- $AACsampleRateLookup[12] = 0;
- $AACsampleRateLookup[13] = 0;
- $AACsampleRateLookup[14] = 0;
- $AACsampleRateLookup[15] = 0;
- }
- return (isset($AACsampleRateLookup[$samplerateid]) ? $AACsampleRateLookup[$samplerateid] : 'invalid');
- }
-
- public static function AACprofileLookup($profileid, $mpegversion) {
- static $AACprofileLookup = array();
- if (empty($AACprofileLookup)) {
- $AACprofileLookup[2][0] = 'Main profile';
- $AACprofileLookup[2][1] = 'Low Complexity profile (LC)';
- $AACprofileLookup[2][2] = 'Scalable Sample Rate profile (SSR)';
- $AACprofileLookup[2][3] = '(reserved)';
- $AACprofileLookup[4][0] = 'AAC_MAIN';
- $AACprofileLookup[4][1] = 'AAC_LC';
- $AACprofileLookup[4][2] = 'AAC_SSR';
- $AACprofileLookup[4][3] = 'AAC_LTP';
- }
- return (isset($AACprofileLookup[$mpegversion][$profileid]) ? $AACprofileLookup[$mpegversion][$profileid] : 'invalid');
- }
-
- public static function AACchannelCountCalculate($program_configs) {
- $channels = 0;
- for ($i = 0; $i < $program_configs['num_front_channel_elements']; $i++) {
- $channels++;
- if ($program_configs['front_element_is_cpe'][$i]) {
- // each front element is channel pair (CPE = Channel Pair Element)
- $channels++;
- }
- }
- for ($i = 0; $i < $program_configs['num_side_channel_elements']; $i++) {
- $channels++;
- if ($program_configs['side_element_is_cpe'][$i]) {
- // each side element is channel pair (CPE = Channel Pair Element)
- $channels++;
- }
- }
- for ($i = 0; $i < $program_configs['num_back_channel_elements']; $i++) {
- $channels++;
- if ($program_configs['back_element_is_cpe'][$i]) {
- // each back element is channel pair (CPE = Channel Pair Element)
- $channels++;
- }
- }
- for ($i = 0; $i < $program_configs['num_lfe_channel_elements']; $i++) {
- $channels++;
- }
- return $channels;
- }
-
-}
-
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.audio.ac3.php b/3rdparty/getid3/module.audio.ac3.php
deleted file mode 100644
index ffe01746891..00000000000
--- a/3rdparty/getid3/module.audio.ac3.php
+++ /dev/null
@@ -1,473 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.audio.ac3.php //
-// module for analyzing AC-3 (aka Dolby Digital) audio files //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_ac3 extends getid3_handler
-{
- private $AC3header = '';
- private $BSIoffset = 0;
-
-
- public function Analyze() {
- $info = &$this->getid3->info;
-
- ///AH
- $info['ac3']['raw']['bsi'] = array();
- $thisfile_ac3 = &$info['ac3'];
- $thisfile_ac3_raw = &$thisfile_ac3['raw'];
- $thisfile_ac3_raw_bsi = &$thisfile_ac3_raw['bsi'];
-
-
- // http://www.atsc.org/standards/a_52a.pdf
-
- $info['fileformat'] = 'ac3';
-
- // An AC-3 serial coded audio bit stream is made up of a sequence of synchronization frames
- // Each synchronization frame contains 6 coded audio blocks (AB), each of which represent 256
- // new audio samples per channel. A synchronization information (SI) header at the beginning
- // of each frame contains information needed to acquire and maintain synchronization. A
- // bit stream information (BSI) header follows SI, and contains parameters describing the coded
- // audio service. The coded audio blocks may be followed by an auxiliary data (Aux) field. At the
- // end of each frame is an error check field that includes a CRC word for error detection. An
- // additional CRC word is located in the SI header, the use of which, by a decoder, is optional.
- //
- // syncinfo() | bsi() | AB0 | AB1 | AB2 | AB3 | AB4 | AB5 | Aux | CRC
-
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
- $this->AC3header['syncinfo'] = fread($this->getid3->fp, 5);
- $thisfile_ac3_raw['synchinfo']['synchword'] = substr($this->AC3header['syncinfo'], 0, 2);
-
- $magic = "\x0B\x77";
- if ($thisfile_ac3_raw['synchinfo']['synchword'] != $magic) {
- $info['error'][] = 'Expecting "'.getid3_lib::PrintHexBytes($magic).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($thisfile_ac3_raw['synchinfo']['synchword']).'"';
- unset($info['fileformat'], $info['ac3']);
- return false;
- }
-
- $info['audio']['dataformat'] = 'ac3';
- $info['audio']['bitrate_mode'] = 'cbr';
- $info['audio']['lossless'] = false;
-
- // syncinfo() {
- // syncword 16
- // crc1 16
- // fscod 2
- // frmsizecod 6
- // } /* end of syncinfo */
-
- $thisfile_ac3_raw['synchinfo']['crc1'] = getid3_lib::LittleEndian2Int(substr($this->AC3header['syncinfo'], 2, 2));
- $ac3_synchinfo_fscod_frmsizecod = getid3_lib::LittleEndian2Int(substr($this->AC3header['syncinfo'], 4, 1));
- $thisfile_ac3_raw['synchinfo']['fscod'] = ($ac3_synchinfo_fscod_frmsizecod & 0xC0) >> 6;
- $thisfile_ac3_raw['synchinfo']['frmsizecod'] = ($ac3_synchinfo_fscod_frmsizecod & 0x3F);
-
- $thisfile_ac3['sample_rate'] = $this->AC3sampleRateCodeLookup($thisfile_ac3_raw['synchinfo']['fscod']);
- if ($thisfile_ac3_raw['synchinfo']['fscod'] <= 3) {
- $info['audio']['sample_rate'] = $thisfile_ac3['sample_rate'];
- }
-
- $thisfile_ac3['frame_length'] = $this->AC3frameSizeLookup($thisfile_ac3_raw['synchinfo']['frmsizecod'], $thisfile_ac3_raw['synchinfo']['fscod']);
- $thisfile_ac3['bitrate'] = $this->AC3bitrateLookup($thisfile_ac3_raw['synchinfo']['frmsizecod']);
- $info['audio']['bitrate'] = $thisfile_ac3['bitrate'];
-
- $this->AC3header['bsi'] = getid3_lib::BigEndian2Bin(fread($this->getid3->fp, 15));
- $ac3_bsi_offset = 0;
-
- $thisfile_ac3_raw_bsi['bsid'] = $this->readHeaderBSI(5);
- if ($thisfile_ac3_raw_bsi['bsid'] > 8) {
- // Decoders which can decode version 8 will thus be able to decode version numbers less than 8.
- // If this standard is extended by the addition of additional elements or features, a value of bsid greater than 8 will be used.
- // Decoders built to this version of the standard will not be able to decode versions with bsid greater than 8.
- $info['error'][] = 'Bit stream identification is version '.$thisfile_ac3_raw_bsi['bsid'].', but getID3() only understands up to version 8';
- unset($thisfile_ac3);
- return false;
- }
-
- $thisfile_ac3_raw_bsi['bsmod'] = $this->readHeaderBSI(3);
- $thisfile_ac3_raw_bsi['acmod'] = $this->readHeaderBSI(3);
-
- $thisfile_ac3['service_type'] = $this->AC3serviceTypeLookup($thisfile_ac3_raw_bsi['bsmod'], $thisfile_ac3_raw_bsi['acmod']);
- $ac3_coding_mode = $this->AC3audioCodingModeLookup($thisfile_ac3_raw_bsi['acmod']);
- foreach($ac3_coding_mode as $key => $value) {
- $thisfile_ac3[$key] = $value;
- }
- switch ($thisfile_ac3_raw_bsi['acmod']) {
- case 0:
- case 1:
- $info['audio']['channelmode'] = 'mono';
- break;
- case 3:
- case 4:
- $info['audio']['channelmode'] = 'stereo';
- break;
- default:
- $info['audio']['channelmode'] = 'surround';
- break;
- }
- $info['audio']['channels'] = $thisfile_ac3['num_channels'];
-
- if ($thisfile_ac3_raw_bsi['acmod'] & 0x01) {
- // If the lsb of acmod is a 1, center channel is in use and cmixlev follows in the bit stream.
- $thisfile_ac3_raw_bsi['cmixlev'] = $this->readHeaderBSI(2);
- $thisfile_ac3['center_mix_level'] = $this->AC3centerMixLevelLookup($thisfile_ac3_raw_bsi['cmixlev']);
- }
-
- if ($thisfile_ac3_raw_bsi['acmod'] & 0x04) {
- // If the msb of acmod is a 1, surround channels are in use and surmixlev follows in the bit stream.
- $thisfile_ac3_raw_bsi['surmixlev'] = $this->readHeaderBSI(2);
- $thisfile_ac3['surround_mix_level'] = $this->AC3surroundMixLevelLookup($thisfile_ac3_raw_bsi['surmixlev']);
- }
-
- if ($thisfile_ac3_raw_bsi['acmod'] == 0x02) {
- // When operating in the two channel mode, this 2-bit code indicates whether or not the program has been encoded in Dolby Surround.
- $thisfile_ac3_raw_bsi['dsurmod'] = $this->readHeaderBSI(2);
- $thisfile_ac3['dolby_surround_mode'] = $this->AC3dolbySurroundModeLookup($thisfile_ac3_raw_bsi['dsurmod']);
- }
-
- $thisfile_ac3_raw_bsi['lfeon'] = (bool) $this->readHeaderBSI(1);
- $thisfile_ac3['lfe_enabled'] = $thisfile_ac3_raw_bsi['lfeon'];
- if ($thisfile_ac3_raw_bsi['lfeon']) {
- //$info['audio']['channels']++;
- $info['audio']['channels'] .= '.1';
- }
-
- $thisfile_ac3['channels_enabled'] = $this->AC3channelsEnabledLookup($thisfile_ac3_raw_bsi['acmod'], $thisfile_ac3_raw_bsi['lfeon']);
-
- // This indicates how far the average dialogue level is below digital 100 percent. Valid values are 131.
- // The value of 0 is reserved. The values of 1 to 31 are interpreted as -1 dB to -31 dB with respect to digital 100 percent.
- $thisfile_ac3_raw_bsi['dialnorm'] = $this->readHeaderBSI(5);
- $thisfile_ac3['dialogue_normalization'] = '-'.$thisfile_ac3_raw_bsi['dialnorm'].'dB';
-
- $thisfile_ac3_raw_bsi['compre_flag'] = (bool) $this->readHeaderBSI(1);
- if ($thisfile_ac3_raw_bsi['compre_flag']) {
- $thisfile_ac3_raw_bsi['compr'] = $this->readHeaderBSI(8);
- $thisfile_ac3['heavy_compression'] = $this->AC3heavyCompression($thisfile_ac3_raw_bsi['compr']);
- }
-
- $thisfile_ac3_raw_bsi['langcode_flag'] = (bool) $this->readHeaderBSI(1);
- if ($thisfile_ac3_raw_bsi['langcode_flag']) {
- $thisfile_ac3_raw_bsi['langcod'] = $this->readHeaderBSI(8);
- }
-
- $thisfile_ac3_raw_bsi['audprodie'] = (bool) $this->readHeaderBSI(1);
- if ($thisfile_ac3_raw_bsi['audprodie']) {
- $thisfile_ac3_raw_bsi['mixlevel'] = $this->readHeaderBSI(5);
- $thisfile_ac3_raw_bsi['roomtyp'] = $this->readHeaderBSI(2);
-
- $thisfile_ac3['mixing_level'] = (80 + $thisfile_ac3_raw_bsi['mixlevel']).'dB';
- $thisfile_ac3['room_type'] = $this->AC3roomTypeLookup($thisfile_ac3_raw_bsi['roomtyp']);
- }
-
- if ($thisfile_ac3_raw_bsi['acmod'] == 0x00) {
- // If acmod is 0, then two completely independent program channels (dual mono)
- // are encoded into the bit stream, and are referenced as Ch1, Ch2. In this case,
- // a number of additional items are present in BSI or audblk to fully describe Ch2.
-
- // This indicates how far the average dialogue level is below digital 100 percent. Valid values are 131.
- // The value of 0 is reserved. The values of 1 to 31 are interpreted as -1 dB to -31 dB with respect to digital 100 percent.
- $thisfile_ac3_raw_bsi['dialnorm2'] = $this->readHeaderBSI(5);
- $thisfile_ac3['dialogue_normalization2'] = '-'.$thisfile_ac3_raw_bsi['dialnorm2'].'dB';
-
- $thisfile_ac3_raw_bsi['compre_flag2'] = (bool) $this->readHeaderBSI(1);
- if ($thisfile_ac3_raw_bsi['compre_flag2']) {
- $thisfile_ac3_raw_bsi['compr2'] = $this->readHeaderBSI(8);
- $thisfile_ac3['heavy_compression2'] = $this->AC3heavyCompression($thisfile_ac3_raw_bsi['compr2']);
- }
-
- $thisfile_ac3_raw_bsi['langcode_flag2'] = (bool) $this->readHeaderBSI(1);
- if ($thisfile_ac3_raw_bsi['langcode_flag2']) {
- $thisfile_ac3_raw_bsi['langcod2'] = $this->readHeaderBSI(8);
- }
-
- $thisfile_ac3_raw_bsi['audprodie2'] = (bool) $this->readHeaderBSI(1);
- if ($thisfile_ac3_raw_bsi['audprodie2']) {
- $thisfile_ac3_raw_bsi['mixlevel2'] = $this->readHeaderBSI(5);
- $thisfile_ac3_raw_bsi['roomtyp2'] = $this->readHeaderBSI(2);
-
- $thisfile_ac3['mixing_level2'] = (80 + $thisfile_ac3_raw_bsi['mixlevel2']).'dB';
- $thisfile_ac3['room_type2'] = $this->AC3roomTypeLookup($thisfile_ac3_raw_bsi['roomtyp2']);
- }
-
- }
-
- $thisfile_ac3_raw_bsi['copyright'] = (bool) $this->readHeaderBSI(1);
-
- $thisfile_ac3_raw_bsi['original'] = (bool) $this->readHeaderBSI(1);
-
- $thisfile_ac3_raw_bsi['timecode1_flag'] = (bool) $this->readHeaderBSI(1);
- if ($thisfile_ac3_raw_bsi['timecode1_flag']) {
- $thisfile_ac3_raw_bsi['timecode1'] = $this->readHeaderBSI(14);
- }
-
- $thisfile_ac3_raw_bsi['timecode2_flag'] = (bool) $this->readHeaderBSI(1);
- if ($thisfile_ac3_raw_bsi['timecode2_flag']) {
- $thisfile_ac3_raw_bsi['timecode2'] = $this->readHeaderBSI(14);
- }
-
- $thisfile_ac3_raw_bsi['addbsi_flag'] = (bool) $this->readHeaderBSI(1);
- if ($thisfile_ac3_raw_bsi['addbsi_flag']) {
- $thisfile_ac3_raw_bsi['addbsi_length'] = $this->readHeaderBSI(6);
-
- $this->AC3header['bsi'] .= getid3_lib::BigEndian2Bin(fread($this->getid3->fp, $thisfile_ac3_raw_bsi['addbsi_length']));
-
- $thisfile_ac3_raw_bsi['addbsi_data'] = substr($this->AC3header['bsi'], $this->BSIoffset, $thisfile_ac3_raw_bsi['addbsi_length'] * 8);
- $this->BSIoffset += $thisfile_ac3_raw_bsi['addbsi_length'] * 8;
- }
-
- return true;
- }
-
- private function readHeaderBSI($length) {
- $data = substr($this->AC3header['bsi'], $this->BSIoffset, $length);
- $this->BSIoffset += $length;
-
- return bindec($data);
- }
-
- public static function AC3sampleRateCodeLookup($fscod) {
- static $AC3sampleRateCodeLookup = array(
- 0 => 48000,
- 1 => 44100,
- 2 => 32000,
- 3 => 'reserved' // If the reserved code is indicated, the decoder should not attempt to decode audio and should mute.
- );
- return (isset($AC3sampleRateCodeLookup[$fscod]) ? $AC3sampleRateCodeLookup[$fscod] : false);
- }
-
- public static function AC3serviceTypeLookup($bsmod, $acmod) {
- static $AC3serviceTypeLookup = array();
- if (empty($AC3serviceTypeLookup)) {
- for ($i = 0; $i <= 7; $i++) {
- $AC3serviceTypeLookup[0][$i] = 'main audio service: complete main (CM)';
- $AC3serviceTypeLookup[1][$i] = 'main audio service: music and effects (ME)';
- $AC3serviceTypeLookup[2][$i] = 'associated service: visually impaired (VI)';
- $AC3serviceTypeLookup[3][$i] = 'associated service: hearing impaired (HI)';
- $AC3serviceTypeLookup[4][$i] = 'associated service: dialogue (D)';
- $AC3serviceTypeLookup[5][$i] = 'associated service: commentary (C)';
- $AC3serviceTypeLookup[6][$i] = 'associated service: emergency (E)';
- }
-
- $AC3serviceTypeLookup[7][1] = 'associated service: voice over (VO)';
- for ($i = 2; $i <= 7; $i++) {
- $AC3serviceTypeLookup[7][$i] = 'main audio service: karaoke';
- }
- }
- return (isset($AC3serviceTypeLookup[$bsmod][$acmod]) ? $AC3serviceTypeLookup[$bsmod][$acmod] : false);
- }
-
- public static function AC3audioCodingModeLookup($acmod) {
- static $AC3audioCodingModeLookup = array();
- if (empty($AC3audioCodingModeLookup)) {
- // array(channel configuration, # channels (not incl LFE), channel order)
- $AC3audioCodingModeLookup = array (
- 0 => array('channel_config'=>'1+1', 'num_channels'=>2, 'channel_order'=>'Ch1,Ch2'),
- 1 => array('channel_config'=>'1/0', 'num_channels'=>1, 'channel_order'=>'C'),
- 2 => array('channel_config'=>'2/0', 'num_channels'=>2, 'channel_order'=>'L,R'),
- 3 => array('channel_config'=>'3/0', 'num_channels'=>3, 'channel_order'=>'L,C,R'),
- 4 => array('channel_config'=>'2/1', 'num_channels'=>3, 'channel_order'=>'L,R,S'),
- 5 => array('channel_config'=>'3/1', 'num_channels'=>4, 'channel_order'=>'L,C,R,S'),
- 6 => array('channel_config'=>'2/2', 'num_channels'=>4, 'channel_order'=>'L,R,SL,SR'),
- 7 => array('channel_config'=>'3/2', 'num_channels'=>5, 'channel_order'=>'L,C,R,SL,SR')
- );
- }
- return (isset($AC3audioCodingModeLookup[$acmod]) ? $AC3audioCodingModeLookup[$acmod] : false);
- }
-
- public static function AC3centerMixLevelLookup($cmixlev) {
- static $AC3centerMixLevelLookup;
- if (empty($AC3centerMixLevelLookup)) {
- $AC3centerMixLevelLookup = array(
- 0 => pow(2, -3.0 / 6), // 0.707 (3.0 dB)
- 1 => pow(2, -4.5 / 6), // 0.595 (4.5 dB)
- 2 => pow(2, -6.0 / 6), // 0.500 (6.0 dB)
- 3 => 'reserved'
- );
- }
- return (isset($AC3centerMixLevelLookup[$cmixlev]) ? $AC3centerMixLevelLookup[$cmixlev] : false);
- }
-
- public static function AC3surroundMixLevelLookup($surmixlev) {
- static $AC3surroundMixLevelLookup;
- if (empty($AC3surroundMixLevelLookup)) {
- $AC3surroundMixLevelLookup = array(
- 0 => pow(2, -3.0 / 6),
- 1 => pow(2, -6.0 / 6),
- 2 => 0,
- 3 => 'reserved'
- );
- }
- return (isset($AC3surroundMixLevelLookup[$surmixlev]) ? $AC3surroundMixLevelLookup[$surmixlev] : false);
- }
-
- public static function AC3dolbySurroundModeLookup($dsurmod) {
- static $AC3dolbySurroundModeLookup = array(
- 0 => 'not indicated',
- 1 => 'Not Dolby Surround encoded',
- 2 => 'Dolby Surround encoded',
- 3 => 'reserved'
- );
- return (isset($AC3dolbySurroundModeLookup[$dsurmod]) ? $AC3dolbySurroundModeLookup[$dsurmod] : false);
- }
-
- public static function AC3channelsEnabledLookup($acmod, $lfeon) {
- $AC3channelsEnabledLookup = array(
- 'ch1'=>(bool) ($acmod == 0),
- 'ch2'=>(bool) ($acmod == 0),
- 'left'=>(bool) ($acmod > 1),
- 'right'=>(bool) ($acmod > 1),
- 'center'=>(bool) ($acmod & 0x01),
- 'surround_mono'=>false,
- 'surround_left'=>false,
- 'surround_right'=>false,
- 'lfe'=>$lfeon);
- switch ($acmod) {
- case 4:
- case 5:
- $AC3channelsEnabledLookup['surround_mono'] = true;
- break;
- case 6:
- case 7:
- $AC3channelsEnabledLookup['surround_left'] = true;
- $AC3channelsEnabledLookup['surround_right'] = true;
- break;
- }
- return $AC3channelsEnabledLookup;
- }
-
- public static function AC3heavyCompression($compre) {
- // The first four bits indicate gain changes in 6.02dB increments which can be
- // implemented with an arithmetic shift operation. The following four bits
- // indicate linear gain changes, and require a 5-bit multiply.
- // We will represent the two 4-bit fields of compr as follows:
- // X0 X1 X2 X3 . Y4 Y5 Y6 Y7
- // The meaning of the X values is most simply described by considering X to represent a 4-bit
- // signed integer with values from 8 to +7. The gain indicated by X is then (X + 1) * 6.02 dB. The
- // following table shows this in detail.
-
- // Meaning of 4 msb of compr
- // 7 +48.16 dB
- // 6 +42.14 dB
- // 5 +36.12 dB
- // 4 +30.10 dB
- // 3 +24.08 dB
- // 2 +18.06 dB
- // 1 +12.04 dB
- // 0 +6.02 dB
- // -1 0 dB
- // -2 6.02 dB
- // -3 12.04 dB
- // -4 18.06 dB
- // -5 24.08 dB
- // -6 30.10 dB
- // -7 36.12 dB
- // -8 42.14 dB
-
- $fourbit = str_pad(decbin(($compre & 0xF0) >> 4), 4, '0', STR_PAD_LEFT);
- if ($fourbit{0} == '1') {
- $log_gain = -8 + bindec(substr($fourbit, 1));
- } else {
- $log_gain = bindec(substr($fourbit, 1));
- }
- $log_gain = ($log_gain + 1) * getid3_lib::RGADamplitude2dB(2);
-
- // The value of Y is a linear representation of a gain change of up to 6 dB. Y is considered to
- // be an unsigned fractional integer, with a leading value of 1, or: 0.1 Y4 Y5 Y6 Y7 (base 2). Y can
- // represent values between 0.111112 (or 31/32) and 0.100002 (or 1/2). Thus, Y can represent gain
- // changes from 0.28 dB to 6.02 dB.
-
- $lin_gain = (16 + ($compre & 0x0F)) / 32;
-
- // The combination of X and Y values allows compr to indicate gain changes from
- // 48.16 0.28 = +47.89 dB, to
- // 42.14 6.02 = 48.16 dB.
-
- return $log_gain - $lin_gain;
- }
-
- public static function AC3roomTypeLookup($roomtyp) {
- static $AC3roomTypeLookup = array(
- 0 => 'not indicated',
- 1 => 'large room, X curve monitor',
- 2 => 'small room, flat monitor',
- 3 => 'reserved'
- );
- return (isset($AC3roomTypeLookup[$roomtyp]) ? $AC3roomTypeLookup[$roomtyp] : false);
- }
-
- public static function AC3frameSizeLookup($frmsizecod, $fscod) {
- $padding = (bool) ($frmsizecod % 2);
- $framesizeid = floor($frmsizecod / 2);
-
- static $AC3frameSizeLookup = array();
- if (empty($AC3frameSizeLookup)) {
- $AC3frameSizeLookup = array (
- 0 => array(128, 138, 192),
- 1 => array(40, 160, 174, 240),
- 2 => array(48, 192, 208, 288),
- 3 => array(56, 224, 242, 336),
- 4 => array(64, 256, 278, 384),
- 5 => array(80, 320, 348, 480),
- 6 => array(96, 384, 416, 576),
- 7 => array(112, 448, 486, 672),
- 8 => array(128, 512, 556, 768),
- 9 => array(160, 640, 696, 960),
- 10 => array(192, 768, 834, 1152),
- 11 => array(224, 896, 974, 1344),
- 12 => array(256, 1024, 1114, 1536),
- 13 => array(320, 1280, 1392, 1920),
- 14 => array(384, 1536, 1670, 2304),
- 15 => array(448, 1792, 1950, 2688),
- 16 => array(512, 2048, 2228, 3072),
- 17 => array(576, 2304, 2506, 3456),
- 18 => array(640, 2560, 2786, 3840)
- );
- }
- if (($fscod == 1) && $padding) {
- // frame lengths are padded by 1 word (16 bits) at 44100
- $AC3frameSizeLookup[$frmsizecod] += 2;
- }
- return (isset($AC3frameSizeLookup[$framesizeid][$fscod]) ? $AC3frameSizeLookup[$framesizeid][$fscod] : false);
- }
-
- public static function AC3bitrateLookup($frmsizecod) {
- $framesizeid = floor($frmsizecod / 2);
-
- static $AC3bitrateLookup = array(
- 0 => 32000,
- 1 => 40000,
- 2 => 48000,
- 3 => 56000,
- 4 => 64000,
- 5 => 80000,
- 6 => 96000,
- 7 => 112000,
- 8 => 128000,
- 9 => 160000,
- 10 => 192000,
- 11 => 224000,
- 12 => 256000,
- 13 => 320000,
- 14 => 384000,
- 15 => 448000,
- 16 => 512000,
- 17 => 576000,
- 18 => 640000
- );
- return (isset($AC3bitrateLookup[$framesizeid]) ? $AC3bitrateLookup[$framesizeid] : false);
- }
-
-
-}
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.audio.au.php b/3rdparty/getid3/module.audio.au.php
deleted file mode 100644
index a1094dbcda6..00000000000
--- a/3rdparty/getid3/module.audio.au.php
+++ /dev/null
@@ -1,165 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.audio.au.php //
-// module for analyzing AU files //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_au extends getid3_handler
-{
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
- $AUheader = fread($this->getid3->fp, 8);
-
- $magic = '.snd';
- if (substr($AUheader, 0, 4) != $magic) {
- $info['error'][] = 'Expecting "'.getid3_lib::PrintHexBytes($magic).'" (".snd") at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes(substr($AUheader, 0, 4)).'"';
- return false;
- }
-
- // shortcut
- $info['au'] = array();
- $thisfile_au = &$info['au'];
-
- $info['fileformat'] = 'au';
- $info['audio']['dataformat'] = 'au';
- $info['audio']['bitrate_mode'] = 'cbr';
- $thisfile_au['encoding'] = 'ISO-8859-1';
-
- $thisfile_au['header_length'] = getid3_lib::BigEndian2Int(substr($AUheader, 4, 4));
- $AUheader .= fread($this->getid3->fp, $thisfile_au['header_length'] - 8);
- $info['avdataoffset'] += $thisfile_au['header_length'];
-
- $thisfile_au['data_size'] = getid3_lib::BigEndian2Int(substr($AUheader, 8, 4));
- $thisfile_au['data_format_id'] = getid3_lib::BigEndian2Int(substr($AUheader, 12, 4));
- $thisfile_au['sample_rate'] = getid3_lib::BigEndian2Int(substr($AUheader, 16, 4));
- $thisfile_au['channels'] = getid3_lib::BigEndian2Int(substr($AUheader, 20, 4));
- $thisfile_au['comments']['comment'][] = trim(substr($AUheader, 24));
-
- $thisfile_au['data_format'] = $this->AUdataFormatNameLookup($thisfile_au['data_format_id']);
- $thisfile_au['used_bits_per_sample'] = $this->AUdataFormatUsedBitsPerSampleLookup($thisfile_au['data_format_id']);
- if ($thisfile_au['bits_per_sample'] = $this->AUdataFormatBitsPerSampleLookup($thisfile_au['data_format_id'])) {
- $info['audio']['bits_per_sample'] = $thisfile_au['bits_per_sample'];
- } else {
- unset($thisfile_au['bits_per_sample']);
- }
-
- $info['audio']['sample_rate'] = $thisfile_au['sample_rate'];
- $info['audio']['channels'] = $thisfile_au['channels'];
-
- if (($info['avdataoffset'] + $thisfile_au['data_size']) > $info['avdataend']) {
- $info['warning'][] = 'Possible truncated file - expecting "'.$thisfile_au['data_size'].'" bytes of audio data, only found '.($info['avdataend'] - $info['avdataoffset']).' bytes"';
- }
-
- $info['playtime_seconds'] = $thisfile_au['data_size'] / ($thisfile_au['sample_rate'] * $thisfile_au['channels'] * ($thisfile_au['used_bits_per_sample'] / 8));
- $info['audio']['bitrate'] = ($thisfile_au['data_size'] * 8) / $info['playtime_seconds'];
-
- return true;
- }
-
- function AUdataFormatNameLookup($id) {
- static $AUdataFormatNameLookup = array(
- 0 => 'unspecified format',
- 1 => '8-bit mu-law',
- 2 => '8-bit linear',
- 3 => '16-bit linear',
- 4 => '24-bit linear',
- 5 => '32-bit linear',
- 6 => 'floating-point',
- 7 => 'double-precision float',
- 8 => 'fragmented sampled data',
- 9 => 'SUN_FORMAT_NESTED',
- 10 => 'DSP program',
- 11 => '8-bit fixed-point',
- 12 => '16-bit fixed-point',
- 13 => '24-bit fixed-point',
- 14 => '32-bit fixed-point',
-
- 16 => 'non-audio display data',
- 17 => 'SND_FORMAT_MULAW_SQUELCH',
- 18 => '16-bit linear with emphasis',
- 19 => '16-bit linear with compression',
- 20 => '16-bit linear with emphasis + compression',
- 21 => 'Music Kit DSP commands',
- 22 => 'SND_FORMAT_DSP_COMMANDS_SAMPLES',
- 23 => 'CCITT g.721 4-bit ADPCM',
- 24 => 'CCITT g.722 ADPCM',
- 25 => 'CCITT g.723 3-bit ADPCM',
- 26 => 'CCITT g.723 5-bit ADPCM',
- 27 => 'A-Law 8-bit'
- );
- return (isset($AUdataFormatNameLookup[$id]) ? $AUdataFormatNameLookup[$id] : false);
- }
-
- function AUdataFormatBitsPerSampleLookup($id) {
- static $AUdataFormatBitsPerSampleLookup = array(
- 1 => 8,
- 2 => 8,
- 3 => 16,
- 4 => 24,
- 5 => 32,
- 6 => 32,
- 7 => 64,
-
- 11 => 8,
- 12 => 16,
- 13 => 24,
- 14 => 32,
-
- 18 => 16,
- 19 => 16,
- 20 => 16,
-
- 23 => 16,
-
- 25 => 16,
- 26 => 16,
- 27 => 8
- );
- return (isset($AUdataFormatBitsPerSampleLookup[$id]) ? $AUdataFormatBitsPerSampleLookup[$id] : false);
- }
-
- function AUdataFormatUsedBitsPerSampleLookup($id) {
- static $AUdataFormatUsedBitsPerSampleLookup = array(
- 1 => 8,
- 2 => 8,
- 3 => 16,
- 4 => 24,
- 5 => 32,
- 6 => 32,
- 7 => 64,
-
- 11 => 8,
- 12 => 16,
- 13 => 24,
- 14 => 32,
-
- 18 => 16,
- 19 => 16,
- 20 => 16,
-
- 23 => 4,
-
- 25 => 3,
- 26 => 5,
- 27 => 8,
- );
- return (isset($AUdataFormatUsedBitsPerSampleLookup[$id]) ? $AUdataFormatUsedBitsPerSampleLookup[$id] : false);
- }
-
-}
-
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.audio.avr.php b/3rdparty/getid3/module.audio.avr.php
deleted file mode 100644
index 9c6d6650782..00000000000
--- a/3rdparty/getid3/module.audio.avr.php
+++ /dev/null
@@ -1,127 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.audio.avr.php //
-// module for analyzing AVR Audio files //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_avr extends getid3_handler
-{
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- // http://cui.unige.ch/OSG/info/AudioFormats/ap11.html
- // http://www.btinternet.com/~AnthonyJ/Atari/programming/avr_format.html
- // offset type length name comments
- // ---------------------------------------------------------------------
- // 0 char 4 ID format ID == "2BIT"
- // 4 char 8 name sample name (unused space filled with 0)
- // 12 short 1 mono/stereo 0=mono, -1 (0xFFFF)=stereo
- // With stereo, samples are alternated,
- // the first voice is the left :
- // (LRLRLRLRLRLRLRLRLR...)
- // 14 short 1 resolution 8, 12 or 16 (bits)
- // 16 short 1 signed or not 0=unsigned, -1 (0xFFFF)=signed
- // 18 short 1 loop or not 0=no loop, -1 (0xFFFF)=loop on
- // 20 short 1 MIDI note 0xFFnn, where 0 <= nn <= 127
- // 0xFFFF means "no MIDI note defined"
- // 22 byte 1 Replay speed Frequence in the Replay software
- // 0=5.485 Khz, 1=8.084 Khz, 2=10.971 Khz,
- // 3=16.168 Khz, 4=21.942 Khz, 5=32.336 Khz
- // 6=43.885 Khz, 7=47.261 Khz
- // -1 (0xFF)=no defined Frequence
- // 23 byte 3 sample rate in Hertz
- // 26 long 1 size in bytes (2 * bytes in stereo)
- // 30 long 1 loop begin 0 for no loop
- // 34 long 1 loop size equal to 'size' for no loop
- // 38 short 2 Reserved, MIDI keyboard split */
- // 40 short 2 Reserved, sample compression */
- // 42 short 2 Reserved */
- // 44 char 20; Additional filename space, used if (name[7] != 0)
- // 64 byte 64 user data
- // 128 bytes ? sample data (12 bits samples are coded on 16 bits:
- // 0000 xxxx xxxx xxxx)
- // ---------------------------------------------------------------------
-
- // Note that all values are in motorola (big-endian) format, and that long is
- // assumed to be 4 bytes, and short 2 bytes.
- // When reading the samples, you should handle both signed and unsigned data,
- // and be prepared to convert 16->8 bit, or mono->stereo if needed. To convert
- // 8-bit data between signed/unsigned just add 127 to the sample values.
- // Simularly for 16-bit data you should add 32769
-
- $info['fileformat'] = 'avr';
-
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
- $AVRheader = fread($this->getid3->fp, 128);
-
- $info['avr']['raw']['magic'] = substr($AVRheader, 0, 4);
- $magic = '2BIT';
- if ($info['avr']['raw']['magic'] != $magic) {
- $info['error'][] = 'Expecting "'.getid3_lib::PrintHexBytes($magic).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($info['avr']['raw']['magic']).'"';
- unset($info['fileformat']);
- unset($info['avr']);
- return false;
- }
- $info['avdataoffset'] += 128;
-
- $info['avr']['sample_name'] = rtrim(substr($AVRheader, 4, 8));
- $info['avr']['raw']['mono'] = getid3_lib::BigEndian2Int(substr($AVRheader, 12, 2));
- $info['avr']['bits_per_sample'] = getid3_lib::BigEndian2Int(substr($AVRheader, 14, 2));
- $info['avr']['raw']['signed'] = getid3_lib::BigEndian2Int(substr($AVRheader, 16, 2));
- $info['avr']['raw']['loop'] = getid3_lib::BigEndian2Int(substr($AVRheader, 18, 2));
- $info['avr']['raw']['midi'] = getid3_lib::BigEndian2Int(substr($AVRheader, 20, 2));
- $info['avr']['raw']['replay_freq'] = getid3_lib::BigEndian2Int(substr($AVRheader, 22, 1));
- $info['avr']['sample_rate'] = getid3_lib::BigEndian2Int(substr($AVRheader, 23, 3));
- $info['avr']['sample_length'] = getid3_lib::BigEndian2Int(substr($AVRheader, 26, 4));
- $info['avr']['loop_start'] = getid3_lib::BigEndian2Int(substr($AVRheader, 30, 4));
- $info['avr']['loop_end'] = getid3_lib::BigEndian2Int(substr($AVRheader, 34, 4));
- $info['avr']['midi_split'] = getid3_lib::BigEndian2Int(substr($AVRheader, 38, 2));
- $info['avr']['sample_compression'] = getid3_lib::BigEndian2Int(substr($AVRheader, 40, 2));
- $info['avr']['reserved'] = getid3_lib::BigEndian2Int(substr($AVRheader, 42, 2));
- $info['avr']['sample_name_extra'] = rtrim(substr($AVRheader, 44, 20));
- $info['avr']['comment'] = rtrim(substr($AVRheader, 64, 64));
-
- $info['avr']['flags']['stereo'] = (($info['avr']['raw']['mono'] == 0) ? false : true);
- $info['avr']['flags']['signed'] = (($info['avr']['raw']['signed'] == 0) ? false : true);
- $info['avr']['flags']['loop'] = (($info['avr']['raw']['loop'] == 0) ? false : true);
-
- $info['avr']['midi_notes'] = array();
- if (($info['avr']['raw']['midi'] & 0xFF00) != 0xFF00) {
- $info['avr']['midi_notes'][] = ($info['avr']['raw']['midi'] & 0xFF00) >> 8;
- }
- if (($info['avr']['raw']['midi'] & 0x00FF) != 0x00FF) {
- $info['avr']['midi_notes'][] = ($info['avr']['raw']['midi'] & 0x00FF);
- }
-
- if (($info['avdataend'] - $info['avdataoffset']) != ($info['avr']['sample_length'] * (($info['avr']['bits_per_sample'] == 8) ? 1 : 2))) {
- $info['warning'][] = 'Probable truncated file: expecting '.($info['avr']['sample_length'] * (($info['avr']['bits_per_sample'] == 8) ? 1 : 2)).' bytes of audio data, found '.($info['avdataend'] - $info['avdataoffset']);
- }
-
- $info['audio']['dataformat'] = 'avr';
- $info['audio']['lossless'] = true;
- $info['audio']['bitrate_mode'] = 'cbr';
- $info['audio']['bits_per_sample'] = $info['avr']['bits_per_sample'];
- $info['audio']['sample_rate'] = $info['avr']['sample_rate'];
- $info['audio']['channels'] = ($info['avr']['flags']['stereo'] ? 2 : 1);
- $info['playtime_seconds'] = ($info['avr']['sample_length'] / $info['audio']['channels']) / $info['avr']['sample_rate'];
- $info['audio']['bitrate'] = ($info['avr']['sample_length'] * (($info['avr']['bits_per_sample'] == 8) ? 8 : 16)) / $info['playtime_seconds'];
-
-
- return true;
- }
-
-}
-
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.audio.bonk.php b/3rdparty/getid3/module.audio.bonk.php
deleted file mode 100644
index 9f5187e3c0b..00000000000
--- a/3rdparty/getid3/module.audio.bonk.php
+++ /dev/null
@@ -1,230 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.audio.la.php //
-// module for analyzing BONK audio files //
-// dependencies: module.tag.id3v2.php (optional) //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_bonk extends getid3_handler
-{
- function Analyze() {
- $info = &$this->getid3->info;
-
- // shortcut
- $info['bonk'] = array();
- $thisfile_bonk = &$info['bonk'];
-
- $thisfile_bonk['dataoffset'] = $info['avdataoffset'];
- $thisfile_bonk['dataend'] = $info['avdataend'];
-
- if (!getid3_lib::intValueSupported($thisfile_bonk['dataend'])) {
-
- $info['warning'][] = 'Unable to parse BONK file from end (v0.6+ preferred method) because PHP filesystem functions only support up to '.round(PHP_INT_MAX / 1073741824).'GB';
-
- } else {
-
- // scan-from-end method, for v0.6 and higher
- fseek($this->getid3->fp, $thisfile_bonk['dataend'] - 8, SEEK_SET);
- $PossibleBonkTag = fread($this->getid3->fp, 8);
- while ($this->BonkIsValidTagName(substr($PossibleBonkTag, 4, 4), true)) {
- $BonkTagSize = getid3_lib::LittleEndian2Int(substr($PossibleBonkTag, 0, 4));
- fseek($this->getid3->fp, 0 - $BonkTagSize, SEEK_CUR);
- $BonkTagOffset = ftell($this->getid3->fp);
- $TagHeaderTest = fread($this->getid3->fp, 5);
- if (($TagHeaderTest{0} != "\x00") || (substr($PossibleBonkTag, 4, 4) != strtolower(substr($PossibleBonkTag, 4, 4)))) {
- $info['error'][] = 'Expecting "'.getid3_lib::PrintHexBytes("\x00".strtoupper(substr($PossibleBonkTag, 4, 4))).'" at offset '.$BonkTagOffset.', found "'.getid3_lib::PrintHexBytes($TagHeaderTest).'"';
- return false;
- }
- $BonkTagName = substr($TagHeaderTest, 1, 4);
-
- $thisfile_bonk[$BonkTagName]['size'] = $BonkTagSize;
- $thisfile_bonk[$BonkTagName]['offset'] = $BonkTagOffset;
- $this->HandleBonkTags($BonkTagName);
- $NextTagEndOffset = $BonkTagOffset - 8;
- if ($NextTagEndOffset < $thisfile_bonk['dataoffset']) {
- if (empty($info['audio']['encoder'])) {
- $info['audio']['encoder'] = 'Extended BONK v0.9+';
- }
- return true;
- }
- fseek($this->getid3->fp, $NextTagEndOffset, SEEK_SET);
- $PossibleBonkTag = fread($this->getid3->fp, 8);
- }
-
- }
-
- // seek-from-beginning method for v0.4 and v0.5
- if (empty($thisfile_bonk['BONK'])) {
- fseek($this->getid3->fp, $thisfile_bonk['dataoffset'], SEEK_SET);
- do {
- $TagHeaderTest = fread($this->getid3->fp, 5);
- switch ($TagHeaderTest) {
- case "\x00".'BONK':
- if (empty($info['audio']['encoder'])) {
- $info['audio']['encoder'] = 'BONK v0.4';
- }
- break;
-
- case "\x00".'INFO':
- $info['audio']['encoder'] = 'Extended BONK v0.5';
- break;
-
- default:
- break 2;
- }
- $BonkTagName = substr($TagHeaderTest, 1, 4);
- $thisfile_bonk[$BonkTagName]['size'] = $thisfile_bonk['dataend'] - $thisfile_bonk['dataoffset'];
- $thisfile_bonk[$BonkTagName]['offset'] = $thisfile_bonk['dataoffset'];
- $this->HandleBonkTags($BonkTagName);
-
- } while (true);
- }
-
- // parse META block for v0.6 - v0.8
- if (empty($thisfile_bonk['INFO']) && isset($thisfile_bonk['META']['tags']['info'])) {
- fseek($this->getid3->fp, $thisfile_bonk['META']['tags']['info'], SEEK_SET);
- $TagHeaderTest = fread($this->getid3->fp, 5);
- if ($TagHeaderTest == "\x00".'INFO') {
- $info['audio']['encoder'] = 'Extended BONK v0.6 - v0.8';
-
- $BonkTagName = substr($TagHeaderTest, 1, 4);
- $thisfile_bonk[$BonkTagName]['size'] = $thisfile_bonk['dataend'] - $thisfile_bonk['dataoffset'];
- $thisfile_bonk[$BonkTagName]['offset'] = $thisfile_bonk['dataoffset'];
- $this->HandleBonkTags($BonkTagName);
- }
- }
-
- if (empty($info['audio']['encoder'])) {
- $info['audio']['encoder'] = 'Extended BONK v0.9+';
- }
- if (empty($thisfile_bonk['BONK'])) {
- unset($info['bonk']);
- }
- return true;
-
- }
-
- function HandleBonkTags($BonkTagName) {
- $info = &$this->getid3->info;
- switch ($BonkTagName) {
- case 'BONK':
- // shortcut
- $thisfile_bonk_BONK = &$info['bonk']['BONK'];
-
- $BonkData = "\x00".'BONK'.fread($this->getid3->fp, 17);
- $thisfile_bonk_BONK['version'] = getid3_lib::LittleEndian2Int(substr($BonkData, 5, 1));
- $thisfile_bonk_BONK['number_samples'] = getid3_lib::LittleEndian2Int(substr($BonkData, 6, 4));
- $thisfile_bonk_BONK['sample_rate'] = getid3_lib::LittleEndian2Int(substr($BonkData, 10, 4));
-
- $thisfile_bonk_BONK['channels'] = getid3_lib::LittleEndian2Int(substr($BonkData, 14, 1));
- $thisfile_bonk_BONK['lossless'] = (bool) getid3_lib::LittleEndian2Int(substr($BonkData, 15, 1));
- $thisfile_bonk_BONK['joint_stereo'] = (bool) getid3_lib::LittleEndian2Int(substr($BonkData, 16, 1));
- $thisfile_bonk_BONK['number_taps'] = getid3_lib::LittleEndian2Int(substr($BonkData, 17, 2));
- $thisfile_bonk_BONK['downsampling_ratio'] = getid3_lib::LittleEndian2Int(substr($BonkData, 19, 1));
- $thisfile_bonk_BONK['samples_per_packet'] = getid3_lib::LittleEndian2Int(substr($BonkData, 20, 2));
-
- $info['avdataoffset'] = $thisfile_bonk_BONK['offset'] + 5 + 17;
- $info['avdataend'] = $thisfile_bonk_BONK['offset'] + $thisfile_bonk_BONK['size'];
-
- $info['fileformat'] = 'bonk';
- $info['audio']['dataformat'] = 'bonk';
- $info['audio']['bitrate_mode'] = 'vbr'; // assumed
- $info['audio']['channels'] = $thisfile_bonk_BONK['channels'];
- $info['audio']['sample_rate'] = $thisfile_bonk_BONK['sample_rate'];
- $info['audio']['channelmode'] = ($thisfile_bonk_BONK['joint_stereo'] ? 'joint stereo' : 'stereo');
- $info['audio']['lossless'] = $thisfile_bonk_BONK['lossless'];
- $info['audio']['codec'] = 'bonk';
-
- $info['playtime_seconds'] = $thisfile_bonk_BONK['number_samples'] / ($thisfile_bonk_BONK['sample_rate'] * $thisfile_bonk_BONK['channels']);
- if ($info['playtime_seconds'] > 0) {
- $info['audio']['bitrate'] = (($info['bonk']['dataend'] - $info['bonk']['dataoffset']) * 8) / $info['playtime_seconds'];
- }
- break;
-
- case 'INFO':
- // shortcut
- $thisfile_bonk_INFO = &$info['bonk']['INFO'];
-
- $thisfile_bonk_INFO['version'] = getid3_lib::LittleEndian2Int(fread($this->getid3->fp, 1));
- $thisfile_bonk_INFO['entries_count'] = 0;
- $NextInfoDataPair = fread($this->getid3->fp, 5);
- if (!$this->BonkIsValidTagName(substr($NextInfoDataPair, 1, 4))) {
- while (!feof($this->getid3->fp)) {
- //$CurrentSeekInfo['offset'] = getid3_lib::LittleEndian2Int(substr($NextInfoDataPair, 0, 4));
- //$CurrentSeekInfo['nextbit'] = getid3_lib::LittleEndian2Int(substr($NextInfoDataPair, 4, 1));
- //$thisfile_bonk_INFO[] = $CurrentSeekInfo;
-
- $NextInfoDataPair = fread($this->getid3->fp, 5);
- if ($this->BonkIsValidTagName(substr($NextInfoDataPair, 1, 4))) {
- fseek($this->getid3->fp, -5, SEEK_CUR);
- break;
- }
- $thisfile_bonk_INFO['entries_count']++;
- }
- }
- break;
-
- case 'META':
- $BonkData = "\x00".'META'.fread($this->getid3->fp, $info['bonk']['META']['size'] - 5);
- $info['bonk']['META']['version'] = getid3_lib::LittleEndian2Int(substr($BonkData, 5, 1));
-
- $MetaTagEntries = floor(((strlen($BonkData) - 8) - 6) / 8); // BonkData - xxxxmeta - META
- $offset = 6;
- for ($i = 0; $i < $MetaTagEntries; $i++) {
- $MetaEntryTagName = substr($BonkData, $offset, 4);
- $offset += 4;
- $MetaEntryTagOffset = getid3_lib::LittleEndian2Int(substr($BonkData, $offset, 4));
- $offset += 4;
- $info['bonk']['META']['tags'][$MetaEntryTagName] = $MetaEntryTagOffset;
- }
- break;
-
- case ' ID3':
- $info['audio']['encoder'] = 'Extended BONK v0.9+';
-
- // ID3v2 checking is optional
- if (class_exists('getid3_id3v2')) {
- $getid3_temp = new getID3();
- $getid3_temp->openfile($this->getid3->filename);
- $getid3_id3v2 = new getid3_id3v2($getid3_temp);
- $getid3_id3v2->StartingOffset = $info['bonk'][' ID3']['offset'] + 2;
- $info['bonk'][' ID3']['valid'] = $getid3_id3v2->Analyze();
- if ($info['bonk'][' ID3']['valid']) {
- $info['id3v2'] = $getid3_temp->info['id3v2'];
- }
- unset($getid3_temp, $getid3_id3v2);
- }
- break;
-
- default:
- $info['warning'][] = 'Unexpected Bonk tag "'.$BonkTagName.'" at offset '.$info['bonk'][$BonkTagName]['offset'];
- break;
-
- }
- }
-
- static function BonkIsValidTagName($PossibleBonkTag, $ignorecase=false) {
- static $BonkIsValidTagName = array('BONK', 'INFO', ' ID3', 'META');
- foreach ($BonkIsValidTagName as $validtagname) {
- if ($validtagname == $PossibleBonkTag) {
- return true;
- } elseif ($ignorecase && (strtolower($validtagname) == strtolower($PossibleBonkTag))) {
- return true;
- }
- }
- return false;
- }
-
-}
-
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.audio.dss.php b/3rdparty/getid3/module.audio.dss.php
deleted file mode 100644
index b7b4367629a..00000000000
--- a/3rdparty/getid3/module.audio.dss.php
+++ /dev/null
@@ -1,75 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.audio.dss.php //
-// module for analyzing Digital Speech Standard (DSS) files //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_dss extends getid3_handler
-{
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
- $DSSheader = fread($this->getid3->fp, 1256);
-
- if (!preg_match('#^(\x02|\x03)dss#', $DSSheader)) {
- $info['error'][] = 'Expecting "[02-03] 64 73 73" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes(substr($DSSheader, 0, 4)).'"';
- return false;
- }
-
- // some structure information taken from http://cpansearch.perl.org/src/RGIBSON/Audio-DSS-0.02/lib/Audio/DSS.pm
-
- // shortcut
- $info['dss'] = array();
- $thisfile_dss = &$info['dss'];
-
- $info['fileformat'] = 'dss';
- $info['audio']['dataformat'] = 'dss';
- $info['audio']['bitrate_mode'] = 'cbr';
- //$thisfile_dss['encoding'] = 'ISO-8859-1';
-
- $thisfile_dss['version'] = ord(substr($DSSheader, 0, 1));
- $thisfile_dss['date_create'] = $this->DSSdateStringToUnixDate(substr($DSSheader, 38, 12));
- $thisfile_dss['date_complete'] = $this->DSSdateStringToUnixDate(substr($DSSheader, 50, 12));
- //$thisfile_dss['length'] = intval(substr($DSSheader, 62, 6)); // I thought time was in seconds, it's actually HHMMSS
- $thisfile_dss['length'] = intval((substr($DSSheader, 62, 2) * 3600) + (substr($DSSheader, 64, 2) * 60) + substr($DSSheader, 66, 2));
- $thisfile_dss['priority'] = ord(substr($DSSheader, 793, 1));
- $thisfile_dss['comments'] = trim(substr($DSSheader, 798, 100));
-
-
- //$info['audio']['bits_per_sample'] = ?;
- //$info['audio']['sample_rate'] = ?;
- $info['audio']['channels'] = 1;
-
- $info['playtime_seconds'] = $thisfile_dss['length'];
- $info['audio']['bitrate'] = ($info['filesize'] * 8) / $info['playtime_seconds'];
-
- return true;
- }
-
- function DSSdateStringToUnixDate($datestring) {
- $y = substr($datestring, 0, 2);
- $m = substr($datestring, 2, 2);
- $d = substr($datestring, 4, 2);
- $h = substr($datestring, 6, 2);
- $i = substr($datestring, 8, 2);
- $s = substr($datestring, 10, 2);
- $y += (($y < 95) ? 2000 : 1900);
- return mktime($h, $i, $s, $m, $d, $y);
- }
-
-}
-
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.audio.dts.php b/3rdparty/getid3/module.audio.dts.php
deleted file mode 100644
index 8102ba8bf53..00000000000
--- a/3rdparty/getid3/module.audio.dts.php
+++ /dev/null
@@ -1,246 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.audio.dts.php //
-// module for analyzing DTS Audio files //
-// dependencies: NONE //
-// //
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_dts extends getid3_handler
-{
-
- public function Analyze() {
- $info = &$this->getid3->info;
-
- // Specs taken from "DTS Coherent Acoustics;Core and Extensions, ETSI TS 102 114 V1.2.1 (2002-12)"
- // (http://pda.etsi.org/pda/queryform.asp)
- // With thanks to Gambit <macteam@users.sourceforge.net> http://mac.sourceforge.net/atl/
-
- $info['fileformat'] = 'dts';
-
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
- $DTSheader = fread($this->getid3->fp, 16);
- $info['dts']['raw']['magic'] = substr($DTSheader, 0, 4);
-
- $magic = "\x7F\xFE\x80\x01";
- if ($info['dts']['raw']['magic'] != $magic) {
- $info['error'][] = 'Expecting "'.getid3_lib::PrintHexBytes($magic).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($info['dts']['raw']['magic']).'"';
- unset($info['fileformat'], $info['dts']);
- return false;
- }
-
- $fhBS = getid3_lib::BigEndian2Bin(substr($DTSheader, 4, 12));
- $bsOffset = 0;
- $info['dts']['raw']['frame_type'] = $this->readBinData($fhBS, $bsOffset, 1);
- $info['dts']['raw']['deficit_samples'] = $this->readBinData($fhBS, $bsOffset, 5);
- $info['dts']['flags']['crc_present'] = (bool) $this->readBinData($fhBS, $bsOffset, 1);
- $info['dts']['raw']['pcm_sample_blocks'] = $this->readBinData($fhBS, $bsOffset, 7);
- $info['dts']['raw']['frame_byte_size'] = $this->readBinData($fhBS, $bsOffset, 14);
- $info['dts']['raw']['channel_arrangement'] = $this->readBinData($fhBS, $bsOffset, 6);
- $info['dts']['raw']['sample_frequency'] = $this->readBinData($fhBS, $bsOffset, 4);
- $info['dts']['raw']['bitrate'] = $this->readBinData($fhBS, $bsOffset, 5);
- $info['dts']['flags']['embedded_downmix'] = (bool) $this->readBinData($fhBS, $bsOffset, 1);
- $info['dts']['flags']['dynamicrange'] = (bool) $this->readBinData($fhBS, $bsOffset, 1);
- $info['dts']['flags']['timestamp'] = (bool) $this->readBinData($fhBS, $bsOffset, 1);
- $info['dts']['flags']['auxdata'] = (bool) $this->readBinData($fhBS, $bsOffset, 1);
- $info['dts']['flags']['hdcd'] = (bool) $this->readBinData($fhBS, $bsOffset, 1);
- $info['dts']['raw']['extension_audio'] = $this->readBinData($fhBS, $bsOffset, 3);
- $info['dts']['flags']['extended_coding'] = (bool) $this->readBinData($fhBS, $bsOffset, 1);
- $info['dts']['flags']['audio_sync_insertion'] = (bool) $this->readBinData($fhBS, $bsOffset, 1);
- $info['dts']['raw']['lfe_effects'] = $this->readBinData($fhBS, $bsOffset, 2);
- $info['dts']['flags']['predictor_history'] = (bool) $this->readBinData($fhBS, $bsOffset, 1);
- if ($info['dts']['flags']['crc_present']) {
- $info['dts']['raw']['crc16'] = $this->readBinData($fhBS, $bsOffset, 16);
- }
- $info['dts']['flags']['mri_perfect_reconst'] = (bool) $this->readBinData($fhBS, $bsOffset, 1);
- $info['dts']['raw']['encoder_soft_version'] = $this->readBinData($fhBS, $bsOffset, 4);
- $info['dts']['raw']['copy_history'] = $this->readBinData($fhBS, $bsOffset, 2);
- $info['dts']['raw']['bits_per_sample'] = $this->readBinData($fhBS, $bsOffset, 2);
- $info['dts']['flags']['surround_es'] = (bool) $this->readBinData($fhBS, $bsOffset, 1);
- $info['dts']['flags']['front_sum_diff'] = (bool) $this->readBinData($fhBS, $bsOffset, 1);
- $info['dts']['flags']['surround_sum_diff'] = (bool) $this->readBinData($fhBS, $bsOffset, 1);
- $info['dts']['raw']['dialog_normalization'] = $this->readBinData($fhBS, $bsOffset, 4);
-
-
- $info['dts']['bitrate'] = self::DTSbitrateLookup($info['dts']['raw']['bitrate']);
- $info['dts']['bits_per_sample'] = self::DTSbitPerSampleLookup($info['dts']['raw']['bits_per_sample']);
- $info['dts']['sample_rate'] = self::DTSsampleRateLookup($info['dts']['raw']['sample_frequency']);
- $info['dts']['dialog_normalization'] = self::DTSdialogNormalization($info['dts']['raw']['dialog_normalization'], $info['dts']['raw']['encoder_soft_version']);
- $info['dts']['flags']['lossless'] = (($info['dts']['raw']['bitrate'] == 31) ? true : false);
- $info['dts']['bitrate_mode'] = (($info['dts']['raw']['bitrate'] == 30) ? 'vbr' : 'cbr');
- $info['dts']['channels'] = self::DTSnumChannelsLookup($info['dts']['raw']['channel_arrangement']);
- $info['dts']['channel_arrangement'] = self::DTSchannelArrangementLookup($info['dts']['raw']['channel_arrangement']);
-
- $info['audio']['dataformat'] = 'dts';
- $info['audio']['lossless'] = $info['dts']['flags']['lossless'];
- $info['audio']['bitrate_mode'] = $info['dts']['bitrate_mode'];
- $info['audio']['bits_per_sample'] = $info['dts']['bits_per_sample'];
- $info['audio']['sample_rate'] = $info['dts']['sample_rate'];
- $info['audio']['channels'] = $info['dts']['channels'];
- $info['audio']['bitrate'] = $info['dts']['bitrate'];
- if (isset($info['avdataend'])) {
- $info['playtime_seconds'] = ($info['avdataend'] - $info['avdataoffset']) / ($info['dts']['bitrate'] / 8);
- }
-
- return true;
- }
-
- private function readBinData($bin, &$offset, $length) {
- $data = substr($bin, $offset, $length);
- $offset += $length;
- return bindec($data);
- }
-
- private static function DTSbitrateLookup($index) {
- $DTSbitrateLookup = array(
- 0 => 32000,
- 1 => 56000,
- 2 => 64000,
- 3 => 96000,
- 4 => 112000,
- 5 => 128000,
- 6 => 192000,
- 7 => 224000,
- 8 => 256000,
- 9 => 320000,
- 10 => 384000,
- 11 => 448000,
- 12 => 512000,
- 13 => 576000,
- 14 => 640000,
- 15 => 768000,
- 16 => 960000,
- 17 => 1024000,
- 18 => 1152000,
- 19 => 1280000,
- 20 => 1344000,
- 21 => 1408000,
- 22 => 1411200,
- 23 => 1472000,
- 24 => 1536000,
- 25 => 1920000,
- 26 => 2048000,
- 27 => 3072000,
- 28 => 3840000,
- 29 => 'open',
- 30 => 'variable',
- 31 => 'lossless'
- );
- return (isset($DTSbitrateLookup[$index]) ? $DTSbitrateLookup[$index] : false);
- }
-
- private static function DTSsampleRateLookup($index) {
- $DTSsampleRateLookup = array(
- 0 => 'invalid',
- 1 => 8000,
- 2 => 16000,
- 3 => 32000,
- 4 => 'invalid',
- 5 => 'invalid',
- 6 => 11025,
- 7 => 22050,
- 8 => 44100,
- 9 => 'invalid',
- 10 => 'invalid',
- 11 => 12000,
- 12 => 24000,
- 13 => 48000,
- 14 => 'invalid',
- 15 => 'invalid'
- );
- return (isset($DTSsampleRateLookup[$index]) ? $DTSsampleRateLookup[$index] : false);
- }
-
- private static function DTSbitPerSampleLookup($index) {
- $DTSbitPerSampleLookup = array(
- 0 => 16,
- 1 => 20,
- 2 => 24,
- 3 => 24,
- );
- return (isset($DTSbitPerSampleLookup[$index]) ? $DTSbitPerSampleLookup[$index] : false);
- }
-
- private static function DTSnumChannelsLookup($index) {
- switch ($index) {
- case 0:
- return 1;
- break;
- case 1:
- case 2:
- case 3:
- case 4:
- return 2;
- break;
- case 5:
- case 6:
- return 3;
- break;
- case 7:
- case 8:
- return 4;
- break;
- case 9:
- return 5;
- break;
- case 10:
- case 11:
- case 12:
- return 6;
- break;
- case 13:
- return 7;
- break;
- case 14:
- case 15:
- return 8;
- break;
- }
- return false;
- }
-
- private static function DTSchannelArrangementLookup($index) {
- $DTSchannelArrangementLookup = array(
- 0 => 'A',
- 1 => 'A + B (dual mono)',
- 2 => 'L + R (stereo)',
- 3 => '(L+R) + (L-R) (sum-difference)',
- 4 => 'LT + RT (left and right total)',
- 5 => 'C + L + R',
- 6 => 'L + R + S',
- 7 => 'C + L + R + S',
- 8 => 'L + R + SL + SR',
- 9 => 'C + L + R + SL + SR',
- 10 => 'CL + CR + L + R + SL + SR',
- 11 => 'C + L + R+ LR + RR + OV',
- 12 => 'CF + CR + LF + RF + LR + RR',
- 13 => 'CL + C + CR + L + R + SL + SR',
- 14 => 'CL + CR + L + R + SL1 + SL2 + SR1 + SR2',
- 15 => 'CL + C+ CR + L + R + SL + S + SR',
- );
- return (isset($DTSchannelArrangementLookup[$index]) ? $DTSchannelArrangementLookup[$index] : 'user-defined');
- }
-
- private static function DTSdialogNormalization($index, $version) {
- switch ($version) {
- case 7:
- return 0 - $index;
- break;
- case 6:
- return 0 - 16 - $index;
- break;
- }
- return false;
- }
-
-}
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.audio.flac.php b/3rdparty/getid3/module.audio.flac.php
deleted file mode 100644
index 98daec0fd9d..00000000000
--- a/3rdparty/getid3/module.audio.flac.php
+++ /dev/null
@@ -1,480 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.audio.flac.php //
-// module for analyzing FLAC and OggFLAC audio files //
-// dependencies: module.audio.ogg.php //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.ogg.php', __FILE__, true);
-
-class getid3_flac extends getid3_handler
-{
- var $inline_attachments = true; // true: return full data for all attachments; false: return no data for all attachments; integer: return data for attachments <= than this; string: save as file to this directory
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- // http://flac.sourceforge.net/format.html
-
- $this->fseek($info['avdataoffset'], SEEK_SET);
- $StreamMarker = $this->fread(4);
- $magic = 'fLaC';
- if ($StreamMarker != $magic) {
- $info['error'][] = 'Expecting "'.getid3_lib::PrintHexBytes($magic).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($StreamMarker).'"';
- return false;
- }
- $info['fileformat'] = 'flac';
- $info['audio']['dataformat'] = 'flac';
- $info['audio']['bitrate_mode'] = 'vbr';
- $info['audio']['lossless'] = true;
-
- return $this->FLACparseMETAdata();
- }
-
-
- function FLACparseMETAdata() {
- $info = &$this->getid3->info;
- do {
- $METAdataBlockOffset = $this->ftell();
- $METAdataBlockHeader = $this->fread(4);
- $METAdataLastBlockFlag = (bool) (getid3_lib::BigEndian2Int(substr($METAdataBlockHeader, 0, 1)) & 0x80);
- $METAdataBlockType = getid3_lib::BigEndian2Int(substr($METAdataBlockHeader, 0, 1)) & 0x7F;
- $METAdataBlockLength = getid3_lib::BigEndian2Int(substr($METAdataBlockHeader, 1, 3));
- $METAdataBlockTypeText = getid3_flac::FLACmetaBlockTypeLookup($METAdataBlockType);
-
- if ($METAdataBlockLength < 0) {
- $info['error'][] = 'corrupt or invalid METADATA_BLOCK_HEADER.BLOCK_TYPE ('.$METAdataBlockType.') at offset '.$METAdataBlockOffset;
- break;
- }
-
- $info['flac'][$METAdataBlockTypeText]['raw'] = array();
- $ThisFileInfo_flac_METAdataBlockTypeText_raw = &$info['flac'][$METAdataBlockTypeText]['raw'];
-
- $ThisFileInfo_flac_METAdataBlockTypeText_raw['offset'] = $METAdataBlockOffset;
- $ThisFileInfo_flac_METAdataBlockTypeText_raw['last_meta_block'] = $METAdataLastBlockFlag;
- $ThisFileInfo_flac_METAdataBlockTypeText_raw['block_type'] = $METAdataBlockType;
- $ThisFileInfo_flac_METAdataBlockTypeText_raw['block_type_text'] = $METAdataBlockTypeText;
- $ThisFileInfo_flac_METAdataBlockTypeText_raw['block_length'] = $METAdataBlockLength;
- if (($METAdataBlockOffset + 4 + $METAdataBlockLength) > $info['avdataend']) {
- $info['error'][] = 'METADATA_BLOCK_HEADER.BLOCK_TYPE ('.$METAdataBlockType.') at offset '.$METAdataBlockOffset.' extends beyond end of file';
- break;
- }
- if ($METAdataBlockLength < 1) {
- $info['error'][] = 'METADATA_BLOCK_HEADER.BLOCK_LENGTH ('.$METAdataBlockLength.') at offset '.$METAdataBlockOffset.' is invalid';
- break;
- }
- $ThisFileInfo_flac_METAdataBlockTypeText_raw['block_data'] = $this->fread($METAdataBlockLength);
- $info['avdataoffset'] = $this->ftell();
-
- switch ($METAdataBlockTypeText) {
- case 'STREAMINFO': // 0x00
- if (!$this->FLACparseSTREAMINFO($ThisFileInfo_flac_METAdataBlockTypeText_raw['block_data'])) {
- return false;
- }
- break;
-
- case 'PADDING': // 0x01
- // ignore
- break;
-
- case 'APPLICATION': // 0x02
- if (!$this->FLACparseAPPLICATION($ThisFileInfo_flac_METAdataBlockTypeText_raw['block_data'])) {
- return false;
- }
- break;
-
- case 'SEEKTABLE': // 0x03
- if (!$this->FLACparseSEEKTABLE($ThisFileInfo_flac_METAdataBlockTypeText_raw['block_data'])) {
- return false;
- }
- break;
-
- case 'VORBIS_COMMENT': // 0x04
- $getid3_temp = new getID3();
- $getid3_temp->openfile($this->getid3->filename);
- $getid3_temp->info['avdataoffset'] = $this->ftell() - $METAdataBlockLength;
- $getid3_temp->info['audio']['dataformat'] = 'flac';
- $getid3_temp->info['flac'] = $info['flac'];
- $getid3_ogg = new getid3_ogg($getid3_temp);
- $getid3_ogg->ParseVorbisCommentsFilepointer();
- $maybe_copy_keys = array('vendor', 'comments_raw', 'comments', 'replay_gain');
- foreach ($maybe_copy_keys as $maybe_copy_key) {
- if (!empty($getid3_temp->info['ogg'][$maybe_copy_key])) {
- $info['ogg'][$maybe_copy_key] = $getid3_temp->info['ogg'][$maybe_copy_key];
- }
- }
- if (!empty($getid3_temp->info['replay_gain'])) {
- $info['replay_gain'] = $getid3_temp->info['replay_gain'];
- }
- unset($getid3_temp, $getid3_ogg);
- break;
-
- case 'CUESHEET': // 0x05
- if (!getid3_flac::FLACparseCUESHEET($ThisFileInfo_flac_METAdataBlockTypeText_raw['block_data'])) {
- return false;
- }
- break;
-
- case 'PICTURE': // 0x06
- if (!getid3_flac::FLACparsePICTURE($ThisFileInfo_flac_METAdataBlockTypeText_raw['block_data'])) {
- return false;
- }
- break;
-
- default:
- $info['warning'][] = 'Unhandled METADATA_BLOCK_HEADER.BLOCK_TYPE ('.$METAdataBlockType.') at offset '.$METAdataBlockOffset;
- break;
- }
-
- } while ($METAdataLastBlockFlag === false);
-
- if (isset($info['flac']['PICTURE'])) {
- foreach ($info['flac']['PICTURE'] as $key => $valuearray) {
- if (!empty($valuearray['image_mime']) && !empty($valuearray['data'])) {
- $info['ogg']['comments']['picture'][] = array('image_mime'=>$valuearray['image_mime'], 'data'=>$valuearray['data']);
- }
- }
- }
-
- if (isset($info['flac']['STREAMINFO'])) {
- $info['flac']['compressed_audio_bytes'] = $info['avdataend'] - $info['avdataoffset'];
- $info['flac']['uncompressed_audio_bytes'] = $info['flac']['STREAMINFO']['samples_stream'] * $info['flac']['STREAMINFO']['channels'] * ($info['flac']['STREAMINFO']['bits_per_sample'] / 8);
- if ($info['flac']['uncompressed_audio_bytes'] == 0) {
- $info['error'][] = 'Corrupt FLAC file: uncompressed_audio_bytes == zero';
- return false;
- }
- $info['flac']['compression_ratio'] = $info['flac']['compressed_audio_bytes'] / $info['flac']['uncompressed_audio_bytes'];
- }
-
- // set md5_data_source - built into flac 0.5+
- if (isset($info['flac']['STREAMINFO']['audio_signature'])) {
-
- if ($info['flac']['STREAMINFO']['audio_signature'] === str_repeat("\x00", 16)) {
-
- $info['warning'][] = 'FLAC STREAMINFO.audio_signature is null (known issue with libOggFLAC)';
-
- } else {
-
- $info['md5_data_source'] = '';
- $md5 = $info['flac']['STREAMINFO']['audio_signature'];
- for ($i = 0; $i < strlen($md5); $i++) {
- $info['md5_data_source'] .= str_pad(dechex(ord($md5{$i})), 2, '00', STR_PAD_LEFT);
- }
- if (!preg_match('/^[0-9a-f]{32}$/', $info['md5_data_source'])) {
- unset($info['md5_data_source']);
- }
-
- }
-
- }
-
- $info['audio']['bits_per_sample'] = $info['flac']['STREAMINFO']['bits_per_sample'];
- if ($info['audio']['bits_per_sample'] == 8) {
- // special case
- // must invert sign bit on all data bytes before MD5'ing to match FLAC's calculated value
- // MD5sum calculates on unsigned bytes, but FLAC calculated MD5 on 8-bit audio data as signed
- $info['warning'][] = 'FLAC calculates MD5 data strangely on 8-bit audio, so the stored md5_data_source value will not match the decoded WAV file';
- }
- if (!empty($info['ogg']['vendor'])) {
- $info['audio']['encoder'] = $info['ogg']['vendor'];
- }
-
- return true;
- }
-
- static function FLACmetaBlockTypeLookup($blocktype) {
- static $FLACmetaBlockTypeLookup = array();
- if (empty($FLACmetaBlockTypeLookup)) {
- $FLACmetaBlockTypeLookup[0] = 'STREAMINFO';
- $FLACmetaBlockTypeLookup[1] = 'PADDING';
- $FLACmetaBlockTypeLookup[2] = 'APPLICATION';
- $FLACmetaBlockTypeLookup[3] = 'SEEKTABLE';
- $FLACmetaBlockTypeLookup[4] = 'VORBIS_COMMENT';
- $FLACmetaBlockTypeLookup[5] = 'CUESHEET';
- $FLACmetaBlockTypeLookup[6] = 'PICTURE';
- }
- return (isset($FLACmetaBlockTypeLookup[$blocktype]) ? $FLACmetaBlockTypeLookup[$blocktype] : 'reserved');
- }
-
- static function FLACapplicationIDLookup($applicationid) {
- static $FLACapplicationIDLookup = array();
- if (empty($FLACapplicationIDLookup)) {
- // http://flac.sourceforge.net/id.html
- $FLACapplicationIDLookup[0x46746F6C] = 'flac-tools'; // 'Ftol'
- $FLACapplicationIDLookup[0x46746F6C] = 'Sound Font FLAC'; // 'SFFL'
- }
- return (isset($FLACapplicationIDLookup[$applicationid]) ? $FLACapplicationIDLookup[$applicationid] : 'reserved');
- }
-
- static function FLACpictureTypeLookup($type_id) {
- static $lookup = array (
- 0 => 'Other',
- 1 => '32x32 pixels \'file icon\' (PNG only)',
- 2 => 'Other file icon',
- 3 => 'Cover (front)',
- 4 => 'Cover (back)',
- 5 => 'Leaflet page',
- 6 => 'Media (e.g. label side of CD)',
- 7 => 'Lead artist/lead performer/soloist',
- 8 => 'Artist/performer',
- 9 => 'Conductor',
- 10 => 'Band/Orchestra',
- 11 => 'Composer',
- 12 => 'Lyricist/text writer',
- 13 => 'Recording Location',
- 14 => 'During recording',
- 15 => 'During performance',
- 16 => 'Movie/video screen capture',
- 17 => 'A bright coloured fish',
- 18 => 'Illustration',
- 19 => 'Band/artist logotype',
- 20 => 'Publisher/Studio logotype',
- );
- return (isset($lookup[$type_id]) ? $lookup[$type_id] : 'reserved');
- }
-
- function FLACparseSTREAMINFO($METAdataBlockData) {
- $info = &$this->getid3->info;
-
- $offset = 0;
- $info['flac']['STREAMINFO']['min_block_size'] = getid3_lib::BigEndian2Int(substr($METAdataBlockData, $offset, 2));
- $offset += 2;
- $info['flac']['STREAMINFO']['max_block_size'] = getid3_lib::BigEndian2Int(substr($METAdataBlockData, $offset, 2));
- $offset += 2;
- $info['flac']['STREAMINFO']['min_frame_size'] = getid3_lib::BigEndian2Int(substr($METAdataBlockData, $offset, 3));
- $offset += 3;
- $info['flac']['STREAMINFO']['max_frame_size'] = getid3_lib::BigEndian2Int(substr($METAdataBlockData, $offset, 3));
- $offset += 3;
-
- $SampleRateChannelsSampleBitsStreamSamples = getid3_lib::BigEndian2Bin(substr($METAdataBlockData, $offset, 8));
- $info['flac']['STREAMINFO']['sample_rate'] = getid3_lib::Bin2Dec(substr($SampleRateChannelsSampleBitsStreamSamples, 0, 20));
- $info['flac']['STREAMINFO']['channels'] = getid3_lib::Bin2Dec(substr($SampleRateChannelsSampleBitsStreamSamples, 20, 3)) + 1;
- $info['flac']['STREAMINFO']['bits_per_sample'] = getid3_lib::Bin2Dec(substr($SampleRateChannelsSampleBitsStreamSamples, 23, 5)) + 1;
- $info['flac']['STREAMINFO']['samples_stream'] = getid3_lib::Bin2Dec(substr($SampleRateChannelsSampleBitsStreamSamples, 28, 36));
- $offset += 8;
-
- $info['flac']['STREAMINFO']['audio_signature'] = substr($METAdataBlockData, $offset, 16);
- $offset += 16;
-
- if (!empty($info['flac']['STREAMINFO']['sample_rate'])) {
-
- $info['audio']['bitrate_mode'] = 'vbr';
- $info['audio']['sample_rate'] = $info['flac']['STREAMINFO']['sample_rate'];
- $info['audio']['channels'] = $info['flac']['STREAMINFO']['channels'];
- $info['audio']['bits_per_sample'] = $info['flac']['STREAMINFO']['bits_per_sample'];
- $info['playtime_seconds'] = $info['flac']['STREAMINFO']['samples_stream'] / $info['flac']['STREAMINFO']['sample_rate'];
- if ($info['playtime_seconds'] > 0) {
- $info['audio']['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds'];
- }
-
- } else {
- $info['error'][] = 'Corrupt METAdata block: STREAMINFO';
- return false;
- }
- unset($info['flac']['STREAMINFO']['raw']);
- return true;
- }
-
-
- function FLACparseAPPLICATION($METAdataBlockData) {
- $info = &$this->getid3->info;
-
- $offset = 0;
- $ApplicationID = getid3_lib::BigEndian2Int(substr($METAdataBlockData, $offset, 4));
- $offset += 4;
- $info['flac']['APPLICATION'][$ApplicationID]['name'] = getid3_flac::FLACapplicationIDLookup($ApplicationID);
- $info['flac']['APPLICATION'][$ApplicationID]['data'] = substr($METAdataBlockData, $offset);
- $offset = $METAdataBlockLength;
-
- unset($info['flac']['APPLICATION']['raw']);
- return true;
- }
-
-
- function FLACparseSEEKTABLE($METAdataBlockData) {
- $info = &$this->getid3->info;
-
- $offset = 0;
- $METAdataBlockLength = strlen($METAdataBlockData);
- $placeholderpattern = str_repeat("\xFF", 8);
- while ($offset < $METAdataBlockLength) {
- $SampleNumberString = substr($METAdataBlockData, $offset, 8);
- $offset += 8;
- if ($SampleNumberString == $placeholderpattern) {
-
- // placeholder point
- getid3_lib::safe_inc($info['flac']['SEEKTABLE']['placeholders'], 1);
- $offset += 10;
-
- } else {
-
- $SampleNumber = getid3_lib::BigEndian2Int($SampleNumberString);
- $info['flac']['SEEKTABLE'][$SampleNumber]['offset'] = getid3_lib::BigEndian2Int(substr($METAdataBlockData, $offset, 8));
- $offset += 8;
- $info['flac']['SEEKTABLE'][$SampleNumber]['samples'] = getid3_lib::BigEndian2Int(substr($METAdataBlockData, $offset, 2));
- $offset += 2;
-
- }
- }
-
- unset($info['flac']['SEEKTABLE']['raw']);
-
- return true;
- }
-
- function FLACparseCUESHEET($METAdataBlockData) {
- $info = &$this->getid3->info;
- $offset = 0;
- $info['flac']['CUESHEET']['media_catalog_number'] = trim(substr($METAdataBlockData, $offset, 128), "\0");
- $offset += 128;
- $info['flac']['CUESHEET']['lead_in_samples'] = getid3_lib::BigEndian2Int(substr($METAdataBlockData, $offset, 8));
- $offset += 8;
- $info['flac']['CUESHEET']['flags']['is_cd'] = (bool) (getid3_lib::BigEndian2Int(substr($METAdataBlockData, $offset, 1)) & 0x80);
- $offset += 1;
-
- $offset += 258; // reserved
-
- $info['flac']['CUESHEET']['number_tracks'] = getid3_lib::BigEndian2Int(substr($METAdataBlockData, $offset, 1));
- $offset += 1;
-
- for ($track = 0; $track < $info['flac']['CUESHEET']['number_tracks']; $track++) {
- $TrackSampleOffset = getid3_lib::BigEndian2Int(substr($METAdataBlockData, $offset, 8));
- $offset += 8;
- $TrackNumber = getid3_lib::BigEndian2Int(substr($METAdataBlockData, $offset, 1));
- $offset += 1;
-
- $info['flac']['CUESHEET']['tracks'][$TrackNumber]['sample_offset'] = $TrackSampleOffset;
-
- $info['flac']['CUESHEET']['tracks'][$TrackNumber]['isrc'] = substr($METAdataBlockData, $offset, 12);
- $offset += 12;
-
- $TrackFlagsRaw = getid3_lib::BigEndian2Int(substr($METAdataBlockData, $offset, 1));
- $offset += 1;
- $info['flac']['CUESHEET']['tracks'][$TrackNumber]['flags']['is_audio'] = (bool) ($TrackFlagsRaw & 0x80);
- $info['flac']['CUESHEET']['tracks'][$TrackNumber]['flags']['pre_emphasis'] = (bool) ($TrackFlagsRaw & 0x40);
-
- $offset += 13; // reserved
-
- $info['flac']['CUESHEET']['tracks'][$TrackNumber]['index_points'] = getid3_lib::BigEndian2Int(substr($METAdataBlockData, $offset, 1));
- $offset += 1;
-
- for ($index = 0; $index < $info['flac']['CUESHEET']['tracks'][$TrackNumber]['index_points']; $index++) {
- $IndexSampleOffset = getid3_lib::BigEndian2Int(substr($METAdataBlockData, $offset, 8));
- $offset += 8;
- $IndexNumber = getid3_lib::BigEndian2Int(substr($METAdataBlockData, $offset, 1));
- $offset += 1;
-
- $offset += 3; // reserved
-
- $info['flac']['CUESHEET']['tracks'][$TrackNumber]['indexes'][$IndexNumber] = $IndexSampleOffset;
- }
- }
-
- unset($info['flac']['CUESHEET']['raw']);
-
- return true;
- }
-
-
- function FLACparsePICTURE($meta_data_block_data) {
- $info = &$this->getid3->info;
- $picture = &$info['flac']['PICTURE'][sizeof($info['flac']['PICTURE']) - 1];
- $picture['offset'] = $info['flac']['PICTURE']['raw']['offset'];
- unset($info['flac']['PICTURE']['raw']);
-
- $offset = 0;
-
- $picture['typeid'] = getid3_lib::BigEndian2Int(substr($meta_data_block_data, $offset, 4));
- $picture['type'] = getid3_flac::FLACpictureTypeLookup($picture['typeid']);
- $offset += 4;
-
- $length = getid3_lib::BigEndian2Int(substr($meta_data_block_data, $offset, 4));
- $offset += 4;
-
- $picture['image_mime'] = substr($meta_data_block_data, $offset, $length);
- $offset += $length;
-
- $length = getid3_lib::BigEndian2Int(substr($meta_data_block_data, $offset, 4));
- $offset += 4;
-
- $picture['description'] = substr($meta_data_block_data, $offset, $length);
- $offset += $length;
-
- $picture['width'] = getid3_lib::BigEndian2Int(substr($meta_data_block_data, $offset, 4));
- $offset += 4;
-
- $picture['height'] = getid3_lib::BigEndian2Int(substr($meta_data_block_data, $offset, 4));
- $offset += 4;
-
- $picture['color_depth'] = getid3_lib::BigEndian2Int(substr($meta_data_block_data, $offset, 4));
- $offset += 4;
-
- $picture['colors_indexed'] = getid3_lib::BigEndian2Int(substr($meta_data_block_data, $offset, 4));
- $offset += 4;
-
- $length = getid3_lib::BigEndian2Int(substr($meta_data_block_data, $offset, 4));
- $offset += 4;
-
- $picture['data'] = substr($meta_data_block_data, $offset, $length);
- $offset += $length;
- $picture['data_length'] = strlen($picture['data']);
-
-
- do {
- if ($this->inline_attachments === false) {
- // skip entirely
- unset($picture['data']);
- break;
- }
- if ($this->inline_attachments === true) {
- // great
- } elseif (is_int($this->inline_attachments)) {
- if ($this->inline_attachments < $picture['data_length']) {
- // too big, skip
- $info['warning'][] = 'attachment at '.$picture['offset'].' is too large to process inline ('.number_format($picture['data_length']).' bytes)';
- unset($picture['data']);
- break;
- }
- } elseif (is_string($this->inline_attachments)) {
- $this->inline_attachments = rtrim(str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $this->inline_attachments), DIRECTORY_SEPARATOR);
- if (!is_dir($this->inline_attachments) || !is_writable($this->inline_attachments)) {
- // cannot write, skip
- $info['warning'][] = 'attachment at '.$picture['offset'].' cannot be saved to "'.$this->inline_attachments.'" (not writable)';
- unset($picture['data']);
- break;
- }
- }
- // if we get this far, must be OK
- if (is_string($this->inline_attachments)) {
- $destination_filename = $this->inline_attachments.DIRECTORY_SEPARATOR.md5($info['filenamepath']).'_'.$picture['offset'];
- if (!file_exists($destination_filename) || is_writable($destination_filename)) {
- file_put_contents($destination_filename, $picture['data']);
- } else {
- $info['warning'][] = 'attachment at '.$picture['offset'].' cannot be saved to "'.$destination_filename.'" (not writable)';
- }
- $picture['data_filename'] = $destination_filename;
- unset($picture['data']);
- } else {
- if (!isset($info['flac']['comments']['picture'])) {
- $info['flac']['comments']['picture'] = array();
- }
- $info['flac']['comments']['picture'][] = array('data'=>$picture['data'], 'image_mime'=>$picture['image_mime']);
- }
- } while (false);
-
-
-
- return true;
- }
-}
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.audio.la.php b/3rdparty/getid3/module.audio.la.php
deleted file mode 100644
index 98d80a6dc6c..00000000000
--- a/3rdparty/getid3/module.audio.la.php
+++ /dev/null
@@ -1,229 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.audio.la.php //
-// module for analyzing LA (LosslessAudio) audio files //
-// dependencies: module.audio.riff.php //
-// ///
-/////////////////////////////////////////////////////////////////
-
-getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, true);
-
-class getid3_la extends getid3_handler
-{
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- $offset = 0;
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
- $rawdata = fread($this->getid3->fp, $this->getid3->fread_buffer_size());
-
- switch (substr($rawdata, $offset, 4)) {
- case 'LA02':
- case 'LA03':
- case 'LA04':
- $info['fileformat'] = 'la';
- $info['audio']['dataformat'] = 'la';
- $info['audio']['lossless'] = true;
-
- $info['la']['version_major'] = (int) substr($rawdata, $offset + 2, 1);
- $info['la']['version_minor'] = (int) substr($rawdata, $offset + 3, 1);
- $info['la']['version'] = (float) $info['la']['version_major'] + ($info['la']['version_minor'] / 10);
- $offset += 4;
-
- $info['la']['uncompressed_size'] = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 4));
- $offset += 4;
- if ($info['la']['uncompressed_size'] == 0) {
- $info['error'][] = 'Corrupt LA file: uncompressed_size == zero';
- return false;
- }
-
- $WAVEchunk = substr($rawdata, $offset, 4);
- if ($WAVEchunk !== 'WAVE') {
- $info['error'][] = 'Expected "WAVE" ('.getid3_lib::PrintHexBytes('WAVE').') at offset '.$offset.', found "'.$WAVEchunk.'" ('.getid3_lib::PrintHexBytes($WAVEchunk).') instead.';
- return false;
- }
- $offset += 4;
-
- $info['la']['fmt_size'] = 24;
- if ($info['la']['version'] >= 0.3) {
-
- $info['la']['fmt_size'] = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 4));
- $info['la']['header_size'] = 49 + $info['la']['fmt_size'] - 24;
- $offset += 4;
-
- } else {
-
- // version 0.2 didn't support additional data blocks
- $info['la']['header_size'] = 41;
-
- }
-
- $fmt_chunk = substr($rawdata, $offset, 4);
- if ($fmt_chunk !== 'fmt ') {
- $info['error'][] = 'Expected "fmt " ('.getid3_lib::PrintHexBytes('fmt ').') at offset '.$offset.', found "'.$fmt_chunk.'" ('.getid3_lib::PrintHexBytes($fmt_chunk).') instead.';
- return false;
- }
- $offset += 4;
- $fmt_size = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 4));
- $offset += 4;
-
- $info['la']['raw']['format'] = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 2));
- $offset += 2;
-
- $info['la']['channels'] = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 2));
- $offset += 2;
- if ($info['la']['channels'] == 0) {
- $info['error'][] = 'Corrupt LA file: channels == zero';
- return false;
- }
-
- $info['la']['sample_rate'] = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 4));
- $offset += 4;
- if ($info['la']['sample_rate'] == 0) {
- $info['error'][] = 'Corrupt LA file: sample_rate == zero';
- return false;
- }
-
- $info['la']['bytes_per_second'] = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 4));
- $offset += 4;
- $info['la']['bytes_per_sample'] = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 2));
- $offset += 2;
- $info['la']['bits_per_sample'] = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 2));
- $offset += 2;
-
- $info['la']['samples'] = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 4));
- $offset += 4;
-
- $info['la']['raw']['flags'] = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 1));
- $offset += 1;
- $info['la']['flags']['seekable'] = (bool) ($info['la']['raw']['flags'] & 0x01);
- if ($info['la']['version'] >= 0.4) {
- $info['la']['flags']['high_compression'] = (bool) ($info['la']['raw']['flags'] & 0x02);
- }
-
- $info['la']['original_crc'] = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 4));
- $offset += 4;
-
- // mikebevin*de
- // Basically, the blocksize/seekevery are 61440/19 in La0.4 and 73728/16
- // in earlier versions. A seekpoint is added every blocksize * seekevery
- // samples, so 4 * int(totalSamples / (blockSize * seekEvery)) should
- // give the number of bytes used for the seekpoints. Of course, if seeking
- // is disabled, there are no seekpoints stored.
- if ($info['la']['version'] >= 0.4) {
- $info['la']['blocksize'] = 61440;
- $info['la']['seekevery'] = 19;
- } else {
- $info['la']['blocksize'] = 73728;
- $info['la']['seekevery'] = 16;
- }
-
- $info['la']['seekpoint_count'] = 0;
- if ($info['la']['flags']['seekable']) {
- $info['la']['seekpoint_count'] = floor($info['la']['samples'] / ($info['la']['blocksize'] * $info['la']['seekevery']));
-
- for ($i = 0; $i < $info['la']['seekpoint_count']; $i++) {
- $info['la']['seekpoints'][] = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 4));
- $offset += 4;
- }
- }
-
- if ($info['la']['version'] >= 0.3) {
-
- // Following the main header information, the program outputs all of the
- // seekpoints. Following these is what I called the 'footer start',
- // i.e. the position immediately after the La audio data is finished.
- $info['la']['footerstart'] = getid3_lib::LittleEndian2Int(substr($rawdata, $offset, 4));
- $offset += 4;
-
- if ($info['la']['footerstart'] > $info['filesize']) {
- $info['warning'][] = 'FooterStart value points to offset '.$info['la']['footerstart'].' which is beyond end-of-file ('.$info['filesize'].')';
- $info['la']['footerstart'] = $info['filesize'];
- }
-
- } else {
-
- // La v0.2 didn't have FooterStart value
- $info['la']['footerstart'] = $info['avdataend'];
-
- }
-
- if ($info['la']['footerstart'] < $info['avdataend']) {
- if ($RIFFtempfilename = tempnam(GETID3_TEMP_DIR, 'id3')) {
- if ($RIFF_fp = fopen($RIFFtempfilename, 'w+b')) {
- $RIFFdata = 'WAVE';
- if ($info['la']['version'] == 0.2) {
- $RIFFdata .= substr($rawdata, 12, 24);
- } else {
- $RIFFdata .= substr($rawdata, 16, 24);
- }
- if ($info['la']['footerstart'] < $info['avdataend']) {
- fseek($this->getid3->fp, $info['la']['footerstart'], SEEK_SET);
- $RIFFdata .= fread($this->getid3->fp, $info['avdataend'] - $info['la']['footerstart']);
- }
- $RIFFdata = 'RIFF'.getid3_lib::LittleEndian2String(strlen($RIFFdata), 4, false).$RIFFdata;
- fwrite($RIFF_fp, $RIFFdata, strlen($RIFFdata));
- fclose($RIFF_fp);
-
- $getid3_temp = new getID3();
- $getid3_temp->openfile($RIFFtempfilename);
- $getid3_riff = new getid3_riff($getid3_temp);
- $getid3_riff->Analyze();
-
- if (empty($getid3_temp->info['error'])) {
- $info['riff'] = $getid3_temp->info['riff'];
- } else {
- $info['warning'][] = 'Error parsing RIFF portion of La file: '.implode($getid3_temp->info['error']);
- }
- unset($getid3_temp, $getid3_riff);
- }
- unlink($RIFFtempfilename);
- }
- }
-
- // $info['avdataoffset'] should be zero to begin with, but just in case it's not, include the addition anyway
- $info['avdataend'] = $info['avdataoffset'] + $info['la']['footerstart'];
- $info['avdataoffset'] = $info['avdataoffset'] + $offset;
-
- //$info['la']['codec'] = RIFFwFormatTagLookup($info['la']['raw']['format']);
- $info['la']['compression_ratio'] = (float) (($info['avdataend'] - $info['avdataoffset']) / $info['la']['uncompressed_size']);
- $info['playtime_seconds'] = (float) ($info['la']['samples'] / $info['la']['sample_rate']) / $info['la']['channels'];
- if ($info['playtime_seconds'] == 0) {
- $info['error'][] = 'Corrupt LA file: playtime_seconds == zero';
- return false;
- }
-
- $info['audio']['bitrate'] = ($info['avdataend'] - $info['avdataoffset']) * 8 / $info['playtime_seconds'];
- //$info['audio']['codec'] = $info['la']['codec'];
- $info['audio']['bits_per_sample'] = $info['la']['bits_per_sample'];
- break;
-
- default:
- if (substr($rawdata, $offset, 2) == 'LA') {
- $info['error'][] = 'This version of getID3() ['.$this->getid3->version().'] does not support LA version '.substr($rawdata, $offset + 2, 1).'.'.substr($rawdata, $offset + 3, 1).' which this appears to be - check http://getid3.sourceforge.net for updates.';
- } else {
- $info['error'][] = 'Not a LA (Lossless-Audio) file';
- }
- return false;
- break;
- }
-
- $info['audio']['channels'] = $info['la']['channels'];
- $info['audio']['sample_rate'] = (int) $info['la']['sample_rate'];
- $info['audio']['encoder'] = 'LA v'.$info['la']['version'];
-
- return true;
- }
-
-}
-
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.audio.lpac.php b/3rdparty/getid3/module.audio.lpac.php
deleted file mode 100644
index 6ef0fb8acd0..00000000000
--- a/3rdparty/getid3/module.audio.lpac.php
+++ /dev/null
@@ -1,130 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.audio.lpac.php //
-// module for analyzing LPAC Audio files //
-// dependencies: module.audio-video.riff.php //
-// ///
-/////////////////////////////////////////////////////////////////
-
-getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, true);
-
-class getid3_lpac extends getid3_handler
-{
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
- $LPACheader = fread($this->getid3->fp, 14);
- if (substr($LPACheader, 0, 4) != 'LPAC') {
- $info['error'][] = 'Expected "LPAC" at offset '.$info['avdataoffset'].', found "'.$StreamMarker.'"';
- return false;
- }
- $info['avdataoffset'] += 14;
-
- $info['fileformat'] = 'lpac';
- $info['audio']['dataformat'] = 'lpac';
- $info['audio']['lossless'] = true;
- $info['audio']['bitrate_mode'] = 'vbr';
-
- $info['lpac']['file_version'] = getid3_lib::BigEndian2Int(substr($LPACheader, 4, 1));
- $flags['audio_type'] = getid3_lib::BigEndian2Int(substr($LPACheader, 5, 1));
- $info['lpac']['total_samples']= getid3_lib::BigEndian2Int(substr($LPACheader, 6, 4));
- $flags['parameters'] = getid3_lib::BigEndian2Int(substr($LPACheader, 10, 4));
-
- $info['lpac']['flags']['is_wave'] = (bool) ($flags['audio_type'] & 0x40);
- $info['lpac']['flags']['stereo'] = (bool) ($flags['audio_type'] & 0x04);
- $info['lpac']['flags']['24_bit'] = (bool) ($flags['audio_type'] & 0x02);
- $info['lpac']['flags']['16_bit'] = (bool) ($flags['audio_type'] & 0x01);
-
- if ($info['lpac']['flags']['24_bit'] && $info['lpac']['flags']['16_bit']) {
- $info['warning'][] = '24-bit and 16-bit flags cannot both be set';
- }
-
- $info['lpac']['flags']['fast_compress'] = (bool) ($flags['parameters'] & 0x40000000);
- $info['lpac']['flags']['random_access'] = (bool) ($flags['parameters'] & 0x08000000);
- $info['lpac']['block_length'] = pow(2, (($flags['parameters'] & 0x07000000) >> 24)) * 256;
- $info['lpac']['flags']['adaptive_prediction_order'] = (bool) ($flags['parameters'] & 0x00800000);
- $info['lpac']['flags']['adaptive_quantization'] = (bool) ($flags['parameters'] & 0x00400000);
- $info['lpac']['flags']['joint_stereo'] = (bool) ($flags['parameters'] & 0x00040000);
- $info['lpac']['quantization'] = ($flags['parameters'] & 0x00001F00) >> 8;
- $info['lpac']['max_prediction_order'] = ($flags['parameters'] & 0x0000003F);
-
- if ($info['lpac']['flags']['fast_compress'] && ($info['lpac']['max_prediction_order'] != 3)) {
- $info['warning'][] = 'max_prediction_order expected to be "3" if fast_compress is true, actual value is "'.$info['lpac']['max_prediction_order'].'"';
- }
- switch ($info['lpac']['file_version']) {
- case 6:
- if ($info['lpac']['flags']['adaptive_quantization']) {
- $info['warning'][] = 'adaptive_quantization expected to be false in LPAC file stucture v6, actually true';
- }
- if ($info['lpac']['quantization'] != 20) {
- $info['warning'][] = 'Quantization expected to be 20 in LPAC file stucture v6, actually '.$info['lpac']['flags']['Q'];
- }
- break;
-
- default:
- //$info['warning'][] = 'This version of getID3() ['.$this->getid3->version().'] only supports LPAC file format version 6, this file is version '.$info['lpac']['file_version'].' - please report to info@getid3.org';
- break;
- }
-
- $getid3_temp = new getID3();
- $getid3_temp->openfile($this->getid3->filename);
- $getid3_temp->info = $info;
- $getid3_riff = new getid3_riff($getid3_temp);
- $getid3_riff->Analyze();
- $info['avdataoffset'] = $getid3_temp->info['avdataoffset'];
- $info['riff'] = $getid3_temp->info['riff'];
- $info['error'] = $getid3_temp->info['error'];
- $info['warning'] = $getid3_temp->info['warning'];
- $info['lpac']['comments']['comment'] = $getid3_temp->info['comments'];
- $info['audio']['sample_rate'] = $getid3_temp->info['audio']['sample_rate'];
- unset($getid3_temp, $getid3_riff);
-
- $info['audio']['channels'] = ($info['lpac']['flags']['stereo'] ? 2 : 1);
-
- if ($info['lpac']['flags']['24_bit']) {
- $info['audio']['bits_per_sample'] = $info['riff']['audio'][0]['bits_per_sample'];
- } elseif ($info['lpac']['flags']['16_bit']) {
- $info['audio']['bits_per_sample'] = 16;
- } else {
- $info['audio']['bits_per_sample'] = 8;
- }
-
- if ($info['lpac']['flags']['fast_compress']) {
- // fast
- $info['audio']['encoder_options'] = '-1';
- } else {
- switch ($info['lpac']['max_prediction_order']) {
- case 20: // simple
- $info['audio']['encoder_options'] = '-2';
- break;
- case 30: // medium
- $info['audio']['encoder_options'] = '-3';
- break;
- case 40: // high
- $info['audio']['encoder_options'] = '-4';
- break;
- case 60: // extrahigh
- $info['audio']['encoder_options'] = '-5';
- break;
- }
- }
-
- $info['playtime_seconds'] = $info['lpac']['total_samples'] / $info['audio']['sample_rate'];
- $info['audio']['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds'];
-
- return true;
- }
-
-}
-
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.audio.midi.php b/3rdparty/getid3/module.audio.midi.php
deleted file mode 100644
index 7b839cf1404..00000000000
--- a/3rdparty/getid3/module.audio.midi.php
+++ /dev/null
@@ -1,526 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.audio.midi.php //
-// module for Midi Audio files //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-
-define('GETID3_MIDI_MAGIC_MTHD', 'MThd'); // MIDI file header magic
-define('GETID3_MIDI_MAGIC_MTRK', 'MTrk'); // MIDI track header magic
-
-class getid3_midi extends getid3_handler
-{
- var $scanwholefile = true;
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- // shortcut
- $info['midi']['raw'] = array();
- $thisfile_midi = &$info['midi'];
- $thisfile_midi_raw = &$thisfile_midi['raw'];
-
- $info['fileformat'] = 'midi';
- $info['audio']['dataformat'] = 'midi';
-
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
- $MIDIdata = fread($this->getid3->fp, $this->getid3->fread_buffer_size());
- $offset = 0;
- $MIDIheaderID = substr($MIDIdata, $offset, 4); // 'MThd'
- if ($MIDIheaderID != GETID3_MIDI_MAGIC_MTHD) {
- $info['error'][] = 'Expecting "'.getid3_lib::PrintHexBytes(GETID3_MIDI_MAGIC_MTHD).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($MIDIheaderID).'"';
- unset($info['fileformat']);
- return false;
- }
- $offset += 4;
- $thisfile_midi_raw['headersize'] = getid3_lib::BigEndian2Int(substr($MIDIdata, $offset, 4));
- $offset += 4;
- $thisfile_midi_raw['fileformat'] = getid3_lib::BigEndian2Int(substr($MIDIdata, $offset, 2));
- $offset += 2;
- $thisfile_midi_raw['tracks'] = getid3_lib::BigEndian2Int(substr($MIDIdata, $offset, 2));
- $offset += 2;
- $thisfile_midi_raw['ticksperqnote'] = getid3_lib::BigEndian2Int(substr($MIDIdata, $offset, 2));
- $offset += 2;
-
- for ($i = 0; $i < $thisfile_midi_raw['tracks']; $i++) {
- while ((strlen($MIDIdata) - $offset) < 8) {
- $MIDIdata .= fread($this->getid3->fp, $this->getid3->fread_buffer_size());
- }
- $trackID = substr($MIDIdata, $offset, 4);
- $offset += 4;
- if ($trackID == GETID3_MIDI_MAGIC_MTRK) {
- $tracksize = getid3_lib::BigEndian2Int(substr($MIDIdata, $offset, 4));
- $offset += 4;
- // $thisfile_midi['tracks'][$i]['size'] = $tracksize;
- $trackdataarray[$i] = substr($MIDIdata, $offset, $tracksize);
- $offset += $tracksize;
- } else {
- $info['error'][] = 'Expecting "'.getid3_lib::PrintHexBytes(GETID3_MIDI_MAGIC_MTRK).'" at '.($offset - 4).', found "'.getid3_lib::PrintHexBytes($trackID).'" instead';
- return false;
- }
- }
-
- if (!isset($trackdataarray) || !is_array($trackdataarray)) {
- $info['error'][] = 'Cannot find MIDI track information';
- unset($thisfile_midi);
- unset($info['fileformat']);
- return false;
- }
-
- if ($this->scanwholefile) { // this can take quite a long time, so have the option to bypass it if speed is very important
- $thisfile_midi['totalticks'] = 0;
- $info['playtime_seconds'] = 0;
- $CurrentMicroSecondsPerBeat = 500000; // 120 beats per minute; 60,000,000 microseconds per minute -> 500,000 microseconds per beat
- $CurrentBeatsPerMinute = 120; // 120 beats per minute; 60,000,000 microseconds per minute -> 500,000 microseconds per beat
- $MicroSecondsPerQuarterNoteAfter = array ();
-
- foreach ($trackdataarray as $tracknumber => $trackdata) {
-
- $eventsoffset = 0;
- $LastIssuedMIDIcommand = 0;
- $LastIssuedMIDIchannel = 0;
- $CumulativeDeltaTime = 0;
- $TicksAtCurrentBPM = 0;
- while ($eventsoffset < strlen($trackdata)) {
- $eventid = 0;
- if (isset($MIDIevents[$tracknumber]) && is_array($MIDIevents[$tracknumber])) {
- $eventid = count($MIDIevents[$tracknumber]);
- }
- $deltatime = 0;
- for ($i = 0; $i < 4; $i++) {
- $deltatimebyte = ord(substr($trackdata, $eventsoffset++, 1));
- $deltatime = ($deltatime << 7) + ($deltatimebyte & 0x7F);
- if ($deltatimebyte & 0x80) {
- // another byte follows
- } else {
- break;
- }
- }
- $CumulativeDeltaTime += $deltatime;
- $TicksAtCurrentBPM += $deltatime;
- $MIDIevents[$tracknumber][$eventid]['deltatime'] = $deltatime;
- $MIDI_event_channel = ord(substr($trackdata, $eventsoffset++, 1));
- if ($MIDI_event_channel & 0x80) {
- // OK, normal event - MIDI command has MSB set
- $LastIssuedMIDIcommand = $MIDI_event_channel >> 4;
- $LastIssuedMIDIchannel = $MIDI_event_channel & 0x0F;
- } else {
- // running event - assume last command
- $eventsoffset--;
- }
- $MIDIevents[$tracknumber][$eventid]['eventid'] = $LastIssuedMIDIcommand;
- $MIDIevents[$tracknumber][$eventid]['channel'] = $LastIssuedMIDIchannel;
- if ($MIDIevents[$tracknumber][$eventid]['eventid'] == 0x08) { // Note off (key is released)
-
- $notenumber = ord(substr($trackdata, $eventsoffset++, 1));
- $velocity = ord(substr($trackdata, $eventsoffset++, 1));
-
- } elseif ($MIDIevents[$tracknumber][$eventid]['eventid'] == 0x09) { // Note on (key is pressed)
-
- $notenumber = ord(substr($trackdata, $eventsoffset++, 1));
- $velocity = ord(substr($trackdata, $eventsoffset++, 1));
-
- } elseif ($MIDIevents[$tracknumber][$eventid]['eventid'] == 0x0A) { // Key after-touch
-
- $notenumber = ord(substr($trackdata, $eventsoffset++, 1));
- $velocity = ord(substr($trackdata, $eventsoffset++, 1));
-
- } elseif ($MIDIevents[$tracknumber][$eventid]['eventid'] == 0x0B) { // Control Change
-
- $controllernum = ord(substr($trackdata, $eventsoffset++, 1));
- $newvalue = ord(substr($trackdata, $eventsoffset++, 1));
-
- } elseif ($MIDIevents[$tracknumber][$eventid]['eventid'] == 0x0C) { // Program (patch) change
-
- $newprogramnum = ord(substr($trackdata, $eventsoffset++, 1));
-
- $thisfile_midi_raw['track'][$tracknumber]['instrumentid'] = $newprogramnum;
- if ($tracknumber == 10) {
- $thisfile_midi_raw['track'][$tracknumber]['instrument'] = $this->GeneralMIDIpercussionLookup($newprogramnum);
- } else {
- $thisfile_midi_raw['track'][$tracknumber]['instrument'] = $this->GeneralMIDIinstrumentLookup($newprogramnum);
- }
-
- } elseif ($MIDIevents[$tracknumber][$eventid]['eventid'] == 0x0D) { // Channel after-touch
-
- $channelnumber = ord(substr($trackdata, $eventsoffset++, 1));
-
- } elseif ($MIDIevents[$tracknumber][$eventid]['eventid'] == 0x0E) { // Pitch wheel change (2000H is normal or no change)
-
- $changeLSB = ord(substr($trackdata, $eventsoffset++, 1));
- $changeMSB = ord(substr($trackdata, $eventsoffset++, 1));
- $pitchwheelchange = (($changeMSB & 0x7F) << 7) & ($changeLSB & 0x7F);
-
- } elseif (($MIDIevents[$tracknumber][$eventid]['eventid'] == 0x0F) && ($MIDIevents[$tracknumber][$eventid]['channel'] == 0x0F)) {
-
- $METAeventCommand = ord(substr($trackdata, $eventsoffset++, 1));
- $METAeventLength = ord(substr($trackdata, $eventsoffset++, 1));
- $METAeventData = substr($trackdata, $eventsoffset, $METAeventLength);
- $eventsoffset += $METAeventLength;
- switch ($METAeventCommand) {
- case 0x00: // Set track sequence number
- $track_sequence_number = getid3_lib::BigEndian2Int(substr($METAeventData, 0, $METAeventLength));
- //$thisfile_midi_raw['events'][$tracknumber][$eventid]['seqno'] = $track_sequence_number;
- break;
-
- case 0x01: // Text: generic
- $text_generic = substr($METAeventData, 0, $METAeventLength);
- //$thisfile_midi_raw['events'][$tracknumber][$eventid]['text'] = $text_generic;
- $thisfile_midi['comments']['comment'][] = $text_generic;
- break;
-
- case 0x02: // Text: copyright
- $text_copyright = substr($METAeventData, 0, $METAeventLength);
- //$thisfile_midi_raw['events'][$tracknumber][$eventid]['copyright'] = $text_copyright;
- $thisfile_midi['comments']['copyright'][] = $text_copyright;
- break;
-
- case 0x03: // Text: track name
- $text_trackname = substr($METAeventData, 0, $METAeventLength);
- $thisfile_midi_raw['track'][$tracknumber]['name'] = $text_trackname;
- break;
-
- case 0x04: // Text: track instrument name
- $text_instrument = substr($METAeventData, 0, $METAeventLength);
- //$thisfile_midi_raw['events'][$tracknumber][$eventid]['instrument'] = $text_instrument;
- break;
-
- case 0x05: // Text: lyrics
- $text_lyrics = substr($METAeventData, 0, $METAeventLength);
- //$thisfile_midi_raw['events'][$tracknumber][$eventid]['lyrics'] = $text_lyrics;
- if (!isset($thisfile_midi['lyrics'])) {
- $thisfile_midi['lyrics'] = '';
- }
- $thisfile_midi['lyrics'] .= $text_lyrics."\n";
- break;
-
- case 0x06: // Text: marker
- $text_marker = substr($METAeventData, 0, $METAeventLength);
- //$thisfile_midi_raw['events'][$tracknumber][$eventid]['marker'] = $text_marker;
- break;
-
- case 0x07: // Text: cue point
- $text_cuepoint = substr($METAeventData, 0, $METAeventLength);
- //$thisfile_midi_raw['events'][$tracknumber][$eventid]['cuepoint'] = $text_cuepoint;
- break;
-
- case 0x2F: // End Of Track
- //$thisfile_midi_raw['events'][$tracknumber][$eventid]['EOT'] = $CumulativeDeltaTime;
- break;
-
- case 0x51: // Tempo: microseconds / quarter note
- $CurrentMicroSecondsPerBeat = getid3_lib::BigEndian2Int(substr($METAeventData, 0, $METAeventLength));
- if ($CurrentMicroSecondsPerBeat == 0) {
- $info['error'][] = 'Corrupt MIDI file: CurrentMicroSecondsPerBeat == zero';
- return false;
- }
- $thisfile_midi_raw['events'][$tracknumber][$CumulativeDeltaTime]['us_qnote'] = $CurrentMicroSecondsPerBeat;
- $CurrentBeatsPerMinute = (1000000 / $CurrentMicroSecondsPerBeat) * 60;
- $MicroSecondsPerQuarterNoteAfter[$CumulativeDeltaTime] = $CurrentMicroSecondsPerBeat;
- $TicksAtCurrentBPM = 0;
- break;
-
- case 0x58: // Time signature
- $timesig_numerator = getid3_lib::BigEndian2Int($METAeventData{0});
- $timesig_denominator = pow(2, getid3_lib::BigEndian2Int($METAeventData{1})); // $02 -> x/4, $03 -> x/8, etc
- $timesig_32inqnote = getid3_lib::BigEndian2Int($METAeventData{2}); // number of 32nd notes to the quarter note
- //$thisfile_midi_raw['events'][$tracknumber][$eventid]['timesig_32inqnote'] = $timesig_32inqnote;
- //$thisfile_midi_raw['events'][$tracknumber][$eventid]['timesig_numerator'] = $timesig_numerator;
- //$thisfile_midi_raw['events'][$tracknumber][$eventid]['timesig_denominator'] = $timesig_denominator;
- //$thisfile_midi_raw['events'][$tracknumber][$eventid]['timesig_text'] = $timesig_numerator.'/'.$timesig_denominator;
- $thisfile_midi['timesignature'][] = $timesig_numerator.'/'.$timesig_denominator;
- break;
-
- case 0x59: // Keysignature
- $keysig_sharpsflats = getid3_lib::BigEndian2Int($METAeventData{0});
- if ($keysig_sharpsflats & 0x80) {
- // (-7 -> 7 flats, 0 ->key of C, 7 -> 7 sharps)
- $keysig_sharpsflats -= 256;
- }
-
- $keysig_majorminor = getid3_lib::BigEndian2Int($METAeventData{1}); // 0 -> major, 1 -> minor
- $keysigs = array(-7=>'Cb', -6=>'Gb', -5=>'Db', -4=>'Ab', -3=>'Eb', -2=>'Bb', -1=>'F', 0=>'C', 1=>'G', 2=>'D', 3=>'A', 4=>'E', 5=>'B', 6=>'F#', 7=>'C#');
- //$thisfile_midi_raw['events'][$tracknumber][$eventid]['keysig_sharps'] = (($keysig_sharpsflats > 0) ? abs($keysig_sharpsflats) : 0);
- //$thisfile_midi_raw['events'][$tracknumber][$eventid]['keysig_flats'] = (($keysig_sharpsflats < 0) ? abs($keysig_sharpsflats) : 0);
- //$thisfile_midi_raw['events'][$tracknumber][$eventid]['keysig_minor'] = (bool) $keysig_majorminor;
- //$thisfile_midi_raw['events'][$tracknumber][$eventid]['keysig_text'] = $keysigs[$keysig_sharpsflats].' '.($thisfile_midi_raw['events'][$tracknumber][$eventid]['keysig_minor'] ? 'minor' : 'major');
-
- // $keysigs[$keysig_sharpsflats] gets an int key (correct) - $keysigs["$keysig_sharpsflats"] gets a string key (incorrect)
- $thisfile_midi['keysignature'][] = $keysigs[$keysig_sharpsflats].' '.((bool) $keysig_majorminor ? 'minor' : 'major');
- break;
-
- case 0x7F: // Sequencer specific information
- $custom_data = substr($METAeventData, 0, $METAeventLength);
- break;
-
- default:
- $info['warning'][] = 'Unhandled META Event Command: '.$METAeventCommand;
- break;
- }
-
- } else {
-
- $info['warning'][] = 'Unhandled MIDI Event ID: '.$MIDIevents[$tracknumber][$eventid]['eventid'].' + Channel ID: '.$MIDIevents[$tracknumber][$eventid]['channel'];
-
- }
- }
- if (($tracknumber > 0) || (count($trackdataarray) == 1)) {
- $thisfile_midi['totalticks'] = max($thisfile_midi['totalticks'], $CumulativeDeltaTime);
- }
- }
- $previoustickoffset = null;
-
- ksort($MicroSecondsPerQuarterNoteAfter);
- foreach ($MicroSecondsPerQuarterNoteAfter as $tickoffset => $microsecondsperbeat) {
- if (is_null($previoustickoffset)) {
- $prevmicrosecondsperbeat = $microsecondsperbeat;
- $previoustickoffset = $tickoffset;
- continue;
- }
- if ($thisfile_midi['totalticks'] > $tickoffset) {
-
- if ($thisfile_midi_raw['ticksperqnote'] == 0) {
- $info['error'][] = 'Corrupt MIDI file: ticksperqnote == zero';
- return false;
- }
-
- $info['playtime_seconds'] += (($tickoffset - $previoustickoffset) / $thisfile_midi_raw['ticksperqnote']) * ($prevmicrosecondsperbeat / 1000000);
-
- $prevmicrosecondsperbeat = $microsecondsperbeat;
- $previoustickoffset = $tickoffset;
- }
- }
- if ($thisfile_midi['totalticks'] > $previoustickoffset) {
-
- if ($thisfile_midi_raw['ticksperqnote'] == 0) {
- $info['error'][] = 'Corrupt MIDI file: ticksperqnote == zero';
- return false;
- }
-
- $info['playtime_seconds'] += (($thisfile_midi['totalticks'] - $previoustickoffset) / $thisfile_midi_raw['ticksperqnote']) * ($microsecondsperbeat / 1000000);
-
- }
- }
-
-
- if (!empty($info['playtime_seconds'])) {
- $info['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds'];
- }
-
- if (!empty($thisfile_midi['lyrics'])) {
- $thisfile_midi['comments']['lyrics'][] = $thisfile_midi['lyrics'];
- }
-
- return true;
- }
-
- function GeneralMIDIinstrumentLookup($instrumentid) {
-
- $begin = __LINE__;
-
- /** This is not a comment!
-
- 0 Acoustic Grand
- 1 Bright Acoustic
- 2 Electric Grand
- 3 Honky-Tonk
- 4 Electric Piano 1
- 5 Electric Piano 2
- 6 Harpsichord
- 7 Clavier
- 8 Celesta
- 9 Glockenspiel
- 10 Music Box
- 11 Vibraphone
- 12 Marimba
- 13 Xylophone
- 14 Tubular Bells
- 15 Dulcimer
- 16 Drawbar Organ
- 17 Percussive Organ
- 18 Rock Organ
- 19 Church Organ
- 20 Reed Organ
- 21 Accordian
- 22 Harmonica
- 23 Tango Accordian
- 24 Acoustic Guitar (nylon)
- 25 Acoustic Guitar (steel)
- 26 Electric Guitar (jazz)
- 27 Electric Guitar (clean)
- 28 Electric Guitar (muted)
- 29 Overdriven Guitar
- 30 Distortion Guitar
- 31 Guitar Harmonics
- 32 Acoustic Bass
- 33 Electric Bass (finger)
- 34 Electric Bass (pick)
- 35 Fretless Bass
- 36 Slap Bass 1
- 37 Slap Bass 2
- 38 Synth Bass 1
- 39 Synth Bass 2
- 40 Violin
- 41 Viola
- 42 Cello
- 43 Contrabass
- 44 Tremolo Strings
- 45 Pizzicato Strings
- 46 Orchestral Strings
- 47 Timpani
- 48 String Ensemble 1
- 49 String Ensemble 2
- 50 SynthStrings 1
- 51 SynthStrings 2
- 52 Choir Aahs
- 53 Voice Oohs
- 54 Synth Voice
- 55 Orchestra Hit
- 56 Trumpet
- 57 Trombone
- 58 Tuba
- 59 Muted Trumpet
- 60 French Horn
- 61 Brass Section
- 62 SynthBrass 1
- 63 SynthBrass 2
- 64 Soprano Sax
- 65 Alto Sax
- 66 Tenor Sax
- 67 Baritone Sax
- 68 Oboe
- 69 English Horn
- 70 Bassoon
- 71 Clarinet
- 72 Piccolo
- 73 Flute
- 74 Recorder
- 75 Pan Flute
- 76 Blown Bottle
- 77 Shakuhachi
- 78 Whistle
- 79 Ocarina
- 80 Lead 1 (square)
- 81 Lead 2 (sawtooth)
- 82 Lead 3 (calliope)
- 83 Lead 4 (chiff)
- 84 Lead 5 (charang)
- 85 Lead 6 (voice)
- 86 Lead 7 (fifths)
- 87 Lead 8 (bass + lead)
- 88 Pad 1 (new age)
- 89 Pad 2 (warm)
- 90 Pad 3 (polysynth)
- 91 Pad 4 (choir)
- 92 Pad 5 (bowed)
- 93 Pad 6 (metallic)
- 94 Pad 7 (halo)
- 95 Pad 8 (sweep)
- 96 FX 1 (rain)
- 97 FX 2 (soundtrack)
- 98 FX 3 (crystal)
- 99 FX 4 (atmosphere)
- 100 FX 5 (brightness)
- 101 FX 6 (goblins)
- 102 FX 7 (echoes)
- 103 FX 8 (sci-fi)
- 104 Sitar
- 105 Banjo
- 106 Shamisen
- 107 Koto
- 108 Kalimba
- 109 Bagpipe
- 110 Fiddle
- 111 Shanai
- 112 Tinkle Bell
- 113 Agogo
- 114 Steel Drums
- 115 Woodblock
- 116 Taiko Drum
- 117 Melodic Tom
- 118 Synth Drum
- 119 Reverse Cymbal
- 120 Guitar Fret Noise
- 121 Breath Noise
- 122 Seashore
- 123 Bird Tweet
- 124 Telephone Ring
- 125 Helicopter
- 126 Applause
- 127 Gunshot
-
- */
-
- return getid3_lib::EmbeddedLookup($instrumentid, $begin, __LINE__, __FILE__, 'GeneralMIDIinstrument');
- }
-
- function GeneralMIDIpercussionLookup($instrumentid) {
-
- $begin = __LINE__;
-
- /** This is not a comment!
-
- 35 Acoustic Bass Drum
- 36 Bass Drum 1
- 37 Side Stick
- 38 Acoustic Snare
- 39 Hand Clap
- 40 Electric Snare
- 41 Low Floor Tom
- 42 Closed Hi-Hat
- 43 High Floor Tom
- 44 Pedal Hi-Hat
- 45 Low Tom
- 46 Open Hi-Hat
- 47 Low-Mid Tom
- 48 Hi-Mid Tom
- 49 Crash Cymbal 1
- 50 High Tom
- 51 Ride Cymbal 1
- 52 Chinese Cymbal
- 53 Ride Bell
- 54 Tambourine
- 55 Splash Cymbal
- 56 Cowbell
- 57 Crash Cymbal 2
- 59 Ride Cymbal 2
- 60 Hi Bongo
- 61 Low Bongo
- 62 Mute Hi Conga
- 63 Open Hi Conga
- 64 Low Conga
- 65 High Timbale
- 66 Low Timbale
- 67 High Agogo
- 68 Low Agogo
- 69 Cabasa
- 70 Maracas
- 71 Short Whistle
- 72 Long Whistle
- 73 Short Guiro
- 74 Long Guiro
- 75 Claves
- 76 Hi Wood Block
- 77 Low Wood Block
- 78 Mute Cuica
- 79 Open Cuica
- 80 Mute Triangle
- 81 Open Triangle
-
- */
-
- return getid3_lib::EmbeddedLookup($instrumentid, $begin, __LINE__, __FILE__, 'GeneralMIDIpercussion');
- }
-
-}
-
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.audio.mod.php b/3rdparty/getid3/module.audio.mod.php
deleted file mode 100644
index b8817694261..00000000000
--- a/3rdparty/getid3/module.audio.mod.php
+++ /dev/null
@@ -1,101 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.audio.mod.php //
-// module for analyzing MOD Audio files //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_mod extends getid3_handler
-{
-
- function Analyze() {
- $info = &$this->getid3->info;
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
- $fileheader = fread($this->getid3->fp, 1088);
- if (preg_match('#^IMPM#', $fileheader)) {
- return $this->getITheaderFilepointer();
- } elseif (preg_match('#^Extended Module#', $fileheader)) {
- return $this->getXMheaderFilepointer();
- } elseif (preg_match('#^.{44}SCRM#', $fileheader)) {
- return $this->getS3MheaderFilepointer();
- } elseif (preg_match('#^.{1080}(M\\.K\\.|M!K!|FLT4|FLT8|[5-9]CHN|[1-3][0-9]CH)#', $fileheader)) {
- return $this->getMODheaderFilepointer();
- }
- $info['error'][] = 'This is not a known type of MOD file';
- return false;
- }
-
-
- function getMODheaderFilepointer() {
- $info = &$this->getid3->info;
- fseek($this->getid3->fp, $info['avdataoffset'] + 1080);
- $FormatID = fread($this->getid3->fp, 4);
- if (!preg_match('#^(M.K.|[5-9]CHN|[1-3][0-9]CH)$#', $FormatID)) {
- $info['error'][] = 'This is not a known type of MOD file';
- return false;
- }
-
- $info['fileformat'] = 'mod';
-
- $info['error'][] = 'MOD parsing not enabled in this version of getID3() ['.$this->getid3->version().']';
- return false;
- }
-
- function getXMheaderFilepointer() {
- $info = &$this->getid3->info;
- fseek($this->getid3->fp, $info['avdataoffset']);
- $FormatID = fread($this->getid3->fp, 15);
- if (!preg_match('#^Extended Module$#', $FormatID)) {
- $info['error'][] = 'This is not a known type of XM-MOD file';
- return false;
- }
-
- $info['fileformat'] = 'xm';
-
- $info['error'][] = 'XM-MOD parsing not enabled in this version of getID3() ['.$this->getid3->version().']';
- return false;
- }
-
- function getS3MheaderFilepointer() {
- $info = &$this->getid3->info;
- fseek($this->getid3->fp, $info['avdataoffset'] + 44);
- $FormatID = fread($this->getid3->fp, 4);
- if (!preg_match('#^SCRM$#', $FormatID)) {
- $info['error'][] = 'This is not a ScreamTracker MOD file';
- return false;
- }
-
- $info['fileformat'] = 's3m';
-
- $info['error'][] = 'ScreamTracker parsing not enabled in this version of getID3() ['.$this->getid3->version().']';
- return false;
- }
-
- function getITheaderFilepointer() {
- $info = &$this->getid3->info;
- fseek($this->getid3->fp, $info['avdataoffset']);
- $FormatID = fread($this->getid3->fp, 4);
- if (!preg_match('#^IMPM$#', $FormatID)) {
- $info['error'][] = 'This is not an ImpulseTracker MOD file';
- return false;
- }
-
- $info['fileformat'] = 'it';
-
- $info['error'][] = 'ImpulseTracker parsing not enabled in this version of getID3() ['.$this->getid3->version().']';
- return false;
- }
-
-}
-
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.audio.monkey.php b/3rdparty/getid3/module.audio.monkey.php
deleted file mode 100644
index ffaeae9f07b..00000000000
--- a/3rdparty/getid3/module.audio.monkey.php
+++ /dev/null
@@ -1,205 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.audio.monkey.php //
-// module for analyzing Monkey's Audio files //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_monkey extends getid3_handler
-{
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- // based loosely on code from TMonkey by Jurgen Faul <jfaulgmx*de>
- // http://jfaul.de/atl or http://j-faul.virtualave.net/atl/atl.html
-
- $info['fileformat'] = 'mac';
- $info['audio']['dataformat'] = 'mac';
- $info['audio']['bitrate_mode'] = 'vbr';
- $info['audio']['lossless'] = true;
-
- $info['monkeys_audio']['raw'] = array();
- $thisfile_monkeysaudio = &$info['monkeys_audio'];
- $thisfile_monkeysaudio_raw = &$thisfile_monkeysaudio['raw'];
-
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
- $MACheaderData = fread($this->getid3->fp, 74);
-
- $thisfile_monkeysaudio_raw['magic'] = substr($MACheaderData, 0, 4);
- $magic = 'MAC ';
- if ($thisfile_monkeysaudio_raw['magic'] != $magic) {
- $info['error'][] = 'Expecting "'.getid3_lib::PrintHexBytes($magic).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($thisfile_monkeysaudio_raw['magic']).'"';
- unset($info['fileformat']);
- return false;
- }
- $thisfile_monkeysaudio_raw['nVersion'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, 4, 2)); // appears to be uint32 in 3.98+
-
- if ($thisfile_monkeysaudio_raw['nVersion'] < 3980) {
- $thisfile_monkeysaudio_raw['nCompressionLevel'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, 6, 2));
- $thisfile_monkeysaudio_raw['nFormatFlags'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, 8, 2));
- $thisfile_monkeysaudio_raw['nChannels'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, 10, 2));
- $thisfile_monkeysaudio_raw['nSampleRate'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, 12, 4));
- $thisfile_monkeysaudio_raw['nHeaderDataBytes'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, 16, 4));
- $thisfile_monkeysaudio_raw['nWAVTerminatingBytes'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, 20, 4));
- $thisfile_monkeysaudio_raw['nTotalFrames'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, 24, 4));
- $thisfile_monkeysaudio_raw['nFinalFrameSamples'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, 28, 4));
- $thisfile_monkeysaudio_raw['nPeakLevel'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, 32, 4));
- $thisfile_monkeysaudio_raw['nSeekElements'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, 38, 2));
- $offset = 8;
- } else {
- $offset = 8;
- // APE_DESCRIPTOR
- $thisfile_monkeysaudio_raw['nDescriptorBytes'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 4));
- $offset += 4;
- $thisfile_monkeysaudio_raw['nHeaderBytes'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 4));
- $offset += 4;
- $thisfile_monkeysaudio_raw['nSeekTableBytes'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 4));
- $offset += 4;
- $thisfile_monkeysaudio_raw['nHeaderDataBytes'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 4));
- $offset += 4;
- $thisfile_monkeysaudio_raw['nAPEFrameDataBytes'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 4));
- $offset += 4;
- $thisfile_monkeysaudio_raw['nAPEFrameDataBytesHigh'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 4));
- $offset += 4;
- $thisfile_monkeysaudio_raw['nTerminatingDataBytes'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 4));
- $offset += 4;
- $thisfile_monkeysaudio_raw['cFileMD5'] = substr($MACheaderData, $offset, 16);
- $offset += 16;
-
- // APE_HEADER
- $thisfile_monkeysaudio_raw['nCompressionLevel'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 2));
- $offset += 2;
- $thisfile_monkeysaudio_raw['nFormatFlags'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 2));
- $offset += 2;
- $thisfile_monkeysaudio_raw['nBlocksPerFrame'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 4));
- $offset += 4;
- $thisfile_monkeysaudio_raw['nFinalFrameBlocks'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 4));
- $offset += 4;
- $thisfile_monkeysaudio_raw['nTotalFrames'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 4));
- $offset += 4;
- $thisfile_monkeysaudio_raw['nBitsPerSample'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 2));
- $offset += 2;
- $thisfile_monkeysaudio_raw['nChannels'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 2));
- $offset += 2;
- $thisfile_monkeysaudio_raw['nSampleRate'] = getid3_lib::LittleEndian2Int(substr($MACheaderData, $offset, 4));
- $offset += 4;
- }
-
- $thisfile_monkeysaudio['flags']['8-bit'] = (bool) ($thisfile_monkeysaudio_raw['nFormatFlags'] & 0x0001);
- $thisfile_monkeysaudio['flags']['crc-32'] = (bool) ($thisfile_monkeysaudio_raw['nFormatFlags'] & 0x0002);
- $thisfile_monkeysaudio['flags']['peak_level'] = (bool) ($thisfile_monkeysaudio_raw['nFormatFlags'] & 0x0004);
- $thisfile_monkeysaudio['flags']['24-bit'] = (bool) ($thisfile_monkeysaudio_raw['nFormatFlags'] & 0x0008);
- $thisfile_monkeysaudio['flags']['seek_elements'] = (bool) ($thisfile_monkeysaudio_raw['nFormatFlags'] & 0x0010);
- $thisfile_monkeysaudio['flags']['no_wav_header'] = (bool) ($thisfile_monkeysaudio_raw['nFormatFlags'] & 0x0020);
- $thisfile_monkeysaudio['version'] = $thisfile_monkeysaudio_raw['nVersion'] / 1000;
- $thisfile_monkeysaudio['compression'] = $this->MonkeyCompressionLevelNameLookup($thisfile_monkeysaudio_raw['nCompressionLevel']);
- if ($thisfile_monkeysaudio_raw['nVersion'] < 3980) {
- $thisfile_monkeysaudio['samples_per_frame'] = $this->MonkeySamplesPerFrame($thisfile_monkeysaudio_raw['nVersion'], $thisfile_monkeysaudio_raw['nCompressionLevel']);
- }
- $thisfile_monkeysaudio['bits_per_sample'] = ($thisfile_monkeysaudio['flags']['24-bit'] ? 24 : ($thisfile_monkeysaudio['flags']['8-bit'] ? 8 : 16));
- $thisfile_monkeysaudio['channels'] = $thisfile_monkeysaudio_raw['nChannels'];
- $info['audio']['channels'] = $thisfile_monkeysaudio['channels'];
- $thisfile_monkeysaudio['sample_rate'] = $thisfile_monkeysaudio_raw['nSampleRate'];
- if ($thisfile_monkeysaudio['sample_rate'] == 0) {
- $info['error'][] = 'Corrupt MAC file: frequency == zero';
- return false;
- }
- $info['audio']['sample_rate'] = $thisfile_monkeysaudio['sample_rate'];
- if ($thisfile_monkeysaudio['flags']['peak_level']) {
- $thisfile_monkeysaudio['peak_level'] = $thisfile_monkeysaudio_raw['nPeakLevel'];
- $thisfile_monkeysaudio['peak_ratio'] = $thisfile_monkeysaudio['peak_level'] / pow(2, $thisfile_monkeysaudio['bits_per_sample'] - 1);
- }
- if ($thisfile_monkeysaudio_raw['nVersion'] >= 3980) {
- $thisfile_monkeysaudio['samples'] = (($thisfile_monkeysaudio_raw['nTotalFrames'] - 1) * $thisfile_monkeysaudio_raw['nBlocksPerFrame']) + $thisfile_monkeysaudio_raw['nFinalFrameBlocks'];
- } else {
- $thisfile_monkeysaudio['samples'] = (($thisfile_monkeysaudio_raw['nTotalFrames'] - 1) * $thisfile_monkeysaudio['samples_per_frame']) + $thisfile_monkeysaudio_raw['nFinalFrameSamples'];
- }
- $thisfile_monkeysaudio['playtime'] = $thisfile_monkeysaudio['samples'] / $thisfile_monkeysaudio['sample_rate'];
- if ($thisfile_monkeysaudio['playtime'] == 0) {
- $info['error'][] = 'Corrupt MAC file: playtime == zero';
- return false;
- }
- $info['playtime_seconds'] = $thisfile_monkeysaudio['playtime'];
- $thisfile_monkeysaudio['compressed_size'] = $info['avdataend'] - $info['avdataoffset'];
- $thisfile_monkeysaudio['uncompressed_size'] = $thisfile_monkeysaudio['samples'] * $thisfile_monkeysaudio['channels'] * ($thisfile_monkeysaudio['bits_per_sample'] / 8);
- if ($thisfile_monkeysaudio['uncompressed_size'] == 0) {
- $info['error'][] = 'Corrupt MAC file: uncompressed_size == zero';
- return false;
- }
- $thisfile_monkeysaudio['compression_ratio'] = $thisfile_monkeysaudio['compressed_size'] / ($thisfile_monkeysaudio['uncompressed_size'] + $thisfile_monkeysaudio_raw['nHeaderDataBytes']);
- $thisfile_monkeysaudio['bitrate'] = (($thisfile_monkeysaudio['samples'] * $thisfile_monkeysaudio['channels'] * $thisfile_monkeysaudio['bits_per_sample']) / $thisfile_monkeysaudio['playtime']) * $thisfile_monkeysaudio['compression_ratio'];
- $info['audio']['bitrate'] = $thisfile_monkeysaudio['bitrate'];
-
- // add size of MAC header to avdataoffset
- if ($thisfile_monkeysaudio_raw['nVersion'] >= 3980) {
- $info['avdataoffset'] += $thisfile_monkeysaudio_raw['nDescriptorBytes'];
- $info['avdataoffset'] += $thisfile_monkeysaudio_raw['nHeaderBytes'];
- $info['avdataoffset'] += $thisfile_monkeysaudio_raw['nSeekTableBytes'];
- $info['avdataoffset'] += $thisfile_monkeysaudio_raw['nHeaderDataBytes'];
-
- $info['avdataend'] -= $thisfile_monkeysaudio_raw['nTerminatingDataBytes'];
- } else {
- $info['avdataoffset'] += $offset;
- }
-
- if ($thisfile_monkeysaudio_raw['nVersion'] >= 3980) {
- if ($thisfile_monkeysaudio_raw['cFileMD5'] === str_repeat("\x00", 16)) {
- //$info['warning'][] = 'cFileMD5 is null';
- } else {
- $info['md5_data_source'] = '';
- $md5 = $thisfile_monkeysaudio_raw['cFileMD5'];
- for ($i = 0; $i < strlen($md5); $i++) {
- $info['md5_data_source'] .= str_pad(dechex(ord($md5{$i})), 2, '00', STR_PAD_LEFT);
- }
- if (!preg_match('/^[0-9a-f]{32}$/', $info['md5_data_source'])) {
- unset($info['md5_data_source']);
- }
- }
- }
-
-
-
- $info['audio']['bits_per_sample'] = $thisfile_monkeysaudio['bits_per_sample'];
- $info['audio']['encoder'] = 'MAC v'.number_format($thisfile_monkeysaudio['version'], 2);
- $info['audio']['encoder_options'] = ucfirst($thisfile_monkeysaudio['compression']).' compression';
-
- return true;
- }
-
- function MonkeyCompressionLevelNameLookup($compressionlevel) {
- static $MonkeyCompressionLevelNameLookup = array(
- 0 => 'unknown',
- 1000 => 'fast',
- 2000 => 'normal',
- 3000 => 'high',
- 4000 => 'extra-high',
- 5000 => 'insane'
- );
- return (isset($MonkeyCompressionLevelNameLookup[$compressionlevel]) ? $MonkeyCompressionLevelNameLookup[$compressionlevel] : 'invalid');
- }
-
- function MonkeySamplesPerFrame($versionid, $compressionlevel) {
- if ($versionid >= 3950) {
- return 73728 * 4;
- } elseif ($versionid >= 3900) {
- return 73728;
- } elseif (($versionid >= 3800) && ($compressionlevel == 4000)) {
- return 73728;
- } else {
- return 9216;
- }
- }
-
-}
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.audio.mp3.php b/3rdparty/getid3/module.audio.mp3.php
deleted file mode 100644
index 909646e1a1e..00000000000
--- a/3rdparty/getid3/module.audio.mp3.php
+++ /dev/null
@@ -1,2011 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.audio.mp3.php //
-// module for analyzing MP3 files //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-// number of frames to scan to determine if MPEG-audio sequence is valid
-// Lower this number to 5-20 for faster scanning
-// Increase this number to 50+ for most accurate detection of valid VBR/CBR
-// mpeg-audio streams
-define('GETID3_MP3_VALID_CHECK_FRAMES', 35);
-
-
-class getid3_mp3 extends getid3_handler
-{
-
- var $allow_bruteforce = false; // forces getID3() to scan the file byte-by-byte and log all the valid audio frame headers - extremely slow, unrecommended, but may provide data from otherwise-unusuable files
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- $initialOffset = $info['avdataoffset'];
-
- if (!$this->getOnlyMPEGaudioInfo($info['avdataoffset'])) {
- if ($this->allow_bruteforce) {
- $info['error'][] = 'Rescanning file in BruteForce mode';
- $this->getOnlyMPEGaudioInfoBruteForce($this->getid3->fp, $info);
- }
- }
-
-
- if (isset($info['mpeg']['audio']['bitrate_mode'])) {
- $info['audio']['bitrate_mode'] = strtolower($info['mpeg']['audio']['bitrate_mode']);
- }
-
- if (((isset($info['id3v2']['headerlength']) && ($info['avdataoffset'] > $info['id3v2']['headerlength'])) || (!isset($info['id3v2']) && ($info['avdataoffset'] > 0) && ($info['avdataoffset'] != $initialOffset)))) {
-
- $synchoffsetwarning = 'Unknown data before synch ';
- if (isset($info['id3v2']['headerlength'])) {
- $synchoffsetwarning .= '(ID3v2 header ends at '.$info['id3v2']['headerlength'].', then '.($info['avdataoffset'] - $info['id3v2']['headerlength']).' bytes garbage, ';
- } elseif ($initialOffset > 0) {
- $synchoffsetwarning .= '(should be at '.$initialOffset.', ';
- } else {
- $synchoffsetwarning .= '(should be at beginning of file, ';
- }
- $synchoffsetwarning .= 'synch detected at '.$info['avdataoffset'].')';
- if (isset($info['audio']['bitrate_mode']) && ($info['audio']['bitrate_mode'] == 'cbr')) {
-
- if (!empty($info['id3v2']['headerlength']) && (($info['avdataoffset'] - $info['id3v2']['headerlength']) == $info['mpeg']['audio']['framelength'])) {
-
- $synchoffsetwarning .= '. This is a known problem with some versions of LAME (3.90-3.92) DLL in CBR mode.';
- $info['audio']['codec'] = 'LAME';
- $CurrentDataLAMEversionString = 'LAME3.';
-
- } elseif (empty($info['id3v2']['headerlength']) && ($info['avdataoffset'] == $info['mpeg']['audio']['framelength'])) {
-
- $synchoffsetwarning .= '. This is a known problem with some versions of LAME (3.90 - 3.92) DLL in CBR mode.';
- $info['audio']['codec'] = 'LAME';
- $CurrentDataLAMEversionString = 'LAME3.';
-
- }
-
- }
- $info['warning'][] = $synchoffsetwarning;
-
- }
-
- if (isset($info['mpeg']['audio']['LAME'])) {
- $info['audio']['codec'] = 'LAME';
- if (!empty($info['mpeg']['audio']['LAME']['long_version'])) {
- $info['audio']['encoder'] = rtrim($info['mpeg']['audio']['LAME']['long_version'], "\x00");
- } elseif (!empty($info['mpeg']['audio']['LAME']['short_version'])) {
- $info['audio']['encoder'] = rtrim($info['mpeg']['audio']['LAME']['short_version'], "\x00");
- }
- }
-
- $CurrentDataLAMEversionString = (!empty($CurrentDataLAMEversionString) ? $CurrentDataLAMEversionString : (isset($info['audio']['encoder']) ? $info['audio']['encoder'] : ''));
- if (!empty($CurrentDataLAMEversionString) && (substr($CurrentDataLAMEversionString, 0, 6) == 'LAME3.') && !preg_match('[0-9\)]', substr($CurrentDataLAMEversionString, -1))) {
- // a version number of LAME that does not end with a number like "LAME3.92"
- // or with a closing parenthesis like "LAME3.88 (alpha)"
- // or a version of LAME with the LAMEtag-not-filled-in-DLL-mode bug (3.90-3.92)
-
- // not sure what the actual last frame length will be, but will be less than or equal to 1441
- $PossiblyLongerLAMEversion_FrameLength = 1441;
-
- // Not sure what version of LAME this is - look in padding of last frame for longer version string
- $PossibleLAMEversionStringOffset = $info['avdataend'] - $PossiblyLongerLAMEversion_FrameLength;
- fseek($this->getid3->fp, $PossibleLAMEversionStringOffset);
- $PossiblyLongerLAMEversion_Data = fread($this->getid3->fp, $PossiblyLongerLAMEversion_FrameLength);
- switch (substr($CurrentDataLAMEversionString, -1)) {
- case 'a':
- case 'b':
- // "LAME3.94a" will have a longer version string of "LAME3.94 (alpha)" for example
- // need to trim off "a" to match longer string
- $CurrentDataLAMEversionString = substr($CurrentDataLAMEversionString, 0, -1);
- break;
- }
- if (($PossiblyLongerLAMEversion_String = strstr($PossiblyLongerLAMEversion_Data, $CurrentDataLAMEversionString)) !== false) {
- if (substr($PossiblyLongerLAMEversion_String, 0, strlen($CurrentDataLAMEversionString)) == $CurrentDataLAMEversionString) {
- $PossiblyLongerLAMEversion_NewString = substr($PossiblyLongerLAMEversion_String, 0, strspn($PossiblyLongerLAMEversion_String, 'LAME0123456789., (abcdefghijklmnopqrstuvwxyzJFSOND)')); //"LAME3.90.3" "LAME3.87 (beta 1, Sep 27 2000)" "LAME3.88 (beta)"
- if (empty($info['audio']['encoder']) || (strlen($PossiblyLongerLAMEversion_NewString) > strlen($info['audio']['encoder']))) {
- $info['audio']['encoder'] = $PossiblyLongerLAMEversion_NewString;
- }
- }
- }
- }
- if (!empty($info['audio']['encoder'])) {
- $info['audio']['encoder'] = rtrim($info['audio']['encoder'], "\x00 ");
- }
-
- switch (isset($info['mpeg']['audio']['layer']) ? $info['mpeg']['audio']['layer'] : '') {
- case 1:
- case 2:
- $info['audio']['dataformat'] = 'mp'.$info['mpeg']['audio']['layer'];
- break;
- }
- if (isset($info['fileformat']) && ($info['fileformat'] == 'mp3')) {
- switch ($info['audio']['dataformat']) {
- case 'mp1':
- case 'mp2':
- case 'mp3':
- $info['fileformat'] = $info['audio']['dataformat'];
- break;
-
- default:
- $info['warning'][] = 'Expecting [audio][dataformat] to be mp1/mp2/mp3 when fileformat == mp3, [audio][dataformat] actually "'.$info['audio']['dataformat'].'"';
- break;
- }
- }
-
- if (empty($info['fileformat'])) {
- unset($info['fileformat']);
- unset($info['audio']['bitrate_mode']);
- unset($info['avdataoffset']);
- unset($info['avdataend']);
- return false;
- }
-
- $info['mime_type'] = 'audio/mpeg';
- $info['audio']['lossless'] = false;
-
- // Calculate playtime
- if (!isset($info['playtime_seconds']) && isset($info['audio']['bitrate']) && ($info['audio']['bitrate'] > 0)) {
- $info['playtime_seconds'] = ($info['avdataend'] - $info['avdataoffset']) * 8 / $info['audio']['bitrate'];
- }
-
- $info['audio']['encoder_options'] = $this->GuessEncoderOptions();
-
- return true;
- }
-
-
- function GuessEncoderOptions() {
- // shortcuts
- $info = &$this->getid3->info;
- if (!empty($info['mpeg']['audio'])) {
- $thisfile_mpeg_audio = &$info['mpeg']['audio'];
- if (!empty($thisfile_mpeg_audio['LAME'])) {
- $thisfile_mpeg_audio_lame = &$thisfile_mpeg_audio['LAME'];
- }
- }
-
- $encoder_options = '';
- static $NamedPresetBitrates = array(16, 24, 40, 56, 112, 128, 160, 192, 256);
-
- if (isset($thisfile_mpeg_audio['VBR_method']) && ($thisfile_mpeg_audio['VBR_method'] == 'Fraunhofer') && !empty($thisfile_mpeg_audio['VBR_quality'])) {
-
- $encoder_options = 'VBR q'.$thisfile_mpeg_audio['VBR_quality'];
-
- } elseif (!empty($thisfile_mpeg_audio_lame['preset_used']) && (!in_array($thisfile_mpeg_audio_lame['preset_used_id'], $NamedPresetBitrates))) {
-
- $encoder_options = $thisfile_mpeg_audio_lame['preset_used'];
-
- } elseif (!empty($thisfile_mpeg_audio_lame['vbr_quality'])) {
-
- static $KnownEncoderValues = array();
- if (empty($KnownEncoderValues)) {
-
- //$KnownEncoderValues[abrbitrate_minbitrate][vbr_quality][raw_vbr_method][raw_noise_shaping][raw_stereo_mode][ath_type][lowpass_frequency] = 'preset name';
- $KnownEncoderValues[0xFF][58][1][1][3][2][20500] = '--alt-preset insane'; // 3.90, 3.90.1, 3.92
- $KnownEncoderValues[0xFF][58][1][1][3][2][20600] = '--alt-preset insane'; // 3.90.2, 3.90.3, 3.91
- $KnownEncoderValues[0xFF][57][1][1][3][4][20500] = '--alt-preset insane'; // 3.94, 3.95
- $KnownEncoderValues['**'][78][3][2][3][2][19500] = '--alt-preset extreme'; // 3.90, 3.90.1, 3.92
- $KnownEncoderValues['**'][78][3][2][3][2][19600] = '--alt-preset extreme'; // 3.90.2, 3.91
- $KnownEncoderValues['**'][78][3][1][3][2][19600] = '--alt-preset extreme'; // 3.90.3
- $KnownEncoderValues['**'][78][4][2][3][2][19500] = '--alt-preset fast extreme'; // 3.90, 3.90.1, 3.92
- $KnownEncoderValues['**'][78][4][2][3][2][19600] = '--alt-preset fast extreme'; // 3.90.2, 3.90.3, 3.91
- $KnownEncoderValues['**'][78][3][2][3][4][19000] = '--alt-preset standard'; // 3.90, 3.90.1, 3.90.2, 3.91, 3.92
- $KnownEncoderValues['**'][78][3][1][3][4][19000] = '--alt-preset standard'; // 3.90.3
- $KnownEncoderValues['**'][78][4][2][3][4][19000] = '--alt-preset fast standard'; // 3.90, 3.90.1, 3.90.2, 3.91, 3.92
- $KnownEncoderValues['**'][78][4][1][3][4][19000] = '--alt-preset fast standard'; // 3.90.3
- $KnownEncoderValues['**'][88][4][1][3][3][19500] = '--r3mix'; // 3.90, 3.90.1, 3.92
- $KnownEncoderValues['**'][88][4][1][3][3][19600] = '--r3mix'; // 3.90.2, 3.90.3, 3.91
- $KnownEncoderValues['**'][67][4][1][3][4][18000] = '--r3mix'; // 3.94, 3.95
- $KnownEncoderValues['**'][68][3][2][3][4][18000] = '--alt-preset medium'; // 3.90.3
- $KnownEncoderValues['**'][68][4][2][3][4][18000] = '--alt-preset fast medium'; // 3.90.3
-
- $KnownEncoderValues[0xFF][99][1][1][1][2][0] = '--preset studio'; // 3.90, 3.90.1, 3.90.2, 3.91, 3.92
- $KnownEncoderValues[0xFF][58][2][1][3][2][20600] = '--preset studio'; // 3.90.3, 3.93.1
- $KnownEncoderValues[0xFF][58][2][1][3][2][20500] = '--preset studio'; // 3.93
- $KnownEncoderValues[0xFF][57][2][1][3][4][20500] = '--preset studio'; // 3.94, 3.95
- $KnownEncoderValues[0xC0][88][1][1][1][2][0] = '--preset cd'; // 3.90, 3.90.1, 3.90.2, 3.91, 3.92
- $KnownEncoderValues[0xC0][58][2][2][3][2][19600] = '--preset cd'; // 3.90.3, 3.93.1
- $KnownEncoderValues[0xC0][58][2][2][3][2][19500] = '--preset cd'; // 3.93
- $KnownEncoderValues[0xC0][57][2][1][3][4][19500] = '--preset cd'; // 3.94, 3.95
- $KnownEncoderValues[0xA0][78][1][1][3][2][18000] = '--preset hifi'; // 3.90, 3.90.1, 3.90.2, 3.91, 3.92
- $KnownEncoderValues[0xA0][58][2][2][3][2][18000] = '--preset hifi'; // 3.90.3, 3.93, 3.93.1
- $KnownEncoderValues[0xA0][57][2][1][3][4][18000] = '--preset hifi'; // 3.94, 3.95
- $KnownEncoderValues[0x80][67][1][1][3][2][18000] = '--preset tape'; // 3.90, 3.90.1, 3.90.2, 3.91, 3.92
- $KnownEncoderValues[0x80][67][1][1][3][2][15000] = '--preset radio'; // 3.90, 3.90.1, 3.90.2, 3.91, 3.92
- $KnownEncoderValues[0x70][67][1][1][3][2][15000] = '--preset fm'; // 3.90, 3.90.1, 3.90.2, 3.91, 3.92
- $KnownEncoderValues[0x70][58][2][2][3][2][16000] = '--preset tape/radio/fm'; // 3.90.3, 3.93, 3.93.1
- $KnownEncoderValues[0x70][57][2][1][3][4][16000] = '--preset tape/radio/fm'; // 3.94, 3.95
- $KnownEncoderValues[0x38][58][2][2][0][2][10000] = '--preset voice'; // 3.90.3, 3.93, 3.93.1
- $KnownEncoderValues[0x38][57][2][1][0][4][15000] = '--preset voice'; // 3.94, 3.95
- $KnownEncoderValues[0x38][57][2][1][0][4][16000] = '--preset voice'; // 3.94a14
- $KnownEncoderValues[0x28][65][1][1][0][2][7500] = '--preset mw-us'; // 3.90, 3.90.1, 3.92
- $KnownEncoderValues[0x28][65][1][1][0][2][7600] = '--preset mw-us'; // 3.90.2, 3.91
- $KnownEncoderValues[0x28][58][2][2][0][2][7000] = '--preset mw-us'; // 3.90.3, 3.93, 3.93.1
- $KnownEncoderValues[0x28][57][2][1][0][4][10500] = '--preset mw-us'; // 3.94, 3.95
- $KnownEncoderValues[0x28][57][2][1][0][4][11200] = '--preset mw-us'; // 3.94a14
- $KnownEncoderValues[0x28][57][2][1][0][4][8800] = '--preset mw-us'; // 3.94a15
- $KnownEncoderValues[0x18][58][2][2][0][2][4000] = '--preset phon+/lw/mw-eu/sw'; // 3.90.3, 3.93.1
- $KnownEncoderValues[0x18][58][2][2][0][2][3900] = '--preset phon+/lw/mw-eu/sw'; // 3.93
- $KnownEncoderValues[0x18][57][2][1][0][4][5900] = '--preset phon+/lw/mw-eu/sw'; // 3.94, 3.95
- $KnownEncoderValues[0x18][57][2][1][0][4][6200] = '--preset phon+/lw/mw-eu/sw'; // 3.94a14
- $KnownEncoderValues[0x18][57][2][1][0][4][3200] = '--preset phon+/lw/mw-eu/sw'; // 3.94a15
- $KnownEncoderValues[0x10][58][2][2][0][2][3800] = '--preset phone'; // 3.90.3, 3.93.1
- $KnownEncoderValues[0x10][58][2][2][0][2][3700] = '--preset phone'; // 3.93
- $KnownEncoderValues[0x10][57][2][1][0][4][5600] = '--preset phone'; // 3.94, 3.95
- }
-
- if (isset($KnownEncoderValues[$thisfile_mpeg_audio_lame['raw']['abrbitrate_minbitrate']][$thisfile_mpeg_audio_lame['vbr_quality']][$thisfile_mpeg_audio_lame['raw']['vbr_method']][$thisfile_mpeg_audio_lame['raw']['noise_shaping']][$thisfile_mpeg_audio_lame['raw']['stereo_mode']][$thisfile_mpeg_audio_lame['ath_type']][$thisfile_mpeg_audio_lame['lowpass_frequency']])) {
-
- $encoder_options = $KnownEncoderValues[$thisfile_mpeg_audio_lame['raw']['abrbitrate_minbitrate']][$thisfile_mpeg_audio_lame['vbr_quality']][$thisfile_mpeg_audio_lame['raw']['vbr_method']][$thisfile_mpeg_audio_lame['raw']['noise_shaping']][$thisfile_mpeg_audio_lame['raw']['stereo_mode']][$thisfile_mpeg_audio_lame['ath_type']][$thisfile_mpeg_audio_lame['lowpass_frequency']];
-
- } elseif (isset($KnownEncoderValues['**'][$thisfile_mpeg_audio_lame['vbr_quality']][$thisfile_mpeg_audio_lame['raw']['vbr_method']][$thisfile_mpeg_audio_lame['raw']['noise_shaping']][$thisfile_mpeg_audio_lame['raw']['stereo_mode']][$thisfile_mpeg_audio_lame['ath_type']][$thisfile_mpeg_audio_lame['lowpass_frequency']])) {
-
- $encoder_options = $KnownEncoderValues['**'][$thisfile_mpeg_audio_lame['vbr_quality']][$thisfile_mpeg_audio_lame['raw']['vbr_method']][$thisfile_mpeg_audio_lame['raw']['noise_shaping']][$thisfile_mpeg_audio_lame['raw']['stereo_mode']][$thisfile_mpeg_audio_lame['ath_type']][$thisfile_mpeg_audio_lame['lowpass_frequency']];
-
- } elseif ($info['audio']['bitrate_mode'] == 'vbr') {
-
- // http://gabriel.mp3-tech.org/mp3infotag.html
- // int Quality = (100 - 10 * gfp->VBR_q - gfp->quality)h
-
-
- $LAME_V_value = 10 - ceil($thisfile_mpeg_audio_lame['vbr_quality'] / 10);
- $LAME_q_value = 100 - $thisfile_mpeg_audio_lame['vbr_quality'] - ($LAME_V_value * 10);
- $encoder_options = '-V'.$LAME_V_value.' -q'.$LAME_q_value;
-
- } elseif ($info['audio']['bitrate_mode'] == 'cbr') {
-
- $encoder_options = strtoupper($info['audio']['bitrate_mode']).ceil($info['audio']['bitrate'] / 1000);
-
- } else {
-
- $encoder_options = strtoupper($info['audio']['bitrate_mode']);
-
- }
-
- } elseif (!empty($thisfile_mpeg_audio_lame['bitrate_abr'])) {
-
- $encoder_options = 'ABR'.$thisfile_mpeg_audio_lame['bitrate_abr'];
-
- } elseif (!empty($info['audio']['bitrate'])) {
-
- if ($info['audio']['bitrate_mode'] == 'cbr') {
- $encoder_options = strtoupper($info['audio']['bitrate_mode']).ceil($info['audio']['bitrate'] / 1000);
- } else {
- $encoder_options = strtoupper($info['audio']['bitrate_mode']);
- }
-
- }
- if (!empty($thisfile_mpeg_audio_lame['bitrate_min'])) {
- $encoder_options .= ' -b'.$thisfile_mpeg_audio_lame['bitrate_min'];
- }
-
- if (!empty($thisfile_mpeg_audio_lame['encoding_flags']['nogap_prev']) || !empty($thisfile_mpeg_audio_lame['encoding_flags']['nogap_next'])) {
- $encoder_options .= ' --nogap';
- }
-
- if (!empty($thisfile_mpeg_audio_lame['lowpass_frequency'])) {
- $ExplodedOptions = explode(' ', $encoder_options, 4);
- if ($ExplodedOptions[0] == '--r3mix') {
- $ExplodedOptions[1] = 'r3mix';
- }
- switch ($ExplodedOptions[0]) {
- case '--preset':
- case '--alt-preset':
- case '--r3mix':
- if ($ExplodedOptions[1] == 'fast') {
- $ExplodedOptions[1] .= ' '.$ExplodedOptions[2];
- }
- switch ($ExplodedOptions[1]) {
- case 'portable':
- case 'medium':
- case 'standard':
- case 'extreme':
- case 'insane':
- case 'fast portable':
- case 'fast medium':
- case 'fast standard':
- case 'fast extreme':
- case 'fast insane':
- case 'r3mix':
- static $ExpectedLowpass = array(
- 'insane|20500' => 20500,
- 'insane|20600' => 20600, // 3.90.2, 3.90.3, 3.91
- 'medium|18000' => 18000,
- 'fast medium|18000' => 18000,
- 'extreme|19500' => 19500, // 3.90, 3.90.1, 3.92, 3.95
- 'extreme|19600' => 19600, // 3.90.2, 3.90.3, 3.91, 3.93.1
- 'fast extreme|19500' => 19500, // 3.90, 3.90.1, 3.92, 3.95
- 'fast extreme|19600' => 19600, // 3.90.2, 3.90.3, 3.91, 3.93.1
- 'standard|19000' => 19000,
- 'fast standard|19000' => 19000,
- 'r3mix|19500' => 19500, // 3.90, 3.90.1, 3.92
- 'r3mix|19600' => 19600, // 3.90.2, 3.90.3, 3.91
- 'r3mix|18000' => 18000, // 3.94, 3.95
- );
- if (!isset($ExpectedLowpass[$ExplodedOptions[1].'|'.$thisfile_mpeg_audio_lame['lowpass_frequency']]) && ($thisfile_mpeg_audio_lame['lowpass_frequency'] < 22050) && (round($thisfile_mpeg_audio_lame['lowpass_frequency'] / 1000) < round($thisfile_mpeg_audio['sample_rate'] / 2000))) {
- $encoder_options .= ' --lowpass '.$thisfile_mpeg_audio_lame['lowpass_frequency'];
- }
- break;
-
- default:
- break;
- }
- break;
- }
- }
-
- if (isset($thisfile_mpeg_audio_lame['raw']['source_sample_freq'])) {
- if (($thisfile_mpeg_audio['sample_rate'] == 44100) && ($thisfile_mpeg_audio_lame['raw']['source_sample_freq'] != 1)) {
- $encoder_options .= ' --resample 44100';
- } elseif (($thisfile_mpeg_audio['sample_rate'] == 48000) && ($thisfile_mpeg_audio_lame['raw']['source_sample_freq'] != 2)) {
- $encoder_options .= ' --resample 48000';
- } elseif ($thisfile_mpeg_audio['sample_rate'] < 44100) {
- switch ($thisfile_mpeg_audio_lame['raw']['source_sample_freq']) {
- case 0: // <= 32000
- // may or may not be same as source frequency - ignore
- break;
- case 1: // 44100
- case 2: // 48000
- case 3: // 48000+
- $ExplodedOptions = explode(' ', $encoder_options, 4);
- switch ($ExplodedOptions[0]) {
- case '--preset':
- case '--alt-preset':
- switch ($ExplodedOptions[1]) {
- case 'fast':
- case 'portable':
- case 'medium':
- case 'standard':
- case 'extreme':
- case 'insane':
- $encoder_options .= ' --resample '.$thisfile_mpeg_audio['sample_rate'];
- break;
-
- default:
- static $ExpectedResampledRate = array(
- 'phon+/lw/mw-eu/sw|16000' => 16000,
- 'mw-us|24000' => 24000, // 3.95
- 'mw-us|32000' => 32000, // 3.93
- 'mw-us|16000' => 16000, // 3.92
- 'phone|16000' => 16000,
- 'phone|11025' => 11025, // 3.94a15
- 'radio|32000' => 32000, // 3.94a15
- 'fm/radio|32000' => 32000, // 3.92
- 'fm|32000' => 32000, // 3.90
- 'voice|32000' => 32000);
- if (!isset($ExpectedResampledRate[$ExplodedOptions[1].'|'.$thisfile_mpeg_audio['sample_rate']])) {
- $encoder_options .= ' --resample '.$thisfile_mpeg_audio['sample_rate'];
- }
- break;
- }
- break;
-
- case '--r3mix':
- default:
- $encoder_options .= ' --resample '.$thisfile_mpeg_audio['sample_rate'];
- break;
- }
- break;
- }
- }
- }
- if (empty($encoder_options) && !empty($info['audio']['bitrate']) && !empty($info['audio']['bitrate_mode'])) {
- //$encoder_options = strtoupper($info['audio']['bitrate_mode']).ceil($info['audio']['bitrate'] / 1000);
- $encoder_options = strtoupper($info['audio']['bitrate_mode']);
- }
-
- return $encoder_options;
- }
-
-
- function decodeMPEGaudioHeader($offset, &$info, $recursivesearch=true, $ScanAsCBR=false, $FastMPEGheaderScan=false) {
- static $MPEGaudioVersionLookup;
- static $MPEGaudioLayerLookup;
- static $MPEGaudioBitrateLookup;
- static $MPEGaudioFrequencyLookup;
- static $MPEGaudioChannelModeLookup;
- static $MPEGaudioModeExtensionLookup;
- static $MPEGaudioEmphasisLookup;
- if (empty($MPEGaudioVersionLookup)) {
- $MPEGaudioVersionLookup = getid3_mp3::MPEGaudioVersionArray();
- $MPEGaudioLayerLookup = getid3_mp3::MPEGaudioLayerArray();
- $MPEGaudioBitrateLookup = getid3_mp3::MPEGaudioBitrateArray();
- $MPEGaudioFrequencyLookup = getid3_mp3::MPEGaudioFrequencyArray();
- $MPEGaudioChannelModeLookup = getid3_mp3::MPEGaudioChannelModeArray();
- $MPEGaudioModeExtensionLookup = getid3_mp3::MPEGaudioModeExtensionArray();
- $MPEGaudioEmphasisLookup = getid3_mp3::MPEGaudioEmphasisArray();
- }
-
- if (fseek($this->getid3->fp, $offset, SEEK_SET) != 0) {
- $info['error'][] = 'decodeMPEGaudioHeader() failed to seek to next offset at '.$offset;
- return false;
- }
- //$headerstring = fread($this->getid3->fp, 1441); // worst-case max length = 32kHz @ 320kbps layer 3 = 1441 bytes/frame
- $headerstring = fread($this->getid3->fp, 226); // LAME header at offset 36 + 190 bytes of Xing/LAME data
-
- // MP3 audio frame structure:
- // $aa $aa $aa $aa [$bb $bb] $cc...
- // where $aa..$aa is the four-byte mpeg-audio header (below)
- // $bb $bb is the optional 2-byte CRC
- // and $cc... is the audio data
-
- $head4 = substr($headerstring, 0, 4);
-
- static $MPEGaudioHeaderDecodeCache = array();
- if (isset($MPEGaudioHeaderDecodeCache[$head4])) {
- $MPEGheaderRawArray = $MPEGaudioHeaderDecodeCache[$head4];
- } else {
- $MPEGheaderRawArray = getid3_mp3::MPEGaudioHeaderDecode($head4);
- $MPEGaudioHeaderDecodeCache[$head4] = $MPEGheaderRawArray;
- }
-
- static $MPEGaudioHeaderValidCache = array();
- if (!isset($MPEGaudioHeaderValidCache[$head4])) { // Not in cache
- //$MPEGaudioHeaderValidCache[$head4] = getid3_mp3::MPEGaudioHeaderValid($MPEGheaderRawArray, false, true); // allow badly-formatted freeformat (from LAME 3.90 - 3.93.1)
- $MPEGaudioHeaderValidCache[$head4] = getid3_mp3::MPEGaudioHeaderValid($MPEGheaderRawArray, false, false);
- }
-
- // shortcut
- if (!isset($info['mpeg']['audio'])) {
- $info['mpeg']['audio'] = array();
- }
- $thisfile_mpeg_audio = &$info['mpeg']['audio'];
-
-
- if ($MPEGaudioHeaderValidCache[$head4]) {
- $thisfile_mpeg_audio['raw'] = $MPEGheaderRawArray;
- } else {
- $info['error'][] = 'Invalid MPEG audio header ('.getid3_lib::PrintHexBytes($head4).') at offset '.$offset;
- return false;
- }
-
- if (!$FastMPEGheaderScan) {
- $thisfile_mpeg_audio['version'] = $MPEGaudioVersionLookup[$thisfile_mpeg_audio['raw']['version']];
- $thisfile_mpeg_audio['layer'] = $MPEGaudioLayerLookup[$thisfile_mpeg_audio['raw']['layer']];
-
- $thisfile_mpeg_audio['channelmode'] = $MPEGaudioChannelModeLookup[$thisfile_mpeg_audio['raw']['channelmode']];
- $thisfile_mpeg_audio['channels'] = (($thisfile_mpeg_audio['channelmode'] == 'mono') ? 1 : 2);
- $thisfile_mpeg_audio['sample_rate'] = $MPEGaudioFrequencyLookup[$thisfile_mpeg_audio['version']][$thisfile_mpeg_audio['raw']['sample_rate']];
- $thisfile_mpeg_audio['protection'] = !$thisfile_mpeg_audio['raw']['protection'];
- $thisfile_mpeg_audio['private'] = (bool) $thisfile_mpeg_audio['raw']['private'];
- $thisfile_mpeg_audio['modeextension'] = $MPEGaudioModeExtensionLookup[$thisfile_mpeg_audio['layer']][$thisfile_mpeg_audio['raw']['modeextension']];
- $thisfile_mpeg_audio['copyright'] = (bool) $thisfile_mpeg_audio['raw']['copyright'];
- $thisfile_mpeg_audio['original'] = (bool) $thisfile_mpeg_audio['raw']['original'];
- $thisfile_mpeg_audio['emphasis'] = $MPEGaudioEmphasisLookup[$thisfile_mpeg_audio['raw']['emphasis']];
-
- $info['audio']['channels'] = $thisfile_mpeg_audio['channels'];
- $info['audio']['sample_rate'] = $thisfile_mpeg_audio['sample_rate'];
-
- if ($thisfile_mpeg_audio['protection']) {
- $thisfile_mpeg_audio['crc'] = getid3_lib::BigEndian2Int(substr($headerstring, 4, 2));
- }
- }
-
- if ($thisfile_mpeg_audio['raw']['bitrate'] == 15) {
- // http://www.hydrogenaudio.org/?act=ST&f=16&t=9682&st=0
- $info['warning'][] = 'Invalid bitrate index (15), this is a known bug in free-format MP3s encoded by LAME v3.90 - 3.93.1';
- $thisfile_mpeg_audio['raw']['bitrate'] = 0;
- }
- $thisfile_mpeg_audio['padding'] = (bool) $thisfile_mpeg_audio['raw']['padding'];
- $thisfile_mpeg_audio['bitrate'] = $MPEGaudioBitrateLookup[$thisfile_mpeg_audio['version']][$thisfile_mpeg_audio['layer']][$thisfile_mpeg_audio['raw']['bitrate']];
-
- if (($thisfile_mpeg_audio['bitrate'] == 'free') && ($offset == $info['avdataoffset'])) {
- // only skip multiple frame check if free-format bitstream found at beginning of file
- // otherwise is quite possibly simply corrupted data
- $recursivesearch = false;
- }
-
- // For Layer 2 there are some combinations of bitrate and mode which are not allowed.
- if (!$FastMPEGheaderScan && ($thisfile_mpeg_audio['layer'] == '2')) {
-
- $info['audio']['dataformat'] = 'mp2';
- switch ($thisfile_mpeg_audio['channelmode']) {
-
- case 'mono':
- if (($thisfile_mpeg_audio['bitrate'] == 'free') || ($thisfile_mpeg_audio['bitrate'] <= 192000)) {
- // these are ok
- } else {
- $info['error'][] = $thisfile_mpeg_audio['bitrate'].'kbps not allowed in Layer 2, '.$thisfile_mpeg_audio['channelmode'].'.';
- return false;
- }
- break;
-
- case 'stereo':
- case 'joint stereo':
- case 'dual channel':
- if (($thisfile_mpeg_audio['bitrate'] == 'free') || ($thisfile_mpeg_audio['bitrate'] == 64000) || ($thisfile_mpeg_audio['bitrate'] >= 96000)) {
- // these are ok
- } else {
- $info['error'][] = intval(round($thisfile_mpeg_audio['bitrate'] / 1000)).'kbps not allowed in Layer 2, '.$thisfile_mpeg_audio['channelmode'].'.';
- return false;
- }
- break;
-
- }
-
- }
-
-
- if ($info['audio']['sample_rate'] > 0) {
- $thisfile_mpeg_audio['framelength'] = getid3_mp3::MPEGaudioFrameLength($thisfile_mpeg_audio['bitrate'], $thisfile_mpeg_audio['version'], $thisfile_mpeg_audio['layer'], (int) $thisfile_mpeg_audio['padding'], $info['audio']['sample_rate']);
- }
-
- $nextframetestoffset = $offset + 1;
- if ($thisfile_mpeg_audio['bitrate'] != 'free') {
-
- $info['audio']['bitrate'] = $thisfile_mpeg_audio['bitrate'];
-
- if (isset($thisfile_mpeg_audio['framelength'])) {
- $nextframetestoffset = $offset + $thisfile_mpeg_audio['framelength'];
- } else {
- $info['error'][] = 'Frame at offset('.$offset.') is has an invalid frame length.';
- return false;
- }
-
- }
-
- $ExpectedNumberOfAudioBytes = 0;
-
- ////////////////////////////////////////////////////////////////////////////////////
- // Variable-bitrate headers
-
- if (substr($headerstring, 4 + 32, 4) == 'VBRI') {
- // Fraunhofer VBR header is hardcoded 'VBRI' at offset 0x24 (36)
- // specs taken from http://minnie.tuhs.org/pipermail/mp3encoder/2001-January/001800.html
-
- $thisfile_mpeg_audio['bitrate_mode'] = 'vbr';
- $thisfile_mpeg_audio['VBR_method'] = 'Fraunhofer';
- $info['audio']['codec'] = 'Fraunhofer';
-
- $SideInfoData = substr($headerstring, 4 + 2, 32);
-
- $FraunhoferVBROffset = 36;
-
- $thisfile_mpeg_audio['VBR_encoder_version'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 4, 2)); // VbriVersion
- $thisfile_mpeg_audio['VBR_encoder_delay'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 6, 2)); // VbriDelay
- $thisfile_mpeg_audio['VBR_quality'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 8, 2)); // VbriQuality
- $thisfile_mpeg_audio['VBR_bytes'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 10, 4)); // VbriStreamBytes
- $thisfile_mpeg_audio['VBR_frames'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 14, 4)); // VbriStreamFrames
- $thisfile_mpeg_audio['VBR_seek_offsets'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 18, 2)); // VbriTableSize
- $thisfile_mpeg_audio['VBR_seek_scale'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 20, 2)); // VbriTableScale
- $thisfile_mpeg_audio['VBR_entry_bytes'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 22, 2)); // VbriEntryBytes
- $thisfile_mpeg_audio['VBR_entry_frames'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 24, 2)); // VbriEntryFrames
-
- $ExpectedNumberOfAudioBytes = $thisfile_mpeg_audio['VBR_bytes'];
-
- $previousbyteoffset = $offset;
- for ($i = 0; $i < $thisfile_mpeg_audio['VBR_seek_offsets']; $i++) {
- $Fraunhofer_OffsetN = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset, $thisfile_mpeg_audio['VBR_entry_bytes']));
- $FraunhoferVBROffset += $thisfile_mpeg_audio['VBR_entry_bytes'];
- $thisfile_mpeg_audio['VBR_offsets_relative'][$i] = ($Fraunhofer_OffsetN * $thisfile_mpeg_audio['VBR_seek_scale']);
- $thisfile_mpeg_audio['VBR_offsets_absolute'][$i] = ($Fraunhofer_OffsetN * $thisfile_mpeg_audio['VBR_seek_scale']) + $previousbyteoffset;
- $previousbyteoffset += $Fraunhofer_OffsetN;
- }
-
-
- } else {
-
- // Xing VBR header is hardcoded 'Xing' at a offset 0x0D (13), 0x15 (21) or 0x24 (36)
- // depending on MPEG layer and number of channels
-
- $VBRidOffset = getid3_mp3::XingVBRidOffset($thisfile_mpeg_audio['version'], $thisfile_mpeg_audio['channelmode']);
- $SideInfoData = substr($headerstring, 4 + 2, $VBRidOffset - 4);
-
- if ((substr($headerstring, $VBRidOffset, strlen('Xing')) == 'Xing') || (substr($headerstring, $VBRidOffset, strlen('Info')) == 'Info')) {
- // 'Xing' is traditional Xing VBR frame
- // 'Info' is LAME-encoded CBR (This was done to avoid CBR files to be recognized as traditional Xing VBR files by some decoders.)
- // 'Info' *can* legally be used to specify a VBR file as well, however.
-
- // http://www.multiweb.cz/twoinches/MP3inside.htm
- //00..03 = "Xing" or "Info"
- //04..07 = Flags:
- // 0x01 Frames Flag set if value for number of frames in file is stored
- // 0x02 Bytes Flag set if value for filesize in bytes is stored
- // 0x04 TOC Flag set if values for TOC are stored
- // 0x08 VBR Scale Flag set if values for VBR scale is stored
- //08..11 Frames: Number of frames in file (including the first Xing/Info one)
- //12..15 Bytes: File length in Bytes
- //16..115 TOC (Table of Contents):
- // Contains of 100 indexes (one Byte length) for easier lookup in file. Approximately solves problem with moving inside file.
- // Each Byte has a value according this formula:
- // (TOC[i] / 256) * fileLenInBytes
- // So if song lasts eg. 240 sec. and you want to jump to 60. sec. (and file is 5 000 000 Bytes length) you can use:
- // TOC[(60/240)*100] = TOC[25]
- // and corresponding Byte in file is then approximately at:
- // (TOC[25]/256) * 5000000
- //116..119 VBR Scale
-
-
- // should be safe to leave this at 'vbr' and let it be overriden to 'cbr' if a CBR preset/mode is used by LAME
-// if (substr($headerstring, $VBRidOffset, strlen('Info')) == 'Xing') {
- $thisfile_mpeg_audio['bitrate_mode'] = 'vbr';
- $thisfile_mpeg_audio['VBR_method'] = 'Xing';
-// } else {
-// $ScanAsCBR = true;
-// $thisfile_mpeg_audio['bitrate_mode'] = 'cbr';
-// }
-
- $thisfile_mpeg_audio['xing_flags_raw'] = getid3_lib::BigEndian2Int(substr($headerstring, $VBRidOffset + 4, 4));
-
- $thisfile_mpeg_audio['xing_flags']['frames'] = (bool) ($thisfile_mpeg_audio['xing_flags_raw'] & 0x00000001);
- $thisfile_mpeg_audio['xing_flags']['bytes'] = (bool) ($thisfile_mpeg_audio['xing_flags_raw'] & 0x00000002);
- $thisfile_mpeg_audio['xing_flags']['toc'] = (bool) ($thisfile_mpeg_audio['xing_flags_raw'] & 0x00000004);
- $thisfile_mpeg_audio['xing_flags']['vbr_scale'] = (bool) ($thisfile_mpeg_audio['xing_flags_raw'] & 0x00000008);
-
- if ($thisfile_mpeg_audio['xing_flags']['frames']) {
- $thisfile_mpeg_audio['VBR_frames'] = getid3_lib::BigEndian2Int(substr($headerstring, $VBRidOffset + 8, 4));
- //$thisfile_mpeg_audio['VBR_frames']--; // don't count header Xing/Info frame
- }
- if ($thisfile_mpeg_audio['xing_flags']['bytes']) {
- $thisfile_mpeg_audio['VBR_bytes'] = getid3_lib::BigEndian2Int(substr($headerstring, $VBRidOffset + 12, 4));
- }
-
- //if (($thisfile_mpeg_audio['bitrate'] == 'free') && !empty($thisfile_mpeg_audio['VBR_frames']) && !empty($thisfile_mpeg_audio['VBR_bytes'])) {
- if (!empty($thisfile_mpeg_audio['VBR_frames']) && !empty($thisfile_mpeg_audio['VBR_bytes'])) {
-
- $framelengthfloat = $thisfile_mpeg_audio['VBR_bytes'] / $thisfile_mpeg_audio['VBR_frames'];
-
- if ($thisfile_mpeg_audio['layer'] == '1') {
- // BitRate = (((FrameLengthInBytes / 4) - Padding) * SampleRate) / 12
- //$info['audio']['bitrate'] = ((($framelengthfloat / 4) - intval($thisfile_mpeg_audio['padding'])) * $thisfile_mpeg_audio['sample_rate']) / 12;
- $info['audio']['bitrate'] = ($framelengthfloat / 4) * $thisfile_mpeg_audio['sample_rate'] * (2 / $info['audio']['channels']) / 12;
- } else {
- // Bitrate = ((FrameLengthInBytes - Padding) * SampleRate) / 144
- //$info['audio']['bitrate'] = (($framelengthfloat - intval($thisfile_mpeg_audio['padding'])) * $thisfile_mpeg_audio['sample_rate']) / 144;
- $info['audio']['bitrate'] = $framelengthfloat * $thisfile_mpeg_audio['sample_rate'] * (2 / $info['audio']['channels']) / 144;
- }
- $thisfile_mpeg_audio['framelength'] = floor($framelengthfloat);
- }
-
- if ($thisfile_mpeg_audio['xing_flags']['toc']) {
- $LAMEtocData = substr($headerstring, $VBRidOffset + 16, 100);
- for ($i = 0; $i < 100; $i++) {
- $thisfile_mpeg_audio['toc'][$i] = ord($LAMEtocData{$i});
- }
- }
- if ($thisfile_mpeg_audio['xing_flags']['vbr_scale']) {
- $thisfile_mpeg_audio['VBR_scale'] = getid3_lib::BigEndian2Int(substr($headerstring, $VBRidOffset + 116, 4));
- }
-
-
- // http://gabriel.mp3-tech.org/mp3infotag.html
- if (substr($headerstring, $VBRidOffset + 120, 4) == 'LAME') {
-
- // shortcut
- $thisfile_mpeg_audio['LAME'] = array();
- $thisfile_mpeg_audio_lame = &$thisfile_mpeg_audio['LAME'];
-
-
- $thisfile_mpeg_audio_lame['long_version'] = substr($headerstring, $VBRidOffset + 120, 20);
- $thisfile_mpeg_audio_lame['short_version'] = substr($thisfile_mpeg_audio_lame['long_version'], 0, 9);
-
- if ($thisfile_mpeg_audio_lame['short_version'] >= 'LAME3.90') {
-
- // extra 11 chars are not part of version string when LAMEtag present
- unset($thisfile_mpeg_audio_lame['long_version']);
-
- // It the LAME tag was only introduced in LAME v3.90
- // http://www.hydrogenaudio.org/?act=ST&f=15&t=9933
-
- // Offsets of various bytes in http://gabriel.mp3-tech.org/mp3infotag.html
- // are assuming a 'Xing' identifier offset of 0x24, which is the case for
- // MPEG-1 non-mono, but not for other combinations
- $LAMEtagOffsetContant = $VBRidOffset - 0x24;
-
- // shortcuts
- $thisfile_mpeg_audio_lame['RGAD'] = array('track'=>array(), 'album'=>array());
- $thisfile_mpeg_audio_lame_RGAD = &$thisfile_mpeg_audio_lame['RGAD'];
- $thisfile_mpeg_audio_lame_RGAD_track = &$thisfile_mpeg_audio_lame_RGAD['track'];
- $thisfile_mpeg_audio_lame_RGAD_album = &$thisfile_mpeg_audio_lame_RGAD['album'];
- $thisfile_mpeg_audio_lame['raw'] = array();
- $thisfile_mpeg_audio_lame_raw = &$thisfile_mpeg_audio_lame['raw'];
-
- // byte $9B VBR Quality
- // This field is there to indicate a quality level, although the scale was not precised in the original Xing specifications.
- // Actually overwrites original Xing bytes
- unset($thisfile_mpeg_audio['VBR_scale']);
- $thisfile_mpeg_audio_lame['vbr_quality'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0x9B, 1));
-
- // bytes $9C-$A4 Encoder short VersionString
- $thisfile_mpeg_audio_lame['short_version'] = substr($headerstring, $LAMEtagOffsetContant + 0x9C, 9);
-
- // byte $A5 Info Tag revision + VBR method
- $LAMEtagRevisionVBRmethod = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xA5, 1));
-
- $thisfile_mpeg_audio_lame['tag_revision'] = ($LAMEtagRevisionVBRmethod & 0xF0) >> 4;
- $thisfile_mpeg_audio_lame_raw['vbr_method'] = $LAMEtagRevisionVBRmethod & 0x0F;
- $thisfile_mpeg_audio_lame['vbr_method'] = getid3_mp3::LAMEvbrMethodLookup($thisfile_mpeg_audio_lame_raw['vbr_method']);
- $thisfile_mpeg_audio['bitrate_mode'] = substr($thisfile_mpeg_audio_lame['vbr_method'], 0, 3); // usually either 'cbr' or 'vbr', but truncates 'vbr-old / vbr-rh' to 'vbr'
-
- // byte $A6 Lowpass filter value
- $thisfile_mpeg_audio_lame['lowpass_frequency'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xA6, 1)) * 100;
-
- // bytes $A7-$AE Replay Gain
- // http://privatewww.essex.ac.uk/~djmrob/replaygain/rg_data_format.html
- // bytes $A7-$AA : 32 bit floating point "Peak signal amplitude"
- if ($thisfile_mpeg_audio_lame['short_version'] >= 'LAME3.94b') {
- // LAME 3.94a16 and later - 9.23 fixed point
- // ie 0x0059E2EE / (2^23) = 5890798 / 8388608 = 0.7022378444671630859375
- $thisfile_mpeg_audio_lame_RGAD['peak_amplitude'] = (float) ((getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xA7, 4))) / 8388608);
- } else {
- // LAME 3.94a15 and earlier - 32-bit floating point
- // Actually 3.94a16 will fall in here too and be WRONG, but is hard to detect 3.94a16 vs 3.94a15
- $thisfile_mpeg_audio_lame_RGAD['peak_amplitude'] = getid3_lib::LittleEndian2Float(substr($headerstring, $LAMEtagOffsetContant + 0xA7, 4));
- }
- if ($thisfile_mpeg_audio_lame_RGAD['peak_amplitude'] == 0) {
- unset($thisfile_mpeg_audio_lame_RGAD['peak_amplitude']);
- } else {
- $thisfile_mpeg_audio_lame_RGAD['peak_db'] = getid3_lib::RGADamplitude2dB($thisfile_mpeg_audio_lame_RGAD['peak_amplitude']);
- }
-
- $thisfile_mpeg_audio_lame_raw['RGAD_track'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xAB, 2));
- $thisfile_mpeg_audio_lame_raw['RGAD_album'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xAD, 2));
-
-
- if ($thisfile_mpeg_audio_lame_raw['RGAD_track'] != 0) {
-
- $thisfile_mpeg_audio_lame_RGAD_track['raw']['name'] = ($thisfile_mpeg_audio_lame_raw['RGAD_track'] & 0xE000) >> 13;
- $thisfile_mpeg_audio_lame_RGAD_track['raw']['originator'] = ($thisfile_mpeg_audio_lame_raw['RGAD_track'] & 0x1C00) >> 10;
- $thisfile_mpeg_audio_lame_RGAD_track['raw']['sign_bit'] = ($thisfile_mpeg_audio_lame_raw['RGAD_track'] & 0x0200) >> 9;
- $thisfile_mpeg_audio_lame_RGAD_track['raw']['gain_adjust'] = $thisfile_mpeg_audio_lame_raw['RGAD_track'] & 0x01FF;
- $thisfile_mpeg_audio_lame_RGAD_track['name'] = getid3_lib::RGADnameLookup($thisfile_mpeg_audio_lame_RGAD_track['raw']['name']);
- $thisfile_mpeg_audio_lame_RGAD_track['originator'] = getid3_lib::RGADoriginatorLookup($thisfile_mpeg_audio_lame_RGAD_track['raw']['originator']);
- $thisfile_mpeg_audio_lame_RGAD_track['gain_db'] = getid3_lib::RGADadjustmentLookup($thisfile_mpeg_audio_lame_RGAD_track['raw']['gain_adjust'], $thisfile_mpeg_audio_lame_RGAD_track['raw']['sign_bit']);
-
- if (!empty($thisfile_mpeg_audio_lame_RGAD['peak_amplitude'])) {
- $info['replay_gain']['track']['peak'] = $thisfile_mpeg_audio_lame_RGAD['peak_amplitude'];
- }
- $info['replay_gain']['track']['originator'] = $thisfile_mpeg_audio_lame_RGAD_track['originator'];
- $info['replay_gain']['track']['adjustment'] = $thisfile_mpeg_audio_lame_RGAD_track['gain_db'];
- } else {
- unset($thisfile_mpeg_audio_lame_RGAD['track']);
- }
- if ($thisfile_mpeg_audio_lame_raw['RGAD_album'] != 0) {
-
- $thisfile_mpeg_audio_lame_RGAD_album['raw']['name'] = ($thisfile_mpeg_audio_lame_raw['RGAD_album'] & 0xE000) >> 13;
- $thisfile_mpeg_audio_lame_RGAD_album['raw']['originator'] = ($thisfile_mpeg_audio_lame_raw['RGAD_album'] & 0x1C00) >> 10;
- $thisfile_mpeg_audio_lame_RGAD_album['raw']['sign_bit'] = ($thisfile_mpeg_audio_lame_raw['RGAD_album'] & 0x0200) >> 9;
- $thisfile_mpeg_audio_lame_RGAD_album['raw']['gain_adjust'] = $thisfile_mpeg_audio_lame_raw['RGAD_album'] & 0x01FF;
- $thisfile_mpeg_audio_lame_RGAD_album['name'] = getid3_lib::RGADnameLookup($thisfile_mpeg_audio_lame_RGAD_album['raw']['name']);
- $thisfile_mpeg_audio_lame_RGAD_album['originator'] = getid3_lib::RGADoriginatorLookup($thisfile_mpeg_audio_lame_RGAD_album['raw']['originator']);
- $thisfile_mpeg_audio_lame_RGAD_album['gain_db'] = getid3_lib::RGADadjustmentLookup($thisfile_mpeg_audio_lame_RGAD_album['raw']['gain_adjust'], $thisfile_mpeg_audio_lame_RGAD_album['raw']['sign_bit']);
-
- if (!empty($thisfile_mpeg_audio_lame_RGAD['peak_amplitude'])) {
- $info['replay_gain']['album']['peak'] = $thisfile_mpeg_audio_lame_RGAD['peak_amplitude'];
- }
- $info['replay_gain']['album']['originator'] = $thisfile_mpeg_audio_lame_RGAD_album['originator'];
- $info['replay_gain']['album']['adjustment'] = $thisfile_mpeg_audio_lame_RGAD_album['gain_db'];
- } else {
- unset($thisfile_mpeg_audio_lame_RGAD['album']);
- }
- if (empty($thisfile_mpeg_audio_lame_RGAD)) {
- unset($thisfile_mpeg_audio_lame['RGAD']);
- }
-
-
- // byte $AF Encoding flags + ATH Type
- $EncodingFlagsATHtype = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xAF, 1));
- $thisfile_mpeg_audio_lame['encoding_flags']['nspsytune'] = (bool) ($EncodingFlagsATHtype & 0x10);
- $thisfile_mpeg_audio_lame['encoding_flags']['nssafejoint'] = (bool) ($EncodingFlagsATHtype & 0x20);
- $thisfile_mpeg_audio_lame['encoding_flags']['nogap_next'] = (bool) ($EncodingFlagsATHtype & 0x40);
- $thisfile_mpeg_audio_lame['encoding_flags']['nogap_prev'] = (bool) ($EncodingFlagsATHtype & 0x80);
- $thisfile_mpeg_audio_lame['ath_type'] = $EncodingFlagsATHtype & 0x0F;
-
- // byte $B0 if ABR {specified bitrate} else {minimal bitrate}
- $thisfile_mpeg_audio_lame['raw']['abrbitrate_minbitrate'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB0, 1));
- if ($thisfile_mpeg_audio_lame_raw['vbr_method'] == 2) { // Average BitRate (ABR)
- $thisfile_mpeg_audio_lame['bitrate_abr'] = $thisfile_mpeg_audio_lame['raw']['abrbitrate_minbitrate'];
- } elseif ($thisfile_mpeg_audio_lame_raw['vbr_method'] == 1) { // Constant BitRate (CBR)
- // ignore
- } elseif ($thisfile_mpeg_audio_lame['raw']['abrbitrate_minbitrate'] > 0) { // Variable BitRate (VBR) - minimum bitrate
- $thisfile_mpeg_audio_lame['bitrate_min'] = $thisfile_mpeg_audio_lame['raw']['abrbitrate_minbitrate'];
- }
-
- // bytes $B1-$B3 Encoder delays
- $EncoderDelays = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB1, 3));
- $thisfile_mpeg_audio_lame['encoder_delay'] = ($EncoderDelays & 0xFFF000) >> 12;
- $thisfile_mpeg_audio_lame['end_padding'] = $EncoderDelays & 0x000FFF;
-
- // byte $B4 Misc
- $MiscByte = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB4, 1));
- $thisfile_mpeg_audio_lame_raw['noise_shaping'] = ($MiscByte & 0x03);
- $thisfile_mpeg_audio_lame_raw['stereo_mode'] = ($MiscByte & 0x1C) >> 2;
- $thisfile_mpeg_audio_lame_raw['not_optimal_quality'] = ($MiscByte & 0x20) >> 5;
- $thisfile_mpeg_audio_lame_raw['source_sample_freq'] = ($MiscByte & 0xC0) >> 6;
- $thisfile_mpeg_audio_lame['noise_shaping'] = $thisfile_mpeg_audio_lame_raw['noise_shaping'];
- $thisfile_mpeg_audio_lame['stereo_mode'] = getid3_mp3::LAMEmiscStereoModeLookup($thisfile_mpeg_audio_lame_raw['stereo_mode']);
- $thisfile_mpeg_audio_lame['not_optimal_quality'] = (bool) $thisfile_mpeg_audio_lame_raw['not_optimal_quality'];
- $thisfile_mpeg_audio_lame['source_sample_freq'] = getid3_mp3::LAMEmiscSourceSampleFrequencyLookup($thisfile_mpeg_audio_lame_raw['source_sample_freq']);
-
- // byte $B5 MP3 Gain
- $thisfile_mpeg_audio_lame_raw['mp3_gain'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB5, 1), false, true);
- $thisfile_mpeg_audio_lame['mp3_gain_db'] = (getid3_lib::RGADamplitude2dB(2) / 4) * $thisfile_mpeg_audio_lame_raw['mp3_gain'];
- $thisfile_mpeg_audio_lame['mp3_gain_factor'] = pow(2, ($thisfile_mpeg_audio_lame['mp3_gain_db'] / 6));
-
- // bytes $B6-$B7 Preset and surround info
- $PresetSurroundBytes = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB6, 2));
- // Reserved = ($PresetSurroundBytes & 0xC000);
- $thisfile_mpeg_audio_lame_raw['surround_info'] = ($PresetSurroundBytes & 0x3800);
- $thisfile_mpeg_audio_lame['surround_info'] = getid3_mp3::LAMEsurroundInfoLookup($thisfile_mpeg_audio_lame_raw['surround_info']);
- $thisfile_mpeg_audio_lame['preset_used_id'] = ($PresetSurroundBytes & 0x07FF);
- $thisfile_mpeg_audio_lame['preset_used'] = getid3_mp3::LAMEpresetUsedLookup($thisfile_mpeg_audio_lame);
- if (!empty($thisfile_mpeg_audio_lame['preset_used_id']) && empty($thisfile_mpeg_audio_lame['preset_used'])) {
- $info['warning'][] = 'Unknown LAME preset used ('.$thisfile_mpeg_audio_lame['preset_used_id'].') - please report to info@getid3.org';
- }
- if (($thisfile_mpeg_audio_lame['short_version'] == 'LAME3.90.') && !empty($thisfile_mpeg_audio_lame['preset_used_id'])) {
- // this may change if 3.90.4 ever comes out
- $thisfile_mpeg_audio_lame['short_version'] = 'LAME3.90.3';
- }
-
- // bytes $B8-$BB MusicLength
- $thisfile_mpeg_audio_lame['audio_bytes'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB8, 4));
- $ExpectedNumberOfAudioBytes = (($thisfile_mpeg_audio_lame['audio_bytes'] > 0) ? $thisfile_mpeg_audio_lame['audio_bytes'] : $thisfile_mpeg_audio['VBR_bytes']);
-
- // bytes $BC-$BD MusicCRC
- $thisfile_mpeg_audio_lame['music_crc'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xBC, 2));
-
- // bytes $BE-$BF CRC-16 of Info Tag
- $thisfile_mpeg_audio_lame['lame_tag_crc'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xBE, 2));
-
-
- // LAME CBR
- if ($thisfile_mpeg_audio_lame_raw['vbr_method'] == 1) {
-
- $thisfile_mpeg_audio['bitrate_mode'] = 'cbr';
- $thisfile_mpeg_audio['bitrate'] = getid3_mp3::ClosestStandardMP3Bitrate($thisfile_mpeg_audio['bitrate']);
- $info['audio']['bitrate'] = $thisfile_mpeg_audio['bitrate'];
- //if (empty($thisfile_mpeg_audio['bitrate']) || (!empty($thisfile_mpeg_audio_lame['bitrate_min']) && ($thisfile_mpeg_audio_lame['bitrate_min'] != 255))) {
- // $thisfile_mpeg_audio['bitrate'] = $thisfile_mpeg_audio_lame['bitrate_min'];
- //}
-
- }
-
- }
- }
-
- } else {
-
- // not Fraunhofer or Xing VBR methods, most likely CBR (but could be VBR with no header)
- $thisfile_mpeg_audio['bitrate_mode'] = 'cbr';
- if ($recursivesearch) {
- $thisfile_mpeg_audio['bitrate_mode'] = 'vbr';
- if ($this->RecursiveFrameScanning($offset, $nextframetestoffset, true)) {
- $recursivesearch = false;
- $thisfile_mpeg_audio['bitrate_mode'] = 'cbr';
- }
- if ($thisfile_mpeg_audio['bitrate_mode'] == 'vbr') {
- $info['warning'][] = 'VBR file with no VBR header. Bitrate values calculated from actual frame bitrates.';
- }
- }
-
- }
-
- }
-
- if (($ExpectedNumberOfAudioBytes > 0) && ($ExpectedNumberOfAudioBytes != ($info['avdataend'] - $info['avdataoffset']))) {
- if ($ExpectedNumberOfAudioBytes > ($info['avdataend'] - $info['avdataoffset'])) {
- if (isset($info['fileformat']) && ($info['fileformat'] == 'riff')) {
- // ignore, audio data is broken into chunks so will always be data "missing"
- } elseif (($ExpectedNumberOfAudioBytes - ($info['avdataend'] - $info['avdataoffset'])) == 1) {
- $info['warning'][] = 'Last byte of data truncated (this is a known bug in Meracl ID3 Tag Writer before v1.3.5)';
- } else {
- $info['warning'][] = 'Probable truncated file: expecting '.$ExpectedNumberOfAudioBytes.' bytes of audio data, only found '.($info['avdataend'] - $info['avdataoffset']).' (short by '.($ExpectedNumberOfAudioBytes - ($info['avdataend'] - $info['avdataoffset'])).' bytes)';
- }
- } else {
- if ((($info['avdataend'] - $info['avdataoffset']) - $ExpectedNumberOfAudioBytes) == 1) {
- // $prenullbytefileoffset = ftell($this->getid3->fp);
- // fseek($this->getid3->fp, $info['avdataend'], SEEK_SET);
- // $PossibleNullByte = fread($this->getid3->fp, 1);
- // fseek($this->getid3->fp, $prenullbytefileoffset, SEEK_SET);
- // if ($PossibleNullByte === "\x00") {
- $info['avdataend']--;
- // $info['warning'][] = 'Extra null byte at end of MP3 data assumed to be RIFF padding and therefore ignored';
- // } else {
- // $info['warning'][] = 'Too much data in file: expecting '.$ExpectedNumberOfAudioBytes.' bytes of audio data, found '.($info['avdataend'] - $info['avdataoffset']).' ('.(($info['avdataend'] - $info['avdataoffset']) - $ExpectedNumberOfAudioBytes).' bytes too many)';
- // }
- } else {
- $info['warning'][] = 'Too much data in file: expecting '.$ExpectedNumberOfAudioBytes.' bytes of audio data, found '.($info['avdataend'] - $info['avdataoffset']).' ('.(($info['avdataend'] - $info['avdataoffset']) - $ExpectedNumberOfAudioBytes).' bytes too many)';
- }
- }
- }
-
- if (($thisfile_mpeg_audio['bitrate'] == 'free') && empty($info['audio']['bitrate'])) {
- if (($offset == $info['avdataoffset']) && empty($thisfile_mpeg_audio['VBR_frames'])) {
- $framebytelength = $this->FreeFormatFrameLength($offset, true);
- if ($framebytelength > 0) {
- $thisfile_mpeg_audio['framelength'] = $framebytelength;
- if ($thisfile_mpeg_audio['layer'] == '1') {
- // BitRate = (((FrameLengthInBytes / 4) - Padding) * SampleRate) / 12
- $info['audio']['bitrate'] = ((($framebytelength / 4) - intval($thisfile_mpeg_audio['padding'])) * $thisfile_mpeg_audio['sample_rate']) / 12;
- } else {
- // Bitrate = ((FrameLengthInBytes - Padding) * SampleRate) / 144
- $info['audio']['bitrate'] = (($framebytelength - intval($thisfile_mpeg_audio['padding'])) * $thisfile_mpeg_audio['sample_rate']) / 144;
- }
- } else {
- $info['error'][] = 'Error calculating frame length of free-format MP3 without Xing/LAME header';
- }
- }
- }
-
- if (isset($thisfile_mpeg_audio['VBR_frames']) ? $thisfile_mpeg_audio['VBR_frames'] : '') {
- switch ($thisfile_mpeg_audio['bitrate_mode']) {
- case 'vbr':
- case 'abr':
- $bytes_per_frame = 1152;
- if (($thisfile_mpeg_audio['version'] == '1') && ($thisfile_mpeg_audio['layer'] == 1)) {
- $bytes_per_frame = 384;
- } elseif ((($thisfile_mpeg_audio['version'] == '2') || ($thisfile_mpeg_audio['version'] == '2.5')) && ($thisfile_mpeg_audio['layer'] == 3)) {
- $bytes_per_frame = 576;
- }
- $thisfile_mpeg_audio['VBR_bitrate'] = (isset($thisfile_mpeg_audio['VBR_bytes']) ? (($thisfile_mpeg_audio['VBR_bytes'] / $thisfile_mpeg_audio['VBR_frames']) * 8) * ($info['audio']['sample_rate'] / $bytes_per_frame) : 0);
- if ($thisfile_mpeg_audio['VBR_bitrate'] > 0) {
- $info['audio']['bitrate'] = $thisfile_mpeg_audio['VBR_bitrate'];
- $thisfile_mpeg_audio['bitrate'] = $thisfile_mpeg_audio['VBR_bitrate']; // to avoid confusion
- }
- break;
- }
- }
-
- // End variable-bitrate headers
- ////////////////////////////////////////////////////////////////////////////////////
-
- if ($recursivesearch) {
-
- if (!$this->RecursiveFrameScanning($offset, $nextframetestoffset, $ScanAsCBR)) {
- return false;
- }
-
- }
-
-
- //if (false) {
- // // experimental side info parsing section - not returning anything useful yet
- //
- // $SideInfoBitstream = getid3_lib::BigEndian2Bin($SideInfoData);
- // $SideInfoOffset = 0;
- //
- // if ($thisfile_mpeg_audio['version'] == '1') {
- // if ($thisfile_mpeg_audio['channelmode'] == 'mono') {
- // // MPEG-1 (mono)
- // $thisfile_mpeg_audio['side_info']['main_data_begin'] = substr($SideInfoBitstream, $SideInfoOffset, 9);
- // $SideInfoOffset += 9;
- // $SideInfoOffset += 5;
- // } else {
- // // MPEG-1 (stereo, joint-stereo, dual-channel)
- // $thisfile_mpeg_audio['side_info']['main_data_begin'] = substr($SideInfoBitstream, $SideInfoOffset, 9);
- // $SideInfoOffset += 9;
- // $SideInfoOffset += 3;
- // }
- // } else { // 2 or 2.5
- // if ($thisfile_mpeg_audio['channelmode'] == 'mono') {
- // // MPEG-2, MPEG-2.5 (mono)
- // $thisfile_mpeg_audio['side_info']['main_data_begin'] = substr($SideInfoBitstream, $SideInfoOffset, 8);
- // $SideInfoOffset += 8;
- // $SideInfoOffset += 1;
- // } else {
- // // MPEG-2, MPEG-2.5 (stereo, joint-stereo, dual-channel)
- // $thisfile_mpeg_audio['side_info']['main_data_begin'] = substr($SideInfoBitstream, $SideInfoOffset, 8);
- // $SideInfoOffset += 8;
- // $SideInfoOffset += 2;
- // }
- // }
- //
- // if ($thisfile_mpeg_audio['version'] == '1') {
- // for ($channel = 0; $channel < $info['audio']['channels']; $channel++) {
- // for ($scfsi_band = 0; $scfsi_band < 4; $scfsi_band++) {
- // $thisfile_mpeg_audio['scfsi'][$channel][$scfsi_band] = substr($SideInfoBitstream, $SideInfoOffset, 1);
- // $SideInfoOffset += 2;
- // }
- // }
- // }
- // for ($granule = 0; $granule < (($thisfile_mpeg_audio['version'] == '1') ? 2 : 1); $granule++) {
- // for ($channel = 0; $channel < $info['audio']['channels']; $channel++) {
- // $thisfile_mpeg_audio['part2_3_length'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 12);
- // $SideInfoOffset += 12;
- // $thisfile_mpeg_audio['big_values'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 9);
- // $SideInfoOffset += 9;
- // $thisfile_mpeg_audio['global_gain'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 8);
- // $SideInfoOffset += 8;
- // if ($thisfile_mpeg_audio['version'] == '1') {
- // $thisfile_mpeg_audio['scalefac_compress'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 4);
- // $SideInfoOffset += 4;
- // } else {
- // $thisfile_mpeg_audio['scalefac_compress'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 9);
- // $SideInfoOffset += 9;
- // }
- // $thisfile_mpeg_audio['window_switching_flag'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 1);
- // $SideInfoOffset += 1;
- //
- // if ($thisfile_mpeg_audio['window_switching_flag'][$granule][$channel] == '1') {
- //
- // $thisfile_mpeg_audio['block_type'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 2);
- // $SideInfoOffset += 2;
- // $thisfile_mpeg_audio['mixed_block_flag'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 1);
- // $SideInfoOffset += 1;
- //
- // for ($region = 0; $region < 2; $region++) {
- // $thisfile_mpeg_audio['table_select'][$granule][$channel][$region] = substr($SideInfoBitstream, $SideInfoOffset, 5);
- // $SideInfoOffset += 5;
- // }
- // $thisfile_mpeg_audio['table_select'][$granule][$channel][2] = 0;
- //
- // for ($window = 0; $window < 3; $window++) {
- // $thisfile_mpeg_audio['subblock_gain'][$granule][$channel][$window] = substr($SideInfoBitstream, $SideInfoOffset, 3);
- // $SideInfoOffset += 3;
- // }
- //
- // } else {
- //
- // for ($region = 0; $region < 3; $region++) {
- // $thisfile_mpeg_audio['table_select'][$granule][$channel][$region] = substr($SideInfoBitstream, $SideInfoOffset, 5);
- // $SideInfoOffset += 5;
- // }
- //
- // $thisfile_mpeg_audio['region0_count'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 4);
- // $SideInfoOffset += 4;
- // $thisfile_mpeg_audio['region1_count'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 3);
- // $SideInfoOffset += 3;
- // $thisfile_mpeg_audio['block_type'][$granule][$channel] = 0;
- // }
- //
- // if ($thisfile_mpeg_audio['version'] == '1') {
- // $thisfile_mpeg_audio['preflag'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 1);
- // $SideInfoOffset += 1;
- // }
- // $thisfile_mpeg_audio['scalefac_scale'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 1);
- // $SideInfoOffset += 1;
- // $thisfile_mpeg_audio['count1table_select'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 1);
- // $SideInfoOffset += 1;
- // }
- // }
- //}
-
- return true;
- }
-
- function RecursiveFrameScanning(&$offset, &$nextframetestoffset, $ScanAsCBR) {
- $info = &$this->getid3->info;
- $firstframetestarray = array('error'=>'', 'warning'=>'', 'avdataend'=>$info['avdataend'], 'avdataoffset'=>$info['avdataoffset']);
- $this->decodeMPEGaudioHeader($offset, $firstframetestarray, false);
-
- for ($i = 0; $i < GETID3_MP3_VALID_CHECK_FRAMES; $i++) {
- // check next GETID3_MP3_VALID_CHECK_FRAMES frames for validity, to make sure we haven't run across a false synch
- if (($nextframetestoffset + 4) >= $info['avdataend']) {
- // end of file
- return true;
- }
-
- $nextframetestarray = array('error'=>'', 'warning'=>'', 'avdataend'=>$info['avdataend'], 'avdataoffset'=>$info['avdataoffset']);
- if ($this->decodeMPEGaudioHeader($nextframetestoffset, $nextframetestarray, false)) {
- if ($ScanAsCBR) {
- // force CBR mode, used for trying to pick out invalid audio streams with valid(?) VBR headers, or VBR streams with no VBR header
- if (!isset($nextframetestarray['mpeg']['audio']['bitrate']) || !isset($firstframetestarray['mpeg']['audio']['bitrate']) || ($nextframetestarray['mpeg']['audio']['bitrate'] != $firstframetestarray['mpeg']['audio']['bitrate'])) {
- return false;
- }
- }
-
-
- // next frame is OK, get ready to check the one after that
- if (isset($nextframetestarray['mpeg']['audio']['framelength']) && ($nextframetestarray['mpeg']['audio']['framelength'] > 0)) {
- $nextframetestoffset += $nextframetestarray['mpeg']['audio']['framelength'];
- } else {
- $info['error'][] = 'Frame at offset ('.$offset.') is has an invalid frame length.';
- return false;
- }
-
- } elseif (!empty($firstframetestarray['mpeg']['audio']['framelength']) && (($nextframetestoffset + $firstframetestarray['mpeg']['audio']['framelength']) > $info['avdataend'])) {
-
- // it's not the end of the file, but there's not enough data left for another frame, so assume it's garbage/padding and return OK
- return true;
-
- } else {
-
- // next frame is not valid, note the error and fail, so scanning can contiue for a valid frame sequence
- $info['warning'][] = 'Frame at offset ('.$offset.') is valid, but the next one at ('.$nextframetestoffset.') is not.';
-
- return false;
- }
- }
- return true;
- }
-
- function FreeFormatFrameLength($offset, $deepscan=false) {
- $info = &$this->getid3->info;
-
- fseek($this->getid3->fp, $offset, SEEK_SET);
- $MPEGaudioData = fread($this->getid3->fp, 32768);
-
- $SyncPattern1 = substr($MPEGaudioData, 0, 4);
- // may be different pattern due to padding
- $SyncPattern2 = $SyncPattern1{0}.$SyncPattern1{1}.chr(ord($SyncPattern1{2}) | 0x02).$SyncPattern1{3};
- if ($SyncPattern2 === $SyncPattern1) {
- $SyncPattern2 = $SyncPattern1{0}.$SyncPattern1{1}.chr(ord($SyncPattern1{2}) & 0xFD).$SyncPattern1{3};
- }
-
- $framelength = false;
- $framelength1 = strpos($MPEGaudioData, $SyncPattern1, 4);
- $framelength2 = strpos($MPEGaudioData, $SyncPattern2, 4);
- if ($framelength1 > 4) {
- $framelength = $framelength1;
- }
- if (($framelength2 > 4) && ($framelength2 < $framelength1)) {
- $framelength = $framelength2;
- }
- if (!$framelength) {
-
- // LAME 3.88 has a different value for modeextension on the first frame vs the rest
- $framelength1 = strpos($MPEGaudioData, substr($SyncPattern1, 0, 3), 4);
- $framelength2 = strpos($MPEGaudioData, substr($SyncPattern2, 0, 3), 4);
-
- if ($framelength1 > 4) {
- $framelength = $framelength1;
- }
- if (($framelength2 > 4) && ($framelength2 < $framelength1)) {
- $framelength = $framelength2;
- }
- if (!$framelength) {
- $info['error'][] = 'Cannot find next free-format synch pattern ('.getid3_lib::PrintHexBytes($SyncPattern1).' or '.getid3_lib::PrintHexBytes($SyncPattern2).') after offset '.$offset;
- return false;
- } else {
- $info['warning'][] = 'ModeExtension varies between first frame and other frames (known free-format issue in LAME 3.88)';
- $info['audio']['codec'] = 'LAME';
- $info['audio']['encoder'] = 'LAME3.88';
- $SyncPattern1 = substr($SyncPattern1, 0, 3);
- $SyncPattern2 = substr($SyncPattern2, 0, 3);
- }
- }
-
- if ($deepscan) {
-
- $ActualFrameLengthValues = array();
- $nextoffset = $offset + $framelength;
- while ($nextoffset < ($info['avdataend'] - 6)) {
- fseek($this->getid3->fp, $nextoffset - 1, SEEK_SET);
- $NextSyncPattern = fread($this->getid3->fp, 6);
- if ((substr($NextSyncPattern, 1, strlen($SyncPattern1)) == $SyncPattern1) || (substr($NextSyncPattern, 1, strlen($SyncPattern2)) == $SyncPattern2)) {
- // good - found where expected
- $ActualFrameLengthValues[] = $framelength;
- } elseif ((substr($NextSyncPattern, 0, strlen($SyncPattern1)) == $SyncPattern1) || (substr($NextSyncPattern, 0, strlen($SyncPattern2)) == $SyncPattern2)) {
- // ok - found one byte earlier than expected (last frame wasn't padded, first frame was)
- $ActualFrameLengthValues[] = ($framelength - 1);
- $nextoffset--;
- } elseif ((substr($NextSyncPattern, 2, strlen($SyncPattern1)) == $SyncPattern1) || (substr($NextSyncPattern, 2, strlen($SyncPattern2)) == $SyncPattern2)) {
- // ok - found one byte later than expected (last frame was padded, first frame wasn't)
- $ActualFrameLengthValues[] = ($framelength + 1);
- $nextoffset++;
- } else {
- $info['error'][] = 'Did not find expected free-format sync pattern at offset '.$nextoffset;
- return false;
- }
- $nextoffset += $framelength;
- }
- if (count($ActualFrameLengthValues) > 0) {
- $framelength = intval(round(array_sum($ActualFrameLengthValues) / count($ActualFrameLengthValues)));
- }
- }
- return $framelength;
- }
-
- function getOnlyMPEGaudioInfoBruteForce() {
- $MPEGaudioHeaderDecodeCache = array();
- $MPEGaudioHeaderValidCache = array();
- $MPEGaudioHeaderLengthCache = array();
- $MPEGaudioVersionLookup = getid3_mp3::MPEGaudioVersionArray();
- $MPEGaudioLayerLookup = getid3_mp3::MPEGaudioLayerArray();
- $MPEGaudioBitrateLookup = getid3_mp3::MPEGaudioBitrateArray();
- $MPEGaudioFrequencyLookup = getid3_mp3::MPEGaudioFrequencyArray();
- $MPEGaudioChannelModeLookup = getid3_mp3::MPEGaudioChannelModeArray();
- $MPEGaudioModeExtensionLookup = getid3_mp3::MPEGaudioModeExtensionArray();
- $MPEGaudioEmphasisLookup = getid3_mp3::MPEGaudioEmphasisArray();
- $LongMPEGversionLookup = array();
- $LongMPEGlayerLookup = array();
- $LongMPEGbitrateLookup = array();
- $LongMPEGpaddingLookup = array();
- $LongMPEGfrequencyLookup = array();
- $Distribution['bitrate'] = array();
- $Distribution['frequency'] = array();
- $Distribution['layer'] = array();
- $Distribution['version'] = array();
- $Distribution['padding'] = array();
-
- $info = &$this->getid3->info;
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
-
- $max_frames_scan = 5000;
- $frames_scanned = 0;
-
- $previousvalidframe = $info['avdataoffset'];
- while (ftell($this->getid3->fp) < $info['avdataend']) {
- set_time_limit(30);
- $head4 = fread($this->getid3->fp, 4);
- if (strlen($head4) < 4) {
- break;
- }
- if ($head4{0} != "\xFF") {
- for ($i = 1; $i < 4; $i++) {
- if ($head4{$i} == "\xFF") {
- fseek($this->getid3->fp, $i - 4, SEEK_CUR);
- continue 2;
- }
- }
- continue;
- }
- if (!isset($MPEGaudioHeaderDecodeCache[$head4])) {
- $MPEGaudioHeaderDecodeCache[$head4] = getid3_mp3::MPEGaudioHeaderDecode($head4);
- }
- if (!isset($MPEGaudioHeaderValidCache[$head4])) {
- $MPEGaudioHeaderValidCache[$head4] = getid3_mp3::MPEGaudioHeaderValid($MPEGaudioHeaderDecodeCache[$head4], false, false);
- }
- if ($MPEGaudioHeaderValidCache[$head4]) {
-
- if (!isset($MPEGaudioHeaderLengthCache[$head4])) {
- $LongMPEGversionLookup[$head4] = $MPEGaudioVersionLookup[$MPEGaudioHeaderDecodeCache[$head4]['version']];
- $LongMPEGlayerLookup[$head4] = $MPEGaudioLayerLookup[$MPEGaudioHeaderDecodeCache[$head4]['layer']];
- $LongMPEGbitrateLookup[$head4] = $MPEGaudioBitrateLookup[$LongMPEGversionLookup[$head4]][$LongMPEGlayerLookup[$head4]][$MPEGaudioHeaderDecodeCache[$head4]['bitrate']];
- $LongMPEGpaddingLookup[$head4] = (bool) $MPEGaudioHeaderDecodeCache[$head4]['padding'];
- $LongMPEGfrequencyLookup[$head4] = $MPEGaudioFrequencyLookup[$LongMPEGversionLookup[$head4]][$MPEGaudioHeaderDecodeCache[$head4]['sample_rate']];
- $MPEGaudioHeaderLengthCache[$head4] = getid3_mp3::MPEGaudioFrameLength(
- $LongMPEGbitrateLookup[$head4],
- $LongMPEGversionLookup[$head4],
- $LongMPEGlayerLookup[$head4],
- $LongMPEGpaddingLookup[$head4],
- $LongMPEGfrequencyLookup[$head4]);
- }
- if ($MPEGaudioHeaderLengthCache[$head4] > 4) {
- $WhereWeWere = ftell($this->getid3->fp);
- fseek($this->getid3->fp, $MPEGaudioHeaderLengthCache[$head4] - 4, SEEK_CUR);
- $next4 = fread($this->getid3->fp, 4);
- if ($next4{0} == "\xFF") {
- if (!isset($MPEGaudioHeaderDecodeCache[$next4])) {
- $MPEGaudioHeaderDecodeCache[$next4] = getid3_mp3::MPEGaudioHeaderDecode($next4);
- }
- if (!isset($MPEGaudioHeaderValidCache[$next4])) {
- $MPEGaudioHeaderValidCache[$next4] = getid3_mp3::MPEGaudioHeaderValid($MPEGaudioHeaderDecodeCache[$next4], false, false);
- }
- if ($MPEGaudioHeaderValidCache[$next4]) {
- fseek($this->getid3->fp, -4, SEEK_CUR);
-
- getid3_lib::safe_inc($Distribution['bitrate'][$LongMPEGbitrateLookup[$head4]]);
- getid3_lib::safe_inc($Distribution['layer'][$LongMPEGlayerLookup[$head4]]);
- getid3_lib::safe_inc($Distribution['version'][$LongMPEGversionLookup[$head4]]);
- getid3_lib::safe_inc($Distribution['padding'][intval($LongMPEGpaddingLookup[$head4])]);
- getid3_lib::safe_inc($Distribution['frequency'][$LongMPEGfrequencyLookup[$head4]]);
- if ($max_frames_scan && (++$frames_scanned >= $max_frames_scan)) {
- $pct_data_scanned = (ftell($this->getid3->fp) - $info['avdataoffset']) / ($info['avdataend'] - $info['avdataoffset']);
- $info['warning'][] = 'too many MPEG audio frames to scan, only scanned first '.$max_frames_scan.' frames ('.number_format($pct_data_scanned * 100, 1).'% of file) and extrapolated distribution, playtime and bitrate may be incorrect.';
- foreach ($Distribution as $key1 => $value1) {
- foreach ($value1 as $key2 => $value2) {
- $Distribution[$key1][$key2] = round($value2 / $pct_data_scanned);
- }
- }
- break;
- }
- continue;
- }
- }
- unset($next4);
- fseek($this->getid3->fp, $WhereWeWere - 3, SEEK_SET);
- }
-
- }
- }
- foreach ($Distribution as $key => $value) {
- ksort($Distribution[$key], SORT_NUMERIC);
- }
- ksort($Distribution['version'], SORT_STRING);
- $info['mpeg']['audio']['bitrate_distribution'] = $Distribution['bitrate'];
- $info['mpeg']['audio']['frequency_distribution'] = $Distribution['frequency'];
- $info['mpeg']['audio']['layer_distribution'] = $Distribution['layer'];
- $info['mpeg']['audio']['version_distribution'] = $Distribution['version'];
- $info['mpeg']['audio']['padding_distribution'] = $Distribution['padding'];
- if (count($Distribution['version']) > 1) {
- $info['error'][] = 'Corrupt file - more than one MPEG version detected';
- }
- if (count($Distribution['layer']) > 1) {
- $info['error'][] = 'Corrupt file - more than one MPEG layer detected';
- }
- if (count($Distribution['frequency']) > 1) {
- $info['error'][] = 'Corrupt file - more than one MPEG sample rate detected';
- }
-
-
- $bittotal = 0;
- foreach ($Distribution['bitrate'] as $bitratevalue => $bitratecount) {
- if ($bitratevalue != 'free') {
- $bittotal += ($bitratevalue * $bitratecount);
- }
- }
- $info['mpeg']['audio']['frame_count'] = array_sum($Distribution['bitrate']);
- if ($info['mpeg']['audio']['frame_count'] == 0) {
- $info['error'][] = 'no MPEG audio frames found';
- return false;
- }
- $info['mpeg']['audio']['bitrate'] = ($bittotal / $info['mpeg']['audio']['frame_count']);
- $info['mpeg']['audio']['bitrate_mode'] = ((count($Distribution['bitrate']) > 0) ? 'vbr' : 'cbr');
- $info['mpeg']['audio']['sample_rate'] = getid3_lib::array_max($Distribution['frequency'], true);
-
- $info['audio']['bitrate'] = $info['mpeg']['audio']['bitrate'];
- $info['audio']['bitrate_mode'] = $info['mpeg']['audio']['bitrate_mode'];
- $info['audio']['sample_rate'] = $info['mpeg']['audio']['sample_rate'];
- $info['audio']['dataformat'] = 'mp'.getid3_lib::array_max($Distribution['layer'], true);
- $info['fileformat'] = $info['audio']['dataformat'];
-
- return true;
- }
-
-
- function getOnlyMPEGaudioInfo($avdataoffset, $BitrateHistogram=false) {
- // looks for synch, decodes MPEG audio header
-
- $info = &$this->getid3->info;
-
- static $MPEGaudioVersionLookup;
- static $MPEGaudioLayerLookup;
- static $MPEGaudioBitrateLookup;
- if (empty($MPEGaudioVersionLookup)) {
- $MPEGaudioVersionLookup = getid3_mp3::MPEGaudioVersionArray();
- $MPEGaudioLayerLookup = getid3_mp3::MPEGaudioLayerArray();
- $MPEGaudioBitrateLookup = getid3_mp3::MPEGaudioBitrateArray();
-
- }
-
- fseek($this->getid3->fp, $avdataoffset, SEEK_SET);
- $sync_seek_buffer_size = min(128 * 1024, $info['avdataend'] - $avdataoffset);
- if ($sync_seek_buffer_size <= 0) {
- $info['error'][] = 'Invalid $sync_seek_buffer_size at offset '.$avdataoffset;
- return false;
- }
- $header = fread($this->getid3->fp, $sync_seek_buffer_size);
- $sync_seek_buffer_size = strlen($header);
- $SynchSeekOffset = 0;
- while ($SynchSeekOffset < $sync_seek_buffer_size) {
- if ((($avdataoffset + $SynchSeekOffset) < $info['avdataend']) && !feof($this->getid3->fp)) {
-
- if ($SynchSeekOffset > $sync_seek_buffer_size) {
- // if a synch's not found within the first 128k bytes, then give up
- $info['error'][] = 'Could not find valid MPEG audio synch within the first '.round($sync_seek_buffer_size / 1024).'kB';
- if (isset($info['audio']['bitrate'])) {
- unset($info['audio']['bitrate']);
- }
- if (isset($info['mpeg']['audio'])) {
- unset($info['mpeg']['audio']);
- }
- if (empty($info['mpeg'])) {
- unset($info['mpeg']);
- }
- return false;
-
- } elseif (feof($this->getid3->fp)) {
-
- $info['error'][] = 'Could not find valid MPEG audio synch before end of file';
- if (isset($info['audio']['bitrate'])) {
- unset($info['audio']['bitrate']);
- }
- if (isset($info['mpeg']['audio'])) {
- unset($info['mpeg']['audio']);
- }
- if (isset($info['mpeg']) && (!is_array($info['mpeg']) || (count($info['mpeg']) == 0))) {
- unset($info['mpeg']);
- }
- return false;
- }
- }
-
- if (($SynchSeekOffset + 1) >= strlen($header)) {
- $info['error'][] = 'Could not find valid MPEG synch before end of file';
- return false;
- }
-
- if (($header{$SynchSeekOffset} == "\xFF") && ($header{($SynchSeekOffset + 1)} > "\xE0")) { // synch detected
- if (!isset($FirstFrameThisfileInfo) && !isset($info['mpeg']['audio'])) {
- $FirstFrameThisfileInfo = $info;
- $FirstFrameAVDataOffset = $avdataoffset + $SynchSeekOffset;
- if (!$this->decodeMPEGaudioHeader($FirstFrameAVDataOffset, $FirstFrameThisfileInfo, false)) {
- // if this is the first valid MPEG-audio frame, save it in case it's a VBR header frame and there's
- // garbage between this frame and a valid sequence of MPEG-audio frames, to be restored below
- unset($FirstFrameThisfileInfo);
- }
- }
-
- $dummy = $info; // only overwrite real data if valid header found
- if ($this->decodeMPEGaudioHeader($avdataoffset + $SynchSeekOffset, $dummy, true)) {
- $info = $dummy;
- $info['avdataoffset'] = $avdataoffset + $SynchSeekOffset;
- switch (isset($info['fileformat']) ? $info['fileformat'] : '') {
- case '':
- case 'id3':
- case 'ape':
- case 'mp3':
- $info['fileformat'] = 'mp3';
- $info['audio']['dataformat'] = 'mp3';
- break;
- }
- if (isset($FirstFrameThisfileInfo['mpeg']['audio']['bitrate_mode']) && ($FirstFrameThisfileInfo['mpeg']['audio']['bitrate_mode'] == 'vbr')) {
- if (!(abs($info['audio']['bitrate'] - $FirstFrameThisfileInfo['audio']['bitrate']) <= 1)) {
- // If there is garbage data between a valid VBR header frame and a sequence
- // of valid MPEG-audio frames the VBR data is no longer discarded.
- $info = $FirstFrameThisfileInfo;
- $info['avdataoffset'] = $FirstFrameAVDataOffset;
- $info['fileformat'] = 'mp3';
- $info['audio']['dataformat'] = 'mp3';
- $dummy = $info;
- unset($dummy['mpeg']['audio']);
- $GarbageOffsetStart = $FirstFrameAVDataOffset + $FirstFrameThisfileInfo['mpeg']['audio']['framelength'];
- $GarbageOffsetEnd = $avdataoffset + $SynchSeekOffset;
- if ($this->decodeMPEGaudioHeader($GarbageOffsetEnd, $dummy, true, true)) {
- $info = $dummy;
- $info['avdataoffset'] = $GarbageOffsetEnd;
- $info['warning'][] = 'apparently-valid VBR header not used because could not find '.GETID3_MP3_VALID_CHECK_FRAMES.' consecutive MPEG-audio frames immediately after VBR header (garbage data for '.($GarbageOffsetEnd - $GarbageOffsetStart).' bytes between '.$GarbageOffsetStart.' and '.$GarbageOffsetEnd.'), but did find valid CBR stream starting at '.$GarbageOffsetEnd;
- } else {
- $info['warning'][] = 'using data from VBR header even though could not find '.GETID3_MP3_VALID_CHECK_FRAMES.' consecutive MPEG-audio frames immediately after VBR header (garbage data for '.($GarbageOffsetEnd - $GarbageOffsetStart).' bytes between '.$GarbageOffsetStart.' and '.$GarbageOffsetEnd.')';
- }
- }
- }
- if (isset($info['mpeg']['audio']['bitrate_mode']) && ($info['mpeg']['audio']['bitrate_mode'] == 'vbr') && !isset($info['mpeg']['audio']['VBR_method'])) {
- // VBR file with no VBR header
- $BitrateHistogram = true;
- }
-
- if ($BitrateHistogram) {
-
- $info['mpeg']['audio']['stereo_distribution'] = array('stereo'=>0, 'joint stereo'=>0, 'dual channel'=>0, 'mono'=>0);
- $info['mpeg']['audio']['version_distribution'] = array('1'=>0, '2'=>0, '2.5'=>0);
-
- if ($info['mpeg']['audio']['version'] == '1') {
- if ($info['mpeg']['audio']['layer'] == 3) {
- $info['mpeg']['audio']['bitrate_distribution'] = array('free'=>0, 32000=>0, 40000=>0, 48000=>0, 56000=>0, 64000=>0, 80000=>0, 96000=>0, 112000=>0, 128000=>0, 160000=>0, 192000=>0, 224000=>0, 256000=>0, 320000=>0);
- } elseif ($info['mpeg']['audio']['layer'] == 2) {
- $info['mpeg']['audio']['bitrate_distribution'] = array('free'=>0, 32000=>0, 48000=>0, 56000=>0, 64000=>0, 80000=>0, 96000=>0, 112000=>0, 128000=>0, 160000=>0, 192000=>0, 224000=>0, 256000=>0, 320000=>0, 384000=>0);
- } elseif ($info['mpeg']['audio']['layer'] == 1) {
- $info['mpeg']['audio']['bitrate_distribution'] = array('free'=>0, 32000=>0, 64000=>0, 96000=>0, 128000=>0, 160000=>0, 192000=>0, 224000=>0, 256000=>0, 288000=>0, 320000=>0, 352000=>0, 384000=>0, 416000=>0, 448000=>0);
- }
- } elseif ($info['mpeg']['audio']['layer'] == 1) {
- $info['mpeg']['audio']['bitrate_distribution'] = array('free'=>0, 32000=>0, 48000=>0, 56000=>0, 64000=>0, 80000=>0, 96000=>0, 112000=>0, 128000=>0, 144000=>0, 160000=>0, 176000=>0, 192000=>0, 224000=>0, 256000=>0);
- } else {
- $info['mpeg']['audio']['bitrate_distribution'] = array('free'=>0, 8000=>0, 16000=>0, 24000=>0, 32000=>0, 40000=>0, 48000=>0, 56000=>0, 64000=>0, 80000=>0, 96000=>0, 112000=>0, 128000=>0, 144000=>0, 160000=>0);
- }
-
- $dummy = array('error'=>$info['error'], 'warning'=>$info['warning'], 'avdataend'=>$info['avdataend'], 'avdataoffset'=>$info['avdataoffset']);
- $synchstartoffset = $info['avdataoffset'];
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
-
- // you can play with these numbers:
- $max_frames_scan = 50000;
- $max_scan_segments = 10;
-
- // don't play with these numbers:
- $FastMode = false;
- $SynchErrorsFound = 0;
- $frames_scanned = 0;
- $this_scan_segment = 0;
- $frames_scan_per_segment = ceil($max_frames_scan / $max_scan_segments);
- $pct_data_scanned = 0;
- for ($current_segment = 0; $current_segment < $max_scan_segments; $current_segment++) {
- $frames_scanned_this_segment = 0;
- if (ftell($this->getid3->fp) >= $info['avdataend']) {
- break;
- }
- $scan_start_offset[$current_segment] = max(ftell($this->getid3->fp), $info['avdataoffset'] + round($current_segment * (($info['avdataend'] - $info['avdataoffset']) / $max_scan_segments)));
- if ($current_segment > 0) {
- fseek($this->getid3->fp, $scan_start_offset[$current_segment], SEEK_SET);
- $buffer_4k = fread($this->getid3->fp, 4096);
- for ($j = 0; $j < (strlen($buffer_4k) - 4); $j++) {
- if (($buffer_4k{$j} == "\xFF") && ($buffer_4k{($j + 1)} > "\xE0")) { // synch detected
- if ($this->decodeMPEGaudioHeader($scan_start_offset[$current_segment] + $j, $dummy, false, false, $FastMode)) {
- $calculated_next_offset = $scan_start_offset[$current_segment] + $j + $dummy['mpeg']['audio']['framelength'];
- if ($this->decodeMPEGaudioHeader($calculated_next_offset, $dummy, false, false, $FastMode)) {
- $scan_start_offset[$current_segment] += $j;
- break;
- }
- }
- }
- }
- }
- $synchstartoffset = $scan_start_offset[$current_segment];
- while ($this->decodeMPEGaudioHeader($synchstartoffset, $dummy, false, false, $FastMode)) {
- $FastMode = true;
- $thisframebitrate = $MPEGaudioBitrateLookup[$MPEGaudioVersionLookup[$dummy['mpeg']['audio']['raw']['version']]][$MPEGaudioLayerLookup[$dummy['mpeg']['audio']['raw']['layer']]][$dummy['mpeg']['audio']['raw']['bitrate']];
-
- if (empty($dummy['mpeg']['audio']['framelength'])) {
- $SynchErrorsFound++;
- $synchstartoffset++;
- } else {
- getid3_lib::safe_inc($info['mpeg']['audio']['bitrate_distribution'][$thisframebitrate]);
- getid3_lib::safe_inc($info['mpeg']['audio']['stereo_distribution'][$dummy['mpeg']['audio']['channelmode']]);
- getid3_lib::safe_inc($info['mpeg']['audio']['version_distribution'][$dummy['mpeg']['audio']['version']]);
- $synchstartoffset += $dummy['mpeg']['audio']['framelength'];
- }
- $frames_scanned++;
- if ($frames_scan_per_segment && (++$frames_scanned_this_segment >= $frames_scan_per_segment)) {
- $this_pct_scanned = (ftell($this->getid3->fp) - $scan_start_offset[$current_segment]) / ($info['avdataend'] - $info['avdataoffset']);
- if (($current_segment == 0) && (($this_pct_scanned * $max_scan_segments) >= 1)) {
- // file likely contains < $max_frames_scan, just scan as one segment
- $max_scan_segments = 1;
- $frames_scan_per_segment = $max_frames_scan;
- } else {
- $pct_data_scanned += $this_pct_scanned;
- break;
- }
- }
- }
- }
- if ($pct_data_scanned > 0) {
- $info['warning'][] = 'too many MPEG audio frames to scan, only scanned '.$frames_scanned.' frames in '.$max_scan_segments.' segments ('.number_format($pct_data_scanned * 100, 1).'% of file) and extrapolated distribution, playtime and bitrate may be incorrect.';
- foreach ($info['mpeg']['audio'] as $key1 => $value1) {
- if (!preg_match('#_distribution$#i', $key1)) {
- continue;
- }
- foreach ($value1 as $key2 => $value2) {
- $info['mpeg']['audio'][$key1][$key2] = round($value2 / $pct_data_scanned);
- }
- }
- }
-
- if ($SynchErrorsFound > 0) {
- $info['warning'][] = 'Found '.$SynchErrorsFound.' synch errors in histogram analysis';
- //return false;
- }
-
- $bittotal = 0;
- $framecounter = 0;
- foreach ($info['mpeg']['audio']['bitrate_distribution'] as $bitratevalue => $bitratecount) {
- $framecounter += $bitratecount;
- if ($bitratevalue != 'free') {
- $bittotal += ($bitratevalue * $bitratecount);
- }
- }
- if ($framecounter == 0) {
- $info['error'][] = 'Corrupt MP3 file: framecounter == zero';
- return false;
- }
- $info['mpeg']['audio']['frame_count'] = getid3_lib::CastAsInt($framecounter);
- $info['mpeg']['audio']['bitrate'] = ($bittotal / $framecounter);
-
- $info['audio']['bitrate'] = $info['mpeg']['audio']['bitrate'];
-
-
- // Definitively set VBR vs CBR, even if the Xing/LAME/VBRI header says differently
- $distinct_bitrates = 0;
- foreach ($info['mpeg']['audio']['bitrate_distribution'] as $bitrate_value => $bitrate_count) {
- if ($bitrate_count > 0) {
- $distinct_bitrates++;
- }
- }
- if ($distinct_bitrates > 1) {
- $info['mpeg']['audio']['bitrate_mode'] = 'vbr';
- } else {
- $info['mpeg']['audio']['bitrate_mode'] = 'cbr';
- }
- $info['audio']['bitrate_mode'] = $info['mpeg']['audio']['bitrate_mode'];
-
- }
-
- break; // exit while()
- }
- }
-
- $SynchSeekOffset++;
- if (($avdataoffset + $SynchSeekOffset) >= $info['avdataend']) {
- // end of file/data
-
- if (empty($info['mpeg']['audio'])) {
-
- $info['error'][] = 'could not find valid MPEG synch before end of file';
- if (isset($info['audio']['bitrate'])) {
- unset($info['audio']['bitrate']);
- }
- if (isset($info['mpeg']['audio'])) {
- unset($info['mpeg']['audio']);
- }
- if (isset($info['mpeg']) && (!is_array($info['mpeg']) || empty($info['mpeg']))) {
- unset($info['mpeg']);
- }
- return false;
-
- }
- break;
- }
-
- }
- $info['audio']['channels'] = $info['mpeg']['audio']['channels'];
- $info['audio']['channelmode'] = $info['mpeg']['audio']['channelmode'];
- $info['audio']['sample_rate'] = $info['mpeg']['audio']['sample_rate'];
- return true;
- }
-
-
- static function MPEGaudioVersionArray() {
- static $MPEGaudioVersion = array('2.5', false, '2', '1');
- return $MPEGaudioVersion;
- }
-
- static function MPEGaudioLayerArray() {
- static $MPEGaudioLayer = array(false, 3, 2, 1);
- return $MPEGaudioLayer;
- }
-
- static function MPEGaudioBitrateArray() {
- static $MPEGaudioBitrate;
- if (empty($MPEGaudioBitrate)) {
- $MPEGaudioBitrate = array (
- '1' => array (1 => array('free', 32000, 64000, 96000, 128000, 160000, 192000, 224000, 256000, 288000, 320000, 352000, 384000, 416000, 448000),
- 2 => array('free', 32000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 160000, 192000, 224000, 256000, 320000, 384000),
- 3 => array('free', 32000, 40000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 160000, 192000, 224000, 256000, 320000)
- ),
-
- '2' => array (1 => array('free', 32000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 144000, 160000, 176000, 192000, 224000, 256000),
- 2 => array('free', 8000, 16000, 24000, 32000, 40000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 144000, 160000),
- )
- );
- $MPEGaudioBitrate['2'][3] = $MPEGaudioBitrate['2'][2];
- $MPEGaudioBitrate['2.5'] = $MPEGaudioBitrate['2'];
- }
- return $MPEGaudioBitrate;
- }
-
- static function MPEGaudioFrequencyArray() {
- static $MPEGaudioFrequency;
- if (empty($MPEGaudioFrequency)) {
- $MPEGaudioFrequency = array (
- '1' => array(44100, 48000, 32000),
- '2' => array(22050, 24000, 16000),
- '2.5' => array(11025, 12000, 8000)
- );
- }
- return $MPEGaudioFrequency;
- }
-
- static function MPEGaudioChannelModeArray() {
- static $MPEGaudioChannelMode = array('stereo', 'joint stereo', 'dual channel', 'mono');
- return $MPEGaudioChannelMode;
- }
-
- static function MPEGaudioModeExtensionArray() {
- static $MPEGaudioModeExtension;
- if (empty($MPEGaudioModeExtension)) {
- $MPEGaudioModeExtension = array (
- 1 => array('4-31', '8-31', '12-31', '16-31'),
- 2 => array('4-31', '8-31', '12-31', '16-31'),
- 3 => array('', 'IS', 'MS', 'IS+MS')
- );
- }
- return $MPEGaudioModeExtension;
- }
-
- static function MPEGaudioEmphasisArray() {
- static $MPEGaudioEmphasis = array('none', '50/15ms', false, 'CCIT J.17');
- return $MPEGaudioEmphasis;
- }
-
- static function MPEGaudioHeaderBytesValid($head4, $allowBitrate15=false) {
- return getid3_mp3::MPEGaudioHeaderValid(getid3_mp3::MPEGaudioHeaderDecode($head4), false, $allowBitrate15);
- }
-
- static function MPEGaudioHeaderValid($rawarray, $echoerrors=false, $allowBitrate15=false) {
- if (($rawarray['synch'] & 0x0FFE) != 0x0FFE) {
- return false;
- }
-
- static $MPEGaudioVersionLookup;
- static $MPEGaudioLayerLookup;
- static $MPEGaudioBitrateLookup;
- static $MPEGaudioFrequencyLookup;
- static $MPEGaudioChannelModeLookup;
- static $MPEGaudioModeExtensionLookup;
- static $MPEGaudioEmphasisLookup;
- if (empty($MPEGaudioVersionLookup)) {
- $MPEGaudioVersionLookup = getid3_mp3::MPEGaudioVersionArray();
- $MPEGaudioLayerLookup = getid3_mp3::MPEGaudioLayerArray();
- $MPEGaudioBitrateLookup = getid3_mp3::MPEGaudioBitrateArray();
- $MPEGaudioFrequencyLookup = getid3_mp3::MPEGaudioFrequencyArray();
- $MPEGaudioChannelModeLookup = getid3_mp3::MPEGaudioChannelModeArray();
- $MPEGaudioModeExtensionLookup = getid3_mp3::MPEGaudioModeExtensionArray();
- $MPEGaudioEmphasisLookup = getid3_mp3::MPEGaudioEmphasisArray();
- }
-
- if (isset($MPEGaudioVersionLookup[$rawarray['version']])) {
- $decodedVersion = $MPEGaudioVersionLookup[$rawarray['version']];
- } else {
- echo ($echoerrors ? "\n".'invalid Version ('.$rawarray['version'].')' : '');
- return false;
- }
- if (isset($MPEGaudioLayerLookup[$rawarray['layer']])) {
- $decodedLayer = $MPEGaudioLayerLookup[$rawarray['layer']];
- } else {
- echo ($echoerrors ? "\n".'invalid Layer ('.$rawarray['layer'].')' : '');
- return false;
- }
- if (!isset($MPEGaudioBitrateLookup[$decodedVersion][$decodedLayer][$rawarray['bitrate']])) {
- echo ($echoerrors ? "\n".'invalid Bitrate ('.$rawarray['bitrate'].')' : '');
- if ($rawarray['bitrate'] == 15) {
- // known issue in LAME 3.90 - 3.93.1 where free-format has bitrate ID of 15 instead of 0
- // let it go through here otherwise file will not be identified
- if (!$allowBitrate15) {
- return false;
- }
- } else {
- return false;
- }
- }
- if (!isset($MPEGaudioFrequencyLookup[$decodedVersion][$rawarray['sample_rate']])) {
- echo ($echoerrors ? "\n".'invalid Frequency ('.$rawarray['sample_rate'].')' : '');
- return false;
- }
- if (!isset($MPEGaudioChannelModeLookup[$rawarray['channelmode']])) {
- echo ($echoerrors ? "\n".'invalid ChannelMode ('.$rawarray['channelmode'].')' : '');
- return false;
- }
- if (!isset($MPEGaudioModeExtensionLookup[$decodedLayer][$rawarray['modeextension']])) {
- echo ($echoerrors ? "\n".'invalid Mode Extension ('.$rawarray['modeextension'].')' : '');
- return false;
- }
- if (!isset($MPEGaudioEmphasisLookup[$rawarray['emphasis']])) {
- echo ($echoerrors ? "\n".'invalid Emphasis ('.$rawarray['emphasis'].')' : '');
- return false;
- }
- // These are just either set or not set, you can't mess that up :)
- // $rawarray['protection'];
- // $rawarray['padding'];
- // $rawarray['private'];
- // $rawarray['copyright'];
- // $rawarray['original'];
-
- return true;
- }
-
- static function MPEGaudioHeaderDecode($Header4Bytes) {
- // AAAA AAAA AAAB BCCD EEEE FFGH IIJJ KLMM
- // A - Frame sync (all bits set)
- // B - MPEG Audio version ID
- // C - Layer description
- // D - Protection bit
- // E - Bitrate index
- // F - Sampling rate frequency index
- // G - Padding bit
- // H - Private bit
- // I - Channel Mode
- // J - Mode extension (Only if Joint stereo)
- // K - Copyright
- // L - Original
- // M - Emphasis
-
- if (strlen($Header4Bytes) != 4) {
- return false;
- }
-
- $MPEGrawHeader['synch'] = (getid3_lib::BigEndian2Int(substr($Header4Bytes, 0, 2)) & 0xFFE0) >> 4;
- $MPEGrawHeader['version'] = (ord($Header4Bytes{1}) & 0x18) >> 3; // BB
- $MPEGrawHeader['layer'] = (ord($Header4Bytes{1}) & 0x06) >> 1; // CC
- $MPEGrawHeader['protection'] = (ord($Header4Bytes{1}) & 0x01); // D
- $MPEGrawHeader['bitrate'] = (ord($Header4Bytes{2}) & 0xF0) >> 4; // EEEE
- $MPEGrawHeader['sample_rate'] = (ord($Header4Bytes{2}) & 0x0C) >> 2; // FF
- $MPEGrawHeader['padding'] = (ord($Header4Bytes{2}) & 0x02) >> 1; // G
- $MPEGrawHeader['private'] = (ord($Header4Bytes{2}) & 0x01); // H
- $MPEGrawHeader['channelmode'] = (ord($Header4Bytes{3}) & 0xC0) >> 6; // II
- $MPEGrawHeader['modeextension'] = (ord($Header4Bytes{3}) & 0x30) >> 4; // JJ
- $MPEGrawHeader['copyright'] = (ord($Header4Bytes{3}) & 0x08) >> 3; // K
- $MPEGrawHeader['original'] = (ord($Header4Bytes{3}) & 0x04) >> 2; // L
- $MPEGrawHeader['emphasis'] = (ord($Header4Bytes{3}) & 0x03); // MM
-
- return $MPEGrawHeader;
- }
-
- static function MPEGaudioFrameLength(&$bitrate, &$version, &$layer, $padding, &$samplerate) {
- static $AudioFrameLengthCache = array();
-
- if (!isset($AudioFrameLengthCache[$bitrate][$version][$layer][$padding][$samplerate])) {
- $AudioFrameLengthCache[$bitrate][$version][$layer][$padding][$samplerate] = false;
- if ($bitrate != 'free') {
-
- if ($version == '1') {
-
- if ($layer == '1') {
-
- // For Layer I slot is 32 bits long
- $FrameLengthCoefficient = 48;
- $SlotLength = 4;
-
- } else { // Layer 2 / 3
-
- // for Layer 2 and Layer 3 slot is 8 bits long.
- $FrameLengthCoefficient = 144;
- $SlotLength = 1;
-
- }
-
- } else { // MPEG-2 / MPEG-2.5
-
- if ($layer == '1') {
-
- // For Layer I slot is 32 bits long
- $FrameLengthCoefficient = 24;
- $SlotLength = 4;
-
- } elseif ($layer == '2') {
-
- // for Layer 2 and Layer 3 slot is 8 bits long.
- $FrameLengthCoefficient = 144;
- $SlotLength = 1;
-
- } else { // layer 3
-
- // for Layer 2 and Layer 3 slot is 8 bits long.
- $FrameLengthCoefficient = 72;
- $SlotLength = 1;
-
- }
-
- }
-
- // FrameLengthInBytes = ((Coefficient * BitRate) / SampleRate) + Padding
- if ($samplerate > 0) {
- $NewFramelength = ($FrameLengthCoefficient * $bitrate) / $samplerate;
- $NewFramelength = floor($NewFramelength / $SlotLength) * $SlotLength; // round to next-lower multiple of SlotLength (1 byte for Layer 2/3, 4 bytes for Layer I)
- if ($padding) {
- $NewFramelength += $SlotLength;
- }
- $AudioFrameLengthCache[$bitrate][$version][$layer][$padding][$samplerate] = (int) $NewFramelength;
- }
- }
- }
- return $AudioFrameLengthCache[$bitrate][$version][$layer][$padding][$samplerate];
- }
-
- static function ClosestStandardMP3Bitrate($bit_rate) {
- static $standard_bit_rates = array (320000, 256000, 224000, 192000, 160000, 128000, 112000, 96000, 80000, 64000, 56000, 48000, 40000, 32000, 24000, 16000, 8000);
- static $bit_rate_table = array (0=>'-');
- $round_bit_rate = intval(round($bit_rate, -3));
- if (!isset($bit_rate_table[$round_bit_rate])) {
- if ($round_bit_rate > max($standard_bit_rates)) {
- $bit_rate_table[$round_bit_rate] = round($bit_rate, 2 - strlen($bit_rate));
- } else {
- $bit_rate_table[$round_bit_rate] = max($standard_bit_rates);
- foreach ($standard_bit_rates as $standard_bit_rate) {
- if ($round_bit_rate >= $standard_bit_rate + (($bit_rate_table[$round_bit_rate] - $standard_bit_rate) / 2)) {
- break;
- }
- $bit_rate_table[$round_bit_rate] = $standard_bit_rate;
- }
- }
- }
- return $bit_rate_table[$round_bit_rate];
- }
-
- static function XingVBRidOffset($version, $channelmode) {
- static $XingVBRidOffsetCache = array();
- if (empty($XingVBRidOffset)) {
- $XingVBRidOffset = array (
- '1' => array ('mono' => 0x15, // 4 + 17 = 21
- 'stereo' => 0x24, // 4 + 32 = 36
- 'joint stereo' => 0x24,
- 'dual channel' => 0x24
- ),
-
- '2' => array ('mono' => 0x0D, // 4 + 9 = 13
- 'stereo' => 0x15, // 4 + 17 = 21
- 'joint stereo' => 0x15,
- 'dual channel' => 0x15
- ),
-
- '2.5' => array ('mono' => 0x15,
- 'stereo' => 0x15,
- 'joint stereo' => 0x15,
- 'dual channel' => 0x15
- )
- );
- }
- return $XingVBRidOffset[$version][$channelmode];
- }
-
- static function LAMEvbrMethodLookup($VBRmethodID) {
- static $LAMEvbrMethodLookup = array(
- 0x00 => 'unknown',
- 0x01 => 'cbr',
- 0x02 => 'abr',
- 0x03 => 'vbr-old / vbr-rh',
- 0x04 => 'vbr-new / vbr-mtrh',
- 0x05 => 'vbr-mt',
- 0x06 => 'vbr (full vbr method 4)',
- 0x08 => 'cbr (constant bitrate 2 pass)',
- 0x09 => 'abr (2 pass)',
- 0x0F => 'reserved'
- );
- return (isset($LAMEvbrMethodLookup[$VBRmethodID]) ? $LAMEvbrMethodLookup[$VBRmethodID] : '');
- }
-
- static function LAMEmiscStereoModeLookup($StereoModeID) {
- static $LAMEmiscStereoModeLookup = array(
- 0 => 'mono',
- 1 => 'stereo',
- 2 => 'dual mono',
- 3 => 'joint stereo',
- 4 => 'forced stereo',
- 5 => 'auto',
- 6 => 'intensity stereo',
- 7 => 'other'
- );
- return (isset($LAMEmiscStereoModeLookup[$StereoModeID]) ? $LAMEmiscStereoModeLookup[$StereoModeID] : '');
- }
-
- static function LAMEmiscSourceSampleFrequencyLookup($SourceSampleFrequencyID) {
- static $LAMEmiscSourceSampleFrequencyLookup = array(
- 0 => '<= 32 kHz',
- 1 => '44.1 kHz',
- 2 => '48 kHz',
- 3 => '> 48kHz'
- );
- return (isset($LAMEmiscSourceSampleFrequencyLookup[$SourceSampleFrequencyID]) ? $LAMEmiscSourceSampleFrequencyLookup[$SourceSampleFrequencyID] : '');
- }
-
- static function LAMEsurroundInfoLookup($SurroundInfoID) {
- static $LAMEsurroundInfoLookup = array(
- 0 => 'no surround info',
- 1 => 'DPL encoding',
- 2 => 'DPL2 encoding',
- 3 => 'Ambisonic encoding'
- );
- return (isset($LAMEsurroundInfoLookup[$SurroundInfoID]) ? $LAMEsurroundInfoLookup[$SurroundInfoID] : 'reserved');
- }
-
- static function LAMEpresetUsedLookup($LAMEtag) {
-
- if ($LAMEtag['preset_used_id'] == 0) {
- // no preset used (LAME >=3.93)
- // no preset recorded (LAME <3.93)
- return '';
- }
- $LAMEpresetUsedLookup = array();
-
- ///// THIS PART CANNOT BE STATIC .
- for ($i = 8; $i <= 320; $i++) {
- switch ($LAMEtag['vbr_method']) {
- case 'cbr':
- $LAMEpresetUsedLookup[$i] = '--alt-preset '.$LAMEtag['vbr_method'].' '.$i;
- break;
- case 'abr':
- default: // other VBR modes shouldn't be here(?)
- $LAMEpresetUsedLookup[$i] = '--alt-preset '.$i;
- break;
- }
- }
-
- // named old-style presets (studio, phone, voice, etc) are handled in GuessEncoderOptions()
-
- // named alt-presets
- $LAMEpresetUsedLookup[1000] = '--r3mix';
- $LAMEpresetUsedLookup[1001] = '--alt-preset standard';
- $LAMEpresetUsedLookup[1002] = '--alt-preset extreme';
- $LAMEpresetUsedLookup[1003] = '--alt-preset insane';
- $LAMEpresetUsedLookup[1004] = '--alt-preset fast standard';
- $LAMEpresetUsedLookup[1005] = '--alt-preset fast extreme';
- $LAMEpresetUsedLookup[1006] = '--alt-preset medium';
- $LAMEpresetUsedLookup[1007] = '--alt-preset fast medium';
-
- // LAME 3.94 additions/changes
- $LAMEpresetUsedLookup[1010] = '--preset portable'; // 3.94a15 Oct 21 2003
- $LAMEpresetUsedLookup[1015] = '--preset radio'; // 3.94a15 Oct 21 2003
-
- $LAMEpresetUsedLookup[320] = '--preset insane'; // 3.94a15 Nov 12 2003
- $LAMEpresetUsedLookup[410] = '-V9';
- $LAMEpresetUsedLookup[420] = '-V8';
- $LAMEpresetUsedLookup[440] = '-V6';
- $LAMEpresetUsedLookup[430] = '--preset radio'; // 3.94a15 Nov 12 2003
- $LAMEpresetUsedLookup[450] = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'portable'; // 3.94a15 Nov 12 2003
- $LAMEpresetUsedLookup[460] = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'medium'; // 3.94a15 Nov 12 2003
- $LAMEpresetUsedLookup[470] = '--r3mix'; // 3.94b1 Dec 18 2003
- $LAMEpresetUsedLookup[480] = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'standard'; // 3.94a15 Nov 12 2003
- $LAMEpresetUsedLookup[490] = '-V1';
- $LAMEpresetUsedLookup[500] = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'extreme'; // 3.94a15 Nov 12 2003
-
- return (isset($LAMEpresetUsedLookup[$LAMEtag['preset_used_id']]) ? $LAMEpresetUsedLookup[$LAMEtag['preset_used_id']] : 'new/unknown preset: '.$LAMEtag['preset_used_id'].' - report to info@getid3.org');
- }
-
-}
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.audio.mpc.php b/3rdparty/getid3/module.audio.mpc.php
deleted file mode 100644
index 9a0b16d9abc..00000000000
--- a/3rdparty/getid3/module.audio.mpc.php
+++ /dev/null
@@ -1,509 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.audio.mpc.php //
-// module for analyzing Musepack/MPEG+ Audio files //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_mpc extends getid3_handler
-{
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- $info['mpc']['header'] = array();
- $thisfile_mpc_header = &$info['mpc']['header'];
-
- $info['fileformat'] = 'mpc';
- $info['audio']['dataformat'] = 'mpc';
- $info['audio']['bitrate_mode'] = 'vbr';
- $info['audio']['channels'] = 2; // up to SV7 the format appears to have been hardcoded for stereo only
- $info['audio']['lossless'] = false;
-
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
- $MPCheaderData = fread($this->getid3->fp, 4);
- $info['mpc']['header']['preamble'] = substr($MPCheaderData, 0, 4); // should be 'MPCK' (SV8) or 'MP+' (SV7), otherwise possible stream data (SV4-SV6)
- if (preg_match('#^MPCK#', $info['mpc']['header']['preamble'])) {
-
- // this is SV8
- return $this->ParseMPCsv8();
-
- } elseif (preg_match('#^MP\+#', $info['mpc']['header']['preamble'])) {
-
- // this is SV7
- return $this->ParseMPCsv7();
-
- } elseif (preg_match('/^[\x00\x01\x10\x11\x40\x41\x50\x51\x80\x81\x90\x91\xC0\xC1\xD0\xD1][\x20-37][\x00\x20\x40\x60\x80\xA0\xC0\xE0]/s', $MPCheaderData)) {
-
- // this is SV4 - SV6, handle seperately
- return $this->ParseMPCsv6();
-
- } else {
-
- $info['error'][] = 'Expecting "MP+" or "MPCK" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes(substr($MPCheaderData, 0, 4)).'"';
- unset($info['fileformat']);
- unset($info['mpc']);
- return false;
-
- }
- return false;
- }
-
-
- function ParseMPCsv8() {
- // this is SV8
- // http://trac.musepack.net/trac/wiki/SV8Specification
-
- $info = &$this->getid3->info;
- $thisfile_mpc_header = &$info['mpc']['header'];
-
- $keyNameSize = 2;
- $maxHandledPacketLength = 9; // specs say: "n*8; 0 < n < 10"
-
- $offset = ftell($this->getid3->fp);
- while ($offset < $info['avdataend']) {
- $thisPacket = array();
- $thisPacket['offset'] = $offset;
- $packet_offset = 0;
-
- // Size is a variable-size field, could be 1-4 bytes (possibly more?)
- // read enough data in and figure out the exact size later
- $MPCheaderData = fread($this->getid3->fp, $keyNameSize + $maxHandledPacketLength);
- $packet_offset += $keyNameSize;
- $thisPacket['key'] = substr($MPCheaderData, 0, $keyNameSize);
- $thisPacket['key_name'] = $this->MPCsv8PacketName($thisPacket['key']);
- if ($thisPacket['key'] == $thisPacket['key_name']) {
- $info['error'][] = 'Found unexpected key value "'.$thisPacket['key'].'" at offset '.$thisPacket['offset'];
- return false;
- }
- $packetLength = 0;
- $thisPacket['packet_size'] = $this->SV8variableLengthInteger(substr($MPCheaderData, $keyNameSize), $packetLength); // includes keyname and packet_size field
- if ($thisPacket['packet_size'] === false) {
- $info['error'][] = 'Did not find expected packet length within '.$maxHandledPacketLength.' bytes at offset '.($thisPacket['offset'] + $keyNameSize);
- return false;
- }
- $packet_offset += $packetLength;
- $offset += $thisPacket['packet_size'];
-
- switch ($thisPacket['key']) {
- case 'SH': // Stream Header
- $moreBytesToRead = $thisPacket['packet_size'] - $keyNameSize - $maxHandledPacketLength;
- if ($moreBytesToRead > 0) {
- $MPCheaderData .= fread($this->getid3->fp, $moreBytesToRead);
- }
- $thisPacket['crc'] = getid3_lib::BigEndian2Int(substr($MPCheaderData, $packet_offset, 4));
- $packet_offset += 4;
- $thisPacket['stream_version'] = getid3_lib::BigEndian2Int(substr($MPCheaderData, $packet_offset, 1));
- $packet_offset += 1;
-
- $packetLength = 0;
- $thisPacket['sample_count'] = $this->SV8variableLengthInteger(substr($MPCheaderData, $packet_offset, $maxHandledPacketLength), $packetLength);
- $packet_offset += $packetLength;
-
- $packetLength = 0;
- $thisPacket['beginning_silence'] = $this->SV8variableLengthInteger(substr($MPCheaderData, $packet_offset, $maxHandledPacketLength), $packetLength);
- $packet_offset += $packetLength;
-
- $otherUsefulData = getid3_lib::BigEndian2Int(substr($MPCheaderData, $packet_offset, 2));
- $packet_offset += 2;
- $thisPacket['sample_frequency_raw'] = (($otherUsefulData & 0xE000) >> 13);
- $thisPacket['max_bands_used'] = (($otherUsefulData & 0x1F00) >> 8);
- $thisPacket['channels'] = (($otherUsefulData & 0x00F0) >> 4) + 1;
- $thisPacket['ms_used'] = (bool) (($otherUsefulData & 0x0008) >> 3);
- $thisPacket['audio_block_frames'] = (($otherUsefulData & 0x0007) >> 0);
- $thisPacket['sample_frequency'] = $this->MPCfrequencyLookup($thisPacket['sample_frequency_raw']);
-
- $thisfile_mpc_header['mid_side_stereo'] = $thisPacket['ms_used'];
- $thisfile_mpc_header['sample_rate'] = $thisPacket['sample_frequency'];
- $thisfile_mpc_header['samples'] = $thisPacket['sample_count'];
- $thisfile_mpc_header['stream_version_major'] = $thisPacket['stream_version'];
-
- $info['audio']['channels'] = $thisPacket['channels'];
- $info['audio']['sample_rate'] = $thisPacket['sample_frequency'];
- $info['playtime_seconds'] = $thisPacket['sample_count'] / $thisPacket['sample_frequency'];
- $info['audio']['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds'];
- break;
-
- case 'RG': // Replay Gain
- $moreBytesToRead = $thisPacket['packet_size'] - $keyNameSize - $maxHandledPacketLength;
- if ($moreBytesToRead > 0) {
- $MPCheaderData .= fread($this->getid3->fp, $moreBytesToRead);
- }
- $thisPacket['replaygain_version'] = getid3_lib::BigEndian2Int(substr($MPCheaderData, $packet_offset, 1));
- $packet_offset += 1;
- $thisPacket['replaygain_title_gain'] = getid3_lib::BigEndian2Int(substr($MPCheaderData, $packet_offset, 2));
- $packet_offset += 2;
- $thisPacket['replaygain_title_peak'] = getid3_lib::BigEndian2Int(substr($MPCheaderData, $packet_offset, 2));
- $packet_offset += 2;
- $thisPacket['replaygain_album_gain'] = getid3_lib::BigEndian2Int(substr($MPCheaderData, $packet_offset, 2));
- $packet_offset += 2;
- $thisPacket['replaygain_album_peak'] = getid3_lib::BigEndian2Int(substr($MPCheaderData, $packet_offset, 2));
- $packet_offset += 2;
-
- if ($thisPacket['replaygain_title_gain']) { $info['replay_gain']['title']['gain'] = $thisPacket['replaygain_title_gain']; }
- if ($thisPacket['replaygain_title_peak']) { $info['replay_gain']['title']['peak'] = $thisPacket['replaygain_title_peak']; }
- if ($thisPacket['replaygain_album_gain']) { $info['replay_gain']['album']['gain'] = $thisPacket['replaygain_album_gain']; }
- if ($thisPacket['replaygain_album_peak']) { $info['replay_gain']['album']['peak'] = $thisPacket['replaygain_album_peak']; }
- break;
-
- case 'EI': // Encoder Info
- $moreBytesToRead = $thisPacket['packet_size'] - $keyNameSize - $maxHandledPacketLength;
- if ($moreBytesToRead > 0) {
- $MPCheaderData .= fread($this->getid3->fp, $moreBytesToRead);
- }
- $profile_pns = getid3_lib::BigEndian2Int(substr($MPCheaderData, $packet_offset, 1));
- $packet_offset += 1;
- $quality_int = (($profile_pns & 0xF0) >> 4);
- $quality_dec = (($profile_pns & 0x0E) >> 3);
- $thisPacket['quality'] = (float) $quality_int + ($quality_dec / 8);
- $thisPacket['pns_tool'] = (bool) (($profile_pns & 0x01) >> 0);
- $thisPacket['version_major'] = getid3_lib::BigEndian2Int(substr($MPCheaderData, $packet_offset, 1));
- $packet_offset += 1;
- $thisPacket['version_minor'] = getid3_lib::BigEndian2Int(substr($MPCheaderData, $packet_offset, 1));
- $packet_offset += 1;
- $thisPacket['version_build'] = getid3_lib::BigEndian2Int(substr($MPCheaderData, $packet_offset, 1));
- $packet_offset += 1;
- $thisPacket['version'] = $thisPacket['version_major'].'.'.$thisPacket['version_minor'].'.'.$thisPacket['version_build'];
-
- $info['audio']['encoder'] = 'MPC v'.$thisPacket['version'].' ('.(($thisPacket['version_minor'] % 2) ? 'unstable' : 'stable').')';
- $thisfile_mpc_header['encoder_version'] = $info['audio']['encoder'];
- //$thisfile_mpc_header['quality'] = (float) ($thisPacket['quality'] / 1.5875); // values can range from 0.000 to 15.875, mapped to qualities of 0.0 to 10.0
- $thisfile_mpc_header['quality'] = (float) ($thisPacket['quality'] - 5); // values can range from 0.000 to 15.875, of which 0..4 are "reserved/experimental", and 5..15 are mapped to qualities of 0.0 to 10.0
- break;
-
- case 'SO': // Seek Table Offset
- $packetLength = 0;
- $thisPacket['seek_table_offset'] = $thisPacket['offset'] + $this->SV8variableLengthInteger(substr($MPCheaderData, $packet_offset, $maxHandledPacketLength), $packetLength);
- $packet_offset += $packetLength;
- break;
-
- case 'ST': // Seek Table
- case 'SE': // Stream End
- case 'AP': // Audio Data
- // nothing useful here, just skip this packet
- $thisPacket = array();
- break;
-
- default:
- $info['error'][] = 'Found unhandled key type "'.$thisPacket['key'].'" at offset '.$thisPacket['offset'];
- return false;
- break;
- }
- if (!empty($thisPacket)) {
- $info['mpc']['packets'][] = $thisPacket;
- }
- fseek($this->getid3->fp, $offset);
- }
- $thisfile_mpc_header['size'] = $offset;
- return true;
- }
-
- function ParseMPCsv7() {
- // this is SV7
- // http://www.uni-jena.de/~pfk/mpp/sv8/header.html
-
- $info = &$this->getid3->info;
- $thisfile_mpc_header = &$info['mpc']['header'];
- $offset = 0;
-
- $thisfile_mpc_header['size'] = 28;
- $MPCheaderData = $info['mpc']['header']['preamble'];
- $MPCheaderData .= fread($this->getid3->fp, $thisfile_mpc_header['size'] - strlen($info['mpc']['header']['preamble']));
- $offset = strlen('MP+');
-
- $StreamVersionByte = getid3_lib::LittleEndian2Int(substr($MPCheaderData, $offset, 1));
- $offset += 1;
- $thisfile_mpc_header['stream_version_major'] = ($StreamVersionByte & 0x0F) >> 0;
- $thisfile_mpc_header['stream_version_minor'] = ($StreamVersionByte & 0xF0) >> 4; // should always be 0, subversions no longer exist in SV8
- $thisfile_mpc_header['frame_count'] = getid3_lib::LittleEndian2Int(substr($MPCheaderData, $offset, 4));
- $offset += 4;
-
- if ($thisfile_mpc_header['stream_version_major'] != 7) {
- $info['error'][] = 'Only Musepack SV7 supported (this file claims to be v'.$thisfile_mpc_header['stream_version_major'].')';
- return false;
- }
-
- $FlagsDWORD1 = getid3_lib::LittleEndian2Int(substr($MPCheaderData, $offset, 4));
- $offset += 4;
- $thisfile_mpc_header['intensity_stereo'] = (bool) (($FlagsDWORD1 & 0x80000000) >> 31);
- $thisfile_mpc_header['mid_side_stereo'] = (bool) (($FlagsDWORD1 & 0x40000000) >> 30);
- $thisfile_mpc_header['max_subband'] = ($FlagsDWORD1 & 0x3F000000) >> 24;
- $thisfile_mpc_header['raw']['profile'] = ($FlagsDWORD1 & 0x00F00000) >> 20;
- $thisfile_mpc_header['begin_loud'] = (bool) (($FlagsDWORD1 & 0x00080000) >> 19);
- $thisfile_mpc_header['end_loud'] = (bool) (($FlagsDWORD1 & 0x00040000) >> 18);
- $thisfile_mpc_header['raw']['sample_rate'] = ($FlagsDWORD1 & 0x00030000) >> 16;
- $thisfile_mpc_header['max_level'] = ($FlagsDWORD1 & 0x0000FFFF);
-
- $thisfile_mpc_header['raw']['title_peak'] = getid3_lib::LittleEndian2Int(substr($MPCheaderData, $offset, 2));
- $offset += 2;
- $thisfile_mpc_header['raw']['title_gain'] = getid3_lib::LittleEndian2Int(substr($MPCheaderData, $offset, 2), true);
- $offset += 2;
-
- $thisfile_mpc_header['raw']['album_peak'] = getid3_lib::LittleEndian2Int(substr($MPCheaderData, $offset, 2));
- $offset += 2;
- $thisfile_mpc_header['raw']['album_gain'] = getid3_lib::LittleEndian2Int(substr($MPCheaderData, $offset, 2), true);
- $offset += 2;
-
- $FlagsDWORD2 = getid3_lib::LittleEndian2Int(substr($MPCheaderData, $offset, 4));
- $offset += 4;
- $thisfile_mpc_header['true_gapless'] = (bool) (($FlagsDWORD2 & 0x80000000) >> 31);
- $thisfile_mpc_header['last_frame_length'] = ($FlagsDWORD2 & 0x7FF00000) >> 20;
-
-
- $thisfile_mpc_header['raw']['not_sure_what'] = getid3_lib::LittleEndian2Int(substr($MPCheaderData, $offset, 3));
- $offset += 3;
- $thisfile_mpc_header['raw']['encoder_version'] = getid3_lib::LittleEndian2Int(substr($MPCheaderData, $offset, 1));
- $offset += 1;
-
- $thisfile_mpc_header['profile'] = $this->MPCprofileNameLookup($thisfile_mpc_header['raw']['profile']);
- $thisfile_mpc_header['sample_rate'] = $this->MPCfrequencyLookup($thisfile_mpc_header['raw']['sample_rate']);
- if ($thisfile_mpc_header['sample_rate'] == 0) {
- $info['error'][] = 'Corrupt MPC file: frequency == zero';
- return false;
- }
- $info['audio']['sample_rate'] = $thisfile_mpc_header['sample_rate'];
- $thisfile_mpc_header['samples'] = ((($thisfile_mpc_header['frame_count'] - 1) * 1152) + $thisfile_mpc_header['last_frame_length']) * $info['audio']['channels'];
-
- $info['playtime_seconds'] = ($thisfile_mpc_header['samples'] / $info['audio']['channels']) / $info['audio']['sample_rate'];
- if ($info['playtime_seconds'] == 0) {
- $info['error'][] = 'Corrupt MPC file: playtime_seconds == zero';
- return false;
- }
-
- // add size of file header to avdataoffset - calc bitrate correctly + MD5 data
- $info['avdataoffset'] += $thisfile_mpc_header['size'];
-
- $info['audio']['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds'];
-
- $thisfile_mpc_header['title_peak'] = $thisfile_mpc_header['raw']['title_peak'];
- $thisfile_mpc_header['title_peak_db'] = $this->MPCpeakDBLookup($thisfile_mpc_header['title_peak']);
- if ($thisfile_mpc_header['raw']['title_gain'] < 0) {
- $thisfile_mpc_header['title_gain_db'] = (float) (32768 + $thisfile_mpc_header['raw']['title_gain']) / -100;
- } else {
- $thisfile_mpc_header['title_gain_db'] = (float) $thisfile_mpc_header['raw']['title_gain'] / 100;
- }
-
- $thisfile_mpc_header['album_peak'] = $thisfile_mpc_header['raw']['album_peak'];
- $thisfile_mpc_header['album_peak_db'] = $this->MPCpeakDBLookup($thisfile_mpc_header['album_peak']);
- if ($thisfile_mpc_header['raw']['album_gain'] < 0) {
- $thisfile_mpc_header['album_gain_db'] = (float) (32768 + $thisfile_mpc_header['raw']['album_gain']) / -100;
- } else {
- $thisfile_mpc_header['album_gain_db'] = (float) $thisfile_mpc_header['raw']['album_gain'] / 100;;
- }
- $thisfile_mpc_header['encoder_version'] = $this->MPCencoderVersionLookup($thisfile_mpc_header['raw']['encoder_version']);
-
- $info['replay_gain']['track']['adjustment'] = $thisfile_mpc_header['title_gain_db'];
- $info['replay_gain']['album']['adjustment'] = $thisfile_mpc_header['album_gain_db'];
-
- if ($thisfile_mpc_header['title_peak'] > 0) {
- $info['replay_gain']['track']['peak'] = $thisfile_mpc_header['title_peak'];
- } elseif (round($thisfile_mpc_header['max_level'] * 1.18) > 0) {
- $info['replay_gain']['track']['peak'] = getid3_lib::CastAsInt(round($thisfile_mpc_header['max_level'] * 1.18)); // why? I don't know - see mppdec.c
- }
- if ($thisfile_mpc_header['album_peak'] > 0) {
- $info['replay_gain']['album']['peak'] = $thisfile_mpc_header['album_peak'];
- }
-
- //$info['audio']['encoder'] = 'SV'.$thisfile_mpc_header['stream_version_major'].'.'.$thisfile_mpc_header['stream_version_minor'].', '.$thisfile_mpc_header['encoder_version'];
- $info['audio']['encoder'] = $thisfile_mpc_header['encoder_version'];
- $info['audio']['encoder_options'] = $thisfile_mpc_header['profile'];
- $thisfile_mpc_header['quality'] = (float) ($thisfile_mpc_header['raw']['profile'] - 5); // values can range from 0 to 15, of which 0..4 are "reserved/experimental", and 5..15 are mapped to qualities of 0.0 to 10.0
-
- return true;
- }
-
- function ParseMPCsv6() {
- // this is SV4 - SV6
-
- $info = &$this->getid3->info;
- $thisfile_mpc_header = &$info['mpc']['header'];
- $offset = 0;
-
- $thisfile_mpc_header['size'] = 8;
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
- $MPCheaderData = fread($this->getid3->fp, $thisfile_mpc_header['size']);
-
- // add size of file header to avdataoffset - calc bitrate correctly + MD5 data
- $info['avdataoffset'] += $thisfile_mpc_header['size'];
-
- // Most of this code adapted from Jurgen Faul's MPEGplus source code - thanks Jurgen! :)
- $HeaderDWORD[0] = getid3_lib::LittleEndian2Int(substr($MPCheaderData, 0, 4));
- $HeaderDWORD[1] = getid3_lib::LittleEndian2Int(substr($MPCheaderData, 4, 4));
-
-
- // DDDD DDDD CCCC CCCC BBBB BBBB AAAA AAAA
- // aaaa aaaa abcd dddd dddd deee eeff ffff
- //
- // a = bitrate = anything
- // b = IS = anything
- // c = MS = anything
- // d = streamversion = 0000000004 or 0000000005 or 0000000006
- // e = maxband = anything
- // f = blocksize = 000001 for SV5+, anything(?) for SV4
-
- $thisfile_mpc_header['target_bitrate'] = (($HeaderDWORD[0] & 0xFF800000) >> 23);
- $thisfile_mpc_header['intensity_stereo'] = (bool) (($HeaderDWORD[0] & 0x00400000) >> 22);
- $thisfile_mpc_header['mid_side_stereo'] = (bool) (($HeaderDWORD[0] & 0x00200000) >> 21);
- $thisfile_mpc_header['stream_version_major'] = ($HeaderDWORD[0] & 0x001FF800) >> 11;
- $thisfile_mpc_header['stream_version_minor'] = 0; // no sub-version numbers before SV7
- $thisfile_mpc_header['max_band'] = ($HeaderDWORD[0] & 0x000007C0) >> 6; // related to lowpass frequency, not sure how it translates exactly
- $thisfile_mpc_header['block_size'] = ($HeaderDWORD[0] & 0x0000003F);
-
- switch ($thisfile_mpc_header['stream_version_major']) {
- case 4:
- $thisfile_mpc_header['frame_count'] = ($HeaderDWORD[1] >> 16);
- break;
-
- case 5:
- case 6:
- $thisfile_mpc_header['frame_count'] = $HeaderDWORD[1];
- break;
-
- default:
- $info['error'] = 'Expecting 4, 5 or 6 in version field, found '.$thisfile_mpc_header['stream_version_major'].' instead';
- unset($info['mpc']);
- return false;
- break;
- }
-
- if (($thisfile_mpc_header['stream_version_major'] > 4) && ($thisfile_mpc_header['block_size'] != 1)) {
- $info['warning'][] = 'Block size expected to be 1, actual value found: '.$thisfile_mpc_header['block_size'];
- }
-
- $thisfile_mpc_header['sample_rate'] = 44100; // AB: used by all files up to SV7
- $info['audio']['sample_rate'] = $thisfile_mpc_header['sample_rate'];
- $thisfile_mpc_header['samples'] = $thisfile_mpc_header['frame_count'] * 1152 * $info['audio']['channels'];
-
- if ($thisfile_mpc_header['target_bitrate'] == 0) {
- $info['audio']['bitrate_mode'] = 'vbr';
- } else {
- $info['audio']['bitrate_mode'] = 'cbr';
- }
-
- $info['mpc']['bitrate'] = ($info['avdataend'] - $info['avdataoffset']) * 8 * 44100 / $thisfile_mpc_header['frame_count'] / 1152;
- $info['audio']['bitrate'] = $info['mpc']['bitrate'];
- $info['audio']['encoder'] = 'SV'.$thisfile_mpc_header['stream_version_major'];
-
- return true;
- }
-
-
- function MPCprofileNameLookup($profileid) {
- static $MPCprofileNameLookup = array(
- 0 => 'no profile',
- 1 => 'Experimental',
- 2 => 'unused',
- 3 => 'unused',
- 4 => 'unused',
- 5 => 'below Telephone (q = 0.0)',
- 6 => 'below Telephone (q = 1.0)',
- 7 => 'Telephone (q = 2.0)',
- 8 => 'Thumb (q = 3.0)',
- 9 => 'Radio (q = 4.0)',
- 10 => 'Standard (q = 5.0)',
- 11 => 'Extreme (q = 6.0)',
- 12 => 'Insane (q = 7.0)',
- 13 => 'BrainDead (q = 8.0)',
- 14 => 'above BrainDead (q = 9.0)',
- 15 => 'above BrainDead (q = 10.0)'
- );
- return (isset($MPCprofileNameLookup[$profileid]) ? $MPCprofileNameLookup[$profileid] : 'invalid');
- }
-
- function MPCfrequencyLookup($frequencyid) {
- static $MPCfrequencyLookup = array(
- 0 => 44100,
- 1 => 48000,
- 2 => 37800,
- 3 => 32000
- );
- return (isset($MPCfrequencyLookup[$frequencyid]) ? $MPCfrequencyLookup[$frequencyid] : 'invalid');
- }
-
- function MPCpeakDBLookup($intvalue) {
- if ($intvalue > 0) {
- return ((log10($intvalue) / log10(2)) - 15) * 6;
- }
- return false;
- }
-
- function MPCencoderVersionLookup($encoderversion) {
- //Encoder version * 100 (106 = 1.06)
- //EncoderVersion % 10 == 0 Release (1.0)
- //EncoderVersion % 2 == 0 Beta (1.06)
- //EncoderVersion % 2 == 1 Alpha (1.05a...z)
-
- if ($encoderversion == 0) {
- // very old version, not known exactly which
- return 'Buschmann v1.7.0-v1.7.9 or Klemm v0.90-v1.05';
- }
-
- if (($encoderversion % 10) == 0) {
-
- // release version
- return number_format($encoderversion / 100, 2);
-
- } elseif (($encoderversion % 2) == 0) {
-
- // beta version
- return number_format($encoderversion / 100, 2).' beta';
-
- }
-
- // alpha version
- return number_format($encoderversion / 100, 2).' alpha';
- }
-
- function SV8variableLengthInteger($data, &$packetLength, $maxHandledPacketLength=9) {
- $packet_size = 0;
- for ($packetLength = 1; $packetLength <= $maxHandledPacketLength; $packetLength++) {
- // variable-length size field:
- // bits, big-endian
- // 0xxx xxxx - value 0 to 2^7-1
- // 1xxx xxxx 0xxx xxxx - value 0 to 2^14-1
- // 1xxx xxxx 1xxx xxxx 0xxx xxxx - value 0 to 2^21-1
- // 1xxx xxxx 1xxx xxxx 1xxx xxxx 0xxx xxxx - value 0 to 2^28-1
- // ...
- $thisbyte = ord(substr($data, ($packetLength - 1), 1));
- // look through bytes until find a byte with MSB==0
- $packet_size = ($packet_size << 7);
- $packet_size = ($packet_size | ($thisbyte & 0x7F));
- if (($thisbyte & 0x80) === 0) {
- break;
- }
- if ($packetLength >= $maxHandledPacketLength) {
- return false;
- }
- }
- return $packet_size;
- }
-
- function MPCsv8PacketName($packetKey) {
- static $MPCsv8PacketName = array();
- if (empty($MPCsv8PacketName)) {
- $MPCsv8PacketName = array(
- 'AP' => 'Audio Packet',
- 'CT' => 'Chapter Tag',
- 'EI' => 'Encoder Info',
- 'RG' => 'Replay Gain',
- 'SE' => 'Stream End',
- 'SH' => 'Stream Header',
- 'SO' => 'Seek Table Offset',
- 'ST' => 'Seek Table',
- );
- }
- return (isset($MPCsv8PacketName[$packetKey]) ? $MPCsv8PacketName[$packetKey] : $packetKey);
- }
-}
-
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.audio.ogg.php b/3rdparty/getid3/module.audio.ogg.php
deleted file mode 100644
index c987fa67d70..00000000000
--- a/3rdparty/getid3/module.audio.ogg.php
+++ /dev/null
@@ -1,705 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.audio.ogg.php //
-// module for analyzing Ogg Vorbis, OggFLAC and Speex files //
-// dependencies: module.audio.flac.php //
-// ///
-/////////////////////////////////////////////////////////////////
-
-getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.flac.php', __FILE__, true);
-
-class getid3_ogg extends getid3_handler
-{
- var $inline_attachments = true; // true: return full data for all attachments; false: return no data for all attachments; integer: return data for attachments <= than this; string: save as file to this directory
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- $info['fileformat'] = 'ogg';
-
- // Warn about illegal tags - only vorbiscomments are allowed
- if (isset($info['id3v2'])) {
- $info['warning'][] = 'Illegal ID3v2 tag present.';
- }
- if (isset($info['id3v1'])) {
- $info['warning'][] = 'Illegal ID3v1 tag present.';
- }
- if (isset($info['ape'])) {
- $info['warning'][] = 'Illegal APE tag present.';
- }
-
-
- // Page 1 - Stream Header
-
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
-
- $oggpageinfo = $this->ParseOggPageHeader();
- $info['ogg']['pageheader'][$oggpageinfo['page_seqno']] = $oggpageinfo;
-
- if (ftell($this->getid3->fp) >= $this->getid3->fread_buffer_size()) {
- $info['error'][] = 'Could not find start of Ogg page in the first '.$this->getid3->fread_buffer_size().' bytes (this might not be an Ogg-Vorbis file?)';
- unset($info['fileformat']);
- unset($info['ogg']);
- return false;
- }
-
- $filedata = fread($this->getid3->fp, $oggpageinfo['page_length']);
- $filedataoffset = 0;
-
- if (substr($filedata, 0, 4) == 'fLaC') {
-
- $info['audio']['dataformat'] = 'flac';
- $info['audio']['bitrate_mode'] = 'vbr';
- $info['audio']['lossless'] = true;
-
- } elseif (substr($filedata, 1, 6) == 'vorbis') {
-
- $this->ParseVorbisPageHeader($filedata, $filedataoffset, $oggpageinfo);
-
- } elseif (substr($filedata, 0, 8) == 'Speex ') {
-
- // http://www.speex.org/manual/node10.html
-
- $info['audio']['dataformat'] = 'speex';
- $info['mime_type'] = 'audio/speex';
- $info['audio']['bitrate_mode'] = 'abr';
- $info['audio']['lossless'] = false;
-
- $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['speex_string'] = substr($filedata, $filedataoffset, 8); // hard-coded to 'Speex '
- $filedataoffset += 8;
- $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['speex_version'] = substr($filedata, $filedataoffset, 20);
- $filedataoffset += 20;
- $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['speex_version_id'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
- $filedataoffset += 4;
- $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['header_size'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
- $filedataoffset += 4;
- $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['rate'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
- $filedataoffset += 4;
- $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['mode'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
- $filedataoffset += 4;
- $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['mode_bitstream_version'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
- $filedataoffset += 4;
- $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['nb_channels'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
- $filedataoffset += 4;
- $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['bitrate'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
- $filedataoffset += 4;
- $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['framesize'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
- $filedataoffset += 4;
- $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['vbr'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
- $filedataoffset += 4;
- $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['frames_per_packet'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
- $filedataoffset += 4;
- $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['extra_headers'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
- $filedataoffset += 4;
- $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['reserved1'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
- $filedataoffset += 4;
- $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['reserved2'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
- $filedataoffset += 4;
-
- $info['speex']['speex_version'] = trim($info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['speex_version']);
- $info['speex']['sample_rate'] = $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['rate'];
- $info['speex']['channels'] = $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['nb_channels'];
- $info['speex']['vbr'] = (bool) $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['vbr'];
- $info['speex']['band_type'] = $this->SpeexBandModeLookup($info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['mode']);
-
- $info['audio']['sample_rate'] = $info['speex']['sample_rate'];
- $info['audio']['channels'] = $info['speex']['channels'];
- if ($info['speex']['vbr']) {
- $info['audio']['bitrate_mode'] = 'vbr';
- }
-
-
- } elseif (substr($filedata, 0, 8) == "fishead\x00") {
-
- // Ogg Skeleton version 3.0 Format Specification
- // http://xiph.org/ogg/doc/skeleton.html
- $filedataoffset += 8;
- $info['ogg']['skeleton']['fishead']['raw']['version_major'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 2));
- $filedataoffset += 2;
- $info['ogg']['skeleton']['fishead']['raw']['version_minor'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 2));
- $filedataoffset += 2;
- $info['ogg']['skeleton']['fishead']['raw']['presentationtime_numerator'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8));
- $filedataoffset += 8;
- $info['ogg']['skeleton']['fishead']['raw']['presentationtime_denominator'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8));
- $filedataoffset += 8;
- $info['ogg']['skeleton']['fishead']['raw']['basetime_numerator'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8));
- $filedataoffset += 8;
- $info['ogg']['skeleton']['fishead']['raw']['basetime_denominator'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8));
- $filedataoffset += 8;
- $info['ogg']['skeleton']['fishead']['raw']['utc'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 20));
- $filedataoffset += 20;
-
- $info['ogg']['skeleton']['fishead']['version'] = $info['ogg']['skeleton']['fishead']['raw']['version_major'].'.'.$info['ogg']['skeleton']['fishead']['raw']['version_minor'];
- $info['ogg']['skeleton']['fishead']['presentationtime'] = $info['ogg']['skeleton']['fishead']['raw']['presentationtime_numerator'] / $info['ogg']['skeleton']['fishead']['raw']['presentationtime_denominator'];
- $info['ogg']['skeleton']['fishead']['basetime'] = $info['ogg']['skeleton']['fishead']['raw']['basetime_numerator'] / $info['ogg']['skeleton']['fishead']['raw']['basetime_denominator'];
- $info['ogg']['skeleton']['fishead']['utc'] = $info['ogg']['skeleton']['fishead']['raw']['utc'];
-
-
- $counter = 0;
- do {
- $oggpageinfo = $this->ParseOggPageHeader();
- $info['ogg']['pageheader'][$oggpageinfo['page_seqno'].'.'.$counter++] = $oggpageinfo;
- $filedata = fread($this->getid3->fp, $oggpageinfo['page_length']);
- fseek($this->getid3->fp, $oggpageinfo['page_end_offset'], SEEK_SET);
-
- if (substr($filedata, 0, 8) == "fisbone\x00") {
-
- $filedataoffset = 8;
- $info['ogg']['skeleton']['fisbone']['raw']['message_header_offset'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
- $filedataoffset += 4;
- $info['ogg']['skeleton']['fisbone']['raw']['serial_number'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
- $filedataoffset += 4;
- $info['ogg']['skeleton']['fisbone']['raw']['number_header_packets'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
- $filedataoffset += 4;
- $info['ogg']['skeleton']['fisbone']['raw']['granulerate_numerator'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8));
- $filedataoffset += 8;
- $info['ogg']['skeleton']['fisbone']['raw']['granulerate_denominator'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8));
- $filedataoffset += 8;
- $info['ogg']['skeleton']['fisbone']['raw']['basegranule'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8));
- $filedataoffset += 8;
- $info['ogg']['skeleton']['fisbone']['raw']['preroll'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
- $filedataoffset += 4;
- $info['ogg']['skeleton']['fisbone']['raw']['granuleshift'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1));
- $filedataoffset += 1;
- $info['ogg']['skeleton']['fisbone']['raw']['padding'] = substr($filedata, $filedataoffset, 3);
- $filedataoffset += 3;
-
- } elseif (substr($filedata, 1, 6) == 'theora') {
-
- $info['video']['dataformat'] = 'theora';
-$info['error'][] = 'Ogg Theora not correctly handled in this version of getID3 ['.$this->getid3->version().']';
-//break;
-
- } elseif (substr($filedata, 1, 6) == 'vorbis') {
-
- $this->ParseVorbisPageHeader($filedata, $filedataoffset, $oggpageinfo);
-
- } else {
-$info['error'][] = 'unexpected';
-//break;
- }
- //} while ($oggpageinfo['page_seqno'] == 0);
- } while (($oggpageinfo['page_seqno'] == 0) && (substr($filedata, 0, 8) != "fisbone\x00"));
- fseek($this->getid3->fp, $oggpageinfo['page_start_offset'], SEEK_SET);
-
-
-$info['error'][] = 'Ogg Skeleton not correctly handled in this version of getID3 ['.$this->getid3->version().']';
-//return false;
-
-
- } else {
-
- $info['error'][] = 'Expecting either "Speex " or "vorbis" identifier strings, found "'.substr($filedata, 0, 8).'"';
- unset($info['ogg']);
- unset($info['mime_type']);
- return false;
-
- }
-
- // Page 2 - Comment Header
- $oggpageinfo = $this->ParseOggPageHeader();
- $info['ogg']['pageheader'][$oggpageinfo['page_seqno']] = $oggpageinfo;
-
- switch ($info['audio']['dataformat']) {
- case 'vorbis':
- $filedata = fread($this->getid3->fp, $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_length']);
- $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['packet_type'] = getid3_lib::LittleEndian2Int(substr($filedata, 0, 1));
- $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['stream_type'] = substr($filedata, 1, 6); // hard-coded to 'vorbis'
-
- $this->ParseVorbisCommentsFilepointer();
- break;
-
- case 'flac':
- $getid3_flac = new getid3_flac($this->getid3);
- if (!$getid3_flac->FLACparseMETAdata()) {
- $info['error'][] = 'Failed to parse FLAC headers';
- return false;
- }
- unset($getid3_flac);
- break;
-
- case 'speex':
- fseek($this->getid3->fp, $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_length'], SEEK_CUR);
- $this->ParseVorbisCommentsFilepointer();
- break;
-
- }
-
-
-
- // Last Page - Number of Samples
-
- if (!getid3_lib::intValueSupported($info['avdataend'])) {
-
- $info['warning'][] = 'Unable to parse Ogg end chunk file (PHP does not support file operations beyond '.round(PHP_INT_MAX / 1073741824).'GB)';
-
- } else {
-
- fseek($this->getid3->fp, max($info['avdataend'] - $this->getid3->fread_buffer_size(), 0), SEEK_SET);
- $LastChunkOfOgg = strrev(fread($this->getid3->fp, $this->getid3->fread_buffer_size()));
- if ($LastOggSpostion = strpos($LastChunkOfOgg, 'SggO')) {
- fseek($this->getid3->fp, $info['avdataend'] - ($LastOggSpostion + strlen('SggO')), SEEK_SET);
- $info['avdataend'] = ftell($this->getid3->fp);
- $info['ogg']['pageheader']['eos'] = $this->ParseOggPageHeader();
- $info['ogg']['samples'] = $info['ogg']['pageheader']['eos']['pcm_abs_position'];
- if ($info['ogg']['samples'] == 0) {
- $info['error'][] = 'Corrupt Ogg file: eos.number of samples == zero';
- return false;
- }
- if (!empty($info['audio']['sample_rate'])) {
- $info['ogg']['bitrate_average'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / ($info['ogg']['samples'] / $info['audio']['sample_rate']);
- }
- }
-
- }
-
- if (!empty($info['ogg']['bitrate_average'])) {
- $info['audio']['bitrate'] = $info['ogg']['bitrate_average'];
- } elseif (!empty($info['ogg']['bitrate_nominal'])) {
- $info['audio']['bitrate'] = $info['ogg']['bitrate_nominal'];
- } elseif (!empty($info['ogg']['bitrate_min']) && !empty($info['ogg']['bitrate_max'])) {
- $info['audio']['bitrate'] = ($info['ogg']['bitrate_min'] + $info['ogg']['bitrate_max']) / 2;
- }
- if (isset($info['audio']['bitrate']) && !isset($info['playtime_seconds'])) {
- if ($info['audio']['bitrate'] == 0) {
- $info['error'][] = 'Corrupt Ogg file: bitrate_audio == zero';
- return false;
- }
- $info['playtime_seconds'] = (float) ((($info['avdataend'] - $info['avdataoffset']) * 8) / $info['audio']['bitrate']);
- }
-
- if (isset($info['ogg']['vendor'])) {
- $info['audio']['encoder'] = preg_replace('/^Encoded with /', '', $info['ogg']['vendor']);
-
- // Vorbis only
- if ($info['audio']['dataformat'] == 'vorbis') {
-
- // Vorbis 1.0 starts with Xiph.Org
- if (preg_match('/^Xiph.Org/', $info['audio']['encoder'])) {
-
- if ($info['audio']['bitrate_mode'] == 'abr') {
-
- // Set -b 128 on abr files
- $info['audio']['encoder_options'] = '-b '.round($info['ogg']['bitrate_nominal'] / 1000);
-
- } elseif (($info['audio']['bitrate_mode'] == 'vbr') && ($info['audio']['channels'] == 2) && ($info['audio']['sample_rate'] >= 44100) && ($info['audio']['sample_rate'] <= 48000)) {
- // Set -q N on vbr files
- $info['audio']['encoder_options'] = '-q '.$this->get_quality_from_nominal_bitrate($info['ogg']['bitrate_nominal']);
-
- }
- }
-
- if (empty($info['audio']['encoder_options']) && !empty($info['ogg']['bitrate_nominal'])) {
- $info['audio']['encoder_options'] = 'Nominal bitrate: '.intval(round($info['ogg']['bitrate_nominal'] / 1000)).'kbps';
- }
- }
- }
-
- return true;
- }
-
- function ParseVorbisPageHeader(&$filedata, &$filedataoffset, &$oggpageinfo) {
- $info = &$this->getid3->info;
- $info['audio']['dataformat'] = 'vorbis';
- $info['audio']['lossless'] = false;
-
- $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['packet_type'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1));
- $filedataoffset += 1;
- $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['stream_type'] = substr($filedata, $filedataoffset, 6); // hard-coded to 'vorbis'
- $filedataoffset += 6;
- $info['ogg']['bitstreamversion'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
- $filedataoffset += 4;
- $info['ogg']['numberofchannels'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1));
- $filedataoffset += 1;
- $info['audio']['channels'] = $info['ogg']['numberofchannels'];
- $info['ogg']['samplerate'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
- $filedataoffset += 4;
- if ($info['ogg']['samplerate'] == 0) {
- $info['error'][] = 'Corrupt Ogg file: sample rate == zero';
- return false;
- }
- $info['audio']['sample_rate'] = $info['ogg']['samplerate'];
- $info['ogg']['samples'] = 0; // filled in later
- $info['ogg']['bitrate_average'] = 0; // filled in later
- $info['ogg']['bitrate_max'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
- $filedataoffset += 4;
- $info['ogg']['bitrate_nominal'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
- $filedataoffset += 4;
- $info['ogg']['bitrate_min'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
- $filedataoffset += 4;
- $info['ogg']['blocksize_small'] = pow(2, getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)) & 0x0F);
- $info['ogg']['blocksize_large'] = pow(2, (getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)) & 0xF0) >> 4);
- $info['ogg']['stop_bit'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)); // must be 1, marks end of packet
-
- $info['audio']['bitrate_mode'] = 'vbr'; // overridden if actually abr
- if ($info['ogg']['bitrate_max'] == 0xFFFFFFFF) {
- unset($info['ogg']['bitrate_max']);
- $info['audio']['bitrate_mode'] = 'abr';
- }
- if ($info['ogg']['bitrate_nominal'] == 0xFFFFFFFF) {
- unset($info['ogg']['bitrate_nominal']);
- }
- if ($info['ogg']['bitrate_min'] == 0xFFFFFFFF) {
- unset($info['ogg']['bitrate_min']);
- $info['audio']['bitrate_mode'] = 'abr';
- }
- return true;
- }
-
- function ParseOggPageHeader() {
- // http://xiph.org/ogg/vorbis/doc/framing.html
- $oggheader['page_start_offset'] = ftell($this->getid3->fp); // where we started from in the file
-
- $filedata = fread($this->getid3->fp, $this->getid3->fread_buffer_size());
- $filedataoffset = 0;
- while ((substr($filedata, $filedataoffset++, 4) != 'OggS')) {
- if ((ftell($this->getid3->fp) - $oggheader['page_start_offset']) >= $this->getid3->fread_buffer_size()) {
- // should be found before here
- return false;
- }
- if ((($filedataoffset + 28) > strlen($filedata)) || (strlen($filedata) < 28)) {
- if (feof($this->getid3->fp) || (($filedata .= fread($this->getid3->fp, $this->getid3->fread_buffer_size())) === false)) {
- // get some more data, unless eof, in which case fail
- return false;
- }
- }
- }
- $filedataoffset += strlen('OggS') - 1; // page, delimited by 'OggS'
-
- $oggheader['stream_structver'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1));
- $filedataoffset += 1;
- $oggheader['flags_raw'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1));
- $filedataoffset += 1;
- $oggheader['flags']['fresh'] = (bool) ($oggheader['flags_raw'] & 0x01); // fresh packet
- $oggheader['flags']['bos'] = (bool) ($oggheader['flags_raw'] & 0x02); // first page of logical bitstream (bos)
- $oggheader['flags']['eos'] = (bool) ($oggheader['flags_raw'] & 0x04); // last page of logical bitstream (eos)
-
- $oggheader['pcm_abs_position'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8));
- $filedataoffset += 8;
- $oggheader['stream_serialno'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
- $filedataoffset += 4;
- $oggheader['page_seqno'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
- $filedataoffset += 4;
- $oggheader['page_checksum'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
- $filedataoffset += 4;
- $oggheader['page_segments'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1));
- $filedataoffset += 1;
- $oggheader['page_length'] = 0;
- for ($i = 0; $i < $oggheader['page_segments']; $i++) {
- $oggheader['segment_table'][$i] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1));
- $filedataoffset += 1;
- $oggheader['page_length'] += $oggheader['segment_table'][$i];
- }
- $oggheader['header_end_offset'] = $oggheader['page_start_offset'] + $filedataoffset;
- $oggheader['page_end_offset'] = $oggheader['header_end_offset'] + $oggheader['page_length'];
- fseek($this->getid3->fp, $oggheader['header_end_offset'], SEEK_SET);
-
- return $oggheader;
- }
-
-
- function ParseVorbisCommentsFilepointer() {
- $info = &$this->getid3->info;
-
- $OriginalOffset = ftell($this->getid3->fp);
- $commentdataoffset = 0;
- $VorbisCommentPage = 1;
-
- switch ($info['audio']['dataformat']) {
- case 'vorbis':
- $CommentStartOffset = $info['ogg']['pageheader'][$VorbisCommentPage]['page_start_offset']; // Second Ogg page, after header block
- fseek($this->getid3->fp, $CommentStartOffset, SEEK_SET);
- $commentdataoffset = 27 + $info['ogg']['pageheader'][$VorbisCommentPage]['page_segments'];
- $commentdata = fread($this->getid3->fp, getid3_ogg::OggPageSegmentLength($info['ogg']['pageheader'][$VorbisCommentPage], 1) + $commentdataoffset);
-
- $commentdataoffset += (strlen('vorbis') + 1);
- break;
-
- case 'flac':
- $CommentStartOffset = $info['flac']['VORBIS_COMMENT']['raw']['offset'] + 4;
- fseek($this->getid3->fp, $CommentStartOffset, SEEK_SET);
- $commentdata = fread($this->getid3->fp, $info['flac']['VORBIS_COMMENT']['raw']['block_length']);
- break;
-
- case 'speex':
- $CommentStartOffset = $info['ogg']['pageheader'][$VorbisCommentPage]['page_start_offset']; // Second Ogg page, after header block
- fseek($this->getid3->fp, $CommentStartOffset, SEEK_SET);
- $commentdataoffset = 27 + $info['ogg']['pageheader'][$VorbisCommentPage]['page_segments'];
- $commentdata = fread($this->getid3->fp, getid3_ogg::OggPageSegmentLength($info['ogg']['pageheader'][$VorbisCommentPage], 1) + $commentdataoffset);
- break;
-
- default:
- return false;
- break;
- }
-
- $VendorSize = getid3_lib::LittleEndian2Int(substr($commentdata, $commentdataoffset, 4));
- $commentdataoffset += 4;
-
- $info['ogg']['vendor'] = substr($commentdata, $commentdataoffset, $VendorSize);
- $commentdataoffset += $VendorSize;
-
- $CommentsCount = getid3_lib::LittleEndian2Int(substr($commentdata, $commentdataoffset, 4));
- $commentdataoffset += 4;
- $info['avdataoffset'] = $CommentStartOffset + $commentdataoffset;
-
- $basicfields = array('TITLE', 'ARTIST', 'ALBUM', 'TRACKNUMBER', 'GENRE', 'DATE', 'DESCRIPTION', 'COMMENT');
- $ThisFileInfo_ogg_comments_raw = &$info['ogg']['comments_raw'];
- for ($i = 0; $i < $CommentsCount; $i++) {
-
- $ThisFileInfo_ogg_comments_raw[$i]['dataoffset'] = $CommentStartOffset + $commentdataoffset;
-
- if (ftell($this->getid3->fp) < ($ThisFileInfo_ogg_comments_raw[$i]['dataoffset'] + 4)) {
- if ($oggpageinfo = $this->ParseOggPageHeader()) {
- $info['ogg']['pageheader'][$oggpageinfo['page_seqno']] = $oggpageinfo;
-
- $VorbisCommentPage++;
-
- // First, save what we haven't read yet
- $AsYetUnusedData = substr($commentdata, $commentdataoffset);
-
- // Then take that data off the end
- $commentdata = substr($commentdata, 0, $commentdataoffset);
-
- // Add [headerlength] bytes of dummy data for the Ogg Page Header, just to keep absolute offsets correct
- $commentdata .= str_repeat("\x00", 27 + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_segments']);
- $commentdataoffset += (27 + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_segments']);
-
- // Finally, stick the unused data back on the end
- $commentdata .= $AsYetUnusedData;
-
- //$commentdata .= fread($this->getid3->fp, $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_length']);
- $commentdata .= fread($this->getid3->fp, $this->OggPageSegmentLength($info['ogg']['pageheader'][$VorbisCommentPage], 1));
- }
-
- }
- $ThisFileInfo_ogg_comments_raw[$i]['size'] = getid3_lib::LittleEndian2Int(substr($commentdata, $commentdataoffset, 4));
-
- // replace avdataoffset with position just after the last vorbiscomment
- $info['avdataoffset'] = $ThisFileInfo_ogg_comments_raw[$i]['dataoffset'] + $ThisFileInfo_ogg_comments_raw[$i]['size'] + 4;
-
- $commentdataoffset += 4;
- while ((strlen($commentdata) - $commentdataoffset) < $ThisFileInfo_ogg_comments_raw[$i]['size']) {
- if (($ThisFileInfo_ogg_comments_raw[$i]['size'] > $info['avdataend']) || ($ThisFileInfo_ogg_comments_raw[$i]['size'] < 0)) {
- $info['warning'][] = 'Invalid Ogg comment size (comment #'.$i.', claims to be '.number_format($ThisFileInfo_ogg_comments_raw[$i]['size']).' bytes) - aborting reading comments';
- break 2;
- }
-
- $VorbisCommentPage++;
-
- $oggpageinfo = $this->ParseOggPageHeader();
- $info['ogg']['pageheader'][$oggpageinfo['page_seqno']] = $oggpageinfo;
-
- // First, save what we haven't read yet
- $AsYetUnusedData = substr($commentdata, $commentdataoffset);
-
- // Then take that data off the end
- $commentdata = substr($commentdata, 0, $commentdataoffset);
-
- // Add [headerlength] bytes of dummy data for the Ogg Page Header, just to keep absolute offsets correct
- $commentdata .= str_repeat("\x00", 27 + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_segments']);
- $commentdataoffset += (27 + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_segments']);
-
- // Finally, stick the unused data back on the end
- $commentdata .= $AsYetUnusedData;
-
- //$commentdata .= fread($this->getid3->fp, $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_length']);
- if (!isset($info['ogg']['pageheader'][$VorbisCommentPage])) {
- $info['warning'][] = 'undefined Vorbis Comment page "'.$VorbisCommentPage.'" at offset '.ftell($this->getid3->fp);
- break;
- }
- $readlength = getid3_ogg::OggPageSegmentLength($info['ogg']['pageheader'][$VorbisCommentPage], 1);
- if ($readlength <= 0) {
- $info['warning'][] = 'invalid length Vorbis Comment page "'.$VorbisCommentPage.'" at offset '.ftell($this->getid3->fp);
- break;
- }
- $commentdata .= fread($this->getid3->fp, $readlength);
-
- //$filebaseoffset += $oggpageinfo['header_end_offset'] - $oggpageinfo['page_start_offset'];
- }
- $ThisFileInfo_ogg_comments_raw[$i]['offset'] = $commentdataoffset;
- $commentstring = substr($commentdata, $commentdataoffset, $ThisFileInfo_ogg_comments_raw[$i]['size']);
- $commentdataoffset += $ThisFileInfo_ogg_comments_raw[$i]['size'];
-
- if (!$commentstring) {
-
- // no comment?
- $info['warning'][] = 'Blank Ogg comment ['.$i.']';
-
- } elseif (strstr($commentstring, '=')) {
-
- $commentexploded = explode('=', $commentstring, 2);
- $ThisFileInfo_ogg_comments_raw[$i]['key'] = strtoupper($commentexploded[0]);
- $ThisFileInfo_ogg_comments_raw[$i]['value'] = (isset($commentexploded[1]) ? $commentexploded[1] : '');
- $ThisFileInfo_ogg_comments_raw[$i]['data'] = base64_decode($ThisFileInfo_ogg_comments_raw[$i]['value']);
- $ThisFileInfo_ogg_comments_raw[$i]['data_length'] = strlen($ThisFileInfo_ogg_comments_raw[$i]['data']);
-
- if (preg_match('#^(BM|GIF|\xFF\xD8\xFF|\x89\x50\x4E\x47\x0D\x0A\x1A\x0A|II\x2A\x00|MM\x00\x2A)#s', $ThisFileInfo_ogg_comments_raw[$i]['data'])) {
- $imageinfo = array();
- $imagechunkcheck = getid3_lib::GetDataImageSize($ThisFileInfo_ogg_comments_raw[$i]['data'], $imageinfo);
- unset($imageinfo);
- if (!empty($imagechunkcheck)) {
- $ThisFileInfo_ogg_comments_raw[$i]['image_mime'] = image_type_to_mime_type($imagechunkcheck[2]);
- if ($ThisFileInfo_ogg_comments_raw[$i]['image_mime'] && ($ThisFileInfo_ogg_comments_raw[$i]['image_mime'] != 'application/octet-stream')) {
- unset($ThisFileInfo_ogg_comments_raw[$i]['value']);
- }
- }
- }
-
- if (isset($ThisFileInfo_ogg_comments_raw[$i]['value'])) {
- unset($ThisFileInfo_ogg_comments_raw[$i]['data']);
- $info['ogg']['comments'][strtolower($ThisFileInfo_ogg_comments_raw[$i]['key'])][] = $ThisFileInfo_ogg_comments_raw[$i]['value'];
- } else {
- do {
- if ($this->inline_attachments === false) {
- // skip entirely
- unset($ThisFileInfo_ogg_comments_raw[$i]['data']);
- break;
- }
- if ($this->inline_attachments === true) {
- // great
- } elseif (is_int($this->inline_attachments)) {
- if ($this->inline_attachments < $ThisFileInfo_ogg_comments_raw[$i]['data_length']) {
- // too big, skip
- $info['warning'][] = 'attachment at '.$ThisFileInfo_ogg_comments_raw[$i]['offset'].' is too large to process inline ('.number_format($ThisFileInfo_ogg_comments_raw[$i]['data_length']).' bytes)';
- unset($ThisFileInfo_ogg_comments_raw[$i]['data']);
- break;
- }
- } elseif (is_string($this->inline_attachments)) {
- $this->inline_attachments = rtrim(str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $this->inline_attachments), DIRECTORY_SEPARATOR);
- if (!is_dir($this->inline_attachments) || !is_writable($this->inline_attachments)) {
- // cannot write, skip
- $info['warning'][] = 'attachment at '.$ThisFileInfo_ogg_comments_raw[$i]['offset'].' cannot be saved to "'.$this->inline_attachments.'" (not writable)';
- unset($ThisFileInfo_ogg_comments_raw[$i]['data']);
- break;
- }
- }
- // if we get this far, must be OK
- if (is_string($this->inline_attachments)) {
- $destination_filename = $this->inline_attachments.DIRECTORY_SEPARATOR.md5($info['filenamepath']).'_'.$ThisFileInfo_ogg_comments_raw[$i]['offset'];
- if (!file_exists($destination_filename) || is_writable($destination_filename)) {
- file_put_contents($destination_filename, $ThisFileInfo_ogg_comments_raw[$i]['data']);
- } else {
- $info['warning'][] = 'attachment at '.$ThisFileInfo_ogg_comments_raw[$i]['offset'].' cannot be saved to "'.$destination_filename.'" (not writable)';
- }
- $ThisFileInfo_ogg_comments_raw[$i]['data_filename'] = $destination_filename;
- unset($ThisFileInfo_ogg_comments_raw[$i]['data']);
- } else {
- $info['ogg']['comments']['picture'][] = array('data'=>$ThisFileInfo_ogg_comments_raw[$i]['data'], 'image_mime'=>$ThisFileInfo_ogg_comments_raw[$i]['image_mime']);
- }
- } while (false);
-
- }
-
-
- } else {
-
- $info['warning'][] = '[known problem with CDex >= v1.40, < v1.50b7] Invalid Ogg comment name/value pair ['.$i.']: '.$commentstring;
-
- }
- }
-
-
- // Replay Gain Adjustment
- // http://privatewww.essex.ac.uk/~djmrob/replaygain/
- if (isset($info['ogg']['comments']) && is_array($info['ogg']['comments'])) {
- foreach ($info['ogg']['comments'] as $index => $commentvalue) {
- switch ($index) {
- case 'rg_audiophile':
- case 'replaygain_album_gain':
- $info['replay_gain']['album']['adjustment'] = (double) $commentvalue[0];
- unset($info['ogg']['comments'][$index]);
- break;
-
- case 'rg_radio':
- case 'replaygain_track_gain':
- $info['replay_gain']['track']['adjustment'] = (double) $commentvalue[0];
- unset($info['ogg']['comments'][$index]);
- break;
-
- case 'replaygain_album_peak':
- $info['replay_gain']['album']['peak'] = (double) $commentvalue[0];
- unset($info['ogg']['comments'][$index]);
- break;
-
- case 'rg_peak':
- case 'replaygain_track_peak':
- $info['replay_gain']['track']['peak'] = (double) $commentvalue[0];
- unset($info['ogg']['comments'][$index]);
- break;
-
- case 'replaygain_reference_loudness':
- $info['replay_gain']['reference_volume'] = (double) $commentvalue[0];
- unset($info['ogg']['comments'][$index]);
- break;
-
- default:
- // do nothing
- break;
- }
- }
- }
-
- fseek($this->getid3->fp, $OriginalOffset, SEEK_SET);
-
- return true;
- }
-
- static function SpeexBandModeLookup($mode) {
- static $SpeexBandModeLookup = array();
- if (empty($SpeexBandModeLookup)) {
- $SpeexBandModeLookup[0] = 'narrow';
- $SpeexBandModeLookup[1] = 'wide';
- $SpeexBandModeLookup[2] = 'ultra-wide';
- }
- return (isset($SpeexBandModeLookup[$mode]) ? $SpeexBandModeLookup[$mode] : null);
- }
-
-
- static function OggPageSegmentLength($OggInfoArray, $SegmentNumber=1) {
- for ($i = 0; $i < $SegmentNumber; $i++) {
- $segmentlength = 0;
- foreach ($OggInfoArray['segment_table'] as $key => $value) {
- $segmentlength += $value;
- if ($value < 255) {
- break;
- }
- }
- }
- return $segmentlength;
- }
-
-
- static function get_quality_from_nominal_bitrate($nominal_bitrate) {
-
- // decrease precision
- $nominal_bitrate = $nominal_bitrate / 1000;
-
- if ($nominal_bitrate < 128) {
- // q-1 to q4
- $qval = ($nominal_bitrate - 64) / 16;
- } elseif ($nominal_bitrate < 256) {
- // q4 to q8
- $qval = $nominal_bitrate / 32;
- } elseif ($nominal_bitrate < 320) {
- // q8 to q9
- $qval = ($nominal_bitrate + 256) / 64;
- } else {
- // q9 to q10
- $qval = ($nominal_bitrate + 1300) / 180;
- }
- //return $qval; // 5.031324
- //return intval($qval); // 5
- return round($qval, 1); // 5 or 4.9
- }
-
-}
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.audio.optimfrog.php b/3rdparty/getid3/module.audio.optimfrog.php
deleted file mode 100644
index c1c89638376..00000000000
--- a/3rdparty/getid3/module.audio.optimfrog.php
+++ /dev/null
@@ -1,429 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.audio.optimfrog.php //
-// module for analyzing OptimFROG audio files //
-// dependencies: module.audio.riff.php //
-// ///
-/////////////////////////////////////////////////////////////////
-
-getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, true);
-
-class getid3_optimfrog extends getid3_handler
-{
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- $info['fileformat'] = 'ofr';
- $info['audio']['dataformat'] = 'ofr';
- $info['audio']['bitrate_mode'] = 'vbr';
- $info['audio']['lossless'] = true;
-
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
- $OFRheader = fread($this->getid3->fp, 8);
- if (substr($OFRheader, 0, 5) == '*RIFF') {
-
- return $this->ParseOptimFROGheader42();
-
- } elseif (substr($OFRheader, 0, 3) == 'OFR') {
-
- return $this->ParseOptimFROGheader45();
-
- }
-
- $info['error'][] = 'Expecting "*RIFF" or "OFR " at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($OFRheader).'"';
- unset($info['fileformat']);
- return false;
- }
-
-
- function ParseOptimFROGheader42() {
- // for fileformat of v4.21 and older
-
- $info = &$this->getid3->info;
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
- $OptimFROGheaderData = fread($this->getid3->fp, 45);
- $info['avdataoffset'] = 45;
-
- $OptimFROGencoderVersion_raw = getid3_lib::LittleEndian2Int(substr($OptimFROGheaderData, 0, 1));
- $OptimFROGencoderVersion_major = floor($OptimFROGencoderVersion_raw / 10);
- $OptimFROGencoderVersion_minor = $OptimFROGencoderVersion_raw - ($OptimFROGencoderVersion_major * 10);
- $RIFFdata = substr($OptimFROGheaderData, 1, 44);
- $OrignalRIFFheaderSize = getid3_lib::LittleEndian2Int(substr($RIFFdata, 4, 4)) + 8;
- $OrignalRIFFdataSize = getid3_lib::LittleEndian2Int(substr($RIFFdata, 40, 4)) + 44;
-
- if ($OrignalRIFFheaderSize > $OrignalRIFFdataSize) {
- $info['avdataend'] -= ($OrignalRIFFheaderSize - $OrignalRIFFdataSize);
- fseek($this->getid3->fp, $info['avdataend'], SEEK_SET);
- $RIFFdata .= fread($this->getid3->fp, $OrignalRIFFheaderSize - $OrignalRIFFdataSize);
- }
-
- // move the data chunk after all other chunks (if any)
- // so that the RIFF parser doesn't see EOF when trying
- // to skip over the data chunk
- $RIFFdata = substr($RIFFdata, 0, 36).substr($RIFFdata, 44).substr($RIFFdata, 36, 8);
-
- $getid3_temp = new getID3();
- $getid3_temp->openfile($this->getid3->filename);
- $getid3_temp->info['avdataoffset'] = $info['avdataoffset'];
- $getid3_temp->info['avdataend'] = $info['avdataend'];
- $getid3_riff = new getid3_riff($getid3_temp);
- $getid3_riff->ParseRIFFdata($RIFFdata);
- $info['riff'] = $getid3_temp->info['riff'];
-
- $info['audio']['encoder'] = 'OptimFROG '.$OptimFROGencoderVersion_major.'.'.$OptimFROGencoderVersion_minor;
- $info['audio']['channels'] = $info['riff']['audio'][0]['channels'];
- $info['audio']['sample_rate'] = $info['riff']['audio'][0]['sample_rate'];
- $info['audio']['bits_per_sample'] = $info['riff']['audio'][0]['bits_per_sample'];
- $info['playtime_seconds'] = $OrignalRIFFdataSize / ($info['audio']['channels'] * $info['audio']['sample_rate'] * ($info['audio']['bits_per_sample'] / 8));
- $info['audio']['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds'];
-
- unset($getid3_riff, $getid3_temp, $RIFFdata);
-
- return true;
- }
-
-
- function ParseOptimFROGheader45() {
- // for fileformat of v4.50a and higher
-
- $info = &$this->getid3->info;
- $RIFFdata = '';
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
- while (!feof($this->getid3->fp) && (ftell($this->getid3->fp) < $info['avdataend'])) {
- $BlockOffset = ftell($this->getid3->fp);
- $BlockData = fread($this->getid3->fp, 8);
- $offset = 8;
- $BlockName = substr($BlockData, 0, 4);
- $BlockSize = getid3_lib::LittleEndian2Int(substr($BlockData, 4, 4));
-
- if ($BlockName == 'OFRX') {
- $BlockName = 'OFR ';
- }
- if (!isset($info['ofr'][$BlockName])) {
- $info['ofr'][$BlockName] = array();
- }
- $thisfile_ofr_thisblock = &$info['ofr'][$BlockName];
-
- switch ($BlockName) {
- case 'OFR ':
-
- // shortcut
- $thisfile_ofr_thisblock['offset'] = $BlockOffset;
- $thisfile_ofr_thisblock['size'] = $BlockSize;
-
- $info['audio']['encoder'] = 'OptimFROG 4.50 alpha';
- switch ($BlockSize) {
- case 12:
- case 15:
- // good
- break;
-
- default:
- $info['warning'][] = '"'.$BlockName.'" contains more data than expected (expected 12 or 15 bytes, found '.$BlockSize.' bytes)';
- break;
- }
- $BlockData .= fread($this->getid3->fp, $BlockSize);
-
- $thisfile_ofr_thisblock['total_samples'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 6));
- $offset += 6;
- $thisfile_ofr_thisblock['raw']['sample_type'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 1));
- $thisfile_ofr_thisblock['sample_type'] = $this->OptimFROGsampleTypeLookup($thisfile_ofr_thisblock['raw']['sample_type']);
- $offset += 1;
- $thisfile_ofr_thisblock['channel_config'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 1));
- $thisfile_ofr_thisblock['channels'] = $thisfile_ofr_thisblock['channel_config'];
- $offset += 1;
- $thisfile_ofr_thisblock['sample_rate'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 4));
- $offset += 4;
-
- if ($BlockSize > 12) {
-
- // OFR 4.504b or higher
- $thisfile_ofr_thisblock['channels'] = $this->OptimFROGchannelConfigNumChannelsLookup($thisfile_ofr_thisblock['channel_config']);
- $thisfile_ofr_thisblock['raw']['encoder_id'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 2));
- $thisfile_ofr_thisblock['encoder'] = $this->OptimFROGencoderNameLookup($thisfile_ofr_thisblock['raw']['encoder_id']);
- $offset += 2;
- $thisfile_ofr_thisblock['raw']['compression'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 1));
- $thisfile_ofr_thisblock['compression'] = $this->OptimFROGcompressionLookup($thisfile_ofr_thisblock['raw']['compression']);
- $thisfile_ofr_thisblock['speedup'] = $this->OptimFROGspeedupLookup($thisfile_ofr_thisblock['raw']['compression']);
- $offset += 1;
-
- $info['audio']['encoder'] = 'OptimFROG '.$thisfile_ofr_thisblock['encoder'];
- $info['audio']['encoder_options'] = '--mode '.$thisfile_ofr_thisblock['compression'];
-
- if ((($thisfile_ofr_thisblock['raw']['encoder_id'] & 0xF0) >> 4) == 7) { // v4.507
- if (strtolower(getid3_lib::fileextension($info['filename'])) == 'ofs') {
- // OptimFROG DualStream format is lossy, but as of v4.507 there is no way to tell the difference
- // between lossless and lossy other than the file extension.
- $info['audio']['dataformat'] = 'ofs';
- $info['audio']['lossless'] = true;
- }
- }
-
- }
-
- $info['audio']['channels'] = $thisfile_ofr_thisblock['channels'];
- $info['audio']['sample_rate'] = $thisfile_ofr_thisblock['sample_rate'];
- $info['audio']['bits_per_sample'] = $this->OptimFROGbitsPerSampleTypeLookup($thisfile_ofr_thisblock['raw']['sample_type']);
- break;
-
-
- case 'COMP':
- // unlike other block types, there CAN be multiple COMP blocks
-
- $COMPdata['offset'] = $BlockOffset;
- $COMPdata['size'] = $BlockSize;
-
- if ($info['avdataoffset'] == 0) {
- $info['avdataoffset'] = $BlockOffset;
- }
-
- // Only interested in first 14 bytes (only first 12 needed for v4.50 alpha), not actual audio data
- $BlockData .= fread($this->getid3->fp, 14);
- fseek($this->getid3->fp, $BlockSize - 14, SEEK_CUR);
-
- $COMPdata['crc_32'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 4));
- $offset += 4;
- $COMPdata['sample_count'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 4));
- $offset += 4;
- $COMPdata['raw']['sample_type'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 1));
- $COMPdata['sample_type'] = $this->OptimFROGsampleTypeLookup($COMPdata['raw']['sample_type']);
- $offset += 1;
- $COMPdata['raw']['channel_configuration'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 1));
- $COMPdata['channel_configuration'] = $this->OptimFROGchannelConfigurationLookup($COMPdata['raw']['channel_configuration']);
- $offset += 1;
- $COMPdata['raw']['algorithm_id'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 2));
- //$COMPdata['algorithm'] = OptimFROGalgorithmNameLookup($COMPdata['raw']['algorithm_id']);
- $offset += 2;
-
- if ($info['ofr']['OFR ']['size'] > 12) {
-
- // OFR 4.504b or higher
- $COMPdata['raw']['encoder_id'] = getid3_lib::LittleEndian2Int(substr($BlockData, $offset, 2));
- $COMPdata['encoder'] = $this->OptimFROGencoderNameLookup($COMPdata['raw']['encoder_id']);
- $offset += 2;
-
- }
-
- if ($COMPdata['crc_32'] == 0x454E4F4E) {
- // ASCII value of 'NONE' - placeholder value in v4.50a
- $COMPdata['crc_32'] = false;
- }
-
- $thisfile_ofr_thisblock[] = $COMPdata;
- break;
-
- case 'HEAD':
- $thisfile_ofr_thisblock['offset'] = $BlockOffset;
- $thisfile_ofr_thisblock['size'] = $BlockSize;
-
- $RIFFdata .= fread($this->getid3->fp, $BlockSize);
- break;
-
- case 'TAIL':
- $thisfile_ofr_thisblock['offset'] = $BlockOffset;
- $thisfile_ofr_thisblock['size'] = $BlockSize;
-
- if ($BlockSize > 0) {
- $RIFFdata .= fread($this->getid3->fp, $BlockSize);
- }
- break;
-
- case 'RECV':
- // block contains no useful meta data - simply note and skip
-
- $thisfile_ofr_thisblock['offset'] = $BlockOffset;
- $thisfile_ofr_thisblock['size'] = $BlockSize;
-
- fseek($this->getid3->fp, $BlockSize, SEEK_CUR);
- break;
-
-
- case 'APET':
- // APEtag v2
-
- $thisfile_ofr_thisblock['offset'] = $BlockOffset;
- $thisfile_ofr_thisblock['size'] = $BlockSize;
- $info['warning'][] = 'APEtag processing inside OptimFROG not supported in this version ('.$this->getid3->version().') of getID3()';
-
- fseek($this->getid3->fp, $BlockSize, SEEK_CUR);
- break;
-
-
- case 'MD5 ':
- // APEtag v2
-
- $thisfile_ofr_thisblock['offset'] = $BlockOffset;
- $thisfile_ofr_thisblock['size'] = $BlockSize;
-
- if ($BlockSize == 16) {
-
- $thisfile_ofr_thisblock['md5_binary'] = fread($this->getid3->fp, $BlockSize);
- $thisfile_ofr_thisblock['md5_string'] = getid3_lib::PrintHexBytes($thisfile_ofr_thisblock['md5_binary'], true, false, false);
- $info['md5_data_source'] = $thisfile_ofr_thisblock['md5_string'];
-
- } else {
-
- $info['warning'][] = 'Expecting block size of 16 in "MD5 " chunk, found '.$BlockSize.' instead';
- fseek($this->getid3->fp, $BlockSize, SEEK_CUR);
-
- }
- break;
-
-
- default:
- $thisfile_ofr_thisblock['offset'] = $BlockOffset;
- $thisfile_ofr_thisblock['size'] = $BlockSize;
-
- $info['warning'][] = 'Unhandled OptimFROG block type "'.$BlockName.'" at offset '.$thisfile_ofr_thisblock['offset'];
- fseek($this->getid3->fp, $BlockSize, SEEK_CUR);
- break;
- }
- }
- if (isset($info['ofr']['TAIL']['offset'])) {
- $info['avdataend'] = $info['ofr']['TAIL']['offset'];
- }
-
- $info['playtime_seconds'] = (float) $info['ofr']['OFR ']['total_samples'] / ($info['audio']['channels'] * $info['audio']['sample_rate']);
- $info['audio']['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds'];
-
- // move the data chunk after all other chunks (if any)
- // so that the RIFF parser doesn't see EOF when trying
- // to skip over the data chunk
- $RIFFdata = substr($RIFFdata, 0, 36).substr($RIFFdata, 44).substr($RIFFdata, 36, 8);
-
- $getid3_temp = new getID3();
- $getid3_temp->openfile($this->getid3->filename);
- $getid3_temp->info['avdataoffset'] = $info['avdataoffset'];
- $getid3_temp->info['avdataend'] = $info['avdataend'];
- $getid3_riff = new getid3_riff($getid3_temp);
- $getid3_riff->ParseRIFFdata($RIFFdata);
- $info['riff'] = $getid3_temp->info['riff'];
-
- unset($getid3_riff, $getid3_temp, $RIFFdata);
-
- return true;
- }
-
-
- static function OptimFROGsampleTypeLookup($SampleType) {
- static $OptimFROGsampleTypeLookup = array(
- 0 => 'unsigned int (8-bit)',
- 1 => 'signed int (8-bit)',
- 2 => 'unsigned int (16-bit)',
- 3 => 'signed int (16-bit)',
- 4 => 'unsigned int (24-bit)',
- 5 => 'signed int (24-bit)',
- 6 => 'unsigned int (32-bit)',
- 7 => 'signed int (32-bit)',
- 8 => 'float 0.24 (32-bit)',
- 9 => 'float 16.8 (32-bit)',
- 10 => 'float 24.0 (32-bit)'
- );
- return (isset($OptimFROGsampleTypeLookup[$SampleType]) ? $OptimFROGsampleTypeLookup[$SampleType] : false);
- }
-
- static function OptimFROGbitsPerSampleTypeLookup($SampleType) {
- static $OptimFROGbitsPerSampleTypeLookup = array(
- 0 => 8,
- 1 => 8,
- 2 => 16,
- 3 => 16,
- 4 => 24,
- 5 => 24,
- 6 => 32,
- 7 => 32,
- 8 => 32,
- 9 => 32,
- 10 => 32
- );
- return (isset($OptimFROGbitsPerSampleTypeLookup[$SampleType]) ? $OptimFROGbitsPerSampleTypeLookup[$SampleType] : false);
- }
-
- static function OptimFROGchannelConfigurationLookup($ChannelConfiguration) {
- static $OptimFROGchannelConfigurationLookup = array(
- 0 => 'mono',
- 1 => 'stereo'
- );
- return (isset($OptimFROGchannelConfigurationLookup[$ChannelConfiguration]) ? $OptimFROGchannelConfigurationLookup[$ChannelConfiguration] : false);
- }
-
- static function OptimFROGchannelConfigNumChannelsLookup($ChannelConfiguration) {
- static $OptimFROGchannelConfigNumChannelsLookup = array(
- 0 => 1,
- 1 => 2
- );
- return (isset($OptimFROGchannelConfigNumChannelsLookup[$ChannelConfiguration]) ? $OptimFROGchannelConfigNumChannelsLookup[$ChannelConfiguration] : false);
- }
-
-
-
- // static function OptimFROGalgorithmNameLookup($AlgorithID) {
- // static $OptimFROGalgorithmNameLookup = array();
- // return (isset($OptimFROGalgorithmNameLookup[$AlgorithID]) ? $OptimFROGalgorithmNameLookup[$AlgorithID] : false);
- // }
-
-
- static function OptimFROGencoderNameLookup($EncoderID) {
- // version = (encoderID >> 4) + 4500
- // system = encoderID & 0xF
-
- $EncoderVersion = number_format(((($EncoderID & 0xF0) >> 4) + 4500) / 1000, 3);
- $EncoderSystemID = ($EncoderID & 0x0F);
-
- static $OptimFROGencoderSystemLookup = array(
- 0x00 => 'Windows console',
- 0x01 => 'Linux console',
- 0x0F => 'unknown'
- );
- return $EncoderVersion.' ('.(isset($OptimFROGencoderSystemLookup[$EncoderSystemID]) ? $OptimFROGencoderSystemLookup[$EncoderSystemID] : 'undefined encoder type (0x'.dechex($EncoderSystemID).')').')';
- }
-
- static function OptimFROGcompressionLookup($CompressionID) {
- // mode = compression >> 3
- // speedup = compression & 0x07
-
- $CompressionModeID = ($CompressionID & 0xF8) >> 3;
- //$CompressionSpeedupID = ($CompressionID & 0x07);
-
- static $OptimFROGencoderModeLookup = array(
- 0x00 => 'fast',
- 0x01 => 'normal',
- 0x02 => 'high',
- 0x03 => 'extra', // extranew (some versions)
- 0x04 => 'best', // bestnew (some versions)
- 0x05 => 'ultra',
- 0x06 => 'insane',
- 0x07 => 'highnew',
- 0x08 => 'extranew',
- 0x09 => 'bestnew'
- );
- return (isset($OptimFROGencoderModeLookup[$CompressionModeID]) ? $OptimFROGencoderModeLookup[$CompressionModeID] : 'undefined mode (0x'.str_pad(dechex($CompressionModeID), 2, '0', STR_PAD_LEFT).')');
- }
-
- static function OptimFROGspeedupLookup($CompressionID) {
- // mode = compression >> 3
- // speedup = compression & 0x07
-
- //$CompressionModeID = ($CompressionID & 0xF8) >> 3;
- $CompressionSpeedupID = ($CompressionID & 0x07);
-
- static $OptimFROGencoderSpeedupLookup = array(
- 0x00 => '1x',
- 0x01 => '2x',
- 0x02 => '4x'
- );
- return (isset($OptimFROGencoderSpeedupLookup[$CompressionSpeedupID]) ? $OptimFROGencoderSpeedupLookup[$CompressionSpeedupID] : 'undefined mode (0x'.dechex($CompressionSpeedupID));
- }
-
-}
-
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.audio.rkau.php b/3rdparty/getid3/module.audio.rkau.php
deleted file mode 100644
index c442076275d..00000000000
--- a/3rdparty/getid3/module.audio.rkau.php
+++ /dev/null
@@ -1,94 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.audio.shorten.php //
-// module for analyzing Shorten Audio files //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_rkau extends getid3_handler
-{
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
- $RKAUHeader = fread($this->getid3->fp, 20);
- $magic = 'RKA';
- if (substr($RKAUHeader, 0, 3) != $magic) {
- $info['error'][] = 'Expecting "'.getid3_lib::PrintHexBytes($magic).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes(substr($RKAUHeader, 0, 3)).'"';
- return false;
- }
-
- $info['fileformat'] = 'rkau';
- $info['audio']['dataformat'] = 'rkau';
- $info['audio']['bitrate_mode'] = 'vbr';
-
- $info['rkau']['raw']['version'] = getid3_lib::LittleEndian2Int(substr($RKAUHeader, 3, 1));
- $info['rkau']['version'] = '1.'.str_pad($info['rkau']['raw']['version'] & 0x0F, 2, '0', STR_PAD_LEFT);
- if (($info['rkau']['version'] > 1.07) || ($info['rkau']['version'] < 1.06)) {
- $info['error'][] = 'This version of getID3() ['.$this->getid3->version().'] can only parse RKAU files v1.06 and 1.07 (this file is v'.$info['rkau']['version'].')';
- unset($info['rkau']);
- return false;
- }
-
- $info['rkau']['source_bytes'] = getid3_lib::LittleEndian2Int(substr($RKAUHeader, 4, 4));
- $info['rkau']['sample_rate'] = getid3_lib::LittleEndian2Int(substr($RKAUHeader, 8, 4));
- $info['rkau']['channels'] = getid3_lib::LittleEndian2Int(substr($RKAUHeader, 12, 1));
- $info['rkau']['bits_per_sample'] = getid3_lib::LittleEndian2Int(substr($RKAUHeader, 13, 1));
-
- $info['rkau']['raw']['quality'] = getid3_lib::LittleEndian2Int(substr($RKAUHeader, 14, 1));
- $this->RKAUqualityLookup($info['rkau']);
-
- $info['rkau']['raw']['flags'] = getid3_lib::LittleEndian2Int(substr($RKAUHeader, 15, 1));
- $info['rkau']['flags']['joint_stereo'] = (bool) (!($info['rkau']['raw']['flags'] & 0x01));
- $info['rkau']['flags']['streaming'] = (bool) ($info['rkau']['raw']['flags'] & 0x02);
- $info['rkau']['flags']['vrq_lossy_mode'] = (bool) ($info['rkau']['raw']['flags'] & 0x04);
-
- if ($info['rkau']['flags']['streaming']) {
- $info['avdataoffset'] += 20;
- $info['rkau']['compressed_bytes'] = getid3_lib::LittleEndian2Int(substr($RKAUHeader, 16, 4));
- } else {
- $info['avdataoffset'] += 16;
- $info['rkau']['compressed_bytes'] = $info['avdataend'] - $info['avdataoffset'] - 1;
- }
- // Note: compressed_bytes does not always equal what appears to be the actual number of compressed bytes,
- // sometimes it's more, sometimes less. No idea why(?)
-
- $info['audio']['lossless'] = $info['rkau']['lossless'];
- $info['audio']['channels'] = $info['rkau']['channels'];
- $info['audio']['bits_per_sample'] = $info['rkau']['bits_per_sample'];
- $info['audio']['sample_rate'] = $info['rkau']['sample_rate'];
-
- $info['playtime_seconds'] = $info['rkau']['source_bytes'] / ($info['rkau']['sample_rate'] * $info['rkau']['channels'] * ($info['rkau']['bits_per_sample'] / 8));
- $info['audio']['bitrate'] = ($info['rkau']['compressed_bytes'] * 8) / $info['playtime_seconds'];
-
- return true;
-
- }
-
-
- function RKAUqualityLookup(&$RKAUdata) {
- $level = ($RKAUdata['raw']['quality'] & 0xF0) >> 4;
- $quality = $RKAUdata['raw']['quality'] & 0x0F;
-
- $RKAUdata['lossless'] = (($quality == 0) ? true : false);
- $RKAUdata['compression_level'] = $level + 1;
- if (!$RKAUdata['lossless']) {
- $RKAUdata['quality_setting'] = $quality;
- }
-
- return true;
- }
-
-}
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.audio.shorten.php b/3rdparty/getid3/module.audio.shorten.php
deleted file mode 100644
index 7b3d312ea28..00000000000
--- a/3rdparty/getid3/module.audio.shorten.php
+++ /dev/null
@@ -1,183 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.audio.shorten.php //
-// module for analyzing Shorten Audio files //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_shorten extends getid3_handler
-{
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
-
- $ShortenHeader = fread($this->getid3->fp, 8);
- $magic = 'ajkg';
- if (substr($ShortenHeader, 0, 4) != $magic) {
- $info['error'][] = 'Expecting "'.getid3_lib::PrintHexBytes($magic).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes(substr($ShortenHeader, 0, 4)).'"';
- return false;
- }
- $info['fileformat'] = 'shn';
- $info['audio']['dataformat'] = 'shn';
- $info['audio']['lossless'] = true;
- $info['audio']['bitrate_mode'] = 'vbr';
-
- $info['shn']['version'] = getid3_lib::LittleEndian2Int(substr($ShortenHeader, 4, 1));
-
- fseek($this->getid3->fp, $info['avdataend'] - 12, SEEK_SET);
- $SeekTableSignatureTest = fread($this->getid3->fp, 12);
- $info['shn']['seektable']['present'] = (bool) (substr($SeekTableSignatureTest, 4, 8) == 'SHNAMPSK');
- if ($info['shn']['seektable']['present']) {
- $info['shn']['seektable']['length'] = getid3_lib::LittleEndian2Int(substr($SeekTableSignatureTest, 0, 4));
- $info['shn']['seektable']['offset'] = $info['avdataend'] - $info['shn']['seektable']['length'];
- fseek($this->getid3->fp, $info['shn']['seektable']['offset'], SEEK_SET);
- $SeekTableMagic = fread($this->getid3->fp, 4);
- $magic = 'SEEK';
- if ($SeekTableMagic != $magic) {
-
- $info['error'][] = 'Expecting "'.getid3_lib::PrintHexBytes($magic).'" at offset '.$info['shn']['seektable']['offset'].', found "'.getid3_lib::PrintHexBytes($SeekTableMagic).'"';
- return false;
-
- } else {
-
- // typedef struct tag_TSeekEntry
- // {
- // unsigned long SampleNumber;
- // unsigned long SHNFileByteOffset;
- // unsigned long SHNLastBufferReadPosition;
- // unsigned short SHNByteGet;
- // unsigned short SHNBufferOffset;
- // unsigned short SHNFileBitOffset;
- // unsigned long SHNGBuffer;
- // unsigned short SHNBitShift;
- // long CBuf0[3];
- // long CBuf1[3];
- // long Offset0[4];
- // long Offset1[4];
- // }TSeekEntry;
-
- $SeekTableData = fread($this->getid3->fp, $info['shn']['seektable']['length'] - 16);
- $info['shn']['seektable']['entry_count'] = floor(strlen($SeekTableData) / 80);
- //$info['shn']['seektable']['entries'] = array();
- //$SeekTableOffset = 0;
- //for ($i = 0; $i < $info['shn']['seektable']['entry_count']; $i++) {
- // $SeekTableEntry['sample_number'] = getid3_lib::LittleEndian2Int(substr($SeekTableData, $SeekTableOffset, 4));
- // $SeekTableOffset += 4;
- // $SeekTableEntry['shn_file_byte_offset'] = getid3_lib::LittleEndian2Int(substr($SeekTableData, $SeekTableOffset, 4));
- // $SeekTableOffset += 4;
- // $SeekTableEntry['shn_last_buffer_read_position'] = getid3_lib::LittleEndian2Int(substr($SeekTableData, $SeekTableOffset, 4));
- // $SeekTableOffset += 4;
- // $SeekTableEntry['shn_byte_get'] = getid3_lib::LittleEndian2Int(substr($SeekTableData, $SeekTableOffset, 2));
- // $SeekTableOffset += 2;
- // $SeekTableEntry['shn_buffer_offset'] = getid3_lib::LittleEndian2Int(substr($SeekTableData, $SeekTableOffset, 2));
- // $SeekTableOffset += 2;
- // $SeekTableEntry['shn_file_bit_offset'] = getid3_lib::LittleEndian2Int(substr($SeekTableData, $SeekTableOffset, 2));
- // $SeekTableOffset += 2;
- // $SeekTableEntry['shn_gbuffer'] = getid3_lib::LittleEndian2Int(substr($SeekTableData, $SeekTableOffset, 4));
- // $SeekTableOffset += 4;
- // $SeekTableEntry['shn_bit_shift'] = getid3_lib::LittleEndian2Int(substr($SeekTableData, $SeekTableOffset, 2));
- // $SeekTableOffset += 2;
- // for ($j = 0; $j < 3; $j++) {
- // $SeekTableEntry['cbuf0'][$j] = getid3_lib::LittleEndian2Int(substr($SeekTableData, $SeekTableOffset, 4));
- // $SeekTableOffset += 4;
- // }
- // for ($j = 0; $j < 3; $j++) {
- // $SeekTableEntry['cbuf1'][$j] = getid3_lib::LittleEndian2Int(substr($SeekTableData, $SeekTableOffset, 4));
- // $SeekTableOffset += 4;
- // }
- // for ($j = 0; $j < 4; $j++) {
- // $SeekTableEntry['offset0'][$j] = getid3_lib::LittleEndian2Int(substr($SeekTableData, $SeekTableOffset, 4));
- // $SeekTableOffset += 4;
- // }
- // for ($j = 0; $j < 4; $j++) {
- // $SeekTableEntry['offset1'][$j] = getid3_lib::LittleEndian2Int(substr($SeekTableData, $SeekTableOffset, 4));
- // $SeekTableOffset += 4;
- // }
- //
- // $info['shn']['seektable']['entries'][] = $SeekTableEntry;
- //}
-
- }
-
- }
-
- if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) {
- $info['error'][] = 'PHP running in Safe Mode - backtick operator not available, cannot run shntool to analyze Shorten files';
- return false;
- }
-
- if (GETID3_OS_ISWINDOWS) {
-
- $RequiredFiles = array('shorten.exe', 'cygwin1.dll', 'head.exe');
- foreach ($RequiredFiles as $required_file) {
- if (!is_readable(GETID3_HELPERAPPSDIR.$required_file)) {
- $info['error'][] = GETID3_HELPERAPPSDIR.$required_file.' does not exist';
- return false;
- }
- }
- $commandline = GETID3_HELPERAPPSDIR.'shorten.exe -x "'.$info['filenamepath'].'" - | '.GETID3_HELPERAPPSDIR.'head.exe -c 64';
- $commandline = str_replace('/', '\\', $commandline);
-
- } else {
-
- static $shorten_present;
- if (!isset($shorten_present)) {
- $shorten_present = file_exists('/usr/local/bin/shorten') || `which shorten`;
- }
- if (!$shorten_present) {
- $info['error'][] = 'shorten binary was not found in path or /usr/local/bin';
- return false;
- }
- $commandline = (file_exists('/usr/local/bin/shorten') ? '/usr/local/bin/' : '' ) . 'shorten -x '.escapeshellarg($info['filenamepath']).' - | head -c 64';
-
- }
-
- $output = `$commandline`;
-
- if (!empty($output) && (substr($output, 12, 4) == 'fmt ')) {
-
- getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, true);
-
- $fmt_size = getid3_lib::LittleEndian2Int(substr($output, 16, 4));
- $DecodedWAVFORMATEX = getid3_riff::RIFFparseWAVEFORMATex(substr($output, 20, $fmt_size));
- $info['audio']['channels'] = $DecodedWAVFORMATEX['channels'];
- $info['audio']['bits_per_sample'] = $DecodedWAVFORMATEX['bits_per_sample'];
- $info['audio']['sample_rate'] = $DecodedWAVFORMATEX['sample_rate'];
-
- if (substr($output, 20 + $fmt_size, 4) == 'data') {
-
- $info['playtime_seconds'] = getid3_lib::LittleEndian2Int(substr($output, 20 + 4 + $fmt_size, 4)) / $DecodedWAVFORMATEX['raw']['nAvgBytesPerSec'];
-
- } else {
-
- $info['error'][] = 'shorten failed to decode DATA chunk to expected location, cannot determine playtime';
- return false;
-
- }
-
- $info['audio']['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) / $info['playtime_seconds']) * 8;
-
- } else {
-
- $info['error'][] = 'shorten failed to decode file to WAV for parsing';
- return false;
-
- }
-
- return true;
- }
-
-}
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.audio.tta.php b/3rdparty/getid3/module.audio.tta.php
deleted file mode 100644
index 1c646ee6768..00000000000
--- a/3rdparty/getid3/module.audio.tta.php
+++ /dev/null
@@ -1,109 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.audio.tta.php //
-// module for analyzing TTA Audio files //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_tta extends getid3_handler
-{
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- $info['fileformat'] = 'tta';
- $info['audio']['dataformat'] = 'tta';
- $info['audio']['lossless'] = true;
- $info['audio']['bitrate_mode'] = 'vbr';
-
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
- $ttaheader = fread($this->getid3->fp, 26);
-
- $info['tta']['magic'] = substr($ttaheader, 0, 3);
- $magic = 'TTA';
- if ($info['tta']['magic'] != $magic) {
- $info['error'][] = 'Expecting "'.getid3_lib::PrintHexBytes($magic).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($info['tta']['magic']).'"';
- unset($info['fileformat']);
- unset($info['audio']);
- unset($info['tta']);
- return false;
- }
-
- switch ($ttaheader{3}) {
- case "\x01": // TTA v1.x
- case "\x02": // TTA v1.x
- case "\x03": // TTA v1.x
- // "It was the demo-version of the TTA encoder. There is no released format with such header. TTA encoder v1 is not supported about a year."
- $info['tta']['major_version'] = 1;
- $info['avdataoffset'] += 16;
-
- $info['tta']['compression_level'] = ord($ttaheader{3});
- $info['tta']['channels'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 4, 2));
- $info['tta']['bits_per_sample'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 6, 2));
- $info['tta']['sample_rate'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 8, 4));
- $info['tta']['samples_per_channel'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 12, 4));
-
- $info['audio']['encoder_options'] = '-e'.$info['tta']['compression_level'];
- $info['playtime_seconds'] = $info['tta']['samples_per_channel'] / $info['tta']['sample_rate'];
- break;
-
- case '2': // TTA v2.x
- // "I have hurried to release the TTA 2.0 encoder. Format documentation is removed from our site. This format still in development. Please wait the TTA2 format, encoder v4."
- $info['tta']['major_version'] = 2;
- $info['avdataoffset'] += 20;
-
- $info['tta']['compression_level'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 4, 2));
- $info['tta']['audio_format'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 6, 2));
- $info['tta']['channels'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 8, 2));
- $info['tta']['bits_per_sample'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 10, 2));
- $info['tta']['sample_rate'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 12, 4));
- $info['tta']['data_length'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 16, 4));
-
- $info['audio']['encoder_options'] = '-e'.$info['tta']['compression_level'];
- $info['playtime_seconds'] = $info['tta']['data_length'] / $info['tta']['sample_rate'];
- break;
-
- case '1': // TTA v3.x
- // "This is a first stable release of the TTA format. It will be supported by the encoders v3 or higher."
- $info['tta']['major_version'] = 3;
- $info['avdataoffset'] += 26;
-
- $info['tta']['audio_format'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 4, 2)); // getid3_riff::RIFFwFormatTagLookup()
- $info['tta']['channels'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 6, 2));
- $info['tta']['bits_per_sample'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 8, 2));
- $info['tta']['sample_rate'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 10, 4));
- $info['tta']['data_length'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 14, 4));
- $info['tta']['crc32_footer'] = substr($ttaheader, 18, 4);
- $info['tta']['seek_point'] = getid3_lib::LittleEndian2Int(substr($ttaheader, 22, 4));
-
- $info['playtime_seconds'] = $info['tta']['data_length'] / $info['tta']['sample_rate'];
- break;
-
- default:
- $info['error'][] = 'This version of getID3() ['.$this->getid3->version().'] only knows how to handle TTA v1 and v2 - it may not work correctly with this file which appears to be TTA v'.$ttaheader{3};
- return false;
- break;
- }
-
- $info['audio']['encoder'] = 'TTA v'.$info['tta']['major_version'];
- $info['audio']['bits_per_sample'] = $info['tta']['bits_per_sample'];
- $info['audio']['sample_rate'] = $info['tta']['sample_rate'];
- $info['audio']['channels'] = $info['tta']['channels'];
- $info['audio']['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds'];
-
- return true;
- }
-
-}
-
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.audio.voc.php b/3rdparty/getid3/module.audio.voc.php
deleted file mode 100644
index 1186a4cc03e..00000000000
--- a/3rdparty/getid3/module.audio.voc.php
+++ /dev/null
@@ -1,207 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.audio.voc.php //
-// module for analyzing Creative VOC Audio files //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_voc extends getid3_handler
-{
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- $OriginalAVdataOffset = $info['avdataoffset'];
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
- $VOCheader = fread($this->getid3->fp, 26);
-
- $magic = 'Creative Voice File';
- if (substr($VOCheader, 0, 19) != $magic) {
- $info['error'][] = 'Expecting "'.getid3_lib::PrintHexBytes($magic).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes(substr($VOCheader, 0, 19)).'"';
- return false;
- }
-
- // shortcuts
- $thisfile_audio = &$info['audio'];
- $info['voc'] = array();
- $thisfile_voc = &$info['voc'];
-
- $info['fileformat'] = 'voc';
- $thisfile_audio['dataformat'] = 'voc';
- $thisfile_audio['bitrate_mode'] = 'cbr';
- $thisfile_audio['lossless'] = true;
- $thisfile_audio['channels'] = 1; // might be overriden below
- $thisfile_audio['bits_per_sample'] = 8; // might be overriden below
-
- // byte # Description
- // ------ ------------------------------------------
- // 00-12 'Creative Voice File'
- // 13 1A (eof to abort printing of file)
- // 14-15 Offset of first datablock in .voc file (std 1A 00 in Intel Notation)
- // 16-17 Version number (minor,major) (VOC-HDR puts 0A 01)
- // 18-19 2's Comp of Ver. # + 1234h (VOC-HDR puts 29 11)
-
- $thisfile_voc['header']['datablock_offset'] = getid3_lib::LittleEndian2Int(substr($VOCheader, 20, 2));
- $thisfile_voc['header']['minor_version'] = getid3_lib::LittleEndian2Int(substr($VOCheader, 22, 1));
- $thisfile_voc['header']['major_version'] = getid3_lib::LittleEndian2Int(substr($VOCheader, 23, 1));
-
- do {
-
- $BlockOffset = ftell($this->getid3->fp);
- $BlockData = fread($this->getid3->fp, 4);
- $BlockType = ord($BlockData{0});
- $BlockSize = getid3_lib::LittleEndian2Int(substr($BlockData, 1, 3));
- $ThisBlock = array();
-
- getid3_lib::safe_inc($thisfile_voc['blocktypes'][$BlockType], 1);
- switch ($BlockType) {
- case 0: // Terminator
- // do nothing, we'll break out of the loop down below
- break;
-
- case 1: // Sound data
- $BlockData .= fread($this->getid3->fp, 2);
- if ($info['avdataoffset'] <= $OriginalAVdataOffset) {
- $info['avdataoffset'] = ftell($this->getid3->fp);
- }
- fseek($this->getid3->fp, $BlockSize - 2, SEEK_CUR);
-
- $ThisBlock['sample_rate_id'] = getid3_lib::LittleEndian2Int(substr($BlockData, 4, 1));
- $ThisBlock['compression_type'] = getid3_lib::LittleEndian2Int(substr($BlockData, 5, 1));
-
- $ThisBlock['compression_name'] = $this->VOCcompressionTypeLookup($ThisBlock['compression_type']);
- if ($ThisBlock['compression_type'] <= 3) {
- $thisfile_voc['compressed_bits_per_sample'] = getid3_lib::CastAsInt(str_replace('-bit', '', $ThisBlock['compression_name']));
- }
-
- // Less accurate sample_rate calculation than the Extended block (#8) data (but better than nothing if Extended Block is not available)
- if (empty($thisfile_audio['sample_rate'])) {
- // SR byte = 256 - (1000000 / sample_rate)
- $thisfile_audio['sample_rate'] = getid3_lib::trunc((1000000 / (256 - $ThisBlock['sample_rate_id'])) / $thisfile_audio['channels']);
- }
- break;
-
- case 2: // Sound continue
- case 3: // Silence
- case 4: // Marker
- case 6: // Repeat
- case 7: // End repeat
- // nothing useful, just skip
- fseek($this->getid3->fp, $BlockSize, SEEK_CUR);
- break;
-
- case 8: // Extended
- $BlockData .= fread($this->getid3->fp, 4);
-
- //00-01 Time Constant:
- // Mono: 65536 - (256000000 / sample_rate)
- // Stereo: 65536 - (256000000 / (sample_rate * 2))
- $ThisBlock['time_constant'] = getid3_lib::LittleEndian2Int(substr($BlockData, 4, 2));
- $ThisBlock['pack_method'] = getid3_lib::LittleEndian2Int(substr($BlockData, 6, 1));
- $ThisBlock['stereo'] = (bool) getid3_lib::LittleEndian2Int(substr($BlockData, 7, 1));
-
- $thisfile_audio['channels'] = ($ThisBlock['stereo'] ? 2 : 1);
- $thisfile_audio['sample_rate'] = getid3_lib::trunc((256000000 / (65536 - $ThisBlock['time_constant'])) / $thisfile_audio['channels']);
- break;
-
- case 9: // data block that supersedes blocks 1 and 8. Used for stereo, 16 bit
- $BlockData .= fread($this->getid3->fp, 12);
- if ($info['avdataoffset'] <= $OriginalAVdataOffset) {
- $info['avdataoffset'] = ftell($this->getid3->fp);
- }
- fseek($this->getid3->fp, $BlockSize - 12, SEEK_CUR);
-
- $ThisBlock['sample_rate'] = getid3_lib::LittleEndian2Int(substr($BlockData, 4, 4));
- $ThisBlock['bits_per_sample'] = getid3_lib::LittleEndian2Int(substr($BlockData, 8, 1));
- $ThisBlock['channels'] = getid3_lib::LittleEndian2Int(substr($BlockData, 9, 1));
- $ThisBlock['wFormat'] = getid3_lib::LittleEndian2Int(substr($BlockData, 10, 2));
-
- $ThisBlock['compression_name'] = $this->VOCwFormatLookup($ThisBlock['wFormat']);
- if ($this->VOCwFormatActualBitsPerSampleLookup($ThisBlock['wFormat'])) {
- $thisfile_voc['compressed_bits_per_sample'] = $this->VOCwFormatActualBitsPerSampleLookup($ThisBlock['wFormat']);
- }
-
- $thisfile_audio['sample_rate'] = $ThisBlock['sample_rate'];
- $thisfile_audio['bits_per_sample'] = $ThisBlock['bits_per_sample'];
- $thisfile_audio['channels'] = $ThisBlock['channels'];
- break;
-
- default:
- $info['warning'][] = 'Unhandled block type "'.$BlockType.'" at offset '.$BlockOffset;
- fseek($this->getid3->fp, $BlockSize, SEEK_CUR);
- break;
- }
-
- if (!empty($ThisBlock)) {
- $ThisBlock['block_offset'] = $BlockOffset;
- $ThisBlock['block_size'] = $BlockSize;
- $ThisBlock['block_type_id'] = $BlockType;
- $thisfile_voc['blocks'][] = $ThisBlock;
- }
-
- } while (!feof($this->getid3->fp) && ($BlockType != 0));
-
- // Terminator block doesn't have size field, so seek back 3 spaces
- fseek($this->getid3->fp, -3, SEEK_CUR);
-
- ksort($thisfile_voc['blocktypes']);
-
- if (!empty($thisfile_voc['compressed_bits_per_sample'])) {
- $info['playtime_seconds'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / ($thisfile_voc['compressed_bits_per_sample'] * $thisfile_audio['channels'] * $thisfile_audio['sample_rate']);
- $thisfile_audio['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds'];
- }
-
- return true;
- }
-
- function VOCcompressionTypeLookup($index) {
- static $VOCcompressionTypeLookup = array(
- 0 => '8-bit',
- 1 => '4-bit',
- 2 => '2.6-bit',
- 3 => '2-bit'
- );
- return (isset($VOCcompressionTypeLookup[$index]) ? $VOCcompressionTypeLookup[$index] : 'Multi DAC ('.($index - 3).') channels');
- }
-
- function VOCwFormatLookup($index) {
- static $VOCwFormatLookup = array(
- 0x0000 => '8-bit unsigned PCM',
- 0x0001 => 'Creative 8-bit to 4-bit ADPCM',
- 0x0002 => 'Creative 8-bit to 3-bit ADPCM',
- 0x0003 => 'Creative 8-bit to 2-bit ADPCM',
- 0x0004 => '16-bit signed PCM',
- 0x0006 => 'CCITT a-Law',
- 0x0007 => 'CCITT u-Law',
- 0x2000 => 'Creative 16-bit to 4-bit ADPCM'
- );
- return (isset($VOCwFormatLookup[$index]) ? $VOCwFormatLookup[$index] : false);
- }
-
- function VOCwFormatActualBitsPerSampleLookup($index) {
- static $VOCwFormatLookup = array(
- 0x0000 => 8,
- 0x0001 => 4,
- 0x0002 => 3,
- 0x0003 => 2,
- 0x0004 => 16,
- 0x0006 => 8,
- 0x0007 => 8,
- 0x2000 => 4
- );
- return (isset($VOCwFormatLookup[$index]) ? $VOCwFormatLookup[$index] : false);
- }
-
-}
-
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.audio.vqf.php b/3rdparty/getid3/module.audio.vqf.php
deleted file mode 100644
index dc6ff5ecc42..00000000000
--- a/3rdparty/getid3/module.audio.vqf.php
+++ /dev/null
@@ -1,162 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.audio.vqf.php //
-// module for analyzing VQF audio files //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_vqf extends getid3_handler
-{
- function Analyze() {
- $info = &$this->getid3->info;
-
- // based loosely on code from TTwinVQ by Jurgen Faul <jfaulgmx*de>
- // http://jfaul.de/atl or http://j-faul.virtualave.net/atl/atl.html
-
- $info['fileformat'] = 'vqf';
- $info['audio']['dataformat'] = 'vqf';
- $info['audio']['bitrate_mode'] = 'cbr';
- $info['audio']['lossless'] = false;
-
- // shortcut
- $info['vqf']['raw'] = array();
- $thisfile_vqf = &$info['vqf'];
- $thisfile_vqf_raw = &$thisfile_vqf['raw'];
-
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
- $VQFheaderData = fread($this->getid3->fp, 16);
-
- $offset = 0;
- $thisfile_vqf_raw['header_tag'] = substr($VQFheaderData, $offset, 4);
- $magic = 'TWIN';
- if ($thisfile_vqf_raw['header_tag'] != $magic) {
- $info['error'][] = 'Expecting "'.getid3_lib::PrintHexBytes($magic).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($thisfile_vqf_raw['header_tag']).'"';
- unset($info['vqf']);
- unset($info['fileformat']);
- return false;
- }
- $offset += 4;
- $thisfile_vqf_raw['version'] = substr($VQFheaderData, $offset, 8);
- $offset += 8;
- $thisfile_vqf_raw['size'] = getid3_lib::BigEndian2Int(substr($VQFheaderData, $offset, 4));
- $offset += 4;
-
- while (ftell($this->getid3->fp) < $info['avdataend']) {
-
- $ChunkBaseOffset = ftell($this->getid3->fp);
- $chunkoffset = 0;
- $ChunkData = fread($this->getid3->fp, 8);
- $ChunkName = substr($ChunkData, $chunkoffset, 4);
- if ($ChunkName == 'DATA') {
- $info['avdataoffset'] = $ChunkBaseOffset;
- break;
- }
- $chunkoffset += 4;
- $ChunkSize = getid3_lib::BigEndian2Int(substr($ChunkData, $chunkoffset, 4));
- $chunkoffset += 4;
- if ($ChunkSize > ($info['avdataend'] - ftell($this->getid3->fp))) {
- $info['error'][] = 'Invalid chunk size ('.$ChunkSize.') for chunk "'.$ChunkName.'" at offset '.$ChunkBaseOffset;
- break;
- }
- if ($ChunkSize > 0) {
- $ChunkData .= fread($this->getid3->fp, $ChunkSize);
- }
-
- switch ($ChunkName) {
- case 'COMM':
- // shortcut
- $thisfile_vqf['COMM'] = array();
- $thisfile_vqf_COMM = &$thisfile_vqf['COMM'];
-
- $thisfile_vqf_COMM['channel_mode'] = getid3_lib::BigEndian2Int(substr($ChunkData, $chunkoffset, 4));
- $chunkoffset += 4;
- $thisfile_vqf_COMM['bitrate'] = getid3_lib::BigEndian2Int(substr($ChunkData, $chunkoffset, 4));
- $chunkoffset += 4;
- $thisfile_vqf_COMM['sample_rate'] = getid3_lib::BigEndian2Int(substr($ChunkData, $chunkoffset, 4));
- $chunkoffset += 4;
- $thisfile_vqf_COMM['security_level'] = getid3_lib::BigEndian2Int(substr($ChunkData, $chunkoffset, 4));
- $chunkoffset += 4;
-
- $info['audio']['channels'] = $thisfile_vqf_COMM['channel_mode'] + 1;
- $info['audio']['sample_rate'] = $this->VQFchannelFrequencyLookup($thisfile_vqf_COMM['sample_rate']);
- $info['audio']['bitrate'] = $thisfile_vqf_COMM['bitrate'] * 1000;
- $info['audio']['encoder_options'] = 'CBR' . ceil($info['audio']['bitrate']/1000);
-
- if ($info['audio']['bitrate'] == 0) {
- $info['error'][] = 'Corrupt VQF file: bitrate_audio == zero';
- return false;
- }
- break;
-
- case 'NAME':
- case 'AUTH':
- case '(c) ':
- case 'FILE':
- case 'COMT':
- case 'ALBM':
- $thisfile_vqf['comments'][$this->VQFcommentNiceNameLookup($ChunkName)][] = trim(substr($ChunkData, 8));
- break;
-
- case 'DSIZ':
- $thisfile_vqf['DSIZ'] = getid3_lib::BigEndian2Int(substr($ChunkData, 8, 4));
- break;
-
- default:
- $info['warning'][] = 'Unhandled chunk type "'.$ChunkName.'" at offset '.$ChunkBaseOffset;
- break;
- }
- }
-
- $info['playtime_seconds'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['audio']['bitrate'];
-
- if (isset($thisfile_vqf['DSIZ']) && (($thisfile_vqf['DSIZ'] != ($info['avdataend'] - $info['avdataoffset'] - strlen('DATA'))))) {
- switch ($thisfile_vqf['DSIZ']) {
- case 0:
- case 1:
- $info['warning'][] = 'Invalid DSIZ value "'.$thisfile_vqf['DSIZ'].'". This is known to happen with VQF files encoded by Ahead Nero, and seems to be its way of saying this is TwinVQF v'.($thisfile_vqf['DSIZ'] + 1).'.0';
- $info['audio']['encoder'] = 'Ahead Nero';
- break;
-
- default:
- $info['warning'][] = 'Probable corrupted file - should be '.$thisfile_vqf['DSIZ'].' bytes, actually '.($info['avdataend'] - $info['avdataoffset'] - strlen('DATA'));
- break;
- }
- }
-
- return true;
- }
-
- function VQFchannelFrequencyLookup($frequencyid) {
- static $VQFchannelFrequencyLookup = array(
- 11 => 11025,
- 22 => 22050,
- 44 => 44100
- );
- return (isset($VQFchannelFrequencyLookup[$frequencyid]) ? $VQFchannelFrequencyLookup[$frequencyid] : $frequencyid * 1000);
- }
-
- function VQFcommentNiceNameLookup($shortname) {
- static $VQFcommentNiceNameLookup = array(
- 'NAME' => 'title',
- 'AUTH' => 'artist',
- '(c) ' => 'copyright',
- 'FILE' => 'filename',
- 'COMT' => 'comment',
- 'ALBM' => 'album'
- );
- return (isset($VQFcommentNiceNameLookup[$shortname]) ? $VQFcommentNiceNameLookup[$shortname] : $shortname);
- }
-
-}
-
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.audio.wavpack.php b/3rdparty/getid3/module.audio.wavpack.php
deleted file mode 100644
index 6ab5b438677..00000000000
--- a/3rdparty/getid3/module.audio.wavpack.php
+++ /dev/null
@@ -1,400 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.audio.wavpack.php //
-// module for analyzing WavPack v4.0+ Audio files //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_wavpack extends getid3_handler
-{
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
-
- while (true) {
-
- $wavpackheader = fread($this->getid3->fp, 32);
-
- if (ftell($this->getid3->fp) >= $info['avdataend']) {
- break;
- } elseif (feof($this->getid3->fp)) {
- break;
- } elseif (
- isset($info['wavpack']['blockheader']['total_samples']) &&
- isset($info['wavpack']['blockheader']['block_samples']) &&
- ($info['wavpack']['blockheader']['total_samples'] > 0) &&
- ($info['wavpack']['blockheader']['block_samples'] > 0) &&
- (!isset($info['wavpack']['riff_trailer_size']) || ($info['wavpack']['riff_trailer_size'] <= 0)) &&
- ((isset($info['wavpack']['config_flags']['md5_checksum']) && ($info['wavpack']['config_flags']['md5_checksum'] === false)) || !empty($info['md5_data_source']))) {
- break;
- }
-
- $blockheader_offset = ftell($this->getid3->fp) - 32;
- $blockheader_magic = substr($wavpackheader, 0, 4);
- $blockheader_size = getid3_lib::LittleEndian2Int(substr($wavpackheader, 4, 4));
-
- $magic = 'wvpk';
- if ($blockheader_magic != $magic) {
- $info['error'][] = 'Expecting "'.getid3_lib::PrintHexBytes($magic).'" at offset '.$blockheader_offset.', found "'.getid3_lib::PrintHexBytes($blockheader_magic).'"';
- switch (isset($info['audio']['dataformat']) ? $info['audio']['dataformat'] : '') {
- case 'wavpack':
- case 'wvc':
- break;
- default:
- unset($info['fileformat']);
- unset($info['audio']);
- unset($info['wavpack']);
- break;
- }
- return false;
- }
-
- if (empty($info['wavpack']['blockheader']['block_samples']) ||
- empty($info['wavpack']['blockheader']['total_samples']) ||
- ($info['wavpack']['blockheader']['block_samples'] <= 0) ||
- ($info['wavpack']['blockheader']['total_samples'] <= 0)) {
- // Also, it is possible that the first block might not have
- // any samples (block_samples == 0) and in this case you should skip blocks
- // until you find one with samples because the other information (like
- // total_samples) are not guaranteed to be correct until (block_samples > 0)
-
- // Finally, I have defined a format for files in which the length is not known
- // (for example when raw files are created using pipes). In these cases
- // total_samples will be -1 and you must seek to the final block to determine
- // the total number of samples.
-
-
- $info['audio']['dataformat'] = 'wavpack';
- $info['fileformat'] = 'wavpack';
- $info['audio']['lossless'] = true;
- $info['audio']['bitrate_mode'] = 'vbr';
-
- $info['wavpack']['blockheader']['offset'] = $blockheader_offset;
- $info['wavpack']['blockheader']['magic'] = $blockheader_magic;
- $info['wavpack']['blockheader']['size'] = $blockheader_size;
-
- if ($info['wavpack']['blockheader']['size'] >= 0x100000) {
- $info['error'][] = 'Expecting WavPack block size less than "0x100000", found "'.$info['wavpack']['blockheader']['size'].'" at offset '.$info['wavpack']['blockheader']['offset'];
- switch (isset($info['audio']['dataformat']) ? $info['audio']['dataformat'] : '') {
- case 'wavpack':
- case 'wvc':
- break;
- default:
- unset($info['fileformat']);
- unset($info['audio']);
- unset($info['wavpack']);
- break;
- }
- return false;
- }
-
- $info['wavpack']['blockheader']['minor_version'] = ord($wavpackheader{8});
- $info['wavpack']['blockheader']['major_version'] = ord($wavpackheader{9});
-
- if (($info['wavpack']['blockheader']['major_version'] != 4) ||
- (($info['wavpack']['blockheader']['minor_version'] < 4) &&
- ($info['wavpack']['blockheader']['minor_version'] > 16))) {
- $info['error'][] = 'Expecting WavPack version between "4.2" and "4.16", found version "'.$info['wavpack']['blockheader']['major_version'].'.'.$info['wavpack']['blockheader']['minor_version'].'" at offset '.$info['wavpack']['blockheader']['offset'];
- switch (isset($info['audio']['dataformat']) ? $info['audio']['dataformat'] : '') {
- case 'wavpack':
- case 'wvc':
- break;
- default:
- unset($info['fileformat']);
- unset($info['audio']);
- unset($info['wavpack']);
- break;
- }
- return false;
- }
-
- $info['wavpack']['blockheader']['track_number'] = ord($wavpackheader{10}); // unused
- $info['wavpack']['blockheader']['index_number'] = ord($wavpackheader{11}); // unused
- $info['wavpack']['blockheader']['total_samples'] = getid3_lib::LittleEndian2Int(substr($wavpackheader, 12, 4));
- $info['wavpack']['blockheader']['block_index'] = getid3_lib::LittleEndian2Int(substr($wavpackheader, 16, 4));
- $info['wavpack']['blockheader']['block_samples'] = getid3_lib::LittleEndian2Int(substr($wavpackheader, 20, 4));
- $info['wavpack']['blockheader']['flags_raw'] = getid3_lib::LittleEndian2Int(substr($wavpackheader, 24, 4));
- $info['wavpack']['blockheader']['crc'] = getid3_lib::LittleEndian2Int(substr($wavpackheader, 28, 4));
-
- $info['wavpack']['blockheader']['flags']['bytes_per_sample'] = 1 + ($info['wavpack']['blockheader']['flags_raw'] & 0x00000003);
- $info['wavpack']['blockheader']['flags']['mono'] = (bool) ($info['wavpack']['blockheader']['flags_raw'] & 0x00000004);
- $info['wavpack']['blockheader']['flags']['hybrid'] = (bool) ($info['wavpack']['blockheader']['flags_raw'] & 0x00000008);
- $info['wavpack']['blockheader']['flags']['joint_stereo'] = (bool) ($info['wavpack']['blockheader']['flags_raw'] & 0x00000010);
- $info['wavpack']['blockheader']['flags']['cross_decorrelation'] = (bool) ($info['wavpack']['blockheader']['flags_raw'] & 0x00000020);
- $info['wavpack']['blockheader']['flags']['hybrid_noiseshape'] = (bool) ($info['wavpack']['blockheader']['flags_raw'] & 0x00000040);
- $info['wavpack']['blockheader']['flags']['ieee_32bit_float'] = (bool) ($info['wavpack']['blockheader']['flags_raw'] & 0x00000080);
- $info['wavpack']['blockheader']['flags']['int_32bit'] = (bool) ($info['wavpack']['blockheader']['flags_raw'] & 0x00000100);
- $info['wavpack']['blockheader']['flags']['hybrid_bitrate_noise'] = (bool) ($info['wavpack']['blockheader']['flags_raw'] & 0x00000200);
- $info['wavpack']['blockheader']['flags']['hybrid_balance_noise'] = (bool) ($info['wavpack']['blockheader']['flags_raw'] & 0x00000400);
- $info['wavpack']['blockheader']['flags']['multichannel_initial'] = (bool) ($info['wavpack']['blockheader']['flags_raw'] & 0x00000800);
- $info['wavpack']['blockheader']['flags']['multichannel_final'] = (bool) ($info['wavpack']['blockheader']['flags_raw'] & 0x00001000);
-
- $info['audio']['lossless'] = !$info['wavpack']['blockheader']['flags']['hybrid'];
- }
-
- while (!feof($this->getid3->fp) && (ftell($this->getid3->fp) < ($blockheader_offset + $blockheader_size + 8))) {
-
- $metablock = array('offset'=>ftell($this->getid3->fp));
- $metablockheader = fread($this->getid3->fp, 2);
- if (feof($this->getid3->fp)) {
- break;
- }
- $metablock['id'] = ord($metablockheader{0});
- $metablock['function_id'] = ($metablock['id'] & 0x3F);
- $metablock['function_name'] = $this->WavPackMetablockNameLookup($metablock['function_id']);
-
- // The 0x20 bit in the id of the meta subblocks (which is defined as
- // ID_OPTIONAL_DATA) is a permanent part of the id. The idea is that
- // if a decoder encounters an id that it does not know about, it uses
- // that "ID_OPTIONAL_DATA" flag to determine what to do. If it is set
- // then the decoder simply ignores the metadata, but if it is zero
- // then the decoder should quit because it means that an understanding
- // of the metadata is required to correctly decode the audio.
- $metablock['non_decoder'] = (bool) ($metablock['id'] & 0x20);
-
- $metablock['padded_data'] = (bool) ($metablock['id'] & 0x40);
- $metablock['large_block'] = (bool) ($metablock['id'] & 0x80);
- if ($metablock['large_block']) {
- $metablockheader .= fread($this->getid3->fp, 2);
- }
- $metablock['size'] = getid3_lib::LittleEndian2Int(substr($metablockheader, 1)) * 2; // size is stored in words
- $metablock['data'] = null;
-
- if ($metablock['size'] > 0) {
-
- switch ($metablock['function_id']) {
- case 0x21: // ID_RIFF_HEADER
- case 0x22: // ID_RIFF_TRAILER
- case 0x23: // ID_REPLAY_GAIN
- case 0x24: // ID_CUESHEET
- case 0x25: // ID_CONFIG_BLOCK
- case 0x26: // ID_MD5_CHECKSUM
- $metablock['data'] = fread($this->getid3->fp, $metablock['size']);
-
- if ($metablock['padded_data']) {
- // padded to the nearest even byte
- $metablock['size']--;
- $metablock['data'] = substr($metablock['data'], 0, -1);
- }
- break;
-
- case 0x00: // ID_DUMMY
- case 0x01: // ID_ENCODER_INFO
- case 0x02: // ID_DECORR_TERMS
- case 0x03: // ID_DECORR_WEIGHTS
- case 0x04: // ID_DECORR_SAMPLES
- case 0x05: // ID_ENTROPY_VARS
- case 0x06: // ID_HYBRID_PROFILE
- case 0x07: // ID_SHAPING_WEIGHTS
- case 0x08: // ID_FLOAT_INFO
- case 0x09: // ID_INT32_INFO
- case 0x0A: // ID_WV_BITSTREAM
- case 0x0B: // ID_WVC_BITSTREAM
- case 0x0C: // ID_WVX_BITSTREAM
- case 0x0D: // ID_CHANNEL_INFO
- fseek($this->getid3->fp, $metablock['offset'] + ($metablock['large_block'] ? 4 : 2) + $metablock['size'], SEEK_SET);
- break;
-
- default:
- $info['warning'][] = 'Unexpected metablock type "0x'.str_pad(dechex($metablock['function_id']), 2, '0', STR_PAD_LEFT).'" at offset '.$metablock['offset'];
- fseek($this->getid3->fp, $metablock['offset'] + ($metablock['large_block'] ? 4 : 2) + $metablock['size'], SEEK_SET);
- break;
- }
-
- switch ($metablock['function_id']) {
- case 0x21: // ID_RIFF_HEADER
- getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, true);
- $original_wav_filesize = getid3_lib::LittleEndian2Int(substr($metablock['data'], 4, 4));
-
- $getid3_temp = new getID3();
- $getid3_temp->openfile($this->getid3->filename);
- $getid3_riff = new getid3_riff($getid3_temp);
- $getid3_riff->ParseRIFFdata($metablock['data']);
- $metablock['riff'] = $getid3_temp->info['riff'];
- $info['audio']['sample_rate'] = $getid3_temp->info['riff']['raw']['fmt ']['nSamplesPerSec'];
- unset($getid3_riff, $getid3_temp);
-
- $metablock['riff']['original_filesize'] = $original_wav_filesize;
- $info['wavpack']['riff_trailer_size'] = $original_wav_filesize - $metablock['riff']['WAVE']['data'][0]['size'] - $metablock['riff']['header_size'];
- $info['playtime_seconds'] = $info['wavpack']['blockheader']['total_samples'] / $info['audio']['sample_rate'];
-
- // Safe RIFF header in case there's a RIFF footer later
- $metablockRIFFheader = $metablock['data'];
- break;
-
-
- case 0x22: // ID_RIFF_TRAILER
- $metablockRIFFfooter = $metablockRIFFheader.$metablock['data'];
- getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, true);
-
- $startoffset = $metablock['offset'] + ($metablock['large_block'] ? 4 : 2);
- $getid3_temp = new getID3();
- $getid3_temp->openfile($this->getid3->filename);
- $getid3_temp->info['avdataend'] = $info['avdataend'];
- $getid3_temp->info['fileformat'] = 'riff';
- $getid3_riff = new getid3_riff($getid3_temp);
- $metablock['riff'] = $getid3_riff->ParseRIFF($startoffset, $startoffset + $metablock['size']);
-
- if (!empty($metablock['riff']['INFO'])) {
- $getid3_riff->RIFFcommentsParse($metablock['riff']['INFO'], $metablock['comments']);
- $info['tags']['riff'] = $metablock['comments'];
- }
- unset($getid3_temp, $getid3_riff);
- break;
-
-
- case 0x23: // ID_REPLAY_GAIN
- $info['warning'][] = 'WavPack "Replay Gain" contents not yet handled by getID3() in metablock at offset '.$metablock['offset'];
- break;
-
-
- case 0x24: // ID_CUESHEET
- $info['warning'][] = 'WavPack "Cuesheet" contents not yet handled by getID3() in metablock at offset '.$metablock['offset'];
- break;
-
-
- case 0x25: // ID_CONFIG_BLOCK
- $metablock['flags_raw'] = getid3_lib::LittleEndian2Int(substr($metablock['data'], 0, 3));
-
- $metablock['flags']['adobe_mode'] = (bool) ($metablock['flags_raw'] & 0x000001); // "adobe" mode for 32-bit floats
- $metablock['flags']['fast_flag'] = (bool) ($metablock['flags_raw'] & 0x000002); // fast mode
- $metablock['flags']['very_fast_flag'] = (bool) ($metablock['flags_raw'] & 0x000004); // double fast
- $metablock['flags']['high_flag'] = (bool) ($metablock['flags_raw'] & 0x000008); // high quality mode
- $metablock['flags']['very_high_flag'] = (bool) ($metablock['flags_raw'] & 0x000010); // double high (not used yet)
- $metablock['flags']['bitrate_kbps'] = (bool) ($metablock['flags_raw'] & 0x000020); // bitrate is kbps, not bits / sample
- $metablock['flags']['auto_shaping'] = (bool) ($metablock['flags_raw'] & 0x000040); // automatic noise shaping
- $metablock['flags']['shape_override'] = (bool) ($metablock['flags_raw'] & 0x000080); // shaping mode specified
- $metablock['flags']['joint_override'] = (bool) ($metablock['flags_raw'] & 0x000100); // joint-stereo mode specified
- $metablock['flags']['copy_time'] = (bool) ($metablock['flags_raw'] & 0x000200); // copy file-time from source
- $metablock['flags']['create_exe'] = (bool) ($metablock['flags_raw'] & 0x000400); // create executable
- $metablock['flags']['create_wvc'] = (bool) ($metablock['flags_raw'] & 0x000800); // create correction file
- $metablock['flags']['optimize_wvc'] = (bool) ($metablock['flags_raw'] & 0x001000); // maximize bybrid compression
- $metablock['flags']['quality_mode'] = (bool) ($metablock['flags_raw'] & 0x002000); // psychoacoustic quality mode
- $metablock['flags']['raw_flag'] = (bool) ($metablock['flags_raw'] & 0x004000); // raw mode (not implemented yet)
- $metablock['flags']['calc_noise'] = (bool) ($metablock['flags_raw'] & 0x008000); // calc noise in hybrid mode
- $metablock['flags']['lossy_mode'] = (bool) ($metablock['flags_raw'] & 0x010000); // obsolete (for information)
- $metablock['flags']['extra_mode'] = (bool) ($metablock['flags_raw'] & 0x020000); // extra processing mode
- $metablock['flags']['skip_wvx'] = (bool) ($metablock['flags_raw'] & 0x040000); // no wvx stream w/ floats & big ints
- $metablock['flags']['md5_checksum'] = (bool) ($metablock['flags_raw'] & 0x080000); // compute & store MD5 signature
- $metablock['flags']['quiet_mode'] = (bool) ($metablock['flags_raw'] & 0x100000); // don't report progress %
-
- $info['wavpack']['config_flags'] = $metablock['flags'];
-
-
- $info['audio']['encoder_options'] = '';
- if ($info['wavpack']['blockheader']['flags']['hybrid']) {
- $info['audio']['encoder_options'] .= ' -b???';
- }
- $info['audio']['encoder_options'] .= ($metablock['flags']['adobe_mode'] ? ' -a' : '');
- $info['audio']['encoder_options'] .= ($metablock['flags']['optimize_wvc'] ? ' -cc' : '');
- $info['audio']['encoder_options'] .= ($metablock['flags']['create_exe'] ? ' -e' : '');
- $info['audio']['encoder_options'] .= ($metablock['flags']['fast_flag'] ? ' -f' : '');
- $info['audio']['encoder_options'] .= ($metablock['flags']['joint_override'] ? ' -j?' : '');
- $info['audio']['encoder_options'] .= ($metablock['flags']['high_flag'] ? ' -h' : '');
- $info['audio']['encoder_options'] .= ($metablock['flags']['md5_checksum'] ? ' -m' : '');
- $info['audio']['encoder_options'] .= ($metablock['flags']['calc_noise'] ? ' -n' : '');
- $info['audio']['encoder_options'] .= ($metablock['flags']['shape_override'] ? ' -s?' : '');
- $info['audio']['encoder_options'] .= ($metablock['flags']['extra_mode'] ? ' -x?' : '');
- if (!empty($info['audio']['encoder_options'])) {
- $info['audio']['encoder_options'] = trim($info['audio']['encoder_options']);
- } elseif (isset($info['audio']['encoder_options'])) {
- unset($info['audio']['encoder_options']);
- }
- break;
-
-
- case 0x26: // ID_MD5_CHECKSUM
- if (strlen($metablock['data']) == 16) {
- $info['md5_data_source'] = strtolower(getid3_lib::PrintHexBytes($metablock['data'], true, false, false));
- } else {
- $info['warning'][] = 'Expecting 16 bytes of WavPack "MD5 Checksum" in metablock at offset '.$metablock['offset'].', but found '.strlen($metablock['data']).' bytes';
- }
- break;
-
-
- case 0x00: // ID_DUMMY
- case 0x01: // ID_ENCODER_INFO
- case 0x02: // ID_DECORR_TERMS
- case 0x03: // ID_DECORR_WEIGHTS
- case 0x04: // ID_DECORR_SAMPLES
- case 0x05: // ID_ENTROPY_VARS
- case 0x06: // ID_HYBRID_PROFILE
- case 0x07: // ID_SHAPING_WEIGHTS
- case 0x08: // ID_FLOAT_INFO
- case 0x09: // ID_INT32_INFO
- case 0x0A: // ID_WV_BITSTREAM
- case 0x0B: // ID_WVC_BITSTREAM
- case 0x0C: // ID_WVX_BITSTREAM
- case 0x0D: // ID_CHANNEL_INFO
- unset($metablock);
- break;
- }
-
- }
- if (!empty($metablock)) {
- $info['wavpack']['metablocks'][] = $metablock;
- }
-
- }
-
- }
-
- $info['audio']['encoder'] = 'WavPack v'.$info['wavpack']['blockheader']['major_version'].'.'.str_pad($info['wavpack']['blockheader']['minor_version'], 2, '0', STR_PAD_LEFT);
- $info['audio']['bits_per_sample'] = $info['wavpack']['blockheader']['flags']['bytes_per_sample'] * 8;
- $info['audio']['channels'] = ($info['wavpack']['blockheader']['flags']['mono'] ? 1 : 2);
-
- if (!empty($info['playtime_seconds'])) {
-
- $info['audio']['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds'];
-
- } else {
-
- $info['audio']['dataformat'] = 'wvc';
-
- }
-
- return true;
- }
-
-
- function WavPackMetablockNameLookup(&$id) {
- static $WavPackMetablockNameLookup = array(
- 0x00 => 'Dummy',
- 0x01 => 'Encoder Info',
- 0x02 => 'Decorrelation Terms',
- 0x03 => 'Decorrelation Weights',
- 0x04 => 'Decorrelation Samples',
- 0x05 => 'Entropy Variables',
- 0x06 => 'Hybrid Profile',
- 0x07 => 'Shaping Weights',
- 0x08 => 'Float Info',
- 0x09 => 'Int32 Info',
- 0x0A => 'WV Bitstream',
- 0x0B => 'WVC Bitstream',
- 0x0C => 'WVX Bitstream',
- 0x0D => 'Channel Info',
- 0x21 => 'RIFF header',
- 0x22 => 'RIFF trailer',
- 0x23 => 'Replay Gain',
- 0x24 => 'Cuesheet',
- 0x25 => 'Config Block',
- 0x26 => 'MD5 Checksum',
- );
- return (isset($WavPackMetablockNameLookup[$id]) ? $WavPackMetablockNameLookup[$id] : '');
- }
-
-}
-
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.graphic.bmp.php b/3rdparty/getid3/module.graphic.bmp.php
deleted file mode 100644
index 5ac671fbca0..00000000000
--- a/3rdparty/getid3/module.graphic.bmp.php
+++ /dev/null
@@ -1,690 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.graphic.bmp.php //
-// module for analyzing BMP Image files //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_bmp extends getid3_handler
-{
- var $ExtractPalette = false;
- var $ExtractData = false;
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- // shortcuts
- $info['bmp']['header']['raw'] = array();
- $thisfile_bmp = &$info['bmp'];
- $thisfile_bmp_header = &$thisfile_bmp['header'];
- $thisfile_bmp_header_raw = &$thisfile_bmp_header['raw'];
-
- // BITMAPFILEHEADER [14 bytes] - http://msdn.microsoft.com/library/en-us/gdi/bitmaps_62uq.asp
- // all versions
- // WORD bfType;
- // DWORD bfSize;
- // WORD bfReserved1;
- // WORD bfReserved2;
- // DWORD bfOffBits;
-
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
- $offset = 0;
- $BMPheader = fread($this->getid3->fp, 14 + 40);
-
- $thisfile_bmp_header_raw['identifier'] = substr($BMPheader, $offset, 2);
- $offset += 2;
-
- $magic = 'BM';
- if ($thisfile_bmp_header_raw['identifier'] != $magic) {
- $info['error'][] = 'Expecting "'.getid3_lib::PrintHexBytes($magic).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($thisfile_bmp_header_raw['identifier']).'"';
- unset($info['fileformat']);
- unset($info['bmp']);
- return false;
- }
-
- $thisfile_bmp_header_raw['filesize'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4));
- $offset += 4;
- $thisfile_bmp_header_raw['reserved1'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 2));
- $offset += 2;
- $thisfile_bmp_header_raw['reserved2'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 2));
- $offset += 2;
- $thisfile_bmp_header_raw['data_offset'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4));
- $offset += 4;
- $thisfile_bmp_header_raw['header_size'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4));
- $offset += 4;
-
-
- // check if the hardcoded-to-1 "planes" is at offset 22 or 26
- $planes22 = getid3_lib::LittleEndian2Int(substr($BMPheader, 22, 2));
- $planes26 = getid3_lib::LittleEndian2Int(substr($BMPheader, 26, 2));
- if (($planes22 == 1) && ($planes26 != 1)) {
- $thisfile_bmp['type_os'] = 'OS/2';
- $thisfile_bmp['type_version'] = 1;
- } elseif (($planes26 == 1) && ($planes22 != 1)) {
- $thisfile_bmp['type_os'] = 'Windows';
- $thisfile_bmp['type_version'] = 1;
- } elseif ($thisfile_bmp_header_raw['header_size'] == 12) {
- $thisfile_bmp['type_os'] = 'OS/2';
- $thisfile_bmp['type_version'] = 1;
- } elseif ($thisfile_bmp_header_raw['header_size'] == 40) {
- $thisfile_bmp['type_os'] = 'Windows';
- $thisfile_bmp['type_version'] = 1;
- } elseif ($thisfile_bmp_header_raw['header_size'] == 84) {
- $thisfile_bmp['type_os'] = 'Windows';
- $thisfile_bmp['type_version'] = 4;
- } elseif ($thisfile_bmp_header_raw['header_size'] == 100) {
- $thisfile_bmp['type_os'] = 'Windows';
- $thisfile_bmp['type_version'] = 5;
- } else {
- $info['error'][] = 'Unknown BMP subtype (or not a BMP file)';
- unset($info['fileformat']);
- unset($info['bmp']);
- return false;
- }
-
- $info['fileformat'] = 'bmp';
- $info['video']['dataformat'] = 'bmp';
- $info['video']['lossless'] = true;
- $info['video']['pixel_aspect_ratio'] = (float) 1;
-
- if ($thisfile_bmp['type_os'] == 'OS/2') {
-
- // OS/2-format BMP
- // http://netghost.narod.ru/gff/graphics/summary/os2bmp.htm
-
- // DWORD Size; /* Size of this structure in bytes */
- // DWORD Width; /* Bitmap width in pixels */
- // DWORD Height; /* Bitmap height in pixel */
- // WORD NumPlanes; /* Number of bit planes (color depth) */
- // WORD BitsPerPixel; /* Number of bits per pixel per plane */
-
- $thisfile_bmp_header_raw['width'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 2));
- $offset += 2;
- $thisfile_bmp_header_raw['height'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 2));
- $offset += 2;
- $thisfile_bmp_header_raw['planes'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 2));
- $offset += 2;
- $thisfile_bmp_header_raw['bits_per_pixel'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 2));
- $offset += 2;
-
- $info['video']['resolution_x'] = $thisfile_bmp_header_raw['width'];
- $info['video']['resolution_y'] = $thisfile_bmp_header_raw['height'];
- $info['video']['codec'] = 'BI_RGB '.$thisfile_bmp_header_raw['bits_per_pixel'].'-bit';
- $info['video']['bits_per_sample'] = $thisfile_bmp_header_raw['bits_per_pixel'];
-
- if ($thisfile_bmp['type_version'] >= 2) {
- // DWORD Compression; /* Bitmap compression scheme */
- // DWORD ImageDataSize; /* Size of bitmap data in bytes */
- // DWORD XResolution; /* X resolution of display device */
- // DWORD YResolution; /* Y resolution of display device */
- // DWORD ColorsUsed; /* Number of color table indices used */
- // DWORD ColorsImportant; /* Number of important color indices */
- // WORD Units; /* Type of units used to measure resolution */
- // WORD Reserved; /* Pad structure to 4-byte boundary */
- // WORD Recording; /* Recording algorithm */
- // WORD Rendering; /* Halftoning algorithm used */
- // DWORD Size1; /* Reserved for halftoning algorithm use */
- // DWORD Size2; /* Reserved for halftoning algorithm use */
- // DWORD ColorEncoding; /* Color model used in bitmap */
- // DWORD Identifier; /* Reserved for application use */
-
- $thisfile_bmp_header_raw['compression'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4));
- $offset += 4;
- $thisfile_bmp_header_raw['bmp_data_size'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4));
- $offset += 4;
- $thisfile_bmp_header_raw['resolution_h'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4));
- $offset += 4;
- $thisfile_bmp_header_raw['resolution_v'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4));
- $offset += 4;
- $thisfile_bmp_header_raw['colors_used'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4));
- $offset += 4;
- $thisfile_bmp_header_raw['colors_important'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4));
- $offset += 4;
- $thisfile_bmp_header_raw['resolution_units'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 2));
- $offset += 2;
- $thisfile_bmp_header_raw['reserved1'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 2));
- $offset += 2;
- $thisfile_bmp_header_raw['recording'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 2));
- $offset += 2;
- $thisfile_bmp_header_raw['rendering'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 2));
- $offset += 2;
- $thisfile_bmp_header_raw['size1'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4));
- $offset += 4;
- $thisfile_bmp_header_raw['size2'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4));
- $offset += 4;
- $thisfile_bmp_header_raw['color_encoding'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4));
- $offset += 4;
- $thisfile_bmp_header_raw['identifier'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4));
- $offset += 4;
-
- $thisfile_bmp_header['compression'] = $this->BMPcompressionOS2Lookup($thisfile_bmp_header_raw['compression']);
-
- $info['video']['codec'] = $thisfile_bmp_header['compression'].' '.$thisfile_bmp_header_raw['bits_per_pixel'].'-bit';
- }
-
- } elseif ($thisfile_bmp['type_os'] == 'Windows') {
-
- // Windows-format BMP
-
- // BITMAPINFOHEADER - [40 bytes] http://msdn.microsoft.com/library/en-us/gdi/bitmaps_1rw2.asp
- // all versions
- // DWORD biSize;
- // LONG biWidth;
- // LONG biHeight;
- // WORD biPlanes;
- // WORD biBitCount;
- // DWORD biCompression;
- // DWORD biSizeImage;
- // LONG biXPelsPerMeter;
- // LONG biYPelsPerMeter;
- // DWORD biClrUsed;
- // DWORD biClrImportant;
-
- // possibly integrate this section and module.audio-video.riff.php::ParseBITMAPINFOHEADER() ?
-
- $thisfile_bmp_header_raw['width'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4), true);
- $offset += 4;
- $thisfile_bmp_header_raw['height'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4), true);
- $offset += 4;
- $thisfile_bmp_header_raw['planes'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 2));
- $offset += 2;
- $thisfile_bmp_header_raw['bits_per_pixel'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 2));
- $offset += 2;
- $thisfile_bmp_header_raw['compression'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4));
- $offset += 4;
- $thisfile_bmp_header_raw['bmp_data_size'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4));
- $offset += 4;
- $thisfile_bmp_header_raw['resolution_h'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4), true);
- $offset += 4;
- $thisfile_bmp_header_raw['resolution_v'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4), true);
- $offset += 4;
- $thisfile_bmp_header_raw['colors_used'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4));
- $offset += 4;
- $thisfile_bmp_header_raw['colors_important'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4));
- $offset += 4;
-
- $thisfile_bmp_header['compression'] = $this->BMPcompressionWindowsLookup($thisfile_bmp_header_raw['compression']);
- $info['video']['resolution_x'] = $thisfile_bmp_header_raw['width'];
- $info['video']['resolution_y'] = $thisfile_bmp_header_raw['height'];
- $info['video']['codec'] = $thisfile_bmp_header['compression'].' '.$thisfile_bmp_header_raw['bits_per_pixel'].'-bit';
- $info['video']['bits_per_sample'] = $thisfile_bmp_header_raw['bits_per_pixel'];
-
- if (($thisfile_bmp['type_version'] >= 4) || ($thisfile_bmp_header_raw['compression'] == 3)) {
- // should only be v4+, but BMPs with type_version==1 and BI_BITFIELDS compression have been seen
- $BMPheader .= fread($this->getid3->fp, 44);
-
- // BITMAPV4HEADER - [44 bytes] - http://msdn.microsoft.com/library/en-us/gdi/bitmaps_2k1e.asp
- // Win95+, WinNT4.0+
- // DWORD bV4RedMask;
- // DWORD bV4GreenMask;
- // DWORD bV4BlueMask;
- // DWORD bV4AlphaMask;
- // DWORD bV4CSType;
- // CIEXYZTRIPLE bV4Endpoints;
- // DWORD bV4GammaRed;
- // DWORD bV4GammaGreen;
- // DWORD bV4GammaBlue;
- $thisfile_bmp_header_raw['red_mask'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4));
- $offset += 4;
- $thisfile_bmp_header_raw['green_mask'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4));
- $offset += 4;
- $thisfile_bmp_header_raw['blue_mask'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4));
- $offset += 4;
- $thisfile_bmp_header_raw['alpha_mask'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4));
- $offset += 4;
- $thisfile_bmp_header_raw['cs_type'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4));
- $offset += 4;
- $thisfile_bmp_header_raw['ciexyz_red'] = substr($BMPheader, $offset, 4);
- $offset += 4;
- $thisfile_bmp_header_raw['ciexyz_green'] = substr($BMPheader, $offset, 4);
- $offset += 4;
- $thisfile_bmp_header_raw['ciexyz_blue'] = substr($BMPheader, $offset, 4);
- $offset += 4;
- $thisfile_bmp_header_raw['gamma_red'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4));
- $offset += 4;
- $thisfile_bmp_header_raw['gamma_green'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4));
- $offset += 4;
- $thisfile_bmp_header_raw['gamma_blue'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4));
- $offset += 4;
-
- $thisfile_bmp_header['ciexyz_red'] = getid3_lib::FixedPoint2_30(strrev($thisfile_bmp_header_raw['ciexyz_red']));
- $thisfile_bmp_header['ciexyz_green'] = getid3_lib::FixedPoint2_30(strrev($thisfile_bmp_header_raw['ciexyz_green']));
- $thisfile_bmp_header['ciexyz_blue'] = getid3_lib::FixedPoint2_30(strrev($thisfile_bmp_header_raw['ciexyz_blue']));
- }
-
- if ($thisfile_bmp['type_version'] >= 5) {
- $BMPheader .= fread($this->getid3->fp, 16);
-
- // BITMAPV5HEADER - [16 bytes] - http://msdn.microsoft.com/library/en-us/gdi/bitmaps_7c36.asp
- // Win98+, Win2000+
- // DWORD bV5Intent;
- // DWORD bV5ProfileData;
- // DWORD bV5ProfileSize;
- // DWORD bV5Reserved;
- $thisfile_bmp_header_raw['intent'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4));
- $offset += 4;
- $thisfile_bmp_header_raw['profile_data_offset'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4));
- $offset += 4;
- $thisfile_bmp_header_raw['profile_data_size'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4));
- $offset += 4;
- $thisfile_bmp_header_raw['reserved3'] = getid3_lib::LittleEndian2Int(substr($BMPheader, $offset, 4));
- $offset += 4;
- }
-
- } else {
-
- $info['error'][] = 'Unknown BMP format in header.';
- return false;
-
- }
-
-
- if ($this->ExtractPalette || $this->ExtractData) {
- $PaletteEntries = 0;
- if ($thisfile_bmp_header_raw['bits_per_pixel'] < 16) {
- $PaletteEntries = pow(2, $thisfile_bmp_header_raw['bits_per_pixel']);
- } elseif (isset($thisfile_bmp_header_raw['colors_used']) && ($thisfile_bmp_header_raw['colors_used'] > 0) && ($thisfile_bmp_header_raw['colors_used'] <= 256)) {
- $PaletteEntries = $thisfile_bmp_header_raw['colors_used'];
- }
- if ($PaletteEntries > 0) {
- $BMPpalette = fread($this->getid3->fp, 4 * $PaletteEntries);
- $paletteoffset = 0;
- for ($i = 0; $i < $PaletteEntries; $i++) {
- // RGBQUAD - http://msdn.microsoft.com/library/en-us/gdi/bitmaps_5f8y.asp
- // BYTE rgbBlue;
- // BYTE rgbGreen;
- // BYTE rgbRed;
- // BYTE rgbReserved;
- $blue = getid3_lib::LittleEndian2Int(substr($BMPpalette, $paletteoffset++, 1));
- $green = getid3_lib::LittleEndian2Int(substr($BMPpalette, $paletteoffset++, 1));
- $red = getid3_lib::LittleEndian2Int(substr($BMPpalette, $paletteoffset++, 1));
- if (($thisfile_bmp['type_os'] == 'OS/2') && ($thisfile_bmp['type_version'] == 1)) {
- // no padding byte
- } else {
- $paletteoffset++; // padding byte
- }
- $thisfile_bmp['palette'][$i] = (($red << 16) | ($green << 8) | $blue);
- }
- }
- }
-
- if ($this->ExtractData) {
- fseek($this->getid3->fp, $thisfile_bmp_header_raw['data_offset'], SEEK_SET);
- $RowByteLength = ceil(($thisfile_bmp_header_raw['width'] * ($thisfile_bmp_header_raw['bits_per_pixel'] / 8)) / 4) * 4; // round up to nearest DWORD boundry
- $BMPpixelData = fread($this->getid3->fp, $thisfile_bmp_header_raw['height'] * $RowByteLength);
- $pixeldataoffset = 0;
- $thisfile_bmp_header_raw['compression'] = (isset($thisfile_bmp_header_raw['compression']) ? $thisfile_bmp_header_raw['compression'] : '');
- switch ($thisfile_bmp_header_raw['compression']) {
-
- case 0: // BI_RGB
- switch ($thisfile_bmp_header_raw['bits_per_pixel']) {
- case 1:
- for ($row = ($thisfile_bmp_header_raw['height'] - 1); $row >= 0; $row--) {
- for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col = $col) {
- $paletteindexbyte = ord($BMPpixelData{$pixeldataoffset++});
- for ($i = 7; $i >= 0; $i--) {
- $paletteindex = ($paletteindexbyte & (0x01 << $i)) >> $i;
- $thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][$paletteindex];
- $col++;
- }
- }
- while (($pixeldataoffset % 4) != 0) {
- // lines are padded to nearest DWORD
- $pixeldataoffset++;
- }
- }
- break;
-
- case 4:
- for ($row = ($thisfile_bmp_header_raw['height'] - 1); $row >= 0; $row--) {
- for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col = $col) {
- $paletteindexbyte = ord($BMPpixelData{$pixeldataoffset++});
- for ($i = 1; $i >= 0; $i--) {
- $paletteindex = ($paletteindexbyte & (0x0F << (4 * $i))) >> (4 * $i);
- $thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][$paletteindex];
- $col++;
- }
- }
- while (($pixeldataoffset % 4) != 0) {
- // lines are padded to nearest DWORD
- $pixeldataoffset++;
- }
- }
- break;
-
- case 8:
- for ($row = ($thisfile_bmp_header_raw['height'] - 1); $row >= 0; $row--) {
- for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col++) {
- $paletteindex = ord($BMPpixelData{$pixeldataoffset++});
- $thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][$paletteindex];
- }
- while (($pixeldataoffset % 4) != 0) {
- // lines are padded to nearest DWORD
- $pixeldataoffset++;
- }
- }
- break;
-
- case 24:
- for ($row = ($thisfile_bmp_header_raw['height'] - 1); $row >= 0; $row--) {
- for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col++) {
- $thisfile_bmp['data'][$row][$col] = (ord($BMPpixelData{$pixeldataoffset+2}) << 16) | (ord($BMPpixelData{$pixeldataoffset+1}) << 8) | ord($BMPpixelData{$pixeldataoffset});
- $pixeldataoffset += 3;
- }
- while (($pixeldataoffset % 4) != 0) {
- // lines are padded to nearest DWORD
- $pixeldataoffset++;
- }
- }
- break;
-
- case 32:
- for ($row = ($thisfile_bmp_header_raw['height'] - 1); $row >= 0; $row--) {
- for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col++) {
- $thisfile_bmp['data'][$row][$col] = (ord($BMPpixelData{$pixeldataoffset+3}) << 24) | (ord($BMPpixelData{$pixeldataoffset+2}) << 16) | (ord($BMPpixelData{$pixeldataoffset+1}) << 8) | ord($BMPpixelData{$pixeldataoffset});
- $pixeldataoffset += 4;
- }
- while (($pixeldataoffset % 4) != 0) {
- // lines are padded to nearest DWORD
- $pixeldataoffset++;
- }
- }
- break;
-
- case 16:
- // ?
- break;
-
- default:
- $info['error'][] = 'Unknown bits-per-pixel value ('.$thisfile_bmp_header_raw['bits_per_pixel'].') - cannot read pixel data';
- break;
- }
- break;
-
-
- case 1: // BI_RLE8 - http://msdn.microsoft.com/library/en-us/gdi/bitmaps_6x0u.asp
- switch ($thisfile_bmp_header_raw['bits_per_pixel']) {
- case 8:
- $pixelcounter = 0;
- while ($pixeldataoffset < strlen($BMPpixelData)) {
- $firstbyte = getid3_lib::LittleEndian2Int(substr($BMPpixelData, $pixeldataoffset++, 1));
- $secondbyte = getid3_lib::LittleEndian2Int(substr($BMPpixelData, $pixeldataoffset++, 1));
- if ($firstbyte == 0) {
-
- // escaped/absolute mode - the first byte of the pair can be set to zero to
- // indicate an escape character that denotes the end of a line, the end of
- // a bitmap, or a delta, depending on the value of the second byte.
- switch ($secondbyte) {
- case 0:
- // end of line
- // no need for special processing, just ignore
- break;
-
- case 1:
- // end of bitmap
- $pixeldataoffset = strlen($BMPpixelData); // force to exit loop just in case
- break;
-
- case 2:
- // delta - The 2 bytes following the escape contain unsigned values
- // indicating the horizontal and vertical offsets of the next pixel
- // from the current position.
- $colincrement = getid3_lib::LittleEndian2Int(substr($BMPpixelData, $pixeldataoffset++, 1));
- $rowincrement = getid3_lib::LittleEndian2Int(substr($BMPpixelData, $pixeldataoffset++, 1));
- $col = ($pixelcounter % $thisfile_bmp_header_raw['width']) + $colincrement;
- $row = ($thisfile_bmp_header_raw['height'] - 1 - (($pixelcounter - $col) / $thisfile_bmp_header_raw['width'])) - $rowincrement;
- $pixelcounter = ($row * $thisfile_bmp_header_raw['width']) + $col;
- break;
-
- default:
- // In absolute mode, the first byte is zero and the second byte is a
- // value in the range 03H through FFH. The second byte represents the
- // number of bytes that follow, each of which contains the color index
- // of a single pixel. Each run must be aligned on a word boundary.
- for ($i = 0; $i < $secondbyte; $i++) {
- $paletteindex = getid3_lib::LittleEndian2Int(substr($BMPpixelData, $pixeldataoffset++, 1));
- $col = $pixelcounter % $thisfile_bmp_header_raw['width'];
- $row = $thisfile_bmp_header_raw['height'] - 1 - (($pixelcounter - $col) / $thisfile_bmp_header_raw['width']);
- $thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][$paletteindex];
- $pixelcounter++;
- }
- while (($pixeldataoffset % 2) != 0) {
- // Each run must be aligned on a word boundary.
- $pixeldataoffset++;
- }
- break;
- }
-
- } else {
-
- // encoded mode - the first byte specifies the number of consecutive pixels
- // to be drawn using the color index contained in the second byte.
- for ($i = 0; $i < $firstbyte; $i++) {
- $col = $pixelcounter % $thisfile_bmp_header_raw['width'];
- $row = $thisfile_bmp_header_raw['height'] - 1 - (($pixelcounter - $col) / $thisfile_bmp_header_raw['width']);
- $thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][$secondbyte];
- $pixelcounter++;
- }
-
- }
- }
- break;
-
- default:
- $info['error'][] = 'Unknown bits-per-pixel value ('.$thisfile_bmp_header_raw['bits_per_pixel'].') - cannot read pixel data';
- break;
- }
- break;
-
-
-
- case 2: // BI_RLE4 - http://msdn.microsoft.com/library/en-us/gdi/bitmaps_6x0u.asp
- switch ($thisfile_bmp_header_raw['bits_per_pixel']) {
- case 4:
- $pixelcounter = 0;
- while ($pixeldataoffset < strlen($BMPpixelData)) {
- $firstbyte = getid3_lib::LittleEndian2Int(substr($BMPpixelData, $pixeldataoffset++, 1));
- $secondbyte = getid3_lib::LittleEndian2Int(substr($BMPpixelData, $pixeldataoffset++, 1));
- if ($firstbyte == 0) {
-
- // escaped/absolute mode - the first byte of the pair can be set to zero to
- // indicate an escape character that denotes the end of a line, the end of
- // a bitmap, or a delta, depending on the value of the second byte.
- switch ($secondbyte) {
- case 0:
- // end of line
- // no need for special processing, just ignore
- break;
-
- case 1:
- // end of bitmap
- $pixeldataoffset = strlen($BMPpixelData); // force to exit loop just in case
- break;
-
- case 2:
- // delta - The 2 bytes following the escape contain unsigned values
- // indicating the horizontal and vertical offsets of the next pixel
- // from the current position.
- $colincrement = getid3_lib::LittleEndian2Int(substr($BMPpixelData, $pixeldataoffset++, 1));
- $rowincrement = getid3_lib::LittleEndian2Int(substr($BMPpixelData, $pixeldataoffset++, 1));
- $col = ($pixelcounter % $thisfile_bmp_header_raw['width']) + $colincrement;
- $row = ($thisfile_bmp_header_raw['height'] - 1 - (($pixelcounter - $col) / $thisfile_bmp_header_raw['width'])) - $rowincrement;
- $pixelcounter = ($row * $thisfile_bmp_header_raw['width']) + $col;
- break;
-
- default:
- // In absolute mode, the first byte is zero. The second byte contains the number
- // of color indexes that follow. Subsequent bytes contain color indexes in their
- // high- and low-order 4 bits, one color index for each pixel. In absolute mode,
- // each run must be aligned on a word boundary.
- unset($paletteindexes);
- for ($i = 0; $i < ceil($secondbyte / 2); $i++) {
- $paletteindexbyte = getid3_lib::LittleEndian2Int(substr($BMPpixelData, $pixeldataoffset++, 1));
- $paletteindexes[] = ($paletteindexbyte & 0xF0) >> 4;
- $paletteindexes[] = ($paletteindexbyte & 0x0F);
- }
- while (($pixeldataoffset % 2) != 0) {
- // Each run must be aligned on a word boundary.
- $pixeldataoffset++;
- }
-
- foreach ($paletteindexes as $paletteindex) {
- $col = $pixelcounter % $thisfile_bmp_header_raw['width'];
- $row = $thisfile_bmp_header_raw['height'] - 1 - (($pixelcounter - $col) / $thisfile_bmp_header_raw['width']);
- $thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][$paletteindex];
- $pixelcounter++;
- }
- break;
- }
-
- } else {
-
- // encoded mode - the first byte of the pair contains the number of pixels to be
- // drawn using the color indexes in the second byte. The second byte contains two
- // color indexes, one in its high-order 4 bits and one in its low-order 4 bits.
- // The first of the pixels is drawn using the color specified by the high-order
- // 4 bits, the second is drawn using the color in the low-order 4 bits, the third
- // is drawn using the color in the high-order 4 bits, and so on, until all the
- // pixels specified by the first byte have been drawn.
- $paletteindexes[0] = ($secondbyte & 0xF0) >> 4;
- $paletteindexes[1] = ($secondbyte & 0x0F);
- for ($i = 0; $i < $firstbyte; $i++) {
- $col = $pixelcounter % $thisfile_bmp_header_raw['width'];
- $row = $thisfile_bmp_header_raw['height'] - 1 - (($pixelcounter - $col) / $thisfile_bmp_header_raw['width']);
- $thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][$paletteindexes[($i % 2)]];
- $pixelcounter++;
- }
-
- }
- }
- break;
-
- default:
- $info['error'][] = 'Unknown bits-per-pixel value ('.$thisfile_bmp_header_raw['bits_per_pixel'].') - cannot read pixel data';
- break;
- }
- break;
-
-
- case 3: // BI_BITFIELDS
- switch ($thisfile_bmp_header_raw['bits_per_pixel']) {
- case 16:
- case 32:
- $redshift = 0;
- $greenshift = 0;
- $blueshift = 0;
- while ((($thisfile_bmp_header_raw['red_mask'] >> $redshift) & 0x01) == 0) {
- $redshift++;
- }
- while ((($thisfile_bmp_header_raw['green_mask'] >> $greenshift) & 0x01) == 0) {
- $greenshift++;
- }
- while ((($thisfile_bmp_header_raw['blue_mask'] >> $blueshift) & 0x01) == 0) {
- $blueshift++;
- }
- for ($row = ($thisfile_bmp_header_raw['height'] - 1); $row >= 0; $row--) {
- for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col++) {
- $pixelvalue = getid3_lib::LittleEndian2Int(substr($BMPpixelData, $pixeldataoffset, $thisfile_bmp_header_raw['bits_per_pixel'] / 8));
- $pixeldataoffset += $thisfile_bmp_header_raw['bits_per_pixel'] / 8;
-
- $red = intval(round(((($pixelvalue & $thisfile_bmp_header_raw['red_mask']) >> $redshift) / ($thisfile_bmp_header_raw['red_mask'] >> $redshift)) * 255));
- $green = intval(round(((($pixelvalue & $thisfile_bmp_header_raw['green_mask']) >> $greenshift) / ($thisfile_bmp_header_raw['green_mask'] >> $greenshift)) * 255));
- $blue = intval(round(((($pixelvalue & $thisfile_bmp_header_raw['blue_mask']) >> $blueshift) / ($thisfile_bmp_header_raw['blue_mask'] >> $blueshift)) * 255));
- $thisfile_bmp['data'][$row][$col] = (($red << 16) | ($green << 8) | ($blue));
- }
- while (($pixeldataoffset % 4) != 0) {
- // lines are padded to nearest DWORD
- $pixeldataoffset++;
- }
- }
- break;
-
- default:
- $info['error'][] = 'Unknown bits-per-pixel value ('.$thisfile_bmp_header_raw['bits_per_pixel'].') - cannot read pixel data';
- break;
- }
- break;
-
-
- default: // unhandled compression type
- $info['error'][] = 'Unknown/unhandled compression type value ('.$thisfile_bmp_header_raw['compression'].') - cannot decompress pixel data';
- break;
- }
- }
-
- return true;
- }
-
-
- function PlotBMP(&$BMPinfo) {
- $starttime = time();
- if (!isset($BMPinfo['bmp']['data']) || !is_array($BMPinfo['bmp']['data'])) {
- echo 'ERROR: no pixel data<BR>';
- return false;
- }
- set_time_limit(intval(round($BMPinfo['resolution_x'] * $BMPinfo['resolution_y'] / 10000)));
- if ($im = ImageCreateTrueColor($BMPinfo['resolution_x'], $BMPinfo['resolution_y'])) {
- for ($row = 0; $row < $BMPinfo['resolution_y']; $row++) {
- for ($col = 0; $col < $BMPinfo['resolution_x']; $col++) {
- if (isset($BMPinfo['bmp']['data'][$row][$col])) {
- $red = ($BMPinfo['bmp']['data'][$row][$col] & 0x00FF0000) >> 16;
- $green = ($BMPinfo['bmp']['data'][$row][$col] & 0x0000FF00) >> 8;
- $blue = ($BMPinfo['bmp']['data'][$row][$col] & 0x000000FF);
- $pixelcolor = ImageColorAllocate($im, $red, $green, $blue);
- ImageSetPixel($im, $col, $row, $pixelcolor);
- } else {
- //echo 'ERROR: no data for pixel '.$row.' x '.$col.'<BR>';
- //return false;
- }
- }
- }
- if (headers_sent()) {
- echo 'plotted '.($BMPinfo['resolution_x'] * $BMPinfo['resolution_y']).' pixels in '.(time() - $starttime).' seconds<BR>';
- ImageDestroy($im);
- exit;
- } else {
- header('Content-type: image/png');
- ImagePNG($im);
- ImageDestroy($im);
- return true;
- }
- }
- return false;
- }
-
- function BMPcompressionWindowsLookup($compressionid) {
- static $BMPcompressionWindowsLookup = array(
- 0 => 'BI_RGB',
- 1 => 'BI_RLE8',
- 2 => 'BI_RLE4',
- 3 => 'BI_BITFIELDS',
- 4 => 'BI_JPEG',
- 5 => 'BI_PNG'
- );
- return (isset($BMPcompressionWindowsLookup[$compressionid]) ? $BMPcompressionWindowsLookup[$compressionid] : 'invalid');
- }
-
- function BMPcompressionOS2Lookup($compressionid) {
- static $BMPcompressionOS2Lookup = array(
- 0 => 'BI_RGB',
- 1 => 'BI_RLE8',
- 2 => 'BI_RLE4',
- 3 => 'Huffman 1D',
- 4 => 'BI_RLE24',
- );
- return (isset($BMPcompressionOS2Lookup[$compressionid]) ? $BMPcompressionOS2Lookup[$compressionid] : 'invalid');
- }
-
-}
-
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.graphic.efax.php b/3rdparty/getid3/module.graphic.efax.php
deleted file mode 100644
index 2a57302e158..00000000000
--- a/3rdparty/getid3/module.graphic.efax.php
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.archive.efax.php //
-// module for analyzing eFax files //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_efax extends getid3_handler
-{
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
- $efaxheader = fread($this->getid3->fp, 1024);
-
- $info['efax']['header']['magic'] = substr($efaxheader, 0, 2);
- if ($info['efax']['header']['magic'] != "\xDC\xFE") {
- $info['error'][] = 'Invalid eFax byte order identifier (expecting DC FE, found '.getid3_lib::PrintHexBytes($info['efax']['header']['magic']).') at offset '.$info['avdataoffset'];
- return false;
- }
- $info['fileformat'] = 'efax';
-
- $info['efax']['header']['filesize'] = getid3_lib::LittleEndian2Int(substr($efaxheader, 2, 4));
- if ($info['efax']['header']['filesize'] != $info['filesize']) {
- $info['error'][] = 'Probable '.(($info['efax']['header']['filesize'] > $info['filesize']) ? 'truncated' : 'corrupt').' file, expecting '.$info['efax']['header']['filesize'].' bytes, found '.$info['filesize'].' bytes';
- }
- $info['efax']['header']['software1'] = rtrim(substr($efaxheader, 26, 32), "\x00");
- $info['efax']['header']['software2'] = rtrim(substr($efaxheader, 58, 32), "\x00");
- $info['efax']['header']['software3'] = rtrim(substr($efaxheader, 90, 32), "\x00");
-
- $info['efax']['header']['pages'] = getid3_lib::LittleEndian2Int(substr($efaxheader, 198, 2));
- $info['efax']['header']['data_bytes'] = getid3_lib::LittleEndian2Int(substr($efaxheader, 202, 4));
-
-$info['error'][] = 'eFax parsing not enabled in this version of getID3() ['.$this->getid3->version().']';
-return false;
-
- return true;
- }
-
-}
-
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.graphic.gif.php b/3rdparty/getid3/module.graphic.gif.php
deleted file mode 100644
index 0b3e1379ff7..00000000000
--- a/3rdparty/getid3/module.graphic.gif.php
+++ /dev/null
@@ -1,184 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.graphic.gif.php //
-// module for analyzing GIF Image files //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_gif extends getid3_handler
-{
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- $info['fileformat'] = 'gif';
- $info['video']['dataformat'] = 'gif';
- $info['video']['lossless'] = true;
- $info['video']['pixel_aspect_ratio'] = (float) 1;
-
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
- $GIFheader = fread($this->getid3->fp, 13);
- $offset = 0;
-
- $info['gif']['header']['raw']['identifier'] = substr($GIFheader, $offset, 3);
- $offset += 3;
-
- $magic = 'GIF';
- if ($info['gif']['header']['raw']['identifier'] != $magic) {
- $info['error'][] = 'Expecting "'.getid3_lib::PrintHexBytes($magic).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($info['gif']['header']['raw']['identifier']).'"';
- unset($info['fileformat']);
- unset($info['gif']);
- return false;
- }
-
- $info['gif']['header']['raw']['version'] = substr($GIFheader, $offset, 3);
- $offset += 3;
- $info['gif']['header']['raw']['width'] = getid3_lib::LittleEndian2Int(substr($GIFheader, $offset, 2));
- $offset += 2;
- $info['gif']['header']['raw']['height'] = getid3_lib::LittleEndian2Int(substr($GIFheader, $offset, 2));
- $offset += 2;
- $info['gif']['header']['raw']['flags'] = getid3_lib::LittleEndian2Int(substr($GIFheader, $offset, 1));
- $offset += 1;
- $info['gif']['header']['raw']['bg_color_index'] = getid3_lib::LittleEndian2Int(substr($GIFheader, $offset, 1));
- $offset += 1;
- $info['gif']['header']['raw']['aspect_ratio'] = getid3_lib::LittleEndian2Int(substr($GIFheader, $offset, 1));
- $offset += 1;
-
- $info['video']['resolution_x'] = $info['gif']['header']['raw']['width'];
- $info['video']['resolution_y'] = $info['gif']['header']['raw']['height'];
- $info['gif']['version'] = $info['gif']['header']['raw']['version'];
- $info['gif']['header']['flags']['global_color_table'] = (bool) ($info['gif']['header']['raw']['flags'] & 0x80);
- if ($info['gif']['header']['raw']['flags'] & 0x80) {
- // Number of bits per primary color available to the original image, minus 1
- $info['gif']['header']['bits_per_pixel'] = 3 * ((($info['gif']['header']['raw']['flags'] & 0x70) >> 4) + 1);
- } else {
- $info['gif']['header']['bits_per_pixel'] = 0;
- }
- $info['gif']['header']['flags']['global_color_sorted'] = (bool) ($info['gif']['header']['raw']['flags'] & 0x40);
- if ($info['gif']['header']['flags']['global_color_table']) {
- // the number of bytes contained in the Global Color Table. To determine that
- // actual size of the color table, raise 2 to [the value of the field + 1]
- $info['gif']['header']['global_color_size'] = pow(2, ($info['gif']['header']['raw']['flags'] & 0x07) + 1);
- $info['video']['bits_per_sample'] = ($info['gif']['header']['raw']['flags'] & 0x07) + 1;
- } else {
- $info['gif']['header']['global_color_size'] = 0;
- }
- if ($info['gif']['header']['raw']['aspect_ratio'] != 0) {
- // Aspect Ratio = (Pixel Aspect Ratio + 15) / 64
- $info['gif']['header']['aspect_ratio'] = ($info['gif']['header']['raw']['aspect_ratio'] + 15) / 64;
- }
-
-// if ($info['gif']['header']['flags']['global_color_table']) {
-// $GIFcolorTable = fread($this->getid3->fp, 3 * $info['gif']['header']['global_color_size']);
-// $offset = 0;
-// for ($i = 0; $i < $info['gif']['header']['global_color_size']; $i++) {
-// $red = getid3_lib::LittleEndian2Int(substr($GIFcolorTable, $offset++, 1));
-// $green = getid3_lib::LittleEndian2Int(substr($GIFcolorTable, $offset++, 1));
-// $blue = getid3_lib::LittleEndian2Int(substr($GIFcolorTable, $offset++, 1));
-// $info['gif']['global_color_table'][$i] = (($red << 16) | ($green << 8) | ($blue));
-// }
-// }
-//
-// // Image Descriptor
-// while (!feof($this->getid3->fp)) {
-// $NextBlockTest = fread($this->getid3->fp, 1);
-// switch ($NextBlockTest) {
-//
-// case ',': // ',' - Image separator character
-//
-// $ImageDescriptorData = $NextBlockTest.fread($this->getid3->fp, 9);
-// $ImageDescriptor = array();
-// $ImageDescriptor['image_left'] = getid3_lib::LittleEndian2Int(substr($ImageDescriptorData, 1, 2));
-// $ImageDescriptor['image_top'] = getid3_lib::LittleEndian2Int(substr($ImageDescriptorData, 3, 2));
-// $ImageDescriptor['image_width'] = getid3_lib::LittleEndian2Int(substr($ImageDescriptorData, 5, 2));
-// $ImageDescriptor['image_height'] = getid3_lib::LittleEndian2Int(substr($ImageDescriptorData, 7, 2));
-// $ImageDescriptor['flags_raw'] = getid3_lib::LittleEndian2Int(substr($ImageDescriptorData, 9, 1));
-// $ImageDescriptor['flags']['use_local_color_map'] = (bool) ($ImageDescriptor['flags_raw'] & 0x80);
-// $ImageDescriptor['flags']['image_interlaced'] = (bool) ($ImageDescriptor['flags_raw'] & 0x40);
-// $info['gif']['image_descriptor'][] = $ImageDescriptor;
-//
-// if ($ImageDescriptor['flags']['use_local_color_map']) {
-//
-// $info['warning'][] = 'This version of getID3() cannot parse local color maps for GIFs';
-// return true;
-//
-// }
-//echo 'Start of raster data: '.ftell($this->getid3->fp).'<BR>';
-// $RasterData = array();
-// $RasterData['code_size'] = getid3_lib::LittleEndian2Int(fread($this->getid3->fp, 1));
-// $RasterData['block_byte_count'] = getid3_lib::LittleEndian2Int(fread($this->getid3->fp, 1));
-// $info['gif']['raster_data'][count($info['gif']['image_descriptor']) - 1] = $RasterData;
-//
-// $CurrentCodeSize = $RasterData['code_size'] + 1;
-// for ($i = 0; $i < pow(2, $RasterData['code_size']); $i++) {
-// $DefaultDataLookupTable[$i] = chr($i);
-// }
-// $DefaultDataLookupTable[pow(2, $RasterData['code_size']) + 0] = ''; // Clear Code
-// $DefaultDataLookupTable[pow(2, $RasterData['code_size']) + 1] = ''; // End Of Image Code
-//
-//
-// $NextValue = $this->GetLSBits($CurrentCodeSize);
-// echo 'Clear Code: '.$NextValue.'<BR>';
-//
-// $NextValue = $this->GetLSBits($CurrentCodeSize);
-// echo 'First Color: '.$NextValue.'<BR>';
-//
-// $Prefix = $NextValue;
-//$i = 0;
-// while ($i++ < 20) {
-// $NextValue = $this->GetLSBits($CurrentCodeSize);
-// echo $NextValue.'<BR>';
-// }
-//return true;
-// break;
-//
-// case '!':
-// // GIF Extension Block
-// $ExtensionBlockData = $NextBlockTest.fread($this->getid3->fp, 2);
-// $ExtensionBlock = array();
-// $ExtensionBlock['function_code'] = getid3_lib::LittleEndian2Int(substr($ExtensionBlockData, 1, 1));
-// $ExtensionBlock['byte_length'] = getid3_lib::LittleEndian2Int(substr($ExtensionBlockData, 2, 1));
-// $ExtensionBlock['data'] = fread($this->getid3->fp, $ExtensionBlock['byte_length']);
-// $info['gif']['extension_blocks'][] = $ExtensionBlock;
-// break;
-//
-// case ';':
-// $info['gif']['terminator_offset'] = ftell($this->getid3->fp) - 1;
-// // GIF Terminator
-// break;
-//
-// default:
-// break;
-//
-//
-// }
-// }
-
- return true;
- }
-
-
- function GetLSBits($bits) {
- static $bitbuffer = '';
- while (strlen($bitbuffer) < $bits) {
- $bitbuffer = str_pad(decbin(ord(fread($this->getid3->fp, 1))), 8, '0', STR_PAD_LEFT).$bitbuffer;
- }
- $value = bindec(substr($bitbuffer, 0 - $bits));
- $bitbuffer = substr($bitbuffer, 0, 0 - $bits);
-
- return $value;
- }
-
-}
-
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.graphic.jpg.php b/3rdparty/getid3/module.graphic.jpg.php
deleted file mode 100644
index 153ebcd0e6f..00000000000
--- a/3rdparty/getid3/module.graphic.jpg.php
+++ /dev/null
@@ -1,338 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.graphic.jpg.php //
-// module for analyzing JPEG Image files //
-// dependencies: PHP compiled with --enable-exif (optional) //
-// module.tag.xmp.php (optional) //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_jpg extends getid3_handler
-{
-
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- $info['fileformat'] = 'jpg';
- $info['video']['dataformat'] = 'jpg';
- $info['video']['lossless'] = false;
- $info['video']['bits_per_sample'] = 24;
- $info['video']['pixel_aspect_ratio'] = (float) 1;
-
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
-
- $imageinfo = array();
- list($width, $height, $type) = getid3_lib::GetDataImageSize(fread($this->getid3->fp, $info['filesize']), $imageinfo);
-
-
- if (isset($imageinfo['APP13'])) {
- // http://php.net/iptcparse
- // http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/IPTC.html
- $iptc_parsed = iptcparse($imageinfo['APP13']);
- if (is_array($iptc_parsed)) {
- foreach ($iptc_parsed as $iptc_key_raw => $iptc_values) {
- list($iptc_record, $iptc_tagkey) = explode('#', $iptc_key_raw);
- $iptc_tagkey = intval(ltrim($iptc_tagkey, '0'));
- foreach ($iptc_values as $key => $value) {
- $IPTCrecordName = $this->IPTCrecordName($iptc_record);
- $IPTCrecordTagName = $this->IPTCrecordTagName($iptc_record, $iptc_tagkey);
- if (isset($info['iptc'][$IPTCrecordName][$IPTCrecordTagName])) {
- $info['iptc'][$IPTCrecordName][$IPTCrecordTagName][] = $value;
- } else {
- $info['iptc'][$IPTCrecordName][$IPTCrecordTagName] = array($value);
- }
- }
- }
- }
- }
-
- $returnOK = false;
- switch ($type) {
- case IMG_JPG:
- $info['video']['resolution_x'] = $width;
- $info['video']['resolution_y'] = $height;
-
- if (isset($imageinfo['APP1'])) {
- if (function_exists('exif_read_data')) {
- if (substr($imageinfo['APP1'], 0, 4) == 'Exif') {
- $info['jpg']['exif'] = @exif_read_data($info['filenamepath'], '', true, false);
- } else {
- $info['warning'][] = 'exif_read_data() cannot parse non-EXIF data in APP1 (expected "Exif", found "'.substr($imageinfo['APP1'], 0, 4).'")';
- }
- } else {
- $info['warning'][] = 'EXIF parsing only available when '.(GETID3_OS_ISWINDOWS ? 'php_exif.dll enabled' : 'compiled with --enable-exif');
- }
- }
- $returnOK = true;
- break;
-
- default:
- break;
- }
-
-
- $cast_as_appropriate_keys = array('EXIF', 'IFD0', 'THUMBNAIL');
- foreach ($cast_as_appropriate_keys as $exif_key) {
- if (isset($info['jpg']['exif'][$exif_key])) {
- foreach ($info['jpg']['exif'][$exif_key] as $key => $value) {
- $info['jpg']['exif'][$exif_key][$key] = $this->CastAsAppropriate($value);
- }
- }
- }
-
-
- if (isset($info['jpg']['exif']['GPS'])) {
-
- if (isset($info['jpg']['exif']['GPS']['GPSVersion'])) {
- for ($i = 0; $i < 4; $i++) {
- $version_subparts[$i] = ord(substr($info['jpg']['exif']['GPS']['GPSVersion'], $i, 1));
- }
- $info['jpg']['exif']['GPS']['computed']['version'] = 'v'.implode('.', $version_subparts);
- }
-
- if (isset($info['jpg']['exif']['GPS']['GPSDateStamp'])) {
- $explodedGPSDateStamp = explode(':', $info['jpg']['exif']['GPS']['GPSDateStamp']);
- $computed_time[5] = (isset($explodedGPSDateStamp[0]) ? $explodedGPSDateStamp[0] : '');
- $computed_time[3] = (isset($explodedGPSDateStamp[1]) ? $explodedGPSDateStamp[1] : '');
- $computed_time[4] = (isset($explodedGPSDateStamp[2]) ? $explodedGPSDateStamp[2] : '');
-
- if (function_exists('date_default_timezone_set')) {
- date_default_timezone_set('UTC');
- } else {
- ini_set('date.timezone', 'UTC');
- }
-
- $computed_time = array(0=>0, 1=>0, 2=>0, 3=>0, 4=>0, 5=>0);
- if (isset($info['jpg']['exif']['GPS']['GPSTimeStamp']) && is_array($info['jpg']['exif']['GPS']['GPSTimeStamp'])) {
- foreach ($info['jpg']['exif']['GPS']['GPSTimeStamp'] as $key => $value) {
- $computed_time[$key] = getid3_lib::DecimalizeFraction($value);
- }
- }
- $info['jpg']['exif']['GPS']['computed']['timestamp'] = mktime($computed_time[0], $computed_time[1], $computed_time[2], $computed_time[3], $computed_time[4], $computed_time[5]);
- }
-
- if (isset($info['jpg']['exif']['GPS']['GPSLatitude']) && is_array($info['jpg']['exif']['GPS']['GPSLatitude'])) {
- $direction_multiplier = ((isset($info['jpg']['exif']['GPS']['GPSLatitudeRef']) && ($info['jpg']['exif']['GPS']['GPSLatitudeRef'] == 'S')) ? -1 : 1);
- foreach ($info['jpg']['exif']['GPS']['GPSLatitude'] as $key => $value) {
- $computed_latitude[$key] = getid3_lib::DecimalizeFraction($value);
- }
- $info['jpg']['exif']['GPS']['computed']['latitude'] = $direction_multiplier * ($computed_latitude[0] + ($computed_latitude[1] / 60) + ($computed_latitude[2] / 3600));
- }
-
- if (isset($info['jpg']['exif']['GPS']['GPSLongitude']) && is_array($info['jpg']['exif']['GPS']['GPSLongitude'])) {
- $direction_multiplier = ((isset($info['jpg']['exif']['GPS']['GPSLongitudeRef']) && ($info['jpg']['exif']['GPS']['GPSLongitudeRef'] == 'W')) ? -1 : 1);
- foreach ($info['jpg']['exif']['GPS']['GPSLongitude'] as $key => $value) {
- $computed_longitude[$key] = getid3_lib::DecimalizeFraction($value);
- }
- $info['jpg']['exif']['GPS']['computed']['longitude'] = $direction_multiplier * ($computed_longitude[0] + ($computed_longitude[1] / 60) + ($computed_longitude[2] / 3600));
- }
-
- if (isset($info['jpg']['exif']['GPS']['GPSAltitude'])) {
- $direction_multiplier = ((isset($info['jpg']['exif']['GPS']['GPSAltitudeRef']) && ($info['jpg']['exif']['GPS']['GPSAltitudeRef'] === chr(1))) ? -1 : 1);
- $info['jpg']['exif']['GPS']['computed']['altitude'] = $direction_multiplier * getid3_lib::DecimalizeFraction($info['jpg']['exif']['GPS']['GPSAltitude']);
- }
-
- }
-
-
- if (getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.xmp.php', __FILE__, false)) {
- if (isset($info['filenamepath'])) {
- $image_xmp = new Image_XMP($info['filenamepath']);
- $xmp_raw = $image_xmp->getAllTags();
- foreach ($xmp_raw as $key => $value) {
- list($subsection, $tagname) = explode(':', $key);
- $info['xmp'][$subsection][$tagname] = $this->CastAsAppropriate($value);
- }
- }
- }
-
- if (!$returnOK) {
- unset($info['fileformat']);
- return false;
- }
- return true;
- }
-
-
- function CastAsAppropriate($value) {
- if (is_array($value)) {
- return $value;
- } elseif (preg_match('#^[0-9]+/[0-9]+$#', $value)) {
- return getid3_lib::DecimalizeFraction($value);
- } elseif (preg_match('#^[0-9]+$#', $value)) {
- return getid3_lib::CastAsInt($value);
- } elseif (preg_match('#^[0-9\.]+$#', $value)) {
- return (float) $value;
- }
- return $value;
- }
-
-
- function IPTCrecordName($iptc_record) {
- // http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/IPTC.html
- static $IPTCrecordName = array();
- if (empty($IPTCrecordName)) {
- $IPTCrecordName = array(
- 1 => 'IPTCEnvelope',
- 2 => 'IPTCApplication',
- 3 => 'IPTCNewsPhoto',
- 7 => 'IPTCPreObjectData',
- 8 => 'IPTCObjectData',
- 9 => 'IPTCPostObjectData',
- );
- }
- return (isset($IPTCrecordName[$iptc_record]) ? $IPTCrecordName[$iptc_record] : '');
- }
-
-
- function IPTCrecordTagName($iptc_record, $iptc_tagkey) {
- // http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/IPTC.html
- static $IPTCrecordTagName = array();
- if (empty($IPTCrecordTagName)) {
- $IPTCrecordTagName = array(
- 1 => array( // IPTC EnvelopeRecord Tags
- 0 => 'EnvelopeRecordVersion',
- 5 => 'Destination',
- 20 => 'FileFormat',
- 22 => 'FileVersion',
- 30 => 'ServiceIdentifier',
- 40 => 'EnvelopeNumber',
- 50 => 'ProductID',
- 60 => 'EnvelopePriority',
- 70 => 'DateSent',
- 80 => 'TimeSent',
- 90 => 'CodedCharacterSet',
- 100 => 'UniqueObjectName',
- 120 => 'ARMIdentifier',
- 122 => 'ARMVersion',
- ),
- 2 => array( // IPTC ApplicationRecord Tags
- 0 => 'ApplicationRecordVersion',
- 3 => 'ObjectTypeReference',
- 4 => 'ObjectAttributeReference',
- 5 => 'ObjectName',
- 7 => 'EditStatus',
- 8 => 'EditorialUpdate',
- 10 => 'Urgency',
- 12 => 'SubjectReference',
- 15 => 'Category',
- 20 => 'SupplementalCategories',
- 22 => 'FixtureIdentifier',
- 25 => 'Keywords',
- 26 => 'ContentLocationCode',
- 27 => 'ContentLocationName',
- 30 => 'ReleaseDate',
- 35 => 'ReleaseTime',
- 37 => 'ExpirationDate',
- 38 => 'ExpirationTime',
- 40 => 'SpecialInstructions',
- 42 => 'ActionAdvised',
- 45 => 'ReferenceService',
- 47 => 'ReferenceDate',
- 50 => 'ReferenceNumber',
- 55 => 'DateCreated',
- 60 => 'TimeCreated',
- 62 => 'DigitalCreationDate',
- 63 => 'DigitalCreationTime',
- 65 => 'OriginatingProgram',
- 70 => 'ProgramVersion',
- 75 => 'ObjectCycle',
- 80 => 'By-line',
- 85 => 'By-lineTitle',
- 90 => 'City',
- 92 => 'Sub-location',
- 95 => 'Province-State',
- 100 => 'Country-PrimaryLocationCode',
- 101 => 'Country-PrimaryLocationName',
- 103 => 'OriginalTransmissionReference',
- 105 => 'Headline',
- 110 => 'Credit',
- 115 => 'Source',
- 116 => 'CopyrightNotice',
- 118 => 'Contact',
- 120 => 'Caption-Abstract',
- 121 => 'LocalCaption',
- 122 => 'Writer-Editor',
- 125 => 'RasterizedCaption',
- 130 => 'ImageType',
- 131 => 'ImageOrientation',
- 135 => 'LanguageIdentifier',
- 150 => 'AudioType',
- 151 => 'AudioSamplingRate',
- 152 => 'AudioSamplingResolution',
- 153 => 'AudioDuration',
- 154 => 'AudioOutcue',
- 184 => 'JobID',
- 185 => 'MasterDocumentID',
- 186 => 'ShortDocumentID',
- 187 => 'UniqueDocumentID',
- 188 => 'OwnerID',
- 200 => 'ObjectPreviewFileFormat',
- 201 => 'ObjectPreviewFileVersion',
- 202 => 'ObjectPreviewData',
- 221 => 'Prefs',
- 225 => 'ClassifyState',
- 228 => 'SimilarityIndex',
- 230 => 'DocumentNotes',
- 231 => 'DocumentHistory',
- 232 => 'ExifCameraInfo',
- ),
- 3 => array( // IPTC NewsPhoto Tags
- 0 => 'NewsPhotoVersion',
- 10 => 'IPTCPictureNumber',
- 20 => 'IPTCImageWidth',
- 30 => 'IPTCImageHeight',
- 40 => 'IPTCPixelWidth',
- 50 => 'IPTCPixelHeight',
- 55 => 'SupplementalType',
- 60 => 'ColorRepresentation',
- 64 => 'InterchangeColorSpace',
- 65 => 'ColorSequence',
- 66 => 'ICC_Profile',
- 70 => 'ColorCalibrationMatrix',
- 80 => 'LookupTable',
- 84 => 'NumIndexEntries',
- 85 => 'ColorPalette',
- 86 => 'IPTCBitsPerSample',
- 90 => 'SampleStructure',
- 100 => 'ScanningDirection',
- 102 => 'IPTCImageRotation',
- 110 => 'DataCompressionMethod',
- 120 => 'QuantizationMethod',
- 125 => 'EndPoints',
- 130 => 'ExcursionTolerance',
- 135 => 'BitsPerComponent',
- 140 => 'MaximumDensityRange',
- 145 => 'GammaCompensatedValue',
- ),
- 7 => array( // IPTC PreObjectData Tags
- 10 => 'SizeMode',
- 20 => 'MaxSubfileSize',
- 90 => 'ObjectSizeAnnounced',
- 95 => 'MaximumObjectSize',
- ),
- 8 => array( // IPTC ObjectData Tags
- 10 => 'SubFile',
- ),
- 9 => array( // IPTC PostObjectData Tags
- 10 => 'ConfirmedObjectSize',
- ),
- );
-
- }
- return (isset($IPTCrecordTagName[$iptc_record][$iptc_tagkey]) ? $IPTCrecordTagName[$iptc_record][$iptc_tagkey] : $iptc_tagkey);
- }
-
-}
-
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.graphic.pcd.php b/3rdparty/getid3/module.graphic.pcd.php
deleted file mode 100644
index dcbc6763630..00000000000
--- a/3rdparty/getid3/module.graphic.pcd.php
+++ /dev/null
@@ -1,134 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.graphic.pcd.php //
-// module for analyzing PhotoCD (PCD) Image files //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_pcd extends getid3_handler
-{
- var $ExtractData = 0;
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- $info['fileformat'] = 'pcd';
- $info['video']['dataformat'] = 'pcd';
- $info['video']['lossless'] = false;
-
-
- fseek($this->getid3->fp, $info['avdataoffset'] + 72, SEEK_SET);
-
- $PCDflags = fread($this->getid3->fp, 1);
- $PCDisVertical = ((ord($PCDflags) & 0x01) ? true : false);
-
-
- if ($PCDisVertical) {
- $info['video']['resolution_x'] = 3072;
- $info['video']['resolution_y'] = 2048;
- } else {
- $info['video']['resolution_x'] = 2048;
- $info['video']['resolution_y'] = 3072;
- }
-
-
- if ($this->ExtractData > 3) {
-
- $info['error'][] = 'Cannot extract PSD image data for detail levels above BASE (level-3) because encrypted with Kodak-proprietary compression/encryption.';
-
- } elseif ($this->ExtractData > 0) {
-
- $PCD_levels[1] = array( 192, 128, 0x02000); // BASE/16
- $PCD_levels[2] = array( 384, 256, 0x0B800); // BASE/4
- $PCD_levels[3] = array( 768, 512, 0x30000); // BASE
- //$PCD_levels[4] = array(1536, 1024, ??); // BASE*4 - encrypted with Kodak-proprietary compression/encryption
- //$PCD_levels[5] = array(3072, 2048, ??); // BASE*16 - encrypted with Kodak-proprietary compression/encryption
- //$PCD_levels[6] = array(6144, 4096, ??); // BASE*64 - encrypted with Kodak-proprietary compression/encryption; PhotoCD-Pro only
-
- list($PCD_width, $PCD_height, $PCD_dataOffset) = $PCD_levels[3];
-
- fseek($this->getid3->fp, $info['avdataoffset'] + $PCD_dataOffset, SEEK_SET);
-
- for ($y = 0; $y < $PCD_height; $y += 2) {
- // The image-data of these subtypes start at the respective offsets of 02000h, 0b800h and 30000h.
- // To decode the YcbYr to the more usual RGB-code, three lines of data have to be read, each
- // consisting of w bytes, where w is the width of the image-subtype. The first w bytes and
- // the first half of the third w bytes contain data for the first RGB-line, the second w bytes
- // and the second half of the third w bytes contain data for a second RGB-line.
-
- $PCD_data_Y1 = fread($this->getid3->fp, $PCD_width);
- $PCD_data_Y2 = fread($this->getid3->fp, $PCD_width);
- $PCD_data_Cb = fread($this->getid3->fp, intval(round($PCD_width / 2)));
- $PCD_data_Cr = fread($this->getid3->fp, intval(round($PCD_width / 2)));
-
- for ($x = 0; $x < $PCD_width; $x++) {
- if ($PCDisVertical) {
- $info['pcd']['data'][$PCD_width - $x][$y] = $this->YCbCr2RGB(ord($PCD_data_Y1{$x}), ord($PCD_data_Cb{floor($x / 2)}), ord($PCD_data_Cr{floor($x / 2)}));
- $info['pcd']['data'][$PCD_width - $x][$y + 1] = $this->YCbCr2RGB(ord($PCD_data_Y2{$x}), ord($PCD_data_Cb{floor($x / 2)}), ord($PCD_data_Cr{floor($x / 2)}));
- } else {
- $info['pcd']['data'][$y][$x] = $this->YCbCr2RGB(ord($PCD_data_Y1{$x}), ord($PCD_data_Cb{floor($x / 2)}), ord($PCD_data_Cr{floor($x / 2)}));
- $info['pcd']['data'][$y + 1][$x] = $this->YCbCr2RGB(ord($PCD_data_Y2{$x}), ord($PCD_data_Cb{floor($x / 2)}), ord($PCD_data_Cr{floor($x / 2)}));
- }
- }
- }
-
- // Example for plotting extracted data
- //getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.ac3.php', __FILE__, true);
- //if ($PCDisVertical) {
- // $BMPinfo['resolution_x'] = $PCD_height;
- // $BMPinfo['resolution_y'] = $PCD_width;
- //} else {
- // $BMPinfo['resolution_x'] = $PCD_width;
- // $BMPinfo['resolution_y'] = $PCD_height;
- //}
- //$BMPinfo['bmp']['data'] = $info['pcd']['data'];
- //getid3_bmp::PlotBMP($BMPinfo);
- //exit;
-
- }
-
- }
-
- function YCbCr2RGB($Y, $Cb, $Cr) {
- static $YCbCr_constants = array();
- if (empty($YCbCr_constants)) {
- $YCbCr_constants['red']['Y'] = 0.0054980 * 256;
- $YCbCr_constants['red']['Cb'] = 0.0000000 * 256;
- $YCbCr_constants['red']['Cr'] = 0.0051681 * 256;
- $YCbCr_constants['green']['Y'] = 0.0054980 * 256;
- $YCbCr_constants['green']['Cb'] = -0.0015446 * 256;
- $YCbCr_constants['green']['Cr'] = -0.0026325 * 256;
- $YCbCr_constants['blue']['Y'] = 0.0054980 * 256;
- $YCbCr_constants['blue']['Cb'] = 0.0079533 * 256;
- $YCbCr_constants['blue']['Cr'] = 0.0000000 * 256;
- }
-
- $RGBcolor = array('red'=>0, 'green'=>0, 'blue'=>0);
- foreach ($RGBcolor as $rgbname => $dummy) {
- $RGBcolor[$rgbname] = max(0,
- min(255,
- intval(
- round(
- ($YCbCr_constants[$rgbname]['Y'] * $Y) +
- ($YCbCr_constants[$rgbname]['Cb'] * ($Cb - 156)) +
- ($YCbCr_constants[$rgbname]['Cr'] * ($Cr - 137))
- )
- )
- )
- );
- }
- return (($RGBcolor['red'] * 65536) + ($RGBcolor['green'] * 256) + $RGBcolor['blue']);
- }
-
-}
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.graphic.png.php b/3rdparty/getid3/module.graphic.png.php
deleted file mode 100644
index 9109c43689c..00000000000
--- a/3rdparty/getid3/module.graphic.png.php
+++ /dev/null
@@ -1,520 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.graphic.png.php //
-// module for analyzing PNG Image files //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_png extends getid3_handler
-{
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- // shortcut
- $info['png'] = array();
- $thisfile_png = &$info['png'];
-
- $info['fileformat'] = 'png';
- $info['video']['dataformat'] = 'png';
- $info['video']['lossless'] = false;
-
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
- $PNGfiledata = fread($this->getid3->fp, $this->getid3->fread_buffer_size());
- $offset = 0;
-
- $PNGidentifier = substr($PNGfiledata, $offset, 8); // $89 $50 $4E $47 $0D $0A $1A $0A
- $offset += 8;
-
- if ($PNGidentifier != "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A") {
- $info['error'][] = 'First 8 bytes of file ('.getid3_lib::PrintHexBytes($PNGidentifier).') did not match expected PNG identifier';
- unset($info['fileformat']);
- return false;
- }
-
- while (((ftell($this->getid3->fp) - (strlen($PNGfiledata) - $offset)) < $info['filesize'])) {
- $chunk['data_length'] = getid3_lib::BigEndian2Int(substr($PNGfiledata, $offset, 4));
- $offset += 4;
- while (((strlen($PNGfiledata) - $offset) < ($chunk['data_length'] + 4)) && (ftell($this->getid3->fp) < $info['filesize'])) {
- $PNGfiledata .= fread($this->getid3->fp, $this->getid3->fread_buffer_size());
- }
- $chunk['type_text'] = substr($PNGfiledata, $offset, 4);
- $offset += 4;
- $chunk['type_raw'] = getid3_lib::BigEndian2Int($chunk['type_text']);
- $chunk['data'] = substr($PNGfiledata, $offset, $chunk['data_length']);
- $offset += $chunk['data_length'];
- $chunk['crc'] = getid3_lib::BigEndian2Int(substr($PNGfiledata, $offset, 4));
- $offset += 4;
-
- $chunk['flags']['ancilliary'] = (bool) ($chunk['type_raw'] & 0x20000000);
- $chunk['flags']['private'] = (bool) ($chunk['type_raw'] & 0x00200000);
- $chunk['flags']['reserved'] = (bool) ($chunk['type_raw'] & 0x00002000);
- $chunk['flags']['safe_to_copy'] = (bool) ($chunk['type_raw'] & 0x00000020);
-
- // shortcut
- $thisfile_png[$chunk['type_text']] = array();
- $thisfile_png_chunk_type_text = &$thisfile_png[$chunk['type_text']];
-
- switch ($chunk['type_text']) {
-
- case 'IHDR': // Image Header
- $thisfile_png_chunk_type_text['header'] = $chunk;
- $thisfile_png_chunk_type_text['width'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 4));
- $thisfile_png_chunk_type_text['height'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 4, 4));
- $thisfile_png_chunk_type_text['raw']['bit_depth'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 8, 1));
- $thisfile_png_chunk_type_text['raw']['color_type'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 9, 1));
- $thisfile_png_chunk_type_text['raw']['compression_method'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 10, 1));
- $thisfile_png_chunk_type_text['raw']['filter_method'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 11, 1));
- $thisfile_png_chunk_type_text['raw']['interlace_method'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 12, 1));
-
- $thisfile_png_chunk_type_text['compression_method_text'] = $this->PNGcompressionMethodLookup($thisfile_png_chunk_type_text['raw']['compression_method']);
- $thisfile_png_chunk_type_text['color_type']['palette'] = (bool) ($thisfile_png_chunk_type_text['raw']['color_type'] & 0x01);
- $thisfile_png_chunk_type_text['color_type']['true_color'] = (bool) ($thisfile_png_chunk_type_text['raw']['color_type'] & 0x02);
- $thisfile_png_chunk_type_text['color_type']['alpha'] = (bool) ($thisfile_png_chunk_type_text['raw']['color_type'] & 0x04);
-
- $info['video']['resolution_x'] = $thisfile_png_chunk_type_text['width'];
- $info['video']['resolution_y'] = $thisfile_png_chunk_type_text['height'];
-
- $info['video']['bits_per_sample'] = $this->IHDRcalculateBitsPerSample($thisfile_png_chunk_type_text['raw']['color_type'], $thisfile_png_chunk_type_text['raw']['bit_depth']);
- break;
-
-
- case 'PLTE': // Palette
- $thisfile_png_chunk_type_text['header'] = $chunk;
- $paletteoffset = 0;
- for ($i = 0; $i <= 255; $i++) {
- //$thisfile_png_chunk_type_text['red'][$i] = getid3_lib::BigEndian2Int(substr($chunk['data'], $paletteoffset++, 1));
- //$thisfile_png_chunk_type_text['green'][$i] = getid3_lib::BigEndian2Int(substr($chunk['data'], $paletteoffset++, 1));
- //$thisfile_png_chunk_type_text['blue'][$i] = getid3_lib::BigEndian2Int(substr($chunk['data'], $paletteoffset++, 1));
- $red = getid3_lib::BigEndian2Int(substr($chunk['data'], $paletteoffset++, 1));
- $green = getid3_lib::BigEndian2Int(substr($chunk['data'], $paletteoffset++, 1));
- $blue = getid3_lib::BigEndian2Int(substr($chunk['data'], $paletteoffset++, 1));
- $thisfile_png_chunk_type_text[$i] = (($red << 16) | ($green << 8) | ($blue));
- }
- break;
-
-
- case 'tRNS': // Transparency
- $thisfile_png_chunk_type_text['header'] = $chunk;
- switch ($thisfile_png['IHDR']['raw']['color_type']) {
- case 0:
- $thisfile_png_chunk_type_text['transparent_color_gray'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 2));
- break;
-
- case 2:
- $thisfile_png_chunk_type_text['transparent_color_red'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 2));
- $thisfile_png_chunk_type_text['transparent_color_green'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 2, 2));
- $thisfile_png_chunk_type_text['transparent_color_blue'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 4, 2));
- break;
-
- case 3:
- for ($i = 0; $i < strlen($chunk['data']); $i++) {
- $thisfile_png_chunk_type_text['palette_opacity'][$i] = getid3_lib::BigEndian2Int(substr($chunk['data'], $i, 1));
- }
- break;
-
- case 4:
- case 6:
- $info['error'][] = 'Invalid color_type in tRNS chunk: '.$thisfile_png['IHDR']['raw']['color_type'];
-
- default:
- $info['warning'][] = 'Unhandled color_type in tRNS chunk: '.$thisfile_png['IHDR']['raw']['color_type'];
- break;
- }
- break;
-
-
- case 'gAMA': // Image Gamma
- $thisfile_png_chunk_type_text['header'] = $chunk;
- $thisfile_png_chunk_type_text['gamma'] = getid3_lib::BigEndian2Int($chunk['data']) / 100000;
- break;
-
-
- case 'cHRM': // Primary Chromaticities
- $thisfile_png_chunk_type_text['header'] = $chunk;
- $thisfile_png_chunk_type_text['white_x'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 4)) / 100000;
- $thisfile_png_chunk_type_text['white_y'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 4, 4)) / 100000;
- $thisfile_png_chunk_type_text['red_y'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 8, 4)) / 100000;
- $thisfile_png_chunk_type_text['red_y'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 12, 4)) / 100000;
- $thisfile_png_chunk_type_text['green_y'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 16, 4)) / 100000;
- $thisfile_png_chunk_type_text['green_y'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 20, 4)) / 100000;
- $thisfile_png_chunk_type_text['blue_y'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 24, 4)) / 100000;
- $thisfile_png_chunk_type_text['blue_y'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 28, 4)) / 100000;
- break;
-
-
- case 'sRGB': // Standard RGB Color Space
- $thisfile_png_chunk_type_text['header'] = $chunk;
- $thisfile_png_chunk_type_text['reindering_intent'] = getid3_lib::BigEndian2Int($chunk['data']);
- $thisfile_png_chunk_type_text['reindering_intent_text'] = $this->PNGsRGBintentLookup($thisfile_png_chunk_type_text['reindering_intent']);
- break;
-
-
- case 'iCCP': // Embedded ICC Profile
- $thisfile_png_chunk_type_text['header'] = $chunk;
- list($profilename, $compressiondata) = explode("\x00", $chunk['data'], 2);
- $thisfile_png_chunk_type_text['profile_name'] = $profilename;
- $thisfile_png_chunk_type_text['compression_method'] = getid3_lib::BigEndian2Int(substr($compressiondata, 0, 1));
- $thisfile_png_chunk_type_text['compression_profile'] = substr($compressiondata, 1);
-
- $thisfile_png_chunk_type_text['compression_method_text'] = $this->PNGcompressionMethodLookup($thisfile_png_chunk_type_text['compression_method']);
- break;
-
-
- case 'tEXt': // Textual Data
- $thisfile_png_chunk_type_text['header'] = $chunk;
- list($keyword, $text) = explode("\x00", $chunk['data'], 2);
- $thisfile_png_chunk_type_text['keyword'] = $keyword;
- $thisfile_png_chunk_type_text['text'] = $text;
-
- $thisfile_png['comments'][$thisfile_png_chunk_type_text['keyword']][] = $thisfile_png_chunk_type_text['text'];
- break;
-
-
- case 'zTXt': // Compressed Textual Data
- $thisfile_png_chunk_type_text['header'] = $chunk;
- list($keyword, $otherdata) = explode("\x00", $chunk['data'], 2);
- $thisfile_png_chunk_type_text['keyword'] = $keyword;
- $thisfile_png_chunk_type_text['compression_method'] = getid3_lib::BigEndian2Int(substr($otherdata, 0, 1));
- $thisfile_png_chunk_type_text['compressed_text'] = substr($otherdata, 1);
- $thisfile_png_chunk_type_text['compression_method_text'] = $this->PNGcompressionMethodLookup($thisfile_png_chunk_type_text['compression_method']);
- switch ($thisfile_png_chunk_type_text['compression_method']) {
- case 0:
- $thisfile_png_chunk_type_text['text'] = gzuncompress($thisfile_png_chunk_type_text['compressed_text']);
- break;
-
- default:
- // unknown compression method
- break;
- }
-
- if (isset($thisfile_png_chunk_type_text['text'])) {
- $thisfile_png['comments'][$thisfile_png_chunk_type_text['keyword']][] = $thisfile_png_chunk_type_text['text'];
- }
- break;
-
-
- case 'iTXt': // International Textual Data
- $thisfile_png_chunk_type_text['header'] = $chunk;
- list($keyword, $otherdata) = explode("\x00", $chunk['data'], 2);
- $thisfile_png_chunk_type_text['keyword'] = $keyword;
- $thisfile_png_chunk_type_text['compression'] = (bool) getid3_lib::BigEndian2Int(substr($otherdata, 0, 1));
- $thisfile_png_chunk_type_text['compression_method'] = getid3_lib::BigEndian2Int(substr($otherdata, 1, 1));
- $thisfile_png_chunk_type_text['compression_method_text'] = $this->PNGcompressionMethodLookup($thisfile_png_chunk_type_text['compression_method']);
- list($languagetag, $translatedkeyword, $text) = explode("\x00", substr($otherdata, 2), 3);
- $thisfile_png_chunk_type_text['language_tag'] = $languagetag;
- $thisfile_png_chunk_type_text['translated_keyword'] = $translatedkeyword;
-
- if ($thisfile_png_chunk_type_text['compression']) {
-
- switch ($thisfile_png_chunk_type_text['compression_method']) {
- case 0:
- $thisfile_png_chunk_type_text['text'] = gzuncompress($text);
- break;
-
- default:
- // unknown compression method
- break;
- }
-
- } else {
-
- $thisfile_png_chunk_type_text['text'] = $text;
-
- }
-
- if (isset($thisfile_png_chunk_type_text['text'])) {
- $thisfile_png['comments'][$thisfile_png_chunk_type_text['keyword']][] = $thisfile_png_chunk_type_text['text'];
- }
- break;
-
-
- case 'bKGD': // Background Color
- $thisfile_png_chunk_type_text['header'] = $chunk;
- switch ($thisfile_png['IHDR']['raw']['color_type']) {
- case 0:
- case 4:
- $thisfile_png_chunk_type_text['background_gray'] = getid3_lib::BigEndian2Int($chunk['data']);
- break;
-
- case 2:
- case 6:
- $thisfile_png_chunk_type_text['background_red'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0 * $thisfile_png['IHDR']['raw']['bit_depth'], $thisfile_png['IHDR']['raw']['bit_depth']));
- $thisfile_png_chunk_type_text['background_green'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 1 * $thisfile_png['IHDR']['raw']['bit_depth'], $thisfile_png['IHDR']['raw']['bit_depth']));
- $thisfile_png_chunk_type_text['background_blue'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 2 * $thisfile_png['IHDR']['raw']['bit_depth'], $thisfile_png['IHDR']['raw']['bit_depth']));
- break;
-
- case 3:
- $thisfile_png_chunk_type_text['background_index'] = getid3_lib::BigEndian2Int($chunk['data']);
- break;
-
- default:
- break;
- }
- break;
-
-
- case 'pHYs': // Physical Pixel Dimensions
- $thisfile_png_chunk_type_text['header'] = $chunk;
- $thisfile_png_chunk_type_text['pixels_per_unit_x'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 4));
- $thisfile_png_chunk_type_text['pixels_per_unit_y'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 4, 4));
- $thisfile_png_chunk_type_text['unit_specifier'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 8, 1));
- $thisfile_png_chunk_type_text['unit'] = $this->PNGpHYsUnitLookup($thisfile_png_chunk_type_text['unit_specifier']);
- break;
-
-
- case 'sBIT': // Significant Bits
- $thisfile_png_chunk_type_text['header'] = $chunk;
- switch ($thisfile_png['IHDR']['raw']['color_type']) {
- case 0:
- $thisfile_png_chunk_type_text['significant_bits_gray'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 1));
- break;
-
- case 2:
- case 3:
- $thisfile_png_chunk_type_text['significant_bits_red'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 1));
- $thisfile_png_chunk_type_text['significant_bits_green'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 1, 1));
- $thisfile_png_chunk_type_text['significant_bits_blue'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 2, 1));
- break;
-
- case 4:
- $thisfile_png_chunk_type_text['significant_bits_gray'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 1));
- $thisfile_png_chunk_type_text['significant_bits_alpha'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 1, 1));
- break;
-
- case 6:
- $thisfile_png_chunk_type_text['significant_bits_red'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 1));
- $thisfile_png_chunk_type_text['significant_bits_green'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 1, 1));
- $thisfile_png_chunk_type_text['significant_bits_blue'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 2, 1));
- $thisfile_png_chunk_type_text['significant_bits_alpha'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 3, 1));
- break;
-
- default:
- break;
- }
- break;
-
-
- case 'sPLT': // Suggested Palette
- $thisfile_png_chunk_type_text['header'] = $chunk;
- list($palettename, $otherdata) = explode("\x00", $chunk['data'], 2);
- $thisfile_png_chunk_type_text['palette_name'] = $palettename;
- $sPLToffset = 0;
- $thisfile_png_chunk_type_text['sample_depth_bits'] = getid3_lib::BigEndian2Int(substr($otherdata, $sPLToffset, 1));
- $sPLToffset += 1;
- $thisfile_png_chunk_type_text['sample_depth_bytes'] = $thisfile_png_chunk_type_text['sample_depth_bits'] / 8;
- $paletteCounter = 0;
- while ($sPLToffset < strlen($otherdata)) {
- $thisfile_png_chunk_type_text['red'][$paletteCounter] = getid3_lib::BigEndian2Int(substr($otherdata, $sPLToffset, $thisfile_png_chunk_type_text['sample_depth_bytes']));
- $sPLToffset += $thisfile_png_chunk_type_text['sample_depth_bytes'];
- $thisfile_png_chunk_type_text['green'][$paletteCounter] = getid3_lib::BigEndian2Int(substr($otherdata, $sPLToffset, $thisfile_png_chunk_type_text['sample_depth_bytes']));
- $sPLToffset += $thisfile_png_chunk_type_text['sample_depth_bytes'];
- $thisfile_png_chunk_type_text['blue'][$paletteCounter] = getid3_lib::BigEndian2Int(substr($otherdata, $sPLToffset, $thisfile_png_chunk_type_text['sample_depth_bytes']));
- $sPLToffset += $thisfile_png_chunk_type_text['sample_depth_bytes'];
- $thisfile_png_chunk_type_text['alpha'][$paletteCounter] = getid3_lib::BigEndian2Int(substr($otherdata, $sPLToffset, $thisfile_png_chunk_type_text['sample_depth_bytes']));
- $sPLToffset += $thisfile_png_chunk_type_text['sample_depth_bytes'];
- $thisfile_png_chunk_type_text['frequency'][$paletteCounter] = getid3_lib::BigEndian2Int(substr($otherdata, $sPLToffset, 2));
- $sPLToffset += 2;
- $paletteCounter++;
- }
- break;
-
-
- case 'hIST': // Palette Histogram
- $thisfile_png_chunk_type_text['header'] = $chunk;
- $hISTcounter = 0;
- while ($hISTcounter < strlen($chunk['data'])) {
- $thisfile_png_chunk_type_text[$hISTcounter] = getid3_lib::BigEndian2Int(substr($chunk['data'], $hISTcounter / 2, 2));
- $hISTcounter += 2;
- }
- break;
-
-
- case 'tIME': // Image Last-Modification Time
- $thisfile_png_chunk_type_text['header'] = $chunk;
- $thisfile_png_chunk_type_text['year'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 2));
- $thisfile_png_chunk_type_text['month'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 2, 1));
- $thisfile_png_chunk_type_text['day'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 3, 1));
- $thisfile_png_chunk_type_text['hour'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 4, 1));
- $thisfile_png_chunk_type_text['minute'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 5, 1));
- $thisfile_png_chunk_type_text['second'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 6, 1));
- $thisfile_png_chunk_type_text['unix'] = gmmktime($thisfile_png_chunk_type_text['hour'], $thisfile_png_chunk_type_text['minute'], $thisfile_png_chunk_type_text['second'], $thisfile_png_chunk_type_text['month'], $thisfile_png_chunk_type_text['day'], $thisfile_png_chunk_type_text['year']);
- break;
-
-
- case 'oFFs': // Image Offset
- $thisfile_png_chunk_type_text['header'] = $chunk;
- $thisfile_png_chunk_type_text['position_x'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 4), false, true);
- $thisfile_png_chunk_type_text['position_y'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 4, 4), false, true);
- $thisfile_png_chunk_type_text['unit_specifier'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 8, 1));
- $thisfile_png_chunk_type_text['unit'] = $this->PNGoFFsUnitLookup($thisfile_png_chunk_type_text['unit_specifier']);
- break;
-
-
- case 'pCAL': // Calibration Of Pixel Values
- $thisfile_png_chunk_type_text['header'] = $chunk;
- list($calibrationname, $otherdata) = explode("\x00", $chunk['data'], 2);
- $thisfile_png_chunk_type_text['calibration_name'] = $calibrationname;
- $pCALoffset = 0;
- $thisfile_png_chunk_type_text['original_zero'] = getid3_lib::BigEndian2Int(substr($chunk['data'], $pCALoffset, 4), false, true);
- $pCALoffset += 4;
- $thisfile_png_chunk_type_text['original_max'] = getid3_lib::BigEndian2Int(substr($chunk['data'], $pCALoffset, 4), false, true);
- $pCALoffset += 4;
- $thisfile_png_chunk_type_text['equation_type'] = getid3_lib::BigEndian2Int(substr($chunk['data'], $pCALoffset, 1));
- $pCALoffset += 1;
- $thisfile_png_chunk_type_text['equation_type_text'] = $this->PNGpCALequationTypeLookup($thisfile_png_chunk_type_text['equation_type']);
- $thisfile_png_chunk_type_text['parameter_count'] = getid3_lib::BigEndian2Int(substr($chunk['data'], $pCALoffset, 1));
- $pCALoffset += 1;
- $thisfile_png_chunk_type_text['parameters'] = explode("\x00", substr($chunk['data'], $pCALoffset));
- break;
-
-
- case 'sCAL': // Physical Scale Of Image Subject
- $thisfile_png_chunk_type_text['header'] = $chunk;
- $thisfile_png_chunk_type_text['unit_specifier'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 1));
- $thisfile_png_chunk_type_text['unit'] = $this->PNGsCALUnitLookup($thisfile_png_chunk_type_text['unit_specifier']);
- list($pixelwidth, $pixelheight) = explode("\x00", substr($chunk['data'], 1));
- $thisfile_png_chunk_type_text['pixel_width'] = $pixelwidth;
- $thisfile_png_chunk_type_text['pixel_height'] = $pixelheight;
- break;
-
-
- case 'gIFg': // GIF Graphic Control Extension
- $gIFgCounter = 0;
- if (isset($thisfile_png_chunk_type_text) && is_array($thisfile_png_chunk_type_text)) {
- $gIFgCounter = count($thisfile_png_chunk_type_text);
- }
- $thisfile_png_chunk_type_text[$gIFgCounter]['header'] = $chunk;
- $thisfile_png_chunk_type_text[$gIFgCounter]['disposal_method'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 0, 1));
- $thisfile_png_chunk_type_text[$gIFgCounter]['user_input_flag'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 1, 1));
- $thisfile_png_chunk_type_text[$gIFgCounter]['delay_time'] = getid3_lib::BigEndian2Int(substr($chunk['data'], 2, 2));
- break;
-
-
- case 'gIFx': // GIF Application Extension
- $gIFxCounter = 0;
- if (isset($thisfile_png_chunk_type_text) && is_array($thisfile_png_chunk_type_text)) {
- $gIFxCounter = count($thisfile_png_chunk_type_text);
- }
- $thisfile_png_chunk_type_text[$gIFxCounter]['header'] = $chunk;
- $thisfile_png_chunk_type_text[$gIFxCounter]['application_identifier'] = substr($chunk['data'], 0, 8);
- $thisfile_png_chunk_type_text[$gIFxCounter]['authentication_code'] = substr($chunk['data'], 8, 3);
- $thisfile_png_chunk_type_text[$gIFxCounter]['application_data'] = substr($chunk['data'], 11);
- break;
-
-
- case 'IDAT': // Image Data
- $idatinformationfieldindex = 0;
- if (isset($thisfile_png['IDAT']) && is_array($thisfile_png['IDAT'])) {
- $idatinformationfieldindex = count($thisfile_png['IDAT']);
- }
- unset($chunk['data']);
- $thisfile_png_chunk_type_text[$idatinformationfieldindex]['header'] = $chunk;
- break;
-
-
- case 'IEND': // Image Trailer
- $thisfile_png_chunk_type_text['header'] = $chunk;
- break;
-
-
- default:
- //unset($chunk['data']);
- $thisfile_png_chunk_type_text['header'] = $chunk;
- $info['warning'][] = 'Unhandled chunk type: '.$chunk['type_text'];
- break;
- }
- }
-
- return true;
- }
-
- function PNGsRGBintentLookup($sRGB) {
- static $PNGsRGBintentLookup = array(
- 0 => 'Perceptual',
- 1 => 'Relative colorimetric',
- 2 => 'Saturation',
- 3 => 'Absolute colorimetric'
- );
- return (isset($PNGsRGBintentLookup[$sRGB]) ? $PNGsRGBintentLookup[$sRGB] : 'invalid');
- }
-
- function PNGcompressionMethodLookup($compressionmethod) {
- static $PNGcompressionMethodLookup = array(
- 0 => 'deflate/inflate'
- );
- return (isset($PNGcompressionMethodLookup[$compressionmethod]) ? $PNGcompressionMethodLookup[$compressionmethod] : 'invalid');
- }
-
- function PNGpHYsUnitLookup($unitid) {
- static $PNGpHYsUnitLookup = array(
- 0 => 'unknown',
- 1 => 'meter'
- );
- return (isset($PNGpHYsUnitLookup[$unitid]) ? $PNGpHYsUnitLookup[$unitid] : 'invalid');
- }
-
- function PNGoFFsUnitLookup($unitid) {
- static $PNGoFFsUnitLookup = array(
- 0 => 'pixel',
- 1 => 'micrometer'
- );
- return (isset($PNGoFFsUnitLookup[$unitid]) ? $PNGoFFsUnitLookup[$unitid] : 'invalid');
- }
-
- function PNGpCALequationTypeLookup($equationtype) {
- static $PNGpCALequationTypeLookup = array(
- 0 => 'Linear mapping',
- 1 => 'Base-e exponential mapping',
- 2 => 'Arbitrary-base exponential mapping',
- 3 => 'Hyperbolic mapping'
- );
- return (isset($PNGpCALequationTypeLookup[$equationtype]) ? $PNGpCALequationTypeLookup[$equationtype] : 'invalid');
- }
-
- function PNGsCALUnitLookup($unitid) {
- static $PNGsCALUnitLookup = array(
- 0 => 'meter',
- 1 => 'radian'
- );
- return (isset($PNGsCALUnitLookup[$unitid]) ? $PNGsCALUnitLookup[$unitid] : 'invalid');
- }
-
- function IHDRcalculateBitsPerSample($color_type, $bit_depth) {
- switch ($color_type) {
- case 0: // Each pixel is a grayscale sample.
- return $bit_depth;
- break;
-
- case 2: // Each pixel is an R,G,B triple
- return 3 * $bit_depth;
- break;
-
- case 3: // Each pixel is a palette index; a PLTE chunk must appear.
- return $bit_depth;
- break;
-
- case 4: // Each pixel is a grayscale sample, followed by an alpha sample.
- return 2 * $bit_depth;
- break;
-
- case 6: // Each pixel is an R,G,B triple, followed by an alpha sample.
- return 4 * $bit_depth;
- break;
- }
- return false;
- }
-
-}
-
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.graphic.svg.php b/3rdparty/getid3/module.graphic.svg.php
deleted file mode 100644
index d9d52d74d01..00000000000
--- a/3rdparty/getid3/module.graphic.svg.php
+++ /dev/null
@@ -1,104 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.graphic.svg.php //
-// module for analyzing SVG Image files //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_svg extends getid3_handler
-{
-
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
-
- $SVGheader = fread($this->getid3->fp, 4096);
- if (preg_match('#\<\?xml([^\>]+)\?\>#i', $SVGheader, $matches)) {
- $info['svg']['xml']['raw'] = $matches;
- }
- if (preg_match('#\<\!DOCTYPE([^\>]+)\>#i', $SVGheader, $matches)) {
- $info['svg']['doctype']['raw'] = $matches;
- }
- if (preg_match('#\<svg([^\>]+)\>#i', $SVGheader, $matches)) {
- $info['svg']['svg']['raw'] = $matches;
- }
- if (isset($info['svg']['svg']['raw'])) {
-
- $sections_to_fix = array('xml', 'doctype', 'svg');
- foreach ($sections_to_fix as $section_to_fix) {
- if (!isset($info['svg'][$section_to_fix])) {
- continue;
- }
- $section_data = array();
- while (preg_match('/ "([^"]+)"/', $info['svg'][$section_to_fix]['raw'][1], $matches)) {
- $section_data[] = $matches[1];
- $info['svg'][$section_to_fix]['raw'][1] = str_replace($matches[0], '', $info['svg'][$section_to_fix]['raw'][1]);
- }
- while (preg_match('/([^\s]+)="([^"]+)"/', $info['svg'][$section_to_fix]['raw'][1], $matches)) {
- $section_data[] = $matches[0];
- $info['svg'][$section_to_fix]['raw'][1] = str_replace($matches[0], '', $info['svg'][$section_to_fix]['raw'][1]);
- }
- $section_data = array_merge($section_data, preg_split('/[\s,]+/', $info['svg'][$section_to_fix]['raw'][1]));
- foreach ($section_data as $keyvaluepair) {
- $keyvaluepair = trim($keyvaluepair);
- if ($keyvaluepair) {
- $keyvalueexploded = explode('=', $keyvaluepair);
- $key = (isset($keyvalueexploded[0]) ? $keyvalueexploded[0] : '');
- $value = (isset($keyvalueexploded[1]) ? $keyvalueexploded[1] : '');
- $info['svg'][$section_to_fix]['sections'][$key] = trim($value, '"');
- }
- }
- }
-
- $info['fileformat'] = 'svg';
- $info['video']['dataformat'] = 'svg';
- $info['video']['lossless'] = true;
- //$info['video']['bits_per_sample'] = 24;
- $info['video']['pixel_aspect_ratio'] = (float) 1;
-
- if (!empty($info['svg']['svg']['sections']['width'])) {
- $info['svg']['width'] = intval($info['svg']['svg']['sections']['width']);
- }
- if (!empty($info['svg']['svg']['sections']['height'])) {
- $info['svg']['height'] = intval($info['svg']['svg']['sections']['height']);
- }
- if (!empty($info['svg']['svg']['sections']['version'])) {
- $info['svg']['version'] = $info['svg']['svg']['sections']['version'];
- }
- if (!isset($info['svg']['version']) && isset($info['svg']['doctype']['sections'])) {
- foreach ($info['svg']['doctype']['sections'] as $key => $value) {
- if (preg_match('#//W3C//DTD SVG ([0-9\.]+)//#i', $key, $matches)) {
- $info['svg']['version'] = $matches[1];
- break;
- }
- }
- }
-
- if (!empty($info['svg']['width'])) {
- $info['video']['resolution_x'] = $info['svg']['width'];
- }
- if (!empty($info['svg']['height'])) {
- $info['video']['resolution_y'] = $info['svg']['height'];
- }
-
- return true;
- }
- $info['error'][] = 'Did not find expected <svg> tag';
- return false;
- }
-
-}
-
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.graphic.tiff.php b/3rdparty/getid3/module.graphic.tiff.php
deleted file mode 100644
index e977124216a..00000000000
--- a/3rdparty/getid3/module.graphic.tiff.php
+++ /dev/null
@@ -1,227 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.archive.tiff.php //
-// module for analyzing TIFF files //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_tiff extends getid3_handler
-{
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
- $TIFFheader = fread($this->getid3->fp, 4);
-
- switch (substr($TIFFheader, 0, 2)) {
- case 'II':
- $info['tiff']['byte_order'] = 'Intel';
- break;
- case 'MM':
- $info['tiff']['byte_order'] = 'Motorola';
- break;
- default:
- $info['error'][] = 'Invalid TIFF byte order identifier ('.substr($TIFFheader, 0, 2).') at offset '.$info['avdataoffset'];
- return false;
- break;
- }
-
- $info['fileformat'] = 'tiff';
- $info['video']['dataformat'] = 'tiff';
- $info['video']['lossless'] = true;
- $info['tiff']['ifd'] = array();
- $CurrentIFD = array();
-
- $FieldTypeByteLength = array(1=>1, 2=>1, 3=>2, 4=>4, 5=>8);
-
- $nextIFDoffset = $this->TIFFendian2Int(fread($this->getid3->fp, 4), $info['tiff']['byte_order']);
-
- while ($nextIFDoffset > 0) {
-
- $CurrentIFD['offset'] = $nextIFDoffset;
-
- fseek($this->getid3->fp, $info['avdataoffset'] + $nextIFDoffset, SEEK_SET);
- $CurrentIFD['fieldcount'] = $this->TIFFendian2Int(fread($this->getid3->fp, 2), $info['tiff']['byte_order']);
-
- for ($i = 0; $i < $CurrentIFD['fieldcount']; $i++) {
- $CurrentIFD['fields'][$i]['raw']['tag'] = $this->TIFFendian2Int(fread($this->getid3->fp, 2), $info['tiff']['byte_order']);
- $CurrentIFD['fields'][$i]['raw']['type'] = $this->TIFFendian2Int(fread($this->getid3->fp, 2), $info['tiff']['byte_order']);
- $CurrentIFD['fields'][$i]['raw']['length'] = $this->TIFFendian2Int(fread($this->getid3->fp, 4), $info['tiff']['byte_order']);
- $CurrentIFD['fields'][$i]['raw']['offset'] = fread($this->getid3->fp, 4);
-
- switch ($CurrentIFD['fields'][$i]['raw']['type']) {
- case 1: // BYTE An 8-bit unsigned integer.
- if ($CurrentIFD['fields'][$i]['raw']['length'] <= 4) {
- $CurrentIFD['fields'][$i]['value'] = $this->TIFFendian2Int(substr($CurrentIFD['fields'][$i]['raw']['offset'], 0, 1), $info['tiff']['byte_order']);
- } else {
- $CurrentIFD['fields'][$i]['offset'] = $this->TIFFendian2Int($CurrentIFD['fields'][$i]['raw']['offset'], $info['tiff']['byte_order']);
- }
- break;
-
- case 2: // ASCII 8-bit bytes that store ASCII codes; the last byte must be null.
- if ($CurrentIFD['fields'][$i]['raw']['length'] <= 4) {
- $CurrentIFD['fields'][$i]['value'] = substr($CurrentIFD['fields'][$i]['raw']['offset'], 3);
- } else {
- $CurrentIFD['fields'][$i]['offset'] = $this->TIFFendian2Int($CurrentIFD['fields'][$i]['raw']['offset'], $info['tiff']['byte_order']);
- }
- break;
-
- case 3: // SHORT A 16-bit (2-byte) unsigned integer.
- if ($CurrentIFD['fields'][$i]['raw']['length'] <= 2) {
- $CurrentIFD['fields'][$i]['value'] = $this->TIFFendian2Int(substr($CurrentIFD['fields'][$i]['raw']['offset'], 0, 2), $info['tiff']['byte_order']);
- } else {
- $CurrentIFD['fields'][$i]['offset'] = $this->TIFFendian2Int($CurrentIFD['fields'][$i]['raw']['offset'], $info['tiff']['byte_order']);
- }
- break;
-
- case 4: // LONG A 32-bit (4-byte) unsigned integer.
- if ($CurrentIFD['fields'][$i]['raw']['length'] <= 1) {
- $CurrentIFD['fields'][$i]['value'] = $this->TIFFendian2Int($CurrentIFD['fields'][$i]['raw']['offset'], $info['tiff']['byte_order']);
- } else {
- $CurrentIFD['fields'][$i]['offset'] = $this->TIFFendian2Int($CurrentIFD['fields'][$i]['raw']['offset'], $info['tiff']['byte_order']);
- }
- break;
-
- case 5: // RATIONAL Two LONG_s: the first represents the numerator of a fraction, the second the denominator.
- break;
- }
- }
-
- $info['tiff']['ifd'][] = $CurrentIFD;
- $CurrentIFD = array();
- $nextIFDoffset = $this->TIFFendian2Int(fread($this->getid3->fp, 4), $info['tiff']['byte_order']);
-
- }
-
- foreach ($info['tiff']['ifd'] as $IFDid => $IFDarray) {
- foreach ($IFDarray['fields'] as $key => $fieldarray) {
- switch ($fieldarray['raw']['tag']) {
- case 256: // ImageWidth
- case 257: // ImageLength
- case 258: // BitsPerSample
- case 259: // Compression
- if (!isset($fieldarray['value'])) {
- fseek($this->getid3->fp, $fieldarray['offset'], SEEK_SET);
- $info['tiff']['ifd'][$IFDid]['fields'][$key]['raw']['data'] = fread($this->getid3->fp, $fieldarray['raw']['length'] * $FieldTypeByteLength[$fieldarray['raw']['type']]);
-
- }
- break;
-
- case 270: // ImageDescription
- case 271: // Make
- case 272: // Model
- case 305: // Software
- case 306: // DateTime
- case 315: // Artist
- case 316: // HostComputer
- if (isset($fieldarray['value'])) {
- $info['tiff']['ifd'][$IFDid]['fields'][$key]['raw']['data'] = $fieldarray['value'];
- } else {
- fseek($this->getid3->fp, $fieldarray['offset'], SEEK_SET);
- $info['tiff']['ifd'][$IFDid]['fields'][$key]['raw']['data'] = fread($this->getid3->fp, $fieldarray['raw']['length'] * $FieldTypeByteLength[$fieldarray['raw']['type']]);
-
- }
- break;
- }
- switch ($fieldarray['raw']['tag']) {
- case 256: // ImageWidth
- $info['video']['resolution_x'] = $fieldarray['value'];
- break;
-
- case 257: // ImageLength
- $info['video']['resolution_y'] = $fieldarray['value'];
- break;
-
- case 258: // BitsPerSample
- if (isset($fieldarray['value'])) {
- $info['video']['bits_per_sample'] = $fieldarray['value'];
- } else {
- $info['video']['bits_per_sample'] = 0;
- for ($i = 0; $i < $fieldarray['raw']['length']; $i++) {
- $info['video']['bits_per_sample'] += $this->TIFFendian2Int(substr($info['tiff']['ifd'][$IFDid]['fields'][$key]['raw']['data'], $i * $FieldTypeByteLength[$fieldarray['raw']['type']], $FieldTypeByteLength[$fieldarray['raw']['type']]), $info['tiff']['byte_order']);
- }
- }
- break;
-
- case 259: // Compression
- $info['video']['codec'] = $this->TIFFcompressionMethod($fieldarray['value']);
- break;
-
- case 270: // ImageDescription
- case 271: // Make
- case 272: // Model
- case 305: // Software
- case 306: // DateTime
- case 315: // Artist
- case 316: // HostComputer
- $TIFFcommentName = $this->TIFFcommentName($fieldarray['raw']['tag']);
- if (isset($info['tiff']['comments'][$TIFFcommentName])) {
- $info['tiff']['comments'][$TIFFcommentName][] = $info['tiff']['ifd'][$IFDid]['fields'][$key]['raw']['data'];
- } else {
- $info['tiff']['comments'][$TIFFcommentName] = array($info['tiff']['ifd'][$IFDid]['fields'][$key]['raw']['data']);
- }
- break;
-
- default:
- break;
- }
- }
- }
-
- return true;
- }
-
-
- function TIFFendian2Int($bytestring, $byteorder) {
- if ($byteorder == 'Intel') {
- return getid3_lib::LittleEndian2Int($bytestring);
- } elseif ($byteorder == 'Motorola') {
- return getid3_lib::BigEndian2Int($bytestring);
- }
- return false;
- }
-
- function TIFFcompressionMethod($id) {
- static $TIFFcompressionMethod = array();
- if (empty($TIFFcompressionMethod)) {
- $TIFFcompressionMethod = array(
- 1 => 'Uncompressed',
- 2 => 'Huffman',
- 3 => 'Fax - CCITT 3',
- 5 => 'LZW',
- 32773 => 'PackBits',
- );
- }
- return (isset($TIFFcompressionMethod[$id]) ? $TIFFcompressionMethod[$id] : 'unknown/invalid ('.$id.')');
- }
-
- function TIFFcommentName($id) {
- static $TIFFcommentName = array();
- if (empty($TIFFcommentName)) {
- $TIFFcommentName = array(
- 270 => 'imagedescription',
- 271 => 'make',
- 272 => 'model',
- 305 => 'software',
- 306 => 'datetime',
- 315 => 'artist',
- 316 => 'hostcomputer',
- );
- }
- return (isset($TIFFcommentName[$id]) ? $TIFFcommentName[$id] : 'unknown/invalid ('.$id.')');
- }
-
-}
-
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.misc.cue.php b/3rdparty/getid3/module.misc.cue.php
deleted file mode 100644
index c99ce247984..00000000000
--- a/3rdparty/getid3/module.misc.cue.php
+++ /dev/null
@@ -1,312 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.misc.cue.php //
-// module for analyzing CUEsheet files //
-// dependencies: NONE //
-// //
-/////////////////////////////////////////////////////////////////
-// //
-// Module originally written [2009-Mar-25] by //
-// Nigel Barnes <ngbarneshotmail*com> //
-// Minor reformatting and similar small changes to integrate //
-// into getID3 by James Heinrich <info@getid3.org> //
-// ///
-/////////////////////////////////////////////////////////////////
-
-/*
- * CueSheet parser by Nigel Barnes.
- *
- * This is a PHP conversion of CueSharp 0.5 by Wyatt O'Day (wyday.com/cuesharp)
- */
-
-/**
- * A CueSheet class used to open and parse cuesheets.
- *
- */
-class getid3_cue extends getid3_handler
-{
- var $cuesheet = array();
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- $info['fileformat'] = 'cue';
- $this->readCueSheetFilename($info['filenamepath']);
- $info['cue'] = $this->cuesheet;
- return true;
- }
-
-
-
- function readCueSheetFilename($filename)
- {
- $filedata = file_get_contents($filename);
- return $this->readCueSheet($filedata);
- }
- /**
- * Parses a cue sheet file.
- *
- * @param string $filename - The filename for the cue sheet to open.
- */
- function readCueSheet(&$filedata)
- {
- $cue_lines = array();
- foreach (explode("\n", str_replace("\r", null, $filedata)) as $line)
- {
- if ( (strlen($line) > 0) && ($line[0] != '#'))
- {
- $cue_lines[] = trim($line);
- }
- }
- $this->parseCueSheet($cue_lines);
-
- return $this->cuesheet;
- }
-
- /**
- * Parses the cue sheet array.
- *
- * @param array $file - The cuesheet as an array of each line.
- */
- function parseCueSheet($file)
- {
- //-1 means still global, all others are track specific
- $track_on = -1;
-
- for ($i=0; $i < count($file); $i++)
- {
- list($key) = explode(' ', strtolower($file[$i]), 2);
- switch ($key)
- {
- case 'catalog':
- case 'cdtextfile':
- case 'isrc':
- case 'performer':
- case 'songwriter':
- case 'title':
- $this->parseString($file[$i], $track_on);
- break;
- case 'file':
- $currentFile = $this->parseFile($file[$i]);
- break;
- case 'flags':
- $this->parseFlags($file[$i], $track_on);
- break;
- case 'index':
- case 'postgap':
- case 'pregap':
- $this->parseIndex($file[$i], $track_on);
- break;
- case 'rem':
- $this->parseComment($file[$i], $track_on);
- break;
- case 'track':
- $track_on++;
- $this->parseTrack($file[$i], $track_on);
- if (isset($currentFile)) // if there's a file
- {
- $this->cuesheet['tracks'][$track_on]['datafile'] = $currentFile;
- }
- break;
- default:
- //save discarded junk and place string[] with track it was found in
- $this->parseGarbage($file[$i], $track_on);
- break;
- }
- }
- }
-
- /**
- * Parses the REM command.
- *
- * @param string $line - The line in the cue file that contains the TRACK command.
- * @param integer $track_on - The track currently processing.
- */
- function parseComment($line, $track_on)
- {
- $explodedline = explode(' ', $line, 3);
- $comment_REM = (isset($explodedline[0]) ? $explodedline[0] : '');
- $comment_type = (isset($explodedline[1]) ? $explodedline[1] : '');
- $comment_data = (isset($explodedline[2]) ? $explodedline[2] : '');
- if (($comment_REM == 'REM') && $comment_type) {
- $comment_type = strtolower($comment_type);
- $commment_data = trim($comment_data, ' "');
- if ($track_on != -1) {
- $this->cuesheet['tracks'][$track_on]['comments'][$comment_type][] = $comment_data;
- } else {
- $this->cuesheet['comments'][$comment_type][] = $comment_data;
- }
- }
- }
-
- /**
- * Parses the FILE command.
- *
- * @param string $line - The line in the cue file that contains the FILE command.
- * @return array - Array of FILENAME and TYPE of file..
- */
- function parseFile($line)
- {
- $line = substr($line, strpos($line, ' ') + 1);
- $type = strtolower(substr($line, strrpos($line, ' ')));
-
- //remove type
- $line = substr($line, 0, strrpos($line, ' ') - 1);
-
- //if quotes around it, remove them.
- $line = trim($line, '"');
-
- return array('filename'=>$line, 'type'=>$type);
- }
-
- /**
- * Parses the FLAG command.
- *
- * @param string $line - The line in the cue file that contains the TRACK command.
- * @param integer $track_on - The track currently processing.
- */
- function parseFlags($line, $track_on)
- {
- if ($track_on != -1)
- {
- foreach (explode(' ', strtolower($line)) as $type)
- {
- switch ($type)
- {
- case 'flags':
- // first entry in this line
- $this->cuesheet['tracks'][$track_on]['flags'] = array(
- '4ch' => false,
- 'data' => false,
- 'dcp' => false,
- 'pre' => false,
- 'scms' => false,
- );
- break;
- case 'data':
- case 'dcp':
- case '4ch':
- case 'pre':
- case 'scms':
- $this->cuesheet['tracks'][$track_on]['flags'][$type] = true;
- break;
- default:
- break;
- }
- }
- }
- }
-
- /**
- * Collect any unidentified data.
- *
- * @param string $line - The line in the cue file that contains the TRACK command.
- * @param integer $track_on - The track currently processing.
- */
- function parseGarbage($line, $track_on)
- {
- if ( strlen($line) > 0 )
- {
- if ($track_on == -1)
- {
- $this->cuesheet['garbage'][] = $line;
- }
- else
- {
- $this->cuesheet['tracks'][$track_on]['garbage'][] = $line;
- }
- }
- }
-
- /**
- * Parses the INDEX command of a TRACK.
- *
- * @param string $line - The line in the cue file that contains the TRACK command.
- * @param integer $track_on - The track currently processing.
- */
- function parseIndex($line, $track_on)
- {
- $type = strtolower(substr($line, 0, strpos($line, ' ')));
- $line = substr($line, strpos($line, ' ') + 1);
-
- if ($type == 'index')
- {
- //read the index number
- $number = intval(substr($line, 0, strpos($line, ' ')));
- $line = substr($line, strpos($line, ' ') + 1);
- }
-
- //extract the minutes, seconds, and frames
- $explodedline = explode(':', $line);
- $minutes = (isset($explodedline[0]) ? $explodedline[0] : '');
- $seconds = (isset($explodedline[1]) ? $explodedline[1] : '');
- $frames = (isset($explodedline[2]) ? $explodedline[2] : '');
-
- switch ($type) {
- case 'index':
- $this->cuesheet['tracks'][$track_on][$type][$number] = array('minutes'=>intval($minutes), 'seconds'=>intval($seconds), 'frames'=>intval($frames));
- break;
- case 'pregap':
- case 'postgap':
- $this->cuesheet['tracks'][$track_on][$type] = array('minutes'=>intval($minutes), 'seconds'=>intval($seconds), 'frames'=>intval($frames));
- break;
- }
- }
-
- function parseString($line, $track_on)
- {
- $category = strtolower(substr($line, 0, strpos($line, ' ')));
- $line = substr($line, strpos($line, ' ') + 1);
-
- //get rid of the quotes
- $line = trim($line, '"');
-
- switch ($category)
- {
- case 'catalog':
- case 'cdtextfile':
- case 'isrc':
- case 'performer':
- case 'songwriter':
- case 'title':
- if ($track_on == -1)
- {
- $this->cuesheet[$category] = $line;
- }
- else
- {
- $this->cuesheet['tracks'][$track_on][$category] = $line;
- }
- break;
- default:
- break;
- }
- }
-
- /**
- * Parses the TRACK command.
- *
- * @param string $line - The line in the cue file that contains the TRACK command.
- * @param integer $track_on - The track currently processing.
- */
- function parseTrack($line, $track_on)
- {
- $line = substr($line, strpos($line, ' ') + 1);
- $track = ltrim(substr($line, 0, strpos($line, ' ')), '0');
-
- //find the data type.
- $datatype = strtolower(substr($line, strpos($line, ' ') + 1));
-
- $this->cuesheet['tracks'][$track_on] = array('track_number'=>$track, 'datatype'=>$datatype);
- }
-
-}
-
-?>
diff --git a/3rdparty/getid3/module.misc.exe.php b/3rdparty/getid3/module.misc.exe.php
deleted file mode 100644
index 108e62ecd7b..00000000000
--- a/3rdparty/getid3/module.misc.exe.php
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.misc.exe.php //
-// module for analyzing EXE files //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_exe extends getid3_handler
-{
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
- $EXEheader = fread($this->getid3->fp, 28);
-
- $magic = 'MZ';
- if (substr($EXEheader, 0, 2) != $magic) {
- $info['error'][] = 'Expecting "'.getid3_lib::PrintHexBytes($magic).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes(substr($EXEheader, 0, 2)).'"';
- return false;
- }
-
- $info['fileformat'] = 'exe';
- $info['exe']['mz']['magic'] = 'MZ';
-
- $info['exe']['mz']['raw']['last_page_size'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 2, 2));
- $info['exe']['mz']['raw']['page_count'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 4, 2));
- $info['exe']['mz']['raw']['relocation_count'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 6, 2));
- $info['exe']['mz']['raw']['header_paragraphs'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 8, 2));
- $info['exe']['mz']['raw']['min_memory_paragraphs'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 10, 2));
- $info['exe']['mz']['raw']['max_memory_paragraphs'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 12, 2));
- $info['exe']['mz']['raw']['initial_ss'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 14, 2));
- $info['exe']['mz']['raw']['initial_sp'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 16, 2));
- $info['exe']['mz']['raw']['checksum'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 18, 2));
- $info['exe']['mz']['raw']['cs_ip'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 20, 4));
- $info['exe']['mz']['raw']['relocation_table_offset'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 24, 2));
- $info['exe']['mz']['raw']['overlay_number'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 26, 2));
-
- $info['exe']['mz']['byte_size'] = (($info['exe']['mz']['raw']['page_count'] - 1)) * 512 + $info['exe']['mz']['raw']['last_page_size'];
- $info['exe']['mz']['header_size'] = $info['exe']['mz']['raw']['header_paragraphs'] * 16;
- $info['exe']['mz']['memory_minimum'] = $info['exe']['mz']['raw']['min_memory_paragraphs'] * 16;
- $info['exe']['mz']['memory_recommended'] = $info['exe']['mz']['raw']['max_memory_paragraphs'] * 16;
-
-$info['error'][] = 'EXE parsing not enabled in this version of getID3() ['.$this->getid3->version().']';
-return false;
-
- }
-
-}
-
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.misc.iso.php b/3rdparty/getid3/module.misc.iso.php
deleted file mode 100644
index 727fdf8701c..00000000000
--- a/3rdparty/getid3/module.misc.iso.php
+++ /dev/null
@@ -1,389 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.misc.iso.php //
-// module for analyzing ISO files //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_iso extends getid3_handler
-{
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- $info['fileformat'] = 'iso';
-
- for ($i = 16; $i <= 19; $i++) {
- fseek($this->getid3->fp, 2048 * $i, SEEK_SET);
- $ISOheader = fread($this->getid3->fp, 2048);
- if (substr($ISOheader, 1, 5) == 'CD001') {
- switch (ord($ISOheader{0})) {
- case 1:
- $info['iso']['primary_volume_descriptor']['offset'] = 2048 * $i;
- $this->ParsePrimaryVolumeDescriptor($ISOheader);
- break;
-
- case 2:
- $info['iso']['supplementary_volume_descriptor']['offset'] = 2048 * $i;
- $this->ParseSupplementaryVolumeDescriptor($ISOheader);
- break;
-
- default:
- // skip
- break;
- }
- }
- }
-
- $this->ParsePathTable();
-
- $info['iso']['files'] = array();
- foreach ($info['iso']['path_table']['directories'] as $directorynum => $directorydata) {
- $info['iso']['directories'][$directorynum] = $this->ParseDirectoryRecord($directorydata);
- }
-
- return true;
- }
-
-
- function ParsePrimaryVolumeDescriptor(&$ISOheader) {
- // ISO integer values are stored *BOTH* Little-Endian AND Big-Endian format!!
- // ie 12345 == 0x3039 is stored as $39 $30 $30 $39 in a 4-byte field
-
- // shortcuts
- $info = &$this->getid3->info;
- $info['iso']['primary_volume_descriptor']['raw'] = array();
- $thisfile_iso_primaryVD = &$info['iso']['primary_volume_descriptor'];
- $thisfile_iso_primaryVD_raw = &$thisfile_iso_primaryVD['raw'];
-
- $thisfile_iso_primaryVD_raw['volume_descriptor_type'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 0, 1));
- $thisfile_iso_primaryVD_raw['standard_identifier'] = substr($ISOheader, 1, 5);
- if ($thisfile_iso_primaryVD_raw['standard_identifier'] != 'CD001') {
- $info['error'][] = 'Expected "CD001" at offset ('.($thisfile_iso_primaryVD['offset'] + 1).'), found "'.$thisfile_iso_primaryVD_raw['standard_identifier'].'" instead';
- unset($info['fileformat']);
- unset($info['iso']);
- return false;
- }
-
-
- $thisfile_iso_primaryVD_raw['volume_descriptor_version'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 6, 1));
- //$thisfile_iso_primaryVD_raw['unused_1'] = substr($ISOheader, 7, 1);
- $thisfile_iso_primaryVD_raw['system_identifier'] = substr($ISOheader, 8, 32);
- $thisfile_iso_primaryVD_raw['volume_identifier'] = substr($ISOheader, 40, 32);
- //$thisfile_iso_primaryVD_raw['unused_2'] = substr($ISOheader, 72, 8);
- $thisfile_iso_primaryVD_raw['volume_space_size'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 80, 4));
- //$thisfile_iso_primaryVD_raw['unused_3'] = substr($ISOheader, 88, 32);
- $thisfile_iso_primaryVD_raw['volume_set_size'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 120, 2));
- $thisfile_iso_primaryVD_raw['volume_sequence_number'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 124, 2));
- $thisfile_iso_primaryVD_raw['logical_block_size'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 128, 2));
- $thisfile_iso_primaryVD_raw['path_table_size'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 132, 4));
- $thisfile_iso_primaryVD_raw['path_table_l_location'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 140, 2));
- $thisfile_iso_primaryVD_raw['path_table_l_opt_location'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 144, 2));
- $thisfile_iso_primaryVD_raw['path_table_m_location'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 148, 2));
- $thisfile_iso_primaryVD_raw['path_table_m_opt_location'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 152, 2));
- $thisfile_iso_primaryVD_raw['root_directory_record'] = substr($ISOheader, 156, 34);
- $thisfile_iso_primaryVD_raw['volume_set_identifier'] = substr($ISOheader, 190, 128);
- $thisfile_iso_primaryVD_raw['publisher_identifier'] = substr($ISOheader, 318, 128);
- $thisfile_iso_primaryVD_raw['data_preparer_identifier'] = substr($ISOheader, 446, 128);
- $thisfile_iso_primaryVD_raw['application_identifier'] = substr($ISOheader, 574, 128);
- $thisfile_iso_primaryVD_raw['copyright_file_identifier'] = substr($ISOheader, 702, 37);
- $thisfile_iso_primaryVD_raw['abstract_file_identifier'] = substr($ISOheader, 739, 37);
- $thisfile_iso_primaryVD_raw['bibliographic_file_identifier'] = substr($ISOheader, 776, 37);
- $thisfile_iso_primaryVD_raw['volume_creation_date_time'] = substr($ISOheader, 813, 17);
- $thisfile_iso_primaryVD_raw['volume_modification_date_time'] = substr($ISOheader, 830, 17);
- $thisfile_iso_primaryVD_raw['volume_expiration_date_time'] = substr($ISOheader, 847, 17);
- $thisfile_iso_primaryVD_raw['volume_effective_date_time'] = substr($ISOheader, 864, 17);
- $thisfile_iso_primaryVD_raw['file_structure_version'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 881, 1));
- //$thisfile_iso_primaryVD_raw['unused_4'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 882, 1));
- $thisfile_iso_primaryVD_raw['application_data'] = substr($ISOheader, 883, 512);
- //$thisfile_iso_primaryVD_raw['unused_5'] = substr($ISOheader, 1395, 653);
-
- $thisfile_iso_primaryVD['system_identifier'] = trim($thisfile_iso_primaryVD_raw['system_identifier']);
- $thisfile_iso_primaryVD['volume_identifier'] = trim($thisfile_iso_primaryVD_raw['volume_identifier']);
- $thisfile_iso_primaryVD['volume_set_identifier'] = trim($thisfile_iso_primaryVD_raw['volume_set_identifier']);
- $thisfile_iso_primaryVD['publisher_identifier'] = trim($thisfile_iso_primaryVD_raw['publisher_identifier']);
- $thisfile_iso_primaryVD['data_preparer_identifier'] = trim($thisfile_iso_primaryVD_raw['data_preparer_identifier']);
- $thisfile_iso_primaryVD['application_identifier'] = trim($thisfile_iso_primaryVD_raw['application_identifier']);
- $thisfile_iso_primaryVD['copyright_file_identifier'] = trim($thisfile_iso_primaryVD_raw['copyright_file_identifier']);
- $thisfile_iso_primaryVD['abstract_file_identifier'] = trim($thisfile_iso_primaryVD_raw['abstract_file_identifier']);
- $thisfile_iso_primaryVD['bibliographic_file_identifier'] = trim($thisfile_iso_primaryVD_raw['bibliographic_file_identifier']);
- $thisfile_iso_primaryVD['volume_creation_date_time'] = $this->ISOtimeText2UNIXtime($thisfile_iso_primaryVD_raw['volume_creation_date_time']);
- $thisfile_iso_primaryVD['volume_modification_date_time'] = $this->ISOtimeText2UNIXtime($thisfile_iso_primaryVD_raw['volume_modification_date_time']);
- $thisfile_iso_primaryVD['volume_expiration_date_time'] = $this->ISOtimeText2UNIXtime($thisfile_iso_primaryVD_raw['volume_expiration_date_time']);
- $thisfile_iso_primaryVD['volume_effective_date_time'] = $this->ISOtimeText2UNIXtime($thisfile_iso_primaryVD_raw['volume_effective_date_time']);
-
- if (($thisfile_iso_primaryVD_raw['volume_space_size'] * 2048) > $info['filesize']) {
- $info['error'][] = 'Volume Space Size ('.($thisfile_iso_primaryVD_raw['volume_space_size'] * 2048).' bytes) is larger than the file size ('.$info['filesize'].' bytes) (truncated file?)';
- }
-
- return true;
- }
-
-
- function ParseSupplementaryVolumeDescriptor(&$ISOheader) {
- // ISO integer values are stored Both-Endian format!!
- // ie 12345 == 0x3039 is stored as $39 $30 $30 $39 in a 4-byte field
-
- // shortcuts
- $info = &$this->getid3->info;
- $info['iso']['supplementary_volume_descriptor']['raw'] = array();
- $thisfile_iso_supplementaryVD = &$info['iso']['supplementary_volume_descriptor'];
- $thisfile_iso_supplementaryVD_raw = &$thisfile_iso_supplementaryVD['raw'];
-
- $thisfile_iso_supplementaryVD_raw['volume_descriptor_type'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 0, 1));
- $thisfile_iso_supplementaryVD_raw['standard_identifier'] = substr($ISOheader, 1, 5);
- if ($thisfile_iso_supplementaryVD_raw['standard_identifier'] != 'CD001') {
- $info['error'][] = 'Expected "CD001" at offset ('.($thisfile_iso_supplementaryVD['offset'] + 1).'), found "'.$thisfile_iso_supplementaryVD_raw['standard_identifier'].'" instead';
- unset($info['fileformat']);
- unset($info['iso']);
- return false;
- }
-
- $thisfile_iso_supplementaryVD_raw['volume_descriptor_version'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 6, 1));
- //$thisfile_iso_supplementaryVD_raw['unused_1'] = substr($ISOheader, 7, 1);
- $thisfile_iso_supplementaryVD_raw['system_identifier'] = substr($ISOheader, 8, 32);
- $thisfile_iso_supplementaryVD_raw['volume_identifier'] = substr($ISOheader, 40, 32);
- //$thisfile_iso_supplementaryVD_raw['unused_2'] = substr($ISOheader, 72, 8);
- $thisfile_iso_supplementaryVD_raw['volume_space_size'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 80, 4));
- if ($thisfile_iso_supplementaryVD_raw['volume_space_size'] == 0) {
- // Supplementary Volume Descriptor not used
- //unset($thisfile_iso_supplementaryVD);
- //return false;
- }
-
- //$thisfile_iso_supplementaryVD_raw['unused_3'] = substr($ISOheader, 88, 32);
- $thisfile_iso_supplementaryVD_raw['volume_set_size'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 120, 2));
- $thisfile_iso_supplementaryVD_raw['volume_sequence_number'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 124, 2));
- $thisfile_iso_supplementaryVD_raw['logical_block_size'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 128, 2));
- $thisfile_iso_supplementaryVD_raw['path_table_size'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 132, 4));
- $thisfile_iso_supplementaryVD_raw['path_table_l_location'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 140, 2));
- $thisfile_iso_supplementaryVD_raw['path_table_l_opt_location'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 144, 2));
- $thisfile_iso_supplementaryVD_raw['path_table_m_location'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 148, 2));
- $thisfile_iso_supplementaryVD_raw['path_table_m_opt_location'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 152, 2));
- $thisfile_iso_supplementaryVD_raw['root_directory_record'] = substr($ISOheader, 156, 34);
- $thisfile_iso_supplementaryVD_raw['volume_set_identifier'] = substr($ISOheader, 190, 128);
- $thisfile_iso_supplementaryVD_raw['publisher_identifier'] = substr($ISOheader, 318, 128);
- $thisfile_iso_supplementaryVD_raw['data_preparer_identifier'] = substr($ISOheader, 446, 128);
- $thisfile_iso_supplementaryVD_raw['application_identifier'] = substr($ISOheader, 574, 128);
- $thisfile_iso_supplementaryVD_raw['copyright_file_identifier'] = substr($ISOheader, 702, 37);
- $thisfile_iso_supplementaryVD_raw['abstract_file_identifier'] = substr($ISOheader, 739, 37);
- $thisfile_iso_supplementaryVD_raw['bibliographic_file_identifier'] = substr($ISOheader, 776, 37);
- $thisfile_iso_supplementaryVD_raw['volume_creation_date_time'] = substr($ISOheader, 813, 17);
- $thisfile_iso_supplementaryVD_raw['volume_modification_date_time'] = substr($ISOheader, 830, 17);
- $thisfile_iso_supplementaryVD_raw['volume_expiration_date_time'] = substr($ISOheader, 847, 17);
- $thisfile_iso_supplementaryVD_raw['volume_effective_date_time'] = substr($ISOheader, 864, 17);
- $thisfile_iso_supplementaryVD_raw['file_structure_version'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 881, 1));
- //$thisfile_iso_supplementaryVD_raw['unused_4'] = getid3_lib::LittleEndian2Int(substr($ISOheader, 882, 1));
- $thisfile_iso_supplementaryVD_raw['application_data'] = substr($ISOheader, 883, 512);
- //$thisfile_iso_supplementaryVD_raw['unused_5'] = substr($ISOheader, 1395, 653);
-
- $thisfile_iso_supplementaryVD['system_identifier'] = trim($thisfile_iso_supplementaryVD_raw['system_identifier']);
- $thisfile_iso_supplementaryVD['volume_identifier'] = trim($thisfile_iso_supplementaryVD_raw['volume_identifier']);
- $thisfile_iso_supplementaryVD['volume_set_identifier'] = trim($thisfile_iso_supplementaryVD_raw['volume_set_identifier']);
- $thisfile_iso_supplementaryVD['publisher_identifier'] = trim($thisfile_iso_supplementaryVD_raw['publisher_identifier']);
- $thisfile_iso_supplementaryVD['data_preparer_identifier'] = trim($thisfile_iso_supplementaryVD_raw['data_preparer_identifier']);
- $thisfile_iso_supplementaryVD['application_identifier'] = trim($thisfile_iso_supplementaryVD_raw['application_identifier']);
- $thisfile_iso_supplementaryVD['copyright_file_identifier'] = trim($thisfile_iso_supplementaryVD_raw['copyright_file_identifier']);
- $thisfile_iso_supplementaryVD['abstract_file_identifier'] = trim($thisfile_iso_supplementaryVD_raw['abstract_file_identifier']);
- $thisfile_iso_supplementaryVD['bibliographic_file_identifier'] = trim($thisfile_iso_supplementaryVD_raw['bibliographic_file_identifier']);
- $thisfile_iso_supplementaryVD['volume_creation_date_time'] = $this->ISOtimeText2UNIXtime($thisfile_iso_supplementaryVD_raw['volume_creation_date_time']);
- $thisfile_iso_supplementaryVD['volume_modification_date_time'] = $this->ISOtimeText2UNIXtime($thisfile_iso_supplementaryVD_raw['volume_modification_date_time']);
- $thisfile_iso_supplementaryVD['volume_expiration_date_time'] = $this->ISOtimeText2UNIXtime($thisfile_iso_supplementaryVD_raw['volume_expiration_date_time']);
- $thisfile_iso_supplementaryVD['volume_effective_date_time'] = $this->ISOtimeText2UNIXtime($thisfile_iso_supplementaryVD_raw['volume_effective_date_time']);
-
- if (($thisfile_iso_supplementaryVD_raw['volume_space_size'] * $thisfile_iso_supplementaryVD_raw['logical_block_size']) > $info['filesize']) {
- $info['error'][] = 'Volume Space Size ('.($thisfile_iso_supplementaryVD_raw['volume_space_size'] * $thisfile_iso_supplementaryVD_raw['logical_block_size']).' bytes) is larger than the file size ('.$info['filesize'].' bytes) (truncated file?)';
- }
-
- return true;
- }
-
-
- function ParsePathTable() {
- $info = &$this->getid3->info;
- if (!isset($info['iso']['supplementary_volume_descriptor']['raw']['path_table_l_location']) && !isset($info['iso']['primary_volume_descriptor']['raw']['path_table_l_location'])) {
- return false;
- }
- if (isset($info['iso']['supplementary_volume_descriptor']['raw']['path_table_l_location'])) {
- $PathTableLocation = $info['iso']['supplementary_volume_descriptor']['raw']['path_table_l_location'];
- $PathTableSize = $info['iso']['supplementary_volume_descriptor']['raw']['path_table_size'];
- $TextEncoding = 'UTF-16BE'; // Big-Endian Unicode
- } else {
- $PathTableLocation = $info['iso']['primary_volume_descriptor']['raw']['path_table_l_location'];
- $PathTableSize = $info['iso']['primary_volume_descriptor']['raw']['path_table_size'];
- $TextEncoding = 'ISO-8859-1'; // Latin-1
- }
-
- if (($PathTableLocation * 2048) > $info['filesize']) {
- $info['error'][] = 'Path Table Location specifies an offset ('.($PathTableLocation * 2048).') beyond the end-of-file ('.$info['filesize'].')';
- return false;
- }
-
- $info['iso']['path_table']['offset'] = $PathTableLocation * 2048;
- fseek($this->getid3->fp, $info['iso']['path_table']['offset'], SEEK_SET);
- $info['iso']['path_table']['raw'] = fread($this->getid3->fp, $PathTableSize);
-
- $offset = 0;
- $pathcounter = 1;
- while ($offset < $PathTableSize) {
- // shortcut
- $info['iso']['path_table']['directories'][$pathcounter] = array();
- $thisfile_iso_pathtable_directories_current = &$info['iso']['path_table']['directories'][$pathcounter];
-
- $thisfile_iso_pathtable_directories_current['length'] = getid3_lib::LittleEndian2Int(substr($info['iso']['path_table']['raw'], $offset, 1));
- $offset += 1;
- $thisfile_iso_pathtable_directories_current['extended_length'] = getid3_lib::LittleEndian2Int(substr($info['iso']['path_table']['raw'], $offset, 1));
- $offset += 1;
- $thisfile_iso_pathtable_directories_current['location_logical'] = getid3_lib::LittleEndian2Int(substr($info['iso']['path_table']['raw'], $offset, 4));
- $offset += 4;
- $thisfile_iso_pathtable_directories_current['parent_directory'] = getid3_lib::LittleEndian2Int(substr($info['iso']['path_table']['raw'], $offset, 2));
- $offset += 2;
- $thisfile_iso_pathtable_directories_current['name'] = substr($info['iso']['path_table']['raw'], $offset, $thisfile_iso_pathtable_directories_current['length']);
- $offset += $thisfile_iso_pathtable_directories_current['length'] + ($thisfile_iso_pathtable_directories_current['length'] % 2);
-
- $thisfile_iso_pathtable_directories_current['name_ascii'] = getid3_lib::iconv_fallback($TextEncoding, $info['encoding'], $thisfile_iso_pathtable_directories_current['name']);
-
- $thisfile_iso_pathtable_directories_current['location_bytes'] = $thisfile_iso_pathtable_directories_current['location_logical'] * 2048;
- if ($pathcounter == 1) {
- $thisfile_iso_pathtable_directories_current['full_path'] = '/';
- } else {
- $thisfile_iso_pathtable_directories_current['full_path'] = $info['iso']['path_table']['directories'][$thisfile_iso_pathtable_directories_current['parent_directory']]['full_path'].$thisfile_iso_pathtable_directories_current['name_ascii'].'/';
- }
- $FullPathArray[] = $thisfile_iso_pathtable_directories_current['full_path'];
-
- $pathcounter++;
- }
-
- return true;
- }
-
-
- function ParseDirectoryRecord($directorydata) {
- $info = &$this->getid3->info;
- if (isset($info['iso']['supplementary_volume_descriptor'])) {
- $TextEncoding = 'UTF-16BE'; // Big-Endian Unicode
- } else {
- $TextEncoding = 'ISO-8859-1'; // Latin-1
- }
-
- fseek($this->getid3->fp, $directorydata['location_bytes'], SEEK_SET);
- $DirectoryRecordData = fread($this->getid3->fp, 1);
-
- while (ord($DirectoryRecordData{0}) > 33) {
-
- $DirectoryRecordData .= fread($this->getid3->fp, ord($DirectoryRecordData{0}) - 1);
-
- $ThisDirectoryRecord['raw']['length'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 0, 1));
- $ThisDirectoryRecord['raw']['extended_attribute_length'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 1, 1));
- $ThisDirectoryRecord['raw']['offset_logical'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 2, 4));
- $ThisDirectoryRecord['raw']['filesize'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 10, 4));
- $ThisDirectoryRecord['raw']['recording_date_time'] = substr($DirectoryRecordData, 18, 7);
- $ThisDirectoryRecord['raw']['file_flags'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 25, 1));
- $ThisDirectoryRecord['raw']['file_unit_size'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 26, 1));
- $ThisDirectoryRecord['raw']['interleave_gap_size'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 27, 1));
- $ThisDirectoryRecord['raw']['volume_sequence_number'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 28, 2));
- $ThisDirectoryRecord['raw']['file_identifier_length'] = getid3_lib::LittleEndian2Int(substr($DirectoryRecordData, 32, 1));
- $ThisDirectoryRecord['raw']['file_identifier'] = substr($DirectoryRecordData, 33, $ThisDirectoryRecord['raw']['file_identifier_length']);
-
- $ThisDirectoryRecord['file_identifier_ascii'] = getid3_lib::iconv_fallback($TextEncoding, $info['encoding'], $ThisDirectoryRecord['raw']['file_identifier']);
-
- $ThisDirectoryRecord['filesize'] = $ThisDirectoryRecord['raw']['filesize'];
- $ThisDirectoryRecord['offset_bytes'] = $ThisDirectoryRecord['raw']['offset_logical'] * 2048;
- $ThisDirectoryRecord['file_flags']['hidden'] = (bool) ($ThisDirectoryRecord['raw']['file_flags'] & 0x01);
- $ThisDirectoryRecord['file_flags']['directory'] = (bool) ($ThisDirectoryRecord['raw']['file_flags'] & 0x02);
- $ThisDirectoryRecord['file_flags']['associated'] = (bool) ($ThisDirectoryRecord['raw']['file_flags'] & 0x04);
- $ThisDirectoryRecord['file_flags']['extended'] = (bool) ($ThisDirectoryRecord['raw']['file_flags'] & 0x08);
- $ThisDirectoryRecord['file_flags']['permissions'] = (bool) ($ThisDirectoryRecord['raw']['file_flags'] & 0x10);
- $ThisDirectoryRecord['file_flags']['multiple'] = (bool) ($ThisDirectoryRecord['raw']['file_flags'] & 0x80);
- $ThisDirectoryRecord['recording_timestamp'] = $this->ISOtime2UNIXtime($ThisDirectoryRecord['raw']['recording_date_time']);
-
- if ($ThisDirectoryRecord['file_flags']['directory']) {
- $ThisDirectoryRecord['filename'] = $directorydata['full_path'];
- } else {
- $ThisDirectoryRecord['filename'] = $directorydata['full_path'].$this->ISOstripFilenameVersion($ThisDirectoryRecord['file_identifier_ascii']);
- $info['iso']['files'] = getid3_lib::array_merge_clobber($info['iso']['files'], getid3_lib::CreateDeepArray($ThisDirectoryRecord['filename'], '/', $ThisDirectoryRecord['filesize']));
- }
-
- $DirectoryRecord[] = $ThisDirectoryRecord;
- $DirectoryRecordData = fread($this->getid3->fp, 1);
- }
-
- return $DirectoryRecord;
- }
-
- function ISOstripFilenameVersion($ISOfilename) {
- // convert 'filename.ext;1' to 'filename.ext'
- if (!strstr($ISOfilename, ';')) {
- return $ISOfilename;
- } else {
- return substr($ISOfilename, 0, strpos($ISOfilename, ';'));
- }
- }
-
- function ISOtimeText2UNIXtime($ISOtime) {
-
- $UNIXyear = (int) substr($ISOtime, 0, 4);
- $UNIXmonth = (int) substr($ISOtime, 4, 2);
- $UNIXday = (int) substr($ISOtime, 6, 2);
- $UNIXhour = (int) substr($ISOtime, 8, 2);
- $UNIXminute = (int) substr($ISOtime, 10, 2);
- $UNIXsecond = (int) substr($ISOtime, 12, 2);
-
- if (!$UNIXyear) {
- return false;
- }
- return gmmktime($UNIXhour, $UNIXminute, $UNIXsecond, $UNIXmonth, $UNIXday, $UNIXyear);
- }
-
- function ISOtime2UNIXtime($ISOtime) {
- // Represented by seven bytes:
- // 1: Number of years since 1900
- // 2: Month of the year from 1 to 12
- // 3: Day of the Month from 1 to 31
- // 4: Hour of the day from 0 to 23
- // 5: Minute of the hour from 0 to 59
- // 6: second of the minute from 0 to 59
- // 7: Offset from Greenwich Mean Time in number of 15 minute intervals from -48 (West) to +52 (East)
-
- $UNIXyear = ord($ISOtime{0}) + 1900;
- $UNIXmonth = ord($ISOtime{1});
- $UNIXday = ord($ISOtime{2});
- $UNIXhour = ord($ISOtime{3});
- $UNIXminute = ord($ISOtime{4});
- $UNIXsecond = ord($ISOtime{5});
- $GMToffset = $this->TwosCompliment2Decimal(ord($ISOtime{5}));
-
- return gmmktime($UNIXhour, $UNIXminute, $UNIXsecond, $UNIXmonth, $UNIXday, $UNIXyear);
- }
-
- function TwosCompliment2Decimal($BinaryValue) {
- // http://sandbox.mc.edu/~bennet/cs110/tc/tctod.html
- // First check if the number is negative or positive by looking at the sign bit.
- // If it is positive, simply convert it to decimal.
- // If it is negative, make it positive by inverting the bits and adding one.
- // Then, convert the result to decimal.
- // The negative of this number is the value of the original binary.
-
- if ($BinaryValue & 0x80) {
-
- // negative number
- return (0 - ((~$BinaryValue & 0xFF) + 1));
- } else {
- // positive number
- return $BinaryValue;
- }
- }
-
-
-}
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.misc.msoffice.php b/3rdparty/getid3/module.misc.msoffice.php
deleted file mode 100644
index 8fea108534a..00000000000
--- a/3rdparty/getid3/module.misc.msoffice.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.archive.doc.php //
-// module for analyzing MS Office (.doc, .xls, etc) files //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_msoffice extends getid3_handler
-{
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
- $DOCFILEheader = fread($this->getid3->fp, 8);
- $magic = "\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1";
- if (substr($DOCFILEheader, 0, 8) != $magic) {
- $info['error'][] = 'Expecting "'.getid3_lib::PrintHexBytes($magic).'" at '.$info['avdataoffset'].', found '.getid3_lib::PrintHexBytes(substr($DOCFILEheader, 0, 8)).' instead.';
- return false;
- }
- $info['fileformat'] = 'msoffice';
-
-$info['error'][] = 'MS Office (.doc, .xls, etc) parsing not enabled in this version of getID3() ['.$this->getid3->version().']';
-return false;
-
- }
-
-}
-
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.misc.par2.php b/3rdparty/getid3/module.misc.par2.php
deleted file mode 100644
index d8b0a388b74..00000000000
--- a/3rdparty/getid3/module.misc.par2.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.misc.par2.php //
-// module for analyzing PAR2 files //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_par2 extends getid3_handler
-{
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- $info['fileformat'] = 'par2';
-
- $info['error'][] = 'PAR2 parsing not enabled in this version of getID3()';
- return false;
-
- }
-
-}
-
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.misc.pdf.php b/3rdparty/getid3/module.misc.pdf.php
deleted file mode 100644
index 38ed646a9e0..00000000000
--- a/3rdparty/getid3/module.misc.pdf.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.misc.pdf.php //
-// module for analyzing PDF files //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_pdf extends getid3_handler
-{
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- $info['fileformat'] = 'pdf';
-
- $info['error'][] = 'PDF parsing not enabled in this version of getID3() ['.$this->getid3->version().']';
- return false;
-
- }
-
-}
-
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.tag.apetag.php b/3rdparty/getid3/module.tag.apetag.php
deleted file mode 100644
index 6522475f516..00000000000
--- a/3rdparty/getid3/module.tag.apetag.php
+++ /dev/null
@@ -1,372 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.tag.apetag.php //
-// module for analyzing APE tags //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-
-class getid3_apetag extends getid3_handler
-{
- var $inline_attachments = true; // true: return full data for all attachments; false: return no data for all attachments; integer: return data for attachments <= than this; string: save as file to this directory
- var $overrideendoffset = 0;
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- if (!getid3_lib::intValueSupported($info['filesize'])) {
- $info['warning'][] = 'Unable to check for APEtags because file is larger than '.round(PHP_INT_MAX / 1073741824).'GB';
- return false;
- }
-
- $id3v1tagsize = 128;
- $apetagheadersize = 32;
- $lyrics3tagsize = 10;
-
- if ($this->overrideendoffset == 0) {
-
- fseek($this->getid3->fp, 0 - $id3v1tagsize - $apetagheadersize - $lyrics3tagsize, SEEK_END);
- $APEfooterID3v1 = fread($this->getid3->fp, $id3v1tagsize + $apetagheadersize + $lyrics3tagsize);
-
- //if (preg_match('/APETAGEX.{24}TAG.{125}$/i', $APEfooterID3v1)) {
- if (substr($APEfooterID3v1, strlen($APEfooterID3v1) - $id3v1tagsize - $apetagheadersize, 8) == 'APETAGEX') {
-
- // APE tag found before ID3v1
- $info['ape']['tag_offset_end'] = $info['filesize'] - $id3v1tagsize;
-
- //} elseif (preg_match('/APETAGEX.{24}$/i', $APEfooterID3v1)) {
- } elseif (substr($APEfooterID3v1, strlen($APEfooterID3v1) - $apetagheadersize, 8) == 'APETAGEX') {
-
- // APE tag found, no ID3v1
- $info['ape']['tag_offset_end'] = $info['filesize'];
-
- }
-
- } else {
-
- fseek($this->getid3->fp, $this->overrideendoffset - $apetagheadersize, SEEK_SET);
- if (fread($this->getid3->fp, 8) == 'APETAGEX') {
- $info['ape']['tag_offset_end'] = $this->overrideendoffset;
- }
-
- }
- if (!isset($info['ape']['tag_offset_end'])) {
-
- // APE tag not found
- unset($info['ape']);
- return false;
-
- }
-
- // shortcut
- $thisfile_ape = &$info['ape'];
-
- fseek($this->getid3->fp, $thisfile_ape['tag_offset_end'] - $apetagheadersize, SEEK_SET);
- $APEfooterData = fread($this->getid3->fp, 32);
- if (!($thisfile_ape['footer'] = $this->parseAPEheaderFooter($APEfooterData))) {
- $info['error'][] = 'Error parsing APE footer at offset '.$thisfile_ape['tag_offset_end'];
- return false;
- }
-
- if (isset($thisfile_ape['footer']['flags']['header']) && $thisfile_ape['footer']['flags']['header']) {
- fseek($this->getid3->fp, $thisfile_ape['tag_offset_end'] - $thisfile_ape['footer']['raw']['tagsize'] - $apetagheadersize, SEEK_SET);
- $thisfile_ape['tag_offset_start'] = ftell($this->getid3->fp);
- $APEtagData = fread($this->getid3->fp, $thisfile_ape['footer']['raw']['tagsize'] + $apetagheadersize);
- } else {
- $thisfile_ape['tag_offset_start'] = $thisfile_ape['tag_offset_end'] - $thisfile_ape['footer']['raw']['tagsize'];
- fseek($this->getid3->fp, $thisfile_ape['tag_offset_start'], SEEK_SET);
- $APEtagData = fread($this->getid3->fp, $thisfile_ape['footer']['raw']['tagsize']);
- }
- $info['avdataend'] = $thisfile_ape['tag_offset_start'];
-
- if (isset($info['id3v1']['tag_offset_start']) && ($info['id3v1']['tag_offset_start'] < $thisfile_ape['tag_offset_end'])) {
- $info['warning'][] = 'ID3v1 tag information ignored since it appears to be a false synch in APEtag data';
- unset($info['id3v1']);
- foreach ($info['warning'] as $key => $value) {
- if ($value == 'Some ID3v1 fields do not use NULL characters for padding') {
- unset($info['warning'][$key]);
- sort($info['warning']);
- break;
- }
- }
- }
-
- $offset = 0;
- if (isset($thisfile_ape['footer']['flags']['header']) && $thisfile_ape['footer']['flags']['header']) {
- if ($thisfile_ape['header'] = $this->parseAPEheaderFooter(substr($APEtagData, 0, $apetagheadersize))) {
- $offset += $apetagheadersize;
- } else {
- $info['error'][] = 'Error parsing APE header at offset '.$thisfile_ape['tag_offset_start'];
- return false;
- }
- }
-
- // shortcut
- $info['replay_gain'] = array();
- $thisfile_replaygain = &$info['replay_gain'];
-
- for ($i = 0; $i < $thisfile_ape['footer']['raw']['tag_items']; $i++) {
- $value_size = getid3_lib::LittleEndian2Int(substr($APEtagData, $offset, 4));
- $offset += 4;
- $item_flags = getid3_lib::LittleEndian2Int(substr($APEtagData, $offset, 4));
- $offset += 4;
- if (strstr(substr($APEtagData, $offset), "\x00") === false) {
- $info['error'][] = 'Cannot find null-byte (0x00) seperator between ItemKey #'.$i.' and value. ItemKey starts '.$offset.' bytes into the APE tag, at file offset '.($thisfile_ape['tag_offset_start'] + $offset);
- return false;
- }
- $ItemKeyLength = strpos($APEtagData, "\x00", $offset) - $offset;
- $item_key = strtolower(substr($APEtagData, $offset, $ItemKeyLength));
-
- // shortcut
- $thisfile_ape['items'][$item_key] = array();
- $thisfile_ape_items_current = &$thisfile_ape['items'][$item_key];
-
- $thisfile_ape_items_current['offset'] = $thisfile_ape['tag_offset_start'] + $offset;
-
- $offset += ($ItemKeyLength + 1); // skip 0x00 terminator
- $thisfile_ape_items_current['data'] = substr($APEtagData, $offset, $value_size);
- $offset += $value_size;
-
- $thisfile_ape_items_current['flags'] = $this->parseAPEtagFlags($item_flags);
- switch ($thisfile_ape_items_current['flags']['item_contents_raw']) {
- case 0: // UTF-8
- case 3: // Locator (URL, filename, etc), UTF-8 encoded
- $thisfile_ape_items_current['data'] = explode("\x00", trim($thisfile_ape_items_current['data']));
- break;
-
- default: // binary data
- break;
- }
-
- switch (strtolower($item_key)) {
- case 'replaygain_track_gain':
- $thisfile_replaygain['track']['adjustment'] = (float) str_replace(',', '.', $thisfile_ape_items_current['data'][0]); // float casting will see "0,95" as zero!
- $thisfile_replaygain['track']['originator'] = 'unspecified';
- break;
-
- case 'replaygain_track_peak':
- $thisfile_replaygain['track']['peak'] = (float) str_replace(',', '.', $thisfile_ape_items_current['data'][0]); // float casting will see "0,95" as zero!
- $thisfile_replaygain['track']['originator'] = 'unspecified';
- if ($thisfile_replaygain['track']['peak'] <= 0) {
- $info['warning'][] = 'ReplayGain Track peak from APEtag appears invalid: '.$thisfile_replaygain['track']['peak'].' (original value = "'.$thisfile_ape_items_current['data'][0].'")';
- }
- break;
-
- case 'replaygain_album_gain':
- $thisfile_replaygain['album']['adjustment'] = (float) str_replace(',', '.', $thisfile_ape_items_current['data'][0]); // float casting will see "0,95" as zero!
- $thisfile_replaygain['album']['originator'] = 'unspecified';
- break;
-
- case 'replaygain_album_peak':
- $thisfile_replaygain['album']['peak'] = (float) str_replace(',', '.', $thisfile_ape_items_current['data'][0]); // float casting will see "0,95" as zero!
- $thisfile_replaygain['album']['originator'] = 'unspecified';
- if ($thisfile_replaygain['album']['peak'] <= 0) {
- $info['warning'][] = 'ReplayGain Album peak from APEtag appears invalid: '.$thisfile_replaygain['album']['peak'].' (original value = "'.$thisfile_ape_items_current['data'][0].'")';
- }
- break;
-
- case 'mp3gain_undo':
- list($mp3gain_undo_left, $mp3gain_undo_right, $mp3gain_undo_wrap) = explode(',', $thisfile_ape_items_current['data'][0]);
- $thisfile_replaygain['mp3gain']['undo_left'] = intval($mp3gain_undo_left);
- $thisfile_replaygain['mp3gain']['undo_right'] = intval($mp3gain_undo_right);
- $thisfile_replaygain['mp3gain']['undo_wrap'] = (($mp3gain_undo_wrap == 'Y') ? true : false);
- break;
-
- case 'mp3gain_minmax':
- list($mp3gain_globalgain_min, $mp3gain_globalgain_max) = explode(',', $thisfile_ape_items_current['data'][0]);
- $thisfile_replaygain['mp3gain']['globalgain_track_min'] = intval($mp3gain_globalgain_min);
- $thisfile_replaygain['mp3gain']['globalgain_track_max'] = intval($mp3gain_globalgain_max);
- break;
-
- case 'mp3gain_album_minmax':
- list($mp3gain_globalgain_album_min, $mp3gain_globalgain_album_max) = explode(',', $thisfile_ape_items_current['data'][0]);
- $thisfile_replaygain['mp3gain']['globalgain_album_min'] = intval($mp3gain_globalgain_album_min);
- $thisfile_replaygain['mp3gain']['globalgain_album_max'] = intval($mp3gain_globalgain_album_max);
- break;
-
- case 'tracknumber':
- if (is_array($thisfile_ape_items_current['data'])) {
- foreach ($thisfile_ape_items_current['data'] as $comment) {
- $thisfile_ape['comments']['track'][] = $comment;
- }
- }
- break;
-
- case 'cover art (artist)':
- case 'cover art (back)':
- case 'cover art (band logo)':
- case 'cover art (band)':
- case 'cover art (colored fish)':
- case 'cover art (composer)':
- case 'cover art (conductor)':
- case 'cover art (front)':
- case 'cover art (icon)':
- case 'cover art (illustration)':
- case 'cover art (lead)':
- case 'cover art (leaflet)':
- case 'cover art (lyricist)':
- case 'cover art (media)':
- case 'cover art (movie scene)':
- case 'cover art (other icon)':
- case 'cover art (other)':
- case 'cover art (performance)':
- case 'cover art (publisher logo)':
- case 'cover art (recording)':
- case 'cover art (studio)':
- // list of possible cover arts from http://taglib-sharp.sourcearchive.com/documentation/2.0.3.0-2/Ape_2Tag_8cs-source.html
- list($thisfile_ape_items_current['filename'], $thisfile_ape_items_current['data']) = explode("\x00", $thisfile_ape_items_current['data'], 2);
- $thisfile_ape_items_current['data_offset'] = $thisfile_ape_items_current['offset'] + strlen($thisfile_ape_items_current['filename']."\x00");
- $thisfile_ape_items_current['data_length'] = strlen($thisfile_ape_items_current['data']);
-
- $thisfile_ape_items_current['image_mime'] = '';
- $imageinfo = array();
- $imagechunkcheck = getid3_lib::GetDataImageSize($thisfile_ape_items_current['data'], $imageinfo);
- $thisfile_ape_items_current['image_mime'] = image_type_to_mime_type($imagechunkcheck[2]);
-
- do {
- if ($this->inline_attachments === false) {
- // skip entirely
- unset($thisfile_ape_items_current['data']);
- break;
- }
- if ($this->inline_attachments === true) {
- // great
- } elseif (is_int($this->inline_attachments)) {
- if ($this->inline_attachments < $thisfile_ape_items_current['data_length']) {
- // too big, skip
- $info['warning'][] = 'attachment at '.$thisfile_ape_items_current['offset'].' is too large to process inline ('.number_format($thisfile_ape_items_current['data_length']).' bytes)';
- unset($thisfile_ape_items_current['data']);
- break;
- }
- } elseif (is_string($this->inline_attachments)) {
- $this->inline_attachments = rtrim(str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $this->inline_attachments), DIRECTORY_SEPARATOR);
- if (!is_dir($this->inline_attachments) || !is_writable($this->inline_attachments)) {
- // cannot write, skip
- $info['warning'][] = 'attachment at '.$thisfile_ape_items_current['offset'].' cannot be saved to "'.$this->inline_attachments.'" (not writable)';
- unset($thisfile_ape_items_current['data']);
- break;
- }
- }
- // if we get this far, must be OK
- if (is_string($this->inline_attachments)) {
- $destination_filename = $this->inline_attachments.DIRECTORY_SEPARATOR.md5($info['filenamepath']).'_'.$thisfile_ape_items_current['data_offset'];
- if (!file_exists($destination_filename) || is_writable($destination_filename)) {
- file_put_contents($destination_filename, $thisfile_ape_items_current['data']);
- } else {
- $info['warning'][] = 'attachment at '.$thisfile_ape_items_current['offset'].' cannot be saved to "'.$destination_filename.'" (not writable)';
- }
- $thisfile_ape_items_current['data_filename'] = $destination_filename;
- unset($thisfile_ape_items_current['data']);
- } else {
- if (!isset($info['ape']['comments']['picture'])) {
- $info['ape']['comments']['picture'] = array();
- }
- $info['ape']['comments']['picture'][] = array('data'=>$thisfile_ape_items_current['data'], 'image_mime'=>$thisfile_ape_items_current['image_mime']);
- }
- } while (false);
- break;
-
- default:
- if (is_array($thisfile_ape_items_current['data'])) {
- foreach ($thisfile_ape_items_current['data'] as $comment) {
- $thisfile_ape['comments'][strtolower($item_key)][] = $comment;
- }
- }
- break;
- }
-
- }
- if (empty($thisfile_replaygain)) {
- unset($info['replay_gain']);
- }
- return true;
- }
-
- function parseAPEheaderFooter($APEheaderFooterData) {
- // http://www.uni-jena.de/~pfk/mpp/sv8/apeheader.html
-
- // shortcut
- $headerfooterinfo['raw'] = array();
- $headerfooterinfo_raw = &$headerfooterinfo['raw'];
-
- $headerfooterinfo_raw['footer_tag'] = substr($APEheaderFooterData, 0, 8);
- if ($headerfooterinfo_raw['footer_tag'] != 'APETAGEX') {
- return false;
- }
- $headerfooterinfo_raw['version'] = getid3_lib::LittleEndian2Int(substr($APEheaderFooterData, 8, 4));
- $headerfooterinfo_raw['tagsize'] = getid3_lib::LittleEndian2Int(substr($APEheaderFooterData, 12, 4));
- $headerfooterinfo_raw['tag_items'] = getid3_lib::LittleEndian2Int(substr($APEheaderFooterData, 16, 4));
- $headerfooterinfo_raw['global_flags'] = getid3_lib::LittleEndian2Int(substr($APEheaderFooterData, 20, 4));
- $headerfooterinfo_raw['reserved'] = substr($APEheaderFooterData, 24, 8);
-
- $headerfooterinfo['tag_version'] = $headerfooterinfo_raw['version'] / 1000;
- if ($headerfooterinfo['tag_version'] >= 2) {
- $headerfooterinfo['flags'] = $this->parseAPEtagFlags($headerfooterinfo_raw['global_flags']);
- }
- return $headerfooterinfo;
- }
-
- function parseAPEtagFlags($rawflagint) {
- // "Note: APE Tags 1.0 do not use any of the APE Tag flags.
- // All are set to zero on creation and ignored on reading."
- // http://www.uni-jena.de/~pfk/mpp/sv8/apetagflags.html
- $flags['header'] = (bool) ($rawflagint & 0x80000000);
- $flags['footer'] = (bool) ($rawflagint & 0x40000000);
- $flags['this_is_header'] = (bool) ($rawflagint & 0x20000000);
- $flags['item_contents_raw'] = ($rawflagint & 0x00000006) >> 1;
- $flags['read_only'] = (bool) ($rawflagint & 0x00000001);
-
- $flags['item_contents'] = $this->APEcontentTypeFlagLookup($flags['item_contents_raw']);
-
- return $flags;
- }
-
- function APEcontentTypeFlagLookup($contenttypeid) {
- static $APEcontentTypeFlagLookup = array(
- 0 => 'utf-8',
- 1 => 'binary',
- 2 => 'external',
- 3 => 'reserved'
- );
- return (isset($APEcontentTypeFlagLookup[$contenttypeid]) ? $APEcontentTypeFlagLookup[$contenttypeid] : 'invalid');
- }
-
- function APEtagItemIsUTF8Lookup($itemkey) {
- static $APEtagItemIsUTF8Lookup = array(
- 'title',
- 'subtitle',
- 'artist',
- 'album',
- 'debut album',
- 'publisher',
- 'conductor',
- 'track',
- 'composer',
- 'comment',
- 'copyright',
- 'publicationright',
- 'file',
- 'year',
- 'record date',
- 'record location',
- 'genre',
- 'media',
- 'related',
- 'isrc',
- 'abstract',
- 'language',
- 'bibliography'
- );
- return in_array(strtolower($itemkey), $APEtagItemIsUTF8Lookup);
- }
-
-}
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.tag.id3v1.php b/3rdparty/getid3/module.tag.id3v1.php
deleted file mode 100644
index a9932d13f32..00000000000
--- a/3rdparty/getid3/module.tag.id3v1.php
+++ /dev/null
@@ -1,362 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.tag.id3v1.php //
-// module for analyzing ID3v1 tags //
-// dependencies: NONE //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_id3v1 extends getid3_handler
-{
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- if (!getid3_lib::intValueSupported($info['filesize'])) {
- $info['warning'][] = 'Unable to check for ID3v1 because file is larger than '.round(PHP_INT_MAX / 1073741824).'GB';
- return false;
- }
-
- fseek($this->getid3->fp, -256, SEEK_END);
- $preid3v1 = fread($this->getid3->fp, 128);
- $id3v1tag = fread($this->getid3->fp, 128);
-
- if (substr($id3v1tag, 0, 3) == 'TAG') {
-
- $info['avdataend'] = $info['filesize'] - 128;
-
- $ParsedID3v1['title'] = $this->cutfield(substr($id3v1tag, 3, 30));
- $ParsedID3v1['artist'] = $this->cutfield(substr($id3v1tag, 33, 30));
- $ParsedID3v1['album'] = $this->cutfield(substr($id3v1tag, 63, 30));
- $ParsedID3v1['year'] = $this->cutfield(substr($id3v1tag, 93, 4));
- $ParsedID3v1['comment'] = substr($id3v1tag, 97, 30); // can't remove nulls yet, track detection depends on them
- $ParsedID3v1['genreid'] = ord(substr($id3v1tag, 127, 1));
-
- // If second-last byte of comment field is null and last byte of comment field is non-null
- // then this is ID3v1.1 and the comment field is 28 bytes long and the 30th byte is the track number
- if (($id3v1tag{125} === "\x00") && ($id3v1tag{126} !== "\x00")) {
- $ParsedID3v1['track'] = ord(substr($ParsedID3v1['comment'], 29, 1));
- $ParsedID3v1['comment'] = substr($ParsedID3v1['comment'], 0, 28);
- }
- $ParsedID3v1['comment'] = $this->cutfield($ParsedID3v1['comment']);
-
- $ParsedID3v1['genre'] = $this->LookupGenreName($ParsedID3v1['genreid']);
- if (!empty($ParsedID3v1['genre'])) {
- unset($ParsedID3v1['genreid']);
- }
- if (isset($ParsedID3v1['genre']) && (empty($ParsedID3v1['genre']) || ($ParsedID3v1['genre'] == 'Unknown'))) {
- unset($ParsedID3v1['genre']);
- }
-
- foreach ($ParsedID3v1 as $key => $value) {
- $ParsedID3v1['comments'][$key][0] = $value;
- }
-
- // ID3v1 data is supposed to be padded with NULL characters, but some taggers pad with spaces
- $GoodFormatID3v1tag = $this->GenerateID3v1Tag(
- $ParsedID3v1['title'],
- $ParsedID3v1['artist'],
- $ParsedID3v1['album'],
- $ParsedID3v1['year'],
- (isset($ParsedID3v1['genre']) ? $this->LookupGenreID($ParsedID3v1['genre']) : false),
- $ParsedID3v1['comment'],
- (!empty($ParsedID3v1['track']) ? $ParsedID3v1['track'] : ''));
- $ParsedID3v1['padding_valid'] = true;
- if ($id3v1tag !== $GoodFormatID3v1tag) {
- $ParsedID3v1['padding_valid'] = false;
- $info['warning'][] = 'Some ID3v1 fields do not use NULL characters for padding';
- }
-
- $ParsedID3v1['tag_offset_end'] = $info['filesize'];
- $ParsedID3v1['tag_offset_start'] = $ParsedID3v1['tag_offset_end'] - 128;
-
- $info['id3v1'] = $ParsedID3v1;
- }
-
- if (substr($preid3v1, 0, 3) == 'TAG') {
- // The way iTunes handles tags is, well, brain-damaged.
- // It completely ignores v1 if ID3v2 is present.
- // This goes as far as adding a new v1 tag *even if there already is one*
-
- // A suspected double-ID3v1 tag has been detected, but it could be that
- // the "TAG" identifier is a legitimate part of an APE or Lyrics3 tag
- if (substr($preid3v1, 96, 8) == 'APETAGEX') {
- // an APE tag footer was found before the last ID3v1, assume false "TAG" synch
- } elseif (substr($preid3v1, 119, 6) == 'LYRICS') {
- // a Lyrics3 tag footer was found before the last ID3v1, assume false "TAG" synch
- } else {
- // APE and Lyrics3 footers not found - assume double ID3v1
- $info['warning'][] = 'Duplicate ID3v1 tag detected - this has been known to happen with iTunes';
- $info['avdataend'] -= 128;
- }
- }
-
- return true;
- }
-
- static function cutfield($str) {
- return trim(substr($str, 0, strcspn($str, "\x00")));
- }
-
- static function ArrayOfGenres($allowSCMPXextended=false) {
- static $GenreLookup = array(
- 0 => 'Blues',
- 1 => 'Classic Rock',
- 2 => 'Country',
- 3 => 'Dance',
- 4 => 'Disco',
- 5 => 'Funk',
- 6 => 'Grunge',
- 7 => 'Hip-Hop',
- 8 => 'Jazz',
- 9 => 'Metal',
- 10 => 'New Age',
- 11 => 'Oldies',
- 12 => 'Other',
- 13 => 'Pop',
- 14 => 'R&B',
- 15 => 'Rap',
- 16 => 'Reggae',
- 17 => 'Rock',
- 18 => 'Techno',
- 19 => 'Industrial',
- 20 => 'Alternative',
- 21 => 'Ska',
- 22 => 'Death Metal',
- 23 => 'Pranks',
- 24 => 'Soundtrack',
- 25 => 'Euro-Techno',
- 26 => 'Ambient',
- 27 => 'Trip-Hop',
- 28 => 'Vocal',
- 29 => 'Jazz+Funk',
- 30 => 'Fusion',
- 31 => 'Trance',
- 32 => 'Classical',
- 33 => 'Instrumental',
- 34 => 'Acid',
- 35 => 'House',
- 36 => 'Game',
- 37 => 'Sound Clip',
- 38 => 'Gospel',
- 39 => 'Noise',
- 40 => 'Alt. Rock',
- 41 => 'Bass',
- 42 => 'Soul',
- 43 => 'Punk',
- 44 => 'Space',
- 45 => 'Meditative',
- 46 => 'Instrumental Pop',
- 47 => 'Instrumental Rock',
- 48 => 'Ethnic',
- 49 => 'Gothic',
- 50 => 'Darkwave',
- 51 => 'Techno-Industrial',
- 52 => 'Electronic',
- 53 => 'Pop-Folk',
- 54 => 'Eurodance',
- 55 => 'Dream',
- 56 => 'Southern Rock',
- 57 => 'Comedy',
- 58 => 'Cult',
- 59 => 'Gangsta Rap',
- 60 => 'Top 40',
- 61 => 'Christian Rap',
- 62 => 'Pop/Funk',
- 63 => 'Jungle',
- 64 => 'Native American',
- 65 => 'Cabaret',
- 66 => 'New Wave',
- 67 => 'Psychedelic',
- 68 => 'Rave',
- 69 => 'Showtunes',
- 70 => 'Trailer',
- 71 => 'Lo-Fi',
- 72 => 'Tribal',
- 73 => 'Acid Punk',
- 74 => 'Acid Jazz',
- 75 => 'Polka',
- 76 => 'Retro',
- 77 => 'Musical',
- 78 => 'Rock & Roll',
- 79 => 'Hard Rock',
- 80 => 'Folk',
- 81 => 'Folk/Rock',
- 82 => 'National Folk',
- 83 => 'Swing',
- 84 => 'Fast-Fusion',
- 85 => 'Bebob',
- 86 => 'Latin',
- 87 => 'Revival',
- 88 => 'Celtic',
- 89 => 'Bluegrass',
- 90 => 'Avantgarde',
- 91 => 'Gothic Rock',
- 92 => 'Progressive Rock',
- 93 => 'Psychedelic Rock',
- 94 => 'Symphonic Rock',
- 95 => 'Slow Rock',
- 96 => 'Big Band',
- 97 => 'Chorus',
- 98 => 'Easy Listening',
- 99 => 'Acoustic',
- 100 => 'Humour',
- 101 => 'Speech',
- 102 => 'Chanson',
- 103 => 'Opera',
- 104 => 'Chamber Music',
- 105 => 'Sonata',
- 106 => 'Symphony',
- 107 => 'Booty Bass',
- 108 => 'Primus',
- 109 => 'Porn Groove',
- 110 => 'Satire',
- 111 => 'Slow Jam',
- 112 => 'Club',
- 113 => 'Tango',
- 114 => 'Samba',
- 115 => 'Folklore',
- 116 => 'Ballad',
- 117 => 'Power Ballad',
- 118 => 'Rhythmic Soul',
- 119 => 'Freestyle',
- 120 => 'Duet',
- 121 => 'Punk Rock',
- 122 => 'Drum Solo',
- 123 => 'A Cappella',
- 124 => 'Euro-House',
- 125 => 'Dance Hall',
- 126 => 'Goa',
- 127 => 'Drum & Bass',
- 128 => 'Club-House',
- 129 => 'Hardcore',
- 130 => 'Terror',
- 131 => 'Indie',
- 132 => 'BritPop',
- 133 => 'Negerpunk',
- 134 => 'Polsk Punk',
- 135 => 'Beat',
- 136 => 'Christian Gangsta Rap',
- 137 => 'Heavy Metal',
- 138 => 'Black Metal',
- 139 => 'Crossover',
- 140 => 'Contemporary Christian',
- 141 => 'Christian Rock',
- 142 => 'Merengue',
- 143 => 'Salsa',
- 144 => 'Thrash Metal',
- 145 => 'Anime',
- 146 => 'JPop',
- 147 => 'Synthpop',
-
- 255 => 'Unknown',
-
- 'CR' => 'Cover',
- 'RX' => 'Remix'
- );
-
- static $GenreLookupSCMPX = array();
- if ($allowSCMPXextended && empty($GenreLookupSCMPX)) {
- $GenreLookupSCMPX = $GenreLookup;
- // http://www.geocities.co.jp/SiliconValley-Oakland/3664/alittle.html#GenreExtended
- // Extended ID3v1 genres invented by SCMPX
- // Note that 255 "Japanese Anime" conflicts with standard "Unknown"
- $GenreLookupSCMPX[240] = 'Sacred';
- $GenreLookupSCMPX[241] = 'Northern Europe';
- $GenreLookupSCMPX[242] = 'Irish & Scottish';
- $GenreLookupSCMPX[243] = 'Scotland';
- $GenreLookupSCMPX[244] = 'Ethnic Europe';
- $GenreLookupSCMPX[245] = 'Enka';
- $GenreLookupSCMPX[246] = 'Children\'s Song';
- $GenreLookupSCMPX[247] = 'Japanese Sky';
- $GenreLookupSCMPX[248] = 'Japanese Heavy Rock';
- $GenreLookupSCMPX[249] = 'Japanese Doom Rock';
- $GenreLookupSCMPX[250] = 'Japanese J-POP';
- $GenreLookupSCMPX[251] = 'Japanese Seiyu';
- $GenreLookupSCMPX[252] = 'Japanese Ambient Techno';
- $GenreLookupSCMPX[253] = 'Japanese Moemoe';
- $GenreLookupSCMPX[254] = 'Japanese Tokusatsu';
- //$GenreLookupSCMPX[255] = 'Japanese Anime';
- }
-
- return ($allowSCMPXextended ? $GenreLookupSCMPX : $GenreLookup);
- }
-
- static function LookupGenreName($genreid, $allowSCMPXextended=true) {
- switch ($genreid) {
- case 'RX':
- case 'CR':
- break;
- default:
- if (!is_numeric($genreid)) {
- return false;
- }
- $genreid = intval($genreid); // to handle 3 or '3' or '03'
- break;
- }
- $GenreLookup = getid3_id3v1::ArrayOfGenres($allowSCMPXextended);
- return (isset($GenreLookup[$genreid]) ? $GenreLookup[$genreid] : false);
- }
-
- static function LookupGenreID($genre, $allowSCMPXextended=false) {
- $GenreLookup = getid3_id3v1::ArrayOfGenres($allowSCMPXextended);
- $LowerCaseNoSpaceSearchTerm = strtolower(str_replace(' ', '', $genre));
- foreach ($GenreLookup as $key => $value) {
- if (strtolower(str_replace(' ', '', $value)) == $LowerCaseNoSpaceSearchTerm) {
- return $key;
- }
- }
- return false;
- }
-
- static function StandardiseID3v1GenreName($OriginalGenre) {
- if (($GenreID = getid3_id3v1::LookupGenreID($OriginalGenre)) !== false) {
- return getid3_id3v1::LookupGenreName($GenreID);
- }
- return $OriginalGenre;
- }
-
- static function GenerateID3v1Tag($title, $artist, $album, $year, $genreid, $comment, $track='') {
- $ID3v1Tag = 'TAG';
- $ID3v1Tag .= str_pad(trim(substr($title, 0, 30)), 30, "\x00", STR_PAD_RIGHT);
- $ID3v1Tag .= str_pad(trim(substr($artist, 0, 30)), 30, "\x00", STR_PAD_RIGHT);
- $ID3v1Tag .= str_pad(trim(substr($album, 0, 30)), 30, "\x00", STR_PAD_RIGHT);
- $ID3v1Tag .= str_pad(trim(substr($year, 0, 4)), 4, "\x00", STR_PAD_LEFT);
- if (!empty($track) && ($track > 0) && ($track <= 255)) {
- $ID3v1Tag .= str_pad(trim(substr($comment, 0, 28)), 28, "\x00", STR_PAD_RIGHT);
- $ID3v1Tag .= "\x00";
- if (gettype($track) == 'string') {
- $track = (int) $track;
- }
- $ID3v1Tag .= chr($track);
- } else {
- $ID3v1Tag .= str_pad(trim(substr($comment, 0, 30)), 30, "\x00", STR_PAD_RIGHT);
- }
- if (($genreid < 0) || ($genreid > 147)) {
- $genreid = 255; // 'unknown' genre
- }
- switch (gettype($genreid)) {
- case 'string':
- case 'integer':
- $ID3v1Tag .= chr(intval($genreid));
- break;
- default:
- $ID3v1Tag .= chr(255); // 'unknown' genre
- break;
- }
-
- return $ID3v1Tag;
- }
-
-}
-
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.tag.id3v2.php b/3rdparty/getid3/module.tag.id3v2.php
deleted file mode 100644
index 56adeb95068..00000000000
--- a/3rdparty/getid3/module.tag.id3v2.php
+++ /dev/null
@@ -1,3327 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-/// //
-// module.tag.id3v2.php //
-// module for analyzing ID3v2 tags //
-// dependencies: module.tag.id3v1.php //
-// ///
-/////////////////////////////////////////////////////////////////
-
-getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.id3v1.php', __FILE__, true);
-
-class getid3_id3v2 extends getid3_handler
-{
- var $inline_attachments = true; // true: return full data for all attachments; false: return no data for all attachments; integer: return data for attachments <= than this; string: save as file to this directory
- var $StartingOffset = 0;
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- // Overall tag structure:
- // +-----------------------------+
- // | Header (10 bytes) |
- // +-----------------------------+
- // | Extended Header |
- // | (variable length, OPTIONAL) |
- // +-----------------------------+
- // | Frames (variable length) |
- // +-----------------------------+
- // | Padding |
- // | (variable length, OPTIONAL) |
- // +-----------------------------+
- // | Footer (10 bytes, OPTIONAL) |
- // +-----------------------------+
-
- // Header
- // ID3v2/file identifier "ID3"
- // ID3v2 version $04 00
- // ID3v2 flags (%ab000000 in v2.2, %abc00000 in v2.3, %abcd0000 in v2.4.x)
- // ID3v2 size 4 * %0xxxxxxx
-
-
- // shortcuts
- $info['id3v2']['header'] = true;
- $thisfile_id3v2 = &$info['id3v2'];
- $thisfile_id3v2['flags'] = array();
- $thisfile_id3v2_flags = &$thisfile_id3v2['flags'];
-
-
- fseek($this->getid3->fp, $this->StartingOffset, SEEK_SET);
- $header = fread($this->getid3->fp, 10);
- if (substr($header, 0, 3) == 'ID3' && strlen($header) == 10) {
-
- $thisfile_id3v2['majorversion'] = ord($header{3});
- $thisfile_id3v2['minorversion'] = ord($header{4});
-
- // shortcut
- $id3v2_majorversion = &$thisfile_id3v2['majorversion'];
-
- } else {
-
- unset($info['id3v2']);
- return false;
-
- }
-
- if ($id3v2_majorversion > 4) { // this script probably won't correctly parse ID3v2.5.x and above (if it ever exists)
-
- $info['error'][] = 'this script only parses up to ID3v2.4.x - this tag is ID3v2.'.$id3v2_majorversion.'.'.$thisfile_id3v2['minorversion'];
- return false;
-
- }
-
- $id3_flags = ord($header{5});
- switch ($id3v2_majorversion) {
- case 2:
- // %ab000000 in v2.2
- $thisfile_id3v2_flags['unsynch'] = (bool) ($id3_flags & 0x80); // a - Unsynchronisation
- $thisfile_id3v2_flags['compression'] = (bool) ($id3_flags & 0x40); // b - Compression
- break;
-
- case 3:
- // %abc00000 in v2.3
- $thisfile_id3v2_flags['unsynch'] = (bool) ($id3_flags & 0x80); // a - Unsynchronisation
- $thisfile_id3v2_flags['exthead'] = (bool) ($id3_flags & 0x40); // b - Extended header
- $thisfile_id3v2_flags['experim'] = (bool) ($id3_flags & 0x20); // c - Experimental indicator
- break;
-
- case 4:
- // %abcd0000 in v2.4
- $thisfile_id3v2_flags['unsynch'] = (bool) ($id3_flags & 0x80); // a - Unsynchronisation
- $thisfile_id3v2_flags['exthead'] = (bool) ($id3_flags & 0x40); // b - Extended header
- $thisfile_id3v2_flags['experim'] = (bool) ($id3_flags & 0x20); // c - Experimental indicator
- $thisfile_id3v2_flags['isfooter'] = (bool) ($id3_flags & 0x10); // d - Footer present
- break;
- }
-
- $thisfile_id3v2['headerlength'] = getid3_lib::BigEndian2Int(substr($header, 6, 4), 1) + 10; // length of ID3v2 tag in 10-byte header doesn't include 10-byte header length
-
- $thisfile_id3v2['tag_offset_start'] = $this->StartingOffset;
- $thisfile_id3v2['tag_offset_end'] = $thisfile_id3v2['tag_offset_start'] + $thisfile_id3v2['headerlength'];
-
-
-
- // create 'encoding' key - used by getid3::HandleAllTags()
- // in ID3v2 every field can have it's own encoding type
- // so force everything to UTF-8 so it can be handled consistantly
- $thisfile_id3v2['encoding'] = 'UTF-8';
-
-
- // Frames
-
- // All ID3v2 frames consists of one frame header followed by one or more
- // fields containing the actual information. The header is always 10
- // bytes and laid out as follows:
- //
- // Frame ID $xx xx xx xx (four characters)
- // Size 4 * %0xxxxxxx
- // Flags $xx xx
-
- $sizeofframes = $thisfile_id3v2['headerlength'] - 10; // not including 10-byte initial header
- if (!empty($thisfile_id3v2['exthead']['length'])) {
- $sizeofframes -= ($thisfile_id3v2['exthead']['length'] + 4);
- }
- if (!empty($thisfile_id3v2_flags['isfooter'])) {
- $sizeofframes -= 10; // footer takes last 10 bytes of ID3v2 header, after frame data, before audio
- }
- if ($sizeofframes > 0) {
-
- $framedata = fread($this->getid3->fp, $sizeofframes); // read all frames from file into $framedata variable
-
- // if entire frame data is unsynched, de-unsynch it now (ID3v2.3.x)
- if (!empty($thisfile_id3v2_flags['unsynch']) && ($id3v2_majorversion <= 3)) {
- $framedata = $this->DeUnsynchronise($framedata);
- }
- // [in ID3v2.4.0] Unsynchronisation [S:6.1] is done on frame level, instead
- // of on tag level, making it easier to skip frames, increasing the streamability
- // of the tag. The unsynchronisation flag in the header [S:3.1] indicates that
- // there exists an unsynchronised frame, while the new unsynchronisation flag in
- // the frame header [S:4.1.2] indicates unsynchronisation.
-
-
- //$framedataoffset = 10 + ($thisfile_id3v2['exthead']['length'] ? $thisfile_id3v2['exthead']['length'] + 4 : 0); // how many bytes into the stream - start from after the 10-byte header (and extended header length+4, if present)
- $framedataoffset = 10; // how many bytes into the stream - start from after the 10-byte header
-
-
- // Extended Header
- if (!empty($thisfile_id3v2_flags['exthead'])) {
- $extended_header_offset = 0;
-
- if ($id3v2_majorversion == 3) {
-
- // v2.3 definition:
- //Extended header size $xx xx xx xx // 32-bit integer
- //Extended Flags $xx xx
- // %x0000000 %00000000 // v2.3
- // x - CRC data present
- //Size of padding $xx xx xx xx
-
- $thisfile_id3v2['exthead']['length'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 4), 0);
- $extended_header_offset += 4;
-
- $thisfile_id3v2['exthead']['flag_bytes'] = 2;
- $thisfile_id3v2['exthead']['flag_raw'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, $thisfile_id3v2['exthead']['flag_bytes']));
- $extended_header_offset += $thisfile_id3v2['exthead']['flag_bytes'];
-
- $thisfile_id3v2['exthead']['flags']['crc'] = (bool) ($thisfile_id3v2['exthead']['flag_raw'] & 0x8000);
-
- $thisfile_id3v2['exthead']['padding_size'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 4));
- $extended_header_offset += 4;
-
- if ($thisfile_id3v2['exthead']['flags']['crc']) {
- $thisfile_id3v2['exthead']['flag_data']['crc'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 4));
- $extended_header_offset += 4;
- }
- $extended_header_offset += $thisfile_id3v2['exthead']['padding_size'];
-
- } elseif ($id3v2_majorversion == 4) {
-
- // v2.4 definition:
- //Extended header size 4 * %0xxxxxxx // 28-bit synchsafe integer
- //Number of flag bytes $01
- //Extended Flags $xx
- // %0bcd0000 // v2.4
- // b - Tag is an update
- // Flag data length $00
- // c - CRC data present
- // Flag data length $05
- // Total frame CRC 5 * %0xxxxxxx
- // d - Tag restrictions
- // Flag data length $01
-
- $thisfile_id3v2['exthead']['length'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 4), true);
- $extended_header_offset += 4;
-
- $thisfile_id3v2['exthead']['flag_bytes'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 1)); // should always be 1
- $extended_header_offset += 1;
-
- $thisfile_id3v2['exthead']['flag_raw'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, $thisfile_id3v2['exthead']['flag_bytes']));
- $extended_header_offset += $thisfile_id3v2['exthead']['flag_bytes'];
-
- $thisfile_id3v2['exthead']['flags']['update'] = (bool) ($thisfile_id3v2['exthead']['flag_raw'] & 0x40);
- $thisfile_id3v2['exthead']['flags']['crc'] = (bool) ($thisfile_id3v2['exthead']['flag_raw'] & 0x20);
- $thisfile_id3v2['exthead']['flags']['restrictions'] = (bool) ($thisfile_id3v2['exthead']['flag_raw'] & 0x10);
-
- if ($thisfile_id3v2['exthead']['flags']['update']) {
- $ext_header_chunk_length = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 1)); // should be 0
- $extended_header_offset += 1;
- }
-
- if ($thisfile_id3v2['exthead']['flags']['crc']) {
- $ext_header_chunk_length = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 1)); // should be 5
- $extended_header_offset += 1;
- $thisfile_id3v2['exthead']['flag_data']['crc'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, $ext_header_chunk_length), true, false);
- $extended_header_offset += $ext_header_chunk_length;
- }
-
- if ($thisfile_id3v2['exthead']['flags']['restrictions']) {
- $ext_header_chunk_length = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 1)); // should be 1
- $extended_header_offset += 1;
-
- // %ppqrrstt
- $restrictions_raw = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 1));
- $extended_header_offset += 1;
- $thisfile_id3v2['exthead']['flags']['restrictions']['tagsize'] = ($restrictions_raw & 0xC0) >> 6; // p - Tag size restrictions
- $thisfile_id3v2['exthead']['flags']['restrictions']['textenc'] = ($restrictions_raw & 0x20) >> 5; // q - Text encoding restrictions
- $thisfile_id3v2['exthead']['flags']['restrictions']['textsize'] = ($restrictions_raw & 0x18) >> 3; // r - Text fields size restrictions
- $thisfile_id3v2['exthead']['flags']['restrictions']['imgenc'] = ($restrictions_raw & 0x04) >> 2; // s - Image encoding restrictions
- $thisfile_id3v2['exthead']['flags']['restrictions']['imgsize'] = ($restrictions_raw & 0x03) >> 0; // t - Image size restrictions
-
- $thisfile_id3v2['exthead']['flags']['restrictions_text']['tagsize'] = $this->LookupExtendedHeaderRestrictionsTagSizeLimits($thisfile_id3v2['exthead']['flags']['restrictions']['tagsize']);
- $thisfile_id3v2['exthead']['flags']['restrictions_text']['textenc'] = $this->LookupExtendedHeaderRestrictionsTextEncodings($thisfile_id3v2['exthead']['flags']['restrictions']['textenc']);
- $thisfile_id3v2['exthead']['flags']['restrictions_text']['textsize'] = $this->LookupExtendedHeaderRestrictionsTextFieldSize($thisfile_id3v2['exthead']['flags']['restrictions']['textsize']);
- $thisfile_id3v2['exthead']['flags']['restrictions_text']['imgenc'] = $this->LookupExtendedHeaderRestrictionsImageEncoding($thisfile_id3v2['exthead']['flags']['restrictions']['imgenc']);
- $thisfile_id3v2['exthead']['flags']['restrictions_text']['imgsize'] = $this->LookupExtendedHeaderRestrictionsImageSizeSize($thisfile_id3v2['exthead']['flags']['restrictions']['imgsize']);
- }
-
- if ($thisfile_id3v2['exthead']['length'] != $extended_header_offset) {
- $info['warning'][] = 'ID3v2.4 extended header length mismatch (expecting '.intval($thisfile_id3v2['exthead']['length']).', found '.intval($extended_header_offset).')';
- }
- }
-
- $framedataoffset += $extended_header_offset;
- $framedata = substr($framedata, $extended_header_offset);
- } // end extended header
-
-
- while (isset($framedata) && (strlen($framedata) > 0)) { // cycle through until no more frame data is left to parse
- if (strlen($framedata) <= $this->ID3v2HeaderLength($id3v2_majorversion)) {
- // insufficient room left in ID3v2 header for actual data - must be padding
- $thisfile_id3v2['padding']['start'] = $framedataoffset;
- $thisfile_id3v2['padding']['length'] = strlen($framedata);
- $thisfile_id3v2['padding']['valid'] = true;
- for ($i = 0; $i < $thisfile_id3v2['padding']['length']; $i++) {
- if ($framedata{$i} != "\x00") {
- $thisfile_id3v2['padding']['valid'] = false;
- $thisfile_id3v2['padding']['errorpos'] = $thisfile_id3v2['padding']['start'] + $i;
- $info['warning'][] = 'Invalid ID3v2 padding found at offset '.$thisfile_id3v2['padding']['errorpos'].' (the remaining '.($thisfile_id3v2['padding']['length'] - $i).' bytes are considered invalid)';
- break;
- }
- }
- break; // skip rest of ID3v2 header
- }
- if ($id3v2_majorversion == 2) {
- // Frame ID $xx xx xx (three characters)
- // Size $xx xx xx (24-bit integer)
- // Flags $xx xx
-
- $frame_header = substr($framedata, 0, 6); // take next 6 bytes for header
- $framedata = substr($framedata, 6); // and leave the rest in $framedata
- $frame_name = substr($frame_header, 0, 3);
- $frame_size = getid3_lib::BigEndian2Int(substr($frame_header, 3, 3), 0);
- $frame_flags = 0; // not used for anything in ID3v2.2, just set to avoid E_NOTICEs
-
- } elseif ($id3v2_majorversion > 2) {
-
- // Frame ID $xx xx xx xx (four characters)
- // Size $xx xx xx xx (32-bit integer in v2.3, 28-bit synchsafe in v2.4+)
- // Flags $xx xx
-
- $frame_header = substr($framedata, 0, 10); // take next 10 bytes for header
- $framedata = substr($framedata, 10); // and leave the rest in $framedata
-
- $frame_name = substr($frame_header, 0, 4);
- if ($id3v2_majorversion == 3) {
- $frame_size = getid3_lib::BigEndian2Int(substr($frame_header, 4, 4), 0); // 32-bit integer
- } else { // ID3v2.4+
- $frame_size = getid3_lib::BigEndian2Int(substr($frame_header, 4, 4), 1); // 32-bit synchsafe integer (28-bit value)
- }
-
- if ($frame_size < (strlen($framedata) + 4)) {
- $nextFrameID = substr($framedata, $frame_size, 4);
- if ($this->IsValidID3v2FrameName($nextFrameID, $id3v2_majorversion)) {
- // next frame is OK
- } elseif (($frame_name == "\x00".'MP3') || ($frame_name == "\x00\x00".'MP') || ($frame_name == ' MP3') || ($frame_name == 'MP3e')) {
- // MP3ext known broken frames - "ok" for the purposes of this test
- } elseif (($id3v2_majorversion == 4) && ($this->IsValidID3v2FrameName(substr($framedata, getid3_lib::BigEndian2Int(substr($frame_header, 4, 4), 0), 4), 3))) {
- $info['warning'][] = 'ID3v2 tag written as ID3v2.4, but with non-synchsafe integers (ID3v2.3 style). Older versions of (Helium2; iTunes) are known culprits of this. Tag has been parsed as ID3v2.3';
- $id3v2_majorversion = 3;
- $frame_size = getid3_lib::BigEndian2Int(substr($frame_header, 4, 4), 0); // 32-bit integer
- }
- }
-
-
- $frame_flags = getid3_lib::BigEndian2Int(substr($frame_header, 8, 2));
- }
-
- if ((($id3v2_majorversion == 2) && ($frame_name == "\x00\x00\x00")) || ($frame_name == "\x00\x00\x00\x00")) {
- // padding encountered
-
- $thisfile_id3v2['padding']['start'] = $framedataoffset;
- $thisfile_id3v2['padding']['length'] = strlen($frame_header) + strlen($framedata);
- $thisfile_id3v2['padding']['valid'] = true;
-
- $len = strlen($framedata);
- for ($i = 0; $i < $len; $i++) {
- if ($framedata{$i} != "\x00") {
- $thisfile_id3v2['padding']['valid'] = false;
- $thisfile_id3v2['padding']['errorpos'] = $thisfile_id3v2['padding']['start'] + $i;
- $info['warning'][] = 'Invalid ID3v2 padding found at offset '.$thisfile_id3v2['padding']['errorpos'].' (the remaining '.($thisfile_id3v2['padding']['length'] - $i).' bytes are considered invalid)';
- break;
- }
- }
- break; // skip rest of ID3v2 header
- }
-
- if ($frame_name == 'COM ') {
- $info['warning'][] = 'error parsing "'.$frame_name.'" ('.$framedataoffset.' bytes into the ID3v2.'.$id3v2_majorversion.' tag). (ERROR: IsValidID3v2FrameName("'.str_replace("\x00", ' ', $frame_name).'", '.$id3v2_majorversion.'))). [Note: this particular error has been known to happen with tags edited by iTunes (versions "X v2.0.3", "v3.0.1" are known-guilty, probably others too)]';
- $frame_name = 'COMM';
- }
- if (($frame_size <= strlen($framedata)) && ($this->IsValidID3v2FrameName($frame_name, $id3v2_majorversion))) {
-
- unset($parsedFrame);
- $parsedFrame['frame_name'] = $frame_name;
- $parsedFrame['frame_flags_raw'] = $frame_flags;
- $parsedFrame['data'] = substr($framedata, 0, $frame_size);
- $parsedFrame['datalength'] = getid3_lib::CastAsInt($frame_size);
- $parsedFrame['dataoffset'] = $framedataoffset;
-
- $this->ParseID3v2Frame($parsedFrame);
- $thisfile_id3v2[$frame_name][] = $parsedFrame;
-
- $framedata = substr($framedata, $frame_size);
-
- } else { // invalid frame length or FrameID
-
- if ($frame_size <= strlen($framedata)) {
-
- if ($this->IsValidID3v2FrameName(substr($framedata, $frame_size, 4), $id3v2_majorversion)) {
-
- // next frame is valid, just skip the current frame
- $framedata = substr($framedata, $frame_size);
- $info['warning'][] = 'Next ID3v2 frame is valid, skipping current frame.';
-
- } else {
-
- // next frame is invalid too, abort processing
- //unset($framedata);
- $framedata = null;
- $info['error'][] = 'Next ID3v2 frame is also invalid, aborting processing.';
-
- }
-
- } elseif ($frame_size == strlen($framedata)) {
-
- // this is the last frame, just skip
- $info['warning'][] = 'This was the last ID3v2 frame.';
-
- } else {
-
- // next frame is invalid too, abort processing
- //unset($framedata);
- $framedata = null;
- $info['warning'][] = 'Invalid ID3v2 frame size, aborting.';
-
- }
- if (!$this->IsValidID3v2FrameName($frame_name, $id3v2_majorversion)) {
-
- switch ($frame_name) {
- case "\x00\x00".'MP':
- case "\x00".'MP3':
- case ' MP3':
- case 'MP3e':
- case "\x00".'MP':
- case ' MP':
- case 'MP3':
- $info['warning'][] = 'error parsing "'.$frame_name.'" ('.$framedataoffset.' bytes into the ID3v2.'.$id3v2_majorversion.' tag). (ERROR: !IsValidID3v2FrameName("'.str_replace("\x00", ' ', $frame_name).'", '.$id3v2_majorversion.'))). [Note: this particular error has been known to happen with tags edited by "MP3ext (www.mutschler.de/mp3ext/)"]';
- break;
-
- default:
- $info['warning'][] = 'error parsing "'.$frame_name.'" ('.$framedataoffset.' bytes into the ID3v2.'.$id3v2_majorversion.' tag). (ERROR: !IsValidID3v2FrameName("'.str_replace("\x00", ' ', $frame_name).'", '.$id3v2_majorversion.'))).';
- break;
- }
-
- } elseif (!isset($framedata) || ($frame_size > strlen($framedata))) {
-
- $info['error'][] = 'error parsing "'.$frame_name.'" ('.$framedataoffset.' bytes into the ID3v2.'.$id3v2_majorversion.' tag). (ERROR: $frame_size ('.$frame_size.') > strlen($framedata) ('.(isset($framedata) ? strlen($framedata) : 'null').')).';
-
- } else {
-
- $info['error'][] = 'error parsing "'.$frame_name.'" ('.$framedataoffset.' bytes into the ID3v2.'.$id3v2_majorversion.' tag).';
-
- }
-
- }
- $framedataoffset += ($frame_size + $this->ID3v2HeaderLength($id3v2_majorversion));
-
- }
-
- }
-
-
- // Footer
-
- // The footer is a copy of the header, but with a different identifier.
- // ID3v2 identifier "3DI"
- // ID3v2 version $04 00
- // ID3v2 flags %abcd0000
- // ID3v2 size 4 * %0xxxxxxx
-
- if (isset($thisfile_id3v2_flags['isfooter']) && $thisfile_id3v2_flags['isfooter']) {
- $footer = fread($this->getid3->fp, 10);
- if (substr($footer, 0, 3) == '3DI') {
- $thisfile_id3v2['footer'] = true;
- $thisfile_id3v2['majorversion_footer'] = ord($footer{3});
- $thisfile_id3v2['minorversion_footer'] = ord($footer{4});
- }
- if ($thisfile_id3v2['majorversion_footer'] <= 4) {
- $id3_flags = ord(substr($footer{5}));
- $thisfile_id3v2_flags['unsynch_footer'] = (bool) ($id3_flags & 0x80);
- $thisfile_id3v2_flags['extfoot_footer'] = (bool) ($id3_flags & 0x40);
- $thisfile_id3v2_flags['experim_footer'] = (bool) ($id3_flags & 0x20);
- $thisfile_id3v2_flags['isfooter_footer'] = (bool) ($id3_flags & 0x10);
-
- $thisfile_id3v2['footerlength'] = getid3_lib::BigEndian2Int(substr($footer, 6, 4), 1);
- }
- } // end footer
-
- if (isset($thisfile_id3v2['comments']['genre'])) {
- foreach ($thisfile_id3v2['comments']['genre'] as $key => $value) {
- unset($thisfile_id3v2['comments']['genre'][$key]);
- $thisfile_id3v2['comments'] = getid3_lib::array_merge_noclobber($thisfile_id3v2['comments'], array('genre'=>$this->ParseID3v2GenreString($value)));
- }
- }
-
- if (isset($thisfile_id3v2['comments']['track'])) {
- foreach ($thisfile_id3v2['comments']['track'] as $key => $value) {
- if (strstr($value, '/')) {
- list($thisfile_id3v2['comments']['tracknum'][$key], $thisfile_id3v2['comments']['totaltracks'][$key]) = explode('/', $thisfile_id3v2['comments']['track'][$key]);
- }
- }
- }
-
- if (!isset($thisfile_id3v2['comments']['year']) && !empty($thisfile_id3v2['comments']['recording_time'][0]) && preg_match('#^([0-9]{4})#', trim($thisfile_id3v2['comments']['recording_time'][0]), $matches)) {
- $thisfile_id3v2['comments']['year'] = array($matches[1]);
- }
-
-
- if (!empty($thisfile_id3v2['TXXX'])) {
- // MediaMonkey does this, maybe others: write a blank RGAD frame, but put replay-gain adjustment values in TXXX frames
- foreach ($thisfile_id3v2['TXXX'] as $txxx_array) {
- switch ($txxx_array['description']) {
- case 'replaygain_track_gain':
- if (empty($info['replay_gain']['track']['adjustment']) && !empty($txxx_array['data'])) {
- $info['replay_gain']['track']['adjustment'] = floatval(trim(str_replace('dB', '', $txxx_array['data'])));
- }
- break;
- case 'replaygain_track_peak':
- if (empty($info['replay_gain']['track']['peak']) && !empty($txxx_array['data'])) {
- $info['replay_gain']['track']['peak'] = floatval($txxx_array['data']);
- }
- break;
- case 'replaygain_album_gain':
- if (empty($info['replay_gain']['album']['adjustment']) && !empty($txxx_array['data'])) {
- $info['replay_gain']['album']['adjustment'] = floatval(trim(str_replace('dB', '', $txxx_array['data'])));
- }
- break;
- }
- }
- }
-
-
- // Set avdataoffset
- $info['avdataoffset'] = $thisfile_id3v2['headerlength'];
- if (isset($thisfile_id3v2['footer'])) {
- $info['avdataoffset'] += 10;
- }
-
- return true;
- }
-
-
- function ParseID3v2GenreString($genrestring) {
- // Parse genres into arrays of genreName and genreID
- // ID3v2.2.x, ID3v2.3.x: '(21)' or '(4)Eurodisco' or '(51)(39)' or '(55)((I think...)'
- // ID3v2.4.x: '21' $00 'Eurodisco' $00
- $clean_genres = array();
- if (strpos($genrestring, "\x00") === false) {
- $genrestring = preg_replace('#\(([0-9]{1,3})\)#', '$1'."\x00", $genrestring);
- }
- $genre_elements = explode("\x00", $genrestring);
- foreach ($genre_elements as $element) {
- $element = trim($element);
- if ($element) {
- if (preg_match('#^[0-9]{1,3}#', $element)) {
- $clean_genres[] = getid3_id3v1::LookupGenreName($element);
- } else {
- $clean_genres[] = str_replace('((', '(', $element);
- }
- }
- }
- return $clean_genres;
- }
-
-
- function ParseID3v2Frame(&$parsedFrame) {
-
- // shortcuts
- $info = &$this->getid3->info;
- $id3v2_majorversion = $info['id3v2']['majorversion'];
-
- $parsedFrame['framenamelong'] = $this->FrameNameLongLookup($parsedFrame['frame_name']);
- if (empty($parsedFrame['framenamelong'])) {
- unset($parsedFrame['framenamelong']);
- }
- $parsedFrame['framenameshort'] = $this->FrameNameShortLookup($parsedFrame['frame_name']);
- if (empty($parsedFrame['framenameshort'])) {
- unset($parsedFrame['framenameshort']);
- }
-
- if ($id3v2_majorversion >= 3) { // frame flags are not part of the ID3v2.2 standard
- if ($id3v2_majorversion == 3) {
- // Frame Header Flags
- // %abc00000 %ijk00000
- $parsedFrame['flags']['TagAlterPreservation'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x8000); // a - Tag alter preservation
- $parsedFrame['flags']['FileAlterPreservation'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x4000); // b - File alter preservation
- $parsedFrame['flags']['ReadOnly'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x2000); // c - Read only
- $parsedFrame['flags']['compression'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0080); // i - Compression
- $parsedFrame['flags']['Encryption'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0040); // j - Encryption
- $parsedFrame['flags']['GroupingIdentity'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0020); // k - Grouping identity
-
- } elseif ($id3v2_majorversion == 4) {
- // Frame Header Flags
- // %0abc0000 %0h00kmnp
- $parsedFrame['flags']['TagAlterPreservation'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x4000); // a - Tag alter preservation
- $parsedFrame['flags']['FileAlterPreservation'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x2000); // b - File alter preservation
- $parsedFrame['flags']['ReadOnly'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x1000); // c - Read only
- $parsedFrame['flags']['GroupingIdentity'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0040); // h - Grouping identity
- $parsedFrame['flags']['compression'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0008); // k - Compression
- $parsedFrame['flags']['Encryption'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0004); // m - Encryption
- $parsedFrame['flags']['Unsynchronisation'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0002); // n - Unsynchronisation
- $parsedFrame['flags']['DataLengthIndicator'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0001); // p - Data length indicator
-
- // Frame-level de-unsynchronisation - ID3v2.4
- if ($parsedFrame['flags']['Unsynchronisation']) {
- $parsedFrame['data'] = $this->DeUnsynchronise($parsedFrame['data']);
- }
-
- if ($parsedFrame['flags']['DataLengthIndicator']) {
- $parsedFrame['data_length_indicator'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 0, 4), 1);
- $parsedFrame['data'] = substr($parsedFrame['data'], 4);
- }
- }
-
- // Frame-level de-compression
- if ($parsedFrame['flags']['compression']) {
- $parsedFrame['decompressed_size'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 0, 4));
- if (!function_exists('gzuncompress')) {
- $info['warning'][] = 'gzuncompress() support required to decompress ID3v2 frame "'.$parsedFrame['frame_name'].'"';
- } else {
- if ($decompresseddata = @gzuncompress(substr($parsedFrame['data'], 4))) {
- //if ($decompresseddata = @gzuncompress($parsedFrame['data'])) {
- $parsedFrame['data'] = $decompresseddata;
- unset($decompresseddata);
- } else {
- $info['warning'][] = 'gzuncompress() failed on compressed contents of ID3v2 frame "'.$parsedFrame['frame_name'].'"';
- }
- }
- }
- }
-
- if (!empty($parsedFrame['flags']['DataLengthIndicator'])) {
- if ($parsedFrame['data_length_indicator'] != strlen($parsedFrame['data'])) {
- $info['warning'][] = 'ID3v2 frame "'.$parsedFrame['frame_name'].'" should be '.$parsedFrame['data_length_indicator'].' bytes long according to DataLengthIndicator, but found '.strlen($parsedFrame['data']).' bytes of data';
- }
- }
-
- if (isset($parsedFrame['datalength']) && ($parsedFrame['datalength'] == 0)) {
-
- $warning = 'Frame "'.$parsedFrame['frame_name'].'" at offset '.$parsedFrame['dataoffset'].' has no data portion';
- switch ($parsedFrame['frame_name']) {
- case 'WCOM':
- $warning .= ' (this is known to happen with files tagged by RioPort)';
- break;
-
- default:
- break;
- }
- $info['warning'][] = $warning;
-
- } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'UFID')) || // 4.1 UFID Unique file identifier
- (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'UFI'))) { // 4.1 UFI Unique file identifier
- // There may be more than one 'UFID' frame in a tag,
- // but only one with the same 'Owner identifier'.
- // <Header for 'Unique file identifier', ID: 'UFID'>
- // Owner identifier <text string> $00
- // Identifier <up to 64 bytes binary data>
- $exploded = explode("\x00", $parsedFrame['data'], 2);
- $parsedFrame['ownerid'] = (isset($exploded[0]) ? $exploded[0] : '');
- $parsedFrame['data'] = (isset($exploded[1]) ? $exploded[1] : '');
-
- } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'TXXX')) || // 4.2.2 TXXX User defined text information frame
- (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'TXX'))) { // 4.2.2 TXX User defined text information frame
- // There may be more than one 'TXXX' frame in each tag,
- // but only one with the same description.
- // <Header for 'User defined text information frame', ID: 'TXXX'>
- // Text encoding $xx
- // Description <text string according to encoding> $00 (00)
- // Value <text string according to encoding>
-
- $frame_offset = 0;
- $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1));
-
- if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) {
- $info['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding';
- }
- $frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset);
- if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) {
- $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00
- }
- $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
- if (ord($frame_description) === 0) {
- $frame_description = '';
- }
- $parsedFrame['encodingid'] = $frame_textencoding;
- $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding);
-
- $parsedFrame['description'] = $frame_description;
- $parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)));
- if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) {
- $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = trim(getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']));
- }
- //unset($parsedFrame['data']); do not unset, may be needed elsewhere, e.g. for replaygain
-
-
- } elseif ($parsedFrame['frame_name']{0} == 'T') { // 4.2. T??[?] Text information frame
- // There may only be one text information frame of its kind in an tag.
- // <Header for 'Text information frame', ID: 'T000' - 'TZZZ',
- // excluding 'TXXX' described in 4.2.6.>
- // Text encoding $xx
- // Information <text string(s) according to encoding>
-
- $frame_offset = 0;
- $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1));
- if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) {
- $info['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding';
- }
-
- $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset);
-
- $parsedFrame['encodingid'] = $frame_textencoding;
- $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding);
-
- if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) {
- $string = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']);
- $string = rtrim($string, "\x00"); // remove possible terminating null (put by encoding id or software bug)
- $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = $string;
- unset($string);
- }
-
- } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'WXXX')) || // 4.3.2 WXXX User defined URL link frame
- (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'WXX'))) { // 4.3.2 WXX User defined URL link frame
- // There may be more than one 'WXXX' frame in each tag,
- // but only one with the same description
- // <Header for 'User defined URL link frame', ID: 'WXXX'>
- // Text encoding $xx
- // Description <text string according to encoding> $00 (00)
- // URL <text string>
-
- $frame_offset = 0;
- $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1));
- if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) {
- $info['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding';
- }
- $frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset);
- if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) {
- $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00
- }
- $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
-
- if (ord($frame_description) === 0) {
- $frame_description = '';
- }
- $parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)));
-
- $frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding));
- if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) {
- $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00
- }
- if ($frame_terminatorpos) {
- // there are null bytes after the data - this is not according to spec
- // only use data up to first null byte
- $frame_urldata = (string) substr($parsedFrame['data'], 0, $frame_terminatorpos);
- } else {
- // no null bytes following data, just use all data
- $frame_urldata = (string) $parsedFrame['data'];
- }
-
- $parsedFrame['encodingid'] = $frame_textencoding;
- $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding);
-
- $parsedFrame['url'] = $frame_urldata;
- $parsedFrame['description'] = $frame_description;
- if (!empty($parsedFrame['framenameshort']) && $parsedFrame['url']) {
- $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['url']);
- }
- unset($parsedFrame['data']);
-
-
- } elseif ($parsedFrame['frame_name']{0} == 'W') { // 4.3. W??? URL link frames
- // There may only be one URL link frame of its kind in a tag,
- // except when stated otherwise in the frame description
- // <Header for 'URL link frame', ID: 'W000' - 'WZZZ', excluding 'WXXX'
- // described in 4.3.2.>
- // URL <text string>
-
- $parsedFrame['url'] = trim($parsedFrame['data']);
- if (!empty($parsedFrame['framenameshort']) && $parsedFrame['url']) {
- $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = $parsedFrame['url'];
- }
- unset($parsedFrame['data']);
-
-
- } elseif ((($id3v2_majorversion == 3) && ($parsedFrame['frame_name'] == 'IPLS')) || // 4.4 IPLS Involved people list (ID3v2.3 only)
- (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'IPL'))) { // 4.4 IPL Involved people list (ID3v2.2 only)
- // There may only be one 'IPL' frame in each tag
- // <Header for 'User defined URL link frame', ID: 'IPL'>
- // Text encoding $xx
- // People list strings <textstrings>
-
- $frame_offset = 0;
- $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1));
- if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) {
- $info['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding';
- }
- $parsedFrame['encodingid'] = $frame_textencoding;
- $parsedFrame['encoding'] = $this->TextEncodingNameLookup($parsedFrame['encodingid']);
-
- $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset);
- if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) {
- $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']);
- }
-
-
- } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'MCDI')) || // 4.4 MCDI Music CD identifier
- (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'MCI'))) { // 4.5 MCI Music CD identifier
- // There may only be one 'MCDI' frame in each tag
- // <Header for 'Music CD identifier', ID: 'MCDI'>
- // CD TOC <binary data>
-
- if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) {
- $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = $parsedFrame['data'];
- }
-
-
- } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'ETCO')) || // 4.5 ETCO Event timing codes
- (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'ETC'))) { // 4.6 ETC Event timing codes
- // There may only be one 'ETCO' frame in each tag
- // <Header for 'Event timing codes', ID: 'ETCO'>
- // Time stamp format $xx
- // Where time stamp format is:
- // $01 (32-bit value) MPEG frames from beginning of file
- // $02 (32-bit value) milliseconds from beginning of file
- // Followed by a list of key events in the following format:
- // Type of event $xx
- // Time stamp $xx (xx ...)
- // The 'Time stamp' is set to zero if directly at the beginning of the sound
- // or after the previous event. All events MUST be sorted in chronological order.
-
- $frame_offset = 0;
- $parsedFrame['timestampformat'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
-
- while ($frame_offset < strlen($parsedFrame['data'])) {
- $parsedFrame['typeid'] = substr($parsedFrame['data'], $frame_offset++, 1);
- $parsedFrame['type'] = $this->ETCOEventLookup($parsedFrame['typeid']);
- $parsedFrame['timestamp'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4));
- $frame_offset += 4;
- }
- unset($parsedFrame['data']);
-
-
- } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'MLLT')) || // 4.6 MLLT MPEG location lookup table
- (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'MLL'))) { // 4.7 MLL MPEG location lookup table
- // There may only be one 'MLLT' frame in each tag
- // <Header for 'Location lookup table', ID: 'MLLT'>
- // MPEG frames between reference $xx xx
- // Bytes between reference $xx xx xx
- // Milliseconds between reference $xx xx xx
- // Bits for bytes deviation $xx
- // Bits for milliseconds dev. $xx
- // Then for every reference the following data is included;
- // Deviation in bytes %xxx....
- // Deviation in milliseconds %xxx....
-
- $frame_offset = 0;
- $parsedFrame['framesbetweenreferences'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 0, 2));
- $parsedFrame['bytesbetweenreferences'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 2, 3));
- $parsedFrame['msbetweenreferences'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 5, 3));
- $parsedFrame['bitsforbytesdeviation'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 8, 1));
- $parsedFrame['bitsformsdeviation'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 9, 1));
- $parsedFrame['data'] = substr($parsedFrame['data'], 10);
- while ($frame_offset < strlen($parsedFrame['data'])) {
- $deviationbitstream .= getid3_lib::BigEndian2Bin(substr($parsedFrame['data'], $frame_offset++, 1));
- }
- $reference_counter = 0;
- while (strlen($deviationbitstream) > 0) {
- $parsedFrame[$reference_counter]['bytedeviation'] = bindec(substr($deviationbitstream, 0, $parsedFrame['bitsforbytesdeviation']));
- $parsedFrame[$reference_counter]['msdeviation'] = bindec(substr($deviationbitstream, $parsedFrame['bitsforbytesdeviation'], $parsedFrame['bitsformsdeviation']));
- $deviationbitstream = substr($deviationbitstream, $parsedFrame['bitsforbytesdeviation'] + $parsedFrame['bitsformsdeviation']);
- $reference_counter++;
- }
- unset($parsedFrame['data']);
-
-
- } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'SYTC')) || // 4.7 SYTC Synchronised tempo codes
- (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'STC'))) { // 4.8 STC Synchronised tempo codes
- // There may only be one 'SYTC' frame in each tag
- // <Header for 'Synchronised tempo codes', ID: 'SYTC'>
- // Time stamp format $xx
- // Tempo data <binary data>
- // Where time stamp format is:
- // $01 (32-bit value) MPEG frames from beginning of file
- // $02 (32-bit value) milliseconds from beginning of file
-
- $frame_offset = 0;
- $parsedFrame['timestampformat'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
- $timestamp_counter = 0;
- while ($frame_offset < strlen($parsedFrame['data'])) {
- $parsedFrame[$timestamp_counter]['tempo'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
- if ($parsedFrame[$timestamp_counter]['tempo'] == 255) {
- $parsedFrame[$timestamp_counter]['tempo'] += ord(substr($parsedFrame['data'], $frame_offset++, 1));
- }
- $parsedFrame[$timestamp_counter]['timestamp'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4));
- $frame_offset += 4;
- $timestamp_counter++;
- }
- unset($parsedFrame['data']);
-
-
- } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'USLT')) || // 4.8 USLT Unsynchronised lyric/text transcription
- (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'ULT'))) { // 4.9 ULT Unsynchronised lyric/text transcription
- // There may be more than one 'Unsynchronised lyrics/text transcription' frame
- // in each tag, but only one with the same language and content descriptor.
- // <Header for 'Unsynchronised lyrics/text transcription', ID: 'USLT'>
- // Text encoding $xx
- // Language $xx xx xx
- // Content descriptor <text string according to encoding> $00 (00)
- // Lyrics/text <full text string according to encoding>
-
- $frame_offset = 0;
- $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1));
- if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) {
- $info['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding';
- }
- $frame_language = substr($parsedFrame['data'], $frame_offset, 3);
- $frame_offset += 3;
- $frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset);
- if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) {
- $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00
- }
- $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
- if (ord($frame_description) === 0) {
- $frame_description = '';
- }
- $parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)));
-
- $parsedFrame['encodingid'] = $frame_textencoding;
- $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding);
-
- $parsedFrame['data'] = $parsedFrame['data'];
- $parsedFrame['language'] = $frame_language;
- $parsedFrame['languagename'] = $this->LanguageLookup($frame_language, false);
- $parsedFrame['description'] = $frame_description;
- if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) {
- $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']);
- }
- unset($parsedFrame['data']);
-
-
- } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'SYLT')) || // 4.9 SYLT Synchronised lyric/text
- (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'SLT'))) { // 4.10 SLT Synchronised lyric/text
- // There may be more than one 'SYLT' frame in each tag,
- // but only one with the same language and content descriptor.
- // <Header for 'Synchronised lyrics/text', ID: 'SYLT'>
- // Text encoding $xx
- // Language $xx xx xx
- // Time stamp format $xx
- // $01 (32-bit value) MPEG frames from beginning of file
- // $02 (32-bit value) milliseconds from beginning of file
- // Content type $xx
- // Content descriptor <text string according to encoding> $00 (00)
- // Terminated text to be synced (typically a syllable)
- // Sync identifier (terminator to above string) $00 (00)
- // Time stamp $xx (xx ...)
-
- $frame_offset = 0;
- $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1));
- if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) {
- $info['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding';
- }
- $frame_language = substr($parsedFrame['data'], $frame_offset, 3);
- $frame_offset += 3;
- $parsedFrame['timestampformat'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
- $parsedFrame['contenttypeid'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
- $parsedFrame['contenttype'] = $this->SYTLContentTypeLookup($parsedFrame['contenttypeid']);
- $parsedFrame['encodingid'] = $frame_textencoding;
- $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding);
-
- $parsedFrame['language'] = $frame_language;
- $parsedFrame['languagename'] = $this->LanguageLookup($frame_language, false);
-
- $timestampindex = 0;
- $frame_remainingdata = substr($parsedFrame['data'], $frame_offset);
- while (strlen($frame_remainingdata)) {
- $frame_offset = 0;
- $frame_terminatorpos = strpos($frame_remainingdata, $this->TextEncodingTerminatorLookup($frame_textencoding));
- if ($frame_terminatorpos === false) {
- $frame_remainingdata = '';
- } else {
- if (ord(substr($frame_remainingdata, $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) {
- $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00
- }
- $parsedFrame['lyrics'][$timestampindex]['data'] = substr($frame_remainingdata, $frame_offset, $frame_terminatorpos - $frame_offset);
-
- $frame_remainingdata = substr($frame_remainingdata, $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)));
- if (($timestampindex == 0) && (ord($frame_remainingdata{0}) != 0)) {
- // timestamp probably omitted for first data item
- } else {
- $parsedFrame['lyrics'][$timestampindex]['timestamp'] = getid3_lib::BigEndian2Int(substr($frame_remainingdata, 0, 4));
- $frame_remainingdata = substr($frame_remainingdata, 4);
- }
- $timestampindex++;
- }
- }
- unset($parsedFrame['data']);
-
-
- } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'COMM')) || // 4.10 COMM Comments
- (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'COM'))) { // 4.11 COM Comments
- // There may be more than one comment frame in each tag,
- // but only one with the same language and content descriptor.
- // <Header for 'Comment', ID: 'COMM'>
- // Text encoding $xx
- // Language $xx xx xx
- // Short content descrip. <text string according to encoding> $00 (00)
- // The actual text <full text string according to encoding>
-
- if (strlen($parsedFrame['data']) < 5) {
-
- $info['warning'][] = 'Invalid data (too short) for "'.$parsedFrame['frame_name'].'" frame at offset '.$parsedFrame['dataoffset'];
-
- } else {
-
- $frame_offset = 0;
- $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1));
- if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) {
- $info['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding';
- }
- $frame_language = substr($parsedFrame['data'], $frame_offset, 3);
- $frame_offset += 3;
- $frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset);
- if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) {
- $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00
- }
- $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
- if (ord($frame_description) === 0) {
- $frame_description = '';
- }
- $frame_text = (string) substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)));
-
- $parsedFrame['encodingid'] = $frame_textencoding;
- $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding);
-
- $parsedFrame['language'] = $frame_language;
- $parsedFrame['languagename'] = $this->LanguageLookup($frame_language, false);
- $parsedFrame['description'] = $frame_description;
- $parsedFrame['data'] = $frame_text;
- if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) {
- $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']);
- }
-
- }
-
- } elseif (($id3v2_majorversion >= 4) && ($parsedFrame['frame_name'] == 'RVA2')) { // 4.11 RVA2 Relative volume adjustment (2) (ID3v2.4+ only)
- // There may be more than one 'RVA2' frame in each tag,
- // but only one with the same identification string
- // <Header for 'Relative volume adjustment (2)', ID: 'RVA2'>
- // Identification <text string> $00
- // The 'identification' string is used to identify the situation and/or
- // device where this adjustment should apply. The following is then
- // repeated for every channel:
- // Type of channel $xx
- // Volume adjustment $xx xx
- // Bits representing peak $xx
- // Peak volume $xx (xx ...)
-
- $frame_terminatorpos = strpos($parsedFrame['data'], "\x00");
- $frame_idstring = substr($parsedFrame['data'], 0, $frame_terminatorpos);
- if (ord($frame_idstring) === 0) {
- $frame_idstring = '';
- }
- $frame_remainingdata = substr($parsedFrame['data'], $frame_terminatorpos + strlen("\x00"));
- $parsedFrame['description'] = $frame_idstring;
- $RVA2channelcounter = 0;
- while (strlen($frame_remainingdata) >= 5) {
- $frame_offset = 0;
- $frame_channeltypeid = ord(substr($frame_remainingdata, $frame_offset++, 1));
- $parsedFrame[$RVA2channelcounter]['channeltypeid'] = $frame_channeltypeid;
- $parsedFrame[$RVA2channelcounter]['channeltype'] = $this->RVA2ChannelTypeLookup($frame_channeltypeid);
- $parsedFrame[$RVA2channelcounter]['volumeadjust'] = getid3_lib::BigEndian2Int(substr($frame_remainingdata, $frame_offset, 2), false, true); // 16-bit signed
- $frame_offset += 2;
- $parsedFrame[$RVA2channelcounter]['bitspeakvolume'] = ord(substr($frame_remainingdata, $frame_offset++, 1));
- if (($parsedFrame[$RVA2channelcounter]['bitspeakvolume'] < 1) || ($parsedFrame[$RVA2channelcounter]['bitspeakvolume'] > 4)) {
- $info['warning'][] = 'ID3v2::RVA2 frame['.$RVA2channelcounter.'] contains invalid '.$parsedFrame[$RVA2channelcounter]['bitspeakvolume'].'-byte bits-representing-peak value';
- break;
- }
- $frame_bytespeakvolume = ceil($parsedFrame[$RVA2channelcounter]['bitspeakvolume'] / 8);
- $parsedFrame[$RVA2channelcounter]['peakvolume'] = getid3_lib::BigEndian2Int(substr($frame_remainingdata, $frame_offset, $frame_bytespeakvolume));
- $frame_remainingdata = substr($frame_remainingdata, $frame_offset + $frame_bytespeakvolume);
- $RVA2channelcounter++;
- }
- unset($parsedFrame['data']);
-
-
- } elseif ((($id3v2_majorversion == 3) && ($parsedFrame['frame_name'] == 'RVAD')) || // 4.12 RVAD Relative volume adjustment (ID3v2.3 only)
- (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'RVA'))) { // 4.12 RVA Relative volume adjustment (ID3v2.2 only)
- // There may only be one 'RVA' frame in each tag
- // <Header for 'Relative volume adjustment', ID: 'RVA'>
- // ID3v2.2 => Increment/decrement %000000ba
- // ID3v2.3 => Increment/decrement %00fedcba
- // Bits used for volume descr. $xx
- // Relative volume change, right $xx xx (xx ...) // a
- // Relative volume change, left $xx xx (xx ...) // b
- // Peak volume right $xx xx (xx ...)
- // Peak volume left $xx xx (xx ...)
- // ID3v2.3 only, optional (not present in ID3v2.2):
- // Relative volume change, right back $xx xx (xx ...) // c
- // Relative volume change, left back $xx xx (xx ...) // d
- // Peak volume right back $xx xx (xx ...)
- // Peak volume left back $xx xx (xx ...)
- // ID3v2.3 only, optional (not present in ID3v2.2):
- // Relative volume change, center $xx xx (xx ...) // e
- // Peak volume center $xx xx (xx ...)
- // ID3v2.3 only, optional (not present in ID3v2.2):
- // Relative volume change, bass $xx xx (xx ...) // f
- // Peak volume bass $xx xx (xx ...)
-
- $frame_offset = 0;
- $frame_incrdecrflags = getid3_lib::BigEndian2Bin(substr($parsedFrame['data'], $frame_offset++, 1));
- $parsedFrame['incdec']['right'] = (bool) substr($frame_incrdecrflags, 6, 1);
- $parsedFrame['incdec']['left'] = (bool) substr($frame_incrdecrflags, 7, 1);
- $parsedFrame['bitsvolume'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
- $frame_bytesvolume = ceil($parsedFrame['bitsvolume'] / 8);
- $parsedFrame['volumechange']['right'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume));
- if ($parsedFrame['incdec']['right'] === false) {
- $parsedFrame['volumechange']['right'] *= -1;
- }
- $frame_offset += $frame_bytesvolume;
- $parsedFrame['volumechange']['left'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume));
- if ($parsedFrame['incdec']['left'] === false) {
- $parsedFrame['volumechange']['left'] *= -1;
- }
- $frame_offset += $frame_bytesvolume;
- $parsedFrame['peakvolume']['right'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume));
- $frame_offset += $frame_bytesvolume;
- $parsedFrame['peakvolume']['left'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume));
- $frame_offset += $frame_bytesvolume;
- if ($id3v2_majorversion == 3) {
- $parsedFrame['data'] = substr($parsedFrame['data'], $frame_offset);
- if (strlen($parsedFrame['data']) > 0) {
- $parsedFrame['incdec']['rightrear'] = (bool) substr($frame_incrdecrflags, 4, 1);
- $parsedFrame['incdec']['leftrear'] = (bool) substr($frame_incrdecrflags, 5, 1);
- $parsedFrame['volumechange']['rightrear'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume));
- if ($parsedFrame['incdec']['rightrear'] === false) {
- $parsedFrame['volumechange']['rightrear'] *= -1;
- }
- $frame_offset += $frame_bytesvolume;
- $parsedFrame['volumechange']['leftrear'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume));
- if ($parsedFrame['incdec']['leftrear'] === false) {
- $parsedFrame['volumechange']['leftrear'] *= -1;
- }
- $frame_offset += $frame_bytesvolume;
- $parsedFrame['peakvolume']['rightrear'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume));
- $frame_offset += $frame_bytesvolume;
- $parsedFrame['peakvolume']['leftrear'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume));
- $frame_offset += $frame_bytesvolume;
- }
- $parsedFrame['data'] = substr($parsedFrame['data'], $frame_offset);
- if (strlen($parsedFrame['data']) > 0) {
- $parsedFrame['incdec']['center'] = (bool) substr($frame_incrdecrflags, 3, 1);
- $parsedFrame['volumechange']['center'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume));
- if ($parsedFrame['incdec']['center'] === false) {
- $parsedFrame['volumechange']['center'] *= -1;
- }
- $frame_offset += $frame_bytesvolume;
- $parsedFrame['peakvolume']['center'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume));
- $frame_offset += $frame_bytesvolume;
- }
- $parsedFrame['data'] = substr($parsedFrame['data'], $frame_offset);
- if (strlen($parsedFrame['data']) > 0) {
- $parsedFrame['incdec']['bass'] = (bool) substr($frame_incrdecrflags, 2, 1);
- $parsedFrame['volumechange']['bass'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume));
- if ($parsedFrame['incdec']['bass'] === false) {
- $parsedFrame['volumechange']['bass'] *= -1;
- }
- $frame_offset += $frame_bytesvolume;
- $parsedFrame['peakvolume']['bass'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume));
- $frame_offset += $frame_bytesvolume;
- }
- }
- unset($parsedFrame['data']);
-
-
- } elseif (($id3v2_majorversion >= 4) && ($parsedFrame['frame_name'] == 'EQU2')) { // 4.12 EQU2 Equalisation (2) (ID3v2.4+ only)
- // There may be more than one 'EQU2' frame in each tag,
- // but only one with the same identification string
- // <Header of 'Equalisation (2)', ID: 'EQU2'>
- // Interpolation method $xx
- // $00 Band
- // $01 Linear
- // Identification <text string> $00
- // The following is then repeated for every adjustment point
- // Frequency $xx xx
- // Volume adjustment $xx xx
-
- $frame_offset = 0;
- $frame_interpolationmethod = ord(substr($parsedFrame['data'], $frame_offset++, 1));
- $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
- $frame_idstring = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
- if (ord($frame_idstring) === 0) {
- $frame_idstring = '';
- }
- $parsedFrame['description'] = $frame_idstring;
- $frame_remainingdata = substr($parsedFrame['data'], $frame_terminatorpos + strlen("\x00"));
- while (strlen($frame_remainingdata)) {
- $frame_frequency = getid3_lib::BigEndian2Int(substr($frame_remainingdata, 0, 2)) / 2;
- $parsedFrame['data'][$frame_frequency] = getid3_lib::BigEndian2Int(substr($frame_remainingdata, 2, 2), false, true);
- $frame_remainingdata = substr($frame_remainingdata, 4);
- }
- $parsedFrame['interpolationmethod'] = $frame_interpolationmethod;
- unset($parsedFrame['data']);
-
-
- } elseif ((($id3v2_majorversion == 3) && ($parsedFrame['frame_name'] == 'EQUA')) || // 4.12 EQUA Equalisation (ID3v2.3 only)
- (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'EQU'))) { // 4.13 EQU Equalisation (ID3v2.2 only)
- // There may only be one 'EQUA' frame in each tag
- // <Header for 'Relative volume adjustment', ID: 'EQU'>
- // Adjustment bits $xx
- // This is followed by 2 bytes + ('adjustment bits' rounded up to the
- // nearest byte) for every equalisation band in the following format,
- // giving a frequency range of 0 - 32767Hz:
- // Increment/decrement %x (MSB of the Frequency)
- // Frequency (lower 15 bits)
- // Adjustment $xx (xx ...)
-
- $frame_offset = 0;
- $parsedFrame['adjustmentbits'] = substr($parsedFrame['data'], $frame_offset++, 1);
- $frame_adjustmentbytes = ceil($parsedFrame['adjustmentbits'] / 8);
-
- $frame_remainingdata = (string) substr($parsedFrame['data'], $frame_offset);
- while (strlen($frame_remainingdata) > 0) {
- $frame_frequencystr = getid3_lib::BigEndian2Bin(substr($frame_remainingdata, 0, 2));
- $frame_incdec = (bool) substr($frame_frequencystr, 0, 1);
- $frame_frequency = bindec(substr($frame_frequencystr, 1, 15));
- $parsedFrame[$frame_frequency]['incdec'] = $frame_incdec;
- $parsedFrame[$frame_frequency]['adjustment'] = getid3_lib::BigEndian2Int(substr($frame_remainingdata, 2, $frame_adjustmentbytes));
- if ($parsedFrame[$frame_frequency]['incdec'] === false) {
- $parsedFrame[$frame_frequency]['adjustment'] *= -1;
- }
- $frame_remainingdata = substr($frame_remainingdata, 2 + $frame_adjustmentbytes);
- }
- unset($parsedFrame['data']);
-
-
- } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'RVRB')) || // 4.13 RVRB Reverb
- (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'REV'))) { // 4.14 REV Reverb
- // There may only be one 'RVRB' frame in each tag.
- // <Header for 'Reverb', ID: 'RVRB'>
- // Reverb left (ms) $xx xx
- // Reverb right (ms) $xx xx
- // Reverb bounces, left $xx
- // Reverb bounces, right $xx
- // Reverb feedback, left to left $xx
- // Reverb feedback, left to right $xx
- // Reverb feedback, right to right $xx
- // Reverb feedback, right to left $xx
- // Premix left to right $xx
- // Premix right to left $xx
-
- $frame_offset = 0;
- $parsedFrame['left'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2));
- $frame_offset += 2;
- $parsedFrame['right'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2));
- $frame_offset += 2;
- $parsedFrame['bouncesL'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
- $parsedFrame['bouncesR'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
- $parsedFrame['feedbackLL'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
- $parsedFrame['feedbackLR'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
- $parsedFrame['feedbackRR'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
- $parsedFrame['feedbackRL'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
- $parsedFrame['premixLR'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
- $parsedFrame['premixRL'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
- unset($parsedFrame['data']);
-
-
- } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'APIC')) || // 4.14 APIC Attached picture
- (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'PIC'))) { // 4.15 PIC Attached picture
- // There may be several pictures attached to one file,
- // each in their individual 'APIC' frame, but only one
- // with the same content descriptor
- // <Header for 'Attached picture', ID: 'APIC'>
- // Text encoding $xx
- // ID3v2.3+ => MIME type <text string> $00
- // ID3v2.2 => Image format $xx xx xx
- // Picture type $xx
- // Description <text string according to encoding> $00 (00)
- // Picture data <binary data>
-
- $frame_offset = 0;
- $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1));
- if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) {
- $info['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding';
- }
-
- if ($id3v2_majorversion == 2 && strlen($parsedFrame['data']) > $frame_offset) {
- $frame_imagetype = substr($parsedFrame['data'], $frame_offset, 3);
- if (strtolower($frame_imagetype) == 'ima') {
- // complete hack for mp3Rage (www.chaoticsoftware.com) that puts ID3v2.3-formatted
- // MIME type instead of 3-char ID3v2.2-format image type (thanks xbhoffpacbell*net)
- $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
- $frame_mimetype = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
- if (ord($frame_mimetype) === 0) {
- $frame_mimetype = '';
- }
- $frame_imagetype = strtoupper(str_replace('image/', '', strtolower($frame_mimetype)));
- if ($frame_imagetype == 'JPEG') {
- $frame_imagetype = 'JPG';
- }
- $frame_offset = $frame_terminatorpos + strlen("\x00");
- } else {
- $frame_offset += 3;
- }
- }
- if ($id3v2_majorversion > 2 && strlen($parsedFrame['data']) > $frame_offset) {
- $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
- $frame_mimetype = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
- if (ord($frame_mimetype) === 0) {
- $frame_mimetype = '';
- }
- $frame_offset = $frame_terminatorpos + strlen("\x00");
- }
-
- $frame_picturetype = ord(substr($parsedFrame['data'], $frame_offset++, 1));
-
- if ($frame_offset >= $parsedFrame['datalength']) {
- $info['warning'][] = 'data portion of APIC frame is missing at offset '.($parsedFrame['dataoffset'] + 8 + $frame_offset);
- } else {
- $frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset);
- if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) {
- $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00
- }
- $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
- if (ord($frame_description) === 0) {
- $frame_description = '';
- }
- $parsedFrame['encodingid'] = $frame_textencoding;
- $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding);
-
- if ($id3v2_majorversion == 2) {
- $parsedFrame['imagetype'] = $frame_imagetype;
- } else {
- $parsedFrame['mime'] = $frame_mimetype;
- }
- $parsedFrame['picturetypeid'] = $frame_picturetype;
- $parsedFrame['picturetype'] = $this->APICPictureTypeLookup($frame_picturetype);
- $parsedFrame['description'] = $frame_description;
- $parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)));
- $parsedFrame['datalength'] = strlen($parsedFrame['data']);
-
- $parsedFrame['image_mime'] = '';
- $imageinfo = array();
- $imagechunkcheck = getid3_lib::GetDataImageSize($parsedFrame['data'], $imageinfo);
- if (($imagechunkcheck[2] >= 1) && ($imagechunkcheck[2] <= 3)) {
- $parsedFrame['image_mime'] = 'image/'.getid3_lib::ImageTypesLookup($imagechunkcheck[2]);
- if ($imagechunkcheck[0]) {
- $parsedFrame['image_width'] = $imagechunkcheck[0];
- }
- if ($imagechunkcheck[1]) {
- $parsedFrame['image_height'] = $imagechunkcheck[1];
- }
- }
-
- do {
- if ($this->inline_attachments === false) {
- // skip entirely
- unset($parsedFrame['data']);
- break;
- }
- if ($this->inline_attachments === true) {
- // great
- } elseif (is_int($this->inline_attachments)) {
- if ($this->inline_attachments < $parsedFrame['data_length']) {
- // too big, skip
- $info['warning'][] = 'attachment at '.$frame_offset.' is too large to process inline ('.number_format($parsedFrame['data_length']).' bytes)';
- unset($parsedFrame['data']);
- break;
- }
- } elseif (is_string($this->inline_attachments)) {
- $this->inline_attachments = rtrim(str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $this->inline_attachments), DIRECTORY_SEPARATOR);
- if (!is_dir($this->inline_attachments) || !is_writable($this->inline_attachments)) {
- // cannot write, skip
- $info['warning'][] = 'attachment at '.$frame_offset.' cannot be saved to "'.$this->inline_attachments.'" (not writable)';
- unset($parsedFrame['data']);
- break;
- }
- }
- // if we get this far, must be OK
- if (is_string($this->inline_attachments)) {
- $destination_filename = $this->inline_attachments.DIRECTORY_SEPARATOR.md5($info['filenamepath']).'_'.$frame_offset;
- if (!file_exists($destination_filename) || is_writable($destination_filename)) {
- file_put_contents($destination_filename, $parsedFrame['data']);
- } else {
- $info['warning'][] = 'attachment at '.$frame_offset.' cannot be saved to "'.$destination_filename.'" (not writable)';
- }
- $parsedFrame['data_filename'] = $destination_filename;
- unset($parsedFrame['data']);
- } else {
- if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) {
- if (!isset($info['id3v2']['comments']['picture'])) {
- $info['id3v2']['comments']['picture'] = array();
- }
- $info['id3v2']['comments']['picture'][] = array('data'=>$parsedFrame['data'], 'image_mime'=>$parsedFrame['image_mime']);
- }
- }
- } while (false);
- }
-
- } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'GEOB')) || // 4.15 GEOB General encapsulated object
- (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'GEO'))) { // 4.16 GEO General encapsulated object
- // There may be more than one 'GEOB' frame in each tag,
- // but only one with the same content descriptor
- // <Header for 'General encapsulated object', ID: 'GEOB'>
- // Text encoding $xx
- // MIME type <text string> $00
- // Filename <text string according to encoding> $00 (00)
- // Content description <text string according to encoding> $00 (00)
- // Encapsulated object <binary data>
-
- $frame_offset = 0;
- $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1));
- if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) {
- $info['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding';
- }
- $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
- $frame_mimetype = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
- if (ord($frame_mimetype) === 0) {
- $frame_mimetype = '';
- }
- $frame_offset = $frame_terminatorpos + strlen("\x00");
-
- $frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset);
- if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) {
- $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00
- }
- $frame_filename = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
- if (ord($frame_filename) === 0) {
- $frame_filename = '';
- }
- $frame_offset = $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding));
-
- $frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset);
- if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) {
- $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00
- }
- $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
- if (ord($frame_description) === 0) {
- $frame_description = '';
- }
- $frame_offset = $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding));
-
- $parsedFrame['objectdata'] = (string) substr($parsedFrame['data'], $frame_offset);
- $parsedFrame['encodingid'] = $frame_textencoding;
- $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding);
-
- $parsedFrame['mime'] = $frame_mimetype;
- $parsedFrame['filename'] = $frame_filename;
- $parsedFrame['description'] = $frame_description;
- unset($parsedFrame['data']);
-
-
- } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'PCNT')) || // 4.16 PCNT Play counter
- (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'CNT'))) { // 4.17 CNT Play counter
- // There may only be one 'PCNT' frame in each tag.
- // When the counter reaches all one's, one byte is inserted in
- // front of the counter thus making the counter eight bits bigger
- // <Header for 'Play counter', ID: 'PCNT'>
- // Counter $xx xx xx xx (xx ...)
-
- $parsedFrame['data'] = getid3_lib::BigEndian2Int($parsedFrame['data']);
-
-
- } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'POPM')) || // 4.17 POPM Popularimeter
- (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'POP'))) { // 4.18 POP Popularimeter
- // There may be more than one 'POPM' frame in each tag,
- // but only one with the same email address
- // <Header for 'Popularimeter', ID: 'POPM'>
- // Email to user <text string> $00
- // Rating $xx
- // Counter $xx xx xx xx (xx ...)
-
- $frame_offset = 0;
- $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
- $frame_emailaddress = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
- if (ord($frame_emailaddress) === 0) {
- $frame_emailaddress = '';
- }
- $frame_offset = $frame_terminatorpos + strlen("\x00");
- $frame_rating = ord(substr($parsedFrame['data'], $frame_offset++, 1));
- $parsedFrame['counter'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset));
- $parsedFrame['email'] = $frame_emailaddress;
- $parsedFrame['rating'] = $frame_rating;
- unset($parsedFrame['data']);
-
-
- } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'RBUF')) || // 4.18 RBUF Recommended buffer size
- (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'BUF'))) { // 4.19 BUF Recommended buffer size
- // There may only be one 'RBUF' frame in each tag
- // <Header for 'Recommended buffer size', ID: 'RBUF'>
- // Buffer size $xx xx xx
- // Embedded info flag %0000000x
- // Offset to next tag $xx xx xx xx
-
- $frame_offset = 0;
- $parsedFrame['buffersize'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 3));
- $frame_offset += 3;
-
- $frame_embeddedinfoflags = getid3_lib::BigEndian2Bin(substr($parsedFrame['data'], $frame_offset++, 1));
- $parsedFrame['flags']['embededinfo'] = (bool) substr($frame_embeddedinfoflags, 7, 1);
- $parsedFrame['nexttagoffset'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4));
- unset($parsedFrame['data']);
-
-
- } elseif (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'CRM')) { // 4.20 Encrypted meta frame (ID3v2.2 only)
- // There may be more than one 'CRM' frame in a tag,
- // but only one with the same 'owner identifier'
- // <Header for 'Encrypted meta frame', ID: 'CRM'>
- // Owner identifier <textstring> $00 (00)
- // Content/explanation <textstring> $00 (00)
- // Encrypted datablock <binary data>
-
- $frame_offset = 0;
- $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
- $frame_ownerid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
- $frame_offset = $frame_terminatorpos + strlen("\x00");
-
- $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
- $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
- if (ord($frame_description) === 0) {
- $frame_description = '';
- }
- $frame_offset = $frame_terminatorpos + strlen("\x00");
-
- $parsedFrame['ownerid'] = $frame_ownerid;
- $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset);
- $parsedFrame['description'] = $frame_description;
- unset($parsedFrame['data']);
-
-
- } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'AENC')) || // 4.19 AENC Audio encryption
- (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'CRA'))) { // 4.21 CRA Audio encryption
- // There may be more than one 'AENC' frames in a tag,
- // but only one with the same 'Owner identifier'
- // <Header for 'Audio encryption', ID: 'AENC'>
- // Owner identifier <text string> $00
- // Preview start $xx xx
- // Preview length $xx xx
- // Encryption info <binary data>
-
- $frame_offset = 0;
- $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
- $frame_ownerid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
- if (ord($frame_ownerid) === 0) {
- $frame_ownerid == '';
- }
- $frame_offset = $frame_terminatorpos + strlen("\x00");
- $parsedFrame['ownerid'] = $frame_ownerid;
- $parsedFrame['previewstart'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2));
- $frame_offset += 2;
- $parsedFrame['previewlength'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2));
- $frame_offset += 2;
- $parsedFrame['encryptioninfo'] = (string) substr($parsedFrame['data'], $frame_offset);
- unset($parsedFrame['data']);
-
-
- } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'LINK')) || // 4.20 LINK Linked information
- (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'LNK'))) { // 4.22 LNK Linked information
- // There may be more than one 'LINK' frame in a tag,
- // but only one with the same contents
- // <Header for 'Linked information', ID: 'LINK'>
- // ID3v2.3+ => Frame identifier $xx xx xx xx
- // ID3v2.2 => Frame identifier $xx xx xx
- // URL <text string> $00
- // ID and additional data <text string(s)>
-
- $frame_offset = 0;
- if ($id3v2_majorversion == 2) {
- $parsedFrame['frameid'] = substr($parsedFrame['data'], $frame_offset, 3);
- $frame_offset += 3;
- } else {
- $parsedFrame['frameid'] = substr($parsedFrame['data'], $frame_offset, 4);
- $frame_offset += 4;
- }
-
- $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
- $frame_url = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
- if (ord($frame_url) === 0) {
- $frame_url = '';
- }
- $frame_offset = $frame_terminatorpos + strlen("\x00");
- $parsedFrame['url'] = $frame_url;
-
- $parsedFrame['additionaldata'] = (string) substr($parsedFrame['data'], $frame_offset);
- if (!empty($parsedFrame['framenameshort']) && $parsedFrame['url']) {
- $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = utf8_encode($parsedFrame['url']);
- }
- unset($parsedFrame['data']);
-
-
- } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'POSS')) { // 4.21 POSS Position synchronisation frame (ID3v2.3+ only)
- // There may only be one 'POSS' frame in each tag
- // <Head for 'Position synchronisation', ID: 'POSS'>
- // Time stamp format $xx
- // Position $xx (xx ...)
-
- $frame_offset = 0;
- $parsedFrame['timestampformat'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
- $parsedFrame['position'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset));
- unset($parsedFrame['data']);
-
-
- } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'USER')) { // 4.22 USER Terms of use (ID3v2.3+ only)
- // There may be more than one 'Terms of use' frame in a tag,
- // but only one with the same 'Language'
- // <Header for 'Terms of use frame', ID: 'USER'>
- // Text encoding $xx
- // Language $xx xx xx
- // The actual text <text string according to encoding>
-
- $frame_offset = 0;
- $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1));
- if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) {
- $info['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding';
- }
- $frame_language = substr($parsedFrame['data'], $frame_offset, 3);
- $frame_offset += 3;
- $parsedFrame['language'] = $frame_language;
- $parsedFrame['languagename'] = $this->LanguageLookup($frame_language, false);
- $parsedFrame['encodingid'] = $frame_textencoding;
- $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding);
-
- $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset);
- if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) {
- $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']);
- }
- unset($parsedFrame['data']);
-
-
- } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'OWNE')) { // 4.23 OWNE Ownership frame (ID3v2.3+ only)
- // There may only be one 'OWNE' frame in a tag
- // <Header for 'Ownership frame', ID: 'OWNE'>
- // Text encoding $xx
- // Price paid <text string> $00
- // Date of purch. <text string>
- // Seller <text string according to encoding>
-
- $frame_offset = 0;
- $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1));
- if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) {
- $info['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding';
- }
- $parsedFrame['encodingid'] = $frame_textencoding;
- $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding);
-
- $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
- $frame_pricepaid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
- $frame_offset = $frame_terminatorpos + strlen("\x00");
-
- $parsedFrame['pricepaid']['currencyid'] = substr($frame_pricepaid, 0, 3);
- $parsedFrame['pricepaid']['currency'] = $this->LookupCurrencyUnits($parsedFrame['pricepaid']['currencyid']);
- $parsedFrame['pricepaid']['value'] = substr($frame_pricepaid, 3);
-
- $parsedFrame['purchasedate'] = substr($parsedFrame['data'], $frame_offset, 8);
- if (!$this->IsValidDateStampString($parsedFrame['purchasedate'])) {
- $parsedFrame['purchasedateunix'] = mktime (0, 0, 0, substr($parsedFrame['purchasedate'], 4, 2), substr($parsedFrame['purchasedate'], 6, 2), substr($parsedFrame['purchasedate'], 0, 4));
- }
- $frame_offset += 8;
-
- $parsedFrame['seller'] = (string) substr($parsedFrame['data'], $frame_offset);
- unset($parsedFrame['data']);
-
-
- } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'COMR')) { // 4.24 COMR Commercial frame (ID3v2.3+ only)
- // There may be more than one 'commercial frame' in a tag,
- // but no two may be identical
- // <Header for 'Commercial frame', ID: 'COMR'>
- // Text encoding $xx
- // Price string <text string> $00
- // Valid until <text string>
- // Contact URL <text string> $00
- // Received as $xx
- // Name of seller <text string according to encoding> $00 (00)
- // Description <text string according to encoding> $00 (00)
- // Picture MIME type <string> $00
- // Seller logo <binary data>
-
- $frame_offset = 0;
- $frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1));
- if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) {
- $info['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding';
- }
-
- $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
- $frame_pricestring = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
- $frame_offset = $frame_terminatorpos + strlen("\x00");
- $frame_rawpricearray = explode('/', $frame_pricestring);
- foreach ($frame_rawpricearray as $key => $val) {
- $frame_currencyid = substr($val, 0, 3);
- $parsedFrame['price'][$frame_currencyid]['currency'] = $this->LookupCurrencyUnits($frame_currencyid);
- $parsedFrame['price'][$frame_currencyid]['value'] = substr($val, 3);
- }
-
- $frame_datestring = substr($parsedFrame['data'], $frame_offset, 8);
- $frame_offset += 8;
-
- $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
- $frame_contacturl = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
- $frame_offset = $frame_terminatorpos + strlen("\x00");
-
- $frame_receivedasid = ord(substr($parsedFrame['data'], $frame_offset++, 1));
-
- $frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset);
- if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) {
- $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00
- }
- $frame_sellername = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
- if (ord($frame_sellername) === 0) {
- $frame_sellername = '';
- }
- $frame_offset = $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding));
-
- $frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset);
- if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) {
- $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00
- }
- $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
- if (ord($frame_description) === 0) {
- $frame_description = '';
- }
- $frame_offset = $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding));
-
- $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
- $frame_mimetype = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
- $frame_offset = $frame_terminatorpos + strlen("\x00");
-
- $frame_sellerlogo = substr($parsedFrame['data'], $frame_offset);
-
- $parsedFrame['encodingid'] = $frame_textencoding;
- $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding);
-
- $parsedFrame['pricevaliduntil'] = $frame_datestring;
- $parsedFrame['contacturl'] = $frame_contacturl;
- $parsedFrame['receivedasid'] = $frame_receivedasid;
- $parsedFrame['receivedas'] = $this->COMRReceivedAsLookup($frame_receivedasid);
- $parsedFrame['sellername'] = $frame_sellername;
- $parsedFrame['description'] = $frame_description;
- $parsedFrame['mime'] = $frame_mimetype;
- $parsedFrame['logo'] = $frame_sellerlogo;
- unset($parsedFrame['data']);
-
-
- } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'ENCR')) { // 4.25 ENCR Encryption method registration (ID3v2.3+ only)
- // There may be several 'ENCR' frames in a tag,
- // but only one containing the same symbol
- // and only one containing the same owner identifier
- // <Header for 'Encryption method registration', ID: 'ENCR'>
- // Owner identifier <text string> $00
- // Method symbol $xx
- // Encryption data <binary data>
-
- $frame_offset = 0;
- $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
- $frame_ownerid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
- if (ord($frame_ownerid) === 0) {
- $frame_ownerid = '';
- }
- $frame_offset = $frame_terminatorpos + strlen("\x00");
-
- $parsedFrame['ownerid'] = $frame_ownerid;
- $parsedFrame['methodsymbol'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
- $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset);
-
-
- } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'GRID')) { // 4.26 GRID Group identification registration (ID3v2.3+ only)
-
- // There may be several 'GRID' frames in a tag,
- // but only one containing the same symbol
- // and only one containing the same owner identifier
- // <Header for 'Group ID registration', ID: 'GRID'>
- // Owner identifier <text string> $00
- // Group symbol $xx
- // Group dependent data <binary data>
-
- $frame_offset = 0;
- $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
- $frame_ownerid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
- if (ord($frame_ownerid) === 0) {
- $frame_ownerid = '';
- }
- $frame_offset = $frame_terminatorpos + strlen("\x00");
-
- $parsedFrame['ownerid'] = $frame_ownerid;
- $parsedFrame['groupsymbol'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
- $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset);
-
-
- } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'PRIV')) { // 4.27 PRIV Private frame (ID3v2.3+ only)
- // The tag may contain more than one 'PRIV' frame
- // but only with different contents
- // <Header for 'Private frame', ID: 'PRIV'>
- // Owner identifier <text string> $00
- // The private data <binary data>
-
- $frame_offset = 0;
- $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
- $frame_ownerid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
- if (ord($frame_ownerid) === 0) {
- $frame_ownerid = '';
- }
- $frame_offset = $frame_terminatorpos + strlen("\x00");
-
- $parsedFrame['ownerid'] = $frame_ownerid;
- $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset);
-
-
- } elseif (($id3v2_majorversion >= 4) && ($parsedFrame['frame_name'] == 'SIGN')) { // 4.28 SIGN Signature frame (ID3v2.4+ only)
- // There may be more than one 'signature frame' in a tag,
- // but no two may be identical
- // <Header for 'Signature frame', ID: 'SIGN'>
- // Group symbol $xx
- // Signature <binary data>
-
- $frame_offset = 0;
- $parsedFrame['groupsymbol'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
- $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset);
-
-
- } elseif (($id3v2_majorversion >= 4) && ($parsedFrame['frame_name'] == 'SEEK')) { // 4.29 SEEK Seek frame (ID3v2.4+ only)
- // There may only be one 'seek frame' in a tag
- // <Header for 'Seek frame', ID: 'SEEK'>
- // Minimum offset to next tag $xx xx xx xx
-
- $frame_offset = 0;
- $parsedFrame['data'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4));
-
-
- } elseif (($id3v2_majorversion >= 4) && ($parsedFrame['frame_name'] == 'ASPI')) { // 4.30 ASPI Audio seek point index (ID3v2.4+ only)
- // There may only be one 'audio seek point index' frame in a tag
- // <Header for 'Seek Point Index', ID: 'ASPI'>
- // Indexed data start (S) $xx xx xx xx
- // Indexed data length (L) $xx xx xx xx
- // Number of index points (N) $xx xx
- // Bits per index point (b) $xx
- // Then for every index point the following data is included:
- // Fraction at index (Fi) $xx (xx)
-
- $frame_offset = 0;
- $parsedFrame['datastart'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4));
- $frame_offset += 4;
- $parsedFrame['indexeddatalength'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4));
- $frame_offset += 4;
- $parsedFrame['indexpoints'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2));
- $frame_offset += 2;
- $parsedFrame['bitsperpoint'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
- $frame_bytesperpoint = ceil($parsedFrame['bitsperpoint'] / 8);
- for ($i = 0; $i < $frame_indexpoints; $i++) {
- $parsedFrame['indexes'][$i] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesperpoint));
- $frame_offset += $frame_bytesperpoint;
- }
- unset($parsedFrame['data']);
-
- } elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'RGAD')) { // Replay Gain Adjustment
- // http://privatewww.essex.ac.uk/~djmrob/replaygain/file_format_id3v2.html
- // There may only be one 'RGAD' frame in a tag
- // <Header for 'Replay Gain Adjustment', ID: 'RGAD'>
- // Peak Amplitude $xx $xx $xx $xx
- // Radio Replay Gain Adjustment %aaabbbcd %dddddddd
- // Audiophile Replay Gain Adjustment %aaabbbcd %dddddddd
- // a - name code
- // b - originator code
- // c - sign bit
- // d - replay gain adjustment
-
- $frame_offset = 0;
- $parsedFrame['peakamplitude'] = getid3_lib::BigEndian2Float(substr($parsedFrame['data'], $frame_offset, 4));
- $frame_offset += 4;
- $rg_track_adjustment = getid3_lib::Dec2Bin(substr($parsedFrame['data'], $frame_offset, 2));
- $frame_offset += 2;
- $rg_album_adjustment = getid3_lib::Dec2Bin(substr($parsedFrame['data'], $frame_offset, 2));
- $frame_offset += 2;
- $parsedFrame['raw']['track']['name'] = getid3_lib::Bin2Dec(substr($rg_track_adjustment, 0, 3));
- $parsedFrame['raw']['track']['originator'] = getid3_lib::Bin2Dec(substr($rg_track_adjustment, 3, 3));
- $parsedFrame['raw']['track']['signbit'] = getid3_lib::Bin2Dec(substr($rg_track_adjustment, 6, 1));
- $parsedFrame['raw']['track']['adjustment'] = getid3_lib::Bin2Dec(substr($rg_track_adjustment, 7, 9));
- $parsedFrame['raw']['album']['name'] = getid3_lib::Bin2Dec(substr($rg_album_adjustment, 0, 3));
- $parsedFrame['raw']['album']['originator'] = getid3_lib::Bin2Dec(substr($rg_album_adjustment, 3, 3));
- $parsedFrame['raw']['album']['signbit'] = getid3_lib::Bin2Dec(substr($rg_album_adjustment, 6, 1));
- $parsedFrame['raw']['album']['adjustment'] = getid3_lib::Bin2Dec(substr($rg_album_adjustment, 7, 9));
- $parsedFrame['track']['name'] = getid3_lib::RGADnameLookup($parsedFrame['raw']['track']['name']);
- $parsedFrame['track']['originator'] = getid3_lib::RGADoriginatorLookup($parsedFrame['raw']['track']['originator']);
- $parsedFrame['track']['adjustment'] = getid3_lib::RGADadjustmentLookup($parsedFrame['raw']['track']['adjustment'], $parsedFrame['raw']['track']['signbit']);
- $parsedFrame['album']['name'] = getid3_lib::RGADnameLookup($parsedFrame['raw']['album']['name']);
- $parsedFrame['album']['originator'] = getid3_lib::RGADoriginatorLookup($parsedFrame['raw']['album']['originator']);
- $parsedFrame['album']['adjustment'] = getid3_lib::RGADadjustmentLookup($parsedFrame['raw']['album']['adjustment'], $parsedFrame['raw']['album']['signbit']);
-
- $info['replay_gain']['track']['peak'] = $parsedFrame['peakamplitude'];
- $info['replay_gain']['track']['originator'] = $parsedFrame['track']['originator'];
- $info['replay_gain']['track']['adjustment'] = $parsedFrame['track']['adjustment'];
- $info['replay_gain']['album']['originator'] = $parsedFrame['album']['originator'];
- $info['replay_gain']['album']['adjustment'] = $parsedFrame['album']['adjustment'];
-
- unset($parsedFrame['data']);
-
- }
-
- return true;
- }
-
-
- function DeUnsynchronise($data) {
- return str_replace("\xFF\x00", "\xFF", $data);
- }
-
- function LookupExtendedHeaderRestrictionsTagSizeLimits($index) {
- static $LookupExtendedHeaderRestrictionsTagSizeLimits = array(
- 0x00 => 'No more than 128 frames and 1 MB total tag size',
- 0x01 => 'No more than 64 frames and 128 KB total tag size',
- 0x02 => 'No more than 32 frames and 40 KB total tag size',
- 0x03 => 'No more than 32 frames and 4 KB total tag size',
- );
- return (isset($LookupExtendedHeaderRestrictionsTagSizeLimits[$index]) ? $LookupExtendedHeaderRestrictionsTagSizeLimits[$index] : '');
- }
-
- function LookupExtendedHeaderRestrictionsTextEncodings($index) {
- static $LookupExtendedHeaderRestrictionsTextEncodings = array(
- 0x00 => 'No restrictions',
- 0x01 => 'Strings are only encoded with ISO-8859-1 or UTF-8',
- );
- return (isset($LookupExtendedHeaderRestrictionsTextEncodings[$index]) ? $LookupExtendedHeaderRestrictionsTextEncodings[$index] : '');
- }
-
- function LookupExtendedHeaderRestrictionsTextFieldSize($index) {
- static $LookupExtendedHeaderRestrictionsTextFieldSize = array(
- 0x00 => 'No restrictions',
- 0x01 => 'No string is longer than 1024 characters',
- 0x02 => 'No string is longer than 128 characters',
- 0x03 => 'No string is longer than 30 characters',
- );
- return (isset($LookupExtendedHeaderRestrictionsTextFieldSize[$index]) ? $LookupExtendedHeaderRestrictionsTextFieldSize[$index] : '');
- }
-
- function LookupExtendedHeaderRestrictionsImageEncoding($index) {
- static $LookupExtendedHeaderRestrictionsImageEncoding = array(
- 0x00 => 'No restrictions',
- 0x01 => 'Images are encoded only with PNG or JPEG',
- );
- return (isset($LookupExtendedHeaderRestrictionsImageEncoding[$index]) ? $LookupExtendedHeaderRestrictionsImageEncoding[$index] : '');
- }
-
- function LookupExtendedHeaderRestrictionsImageSizeSize($index) {
- static $LookupExtendedHeaderRestrictionsImageSizeSize = array(
- 0x00 => 'No restrictions',
- 0x01 => 'All images are 256x256 pixels or smaller',
- 0x02 => 'All images are 64x64 pixels or smaller',
- 0x03 => 'All images are exactly 64x64 pixels, unless required otherwise',
- );
- return (isset($LookupExtendedHeaderRestrictionsImageSizeSize[$index]) ? $LookupExtendedHeaderRestrictionsImageSizeSize[$index] : '');
- }
-
- function LookupCurrencyUnits($currencyid) {
-
- $begin = __LINE__;
-
- /** This is not a comment!
-
-
- AED Dirhams
- AFA Afghanis
- ALL Leke
- AMD Drams
- ANG Guilders
- AOA Kwanza
- ARS Pesos
- ATS Schillings
- AUD Dollars
- AWG Guilders
- AZM Manats
- BAM Convertible Marka
- BBD Dollars
- BDT Taka
- BEF Francs
- BGL Leva
- BHD Dinars
- BIF Francs
- BMD Dollars
- BND Dollars
- BOB Bolivianos
- BRL Brazil Real
- BSD Dollars
- BTN Ngultrum
- BWP Pulas
- BYR Rubles
- BZD Dollars
- CAD Dollars
- CDF Congolese Francs
- CHF Francs
- CLP Pesos
- CNY Yuan Renminbi
- COP Pesos
- CRC Colones
- CUP Pesos
- CVE Escudos
- CYP Pounds
- CZK Koruny
- DEM Deutsche Marks
- DJF Francs
- DKK Kroner
- DOP Pesos
- DZD Algeria Dinars
- EEK Krooni
- EGP Pounds
- ERN Nakfa
- ESP Pesetas
- ETB Birr
- EUR Euro
- FIM Markkaa
- FJD Dollars
- FKP Pounds
- FRF Francs
- GBP Pounds
- GEL Lari
- GGP Pounds
- GHC Cedis
- GIP Pounds
- GMD Dalasi
- GNF Francs
- GRD Drachmae
- GTQ Quetzales
- GYD Dollars
- HKD Dollars
- HNL Lempiras
- HRK Kuna
- HTG Gourdes
- HUF Forints
- IDR Rupiahs
- IEP Pounds
- ILS New Shekels
- IMP Pounds
- INR Rupees
- IQD Dinars
- IRR Rials
- ISK Kronur
- ITL Lire
- JEP Pounds
- JMD Dollars
- JOD Dinars
- JPY Yen
- KES Shillings
- KGS Soms
- KHR Riels
- KMF Francs
- KPW Won
- KWD Dinars
- KYD Dollars
- KZT Tenge
- LAK Kips
- LBP Pounds
- LKR Rupees
- LRD Dollars
- LSL Maloti
- LTL Litai
- LUF Francs
- LVL Lati
- LYD Dinars
- MAD Dirhams
- MDL Lei
- MGF Malagasy Francs
- MKD Denars
- MMK Kyats
- MNT Tugriks
- MOP Patacas
- MRO Ouguiyas
- MTL Liri
- MUR Rupees
- MVR Rufiyaa
- MWK Kwachas
- MXN Pesos
- MYR Ringgits
- MZM Meticais
- NAD Dollars
- NGN Nairas
- NIO Gold Cordobas
- NLG Guilders
- NOK Krone
- NPR Nepal Rupees
- NZD Dollars
- OMR Rials
- PAB Balboa
- PEN Nuevos Soles
- PGK Kina
- PHP Pesos
- PKR Rupees
- PLN Zlotych
- PTE Escudos
- PYG Guarani
- QAR Rials
- ROL Lei
- RUR Rubles
- RWF Rwanda Francs
- SAR Riyals
- SBD Dollars
- SCR Rupees
- SDD Dinars
- SEK Kronor
- SGD Dollars
- SHP Pounds
- SIT Tolars
- SKK Koruny
- SLL Leones
- SOS Shillings
- SPL Luigini
- SRG Guilders
- STD Dobras
- SVC Colones
- SYP Pounds
- SZL Emalangeni
- THB Baht
- TJR Rubles
- TMM Manats
- TND Dinars
- TOP Pa'anga
- TRL Liras
- TTD Dollars
- TVD Tuvalu Dollars
- TWD New Dollars
- TZS Shillings
- UAH Hryvnia
- UGX Shillings
- USD Dollars
- UYU Pesos
- UZS Sums
- VAL Lire
- VEB Bolivares
- VND Dong
- VUV Vatu
- WST Tala
- XAF Francs
- XAG Ounces
- XAU Ounces
- XCD Dollars
- XDR Special Drawing Rights
- XPD Ounces
- XPF Francs
- XPT Ounces
- YER Rials
- YUM New Dinars
- ZAR Rand
- ZMK Kwacha
- ZWD Zimbabwe Dollars
-
- */
-
- return getid3_lib::EmbeddedLookup($currencyid, $begin, __LINE__, __FILE__, 'id3v2-currency-units');
- }
-
-
- function LookupCurrencyCountry($currencyid) {
-
- $begin = __LINE__;
-
- /** This is not a comment!
-
- AED United Arab Emirates
- AFA Afghanistan
- ALL Albania
- AMD Armenia
- ANG Netherlands Antilles
- AOA Angola
- ARS Argentina
- ATS Austria
- AUD Australia
- AWG Aruba
- AZM Azerbaijan
- BAM Bosnia and Herzegovina
- BBD Barbados
- BDT Bangladesh
- BEF Belgium
- BGL Bulgaria
- BHD Bahrain
- BIF Burundi
- BMD Bermuda
- BND Brunei Darussalam
- BOB Bolivia
- BRL Brazil
- BSD Bahamas
- BTN Bhutan
- BWP Botswana
- BYR Belarus
- BZD Belize
- CAD Canada
- CDF Congo/Kinshasa
- CHF Switzerland
- CLP Chile
- CNY China
- COP Colombia
- CRC Costa Rica
- CUP Cuba
- CVE Cape Verde
- CYP Cyprus
- CZK Czech Republic
- DEM Germany
- DJF Djibouti
- DKK Denmark
- DOP Dominican Republic
- DZD Algeria
- EEK Estonia
- EGP Egypt
- ERN Eritrea
- ESP Spain
- ETB Ethiopia
- EUR Euro Member Countries
- FIM Finland
- FJD Fiji
- FKP Falkland Islands (Malvinas)
- FRF France
- GBP United Kingdom
- GEL Georgia
- GGP Guernsey
- GHC Ghana
- GIP Gibraltar
- GMD Gambia
- GNF Guinea
- GRD Greece
- GTQ Guatemala
- GYD Guyana
- HKD Hong Kong
- HNL Honduras
- HRK Croatia
- HTG Haiti
- HUF Hungary
- IDR Indonesia
- IEP Ireland (Eire)
- ILS Israel
- IMP Isle of Man
- INR India
- IQD Iraq
- IRR Iran
- ISK Iceland
- ITL Italy
- JEP Jersey
- JMD Jamaica
- JOD Jordan
- JPY Japan
- KES Kenya
- KGS Kyrgyzstan
- KHR Cambodia
- KMF Comoros
- KPW Korea
- KWD Kuwait
- KYD Cayman Islands
- KZT Kazakstan
- LAK Laos
- LBP Lebanon
- LKR Sri Lanka
- LRD Liberia
- LSL Lesotho
- LTL Lithuania
- LUF Luxembourg
- LVL Latvia
- LYD Libya
- MAD Morocco
- MDL Moldova
- MGF Madagascar
- MKD Macedonia
- MMK Myanmar (Burma)
- MNT Mongolia
- MOP Macau
- MRO Mauritania
- MTL Malta
- MUR Mauritius
- MVR Maldives (Maldive Islands)
- MWK Malawi
- MXN Mexico
- MYR Malaysia
- MZM Mozambique
- NAD Namibia
- NGN Nigeria
- NIO Nicaragua
- NLG Netherlands (Holland)
- NOK Norway
- NPR Nepal
- NZD New Zealand
- OMR Oman
- PAB Panama
- PEN Peru
- PGK Papua New Guinea
- PHP Philippines
- PKR Pakistan
- PLN Poland
- PTE Portugal
- PYG Paraguay
- QAR Qatar
- ROL Romania
- RUR Russia
- RWF Rwanda
- SAR Saudi Arabia
- SBD Solomon Islands
- SCR Seychelles
- SDD Sudan
- SEK Sweden
- SGD Singapore
- SHP Saint Helena
- SIT Slovenia
- SKK Slovakia
- SLL Sierra Leone
- SOS Somalia
- SPL Seborga
- SRG Suriname
- STD So Tome and Principe
- SVC El Salvador
- SYP Syria
- SZL Swaziland
- THB Thailand
- TJR Tajikistan
- TMM Turkmenistan
- TND Tunisia
- TOP Tonga
- TRL Turkey
- TTD Trinidad and Tobago
- TVD Tuvalu
- TWD Taiwan
- TZS Tanzania
- UAH Ukraine
- UGX Uganda
- USD United States of America
- UYU Uruguay
- UZS Uzbekistan
- VAL Vatican City
- VEB Venezuela
- VND Viet Nam
- VUV Vanuatu
- WST Samoa
- XAF Communaut Financire Africaine
- XAG Silver
- XAU Gold
- XCD East Caribbean
- XDR International Monetary Fund
- XPD Palladium
- XPF Comptoirs Franais du Pacifique
- XPT Platinum
- YER Yemen
- YUM Yugoslavia
- ZAR South Africa
- ZMK Zambia
- ZWD Zimbabwe
-
- */
-
- return getid3_lib::EmbeddedLookup($currencyid, $begin, __LINE__, __FILE__, 'id3v2-currency-country');
- }
-
-
-
- static function LanguageLookup($languagecode, $casesensitive=false) {
-
- if (!$casesensitive) {
- $languagecode = strtolower($languagecode);
- }
-
- // http://www.id3.org/id3v2.4.0-structure.txt
- // [4. ID3v2 frame overview]
- // The three byte language field, present in several frames, is used to
- // describe the language of the frame's content, according to ISO-639-2
- // [ISO-639-2]. The language should be represented in lower case. If the
- // language is not known the string "XXX" should be used.
-
-
- // ISO 639-2 - http://www.id3.org/iso639-2.html
-
- $begin = __LINE__;
-
- /** This is not a comment!
-
- XXX unknown
- xxx unknown
- aar Afar
- abk Abkhazian
- ace Achinese
- ach Acoli
- ada Adangme
- afa Afro-Asiatic (Other)
- afh Afrihili
- afr Afrikaans
- aka Akan
- akk Akkadian
- alb Albanian
- ale Aleut
- alg Algonquian Languages
- amh Amharic
- ang English, Old (ca. 450-1100)
- apa Apache Languages
- ara Arabic
- arc Aramaic
- arm Armenian
- arn Araucanian
- arp Arapaho
- art Artificial (Other)
- arw Arawak
- asm Assamese
- ath Athapascan Languages
- ava Avaric
- ave Avestan
- awa Awadhi
- aym Aymara
- aze Azerbaijani
- bad Banda
- bai Bamileke Languages
- bak Bashkir
- bal Baluchi
- bam Bambara
- ban Balinese
- baq Basque
- bas Basa
- bat Baltic (Other)
- bej Beja
- bel Byelorussian
- bem Bemba
- ben Bengali
- ber Berber (Other)
- bho Bhojpuri
- bih Bihari
- bik Bikol
- bin Bini
- bis Bislama
- bla Siksika
- bnt Bantu (Other)
- bod Tibetan
- bra Braj
- bre Breton
- bua Buriat
- bug Buginese
- bul Bulgarian
- bur Burmese
- cad Caddo
- cai Central American Indian (Other)
- car Carib
- cat Catalan
- cau Caucasian (Other)
- ceb Cebuano
- cel Celtic (Other)
- ces Czech
- cha Chamorro
- chb Chibcha
- che Chechen
- chg Chagatai
- chi Chinese
- chm Mari
- chn Chinook jargon
- cho Choctaw
- chr Cherokee
- chu Church Slavic
- chv Chuvash
- chy Cheyenne
- cop Coptic
- cor Cornish
- cos Corsican
- cpe Creoles and Pidgins, English-based (Other)
- cpf Creoles and Pidgins, French-based (Other)
- cpp Creoles and Pidgins, Portuguese-based (Other)
- cre Cree
- crp Creoles and Pidgins (Other)
- cus Cushitic (Other)
- cym Welsh
- cze Czech
- dak Dakota
- dan Danish
- del Delaware
- deu German
- din Dinka
- div Divehi
- doi Dogri
- dra Dravidian (Other)
- dua Duala
- dum Dutch, Middle (ca. 1050-1350)
- dut Dutch
- dyu Dyula
- dzo Dzongkha
- efi Efik
- egy Egyptian (Ancient)
- eka Ekajuk
- ell Greek, Modern (1453-)
- elx Elamite
- eng English
- enm English, Middle (ca. 1100-1500)
- epo Esperanto
- esk Eskimo (Other)
- esl Spanish
- est Estonian
- eus Basque
- ewe Ewe
- ewo Ewondo
- fan Fang
- fao Faroese
- fas Persian
- fat Fanti
- fij Fijian
- fin Finnish
- fiu Finno-Ugrian (Other)
- fon Fon
- fra French
- fre French
- frm French, Middle (ca. 1400-1600)
- fro French, Old (842- ca. 1400)
- fry Frisian
- ful Fulah
- gaa Ga
- gae Gaelic (Scots)
- gai Irish
- gay Gayo
- gdh Gaelic (Scots)
- gem Germanic (Other)
- geo Georgian
- ger German
- gez Geez
- gil Gilbertese
- glg Gallegan
- gmh German, Middle High (ca. 1050-1500)
- goh German, Old High (ca. 750-1050)
- gon Gondi
- got Gothic
- grb Grebo
- grc Greek, Ancient (to 1453)
- gre Greek, Modern (1453-)
- grn Guarani
- guj Gujarati
- hai Haida
- hau Hausa
- haw Hawaiian
- heb Hebrew
- her Herero
- hil Hiligaynon
- him Himachali
- hin Hindi
- hmo Hiri Motu
- hun Hungarian
- hup Hupa
- hye Armenian
- iba Iban
- ibo Igbo
- ice Icelandic
- ijo Ijo
- iku Inuktitut
- ilo Iloko
- ina Interlingua (International Auxiliary language Association)
- inc Indic (Other)
- ind Indonesian
- ine Indo-European (Other)
- ine Interlingue
- ipk Inupiak
- ira Iranian (Other)
- iri Irish
- iro Iroquoian uages
- isl Icelandic
- ita Italian
- jav Javanese
- jaw Javanese
- jpn Japanese
- jpr Judeo-Persian
- jrb Judeo-Arabic
- kaa Kara-Kalpak
- kab Kabyle
- kac Kachin
- kal Greenlandic
- kam Kamba
- kan Kannada
- kar Karen
- kas Kashmiri
- kat Georgian
- kau Kanuri
- kaw Kawi
- kaz Kazakh
- kha Khasi
- khi Khoisan (Other)
- khm Khmer
- kho Khotanese
- kik Kikuyu
- kin Kinyarwanda
- kir Kirghiz
- kok Konkani
- kom Komi
- kon Kongo
- kor Korean
- kpe Kpelle
- kro Kru
- kru Kurukh
- kua Kuanyama
- kum Kumyk
- kur Kurdish
- kus Kusaie
- kut Kutenai
- lad Ladino
- lah Lahnda
- lam Lamba
- lao Lao
- lat Latin
- lav Latvian
- lez Lezghian
- lin Lingala
- lit Lithuanian
- lol Mongo
- loz Lozi
- ltz Letzeburgesch
- lub Luba-Katanga
- lug Ganda
- lui Luiseno
- lun Lunda
- luo Luo (Kenya and Tanzania)
- mac Macedonian
- mad Madurese
- mag Magahi
- mah Marshall
- mai Maithili
- mak Macedonian
- mak Makasar
- mal Malayalam
- man Mandingo
- mao Maori
- map Austronesian (Other)
- mar Marathi
- mas Masai
- max Manx
- may Malay
- men Mende
- mga Irish, Middle (900 - 1200)
- mic Micmac
- min Minangkabau
- mis Miscellaneous (Other)
- mkh Mon-Kmer (Other)
- mlg Malagasy
- mlt Maltese
- mni Manipuri
- mno Manobo Languages
- moh Mohawk
- mol Moldavian
- mon Mongolian
- mos Mossi
- mri Maori
- msa Malay
- mul Multiple Languages
- mun Munda Languages
- mus Creek
- mwr Marwari
- mya Burmese
- myn Mayan Languages
- nah Aztec
- nai North American Indian (Other)
- nau Nauru
- nav Navajo
- nbl Ndebele, South
- nde Ndebele, North
- ndo Ndongo
- nep Nepali
- new Newari
- nic Niger-Kordofanian (Other)
- niu Niuean
- nla Dutch
- nno Norwegian (Nynorsk)
- non Norse, Old
- nor Norwegian
- nso Sotho, Northern
- nub Nubian Languages
- nya Nyanja
- nym Nyamwezi
- nyn Nyankole
- nyo Nyoro
- nzi Nzima
- oci Langue d'Oc (post 1500)
- oji Ojibwa
- ori Oriya
- orm Oromo
- osa Osage
- oss Ossetic
- ota Turkish, Ottoman (1500 - 1928)
- oto Otomian Languages
- paa Papuan-Australian (Other)
- pag Pangasinan
- pal Pahlavi
- pam Pampanga
- pan Panjabi
- pap Papiamento
- pau Palauan
- peo Persian, Old (ca 600 - 400 B.C.)
- per Persian
- phn Phoenician
- pli Pali
- pol Polish
- pon Ponape
- por Portuguese
- pra Prakrit uages
- pro Provencal, Old (to 1500)
- pus Pushto
- que Quechua
- raj Rajasthani
- rar Rarotongan
- roa Romance (Other)
- roh Rhaeto-Romance
- rom Romany
- ron Romanian
- rum Romanian
- run Rundi
- rus Russian
- sad Sandawe
- sag Sango
- sah Yakut
- sai South American Indian (Other)
- sal Salishan Languages
- sam Samaritan Aramaic
- san Sanskrit
- sco Scots
- scr Serbo-Croatian
- sel Selkup
- sem Semitic (Other)
- sga Irish, Old (to 900)
- shn Shan
- sid Sidamo
- sin Singhalese
- sio Siouan Languages
- sit Sino-Tibetan (Other)
- sla Slavic (Other)
- slk Slovak
- slo Slovak
- slv Slovenian
- smi Sami Languages
- smo Samoan
- sna Shona
- snd Sindhi
- sog Sogdian
- som Somali
- son Songhai
- sot Sotho, Southern
- spa Spanish
- sqi Albanian
- srd Sardinian
- srr Serer
- ssa Nilo-Saharan (Other)
- ssw Siswant
- ssw Swazi
- suk Sukuma
- sun Sudanese
- sus Susu
- sux Sumerian
- sve Swedish
- swa Swahili
- swe Swedish
- syr Syriac
- tah Tahitian
- tam Tamil
- tat Tatar
- tel Telugu
- tem Timne
- ter Tereno
- tgk Tajik
- tgl Tagalog
- tha Thai
- tib Tibetan
- tig Tigre
- tir Tigrinya
- tiv Tivi
- tli Tlingit
- tmh Tamashek
- tog Tonga (Nyasa)
- ton Tonga (Tonga Islands)
- tru Truk
- tsi Tsimshian
- tsn Tswana
- tso Tsonga
- tuk Turkmen
- tum Tumbuka
- tur Turkish
- tut Altaic (Other)
- twi Twi
- tyv Tuvinian
- uga Ugaritic
- uig Uighur
- ukr Ukrainian
- umb Umbundu
- und Undetermined
- urd Urdu
- uzb Uzbek
- vai Vai
- ven Venda
- vie Vietnamese
- vol Volapk
- vot Votic
- wak Wakashan Languages
- wal Walamo
- war Waray
- was Washo
- wel Welsh
- wen Sorbian Languages
- wol Wolof
- xho Xhosa
- yao Yao
- yap Yap
- yid Yiddish
- yor Yoruba
- zap Zapotec
- zen Zenaga
- zha Zhuang
- zho Chinese
- zul Zulu
- zun Zuni
-
- */
-
- return getid3_lib::EmbeddedLookup($languagecode, $begin, __LINE__, __FILE__, 'id3v2-languagecode');
- }
-
-
- static function ETCOEventLookup($index) {
- if (($index >= 0x17) && ($index <= 0xDF)) {
- return 'reserved for future use';
- }
- if (($index >= 0xE0) && ($index <= 0xEF)) {
- return 'not predefined synch 0-F';
- }
- if (($index >= 0xF0) && ($index <= 0xFC)) {
- return 'reserved for future use';
- }
-
- static $EventLookup = array(
- 0x00 => 'padding (has no meaning)',
- 0x01 => 'end of initial silence',
- 0x02 => 'intro start',
- 0x03 => 'main part start',
- 0x04 => 'outro start',
- 0x05 => 'outro end',
- 0x06 => 'verse start',
- 0x07 => 'refrain start',
- 0x08 => 'interlude start',
- 0x09 => 'theme start',
- 0x0A => 'variation start',
- 0x0B => 'key change',
- 0x0C => 'time change',
- 0x0D => 'momentary unwanted noise (Snap, Crackle & Pop)',
- 0x0E => 'sustained noise',
- 0x0F => 'sustained noise end',
- 0x10 => 'intro end',
- 0x11 => 'main part end',
- 0x12 => 'verse end',
- 0x13 => 'refrain end',
- 0x14 => 'theme end',
- 0x15 => 'profanity',
- 0x16 => 'profanity end',
- 0xFD => 'audio end (start of silence)',
- 0xFE => 'audio file ends',
- 0xFF => 'one more byte of events follows'
- );
-
- return (isset($EventLookup[$index]) ? $EventLookup[$index] : '');
- }
-
- static function SYTLContentTypeLookup($index) {
- static $SYTLContentTypeLookup = array(
- 0x00 => 'other',
- 0x01 => 'lyrics',
- 0x02 => 'text transcription',
- 0x03 => 'movement/part name', // (e.g. 'Adagio')
- 0x04 => 'events', // (e.g. 'Don Quijote enters the stage')
- 0x05 => 'chord', // (e.g. 'Bb F Fsus')
- 0x06 => 'trivia/\'pop up\' information',
- 0x07 => 'URLs to webpages',
- 0x08 => 'URLs to images'
- );
-
- return (isset($SYTLContentTypeLookup[$index]) ? $SYTLContentTypeLookup[$index] : '');
- }
-
- static function APICPictureTypeLookup($index, $returnarray=false) {
- static $APICPictureTypeLookup = array(
- 0x00 => 'Other',
- 0x01 => '32x32 pixels \'file icon\' (PNG only)',
- 0x02 => 'Other file icon',
- 0x03 => 'Cover (front)',
- 0x04 => 'Cover (back)',
- 0x05 => 'Leaflet page',
- 0x06 => 'Media (e.g. label side of CD)',
- 0x07 => 'Lead artist/lead performer/soloist',
- 0x08 => 'Artist/performer',
- 0x09 => 'Conductor',
- 0x0A => 'Band/Orchestra',
- 0x0B => 'Composer',
- 0x0C => 'Lyricist/text writer',
- 0x0D => 'Recording Location',
- 0x0E => 'During recording',
- 0x0F => 'During performance',
- 0x10 => 'Movie/video screen capture',
- 0x11 => 'A bright coloured fish',
- 0x12 => 'Illustration',
- 0x13 => 'Band/artist logotype',
- 0x14 => 'Publisher/Studio logotype'
- );
- if ($returnarray) {
- return $APICPictureTypeLookup;
- }
- return (isset($APICPictureTypeLookup[$index]) ? $APICPictureTypeLookup[$index] : '');
- }
-
- static function COMRReceivedAsLookup($index) {
- static $COMRReceivedAsLookup = array(
- 0x00 => 'Other',
- 0x01 => 'Standard CD album with other songs',
- 0x02 => 'Compressed audio on CD',
- 0x03 => 'File over the Internet',
- 0x04 => 'Stream over the Internet',
- 0x05 => 'As note sheets',
- 0x06 => 'As note sheets in a book with other sheets',
- 0x07 => 'Music on other media',
- 0x08 => 'Non-musical merchandise'
- );
-
- return (isset($COMRReceivedAsLookup[$index]) ? $COMRReceivedAsLookup[$index] : '');
- }
-
- static function RVA2ChannelTypeLookup($index) {
- static $RVA2ChannelTypeLookup = array(
- 0x00 => 'Other',
- 0x01 => 'Master volume',
- 0x02 => 'Front right',
- 0x03 => 'Front left',
- 0x04 => 'Back right',
- 0x05 => 'Back left',
- 0x06 => 'Front centre',
- 0x07 => 'Back centre',
- 0x08 => 'Subwoofer'
- );
-
- return (isset($RVA2ChannelTypeLookup[$index]) ? $RVA2ChannelTypeLookup[$index] : '');
- }
-
- static function FrameNameLongLookup($framename) {
-
- $begin = __LINE__;
-
- /** This is not a comment!
-
- AENC Audio encryption
- APIC Attached picture
- ASPI Audio seek point index
- BUF Recommended buffer size
- CNT Play counter
- COM Comments
- COMM Comments
- COMR Commercial frame
- CRA Audio encryption
- CRM Encrypted meta frame
- ENCR Encryption method registration
- EQU Equalisation
- EQU2 Equalisation (2)
- EQUA Equalisation
- ETC Event timing codes
- ETCO Event timing codes
- GEO General encapsulated object
- GEOB General encapsulated object
- GRID Group identification registration
- IPL Involved people list
- IPLS Involved people list
- LINK Linked information
- LNK Linked information
- MCDI Music CD identifier
- MCI Music CD Identifier
- MLL MPEG location lookup table
- MLLT MPEG location lookup table
- OWNE Ownership frame
- PCNT Play counter
- PIC Attached picture
- POP Popularimeter
- POPM Popularimeter
- POSS Position synchronisation frame
- PRIV Private frame
- RBUF Recommended buffer size
- REV Reverb
- RVA Relative volume adjustment
- RVA2 Relative volume adjustment (2)
- RVAD Relative volume adjustment
- RVRB Reverb
- SEEK Seek frame
- SIGN Signature frame
- SLT Synchronised lyric/text
- STC Synced tempo codes
- SYLT Synchronised lyric/text
- SYTC Synchronised tempo codes
- TAL Album/Movie/Show title
- TALB Album/Movie/Show title
- TBP BPM (Beats Per Minute)
- TBPM BPM (beats per minute)
- TCM Composer
- TCMP Part of a compilation
- TCO Content type
- TCOM Composer
- TCON Content type
- TCOP Copyright message
- TCP Part of a compilation
- TCR Copyright message
- TDA Date
- TDAT Date
- TDEN Encoding time
- TDLY Playlist delay
- TDOR Original release time
- TDRC Recording time
- TDRL Release time
- TDTG Tagging time
- TDY Playlist delay
- TEN Encoded by
- TENC Encoded by
- TEXT Lyricist/Text writer
- TFLT File type
- TFT File type
- TIM Time
- TIME Time
- TIPL Involved people list
- TIT1 Content group description
- TIT2 Title/songname/content description
- TIT3 Subtitle/Description refinement
- TKE Initial key
- TKEY Initial key
- TLA Language(s)
- TLAN Language(s)
- TLE Length
- TLEN Length
- TMCL Musician credits list
- TMED Media type
- TMOO Mood
- TMT Media type
- TOA Original artist(s)/performer(s)
- TOAL Original album/movie/show title
- TOF Original filename
- TOFN Original filename
- TOL Original Lyricist(s)/text writer(s)
- TOLY Original lyricist(s)/text writer(s)
- TOPE Original artist(s)/performer(s)
- TOR Original release year
- TORY Original release year
- TOT Original album/Movie/Show title
- TOWN File owner/licensee
- TP1 Lead artist(s)/Lead performer(s)/Soloist(s)/Performing group
- TP2 Band/Orchestra/Accompaniment
- TP3 Conductor/Performer refinement
- TP4 Interpreted, remixed, or otherwise modified by
- TPA Part of a set
- TPB Publisher
- TPE1 Lead performer(s)/Soloist(s)
- TPE2 Band/orchestra/accompaniment
- TPE3 Conductor/performer refinement
- TPE4 Interpreted, remixed, or otherwise modified by
- TPOS Part of a set
- TPRO Produced notice
- TPUB Publisher
- TRC ISRC (International Standard Recording Code)
- TRCK Track number/Position in set
- TRD Recording dates
- TRDA Recording dates
- TRK Track number/Position in set
- TRSN Internet radio station name
- TRSO Internet radio station owner
- TS2 Album-Artist sort order
- TSA Album sort order
- TSC Composer sort order
- TSI Size
- TSIZ Size
- TSO2 Album-Artist sort order
- TSOA Album sort order
- TSOC Composer sort order
- TSOP Performer sort order
- TSOT Title sort order
- TSP Performer sort order
- TSRC ISRC (international standard recording code)
- TSS Software/hardware and settings used for encoding
- TSSE Software/Hardware and settings used for encoding
- TSST Set subtitle
- TST Title sort order
- TT1 Content group description
- TT2 Title/Songname/Content description
- TT3 Subtitle/Description refinement
- TXT Lyricist/text writer
- TXX User defined text information frame
- TXXX User defined text information frame
- TYE Year
- TYER Year
- UFI Unique file identifier
- UFID Unique file identifier
- ULT Unsychronised lyric/text transcription
- USER Terms of use
- USLT Unsynchronised lyric/text transcription
- WAF Official audio file webpage
- WAR Official artist/performer webpage
- WAS Official audio source webpage
- WCM Commercial information
- WCOM Commercial information
- WCOP Copyright/Legal information
- WCP Copyright/Legal information
- WOAF Official audio file webpage
- WOAR Official artist/performer webpage
- WOAS Official audio source webpage
- WORS Official Internet radio station homepage
- WPAY Payment
- WPB Publishers official webpage
- WPUB Publishers official webpage
- WXX User defined URL link frame
- WXXX User defined URL link frame
- TFEA Featured Artist
- TSTU Recording Studio
- rgad Replay Gain Adjustment
-
- */
-
- return getid3_lib::EmbeddedLookup($framename, $begin, __LINE__, __FILE__, 'id3v2-framename_long');
-
- // Last three:
- // from Helium2 [www.helium2.com]
- // from http://privatewww.essex.ac.uk/~djmrob/replaygain/file_format_id3v2.html
- }
-
-
- static function FrameNameShortLookup($framename) {
-
- $begin = __LINE__;
-
- /** This is not a comment!
-
- AENC audio_encryption
- APIC attached_picture
- ASPI audio_seek_point_index
- BUF recommended_buffer_size
- CNT play_counter
- COM comment
- COMM comment
- COMR commercial_frame
- CRA audio_encryption
- CRM encrypted_meta_frame
- ENCR encryption_method_registration
- EQU equalisation
- EQU2 equalisation
- EQUA equalisation
- ETC event_timing_codes
- ETCO event_timing_codes
- GEO general_encapsulated_object
- GEOB general_encapsulated_object
- GRID group_identification_registration
- IPL involved_people_list
- IPLS involved_people_list
- LINK linked_information
- LNK linked_information
- MCDI music_cd_identifier
- MCI music_cd_identifier
- MLL mpeg_location_lookup_table
- MLLT mpeg_location_lookup_table
- OWNE ownership_frame
- PCNT play_counter
- PIC attached_picture
- POP popularimeter
- POPM popularimeter
- POSS position_synchronisation_frame
- PRIV private_frame
- RBUF recommended_buffer_size
- REV reverb
- RVA relative_volume_adjustment
- RVA2 relative_volume_adjustment
- RVAD relative_volume_adjustment
- RVRB reverb
- SEEK seek_frame
- SIGN signature_frame
- SLT synchronised_lyric
- STC synced_tempo_codes
- SYLT synchronised_lyric
- SYTC synchronised_tempo_codes
- TAL album
- TALB album
- TBP bpm
- TBPM bpm
- TCM composer
- TCMP part_of_a_compilation
- TCO genre
- TCOM composer
- TCON genre
- TCOP copyright_message
- TCP part_of_a_compilation
- TCR copyright_message
- TDA date
- TDAT date
- TDEN encoding_time
- TDLY playlist_delay
- TDOR original_release_time
- TDRC recording_time
- TDRL release_time
- TDTG tagging_time
- TDY playlist_delay
- TEN encoded_by
- TENC encoded_by
- TEXT lyricist
- TFLT file_type
- TFT file_type
- TIM time
- TIME time
- TIPL involved_people_list
- TIT1 content_group_description
- TIT2 title
- TIT3 subtitle
- TKE initial_key
- TKEY initial_key
- TLA language
- TLAN language
- TLE length
- TLEN length
- TMCL musician_credits_list
- TMED media_type
- TMOO mood
- TMT media_type
- TOA original_artist
- TOAL original_album
- TOF original_filename
- TOFN original_filename
- TOL original_lyricist
- TOLY original_lyricist
- TOPE original_artist
- TOR original_year
- TORY original_year
- TOT original_album
- TOWN file_owner
- TP1 artist
- TP2 band
- TP3 conductor
- TP4 remixer
- TPA part_of_a_set
- TPB publisher
- TPE1 artist
- TPE2 band
- TPE3 conductor
- TPE4 remixer
- TPOS part_of_a_set
- TPRO produced_notice
- TPUB publisher
- TRC isrc
- TRCK track_number
- TRD recording_dates
- TRDA recording_dates
- TRK track_number
- TRSN internet_radio_station_name
- TRSO internet_radio_station_owner
- TS2 album_artist_sort_order
- TSA album_sort_order
- TSC composer_sort_order
- TSI size
- TSIZ size
- TSO2 album_artist_sort_order
- TSOA album_sort_order
- TSOC composer_sort_order
- TSOP performer_sort_order
- TSOT title_sort_order
- TSP performer_sort_order
- TSRC isrc
- TSS encoder_settings
- TSSE encoder_settings
- TSST set_subtitle
- TST title_sort_order
- TT1 description
- TT2 title
- TT3 subtitle
- TXT lyricist
- TXX text
- TXXX text
- TYE year
- TYER year
- UFI unique_file_identifier
- UFID unique_file_identifier
- ULT unsychronised_lyric
- USER terms_of_use
- USLT unsynchronised_lyric
- WAF url_file
- WAR url_artist
- WAS url_source
- WCM commercial_information
- WCOM commercial_information
- WCOP copyright
- WCP copyright
- WOAF url_file
- WOAR url_artist
- WOAS url_source
- WORS url_station
- WPAY url_payment
- WPB url_publisher
- WPUB url_publisher
- WXX url_user
- WXXX url_user
- TFEA featured_artist
- TSTU recording_studio
- rgad replay_gain_adjustment
-
- */
-
- return getid3_lib::EmbeddedLookup($framename, $begin, __LINE__, __FILE__, 'id3v2-framename_short');
- }
-
- static function TextEncodingTerminatorLookup($encoding) {
- // http://www.id3.org/id3v2.4.0-structure.txt
- // Frames that allow different types of text encoding contains a text encoding description byte. Possible encodings:
- static $TextEncodingTerminatorLookup = array(
- 0 => "\x00", // $00 ISO-8859-1. Terminated with $00.
- 1 => "\x00\x00", // $01 UTF-16 encoded Unicode with BOM. All strings in the same frame SHALL have the same byteorder. Terminated with $00 00.
- 2 => "\x00\x00", // $02 UTF-16BE encoded Unicode without BOM. Terminated with $00 00.
- 3 => "\x00", // $03 UTF-8 encoded Unicode. Terminated with $00.
- 255 => "\x00\x00"
- );
- return (isset($TextEncodingTerminatorLookup[$encoding]) ? $TextEncodingTerminatorLookup[$encoding] : '');
- }
-
- static function TextEncodingNameLookup($encoding) {
- // http://www.id3.org/id3v2.4.0-structure.txt
- // Frames that allow different types of text encoding contains a text encoding description byte. Possible encodings:
- static $TextEncodingNameLookup = array(
- 0 => 'ISO-8859-1', // $00 ISO-8859-1. Terminated with $00.
- 1 => 'UTF-16', // $01 UTF-16 encoded Unicode with BOM. All strings in the same frame SHALL have the same byteorder. Terminated with $00 00.
- 2 => 'UTF-16BE', // $02 UTF-16BE encoded Unicode without BOM. Terminated with $00 00.
- 3 => 'UTF-8', // $03 UTF-8 encoded Unicode. Terminated with $00.
- 255 => 'UTF-16BE'
- );
- return (isset($TextEncodingNameLookup[$encoding]) ? $TextEncodingNameLookup[$encoding] : 'ISO-8859-1');
- }
-
- static function IsValidID3v2FrameName($framename, $id3v2majorversion) {
- switch ($id3v2majorversion) {
- case 2:
- return preg_match('#[A-Z][A-Z0-9]{2}#', $framename);
- break;
-
- case 3:
- case 4:
- return preg_match('#[A-Z][A-Z0-9]{3}#', $framename);
- break;
- }
- return false;
- }
-
- static function IsANumber($numberstring, $allowdecimal=false, $allownegative=false) {
- for ($i = 0; $i < strlen($numberstring); $i++) {
- if ((chr($numberstring{$i}) < chr('0')) || (chr($numberstring{$i}) > chr('9'))) {
- if (($numberstring{$i} == '.') && $allowdecimal) {
- // allowed
- } elseif (($numberstring{$i} == '-') && $allownegative && ($i == 0)) {
- // allowed
- } else {
- return false;
- }
- }
- }
- return true;
- }
-
- static function IsValidDateStampString($datestamp) {
- if (strlen($datestamp) != 8) {
- return false;
- }
- if (!self::IsANumber($datestamp, false)) {
- return false;
- }
- $year = substr($datestamp, 0, 4);
- $month = substr($datestamp, 4, 2);
- $day = substr($datestamp, 6, 2);
- if (($year == 0) || ($month == 0) || ($day == 0)) {
- return false;
- }
- if ($month > 12) {
- return false;
- }
- if ($day > 31) {
- return false;
- }
- if (($day > 30) && (($month == 4) || ($month == 6) || ($month == 9) || ($month == 11))) {
- return false;
- }
- if (($day > 29) && ($month == 2)) {
- return false;
- }
- return true;
- }
-
- static function ID3v2HeaderLength($majorversion) {
- return (($majorversion == 2) ? 6 : 10);
- }
-
-}
-
-?>
diff --git a/3rdparty/getid3/module.tag.lyrics3.php b/3rdparty/getid3/module.tag.lyrics3.php
deleted file mode 100644
index aaff717891b..00000000000
--- a/3rdparty/getid3/module.tag.lyrics3.php
+++ /dev/null
@@ -1,297 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-/// //
-// module.tag.lyrics3.php //
-// module for analyzing Lyrics3 tags //
-// dependencies: module.tag.apetag.php (optional) //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_lyrics3 extends getid3_handler
-{
-
- function Analyze() {
- $info = &$this->getid3->info;
-
- // http://www.volweb.cz/str/tags.htm
-
- if (!getid3_lib::intValueSupported($info['filesize'])) {
- $info['warning'][] = 'Unable to check for Lyrics3 because file is larger than '.round(PHP_INT_MAX / 1073741824).'GB';
- return false;
- }
-
- fseek($this->getid3->fp, (0 - 128 - 9 - 6), SEEK_END); // end - ID3v1 - "LYRICSEND" - [Lyrics3size]
- $lyrics3_id3v1 = fread($this->getid3->fp, 128 + 9 + 6);
- $lyrics3lsz = substr($lyrics3_id3v1, 0, 6); // Lyrics3size
- $lyrics3end = substr($lyrics3_id3v1, 6, 9); // LYRICSEND or LYRICS200
- $id3v1tag = substr($lyrics3_id3v1, 15, 128); // ID3v1
-
- if ($lyrics3end == 'LYRICSEND') {
- // Lyrics3v1, ID3v1, no APE
-
- $lyrics3size = 5100;
- $lyrics3offset = $info['filesize'] - 128 - $lyrics3size;
- $lyrics3version = 1;
-
- } elseif ($lyrics3end == 'LYRICS200') {
- // Lyrics3v2, ID3v1, no APE
-
- // LSZ = lyrics + 'LYRICSBEGIN'; add 6-byte size field; add 'LYRICS200'
- $lyrics3size = $lyrics3lsz + 6 + strlen('LYRICS200');
- $lyrics3offset = $info['filesize'] - 128 - $lyrics3size;
- $lyrics3version = 2;
-
- } elseif (substr(strrev($lyrics3_id3v1), 0, 9) == strrev('LYRICSEND')) {
- // Lyrics3v1, no ID3v1, no APE
-
- $lyrics3size = 5100;
- $lyrics3offset = $info['filesize'] - $lyrics3size;
- $lyrics3version = 1;
- $lyrics3offset = $info['filesize'] - $lyrics3size;
-
- } elseif (substr(strrev($lyrics3_id3v1), 0, 9) == strrev('LYRICS200')) {
-
- // Lyrics3v2, no ID3v1, no APE
-
- $lyrics3size = strrev(substr(strrev($lyrics3_id3v1), 9, 6)) + 6 + strlen('LYRICS200'); // LSZ = lyrics + 'LYRICSBEGIN'; add 6-byte size field; add 'LYRICS200'
- $lyrics3offset = $info['filesize'] - $lyrics3size;
- $lyrics3version = 2;
-
- } else {
-
- if (isset($info['ape']['tag_offset_start']) && ($info['ape']['tag_offset_start'] > 15)) {
-
- fseek($this->getid3->fp, $info['ape']['tag_offset_start'] - 15, SEEK_SET);
- $lyrics3lsz = fread($this->getid3->fp, 6);
- $lyrics3end = fread($this->getid3->fp, 9);
-
- if ($lyrics3end == 'LYRICSEND') {
- // Lyrics3v1, APE, maybe ID3v1
-
- $lyrics3size = 5100;
- $lyrics3offset = $info['ape']['tag_offset_start'] - $lyrics3size;
- $info['avdataend'] = $lyrics3offset;
- $lyrics3version = 1;
- $info['warning'][] = 'APE tag located after Lyrics3, will probably break Lyrics3 compatability';
-
- } elseif ($lyrics3end == 'LYRICS200') {
- // Lyrics3v2, APE, maybe ID3v1
-
- $lyrics3size = $lyrics3lsz + 6 + strlen('LYRICS200'); // LSZ = lyrics + 'LYRICSBEGIN'; add 6-byte size field; add 'LYRICS200'
- $lyrics3offset = $info['ape']['tag_offset_start'] - $lyrics3size;
- $lyrics3version = 2;
- $info['warning'][] = 'APE tag located after Lyrics3, will probably break Lyrics3 compatability';
-
- }
-
- }
-
- }
-
- if (isset($lyrics3offset)) {
- $info['avdataend'] = $lyrics3offset;
- $this->getLyrics3Data($lyrics3offset, $lyrics3version, $lyrics3size);
-
- if (!isset($info['ape'])) {
- $GETID3_ERRORARRAY = &$info['warning'];
- if (getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.apetag.php', __FILE__, false)) {
- $getid3_temp = new getID3();
- $getid3_temp->openfile($this->getid3->filename);
- $getid3_apetag = new getid3_apetag($getid3_temp);
- $getid3_apetag->overrideendoffset = $info['lyrics3']['tag_offset_start'];
- $getid3_apetag->Analyze();
- if (!empty($getid3_temp->info['ape'])) {
- $info['ape'] = $getid3_temp->info['ape'];
- }
- if (!empty($getid3_temp->info['replay_gain'])) {
- $info['replay_gain'] = $getid3_temp->info['replay_gain'];
- }
- unset($getid3_temp, $getid3_apetag);
- }
- }
-
- }
-
- return true;
- }
-
- function getLyrics3Data($endoffset, $version, $length) {
- // http://www.volweb.cz/str/tags.htm
-
- $info = &$this->getid3->info;
-
- if (!getid3_lib::intValueSupported($endoffset)) {
- $info['warning'][] = 'Unable to check for Lyrics3 because file is larger than '.round(PHP_INT_MAX / 1073741824).'GB';
- return false;
- }
-
- fseek($this->getid3->fp, $endoffset, SEEK_SET);
- if ($length <= 0) {
- return false;
- }
- $rawdata = fread($this->getid3->fp, $length);
-
- $ParsedLyrics3['raw']['lyrics3version'] = $version;
- $ParsedLyrics3['raw']['lyrics3tagsize'] = $length;
- $ParsedLyrics3['tag_offset_start'] = $endoffset;
- $ParsedLyrics3['tag_offset_end'] = $endoffset + $length - 1;
-
- if (substr($rawdata, 0, 11) != 'LYRICSBEGIN') {
- if (strpos($rawdata, 'LYRICSBEGIN') !== false) {
-
- $info['warning'][] = '"LYRICSBEGIN" expected at '.$endoffset.' but actually found at '.($endoffset + strpos($rawdata, 'LYRICSBEGIN')).' - this is invalid for Lyrics3 v'.$version;
- $info['avdataend'] = $endoffset + strpos($rawdata, 'LYRICSBEGIN');
- $rawdata = substr($rawdata, strpos($rawdata, 'LYRICSBEGIN'));
- $length = strlen($rawdata);
- $ParsedLyrics3['tag_offset_start'] = $info['avdataend'];
- $ParsedLyrics3['raw']['lyrics3tagsize'] = $length;
-
- } else {
-
- $info['error'][] = '"LYRICSBEGIN" expected at '.$endoffset.' but found "'.substr($rawdata, 0, 11).'" instead';
- return false;
-
- }
-
- }
-
- switch ($version) {
-
- case 1:
- if (substr($rawdata, strlen($rawdata) - 9, 9) == 'LYRICSEND') {
- $ParsedLyrics3['raw']['LYR'] = trim(substr($rawdata, 11, strlen($rawdata) - 11 - 9));
- $this->Lyrics3LyricsTimestampParse($ParsedLyrics3);
- } else {
- $info['error'][] = '"LYRICSEND" expected at '.(ftell($this->getid3->fp) - 11 + $length - 9).' but found "'.substr($rawdata, strlen($rawdata) - 9, 9).'" instead';
- return false;
- }
- break;
-
- case 2:
- if (substr($rawdata, strlen($rawdata) - 9, 9) == 'LYRICS200') {
- $ParsedLyrics3['raw']['unparsed'] = substr($rawdata, 11, strlen($rawdata) - 11 - 9 - 6); // LYRICSBEGIN + LYRICS200 + LSZ
- $rawdata = $ParsedLyrics3['raw']['unparsed'];
- while (strlen($rawdata) > 0) {
- $fieldname = substr($rawdata, 0, 3);
- $fieldsize = (int) substr($rawdata, 3, 5);
- $ParsedLyrics3['raw'][$fieldname] = substr($rawdata, 8, $fieldsize);
- $rawdata = substr($rawdata, 3 + 5 + $fieldsize);
- }
-
- if (isset($ParsedLyrics3['raw']['IND'])) {
- $i = 0;
- $flagnames = array('lyrics', 'timestamps', 'inhibitrandom');
- foreach ($flagnames as $flagname) {
- if (strlen($ParsedLyrics3['raw']['IND']) > $i++) {
- $ParsedLyrics3['flags'][$flagname] = $this->IntString2Bool(substr($ParsedLyrics3['raw']['IND'], $i, 1 - 1));
- }
- }
- }
-
- $fieldnametranslation = array('ETT'=>'title', 'EAR'=>'artist', 'EAL'=>'album', 'INF'=>'comment', 'AUT'=>'author');
- foreach ($fieldnametranslation as $key => $value) {
- if (isset($ParsedLyrics3['raw'][$key])) {
- $ParsedLyrics3['comments'][$value][] = trim($ParsedLyrics3['raw'][$key]);
- }
- }
-
- if (isset($ParsedLyrics3['raw']['IMG'])) {
- $imagestrings = explode("\r\n", $ParsedLyrics3['raw']['IMG']);
- foreach ($imagestrings as $key => $imagestring) {
- if (strpos($imagestring, '||') !== false) {
- $imagearray = explode('||', $imagestring);
- $ParsedLyrics3['images'][$key]['filename'] = (isset($imagearray[0]) ? $imagearray[0] : '');
- $ParsedLyrics3['images'][$key]['description'] = (isset($imagearray[1]) ? $imagearray[1] : '');
- $ParsedLyrics3['images'][$key]['timestamp'] = $this->Lyrics3Timestamp2Seconds(isset($imagearray[2]) ? $imagearray[2] : '');
- }
- }
- }
- if (isset($ParsedLyrics3['raw']['LYR'])) {
- $this->Lyrics3LyricsTimestampParse($ParsedLyrics3);
- }
- } else {
- $info['error'][] = '"LYRICS200" expected at '.(ftell($this->getid3->fp) - 11 + $length - 9).' but found "'.substr($rawdata, strlen($rawdata) - 9, 9).'" instead';
- return false;
- }
- break;
-
- default:
- $info['error'][] = 'Cannot process Lyrics3 version '.$version.' (only v1 and v2)';
- return false;
- break;
- }
-
-
- if (isset($info['id3v1']['tag_offset_start']) && ($info['id3v1']['tag_offset_start'] <= $ParsedLyrics3['tag_offset_end'])) {
- $info['warning'][] = 'ID3v1 tag information ignored since it appears to be a false synch in Lyrics3 tag data';
- unset($info['id3v1']);
- foreach ($info['warning'] as $key => $value) {
- if ($value == 'Some ID3v1 fields do not use NULL characters for padding') {
- unset($info['warning'][$key]);
- sort($info['warning']);
- break;
- }
- }
- }
-
- $info['lyrics3'] = $ParsedLyrics3;
-
- return true;
- }
-
- function Lyrics3Timestamp2Seconds($rawtimestamp) {
- if (preg_match('#^\\[([0-9]{2}):([0-9]{2})\\]$#', $rawtimestamp, $regs)) {
- return (int) (($regs[1] * 60) + $regs[2]);
- }
- return false;
- }
-
- function Lyrics3LyricsTimestampParse(&$Lyrics3data) {
- $lyricsarray = explode("\r\n", $Lyrics3data['raw']['LYR']);
- foreach ($lyricsarray as $key => $lyricline) {
- $regs = array();
- unset($thislinetimestamps);
- while (preg_match('#^(\\[[0-9]{2}:[0-9]{2}\\])#', $lyricline, $regs)) {
- $thislinetimestamps[] = $this->Lyrics3Timestamp2Seconds($regs[0]);
- $lyricline = str_replace($regs[0], '', $lyricline);
- }
- $notimestamplyricsarray[$key] = $lyricline;
- if (isset($thislinetimestamps) && is_array($thislinetimestamps)) {
- sort($thislinetimestamps);
- foreach ($thislinetimestamps as $timestampkey => $timestamp) {
- if (isset($Lyrics3data['synchedlyrics'][$timestamp])) {
- // timestamps only have a 1-second resolution, it's possible that multiple lines
- // could have the same timestamp, if so, append
- $Lyrics3data['synchedlyrics'][$timestamp] .= "\r\n".$lyricline;
- } else {
- $Lyrics3data['synchedlyrics'][$timestamp] = $lyricline;
- }
- }
- }
- }
- $Lyrics3data['unsynchedlyrics'] = implode("\r\n", $notimestamplyricsarray);
- if (isset($Lyrics3data['synchedlyrics']) && is_array($Lyrics3data['synchedlyrics'])) {
- ksort($Lyrics3data['synchedlyrics']);
- }
- return true;
- }
-
- function IntString2Bool($char) {
- if ($char == '1') {
- return true;
- } elseif ($char == '0') {
- return false;
- }
- return null;
- }
-}
-
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/module.tag.xmp.php b/3rdparty/getid3/module.tag.xmp.php
deleted file mode 100644
index 141fd09d16a..00000000000
--- a/3rdparty/getid3/module.tag.xmp.php
+++ /dev/null
@@ -1,766 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// module.tag.xmp.php //
-// module for analyzing XMP metadata (e.g. in JPEG files) //
-// dependencies: NONE //
-// //
-/////////////////////////////////////////////////////////////////
-// //
-// Module originally written [2009-Mar-26] by //
-// Nigel Barnes <ngbarneshotmail*com> //
-// Bundled into getID3 with permission //
-// called by getID3 in module.graphic.jpg.php //
-// ///
-/////////////////////////////////////////////////////////////////
-
-/**************************************************************************************************
- * SWISScenter Source Nigel Barnes
- *
- * Provides functions for reading information from the 'APP1' Extensible Metadata
- * Platform (XMP) segment of JPEG format files.
- * This XMP segment is XML based and contains the Resource Description Framework (RDF)
- * data, which itself can contain the Dublin Core Metadata Initiative (DCMI) information.
- *
- * This code uses segments from the JPEG Metadata Toolkit project by Evan Hunter.
- *************************************************************************************************/
-class Image_XMP
-{
- /**
- * @var string
- * The name of the image file that contains the XMP fields to extract and modify.
- * @see Image_XMP()
- */
- var $_sFilename = null;
-
- /**
- * @var array
- * The XMP fields that were extracted from the image or updated by this class.
- * @see getAllTags()
- */
- var $_aXMP = array();
-
- /**
- * @var boolean
- * True if an APP1 segment was found to contain XMP metadata.
- * @see isValid()
- */
- var $_bXMPParse = false;
-
- /**
- * Returns the status of XMP parsing during instantiation
- *
- * You'll normally want to call this method before trying to get XMP fields.
- *
- * @return boolean
- * Returns true if an APP1 segment was found to contain XMP metadata.
- */
- function isValid()
- {
- return $this->_bXMPParse;
- }
-
- /**
- * Get a copy of all XMP tags extracted from the image
- *
- * @return array - An array of XMP fields as it extracted by the XMPparse() function
- */
- function getAllTags()
- {
- return $this->_aXMP;
- }
-
- /**
- * Reads all the JPEG header segments from an JPEG image file into an array
- *
- * @param string $filename - the filename of the JPEG file to read
- * @return array $headerdata - Array of JPEG header segments
- * @return boolean FALSE - if headers could not be read
- */
- function _get_jpeg_header_data($filename)
- {
- // prevent refresh from aborting file operations and hosing file
- ignore_user_abort(true);
-
- // Attempt to open the jpeg file - the at symbol supresses the error message about
- // not being able to open files. The file_exists would have been used, but it
- // does not work with files fetched over http or ftp.
- if (is_readable($filename) && is_file($filename) && ($filehnd = fopen($filename, 'rb'))) {
- // great
- } else {
- return false;
- }
-
- // Read the first two characters
- $data = fread($filehnd, 2);
-
- // Check that the first two characters are 0xFF 0xD8 (SOI - Start of image)
- if ($data != "\xFF\xD8")
- {
- // No SOI (FF D8) at start of file - This probably isn't a JPEG file - close file and return;
- echo '<p>This probably is not a JPEG file</p>'."\n";
- fclose($filehnd);
- return false;
- }
-
- // Read the third character
- $data = fread($filehnd, 2);
-
- // Check that the third character is 0xFF (Start of first segment header)
- if ($data{0} != "\xFF")
- {
- // NO FF found - close file and return - JPEG is probably corrupted
- fclose($filehnd);
- return false;
- }
-
- // Flag that we havent yet hit the compressed image data
- $hit_compressed_image_data = false;
-
- // Cycle through the file until, one of: 1) an EOI (End of image) marker is hit,
- // 2) we have hit the compressed image data (no more headers are allowed after data)
- // 3) or end of file is hit
-
- while (($data{1} != "\xD9") && (!$hit_compressed_image_data) && (!feof($filehnd)))
- {
- // Found a segment to look at.
- // Check that the segment marker is not a Restart marker - restart markers don't have size or data after them
- if ((ord($data{1}) < 0xD0) || (ord($data{1}) > 0xD7))
- {
- // Segment isn't a Restart marker
- // Read the next two bytes (size)
- $sizestr = fread($filehnd, 2);
-
- // convert the size bytes to an integer
- $decodedsize = unpack('nsize', $sizestr);
-
- // Save the start position of the data
- $segdatastart = ftell($filehnd);
-
- // Read the segment data with length indicated by the previously read size
- $segdata = fread($filehnd, $decodedsize['size'] - 2);
-
- // Store the segment information in the output array
- $headerdata[] = array(
- 'SegType' => ord($data{1}),
- 'SegName' => $GLOBALS['JPEG_Segment_Names'][ord($data{1})],
- 'SegDataStart' => $segdatastart,
- 'SegData' => $segdata,
- );
- }
-
- // If this is a SOS (Start Of Scan) segment, then there is no more header data - the compressed image data follows
- if ($data{1} == "\xDA")
- {
- // Flag that we have hit the compressed image data - exit loop as no more headers available.
- $hit_compressed_image_data = true;
- }
- else
- {
- // Not an SOS - Read the next two bytes - should be the segment marker for the next segment
- $data = fread($filehnd, 2);
-
- // Check that the first byte of the two is 0xFF as it should be for a marker
- if ($data{0} != "\xFF")
- {
- // NO FF found - close file and return - JPEG is probably corrupted
- fclose($filehnd);
- return false;
- }
- }
- }
-
- // Close File
- fclose($filehnd);
- // Alow the user to abort from now on
- ignore_user_abort(false);
-
- // Return the header data retrieved
- return $headerdata;
- }
-
-
- /**
- * Retrieves XMP information from an APP1 JPEG segment and returns the raw XML text as a string.
- *
- * @param string $filename - the filename of the JPEG file to read
- * @return string $xmp_data - the string of raw XML text
- * @return boolean FALSE - if an APP 1 XMP segment could not be found, or if an error occured
- */
- function _get_XMP_text($filename)
- {
- //Get JPEG header data
- $jpeg_header_data = $this->_get_jpeg_header_data($filename);
-
- //Cycle through the header segments
- for ($i = 0; $i < count($jpeg_header_data); $i++)
- {
- // If we find an APP1 header,
- if (strcmp($jpeg_header_data[$i]['SegName'], 'APP1') == 0)
- {
- // And if it has the Adobe XMP/RDF label (http://ns.adobe.com/xap/1.0/\x00) ,
- if (strncmp($jpeg_header_data[$i]['SegData'], 'http://ns.adobe.com/xap/1.0/'."\x00", 29) == 0)
- {
- // Found a XMP/RDF block
- // Return the XMP text
- $xmp_data = substr($jpeg_header_data[$i]['SegData'], 29);
-
- return trim($xmp_data); // trim() should not be neccesary, but some files found in the wild with null-terminated block (known samples from Apple Aperture) causes problems elsewhere (see http://www.getid3.org/phpBB3/viewtopic.php?f=4&t=1153)
- }
- }
- }
- return false;
- }
-
- /**
- * Parses a string containing XMP data (XML), and returns an array
- * which contains all the XMP (XML) information.
- *
- * @param string $xml_text - a string containing the XMP data (XML) to be parsed
- * @return array $xmp_array - an array containing all xmp details retrieved.
- * @return boolean FALSE - couldn't parse the XMP data
- */
- function read_XMP_array_from_text($xmltext)
- {
- // Check if there actually is any text to parse
- if (trim($xmltext) == '')
- {
- return false;
- }
-
- // Create an instance of a xml parser to parse the XML text
- $xml_parser = xml_parser_create('UTF-8');
-
- // Change: Fixed problem that caused the whitespace (especially newlines) to be destroyed when converting xml text to an xml array, as of revision 1.10
-
- // We would like to remove unneccessary white space, but this will also
- // remove things like newlines (&#xA;) in the XML values, so white space
- // will have to be removed later
- if (xml_parser_set_option($xml_parser, XML_OPTION_SKIP_WHITE, 0) == false)
- {
- // Error setting case folding - destroy the parser and return
- xml_parser_free($xml_parser);
- return false;
- }
-
- // to use XML code correctly we have to turn case folding
- // (uppercasing) off. XML is case sensitive and upper
- // casing is in reality XML standards violation
- if (xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, 0) == false)
- {
- // Error setting case folding - destroy the parser and return
- xml_parser_free($xml_parser);
- return false;
- }
-
- // Parse the XML text into a array structure
- if (xml_parse_into_struct($xml_parser, $xmltext, $values, $tags) == 0)
- {
- // Error Parsing XML - destroy the parser and return
- xml_parser_free($xml_parser);
- return false;
- }
-
- // Destroy the xml parser
- xml_parser_free($xml_parser);
-
- // Clear the output array
- $xmp_array = array();
-
- // The XMP data has now been parsed into an array ...
-
- // Cycle through each of the array elements
- $current_property = ''; // current property being processed
- $container_index = -1; // -1 = no container open, otherwise index of container content
- foreach ($values as $xml_elem)
- {
- // Syntax and Class names
- switch ($xml_elem['tag'])
- {
- case 'x:xmpmeta':
- // only defined attribute is x:xmptk written by Adobe XMP Toolkit; value is the version of the toolkit
- break;
-
- case 'rdf:RDF':
- // required element immediately within x:xmpmeta; no data here
- break;
-
- case 'rdf:Description':
- switch ($xml_elem['type'])
- {
- case 'open':
- case 'complete':
- if (array_key_exists('attributes', $xml_elem))
- {
- // rdf:Description may contain wanted attributes
- foreach (array_keys($xml_elem['attributes']) as $key)
- {
- // Check whether we want this details from this attribute
- if (in_array($key, $GLOBALS['XMP_tag_captions']))
- {
- // Attribute wanted
- $xmp_array[$key] = $xml_elem['attributes'][$key];
- }
- }
- }
- case 'cdata':
- case 'close':
- break;
- }
-
- case 'rdf:ID':
- case 'rdf:nodeID':
- // Attributes are ignored
- break;
-
- case 'rdf:li':
- // Property member
- if ($xml_elem['type'] == 'complete')
- {
- if (array_key_exists('attributes', $xml_elem))
- {
- // If Lang Alt (language alternatives) then ensure we take the default language
- if (isset($xml_elem['attributes']['xml:lang']) && ($xml_elem['attributes']['xml:lang'] != 'x-default'))
- {
- break;
- }
- }
- if ($current_property != '')
- {
- $xmp_array[$current_property][$container_index] = (isset($xml_elem['value']) ? $xml_elem['value'] : '');
- $container_index += 1;
- }
- //else unidentified attribute!!
- }
- break;
-
- case 'rdf:Seq':
- case 'rdf:Bag':
- case 'rdf:Alt':
- // Container found
- switch ($xml_elem['type'])
- {
- case 'open':
- $container_index = 0;
- break;
- case 'close':
- $container_index = -1;
- break;
- case 'cdata':
- break;
- }
- break;
-
- default:
- // Check whether we want the details from this attribute
- if (in_array($xml_elem['tag'], $GLOBALS['XMP_tag_captions']))
- {
- switch ($xml_elem['type'])
- {
- case 'open':
- // open current element
- $current_property = $xml_elem['tag'];
- break;
-
- case 'close':
- // close current element
- $current_property = '';
- break;
-
- case 'complete':
- // store attribute value
- $xmp_array[$xml_elem['tag']] = (isset($xml_elem['value']) ? $xml_elem['value'] : '');
- break;
-
- case 'cdata':
- // ignore
- break;
- }
- }
- break;
- }
-
- }
- return $xmp_array;
- }
-
-
- /**
- * Constructor
- *
- * @param string - Name of the image file to access and extract XMP information from.
- */
- function Image_XMP($sFilename)
- {
- $this->_sFilename = $sFilename;
-
- if (is_file($this->_sFilename))
- {
- // Get XMP data
- $xmp_data = $this->_get_XMP_text($sFilename);
- if ($xmp_data)
- {
- $this->_aXMP = $this->read_XMP_array_from_text($xmp_data);
- $this->_bXMPParse = true;
- }
- }
- }
-
-}
-
-/**
-* Global Variable: XMP_tag_captions
-*
-* The Property names of all known XMP fields.
-* Note: this is a full list with unrequired properties commented out.
-*/
-$GLOBALS['XMP_tag_captions'] = array(
-// IPTC Core
- 'Iptc4xmpCore:CiAdrCity',
- 'Iptc4xmpCore:CiAdrCtry',
- 'Iptc4xmpCore:CiAdrExtadr',
- 'Iptc4xmpCore:CiAdrPcode',
- 'Iptc4xmpCore:CiAdrRegion',
- 'Iptc4xmpCore:CiEmailWork',
- 'Iptc4xmpCore:CiTelWork',
- 'Iptc4xmpCore:CiUrlWork',
- 'Iptc4xmpCore:CountryCode',
- 'Iptc4xmpCore:CreatorContactInfo',
- 'Iptc4xmpCore:IntellectualGenre',
- 'Iptc4xmpCore:Location',
- 'Iptc4xmpCore:Scene',
- 'Iptc4xmpCore:SubjectCode',
-// Dublin Core Schema
- 'dc:contributor',
- 'dc:coverage',
- 'dc:creator',
- 'dc:date',
- 'dc:description',
- 'dc:format',
- 'dc:identifier',
- 'dc:language',
- 'dc:publisher',
- 'dc:relation',
- 'dc:rights',
- 'dc:source',
- 'dc:subject',
- 'dc:title',
- 'dc:type',
-// XMP Basic Schema
- 'xmp:Advisory',
- 'xmp:BaseURL',
- 'xmp:CreateDate',
- 'xmp:CreatorTool',
- 'xmp:Identifier',
- 'xmp:Label',
- 'xmp:MetadataDate',
- 'xmp:ModifyDate',
- 'xmp:Nickname',
- 'xmp:Rating',
- 'xmp:Thumbnails',
- 'xmpidq:Scheme',
-// XMP Rights Management Schema
- 'xmpRights:Certificate',
- 'xmpRights:Marked',
- 'xmpRights:Owner',
- 'xmpRights:UsageTerms',
- 'xmpRights:WebStatement',
-// These are not in spec but Photoshop CS seems to use them
- 'xap:Advisory',
- 'xap:BaseURL',
- 'xap:CreateDate',
- 'xap:CreatorTool',
- 'xap:Identifier',
- 'xap:MetadataDate',
- 'xap:ModifyDate',
- 'xap:Nickname',
- 'xap:Rating',
- 'xap:Thumbnails',
- 'xapidq:Scheme',
- 'xapRights:Certificate',
- 'xapRights:Copyright',
- 'xapRights:Marked',
- 'xapRights:Owner',
- 'xapRights:UsageTerms',
- 'xapRights:WebStatement',
-// XMP Media Management Schema
- 'xapMM:DerivedFrom',
- 'xapMM:DocumentID',
- 'xapMM:History',
- 'xapMM:InstanceID',
- 'xapMM:ManagedFrom',
- 'xapMM:Manager',
- 'xapMM:ManageTo',
- 'xapMM:ManageUI',
- 'xapMM:ManagerVariant',
- 'xapMM:RenditionClass',
- 'xapMM:RenditionParams',
- 'xapMM:VersionID',
- 'xapMM:Versions',
- 'xapMM:LastURL',
- 'xapMM:RenditionOf',
- 'xapMM:SaveID',
-// XMP Basic Job Ticket Schema
- 'xapBJ:JobRef',
-// XMP Paged-Text Schema
- 'xmpTPg:MaxPageSize',
- 'xmpTPg:NPages',
- 'xmpTPg:Fonts',
- 'xmpTPg:Colorants',
- 'xmpTPg:PlateNames',
-// Adobe PDF Schema
- 'pdf:Keywords',
- 'pdf:PDFVersion',
- 'pdf:Producer',
-// Photoshop Schema
- 'photoshop:AuthorsPosition',
- 'photoshop:CaptionWriter',
- 'photoshop:Category',
- 'photoshop:City',
- 'photoshop:Country',
- 'photoshop:Credit',
- 'photoshop:DateCreated',
- 'photoshop:Headline',
- 'photoshop:History',
-// Not in XMP spec
- 'photoshop:Instructions',
- 'photoshop:Source',
- 'photoshop:State',
- 'photoshop:SupplementalCategories',
- 'photoshop:TransmissionReference',
- 'photoshop:Urgency',
-// EXIF Schemas
- 'tiff:ImageWidth',
- 'tiff:ImageLength',
- 'tiff:BitsPerSample',
- 'tiff:Compression',
- 'tiff:PhotometricInterpretation',
- 'tiff:Orientation',
- 'tiff:SamplesPerPixel',
- 'tiff:PlanarConfiguration',
- 'tiff:YCbCrSubSampling',
- 'tiff:YCbCrPositioning',
- 'tiff:XResolution',
- 'tiff:YResolution',
- 'tiff:ResolutionUnit',
- 'tiff:TransferFunction',
- 'tiff:WhitePoint',
- 'tiff:PrimaryChromaticities',
- 'tiff:YCbCrCoefficients',
- 'tiff:ReferenceBlackWhite',
- 'tiff:DateTime',
- 'tiff:ImageDescription',
- 'tiff:Make',
- 'tiff:Model',
- 'tiff:Software',
- 'tiff:Artist',
- 'tiff:Copyright',
- 'exif:ExifVersion',
- 'exif:FlashpixVersion',
- 'exif:ColorSpace',
- 'exif:ComponentsConfiguration',
- 'exif:CompressedBitsPerPixel',
- 'exif:PixelXDimension',
- 'exif:PixelYDimension',
- 'exif:MakerNote',
- 'exif:UserComment',
- 'exif:RelatedSoundFile',
- 'exif:DateTimeOriginal',
- 'exif:DateTimeDigitized',
- 'exif:ExposureTime',
- 'exif:FNumber',
- 'exif:ExposureProgram',
- 'exif:SpectralSensitivity',
- 'exif:ISOSpeedRatings',
- 'exif:OECF',
- 'exif:ShutterSpeedValue',
- 'exif:ApertureValue',
- 'exif:BrightnessValue',
- 'exif:ExposureBiasValue',
- 'exif:MaxApertureValue',
- 'exif:SubjectDistance',
- 'exif:MeteringMode',
- 'exif:LightSource',
- 'exif:Flash',
- 'exif:FocalLength',
- 'exif:SubjectArea',
- 'exif:FlashEnergy',
- 'exif:SpatialFrequencyResponse',
- 'exif:FocalPlaneXResolution',
- 'exif:FocalPlaneYResolution',
- 'exif:FocalPlaneResolutionUnit',
- 'exif:SubjectLocation',
- 'exif:SensingMethod',
- 'exif:FileSource',
- 'exif:SceneType',
- 'exif:CFAPattern',
- 'exif:CustomRendered',
- 'exif:ExposureMode',
- 'exif:WhiteBalance',
- 'exif:DigitalZoomRatio',
- 'exif:FocalLengthIn35mmFilm',
- 'exif:SceneCaptureType',
- 'exif:GainControl',
- 'exif:Contrast',
- 'exif:Saturation',
- 'exif:Sharpness',
- 'exif:DeviceSettingDescription',
- 'exif:SubjectDistanceRange',
- 'exif:ImageUniqueID',
- 'exif:GPSVersionID',
- 'exif:GPSLatitude',
- 'exif:GPSLongitude',
- 'exif:GPSAltitudeRef',
- 'exif:GPSAltitude',
- 'exif:GPSTimeStamp',
- 'exif:GPSSatellites',
- 'exif:GPSStatus',
- 'exif:GPSMeasureMode',
- 'exif:GPSDOP',
- 'exif:GPSSpeedRef',
- 'exif:GPSSpeed',
- 'exif:GPSTrackRef',
- 'exif:GPSTrack',
- 'exif:GPSImgDirectionRef',
- 'exif:GPSImgDirection',
- 'exif:GPSMapDatum',
- 'exif:GPSDestLatitude',
- 'exif:GPSDestLongitude',
- 'exif:GPSDestBearingRef',
- 'exif:GPSDestBearing',
- 'exif:GPSDestDistanceRef',
- 'exif:GPSDestDistance',
- 'exif:GPSProcessingMethod',
- 'exif:GPSAreaInformation',
- 'exif:GPSDifferential',
- 'stDim:w',
- 'stDim:h',
- 'stDim:unit',
- 'xapGImg:height',
- 'xapGImg:width',
- 'xapGImg:format',
- 'xapGImg:image',
- 'stEvt:action',
- 'stEvt:instanceID',
- 'stEvt:parameters',
- 'stEvt:softwareAgent',
- 'stEvt:when',
- 'stRef:instanceID',
- 'stRef:documentID',
- 'stRef:versionID',
- 'stRef:renditionClass',
- 'stRef:renditionParams',
- 'stRef:manager',
- 'stRef:managerVariant',
- 'stRef:manageTo',
- 'stRef:manageUI',
- 'stVer:comments',
- 'stVer:event',
- 'stVer:modifyDate',
- 'stVer:modifier',
- 'stVer:version',
- 'stJob:name',
- 'stJob:id',
- 'stJob:url',
-// Exif Flash
- 'exif:Fired',
- 'exif:Return',
- 'exif:Mode',
- 'exif:Function',
- 'exif:RedEyeMode',
-// Exif OECF/SFR
- 'exif:Columns',
- 'exif:Rows',
- 'exif:Names',
- 'exif:Values',
-// Exif CFAPattern
- 'exif:Columns',
- 'exif:Rows',
- 'exif:Values',
-// Exif DeviceSettings
- 'exif:Columns',
- 'exif:Rows',
- 'exif:Settings',
-);
-
-
-/**
-* Global Variable: JPEG_Segment_Names
-*
-* The names of the JPEG segment markers, indexed by their marker number
-*/
-$GLOBALS['JPEG_Segment_Names'] = array(
- 0x01 => 'TEM',
- 0x02 => 'RES',
- 0xC0 => 'SOF0',
- 0xC1 => 'SOF1',
- 0xC2 => 'SOF2',
- 0xC3 => 'SOF4',
- 0xC4 => 'DHT',
- 0xC5 => 'SOF5',
- 0xC6 => 'SOF6',
- 0xC7 => 'SOF7',
- 0xC8 => 'JPG',
- 0xC9 => 'SOF9',
- 0xCA => 'SOF10',
- 0xCB => 'SOF11',
- 0xCC => 'DAC',
- 0xCD => 'SOF13',
- 0xCE => 'SOF14',
- 0xCF => 'SOF15',
- 0xD0 => 'RST0',
- 0xD1 => 'RST1',
- 0xD2 => 'RST2',
- 0xD3 => 'RST3',
- 0xD4 => 'RST4',
- 0xD5 => 'RST5',
- 0xD6 => 'RST6',
- 0xD7 => 'RST7',
- 0xD8 => 'SOI',
- 0xD9 => 'EOI',
- 0xDA => 'SOS',
- 0xDB => 'DQT',
- 0xDC => 'DNL',
- 0xDD => 'DRI',
- 0xDE => 'DHP',
- 0xDF => 'EXP',
- 0xE0 => 'APP0',
- 0xE1 => 'APP1',
- 0xE2 => 'APP2',
- 0xE3 => 'APP3',
- 0xE4 => 'APP4',
- 0xE5 => 'APP5',
- 0xE6 => 'APP6',
- 0xE7 => 'APP7',
- 0xE8 => 'APP8',
- 0xE9 => 'APP9',
- 0xEA => 'APP10',
- 0xEB => 'APP11',
- 0xEC => 'APP12',
- 0xED => 'APP13',
- 0xEE => 'APP14',
- 0xEF => 'APP15',
- 0xF0 => 'JPG0',
- 0xF1 => 'JPG1',
- 0xF2 => 'JPG2',
- 0xF3 => 'JPG3',
- 0xF4 => 'JPG4',
- 0xF5 => 'JPG5',
- 0xF6 => 'JPG6',
- 0xF7 => 'JPG7',
- 0xF8 => 'JPG8',
- 0xF9 => 'JPG9',
- 0xFA => 'JPG10',
- 0xFB => 'JPG11',
- 0xFC => 'JPG12',
- 0xFD => 'JPG13',
- 0xFE => 'COM',
-);
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/write.apetag.php b/3rdparty/getid3/write.apetag.php
deleted file mode 100644
index 2b553699fd9..00000000000
--- a/3rdparty/getid3/write.apetag.php
+++ /dev/null
@@ -1,225 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// write.apetag.php //
-// module for writing APE tags //
-// dependencies: module.tag.apetag.php //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.apetag.php', __FILE__, true);
-
-class getid3_write_apetag
-{
-
- var $filename;
- var $tag_data;
- var $always_preserve_replaygain = true; // ReplayGain / MP3gain tags will be copied from old tag even if not passed in data
- var $warnings = array(); // any non-critical errors will be stored here
- var $errors = array(); // any critical errors will be stored here
-
- function getid3_write_apetag() {
- return true;
- }
-
- function WriteAPEtag() {
- // NOTE: All data passed to this function must be UTF-8 format
-
- $getID3 = new getID3;
- $ThisFileInfo = $getID3->analyze($this->filename);
-
- if (isset($ThisFileInfo['ape']['tag_offset_start']) && isset($ThisFileInfo['lyrics3']['tag_offset_end'])) {
- if ($ThisFileInfo['ape']['tag_offset_start'] >= $ThisFileInfo['lyrics3']['tag_offset_end']) {
- // Current APE tag between Lyrics3 and ID3v1/EOF
- // This break Lyrics3 functionality
- if (!$this->DeleteAPEtag()) {
- return false;
- }
- $ThisFileInfo = $getID3->analyze($this->filename);
- }
- }
-
- if ($this->always_preserve_replaygain) {
- $ReplayGainTagsToPreserve = array('mp3gain_minmax', 'mp3gain_album_minmax', 'mp3gain_undo', 'replaygain_track_peak', 'replaygain_track_gain', 'replaygain_album_peak', 'replaygain_album_gain');
- foreach ($ReplayGainTagsToPreserve as $rg_key) {
- if (isset($ThisFileInfo['ape']['items'][strtolower($rg_key)]['data'][0]) && !isset($this->tag_data[strtoupper($rg_key)][0])) {
- $this->tag_data[strtoupper($rg_key)][0] = $ThisFileInfo['ape']['items'][strtolower($rg_key)]['data'][0];
- }
- }
- }
-
- if ($APEtag = $this->GenerateAPEtag()) {
- if (is_writable($this->filename) && is_file($this->filename) && ($fp = fopen($this->filename, 'a+b'))) {
- $oldignoreuserabort = ignore_user_abort(true);
- flock($fp, LOCK_EX);
-
- $PostAPEdataOffset = $ThisFileInfo['avdataend'];
- if (isset($ThisFileInfo['ape']['tag_offset_end'])) {
- $PostAPEdataOffset = max($PostAPEdataOffset, $ThisFileInfo['ape']['tag_offset_end']);
- }
- if (isset($ThisFileInfo['lyrics3']['tag_offset_start'])) {
- $PostAPEdataOffset = max($PostAPEdataOffset, $ThisFileInfo['lyrics3']['tag_offset_start']);
- }
- fseek($fp, $PostAPEdataOffset, SEEK_SET);
- $PostAPEdata = '';
- if ($ThisFileInfo['filesize'] > $PostAPEdataOffset) {
- $PostAPEdata = fread($fp, $ThisFileInfo['filesize'] - $PostAPEdataOffset);
- }
-
- fseek($fp, $PostAPEdataOffset, SEEK_SET);
- if (isset($ThisFileInfo['ape']['tag_offset_start'])) {
- fseek($fp, $ThisFileInfo['ape']['tag_offset_start'], SEEK_SET);
- }
- ftruncate($fp, ftell($fp));
- fwrite($fp, $APEtag, strlen($APEtag));
- if (!empty($PostAPEdata)) {
- fwrite($fp, $PostAPEdata, strlen($PostAPEdata));
- }
- flock($fp, LOCK_UN);
- fclose($fp);
- ignore_user_abort($oldignoreuserabort);
- return true;
- }
- }
- return false;
- }
-
- function DeleteAPEtag() {
- $getID3 = new getID3;
- $ThisFileInfo = $getID3->analyze($this->filename);
- if (isset($ThisFileInfo['ape']['tag_offset_start']) && isset($ThisFileInfo['ape']['tag_offset_end'])) {
- if (is_writable($this->filename) && is_file($this->filename) && ($fp = fopen($this->filename, 'a+b'))) {
-
- flock($fp, LOCK_EX);
- $oldignoreuserabort = ignore_user_abort(true);
-
- fseek($fp, $ThisFileInfo['ape']['tag_offset_end'], SEEK_SET);
- $DataAfterAPE = '';
- if ($ThisFileInfo['filesize'] > $ThisFileInfo['ape']['tag_offset_end']) {
- $DataAfterAPE = fread($fp, $ThisFileInfo['filesize'] - $ThisFileInfo['ape']['tag_offset_end']);
- }
-
- ftruncate($fp, $ThisFileInfo['ape']['tag_offset_start']);
- fseek($fp, $ThisFileInfo['ape']['tag_offset_start'], SEEK_SET);
-
- if (!empty($DataAfterAPE)) {
- fwrite($fp, $DataAfterAPE, strlen($DataAfterAPE));
- }
-
- flock($fp, LOCK_UN);
- fclose($fp);
- ignore_user_abort($oldignoreuserabort);
-
- return true;
- }
- return false;
- }
- return true;
- }
-
-
- function GenerateAPEtag() {
- // NOTE: All data passed to this function must be UTF-8 format
-
- $items = array();
- if (!is_array($this->tag_data)) {
- return false;
- }
- foreach ($this->tag_data as $key => $arrayofvalues) {
- if (!is_array($arrayofvalues)) {
- return false;
- }
-
- $valuestring = '';
- foreach ($arrayofvalues as $value) {
- $valuestring .= str_replace("\x00", '', $value)."\x00";
- }
- $valuestring = rtrim($valuestring, "\x00");
-
- // Length of the assigned value in bytes
- $tagitem = getid3_lib::LittleEndian2String(strlen($valuestring), 4);
-
- //$tagitem .= $this->GenerateAPEtagFlags(true, true, false, 0, false);
- $tagitem .= "\x00\x00\x00\x00";
-
- $tagitem .= $this->CleanAPEtagItemKey($key)."\x00";
- $tagitem .= $valuestring;
-
- $items[] = $tagitem;
-
- }
-
- return $this->GenerateAPEtagHeaderFooter($items, true).implode('', $items).$this->GenerateAPEtagHeaderFooter($items, false);
- }
-
- function GenerateAPEtagHeaderFooter(&$items, $isheader=false) {
- $tagdatalength = 0;
- foreach ($items as $itemdata) {
- $tagdatalength += strlen($itemdata);
- }
-
- $APEheader = 'APETAGEX';
- $APEheader .= getid3_lib::LittleEndian2String(2000, 4);
- $APEheader .= getid3_lib::LittleEndian2String(32 + $tagdatalength, 4);
- $APEheader .= getid3_lib::LittleEndian2String(count($items), 4);
- $APEheader .= $this->GenerateAPEtagFlags(true, true, $isheader, 0, false);
- $APEheader .= str_repeat("\x00", 8);
-
- return $APEheader;
- }
-
- function GenerateAPEtagFlags($header=true, $footer=true, $isheader=false, $encodingid=0, $readonly=false) {
- $APEtagFlags = array_fill(0, 4, 0);
- if ($header) {
- $APEtagFlags[0] |= 0x80; // Tag contains a header
- }
- if (!$footer) {
- $APEtagFlags[0] |= 0x40; // Tag contains no footer
- }
- if ($isheader) {
- $APEtagFlags[0] |= 0x20; // This is the header, not the footer
- }
-
- // 0: Item contains text information coded in UTF-8
- // 1: Item contains binary information )
- // 2: Item is a locator of external stored information )
- // 3: reserved
- $APEtagFlags[3] |= ($encodingid << 1);
-
- if ($readonly) {
- $APEtagFlags[3] |= 0x01; // Tag or Item is Read Only
- }
-
- return chr($APEtagFlags[3]).chr($APEtagFlags[2]).chr($APEtagFlags[1]).chr($APEtagFlags[0]);
- }
-
- function CleanAPEtagItemKey($itemkey) {
- $itemkey = preg_replace("#[^\x20-\x7E]#i", '', $itemkey);
-
- // http://www.personal.uni-jena.de/~pfk/mpp/sv8/apekey.html
- switch (strtoupper($itemkey)) {
- case 'EAN/UPC':
- case 'ISBN':
- case 'LC':
- case 'ISRC':
- $itemkey = strtoupper($itemkey);
- break;
-
- default:
- $itemkey = ucwords($itemkey);
- break;
- }
- return $itemkey;
-
- }
-
-}
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/write.id3v1.php b/3rdparty/getid3/write.id3v1.php
deleted file mode 100644
index cecccd8ac54..00000000000
--- a/3rdparty/getid3/write.id3v1.php
+++ /dev/null
@@ -1,138 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// write.id3v1.php //
-// module for writing ID3v1 tags //
-// dependencies: module.tag.id3v1.php //
-// ///
-/////////////////////////////////////////////////////////////////
-
-getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.id3v1.php', __FILE__, true);
-
-class getid3_write_id3v1
-{
- var $filename;
- var $filesize;
- var $tag_data;
- var $warnings = array(); // any non-critical errors will be stored here
- var $errors = array(); // any critical errors will be stored here
-
- function getid3_write_id3v1() {
- return true;
- }
-
- function WriteID3v1() {
- // File MUST be writeable - CHMOD(646) at least
- if (!empty($this->filename) && is_readable($this->filename) && is_writable($this->filename) && is_file($this->filename)) {
- $this->setRealFileSize();
- if (($this->filesize <= 0) || !getid3_lib::intValueSupported($this->filesize)) {
- $this->errors[] = 'Unable to WriteID3v1('.$this->filename.') because filesize ('.$this->filesize.') is larger than '.round(PHP_INT_MAX / 1073741824).'GB';
- return false;
- }
- if ($fp_source = fopen($this->filename, 'r+b')) {
- fseek($fp_source, -128, SEEK_END);
- if (fread($fp_source, 3) == 'TAG') {
- fseek($fp_source, -128, SEEK_END); // overwrite existing ID3v1 tag
- } else {
- fseek($fp_source, 0, SEEK_END); // append new ID3v1 tag
- }
- $this->tag_data['track'] = (isset($this->tag_data['track']) ? $this->tag_data['track'] : (isset($this->tag_data['track_number']) ? $this->tag_data['track_number'] : (isset($this->tag_data['tracknumber']) ? $this->tag_data['tracknumber'] : '')));
-
- $new_id3v1_tag_data = getid3_id3v1::GenerateID3v1Tag(
- (isset($this->tag_data['title'] ) ? $this->tag_data['title'] : ''),
- (isset($this->tag_data['artist'] ) ? $this->tag_data['artist'] : ''),
- (isset($this->tag_data['album'] ) ? $this->tag_data['album'] : ''),
- (isset($this->tag_data['year'] ) ? $this->tag_data['year'] : ''),
- (isset($this->tag_data['genreid']) ? $this->tag_data['genreid'] : ''),
- (isset($this->tag_data['comment']) ? $this->tag_data['comment'] : ''),
- (isset($this->tag_data['track'] ) ? $this->tag_data['track'] : ''));
- fwrite($fp_source, $new_id3v1_tag_data, 128);
- fclose($fp_source);
- return true;
-
- } else {
- $this->errors[] = 'Could not fopen('.$this->filename.', "r+b")';
- return false;
- }
- }
- $this->errors[] = 'File is not writeable: '.$this->filename;
- return false;
- }
-
- function FixID3v1Padding() {
- // ID3v1 data is supposed to be padded with NULL characters, but some taggers incorrectly use spaces
- // This function rewrites the ID3v1 tag with correct padding
-
- // Initialize getID3 engine
- $getID3 = new getID3;
- $getID3->option_tag_id3v2 = false;
- $getID3->option_tag_apetag = false;
- $getID3->option_tags_html = false;
- $getID3->option_extra_info = false;
- $getID3->option_tag_id3v1 = true;
- $ThisFileInfo = $getID3->analyze($this->filename);
- if (isset($ThisFileInfo['tags']['id3v1'])) {
- foreach ($ThisFileInfo['tags']['id3v1'] as $key => $value) {
- $id3v1data[$key] = implode(',', $value);
- }
- $this->tag_data = $id3v1data;
- return $this->WriteID3v1();
- }
- return false;
- }
-
- function RemoveID3v1() {
- // File MUST be writeable - CHMOD(646) at least
- if (!empty($this->filename) && is_readable($this->filename) && is_writable($this->filename) && is_file($this->filename)) {
- $this->setRealFileSize();
- if (($this->filesize <= 0) || !getid3_lib::intValueSupported($this->filesize)) {
- $this->errors[] = 'Unable to RemoveID3v1('.$this->filename.') because filesize ('.$this->filesize.') is larger than '.round(PHP_INT_MAX / 1073741824).'GB';
- return false;
- }
- if ($fp_source = fopen($this->filename, 'r+b')) {
-
- fseek($fp_source, -128, SEEK_END);
- if (fread($fp_source, 3) == 'TAG') {
- ftruncate($fp_source, $this->filesize - 128);
- } else {
- // no ID3v1 tag to begin with - do nothing
- }
- fclose($fp_source);
- return true;
-
- } else {
- $this->errors[] = 'Could not fopen('.$this->filename.', "r+b")';
- }
- } else {
- $this->errors[] = $this->filename.' is not writeable';
- }
- return false;
- }
-
- function setRealFileSize() {
- if (PHP_INT_MAX > 2147483647) {
- $this->filesize = filesize($this->filename);
- return true;
- }
- // 32-bit PHP will not return correct values for filesize() if file is >=2GB
- // but getID3->analyze() has workarounds to get actual filesize
- $getID3 = new getID3;
- $getID3->option_tag_id3v1 = false;
- $getID3->option_tag_id3v2 = false;
- $getID3->option_tag_apetag = false;
- $getID3->option_tags_html = false;
- $getID3->option_extra_info = false;
- $ThisFileInfo = $getID3->analyze($this->filename);
- $this->filesize = $ThisFileInfo['filesize'];
- return true;
- }
-
-}
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/write.id3v2.php b/3rdparty/getid3/write.id3v2.php
deleted file mode 100644
index ee7c5de2df5..00000000000
--- a/3rdparty/getid3/write.id3v2.php
+++ /dev/null
@@ -1,2050 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-/// //
-// write.id3v2.php //
-// module for writing ID3v2 tags //
-// dependencies: module.tag.id3v2.php //
-// ///
-/////////////////////////////////////////////////////////////////
-
-getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.id3v2.php', __FILE__, true);
-
-class getid3_write_id3v2
-{
- var $filename;
- var $tag_data;
- var $fread_buffer_size = 32768; // read buffer size in bytes
- var $paddedlength = 4096; // minimum length of ID3v2 tag in bytes
- var $majorversion = 3; // ID3v2 major version (2, 3 (recommended), 4)
- var $minorversion = 0; // ID3v2 minor version - always 0
- var $merge_existing_data = false; // if true, merge new data with existing tags; if false, delete old tag data and only write new tags
- var $id3v2_default_encodingid = 0; // default text encoding (ISO-8859-1) if not explicitly passed
- var $id3v2_use_unsynchronisation = false; // the specs say it should be TRUE, but most other ID3v2-aware programs are broken if unsynchronization is used, so by default don't use it.
- var $warnings = array(); // any non-critical errors will be stored here
- var $errors = array(); // any critical errors will be stored here
-
- function getid3_write_id3v2() {
- return true;
- }
-
- function WriteID3v2() {
- // File MUST be writeable - CHMOD(646) at least. It's best if the
- // directory is also writeable, because that method is both faster and less susceptible to errors.
-
- if (!empty($this->filename) && (is_writeable($this->filename) || (!file_exists($this->filename) && is_writeable(dirname($this->filename))))) {
- // Initialize getID3 engine
- $getID3 = new getID3;
- $OldThisFileInfo = $getID3->analyze($this->filename);
- if (!getid3_lib::intValueSupported($OldThisFileInfo['filesize'])) {
- $this->errors[] = 'Unable to write ID3v2 because file is larger than '.round(PHP_INT_MAX / 1073741824).'GB';
- fclose($fp_source);
- return false;
- }
- if ($this->merge_existing_data) {
- // merge with existing data
- if (!empty($OldThisFileInfo['id3v2'])) {
- $this->tag_data = $this->array_join_merge($OldThisFileInfo['id3v2'], $this->tag_data);
- }
- }
- $this->paddedlength = (isset($OldThisFileInfo['id3v2']['headerlength']) ? max($OldThisFileInfo['id3v2']['headerlength'], $this->paddedlength) : $this->paddedlength);
-
- if ($NewID3v2Tag = $this->GenerateID3v2Tag()) {
-
- if (file_exists($this->filename) && is_writeable($this->filename) && isset($OldThisFileInfo['id3v2']['headerlength']) && ($OldThisFileInfo['id3v2']['headerlength'] == strlen($NewID3v2Tag))) {
-
- // best and fastest method - insert-overwrite existing tag (padded to length of old tag if neccesary)
- if (file_exists($this->filename)) {
-
- if (is_readable($this->filename) && is_writable($this->filename) && is_file($this->filename) && ($fp = fopen($this->filename, 'r+b'))) {
- rewind($fp);
- fwrite($fp, $NewID3v2Tag, strlen($NewID3v2Tag));
- fclose($fp);
- } else {
- $this->errors[] = 'Could not fopen("'.$this->filename.'", "r+b")';
- }
-
- } else {
-
- if (is_writable($this->filename) && is_file($this->filename) && ($fp = fopen($this->filename, 'wb'))) {
- rewind($fp);
- fwrite($fp, $NewID3v2Tag, strlen($NewID3v2Tag));
- fclose($fp);
- } else {
- $this->errors[] = 'Could not fopen("'.$this->filename.'", "wb")';
- }
-
- }
-
- } else {
-
- if ($tempfilename = tempnam(GETID3_TEMP_DIR, 'getID3')) {
- if (is_readable($this->filename) && is_file($this->filename) && ($fp_source = fopen($this->filename, 'rb'))) {
- if (is_writable($tempfilename) && is_file($tempfilename) && ($fp_temp = fopen($tempfilename, 'wb'))) {
-
- fwrite($fp_temp, $NewID3v2Tag, strlen($NewID3v2Tag));
-
- rewind($fp_source);
- if (!empty($OldThisFileInfo['avdataoffset'])) {
- fseek($fp_source, $OldThisFileInfo['avdataoffset'], SEEK_SET);
- }
-
- while ($buffer = fread($fp_source, $this->fread_buffer_size)) {
- fwrite($fp_temp, $buffer, strlen($buffer));
- }
-
- fclose($fp_temp);
- fclose($fp_source);
- copy($tempfilename, $this->filename);
- unlink($tempfilename);
- return true;
-
- } else {
- $this->errors[] = 'Could not fopen("'.$tempfilename.'", "wb")';
- }
- fclose($fp_source);
-
- } else {
- $this->errors[] = 'Could not fopen("'.$this->filename.'", "rb")';
- }
- }
- return false;
-
- }
-
- } else {
-
- $this->errors[] = '$this->GenerateID3v2Tag() failed';
-
- }
-
- if (!empty($this->errors)) {
- return false;
- }
- return true;
- } else {
- $this->errors[] = 'WriteID3v2() failed: !is_writeable('.$this->filename.')';
- }
- return false;
- }
-
- function RemoveID3v2() {
- // File MUST be writeable - CHMOD(646) at least. It's best if the
- // directory is also writeable, because that method is both faster and less susceptible to errors.
- if (is_writeable(dirname($this->filename))) {
-
- // preferred method - only one copying operation, minimal chance of corrupting
- // original file if script is interrupted, but required directory to be writeable
- if (is_readable($this->filename) && is_file($this->filename) && ($fp_source = fopen($this->filename, 'rb'))) {
-
- // Initialize getID3 engine
- $getID3 = new getID3;
- $OldThisFileInfo = $getID3->analyze($this->filename);
- if (!getid3_lib::intValueSupported($OldThisFileInfo['filesize'])) {
- $this->errors[] = 'Unable to remove ID3v2 because file is larger than '.round(PHP_INT_MAX / 1073741824).'GB';
- fclose($fp_source);
- return false;
- }
- rewind($fp_source);
- if ($OldThisFileInfo['avdataoffset'] !== false) {
- fseek($fp_source, $OldThisFileInfo['avdataoffset'], SEEK_SET);
- }
- if (is_writable($this->filename) && is_file($this->filename) && ($fp_temp = fopen($this->filename.'getid3tmp', 'w+b'))) {
- while ($buffer = fread($fp_source, $this->fread_buffer_size)) {
- fwrite($fp_temp, $buffer, strlen($buffer));
- }
- fclose($fp_temp);
- } else {
- $this->errors[] = 'Could not fopen("'.$this->filename.'getid3tmp", "w+b")';
- }
- fclose($fp_source);
- } else {
- $this->errors[] = 'Could not fopen("'.$this->filename.'", "rb")';
- }
- if (file_exists($this->filename)) {
- unlink($this->filename);
- }
- rename($this->filename.'getid3tmp', $this->filename);
-
- } elseif (is_writable($this->filename)) {
-
- // less desirable alternate method - double-copies the file, overwrites original file
- // and could corrupt source file if the script is interrupted or an error occurs.
- if (is_readable($this->filename) && is_file($this->filename) && ($fp_source = fopen($this->filename, 'rb'))) {
-
- // Initialize getID3 engine
- $getID3 = new getID3;
- $OldThisFileInfo = $getID3->analyze($this->filename);
- if (!getid3_lib::intValueSupported($OldThisFileInfo['filesize'])) {
- $this->errors[] = 'Unable to remove ID3v2 because file is larger than '.round(PHP_INT_MAX / 1073741824).'GB';
- fclose($fp_source);
- return false;
- }
- rewind($fp_source);
- if ($OldThisFileInfo['avdataoffset'] !== false) {
- fseek($fp_source, $OldThisFileInfo['avdataoffset'], SEEK_SET);
- }
- if ($fp_temp = tmpfile()) {
- while ($buffer = fread($fp_source, $this->fread_buffer_size)) {
- fwrite($fp_temp, $buffer, strlen($buffer));
- }
- fclose($fp_source);
- if (is_writable($this->filename) && is_file($this->filename) && ($fp_source = fopen($this->filename, 'wb'))) {
- rewind($fp_temp);
- while ($buffer = fread($fp_temp, $this->fread_buffer_size)) {
- fwrite($fp_source, $buffer, strlen($buffer));
- }
- fseek($fp_temp, -128, SEEK_END);
- fclose($fp_source);
- } else {
- $this->errors[] = 'Could not fopen("'.$this->filename.'", "wb")';
- }
- fclose($fp_temp);
- } else {
- $this->errors[] = 'Could not create tmpfile()';
- }
- } else {
- $this->errors[] = 'Could not fopen("'.$this->filename.'", "rb")';
- }
-
- } else {
-
- $this->errors[] = 'Directory and file both not writeable';
-
- }
-
- if (!empty($this->errors)) {
- return false;
- }
- return true;
- }
-
-
- function GenerateID3v2TagFlags($flags) {
- switch ($this->majorversion) {
- case 4:
- // %abcd0000
- $flag = (!empty($flags['unsynchronisation']) ? '1' : '0'); // a - Unsynchronisation
- $flag .= (!empty($flags['extendedheader'] ) ? '1' : '0'); // b - Extended header
- $flag .= (!empty($flags['experimental'] ) ? '1' : '0'); // c - Experimental indicator
- $flag .= (!empty($flags['footer'] ) ? '1' : '0'); // d - Footer present
- $flag .= '0000';
- break;
-
- case 3:
- // %abc00000
- $flag = (!empty($flags['unsynchronisation']) ? '1' : '0'); // a - Unsynchronisation
- $flag .= (!empty($flags['extendedheader'] ) ? '1' : '0'); // b - Extended header
- $flag .= (!empty($flags['experimental'] ) ? '1' : '0'); // c - Experimental indicator
- $flag .= '00000';
- break;
-
- case 2:
- // %ab000000
- $flag = (!empty($flags['unsynchronisation']) ? '1' : '0'); // a - Unsynchronisation
- $flag .= (!empty($flags['compression'] ) ? '1' : '0'); // b - Compression
- $flag .= '000000';
- break;
-
- default:
- return false;
- break;
- }
- return chr(bindec($flag));
- }
-
-
- function GenerateID3v2FrameFlags($TagAlter=false, $FileAlter=false, $ReadOnly=false, $Compression=false, $Encryption=false, $GroupingIdentity=false, $Unsynchronisation=false, $DataLengthIndicator=false) {
- switch ($this->majorversion) {
- case 4:
- // %0abc0000 %0h00kmnp
- $flag1 = '0';
- $flag1 .= $TagAlter ? '1' : '0'; // a - Tag alter preservation (true == discard)
- $flag1 .= $FileAlter ? '1' : '0'; // b - File alter preservation (true == discard)
- $flag1 .= $ReadOnly ? '1' : '0'; // c - Read only (true == read only)
- $flag1 .= '0000';
-
- $flag2 = '0';
- $flag2 .= $GroupingIdentity ? '1' : '0'; // h - Grouping identity (true == contains group information)
- $flag2 .= '00';
- $flag2 .= $Compression ? '1' : '0'; // k - Compression (true == compressed)
- $flag2 .= $Encryption ? '1' : '0'; // m - Encryption (true == encrypted)
- $flag2 .= $Unsynchronisation ? '1' : '0'; // n - Unsynchronisation (true == unsynchronised)
- $flag2 .= $DataLengthIndicator ? '1' : '0'; // p - Data length indicator (true == data length indicator added)
- break;
-
- case 3:
- // %abc00000 %ijk00000
- $flag1 = $TagAlter ? '1' : '0'; // a - Tag alter preservation (true == discard)
- $flag1 .= $FileAlter ? '1' : '0'; // b - File alter preservation (true == discard)
- $flag1 .= $ReadOnly ? '1' : '0'; // c - Read only (true == read only)
- $flag1 .= '00000';
-
- $flag2 = $Compression ? '1' : '0'; // i - Compression (true == compressed)
- $flag2 .= $Encryption ? '1' : '0'; // j - Encryption (true == encrypted)
- $flag2 .= $GroupingIdentity ? '1' : '0'; // k - Grouping identity (true == contains group information)
- $flag2 .= '00000';
- break;
-
- default:
- return false;
- break;
-
- }
- return chr(bindec($flag1)).chr(bindec($flag2));
- }
-
- function GenerateID3v2FrameData($frame_name, $source_data_array) {
- if (!getid3_id3v2::IsValidID3v2FrameName($frame_name, $this->majorversion)) {
- return false;
- }
- $framedata = '';
-
- if (($this->majorversion < 3) || ($this->majorversion > 4)) {
-
- $this->errors[] = 'Only ID3v2.3 and ID3v2.4 are supported in GenerateID3v2FrameData()';
-
- } else { // $this->majorversion 3 or 4
-
- switch ($frame_name) {
- case 'UFID':
- // 4.1 UFID Unique file identifier
- // Owner identifier <text string> $00
- // Identifier <up to 64 bytes binary data>
- if (strlen($source_data_array['data']) > 64) {
- $this->errors[] = 'Identifier not allowed to be longer than 64 bytes in '.$frame_name.' (supplied data was '.strlen($source_data_array['data']).' bytes long)';
- } else {
- $framedata .= str_replace("\x00", '', $source_data_array['ownerid'])."\x00";
- $framedata .= substr($source_data_array['data'], 0, 64); // max 64 bytes - truncate anything longer
- }
- break;
-
- case 'TXXX':
- // 4.2.2 TXXX User defined text information frame
- // Text encoding $xx
- // Description <text string according to encoding> $00 (00)
- // Value <text string according to encoding>
- $source_data_array['encodingid'] = (isset($source_data_array['encodingid']) ? $source_data_array['encodingid'] : $this->id3v2_default_encodingid);
- if (!$this->ID3v2IsValidTextEncoding($source_data_array['encodingid'], $this->majorversion)) {
- $this->errors[] = 'Invalid Text Encoding in '.$frame_name.' ('.$source_data_array['encodingid'].') for ID3v2.'.$this->majorversion;
- } else {
- $framedata .= chr($source_data_array['encodingid']);
- $framedata .= $source_data_array['description'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array['encodingid']);
- $framedata .= $source_data_array['data'];
- }
- break;
-
- case 'WXXX':
- // 4.3.2 WXXX User defined URL link frame
- // Text encoding $xx
- // Description <text string according to encoding> $00 (00)
- // URL <text string>
- $source_data_array['encodingid'] = (isset($source_data_array['encodingid']) ? $source_data_array['encodingid'] : $this->id3v2_default_encodingid);
- if (!$this->ID3v2IsValidTextEncoding($source_data_array['encodingid'], $this->majorversion)) {
- $this->errors[] = 'Invalid Text Encoding in '.$frame_name.' ('.$source_data_array['encodingid'].') for ID3v2.'.$this->majorversion;
- } elseif (!isset($source_data_array['data']) || !$this->IsValidURL($source_data_array['data'], false, false)) {
- //$this->errors[] = 'Invalid URL in '.$frame_name.' ('.$source_data_array['data'].')';
- // probably should be an error, need to rewrite IsValidURL() to handle other encodings
- $this->warnings[] = 'Invalid URL in '.$frame_name.' ('.$source_data_array['data'].')';
- } else {
- $framedata .= chr($source_data_array['encodingid']);
- $framedata .= $source_data_array['description'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array['encodingid']);
- $framedata .= $source_data_array['data'];
- }
- break;
-
- case 'IPLS':
- // 4.4 IPLS Involved people list (ID3v2.3 only)
- // Text encoding $xx
- // People list strings <textstrings>
- $source_data_array['encodingid'] = (isset($source_data_array['encodingid']) ? $source_data_array['encodingid'] : $this->id3v2_default_encodingid);
- if (!$this->ID3v2IsValidTextEncoding($source_data_array['encodingid'], $this->majorversion)) {
- $this->errors[] = 'Invalid Text Encoding in '.$frame_name.' ('.$source_data_array['encodingid'].') for ID3v2.'.$this->majorversion;
- } else {
- $framedata .= chr($source_data_array['encodingid']);
- $framedata .= $source_data_array['data'];
- }
- break;
-
- case 'MCDI':
- // 4.4 MCDI Music CD identifier
- // CD TOC <binary data>
- $framedata .= $source_data_array['data'];
- break;
-
- case 'ETCO':
- // 4.5 ETCO Event timing codes
- // Time stamp format $xx
- // Where time stamp format is:
- // $01 (32-bit value) MPEG frames from beginning of file
- // $02 (32-bit value) milliseconds from beginning of file
- // Followed by a list of key events in the following format:
- // Type of event $xx
- // Time stamp $xx (xx ...)
- // The 'Time stamp' is set to zero if directly at the beginning of the sound
- // or after the previous event. All events MUST be sorted in chronological order.
- if (($source_data_array['timestampformat'] > 2) || ($source_data_array['timestampformat'] < 1)) {
- $this->errors[] = 'Invalid Time Stamp Format byte in '.$frame_name.' ('.$source_data_array['timestampformat'].')';
- } else {
- $framedata .= chr($source_data_array['timestampformat']);
- foreach ($source_data_array as $key => $val) {
- if (!$this->ID3v2IsValidETCOevent($val['typeid'])) {
- $this->errors[] = 'Invalid Event Type byte in '.$frame_name.' ('.$val['typeid'].')';
- } elseif (($key != 'timestampformat') && ($key != 'flags')) {
- if (($val['timestamp'] > 0) && ($previousETCOtimestamp >= $val['timestamp'])) {
- // The 'Time stamp' is set to zero if directly at the beginning of the sound
- // or after the previous event. All events MUST be sorted in chronological order.
- $this->errors[] = 'Out-of-order timestamp in '.$frame_name.' ('.$val['timestamp'].') for Event Type ('.$val['typeid'].')';
- } else {
- $framedata .= chr($val['typeid']);
- $framedata .= getid3_lib::BigEndian2String($val['timestamp'], 4, false);
- }
- }
- }
- }
- break;
-
- case 'MLLT':
- // 4.6 MLLT MPEG location lookup table
- // MPEG frames between reference $xx xx
- // Bytes between reference $xx xx xx
- // Milliseconds between reference $xx xx xx
- // Bits for bytes deviation $xx
- // Bits for milliseconds dev. $xx
- // Then for every reference the following data is included;
- // Deviation in bytes %xxx....
- // Deviation in milliseconds %xxx....
- if (($source_data_array['framesbetweenreferences'] > 0) && ($source_data_array['framesbetweenreferences'] <= 65535)) {
- $framedata .= getid3_lib::BigEndian2String($source_data_array['framesbetweenreferences'], 2, false);
- } else {
- $this->errors[] = 'Invalid MPEG Frames Between References in '.$frame_name.' ('.$source_data_array['framesbetweenreferences'].')';
- }
- if (($source_data_array['bytesbetweenreferences'] > 0) && ($source_data_array['bytesbetweenreferences'] <= 16777215)) {
- $framedata .= getid3_lib::BigEndian2String($source_data_array['bytesbetweenreferences'], 3, false);
- } else {
- $this->errors[] = 'Invalid bytes Between References in '.$frame_name.' ('.$source_data_array['bytesbetweenreferences'].')';
- }
- if (($source_data_array['msbetweenreferences'] > 0) && ($source_data_array['msbetweenreferences'] <= 16777215)) {
- $framedata .= getid3_lib::BigEndian2String($source_data_array['msbetweenreferences'], 3, false);
- } else {
- $this->errors[] = 'Invalid Milliseconds Between References in '.$frame_name.' ('.$source_data_array['msbetweenreferences'].')';
- }
- if (!$this->IsWithinBitRange($source_data_array['bitsforbytesdeviation'], 8, false)) {
- if (($source_data_array['bitsforbytesdeviation'] % 4) == 0) {
- $framedata .= chr($source_data_array['bitsforbytesdeviation']);
- } else {
- $this->errors[] = 'Bits For Bytes Deviation in '.$frame_name.' ('.$source_data_array['bitsforbytesdeviation'].') must be a multiple of 4.';
- }
- } else {
- $this->errors[] = 'Invalid Bits For Bytes Deviation in '.$frame_name.' ('.$source_data_array['bitsforbytesdeviation'].')';
- }
- if (!$this->IsWithinBitRange($source_data_array['bitsformsdeviation'], 8, false)) {
- if (($source_data_array['bitsformsdeviation'] % 4) == 0) {
- $framedata .= chr($source_data_array['bitsformsdeviation']);
- } else {
- $this->errors[] = 'Bits For Milliseconds Deviation in '.$frame_name.' ('.$source_data_array['bitsforbytesdeviation'].') must be a multiple of 4.';
- }
- } else {
- $this->errors[] = 'Invalid Bits For Milliseconds Deviation in '.$frame_name.' ('.$source_data_array['bitsformsdeviation'].')';
- }
- foreach ($source_data_array as $key => $val) {
- if (($key != 'framesbetweenreferences') && ($key != 'bytesbetweenreferences') && ($key != 'msbetweenreferences') && ($key != 'bitsforbytesdeviation') && ($key != 'bitsformsdeviation') && ($key != 'flags')) {
- $unwrittenbitstream .= str_pad(getid3_lib::Dec2Bin($val['bytedeviation']), $source_data_array['bitsforbytesdeviation'], '0', STR_PAD_LEFT);
- $unwrittenbitstream .= str_pad(getid3_lib::Dec2Bin($val['msdeviation']), $source_data_array['bitsformsdeviation'], '0', STR_PAD_LEFT);
- }
- }
- for ($i = 0; $i < strlen($unwrittenbitstream); $i += 8) {
- $highnibble = bindec(substr($unwrittenbitstream, $i, 4)) << 4;
- $lownibble = bindec(substr($unwrittenbitstream, $i + 4, 4));
- $framedata .= chr($highnibble & $lownibble);
- }
- break;
-
- case 'SYTC':
- // 4.7 SYTC Synchronised tempo codes
- // Time stamp format $xx
- // Tempo data <binary data>
- // Where time stamp format is:
- // $01 (32-bit value) MPEG frames from beginning of file
- // $02 (32-bit value) milliseconds from beginning of file
- if (($source_data_array['timestampformat'] > 2) || ($source_data_array['timestampformat'] < 1)) {
- $this->errors[] = 'Invalid Time Stamp Format byte in '.$frame_name.' ('.$source_data_array['timestampformat'].')';
- } else {
- $framedata .= chr($source_data_array['timestampformat']);
- foreach ($source_data_array as $key => $val) {
- if (!$this->ID3v2IsValidETCOevent($val['typeid'])) {
- $this->errors[] = 'Invalid Event Type byte in '.$frame_name.' ('.$val['typeid'].')';
- } elseif (($key != 'timestampformat') && ($key != 'flags')) {
- if (($val['tempo'] < 0) || ($val['tempo'] > 510)) {
- $this->errors[] = 'Invalid Tempo (max = 510) in '.$frame_name.' ('.$val['tempo'].') at timestamp ('.$val['timestamp'].')';
- } else {
- if ($val['tempo'] > 255) {
- $framedata .= chr(255);
- $val['tempo'] -= 255;
- }
- $framedata .= chr($val['tempo']);
- $framedata .= getid3_lib::BigEndian2String($val['timestamp'], 4, false);
- }
- }
- }
- }
- break;
-
- case 'USLT':
- // 4.8 USLT Unsynchronised lyric/text transcription
- // Text encoding $xx
- // Language $xx xx xx
- // Content descriptor <text string according to encoding> $00 (00)
- // Lyrics/text <full text string according to encoding>
- $source_data_array['encodingid'] = (isset($source_data_array['encodingid']) ? $source_data_array['encodingid'] : $this->id3v2_default_encodingid);
- if (!$this->ID3v2IsValidTextEncoding($source_data_array['encodingid'])) {
- $this->errors[] = 'Invalid Text Encoding in '.$frame_name.' ('.$source_data_array['encodingid'].') for ID3v2.'.$this->majorversion;
- } elseif (getid3_id3v2::LanguageLookup($source_data_array['language'], true) == '') {
- $this->errors[] = 'Invalid Language in '.$frame_name.' ('.$source_data_array['language'].')';
- } else {
- $framedata .= chr($source_data_array['encodingid']);
- $framedata .= strtolower($source_data_array['language']);
- $framedata .= $source_data_array['description'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array['encodingid']);
- $framedata .= $source_data_array['data'];
- }
- break;
-
- case 'SYLT':
- // 4.9 SYLT Synchronised lyric/text
- // Text encoding $xx
- // Language $xx xx xx
- // Time stamp format $xx
- // $01 (32-bit value) MPEG frames from beginning of file
- // $02 (32-bit value) milliseconds from beginning of file
- // Content type $xx
- // Content descriptor <text string according to encoding> $00 (00)
- // Terminated text to be synced (typically a syllable)
- // Sync identifier (terminator to above string) $00 (00)
- // Time stamp $xx (xx ...)
- $source_data_array['encodingid'] = (isset($source_data_array['encodingid']) ? $source_data_array['encodingid'] : $this->id3v2_default_encodingid);
- if (!$this->ID3v2IsValidTextEncoding($source_data_array['encodingid'])) {
- $this->errors[] = 'Invalid Text Encoding in '.$frame_name.' ('.$source_data_array['encodingid'].') for ID3v2.'.$this->majorversion;
- } elseif (getid3_id3v2::LanguageLookup($source_data_array['language'], true) == '') {
- $this->errors[] = 'Invalid Language in '.$frame_name.' ('.$source_data_array['language'].')';
- } elseif (($source_data_array['timestampformat'] > 2) || ($source_data_array['timestampformat'] < 1)) {
- $this->errors[] = 'Invalid Time Stamp Format byte in '.$frame_name.' ('.$source_data_array['timestampformat'].')';
- } elseif (!$this->ID3v2IsValidSYLTtype($source_data_array['contenttypeid'])) {
- $this->errors[] = 'Invalid Content Type byte in '.$frame_name.' ('.$source_data_array['contenttypeid'].')';
- } elseif (!is_array($source_data_array['data'])) {
- $this->errors[] = 'Invalid Lyric/Timestamp data in '.$frame_name.' (must be an array)';
- } else {
- $framedata .= chr($source_data_array['encodingid']);
- $framedata .= strtolower($source_data_array['language']);
- $framedata .= chr($source_data_array['timestampformat']);
- $framedata .= chr($source_data_array['contenttypeid']);
- $framedata .= $source_data_array['description'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array['encodingid']);
- ksort($source_data_array['data']);
- foreach ($source_data_array['data'] as $key => $val) {
- $framedata .= $val['data'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array['encodingid']);
- $framedata .= getid3_lib::BigEndian2String($val['timestamp'], 4, false);
- }
- }
- break;
-
- case 'COMM':
- // 4.10 COMM Comments
- // Text encoding $xx
- // Language $xx xx xx
- // Short content descrip. <text string according to encoding> $00 (00)
- // The actual text <full text string according to encoding>
- $source_data_array['encodingid'] = (isset($source_data_array['encodingid']) ? $source_data_array['encodingid'] : $this->id3v2_default_encodingid);
- if (!$this->ID3v2IsValidTextEncoding($source_data_array['encodingid'])) {
- $this->errors[] = 'Invalid Text Encoding in '.$frame_name.' ('.$source_data_array['encodingid'].') for ID3v2.'.$this->majorversion;
- } elseif (getid3_id3v2::LanguageLookup($source_data_array['language'], true) == '') {
- $this->errors[] = 'Invalid Language in '.$frame_name.' ('.$source_data_array['language'].')';
- } else {
- $framedata .= chr($source_data_array['encodingid']);
- $framedata .= strtolower($source_data_array['language']);
- $framedata .= $source_data_array['description'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array['encodingid']);
- $framedata .= $source_data_array['data'];
- }
- break;
-
- case 'RVA2':
- // 4.11 RVA2 Relative volume adjustment (2) (ID3v2.4+ only)
- // Identification <text string> $00
- // The 'identification' string is used to identify the situation and/or
- // device where this adjustment should apply. The following is then
- // repeated for every channel:
- // Type of channel $xx
- // Volume adjustment $xx xx
- // Bits representing peak $xx
- // Peak volume $xx (xx ...)
- $framedata .= str_replace("\x00", '', $source_data_array['description'])."\x00";
- foreach ($source_data_array as $key => $val) {
- if ($key != 'description') {
- $framedata .= chr($val['channeltypeid']);
- $framedata .= getid3_lib::BigEndian2String($val['volumeadjust'], 2, false, true); // signed 16-bit
- if (!$this->IsWithinBitRange($source_data_array['bitspeakvolume'], 8, false)) {
- $framedata .= chr($val['bitspeakvolume']);
- if ($val['bitspeakvolume'] > 0) {
- $framedata .= getid3_lib::BigEndian2String($val['peakvolume'], ceil($val['bitspeakvolume'] / 8), false, false);
- }
- } else {
- $this->errors[] = 'Invalid Bits Representing Peak Volume in '.$frame_name.' ('.$val['bitspeakvolume'].') (range = 0 to 255)';
- }
- }
- }
- break;
-
- case 'RVAD':
- // 4.12 RVAD Relative volume adjustment (ID3v2.3 only)
- // Increment/decrement %00fedcba
- // Bits used for volume descr. $xx
- // Relative volume change, right $xx xx (xx ...) // a
- // Relative volume change, left $xx xx (xx ...) // b
- // Peak volume right $xx xx (xx ...)
- // Peak volume left $xx xx (xx ...)
- // Relative volume change, right back $xx xx (xx ...) // c
- // Relative volume change, left back $xx xx (xx ...) // d
- // Peak volume right back $xx xx (xx ...)
- // Peak volume left back $xx xx (xx ...)
- // Relative volume change, center $xx xx (xx ...) // e
- // Peak volume center $xx xx (xx ...)
- // Relative volume change, bass $xx xx (xx ...) // f
- // Peak volume bass $xx xx (xx ...)
- if (!$this->IsWithinBitRange($source_data_array['bitsvolume'], 8, false)) {
- $this->errors[] = 'Invalid Bits For Volume Description byte in '.$frame_name.' ('.$source_data_array['bitsvolume'].') (range = 1 to 255)';
- } else {
- $incdecflag .= '00';
- $incdecflag .= $source_data_array['incdec']['right'] ? '1' : '0'; // a - Relative volume change, right
- $incdecflag .= $source_data_array['incdec']['left'] ? '1' : '0'; // b - Relative volume change, left
- $incdecflag .= $source_data_array['incdec']['rightrear'] ? '1' : '0'; // c - Relative volume change, right back
- $incdecflag .= $source_data_array['incdec']['leftrear'] ? '1' : '0'; // d - Relative volume change, left back
- $incdecflag .= $source_data_array['incdec']['center'] ? '1' : '0'; // e - Relative volume change, center
- $incdecflag .= $source_data_array['incdec']['bass'] ? '1' : '0'; // f - Relative volume change, bass
- $framedata .= chr(bindec($incdecflag));
- $framedata .= chr($source_data_array['bitsvolume']);
- $framedata .= getid3_lib::BigEndian2String($source_data_array['volumechange']['right'], ceil($source_data_array['bitsvolume'] / 8), false);
- $framedata .= getid3_lib::BigEndian2String($source_data_array['volumechange']['left'], ceil($source_data_array['bitsvolume'] / 8), false);
- $framedata .= getid3_lib::BigEndian2String($source_data_array['peakvolume']['right'], ceil($source_data_array['bitsvolume'] / 8), false);
- $framedata .= getid3_lib::BigEndian2String($source_data_array['peakvolume']['left'], ceil($source_data_array['bitsvolume'] / 8), false);
- if ($source_data_array['volumechange']['rightrear'] || $source_data_array['volumechange']['leftrear'] ||
- $source_data_array['peakvolume']['rightrear'] || $source_data_array['peakvolume']['leftrear'] ||
- $source_data_array['volumechange']['center'] || $source_data_array['peakvolume']['center'] ||
- $source_data_array['volumechange']['bass'] || $source_data_array['peakvolume']['bass']) {
- $framedata .= getid3_lib::BigEndian2String($source_data_array['volumechange']['rightrear'], ceil($source_data_array['bitsvolume']/8), false);
- $framedata .= getid3_lib::BigEndian2String($source_data_array['volumechange']['leftrear'], ceil($source_data_array['bitsvolume']/8), false);
- $framedata .= getid3_lib::BigEndian2String($source_data_array['peakvolume']['rightrear'], ceil($source_data_array['bitsvolume']/8), false);
- $framedata .= getid3_lib::BigEndian2String($source_data_array['peakvolume']['leftrear'], ceil($source_data_array['bitsvolume']/8), false);
- }
- if ($source_data_array['volumechange']['center'] || $source_data_array['peakvolume']['center'] ||
- $source_data_array['volumechange']['bass'] || $source_data_array['peakvolume']['bass']) {
- $framedata .= getid3_lib::BigEndian2String($source_data_array['volumechange']['center'], ceil($source_data_array['bitsvolume']/8), false);
- $framedata .= getid3_lib::BigEndian2String($source_data_array['peakvolume']['center'], ceil($source_data_array['bitsvolume']/8), false);
- }
- if ($source_data_array['volumechange']['bass'] || $source_data_array['peakvolume']['bass']) {
- $framedata .= getid3_lib::BigEndian2String($source_data_array['volumechange']['bass'], ceil($source_data_array['bitsvolume']/8), false);
- $framedata .= getid3_lib::BigEndian2String($source_data_array['peakvolume']['bass'], ceil($source_data_array['bitsvolume']/8), false);
- }
- }
- break;
-
- case 'EQU2':
- // 4.12 EQU2 Equalisation (2) (ID3v2.4+ only)
- // Interpolation method $xx
- // $00 Band
- // $01 Linear
- // Identification <text string> $00
- // The following is then repeated for every adjustment point
- // Frequency $xx xx
- // Volume adjustment $xx xx
- if (($source_data_array['interpolationmethod'] < 0) || ($source_data_array['interpolationmethod'] > 1)) {
- $this->errors[] = 'Invalid Interpolation Method byte in '.$frame_name.' ('.$source_data_array['interpolationmethod'].') (valid = 0 or 1)';
- } else {
- $framedata .= chr($source_data_array['interpolationmethod']);
- $framedata .= str_replace("\x00", '', $source_data_array['description'])."\x00";
- foreach ($source_data_array['data'] as $key => $val) {
- $framedata .= getid3_lib::BigEndian2String(intval(round($key * 2)), 2, false);
- $framedata .= getid3_lib::BigEndian2String($val, 2, false, true); // signed 16-bit
- }
- }
- break;
-
- case 'EQUA':
- // 4.12 EQUA Equalisation (ID3v2.3 only)
- // Adjustment bits $xx
- // This is followed by 2 bytes + ('adjustment bits' rounded up to the
- // nearest byte) for every equalisation band in the following format,
- // giving a frequency range of 0 - 32767Hz:
- // Increment/decrement %x (MSB of the Frequency)
- // Frequency (lower 15 bits)
- // Adjustment $xx (xx ...)
- if (!$this->IsWithinBitRange($source_data_array['bitsvolume'], 8, false)) {
- $this->errors[] = 'Invalid Adjustment Bits byte in '.$frame_name.' ('.$source_data_array['bitsvolume'].') (range = 1 to 255)';
- } else {
- $framedata .= chr($source_data_array['adjustmentbits']);
- foreach ($source_data_array as $key => $val) {
- if ($key != 'bitsvolume') {
- if (($key > 32767) || ($key < 0)) {
- $this->errors[] = 'Invalid Frequency in '.$frame_name.' ('.$key.') (range = 0 to 32767)';
- } else {
- if ($val >= 0) {
- // put MSB of frequency to 1 if increment, 0 if decrement
- $key |= 0x8000;
- }
- $framedata .= getid3_lib::BigEndian2String($key, 2, false);
- $framedata .= getid3_lib::BigEndian2String($val, ceil($source_data_array['adjustmentbits'] / 8), false);
- }
- }
- }
- }
- break;
-
- case 'RVRB':
- // 4.13 RVRB Reverb
- // Reverb left (ms) $xx xx
- // Reverb right (ms) $xx xx
- // Reverb bounces, left $xx
- // Reverb bounces, right $xx
- // Reverb feedback, left to left $xx
- // Reverb feedback, left to right $xx
- // Reverb feedback, right to right $xx
- // Reverb feedback, right to left $xx
- // Premix left to right $xx
- // Premix right to left $xx
- if (!$this->IsWithinBitRange($source_data_array['left'], 16, false)) {
- $this->errors[] = 'Invalid Reverb Left in '.$frame_name.' ('.$source_data_array['left'].') (range = 0 to 65535)';
- } elseif (!$this->IsWithinBitRange($source_data_array['right'], 16, false)) {
- $this->errors[] = 'Invalid Reverb Left in '.$frame_name.' ('.$source_data_array['right'].') (range = 0 to 65535)';
- } elseif (!$this->IsWithinBitRange($source_data_array['bouncesL'], 8, false)) {
- $this->errors[] = 'Invalid Reverb Bounces, Left in '.$frame_name.' ('.$source_data_array['bouncesL'].') (range = 0 to 255)';
- } elseif (!$this->IsWithinBitRange($source_data_array['bouncesR'], 8, false)) {
- $this->errors[] = 'Invalid Reverb Bounces, Right in '.$frame_name.' ('.$source_data_array['bouncesR'].') (range = 0 to 255)';
- } elseif (!$this->IsWithinBitRange($source_data_array['feedbackLL'], 8, false)) {
- $this->errors[] = 'Invalid Reverb Feedback, Left-To-Left in '.$frame_name.' ('.$source_data_array['feedbackLL'].') (range = 0 to 255)';
- } elseif (!$this->IsWithinBitRange($source_data_array['feedbackLR'], 8, false)) {
- $this->errors[] = 'Invalid Reverb Feedback, Left-To-Right in '.$frame_name.' ('.$source_data_array['feedbackLR'].') (range = 0 to 255)';
- } elseif (!$this->IsWithinBitRange($source_data_array['feedbackRR'], 8, false)) {
- $this->errors[] = 'Invalid Reverb Feedback, Right-To-Right in '.$frame_name.' ('.$source_data_array['feedbackRR'].') (range = 0 to 255)';
- } elseif (!$this->IsWithinBitRange($source_data_array['feedbackRL'], 8, false)) {
- $this->errors[] = 'Invalid Reverb Feedback, Right-To-Left in '.$frame_name.' ('.$source_data_array['feedbackRL'].') (range = 0 to 255)';
- } elseif (!$this->IsWithinBitRange($source_data_array['premixLR'], 8, false)) {
- $this->errors[] = 'Invalid Premix, Left-To-Right in '.$frame_name.' ('.$source_data_array['premixLR'].') (range = 0 to 255)';
- } elseif (!$this->IsWithinBitRange($source_data_array['premixRL'], 8, false)) {
- $this->errors[] = 'Invalid Premix, Right-To-Left in '.$frame_name.' ('.$source_data_array['premixRL'].') (range = 0 to 255)';
- } else {
- $framedata .= getid3_lib::BigEndian2String($source_data_array['left'], 2, false);
- $framedata .= getid3_lib::BigEndian2String($source_data_array['right'], 2, false);
- $framedata .= chr($source_data_array['bouncesL']);
- $framedata .= chr($source_data_array['bouncesR']);
- $framedata .= chr($source_data_array['feedbackLL']);
- $framedata .= chr($source_data_array['feedbackLR']);
- $framedata .= chr($source_data_array['feedbackRR']);
- $framedata .= chr($source_data_array['feedbackRL']);
- $framedata .= chr($source_data_array['premixLR']);
- $framedata .= chr($source_data_array['premixRL']);
- }
- break;
-
- case 'APIC':
- // 4.14 APIC Attached picture
- // Text encoding $xx
- // MIME type <text string> $00
- // Picture type $xx
- // Description <text string according to encoding> $00 (00)
- // Picture data <binary data>
- $source_data_array['encodingid'] = (isset($source_data_array['encodingid']) ? $source_data_array['encodingid'] : $this->id3v2_default_encodingid);
- if (!$this->ID3v2IsValidTextEncoding($source_data_array['encodingid'])) {
- $this->errors[] = 'Invalid Text Encoding in '.$frame_name.' ('.$source_data_array['encodingid'].') for ID3v2.'.$this->majorversion;
- } elseif (!$this->ID3v2IsValidAPICpicturetype($source_data_array['picturetypeid'])) {
- $this->errors[] = 'Invalid Picture Type byte in '.$frame_name.' ('.$source_data_array['picturetypeid'].') for ID3v2.'.$this->majorversion;
- } elseif (($this->majorversion >= 3) && (!$this->ID3v2IsValidAPICimageformat($source_data_array['mime']))) {
- $this->errors[] = 'Invalid MIME Type in '.$frame_name.' ('.$source_data_array['mime'].') for ID3v2.'.$this->majorversion;
- } elseif (($source_data_array['mime'] == '-->') && (!$this->IsValidURL($source_data_array['data'], false, false))) {
- //$this->errors[] = 'Invalid URL in '.$frame_name.' ('.$source_data_array['data'].')';
- // probably should be an error, need to rewrite IsValidURL() to handle other encodings
- $this->warnings[] = 'Invalid URL in '.$frame_name.' ('.$source_data_array['data'].')';
- } else {
- $framedata .= chr($source_data_array['encodingid']);
- $framedata .= str_replace("\x00", '', $source_data_array['mime'])."\x00";
- $framedata .= chr($source_data_array['picturetypeid']);
- $framedata .= (!empty($source_data_array['description']) ? $source_data_array['description'] : '').getid3_id3v2::TextEncodingTerminatorLookup($source_data_array['encodingid']);
- $framedata .= $source_data_array['data'];
- }
- break;
-
- case 'GEOB':
- // 4.15 GEOB General encapsulated object
- // Text encoding $xx
- // MIME type <text string> $00
- // Filename <text string according to encoding> $00 (00)
- // Content description <text string according to encoding> $00 (00)
- // Encapsulated object <binary data>
- $source_data_array['encodingid'] = (isset($source_data_array['encodingid']) ? $source_data_array['encodingid'] : $this->id3v2_default_encodingid);
- if (!$this->ID3v2IsValidTextEncoding($source_data_array['encodingid'])) {
- $this->errors[] = 'Invalid Text Encoding in '.$frame_name.' ('.$source_data_array['encodingid'].') for ID3v2.'.$this->majorversion;
- } elseif (!$this->IsValidMIMEstring($source_data_array['mime'])) {
- $this->errors[] = 'Invalid MIME Type in '.$frame_name.' ('.$source_data_array['mime'].')';
- } elseif (!$source_data_array['description']) {
- $this->errors[] = 'Missing Description in '.$frame_name;
- } else {
- $framedata .= chr($source_data_array['encodingid']);
- $framedata .= str_replace("\x00", '', $source_data_array['mime'])."\x00";
- $framedata .= $source_data_array['filename'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array['encodingid']);
- $framedata .= $source_data_array['description'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array['encodingid']);
- $framedata .= $source_data_array['data'];
- }
- break;
-
- case 'PCNT':
- // 4.16 PCNT Play counter
- // When the counter reaches all one's, one byte is inserted in
- // front of the counter thus making the counter eight bits bigger
- // Counter $xx xx xx xx (xx ...)
- $framedata .= getid3_lib::BigEndian2String($source_data_array['data'], 4, false);
- break;
-
- case 'POPM':
- // 4.17 POPM Popularimeter
- // When the counter reaches all one's, one byte is inserted in
- // front of the counter thus making the counter eight bits bigger
- // Email to user <text string> $00
- // Rating $xx
- // Counter $xx xx xx xx (xx ...)
- if (!$this->IsWithinBitRange($source_data_array['rating'], 8, false)) {
- $this->errors[] = 'Invalid Rating byte in '.$frame_name.' ('.$source_data_array['rating'].') (range = 0 to 255)';
- } elseif (!IsValidEmail($source_data_array['email'])) {
- $this->errors[] = 'Invalid Email in '.$frame_name.' ('.$source_data_array['email'].')';
- } else {
- $framedata .= str_replace("\x00", '', $source_data_array['email'])."\x00";
- $framedata .= chr($source_data_array['rating']);
- $framedata .= getid3_lib::BigEndian2String($source_data_array['data'], 4, false);
- }
- break;
-
- case 'RBUF':
- // 4.18 RBUF Recommended buffer size
- // Buffer size $xx xx xx
- // Embedded info flag %0000000x
- // Offset to next tag $xx xx xx xx
- if (!$this->IsWithinBitRange($source_data_array['buffersize'], 24, false)) {
- $this->errors[] = 'Invalid Buffer Size in '.$frame_name;
- } elseif (!$this->IsWithinBitRange($source_data_array['nexttagoffset'], 32, false)) {
- $this->errors[] = 'Invalid Offset To Next Tag in '.$frame_name;
- } else {
- $framedata .= getid3_lib::BigEndian2String($source_data_array['buffersize'], 3, false);
- $flag .= '0000000';
- $flag .= $source_data_array['flags']['embededinfo'] ? '1' : '0';
- $framedata .= chr(bindec($flag));
- $framedata .= getid3_lib::BigEndian2String($source_data_array['nexttagoffset'], 4, false);
- }
- break;
-
- case 'AENC':
- // 4.19 AENC Audio encryption
- // Owner identifier <text string> $00
- // Preview start $xx xx
- // Preview length $xx xx
- // Encryption info <binary data>
- if (!$this->IsWithinBitRange($source_data_array['previewstart'], 16, false)) {
- $this->errors[] = 'Invalid Preview Start in '.$frame_name.' ('.$source_data_array['previewstart'].')';
- } elseif (!$this->IsWithinBitRange($source_data_array['previewlength'], 16, false)) {
- $this->errors[] = 'Invalid Preview Length in '.$frame_name.' ('.$source_data_array['previewlength'].')';
- } else {
- $framedata .= str_replace("\x00", '', $source_data_array['ownerid'])."\x00";
- $framedata .= getid3_lib::BigEndian2String($source_data_array['previewstart'], 2, false);
- $framedata .= getid3_lib::BigEndian2String($source_data_array['previewlength'], 2, false);
- $framedata .= $source_data_array['encryptioninfo'];
- }
- break;
-
- case 'LINK':
- // 4.20 LINK Linked information
- // Frame identifier $xx xx xx xx
- // URL <text string> $00
- // ID and additional data <text string(s)>
- if (!getid3_id3v2::IsValidID3v2FrameName($source_data_array['frameid'], $this->majorversion)) {
- $this->errors[] = 'Invalid Frame Identifier in '.$frame_name.' ('.$source_data_array['frameid'].')';
- } elseif (!$this->IsValidURL($source_data_array['data'], true, false)) {
- //$this->errors[] = 'Invalid URL in '.$frame_name.' ('.$source_data_array['data'].')';
- // probably should be an error, need to rewrite IsValidURL() to handle other encodings
- $this->warnings[] = 'Invalid URL in '.$frame_name.' ('.$source_data_array['data'].')';
- } elseif ((($source_data_array['frameid'] == 'AENC') || ($source_data_array['frameid'] == 'APIC') || ($source_data_array['frameid'] == 'GEOB') || ($source_data_array['frameid'] == 'TXXX')) && ($source_data_array['additionaldata'] == '')) {
- $this->errors[] = 'Content Descriptor must be specified as additional data for Frame Identifier of '.$source_data_array['frameid'].' in '.$frame_name;
- } elseif (($source_data_array['frameid'] == 'USER') && (getid3_id3v2::LanguageLookup($source_data_array['additionaldata'], true) == '')) {
- $this->errors[] = 'Language must be specified as additional data for Frame Identifier of '.$source_data_array['frameid'].' in '.$frame_name;
- } elseif (($source_data_array['frameid'] == 'PRIV') && ($source_data_array['additionaldata'] == '')) {
- $this->errors[] = 'Owner Identifier must be specified as additional data for Frame Identifier of '.$source_data_array['frameid'].' in '.$frame_name;
- } elseif ((($source_data_array['frameid'] == 'COMM') || ($source_data_array['frameid'] == 'SYLT') || ($source_data_array['frameid'] == 'USLT')) && ((getid3_id3v2::LanguageLookup(substr($source_data_array['additionaldata'], 0, 3), true) == '') || (substr($source_data_array['additionaldata'], 3) == ''))) {
- $this->errors[] = 'Language followed by Content Descriptor must be specified as additional data for Frame Identifier of '.$source_data_array['frameid'].' in '.$frame_name;
- } else {
- $framedata .= $source_data_array['frameid'];
- $framedata .= str_replace("\x00", '', $source_data_array['data'])."\x00";
- switch ($source_data_array['frameid']) {
- case 'COMM':
- case 'SYLT':
- case 'USLT':
- case 'PRIV':
- case 'USER':
- case 'AENC':
- case 'APIC':
- case 'GEOB':
- case 'TXXX':
- $framedata .= $source_data_array['additionaldata'];
- break;
- case 'ASPI':
- case 'ETCO':
- case 'EQU2':
- case 'MCID':
- case 'MLLT':
- case 'OWNE':
- case 'RVA2':
- case 'RVRB':
- case 'SYTC':
- case 'IPLS':
- case 'RVAD':
- case 'EQUA':
- // no additional data required
- break;
- case 'RBUF':
- if ($this->majorversion == 3) {
- // no additional data required
- } else {
- $this->errors[] = $source_data_array['frameid'].' is not a valid Frame Identifier in '.$frame_name.' (in ID3v2.'.$this->majorversion.')';
- }
-
- default:
- if ((substr($source_data_array['frameid'], 0, 1) == 'T') || (substr($source_data_array['frameid'], 0, 1) == 'W')) {
- // no additional data required
- } else {
- $this->errors[] = $source_data_array['frameid'].' is not a valid Frame Identifier in '.$frame_name.' (in ID3v2.'.$this->majorversion.')';
- }
- break;
- }
- }
- break;
-
- case 'POSS':
- // 4.21 POSS Position synchronisation frame (ID3v2.3+ only)
- // Time stamp format $xx
- // Position $xx (xx ...)
- if (($source_data_array['timestampformat'] < 1) || ($source_data_array['timestampformat'] > 2)) {
- $this->errors[] = 'Invalid Time Stamp Format in '.$frame_name.' ('.$source_data_array['timestampformat'].') (valid = 1 or 2)';
- } elseif (!$this->IsWithinBitRange($source_data_array['position'], 32, false)) {
- $this->errors[] = 'Invalid Position in '.$frame_name.' ('.$source_data_array['position'].') (range = 0 to 4294967295)';
- } else {
- $framedata .= chr($source_data_array['timestampformat']);
- $framedata .= getid3_lib::BigEndian2String($source_data_array['position'], 4, false);
- }
- break;
-
- case 'USER':
- // 4.22 USER Terms of use (ID3v2.3+ only)
- // Text encoding $xx
- // Language $xx xx xx
- // The actual text <text string according to encoding>
- $source_data_array['encodingid'] = (isset($source_data_array['encodingid']) ? $source_data_array['encodingid'] : $this->id3v2_default_encodingid);
- if (!$this->ID3v2IsValidTextEncoding($source_data_array['encodingid'])) {
- $this->errors[] = 'Invalid Text Encoding in '.$frame_name.' ('.$source_data_array['encodingid'].')';
- } elseif (getid3_id3v2::LanguageLookup($source_data_array['language'], true) == '') {
- $this->errors[] = 'Invalid Language in '.$frame_name.' ('.$source_data_array['language'].')';
- } else {
- $framedata .= chr($source_data_array['encodingid']);
- $framedata .= strtolower($source_data_array['language']);
- $framedata .= $source_data_array['data'];
- }
- break;
-
- case 'OWNE':
- // 4.23 OWNE Ownership frame (ID3v2.3+ only)
- // Text encoding $xx
- // Price paid <text string> $00
- // Date of purch. <text string>
- // Seller <text string according to encoding>
- $source_data_array['encodingid'] = (isset($source_data_array['encodingid']) ? $source_data_array['encodingid'] : $this->id3v2_default_encodingid);
- if (!$this->ID3v2IsValidTextEncoding($source_data_array['encodingid'])) {
- $this->errors[] = 'Invalid Text Encoding in '.$frame_name.' ('.$source_data_array['encodingid'].')';
- } elseif (!$this->IsANumber($source_data_array['pricepaid']['value'], false)) {
- $this->errors[] = 'Invalid Price Paid in '.$frame_name.' ('.$source_data_array['pricepaid']['value'].')';
- } elseif (!$this->IsValidDateStampString($source_data_array['purchasedate'])) {
- $this->errors[] = 'Invalid Date Of Purchase in '.$frame_name.' ('.$source_data_array['purchasedate'].') (format = YYYYMMDD)';
- } else {
- $framedata .= chr($source_data_array['encodingid']);
- $framedata .= str_replace("\x00", '', $source_data_array['pricepaid']['value'])."\x00";
- $framedata .= $source_data_array['purchasedate'];
- $framedata .= $source_data_array['seller'];
- }
- break;
-
- case 'COMR':
- // 4.24 COMR Commercial frame (ID3v2.3+ only)
- // Text encoding $xx
- // Price string <text string> $00
- // Valid until <text string>
- // Contact URL <text string> $00
- // Received as $xx
- // Name of seller <text string according to encoding> $00 (00)
- // Description <text string according to encoding> $00 (00)
- // Picture MIME type <string> $00
- // Seller logo <binary data>
- $source_data_array['encodingid'] = (isset($source_data_array['encodingid']) ? $source_data_array['encodingid'] : $this->id3v2_default_encodingid);
- if (!$this->ID3v2IsValidTextEncoding($source_data_array['encodingid'])) {
- $this->errors[] = 'Invalid Text Encoding in '.$frame_name.' ('.$source_data_array['encodingid'].')';
- } elseif (!$this->IsValidDateStampString($source_data_array['pricevaliduntil'])) {
- $this->errors[] = 'Invalid Valid Until date in '.$frame_name.' ('.$source_data_array['pricevaliduntil'].') (format = YYYYMMDD)';
- } elseif (!$this->IsValidURL($source_data_array['contacturl'], false, true)) {
- $this->errors[] = 'Invalid Contact URL in '.$frame_name.' ('.$source_data_array['contacturl'].') (allowed schemes: http, https, ftp, mailto)';
- } elseif (!$this->ID3v2IsValidCOMRreceivedAs($source_data_array['receivedasid'])) {
- $this->errors[] = 'Invalid Received As byte in '.$frame_name.' ('.$source_data_array['contacturl'].') (range = 0 to 8)';
- } elseif (!$this->IsValidMIMEstring($source_data_array['mime'])) {
- $this->errors[] = 'Invalid MIME Type in '.$frame_name.' ('.$source_data_array['mime'].')';
- } else {
- $framedata .= chr($source_data_array['encodingid']);
- unset($pricestring);
- foreach ($source_data_array['price'] as $key => $val) {
- if ($this->ID3v2IsValidPriceString($key.$val['value'])) {
- $pricestrings[] = $key.$val['value'];
- } else {
- $this->errors[] = 'Invalid Price String in '.$frame_name.' ('.$key.$val['value'].')';
- }
- }
- $framedata .= implode('/', $pricestrings);
- $framedata .= $source_data_array['pricevaliduntil'];
- $framedata .= str_replace("\x00", '', $source_data_array['contacturl'])."\x00";
- $framedata .= chr($source_data_array['receivedasid']);
- $framedata .= $source_data_array['sellername'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array['encodingid']);
- $framedata .= $source_data_array['description'].getid3_id3v2::TextEncodingTerminatorLookup($source_data_array['encodingid']);
- $framedata .= $source_data_array['mime']."\x00";
- $framedata .= $source_data_array['logo'];
- }
- break;
-
- case 'ENCR':
- // 4.25 ENCR Encryption method registration (ID3v2.3+ only)
- // Owner identifier <text string> $00
- // Method symbol $xx
- // Encryption data <binary data>
- if (!$this->IsWithinBitRange($source_data_array['methodsymbol'], 8, false)) {
- $this->errors[] = 'Invalid Group Symbol in '.$frame_name.' ('.$source_data_array['methodsymbol'].') (range = 0 to 255)';
- } else {
- $framedata .= str_replace("\x00", '', $source_data_array['ownerid'])."\x00";
- $framedata .= ord($source_data_array['methodsymbol']);
- $framedata .= $source_data_array['data'];
- }
- break;
-
- case 'GRID':
- // 4.26 GRID Group identification registration (ID3v2.3+ only)
- // Owner identifier <text string> $00
- // Group symbol $xx
- // Group dependent data <binary data>
- if (!$this->IsWithinBitRange($source_data_array['groupsymbol'], 8, false)) {
- $this->errors[] = 'Invalid Group Symbol in '.$frame_name.' ('.$source_data_array['groupsymbol'].') (range = 0 to 255)';
- } else {
- $framedata .= str_replace("\x00", '', $source_data_array['ownerid'])."\x00";
- $framedata .= ord($source_data_array['groupsymbol']);
- $framedata .= $source_data_array['data'];
- }
- break;
-
- case 'PRIV':
- // 4.27 PRIV Private frame (ID3v2.3+ only)
- // Owner identifier <text string> $00
- // The private data <binary data>
- $framedata .= str_replace("\x00", '', $source_data_array['ownerid'])."\x00";
- $framedata .= $source_data_array['data'];
- break;
-
- case 'SIGN':
- // 4.28 SIGN Signature frame (ID3v2.4+ only)
- // Group symbol $xx
- // Signature <binary data>
- if (!$this->IsWithinBitRange($source_data_array['groupsymbol'], 8, false)) {
- $this->errors[] = 'Invalid Group Symbol in '.$frame_name.' ('.$source_data_array['groupsymbol'].') (range = 0 to 255)';
- } else {
- $framedata .= ord($source_data_array['groupsymbol']);
- $framedata .= $source_data_array['data'];
- }
- break;
-
- case 'SEEK':
- // 4.29 SEEK Seek frame (ID3v2.4+ only)
- // Minimum offset to next tag $xx xx xx xx
- if (!$this->IsWithinBitRange($source_data_array['data'], 32, false)) {
- $this->errors[] = 'Invalid Minimum Offset in '.$frame_name.' ('.$source_data_array['data'].') (range = 0 to 4294967295)';
- } else {
- $framedata .= getid3_lib::BigEndian2String($source_data_array['data'], 4, false);
- }
- break;
-
- case 'ASPI':
- // 4.30 ASPI Audio seek point index (ID3v2.4+ only)
- // Indexed data start (S) $xx xx xx xx
- // Indexed data length (L) $xx xx xx xx
- // Number of index points (N) $xx xx
- // Bits per index point (b) $xx
- // Then for every index point the following data is included:
- // Fraction at index (Fi) $xx (xx)
- if (!$this->IsWithinBitRange($source_data_array['datastart'], 32, false)) {
- $this->errors[] = 'Invalid Indexed Data Start in '.$frame_name.' ('.$source_data_array['datastart'].') (range = 0 to 4294967295)';
- } elseif (!$this->IsWithinBitRange($source_data_array['datalength'], 32, false)) {
- $this->errors[] = 'Invalid Indexed Data Length in '.$frame_name.' ('.$source_data_array['datalength'].') (range = 0 to 4294967295)';
- } elseif (!$this->IsWithinBitRange($source_data_array['indexpoints'], 16, false)) {
- $this->errors[] = 'Invalid Number Of Index Points in '.$frame_name.' ('.$source_data_array['indexpoints'].') (range = 0 to 65535)';
- } elseif (!$this->IsWithinBitRange($source_data_array['bitsperpoint'], 8, false)) {
- $this->errors[] = 'Invalid Bits Per Index Point in '.$frame_name.' ('.$source_data_array['bitsperpoint'].') (range = 0 to 255)';
- } elseif ($source_data_array['indexpoints'] != count($source_data_array['indexes'])) {
- $this->errors[] = 'Number Of Index Points does not match actual supplied data in '.$frame_name;
- } else {
- $framedata .= getid3_lib::BigEndian2String($source_data_array['datastart'], 4, false);
- $framedata .= getid3_lib::BigEndian2String($source_data_array['datalength'], 4, false);
- $framedata .= getid3_lib::BigEndian2String($source_data_array['indexpoints'], 2, false);
- $framedata .= getid3_lib::BigEndian2String($source_data_array['bitsperpoint'], 1, false);
- foreach ($source_data_array['indexes'] as $key => $val) {
- $framedata .= getid3_lib::BigEndian2String($val, ceil($source_data_array['bitsperpoint'] / 8), false);
- }
- }
- break;
-
- case 'RGAD':
- // RGAD Replay Gain Adjustment
- // http://privatewww.essex.ac.uk/~djmrob/replaygain/
- // Peak Amplitude $xx $xx $xx $xx
- // Radio Replay Gain Adjustment %aaabbbcd %dddddddd
- // Audiophile Replay Gain Adjustment %aaabbbcd %dddddddd
- // a - name code
- // b - originator code
- // c - sign bit
- // d - replay gain adjustment
-
- if (($source_data_array['track_adjustment'] > 51) || ($source_data_array['track_adjustment'] < -51)) {
- $this->errors[] = 'Invalid Track Adjustment in '.$frame_name.' ('.$source_data_array['track_adjustment'].') (range = -51.0 to +51.0)';
- } elseif (($source_data_array['album_adjustment'] > 51) || ($source_data_array['album_adjustment'] < -51)) {
- $this->errors[] = 'Invalid Album Adjustment in '.$frame_name.' ('.$source_data_array['album_adjustment'].') (range = -51.0 to +51.0)';
- } elseif (!$this->ID3v2IsValidRGADname($source_data_array['raw']['track_name'])) {
- $this->errors[] = 'Invalid Track Name Code in '.$frame_name.' ('.$source_data_array['raw']['track_name'].') (range = 0 to 2)';
- } elseif (!$this->ID3v2IsValidRGADname($source_data_array['raw']['album_name'])) {
- $this->errors[] = 'Invalid Album Name Code in '.$frame_name.' ('.$source_data_array['raw']['album_name'].') (range = 0 to 2)';
- } elseif (!$this->ID3v2IsValidRGADoriginator($source_data_array['raw']['track_originator'])) {
- $this->errors[] = 'Invalid Track Originator Code in '.$frame_name.' ('.$source_data_array['raw']['track_originator'].') (range = 0 to 3)';
- } elseif (!$this->ID3v2IsValidRGADoriginator($source_data_array['raw']['album_originator'])) {
- $this->errors[] = 'Invalid Album Originator Code in '.$frame_name.' ('.$source_data_array['raw']['album_originator'].') (range = 0 to 3)';
- } else {
- $framedata .= getid3_lib::Float2String($source_data_array['peakamplitude'], 32);
- $framedata .= getid3_lib::RGADgainString($source_data_array['raw']['track_name'], $source_data_array['raw']['track_originator'], $source_data_array['track_adjustment']);
- $framedata .= getid3_lib::RGADgainString($source_data_array['raw']['album_name'], $source_data_array['raw']['album_originator'], $source_data_array['album_adjustment']);
- }
- break;
-
- default:
- if ((($this->majorversion == 2) && (strlen($frame_name) != 3)) || (($this->majorversion > 2) && (strlen($frame_name) != 4))) {
- $this->errors[] = 'Invalid frame name "'.$frame_name.'" for ID3v2.'.$this->majorversion;
- } elseif ($frame_name{0} == 'T') {
- // 4.2. T??? Text information frames
- // Text encoding $xx
- // Information <text string(s) according to encoding>
- $source_data_array['encodingid'] = (isset($source_data_array['encodingid']) ? $source_data_array['encodingid'] : $this->id3v2_default_encodingid);
- if (!$this->ID3v2IsValidTextEncoding($source_data_array['encodingid'])) {
- $this->errors[] = 'Invalid Text Encoding in '.$frame_name.' ('.$source_data_array['encodingid'].') for ID3v2.'.$this->majorversion;
- } else {
- $framedata .= chr($source_data_array['encodingid']);
- $framedata .= $source_data_array['data'];
- }
- } elseif ($frame_name{0} == 'W') {
- // 4.3. W??? URL link frames
- // URL <text string>
- if (!$this->IsValidURL($source_data_array['data'], false, false)) {
- //$this->errors[] = 'Invalid URL in '.$frame_name.' ('.$source_data_array['data'].')';
- // probably should be an error, need to rewrite IsValidURL() to handle other encodings
- $this->warnings[] = 'Invalid URL in '.$frame_name.' ('.$source_data_array['data'].')';
- } else {
- $framedata .= $source_data_array['data'];
- }
- } else {
- $this->errors[] = $frame_name.' not yet supported in $this->GenerateID3v2FrameData()';
- }
- break;
- }
- }
- if (!empty($this->errors)) {
- return false;
- }
- return $framedata;
- }
-
- function ID3v2FrameIsAllowed($frame_name, $source_data_array) {
- static $PreviousFrames = array();
-
- if ($frame_name === null) {
- // if the writing functions are called multiple times, the static array needs to be
- // cleared - this can be done by calling $this->ID3v2FrameIsAllowed(null, '')
- $PreviousFrames = array();
- return true;
- }
-
- if ($this->majorversion == 4) {
- switch ($frame_name) {
- case 'UFID':
- case 'AENC':
- case 'ENCR':
- case 'GRID':
- if (!isset($source_data_array['ownerid'])) {
- $this->errors[] = '[ownerid] not specified for '.$frame_name;
- } elseif (in_array($frame_name.$source_data_array['ownerid'], $PreviousFrames)) {
- $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same OwnerID ('.$source_data_array['ownerid'].')';
- } else {
- $PreviousFrames[] = $frame_name.$source_data_array['ownerid'];
- }
- break;
-
- case 'TXXX':
- case 'WXXX':
- case 'RVA2':
- case 'EQU2':
- case 'APIC':
- case 'GEOB':
- if (!isset($source_data_array['description'])) {
- $this->errors[] = '[description] not specified for '.$frame_name;
- } elseif (in_array($frame_name.$source_data_array['description'], $PreviousFrames)) {
- $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same Description ('.$source_data_array['description'].')';
- } else {
- $PreviousFrames[] = $frame_name.$source_data_array['description'];
- }
- break;
-
- case 'USER':
- if (!isset($source_data_array['language'])) {
- $this->errors[] = '[language] not specified for '.$frame_name;
- } elseif (in_array($frame_name.$source_data_array['language'], $PreviousFrames)) {
- $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same Language ('.$source_data_array['language'].')';
- } else {
- $PreviousFrames[] = $frame_name.$source_data_array['language'];
- }
- break;
-
- case 'USLT':
- case 'SYLT':
- case 'COMM':
- if (!isset($source_data_array['language'])) {
- $this->errors[] = '[language] not specified for '.$frame_name;
- } elseif (!isset($source_data_array['description'])) {
- $this->errors[] = '[description] not specified for '.$frame_name;
- } elseif (in_array($frame_name.$source_data_array['language'].$source_data_array['description'], $PreviousFrames)) {
- $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same Language + Description ('.$source_data_array['language'].' + '.$source_data_array['description'].')';
- } else {
- $PreviousFrames[] = $frame_name.$source_data_array['language'].$source_data_array['description'];
- }
- break;
-
- case 'POPM':
- if (!isset($source_data_array['email'])) {
- $this->errors[] = '[email] not specified for '.$frame_name;
- } elseif (in_array($frame_name.$source_data_array['email'], $PreviousFrames)) {
- $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same Email ('.$source_data_array['email'].')';
- } else {
- $PreviousFrames[] = $frame_name.$source_data_array['email'];
- }
- break;
-
- case 'IPLS':
- case 'MCDI':
- case 'ETCO':
- case 'MLLT':
- case 'SYTC':
- case 'RVRB':
- case 'PCNT':
- case 'RBUF':
- case 'POSS':
- case 'OWNE':
- case 'SEEK':
- case 'ASPI':
- case 'RGAD':
- if (in_array($frame_name, $PreviousFrames)) {
- $this->errors[] = 'Only one '.$frame_name.' tag allowed';
- } else {
- $PreviousFrames[] = $frame_name;
- }
- break;
-
- case 'LINK':
- // this isn't implemented quite right (yet) - it should check the target frame data for compliance
- // but right now it just allows one linked frame of each type, to be safe.
- if (!isset($source_data_array['frameid'])) {
- $this->errors[] = '[frameid] not specified for '.$frame_name;
- } elseif (in_array($frame_name.$source_data_array['frameid'], $PreviousFrames)) {
- $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same FrameID ('.$source_data_array['frameid'].')';
- } elseif (in_array($source_data_array['frameid'], $PreviousFrames)) {
- // no links to singleton tags
- $this->errors[] = 'Cannot specify a '.$frame_name.' tag to a singleton tag that already exists ('.$source_data_array['frameid'].')';
- } else {
- $PreviousFrames[] = $frame_name.$source_data_array['frameid']; // only one linked tag of this type
- $PreviousFrames[] = $source_data_array['frameid']; // no non-linked singleton tags of this type
- }
- break;
-
- case 'COMR':
- // There may be more than one 'commercial frame' in a tag, but no two may be identical
- // Checking isn't implemented at all (yet) - just assumes that it's OK.
- break;
-
- case 'PRIV':
- case 'SIGN':
- if (!isset($source_data_array['ownerid'])) {
- $this->errors[] = '[ownerid] not specified for '.$frame_name;
- } elseif (!isset($source_data_array['data'])) {
- $this->errors[] = '[data] not specified for '.$frame_name;
- } elseif (in_array($frame_name.$source_data_array['ownerid'].$source_data_array['data'], $PreviousFrames)) {
- $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same OwnerID + Data ('.$source_data_array['ownerid'].' + '.$source_data_array['data'].')';
- } else {
- $PreviousFrames[] = $frame_name.$source_data_array['ownerid'].$source_data_array['data'];
- }
- break;
-
- default:
- if (($frame_name{0} != 'T') && ($frame_name{0} != 'W')) {
- $this->errors[] = 'Frame not allowed in ID3v2.'.$this->majorversion.': '.$frame_name;
- }
- break;
- }
-
- } elseif ($this->majorversion == 3) {
-
- switch ($frame_name) {
- case 'UFID':
- case 'AENC':
- case 'ENCR':
- case 'GRID':
- if (!isset($source_data_array['ownerid'])) {
- $this->errors[] = '[ownerid] not specified for '.$frame_name;
- } elseif (in_array($frame_name.$source_data_array['ownerid'], $PreviousFrames)) {
- $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same OwnerID ('.$source_data_array['ownerid'].')';
- } else {
- $PreviousFrames[] = $frame_name.$source_data_array['ownerid'];
- }
- break;
-
- case 'TXXX':
- case 'WXXX':
- case 'APIC':
- case 'GEOB':
- if (!isset($source_data_array['description'])) {
- $this->errors[] = '[description] not specified for '.$frame_name;
- } elseif (in_array($frame_name.$source_data_array['description'], $PreviousFrames)) {
- $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same Description ('.$source_data_array['description'].')';
- } else {
- $PreviousFrames[] = $frame_name.$source_data_array['description'];
- }
- break;
-
- case 'USER':
- if (!isset($source_data_array['language'])) {
- $this->errors[] = '[language] not specified for '.$frame_name;
- } elseif (in_array($frame_name.$source_data_array['language'], $PreviousFrames)) {
- $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same Language ('.$source_data_array['language'].')';
- } else {
- $PreviousFrames[] = $frame_name.$source_data_array['language'];
- }
- break;
-
- case 'USLT':
- case 'SYLT':
- case 'COMM':
- if (!isset($source_data_array['language'])) {
- $this->errors[] = '[language] not specified for '.$frame_name;
- } elseif (!isset($source_data_array['description'])) {
- $this->errors[] = '[description] not specified for '.$frame_name;
- } elseif (in_array($frame_name.$source_data_array['language'].$source_data_array['description'], $PreviousFrames)) {
- $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same Language + Description ('.$source_data_array['language'].' + '.$source_data_array['description'].')';
- } else {
- $PreviousFrames[] = $frame_name.$source_data_array['language'].$source_data_array['description'];
- }
- break;
-
- case 'POPM':
- if (!isset($source_data_array['email'])) {
- $this->errors[] = '[email] not specified for '.$frame_name;
- } elseif (in_array($frame_name.$source_data_array['email'], $PreviousFrames)) {
- $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same Email ('.$source_data_array['email'].')';
- } else {
- $PreviousFrames[] = $frame_name.$source_data_array['email'];
- }
- break;
-
- case 'IPLS':
- case 'MCDI':
- case 'ETCO':
- case 'MLLT':
- case 'SYTC':
- case 'RVAD':
- case 'EQUA':
- case 'RVRB':
- case 'PCNT':
- case 'RBUF':
- case 'POSS':
- case 'OWNE':
- case 'RGAD':
- if (in_array($frame_name, $PreviousFrames)) {
- $this->errors[] = 'Only one '.$frame_name.' tag allowed';
- } else {
- $PreviousFrames[] = $frame_name;
- }
- break;
-
- case 'LINK':
- // this isn't implemented quite right (yet) - it should check the target frame data for compliance
- // but right now it just allows one linked frame of each type, to be safe.
- if (!isset($source_data_array['frameid'])) {
- $this->errors[] = '[frameid] not specified for '.$frame_name;
- } elseif (in_array($frame_name.$source_data_array['frameid'], $PreviousFrames)) {
- $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same FrameID ('.$source_data_array['frameid'].')';
- } elseif (in_array($source_data_array['frameid'], $PreviousFrames)) {
- // no links to singleton tags
- $this->errors[] = 'Cannot specify a '.$frame_name.' tag to a singleton tag that already exists ('.$source_data_array['frameid'].')';
- } else {
- $PreviousFrames[] = $frame_name.$source_data_array['frameid']; // only one linked tag of this type
- $PreviousFrames[] = $source_data_array['frameid']; // no non-linked singleton tags of this type
- }
- break;
-
- case 'COMR':
- // There may be more than one 'commercial frame' in a tag, but no two may be identical
- // Checking isn't implemented at all (yet) - just assumes that it's OK.
- break;
-
- case 'PRIV':
- if (!isset($source_data_array['ownerid'])) {
- $this->errors[] = '[ownerid] not specified for '.$frame_name;
- } elseif (!isset($source_data_array['data'])) {
- $this->errors[] = '[data] not specified for '.$frame_name;
- } elseif (in_array($frame_name.$source_data_array['ownerid'].$source_data_array['data'], $PreviousFrames)) {
- $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same OwnerID + Data ('.$source_data_array['ownerid'].' + '.$source_data_array['data'].')';
- } else {
- $PreviousFrames[] = $frame_name.$source_data_array['ownerid'].$source_data_array['data'];
- }
- break;
-
- default:
- if (($frame_name{0} != 'T') && ($frame_name{0} != 'W')) {
- $this->errors[] = 'Frame not allowed in ID3v2.'.$this->majorversion.': '.$frame_name;
- }
- break;
- }
-
- } elseif ($this->majorversion == 2) {
-
- switch ($frame_name) {
- case 'UFI':
- case 'CRM':
- case 'CRA':
- if (!isset($source_data_array['ownerid'])) {
- $this->errors[] = '[ownerid] not specified for '.$frame_name;
- } elseif (in_array($frame_name.$source_data_array['ownerid'], $PreviousFrames)) {
- $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same OwnerID ('.$source_data_array['ownerid'].')';
- } else {
- $PreviousFrames[] = $frame_name.$source_data_array['ownerid'];
- }
- break;
-
- case 'TXX':
- case 'WXX':
- case 'PIC':
- case 'GEO':
- if (!isset($source_data_array['description'])) {
- $this->errors[] = '[description] not specified for '.$frame_name;
- } elseif (in_array($frame_name.$source_data_array['description'], $PreviousFrames)) {
- $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same Description ('.$source_data_array['description'].')';
- } else {
- $PreviousFrames[] = $frame_name.$source_data_array['description'];
- }
- break;
-
- case 'ULT':
- case 'SLT':
- case 'COM':
- if (!isset($source_data_array['language'])) {
- $this->errors[] = '[language] not specified for '.$frame_name;
- } elseif (!isset($source_data_array['description'])) {
- $this->errors[] = '[description] not specified for '.$frame_name;
- } elseif (in_array($frame_name.$source_data_array['language'].$source_data_array['description'], $PreviousFrames)) {
- $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same Language + Description ('.$source_data_array['language'].' + '.$source_data_array['description'].')';
- } else {
- $PreviousFrames[] = $frame_name.$source_data_array['language'].$source_data_array['description'];
- }
- break;
-
- case 'POP':
- if (!isset($source_data_array['email'])) {
- $this->errors[] = '[email] not specified for '.$frame_name;
- } elseif (in_array($frame_name.$source_data_array['email'], $PreviousFrames)) {
- $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same Email ('.$source_data_array['email'].')';
- } else {
- $PreviousFrames[] = $frame_name.$source_data_array['email'];
- }
- break;
-
- case 'IPL':
- case 'MCI':
- case 'ETC':
- case 'MLL':
- case 'STC':
- case 'RVA':
- case 'EQU':
- case 'REV':
- case 'CNT':
- case 'BUF':
- if (in_array($frame_name, $PreviousFrames)) {
- $this->errors[] = 'Only one '.$frame_name.' tag allowed';
- } else {
- $PreviousFrames[] = $frame_name;
- }
- break;
-
- case 'LNK':
- // this isn't implemented quite right (yet) - it should check the target frame data for compliance
- // but right now it just allows one linked frame of each type, to be safe.
- if (!isset($source_data_array['frameid'])) {
- $this->errors[] = '[frameid] not specified for '.$frame_name;
- } elseif (in_array($frame_name.$source_data_array['frameid'], $PreviousFrames)) {
- $this->errors[] = 'Only one '.$frame_name.' tag allowed with the same FrameID ('.$source_data_array['frameid'].')';
- } elseif (in_array($source_data_array['frameid'], $PreviousFrames)) {
- // no links to singleton tags
- $this->errors[] = 'Cannot specify a '.$frame_name.' tag to a singleton tag that already exists ('.$source_data_array['frameid'].')';
- } else {
- $PreviousFrames[] = $frame_name.$source_data_array['frameid']; // only one linked tag of this type
- $PreviousFrames[] = $source_data_array['frameid']; // no non-linked singleton tags of this type
- }
- break;
-
- default:
- if (($frame_name{0} != 'T') && ($frame_name{0} != 'W')) {
- $this->errors[] = 'Frame not allowed in ID3v2.'.$this->majorversion.': '.$frame_name;
- }
- break;
- }
- }
-
- if (!empty($this->errors)) {
- return false;
- }
- return true;
- }
-
- function GenerateID3v2Tag($noerrorsonly=true) {
- $this->ID3v2FrameIsAllowed(null, ''); // clear static array in case this isn't the first call to $this->GenerateID3v2Tag()
-
- $tagstring = '';
- if (is_array($this->tag_data)) {
- foreach ($this->tag_data as $frame_name => $frame_rawinputdata) {
- foreach ($frame_rawinputdata as $irrelevantindex => $source_data_array) {
- if (getid3_id3v2::IsValidID3v2FrameName($frame_name, $this->majorversion)) {
- unset($frame_length);
- unset($frame_flags);
- $frame_data = false;
- if ($this->ID3v2FrameIsAllowed($frame_name, $source_data_array)) {
- if ($frame_data = $this->GenerateID3v2FrameData($frame_name, $source_data_array)) {
- $FrameUnsynchronisation = false;
- if ($this->majorversion >= 4) {
- // frame-level unsynchronisation
- $unsynchdata = $frame_data;
- if ($this->id3v2_use_unsynchronisation) {
- $unsynchdata = $this->Unsynchronise($frame_data);
- }
- if (strlen($unsynchdata) != strlen($frame_data)) {
- // unsynchronisation needed
- $FrameUnsynchronisation = true;
- $frame_data = $unsynchdata;
- if (isset($TagUnsynchronisation) && $TagUnsynchronisation === false) {
- // only set to true if ALL frames are unsynchronised
- } else {
- $TagUnsynchronisation = true;
- }
- } else {
- if (isset($TagUnsynchronisation)) {
- $TagUnsynchronisation = false;
- }
- }
- unset($unsynchdata);
-
- $frame_length = getid3_lib::BigEndian2String(strlen($frame_data), 4, true);
- } else {
- $frame_length = getid3_lib::BigEndian2String(strlen($frame_data), 4, false);
- }
- $frame_flags = $this->GenerateID3v2FrameFlags($this->ID3v2FrameFlagsLookupTagAlter($frame_name), $this->ID3v2FrameFlagsLookupFileAlter($frame_name), false, false, false, false, $FrameUnsynchronisation, false);
- }
- } else {
- $this->errors[] = 'Frame "'.$frame_name.'" is NOT allowed';
- }
- if ($frame_data === false) {
- $this->errors[] = '$this->GenerateID3v2FrameData() failed for "'.$frame_name.'"';
- if ($noerrorsonly) {
- return false;
- } else {
- unset($frame_name);
- }
- }
- } else {
- // ignore any invalid frame names, including 'title', 'header', etc
- $this->warnings[] = 'Ignoring invalid ID3v2 frame type: "'.$frame_name.'"';
- unset($frame_name);
- unset($frame_length);
- unset($frame_flags);
- unset($frame_data);
- }
- if (isset($frame_name) && isset($frame_length) && isset($frame_flags) && isset($frame_data)) {
- $tagstring .= $frame_name.$frame_length.$frame_flags.$frame_data;
- }
- }
- }
-
- if (!isset($TagUnsynchronisation)) {
- $TagUnsynchronisation = false;
- }
- if (($this->majorversion <= 3) && $this->id3v2_use_unsynchronisation) {
- // tag-level unsynchronisation
- $unsynchdata = $this->Unsynchronise($tagstring);
- if (strlen($unsynchdata) != strlen($tagstring)) {
- // unsynchronisation needed
- $TagUnsynchronisation = true;
- $tagstring = $unsynchdata;
- }
- }
-
- while ($this->paddedlength < (strlen($tagstring) + getid3_id3v2::ID3v2HeaderLength($this->majorversion))) {
- $this->paddedlength += 1024;
- }
-
- $footer = false; // ID3v2 footers not yet supported in getID3()
- if (!$footer && ($this->paddedlength > (strlen($tagstring) + getid3_id3v2::ID3v2HeaderLength($this->majorversion)))) {
- // pad up to $paddedlength bytes if unpadded tag is shorter than $paddedlength
- // "Furthermore it MUST NOT have any padding when a tag footer is added to the tag."
- if (($this->paddedlength - strlen($tagstring) - getid3_id3v2::ID3v2HeaderLength($this->majorversion)) > 0) {
- $tagstring .= str_repeat("\x00", $this->paddedlength - strlen($tagstring) - getid3_id3v2::ID3v2HeaderLength($this->majorversion));
- }
- }
- if ($this->id3v2_use_unsynchronisation && (substr($tagstring, strlen($tagstring) - 1, 1) == "\xFF")) {
- // special unsynchronisation case:
- // if last byte == $FF then appended a $00
- $TagUnsynchronisation = true;
- $tagstring .= "\x00";
- }
-
- $tagheader = 'ID3';
- $tagheader .= chr($this->majorversion);
- $tagheader .= chr($this->minorversion);
- $tagheader .= $this->GenerateID3v2TagFlags(array('unsynchronisation'=>$TagUnsynchronisation));
- $tagheader .= getid3_lib::BigEndian2String(strlen($tagstring), 4, true);
-
- return $tagheader.$tagstring;
- }
- $this->errors[] = 'tag_data is not an array in GenerateID3v2Tag()';
- return false;
- }
-
- function ID3v2IsValidPriceString($pricestring) {
- if (getid3_id3v2::LanguageLookup(substr($pricestring, 0, 3), true) == '') {
- return false;
- } elseif (!$this->IsANumber(substr($pricestring, 3), true)) {
- return false;
- }
- return true;
- }
-
- function ID3v2FrameFlagsLookupTagAlter($framename) {
- // unfinished
- switch ($framename) {
- case 'RGAD':
- $allow = true;
- default:
- $allow = false;
- break;
- }
- return $allow;
- }
-
- function ID3v2FrameFlagsLookupFileAlter($framename) {
- // unfinished
- switch ($framename) {
- case 'RGAD':
- return false;
- break;
-
- default:
- return false;
- break;
- }
- }
-
- function ID3v2IsValidETCOevent($eventid) {
- if (($eventid < 0) || ($eventid > 0xFF)) {
- // outside range of 1 byte
- return false;
- } elseif (($eventid >= 0xF0) && ($eventid <= 0xFC)) {
- // reserved for future use
- return false;
- } elseif (($eventid >= 0x17) && ($eventid <= 0xDF)) {
- // reserved for future use
- return false;
- } elseif (($eventid >= 0x0E) && ($eventid <= 0x16) && ($this->majorversion == 2)) {
- // not defined in ID3v2.2
- return false;
- } elseif (($eventid >= 0x15) && ($eventid <= 0x16) && ($this->majorversion == 3)) {
- // not defined in ID3v2.3
- return false;
- }
- return true;
- }
-
- function ID3v2IsValidSYLTtype($contenttype) {
- if (($contenttype >= 0) && ($contenttype <= 8) && ($this->majorversion == 4)) {
- return true;
- } elseif (($contenttype >= 0) && ($contenttype <= 6) && ($this->majorversion == 3)) {
- return true;
- }
- return false;
- }
-
- function ID3v2IsValidRVA2channeltype($channeltype) {
- if (($channeltype >= 0) && ($channeltype <= 8) && ($this->majorversion == 4)) {
- return true;
- }
- return false;
- }
-
- function ID3v2IsValidAPICpicturetype($picturetype) {
- if (($picturetype >= 0) && ($picturetype <= 0x14) && ($this->majorversion >= 2) && ($this->majorversion <= 4)) {
- return true;
- }
- return false;
- }
-
- function ID3v2IsValidAPICimageformat($imageformat) {
- if ($imageformat == '-->') {
- return true;
- } elseif ($this->majorversion == 2) {
- if ((strlen($imageformat) == 3) && ($imageformat == strtoupper($imageformat))) {
- return true;
- }
- } elseif (($this->majorversion == 3) || ($this->majorversion == 4)) {
- if ($this->IsValidMIMEstring($imageformat)) {
- return true;
- }
- }
- return false;
- }
-
- function ID3v2IsValidCOMRreceivedAs($receivedas) {
- if (($this->majorversion >= 3) && ($receivedas >= 0) && ($receivedas <= 8)) {
- return true;
- }
- return false;
- }
-
- function ID3v2IsValidRGADname($RGADname) {
- if (($RGADname >= 0) && ($RGADname <= 2)) {
- return true;
- }
- return false;
- }
-
- function ID3v2IsValidRGADoriginator($RGADoriginator) {
- if (($RGADoriginator >= 0) && ($RGADoriginator <= 3)) {
- return true;
- }
- return false;
- }
-
- function ID3v2IsValidTextEncoding($textencodingbyte) {
- static $ID3v2IsValidTextEncoding_cache = array(
- 2 => array(true, true),
- 3 => array(true, true),
- 4 => array(true, true, true, true));
- return isset($ID3v2IsValidTextEncoding_cache[$this->majorversion][$textencodingbyte]);
- }
-
- function Unsynchronise($data) {
- // Whenever a false synchronisation is found within the tag, one zeroed
- // byte is inserted after the first false synchronisation byte. The
- // format of a correct sync that should be altered by ID3 encoders is as
- // follows:
- // %11111111 111xxxxx
- // And should be replaced with:
- // %11111111 00000000 111xxxxx
- // This has the side effect that all $FF 00 combinations have to be
- // altered, so they won't be affected by the decoding process. Therefore
- // all the $FF 00 combinations have to be replaced with the $FF 00 00
- // combination during the unsynchronisation.
-
- $data = str_replace("\xFF\x00", "\xFF\x00\x00", $data);
- $unsyncheddata = '';
- $datalength = strlen($data);
- for ($i = 0; $i < $datalength; $i++) {
- $thischar = $data{$i};
- $unsyncheddata .= $thischar;
- if ($thischar == "\xFF") {
- $nextchar = ord($data{$i + 1});
- if (($nextchar & 0xE0) == 0xE0) {
- // previous byte = 11111111, this byte = 111?????
- $unsyncheddata .= "\x00";
- }
- }
- }
- return $unsyncheddata;
- }
-
- function is_hash($var) {
- // written by dev-nullchristophe*vg
- // taken from http://www.php.net/manual/en/function.array-merge-recursive.php
- if (is_array($var)) {
- $keys = array_keys($var);
- $all_num = true;
- for ($i = 0; $i < count($keys); $i++) {
- if (is_string($keys[$i])) {
- return true;
- }
- }
- }
- return false;
- }
-
- function array_join_merge($arr1, $arr2) {
- // written by dev-nullchristophe*vg
- // taken from http://www.php.net/manual/en/function.array-merge-recursive.php
- if (is_array($arr1) && is_array($arr2)) {
- // the same -> merge
- $new_array = array();
-
- if ($this->is_hash($arr1) && $this->is_hash($arr2)) {
- // hashes -> merge based on keys
- $keys = array_merge(array_keys($arr1), array_keys($arr2));
- foreach ($keys as $key) {
- $new_array[$key] = $this->array_join_merge((isset($arr1[$key]) ? $arr1[$key] : ''), (isset($arr2[$key]) ? $arr2[$key] : ''));
- }
- } else {
- // two real arrays -> merge
- $new_array = array_reverse(array_unique(array_reverse(array_merge($arr1, $arr2))));
- }
- return $new_array;
- } else {
- // not the same ... take new one if defined, else the old one stays
- return $arr2 ? $arr2 : $arr1;
- }
- }
-
- function IsValidMIMEstring($mimestring) {
- if ((strlen($mimestring) >= 3) && (strpos($mimestring, '/') > 0) && (strpos($mimestring, '/') < (strlen($mimestring) - 1))) {
- return true;
- }
- return false;
- }
-
- function IsWithinBitRange($number, $maxbits, $signed=false) {
- if ($signed) {
- if (($number > (0 - pow(2, $maxbits - 1))) && ($number <= pow(2, $maxbits - 1))) {
- return true;
- }
- } else {
- if (($number >= 0) && ($number <= pow(2, $maxbits))) {
- return true;
- }
- }
- return false;
- }
-
- function safe_parse_url($url) {
- $parts = @parse_url($url);
- $parts['scheme'] = (isset($parts['scheme']) ? $parts['scheme'] : '');
- $parts['host'] = (isset($parts['host']) ? $parts['host'] : '');
- $parts['user'] = (isset($parts['user']) ? $parts['user'] : '');
- $parts['pass'] = (isset($parts['pass']) ? $parts['pass'] : '');
- $parts['path'] = (isset($parts['path']) ? $parts['path'] : '');
- $parts['query'] = (isset($parts['query']) ? $parts['query'] : '');
- return $parts;
- }
-
- function IsValidURL($url, $allowUserPass=false) {
- if ($url == '') {
- return false;
- }
- if ($allowUserPass !== true) {
- if (strstr($url, '@')) {
- // in the format http://user:pass@example.com or http://user@example.com
- // but could easily be somebody incorrectly entering an email address in place of a URL
- return false;
- }
- }
- if ($parts = $this->safe_parse_url($url)) {
- if (($parts['scheme'] != 'http') && ($parts['scheme'] != 'https') && ($parts['scheme'] != 'ftp') && ($parts['scheme'] != 'gopher')) {
- return false;
- } elseif (!preg_match('#^[[:alnum:]]([-.]?[0-9a-z])*\\.[a-z]{2,3}$#i', $parts['host'], $regs) && !preg_match('#^[0-9]{1,3}(\\.[0-9]{1,3}){3}$#', $parts['host'])) {
- return false;
- } elseif (!preg_match('#^([[:alnum:]-]|[\\_])*$#i', $parts['user'], $regs)) {
- return false;
- } elseif (!preg_match('#^([[:alnum:]-]|[\\_])*$#i', $parts['pass'], $regs)) {
- return false;
- } elseif (!preg_match('#^[[:alnum:]/_\\.@~-]*$#i', $parts['path'], $regs)) {
- return false;
- } elseif (!empty($parts['query']) && !preg_match('#^[[:alnum:]?&=+:;_()%\\#/,\\.-]*$#i', $parts['query'], $regs)) {
- return false;
- } else {
- return true;
- }
- }
- return false;
- }
-
- static function ID3v2ShortFrameNameLookup($majorversion, $long_description) {
- $long_description = str_replace(' ', '_', strtolower(trim($long_description)));
- static $ID3v2ShortFrameNameLookup = array();
- if (empty($ID3v2ShortFrameNameLookup)) {
-
- // The following are unique to ID3v2.2
- $ID3v2ShortFrameNameLookup[2]['comment'] = 'COM';
- $ID3v2ShortFrameNameLookup[2]['album'] = 'TAL';
- $ID3v2ShortFrameNameLookup[2]['beats_per_minute'] = 'TBP';
- $ID3v2ShortFrameNameLookup[2]['composer'] = 'TCM';
- $ID3v2ShortFrameNameLookup[2]['genre'] = 'TCO';
- $ID3v2ShortFrameNameLookup[2]['itunescompilation'] = 'TCP';
- $ID3v2ShortFrameNameLookup[2]['copyright'] = 'TCR';
- $ID3v2ShortFrameNameLookup[2]['encoded_by'] = 'TEN';
- $ID3v2ShortFrameNameLookup[2]['language'] = 'TLA';
- $ID3v2ShortFrameNameLookup[2]['length'] = 'TLE';
- $ID3v2ShortFrameNameLookup[2]['original_artist'] = 'TOA';
- $ID3v2ShortFrameNameLookup[2]['original_filename'] = 'TOF';
- $ID3v2ShortFrameNameLookup[2]['original_lyricist'] = 'TOL';
- $ID3v2ShortFrameNameLookup[2]['original_album_title'] = 'TOT';
- $ID3v2ShortFrameNameLookup[2]['artist'] = 'TP1';
- $ID3v2ShortFrameNameLookup[2]['band'] = 'TP2';
- $ID3v2ShortFrameNameLookup[2]['conductor'] = 'TP3';
- $ID3v2ShortFrameNameLookup[2]['remixer'] = 'TP4';
- $ID3v2ShortFrameNameLookup[2]['publisher'] = 'TPB';
- $ID3v2ShortFrameNameLookup[2]['isrc'] = 'TRC';
- $ID3v2ShortFrameNameLookup[2]['tracknumber'] = 'TRK';
- $ID3v2ShortFrameNameLookup[2]['size'] = 'TSI';
- $ID3v2ShortFrameNameLookup[2]['encoder_settings'] = 'TSS';
- $ID3v2ShortFrameNameLookup[2]['description'] = 'TT1';
- $ID3v2ShortFrameNameLookup[2]['title'] = 'TT2';
- $ID3v2ShortFrameNameLookup[2]['subtitle'] = 'TT3';
- $ID3v2ShortFrameNameLookup[2]['lyricist'] = 'TXT';
- $ID3v2ShortFrameNameLookup[2]['user_text'] = 'TXX';
- $ID3v2ShortFrameNameLookup[2]['year'] = 'TYE';
- $ID3v2ShortFrameNameLookup[2]['unique_file_identifier'] = 'UFI';
- $ID3v2ShortFrameNameLookup[2]['unsynchronised_lyrics'] = 'ULT';
- $ID3v2ShortFrameNameLookup[2]['url_file'] = 'WAF';
- $ID3v2ShortFrameNameLookup[2]['url_artist'] = 'WAR';
- $ID3v2ShortFrameNameLookup[2]['url_source'] = 'WAS';
- $ID3v2ShortFrameNameLookup[2]['copyright_information'] = 'WCP';
- $ID3v2ShortFrameNameLookup[2]['url_publisher'] = 'WPB';
- $ID3v2ShortFrameNameLookup[2]['url_user'] = 'WXX';
-
- // The following are common to ID3v2.3 and ID3v2.4
- $ID3v2ShortFrameNameLookup[3]['audio_encryption'] = 'AENC';
- $ID3v2ShortFrameNameLookup[3]['attached_picture'] = 'APIC';
- $ID3v2ShortFrameNameLookup[3]['comment'] = 'COMM';
- $ID3v2ShortFrameNameLookup[3]['commercial'] = 'COMR';
- $ID3v2ShortFrameNameLookup[3]['encryption_method_registration'] = 'ENCR';
- $ID3v2ShortFrameNameLookup[3]['event_timing_codes'] = 'ETCO';
- $ID3v2ShortFrameNameLookup[3]['general_encapsulated_object'] = 'GEOB';
- $ID3v2ShortFrameNameLookup[3]['group_identification_registration'] = 'GRID';
- $ID3v2ShortFrameNameLookup[3]['linked_information'] = 'LINK';
- $ID3v2ShortFrameNameLookup[3]['music_cd_identifier'] = 'MCDI';
- $ID3v2ShortFrameNameLookup[3]['mpeg_location_lookup_table'] = 'MLLT';
- $ID3v2ShortFrameNameLookup[3]['ownership'] = 'OWNE';
- $ID3v2ShortFrameNameLookup[3]['play_counter'] = 'PCNT';
- $ID3v2ShortFrameNameLookup[3]['popularimeter'] = 'POPM';
- $ID3v2ShortFrameNameLookup[3]['position_synchronisation'] = 'POSS';
- $ID3v2ShortFrameNameLookup[3]['private'] = 'PRIV';
- $ID3v2ShortFrameNameLookup[3]['recommended_buffer_size'] = 'RBUF';
- $ID3v2ShortFrameNameLookup[3]['reverb'] = 'RVRB';
- $ID3v2ShortFrameNameLookup[3]['synchronised_lyrics'] = 'SYLT';
- $ID3v2ShortFrameNameLookup[3]['synchronised_tempo_codes'] = 'SYTC';
- $ID3v2ShortFrameNameLookup[3]['album'] = 'TALB';
- $ID3v2ShortFrameNameLookup[3]['beats_per_minute'] = 'TBPM';
- $ID3v2ShortFrameNameLookup[3]['itunescompilation'] = 'TCMP';
- $ID3v2ShortFrameNameLookup[3]['composer'] = 'TCOM';
- $ID3v2ShortFrameNameLookup[3]['genre'] = 'TCON';
- $ID3v2ShortFrameNameLookup[3]['copyright'] = 'TCOP';
- $ID3v2ShortFrameNameLookup[3]['playlist_delay'] = 'TDLY';
- $ID3v2ShortFrameNameLookup[3]['encoded_by'] = 'TENC';
- $ID3v2ShortFrameNameLookup[3]['lyricist'] = 'TEXT';
- $ID3v2ShortFrameNameLookup[3]['file_type'] = 'TFLT';
- $ID3v2ShortFrameNameLookup[3]['content_group_description'] = 'TIT1';
- $ID3v2ShortFrameNameLookup[3]['title'] = 'TIT2';
- $ID3v2ShortFrameNameLookup[3]['subtitle'] = 'TIT3';
- $ID3v2ShortFrameNameLookup[3]['initial_key'] = 'TKEY';
- $ID3v2ShortFrameNameLookup[3]['language'] = 'TLAN';
- $ID3v2ShortFrameNameLookup[3]['length'] = 'TLEN';
- $ID3v2ShortFrameNameLookup[3]['media_type'] = 'TMED';
- $ID3v2ShortFrameNameLookup[3]['original_album_title'] = 'TOAL';
- $ID3v2ShortFrameNameLookup[3]['original_filename'] = 'TOFN';
- $ID3v2ShortFrameNameLookup[3]['original_lyricist'] = 'TOLY';
- $ID3v2ShortFrameNameLookup[3]['original_artist'] = 'TOPE';
- $ID3v2ShortFrameNameLookup[3]['file_owner'] = 'TOWN';
- $ID3v2ShortFrameNameLookup[3]['artist'] = 'TPE1';
- $ID3v2ShortFrameNameLookup[3]['band'] = 'TPE2';
- $ID3v2ShortFrameNameLookup[3]['conductor'] = 'TPE3';
- $ID3v2ShortFrameNameLookup[3]['remixer'] = 'TPE4';
- $ID3v2ShortFrameNameLookup[3]['part_of_a_set'] = 'TPOS';
- $ID3v2ShortFrameNameLookup[3]['publisher'] = 'TPUB';
- $ID3v2ShortFrameNameLookup[3]['tracknumber'] = 'TRCK';
- $ID3v2ShortFrameNameLookup[3]['internet_radio_station_name'] = 'TRSN';
- $ID3v2ShortFrameNameLookup[3]['internet_radio_station_owner'] = 'TRSO';
- $ID3v2ShortFrameNameLookup[3]['isrc'] = 'TSRC';
- $ID3v2ShortFrameNameLookup[3]['encoder_settings'] = 'TSSE';
- $ID3v2ShortFrameNameLookup[3]['user_text'] = 'TXXX';
- $ID3v2ShortFrameNameLookup[3]['unique_file_identifier'] = 'UFID';
- $ID3v2ShortFrameNameLookup[3]['terms_of_use'] = 'USER';
- $ID3v2ShortFrameNameLookup[3]['unsynchronised_lyrics'] = 'USLT';
- $ID3v2ShortFrameNameLookup[3]['commercial'] = 'WCOM';
- $ID3v2ShortFrameNameLookup[3]['copyright_information'] = 'WCOP';
- $ID3v2ShortFrameNameLookup[3]['url_file'] = 'WOAF';
- $ID3v2ShortFrameNameLookup[3]['url_artist'] = 'WOAR';
- $ID3v2ShortFrameNameLookup[3]['url_source'] = 'WOAS';
- $ID3v2ShortFrameNameLookup[3]['url_station'] = 'WORS';
- $ID3v2ShortFrameNameLookup[3]['payment'] = 'WPAY';
- $ID3v2ShortFrameNameLookup[3]['url_publisher'] = 'WPUB';
- $ID3v2ShortFrameNameLookup[3]['url_user'] = 'WXXX';
-
- // The above are common to ID3v2.3 and ID3v2.4
- // so copy them to ID3v2.4 before adding specifics for 2.3 and 2.4
- $ID3v2ShortFrameNameLookup[4] = $ID3v2ShortFrameNameLookup[3];
-
- // The following are unique to ID3v2.3
- $ID3v2ShortFrameNameLookup[3]['equalisation'] = 'EQUA';
- $ID3v2ShortFrameNameLookup[3]['involved_people_list'] = 'IPLS';
- $ID3v2ShortFrameNameLookup[3]['relative_volume_adjustment'] = 'RVAD';
- $ID3v2ShortFrameNameLookup[3]['date'] = 'TDAT';
- $ID3v2ShortFrameNameLookup[3]['time'] = 'TIME';
- $ID3v2ShortFrameNameLookup[3]['original_release_year'] = 'TORY';
- $ID3v2ShortFrameNameLookup[3]['recording_dates'] = 'TRDA';
- $ID3v2ShortFrameNameLookup[3]['size'] = 'TSIZ';
- $ID3v2ShortFrameNameLookup[3]['year'] = 'TYER';
-
-
- // The following are unique to ID3v2.4
- $ID3v2ShortFrameNameLookup[4]['audio_seek_point_index'] = 'ASPI';
- $ID3v2ShortFrameNameLookup[4]['equalisation'] = 'EQU2';
- $ID3v2ShortFrameNameLookup[4]['relative_volume_adjustment'] = 'RVA2';
- $ID3v2ShortFrameNameLookup[4]['seek'] = 'SEEK';
- $ID3v2ShortFrameNameLookup[4]['signature'] = 'SIGN';
- $ID3v2ShortFrameNameLookup[4]['encoding_time'] = 'TDEN';
- $ID3v2ShortFrameNameLookup[4]['original_release_time'] = 'TDOR';
- $ID3v2ShortFrameNameLookup[4]['recording_time'] = 'TDRC';
- $ID3v2ShortFrameNameLookup[4]['release_time'] = 'TDRL';
- $ID3v2ShortFrameNameLookup[4]['tagging_time'] = 'TDTG';
- $ID3v2ShortFrameNameLookup[4]['involved_people_list'] = 'TIPL';
- $ID3v2ShortFrameNameLookup[4]['musician_credits_list'] = 'TMCL';
- $ID3v2ShortFrameNameLookup[4]['mood'] = 'TMOO';
- $ID3v2ShortFrameNameLookup[4]['produced_notice'] = 'TPRO';
- $ID3v2ShortFrameNameLookup[4]['album_sort_order'] = 'TSOA';
- $ID3v2ShortFrameNameLookup[4]['performer_sort_order'] = 'TSOP';
- $ID3v2ShortFrameNameLookup[4]['title_sort_order'] = 'TSOT';
- $ID3v2ShortFrameNameLookup[4]['set_subtitle'] = 'TSST';
- }
- return (isset($ID3v2ShortFrameNameLookup[$majorversion][strtolower($long_description)]) ? $ID3v2ShortFrameNameLookup[$majorversion][strtolower($long_description)] : '');
-
- }
-
-}
-
-?>
diff --git a/3rdparty/getid3/write.lyrics3.php b/3rdparty/getid3/write.lyrics3.php
deleted file mode 100644
index fa49cd16eab..00000000000
--- a/3rdparty/getid3/write.lyrics3.php
+++ /dev/null
@@ -1,73 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// write.lyrics3.php //
-// module for writing Lyrics3 tags //
-// dependencies: module.tag.lyrics3.php //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_write_lyrics3
-{
- var $filename;
- var $tag_data;
- //var $lyrics3_version = 2; // 1 or 2
- var $warnings = array(); // any non-critical errors will be stored here
- var $errors = array(); // any critical errors will be stored here
-
- function getid3_write_lyrics3() {
- return true;
- }
-
- function WriteLyrics3() {
- $this->errors[] = 'WriteLyrics3() not yet functional - cannot write Lyrics3';
- return false;
- }
- function DeleteLyrics3() {
- // Initialize getID3 engine
- $getID3 = new getID3;
- $ThisFileInfo = $getID3->analyze($this->filename);
- if (isset($ThisFileInfo['lyrics3']['tag_offset_start']) && isset($ThisFileInfo['lyrics3']['tag_offset_end'])) {
- if (is_readable($this->filename) && is_writable($this->filename) && is_file($this->filename) && ($fp = fopen($this->filename, 'a+b'))) {
-
- flock($fp, LOCK_EX);
- $oldignoreuserabort = ignore_user_abort(true);
-
- fseek($fp, $ThisFileInfo['lyrics3']['tag_offset_end'], SEEK_SET);
- $DataAfterLyrics3 = '';
- if ($ThisFileInfo['filesize'] > $ThisFileInfo['lyrics3']['tag_offset_end']) {
- $DataAfterLyrics3 = fread($fp, $ThisFileInfo['filesize'] - $ThisFileInfo['lyrics3']['tag_offset_end']);
- }
-
- ftruncate($fp, $ThisFileInfo['lyrics3']['tag_offset_start']);
-
- if (!empty($DataAfterLyrics3)) {
- fseek($fp, $ThisFileInfo['lyrics3']['tag_offset_start'], SEEK_SET);
- fwrite($fp, $DataAfterLyrics3, strlen($DataAfterLyrics3));
- }
-
- flock($fp, LOCK_UN);
- fclose($fp);
- ignore_user_abort($oldignoreuserabort);
-
- return true;
-
- } else {
- $this->errors[] = 'Cannot fopen('.$this->filename.', "a+b")';
- return false;
- }
- }
- // no Lyrics3 present
- return true;
- }
-
-}
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/write.metaflac.php b/3rdparty/getid3/write.metaflac.php
deleted file mode 100644
index dfd6950aa70..00000000000
--- a/3rdparty/getid3/write.metaflac.php
+++ /dev/null
@@ -1,163 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// write.metaflac.php //
-// module for writing metaflac tags //
-// dependencies: /helperapps/metaflac.exe //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_write_metaflac
-{
-
- var $filename;
- var $tag_data;
- var $warnings = array(); // any non-critical errors will be stored here
- var $errors = array(); // any critical errors will be stored here
-
- function getid3_write_metaflac() {
- return true;
- }
-
- function WriteMetaFLAC() {
-
- if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) {
- $this->errors[] = 'PHP running in Safe Mode (backtick operator not available) - cannot call metaflac, tags not written';
- return false;
- }
-
- // Create file with new comments
- $tempcommentsfilename = tempnam(GETID3_TEMP_DIR, 'getID3');
- if (is_writable($tempcommentsfilename) && is_file($tempcommentsfilename) && ($fpcomments = fopen($tempcommentsfilename, 'wb'))) {
- foreach ($this->tag_data as $key => $value) {
- foreach ($value as $commentdata) {
- fwrite($fpcomments, $this->CleanmetaflacName($key).'='.$commentdata."\n");
- }
- }
- fclose($fpcomments);
-
- } else {
- $this->errors[] = 'failed to open temporary tags file, tags not written - fopen("'.$tempcommentsfilename.'", "wb")';
- return false;
- }
-
- $oldignoreuserabort = ignore_user_abort(true);
- if (GETID3_OS_ISWINDOWS) {
-
- if (file_exists(GETID3_HELPERAPPSDIR.'metaflac.exe')) {
- //$commandline = '"'.GETID3_HELPERAPPSDIR.'metaflac.exe" --no-utf8-convert --remove-all-tags --import-tags-from="'.$tempcommentsfilename.'" "'.str_replace('/', '\\', $this->filename).'"';
- // metaflac works fine if you copy-paste the above commandline into a command prompt,
- // but refuses to work with `backtick` if there are "doublequotes" present around BOTH
- // the metaflac pathname and the target filename. For whatever reason...??
- // The solution is simply ensure that the metaflac pathname has no spaces,
- // and therefore does not need to be quoted
-
- // On top of that, if error messages are not always captured properly under Windows
- // To at least see if there was a problem, compare file modification timestamps before and after writing
- clearstatcache();
- $timestampbeforewriting = filemtime($this->filename);
-
- $commandline = GETID3_HELPERAPPSDIR.'metaflac.exe --no-utf8-convert --remove-all-tags --import-tags-from='.escapeshellarg($tempcommentsfilename).' '.escapeshellarg($this->filename).' 2>&1';
- $metaflacError = `$commandline`;
-
- if (empty($metaflacError)) {
- clearstatcache();
- if ($timestampbeforewriting == filemtime($this->filename)) {
- $metaflacError = 'File modification timestamp has not changed - it looks like the tags were not written';
- }
- }
- } else {
- $metaflacError = 'metaflac.exe not found in '.GETID3_HELPERAPPSDIR;
- }
-
- } else {
-
- // It's simpler on *nix
- $commandline = 'metaflac --no-utf8-convert --remove-all-tags --import-tags-from='.escapeshellarg($tempcommentsfilename).' '.escapeshellarg($this->filename).' 2>&1';
- $metaflacError = `$commandline`;
-
- }
-
- // Remove temporary comments file
- unlink($tempcommentsfilename);
- ignore_user_abort($oldignoreuserabort);
-
- if (!empty($metaflacError)) {
-
- $this->errors[] = 'System call to metaflac failed with this message returned: '."\n\n".$metaflacError;
- return false;
-
- }
-
- return true;
- }
-
-
- function DeleteMetaFLAC() {
-
- if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) {
- $this->errors[] = 'PHP running in Safe Mode (backtick operator not available) - cannot call metaflac, tags not deleted';
- return false;
- }
-
- $oldignoreuserabort = ignore_user_abort(true);
- if (GETID3_OS_ISWINDOWS) {
-
- if (file_exists(GETID3_HELPERAPPSDIR.'metaflac.exe')) {
- // To at least see if there was a problem, compare file modification timestamps before and after writing
- clearstatcache();
- $timestampbeforewriting = filemtime($this->filename);
-
- $commandline = GETID3_HELPERAPPSDIR.'metaflac.exe --remove-all-tags "'.$this->filename.'" 2>&1';
- $metaflacError = `$commandline`;
-
- if (empty($metaflacError)) {
- clearstatcache();
- if ($timestampbeforewriting == filemtime($this->filename)) {
- $metaflacError = 'File modification timestamp has not changed - it looks like the tags were not deleted';
- }
- }
- } else {
- $metaflacError = 'metaflac.exe not found in '.GETID3_HELPERAPPSDIR;
- }
-
- } else {
-
- // It's simpler on *nix
- $commandline = 'metaflac --remove-all-tags "'.$this->filename.'" 2>&1';
- $metaflacError = `$commandline`;
-
- }
-
- ignore_user_abort($oldignoreuserabort);
-
- if (!empty($metaflacError)) {
- $this->errors[] = 'System call to metaflac failed with this message returned: '."\n\n".$metaflacError;
- return false;
- }
- return true;
- }
-
-
- function CleanmetaflacName($originalcommentname) {
- // A case-insensitive field name that may consist of ASCII 0x20 through 0x7D, 0x3D ('=') excluded.
- // ASCII 0x41 through 0x5A inclusive (A-Z) is to be considered equivalent to ASCII 0x61 through
- // 0x7A inclusive (a-z).
-
- // replace invalid chars with a space, return uppercase text
- // Thanks Chris Bolt <chris-getid3bolt*cx> for improving this function
- // note: *reg_replace() replaces nulls with empty string (not space)
- return strtoupper(preg_replace('#[^ -<>-}]#', ' ', str_replace("\x00", ' ', $originalcommentname)));
-
- }
-
-}
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/write.php b/3rdparty/getid3/write.php
deleted file mode 100644
index 16b19c7d73b..00000000000
--- a/3rdparty/getid3/write.php
+++ /dev/null
@@ -1,615 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-/// //
-// write.php //
-// module for writing tags (APEv2, ID3v1, ID3v2) //
-// dependencies: getid3.lib.php //
-// write.apetag.php (optional) //
-// write.id3v1.php (optional) //
-// write.id3v2.php (optional) //
-// write.vorbiscomment.php (optional) //
-// write.metaflac.php (optional) //
-// write.lyrics3.php (optional) //
-// ///
-/////////////////////////////////////////////////////////////////
-
-if (!defined('GETID3_INCLUDEPATH')) {
- throw new Exception('getid3.php MUST be included before calling getid3_writetags');
-}
-if (!include_once(GETID3_INCLUDEPATH.'getid3.lib.php')) {
- throw new Exception('write.php depends on getid3.lib.php, which is missing.');
-}
-
-
-// NOTES:
-//
-// You should pass data here with standard field names as follows:
-// * TITLE
-// * ARTIST
-// * ALBUM
-// * TRACKNUMBER
-// * COMMENT
-// * GENRE
-// * YEAR
-// * ATTACHED_PICTURE (ID3v2 only)
-//
-// http://www.personal.uni-jena.de/~pfk/mpp/sv8/apekey.html
-// The APEv2 Tag Items Keys definition says "TRACK" is correct but foobar2000 uses "TRACKNUMBER" instead
-// Pass data here as "TRACKNUMBER" for compatability with all formats
-
-
-class getid3_writetags
-{
- // public
- var $filename; // absolute filename of file to write tags to
- var $tagformats = array(); // array of tag formats to write ('id3v1', 'id3v2.2', 'id2v2.3', 'id3v2.4', 'ape', 'vorbiscomment', 'metaflac', 'real')
- var $tag_data = array(array()); // 2-dimensional array of tag data (ex: $data['ARTIST'][0] = 'Elvis')
- var $tag_encoding = 'ISO-8859-1'; // text encoding used for tag data ('ISO-8859-1', 'UTF-8', 'UTF-16', 'UTF-16LE', 'UTF-16BE', )
- var $overwrite_tags = true; // if true will erase existing tag data and write only passed data; if false will merge passed data with existing tag data
- var $remove_other_tags = false; // if true will erase remove all existing tags and only write those passed in $tagformats; if false will ignore any tags not mentioned in $tagformats
-
- var $id3v2_tag_language = 'eng'; // ISO-639-2 3-character language code needed for some ID3v2 frames (http://www.id3.org/iso639-2.html)
- var $id3v2_paddedlength = 4096; // minimum length of ID3v2 tags (will be padded to this length if tag data is shorter)
-
- var $warnings = array(); // any non-critical errors will be stored here
- var $errors = array(); // any critical errors will be stored here
-
- // private
- var $ThisFileInfo; // analysis of file before writing
-
- function getid3_writetags() {
- return true;
- }
-
-
- function WriteTags() {
-
- if (empty($this->filename)) {
- $this->errors[] = 'filename is undefined in getid3_writetags';
- return false;
- } elseif (!file_exists($this->filename)) {
- $this->errors[] = 'filename set to non-existant file "'.$this->filename.'" in getid3_writetags';
- return false;
- }
-
- if (!is_array($this->tagformats)) {
- $this->errors[] = 'tagformats must be an array in getid3_writetags';
- return false;
- }
-
- $TagFormatsToRemove = array();
- if (filesize($this->filename) == 0) {
-
- // empty file special case - allow any tag format, don't check existing format
- // could be useful if you want to generate tag data for a non-existant file
- $this->ThisFileInfo = array('fileformat'=>'');
- $AllowedTagFormats = array('id3v1', 'id3v2.2', 'id3v2.3', 'id3v2.4', 'ape', 'lyrics3');
-
- } else {
-
- $getID3 = new getID3;
- $getID3->encoding = $this->tag_encoding;
- $this->ThisFileInfo = $getID3->analyze($this->filename);
-
- // check for what file types are allowed on this fileformat
- switch (isset($this->ThisFileInfo['fileformat']) ? $this->ThisFileInfo['fileformat'] : '') {
- case 'mp3':
- case 'mp2':
- case 'mp1':
- case 'riff': // maybe not officially, but people do it anyway
- $AllowedTagFormats = array('id3v1', 'id3v2.2', 'id3v2.3', 'id3v2.4', 'ape', 'lyrics3');
- break;
-
- case 'mpc':
- $AllowedTagFormats = array('ape');
- break;
-
- case 'flac':
- $AllowedTagFormats = array('metaflac');
- break;
-
- case 'real':
- $AllowedTagFormats = array('real');
- break;
-
- case 'ogg':
- switch (isset($this->ThisFileInfo['audio']['dataformat']) ? $this->ThisFileInfo['audio']['dataformat'] : '') {
- case 'flac':
- //$AllowedTagFormats = array('metaflac');
- $this->errors[] = 'metaflac is not (yet) compatible with OggFLAC files';
- return false;
- break;
- case 'vorbis':
- $AllowedTagFormats = array('vorbiscomment');
- break;
- default:
- $this->errors[] = 'metaflac is not (yet) compatible with Ogg files other than OggVorbis';
- return false;
- break;
- }
- break;
-
- default:
- $AllowedTagFormats = array();
- break;
- }
- foreach ($this->tagformats as $requested_tag_format) {
- if (!in_array($requested_tag_format, $AllowedTagFormats)) {
- $errormessage = 'Tag format "'.$requested_tag_format.'" is not allowed on "'.(isset($this->ThisFileInfo['fileformat']) ? $this->ThisFileInfo['fileformat'] : '');
- $errormessage .= (isset($this->ThisFileInfo['audio']['dataformat']) ? '.'.$this->ThisFileInfo['audio']['dataformat'] : '');
- $errormessage .= '" files';
- $this->errors[] = $errormessage;
- return false;
- }
- }
-
- // List of other tag formats, removed if requested
- if ($this->remove_other_tags) {
- foreach ($AllowedTagFormats as $AllowedTagFormat) {
- switch ($AllowedTagFormat) {
- case 'id3v2.2':
- case 'id3v2.3':
- case 'id3v2.4':
- if (!in_array('id3v2', $TagFormatsToRemove) && !in_array('id3v2.2', $this->tagformats) && !in_array('id3v2.3', $this->tagformats) && !in_array('id3v2.4', $this->tagformats)) {
- $TagFormatsToRemove[] = 'id3v2';
- }
- break;
-
- default:
- if (!in_array($AllowedTagFormat, $this->tagformats)) {
- $TagFormatsToRemove[] = $AllowedTagFormat;
- }
- break;
- }
- }
- }
- }
-
- $WritingFilesToInclude = array_merge($this->tagformats, $TagFormatsToRemove);
-
- // Check for required include files and include them
- foreach ($WritingFilesToInclude as $tagformat) {
- switch ($tagformat) {
- case 'ape':
- $GETID3_ERRORARRAY = &$this->errors;
- if (!getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'write.apetag.php', __FILE__, false)) {
- return false;
- }
- break;
-
- case 'id3v1':
- case 'lyrics3':
- case 'vorbiscomment':
- case 'metaflac':
- case 'real':
- $GETID3_ERRORARRAY = &$this->errors;
- if (!getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'write.'.$tagformat.'.php', __FILE__, false)) {
- return false;
- }
- break;
-
- case 'id3v2.2':
- case 'id3v2.3':
- case 'id3v2.4':
- case 'id3v2':
- $GETID3_ERRORARRAY = &$this->errors;
- if (!getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'write.id3v2.php', __FILE__, false)) {
- return false;
- }
- break;
-
- default:
- $this->errors[] = 'unknown tag format "'.$tagformat.'" in $tagformats in WriteTags()';
- return false;
- break;
- }
-
- }
-
- // Validation of supplied data
- if (!is_array($this->tag_data)) {
- $this->errors[] = '$this->tag_data is not an array in WriteTags()';
- return false;
- }
- // convert supplied data array keys to upper case, if they're not already
- foreach ($this->tag_data as $tag_key => $tag_array) {
- if (strtoupper($tag_key) !== $tag_key) {
- $this->tag_data[strtoupper($tag_key)] = $this->tag_data[$tag_key];
- unset($this->tag_data[$tag_key]);
- }
- }
- // convert source data array keys to upper case, if they're not already
- if (!empty($this->ThisFileInfo['tags'])) {
- foreach ($this->ThisFileInfo['tags'] as $tag_format => $tag_data_array) {
- foreach ($tag_data_array as $tag_key => $tag_array) {
- if (strtoupper($tag_key) !== $tag_key) {
- $this->ThisFileInfo['tags'][$tag_format][strtoupper($tag_key)] = $this->ThisFileInfo['tags'][$tag_format][$tag_key];
- unset($this->ThisFileInfo['tags'][$tag_format][$tag_key]);
- }
- }
- }
- }
-
- // Convert "TRACK" to "TRACKNUMBER" (if needed) for compatability with all formats
- if (isset($this->tag_data['TRACK']) && !isset($this->tag_data['TRACKNUMBER'])) {
- $this->tag_data['TRACKNUMBER'] = $this->tag_data['TRACK'];
- unset($this->tag_data['TRACK']);
- }
-
- // Remove all other tag formats, if requested
- if ($this->remove_other_tags) {
- $this->DeleteTags($TagFormatsToRemove);
- }
-
- // Write data for each tag format
- foreach ($this->tagformats as $tagformat) {
- $success = false; // overridden if tag writing is successful
- switch ($tagformat) {
- case 'ape':
- $ape_writer = new getid3_write_apetag;
- if (($ape_writer->tag_data = $this->FormatDataForAPE()) !== false) {
- $ape_writer->filename = $this->filename;
- if (($success = $ape_writer->WriteAPEtag()) === false) {
- $this->errors[] = 'WriteAPEtag() failed with message(s):<pre><ul><li>'.str_replace("\n", '</li><li>', htmlentities(trim(implode("\n", $ape_writer->errors)))).'</li></ul></pre>';
- }
- } else {
- $this->errors[] = 'FormatDataForAPE() failed';
- }
- break;
-
- case 'id3v1':
- $id3v1_writer = new getid3_write_id3v1;
- if (($id3v1_writer->tag_data = $this->FormatDataForID3v1()) !== false) {
- $id3v1_writer->filename = $this->filename;
- if (($success = $id3v1_writer->WriteID3v1()) === false) {
- $this->errors[] = 'WriteID3v1() failed with message(s):<pre><ul><li>'.str_replace("\n", '</li><li>', htmlentities(trim(implode("\n", $id3v1_writer->errors)))).'</li></ul></pre>';
- }
- } else {
- $this->errors[] = 'FormatDataForID3v1() failed';
- }
- break;
-
- case 'id3v2.2':
- case 'id3v2.3':
- case 'id3v2.4':
- $id3v2_writer = new getid3_write_id3v2;
- $id3v2_writer->majorversion = intval(substr($tagformat, -1));
- $id3v2_writer->paddedlength = $this->id3v2_paddedlength;
- if (($id3v2_writer->tag_data = $this->FormatDataForID3v2($id3v2_writer->majorversion)) !== false) {
- $id3v2_writer->filename = $this->filename;
- if (($success = $id3v2_writer->WriteID3v2()) === false) {
- $this->errors[] = 'WriteID3v2() failed with message(s):<pre><ul><li>'.str_replace("\n", '</li><li>', htmlentities(trim(implode("\n", $id3v2_writer->errors)))).'</li></ul></pre>';
- }
- } else {
- $this->errors[] = 'FormatDataForID3v2() failed';
- }
- break;
-
- case 'vorbiscomment':
- $vorbiscomment_writer = new getid3_write_vorbiscomment;
- if (($vorbiscomment_writer->tag_data = $this->FormatDataForVorbisComment()) !== false) {
- $vorbiscomment_writer->filename = $this->filename;
- if (($success = $vorbiscomment_writer->WriteVorbisComment()) === false) {
- $this->errors[] = 'WriteVorbisComment() failed with message(s):<pre><ul><li>'.str_replace("\n", '</li><li>', htmlentities(trim(implode("\n", $vorbiscomment_writer->errors)))).'</li></ul></pre>';
- }
- } else {
- $this->errors[] = 'FormatDataForVorbisComment() failed';
- }
- break;
-
- case 'metaflac':
- $metaflac_writer = new getid3_write_metaflac;
- if (($metaflac_writer->tag_data = $this->FormatDataForMetaFLAC()) !== false) {
- $metaflac_writer->filename = $this->filename;
- if (($success = $metaflac_writer->WriteMetaFLAC()) === false) {
- $this->errors[] = 'WriteMetaFLAC() failed with message(s):<pre><ul><li>'.str_replace("\n", '</li><li>', htmlentities(trim(implode("\n", $metaflac_writer->errors)))).'</li></ul></pre>';
- }
- } else {
- $this->errors[] = 'FormatDataForMetaFLAC() failed';
- }
- break;
-
- case 'real':
- $real_writer = new getid3_write_real;
- if (($real_writer->tag_data = $this->FormatDataForReal()) !== false) {
- $real_writer->filename = $this->filename;
- if (($success = $real_writer->WriteReal()) === false) {
- $this->errors[] = 'WriteReal() failed with message(s):<pre><ul><li>'.str_replace("\n", '</li><li>', htmlentities(trim(implode("\n", $real_writer->errors)))).'</li></ul></pre>';
- }
- } else {
- $this->errors[] = 'FormatDataForReal() failed';
- }
- break;
-
- default:
- $this->errors[] = 'Invalid tag format to write: "'.$tagformat.'"';
- return false;
- break;
- }
- if (!$success) {
- return false;
- }
- }
- return true;
-
- }
-
-
- function DeleteTags($TagFormatsToDelete) {
- foreach ($TagFormatsToDelete as $DeleteTagFormat) {
- $success = false; // overridden if tag deletion is successful
- switch ($DeleteTagFormat) {
- case 'id3v1':
- $id3v1_writer = new getid3_write_id3v1;
- $id3v1_writer->filename = $this->filename;
- if (($success = $id3v1_writer->RemoveID3v1()) === false) {
- $this->errors[] = 'RemoveID3v1() failed with message(s):<PRE><UL><LI>'.trim(implode('</LI><LI>', $id3v1_writer->errors)).'</LI></UL></PRE>';
- }
- break;
-
- case 'id3v2':
- $id3v2_writer = new getid3_write_id3v2;
- $id3v2_writer->filename = $this->filename;
- if (($success = $id3v2_writer->RemoveID3v2()) === false) {
- $this->errors[] = 'RemoveID3v2() failed with message(s):<PRE><UL><LI>'.trim(implode('</LI><LI>', $id3v2_writer->errors)).'</LI></UL></PRE>';
- }
- break;
-
- case 'ape':
- $ape_writer = new getid3_write_apetag;
- $ape_writer->filename = $this->filename;
- if (($success = $ape_writer->DeleteAPEtag()) === false) {
- $this->errors[] = 'DeleteAPEtag() failed with message(s):<PRE><UL><LI>'.trim(implode('</LI><LI>', $ape_writer->errors)).'</LI></UL></PRE>';
- }
- break;
-
- case 'vorbiscomment':
- $vorbiscomment_writer = new getid3_write_vorbiscomment;
- $vorbiscomment_writer->filename = $this->filename;
- if (($success = $vorbiscomment_writer->DeleteVorbisComment()) === false) {
- $this->errors[] = 'DeleteVorbisComment() failed with message(s):<PRE><UL><LI>'.trim(implode('</LI><LI>', $vorbiscomment_writer->errors)).'</LI></UL></PRE>';
- }
- break;
-
- case 'metaflac':
- $metaflac_writer = new getid3_write_metaflac;
- $metaflac_writer->filename = $this->filename;
- if (($success = $metaflac_writer->DeleteMetaFLAC()) === false) {
- $this->errors[] = 'DeleteMetaFLAC() failed with message(s):<PRE><UL><LI>'.trim(implode('</LI><LI>', $metaflac_writer->errors)).'</LI></UL></PRE>';
- }
- break;
-
- case 'lyrics3':
- $lyrics3_writer = new getid3_write_lyrics3;
- $lyrics3_writer->filename = $this->filename;
- if (($success = $lyrics3_writer->DeleteLyrics3()) === false) {
- $this->errors[] = 'DeleteLyrics3() failed with message(s):<PRE><UL><LI>'.trim(implode('</LI><LI>', $lyrics3_writer->errors)).'</LI></UL></PRE>';
- }
- break;
-
- case 'real':
- $real_writer = new getid3_write_real;
- $real_writer->filename = $this->filename;
- if (($success = $real_writer->RemoveReal()) === false) {
- $this->errors[] = 'RemoveReal() failed with message(s):<PRE><UL><LI>'.trim(implode('</LI><LI>', $real_writer->errors)).'</LI></UL></PRE>';
- }
- break;
-
- default:
- $this->errors[] = 'Invalid tag format to delete: "'.$tagformat.'"';
- return false;
- break;
- }
- if (!$success) {
- return false;
- }
- }
- return true;
- }
-
-
- function MergeExistingTagData($TagFormat, &$tag_data) {
- // Merge supplied data with existing data, if requested
- if ($this->overwrite_tags) {
- // do nothing - ignore previous data
- } else {
-throw new Exception('$this->overwrite_tags=false is known to be buggy in this version of getID3. Will be fixed in the near future, check www.getid3.org for a newer version.');
- if (!isset($this->ThisFileInfo['tags'][$TagFormat])) {
- return false;
- }
- $tag_data = array_merge_recursive($tag_data, $this->ThisFileInfo['tags'][$TagFormat]);
- }
- return true;
- }
-
- function FormatDataForAPE() {
- $ape_tag_data = array();
- foreach ($this->tag_data as $tag_key => $valuearray) {
- switch ($tag_key) {
- case 'ATTACHED_PICTURE':
- // ATTACHED_PICTURE is ID3v2 only - ignore
- $this->warnings[] = '$data['.$tag_key.'] is assumed to be ID3v2 APIC data - NOT written to APE tag';
- break;
-
- default:
- foreach ($valuearray as $key => $value) {
- if (is_string($value) || is_numeric($value)) {
- $ape_tag_data[$tag_key][$key] = getid3_lib::iconv_fallback($this->tag_encoding, 'UTF-8', $value);
- } else {
- $this->warnings[] = '$data['.$tag_key.']['.$key.'] is not a string value - all of $data['.$tag_key.'] NOT written to APE tag';
- unset($ape_tag_data[$tag_key]);
- break;
- }
- }
- break;
- }
- }
- $this->MergeExistingTagData('ape', $ape_tag_data);
- return $ape_tag_data;
- }
-
-
- function FormatDataForID3v1() {
- $tag_data_id3v1['genreid'] = 255;
- if (!empty($this->tag_data['GENRE'])) {
- foreach ($this->tag_data['GENRE'] as $key => $value) {
- if (getid3_id3v1::LookupGenreID($value) !== false) {
- $tag_data_id3v1['genreid'] = getid3_id3v1::LookupGenreID($value);
- break;
- }
- }
- }
- $tag_data_id3v1['title'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', implode(' ', (isset($this->tag_data['TITLE'] ) ? $this->tag_data['TITLE'] : array())));
- $tag_data_id3v1['artist'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', implode(' ', (isset($this->tag_data['ARTIST'] ) ? $this->tag_data['ARTIST'] : array())));
- $tag_data_id3v1['album'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', implode(' ', (isset($this->tag_data['ALBUM'] ) ? $this->tag_data['ALBUM'] : array())));
- $tag_data_id3v1['year'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', implode(' ', (isset($this->tag_data['YEAR'] ) ? $this->tag_data['YEAR'] : array())));
- $tag_data_id3v1['comment'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', implode(' ', (isset($this->tag_data['COMMENT'] ) ? $this->tag_data['COMMENT'] : array())));
- $tag_data_id3v1['track'] = intval(getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', implode(' ', (isset($this->tag_data['TRACKNUMBER']) ? $this->tag_data['TRACKNUMBER'] : array()))));
- if ($tag_data_id3v1['track'] <= 0) {
- $tag_data_id3v1['track'] = '';
- }
-
- $this->MergeExistingTagData('id3v1', $tag_data_id3v1);
- return $tag_data_id3v1;
- }
-
- function FormatDataForID3v2($id3v2_majorversion) {
- $tag_data_id3v2 = array();
-
- $ID3v2_text_encoding_lookup[2] = array('ISO-8859-1'=>0, 'UTF-16'=>1);
- $ID3v2_text_encoding_lookup[3] = array('ISO-8859-1'=>0, 'UTF-16'=>1);
- $ID3v2_text_encoding_lookup[4] = array('ISO-8859-1'=>0, 'UTF-16'=>1, 'UTF-16BE'=>2, 'UTF-8'=>3);
- foreach ($this->tag_data as $tag_key => $valuearray) {
- $ID3v2_framename = getid3_write_id3v2::ID3v2ShortFrameNameLookup($id3v2_majorversion, $tag_key);
- switch ($ID3v2_framename) {
- case 'APIC':
- foreach ($valuearray as $key => $apic_data_array) {
- if (isset($apic_data_array['data']) &&
- isset($apic_data_array['picturetypeid']) &&
- isset($apic_data_array['description']) &&
- isset($apic_data_array['mime'])) {
- $tag_data_id3v2['APIC'][] = $apic_data_array;
- } else {
- $this->errors[] = 'ID3v2 APIC data is not properly structured';
- return false;
- }
- }
- break;
-
- case '':
- $this->errors[] = 'ID3v2: Skipping "'.$tag_key.'" because cannot match it to a known ID3v2 frame type';
- // some other data type, don't know how to handle it, ignore it
- break;
-
- default:
- // most other (text) frames can be copied over as-is
- foreach ($valuearray as $key => $value) {
- if (isset($ID3v2_text_encoding_lookup[$id3v2_majorversion][$this->tag_encoding])) {
- // source encoding is valid in ID3v2 - use it with no conversion
- $tag_data_id3v2[$ID3v2_framename][$key]['encodingid'] = $ID3v2_text_encoding_lookup[$id3v2_majorversion][$this->tag_encoding];
- $tag_data_id3v2[$ID3v2_framename][$key]['data'] = $value;
- } else {
- // source encoding is NOT valid in ID3v2 - convert it to an ID3v2-valid encoding first
- if ($id3v2_majorversion < 4) {
- // convert data from other encoding to UTF-16 (with BOM)
- // note: some software, notably Windows Media Player and iTunes are broken and treat files tagged with UTF-16BE (with BOM) as corrupt
- // therefore we force data to UTF-16LE and manually prepend the BOM
- $ID3v2_tag_data_converted = false;
- if (!$ID3v2_tag_data_converted && ($this->tag_encoding == 'ISO-8859-1')) {
- // great, leave data as-is for minimum compatability problems
- $tag_data_id3v2[$ID3v2_framename][$key]['encodingid'] = 0;
- $tag_data_id3v2[$ID3v2_framename][$key]['data'] = $value;
- $ID3v2_tag_data_converted = true;
- }
- if (!$ID3v2_tag_data_converted && ($this->tag_encoding == 'UTF-8')) {
- do {
- // if UTF-8 string does not include any characters above chr(127) then it is identical to ISO-8859-1
- for ($i = 0; $i < strlen($value); $i++) {
- if (ord($value{$i}) > 127) {
- break 2;
- }
- }
- $tag_data_id3v2[$ID3v2_framename][$key]['encodingid'] = 0;
- $tag_data_id3v2[$ID3v2_framename][$key]['data'] = $value;
- $ID3v2_tag_data_converted = true;
- } while (false);
- }
- if (!$ID3v2_tag_data_converted) {
- $tag_data_id3v2[$ID3v2_framename][$key]['encodingid'] = 1;
- //$tag_data_id3v2[$ID3v2_framename][$key]['data'] = getid3_lib::iconv_fallback($this->tag_encoding, 'UTF-16', $value); // output is UTF-16LE+BOM or UTF-16BE+BOM depending on system architecture
- $tag_data_id3v2[$ID3v2_framename][$key]['data'] = "\xFF\xFE".getid3_lib::iconv_fallback($this->tag_encoding, 'UTF-16LE', $value); // force LittleEndian order version of UTF-16
- $ID3v2_tag_data_converted = true;
- }
-
- } else {
- // convert data from other encoding to UTF-8
- $tag_data_id3v2[$ID3v2_framename][$key]['encodingid'] = 3;
- $tag_data_id3v2[$ID3v2_framename][$key]['data'] = getid3_lib::iconv_fallback($this->tag_encoding, 'UTF-8', $value);
- }
- }
-
- // These values are not needed for all frame types, but if they're not used no matter
- $tag_data_id3v2[$ID3v2_framename][$key]['description'] = '';
- $tag_data_id3v2[$ID3v2_framename][$key]['language'] = $this->id3v2_tag_language;
- }
- break;
- }
- }
- $this->MergeExistingTagData('id3v2', $tag_data_id3v2);
- return $tag_data_id3v2;
- }
-
- function FormatDataForVorbisComment() {
- $tag_data_vorbiscomment = $this->tag_data;
-
- // check for multi-line comment values - split out to multiple comments if neccesary
- // and convert data to UTF-8 strings
- foreach ($tag_data_vorbiscomment as $tag_key => $valuearray) {
- foreach ($valuearray as $key => $value) {
- str_replace("\r", "\n", $value);
- if (strstr($value, "\n")) {
- unset($tag_data_vorbiscomment[$tag_key][$key]);
- $multilineexploded = explode("\n", $value);
- foreach ($multilineexploded as $newcomment) {
- if (strlen(trim($newcomment)) > 0) {
- $tag_data_vorbiscomment[$tag_key][] = getid3_lib::iconv_fallback($this->tag_encoding, 'UTF-8', $newcomment);
- }
- }
- } elseif (is_string($value) || is_numeric($value)) {
- $tag_data_vorbiscomment[$tag_key][$key] = getid3_lib::iconv_fallback($this->tag_encoding, 'UTF-8', $value);
- } else {
- $this->warnings[] = '$data['.$tag_key.']['.$key.'] is not a string value - all of $data['.$tag_key.'] NOT written to VorbisComment tag';
- unset($tag_data_vorbiscomment[$tag_key]);
- break;
- }
- }
- }
- $this->MergeExistingTagData('vorbiscomment', $tag_data_vorbiscomment);
- return $tag_data_vorbiscomment;
- }
-
- function FormatDataForMetaFLAC() {
- // FLAC & OggFLAC use VorbisComments same as OggVorbis
- // but require metaflac to do the writing rather than vorbiscomment
- return $this->FormatDataForVorbisComment();
- }
-
- function FormatDataForReal() {
- $tag_data_real['title'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', implode(' ', (isset($this->tag_data['TITLE'] ) ? $this->tag_data['TITLE'] : array())));
- $tag_data_real['artist'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', implode(' ', (isset($this->tag_data['ARTIST'] ) ? $this->tag_data['ARTIST'] : array())));
- $tag_data_real['copyright'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', implode(' ', (isset($this->tag_data['COPYRIGHT']) ? $this->tag_data['COPYRIGHT'] : array())));
- $tag_data_real['comment'] = getid3_lib::iconv_fallback($this->tag_encoding, 'ISO-8859-1', implode(' ', (isset($this->tag_data['COMMENT'] ) ? $this->tag_data['COMMENT'] : array())));
-
- $this->MergeExistingTagData('real', $tag_data_real);
- return $tag_data_real;
- }
-
-}
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/write.real.php b/3rdparty/getid3/write.real.php
deleted file mode 100644
index ad37e74adbe..00000000000
--- a/3rdparty/getid3/write.real.php
+++ /dev/null
@@ -1,275 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// write.real.php //
-// module for writing RealAudio/RealVideo tags //
-// dependencies: module.tag.real.php //
-// ///
-/////////////////////////////////////////////////////////////////
-
-class getid3_write_real
-{
- var $filename;
- var $tag_data = array();
- var $fread_buffer_size = 32768; // read buffer size in bytes
- var $warnings = array(); // any non-critical errors will be stored here
- var $errors = array(); // any critical errors will be stored here
- var $paddedlength = 512; // minimum length of CONT tag in bytes
-
- function getid3_write_real() {
- return true;
- }
-
- function WriteReal() {
- // File MUST be writeable - CHMOD(646) at least
- if (is_writeable($this->filename) && is_file($this->filename) && ($fp_source = fopen($this->filename, 'r+b'))) {
-
- // Initialize getID3 engine
- $getID3 = new getID3;
- $OldThisFileInfo = $getID3->analyze($this->filename);
- if (empty($OldThisFileInfo['real']['chunks']) && !empty($OldThisFileInfo['real']['old_ra_header'])) {
- $this->errors[] = 'Cannot write Real tags on old-style file format';
- fclose($fp_source);
- return false;
- }
-
- if (empty($OldThisFileInfo['real']['chunks'])) {
- $this->errors[] = 'Cannot write Real tags because cannot find DATA chunk in file';
- fclose($fp_source);
- return false;
- }
- foreach ($OldThisFileInfo['real']['chunks'] as $chunknumber => $chunkarray) {
- $oldChunkInfo[$chunkarray['name']] = $chunkarray;
- }
- if (!empty($oldChunkInfo['CONT']['length'])) {
- $this->paddedlength = max($oldChunkInfo['CONT']['length'], $this->paddedlength);
- }
-
- $new_CONT_tag_data = $this->GenerateCONTchunk();
- $new_PROP_tag_data = $this->GeneratePROPchunk($OldThisFileInfo['real']['chunks'], $new_CONT_tag_data);
- $new__RMF_tag_data = $this->GenerateRMFchunk($OldThisFileInfo['real']['chunks']);
-
- if (isset($oldChunkInfo['.RMF']['length']) && ($oldChunkInfo['.RMF']['length'] == strlen($new__RMF_tag_data))) {
- fseek($fp_source, $oldChunkInfo['.RMF']['offset'], SEEK_SET);
- fwrite($fp_source, $new__RMF_tag_data);
- } else {
- $this->errors[] = 'new .RMF tag ('.strlen($new__RMF_tag_data).' bytes) different length than old .RMF tag ('.$oldChunkInfo['.RMF']['length'].' bytes)';
- fclose($fp_source);
- return false;
- }
-
- if (isset($oldChunkInfo['PROP']['length']) && ($oldChunkInfo['PROP']['length'] == strlen($new_PROP_tag_data))) {
- fseek($fp_source, $oldChunkInfo['PROP']['offset'], SEEK_SET);
- fwrite($fp_source, $new_PROP_tag_data);
- } else {
- $this->errors[] = 'new PROP tag ('.strlen($new_PROP_tag_data).' bytes) different length than old PROP tag ('.$oldChunkInfo['PROP']['length'].' bytes)';
- fclose($fp_source);
- return false;
- }
-
- if (isset($oldChunkInfo['CONT']['length']) && ($oldChunkInfo['CONT']['length'] == strlen($new_CONT_tag_data))) {
-
- // new data length is same as old data length - just overwrite
- fseek($fp_source, $oldChunkInfo['CONT']['offset'], SEEK_SET);
- fwrite($fp_source, $new_CONT_tag_data);
- fclose($fp_source);
- return true;
-
- } else {
-
- if (empty($oldChunkInfo['CONT'])) {
- // no existing CONT chunk
- $BeforeOffset = $oldChunkInfo['DATA']['offset'];
- $AfterOffset = $oldChunkInfo['DATA']['offset'];
- } else {
- // new data is longer than old data
- $BeforeOffset = $oldChunkInfo['CONT']['offset'];
- $AfterOffset = $oldChunkInfo['CONT']['offset'] + $oldChunkInfo['CONT']['length'];
- }
- if ($tempfilename = tempnam(GETID3_TEMP_DIR, 'getID3')) {
- if (is_writable($tempfilename) && is_file($tempfilename) && ($fp_temp = fopen($tempfilename, 'wb'))) {
-
- rewind($fp_source);
- fwrite($fp_temp, fread($fp_source, $BeforeOffset));
- fwrite($fp_temp, $new_CONT_tag_data);
- fseek($fp_source, $AfterOffset, SEEK_SET);
- while ($buffer = fread($fp_source, $this->fread_buffer_size)) {
- fwrite($fp_temp, $buffer, strlen($buffer));
- }
- fclose($fp_temp);
-
- if (copy($tempfilename, $this->filename)) {
- unlink($tempfilename);
- fclose($fp_source);
- return true;
- }
- unlink($tempfilename);
- $this->errors[] = 'FAILED: copy('.$tempfilename.', '.$this->filename.')';
-
- } else {
- $this->errors[] = 'Could not fopen("'.$tempfilename.'", "wb")';
- }
- }
- fclose($fp_source);
- return false;
-
- }
-
- }
- $this->errors[] = 'Could not fopen("'.$this->filename.'", "r+b")';
- return false;
- }
-
- function GenerateRMFchunk(&$chunks) {
- $oldCONTexists = false;
- foreach ($chunks as $key => $chunk) {
- $chunkNameKeys[$chunk['name']] = $key;
- if ($chunk['name'] == 'CONT') {
- $oldCONTexists = true;
- }
- }
- $newHeadersCount = $chunks[$chunkNameKeys['.RMF']]['headers_count'] + ($oldCONTexists ? 0 : 1);
-
- $RMFchunk = "\x00\x00"; // object version
- $RMFchunk .= getid3_lib::BigEndian2String($chunks[$chunkNameKeys['.RMF']]['file_version'], 4);
- $RMFchunk .= getid3_lib::BigEndian2String($newHeadersCount, 4);
-
- $RMFchunk = '.RMF'.getid3_lib::BigEndian2String(strlen($RMFchunk) + 8, 4).$RMFchunk; // .RMF chunk identifier + chunk length
- return $RMFchunk;
- }
-
- function GeneratePROPchunk(&$chunks, &$new_CONT_tag_data) {
- $old_CONT_length = 0;
- $old_DATA_offset = 0;
- $old_INDX_offset = 0;
- foreach ($chunks as $key => $chunk) {
- $chunkNameKeys[$chunk['name']] = $key;
- if ($chunk['name'] == 'CONT') {
- $old_CONT_length = $chunk['length'];
- } elseif ($chunk['name'] == 'DATA') {
- if (!$old_DATA_offset) {
- $old_DATA_offset = $chunk['offset'];
- }
- } elseif ($chunk['name'] == 'INDX') {
- if (!$old_INDX_offset) {
- $old_INDX_offset = $chunk['offset'];
- }
- }
- }
- $CONTdelta = strlen($new_CONT_tag_data) - $old_CONT_length;
-
- $PROPchunk = "\x00\x00"; // object version
- $PROPchunk .= getid3_lib::BigEndian2String($chunks[$chunkNameKeys['PROP']]['max_bit_rate'], 4);
- $PROPchunk .= getid3_lib::BigEndian2String($chunks[$chunkNameKeys['PROP']]['avg_bit_rate'], 4);
- $PROPchunk .= getid3_lib::BigEndian2String($chunks[$chunkNameKeys['PROP']]['max_packet_size'], 4);
- $PROPchunk .= getid3_lib::BigEndian2String($chunks[$chunkNameKeys['PROP']]['avg_packet_size'], 4);
- $PROPchunk .= getid3_lib::BigEndian2String($chunks[$chunkNameKeys['PROP']]['num_packets'], 4);
- $PROPchunk .= getid3_lib::BigEndian2String($chunks[$chunkNameKeys['PROP']]['duration'], 4);
- $PROPchunk .= getid3_lib::BigEndian2String($chunks[$chunkNameKeys['PROP']]['preroll'], 4);
- $PROPchunk .= getid3_lib::BigEndian2String(max(0, $old_INDX_offset + $CONTdelta), 4);
- $PROPchunk .= getid3_lib::BigEndian2String(max(0, $old_DATA_offset + $CONTdelta), 4);
- $PROPchunk .= getid3_lib::BigEndian2String($chunks[$chunkNameKeys['PROP']]['num_streams'], 2);
- $PROPchunk .= getid3_lib::BigEndian2String($chunks[$chunkNameKeys['PROP']]['flags_raw'], 2);
-
- $PROPchunk = 'PROP'.getid3_lib::BigEndian2String(strlen($PROPchunk) + 8, 4).$PROPchunk; // PROP chunk identifier + chunk length
- return $PROPchunk;
- }
-
- function GenerateCONTchunk() {
- foreach ($this->tag_data as $key => $value) {
- // limit each value to 0xFFFF bytes
- $this->tag_data[$key] = substr($value, 0, 65535);
- }
-
- $CONTchunk = "\x00\x00"; // object version
-
- $CONTchunk .= getid3_lib::BigEndian2String((!empty($this->tag_data['title']) ? strlen($this->tag_data['title']) : 0), 2);
- $CONTchunk .= (!empty($this->tag_data['title']) ? strlen($this->tag_data['title']) : '');
-
- $CONTchunk .= getid3_lib::BigEndian2String((!empty($this->tag_data['artist']) ? strlen($this->tag_data['artist']) : 0), 2);
- $CONTchunk .= (!empty($this->tag_data['artist']) ? strlen($this->tag_data['artist']) : '');
-
- $CONTchunk .= getid3_lib::BigEndian2String((!empty($this->tag_data['copyright']) ? strlen($this->tag_data['copyright']) : 0), 2);
- $CONTchunk .= (!empty($this->tag_data['copyright']) ? strlen($this->tag_data['copyright']) : '');
-
- $CONTchunk .= getid3_lib::BigEndian2String((!empty($this->tag_data['comment']) ? strlen($this->tag_data['comment']) : 0), 2);
- $CONTchunk .= (!empty($this->tag_data['comment']) ? strlen($this->tag_data['comment']) : '');
-
- if ($this->paddedlength > (strlen($CONTchunk) + 8)) {
- $CONTchunk .= str_repeat("\x00", $this->paddedlength - strlen($CONTchunk) - 8);
- }
-
- $CONTchunk = 'CONT'.getid3_lib::BigEndian2String(strlen($CONTchunk) + 8, 4).$CONTchunk; // CONT chunk identifier + chunk length
-
- return $CONTchunk;
- }
-
- function RemoveReal() {
- // File MUST be writeable - CHMOD(646) at least
- if (is_writeable($this->filename) && is_file($this->filename) && ($fp_source = fopen($this->filename, 'r+b'))) {
-
- // Initialize getID3 engine
- $getID3 = new getID3;
- $OldThisFileInfo = $getID3->analyze($this->filename);
- if (empty($OldThisFileInfo['real']['chunks']) && !empty($OldThisFileInfo['real']['old_ra_header'])) {
- $this->errors[] = 'Cannot remove Real tags from old-style file format';
- fclose($fp_source);
- return false;
- }
-
- if (empty($OldThisFileInfo['real']['chunks'])) {
- $this->errors[] = 'Cannot remove Real tags because cannot find DATA chunk in file';
- fclose($fp_source);
- return false;
- }
- foreach ($OldThisFileInfo['real']['chunks'] as $chunknumber => $chunkarray) {
- $oldChunkInfo[$chunkarray['name']] = $chunkarray;
- }
-
- if (empty($oldChunkInfo['CONT'])) {
- // no existing CONT chunk
- fclose($fp_source);
- return true;
- }
-
- $BeforeOffset = $oldChunkInfo['CONT']['offset'];
- $AfterOffset = $oldChunkInfo['CONT']['offset'] + $oldChunkInfo['CONT']['length'];
- if ($tempfilename = tempnam(GETID3_TEMP_DIR, 'getID3')) {
- if (is_writable($tempfilename) && is_file($tempfilename) && ($fp_temp = fopen($tempfilename, 'wb'))) {
-
- rewind($fp_source);
- fwrite($fp_temp, fread($fp_source, $BeforeOffset));
- fseek($fp_source, $AfterOffset, SEEK_SET);
- while ($buffer = fread($fp_source, $this->fread_buffer_size)) {
- fwrite($fp_temp, $buffer, strlen($buffer));
- }
- fclose($fp_temp);
-
- if (copy($tempfilename, $this->filename)) {
- unlink($tempfilename);
- fclose($fp_source);
- return true;
- }
- unlink($tempfilename);
- $this->errors[] = 'FAILED: copy('.$tempfilename.', '.$this->filename.')';
-
- } else {
- $this->errors[] = 'Could not fopen("'.$tempfilename.'", "wb")';
- }
- }
- fclose($fp_source);
- return false;
- }
- $this->errors[] = 'Could not fopen("'.$this->filename.'", "r+b")';
- return false;
- }
-
-}
-
-?> \ No newline at end of file
diff --git a/3rdparty/getid3/write.vorbiscomment.php b/3rdparty/getid3/write.vorbiscomment.php
deleted file mode 100644
index ac8dc693430..00000000000
--- a/3rdparty/getid3/write.vorbiscomment.php
+++ /dev/null
@@ -1,121 +0,0 @@
-<?php
-/////////////////////////////////////////////////////////////////
-/// getID3() by James Heinrich <info@getid3.org> //
-// available at http://getid3.sourceforge.net //
-// or http://www.getid3.org //
-/////////////////////////////////////////////////////////////////
-// See readme.txt for more details //
-/////////////////////////////////////////////////////////////////
-// //
-// write.vorbiscomment.php //
-// module for writing VorbisComment tags //
-// dependencies: /helperapps/vorbiscomment.exe //
-// ///
-/////////////////////////////////////////////////////////////////
-
-
-class getid3_write_vorbiscomment
-{
-
- var $filename;
- var $tag_data;
- var $warnings = array(); // any non-critical errors will be stored here
- var $errors = array(); // any critical errors will be stored here
-
- function getid3_write_vorbiscomment() {
- return true;
- }
-
- function WriteVorbisComment() {
-
- if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) {
- $this->errors[] = 'PHP running in Safe Mode (backtick operator not available) - cannot call vorbiscomment, tags not written';
- return false;
- }
-
- // Create file with new comments
- $tempcommentsfilename = tempnam(GETID3_TEMP_DIR, 'getID3');
- if (is_writable($tempcommentsfilename) && is_file($tempcommentsfilename) && ($fpcomments = fopen($tempcommentsfilename, 'wb'))) {
-
- foreach ($this->tag_data as $key => $value) {
- foreach ($value as $commentdata) {
- fwrite($fpcomments, $this->CleanVorbisCommentName($key).'='.$commentdata."\n");
- }
- }
- fclose($fpcomments);
-
- } else {
- $this->errors[] = 'failed to open temporary tags file "'.$tempcommentsfilename.'", tags not written';
- return false;
- }
-
- $oldignoreuserabort = ignore_user_abort(true);
- if (GETID3_OS_ISWINDOWS) {
-
- if (file_exists(GETID3_HELPERAPPSDIR.'vorbiscomment.exe')) {
- //$commandline = '"'.GETID3_HELPERAPPSDIR.'vorbiscomment.exe" -w --raw -c "'.$tempcommentsfilename.'" "'.str_replace('/', '\\', $this->filename).'"';
- // vorbiscomment works fine if you copy-paste the above commandline into a command prompt,
- // but refuses to work with `backtick` if there are "doublequotes" present around BOTH
- // the metaflac pathname and the target filename. For whatever reason...??
- // The solution is simply ensure that the metaflac pathname has no spaces,
- // and therefore does not need to be quoted
-
- // On top of that, if error messages are not always captured properly under Windows
- // To at least see if there was a problem, compare file modification timestamps before and after writing
- clearstatcache();
- $timestampbeforewriting = filemtime($this->filename);
-
- $commandline = GETID3_HELPERAPPSDIR.'vorbiscomment.exe -w --raw -c "'.$tempcommentsfilename.'" "'.$this->filename.'" 2>&1';
- $VorbiscommentError = `$commandline`;
-
- if (empty($VorbiscommentError)) {
- clearstatcache();
- if ($timestampbeforewriting == filemtime($this->filename)) {
- $VorbiscommentError = 'File modification timestamp has not changed - it looks like the tags were not written';
- }
- }
- } else {
- $VorbiscommentError = 'vorbiscomment.exe not found in '.GETID3_HELPERAPPSDIR;
- }
-
- } else {
-
- $commandline = 'vorbiscomment -w --raw -c "'.$tempcommentsfilename.'" "'.$this->filename.'" 2>&1';
- $VorbiscommentError = `$commandline`;
-
- }
-
- // Remove temporary comments file
- unlink($tempcommentsfilename);
- ignore_user_abort($oldignoreuserabort);
-
- if (!empty($VorbiscommentError)) {
-
- $this->errors[] = 'system call to vorbiscomment failed with message: '."\n\n".$VorbiscommentError;
- return false;
-
- }
-
- return true;
- }
-
- function DeleteVorbisComment() {
- $this->tag_data = array(array());
- return $this->WriteVorbisComment();
- }
-
- function CleanVorbisCommentName($originalcommentname) {
- // A case-insensitive field name that may consist of ASCII 0x20 through 0x7D, 0x3D ('=') excluded.
- // ASCII 0x41 through 0x5A inclusive (A-Z) is to be considered equivalent to ASCII 0x61 through
- // 0x7A inclusive (a-z).
-
- // replace invalid chars with a space, return uppercase text
- // Thanks Chris Bolt <chris-getid3bolt*cx> for improving this function
- // note: *reg_replace() replaces nulls with empty string (not space)
- return strtoupper(preg_replace('#[^ -<>-}]#', ' ', str_replace("\x00", ' ', $originalcommentname)));
-
- }
-
-}
-
-?> \ No newline at end of file
diff --git a/3rdparty/js/chosen/LICENSE.md b/3rdparty/js/chosen/LICENSE.md
deleted file mode 100644
index 80109bba802..00000000000
--- a/3rdparty/js/chosen/LICENSE.md
+++ /dev/null
@@ -1,24 +0,0 @@
-# Chosen, a Select Box Enhancer for jQuery and Protoype
-## by Patrick Filler for [Harvest](http://getharvest.com)
-
-Available for use under the [MIT License](http://en.wikipedia.org/wiki/MIT_License)
-
-Copyright (c) 2011 by Harvest
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE. \ No newline at end of file
diff --git a/3rdparty/js/chosen/README.md b/3rdparty/js/chosen/README.md
deleted file mode 100644
index cee8ed1cc08..00000000000
--- a/3rdparty/js/chosen/README.md
+++ /dev/null
@@ -1,46 +0,0 @@
-# Chosen
-
-Chosen is a library for making long, unwieldy select boxes more user friendly.
-
-- jQuery support: 1.4+
-- Prototype support: 1.7+
-
-For documentation, usage, and examples, see:
-http://harvesthq.github.com/chosen
-
-### Contributing to Chosen
-
-Contributions and pull requests are very welcome. Please follow these guidelines when submitting new code.
-
-1. Make all changes in Coffeescript files, **not** JavaScript files.
-2. For feature changes, update both jQuery *and* Prototype versions
-3. Use 'cake build' to generate Chosen's JavaScript file and minified version.
-4. Don't touch the VERSION file
-5. Submit a Pull Request using GitHub.
-
-### Using CoffeeScript & Cake
-
-First, make sure you have the proper CoffeeScript / Cake set-up in place.
-
-1. Install Coffeescript: the [CoffeeScript documentation](http://jashkenas.github.com/coffee-script/) provides easy-to-follow instructions.
-2. Install UglifyJS: <code>npm -g install uglify-js</code>
-3. Verify that your $NODE_PATH is properly configured using <code>echo $NODE_PATH</code>
-
-Once you're configured, building the JavasScript from the command line is easy:
-
- cake build # build Chosen from source
- cake watch # watch coffee/ for changes and build Chosen
-
-If you're interested, you can find the recipes in Cakefile.
-
-
-### Chosen Credits
-
-- Built by [Harvest](http://www.getharvest.com/)
-- Concept and development by [Patrick Filler](http://www.patrickfiller.com/)
-- Design and CSS by [Matthew Lettini](http://matthewlettini.com/)
-
-### Notable Forks
-
-- [Chosen for MooTools](https://github.com/julesjanssen/chosen), by Jules Janssen
-- [Chosen Drupal 7 Module](https://github.com/Polzme/chosen), by Pol Dell'Aiera \ No newline at end of file
diff --git a/3rdparty/js/chosen/VERSION b/3rdparty/js/chosen/VERSION
deleted file mode 100644
index b5d0ec558fd..00000000000
--- a/3rdparty/js/chosen/VERSION
+++ /dev/null
@@ -1 +0,0 @@
-0.9.8 \ No newline at end of file
diff --git a/3rdparty/js/chosen/chosen.jquery.js b/3rdparty/js/chosen/chosen.jquery.js
deleted file mode 100755
index d1edb08787c..00000000000
--- a/3rdparty/js/chosen/chosen.jquery.js
+++ /dev/null
@@ -1,952 +0,0 @@
-// Chosen, a Select Box Enhancer for jQuery and Protoype
-// by Patrick Filler for Harvest, http://getharvest.com
-//
-// Version 0.9.8
-// Full source at https://github.com/harvesthq/chosen
-// Copyright (c) 2011 Harvest http://getharvest.com
-
-// MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
-// This file is generated by `cake build`, do not edit it by hand.
-(function() {
- var SelectParser;
-
- SelectParser = (function() {
-
- function SelectParser() {
- this.options_index = 0;
- this.parsed = [];
- }
-
- SelectParser.prototype.add_node = function(child) {
- if (child.nodeName === "OPTGROUP") {
- return this.add_group(child);
- } else {
- return this.add_option(child);
- }
- };
-
- SelectParser.prototype.add_group = function(group) {
- var group_position, option, _i, _len, _ref, _results;
- group_position = this.parsed.length;
- this.parsed.push({
- array_index: group_position,
- group: true,
- label: group.label,
- children: 0,
- disabled: group.disabled
- });
- _ref = group.childNodes;
- _results = [];
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- option = _ref[_i];
- _results.push(this.add_option(option, group_position, group.disabled));
- }
- return _results;
- };
-
- SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
- if (option.nodeName === "OPTION") {
- if (option.text !== "") {
- if (group_position != null) this.parsed[group_position].children += 1;
- this.parsed.push({
- array_index: this.parsed.length,
- options_index: this.options_index,
- value: option.value,
- text: option.text,
- html: option.innerHTML,
- selected: option.selected,
- disabled: group_disabled === true ? group_disabled : option.disabled,
- group_array_index: group_position,
- classes: option.className,
- style: option.style.cssText
- });
- } else {
- this.parsed.push({
- array_index: this.parsed.length,
- options_index: this.options_index,
- empty: true
- });
- }
- return this.options_index += 1;
- }
- };
-
- return SelectParser;
-
- })();
-
- SelectParser.select_to_array = function(select) {
- var child, parser, _i, _len, _ref;
- parser = new SelectParser();
- _ref = select.childNodes;
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- child = _ref[_i];
- parser.add_node(child);
- }
- return parser.parsed;
- };
-
- this.SelectParser = SelectParser;
-
-}).call(this);
-
-/*
-Chosen source: generate output using 'cake build'
-Copyright (c) 2011 by Harvest
-*/
-
-(function() {
- var AbstractChosen, root;
-
- root = this;
-
- AbstractChosen = (function() {
-
- function AbstractChosen(form_field, options) {
- this.form_field = form_field;
- this.options = options != null ? options : {};
- this.set_default_values();
- this.is_multiple = this.form_field.multiple;
- this.default_text_default = this.is_multiple ? "Select Some Options" : "Select an Option";
- this.setup();
- this.set_up_html();
- this.register_observers();
- this.finish_setup();
- }
-
- AbstractChosen.prototype.set_default_values = function() {
- var _this = this;
- this.click_test_action = function(evt) {
- return _this.test_active_click(evt);
- };
- this.activate_action = function(evt) {
- return _this.activate_field(evt);
- };
- this.active_field = false;
- this.mouse_on_container = false;
- this.results_showing = false;
- this.result_highlighted = null;
- this.result_single_selected = null;
- this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
- this.disable_search_threshold = this.options.disable_search_threshold || 0;
- this.search_contains = this.options.search_contains || false;
- this.choices = 0;
- return this.results_none_found = this.options.no_results_text || "No results match";
- };
-
- AbstractChosen.prototype.mouse_enter = function() {
- return this.mouse_on_container = true;
- };
-
- AbstractChosen.prototype.mouse_leave = function() {
- return this.mouse_on_container = false;
- };
-
- AbstractChosen.prototype.input_focus = function(evt) {
- var _this = this;
- if (!this.active_field) {
- return setTimeout((function() {
- return _this.container_mousedown();
- }), 50);
- }
- };
-
- AbstractChosen.prototype.input_blur = function(evt) {
- var _this = this;
- if (!this.mouse_on_container) {
- this.active_field = false;
- return setTimeout((function() {
- return _this.blur_test();
- }), 100);
- }
- };
-
- AbstractChosen.prototype.result_add_option = function(option) {
- var classes, style;
- if (!option.disabled) {
- option.dom_id = this.container_id + "_o_" + option.array_index;
- classes = option.selected && this.is_multiple ? [] : ["active-result"];
- if (option.selected) classes.push("result-selected");
- if (option.group_array_index != null) classes.push("group-option");
- if (option.classes !== "") classes.push(option.classes);
- style = option.style.cssText !== "" ? " style=\"" + option.style + "\"" : "";
- return '<li id="' + option.dom_id + '" class="' + classes.join(' ') + '"' + style + '>' + option.html + '</li>';
- } else {
- return "";
- }
- };
-
- AbstractChosen.prototype.results_update_field = function() {
- this.result_clear_highlight();
- this.result_single_selected = null;
- return this.results_build();
- };
-
- AbstractChosen.prototype.results_toggle = function() {
- if (this.results_showing) {
- return this.results_hide();
- } else {
- return this.results_show();
- }
- };
-
- AbstractChosen.prototype.results_search = function(evt) {
- if (this.results_showing) {
- return this.winnow_results();
- } else {
- return this.results_show();
- }
- };
-
- AbstractChosen.prototype.keyup_checker = function(evt) {
- var stroke, _ref;
- stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
- this.search_field_scale();
- switch (stroke) {
- case 8:
- if (this.is_multiple && this.backstroke_length < 1 && this.choices > 0) {
- return this.keydown_backstroke();
- } else if (!this.pending_backstroke) {
- this.result_clear_highlight();
- return this.results_search();
- }
- break;
- case 13:
- evt.preventDefault();
- if (this.results_showing) return this.result_select(evt);
- break;
- case 27:
- if (this.results_showing) this.results_hide();
- return true;
- case 9:
- case 38:
- case 40:
- case 16:
- case 91:
- case 17:
- break;
- default:
- return this.results_search();
- }
- };
-
- AbstractChosen.prototype.generate_field_id = function() {
- var new_id;
- new_id = this.generate_random_id();
- this.form_field.id = new_id;
- return new_id;
- };
-
- AbstractChosen.prototype.generate_random_char = function() {
- var chars, newchar, rand;
- chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ";
- rand = Math.floor(Math.random() * chars.length);
- return newchar = chars.substring(rand, rand + 1);
- };
-
- return AbstractChosen;
-
- })();
-
- root.AbstractChosen = AbstractChosen;
-
-}).call(this);
-
-/*
-Chosen source: generate output using 'cake build'
-Copyright (c) 2011 by Harvest
-*/
-
-(function() {
- var $, Chosen, get_side_border_padding, root,
- __hasProp = Object.prototype.hasOwnProperty,
- __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
-
- root = this;
-
- $ = jQuery;
-
- $.fn.extend({
- chosen: function(options) {
- if ($.browser.msie && ($.browser.version === "6.0" || $.browser.version === "7.0")) {
- return this;
- }
- return $(this).each(function(input_field) {
- if (!($(this)).hasClass("chzn-done")) return new Chosen(this, options);
- });
- }
- });
-
- Chosen = (function(_super) {
-
- __extends(Chosen, _super);
-
- function Chosen() {
- Chosen.__super__.constructor.apply(this, arguments);
- }
-
- Chosen.prototype.setup = function() {
- this.form_field_jq = $(this.form_field);
- return this.is_rtl = this.form_field_jq.hasClass("chzn-rtl");
- };
-
- Chosen.prototype.finish_setup = function() {
- return this.form_field_jq.addClass("chzn-done");
- };
-
- Chosen.prototype.set_up_html = function() {
- var container_div, dd_top, dd_width, sf_width;
- this.container_id = this.form_field.id.length ? this.form_field.id.replace(/(:|\.)/g, '_') : this.generate_field_id();
- this.container_id += "_chzn";
- this.f_width = this.form_field_jq.outerWidth();
- this.default_text = this.form_field_jq.data('placeholder') ? this.form_field_jq.data('placeholder') : this.default_text_default;
- container_div = $("<div />", {
- id: this.container_id,
- "class": "chzn-container" + (this.is_rtl ? ' chzn-rtl' : ''),
- style: 'width: ' + this.f_width + 'px;'
- });
- if (this.is_multiple) {
- container_div.html('<ul class="chzn-choices"><li class="search-field"><input type="text" value="' + this.default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>');
- } else {
- container_div.html('<a href="javascript:void(0)" class="chzn-single chzn-default"><span>' + this.default_text + '</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>');
- }
- this.form_field_jq.hide().after(container_div);
- this.container = $('#' + this.container_id);
- this.container.addClass("chzn-container-" + (this.is_multiple ? "multi" : "single"));
- this.dropdown = this.container.find('div.chzn-drop').first();
- dd_top = this.container.height();
- dd_width = this.f_width - get_side_border_padding(this.dropdown);
- this.dropdown.css({
- "width": dd_width + "px",
- "top": dd_top + "px"
- });
- this.search_field = this.container.find('input').first();
- this.search_results = this.container.find('ul.chzn-results').first();
- this.search_field_scale();
- this.search_no_results = this.container.find('li.no-results').first();
- if (this.is_multiple) {
- this.search_choices = this.container.find('ul.chzn-choices').first();
- this.search_container = this.container.find('li.search-field').first();
- } else {
- this.search_container = this.container.find('div.chzn-search').first();
- this.selected_item = this.container.find('.chzn-single').first();
- sf_width = dd_width - get_side_border_padding(this.search_container) - get_side_border_padding(this.search_field);
- this.search_field.css({
- "width": sf_width + "px"
- });
- }
- this.results_build();
- this.set_tab_index();
- return this.form_field_jq.trigger("liszt:ready", {
- chosen: this
- });
- };
-
- Chosen.prototype.register_observers = function() {
- var _this = this;
- this.container.mousedown(function(evt) {
- return _this.container_mousedown(evt);
- });
- this.container.mouseup(function(evt) {
- return _this.container_mouseup(evt);
- });
- this.container.mouseenter(function(evt) {
- return _this.mouse_enter(evt);
- });
- this.container.mouseleave(function(evt) {
- return _this.mouse_leave(evt);
- });
- this.search_results.mouseup(function(evt) {
- return _this.search_results_mouseup(evt);
- });
- this.search_results.mouseover(function(evt) {
- return _this.search_results_mouseover(evt);
- });
- this.search_results.mouseout(function(evt) {
- return _this.search_results_mouseout(evt);
- });
- this.form_field_jq.bind("liszt:updated", function(evt) {
- return _this.results_update_field(evt);
- });
- this.search_field.blur(function(evt) {
- return _this.input_blur(evt);
- });
- this.search_field.keyup(function(evt) {
- return _this.keyup_checker(evt);
- });
- this.search_field.keydown(function(evt) {
- return _this.keydown_checker(evt);
- });
- if (this.is_multiple) {
- this.search_choices.click(function(evt) {
- return _this.choices_click(evt);
- });
- return this.search_field.focus(function(evt) {
- return _this.input_focus(evt);
- });
- } else {
- return this.container.click(function(evt) {
- return evt.preventDefault();
- });
- }
- };
-
- Chosen.prototype.search_field_disabled = function() {
- this.is_disabled = this.form_field_jq[0].disabled;
- if (this.is_disabled) {
- this.container.addClass('chzn-disabled');
- this.search_field[0].disabled = true;
- if (!this.is_multiple) {
- this.selected_item.unbind("focus", this.activate_action);
- }
- return this.close_field();
- } else {
- this.container.removeClass('chzn-disabled');
- this.search_field[0].disabled = false;
- if (!this.is_multiple) {
- return this.selected_item.bind("focus", this.activate_action);
- }
- }
- };
-
- Chosen.prototype.container_mousedown = function(evt) {
- var target_closelink;
- if (!this.is_disabled) {
- target_closelink = evt != null ? ($(evt.target)).hasClass("search-choice-close") : false;
- if (evt && evt.type === "mousedown" && !this.results_showing) {
- evt.stopPropagation();
- }
- if (!this.pending_destroy_click && !target_closelink) {
- if (!this.active_field) {
- if (this.is_multiple) this.search_field.val("");
- $(document).click(this.click_test_action);
- this.results_show();
- } else if (!this.is_multiple && evt && (($(evt.target)[0] === this.selected_item[0]) || $(evt.target).parents("a.chzn-single").length)) {
- evt.preventDefault();
- this.results_toggle();
- }
- return this.activate_field();
- } else {
- return this.pending_destroy_click = false;
- }
- }
- };
-
- Chosen.prototype.container_mouseup = function(evt) {
- if (evt.target.nodeName === "ABBR") return this.results_reset(evt);
- };
-
- Chosen.prototype.blur_test = function(evt) {
- if (!this.active_field && this.container.hasClass("chzn-container-active")) {
- return this.close_field();
- }
- };
-
- Chosen.prototype.close_field = function() {
- $(document).unbind("click", this.click_test_action);
- if (!this.is_multiple) {
- this.selected_item.attr("tabindex", this.search_field.attr("tabindex"));
- this.search_field.attr("tabindex", -1);
- }
- this.active_field = false;
- this.results_hide();
- this.container.removeClass("chzn-container-active");
- this.winnow_results_clear();
- this.clear_backstroke();
- this.show_search_field_default();
- return this.search_field_scale();
- };
-
- Chosen.prototype.activate_field = function() {
- if (!this.is_multiple && !this.active_field) {
- this.search_field.attr("tabindex", this.selected_item.attr("tabindex"));
- this.selected_item.attr("tabindex", -1);
- }
- this.container.addClass("chzn-container-active");
- this.active_field = true;
- this.search_field.val(this.search_field.val());
- return this.search_field.focus();
- };
-
- Chosen.prototype.test_active_click = function(evt) {
- if ($(evt.target).parents('#' + this.container_id).length) {
- return this.active_field = true;
- } else {
- return this.close_field();
- }
- };
-
- Chosen.prototype.results_build = function() {
- var content, data, _i, _len, _ref;
- this.parsing = true;
- this.results_data = root.SelectParser.select_to_array(this.form_field);
- if (this.is_multiple && this.choices > 0) {
- this.search_choices.find("li.search-choice").remove();
- this.choices = 0;
- } else if (!this.is_multiple) {
- this.selected_item.find("span").text(this.default_text);
- if (this.form_field.options.length <= this.disable_search_threshold) {
- this.container.addClass("chzn-container-single-nosearch");
- } else {
- this.container.removeClass("chzn-container-single-nosearch");
- }
- }
- content = '';
- _ref = this.results_data;
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- data = _ref[_i];
- if (data.group) {
- content += this.result_add_group(data);
- } else if (!data.empty) {
- content += this.result_add_option(data);
- if (data.selected && this.is_multiple) {
- this.choice_build(data);
- } else if (data.selected && !this.is_multiple) {
- this.selected_item.removeClass("chzn-default").find("span").text(data.text);
- if (this.allow_single_deselect) this.single_deselect_control_build();
- }
- }
- }
- this.search_field_disabled();
- this.show_search_field_default();
- this.search_field_scale();
- this.search_results.html(content);
- return this.parsing = false;
- };
-
- Chosen.prototype.result_add_group = function(group) {
- if (!group.disabled) {
- group.dom_id = this.container_id + "_g_" + group.array_index;
- return '<li id="' + group.dom_id + '" class="group-result">' + $("<div />").text(group.label).html() + '</li>';
- } else {
- return "";
- }
- };
-
- Chosen.prototype.result_do_highlight = function(el) {
- var high_bottom, high_top, maxHeight, visible_bottom, visible_top;
- if (el.length) {
- this.result_clear_highlight();
- this.result_highlight = el;
- this.result_highlight.addClass("highlighted");
- maxHeight = parseInt(this.search_results.css("maxHeight"), 10);
- visible_top = this.search_results.scrollTop();
- visible_bottom = maxHeight + visible_top;
- high_top = this.result_highlight.position().top + this.search_results.scrollTop();
- high_bottom = high_top + this.result_highlight.outerHeight();
- if (high_bottom >= visible_bottom) {
- return this.search_results.scrollTop((high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0);
- } else if (high_top < visible_top) {
- return this.search_results.scrollTop(high_top);
- }
- }
- };
-
- Chosen.prototype.result_clear_highlight = function() {
- if (this.result_highlight) this.result_highlight.removeClass("highlighted");
- return this.result_highlight = null;
- };
-
- Chosen.prototype.results_show = function() {
- var dd_top;
- if (!this.is_multiple) {
- this.selected_item.addClass("chzn-single-with-drop");
- if (this.result_single_selected) {
- this.result_do_highlight(this.result_single_selected);
- }
- }
- dd_top = this.is_multiple ? this.container.height() : this.container.height() - 1;
- this.dropdown.css({
- "top": dd_top + "px",
- "left": 0
- });
- this.results_showing = true;
- this.search_field.focus();
- this.search_field.val(this.search_field.val());
- return this.winnow_results();
- };
-
- Chosen.prototype.results_hide = function() {
- if (!this.is_multiple) {
- this.selected_item.removeClass("chzn-single-with-drop");
- }
- this.result_clear_highlight();
- this.dropdown.css({
- "left": "-9000px"
- });
- return this.results_showing = false;
- };
-
- Chosen.prototype.set_tab_index = function(el) {
- var ti;
- if (this.form_field_jq.attr("tabindex")) {
- ti = this.form_field_jq.attr("tabindex");
- this.form_field_jq.attr("tabindex", -1);
- if (this.is_multiple) {
- return this.search_field.attr("tabindex", ti);
- } else {
- this.selected_item.attr("tabindex", ti);
- return this.search_field.attr("tabindex", -1);
- }
- }
- };
-
- Chosen.prototype.show_search_field_default = function() {
- if (this.is_multiple && this.choices < 1 && !this.active_field) {
- this.search_field.val(this.default_text);
- return this.search_field.addClass("default");
- } else {
- this.search_field.val("");
- return this.search_field.removeClass("default");
- }
- };
-
- Chosen.prototype.search_results_mouseup = function(evt) {
- var target;
- target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
- if (target.length) {
- this.result_highlight = target;
- return this.result_select(evt);
- }
- };
-
- Chosen.prototype.search_results_mouseover = function(evt) {
- var target;
- target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
- if (target) return this.result_do_highlight(target);
- };
-
- Chosen.prototype.search_results_mouseout = function(evt) {
- if ($(evt.target).hasClass("active-result" || $(evt.target).parents('.active-result').first())) {
- return this.result_clear_highlight();
- }
- };
-
- Chosen.prototype.choices_click = function(evt) {
- evt.preventDefault();
- if (this.active_field && !($(evt.target).hasClass("search-choice" || $(evt.target).parents('.search-choice').first)) && !this.results_showing) {
- return this.results_show();
- }
- };
-
- Chosen.prototype.choice_build = function(item) {
- var choice_id, link,
- _this = this;
- choice_id = this.container_id + "_c_" + item.array_index;
- this.choices += 1;
- this.search_container.before('<li class="search-choice" id="' + choice_id + '"><span>' + item.html + '</span><a href="javascript:void(0)" class="search-choice-close" rel="' + item.array_index + '"></a></li>');
- link = $('#' + choice_id).find("a").first();
- return link.click(function(evt) {
- return _this.choice_destroy_link_click(evt);
- });
- };
-
- Chosen.prototype.choice_destroy_link_click = function(evt) {
- evt.preventDefault();
- if (!this.is_disabled) {
- this.pending_destroy_click = true;
- return this.choice_destroy($(evt.target));
- } else {
- return evt.stopPropagation;
- }
- };
-
- Chosen.prototype.choice_destroy = function(link) {
- this.choices -= 1;
- this.show_search_field_default();
- if (this.is_multiple && this.choices > 0 && this.search_field.val().length < 1) {
- this.results_hide();
- }
- this.result_deselect(link.attr("rel"));
- return link.parents('li').first().remove();
- };
-
- Chosen.prototype.results_reset = function(evt) {
- this.form_field.options[0].selected = true;
- this.selected_item.find("span").text(this.default_text);
- if (!this.is_multiple) this.selected_item.addClass("chzn-default");
- this.show_search_field_default();
- $(evt.target).remove();
- this.form_field_jq.trigger("change");
- if (this.active_field) return this.results_hide();
- };
-
- Chosen.prototype.result_select = function(evt) {
- var high, high_id, item, position;
- if (this.result_highlight) {
- high = this.result_highlight;
- high_id = high.attr("id");
- this.result_clear_highlight();
- if (this.is_multiple) {
- this.result_deactivate(high);
- } else {
- this.search_results.find(".result-selected").removeClass("result-selected");
- this.result_single_selected = high;
- this.selected_item.removeClass("chzn-default");
- }
- high.addClass("result-selected");
- position = high_id.substr(high_id.lastIndexOf("_") + 1);
- item = this.results_data[position];
- item.selected = true;
- this.form_field.options[item.options_index].selected = true;
- if (this.is_multiple) {
- this.choice_build(item);
- } else {
- this.selected_item.find("span").first().text(item.text);
- if (this.allow_single_deselect) this.single_deselect_control_build();
- }
- if (!(evt.metaKey && this.is_multiple)) this.results_hide();
- this.search_field.val("");
- this.form_field_jq.trigger("change");
- return this.search_field_scale();
- }
- };
-
- Chosen.prototype.result_activate = function(el) {
- return el.addClass("active-result");
- };
-
- Chosen.prototype.result_deactivate = function(el) {
- return el.removeClass("active-result");
- };
-
- Chosen.prototype.result_deselect = function(pos) {
- var result, result_data;
- result_data = this.results_data[pos];
- result_data.selected = false;
- this.form_field.options[result_data.options_index].selected = false;
- result = $("#" + this.container_id + "_o_" + pos);
- result.removeClass("result-selected").addClass("active-result").show();
- this.result_clear_highlight();
- this.winnow_results();
- this.form_field_jq.trigger("change");
- return this.search_field_scale();
- };
-
- Chosen.prototype.single_deselect_control_build = function() {
- if (this.allow_single_deselect && this.selected_item.find("abbr").length < 1) {
- return this.selected_item.find("span").first().after("<abbr class=\"search-choice-close\"></abbr>");
- }
- };
-
- Chosen.prototype.winnow_results = function() {
- var found, option, part, parts, regex, regexAnchor, result, result_id, results, searchText, startpos, text, zregex, _i, _j, _len, _len2, _ref;
- this.no_results_clear();
- results = 0;
- searchText = this.search_field.val() === this.default_text ? "" : $('<div/>').text($.trim(this.search_field.val())).html();
- regexAnchor = this.search_contains ? "" : "^";
- regex = new RegExp(regexAnchor + searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i');
- zregex = new RegExp(searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i');
- _ref = this.results_data;
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- option = _ref[_i];
- if (!option.disabled && !option.empty) {
- if (option.group) {
- $('#' + option.dom_id).css('display', 'none');
- } else if (!(this.is_multiple && option.selected)) {
- found = false;
- result_id = option.dom_id;
- result = $("#" + result_id);
- if (regex.test(option.html)) {
- found = true;
- results += 1;
- } else if (option.html.indexOf(" ") >= 0 || option.html.indexOf("[") === 0) {
- parts = option.html.replace(/\[|\]/g, "").split(" ");
- if (parts.length) {
- for (_j = 0, _len2 = parts.length; _j < _len2; _j++) {
- part = parts[_j];
- if (regex.test(part)) {
- found = true;
- results += 1;
- }
- }
- }
- }
- if (found) {
- if (searchText.length) {
- startpos = option.html.search(zregex);
- text = option.html.substr(0, startpos + searchText.length) + '</em>' + option.html.substr(startpos + searchText.length);
- text = text.substr(0, startpos) + '<em>' + text.substr(startpos);
- } else {
- text = option.html;
- }
- result.html(text);
- this.result_activate(result);
- if (option.group_array_index != null) {
- $("#" + this.results_data[option.group_array_index].dom_id).css('display', 'list-item');
- }
- } else {
- if (this.result_highlight && result_id === this.result_highlight.attr('id')) {
- this.result_clear_highlight();
- }
- this.result_deactivate(result);
- }
- }
- }
- }
- if (results < 1 && searchText.length) {
- return this.no_results(searchText);
- } else {
- return this.winnow_results_set_highlight();
- }
- };
-
- Chosen.prototype.winnow_results_clear = function() {
- var li, lis, _i, _len, _results;
- this.search_field.val("");
- lis = this.search_results.find("li");
- _results = [];
- for (_i = 0, _len = lis.length; _i < _len; _i++) {
- li = lis[_i];
- li = $(li);
- if (li.hasClass("group-result")) {
- _results.push(li.css('display', 'auto'));
- } else if (!this.is_multiple || !li.hasClass("result-selected")) {
- _results.push(this.result_activate(li));
- } else {
- _results.push(void 0);
- }
- }
- return _results;
- };
-
- Chosen.prototype.winnow_results_set_highlight = function() {
- var do_high, selected_results;
- if (!this.result_highlight) {
- selected_results = !this.is_multiple ? this.search_results.find(".result-selected.active-result") : [];
- do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first();
- if (do_high != null) return this.result_do_highlight(do_high);
- }
- };
-
- Chosen.prototype.no_results = function(terms) {
- var no_results_html;
- no_results_html = $('<li class="no-results">' + this.results_none_found + ' "<span></span>"</li>');
- no_results_html.find("span").first().html(terms);
- return this.search_results.append(no_results_html);
- };
-
- Chosen.prototype.no_results_clear = function() {
- return this.search_results.find(".no-results").remove();
- };
-
- Chosen.prototype.keydown_arrow = function() {
- var first_active, next_sib;
- if (!this.result_highlight) {
- first_active = this.search_results.find("li.active-result").first();
- if (first_active) this.result_do_highlight($(first_active));
- } else if (this.results_showing) {
- next_sib = this.result_highlight.nextAll("li.active-result").first();
- if (next_sib) this.result_do_highlight(next_sib);
- }
- if (!this.results_showing) return this.results_show();
- };
-
- Chosen.prototype.keyup_arrow = function() {
- var prev_sibs;
- if (!this.results_showing && !this.is_multiple) {
- return this.results_show();
- } else if (this.result_highlight) {
- prev_sibs = this.result_highlight.prevAll("li.active-result");
- if (prev_sibs.length) {
- return this.result_do_highlight(prev_sibs.first());
- } else {
- if (this.choices > 0) this.results_hide();
- return this.result_clear_highlight();
- }
- }
- };
-
- Chosen.prototype.keydown_backstroke = function() {
- if (this.pending_backstroke) {
- this.choice_destroy(this.pending_backstroke.find("a").first());
- return this.clear_backstroke();
- } else {
- this.pending_backstroke = this.search_container.siblings("li.search-choice").last();
- return this.pending_backstroke.addClass("search-choice-focus");
- }
- };
-
- Chosen.prototype.clear_backstroke = function() {
- if (this.pending_backstroke) {
- this.pending_backstroke.removeClass("search-choice-focus");
- }
- return this.pending_backstroke = null;
- };
-
- Chosen.prototype.keydown_checker = function(evt) {
- var stroke, _ref;
- stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
- this.search_field_scale();
- if (stroke !== 8 && this.pending_backstroke) this.clear_backstroke();
- switch (stroke) {
- case 8:
- this.backstroke_length = this.search_field.val().length;
- break;
- case 9:
- if (this.results_showing && !this.is_multiple) this.result_select(evt);
- this.mouse_on_container = false;
- break;
- case 13:
- evt.preventDefault();
- break;
- case 38:
- evt.preventDefault();
- this.keyup_arrow();
- break;
- case 40:
- this.keydown_arrow();
- break;
- }
- };
-
- Chosen.prototype.search_field_scale = function() {
- var dd_top, div, h, style, style_block, styles, w, _i, _len;
- if (this.is_multiple) {
- h = 0;
- w = 0;
- style_block = "position:absolute; left: -1000px; top: -1000px; display:none;";
- styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing'];
- for (_i = 0, _len = styles.length; _i < _len; _i++) {
- style = styles[_i];
- style_block += style + ":" + this.search_field.css(style) + ";";
- }
- div = $('<div />', {
- 'style': style_block
- });
- div.text(this.search_field.val());
- $('body').append(div);
- w = div.width() + 25;
- div.remove();
- if (w > this.f_width - 10) w = this.f_width - 10;
- this.search_field.css({
- 'width': w + 'px'
- });
- dd_top = this.container.height();
- return this.dropdown.css({
- "top": dd_top + "px"
- });
- }
- };
-
- Chosen.prototype.generate_random_id = function() {
- var string;
- string = "sel" + this.generate_random_char() + this.generate_random_char() + this.generate_random_char();
- while ($("#" + string).length > 0) {
- string += this.generate_random_char();
- }
- return string;
- };
-
- return Chosen;
-
- })(AbstractChosen);
-
- get_side_border_padding = function(elmt) {
- var side_border_padding;
- return side_border_padding = elmt.outerWidth() - elmt.width();
- };
-
- root.get_side_border_padding = get_side_border_padding;
-
-}).call(this);
diff --git a/3rdparty/js/chosen/chosen.jquery.min.js b/3rdparty/js/chosen/chosen.jquery.min.js
deleted file mode 100755
index 9ba164cc47a..00000000000
--- a/3rdparty/js/chosen/chosen.jquery.min.js
+++ /dev/null
@@ -1,10 +0,0 @@
-// Chosen, a Select Box Enhancer for jQuery and Protoype
-// by Patrick Filler for Harvest, http://getharvest.com
-//
-// Version 0.9.8
-// Full source at https://github.com/harvesthq/chosen
-// Copyright (c) 2011 Harvest http://getharvest.com
-
-// MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
-// This file is generated by `cake build`, do not edit it by hand.
-((function(){var a;a=function(){function a(){this.options_index=0,this.parsed=[]}return a.prototype.add_node=function(a){return a.nodeName==="OPTGROUP"?this.add_group(a):this.add_option(a)},a.prototype.add_group=function(a){var b,c,d,e,f,g;b=this.parsed.length,this.parsed.push({array_index:b,group:!0,label:a.label,children:0,disabled:a.disabled}),f=a.childNodes,g=[];for(d=0,e=f.length;d<e;d++)c=f[d],g.push(this.add_option(c,b,a.disabled));return g},a.prototype.add_option=function(a,b,c){if(a.nodeName==="OPTION")return a.text!==""?(b!=null&&(this.parsed[b].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:a.value,text:a.text,html:a.innerHTML,selected:a.selected,disabled:c===!0?c:a.disabled,group_array_index:b,classes:a.className,style:a.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1},a}(),a.select_to_array=function(b){var c,d,e,f,g;d=new a,g=b.childNodes;for(e=0,f=g.length;e<f;e++)c=g[e],d.add_node(c);return d.parsed},this.SelectParser=a})).call(this),function(){var a,b;b=this,a=function(){function a(a,b){this.form_field=a,this.options=b!=null?b:{},this.set_default_values(),this.is_multiple=this.form_field.multiple,this.default_text_default=this.is_multiple?"Select Some Options":"Select an Option",this.setup(),this.set_up_html(),this.register_observers(),this.finish_setup()}return a.prototype.set_default_values=function(){var a=this;return this.click_test_action=function(b){return a.test_active_click(b)},this.activate_action=function(b){return a.activate_field(b)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.result_single_selected=null,this.allow_single_deselect=this.options.allow_single_deselect!=null&&this.form_field.options[0]!=null&&this.form_field.options[0].text===""?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.search_contains=this.options.search_contains||!1,this.choices=0,this.results_none_found=this.options.no_results_text||"No results match"},a.prototype.mouse_enter=function(){return this.mouse_on_container=!0},a.prototype.mouse_leave=function(){return this.mouse_on_container=!1},a.prototype.input_focus=function(a){var b=this;if(!this.active_field)return setTimeout(function(){return b.container_mousedown()},50)},a.prototype.input_blur=function(a){var b=this;if(!this.mouse_on_container)return this.active_field=!1,setTimeout(function(){return b.blur_test()},100)},a.prototype.result_add_option=function(a){var b,c;return a.disabled?"":(a.dom_id=this.container_id+"_o_"+a.array_index,b=a.selected&&this.is_multiple?[]:["active-result"],a.selected&&b.push("result-selected"),a.group_array_index!=null&&b.push("group-option"),a.classes!==""&&b.push(a.classes),c=a.style.cssText!==""?' style="'+a.style+'"':"",'<li id="'+a.dom_id+'" class="'+b.join(" ")+'"'+c+">"+a.html+"</li>")},a.prototype.results_update_field=function(){return this.result_clear_highlight(),this.result_single_selected=null,this.results_build()},a.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},a.prototype.results_search=function(a){return this.results_showing?this.winnow_results():this.results_show()},a.prototype.keyup_checker=function(a){var b,c;b=(c=a.which)!=null?c:a.keyCode,this.search_field_scale();switch(b){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:a.preventDefault();if(this.results_showing)return this.result_select(a);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},a.prototype.generate_field_id=function(){var a;return a=this.generate_random_id(),this.form_field.id=a,a},a.prototype.generate_random_char=function(){var a,b,c;return a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ",c=Math.floor(Math.random()*a.length),b=a.substring(c,c+1)},a}(),b.AbstractChosen=a}.call(this),function(){var a,b,c,d,e=Object.prototype.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};d=this,a=jQuery,a.fn.extend({chosen:function(c){return!a.browser.msie||a.browser.version!=="6.0"&&a.browser.version!=="7.0"?a(this).each(function(d){if(!a(this).hasClass("chzn-done"))return new b(this,c)}):this}}),b=function(b){function e(){e.__super__.constructor.apply(this,arguments)}return f(e,b),e.prototype.setup=function(){return this.form_field_jq=a(this.form_field),this.is_rtl=this.form_field_jq.hasClass("chzn-rtl")},e.prototype.finish_setup=function(){return this.form_field_jq.addClass("chzn-done")},e.prototype.set_up_html=function(){var b,d,e,f;return this.container_id=this.form_field.id.length?this.form_field.id.replace(/(:|\.)/g,"_"):this.generate_field_id(),this.container_id+="_chzn",this.f_width=this.form_field_jq.outerWidth(),this.default_text=this.form_field_jq.data("placeholder")?this.form_field_jq.data("placeholder"):this.default_text_default,b=a("<div />",{id:this.container_id,"class":"chzn-container"+(this.is_rtl?" chzn-rtl":""),style:"width: "+this.f_width+"px;"}),this.is_multiple?b.html('<ul class="chzn-choices"><li class="search-field"><input type="text" value="'+this.default_text+'" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>'):b.html('<a href="javascript:void(0)" class="chzn-single chzn-default"><span>'+this.default_text+'</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>'),this.form_field_jq.hide().after(b),this.container=a("#"+this.container_id),this.container.addClass("chzn-container-"+(this.is_multiple?"multi":"single")),this.dropdown=this.container.find("div.chzn-drop").first(),d=this.container.height(),e=this.f_width-c(this.dropdown),this.dropdown.css({width:e+"px",top:d+"px"}),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chzn-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chzn-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chzn-search").first(),this.selected_item=this.container.find(".chzn-single").first(),f=e-c(this.search_container)-c(this.search_field),this.search_field.css({width:f+"px"})),this.results_build(),this.set_tab_index(),this.form_field_jq.trigger("liszt:ready",{chosen:this})},e.prototype.register_observers=function(){var a=this;return this.container.mousedown(function(b){return a.container_mousedown(b)}),this.container.mouseup(function(b){return a.container_mouseup(b)}),this.container.mouseenter(function(b){return a.mouse_enter(b)}),this.container.mouseleave(function(b){return a.mouse_leave(b)}),this.search_results.mouseup(function(b){return a.search_results_mouseup(b)}),this.search_results.mouseover(function(b){return a.search_results_mouseover(b)}),this.search_results.mouseout(function(b){return a.search_results_mouseout(b)}),this.form_field_jq.bind("liszt:updated",function(b){return a.results_update_field(b)}),this.search_field.blur(function(b){return a.input_blur(b)}),this.search_field.keyup(function(b){return a.keyup_checker(b)}),this.search_field.keydown(function(b){return a.keydown_checker(b)}),this.is_multiple?(this.search_choices.click(function(b){return a.choices_click(b)}),this.search_field.focus(function(b){return a.input_focus(b)})):this.container.click(function(a){return a.preventDefault()})},e.prototype.search_field_disabled=function(){this.is_disabled=this.form_field_jq[0].disabled;if(this.is_disabled)return this.container.addClass("chzn-disabled"),this.search_field[0].disabled=!0,this.is_multiple||this.selected_item.unbind("focus",this.activate_action),this.close_field();this.container.removeClass("chzn-disabled"),this.search_field[0].disabled=!1;if(!this.is_multiple)return this.selected_item.bind("focus",this.activate_action)},e.prototype.container_mousedown=function(b){var c;if(!this.is_disabled)return c=b!=null?a(b.target).hasClass("search-choice-close"):!1,b&&b.type==="mousedown"&&!this.results_showing&&b.stopPropagation(),!this.pending_destroy_click&&!c?(this.active_field?!this.is_multiple&&b&&(a(b.target)[0]===this.selected_item[0]||a(b.target).parents("a.chzn-single").length)&&(b.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),a(document).click(this.click_test_action),this.results_show()),this.activate_field()):this.pending_destroy_click=!1},e.prototype.container_mouseup=function(a){if(a.target.nodeName==="ABBR")return this.results_reset(a)},e.prototype.blur_test=function(a){if(!this.active_field&&this.container.hasClass("chzn-container-active"))return this.close_field()},e.prototype.close_field=function(){return a(document).unbind("click",this.click_test_action),this.is_multiple||(this.selected_item.attr("tabindex",this.search_field.attr("tabindex")),this.search_field.attr("tabindex",-1)),this.active_field=!1,this.results_hide(),this.container.removeClass("chzn-container-active"),this.winnow_results_clear(),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},e.prototype.activate_field=function(){return!this.is_multiple&&!this.active_field&&(this.search_field.attr("tabindex",this.selected_item.attr("tabindex")),this.selected_item.attr("tabindex",-1)),this.container.addClass("chzn-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},e.prototype.test_active_click=function(b){return a(b.target).parents("#"+this.container_id).length?this.active_field=!0:this.close_field()},e.prototype.results_build=function(){var a,b,c,e,f;this.parsing=!0,this.results_data=d.SelectParser.select_to_array(this.form_field),this.is_multiple&&this.choices>0?(this.search_choices.find("li.search-choice").remove(),this.choices=0):this.is_multiple||(this.selected_item.find("span").text(this.default_text),this.form_field.options.length<=this.disable_search_threshold?this.container.addClass("chzn-container-single-nosearch"):this.container.removeClass("chzn-container-single-nosearch")),a="",f=this.results_data;for(c=0,e=f.length;c<e;c++)b=f[c],b.group?a+=this.result_add_group(b):b.empty||(a+=this.result_add_option(b),b.selected&&this.is_multiple?this.choice_build(b):b.selected&&!this.is_multiple&&(this.selected_item.removeClass("chzn-default").find("span").text(b.text),this.allow_single_deselect&&this.single_deselect_control_build()));return this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.search_results.html(a),this.parsing=!1},e.prototype.result_add_group=function(b){return b.disabled?"":(b.dom_id=this.container_id+"_g_"+b.array_index,'<li id="'+b.dom_id+'" class="group-result">'+a("<div />").text(b.label).html()+"</li>")},e.prototype.result_do_highlight=function(a){var b,c,d,e,f;if(a.length){this.result_clear_highlight(),this.result_highlight=a,this.result_highlight.addClass("highlighted"),d=parseInt(this.search_results.css("maxHeight"),10),f=this.search_results.scrollTop(),e=d+f,c=this.result_highlight.position().top+this.search_results.scrollTop(),b=c+this.result_highlight.outerHeight();if(b>=e)return this.search_results.scrollTop(b-d>0?b-d:0);if(c<f)return this.search_results.scrollTop(c)}},e.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},e.prototype.results_show=function(){var a;return this.is_multiple||(this.selected_item.addClass("chzn-single-with-drop"),this.result_single_selected&&this.result_do_highlight(this.result_single_selected)),a=this.is_multiple?this.container.height():this.container.height()-1,this.dropdown.css({top:a+"px",left:0}),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.search_field.val()),this.winnow_results()},e.prototype.results_hide=function(){return this.is_multiple||this.selected_item.removeClass("chzn-single-with-drop"),this.result_clear_highlight(),this.dropdown.css({left:"-9000px"}),this.results_showing=!1},e.prototype.set_tab_index=function(a){var b;if(this.form_field_jq.attr("tabindex"))return b=this.form_field_jq.attr("tabindex"),this.form_field_jq.attr("tabindex",-1),this.is_multiple?this.search_field.attr("tabindex",b):(this.selected_item.attr("tabindex",b),this.search_field.attr("tabindex",-1))},e.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},e.prototype.search_results_mouseup=function(b){var c;c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first();if(c.length)return this.result_highlight=c,this.result_select(b)},e.prototype.search_results_mouseover=function(b){var c;c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first();if(c)return this.result_do_highlight(c)},e.prototype.search_results_mouseout=function(b){if(a(b.target).hasClass("active-result"))return this.result_clear_highlight()},e.prototype.choices_click=function(b){b.preventDefault();if(this.active_field&&!a(b.target).hasClass("search-choice")&&!this.results_showing)return this.results_show()},e.prototype.choice_build=function(b){var c,d,e=this;return c=this.container_id+"_c_"+b.array_index,this.choices+=1,this.search_container.before('<li class="search-choice" id="'+c+'"><span>'+b.html+'</span><a href="javascript:void(0)" class="search-choice-close" rel="'+b.array_index+'"></a></li>'),d=a("#"+c).find("a").first(),d.click(function(a){return e.choice_destroy_link_click(a)})},e.prototype.choice_destroy_link_click=function(b){return b.preventDefault(),this.is_disabled?b.stopPropagation:(this.pending_destroy_click=!0,this.choice_destroy(a(b.target)))},e.prototype.choice_destroy=function(a){return this.choices-=1,this.show_search_field_default(),this.is_multiple&&this.choices>0&&this.search_field.val().length<1&&this.results_hide(),this.result_deselect(a.attr("rel")),a.parents("li").first().remove()},e.prototype.results_reset=function(b){this.form_field.options[0].selected=!0,this.selected_item.find("span").text(this.default_text),this.is_multiple||this.selected_item.addClass("chzn-default"),this.show_search_field_default(),a(b.target).remove(),this.form_field_jq.trigger("change");if(this.active_field)return this.results_hide()},e.prototype.result_select=function(a){var b,c,d,e;if(this.result_highlight)return b=this.result_highlight,c=b.attr("id"),this.result_clear_highlight(),this.is_multiple?this.result_deactivate(b):(this.search_results.find(".result-selected").removeClass("result-selected"),this.result_single_selected=b,this.selected_item.removeClass("chzn-default")),b.addClass("result-selected"),e=c.substr(c.lastIndexOf("_")+1),d=this.results_data[e],d.selected=!0,this.form_field.options[d.options_index].selected=!0,this.is_multiple?this.choice_build(d):(this.selected_item.find("span").first().text(d.text),this.allow_single_deselect&&this.single_deselect_control_build()),(!a.metaKey||!this.is_multiple)&&this.results_hide(),this.search_field.val(""),this.form_field_jq.trigger("change"),this.search_field_scale()},e.prototype.result_activate=function(a){return a.addClass("active-result")},e.prototype.result_deactivate=function(a){return a.removeClass("active-result")},e.prototype.result_deselect=function(b){var c,d;return d=this.results_data[b],d.selected=!1,this.form_field.options[d.options_index].selected=!1,c=a("#"+this.container_id+"_o_"+b),c.removeClass("result-selected").addClass("active-result").show(),this.result_clear_highlight(),this.winnow_results(),this.form_field_jq.trigger("change"),this.search_field_scale()},e.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect&&this.selected_item.find("abbr").length<1)return this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>')},e.prototype.winnow_results=function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s;this.no_results_clear(),j=0,k=this.search_field.val()===this.default_text?"":a("<div/>").text(a.trim(this.search_field.val())).html(),g=this.search_contains?"":"^",f=new RegExp(g+k.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),n=new RegExp(k.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),s=this.results_data;for(o=0,q=s.length;o<q;o++){c=s[o];if(!c.disabled&&!c.empty)if(c.group)a("#"+c.dom_id).css("display","none");else if(!this.is_multiple||!c.selected){b=!1,i=c.dom_id,h=a("#"+i);if(f.test(c.html))b=!0,j+=1;else if(c.html.indexOf(" ")>=0||c.html.indexOf("[")===0){e=c.html.replace(/\[|\]/g,"").split(" ");if(e.length)for(p=0,r=e.length;p<r;p++)d=e[p],f.test(d)&&(b=!0,j+=1)}b?(k.length?(l=c.html.search(n),m=c.html.substr(0,l+k.length)+"</em>"+c.html.substr(l+k.length),m=m.substr(0,l)+"<em>"+m.substr(l)):m=c.html,h.html(m),this.result_activate(h),c.group_array_index!=null&&a("#"+this.results_data[c.group_array_index].dom_id).css("display","list-item")):(this.result_highlight&&i===this.result_highlight.attr("id")&&this.result_clear_highlight(),this.result_deactivate(h))}}return j<1&&k.length?this.no_results(k):this.winnow_results_set_highlight()},e.prototype.winnow_results_clear=function(){var b,c,d,e,f;this.search_field.val(""),c=this.search_results.find("li"),f=[];for(d=0,e=c.length;d<e;d++)b=c[d],b=a(b),b.hasClass("group-result")?f.push(b.css("display","auto")):!this.is_multiple||!b.hasClass("result-selected")?f.push(this.result_activate(b)):f.push(void 0);return f},e.prototype.winnow_results_set_highlight=function(){var a,b;if(!this.result_highlight){b=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),a=b.length?b.first():this.search_results.find(".active-result").first();if(a!=null)return this.result_do_highlight(a)}},e.prototype.no_results=function(b){var c;return c=a('<li class="no-results">'+this.results_none_found+' "<span></span>"</li>'),c.find("span").first().html(b),this.search_results.append(c)},e.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},e.prototype.keydown_arrow=function(){var b,c;this.result_highlight?this.results_showing&&(c=this.result_highlight.nextAll("li.active-result").first(),c&&this.result_do_highlight(c)):(b=this.search_results.find("li.active-result").first(),b&&this.result_do_highlight(a(b)));if(!this.results_showing)return this.results_show()},e.prototype.keyup_arrow=function(){var a;if(!this.results_showing&&!this.is_multiple)return this.results_show();if(this.result_highlight)return a=this.result_highlight.prevAll("li.active-result"),a.length?this.result_do_highlight(a.first()):(this.choices>0&&this.results_hide(),this.result_clear_highlight())},e.prototype.keydown_backstroke=function(){return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(this.pending_backstroke=this.search_container.siblings("li.search-choice").last(),this.pending_backstroke.addClass("search-choice-focus"))},e.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},e.prototype.keydown_checker=function(a){var b,c;b=(c=a.which)!=null?c:a.keyCode,this.search_field_scale(),b!==8&&this.pending_backstroke&&this.clear_backstroke();switch(b){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(a),this.mouse_on_container=!1;break;case 13:a.preventDefault();break;case 38:a.preventDefault(),this.keyup_arrow();break;case 40:this.keydown_arrow()}},e.prototype.search_field_scale=function(){var b,c,d,e,f,g,h,i,j;if(this.is_multiple){d=0,h=0,f="position:absolute; left: -1000px; top: -1000px; display:none;",g=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"];for(i=0,j=g.length;i<j;i++)e=g[i],f+=e+":"+this.search_field.css(e)+";";return c=a("<div />",{style:f}),c.text(this.search_field.val()),a("body").append(c),h=c.width()+25,c.remove(),h>this.f_width-10&&(h=this.f_width-10),this.search_field.css({width:h+"px"}),b=this.container.height(),this.dropdown.css({top:b+"px"})}},e.prototype.generate_random_id=function(){var b;b="sel"+this.generate_random_char()+this.generate_random_char()+this.generate_random_char();while(a("#"+b).length>0)b+=this.generate_random_char();return b},e}(AbstractChosen),c=function(a){var b;return b=a.outerWidth()-a.width()},d.get_side_border_padding=c}.call(this) \ No newline at end of file
diff --git a/3rdparty/mediawiki/CSSMin.php b/3rdparty/mediawiki/CSSMin.php
deleted file mode 100644
index e9c2badf62b..00000000000
--- a/3rdparty/mediawiki/CSSMin.php
+++ /dev/null
@@ -1,228 +0,0 @@
-<?php
-/**
- * Minification of CSS stylesheets.
- *
- * Copyright 2010 Wikimedia Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed
- * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
- * OF ANY KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations under the License.
- *
- * @file
- * @version 0.1.1 -- 2010-09-11
- * @author Trevor Parscal <tparscal@wikimedia.org>
- * @copyright Copyright 2010 Wikimedia Foundation
- * @license http://www.apache.org/licenses/LICENSE-2.0
- */
-
-/**
- * Transforms CSS data
- *
- * This class provides minification, URL remapping, URL extracting, and data-URL embedding.
- */
-class CSSMin {
-
- /* Constants */
-
- /**
- * Maximum file size to still qualify for in-line embedding as a data-URI
- *
- * 24,576 is used because Internet Explorer has a 32,768 byte limit for data URIs,
- * which when base64 encoded will result in a 1/3 increase in size.
- */
- const EMBED_SIZE_LIMIT = 24576;
- const URL_REGEX = 'url\(\s*[\'"]?(?P<file>[^\?\)\'"]*)(?P<query>\??[^\)\'"]*)[\'"]?\s*\)';
-
- /* Protected Static Members */
-
- /** @var array List of common image files extensions and mime-types */
- protected static $mimeTypes = array(
- 'gif' => 'image/gif',
- 'jpe' => 'image/jpeg',
- 'jpeg' => 'image/jpeg',
- 'jpg' => 'image/jpeg',
- 'png' => 'image/png',
- 'tif' => 'image/tiff',
- 'tiff' => 'image/tiff',
- 'xbm' => 'image/x-xbitmap',
- );
-
- /* Static Methods */
-
- /**
- * Gets a list of local file paths which are referenced in a CSS style sheet
- *
- * @param $source string CSS data to remap
- * @param $path string File path where the source was read from (optional)
- * @return array List of local file references
- */
- public static function getLocalFileReferences( $source, $path = null ) {
- $files = array();
- $rFlags = PREG_OFFSET_CAPTURE | PREG_SET_ORDER;
- if ( preg_match_all( '/' . self::URL_REGEX . '/', $source, $matches, $rFlags ) ) {
- foreach ( $matches as $match ) {
- $file = ( isset( $path )
- ? rtrim( $path, '/' ) . '/'
- : '' ) . "{$match['file'][0]}";
-
- // Only proceed if we can access the file
- if ( !is_null( $path ) && file_exists( $file ) ) {
- $files[] = $file;
- }
- }
- }
- return $files;
- }
-
- /**
- * @param $file string
- * @return bool|string
- */
- protected static function getMimeType( $file ) {
- $realpath = realpath( $file );
- // Try a couple of different ways to get the mime-type of a file, in order of
- // preference
- if (
- $realpath
- && function_exists( 'finfo_file' )
- && function_exists( 'finfo_open' )
- && defined( 'FILEINFO_MIME_TYPE' )
- ) {
- // As of PHP 5.3, this is how you get the mime-type of a file; it uses the Fileinfo
- // PECL extension
- return finfo_file( finfo_open( FILEINFO_MIME_TYPE ), $realpath );
- } elseif ( function_exists( 'mime_content_type' ) ) {
- // Before this was deprecated in PHP 5.3, this was how you got the mime-type of a file
- return mime_content_type( $file );
- } else {
- // Worst-case scenario has happened, use the file extension to infer the mime-type
- $ext = strtolower( pathinfo( $file, PATHINFO_EXTENSION ) );
- if ( isset( self::$mimeTypes[$ext] ) ) {
- return self::$mimeTypes[$ext];
- }
- }
- return false;
- }
-
- /**
- * Remaps CSS URL paths and automatically embeds data URIs for URL rules
- * preceded by an /* @embed * / comment
- *
- * @param $source string CSS data to remap
- * @param $local string File path where the source was read from
- * @param $remote string URL path to the file
- * @param $embedData bool If false, never do any data URI embedding, even if / * @embed * / is found
- * @return string Remapped CSS data
- */
- public static function remap( $source, $local, $remote, $embedData = true ) {
- $pattern = '/((?P<embed>\s*\/\*\s*\@embed\s*\*\/)(?P<pre>[^\;\}]*))?' .
- self::URL_REGEX . '(?P<post>[^;]*)[\;]?/';
- $offset = 0;
- while ( preg_match( $pattern, $source, $match, PREG_OFFSET_CAPTURE, $offset ) ) {
- // Skip fully-qualified URLs and data URIs
- $urlScheme = parse_url( $match['file'][0], PHP_URL_SCHEME );
- if ( $urlScheme ) {
- // Move the offset to the end of the match, leaving it alone
- $offset = $match[0][1] + strlen( $match[0][0] );
- continue;
- }
- // URLs with absolute paths like /w/index.php need to be expanded
- // to absolute URLs but otherwise left alone
- if ( $match['file'][0] !== '' && $match['file'][0][0] === '/' ) {
- // Replace the file path with an expanded (possibly protocol-relative) URL
- // ...but only if wfExpandUrl() is even available.
- // This will not be the case if we're running outside of MW
- $lengthIncrease = 0;
- if ( function_exists( 'wfExpandUrl' ) ) {
- $expanded = wfExpandUrl( $match['file'][0], PROTO_RELATIVE );
- $origLength = strlen( $match['file'][0] );
- $lengthIncrease = strlen( $expanded ) - $origLength;
- $source = substr_replace( $source, $expanded,
- $match['file'][1], $origLength
- );
- }
- // Move the offset to the end of the match, leaving it alone
- $offset = $match[0][1] + strlen( $match[0][0] ) + $lengthIncrease;
- continue;
- }
- // Shortcuts
- $embed = $match['embed'][0];
- $pre = $match['pre'][0];
- $post = $match['post'][0];
- $query = $match['query'][0];
- $url = "{$remote}/{$match['file'][0]}";
- $file = "{$local}/{$match['file'][0]}";
- // bug 27052 - Guard against double slashes, because foo//../bar
- // apparently resolves to foo/bar on (some?) clients
- $url = preg_replace( '#([^:])//+#', '\1/', $url );
- $replacement = false;
- if ( $local !== false && file_exists( $file ) ) {
- // Add version parameter as a time-stamp in ISO 8601 format,
- // using Z for the timezone, meaning GMT
- $url .= '?' . gmdate( 'Y-m-d\TH:i:s\Z', round( filemtime( $file ), -2 ) );
- // Embedding requires a bit of extra processing, so let's skip that if we can
- if ( $embedData && $embed ) {
- $type = self::getMimeType( $file );
- // Detect when URLs were preceeded with embed tags, and also verify file size is
- // below the limit
- if (
- $type
- && $match['embed'][1] > 0
- && filesize( $file ) < self::EMBED_SIZE_LIMIT
- ) {
- // Strip off any trailing = symbols (makes browsers freak out)
- $data = base64_encode( file_get_contents( $file ) );
- // Build 2 CSS properties; one which uses a base64 encoded data URI in place
- // of the @embed comment to try and retain line-number integrity, and the
- // other with a remapped an versioned URL and an Internet Explorer hack
- // making it ignored in all browsers that support data URIs
- $replacement = "{$pre}url(data:{$type};base64,{$data}){$post};";
- $replacement .= "{$pre}url({$url}){$post}!ie;";
- }
- }
- if ( $replacement === false ) {
- // Assume that all paths are relative to $remote, and make them absolute
- $replacement = "{$embed}{$pre}url({$url}){$post};";
- }
- } elseif ( $local === false ) {
- // Assume that all paths are relative to $remote, and make them absolute
- $replacement = "{$embed}{$pre}url({$url}{$query}){$post};";
- }
- if ( $replacement !== false ) {
- // Perform replacement on the source
- $source = substr_replace(
- $source, $replacement, $match[0][1], strlen( $match[0][0] )
- );
- // Move the offset to the end of the replacement in the source
- $offset = $match[0][1] + strlen( $replacement );
- continue;
- }
- // Move the offset to the end of the match, leaving it alone
- $offset = $match[0][1] + strlen( $match[0][0] );
- }
- return $source;
- }
-
- /**
- * Removes whitespace from CSS data
- *
- * @param $css string CSS data to minify
- * @return string Minified CSS data
- */
- public static function minify( $css ) {
- return trim(
- str_replace(
- array( '; ', ': ', ' {', '{ ', ', ', '} ', ';}' ),
- array( ';', ':', '{', '{', ',', '}', '}' ),
- preg_replace( array( '/\s+/', '/\/\*.*?\*\//s' ), array( ' ', '' ), $css )
- )
- );
- }
-}
diff --git a/3rdparty/mediawiki/JavaScriptMinifier.php b/3rdparty/mediawiki/JavaScriptMinifier.php
deleted file mode 100644
index db5326c7cfb..00000000000
--- a/3rdparty/mediawiki/JavaScriptMinifier.php
+++ /dev/null
@@ -1,606 +0,0 @@
-<?php
-/**
- * JavaScript Minifier
- *
- * @file
- * @author Paul Copperman <paul.copperman@gmail.com>
- * @license Choose any of Apache, MIT, GPL, LGPL
- */
-
-/**
- * This class is meant to safely minify javascript code, while leaving syntactically correct
- * programs intact. Other libraries, such as JSMin require a certain coding style to work
- * correctly. OTOH, libraries like jsminplus, that do parse the code correctly are rather
- * slow, because they construct a complete parse tree before outputting the code minified.
- * So this class is meant to allow arbitrary (but syntactically correct) input, while being
- * fast enough to be used for on-the-fly minifying.
- */
-class JavaScriptMinifier {
-
- /* Class constants */
- /* Parsing states.
- * The state machine is only necessary to decide whether to parse a slash as division
- * operator or as regexp literal.
- * States are named after the next expected item. We only distinguish states when the
- * distinction is relevant for our purpose.
- */
- const STATEMENT = 0;
- const CONDITION = 1;
- const PROPERTY_ASSIGNMENT = 2;
- const EXPRESSION = 3;
- const EXPRESSION_NO_NL = 4; // only relevant for semicolon insertion
- const EXPRESSION_OP = 5;
- const EXPRESSION_FUNC = 6;
- const EXPRESSION_TERNARY = 7; // used to determine the role of a colon
- const EXPRESSION_TERNARY_OP = 8;
- const EXPRESSION_TERNARY_FUNC = 9;
- const PAREN_EXPRESSION = 10; // expression which is not on the top level
- const PAREN_EXPRESSION_OP = 11;
- const PAREN_EXPRESSION_FUNC = 12;
- const PROPERTY_EXPRESSION = 13; // expression which is within an object literal
- const PROPERTY_EXPRESSION_OP = 14;
- const PROPERTY_EXPRESSION_FUNC = 15;
-
- /* Token types */
- const TYPE_UN_OP = 1; // unary operators
- const TYPE_INCR_OP = 2; // ++ and --
- const TYPE_BIN_OP = 3; // binary operators
- const TYPE_ADD_OP = 4; // + and - which can be either unary or binary ops
- const TYPE_HOOK = 5; // ?
- const TYPE_COLON = 6; // :
- const TYPE_COMMA = 7; // ,
- const TYPE_SEMICOLON = 8; // ;
- const TYPE_BRACE_OPEN = 9; // {
- const TYPE_BRACE_CLOSE = 10; // }
- const TYPE_PAREN_OPEN = 11; // ( and [
- const TYPE_PAREN_CLOSE = 12; // ) and ]
- const TYPE_RETURN = 13; // keywords: break, continue, return, throw
- const TYPE_IF = 14; // keywords: catch, for, with, switch, while, if
- const TYPE_DO = 15; // keywords: case, var, finally, else, do, try
- const TYPE_FUNC = 16; // keywords: function
- const TYPE_LITERAL = 17; // all literals, identifiers and unrecognised tokens
-
- // Sanity limit to avoid excessive memory usage
- const STACK_LIMIT = 1000;
-
- /* Static functions */
-
- /**
- * Returns minified JavaScript code.
- *
- * NOTE: $maxLineLength isn't a strict maximum. Longer lines will be produced when
- * literals (e.g. quoted strings) longer than $maxLineLength are encountered
- * or when required to guard against semicolon insertion.
- *
- * @param $s String JavaScript code to minify
- * @param $statementsOnOwnLine Bool Whether to put each statement on its own line
- * @param $maxLineLength Int Maximum length of a single line, or -1 for no maximum.
- * @return String Minified code
- */
- public static function minify( $s, $statementsOnOwnLine = false, $maxLineLength = 1000 ) {
- // First we declare a few tables that contain our parsing rules
-
- // $opChars : characters, which can be combined without whitespace in between them
- $opChars = array(
- '!' => true,
- '"' => true,
- '%' => true,
- '&' => true,
- "'" => true,
- '(' => true,
- ')' => true,
- '*' => true,
- '+' => true,
- ',' => true,
- '-' => true,
- '.' => true,
- '/' => true,
- ':' => true,
- ';' => true,
- '<' => true,
- '=' => true,
- '>' => true,
- '?' => true,
- '[' => true,
- ']' => true,
- '^' => true,
- '{' => true,
- '|' => true,
- '}' => true,
- '~' => true
- );
-
- // $tokenTypes : maps keywords and operators to their corresponding token type
- $tokenTypes = array(
- '!' => self::TYPE_UN_OP,
- '~' => self::TYPE_UN_OP,
- 'delete' => self::TYPE_UN_OP,
- 'new' => self::TYPE_UN_OP,
- 'typeof' => self::TYPE_UN_OP,
- 'void' => self::TYPE_UN_OP,
- '++' => self::TYPE_INCR_OP,
- '--' => self::TYPE_INCR_OP,
- '!=' => self::TYPE_BIN_OP,
- '!==' => self::TYPE_BIN_OP,
- '%' => self::TYPE_BIN_OP,
- '%=' => self::TYPE_BIN_OP,
- '&' => self::TYPE_BIN_OP,
- '&&' => self::TYPE_BIN_OP,
- '&=' => self::TYPE_BIN_OP,
- '*' => self::TYPE_BIN_OP,
- '*=' => self::TYPE_BIN_OP,
- '+=' => self::TYPE_BIN_OP,
- '-=' => self::TYPE_BIN_OP,
- '.' => self::TYPE_BIN_OP,
- '/' => self::TYPE_BIN_OP,
- '/=' => self::TYPE_BIN_OP,
- '<' => self::TYPE_BIN_OP,
- '<<' => self::TYPE_BIN_OP,
- '<<=' => self::TYPE_BIN_OP,
- '<=' => self::TYPE_BIN_OP,
- '=' => self::TYPE_BIN_OP,
- '==' => self::TYPE_BIN_OP,
- '===' => self::TYPE_BIN_OP,
- '>' => self::TYPE_BIN_OP,
- '>=' => self::TYPE_BIN_OP,
- '>>' => self::TYPE_BIN_OP,
- '>>=' => self::TYPE_BIN_OP,
- '>>>' => self::TYPE_BIN_OP,
- '>>>=' => self::TYPE_BIN_OP,
- '^' => self::TYPE_BIN_OP,
- '^=' => self::TYPE_BIN_OP,
- '|' => self::TYPE_BIN_OP,
- '|=' => self::TYPE_BIN_OP,
- '||' => self::TYPE_BIN_OP,
- 'in' => self::TYPE_BIN_OP,
- 'instanceof' => self::TYPE_BIN_OP,
- '+' => self::TYPE_ADD_OP,
- '-' => self::TYPE_ADD_OP,
- '?' => self::TYPE_HOOK,
- ':' => self::TYPE_COLON,
- ',' => self::TYPE_COMMA,
- ';' => self::TYPE_SEMICOLON,
- '{' => self::TYPE_BRACE_OPEN,
- '}' => self::TYPE_BRACE_CLOSE,
- '(' => self::TYPE_PAREN_OPEN,
- '[' => self::TYPE_PAREN_OPEN,
- ')' => self::TYPE_PAREN_CLOSE,
- ']' => self::TYPE_PAREN_CLOSE,
- 'break' => self::TYPE_RETURN,
- 'continue' => self::TYPE_RETURN,
- 'return' => self::TYPE_RETURN,
- 'throw' => self::TYPE_RETURN,
- 'catch' => self::TYPE_IF,
- 'for' => self::TYPE_IF,
- 'if' => self::TYPE_IF,
- 'switch' => self::TYPE_IF,
- 'while' => self::TYPE_IF,
- 'with' => self::TYPE_IF,
- 'case' => self::TYPE_DO,
- 'do' => self::TYPE_DO,
- 'else' => self::TYPE_DO,
- 'finally' => self::TYPE_DO,
- 'try' => self::TYPE_DO,
- 'var' => self::TYPE_DO,
- 'function' => self::TYPE_FUNC
- );
-
- // $goto : This is the main table for our state machine. For every state/token pair
- // the following state is defined. When no rule exists for a given pair,
- // the state is left unchanged.
- $goto = array(
- self::STATEMENT => array(
- self::TYPE_UN_OP => self::EXPRESSION,
- self::TYPE_INCR_OP => self::EXPRESSION,
- self::TYPE_ADD_OP => self::EXPRESSION,
- self::TYPE_PAREN_OPEN => self::PAREN_EXPRESSION,
- self::TYPE_RETURN => self::EXPRESSION_NO_NL,
- self::TYPE_IF => self::CONDITION,
- self::TYPE_FUNC => self::CONDITION,
- self::TYPE_LITERAL => self::EXPRESSION_OP
- ),
- self::CONDITION => array(
- self::TYPE_PAREN_OPEN => self::PAREN_EXPRESSION
- ),
- self::PROPERTY_ASSIGNMENT => array(
- self::TYPE_COLON => self::PROPERTY_EXPRESSION,
- self::TYPE_BRACE_OPEN => self::STATEMENT
- ),
- self::EXPRESSION => array(
- self::TYPE_SEMICOLON => self::STATEMENT,
- self::TYPE_BRACE_OPEN => self::PROPERTY_ASSIGNMENT,
- self::TYPE_PAREN_OPEN => self::PAREN_EXPRESSION,
- self::TYPE_FUNC => self::EXPRESSION_FUNC,
- self::TYPE_LITERAL => self::EXPRESSION_OP
- ),
- self::EXPRESSION_NO_NL => array(
- self::TYPE_SEMICOLON => self::STATEMENT,
- self::TYPE_BRACE_OPEN => self::PROPERTY_ASSIGNMENT,
- self::TYPE_PAREN_OPEN => self::PAREN_EXPRESSION,
- self::TYPE_FUNC => self::EXPRESSION_FUNC,
- self::TYPE_LITERAL => self::EXPRESSION_OP
- ),
- self::EXPRESSION_OP => array(
- self::TYPE_BIN_OP => self::EXPRESSION,
- self::TYPE_ADD_OP => self::EXPRESSION,
- self::TYPE_HOOK => self::EXPRESSION_TERNARY,
- self::TYPE_COLON => self::STATEMENT,
- self::TYPE_COMMA => self::EXPRESSION,
- self::TYPE_SEMICOLON => self::STATEMENT,
- self::TYPE_PAREN_OPEN => self::PAREN_EXPRESSION
- ),
- self::EXPRESSION_FUNC => array(
- self::TYPE_BRACE_OPEN => self::STATEMENT
- ),
- self::EXPRESSION_TERNARY => array(
- self::TYPE_BRACE_OPEN => self::PROPERTY_ASSIGNMENT,
- self::TYPE_PAREN_OPEN => self::PAREN_EXPRESSION,
- self::TYPE_FUNC => self::EXPRESSION_TERNARY_FUNC,
- self::TYPE_LITERAL => self::EXPRESSION_TERNARY_OP
- ),
- self::EXPRESSION_TERNARY_OP => array(
- self::TYPE_BIN_OP => self::EXPRESSION_TERNARY,
- self::TYPE_ADD_OP => self::EXPRESSION_TERNARY,
- self::TYPE_HOOK => self::EXPRESSION_TERNARY,
- self::TYPE_COMMA => self::EXPRESSION_TERNARY,
- self::TYPE_PAREN_OPEN => self::PAREN_EXPRESSION
- ),
- self::EXPRESSION_TERNARY_FUNC => array(
- self::TYPE_BRACE_OPEN => self::STATEMENT
- ),
- self::PAREN_EXPRESSION => array(
- self::TYPE_BRACE_OPEN => self::PROPERTY_ASSIGNMENT,
- self::TYPE_PAREN_OPEN => self::PAREN_EXPRESSION,
- self::TYPE_FUNC => self::PAREN_EXPRESSION_FUNC,
- self::TYPE_LITERAL => self::PAREN_EXPRESSION_OP
- ),
- self::PAREN_EXPRESSION_OP => array(
- self::TYPE_BIN_OP => self::PAREN_EXPRESSION,
- self::TYPE_ADD_OP => self::PAREN_EXPRESSION,
- self::TYPE_HOOK => self::PAREN_EXPRESSION,
- self::TYPE_COLON => self::PAREN_EXPRESSION,
- self::TYPE_COMMA => self::PAREN_EXPRESSION,
- self::TYPE_SEMICOLON => self::PAREN_EXPRESSION,
- self::TYPE_PAREN_OPEN => self::PAREN_EXPRESSION
- ),
- self::PAREN_EXPRESSION_FUNC => array(
- self::TYPE_BRACE_OPEN => self::STATEMENT
- ),
- self::PROPERTY_EXPRESSION => array(
- self::TYPE_BRACE_OPEN => self::PROPERTY_ASSIGNMENT,
- self::TYPE_PAREN_OPEN => self::PAREN_EXPRESSION,
- self::TYPE_FUNC => self::PROPERTY_EXPRESSION_FUNC,
- self::TYPE_LITERAL => self::PROPERTY_EXPRESSION_OP
- ),
- self::PROPERTY_EXPRESSION_OP => array(
- self::TYPE_BIN_OP => self::PROPERTY_EXPRESSION,
- self::TYPE_ADD_OP => self::PROPERTY_EXPRESSION,
- self::TYPE_HOOK => self::PROPERTY_EXPRESSION,
- self::TYPE_COMMA => self::PROPERTY_ASSIGNMENT,
- self::TYPE_PAREN_OPEN => self::PAREN_EXPRESSION
- ),
- self::PROPERTY_EXPRESSION_FUNC => array(
- self::TYPE_BRACE_OPEN => self::STATEMENT
- )
- );
-
- // $push : This table contains the rules for when to push a state onto the stack.
- // The pushed state is the state to return to when the corresponding
- // closing token is found
- $push = array(
- self::STATEMENT => array(
- self::TYPE_BRACE_OPEN => self::STATEMENT,
- self::TYPE_PAREN_OPEN => self::EXPRESSION_OP
- ),
- self::CONDITION => array(
- self::TYPE_PAREN_OPEN => self::STATEMENT
- ),
- self::PROPERTY_ASSIGNMENT => array(
- self::TYPE_BRACE_OPEN => self::PROPERTY_ASSIGNMENT
- ),
- self::EXPRESSION => array(
- self::TYPE_BRACE_OPEN => self::EXPRESSION_OP,
- self::TYPE_PAREN_OPEN => self::EXPRESSION_OP
- ),
- self::EXPRESSION_NO_NL => array(
- self::TYPE_BRACE_OPEN => self::EXPRESSION_OP,
- self::TYPE_PAREN_OPEN => self::EXPRESSION_OP
- ),
- self::EXPRESSION_OP => array(
- self::TYPE_HOOK => self::EXPRESSION,
- self::TYPE_PAREN_OPEN => self::EXPRESSION_OP
- ),
- self::EXPRESSION_FUNC => array(
- self::TYPE_BRACE_OPEN => self::EXPRESSION_OP
- ),
- self::EXPRESSION_TERNARY => array(
- self::TYPE_BRACE_OPEN => self::EXPRESSION_TERNARY_OP,
- self::TYPE_PAREN_OPEN => self::EXPRESSION_TERNARY_OP
- ),
- self::EXPRESSION_TERNARY_OP => array(
- self::TYPE_HOOK => self::EXPRESSION_TERNARY,
- self::TYPE_PAREN_OPEN => self::EXPRESSION_TERNARY_OP
- ),
- self::EXPRESSION_TERNARY_FUNC => array(
- self::TYPE_BRACE_OPEN => self::EXPRESSION_TERNARY_OP
- ),
- self::PAREN_EXPRESSION => array(
- self::TYPE_BRACE_OPEN => self::PAREN_EXPRESSION_OP,
- self::TYPE_PAREN_OPEN => self::PAREN_EXPRESSION_OP
- ),
- self::PAREN_EXPRESSION_OP => array(
- self::TYPE_PAREN_OPEN => self::PAREN_EXPRESSION_OP
- ),
- self::PAREN_EXPRESSION_FUNC => array(
- self::TYPE_BRACE_OPEN => self::PAREN_EXPRESSION_OP
- ),
- self::PROPERTY_EXPRESSION => array(
- self::TYPE_BRACE_OPEN => self::PROPERTY_EXPRESSION_OP,
- self::TYPE_PAREN_OPEN => self::PROPERTY_EXPRESSION_OP
- ),
- self::PROPERTY_EXPRESSION_OP => array(
- self::TYPE_PAREN_OPEN => self::PROPERTY_EXPRESSION_OP
- ),
- self::PROPERTY_EXPRESSION_FUNC => array(
- self::TYPE_BRACE_OPEN => self::PROPERTY_EXPRESSION_OP
- )
- );
-
- // $pop : Rules for when to pop a state from the stack
- $pop = array(
- self::STATEMENT => array( self::TYPE_BRACE_CLOSE => true ),
- self::PROPERTY_ASSIGNMENT => array( self::TYPE_BRACE_CLOSE => true ),
- self::EXPRESSION => array( self::TYPE_BRACE_CLOSE => true ),
- self::EXPRESSION_NO_NL => array( self::TYPE_BRACE_CLOSE => true ),
- self::EXPRESSION_OP => array( self::TYPE_BRACE_CLOSE => true ),
- self::EXPRESSION_TERNARY_OP => array( self::TYPE_COLON => true ),
- self::PAREN_EXPRESSION => array( self::TYPE_PAREN_CLOSE => true ),
- self::PAREN_EXPRESSION_OP => array( self::TYPE_PAREN_CLOSE => true ),
- self::PROPERTY_EXPRESSION => array( self::TYPE_BRACE_CLOSE => true ),
- self::PROPERTY_EXPRESSION_OP => array( self::TYPE_BRACE_CLOSE => true )
- );
-
- // $semicolon : Rules for when a semicolon insertion is appropriate
- $semicolon = array(
- self::EXPRESSION_NO_NL => array(
- self::TYPE_UN_OP => true,
- self::TYPE_INCR_OP => true,
- self::TYPE_ADD_OP => true,
- self::TYPE_BRACE_OPEN => true,
- self::TYPE_PAREN_OPEN => true,
- self::TYPE_RETURN => true,
- self::TYPE_IF => true,
- self::TYPE_DO => true,
- self::TYPE_FUNC => true,
- self::TYPE_LITERAL => true
- ),
- self::EXPRESSION_OP => array(
- self::TYPE_UN_OP => true,
- self::TYPE_INCR_OP => true,
- self::TYPE_BRACE_OPEN => true,
- self::TYPE_RETURN => true,
- self::TYPE_IF => true,
- self::TYPE_DO => true,
- self::TYPE_FUNC => true,
- self::TYPE_LITERAL => true
- )
- );
-
- // Rules for when newlines should be inserted if
- // $statementsOnOwnLine is enabled.
- // $newlineBefore is checked before switching state,
- // $newlineAfter is checked after
- $newlineBefore = array(
- self::STATEMENT => array(
- self::TYPE_BRACE_CLOSE => true,
- ),
- );
- $newlineAfter = array(
- self::STATEMENT => array(
- self::TYPE_BRACE_OPEN => true,
- self::TYPE_PAREN_CLOSE => true,
- self::TYPE_SEMICOLON => true,
- ),
- );
-
- // $divStates : Contains all states that can be followed by a division operator
- $divStates = array(
- self::EXPRESSION_OP => true,
- self::EXPRESSION_TERNARY_OP => true,
- self::PAREN_EXPRESSION_OP => true,
- self::PROPERTY_EXPRESSION_OP => true
- );
-
- // Here's where the minifying takes place: Loop through the input, looking for tokens
- // and output them to $out, taking actions to the above defined rules when appropriate.
- $out = '';
- $pos = 0;
- $length = strlen( $s );
- $lineLength = 0;
- $newlineFound = true;
- $state = self::STATEMENT;
- $stack = array();
- $last = ';'; // Pretend that we have seen a semicolon yet
- while( $pos < $length ) {
- // First, skip over any whitespace and multiline comments, recording whether we
- // found any newline character
- $skip = strspn( $s, " \t\n\r\xb\xc", $pos );
- if( !$skip ) {
- $ch = $s[$pos];
- if( $ch === '/' && substr( $s, $pos, 2 ) === '/*' ) {
- // Multiline comment. Search for the end token or EOT.
- $end = strpos( $s, '*/', $pos + 2 );
- $skip = $end === false ? $length - $pos : $end - $pos + 2;
- }
- }
- if( $skip ) {
- // The semicolon insertion mechanism needs to know whether there was a newline
- // between two tokens, so record it now.
- if( !$newlineFound && strcspn( $s, "\r\n", $pos, $skip ) !== $skip ) {
- $newlineFound = true;
- }
- $pos += $skip;
- continue;
- }
- // Handle C++-style comments and html comments, which are treated as single line
- // comments by the browser, regardless of whether the end tag is on the same line.
- // Handle --> the same way, but only if it's at the beginning of the line
- if( ( $ch === '/' && substr( $s, $pos, 2 ) === '//' )
- || ( $ch === '<' && substr( $s, $pos, 4 ) === '<!--' )
- || ( $ch === '-' && $newlineFound && substr( $s, $pos, 3 ) === '-->' )
- ) {
- $pos += strcspn( $s, "\r\n", $pos );
- continue;
- }
-
- // Find out which kind of token we're handling. $end will point past the end of it.
- $end = $pos + 1;
- // Handle string literals
- if( $ch === "'" || $ch === '"' ) {
- // Search to the end of the string literal, skipping over backslash escapes
- $search = $ch . '\\';
- do{
- $end += strcspn( $s, $search, $end ) + 2;
- } while( $end - 2 < $length && $s[$end - 2] === '\\' );
- $end--;
- // We have to distinguish between regexp literals and division operators
- // A division operator is only possible in certain states
- } elseif( $ch === '/' && !isset( $divStates[$state] ) ) {
- // Regexp literal, search to the end, skipping over backslash escapes and
- // character classes
- for( ; ; ) {
- do{
- $end += strcspn( $s, '/[\\', $end ) + 2;
- } while( $end - 2 < $length && $s[$end - 2] === '\\' );
- $end--;
- if( $end - 1 >= $length || $s[$end - 1] === '/' ) {
- break;
- }
- do{
- $end += strcspn( $s, ']\\', $end ) + 2;
- } while( $end - 2 < $length && $s[$end - 2] === '\\' );
- $end--;
- };
- // Search past the regexp modifiers (gi)
- while( $end < $length && ctype_alpha( $s[$end] ) ) {
- $end++;
- }
- } elseif(
- $ch === '0'
- && ($pos + 1 < $length) && ($s[$pos + 1] === 'x' || $s[$pos + 1] === 'X' )
- ) {
- // Hex numeric literal
- $end++; // x or X
- $len = strspn( $s, '0123456789ABCDEFabcdef', $end );
- if ( !$len ) {
- return self::parseError($s, $pos, 'Expected a hexadecimal number but found ' . substr( $s, $pos, 5 ) . '...' );
- }
- $end += $len;
- } elseif(
- ctype_digit( $ch )
- || ( $ch === '.' && $pos + 1 < $length && ctype_digit( $s[$pos + 1] ) )
- ) {
- $end += strspn( $s, '0123456789', $end );
- $decimal = strspn( $s, '.', $end );
- if ($decimal) {
- if ( $decimal > 2 ) {
- return self::parseError($s, $end, 'The number has too many decimal points' );
- }
- $end += strspn( $s, '0123456789', $end + 1 ) + $decimal;
- }
- $exponent = strspn( $s, 'eE', $end );
- if( $exponent ) {
- if ( $exponent > 1 ) {
- return self::parseError($s, $end, 'Number with several E' );
- }
- $end++;
-
- // + sign is optional; - sign is required.
- $end += strspn( $s, '-+', $end );
- $len = strspn( $s, '0123456789', $end );
- if ( !$len ) {
- return self::parseError($s, $pos, 'No decimal digits after e, how many zeroes should be added?' );
- }
- $end += $len;
- }
- } elseif( isset( $opChars[$ch] ) ) {
- // Punctuation character. Search for the longest matching operator.
- while(
- $end < $length
- && isset( $tokenTypes[substr( $s, $pos, $end - $pos + 1 )] )
- ) {
- $end++;
- }
- } else {
- // Identifier or reserved word. Search for the end by excluding whitespace and
- // punctuation.
- $end += strcspn( $s, " \t\n.;,=<>+-{}()[]?:*/%'\"!&|^~\xb\xc\r", $end );
- }
-
- // Now get the token type from our type array
- $token = substr( $s, $pos, $end - $pos ); // so $end - $pos == strlen( $token )
- $type = isset( $tokenTypes[$token] ) ? $tokenTypes[$token] : self::TYPE_LITERAL;
-
- if( $newlineFound && isset( $semicolon[$state][$type] ) ) {
- // This token triggers the semicolon insertion mechanism of javascript. While we
- // could add the ; token here ourselves, keeping the newline has a few advantages.
- $out .= "\n";
- $state = self::STATEMENT;
- $lineLength = 0;
- } elseif( $maxLineLength > 0 && $lineLength + $end - $pos > $maxLineLength &&
- !isset( $semicolon[$state][$type] ) && $type !== self::TYPE_INCR_OP )
- {
- // This line would get too long if we added $token, so add a newline first.
- // Only do this if it won't trigger semicolon insertion and if it won't
- // put a postfix increment operator on its own line, which is illegal in js.
- $out .= "\n";
- $lineLength = 0;
- // Check, whether we have to separate the token from the last one with whitespace
- } elseif( !isset( $opChars[$last] ) && !isset( $opChars[$ch] ) ) {
- $out .= ' ';
- $lineLength++;
- // Don't accidentally create ++, -- or // tokens
- } elseif( $last === $ch && ( $ch === '+' || $ch === '-' || $ch === '/' ) ) {
- $out .= ' ';
- $lineLength++;
- }
-
- $out .= $token;
- $lineLength += $end - $pos; // += strlen( $token )
- $last = $s[$end - 1];
- $pos = $end;
- $newlineFound = false;
-
- // Output a newline after the token if required
- // This is checked before AND after switching state
- $newlineAdded = false;
- if ( $statementsOnOwnLine && !$newlineAdded && isset( $newlineBefore[$state][$type] ) ) {
- $out .= "\n";
- $lineLength = 0;
- $newlineAdded = true;
- }
-
- // Now that we have output our token, transition into the new state.
- if( isset( $push[$state][$type] ) && count( $stack ) < self::STACK_LIMIT ) {
- $stack[] = $push[$state][$type];
- }
- if( $stack && isset( $pop[$state][$type] ) ) {
- $state = array_pop( $stack );
- } elseif( isset( $goto[$state][$type] ) ) {
- $state = $goto[$state][$type];
- }
-
- // Check for newline insertion again
- if ( $statementsOnOwnLine && !$newlineAdded && isset( $newlineAfter[$state][$type] ) ) {
- $out .= "\n";
- $lineLength = 0;
- }
- }
- return $out;
- }
-
- static function parseError($fullJavascript, $position, $errorMsg) {
- // TODO: Handle the error: trigger_error, throw exception, return false...
- return false;
- }
-}
diff --git a/3rdparty/miniColors/GPL-LICENSE.txt b/3rdparty/miniColors/GPL-LICENSE.txt
deleted file mode 100644
index 11dddd00ef0..00000000000
--- a/3rdparty/miniColors/GPL-LICENSE.txt
+++ /dev/null
@@ -1,278 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Lesser General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
diff --git a/3rdparty/miniColors/MIT-LICENSE.txt b/3rdparty/miniColors/MIT-LICENSE.txt
deleted file mode 100644
index ec6f7581576..00000000000
--- a/3rdparty/miniColors/MIT-LICENSE.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (c) Cory LaViska
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/3rdparty/miniColors/css/images/colors.png b/3rdparty/miniColors/css/images/colors.png
deleted file mode 100755
index deb50a9ae10..00000000000
--- a/3rdparty/miniColors/css/images/colors.png
+++ /dev/null
Binary files differ
diff --git a/3rdparty/miniColors/css/images/trigger.png b/3rdparty/miniColors/css/images/trigger.png
deleted file mode 100755
index 96c91294f3f..00000000000
--- a/3rdparty/miniColors/css/images/trigger.png
+++ /dev/null
Binary files differ
diff --git a/3rdparty/miniColors/css/jquery.miniColors.css b/3rdparty/miniColors/css/jquery.miniColors.css
deleted file mode 100755
index 592f44894d1..00000000000
--- a/3rdparty/miniColors/css/jquery.miniColors.css
+++ /dev/null
@@ -1,125 +0,0 @@
-INPUT.miniColors {
- margin-right: 4px;
-}
-
-.miniColors-selector {
- position: absolute;
- width: 175px;
- height: 150px;
- background: white;
- border: solid 1px #bababa;
- -moz-box-shadow: 0 0 6px rgba(0, 0, 0, .25);
- -webkit-box-shadow: 0 0 6px rgba(0, 0, 0, .25);
- box-shadow: 0 0 6px rgba(0, 0, 0, .25);
- -moz-border-radius: 5px;
- -webkit-border-radius: 5px;
- border-radius: 5px;
- padding: 5px;
- z-index: 999999;
-}
-
-.miniColors.opacity.miniColors-selector {
- width: 200px;
-}
-
-.miniColors-selector.black {
- background: black;
- border-color: black;
-}
-
-.miniColors-colors {
- position: absolute;
- top: 5px;
- left: 5px;
- width: 150px;
- height: 150px;
- background: url(images/colors.png) -40px 0 no-repeat;
- cursor: crosshair;
-}
-
-.miniColors.opacity .miniColors-colors {
- left: 30px;
-}
-
-.miniColors-hues {
- position: absolute;
- top: 5px;
- left: 160px;
- width: 20px;
- height: 150px;
- background: url(images/colors.png) 0 0 no-repeat;
- cursor: crosshair;
-}
-
-.miniColors.opacity .miniColors-hues {
- left: 185px;
-}
-
-.miniColors-opacity {
- position: absolute;
- top: 5px;
- left: 5px;
- width: 20px;
- height: 150px;
- background: url(images/colors.png) -20px 0 no-repeat;
- cursor: crosshair;
-}
-
-.miniColors-colorPicker {
- position: absolute;
- width: 11px;
- height: 11px;
- border: 1px solid black;
- -moz-border-radius: 11px;
- -webkit-border-radius: 11px;
- border-radius: 11px;
-}
-.miniColors-colorPicker-inner {
- position: absolute;
- top: 0;
- left: 0;
- width: 7px;
- height: 7px;
- border: 2px solid white;
- -moz-border-radius: 9px;
- -webkit-border-radius: 9px;
- border-radius: 9px;
-}
-
-.miniColors-huePicker,
-.miniColors-opacityPicker {
- position: absolute;
- left: -2px;
- width: 22px;
- height: 2px;
- border: 1px solid black;
- background: white;
- margin-top: -1px;
- border-radius: 2px;
-}
-
-.miniColors-trigger,
-.miniColors-triggerWrap {
- width: 22px;
- height: 22px;
- display: inline-block;
-}
-
-.miniColors-triggerWrap {
- background: url(images/trigger.png) -22px 0 no-repeat;
-}
-
-.miniColors-triggerWrap.disabled {
- filter: alpha(opacity=50);
- opacity: .5;
-}
-
-.miniColors-trigger {
- vertical-align: middle;
- outline: none;
- background: url(images/trigger.png) 0 0 no-repeat;
-}
-
-.miniColors-triggerWrap.disabled .miniColors-trigger {
- cursor: default;
-} \ No newline at end of file
diff --git a/3rdparty/miniColors/js/jquery.miniColors.js b/3rdparty/miniColors/js/jquery.miniColors.js
deleted file mode 100755
index a0f439c2c49..00000000000
--- a/3rdparty/miniColors/js/jquery.miniColors.js
+++ /dev/null
@@ -1,710 +0,0 @@
-/*
- * jQuery miniColors: A small color selector
- *
- * Copyright 2012 Cory LaViska for A Beautiful Site, LLC. (http://www.abeautifulsite.net/)
- *
- * Dual licensed under the MIT or GPL Version 2 licenses
- *
-*/
-if(jQuery) (function($) {
-
- $.extend($.fn, {
-
- miniColors: function(o, data) {
-
- var create = function(input, o, data) {
- //
- // Creates a new instance of the miniColors selector
- //
-
- // Determine initial color (defaults to white)
- var color = expandHex(input.val()) || 'ffffff',
- hsb = hex2hsb(color),
- rgb = hsb2rgb(hsb),
- alpha = parseFloat(input.attr('data-opacity')).toFixed(2);
-
- if( alpha > 1 ) alpha = 1;
- if( alpha < 0 ) alpha = 0;
-
- // Create trigger
- var trigger = $('<a class="miniColors-trigger" style="background-color: #' + color + '" href="#"></a>');
- trigger.insertAfter(input);
- trigger.wrap('<span class="miniColors-triggerWrap"></span>');
- if( o.opacity ) {
- trigger.css('backgroundColor', 'rgba(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ', ' + alpha + ')');
- }
-
- // Set input data and update attributes
- input
- .addClass('miniColors')
- .data('original-maxlength', input.attr('maxlength') || null)
- .data('original-autocomplete', input.attr('autocomplete') || null)
- .data('letterCase', o.letterCase === 'uppercase' ? 'uppercase' : 'lowercase')
- .data('opacity', o.opacity ? true : false)
- .data('alpha', alpha)
- .data('trigger', trigger)
- .data('hsb', hsb)
- .data('change', o.change ? o.change : null)
- .data('close', o.close ? o.close : null)
- .data('open', o.open ? o.open : null)
- .attr('maxlength', 7)
- .attr('autocomplete', 'off')
- .val('#' + convertCase(color, o.letterCase));
-
- // Handle options
- if( o.readonly || input.prop('readonly') ) input.prop('readonly', true);
- if( o.disabled || input.prop('disabled') ) disable(input);
-
- // Show selector when trigger is clicked
- trigger.on('click.miniColors', function(event) {
- event.preventDefault();
- if( input.val() === '' ) input.val('#');
- show(input);
-
- });
-
- // Show selector when input receives focus
- input.on('focus.miniColors', function(event) {
- if( input.val() === '' ) input.val('#');
- show(input);
- });
-
- // Hide on blur
- input.on('blur.miniColors', function(event) {
- var hex = expandHex( hsb2hex(input.data('hsb')) );
- input.val( hex ? '#' + convertCase(hex, input.data('letterCase')) : '' );
- });
-
- // Hide when tabbing out of the input
- input.on('keydown.miniColors', function(event) {
- if( event.keyCode === 9 ) hide(input);
- });
-
- // Update when color is typed in
- input.on('keyup.miniColors', function(event) {
- setColorFromInput(input);
- });
-
- // Handle pasting
- input.on('paste.miniColors', function(event) {
- // Short pause to wait for paste to complete
- setTimeout( function() {
- setColorFromInput(input);
- }, 5);
- });
-
- };
-
- var destroy = function(input) {
- //
- // Destroys an active instance of the miniColors selector
- //
- hide();
- input = $(input);
-
- // Restore to original state
- input.data('trigger').parent().remove();
- input
- .attr('autocomplete', input.data('original-autocomplete'))
- .attr('maxlength', input.data('original-maxlength'))
- .removeData()
- .removeClass('miniColors')
- .off('.miniColors');
- $(document).off('.miniColors');
- };
-
- var enable = function(input) {
- //
- // Enables the input control and the selector
- //
- input
- .prop('disabled', false)
- .data('trigger').parent().removeClass('disabled');
- };
-
- var disable = function(input) {
- //
- // Disables the input control and the selector
- //
- hide(input);
- input
- .prop('disabled', true)
- .data('trigger').parent().addClass('disabled');
- };
-
- var show = function(input) {
- //
- // Shows the miniColors selector
- //
- if( input.prop('disabled') ) return false;
-
- // Hide all other instances
- hide();
-
- // Generate the selector
- var selector = $('<div class="miniColors-selector"></div>');
- selector
- .append('<div class="miniColors-hues"><div class="miniColors-huePicker"></div></div>')
- .append('<div class="miniColors-colors" style="background-color: #FFF;"><div class="miniColors-colorPicker"><div class="miniColors-colorPicker-inner"></div></div>')
- .css('display', 'none')
- .addClass( input.attr('class') );
-
- // Opacity
- if( input.data('opacity') ) {
- selector
- .addClass('opacity')
- .prepend('<div class="miniColors-opacity"><div class="miniColors-opacityPicker"></div></div>');
- }
-
- // Set background for colors
- var hsb = input.data('hsb');
- selector
- .find('.miniColors-colors').css('backgroundColor', '#' + hsb2hex({ h: hsb.h, s: 100, b: 100 })).end()
- .find('.miniColors-opacity').css('backgroundColor', '#' + hsb2hex({ h: hsb.h, s: hsb.s, b: hsb.b })).end();
-
- // Set colorPicker position
- var colorPosition = input.data('colorPosition');
- if( !colorPosition ) colorPosition = getColorPositionFromHSB(hsb);
- selector.find('.miniColors-colorPicker')
- .css('top', colorPosition.y + 'px')
- .css('left', colorPosition.x + 'px');
-
- // Set huePicker position
- var huePosition = input.data('huePosition');
- if( !huePosition ) huePosition = getHuePositionFromHSB(hsb);
- selector.find('.miniColors-huePicker').css('top', huePosition + 'px');
-
- // Set opacity position
- var opacityPosition = input.data('opacityPosition');
- if( !opacityPosition ) opacityPosition = getOpacityPositionFromAlpha(input.attr('data-opacity'));
- selector.find('.miniColors-opacityPicker').css('top', opacityPosition + 'px');
-
- // Set input data
- input
- .data('selector', selector)
- .data('huePicker', selector.find('.miniColors-huePicker'))
- .data('opacityPicker', selector.find('.miniColors-opacityPicker'))
- .data('colorPicker', selector.find('.miniColors-colorPicker'))
- .data('mousebutton', 0);
-
- $('BODY').append(selector);
-
- // Position the selector
- var trigger = input.data('trigger'),
- hidden = !input.is(':visible'),
- top = hidden ? trigger.offset().top + trigger.outerHeight() : input.offset().top + input.outerHeight(),
- left = hidden ? trigger.offset().left : input.offset().left,
- selectorWidth = selector.outerWidth(),
- selectorHeight = selector.outerHeight(),
- triggerWidth = trigger.outerWidth(),
- triggerHeight = trigger.outerHeight(),
- windowHeight = $(window).height(),
- windowWidth = $(window).width(),
- scrollTop = $(window).scrollTop(),
- scrollLeft = $(window).scrollLeft();
-
- // Adjust based on viewport
- if( (top + selectorHeight) > windowHeight + scrollTop ) top = top - selectorHeight - triggerHeight;
- if( (left + selectorWidth) > windowWidth + scrollLeft ) left = left - selectorWidth + triggerWidth;
-
- // Set position and show
- selector.css({
- top: top,
- left: left
- }).fadeIn(100);
-
- // Prevent text selection in IE
- selector.on('selectstart', function() { return false; });
-
- // Hide on resize (IE7/8 trigger this when any element is resized...)
- if( !$.browser.msie || ($.browser.msie && $.browser.version >= 9) ) {
- $(window).on('resize.miniColors', function(event) {
- hide(input);
- });
- }
-
- $(document)
- .on('mousedown.miniColors touchstart.miniColors', function(event) {
-
- input.data('mousebutton', 1);
- var testSubject = $(event.target).parents().andSelf();
-
- if( testSubject.hasClass('miniColors-colors') ) {
- event.preventDefault();
- input.data('moving', 'colors');
- moveColor(input, event);
- }
-
- if( testSubject.hasClass('miniColors-hues') ) {
- event.preventDefault();
- input.data('moving', 'hues');
- moveHue(input, event);
- }
-
- if( testSubject.hasClass('miniColors-opacity') ) {
- event.preventDefault();
- input.data('moving', 'opacity');
- moveOpacity(input, event);
- }
-
- if( testSubject.hasClass('miniColors-selector') ) {
- event.preventDefault();
- return;
- }
-
- if( testSubject.hasClass('miniColors') ) return;
-
- hide(input);
- })
- .on('mouseup.miniColors touchend.miniColors', function(event) {
- event.preventDefault();
- input.data('mousebutton', 0).removeData('moving');
- })
- .on('mousemove.miniColors touchmove.miniColors', function(event) {
- event.preventDefault();
- if( input.data('mousebutton') === 1 ) {
- if( input.data('moving') === 'colors' ) moveColor(input, event);
- if( input.data('moving') === 'hues' ) moveHue(input, event);
- if( input.data('moving') === 'opacity' ) moveOpacity(input, event);
- }
- });
-
- // Fire open callback
- if( input.data('open') ) {
- input.data('open').call(input.get(0), '#' + hsb2hex(hsb), $.extend(hsb2rgb(hsb), { a: parseFloat(input.attr('data-opacity')) }));
- }
-
- };
-
- var hide = function(input) {
-
- //
- // Hides one or more miniColors selectors
- //
-
- // Hide all other instances if input isn't specified
- if( !input ) input = $('.miniColors');
-
- input.each( function() {
- var selector = $(this).data('selector');
- $(this).removeData('selector');
- $(selector).fadeOut(100, function() {
- // Fire close callback
- if( input.data('close') ) {
- var hsb = input.data('hsb'), hex = hsb2hex(hsb);
- input.data('close').call(input.get(0), '#' + hex, $.extend(hsb2rgb(hsb), { a: parseFloat(input.attr('data-opacity')) }));
- }
- $(this).remove();
- });
- });
-
- $(document).off('.miniColors');
-
- };
-
- var moveColor = function(input, event) {
-
- var colorPicker = input.data('colorPicker');
-
- colorPicker.hide();
-
- var position = {
- x: event.pageX,
- y: event.pageY
- };
-
- // Touch support
- if( event.originalEvent.changedTouches ) {
- position.x = event.originalEvent.changedTouches[0].pageX;
- position.y = event.originalEvent.changedTouches[0].pageY;
- }
- position.x = position.x - input.data('selector').find('.miniColors-colors').offset().left - 6;
- position.y = position.y - input.data('selector').find('.miniColors-colors').offset().top - 6;
- if( position.x <= -5 ) position.x = -5;
- if( position.x >= 144 ) position.x = 144;
- if( position.y <= -5 ) position.y = -5;
- if( position.y >= 144 ) position.y = 144;
-
- input.data('colorPosition', position);
- colorPicker.css('left', position.x).css('top', position.y).show();
-
- // Calculate saturation
- var s = Math.round((position.x + 5) * 0.67);
- if( s < 0 ) s = 0;
- if( s > 100 ) s = 100;
-
- // Calculate brightness
- var b = 100 - Math.round((position.y + 5) * 0.67);
- if( b < 0 ) b = 0;
- if( b > 100 ) b = 100;
-
- // Update HSB values
- var hsb = input.data('hsb');
- hsb.s = s;
- hsb.b = b;
-
- // Set color
- setColor(input, hsb, true);
- };
-
- var moveHue = function(input, event) {
-
- var huePicker = input.data('huePicker');
-
- huePicker.hide();
-
- var position = event.pageY;
-
- // Touch support
- if( event.originalEvent.changedTouches ) {
- position = event.originalEvent.changedTouches[0].pageY;
- }
-
- position = position - input.data('selector').find('.miniColors-colors').offset().top - 1;
- if( position <= -1 ) position = -1;
- if( position >= 149 ) position = 149;
- input.data('huePosition', position);
- huePicker.css('top', position).show();
-
- // Calculate hue
- var h = Math.round((150 - position - 1) * 2.4);
- if( h < 0 ) h = 0;
- if( h > 360 ) h = 360;
-
- // Update HSB values
- var hsb = input.data('hsb');
- hsb.h = h;
-
- // Set color
- setColor(input, hsb, true);
-
- };
-
- var moveOpacity = function(input, event) {
-
- var opacityPicker = input.data('opacityPicker');
-
- opacityPicker.hide();
-
- var position = event.pageY;
-
- // Touch support
- if( event.originalEvent.changedTouches ) {
- position = event.originalEvent.changedTouches[0].pageY;
- }
-
- position = position - input.data('selector').find('.miniColors-colors').offset().top - 1;
- if( position <= -1 ) position = -1;
- if( position >= 149 ) position = 149;
- input.data('opacityPosition', position);
- opacityPicker.css('top', position).show();
-
- // Calculate opacity
- var alpha = parseFloat((150 - position - 1) / 150).toFixed(2);
- if( alpha < 0 ) alpha = 0;
- if( alpha > 1 ) alpha = 1;
-
- // Update opacity
- input
- .data('alpha', alpha)
- .attr('data-opacity', alpha);
-
- // Set color
- setColor(input, input.data('hsb'), true);
-
- };
-
- var setColor = function(input, hsb, updateInput) {
- input.data('hsb', hsb);
- var hex = hsb2hex(hsb),
- selector = $(input.data('selector'));
- if( updateInput ) input.val( '#' + convertCase(hex, input.data('letterCase')) );
-
- selector
- .find('.miniColors-colors').css('backgroundColor', '#' + hsb2hex({ h: hsb.h, s: 100, b: 100 })).end()
- .find('.miniColors-opacity').css('backgroundColor', '#' + hex).end();
-
- var rgb = hsb2rgb(hsb);
-
- // Set background color (also fallback for non RGBA browsers)
- input.data('trigger').css('backgroundColor', '#' + hex);
-
- // Set background color + opacity
- if( input.data('opacity') ) {
- input.data('trigger').css('backgroundColor', 'rgba(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ', ' + input.attr('data-opacity') + ')');
- }
-
- // Fire change callback
- if( input.data('change') ) {
- if( (hex + ',' + input.attr('data-opacity')) === input.data('lastChange') ) return;
- input.data('change').call(input.get(0), '#' + hex, $.extend(hsb2rgb(hsb), { a: parseFloat(input.attr('data-opacity')) }));
- input.data('lastChange', hex + ',' + input.attr('data-opacity'));
- }
-
- };
-
- var setColorFromInput = function(input) {
-
- input.val('#' + cleanHex(input.val()));
- var hex = expandHex(input.val());
- if( !hex ) return false;
-
- // Get HSB equivalent
- var hsb = hex2hsb(hex);
-
- // Set colorPicker position
- var colorPosition = getColorPositionFromHSB(hsb);
- var colorPicker = $(input.data('colorPicker'));
- colorPicker.css('top', colorPosition.y + 'px').css('left', colorPosition.x + 'px');
- input.data('colorPosition', colorPosition);
-
- // Set huePosition position
- var huePosition = getHuePositionFromHSB(hsb);
- var huePicker = $(input.data('huePicker'));
- huePicker.css('top', huePosition + 'px');
- input.data('huePosition', huePosition);
-
- // Set opacity position
- var opacityPosition = getOpacityPositionFromAlpha(input.attr('data-opacity'));
- var opacityPicker = $(input.data('opacityPicker'));
- opacityPicker.css('top', opacityPosition + 'px');
- input.data('opacityPosition', opacityPosition);
- setColor(input, hsb);
-
- return true;
-
- };
-
- var convertCase = function(string, letterCase) {
- if( letterCase === 'uppercase' ) {
- return string.toUpperCase();
- } else {
- return string.toLowerCase();
- }
- };
-
- var getColorPositionFromHSB = function(hsb) {
- var x = Math.ceil(hsb.s / 0.67);
- if( x < 0 ) x = 0;
- if( x > 150 ) x = 150;
- var y = 150 - Math.ceil(hsb.b / 0.67);
- if( y < 0 ) y = 0;
- if( y > 150 ) y = 150;
- return { x: x - 5, y: y - 5 };
- };
-
- var getHuePositionFromHSB = function(hsb) {
- var y = 150 - (hsb.h / 2.4);
- if( y < 0 ) h = 0;
- if( y > 150 ) h = 150;
- return y;
- };
-
- var getOpacityPositionFromAlpha = function(alpha) {
- var y = 150 * alpha;
- if( y < 0 ) y = 0;
- if( y > 150 ) y = 150;
- return 150 - y;
- };
-
- var cleanHex = function(hex) {
- return hex.replace(/[^A-F0-9]/ig, '');
- };
-
- var expandHex = function(hex) {
- hex = cleanHex(hex);
- if( !hex ) return null;
- if( hex.length === 3 ) hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
- return hex.length === 6 ? hex : null;
- };
-
- var hsb2rgb = function(hsb) {
- var rgb = {};
- var h = Math.round(hsb.h);
- var s = Math.round(hsb.s*255/100);
- var v = Math.round(hsb.b*255/100);
- if(s === 0) {
- rgb.r = rgb.g = rgb.b = v;
- } else {
- var t1 = v;
- var t2 = (255 - s) * v / 255;
- var t3 = (t1 - t2) * (h % 60) / 60;
- if( h === 360 ) h = 0;
- if( h < 60 ) { rgb.r = t1; rgb.b = t2; rgb.g = t2 + t3; }
- else if( h < 120 ) {rgb.g = t1; rgb.b = t2; rgb.r = t1 - t3; }
- else if( h < 180 ) {rgb.g = t1; rgb.r = t2; rgb.b = t2 + t3; }
- else if( h < 240 ) {rgb.b = t1; rgb.r = t2; rgb.g = t1 - t3; }
- else if( h < 300 ) {rgb.b = t1; rgb.g = t2; rgb.r = t2 + t3; }
- else if( h < 360 ) {rgb.r = t1; rgb.g = t2; rgb.b = t1 - t3; }
- else { rgb.r = 0; rgb.g = 0; rgb.b = 0; }
- }
- return {
- r: Math.round(rgb.r),
- g: Math.round(rgb.g),
- b: Math.round(rgb.b)
- };
- };
-
- var rgb2hex = function(rgb) {
- var hex = [
- rgb.r.toString(16),
- rgb.g.toString(16),
- rgb.b.toString(16)
- ];
- $.each(hex, function(nr, val) {
- if (val.length === 1) hex[nr] = '0' + val;
- });
- return hex.join('');
- };
-
- var hex2rgb = function(hex) {
- hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex), 16);
-
- return {
- r: hex >> 16,
- g: (hex & 0x00FF00) >> 8,
- b: (hex & 0x0000FF)
- };
- };
-
- var rgb2hsb = function(rgb) {
- var hsb = { h: 0, s: 0, b: 0 };
- var min = Math.min(rgb.r, rgb.g, rgb.b);
- var max = Math.max(rgb.r, rgb.g, rgb.b);
- var delta = max - min;
- hsb.b = max;
- hsb.s = max !== 0 ? 255 * delta / max : 0;
- if( hsb.s !== 0 ) {
- if( rgb.r === max ) {
- hsb.h = (rgb.g - rgb.b) / delta;
- } else if( rgb.g === max ) {
- hsb.h = 2 + (rgb.b - rgb.r) / delta;
- } else {
- hsb.h = 4 + (rgb.r - rgb.g) / delta;
- }
- } else {
- hsb.h = -1;
- }
- hsb.h *= 60;
- if( hsb.h < 0 ) {
- hsb.h += 360;
- }
- hsb.s *= 100/255;
- hsb.b *= 100/255;
- return hsb;
- };
-
- var hex2hsb = function(hex) {
- var hsb = rgb2hsb(hex2rgb(hex));
- // Zero out hue marker for black, white, and grays (saturation === 0)
- if( hsb.s === 0 ) hsb.h = 360;
- return hsb;
- };
-
- var hsb2hex = function(hsb) {
- return rgb2hex(hsb2rgb(hsb));
- };
-
-
- // Handle calls to $([selector]).miniColors()
- switch(o) {
-
- case 'readonly':
-
- $(this).each( function() {
- if( !$(this).hasClass('miniColors') ) return;
- $(this).prop('readonly', data);
- });
-
- return $(this);
-
- case 'disabled':
-
- $(this).each( function() {
- if( !$(this).hasClass('miniColors') ) return;
- if( data ) {
- disable($(this));
- } else {
- enable($(this));
- }
- });
-
- return $(this);
-
- case 'value':
-
- // Getter
- if( data === undefined ) {
- if( !$(this).hasClass('miniColors') ) return;
- var input = $(this),
- hex = expandHex(input.val());
- return hex ? '#' + convertCase(hex, input.data('letterCase')) : null;
- }
-
- // Setter
- $(this).each( function() {
- if( !$(this).hasClass('miniColors') ) return;
- $(this).val(data);
- setColorFromInput($(this));
- });
-
- return $(this);
-
- case 'opacity':
-
- // Getter
- if( data === undefined ) {
- if( !$(this).hasClass('miniColors') ) return;
- if( $(this).data('opacity') ) {
- return parseFloat($(this).attr('data-opacity'));
- } else {
- return null;
- }
- }
-
- // Setter
- $(this).each( function() {
- if( !$(this).hasClass('miniColors') ) return;
- if( data < 0 ) data = 0;
- if( data > 1 ) data = 1;
- $(this).attr('data-opacity', data).data('alpha', data);
- setColorFromInput($(this));
- });
-
- return $(this);
-
- case 'destroy':
-
- $(this).each( function() {
- if( !$(this).hasClass('miniColors') ) return;
- destroy($(this));
- });
-
- return $(this);
-
- default:
-
- if( !o ) o = {};
-
- $(this).each( function() {
-
- // Must be called on an input element
- if( $(this)[0].tagName.toLowerCase() !== 'input' ) return;
-
- // If a trigger is present, the control was already created
- if( $(this).data('trigger') ) return;
-
- // Create the control
- create($(this), o, data);
-
- });
-
- return $(this);
-
- }
-
- }
-
- });
-
-})(jQuery); \ No newline at end of file
diff --git a/3rdparty/miniColors/js/jquery.miniColors.min.js b/3rdparty/miniColors/js/jquery.miniColors.min.js
deleted file mode 100755
index 1d3346455b0..00000000000
--- a/3rdparty/miniColors/js/jquery.miniColors.min.js
+++ /dev/null
@@ -1,9 +0,0 @@
-/*
- * jQuery miniColors: A small color selector
- *
- * Copyright 2012 Cory LaViska for A Beautiful Site, LLC. (http://www.abeautifulsite.net/)
- *
- * Dual licensed under the MIT or GPL Version 2 licenses
- *
-*/
-if(jQuery)(function($){$.extend($.fn,{miniColors:function(o,data){var create=function(input,o,data){var color=expandHex(input.val())||'ffffff',hsb=hex2hsb(color),rgb=hsb2rgb(hsb),alpha=parseFloat(input.attr('data-opacity')).toFixed(2);if(alpha>1)alpha=1;if(alpha<0)alpha=0;var trigger=$('<a class="miniColors-trigger" style="background-color: #'+color+'" href="#"></a>');trigger.insertAfter(input);trigger.wrap('<span class="miniColors-triggerWrap"></span>');if(o.opacity){trigger.css('backgroundColor','rgba('+rgb.r+', '+rgb.g+', '+rgb.b+', '+alpha+')')}input.addClass('miniColors').data('original-maxlength',input.attr('maxlength')||null).data('original-autocomplete',input.attr('autocomplete')||null).data('letterCase',o.letterCase==='uppercase'?'uppercase':'lowercase').data('opacity',o.opacity?true:false).data('alpha',alpha).data('trigger',trigger).data('hsb',hsb).data('change',o.change?o.change:null).data('close',o.close?o.close:null).data('open',o.open?o.open:null).attr('maxlength',7).attr('autocomplete','off').val('#'+convertCase(color,o.letterCase));if(o.readonly||input.prop('readonly'))input.prop('readonly',true);if(o.disabled||input.prop('disabled'))disable(input);trigger.on('click.miniColors',function(event){event.preventDefault();if(input.val()==='')input.val('#');show(input)});input.on('focus.miniColors',function(event){if(input.val()==='')input.val('#');show(input)});input.on('blur.miniColors',function(event){var hex=expandHex(hsb2hex(input.data('hsb')));input.val(hex?'#'+convertCase(hex,input.data('letterCase')):'')});input.on('keydown.miniColors',function(event){if(event.keyCode===9)hide(input)});input.on('keyup.miniColors',function(event){setColorFromInput(input)});input.on('paste.miniColors',function(event){setTimeout(function(){setColorFromInput(input)},5)})};var destroy=function(input){hide();input=$(input);input.data('trigger').parent().remove();input.attr('autocomplete',input.data('original-autocomplete')).attr('maxlength',input.data('original-maxlength')).removeData().removeClass('miniColors').off('.miniColors');$(document).off('.miniColors')};var enable=function(input){input.prop('disabled',false).data('trigger').parent().removeClass('disabled')};var disable=function(input){hide(input);input.prop('disabled',true).data('trigger').parent().addClass('disabled')};var show=function(input){if(input.prop('disabled'))return false;hide();var selector=$('<div class="miniColors-selector"></div>');selector.append('<div class="miniColors-hues"><div class="miniColors-huePicker"></div></div>').append('<div class="miniColors-colors" style="background-color: #FFF;"><div class="miniColors-colorPicker"><div class="miniColors-colorPicker-inner"></div></div>').css('display','none').addClass(input.attr('class'));if(input.data('opacity')){selector.addClass('opacity').prepend('<div class="miniColors-opacity"><div class="miniColors-opacityPicker"></div></div>')}var hsb=input.data('hsb');selector.find('.miniColors-colors').css('backgroundColor','#'+hsb2hex({h:hsb.h,s:100,b:100})).end().find('.miniColors-opacity').css('backgroundColor','#'+hsb2hex({h:hsb.h,s:hsb.s,b:hsb.b})).end();var colorPosition=input.data('colorPosition');if(!colorPosition)colorPosition=getColorPositionFromHSB(hsb);selector.find('.miniColors-colorPicker').css('top',colorPosition.y+'px').css('left',colorPosition.x+'px');var huePosition=input.data('huePosition');if(!huePosition)huePosition=getHuePositionFromHSB(hsb);selector.find('.miniColors-huePicker').css('top',huePosition+'px');var opacityPosition=input.data('opacityPosition');if(!opacityPosition)opacityPosition=getOpacityPositionFromAlpha(input.attr('data-opacity'));selector.find('.miniColors-opacityPicker').css('top',opacityPosition+'px');input.data('selector',selector).data('huePicker',selector.find('.miniColors-huePicker')).data('opacityPicker',selector.find('.miniColors-opacityPicker')).data('colorPicker',selector.find('.miniColors-colorPicker')).data('mousebutton',0);$('BODY').append(selector);var trigger=input.data('trigger'),hidden=!input.is(':visible'),top=hidden?trigger.offset().top+trigger.outerHeight():input.offset().top+input.outerHeight(),left=hidden?trigger.offset().left:input.offset().left,selectorWidth=selector.outerWidth(),selectorHeight=selector.outerHeight(),triggerWidth=trigger.outerWidth(),triggerHeight=trigger.outerHeight(),windowHeight=$(window).height(),windowWidth=$(window).width(),scrollTop=$(window).scrollTop(),scrollLeft=$(window).scrollLeft();if((top+selectorHeight)>windowHeight+scrollTop)top=top-selectorHeight-triggerHeight;if((left+selectorWidth)>windowWidth+scrollLeft)left=left-selectorWidth+triggerWidth;selector.css({top:top,left:left}).fadeIn(100);selector.on('selectstart',function(){return false});if(!$.browser.msie||($.browser.msie&&$.browser.version>=9)){$(window).on('resize.miniColors',function(event){hide(input)})}$(document).on('mousedown.miniColors touchstart.miniColors',function(event){input.data('mousebutton',1);var testSubject=$(event.target).parents().andSelf();if(testSubject.hasClass('miniColors-colors')){event.preventDefault();input.data('moving','colors');moveColor(input,event)}if(testSubject.hasClass('miniColors-hues')){event.preventDefault();input.data('moving','hues');moveHue(input,event)}if(testSubject.hasClass('miniColors-opacity')){event.preventDefault();input.data('moving','opacity');moveOpacity(input,event)}if(testSubject.hasClass('miniColors-selector')){event.preventDefault();return}if(testSubject.hasClass('miniColors'))return;hide(input)}).on('mouseup.miniColors touchend.miniColors',function(event){event.preventDefault();input.data('mousebutton',0).removeData('moving')}).on('mousemove.miniColors touchmove.miniColors',function(event){event.preventDefault();if(input.data('mousebutton')===1){if(input.data('moving')==='colors')moveColor(input,event);if(input.data('moving')==='hues')moveHue(input,event);if(input.data('moving')==='opacity')moveOpacity(input,event)}});if(input.data('open')){input.data('open').call(input.get(0),'#'+hsb2hex(hsb),$.extend(hsb2rgb(hsb),{a:parseFloat(input.attr('data-opacity'))}))}};var hide=function(input){if(!input)input=$('.miniColors');input.each(function(){var selector=$(this).data('selector');$(this).removeData('selector');$(selector).fadeOut(100,function(){if(input.data('close')){var hsb=input.data('hsb'),hex=hsb2hex(hsb);input.data('close').call(input.get(0),'#'+hex,$.extend(hsb2rgb(hsb),{a:parseFloat(input.attr('data-opacity'))}))}$(this).remove()})});$(document).off('.miniColors')};var moveColor=function(input,event){var colorPicker=input.data('colorPicker');colorPicker.hide();var position={x:event.pageX,y:event.pageY};if(event.originalEvent.changedTouches){position.x=event.originalEvent.changedTouches[0].pageX;position.y=event.originalEvent.changedTouches[0].pageY}position.x=position.x-input.data('selector').find('.miniColors-colors').offset().left-6;position.y=position.y-input.data('selector').find('.miniColors-colors').offset().top-6;if(position.x<=-5)position.x=-5;if(position.x>=144)position.x=144;if(position.y<=-5)position.y=-5;if(position.y>=144)position.y=144;input.data('colorPosition',position);colorPicker.css('left',position.x).css('top',position.y).show();var s=Math.round((position.x+5)*0.67);if(s<0)s=0;if(s>100)s=100;var b=100-Math.round((position.y+5)*0.67);if(b<0)b=0;if(b>100)b=100;var hsb=input.data('hsb');hsb.s=s;hsb.b=b;setColor(input,hsb,true)};var moveHue=function(input,event){var huePicker=input.data('huePicker');huePicker.hide();var position=event.pageY;if(event.originalEvent.changedTouches){position=event.originalEvent.changedTouches[0].pageY}position=position-input.data('selector').find('.miniColors-colors').offset().top-1;if(position<=-1)position=-1;if(position>=149)position=149;input.data('huePosition',position);huePicker.css('top',position).show();var h=Math.round((150-position-1)*2.4);if(h<0)h=0;if(h>360)h=360;var hsb=input.data('hsb');hsb.h=h;setColor(input,hsb,true)};var moveOpacity=function(input,event){var opacityPicker=input.data('opacityPicker');opacityPicker.hide();var position=event.pageY;if(event.originalEvent.changedTouches){position=event.originalEvent.changedTouches[0].pageY}position=position-input.data('selector').find('.miniColors-colors').offset().top-1;if(position<=-1)position=-1;if(position>=149)position=149;input.data('opacityPosition',position);opacityPicker.css('top',position).show();var alpha=parseFloat((150-position-1)/150).toFixed(2);if(alpha<0)alpha=0;if(alpha>1)alpha=1;input.data('alpha',alpha).attr('data-opacity',alpha);setColor(input,input.data('hsb'),true)};var setColor=function(input,hsb,updateInput){input.data('hsb',hsb);var hex=hsb2hex(hsb),selector=$(input.data('selector'));if(updateInput)input.val('#'+convertCase(hex,input.data('letterCase')));selector.find('.miniColors-colors').css('backgroundColor','#'+hsb2hex({h:hsb.h,s:100,b:100})).end().find('.miniColors-opacity').css('backgroundColor','#'+hex).end();var rgb=hsb2rgb(hsb);input.data('trigger').css('backgroundColor','#'+hex);if(input.data('opacity')){input.data('trigger').css('backgroundColor','rgba('+rgb.r+', '+rgb.g+', '+rgb.b+', '+input.attr('data-opacity')+')')}if(input.data('change')){if((hex+','+input.attr('data-opacity'))===input.data('lastChange'))return;input.data('change').call(input.get(0),'#'+hex,$.extend(hsb2rgb(hsb),{a:parseFloat(input.attr('data-opacity'))}));input.data('lastChange',hex+','+input.attr('data-opacity'))}};var setColorFromInput=function(input){input.val('#'+cleanHex(input.val()));var hex=expandHex(input.val());if(!hex)return false;var hsb=hex2hsb(hex);var colorPosition=getColorPositionFromHSB(hsb);var colorPicker=$(input.data('colorPicker'));colorPicker.css('top',colorPosition.y+'px').css('left',colorPosition.x+'px');input.data('colorPosition',colorPosition);var huePosition=getHuePositionFromHSB(hsb);var huePicker=$(input.data('huePicker'));huePicker.css('top',huePosition+'px');input.data('huePosition',huePosition);var opacityPosition=getOpacityPositionFromAlpha(input.attr('data-opacity'));var opacityPicker=$(input.data('opacityPicker'));opacityPicker.css('top',opacityPosition+'px');input.data('opacityPosition',opacityPosition);setColor(input,hsb);return true};var convertCase=function(string,letterCase){if(letterCase==='uppercase'){return string.toUpperCase()}else{return string.toLowerCase()}};var getColorPositionFromHSB=function(hsb){var x=Math.ceil(hsb.s/0.67);if(x<0)x=0;if(x>150)x=150;var y=150-Math.ceil(hsb.b/0.67);if(y<0)y=0;if(y>150)y=150;return{x:x-5,y:y-5}};var getHuePositionFromHSB=function(hsb){var y=150-(hsb.h/2.4);if(y<0)h=0;if(y>150)h=150;return y};var getOpacityPositionFromAlpha=function(alpha){var y=150*alpha;if(y<0)y=0;if(y>150)y=150;return 150-y};var cleanHex=function(hex){return hex.replace(/[^A-F0-9]/ig,'')};var expandHex=function(hex){hex=cleanHex(hex);if(!hex)return null;if(hex.length===3)hex=hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2];return hex.length===6?hex:null};var hsb2rgb=function(hsb){var rgb={};var h=Math.round(hsb.h);var s=Math.round(hsb.s*255/100);var v=Math.round(hsb.b*255/100);if(s===0){rgb.r=rgb.g=rgb.b=v}else{var t1=v;var t2=(255-s)*v/255;var t3=(t1-t2)*(h%60)/60;if(h===360)h=0;if(h<60){rgb.r=t1;rgb.b=t2;rgb.g=t2+t3}else if(h<120){rgb.g=t1;rgb.b=t2;rgb.r=t1-t3}else if(h<180){rgb.g=t1;rgb.r=t2;rgb.b=t2+t3}else if(h<240){rgb.b=t1;rgb.r=t2;rgb.g=t1-t3}else if(h<300){rgb.b=t1;rgb.g=t2;rgb.r=t2+t3}else if(h<360){rgb.r=t1;rgb.g=t2;rgb.b=t1-t3}else{rgb.r=0;rgb.g=0;rgb.b=0}}return{r:Math.round(rgb.r),g:Math.round(rgb.g),b:Math.round(rgb.b)}};var rgb2hex=function(rgb){var hex=[rgb.r.toString(16),rgb.g.toString(16),rgb.b.toString(16)];$.each(hex,function(nr,val){if(val.length===1)hex[nr]='0'+val});return hex.join('')};var hex2rgb=function(hex){hex=parseInt(((hex.indexOf('#')>-1)?hex.substring(1):hex),16);return{r:hex>>16,g:(hex&0x00FF00)>>8,b:(hex&0x0000FF)}};var rgb2hsb=function(rgb){var hsb={h:0,s:0,b:0};var min=Math.min(rgb.r,rgb.g,rgb.b);var max=Math.max(rgb.r,rgb.g,rgb.b);var delta=max-min;hsb.b=max;hsb.s=max!==0?255*delta/max:0;if(hsb.s!==0){if(rgb.r===max){hsb.h=(rgb.g-rgb.b)/delta}else if(rgb.g===max){hsb.h=2+(rgb.b-rgb.r)/delta}else{hsb.h=4+(rgb.r-rgb.g)/delta}}else{hsb.h=-1}hsb.h*=60;if(hsb.h<0){hsb.h+=360}hsb.s*=100/255;hsb.b*=100/255;return hsb};var hex2hsb=function(hex){var hsb=rgb2hsb(hex2rgb(hex));if(hsb.s===0)hsb.h=360;return hsb};var hsb2hex=function(hsb){return rgb2hex(hsb2rgb(hsb))};switch(o){case'readonly':$(this).each(function(){if(!$(this).hasClass('miniColors'))return;$(this).prop('readonly',data)});return $(this);case'disabled':$(this).each(function(){if(!$(this).hasClass('miniColors'))return;if(data){disable($(this))}else{enable($(this))}});return $(this);case'value':if(data===undefined){if(!$(this).hasClass('miniColors'))return;var input=$(this),hex=expandHex(input.val());return hex?'#'+convertCase(hex,input.data('letterCase')):null}$(this).each(function(){if(!$(this).hasClass('miniColors'))return;$(this).val(data);setColorFromInput($(this))});return $(this);case'opacity':if(data===undefined){if(!$(this).hasClass('miniColors'))return;if($(this).data('opacity')){return parseFloat($(this).attr('data-opacity'))}else{return null}}$(this).each(function(){if(!$(this).hasClass('miniColors'))return;if(data<0)data=0;if(data>1)data=1;$(this).attr('data-opacity',data).data('alpha',data);setColorFromInput($(this))});return $(this);case'destroy':$(this).each(function(){if(!$(this).hasClass('miniColors'))return;destroy($(this))});return $(this);default:if(!o)o={};$(this).each(function(){if($(this)[0].tagName.toLowerCase()!=='input')return;if($(this).data('trigger'))return;create($(this),o,data)});return $(this)}}})})(jQuery); \ No newline at end of file
diff --git a/3rdparty/openid/class.openid.v3.php b/3rdparty/openid/class.openid.v3.php
deleted file mode 100644
index eeb31986659..00000000000
--- a/3rdparty/openid/class.openid.v3.php
+++ /dev/null
@@ -1,326 +0,0 @@
-<?php
-/*
- FREE TO USE
- Under License: GPLv3
- Simple OpenID PHP Class
-
- Some modifications by Eddie Roosenmaallen, eddie@roosenmaallen.com
-
--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-This Class was written to make easy for you to integrate OpenID on your website.
-This is just a client, which checks for user's identity. This Class Requires CURL Module.
-It should be easy to use some other HTTP Request Method, but remember, often OpenID servers
-are using SSL.
-We need to be able to perform SSL Verification on the background to check for valid signature.
-
-HOW TO USE THIS CLASS:
- STEP 1)
- $openid = new SimpleOpenID;
- :: SET IDENTITY ::
- $openid->SetIdentity($_POST['openid_url']);
- :: SET RETURN URL ::
- $openid->SetApprovedURL('http://www.yoursite.com/return.php'); // Script which handles a response from OpenID Server
- :: SET TRUST ROOT ::
- $openid->SetTrustRoot('http://www.yoursite.com/');
- :: FETCH SERVER URL FROM IDENTITY PAGE :: [Note: It is recomended to cache this (Session, Cookie, Database)]
- $openid->GetOpenIDServer(); // Returns false if server is not found
- :: REDIRECT USER TO OPEN ID SERVER FOR APPROVAL ::
-
- :: (OPTIONAL) SET OPENID SERVER ::
- $openid->SetOpenIDServer($server_url); // If you have cached previously this, you don't have to call GetOpenIDServer and set value this directly
-
- STEP 2)
- Once user gets returned we must validate signature
- :: VALIDATE REQUEST ::
- true|false = $openid->ValidateWithServer();
-
- ERRORS:
- array = $openid->GetError(); // Get latest Error code
-
- FIELDS:
- OpenID allowes you to retreive a profile. To set what fields you'd like to get use (accepts either string or array):
- $openid->SetRequiredFields(array('email','fullname','dob','gender','postcode','country','language','timezone'));
- or
- $openid->SetOptionalFields('postcode');
-
-IMPORTANT TIPS:
-OPENID as is now, is not trust system. It is a great single-sign on method. If you want to
-store information about OpenID in your database for later use, make sure you handle url identities
-properly.
- For example:
- https://steve.myopenid.com/
- https://steve.myopenid.com
- http://steve.myopenid.com/
- http://steve.myopenid.com
- ... are representing one single user. Some OpenIDs can be in format openidserver.com/users/user/ - keep this in mind when storing identities
-
- To help you store an OpenID in your DB, you can use function:
- $openid_db_safe = $openid->OpenID_Standarize($upenid);
- This may not be comatible with current specs, but it works in current enviroment. Use this function to get openid
- in one format like steve.myopenid.com (without trailing slashes and http/https).
- Use output to insert Identity to database. Don't use this for validation - it may fail.
-
-*/
-
-class SimpleOpenID{
- var $openid_url_identity;
- var $URLs = array();
- var $error = array();
- var $fields = array(
- 'required' => array(),
- 'optional' => array(),
- );
-
- function SimpleOpenID(){
- if (!function_exists('curl_exec')) {
- die('Error: Class SimpleOpenID requires curl extension to work');
- }
- }
- function SetOpenIDServer($a){
- $this->URLs['openid_server'] = $a;
- }
- function SetTrustRoot($a){
- $this->URLs['trust_root'] = $a;
- }
- function SetCancelURL($a){
- $this->URLs['cancel'] = $a;
- }
- function SetApprovedURL($a){
- $this->URLs['approved'] = $a;
- }
- function SetRequiredFields($a){
- if (is_array($a)){
- $this->fields['required'] = $a;
- }else{
- $this->fields['required'][] = $a;
- }
- }
- function SetOptionalFields($a){
- if (is_array($a)){
- $this->fields['optional'] = $a;
- }else{
- $this->fields['optional'][] = $a;
- }
- }
- function SetIdentity($a){ // Set Identity URL
- if ((stripos($a, 'http://') === false)
- && (stripos($a, 'https://') === false)){
- $a = 'http://'.$a;
- }
-/*
- $u = parse_url(trim($a));
- if (!isset($u['path'])){
- $u['path'] = '/';
- }else if(substr($u['path'],-1,1) == '/'){
- $u['path'] = substr($u['path'], 0, strlen($u['path'])-1);
- }
- if (isset($u['query'])){ // If there is a query string, then use identity as is
- $identity = $a;
- }else{
- $identity = $u['scheme'] . '://' . $u['host'] . $u['path'];
- }
-//*/
- $this->openid_url_identity = $a;
- }
- function GetIdentity(){ // Get Identity
- return $this->openid_url_identity;
- }
- function GetError(){
- $e = $this->error;
- return array('code'=>$e[0],'description'=>$e[1]);
- }
-
- function ErrorStore($code, $desc = null){
- $errs['OPENID_NOSERVERSFOUND'] = 'Cannot find OpenID Server TAG on Identity page.';
- if ($desc == null){
- $desc = $errs[$code];
- }
- $this->error = array($code,$desc);
- }
-
- function IsError(){
- if (count($this->error) > 0){
- return true;
- }else{
- return false;
- }
- }
-
- function splitResponse($response) {
- $r = array();
- $response = explode("\n", $response);
- foreach($response as $line) {
- $line = trim($line);
- if ($line != "") {
- list($key, $value) = explode(":", $line, 2);
- $r[trim($key)] = trim($value);
- }
- }
- return $r;
- }
-
- function OpenID_Standarize($openid_identity = null){
- if ($openid_identity === null)
- $openid_identity = $this->openid_url_identity;
-
- $u = parse_url(strtolower(trim($openid_identity)));
-
- if (!isset($u['path']) || ($u['path'] == '/')) {
- $u['path'] = '';
- }
- if(substr($u['path'],-1,1) == '/'){
- $u['path'] = substr($u['path'], 0, strlen($u['path'])-1);
- }
- if (isset($u['query'])){ // If there is a query string, then use identity as is
- return $u['host'] . $u['path'] . '?' . $u['query'];
- }else{
- return $u['host'] . $u['path'];
- }
- }
-
- function array2url($arr){ // converts associated array to URL Query String
- if (!is_array($arr)){
- return false;
- }
- $query = '';
- foreach($arr as $key => $value){
- $query .= $key . "=" . $value . "&";
- }
- return $query;
- }
- function FSOCK_Request($url, $method="GET", $params = ""){
- $fp = fsockopen("ssl://www.myopenid.com", 443, $errno, $errstr, 3); // Connection timeout is 3 seconds
- if (!$fp) {
- $this->ErrorStore('OPENID_SOCKETERROR', $errstr);
- return false;
- } else {
- $request = $method . " /server HTTP/1.0\r\n";
- $request .= "User-Agent: Simple OpenID PHP Class (http://www.phpclasses.org/simple_openid)\r\n";
- $request .= "Connection: close\r\n\r\n";
- fwrite($fp, $request);
- stream_set_timeout($fp, 4); // Connection response timeout is 4 seconds
- $res = fread($fp, 2000);
- $info = stream_get_meta_data($fp);
- fclose($fp);
-
- if ($info['timed_out']) {
- $this->ErrorStore('OPENID_SOCKETTIMEOUT');
- } else {
- return $res;
- }
- }
- }
- function CURL_Request($url, $method="GET", $params = "") { // Remember, SSL MUST BE SUPPORTED
- if (is_array($params)) $params = $this->array2url($params);
- $curl = curl_init($url . ($method == "GET" && $params != "" ? "?" . $params : ""));
- curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
- curl_setopt($curl, CURLOPT_HEADER, false);
- curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($curl, CURLOPT_HTTPGET, ($method == "GET"));
- curl_setopt($curl, CURLOPT_POST, ($method == "POST"));
- if ($method == "POST") curl_setopt($curl, CURLOPT_POSTFIELDS, $params);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
- $response = curl_exec($curl);
-
- if (curl_errno($curl) == 0){
- $response;
- }else{
- $this->ErrorStore('OPENID_CURL', curl_error($curl));
- }
- return $response;
- }
-
- function HTML2OpenIDServer($content) {
- $get = array();
-
- // Get details of their OpenID server and (optional) delegate
- preg_match_all('/<link[^>]*rel=[\'"](openid2.provider )?openid.server[\'"][^>]*href=[\'"]([^\'"]+)[\'"][^>]*\/?>/i', $content, $matches1);
- preg_match_all('/<link[^>]*href=\'"([^\'"]+)[\'"][^>]*rel=[\'"](openid2.provider )?openid.server[\'"][^>]*\/?>/i', $content, $matches2);
- $servers = array_merge($matches1[2], $matches2[1]);
-
- preg_match_all('/<link[^>]*rel=[\'"]openid.delegate[\'"][^>]*href=[\'"]([^\'"]+)[\'"][^>]*\/?>/i', $content, $matches1);
-
- preg_match_all('/<link[^>]*href=[\'"]([^\'"]+)[\'"][^>]*rel=[\'"]openid.delegate[\'"][^>]*\/?>/i', $content, $matches2);
-
- $delegates = array_merge($matches1[1], $matches2[1]);
-
- $ret = array($servers, $delegates);
- return $ret;
- }
-
- function GetOpenIDServer(){
- $response = $this->CURL_Request($this->openid_url_identity);
- list($servers, $delegates) = $this->HTML2OpenIDServer($response);
- if (count($servers) == 0){
- $this->ErrorStore('OPENID_NOSERVERSFOUND');
- return false;
- }
- if (isset($delegates[0])
- && ($delegates[0] != "")){
- $this->SetIdentity($delegates[0]);
- }
- $this->SetOpenIDServer($servers[0]);
- return $servers[0];
- }
-
- function GetRedirectURL(){
- $params = array();
- $params['openid.return_to'] = urlencode($this->URLs['approved']);
- $params['openid.mode'] = 'checkid_setup';
- $params['openid.identity'] = urlencode($this->openid_url_identity);
- $params['openid.trust_root'] = urlencode($this->URLs['trust_root']);
-
- if (isset($this->fields['required'])
- && (count($this->fields['required']) > 0)) {
- $params['openid.sreg.required'] = implode(',',$this->fields['required']);
- }
- if (isset($this->fields['optional'])
- && (count($this->fields['optional']) > 0)) {
- $params['openid.sreg.optional'] = implode(',',$this->fields['optional']);
- }
- return $this->URLs['openid_server'] . "?". $this->array2url($params);
- }
-
- function Redirect(){
- $redirect_to = $this->GetRedirectURL();
- if (headers_sent()){ // Use JavaScript to redirect if content has been previously sent (not recommended, but safe)
- echo '<script language="JavaScript" type="text/javascript">window.location=\'';
- echo $redirect_to;
- echo '\';</script>';
- }else{ // Default Header Redirect
- header('Location: ' . $redirect_to);
- }
- }
-
- function ValidateWithServer(){
- $params = array(
- 'openid.assoc_handle' => urlencode($_GET['openid_assoc_handle']),
- 'openid.signed' => urlencode($_GET['openid_signed']),
- 'openid.sig' => urlencode($_GET['openid_sig'])
- );
- // Send only required parameters to confirm validity
- $arr_signed = explode(",",str_replace('sreg.','sreg_',$_GET['openid_signed']));
- for ($i=0; $i<count($arr_signed); $i++){
- $s = str_replace('sreg_','sreg.', $arr_signed[$i]);
- $c = $_GET['openid_' . $arr_signed[$i]];
- // if ($c != ""){
- $params['openid.' . $s] = urlencode($c);
- // }
- }
- $params['openid.mode'] = "check_authentication";
-
- $openid_server = $this->GetOpenIDServer();
- if ($openid_server == false){
- return false;
- }
- $response = $this->CURL_Request($openid_server,'POST',$params);
- $data = $this->splitResponse($response);
-
- if ($data['is_valid'] == "true") {
- return true;
- }else{
- return false;
- }
- }
-}
diff --git a/3rdparty/openid/phpmyid.php b/3rdparty/openid/phpmyid.php
deleted file mode 100644
index 13fd31c47ca..00000000000
--- a/3rdparty/openid/phpmyid.php
+++ /dev/null
@@ -1,1707 +0,0 @@
-<?php
-// PLEASE DO NOT EDIT THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
-
-/**
- * phpMyID - A standalone, single user, OpenID Identity Provider
- *
- * @package phpMyID
- * @author CJ Niemira <siege (at) siege (dot) org>
- * @copyright 2006-2008
- * @license http://www.gnu.org/licenses/gpl.html GNU Public License
- * @url http://siege.org/projects/phpMyID
- * @version 0.9
- */
-
-/**
- * Set a constant to indicate that phpMyID is running
- */
-define('PHPMYID_STARTED', true);
-
-/**
- * List the known types and modes
- * @name $known
- * @global array $GLOBALS['known']
- */
-$GLOBALS['known'] = array(
- 'assoc_types' => array('HMAC-SHA1'),
-
- 'openid_modes' => array('accept',
- 'associate',
- 'authorize',
- 'cancel',
- 'checkid_immediate',
- 'checkid_setup',
- 'check_authentication',
- 'error',
- 'id_res',
- 'login',
- 'logout',
- 'test'),
-
- 'session_types' => array('',
- 'DH-SHA1'),
-
- 'bigmath_types' => array('DH-SHA1'),
-);
-
-/**
- * Defined by OpenID spec
- * @name $g
- * @global integer $GLOBALS['g']
- */
-$GLOBALS['g'] = 2;
-
-/**
- * Defined by OpenID spec
- * @name $p
- * @global integer $GLOBALS['p']
- */
-$GLOBALS['p'] = '155172898181473697471232257763715539915724801966915404479707' .
-'7953140576293785419175806512274236981889937278161526466314385615958256881888' .
-'8995127215884267541995034125870655654980358010487053768147672651325574704076' .
-'5857479291291572334510643245094715007229621094194349783925984760375594985848' .
-'253359305585439638443';
-
-
-// Runmode functions
-
-/**
- * Allow the user to accept trust on a URL
- * @global array $profile
- */
-function accept_mode () {
- global $profile;
-
- // this is a user session
- user_session();
-
- // the user needs refresh urls in their session to access this mode
- if (! isset($_SESSION['post_accept_url']) || ! isset($_SESSION['cancel_accept_url']) || ! isset($_SESSION['unaccepted_url']))
- error_500('You may not access this mode directly.');
-
- // has the user accepted the trust_root?
- $accepted = @strlen($_REQUEST['accepted'])
- ? $_REQUEST['accepted']
- : null;
-
- // if so, refresh back to post_accept_url
- if ($accepted === 'yes') {
- $_SESSION['accepted_url'] = $_SESSION['unaccepted_url'];
- wrap_redirect($_SESSION['post_accept_url']);
-
- // if they rejected it, return to the client
- } elseif ($accepted === 'no') {
- wrap_redirect($_SESSION['cancel_accept_url']);
- }
-
- // if neither, offer the trust request
- $q = strpos($profile['req_url'], '?') ? '&' : '?';
- $yes = $profile['req_url'] . $q . 'accepted=yes';
- $no = $profile['req_url'] . $q . 'accepted=no';
-
- wrap_html('The client site you are attempting to log into has requested that you trust the following URL:<br/><b>' . $_SESSION['unaccepted_url'] . '</b><br/><br/>Do you wish to continue?<br/><a href="' . $yes . '">Yes</a> | <a href="' . $no . '">No</a>');
-}
-
-/** * Perform an association with a consumer
- * @global array $known
- * @global array $profile
- * @global integer $g
- * @global integer $p
- */
-function associate_mode () {
- global $g, $known, $p, $profile;
-
- // Validate the request
- if (! isset($_REQUEST['openid_mode']) || $_REQUEST['openid_mode'] != 'associate')
- error_400();
-
- // Get the request options, using defaults as necessary
- $assoc_type = (@strlen($_REQUEST['openid_assoc_type'])
- && in_array($_REQUEST['openid_assoc_type'], $known['assoc_types']))
- ? $_REQUEST['openid_assoc_type']
- : 'HMAC-SHA1';
-
- $session_type = (@strlen($_REQUEST['openid_session_type'])
- && in_array($_REQUEST['openid_session_type'], $known['session_types']))
- ? $_REQUEST['openid_session_type']
- : '';
-
- $dh_modulus = (@strlen($_REQUEST['openid_dh_modulus']))
- ? long(base64_decode($_REQUEST['openid_dh_modulus']))
- : ($session_type == 'DH-SHA1'
- ? $p
- : null);
-
- $dh_gen = (@strlen($_REQUEST['openid_dh_gen']))
- ? long(base64_decode($_REQUEST['openid_dh_gen']))
- : ($session_type == 'DH-SHA1'
- ? $g
- : null);
-
- $dh_consumer_public = (@strlen($_REQUEST['openid_dh_consumer_public']))
- ? $_REQUEST['openid_dh_consumer_public']
- : ($session_type == 'DH-SHA1'
- ? error_post('dh_consumer_public was not specified')
- : null);
-
- $lifetime = time() + $profile['lifetime'];
-
- // Create standard keys
- $keys = array(
- 'assoc_type' => $assoc_type,
- 'expires_in' => $profile['lifetime']
- );
-
- // If I can't handle bigmath, default to plaintext sessions
- if (in_array($session_type, $known['bigmath_types']) && $profile['use_bigmath'] === false)
- $session_type = null;
-
- // Add response keys based on the session type
- switch ($session_type) {
- case 'DH-SHA1':
- // Create the associate id and shared secret now
- list ($assoc_handle, $shared_secret) = new_assoc($lifetime);
-
- // Compute the Diffie-Hellman stuff
- $private_key = random($dh_modulus);
- $public_key = bmpowmod($dh_gen, $private_key, $dh_modulus);
- $remote_key = long(base64_decode($dh_consumer_public));
- $ss = bmpowmod($remote_key, $private_key, $dh_modulus);
-
- $keys['assoc_handle'] = $assoc_handle;
- $keys['session_type'] = $session_type;
- $keys['dh_server_public'] = base64_encode(bin($public_key));
- $keys['enc_mac_key'] = base64_encode(x_or(sha1_20(bin($ss)), $shared_secret));
-
- break;
-
- default:
- // Create the associate id and shared secret now
- list ($assoc_handle, $shared_secret) = new_assoc($lifetime);
-
- $keys['assoc_handle'] = $assoc_handle;
- $keys['mac_key'] = base64_encode($shared_secret);
- }
-
- // Return the keys
- wrap_kv($keys);
-}
-
-
-/**
- * Perform a user authorization
- * @global array $profile
- */
-function authorize_mode () {
- global $profile;
- global $USERNAME;
- global $IDENTITY;
-
- // this is a user session
-
- // the user needs refresh urls in their session to access this mode
- if (! isset($_SESSION['post_auth_url']) || ! isset($_SESSION['cancel_auth_url']))
- error_500('You may not access this mode directly.');
-
- $profile['idp_url']=$IDENTITY;
- if (isset($_SERVER['PHP_AUTH_USER']) && $profile['authorized'] === false && $_SERVER['PHP_AUTH_USER']==$USERNAME) {
- if (OCP\User::checkPassword($USERNAME, $_SERVER['PHP_AUTH_PW'])) {// successful login!
- // return to the refresh url if they get in
- $_SESSION['openid_auth']=true;
- $_SESSION['openid_user']=$USERNAME;
- wrap_redirect($_SESSION['post_auth_url']);
-
- // failed login
- } else {
- $_SESSION['failures']++;
- debug('Login failed');
- debug('Fail count: ' . $_SESSION['failures']);
- }
-
- }
-
- // if we get this far the user is not authorized, so send the headers
- $uid = uniqid(mt_rand(1,9));
- $_SESSION['uniqid'] = $uid;
-
-// debug('Prompting user to log in. Stale? ' . $stale);
- header('HTTP/1.0 401 Unauthorized');
-// header(sprintf('WWW-Authenticate: Digest qop="auth-int, auth", realm="%s", domain="%s", nonce="%s", opaque="%s", stale="%s", algorithm="MD5"', $profile['auth_realm'], $profile['auth_domain'], $uid, md5($profile['auth_realm']), $stale ? 'true' : 'false'));
- header('WWW-Authenticate: Basic realm="ownCloud"');
- $q = strpos($_SESSION['cancel_auth_url'], '?') ? '&' : '?';
- wrap_refresh($_SESSION['cancel_auth_url'] . $q . 'openid.mode=cancel');
-// die('401 Unauthorized');
-}
-
-
-/**
- * Handle a consumer's request for cancellation.
- */
-function cancel_mode () {
- wrap_html('Request cancelled.');
-}
-
-
-/**
- * Handle a consumer's request to see if the user is authenticated
- */
-function check_authentication_mode () {
- // Validate the request
- if (! isset($_REQUEST['openid_mode']) || $_REQUEST['openid_mode'] != 'check_authentication')
- error_400();
-
- $assoc_handle = @strlen($_REQUEST['openid_assoc_handle'])
- ? $_REQUEST['openid_assoc_handle']
- : error_post('Missing assoc_handle');
-
- $sig = @strlen($_REQUEST['openid_sig'])
- ? $_REQUEST['openid_sig']
- : error_post('Missing sig');
-
- $signed = @strlen($_REQUEST['openid_signed'])
- ? $_REQUEST['openid_signed']
- : error_post('Missing signed');
-
- // Prepare the return keys
- $keys = array(
- 'openid.mode' => 'id_res'
- );
-
- // Invalidate the assoc handle if we need to
- if (@strlen($_REQUEST['openid_invalidate_handle'])) {
- destroy_assoc_handle($_REQUEST['openid_invalidate_handle']);
-
- $keys['invalidate_handle'] = $_REQUEST['openid_invalidate_handle'];
- }
-
- // Validate the sig by recreating the kv pair and signing
- $_REQUEST['openid_mode'] = 'id_res';
- $tokens = '';
- foreach (explode(',', $signed) as $param) {
- $post = preg_replace('/\./', '_', $param);
- $tokens .= sprintf("%s:%s\n", $param, $_REQUEST['openid_' . $post]);
- }
-
- // Add the sreg stuff, if we've got it
- if (isset($sreg_required)) {
- foreach (explode(',', $sreg_required) as $key) {
- if (! isset($sreg[$key]))
- continue;
- $skey = 'sreg.' . $key;
-
- $tokens .= sprintf("%s:%s\n", $skey, $sreg[$key]);
- $keys[$skey] = $sreg[$key];
- $fields[] = $skey;
- }
- }
-
- // Look up the consumer's shared_secret and timeout
- list ($shared_secret, $expires) = secret($assoc_handle);
-
- // if I can't verify the assoc_handle, or if it's expired
- if ($shared_secret == false || (is_numeric($expires) && $expires < time())) {
- $keys['is_valid'] = 'false';
-
- } else {
- $ok = base64_encode(hmac($shared_secret, $tokens));
- $keys['is_valid'] = ($sig == $ok) ? 'true' : 'false';
- }
-
- // Return the keys
- wrap_kv($keys);
-}
-
-
-/**
- * Handle a consumer's request to see if the end user is logged in
- * @global array $known
- * @global array $profile
- * @global array $sreg
- */
-function checkid ( $wait ) {
- global $known, $profile, $sreg;
- global $USERNAME;
-
- // This is a user session
- user_session();
-
- // Get the options, use defaults as necessary
- $return_to = isset($_REQUEST['openid_return_to'])
- ? $_REQUEST['openid_return_to']
- : error_400('Missing return_to');
-
- $identity = isset($_REQUEST['openid_identity'])
- ? $_REQUEST['openid_identity']
- : error_get($return_to, 'Missing identity');
-
- $assoc_handle = isset($_REQUEST['openid_assoc_handle'])
- ? $_REQUEST['openid_assoc_handle']
- : null;
-
- $trust_root = isset($_REQUEST['openid_trust_root'])
- ? $_REQUEST['openid_trust_root']
- : $return_to;
-
- $sreg_required = isset($_REQUEST['openid_sreg_required'])
- ? $_REQUEST['openid_sreg.required']
- : '';
-
- $sreg_optional = isset($_REQUEST['openid_sreg_optional'])
- ? $_REQUEST['openid_sreg.optional']
- : '';
-
- // determine the cancel url
- $q = strpos($return_to, '?') ? '&' : '?';
- $cancel_url = $return_to . $q . 'openid.mode=cancel';
-
- // required and optional make no difference to us
- $sreg_required .= ',' . $sreg_optional;
- // do the trust_root analysis
- if ($trust_root != $return_to) {
- // the urls are not the same, be sure return decends from trust
- if (! url_descends($return_to, $trust_root))
- error_500('Invalid trust_root: "' . $trust_root . '"');
-
- }
-
- // transfer the user to the url accept mode if they're paranoid
- if ($wait == 1 && isset($profile['paranoid']) && $profile['paranoid'] === true && (! isset($_SESSION['accepted_url']) || $_SESSION['accepted_url'] != $trust_root)) {
- $_SESSION['cancel_accept_url'] = $cancel_url;
- $_SESSION['post_accept_url'] = $profile['req_url'];
- $_SESSION['unaccepted_url'] = $trust_root;
-
- debug('Transferring to acceptance mode.');
- debug('Cancel URL: ' . $_SESSION['cancel_accept_url']);
- debug('Post URL: ' . $_SESSION['post_accept_url']);
-
- $q = strpos($profile['idp_url'], '?') ? '&' : '?';
- wrap_redirect($profile['idp_url'] . $q . 'openid.mode=accept');
- }
-
- // make sure i am this identifier
-// if ($identity != $profile['idp_url']) {
-// debug("Invalid identity: $identity");
-// debug("IdP URL: " . $profile['idp_url']);
-// error_get($return_to, "Invalid identity: '$identity'");
-// }
-
- // begin setting up return keys
- $keys = array(
- 'mode' => 'id_res'
- );
-
- // if the user is not logged in, transfer to the authorization mode
- if ($USERNAME=='' || $_SESSION['openid_auth'] === false || $USERNAME != $_SESSION['openid_user']) {
- // users can only be logged in to one url at a time
- $_SESSION['openid_user'] = null;
- $_SESSION['auth_url'] = null;
-
- if ($wait) {
- unset($_SESSION['uniqid']);
-
- $_SESSION['cancel_auth_url'] = $cancel_url;
- $_SESSION['post_auth_url'] = $profile['req_url'];
-
- debug('Transferring to authorization mode.');
- debug('Cancel URL: ' . $_SESSION['cancel_auth_url']);
- debug('Post URL: ' . $_SESSION['post_auth_url']);
-
- $q = strpos($profile['idp_url'], '?') ? '&' : '?';
- wrap_redirect($profile['idp_url'] . $q . 'openid.mode=authorize');
- } else {
- $keys['user_setup_url'] = $profile['idp_url'];
- }
-
- // the user is logged in
- } else {
- // remove the refresh URLs if set
- unset($_SESSION['cancel_auth_url']);
- unset($_SESSION['post_auth_url']);
-
- // check the assoc handle
- list($shared_secret, $expires) = secret($assoc_handle);
-
- // if I can't verify the assoc_handle, or if it's expired
- if ($shared_secret == false || (is_numeric($expires) && $expires < time())) {
- debug("Session expired or missing key: $expires < " . time());
- if ($assoc_handle != null) {
- $keys['invalidate_handle'] = $assoc_handle;
- destroy_assoc_handle($assoc_handle);
- }
-
- $lifetime = time() + $profile['lifetime'];
- list ($assoc_handle, $shared_secret) = new_assoc($lifetime);
- }
-
- $keys['identity'] = $profile['idp_url'];
- $keys['assoc_handle'] = $assoc_handle;
- $keys['return_to'] = $return_to;
-
- $fields = array_keys($keys);
- $tokens = '';
- foreach ($fields as $key)
- $tokens .= sprintf("%s:%s\n", $key, $keys[$key]);
-
- // add sreg keys
- foreach (explode(',', $sreg_required) as $key) {
- if (! isset($sreg[$key]))
- continue;
- $skey = 'sreg.' . $key;
-
- $tokens .= sprintf("%s:%s\n", $skey, $sreg[$key]);
- $keys[$skey] = $sreg[$key];
- $fields[] = $skey;
- }
-
- $keys['signed'] = implode(',', $fields);
- $keys['sig'] = base64_encode(hmac($shared_secret, $tokens));
- }
-
- wrap_keyed_redirect($return_to, $keys);
-}
-
-
-/**
- * Handle a consumer's request to see if the user is already logged in
- */
-function checkid_immediate_mode () {
- if (! isset($_REQUEST['openid_mode']) || $_REQUEST['openid_mode'] != 'checkid_immediate')
- error_500();
-
- checkid(false);
-}
-
-
-/**
- * Handle a consumer's request to see if the user is logged in, but be willing
- * to wait for them to perform a login if they're not
- */
-function checkid_setup_mode () {
- if (! isset($_REQUEST['openid_mode']) || $_REQUEST['openid_mode'] != 'checkid_setup')
- error_500();
-
- checkid(true);
-}
-
-
-/**
- * Handle errors
- */
-function error_mode () {
- isset($_REQUEST['openid_error'])
- ? wrap_html($_REQUEST['openid_error'])
- : error_500();
-}
-
-
-/**
- * Show a user if they are logged in or not
- * @global array $profile
- */
-function id_res_mode () {
- global $profile;
-
- user_session();
-
- if ($profile['authorized'])
- wrap_html('You are logged in as ' . $_SESSION['auth_username']);
-
- wrap_html('You are not logged in');
-}
-
-
-/**
- * Allow a user to perform a static login
- * @global array $profile
- */
-function login_mode () {
- global $profile;
-
- user_session();
-
- if ($profile['authorized'])
- id_res_mode();
-
- $keys = array(
- 'mode' => 'checkid_setup',
- 'identity' => $profile['idp_url'],
- 'return_to' => $profile['idp_url']
- );
-
- wrap_keyed_redirect($profile['idp_url'], $keys);
-}
-
-
-/**
- * Allow a user to perform a static logout
- * @global array $profile
- */
-function logout_mode () {
- global $profile;
-
- user_session();
-
- if (! $profile['authorized'])
- wrap_html('You were not logged in');
-
- $_SESSION = array();
- session_destroy();
- debug('User session destroyed.');
-
- header('HTTP/1.0 401 Unauthorized');
- wrap_redirect($profile['idp_url']);
-}
-
-
-/**
- * The default information screen
- * @global array $profile
- */
-function no_mode () {
- global $USERNAME, $profile;
- $tmpl = new OCP\Template( 'user_openid', 'nomode', 'guest' );
- if(substr($profile['req_url'],-1,1)!=='/'){//the identity should always end with a /
- $profile['req_url'].='/';
- }
- $tmpl->addHeader('link',array('rel'=>'openid.server', 'href'=>$profile['req_url']));
- $tmpl->addHeader('link',array('rel'=>'openid.delegate', 'href'=>$profile['idp_url']));
- $tmpl->assign('user',$USERNAME);
- $tmpl->printPage();
-}
-
-
-/**
- * Testing for setup
- * @global array $profile
- */
-function test_mode () {
- global $profile, $p, $g;
-
- if ($profile['allow_test'] != true)
- error_403();
-
- @ini_set('max_execution_time', 180);
-
- $test_expire = time() + 120;
- $test_ss_enc = 'W7hvmld2yEYdDb0fHfSkKhQX+PM=';
- $test_ss = base64_decode($test_ss_enc);
- $test_token = "alpha:bravo\ncharlie:delta\necho:foxtrot";
- $test_server_private = '11263846781670293092494395517924811173145217135753406847875706165886322533899689335716152496005807017390233667003995430954419468996805220211293016296351031812246187748601293733816011832462964410766956326501185504714561648498549481477143603650090931135412673422192550825523386522507656442905243832471167330268';
- $test_client_public = base64_decode('AL63zqI5a5p8HdXZF5hFu8p+P9GOb816HcHuvNOhqrgkKdA3fO4XEzmldlb37nv3+xqMBgWj6gxT7vfuFerEZLBvuWyVvR7IOGZmx0BAByoq3fxYd3Fpe2Coxngs015vK37otmH8e83YyyGo5Qua/NAf13yz1PVuJ5Ctk7E+YdVc');
-
- $res = array();
-
- // bcmath
- $res['bcmath'] = extension_loaded('bcmath')
- ? 'pass' : 'warn - not loaded';
-
- // gmp
- if ($profile['allow_gmp']) {
- $res['gmp'] = extension_loaded('gmp')
- ? 'pass' : 'warn - not loaded';
- } else {
- $res['gmp'] = 'pass - n/a';
- }
-
- // get_temp_dir
- $res['logfile'] = is_writable($profile['logfile'])
- ? 'pass' : "warn - log is not writable";
-
- // session & new_assoc
- user_session();
- list($test_assoc, $test_new_ss) = new_assoc($test_expire);
- $res['session'] = ($test_assoc != session_id())
- ? 'pass' : 'fail';
-
- // secret
- @session_unregister('shared_secret');
- list($check, $check2) = secret($test_assoc);
- $res['secret'] = ($check == $test_new_ss)
- ? 'pass' : 'fail';
-
- // expire
- $res['expire'] = ($check2 <= $test_expire)
- ? 'pass' : 'fail';
-
- // base64
- $res['base64'] = (base64_encode($test_ss) == $test_ss_enc)
- ? 'pass' : 'fail';
-
- // hmac
- $test_sig = base64_decode('/VXgHvZAOdoz/OTa5+XJXzSGhjs=');
- $check = hmac($test_ss, $test_token);
- $res['hmac'] = ($check == $test_sig)
- ? 'pass' : sprintf("fail - '%s'", base64_encode($check));
-
- if ($profile['use_bigmath']) {
- // bigmath powmod
- $test_server_public = '102773334773637418574009974502372885384288396853657336911033649141556441102566075470916498748591002884433213640712303846640842555822818660704173387461364443541327856226098159843042567251113889701110175072389560896826887426539315893475252988846151505416694218615764823146765717947374855806613410142231092856731';
- $check = bmpowmod($g, $test_server_private, $p);
- $res['bmpowmod-1'] = ($check == $test_server_public)
- ? 'pass' : sprintf("fail - '%s'", $check);
-
- // long
- $test_client_long = '133926731803116519408547886573524294471756220428015419404483437186057383311250738749035616354107518232016420809434801736658109316293127101479053449990587221774635063166689561125137927607200322073086097478667514042144489248048756916881344442393090205172004842481037581607299263456852036730858519133859409417564';
- $res['long'] = (long($test_client_public) == $test_client_long)
- ? 'pass' : 'fail';
-
- // bigmath powmod 2
- $test_client_share = '19333275433742428703546496981182797556056709274486796259858099992516081822015362253491867310832140733686713353304595602619444380387600756677924791671971324290032515367930532292542300647858206600215875069588627551090223949962823532134061941805446571307168890255137575975911397744471376862555181588554632928402';
- $check = bmpowmod($test_client_long, $test_server_private, $p);
- $res['bmpowmod-2'] = ($check == $test_client_share)
- ? 'pass' : sprintf("fail - '%s'", $check);
-
- // bin
- $test_client_mac_s1 = base64_decode('G4gQQkYM6QmAzhKbVKSBahFesPL0nL3F2MREVwEtnVRRYI0ifl9zmPklwTcvURt3QTiGBd+9Dn3ESLk5qka6IO5xnILcIoBT8nnGVPiOZvTygfuzKp4tQ2mXuIATJoa7oXRGmBWtlSdFapH5Zt6NJj4B83XF/jzZiRwdYuK4HJI=');
- $check = bin($test_client_share);
- $res['bin'] = ($check == $test_client_mac_s1)
- ? 'pass' : sprintf("fail - '%s'", base64_encode($check));
-
- } else {
- $res['bigmath'] = 'fail - big math functions are not available.';
- }
-
- // sha1_20
- $test_client_mac_s1 = base64_decode('G4gQQkYM6QmAzhKbVKSBahFesPL0nL3F2MREVwEtnVRRYI0ifl9zmPklwTcvURt3QTiGBd+9Dn3ESLk5qka6IO5xnILcIoBT8nnGVPiOZvTygfuzKp4tQ2mXuIATJoa7oXRGmBWtlSdFapH5Zt6NJj4B83XF/jzZiRwdYuK4HJI=');
- $test_client_mac_s2 = base64_decode('0Mb2t9d/HvAZyuhbARJPYdx3+v4=');
- $check = sha1_20($test_client_mac_s1);
- $res['sha1_20'] = ($check == $test_client_mac_s2)
- ? 'pass' : sprintf("fail - '%s'", base64_encode($check));
-
- // x_or
- $test_client_mac_s3 = base64_decode('i36ZLYAJ1rYEx1VEHObrS8hgAg0=');
- $check = x_or($test_client_mac_s2, $test_ss);
- $res['x_or'] = ($check == $test_client_mac_s3)
- ? 'pass' : sprintf("fail - '%s'", base64_encode($check));
-
- $out = "<table border=1 cellpadding=4>\n";
- foreach ($res as $test => $stat) {
- $code = substr($stat, 0, 4);
- $color = ($code == 'pass') ? '#9f9'
- : (($code == 'warn') ? '#ff9' : '#f99');
- $out .= sprintf("<tr><th>%s</th><td style='background:%s'>%s</td></tr>\n", $test, $color, $stat);
- }
- $out .= "</table>";
-
- wrap_html( $out );
-}
-
-
-// Support functions
-
-/**
- * Prefix the keys of an array with 'openid.'
- * @param array $array
- * @return array
- */
-function append_openid ($array) {
- $keys = array_keys($array);
- $vals = array_values($array);
-
- $r = array();
- for ($i=0; $i<sizeof($keys); $i++)
- $r['openid.' . $keys[$i]] = $vals[$i];
- return $r;
-}
-
-/**
- * Create a big math addition function
- * @param string $l
- * @param string $r
- * @return string
- * @url http://www.icosaedro.it/bigint Inspired by
- */
-function bmadd($l, $r) {
- if (function_exists('bcadd'))
- return bcadd($l, $r);
-
- global $profile;
- if ($profile['use_gmp'])
- return gmp_strval(gmp_add($l, $r));
-
- $l = strval($l); $r = strval($r);
- $ll = strlen($l); $rl = strlen($r);
- if ($ll < $rl) {
- $l = str_repeat("0", $rl-$ll) . $l;
- $o = $rl;
-
- } elseif ( $ll > $rl ) {
- $r = str_repeat("0", $ll-$rl) . $r;
- $o = $ll;
-
- } else {
- $o = $ll;
- }
-
- $v = '';
- $carry = 0;
-
- for ($i = $o-1; $i >= 0; $i--) {
- $d = (int)$l[$i] + (int)$r[$i] + $carry;
- if ($d <= 9) {
- $carry = 0;
-
- } else {
- $carry = 1;
- $d -= 10;
- }
- $v = (string) $d . $v;
- }
-
- if ($carry > 0)
- $v = "1" . $v;
-
- return $v;
-}
-
-/**
- * Create a big math comparison function
- * @param string $l
- * @param string $r
- * @return string
- */
-function bmcomp($l, $r) {
- if (function_exists('bccomp'))
- return bccomp($l, $r);
-
- global $profile;
- if ($profile['use_gmp'])
- return gmp_strval(gmp_cmp($l, $r));
-
- $l = strval($l); $r = strval($r);
- $ll = strlen($l); $lr = strlen($r);
- if ($ll != $lr)
- return ($ll > $lr) ? 1 : -1;
-
- return strcmp($l, $r);
-}
-
-/**
- * Create a big math division function
- * @param string $l
- * @param string $r
- * @param int $z
- * @return string
- * @url http://www.icosaedro.it/bigint Inspired by
- */
-function bmdiv($l, $r, $z = 0) {
- if (function_exists('bcdiv'))
- return ($z == 0) ? bcdiv($l, $r) : bcmod($l, $r);
-
- global $profile;
- if ($profile['use_gmp'])
- return gmp_strval(($z == 0) ? gmp_div_q($l, $r) : gmp_mod($l, $r));
-
- $l = strval($l); $r = strval($r);
- $v = '0';
-
- while (true) {
- if( bmcomp($l, $r) < 0 )
- break;
-
- $delta = strlen($l) - strlen($r);
- if ($delta >= 1) {
- $zeroes = str_repeat("0", $delta);
- $r2 = $r . $zeroes;
-
- if (strcmp($l, $r2) >= 0) {
- $v = bmadd($v, "1" . $zeroes);
- $l = bmsub($l, $r2);
-
- } else {
- $zeroes = str_repeat("0", $delta - 1);
- $v = bmadd($v, "1" . $zeroes);
- $l = bmsub($l, $r . $zeroes);
- }
-
- } else {
- $l = bmsub($l, $r);
- $v = bmadd($v, "1");
- }
- }
-
- return ($z == 0) ? $v : $l;
-}
-
-/**
- * Create a big math multiplication function
- * @param string $l
- * @param string $r
- * @return string
- * @url http://www.icosaedro.it/bigint Inspired by
- */
-function bmmul($l, $r) {
- if (function_exists('bcmul'))
- return bcmul($l, $r);
-
- global $profile;
- if ($profile['use_gmp'])
- return gmp_strval(gmp_mul($l, $r));
-
- $l = strval($l); $r = strval($r);
-
- $v = '0';
- $z = '';
-
- for( $i = strlen($r)-1; $i >= 0; $i-- ){
- $bd = (int) $r[$i];
- $carry = 0;
- $p = "";
- for( $j = strlen($l)-1; $j >= 0; $j-- ){
- $ad = (int) $l[$j];
- $pd = $ad * $bd + $carry;
- if( $pd <= 9 ){
- $carry = 0;
- } else {
- $carry = (int) ($pd / 10);
- $pd = $pd % 10;
- }
- $p = (string) $pd . $p;
- }
- if( $carry > 0 )
- $p = (string) $carry . $p;
- $p = $p . $z;
- $z .= "0";
- $v = bmadd($v, $p);
- }
-
- return $v;
-}
-
-/**
- * Create a big math modulus function
- * @param string $value
- * @param string $mod
- * @return string
- */
-function bmmod( $value, $mod ) {
- if (function_exists('bcmod'))
- return bcmod($value, $mod);
-
- global $profile;
- if ($profile['use_gmp'])
- return gmp_strval(gmp_mod($value, $mod));
-
- $r = bmdiv($value, $mod, 1);
- return $r;
-}
-
-/**
- * Create a big math power function
- * @param string $value
- * @param string $exponent
- * @return string
- */
-function bmpow ($value, $exponent) {
- if (function_exists('bcpow'))
- return bcpow($value, $exponent);
-
- global $profile;
- if ($profile['use_gmp'])
- return gmp_strval(gmp_pow($value, $exponent));
-
- $r = '1';
- while ($exponent) {
- $r = bmmul($r, $value, 100);
- $exponent--;
- }
- return (string)rtrim($r, '0.');
-}
-
-/**
- * Create a big math 'powmod' function
- * @param string $value
- * @param string $exponent
- * @param string $mod
- * @return string
- * @url http://php.net/manual/en/function.bcpowmod.php#72704 Borrowed from
- */
-function bmpowmod ($value, $exponent, $mod) {
- if (function_exists('bcpowmod'))
- return bcpowmod($value, $exponent, $mod);
-
- global $profile;
- if ($profile['use_gmp'])
- return gmp_strval(gmp_powm($value, $exponent, $mod));
-
- $r = '';
- while ($exponent != '0') {
- $t = bmmod($exponent, '4096');
- $r = substr("000000000000" . decbin(intval($t)), -12) . $r;
- $exponent = bmdiv($exponent, '4096');
- }
-
- $r = preg_replace("!^0+!","",$r);
-
- if ($r == '')
- $r = '0';
- $value = bmmod($value, $mod);
- $erb = strrev($r);
- $q = '1';
- $a[0] = $value;
-
- for ($i = 1; $i < strlen($erb); $i++) {
- $a[$i] = bmmod( bmmul($a[$i-1], $a[$i-1]), $mod );
- }
-
- for ($i = 0; $i < strlen($erb); $i++) {
- if ($erb[$i] == "1") {
- $q = bmmod( bmmul($q, $a[$i]), $mod );
- }
- }
-
- return($q);
-}
-
-/**
- * Create a big math subtraction function
- * @param string $l
- * @param string $r
- * @return string
- * @url http://www.icosaedro.it/bigint Inspired by
- */
-function bmsub($l, $r) {
- if (function_exists('bcsub'))
- return bcsub($l, $r);
-
- global $profile;
- if ($profile['use_gmp'])
- return gmp_strval(gmp_sub($l, $r));
-
-
- $l = strval($l); $r = strval($r);
- $ll = strlen($l); $rl = strlen($r);
-
- if ($ll < $rl) {
- $l = str_repeat("0", $rl-$ll) . $l;
- $o = $rl;
- } elseif ( $ll > $rl ) {
- $r = str_repeat("0", $ll-$rl) . (string)$r;
- $o = $ll;
- } else {
- $o = $ll;
- }
-
- if (strcmp($l, $r) >= 0) {
- $sign = '';
- } else {
- $x = $l; $l = $r; $r = $x;
- $sign = '-';
- }
-
- $v = '';
- $carry = 0;
-
- for ($i = $o-1; $i >= 0; $i--) {
- $d = ($l[$i] - $r[$i]) - $carry;
- if ($d < 0) {
- $carry = 1;
- $d += 10;
- } else {
- $carry = 0;
- }
- $v = (string) $d . $v;
- }
-
- return $sign . ltrim($v, '0');
-}
-
-
-/**
- * Get a binary value
- * @param integer $n
- * @return string
- * @url http://openidenabled.com Borrowed from PHP-OpenID
- */
-function bin ($n) {
- $bytes = array();
- while (bmcomp($n, 0) > 0) {
- array_unshift($bytes, bmmod($n, 256));
- $n = bmdiv($n, bmpow(2,8));
- }
-
- if ($bytes && ($bytes[0] > 127))
- array_unshift($bytes, 0);
-
- $b = '';
- foreach ($bytes as $byte)
- $b .= pack('C', $byte);
-
- return $b;
-}
-
-
-/**
- * Debug logging
- * @param mixed $x
- * @param string $m
- */
-function debug ($x, $m = null) {
- global $profile;
-
- if (! isset($profile['debug']) || $profile['debug'] === false)
- return true;
-
- if (! is_writable(dirname($profile['logfile'])) &! is_writable($profile['logfile']))
- error_500('Cannot write to debug log: ' . $profile['logfile']);
-
- if (is_array($x)) {
- ob_start();
- print_r($x);
- $x = $m . ($m != null ? "\n" : '') . ob_get_clean();
-
- } else {
- $x .= "\n";
- }
-}
-
-
-/**
- * Destroy a consumer's assoc handle
- * @param string $id
- */
-function destroy_assoc_handle ( $id ) {
- debug("Destroying session: $id");
-
- $sid = session_id();
- session_write_close();
-
- session_id($id);
- if (OCP\Config::getSystemValue( "forcessl", false )) {
- ini_set("session.cookie_secure", "on");
- }
- session_start();
- session_destroy();
-
- session_id($sid);
- session_start();
-}
-
-
-/**
- * Return an error message to the user
- * @param string $message
- */
-function error_400 ( $message = 'Bad Request' ) {
- header("HTTP/1.1 400 Bad Request");
- wrap_html($message);
-}
-
-
-/**
- * Return an error message to the user
- * @param string $message
- */
-function error_403 ( $message = 'Forbidden' ) {
- header("HTTP/1.1 403 Forbidden");
- wrap_html($message);
-}
-
-
-/**
- * Return an error message to the user
- * @param string $message
- */
-function error_500 ( $message = 'Internal Server Error' ) {
- header("HTTP/1.1 500 Internal Server Error");
- wrap_html($message);
-}
-
-
-/**
- * Return an error message to the consumer
- * @param string $message
- */
-function error_get ( $url, $message = 'Bad Request') {
- wrap_keyed_redirect($url, array('mode' => 'error', 'error' => $message));
-}
-
-
-/**
- * Return an error message to the consumer
- * @param string $message
- */
-function error_post ( $message = 'Bad Request' ) {
- header("HTTP/1.1 400 Bad Request");
- echo ('error:' . $message);
- exit(0);
-}
-
-
-/**
- * Do an HMAC
- * @param string $key
- * @param string $data
- * @param string $hash
- * @return string
- * @url http://php.net/manual/en/function.sha1.php#39492 Borrowed from
- */
-function hmac($key, $data, $hash = 'sha1_20') {
- $blocksize=64;
-
- if (strlen($key) > $blocksize)
- $key = $hash($key);
-
- $key = str_pad($key, $blocksize,chr(0x00));
- $ipad = str_repeat(chr(0x36),$blocksize);
- $opad = str_repeat(chr(0x5c),$blocksize);
-
- $h1 = $hash(($key ^ $ipad) . $data);
- $hmac = $hash(($key ^ $opad) . $h1);
- return $hmac;
-}
-
-
-if (! function_exists('http_build_query')) {
-/**
- * Create function if missing
- * @param array $array
- * @return string
- */
-function http_build_query ($array) {
- $r = array();
- foreach ($array as $key => $val)
- $r[] = sprintf('%s=%s', urlencode($key), urlencode($val));
- return implode('&', $r);
-}}
-
-
-/**
- * Turn a binary back into a long
- * @param string $b
- * @return integer
- * @url http://openidenabled.com Borrowed from PHP-OpenID
- */
-function long($b) {
- $bytes = array_merge(unpack('C*', $b));
- $n = 0;
- foreach ($bytes as $byte) {
- $n = bmmul($n, bmpow(2,8));
- $n = bmadd($n, $byte);
- }
- return $n;
-}
-
-
-/**
- * Create a new consumer association
- * @param integer $expiration
- * @return array
- */
-function new_assoc ( $expiration ) {
- if (isset($_SESSION) && is_array($_SESSION)) {
- $sid = session_id();
- $dat = session_encode();
- session_write_close();
- }
-
- if (OCP\Config::getSystemValue( "forcessl", false )) {
- ini_set("session.cookie_secure", "on");
- }
- session_start();
- session_regenerate_id('false');
-
- $id = session_id();
- $shared_secret = new_secret();
- debug('Started new assoc session: ' . $id);
-
- $_SESSION = array();
- $_SESSION['expiration'] = $expiration;
- $_SESSION['shared_secret'] = base64_encode($shared_secret);
-
- session_write_close();
-
- if (isset($sid)) {
- session_id($sid);
- session_start();
- $_SESSION = array();
- session_decode($dat);
- }
-
- return array($id, $shared_secret);
-}
-
-
-/**
- * Create a new shared secret
- * @return string
- */
-function new_secret () {
- $r = '';
- for($i=0; $i<20; $i++)
- $r .= chr(mt_rand(0, 255));
-
- debug("Generated new key: hash = '" . md5($r) . "', length = '" . strlen($r) . "'");
- return $r;
-}
-
-
-/**
- * Random number generation
- * @param integer max
- * @return integer
- */
-function random ( $max ) {
- if (strlen($max) < 4)
- return mt_rand(1, $max - 1);
-
- $r = '';
- for($i=1; $i<strlen($max) - 1; $i++)
- $r .= mt_rand(0,9);
- $r .= mt_rand(1,9);
-
- return $r;
-}
-
-/**
- * Get the shared secret and expiration time for the specified assoc_handle
- * @param string $handle assoc_handle to look up
- * @return array (shared_secret, expiration_time)
- */
-function secret ( $handle ) {
- if (! preg_match('/^\w+$/', $handle))
- return array(false, 0);
-
- if (isset($_SESSION) && is_array($_SESSION)) {
- $sid = session_id();
- $dat = session_encode();
- session_write_close();
- }
-
- session_id($handle);
- if (OCP\Config::getSystemValue( "forcessl", false )) {
- ini_set("session.cookie_secure", "on");
- }
- session_start();
- debug('Started session to acquire key: ' . session_id());
-
- $secret = isset($_SESSION['shared_secret'])
- ? base64_decode($_SESSION['shared_secret'])
- : false;
-
- $expiration = isset($_SESSION['expiration'])
- ? $_SESSION['expiration']
- : null;
-
- session_write_close();
-
- if (isset($sid)) {
- session_id($sid);
- session_start();
- $_SESSION = array();
- session_decode($dat);
- }
-
- debug("Found key: hash = '" . md5($secret) . "', length = '" . strlen($secret) . "', expiration = '$expiration'");
- return array($secret, $expiration);
-}
-
-
-/**
- * Do an internal self check
- * @global array $profile
- * @global array $sreg
- */
-function self_check () {
- global $profile, $sreg;
-
-// if (! isset($profile) || ! is_array($profile))
-// error_500('No configuration found, you shouldn\'t access this file directly.');
-
- if (version_compare(phpversion(), '4.2.0', 'lt'))
- error_500('The required minimum version of PHP is 4.2.0, you are running ' . phpversion());
-
- $extension_r = array('session', 'pcre');
- foreach ($extension_r as $x) {
- if (! extension_loaded($x))
- @dl($x);
- if (! extension_loaded($x))
- error_500("Required extension '$x' is missing.");
- }
-
-// $extension_b = array('suhosin');
-// foreach ($extension_b as $x) {
-// if (extension_loaded($x) &! $profile["allow_$x"])
-// error_500("phpMyID is not compatible with '$x'");
-// }
-//
-// $keys = array('auth_username', 'auth_password');
-// foreach ($keys as $key) {
-// if (! array_key_exists($key, $profile))
-// error_500("'$key' is missing from your profile.");
-// }
-
- if (! isset($sreg) || ! is_array($sreg))
- $sreg = array();
-}
-
-
-/**
- * Do SHA1 20 byte encryption
- * @param string $v
- * @return string
- * @url http://openidenabled.com Borrowed from PHP-OpenID
- */
-function sha1_20 ($v) {
- if (version_compare(phpversion(), '5.0.0', 'ge'))
- return sha1($v, true);
-
- $hex = sha1($v);
- $r = '';
- for ($i = 0; $i < 40; $i += 2) {
- $hexcode = substr($hex, $i, 2);
- $charcode = base_convert($hexcode, 16, 10);
- $r .= chr($charcode);
- }
- return $r;
-}
-
-
-/**
- * Look for the point of differentiation in two strings
- * @param string $a
- * @param string $b
- * @return int
- */
-function str_diff_at ($a, $b) {
- if ($a == $b)
- return -1;
- $n = min(strlen($a), strlen($b));
- for ($i = 0; $i < $n; $i++)
- if ($a[$i] != $b[$i])
- return $i;
- return $n;
-}
-
-/**
- * Determine if a child URL actually decends from the parent, and that the
- * parent is a good URL.
- * THIS IS EXPERIMENTAL
- * @param string $parent
- * @param string $child
- * @return bool
- */
-function url_descends ( $child, $parent ) {
- if ($child == $parent)
- return true;
-
- $keys = array();
- $parts = array();
-
- $req = array('scheme', 'host');
- $bad = array('fragment', 'pass', 'user');
-
- foreach (array('parent', 'child') as $name) {
- $parts[$name] = @parse_url($$name);
- if ($parts[$name] === false)
- return false;
-
- $keys[$name] = array_keys($parts[$name]);
-
- if (array_intersect($keys[$name], $req) != $req)
- return false;
-
- if (array_intersect($keys[$name], $bad) != array())
- return false;
-
- if (! preg_match('/^https?$/i', strtolower($parts[$name]['scheme'])))
- return false;
-
- if (! array_key_exists('port', $parts[$name]))
- $parts[$name]['port'] = (strtolower($parts[$name]['scheme']) == 'https') ? 443 : 80;
-
- if (! array_key_exists('path', $parts[$name]))
- $parts[$name]['path'] = '/';
- }
-
- // port and scheme must match
- if ($parts['parent']['scheme'] != $parts['child']['scheme'] ||
- $parts['parent']['port'] != $parts['child']['port'])
- return false;
-
- // compare the hosts by reversing the strings
- $cr_host = strtolower(strrev($parts['child']['host']));
- $pr_host = strtolower(strrev($parts['parent']['host']));
-
- $break = str_diff_at($cr_host, $pr_host);
- if ($break >= 0 && ($pr_host[$break] != '*' || substr_count(substr($pr_host, 0, $break), '.') < 2))
- return false;
-
- // now compare the paths
- $break = str_diff_at($parts['child']['path'], $parts['parent']['path']);
- if ($break >= 0
- && ($break < strlen($parts['parent']['path']) && $parts['parent']['path'][$break] != '*')
- || ($break > strlen($parts['child']['path'])))
- return false;
-
- return true;
-}
-
-
-/**
- * Create a user session
- * @global array $profile
- * @global array $proto
- */
-function user_session () {
- global $proto, $profile;
-
- session_name('phpMyID_Server');
- if (OCP\Config::getSystemValue( "forcessl", false )) {
- ini_set("session.cookie_secure", "on");
- }
- @session_start();
-
- $profile['authorized'] = (isset($_SESSION['auth_username'])
- && $_SESSION['auth_username'] == $profile['auth_username'])
- ? true
- : false;
-
- debug('Started user session: ' . session_id() . ' Auth? ' . $profile['authorized']);
-}
-
-
-/**
- * Return HTML
- * @global string $charset
- * @param string $message
- */
-function wrap_html ( $message ) {
- global $charset, $profile;
- header('Content-Type: text/html; charset=' . $charset);
- $html= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
-<head>
-<title>phpMyID</title>
-<link rel="openid.server" href="' . $profile['req_url'] . '" />
-<link rel="openid.delegate" href="' . $profile['idp_url'] . '" />
-' . implode("\n", $profile['opt_headers']) . '
-<meta name="charset" content="' . $charset . '" />
-<meta name="robots" content="noindex,nofollow" />
-</head>
-<body>
-<p>' . $message . '</p>
-</body>
-</html>
-';
- echo $html;
- exit(0);
-}
-
-
-/**
- * Return a key-value pair in plain text
- * @global string $charset
- * @param array $keys
- */
-function wrap_kv ( $keys ) {
- global $charset;
-
- debug($keys, 'Wrapped key/vals');
- header('Content-Type: text/plain; charset=' . $charset);
- foreach ($keys as $key => $value)
- printf("%s:%s\n", $key, $value);
-
- exit(0);
-}
-
-
-/**
- * Redirect, with OpenID keys
- * @param string $url
- * @param array @keys
- */
-function wrap_keyed_redirect ($url, $keys) {
- $keys = append_openid($keys);
- debug($keys, 'Location keys');
-
- $q = strpos($url, '?') ? '&' : '?';
- wrap_redirect($url . $q . http_build_query($keys));
-}
-
-
-/**
- * Redirect the browser
- * @global string $charset
- * @param string $url
- */
-function wrap_redirect ($url) {
- header('HTTP/1.1 302 Found');
- header('Location: ' . $url);
- debug('Location: ' . $url);
- exit(0);
-}
-
-/**
- * Return an HTML refresh
- * @global string $charset
- * @param string $url
- */
-function wrap_refresh ($url) {
- global $charset;
-
- header('Content-Type: text/html; charset=' . $charset);
- echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
-<head>
-<title>phpMyID</title>
-<meta http-equiv="refresh" content="0;url=' . $url . '">
-</head>
-<body>
-<p>Redirecting to <a href="' . $url . '">' . $url . '</a></p>
-</body>
-</html>
-';
-
- debug('Refresh: ' . $url);
- exit(0);
-}
-
-
-/**
- * Implement binary x_or
- * @param string $a
- * @param string $b
- * @return string
- */
-function x_or ($a, $b) {
- $r = "";
-
- for ($i = 0; $i < strlen($b); $i++)
- $r .= $a[$i] ^ $b[$i];
- debug("Xor size: " . strlen($r));
- return $r;
-}
-
-
-
-/*
- * App Initialization
- */
-// Determine the charset to use
-$GLOBALS['charset'] = 'iso-8859-1';
-
-// Set the internal encoding
-if (function_exists('mb_internal_encoding'))
- mb_internal_encoding($charset);
-
-// Avoid problems with non-default arg_separator.output settings
-// Credit for this goes to user 'prelog' on the forums
-ini_set('arg_separator.output', '&');
-
-// Do a check to be sure everything is set up correctly
-self_check();
-
-
-/**
- * Determine the HTTP request port
- * @name $port
- * @global integer $GLOBALS['port']
- */
-$GLOBALS['port'] = ((isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on' && $_SERVER['SERVER_PORT'] == 443)
- || $_SERVER['SERVER_PORT'] == 80)
- ? ''
- : ':' . $_SERVER['SERVER_PORT'];
-
-
-/**
- * Determine the HTTP request protocol
- * @name $proto
- * @global string $GLOBALS['proto']
- */
-$GLOBALS['proto'] = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on') ? 'https' : 'http';
-
-// Set the authorization state - DO NOT OVERRIDE
-$profile['authorized'] = false;
-
-global $IDENTITY;
-global $USERNAME;
-
-// Set a default IDP URL
-if (! array_key_exists('idp_url', $profile))
- $profile['idp_url'] = $IDENTITY;
-
-//Determine the requested URL - DO NOT OVERRIDE
-$profile['req_url'] = sprintf("%s://%s%s",
- $proto,
- OCP\Util::getServerHost(),
-// $port,//host already includes the path
- $_SERVER["REQUEST_URI"]);
-
-
-// Set the default allowance for testing
-if (! array_key_exists('allow_test', $profile))
- $profile['allow_test'] = false;
-
-// Set the default allowance for gmp
-if (! array_key_exists('allow_gmp', $profile))
- $profile['allow_gmp'] = false;
-
-// Set the default force bigmath - BAD IDEA to override this
-if (! array_key_exists('force_bigmath', $profile))
- $profile['force_bigmath'] = false;
-
-// Determine if GMP is usable
-$profile['use_gmp'] = (extension_loaded('gmp') && $profile['allow_gmp']) ? true : false;
-
-// Determine if I can perform big math functions
-$profile['use_bigmath'] = (extension_loaded('bcmath') || $profile['use_gmp'] || $profile['force_bigmath']) ? true : false;
-
-// Set a default authentication domain
-if (! array_key_exists('auth_domain', $profile))
- $profile['auth_domain'] = $profile['req_url'] . ' ' . $profile['idp_url'];
-
-// Set a default authentication realm
-if (! array_key_exists('auth_realm', $profile))
- $profile['auth_realm'] = 'ownCloud';
-
-// Determine the realm for digest authentication - DO NOT OVERRIDE
-$profile['php_realm'] = $profile['auth_realm'] . (ini_get('safe_mode') ? '-' . getmyuid() : '');
-
-// Set a default lifetime - the lesser of GC and cache time
-if (! array_key_exists('lifetime', $profile)) {
- $sce = session_cache_expire() * 60;
- $gcm = ini_get('session.gc_maxlifetime');
- $profile['lifetime'] = $sce < $gcm ? $sce : $gcm;
-}
-
-// Set a default log file
-if (! array_key_exists('logfile', $profile))
- $profile['logfile'] = get_temp_dir() . DIRECTORY_SEPARATOR . $profile['auth_realm'] . '.debug.log';
-
-
-/*
- * Optional Initialization
- */
-// Setup optional headers
-$profile['opt_headers'] = array();
-
-// Determine if I should add microid stuff
-if (array_key_exists('microid', $profile)) {
- $hash = sha1($profile['idp_url']);
- $values = is_array($profile['microid']) ? $profile['microid'] : array($profile['microid']);
-
- foreach ($values as $microid) {
- preg_match('/^([a-z]+)/i', $microid, $mtx);
- $profile['opt_headers'][] = sprintf('<meta name="microid" content="%s+%s:sha1:%s" />', $mtx[1], $proto, sha1(sha1($microid) . $hash));
- }
-}
-
-// Determine if I should add pavatar stuff
-if (array_key_exists('pavatar', $profile))
- $profile['opt_headers'][] = sprintf('<link rel="pavatar" href="%s" />', $profile['pavatar']);
-
-
-/*
- * Do it
- */
-// Decide which runmode, based on user request or default
-$run_mode = (isset($_REQUEST['openid_mode'])
- && in_array($_REQUEST['openid_mode'], $known['openid_modes']))
- ? $_REQUEST['openid_mode']
- : 'no';
-
-// Run in the determined runmode
-debug("Run mode: $run_mode at: " . time());
-debug($_REQUEST, 'Request params');
-call_user_func($run_mode . '_mode');
diff --git a/3rdparty/php-cloudfiles/.gitignore b/3rdparty/php-cloudfiles/.gitignore
deleted file mode 100644
index 875b72b27e7..00000000000
--- a/3rdparty/php-cloudfiles/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-*.swp
-*~
-tests/output.log
diff --git a/3rdparty/php-cloudfiles/AUTHORS b/3rdparty/php-cloudfiles/AUTHORS
deleted file mode 100644
index a92cfa7c1a9..00000000000
--- a/3rdparty/php-cloudfiles/AUTHORS
+++ /dev/null
@@ -1,11 +0,0 @@
-Current maintainer:
- Conrad Weidenkeller <conrad.weidenkeller@rackspace.com>
-
-Previous maintainer:
- Eric "EJ" Johnson <ej@racklabs.com>
- Chmouel Boudjnah <chmouel.boudjnah@rackspace.co.uk>
-
-Contributors:
- Paul Kehrer
- Ben Arwin
- Jordan Callicoat
diff --git a/3rdparty/php-cloudfiles/COPYING b/3rdparty/php-cloudfiles/COPYING
deleted file mode 100644
index 0e10239d001..00000000000
--- a/3rdparty/php-cloudfiles/COPYING
+++ /dev/null
@@ -1,27 +0,0 @@
-Unless otherwise noted, all files are released under the MIT license,
-exceptions contain licensing information in them.
-
- Copyright (C) 2008 Rackspace US, Inc.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
-Except as contained in this notice, the name of Rackspace US, Inc. shall not
-be used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from Rackspace US, Inc.
-
diff --git a/3rdparty/php-cloudfiles/Changelog b/3rdparty/php-cloudfiles/Changelog
deleted file mode 100644
index df9303c3e5b..00000000000
--- a/3rdparty/php-cloudfiles/Changelog
+++ /dev/null
@@ -1,93 +0,0 @@
-1.7.10 Conrad Weidenkeller <conrad.weidenkeller@rackspace.com>
- * Added Streaming URI Functionality
-
-1.7.9 Conrad Weidenkeller <conrad.weidenkeller@rackspace.com>
- * Added Manifest file support for Large Objects
-
-1.7.8 Conrad Weidenkeller <conrad.weidenkeller@rackspace.com>
- * Added CDN SSL URI Stuff
-
-1.7.7 Conrad Weidenkeller <conrad.weidenkeller@rackspace.com>
- * Added CDN Purge Functionality
-
-1.7.6 - Chmouel Boudjnah <chmouel.boudjnah@rackspace.co.uk>
- * Add Cloud UK Support (conrad.weidenkeller).
-
-1.7.5 - Conrad Weidenkeller <conrad.weidenkeller@rackspace.com>
- * Added the ability to list only currently enabled CDN containers
- * Added curl timeout to CF_Http
- * Fixed some logic errors in some if statements.
-
-1.7.4 - Conrad Weidenkeller <conrad.weidenkeller@rackspace.com>
- * Added Manual SSL support for MacOSX users
-
-1.7.3 - Conrad Weidenkeller <conrad.weidenkeller@rackspace.com>
- * Fixed a Small Bug where some users were seeing response bodies for PUTs
-
-1.7.1 - Conrad Weidenkeller <conrad.weidenkeller@rackspace.com>
- * Added Support for Auth Token Caching.
-
-1.7.0 - Chmouel Boudjnah <chmouel.boudjnah@rackspace.co.uk>
- * Adjust api auth to rackspacecloud not mosso (mshuler).
-
-1.6.2 - Chmouel Boudjnah <chmouel.boudjnah@rackspace.co.uk>
- * Add a close method to close all the current connection.
- * Fix when container_name is named 0.
-
-1.6.1 - Chmouel Boudjnah <chmouel.boudjnah@rackspace.co.uk>
- * Fix setting etag on objects.
- * Fix throwing proper exception when an invalid etag has been set.
- * Fix throwing proper exception when no content type has been set.
-
-1.6.0 - Chmouel Boudjnah <chmouel.boudjnah@rackspace.co.uk>
- * Add CDN ACL restriction by referrer feature.
- * Add CDN ACL restriction by User Agent feature.
- * Add documentation for log_retention method.
- * Return True if log_retention as succeeded.
- * Invalid the PHP stats cache before getting filesize.
-
-1.5.1 - Chmouel Boudjnah <chmouel.boudjnah@rackspace.co.uk> - 20091020
- * If the environement variable RACKSPACE_SERVICENET is defined then force to
- connect via rakcspace servicenet.
-
-1.5.0 - Chmouel Boudjnah <chmouel.boudjnah@rackspace.co.uk> - 20091015
- * Add the option servicenet to connection to use Rackspace service net
- instead of public network.
-
-1.4.0 - Chmouel Boudjnah <chmouel.boudjnah@rackspace.co.uk> - 20090808
-
- * Add the ability to store the container log.
-
-1.3.2 - Chmouel Boudjnah <chmouel.boudjnah@rackspace.co.uk> - 20090606
-
- * Change the Unit Tests to phpunit.
- * Automatically set the updated CA bundle when on the windows OS.
- * More simplification of the mimetype detection and support for PHP 5.3.
- * Fix documentation information about the ttl for cached object.
- * Use the hash library to compute MD5 for streams instead of storing the
- stream in memory.
- * Fix CF_Connection::get_containers to display the container name properly.
-
-1.3.1 - <ej@racklabs.com> - 20090325
-
- * Simplify use of FileInfo, remove packaged MIME/Magic file
- * Throw Exception if no Content-Type is set
- * Fix bug with tracking bytes transferred
- * Support/tested on Windows XP (PHP v5.2.9)
-
-1.3.0 - <ej@racklabs.com> - 20090311
-
- * Support for list operations in JSON/XML
- * Added support for FileInfo automatic Content-Type/MIME detection
- * Workaround for cURL's old CA bundle with CF_Connection->ssl_use_cabundle()
- * Supports limit/marker on Account and Container lists
- * Support "pathname" traversal on Container lists
- * Helper function on Container to create directory marker Objects
- * Support for chunked transfer on PUT requests
-
-1.2.3 - <ej@racklabs.com> - 20081210
-
- * Improved in-line comments and generated HTML docs
- * Callbacks for read/write progress on CF_Connection class
- * Fixed minor bugs
- * Started this Changelog
diff --git a/3rdparty/php-cloudfiles/README b/3rdparty/php-cloudfiles/README
deleted file mode 100644
index 4bcbeade1a4..00000000000
--- a/3rdparty/php-cloudfiles/README
+++ /dev/null
@@ -1,73 +0,0 @@
-;; PHP Cloud Files API
-;; ========================================================================
-;; This package contains the PHP API for the Cloud Files storage system.
-;;
-;; Please see http://www.rackspacecloud.com/ for more information regarding the
-;; Cloud Files storage system.
-;;
-;; Install
-;; ------------------------------------------------------------------------
-;; Extract this archive and make sure the source code files are in your
-;; PHP "include path". To use the API in your source code, just make
-;; sure to include/require the "cloudfiles.php" script.
-;;
-;; Requirements
-;; ------------------------------------------------------------------------
-;; [mandatory] PHP version 5.x (developed against 5.2.0)
-;; [mandatory] PHP's cURL module
-;; [mandatory] PHP enabled with mbstring (multi-byte string) support
-;; [suggested] PEAR FileInfo module (for Content-Type detection)
-;;
-;; Examples
-;; ------------------------------------------------------------------------
-;; For sample code, please see the tests and API docs.
-;;
-;; Docs
-;; ------------------------------------------------------------------------
-;; The included documentation was generated directly from the source
-;; code files using the PHPDocumentor tool.
-;;
-;; This README file is actually the PHPDocumentor INI configuration file.
-;; The following packages were installed via PEAR to generate the HTML
-;; API documentation.
-;;
-;; * PEAR 1.4.11 (stable)
-;; * PhpDocumentor 1.4.2 (stable)
-;; * XML_Beautifier 1.2.0 (stable)
-;; * XML_Parser 1.3.1 (stable)
-;; * XML_Util 1.2.0 (stable)
-;;
-;; To re-generate the API docs, make sure the above software is
-;; available and run:
-;; rm -rf docs && phpdoc -c phpdoc.ini
-;;
-;; Tests
-;; ------------------------------------------------------------------------
-;; The tests are based on phpunit and are run with PHPUnit 3.3.17
-;; please follow the instructions on :
-;;
-;; http://www.phpunit.de/manual/current/en/installation.html
-;;
-;; to install PHPUnit. When installed just run the command phpunit on
-;; the top of the directory and it will launch the tests.
-;;
-;; The tests/Comprehensive.php is not enabled by default since
-;; generating big files. If you want to run it you need to go in the
-;; tests directory and run with phpunit Comprehensive.php
-;;
-;; ========================================================================
-;; The lines below here are the configuration settings for re-generating
-;; the PHP API documentation.
-;;
-[Parse Data]
-title = php-cloudfiles
-hidden = false
-parseprivate = off
-javadocdesc = off
-defaultpackagename = php-cloudfiles
-defaultcategoryname = php-cloudfiles
-target = docs
-directory = .
-ignore = share/,examples/,tests/,.git/,.gitignore,*.ini,*.swp
-output=HTML:Smarty:PHP
-readmeinstallchangelog = README,COPYING,AUTHORS,Changelog
diff --git a/3rdparty/php-cloudfiles/cloudfiles.php b/3rdparty/php-cloudfiles/cloudfiles.php
deleted file mode 100644
index 7b1014265e5..00000000000
--- a/3rdparty/php-cloudfiles/cloudfiles.php
+++ /dev/null
@@ -1,2599 +0,0 @@
-<?php
-/**
- * This is the PHP Cloud Files API.
- *
- * <code>
- * # Authenticate to Cloud Files. The default is to automatically try
- * # to re-authenticate if an authentication token expires.
- * #
- * # NOTE: Some versions of cURL include an outdated certificate authority (CA)
- * # file. This API ships with a newer version obtained directly from
- * # cURL's web site (http://curl.haxx.se). To use the newer CA bundle,
- * # call the CF_Authentication instance's 'ssl_use_cabundle()' method.
- * #
- * $auth = new CF_Authentication($username, $api_key);
- * # $auth->ssl_use_cabundle(); # bypass cURL's old CA bundle
- * $auth->authenticate();
- *
- * # Establish a connection to the storage system
- * #
- * # NOTE: Some versions of cURL include an outdated certificate authority (CA)
- * # file. This API ships with a newer version obtained directly from
- * # cURL's web site (http://curl.haxx.se). To use the newer CA bundle,
- * # call the CF_Connection instance's 'ssl_use_cabundle()' method.
- * #
- * $conn = new CF_Connection($auth);
- * # $conn->ssl_use_cabundle(); # bypass cURL's old CA bundle
- *
- * # Create a remote Container and storage Object
- * #
- * $images = $conn->create_container("photos");
- * $bday = $images->create_object("first_birthday.jpg");
- *
- * # Upload content from a local file by streaming it. Note that we use
- * # a "float" for the file size to overcome PHP's 32-bit integer limit for
- * # very large files.
- * #
- * $fname = "/home/user/photos/birthdays/birthday1.jpg"; # filename to upload
- * $size = (float) sprintf("%u", filesize($fname));
- * $fp = open($fname, "r");
- * $bday->write($fp, $size);
- *
- * # Or... use a convenience function instead
- * #
- * $bday->load_from_filename("/home/user/photos/birthdays/birthday1.jpg");
- *
- * # Now, publish the "photos" container to serve the images by CDN.
- * # Use the "$uri" value to put in your web pages or send the link in an
- * # email message, etc.
- * #
- * $uri = $images->make_public();
- *
- * # Or... print out the Object's public URI
- * #
- * print $bday->public_uri();
- * </code>
- *
- * See the included tests directory for additional sample code.
- *
- * Requres PHP 5.x (for Exceptions and OO syntax) and PHP's cURL module.
- *
- * It uses the supporting "cloudfiles_http.php" module for HTTP(s) support and
- * allows for connection re-use and streaming of content into/out of Cloud Files
- * via PHP's cURL module.
- *
- * See COPYING for license information.
- *
- * @author Eric "EJ" Johnson <ej@racklabs.com>
- * @copyright Copyright (c) 2008, Rackspace US, Inc.
- * @package php-cloudfiles
- */
-
-/**
- */
-require_once("cloudfiles_exceptions.php");
-require("cloudfiles_http.php");
-define("DEFAULT_CF_API_VERSION", 1);
-define("MAX_CONTAINER_NAME_LEN", 256);
-define("MAX_OBJECT_NAME_LEN", 1024);
-define("MAX_OBJECT_SIZE", 5*1024*1024*1024+1);
-define("US_AUTHURL", "https://auth.api.rackspacecloud.com");
-define("UK_AUTHURL", "https://lon.auth.api.rackspacecloud.com");
-/**
- * Class for handling Cloud Files Authentication, call it's {@link authenticate()}
- * method to obtain authorized service urls and an authentication token.
- *
- * Example:
- * <code>
- * # Create the authentication instance
- * #
- * $auth = new CF_Authentication("username", "api_key");
- *
- * # NOTE: For UK Customers please specify your AuthURL Manually
- * # There is a Predfined constant to use EX:
- * #
- * # $auth = new CF_Authentication("username, "api_key", NULL, UK_AUTHURL);
- * # Using the UK_AUTHURL keyword will force the api to use the UK AuthUrl.
- * # rather then the US one. The NULL Is passed for legacy purposes and must
- * # be passed to function correctly.
- *
- * # NOTE: Some versions of cURL include an outdated certificate authority (CA)
- * # file. This API ships with a newer version obtained directly from
- * # cURL's web site (http://curl.haxx.se). To use the newer CA bundle,
- * # call the CF_Authentication instance's 'ssl_use_cabundle()' method.
- * #
- * # $auth->ssl_use_cabundle(); # bypass cURL's old CA bundle
- *
- * # Perform authentication request
- * #
- * $auth->authenticate();
- * </code>
- *
- * @package php-cloudfiles
- */
-class CF_Authentication
-{
- public $dbug;
- public $username;
- public $api_key;
- public $auth_host;
- public $account;
-
- /**
- * Instance variables that are set after successful authentication
- */
- public $storage_url;
- public $cdnm_url;
- public $auth_token;
-
- /**
- * Class constructor (PHP 5 syntax)
- *
- * @param string $username Mosso username
- * @param string $api_key Mosso API Access Key
- * @param string $account <i>Account name</i>
- * @param string $auth_host <i>Authentication service URI</i>
- */
- function __construct($username=NULL, $api_key=NULL, $account=NULL, $auth_host=US_AUTHURL)
- {
-
- $this->dbug = False;
- $this->username = $username;
- $this->api_key = $api_key;
- $this->account_name = $account;
- $this->auth_host = $auth_host;
-
- $this->storage_url = NULL;
- $this->cdnm_url = NULL;
- $this->auth_token = NULL;
-
- $this->cfs_http = new CF_Http(DEFAULT_CF_API_VERSION);
- }
-
- /**
- * Use the Certificate Authority bundle included with this API
- *
- * Most versions of PHP with cURL support include an outdated Certificate
- * Authority (CA) bundle (the file that lists all valid certificate
- * signing authorities). The SSL certificates used by the Cloud Files
- * storage system are perfectly valid but have been created/signed by
- * a CA not listed in these outdated cURL distributions.
- *
- * As a work-around, we've included an updated CA bundle obtained
- * directly from cURL's web site (http://curl.haxx.se). You can direct
- * the API to use this CA bundle by calling this method prior to making
- * any remote calls. The best place to use this method is right after
- * the CF_Authentication instance has been instantiated.
- *
- * You can specify your own CA bundle by passing in the full pathname
- * to the bundle. You can use the included CA bundle by leaving the
- * argument blank.
- *
- * @param string $path Specify path to CA bundle (default to included)
- */
- function ssl_use_cabundle($path=NULL)
- {
- $this->cfs_http->ssl_use_cabundle($path);
- }
-
- /**
- * Attempt to validate Username/API Access Key
- *
- * Attempts to validate credentials with the authentication service. It
- * either returns <kbd>True</kbd> or throws an Exception. Accepts a single
- * (optional) argument for the storage system API version.
- *
- * Example:
- * <code>
- * # Create the authentication instance
- * #
- * $auth = new CF_Authentication("username", "api_key");
- *
- * # Perform authentication request
- * #
- * $auth->authenticate();
- * </code>
- *
- * @param string $version API version for Auth service (optional)
- * @return boolean <kbd>True</kbd> if successfully authenticated
- * @throws AuthenticationException invalid credentials
- * @throws InvalidResponseException invalid response
- */
- function authenticate($version=DEFAULT_CF_API_VERSION)
- {
- list($status,$reason,$surl,$curl,$atoken) =
- $this->cfs_http->authenticate($this->username, $this->api_key,
- $this->account_name, $this->auth_host);
-
- if ($status == 401) {
- throw new AuthenticationException("Invalid username or access key.");
- }
- if ($status < 200 || $status > 299) {
- throw new InvalidResponseException(
- "Unexpected response (".$status."): ".$reason);
- }
-
- if (!($surl || $curl) || !$atoken) {
- throw new InvalidResponseException(
- "Expected headers missing from auth service.");
- }
- $this->storage_url = $surl;
- $this->cdnm_url = $curl;
- $this->auth_token = $atoken;
- return True;
- }
- /**
- * Use Cached Token and Storage URL's rather then grabbing from the Auth System
- *
- * Example:
- * <code>
- * #Create an Auth instance
- * $auth = new CF_Authentication();
- * #Pass Cached URL's and Token as Args
- * $auth->load_cached_credentials("auth_token", "storage_url", "cdn_management_url");
- * </code>
- *
- * @param string $auth_token A Cloud Files Auth Token (Required)
- * @param string $storage_url The Cloud Files Storage URL (Required)
- * @param string $cdnm_url CDN Management URL (Required)
- * @return boolean <kbd>True</kbd> if successful
- * @throws SyntaxException If any of the Required Arguments are missing
- */
- function load_cached_credentials($auth_token, $storage_url, $cdnm_url)
- {
- if(!$storage_url || !$cdnm_url)
- {
- throw new SyntaxException("Missing Required Interface URL's!");
- return False;
- }
- if(!$auth_token)
- {
- throw new SyntaxException("Missing Auth Token!");
- return False;
- }
-
- $this->storage_url = $storage_url;
- $this->cdnm_url = $cdnm_url;
- $this->auth_token = $auth_token;
- return True;
- }
- /**
- * Grab Cloud Files info to be Cached for later use with the load_cached_credentials method.
- *
- * Example:
- * <code>
- * #Create an Auth instance
- * $auth = new CF_Authentication("UserName","API_Key");
- * $auth->authenticate();
- * $array = $auth->export_credentials();
- * </code>
- *
- * @return array of url's and an auth token.
- */
- function export_credentials()
- {
- $arr = array();
- $arr['storage_url'] = $this->storage_url;
- $arr['cdnm_url'] = $this->cdnm_url;
- $arr['auth_token'] = $this->auth_token;
-
- return $arr;
- }
-
-
- /**
- * Make sure the CF_Authentication instance has authenticated.
- *
- * Ensures that the instance variables necessary to communicate with
- * Cloud Files have been set from a previous authenticate() call.
- *
- * @return boolean <kbd>True</kbd> if successfully authenticated
- */
- function authenticated()
- {
- if (!($this->storage_url || $this->cdnm_url) || !$this->auth_token) {
- return False;
- }
- return True;
- }
-
- /**
- * Toggle debugging - set cURL verbose flag
- */
- function setDebug($bool)
- {
- $this->dbug = $bool;
- $this->cfs_http->setDebug($bool);
- }
-}
-
-/**
- * Class for establishing connections to the Cloud Files storage system.
- * Connection instances are used to communicate with the storage system at
- * the account level; listing and deleting Containers and returning Container
- * instances.
- *
- * Example:
- * <code>
- * # Create the authentication instance
- * #
- * $auth = new CF_Authentication("username", "api_key");
- *
- * # Perform authentication request
- * #
- * $auth->authenticate();
- *
- * # Create a connection to the storage/cdn system(s) and pass in the
- * # validated CF_Authentication instance.
- * #
- * $conn = new CF_Connection($auth);
- *
- * # NOTE: Some versions of cURL include an outdated certificate authority (CA)
- * # file. This API ships with a newer version obtained directly from
- * # cURL's web site (http://curl.haxx.se). To use the newer CA bundle,
- * # call the CF_Authentication instance's 'ssl_use_cabundle()' method.
- * #
- * # $conn->ssl_use_cabundle(); # bypass cURL's old CA bundle
- * </code>
- *
- * @package php-cloudfiles
- */
-class CF_Connection
-{
- public $dbug;
- public $cfs_http;
- public $cfs_auth;
-
- /**
- * Pass in a previously authenticated CF_Authentication instance.
- *
- * Example:
- * <code>
- * # Create the authentication instance
- * #
- * $auth = new CF_Authentication("username", "api_key");
- *
- * # Perform authentication request
- * #
- * $auth->authenticate();
- *
- * # Create a connection to the storage/cdn system(s) and pass in the
- * # validated CF_Authentication instance.
- * #
- * $conn = new CF_Connection($auth);
- *
- * # If you are connecting via Rackspace servers and have access
- * # to the servicenet network you can set the $servicenet to True
- * # like this.
- *
- * $conn = new CF_Connection($auth, $servicenet=True);
- *
- * </code>
- *
- * If the environement variable RACKSPACE_SERVICENET is defined it will
- * force to connect via the servicenet.
- *
- * @param obj $cfs_auth previously authenticated CF_Authentication instance
- * @param boolean $servicenet enable/disable access via Rackspace servicenet.
- * @throws AuthenticationException not authenticated
- */
- function __construct($cfs_auth, $servicenet=False)
- {
- if (isset($_ENV['RACKSPACE_SERVICENET']))
- $servicenet=True;
- $this->cfs_http = new CF_Http(DEFAULT_CF_API_VERSION);
- $this->cfs_auth = $cfs_auth;
- if (!$this->cfs_auth->authenticated()) {
- $e = "Need to pass in a previously authenticated ";
- $e .= "CF_Authentication instance.";
- throw new AuthenticationException($e);
- }
- $this->cfs_http->setCFAuth($this->cfs_auth, $servicenet=$servicenet);
- $this->dbug = False;
- }
-
- /**
- * Toggle debugging of instance and back-end HTTP module
- *
- * @param boolean $bool enable/disable cURL debugging
- */
- function setDebug($bool)
- {
- $this->dbug = (boolean) $bool;
- $this->cfs_http->setDebug($this->dbug);
- }
-
- /**
- * Close a connection
- *
- * Example:
- * <code>
- *
- * $conn->close();
- *
- * </code>
- *
- * Will close all current cUrl active connections.
- *
- */
- public function close()
- {
- $this->cfs_http->close();
- }
-
- /**
- * Cloud Files account information
- *
- * Return an array of two floats (since PHP only supports 32-bit integers);
- * number of containers on the account and total bytes used for the account.
- *
- * Example:
- * <code>
- * # ... authentication code excluded (see previous examples) ...
- * #
- * $conn = new CF_Authentication($auth);
- *
- * list($quantity, $bytes) = $conn->get_info();
- * print "Number of containers: " . $quantity . "\n";
- * print "Bytes stored in container: " . $bytes . "\n";
- * </code>
- *
- * @return array (number of containers, total bytes stored)
- * @throws InvalidResponseException unexpected response
- */
- function get_info()
- {
- list($status, $reason, $container_count, $total_bytes) =
- $this->cfs_http->head_account();
- #if ($status == 401 && $this->_re_auth()) {
- # return $this->get_info();
- #}
- if ($status < 200 || $status > 299) {
- throw new InvalidResponseException(
- "Invalid response (".$status."): ".$this->cfs_http->get_error());
- }
- return array($container_count, $total_bytes);
- }
-
- /**
- * Create a Container
- *
- * Given a Container name, return a Container instance, creating a new
- * remote Container if it does not exit.
- *
- * Example:
- * <code>
- * # ... authentication code excluded (see previous examples) ...
- * #
- * $conn = new CF_Authentication($auth);
- *
- * $images = $conn->create_container("my photos");
- * </code>
- *
- * @param string $container_name container name
- * @return CF_Container
- * @throws SyntaxException invalid name
- * @throws InvalidResponseException unexpected response
- */
- function create_container($container_name=NULL)
- {
- if ($container_name != "0" and !isset($container_name))
- throw new SyntaxException("Container name not set.");
-
- if (!isset($container_name) or $container_name == "")
- throw new SyntaxException("Container name not set.");
-
- if (strpos($container_name, "/") !== False) {
- $r = "Container name '".$container_name;
- $r .= "' cannot contain a '/' character.";
- throw new SyntaxException($r);
- }
- if (strlen($container_name) > MAX_CONTAINER_NAME_LEN) {
- throw new SyntaxException(sprintf(
- "Container name exeeds %d bytes.",
- MAX_CONTAINER_NAME_LEN));
- }
-
- $return_code = $this->cfs_http->create_container($container_name);
- if (!$return_code) {
- throw new InvalidResponseException("Invalid response ("
- . $return_code. "): " . $this->cfs_http->get_error());
- }
- #if ($status == 401 && $this->_re_auth()) {
- # return $this->create_container($container_name);
- #}
- if ($return_code != 201 && $return_code != 202) {
- throw new InvalidResponseException(
- "Invalid response (".$return_code."): "
- . $this->cfs_http->get_error());
- }
- return new CF_Container($this->cfs_auth, $this->cfs_http, $container_name);
- }
-
- /**
- * Delete a Container
- *
- * Given either a Container instance or name, remove the remote Container.
- * The Container must be empty prior to removing it.
- *
- * Example:
- * <code>
- * # ... authentication code excluded (see previous examples) ...
- * #
- * $conn = new CF_Authentication($auth);
- *
- * $conn->delete_container("my photos");
- * </code>
- *
- * @param string|obj $container container name or instance
- * @return boolean <kbd>True</kbd> if successfully deleted
- * @throws SyntaxException missing proper argument
- * @throws InvalidResponseException invalid response
- * @throws NonEmptyContainerException container not empty
- * @throws NoSuchContainerException remote container does not exist
- */
- function delete_container($container=NULL)
- {
- $container_name = NULL;
-
- if (is_object($container)) {
- if (get_class($container) == "CF_Container") {
- $container_name = $container->name;
- }
- }
- if (is_string($container)) {
- $container_name = $container;
- }
-
- if ($container_name != "0" and !isset($container_name))
- throw new SyntaxException("Must specify container object or name.");
-
- $return_code = $this->cfs_http->delete_container($container_name);
-
- if (!$return_code) {
- throw new InvalidResponseException("Failed to obtain http response");
- }
- #if ($status == 401 && $this->_re_auth()) {
- # return $this->delete_container($container);
- #}
- if ($return_code == 409) {
- throw new NonEmptyContainerException(
- "Container must be empty prior to removing it.");
- }
- if ($return_code == 404) {
- throw new NoSuchContainerException(
- "Specified container did not exist to delete.");
- }
- if ($return_code != 204) {
- throw new InvalidResponseException(
- "Invalid response (".$return_code."): "
- . $this->cfs_http->get_error());
- }
- return True;
- }
-
- /**
- * Return a Container instance
- *
- * For the given name, return a Container instance if the remote Container
- * exists, otherwise throw a Not Found exception.
- *
- * Example:
- * <code>
- * # ... authentication code excluded (see previous examples) ...
- * #
- * $conn = new CF_Authentication($auth);
- *
- * $images = $conn->get_container("my photos");
- * print "Number of Objects: " . $images->count . "\n";
- * print "Bytes stored in container: " . $images->bytes . "\n";
- * </code>
- *
- * @param string $container_name name of the remote Container
- * @return container CF_Container instance
- * @throws NoSuchContainerException thrown if no remote Container
- * @throws InvalidResponseException unexpected response
- */
- function get_container($container_name=NULL)
- {
- list($status, $reason, $count, $bytes) =
- $this->cfs_http->head_container($container_name);
- #if ($status == 401 && $this->_re_auth()) {
- # return $this->get_container($container_name);
- #}
- if ($status == 404) {
- throw new NoSuchContainerException("Container not found.");
- }
- if ($status < 200 || $status > 299) {
- throw new InvalidResponseException(
- "Invalid response: ".$this->cfs_http->get_error());
- }
- return new CF_Container($this->cfs_auth, $this->cfs_http,
- $container_name, $count, $bytes);
- }
-
- /**
- * Return array of Container instances
- *
- * Return an array of CF_Container instances on the account. The instances
- * will be fully populated with Container attributes (bytes stored and
- * Object count)
- *
- * Example:
- * <code>
- * # ... authentication code excluded (see previous examples) ...
- * #
- * $conn = new CF_Authentication($auth);
- *
- * $clist = $conn->get_containers();
- * foreach ($clist as $cont) {
- * print "Container name: " . $cont->name . "\n";
- * print "Number of Objects: " . $cont->count . "\n";
- * print "Bytes stored in container: " . $cont->bytes . "\n";
- * }
- * </code>
- *
- * @return array An array of CF_Container instances
- * @throws InvalidResponseException unexpected response
- */
- function get_containers($limit=0, $marker=NULL)
- {
- list($status, $reason, $container_info) =
- $this->cfs_http->list_containers_info($limit, $marker);
- #if ($status == 401 && $this->_re_auth()) {
- # return $this->get_containers();
- #}
- if ($status < 200 || $status > 299) {
- throw new InvalidResponseException(
- "Invalid response: ".$this->cfs_http->get_error());
- }
- $containers = array();
- foreach ($container_info as $name => $info) {
- $containers[] = new CF_Container($this->cfs_auth, $this->cfs_http,
- $info['name'], $info["count"], $info["bytes"], False);
- }
- return $containers;
- }
-
- /**
- * Return list of remote Containers
- *
- * Return an array of strings containing the names of all remote Containers.
- *
- * Example:
- * <code>
- * # ... authentication code excluded (see previous examples) ...
- * #
- * $conn = new CF_Authentication($auth);
- *
- * $container_list = $conn->list_containers();
- * print_r($container_list);
- * Array
- * (
- * [0] => "my photos",
- * [1] => "my docs"
- * )
- * </code>
- *
- * @param integer $limit restrict results to $limit Containers
- * @param string $marker return results greater than $marker
- * @return array list of remote Containers
- * @throws InvalidResponseException unexpected response
- */
- function list_containers($limit=0, $marker=NULL)
- {
- list($status, $reason, $containers) =
- $this->cfs_http->list_containers($limit, $marker);
- #if ($status == 401 && $this->_re_auth()) {
- # return $this->list_containers($limit, $marker);
- #}
- if ($status < 200 || $status > 299) {
- throw new InvalidResponseException(
- "Invalid response (".$status."): ".$this->cfs_http->get_error());
- }
- return $containers;
- }
-
- /**
- * Return array of information about remote Containers
- *
- * Return a nested array structure of Container info.
- *
- * Example:
- * <code>
- * # ... authentication code excluded (see previous examples) ...
- * #
- *
- * $container_info = $conn->list_containers_info();
- * print_r($container_info);
- * Array
- * (
- * ["my photos"] =>
- * Array
- * (
- * ["bytes"] => 78,
- * ["count"] => 2
- * )
- * ["docs"] =>
- * Array
- * (
- * ["bytes"] => 37323,
- * ["count"] => 12
- * )
- * )
- * </code>
- *
- * @param integer $limit restrict results to $limit Containers
- * @param string $marker return results greater than $marker
- * @return array nested array structure of Container info
- * @throws InvalidResponseException unexpected response
- */
- function list_containers_info($limit=0, $marker=NULL)
- {
- list($status, $reason, $container_info) =
- $this->cfs_http->list_containers_info($limit, $marker);
- #if ($status == 401 && $this->_re_auth()) {
- # return $this->list_containers_info($limit, $marker);
- #}
- if ($status < 200 || $status > 299) {
- throw new InvalidResponseException(
- "Invalid response (".$status."): ".$this->cfs_http->get_error());
- }
- return $container_info;
- }
-
- /**
- * Return list of Containers that have been published to the CDN.
- *
- * Return an array of strings containing the names of published Containers.
- * Note that this function returns the list of any Container that has
- * ever been CDN-enabled regardless of it's existence in the storage
- * system.
- *
- * Example:
- * <code>
- * # ... authentication code excluded (see previous examples) ...
- * #
- * $conn = new CF_Authentication($auth);
- *
- * $public_containers = $conn->list_public_containers();
- * print_r($public_containers);
- * Array
- * (
- * [0] => "images",
- * [1] => "css",
- * [2] => "javascript"
- * )
- * </code>
- *
- * @param bool $enabled_only Will list all containers ever CDN enabled if * set to false or only currently enabled CDN containers if set to true. * Defaults to false.
- * @return array list of published Container names
- * @throws InvalidResponseException unexpected response
- */
- function list_public_containers($enabled_only=False)
- {
- list($status, $reason, $containers) =
- $this->cfs_http->list_cdn_containers($enabled_only);
- #if ($status == 401 && $this->_re_auth()) {
- # return $this->list_public_containers();
- #}
- if ($status < 200 || $status > 299) {
- throw new InvalidResponseException(
- "Invalid response (".$status."): ".$this->cfs_http->get_error());
- }
- return $containers;
- }
-
- /**
- * Set a user-supplied callback function to report download progress
- *
- * The callback function is used to report incremental progress of a data
- * download functions (e.g. $container->list_objects(), $obj->read(), etc).
- * The specified function will be periodically called with the number of
- * bytes transferred until the entire download is complete. This callback
- * function can be useful for implementing "progress bars" for large
- * downloads.
- *
- * The specified callback function should take a single integer parameter.
- *
- * <code>
- * function read_callback($bytes_transferred) {
- * print ">> downloaded " . $bytes_transferred . " bytes.\n";
- * # ... do other things ...
- * return;
- * }
- *
- * $conn = new CF_Connection($auth_obj);
- * $conn->set_read_progress_function("read_callback");
- * print_r($conn->list_containers());
- *
- * # output would look like this:
- * #
- * >> downloaded 10 bytes.
- * >> downloaded 11 bytes.
- * Array
- * (
- * [0] => fuzzy.txt
- * [1] => space name
- * )
- * </code>
- *
- * @param string $func_name the name of the user callback function
- */
- function set_read_progress_function($func_name)
- {
- $this->cfs_http->setReadProgressFunc($func_name);
- }
-
- /**
- * Set a user-supplied callback function to report upload progress
- *
- * The callback function is used to report incremental progress of a data
- * upload functions (e.g. $obj->write() call). The specified function will
- * be periodically called with the number of bytes transferred until the
- * entire upload is complete. This callback function can be useful
- * for implementing "progress bars" for large uploads/downloads.
- *
- * The specified callback function should take a single integer parameter.
- *
- * <code>
- * function write_callback($bytes_transferred) {
- * print ">> uploaded " . $bytes_transferred . " bytes.\n";
- * # ... do other things ...
- * return;
- * }
- *
- * $conn = new CF_Connection($auth_obj);
- * $conn->set_write_progress_function("write_callback");
- * $container = $conn->create_container("stuff");
- * $obj = $container->create_object("foo");
- * $obj->write("The callback function will be called during upload.");
- *
- * # output would look like this:
- * # >> uploaded 51 bytes.
- * #
- * </code>
- *
- * @param string $func_name the name of the user callback function
- */
- function set_write_progress_function($func_name)
- {
- $this->cfs_http->setWriteProgressFunc($func_name);
- }
-
- /**
- * Use the Certificate Authority bundle included with this API
- *
- * Most versions of PHP with cURL support include an outdated Certificate
- * Authority (CA) bundle (the file that lists all valid certificate
- * signing authorities). The SSL certificates used by the Cloud Files
- * storage system are perfectly valid but have been created/signed by
- * a CA not listed in these outdated cURL distributions.
- *
- * As a work-around, we've included an updated CA bundle obtained
- * directly from cURL's web site (http://curl.haxx.se). You can direct
- * the API to use this CA bundle by calling this method prior to making
- * any remote calls. The best place to use this method is right after
- * the CF_Authentication instance has been instantiated.
- *
- * You can specify your own CA bundle by passing in the full pathname
- * to the bundle. You can use the included CA bundle by leaving the
- * argument blank.
- *
- * @param string $path Specify path to CA bundle (default to included)
- */
- function ssl_use_cabundle($path=NULL)
- {
- $this->cfs_http->ssl_use_cabundle($path);
- }
-
- #private function _re_auth()
- #{
- # $new_auth = new CF_Authentication(
- # $this->cfs_auth->username,
- # $this->cfs_auth->api_key,
- # $this->cfs_auth->auth_host,
- # $this->cfs_auth->account);
- # $new_auth->authenticate();
- # $this->cfs_auth = $new_auth;
- # $this->cfs_http->setCFAuth($this->cfs_auth);
- # return True;
- #}
-}
-
-/**
- * Container operations
- *
- * Containers are storage compartments where you put your data (objects).
- * A container is similar to a directory or folder on a conventional filesystem
- * with the exception that they exist in a flat namespace, you can not create
- * containers inside of containers.
- *
- * You also have the option of marking a Container as "public" so that the
- * Objects stored in the Container are publicly available via the CDN.
- *
- * @package php-cloudfiles
- */
-class CF_Container
-{
- public $cfs_auth;
- public $cfs_http;
- public $name;
- public $object_count;
- public $bytes_used;
-
- public $cdn_enabled;
- public $cdn_streaming_uri;
- public $cdn_ssl_uri;
- public $cdn_uri;
- public $cdn_ttl;
- public $cdn_log_retention;
- public $cdn_acl_user_agent;
- public $cdn_acl_referrer;
-
- /**
- * Class constructor
- *
- * Constructor for Container
- *
- * @param obj $cfs_auth CF_Authentication instance
- * @param obj $cfs_http HTTP connection manager
- * @param string $name name of Container
- * @param int $count number of Objects stored in this Container
- * @param int $bytes number of bytes stored in this Container
- * @throws SyntaxException invalid Container name
- */
- function __construct(&$cfs_auth, &$cfs_http, $name, $count=0,
- $bytes=0, $docdn=True)
- {
- if (strlen($name) > MAX_CONTAINER_NAME_LEN) {
- throw new SyntaxException("Container name exceeds "
- . "maximum allowed length.");
- }
- if (strpos($name, "/") !== False) {
- throw new SyntaxException(
- "Container names cannot contain a '/' character.");
- }
- $this->cfs_auth = $cfs_auth;
- $this->cfs_http = $cfs_http;
- $this->name = $name;
- $this->object_count = $count;
- $this->bytes_used = $bytes;
- $this->cdn_enabled = NULL;
- $this->cdn_uri = NULL;
- $this->cdn_ssl_uri = NULL;
- $this->cdn_streaming_uri = NULL;
- $this->cdn_ttl = NULL;
- $this->cdn_log_retention = NULL;
- $this->cdn_acl_user_agent = NULL;
- $this->cdn_acl_referrer = NULL;
- if ($this->cfs_http->getCDNMUrl() != NULL && $docdn) {
- $this->_cdn_initialize();
- }
- }
-
- /**
- * String representation of Container
- *
- * Pretty print the Container instance.
- *
- * @return string Container details
- */
- function __toString()
- {
- $me = sprintf("name: %s, count: %.0f, bytes: %.0f",
- $this->name, $this->object_count, $this->bytes_used);
- if ($this->cfs_http->getCDNMUrl() != NULL) {
- $me .= sprintf(", cdn: %s, cdn uri: %s, cdn ttl: %.0f, logs retention: %s",
- $this->is_public() ? "Yes" : "No",
- $this->cdn_uri, $this->cdn_ttl,
- $this->cdn_log_retention ? "Yes" : "No"
- );
-
- if ($this->cdn_acl_user_agent != NULL) {
- $me .= ", cdn acl user agent: " . $this->cdn_acl_user_agent;
- }
-
- if ($this->cdn_acl_referrer != NULL) {
- $me .= ", cdn acl referrer: " . $this->cdn_acl_referrer;
- }
-
-
- }
- return $me;
- }
-
- /**
- * Enable Container content to be served via CDN or modify CDN attributes
- *
- * Either enable this Container's content to be served via CDN or
- * adjust its CDN attributes. This Container will always return the
- * same CDN-enabled URI each time it is toggled public/private/public.
- *
- * Example:
- * <code>
- * # ... authentication code excluded (see previous examples) ...
- * #
- * $conn = new CF_Authentication($auth);
- *
- * $public_container = $conn->create_container("public");
- *
- * # CDN-enable the container and set it's TTL for a month
- * #
- * $public_container->make_public(86400/2); # 12 hours (86400 seconds/day)
- * </code>
- *
- * @param int $ttl the time in seconds content will be cached in the CDN
- * @returns string the CDN enabled Container's URI
- * @throws CDNNotEnabledException CDN functionality not returned during auth
- * @throws AuthenticationException if auth token is not valid/expired
- * @throws InvalidResponseException unexpected response
- */
- function make_public($ttl=86400)
- {
- if ($this->cfs_http->getCDNMUrl() == NULL) {
- throw new CDNNotEnabledException(
- "Authentication response did not indicate CDN availability");
- }
- if ($this->cdn_uri != NULL) {
- # previously published, assume we're setting new attributes
- list($status, $reason, $cdn_uri, $cdn_ssl_uri) =
- $this->cfs_http->update_cdn_container($this->name,$ttl,
- $this->cdn_log_retention,
- $this->cdn_acl_user_agent,
- $this->cdn_acl_referrer);
- #if ($status == 401 && $this->_re_auth()) {
- # return $this->make_public($ttl);
- #}
- if ($status == 404) {
- # this instance _thinks_ the container was published, but the
- # cdn management system thinks otherwise - try again with a PUT
- list($status, $reason, $cdn_uri, $cdn_ssl_uri) =
- $this->cfs_http->add_cdn_container($this->name,$ttl);
-
- }
- } else {
- # publish it for first time
- list($status, $reason, $cdn_uri, $cdn_ssl_uri) =
- $this->cfs_http->add_cdn_container($this->name,$ttl);
- }
- #if ($status == 401 && $this->_re_auth()) {
- # return $this->make_public($ttl);
- #}
- if (!in_array($status, array(201,202))) {
- throw new InvalidResponseException(
- "Invalid response (".$status."): ".$this->cfs_http->get_error());
- }
- $this->cdn_enabled = True;
- $this->cdn_ttl = $ttl;
- $this->cdn_ssl_uri = $cdn_ssl_uri;
- $this->cdn_uri = $cdn_uri;
- $this->cdn_log_retention = False;
- $this->cdn_acl_user_agent = "";
- $this->cdn_acl_referrer = "";
- return $this->cdn_uri;
- }
- /**
- * Purge Containers objects from CDN Cache.
- * Example:
- * <code>
- * # ... authentication code excluded (see previous examples) ...
- * #
- * $conn = new CF_Authentication($auth);
- * $container = $conn->get_container("cdn_enabled");
- * $container->purge_from_cdn("user@domain.com");
- * # or
- * $container->purge_from_cdn();
- * # or
- * $container->purge_from_cdn("user1@domain.com,user2@domain.com");
- * @returns boolean True if successful
- * @throws CDNNotEnabledException if CDN Is not enabled on this connection
- * @throws InvalidResponseException if the response expected is not returned
- */
- function purge_from_cdn($email=null)
- {
- if (!$this->cfs_http->getCDNMUrl())
- {
- throw new CDNNotEnabledException(
- "Authentication response did not indicate CDN availability");
- }
- $status = $this->cfs_http->purge_from_cdn($this->name, $email);
- if ($status < 199 or $status > 299) {
- throw new InvalidResponseException(
- "Invalid response (".$status."): ".$this->cfs_http->get_error());
- }
- return True;
- }
- /**
- * Enable ACL restriction by User Agent for this container.
- *
- * Example:
- * <code>
- * # ... authentication code excluded (see previous examples) ...
- * #
- * $conn = new CF_Authentication($auth);
- *
- * $public_container = $conn->get_container("public");
- *
- * # Enable ACL by Referrer
- * $public_container->acl_referrer("Mozilla");
- * </code>
- *
- * @returns boolean True if successful
- * @throws CDNNotEnabledException CDN functionality not returned during auth
- * @throws AuthenticationException if auth token is not valid/expired
- * @throws InvalidResponseException unexpected response
- */
- function acl_user_agent($cdn_acl_user_agent="") {
- if ($this->cfs_http->getCDNMUrl() == NULL) {
- throw new CDNNotEnabledException(
- "Authentication response did not indicate CDN availability");
- }
- list($status,$reason) =
- $this->cfs_http->update_cdn_container($this->name,
- $this->cdn_ttl,
- $this->cdn_log_retention,
- $cdn_acl_user_agent,
- $this->cdn_acl_referrer
- );
- if (!in_array($status, array(202,404))) {
- throw new InvalidResponseException(
- "Invalid response (".$status."): ".$this->cfs_http->get_error());
- }
- $this->cdn_acl_user_agent = $cdn_acl_user_agent;
- return True;
- }
-
- /**
- * Enable ACL restriction by referer for this container.
- *
- * Example:
- * <code>
- * # ... authentication code excluded (see previous examples) ...
- * #
- * $conn = new CF_Authentication($auth);
- *
- * $public_container = $conn->get_container("public");
- *
- * # Enable Referrer
- * $public_container->acl_referrer("http://www.example.com/gallery.php");
- * </code>
- *
- * @returns boolean True if successful
- * @throws CDNNotEnabledException CDN functionality not returned during auth
- * @throws AuthenticationException if auth token is not valid/expired
- * @throws InvalidResponseException unexpected response
- */
- function acl_referrer($cdn_acl_referrer="") {
- if ($this->cfs_http->getCDNMUrl() == NULL) {
- throw new CDNNotEnabledException(
- "Authentication response did not indicate CDN availability");
- }
- list($status,$reason) =
- $this->cfs_http->update_cdn_container($this->name,
- $this->cdn_ttl,
- $this->cdn_log_retention,
- $this->cdn_acl_user_agent,
- $cdn_acl_referrer
- );
- if (!in_array($status, array(202,404))) {
- throw new InvalidResponseException(
- "Invalid response (".$status."): ".$this->cfs_http->get_error());
- }
- $this->cdn_acl_referrer = $cdn_acl_referrer;
- return True;
- }
-
- /**
- * Enable log retention for this CDN container.
- *
- * Enable CDN log retention on the container. If enabled logs will
- * be periodically (at unpredictable intervals) compressed and
- * uploaded to a ".CDN_ACCESS_LOGS" container in the form of
- * "container_name.YYYYMMDDHH-XXXX.gz". Requires CDN be enabled on
- * the account.
- *
- * Example:
- * <code>
- * # ... authentication code excluded (see previous examples) ...
- * #
- * $conn = new CF_Authentication($auth);
- *
- * $public_container = $conn->get_container("public");
- *
- * # Enable logs retention.
- * $public_container->log_retention(True);
- * </code>
- *
- * @returns boolean True if successful
- * @throws CDNNotEnabledException CDN functionality not returned during auth
- * @throws AuthenticationException if auth token is not valid/expired
- * @throws InvalidResponseException unexpected response
- */
- function log_retention($cdn_log_retention=False) {
- if ($this->cfs_http->getCDNMUrl() == NULL) {
- throw new CDNNotEnabledException(
- "Authentication response did not indicate CDN availability");
- }
- list($status,$reason) =
- $this->cfs_http->update_cdn_container($this->name,
- $this->cdn_ttl,
- $cdn_log_retention,
- $this->cdn_acl_user_agent,
- $this->cdn_acl_referrer
- );
- if (!in_array($status, array(202,404))) {
- throw new InvalidResponseException(
- "Invalid response (".$status."): ".$this->cfs_http->get_error());
- }
- $this->cdn_log_retention = $cdn_log_retention;
- return True;
- }
-
- /**
- * Disable the CDN sharing for this container
- *
- * Use this method to disallow distribution into the CDN of this Container's
- * content.
- *
- * NOTE: Any content already cached in the CDN will continue to be served
- * from its cache until the TTL expiration transpires. The default
- * TTL is typically one day, so "privatizing" the Container will take
- * up to 24 hours before the content is purged from the CDN cache.
- *
- * Example:
- * <code>
- * # ... authentication code excluded (see previous examples) ...
- * #
- * $conn = new CF_Authentication($auth);
- *
- * $public_container = $conn->get_container("public");
- *
- * # Disable CDN accessability
- * # ... still cached up to a month based on previous example
- * #
- * $public_container->make_private();
- * </code>
- *
- * @returns boolean True if successful
- * @throws CDNNotEnabledException CDN functionality not returned during auth
- * @throws AuthenticationException if auth token is not valid/expired
- * @throws InvalidResponseException unexpected response
- */
- function make_private()
- {
- if ($this->cfs_http->getCDNMUrl() == NULL) {
- throw new CDNNotEnabledException(
- "Authentication response did not indicate CDN availability");
- }
- list($status,$reason) = $this->cfs_http->remove_cdn_container($this->name);
- #if ($status == 401 && $this->_re_auth()) {
- # return $this->make_private();
- #}
- if (!in_array($status, array(202,404))) {
- throw new InvalidResponseException(
- "Invalid response (".$status."): ".$this->cfs_http->get_error());
- }
- $this->cdn_enabled = False;
- $this->cdn_ttl = NULL;
- $this->cdn_uri = NULL;
- $this->cdn_ssl_uri = NULL;
- $this->cdn_streaming_uri - NULL;
- $this->cdn_log_retention = NULL;
- $this->cdn_acl_user_agent = NULL;
- $this->cdn_acl_referrer = NULL;
- return True;
- }
-
- /**
- * Check if this Container is being publicly served via CDN
- *
- * Use this method to determine if the Container's content is currently
- * available through the CDN.
- *
- * Example:
- * <code>
- * # ... authentication code excluded (see previous examples) ...
- * #
- * $conn = new CF_Authentication($auth);
- *
- * $public_container = $conn->get_container("public");
- *
- * # Display CDN accessability
- * #
- * $public_container->is_public() ? print "Yes" : print "No";
- * </code>
- *
- * @returns boolean True if enabled, False otherwise
- */
- function is_public()
- {
- return $this->cdn_enabled == True ? True : False;
- }
-
- /**
- * Create a new remote storage Object
- *
- * Return a new Object instance. If the remote storage Object exists,
- * the instance's attributes are populated.
- *
- * Example:
- * <code>
- * # ... authentication code excluded (see previous examples) ...
- * #
- * $conn = new CF_Authentication($auth);
- *
- * $public_container = $conn->get_container("public");
- *
- * # This creates a local instance of a storage object but only creates
- * # it in the storage system when the object's write() method is called.
- * #
- * $pic = $public_container->create_object("baby.jpg");
- * </code>
- *
- * @param string $obj_name name of storage Object
- * @return obj CF_Object instance
- */
- function create_object($obj_name=NULL)
- {
- return new CF_Object($this, $obj_name);
- }
-
- /**
- * Return an Object instance for the remote storage Object
- *
- * Given a name, return a Object instance representing the
- * remote storage object.
- *
- * Example:
- * <code>
- * # ... authentication code excluded (see previous examples) ...
- * #
- * $conn = new CF_Authentication($auth);
- *
- * $public_container = $conn->get_container("public");
- *
- * # This call only fetches header information and not the content of
- * # the storage object. Use the Object's read() or stream() methods
- * # to obtain the object's data.
- * #
- * $pic = $public_container->get_object("baby.jpg");
- * </code>
- *
- * @param string $obj_name name of storage Object
- * @return obj CF_Object instance
- */
- function get_object($obj_name=NULL)
- {
- return new CF_Object($this, $obj_name, True);
- }
-
- /**
- * Return a list of Objects
- *
- * Return an array of strings listing the Object names in this Container.
- *
- * Example:
- * <code>
- * # ... authentication code excluded (see previous examples) ...
- * #
- * $images = $conn->get_container("my photos");
- *
- * # Grab the list of all storage objects
- * #
- * $all_objects = $images->list_objects();
- *
- * # Grab subsets of all storage objects
- * #
- * $first_ten = $images->list_objects(10);
- *
- * # Note the use of the previous result's last object name being
- * # used as the 'marker' parameter to fetch the next 10 objects
- * #
- * $next_ten = $images->list_objects(10, $first_ten[count($first_ten)-1]);
- *
- * # Grab images starting with "birthday_party" and default limit/marker
- * # to match all photos with that prefix
- * #
- * $prefixed = $images->list_objects(0, NULL, "birthday");
- *
- * # Assuming you have created the appropriate directory marker Objects,
- * # you can traverse your pseudo-hierarchical containers
- * # with the "path" argument.
- * #
- * $animals = $images->list_objects(0,NULL,NULL,"pictures/animals");
- * $dogs = $images->list_objects(0,NULL,NULL,"pictures/animals/dogs");
- * </code>
- *
- * @param int $limit <i>optional</i> only return $limit names
- * @param int $marker <i>optional</i> subset of names starting at $marker
- * @param string $prefix <i>optional</i> Objects whose names begin with $prefix
- * @param string $path <i>optional</i> only return results under "pathname"
- * @return array array of strings
- * @throws InvalidResponseException unexpected response
- */
- function list_objects($limit=0, $marker=NULL, $prefix=NULL, $path=NULL)
- {
- list($status, $reason, $obj_list) =
- $this->cfs_http->list_objects($this->name, $limit,
- $marker, $prefix, $path);
- #if ($status == 401 && $this->_re_auth()) {
- # return $this->list_objects($limit, $marker, $prefix, $path);
- #}
- if ($status < 200 || $status > 299) {
- throw new InvalidResponseException(
- "Invalid response (".$status."): ".$this->cfs_http->get_error());
- }
- return $obj_list;
- }
-
- /**
- * Return an array of Objects
- *
- * Return an array of Object instances in this Container.
- *
- * Example:
- * <code>
- * # ... authentication code excluded (see previous examples) ...
- * #
- * $images = $conn->get_container("my photos");
- *
- * # Grab the list of all storage objects
- * #
- * $all_objects = $images->get_objects();
- *
- * # Grab subsets of all storage objects
- * #
- * $first_ten = $images->get_objects(10);
- *
- * # Note the use of the previous result's last object name being
- * # used as the 'marker' parameter to fetch the next 10 objects
- * #
- * $next_ten = $images->list_objects(10, $first_ten[count($first_ten)-1]);
- *
- * # Grab images starting with "birthday_party" and default limit/marker
- * # to match all photos with that prefix
- * #
- * $prefixed = $images->get_objects(0, NULL, "birthday");
- *
- * # Assuming you have created the appropriate directory marker Objects,
- * # you can traverse your pseudo-hierarchical containers
- * # with the "path" argument.
- * #
- * $animals = $images->get_objects(0,NULL,NULL,"pictures/animals");
- * $dogs = $images->get_objects(0,NULL,NULL,"pictures/animals/dogs");
- * </code>
- *
- * @param int $limit <i>optional</i> only return $limit names
- * @param int $marker <i>optional</i> subset of names starting at $marker
- * @param string $prefix <i>optional</i> Objects whose names begin with $prefix
- * @param string $path <i>optional</i> only return results under "pathname"
- * @return array array of strings
- * @throws InvalidResponseException unexpected response
- */
- function get_objects($limit=0, $marker=NULL, $prefix=NULL, $path=NULL)
- {
- list($status, $reason, $obj_array) =
- $this->cfs_http->get_objects($this->name, $limit,
- $marker, $prefix, $path);
- #if ($status == 401 && $this->_re_auth()) {
- # return $this->get_objects($limit, $marker, $prefix, $path);
- #}
- if ($status < 200 || $status > 299) {
- throw new InvalidResponseException(
- "Invalid response (".$status."): ".$this->cfs_http->get_error());
- }
- $objects = array();
- foreach ($obj_array as $obj) {
- $tmp = new CF_Object($this, $obj["name"], False, False);
- $tmp->content_type = $obj["content_type"];
- $tmp->content_length = (float) $obj["bytes"];
- $tmp->set_etag($obj["hash"]);
- $tmp->last_modified = $obj["last_modified"];
- $objects[] = $tmp;
- }
- return $objects;
- }
-
- /**
- * Copy a remote storage Object to a target Container
- *
- * Given an Object instance or name and a target Container instance or name, copy copies the remote Object
- * and all associated metadata.
- *
- * Example:
- * <code>
- * # ... authentication code excluded (see previous examples) ...
- * #
- * $conn = new CF_Authentication($auth);
- *
- * $images = $conn->get_container("my photos");
- *
- * # Copy specific object
- * #
- * $images->copy_object_to("disco_dancing.jpg","container_target");
- * </code>
- *
- * @param obj $obj name or instance of Object to copy
- * @param obj $container_target name or instance of target Container
- * @param string $dest_obj_name name of target object (optional - uses source name if omitted)
- * @param array $metadata metadata array for new object (optional)
- * @param array $headers header fields array for the new object (optional)
- * @return boolean <kbd>true</kbd> if successfully copied
- * @throws SyntaxException invalid Object/Container name
- * @throws NoSuchObjectException remote Object does not exist
- * @throws InvalidResponseException unexpected response
- */
- function copy_object_to($obj,$container_target,$dest_obj_name=NULL,$metadata=NULL,$headers=NULL)
- {
- $obj_name = NULL;
- if (is_object($obj)) {
- if (get_class($obj) == "CF_Object") {
- $obj_name = $obj->name;
- }
- }
- if (is_string($obj)) {
- $obj_name = $obj;
- }
- if (!$obj_name) {
- throw new SyntaxException("Object name not set.");
- }
-
- if ($dest_obj_name === NULL) {
- $dest_obj_name = $obj_name;
- }
-
- $container_name_target = NULL;
- if (is_object($container_target)) {
- if (get_class($container_target) == "CF_Container") {
- $container_name_target = $container_target->name;
- }
- }
- if (is_string($container_target)) {
- $container_name_target = $container_target;
- }
- if (!$container_name_target) {
- throw new SyntaxException("Container name target not set.");
- }
-
- $status = $this->cfs_http->copy_object($obj_name,$dest_obj_name,$this->name,$container_name_target,$metadata,$headers);
- if ($status == 404) {
- $m = "Specified object '".$this->name."/".$obj_name;
- $m.= "' did not exist as source to copy from or '".$container_name_target."' did not exist as target to copy to.";
- throw new NoSuchObjectException($m);
- }
- if ($status < 200 || $status > 299) {
- throw new InvalidResponseException(
- "Invalid response (".$status."): ".$this->cfs_http->get_error());
- }
- return true;
- }
-
- /**
- * Copy a remote storage Object from a source Container
- *
- * Given an Object instance or name and a source Container instance or name, copy copies the remote Object
- * and all associated metadata.
- *
- * Example:
- * <code>
- * # ... authentication code excluded (see previous examples) ...
- * #
- * $conn = new CF_Authentication($auth);
- *
- * $images = $conn->get_container("my photos");
- *
- * # Copy specific object
- * #
- * $images->copy_object_from("disco_dancing.jpg","container_source");
- * </code>
- *
- * @param obj $obj name or instance of Object to copy
- * @param obj $container_source name or instance of source Container
- * @param string $dest_obj_name name of target object (optional - uses source name if omitted)
- * @param array $metadata metadata array for new object (optional)
- * @param array $headers header fields array for the new object (optional)
- * @return boolean <kbd>true</kbd> if successfully copied
- * @throws SyntaxException invalid Object/Container name
- * @throws NoSuchObjectException remote Object does not exist
- * @throws InvalidResponseException unexpected response
- */
- function copy_object_from($obj,$container_source,$dest_obj_name=NULL,$metadata=NULL,$headers=NULL)
- {
- $obj_name = NULL;
- if (is_object($obj)) {
- if (get_class($obj) == "CF_Object") {
- $obj_name = $obj->name;
- }
- }
- if (is_string($obj)) {
- $obj_name = $obj;
- }
- if (!$obj_name) {
- throw new SyntaxException("Object name not set.");
- }
-
- if ($dest_obj_name === NULL) {
- $dest_obj_name = $obj_name;
- }
-
- $container_name_source = NULL;
- if (is_object($container_source)) {
- if (get_class($container_source) == "CF_Container") {
- $container_name_source = $container_source->name;
- }
- }
- if (is_string($container_source)) {
- $container_name_source = $container_source;
- }
- if (!$container_name_source) {
- throw new SyntaxException("Container name source not set.");
- }
-
- $status = $this->cfs_http->copy_object($obj_name,$dest_obj_name,$container_name_source,$this->name,$metadata,$headers);
- if ($status == 404) {
- $m = "Specified object '".$container_name_source."/".$obj_name;
- $m.= "' did not exist as source to copy from or '".$this->name."/".$obj_name."' did not exist as target to copy to.";
- throw new NoSuchObjectException($m);
- }
- if ($status < 200 || $status > 299) {
- throw new InvalidResponseException(
- "Invalid response (".$status."): ".$this->cfs_http->get_error());
- }
-
- return true;
- }
-
- /**
- * Move a remote storage Object to a target Container
- *
- * Given an Object instance or name and a target Container instance or name, move copies the remote Object
- * and all associated metadata and deletes the source Object afterwards
- *
- * Example:
- * <code>
- * # ... authentication code excluded (see previous examples) ...
- * #
- * $conn = new CF_Authentication($auth);
- *
- * $images = $conn->get_container("my photos");
- *
- * # Move specific object
- * #
- * $images->move_object_to("disco_dancing.jpg","container_target");
- * </code>
- *
- * @param obj $obj name or instance of Object to move
- * @param obj $container_target name or instance of target Container
- * @param string $dest_obj_name name of target object (optional - uses source name if omitted)
- * @param array $metadata metadata array for new object (optional)
- * @param array $headers header fields array for the new object (optional)
- * @return boolean <kbd>true</kbd> if successfully moved
- * @throws SyntaxException invalid Object/Container name
- * @throws NoSuchObjectException remote Object does not exist
- * @throws InvalidResponseException unexpected response
- */
- function move_object_to($obj,$container_target,$dest_obj_name=NULL,$metadata=NULL,$headers=NULL)
- {
- $retVal = false;
-
- if(self::copy_object_to($obj,$container_target,$dest_obj_name,$metadata,$headers)) {
- $retVal = self::delete_object($obj,$this->name);
- }
-
- return $retVal;
- }
-
- /**
- * Move a remote storage Object from a source Container
- *
- * Given an Object instance or name and a source Container instance or name, move copies the remote Object
- * and all associated metadata and deletes the source Object afterwards
- *
- * Example:
- * <code>
- * # ... authentication code excluded (see previous examples) ...
- * #
- * $conn = new CF_Authentication($auth);
- *
- * $images = $conn->get_container("my photos");
- *
- * # Move specific object
- * #
- * $images->move_object_from("disco_dancing.jpg","container_target");
- * </code>
- *
- * @param obj $obj name or instance of Object to move
- * @param obj $container_source name or instance of target Container
- * @param string $dest_obj_name name of target object (optional - uses source name if omitted)
- * @param array $metadata metadata array for new object (optional)
- * @param array $headers header fields array for the new object (optional)
- * @return boolean <kbd>true</kbd> if successfully moved
- * @throws SyntaxException invalid Object/Container name
- * @throws NoSuchObjectException remote Object does not exist
- * @throws InvalidResponseException unexpected response
- */
- function move_object_from($obj,$container_source,$dest_obj_name=NULL,$metadata=NULL,$headers=NULL)
- {
- $retVal = false;
-
- if(self::copy_object_from($obj,$container_source,$dest_obj_name,$metadata,$headers)) {
- $retVal = self::delete_object($obj,$container_source);
- }
-
- return $retVal;
- }
-
- /**
- * Delete a remote storage Object
- *
- * Given an Object instance or name, permanently remove the remote Object
- * and all associated metadata.
- *
- * Example:
- * <code>
- * # ... authentication code excluded (see previous examples) ...
- * #
- * $conn = new CF_Authentication($auth);
- *
- * $images = $conn->get_container("my photos");
- *
- * # Delete specific object
- * #
- * $images->delete_object("disco_dancing.jpg");
- * </code>
- *
- * @param obj $obj name or instance of Object to delete
- * @param obj $container name or instance of Container in which the object resides (optional)
- * @return boolean <kbd>True</kbd> if successfully removed
- * @throws SyntaxException invalid Object name
- * @throws NoSuchObjectException remote Object does not exist
- * @throws InvalidResponseException unexpected response
- */
- function delete_object($obj,$container=NULL)
- {
- $obj_name = NULL;
- if (is_object($obj)) {
- if (get_class($obj) == "CF_Object") {
- $obj_name = $obj->name;
- }
- }
- if (is_string($obj)) {
- $obj_name = $obj;
- }
- if (!$obj_name) {
- throw new SyntaxException("Object name not set.");
- }
-
- $container_name = NULL;
-
- if($container === NULL) {
- $container_name = $this->name;
- }
- else {
- if (is_object($container)) {
- if (get_class($container) == "CF_Container") {
- $container_name = $container->name;
- }
- }
- if (is_string($container)) {
- $container_name = $container;
- }
- if (!$container_name) {
- throw new SyntaxException("Container name source not set.");
- }
- }
-
- $status = $this->cfs_http->delete_object($container_name, $obj_name);
- #if ($status == 401 && $this->_re_auth()) {
- # return $this->delete_object($obj);
- #}
- if ($status == 404) {
- $m = "Specified object '".$container_name."/".$obj_name;
- $m.= "' did not exist to delete.";
- throw new NoSuchObjectException($m);
- }
- if ($status != 204) {
- throw new InvalidResponseException(
- "Invalid response (".$status."): ".$this->cfs_http->get_error());
- }
- return True;
- }
-
- /**
- * Helper function to create "path" elements for a given Object name
- *
- * Given an Object whos name contains '/' path separators, this function
- * will create the "directory marker" Objects of one byte with the
- * Content-Type of "application/directory".
- *
- * It assumes the last element of the full path is the "real" Object
- * and does NOT create a remote storage Object for that last element.
- */
- function create_paths($path_name)
- {
- if ($path_name[0] == '/') {
- $path_name = mb_substr($path_name, 0, 1);
- }
- $elements = explode('/', $path_name, -1);
- $build_path = "";
- foreach ($elements as $idx => $val) {
- if (!$build_path) {
- $build_path = $val;
- } else {
- $build_path .= "/" . $val;
- }
- $obj = new CF_Object($this, $build_path);
- $obj->content_type = "application/directory";
- $obj->write(".", 1);
- }
- }
-
- /**
- * Internal method to grab CDN/Container info if appropriate to do so
- *
- * @throws InvalidResponseException unexpected response
- */
- private function _cdn_initialize()
- {
- list($status, $reason, $cdn_enabled, $cdn_ssl_uri, $cdn_streaming_uri, $cdn_uri, $cdn_ttl,
- $cdn_log_retention, $cdn_acl_user_agent, $cdn_acl_referrer) =
- $this->cfs_http->head_cdn_container($this->name);
- #if ($status == 401 && $this->_re_auth()) {
- # return $this->_cdn_initialize();
- #}
- if (!in_array($status, array(204,404))) {
- throw new InvalidResponseException(
- "Invalid response (".$status."): ".$this->cfs_http->get_error());
- }
- $this->cdn_enabled = $cdn_enabled;
- $this->cdn_streaming_uri = $cdn_streaming_uri;
- $this->cdn_ssl_uri = $cdn_ssl_uri;
- $this->cdn_uri = $cdn_uri;
- $this->cdn_ttl = $cdn_ttl;
- $this->cdn_log_retention = $cdn_log_retention;
- $this->cdn_acl_user_agent = $cdn_acl_user_agent;
- $this->cdn_acl_referrer = $cdn_acl_referrer;
- }
-
- #private function _re_auth()
- #{
- # $new_auth = new CF_Authentication(
- # $this->cfs_auth->username,
- # $this->cfs_auth->api_key,
- # $this->cfs_auth->auth_host,
- # $this->cfs_auth->account);
- # $new_auth->authenticate();
- # $this->cfs_auth = $new_auth;
- # $this->cfs_http->setCFAuth($this->cfs_auth);
- # return True;
- #}
-}
-
-
-/**
- * Object operations
- *
- * An Object is analogous to a file on a conventional filesystem. You can
- * read data from, or write data to your Objects. You can also associate
- * arbitrary metadata with them.
- *
- * @package php-cloudfiles
- */
-class CF_Object
-{
- public $container;
- public $name;
- public $last_modified;
- public $content_type;
- public $content_length;
- public $metadata;
- public $headers;
- public $manifest;
- private $etag;
-
- /**
- * Class constructor
- *
- * @param obj $container CF_Container instance
- * @param string $name name of Object
- * @param boolean $force_exists if set, throw an error if Object doesn't exist
- */
- function __construct(&$container, $name, $force_exists=False, $dohead=True)
- {
- if ($name[0] == "/") {
- $r = "Object name '".$name;
- $r .= "' cannot contain begin with a '/' character.";
- throw new SyntaxException($r);
- }
- if (strlen($name) > MAX_OBJECT_NAME_LEN) {
- throw new SyntaxException("Object name exceeds "
- . "maximum allowed length.");
- }
- $this->container = $container;
- $this->name = $name;
- $this->etag = NULL;
- $this->_etag_override = False;
- $this->last_modified = NULL;
- $this->content_type = NULL;
- $this->content_length = 0;
- $this->metadata = array();
- $this->headers = array();
- $this->manifest = NULL;
- if ($dohead) {
- if (!$this->_initialize() && $force_exists) {
- throw new NoSuchObjectException("No such object '".$name."'");
- }
- }
- }
-
- /**
- * String representation of Object
- *
- * Pretty print the Object's location and name
- *
- * @return string Object information
- */
- function __toString()
- {
- return $this->container->name . "/" . $this->name;
- }
-
- /**
- * Internal check to get the proper mimetype.
- *
- * This function would go over the available PHP methods to get
- * the MIME type.
- *
- * By default it will try to use the PHP fileinfo library which is
- * available from PHP 5.3 or as an PECL extension
- * (http://pecl.php.net/package/Fileinfo).
- *
- * It will get the magic file by default from the system wide file
- * which is usually available in /usr/share/magic on Unix or try
- * to use the file specified in the source directory of the API
- * (share directory).
- *
- * if fileinfo is not available it will try to use the internal
- * mime_content_type function.
- *
- * @param string $handle name of file or buffer to guess the type from
- * @return boolean <kbd>True</kbd> if successful
- * @throws BadContentTypeException
- */
- function _guess_content_type($handle) {
- if ($this->content_type)
- return;
-
-// if (function_exists("finfo_open")) {
-// $local_magic = dirname(__FILE__) . "/share/magic";
-// $finfo = @finfo_open(FILEINFO_MIME, $local_magic);
-//
-// if (!$finfo)
-// $finfo = @finfo_open(FILEINFO_MIME);
-//
-// if ($finfo) {
-//
-// if (is_file((string)$handle))
-// $ct = @finfo_file($finfo, $handle);
-// else
-// $ct = @finfo_buffer($finfo, $handle);
-//
-// /* PHP 5.3 fileinfo display extra information like
-// charset so we remove everything after the ; since
-// we are not into that stuff */
-// if ($ct) {
-// $extra_content_type_info = strpos($ct, "; ");
-// if ($extra_content_type_info)
-// $ct = substr($ct, 0, $extra_content_type_info);
-// }
-//
-// if ($ct && $ct != 'application/octet-stream')
-// $this->content_type = $ct;
-//
-// @finfo_close($finfo);
-// }
-// }
-//
-// if (!$this->content_type && (string)is_file($handle) && function_exists("mime_content_type")) {
-// $this->content_type = @mime_content_type($handle);
-// }
-
- //use OC's mimetype detection for files
- if(@is_file($handle)){
- $this->content_type=OC_Helper::getMimeType($handle);
- }else{
- $this->content_type=OC_Helper::getStringMimeType($handle);
- }
-
- if (!$this->content_type) {
- throw new BadContentTypeException("Required Content-Type not set");
- }
- return True;
- }
-
- /**
- * String representation of the Object's public URI
- *
- * A string representing the Object's public URI assuming that it's
- * parent Container is CDN-enabled.
- *
- * Example:
- * <code>
- * # ... authentication/connection/container code excluded
- * # ... see previous examples
- *
- * # Print out the Object's CDN URI (if it has one) in an HTML img-tag
- * #
- * print "<img src='$pic->public_uri()' />\n";
- * </code>
- *
- * @return string Object's public URI or NULL
- */
- function public_uri()
- {
- if ($this->container->cdn_enabled) {
- return $this->container->cdn_uri . "/" . $this->name;
- }
- return NULL;
- }
-
- /**
- * String representation of the Object's public SSL URI
- *
- * A string representing the Object's public SSL URI assuming that it's
- * parent Container is CDN-enabled.
- *
- * Example:
- * <code>
- * # ... authentication/connection/container code excluded
- * # ... see previous examples
- *
- * # Print out the Object's CDN SSL URI (if it has one) in an HTML img-tag
- * #
- * print "<img src='$pic->public_ssl_uri()' />\n";
- * </code>
- *
- * @return string Object's public SSL URI or NULL
- */
- function public_ssl_uri()
- {
- if ($this->container->cdn_enabled) {
- return $this->container->cdn_ssl_uri . "/" . $this->name;
- }
- return NULL;
- }
- /**
- * String representation of the Object's public Streaming URI
- *
- * A string representing the Object's public Streaming URI assuming that it's
- * parent Container is CDN-enabled.
- *
- * Example:
- * <code>
- * # ... authentication/connection/container code excluded
- * # ... see previous examples
- *
- * # Print out the Object's CDN Streaming URI (if it has one) in an HTML img-tag
- * #
- * print "<img src='$pic->public_streaming_uri()' />\n";
- * </code>
- *
- * @return string Object's public Streaming URI or NULL
- */
- function public_streaming_uri()
- {
- if ($this->container->cdn_enabled) {
- return $this->container->cdn_streaming_uri . "/" . $this->name;
- }
- return NULL;
- }
-
- /**
- * Read the remote Object's data
- *
- * Returns the Object's data. This is useful for smaller Objects such
- * as images or office documents. Object's with larger content should use
- * the stream() method below.
- *
- * Pass in $hdrs array to set specific custom HTTP headers such as
- * If-Match, If-None-Match, If-Modified-Since, Range, etc.
- *
- * Example:
- * <code>
- * # ... authentication/connection/container code excluded
- * # ... see previous examples
- *
- * $my_docs = $conn->get_container("documents");
- * $doc = $my_docs->get_object("README");
- * $data = $doc->read(); # read image content into a string variable
- * print $data;
- *
- * # Or see stream() below for a different example.
- * #
- * </code>
- *
- * @param array $hdrs user-defined headers (Range, If-Match, etc.)
- * @return string Object's data
- * @throws InvalidResponseException unexpected response
- */
- function read($hdrs=array())
- {
- list($status, $reason, $data) =
- $this->container->cfs_http->get_object_to_string($this, $hdrs);
- #if ($status == 401 && $this->_re_auth()) {
- # return $this->read($hdrs);
- #}
- if (($status < 200) || ($status > 299
- && $status != 412 && $status != 304)) {
- throw new InvalidResponseException("Invalid response (".$status."): "
- . $this->container->cfs_http->get_error());
- }
- return $data;
- }
-
- /**
- * Streaming read of Object's data
- *
- * Given an open PHP resource (see PHP's fopen() method), fetch the Object's
- * data and write it to the open resource handle. This is useful for
- * streaming an Object's content to the browser (videos, images) or for
- * fetching content to a local file.
- *
- * Pass in $hdrs array to set specific custom HTTP headers such as
- * If-Match, If-None-Match, If-Modified-Since, Range, etc.
- *
- * Example:
- * <code>
- * # ... authentication/connection/container code excluded
- * # ... see previous examples
- *
- * # Assuming this is a web script to display the README to the
- * # user's browser:
- * #
- * <?php
- * // grab README from storage system
- * //
- * $my_docs = $conn->get_container("documents");
- * $doc = $my_docs->get_object("README");
- *
- * // Hand it back to user's browser with appropriate content-type
- * //
- * header("Content-Type: " . $doc->content_type);
- * $output = fopen("php://output", "w");
- * $doc->stream($output); # stream object content to PHP's output buffer
- * fclose($output);
- * ?>
- *
- * # See read() above for a more simple example.
- * #
- * </code>
- *
- * @param resource $fp open resource for writing data to
- * @param array $hdrs user-defined headers (Range, If-Match, etc.)
- * @return string Object's data
- * @throws InvalidResponseException unexpected response
- */
- function stream(&$fp, $hdrs=array())
- {
- list($status, $reason) =
- $this->container->cfs_http->get_object_to_stream($this,$fp,$hdrs);
- #if ($status == 401 && $this->_re_auth()) {
- # return $this->stream($fp, $hdrs);
- #}
- if (($status < 200) || ($status > 299
- && $status != 412 && $status != 304)) {
- throw new InvalidResponseException("Invalid response (".$status."): "
- .$reason);
- }
- return True;
- }
-
- /**
- * Store new Object metadata
- *
- * Write's an Object's metadata to the remote Object. This will overwrite
- * an prior Object metadata.
- *
- * Example:
- * <code>
- * # ... authentication/connection/container code excluded
- * # ... see previous examples
- *
- * $my_docs = $conn->get_container("documents");
- * $doc = $my_docs->get_object("README");
- *
- * # Define new metadata for the object
- * #
- * $doc->metadata = array(
- * "Author" => "EJ",
- * "Subject" => "How to use the PHP tests",
- * "Version" => "1.2.2"
- * );
- *
- * # Define additional headers for the object
- * #
- * $doc->headers = array(
- * "Content-Disposition" => "attachment",
- * );
- *
- * # Push the new metadata up to the storage system
- * #
- * $doc->sync_metadata();
- * </code>
- *
- * @return boolean <kbd>True</kbd> if successful, <kbd>False</kbd> otherwise
- * @throws InvalidResponseException unexpected response
- */
- function sync_metadata()
- {
- if (!empty($this->metadata) || !empty($this->headers) || $this->manifest) {
- $status = $this->container->cfs_http->update_object($this);
- #if ($status == 401 && $this->_re_auth()) {
- # return $this->sync_metadata();
- #}
- if ($status != 202) {
- throw new InvalidResponseException("Invalid response ("
- .$status."): ".$this->container->cfs_http->get_error());
- }
- return True;
- }
- return False;
- }
- /**
- * Store new Object manifest
- *
- * Write's an Object's manifest to the remote Object. This will overwrite
- * an prior Object manifest.
- *
- * Example:
- * <code>
- * # ... authentication/connection/container code excluded
- * # ... see previous examples
- *
- * $my_docs = $conn->get_container("documents");
- * $doc = $my_docs->get_object("README");
- *
- * # Define new manifest for the object
- * #
- * $doc->manifest = "container/prefix";
- *
- * # Push the new manifest up to the storage system
- * #
- * $doc->sync_manifest();
- * </code>
- *
- * @return boolean <kbd>True</kbd> if successful, <kbd>False</kbd> otherwise
- * @throws InvalidResponseException unexpected response
- */
-
- function sync_manifest()
- {
- return $this->sync_metadata();
- }
- /**
- * Upload Object's data to Cloud Files
- *
- * Write data to the remote Object. The $data argument can either be a
- * PHP resource open for reading (see PHP's fopen() method) or an in-memory
- * variable. If passing in a PHP resource, you must also include the $bytes
- * parameter.
- *
- * Example:
- * <code>
- * # ... authentication/connection/container code excluded
- * # ... see previous examples
- *
- * $my_docs = $conn->get_container("documents");
- * $doc = $my_docs->get_object("README");
- *
- * # Upload placeholder text in my README
- * #
- * $doc->write("This is just placeholder text for now...");
- * </code>
- *
- * @param string|resource $data string or open resource
- * @param float $bytes amount of data to upload (required for resources)
- * @param boolean $verify generate, send, and compare MD5 checksums
- * @return boolean <kbd>True</kbd> when data uploaded successfully
- * @throws SyntaxException missing required parameters
- * @throws BadContentTypeException if no Content-Type was/could be set
- * @throws MisMatchedChecksumException $verify is set and checksums unequal
- * @throws InvalidResponseException unexpected response
- */
- function write($data=NULL, $bytes=0, $verify=True)
- {
- if (!$data && !is_string($data)) {
- throw new SyntaxException("Missing data source.");
- }
- if ($bytes > MAX_OBJECT_SIZE) {
- throw new SyntaxException("Bytes exceeds maximum object size.");
- }
- if ($verify) {
- if (!$this->_etag_override) {
- $this->etag = $this->compute_md5sum($data);
- }
- } else {
- $this->etag = NULL;
- }
-
- $close_fh = False;
- if (!is_resource($data)) {
- # A hack to treat string data as a file handle. php://memory feels
- # like a better option, but it seems to break on Windows so use
- # a temporary file instead.
- #
- $fp = fopen("php://temp", "wb+");
- #$fp = fopen("php://memory", "wb+");
- fwrite($fp, $data, strlen($data));
- rewind($fp);
- $close_fh = True;
- $this->content_length = (float) strlen($data);
- if ($this->content_length > MAX_OBJECT_SIZE) {
- throw new SyntaxException("Data exceeds maximum object size");
- }
- $ct_data = substr($data, 0, 64);
- } else {
- $this->content_length = $bytes;
- $fp = $data;
- $ct_data = fread($data, 64);
- rewind($data);
- }
-
- $this->_guess_content_type($ct_data);
-
- list($status, $reason, $etag) =
- $this->container->cfs_http->put_object($this, $fp);
- #if ($status == 401 && $this->_re_auth()) {
- # return $this->write($data, $bytes, $verify);
- #}
- if ($status == 412) {
- if ($close_fh) { fclose($fp); }
- throw new SyntaxException("Missing Content-Type header");
- }
- if ($status == 422) {
- if ($close_fh) { fclose($fp); }
- throw new MisMatchedChecksumException(
- "Supplied and computed checksums do not match.");
- }
- if ($status != 201) {
- if ($close_fh) { fclose($fp); }
- throw new InvalidResponseException("Invalid response (".$status."): "
- . $this->container->cfs_http->get_error());
- }
- if (!$verify) {
- $this->etag = $etag;
- }
- if ($close_fh) { fclose($fp); }
- return True;
- }
-
- /**
- * Upload Object data from local filename
- *
- * This is a convenience function to upload the data from a local file. A
- * True value for $verify will cause the method to compute the Object's MD5
- * checksum prior to uploading.
- *
- * Example:
- * <code>
- * # ... authentication/connection/container code excluded
- * # ... see previous examples
- *
- * $my_docs = $conn->get_container("documents");
- * $doc = $my_docs->get_object("README");
- *
- * # Upload my local README's content
- * #
- * $doc->load_from_filename("/home/ej/cloudfiles/readme");
- * </code>
- *
- * @param string $filename full path to local file
- * @param boolean $verify enable local/remote MD5 checksum validation
- * @return boolean <kbd>True</kbd> if data uploaded successfully
- * @throws SyntaxException missing required parameters
- * @throws BadContentTypeException if no Content-Type was/could be set
- * @throws MisMatchedChecksumException $verify is set and checksums unequal
- * @throws InvalidResponseException unexpected response
- * @throws IOException error opening file
- */
- function load_from_filename($filename, $verify=True)
- {
- $fp = @fopen($filename, "r");
- if (!$fp) {
- throw new IOException("Could not open file for reading: ".$filename);
- }
-
- clearstatcache();
-
- $size = (float) sprintf("%u", filesize($filename));
- if ($size > MAX_OBJECT_SIZE) {
- throw new SyntaxException("File size exceeds maximum object size.");
- }
-
- $this->_guess_content_type($filename);
-
- $this->write($fp, $size, $verify);
- fclose($fp);
- return True;
- }
-
- /**
- * Save Object's data to local filename
- *
- * Given a local filename, the Object's data will be written to the newly
- * created file.
- *
- * Example:
- * <code>
- * # ... authentication/connection/container code excluded
- * # ... see previous examples
- *
- * # Whoops! I deleted my local README, let me download/save it
- * #
- * $my_docs = $conn->get_container("documents");
- * $doc = $my_docs->get_object("README");
- *
- * $doc->save_to_filename("/home/ej/cloudfiles/readme.restored");
- * </code>
- *
- * @param string $filename name of local file to write data to
- * @return boolean <kbd>True</kbd> if successful
- * @throws IOException error opening file
- * @throws InvalidResponseException unexpected response
- */
- function save_to_filename($filename)
- {
- $fp = @fopen($filename, "wb");
- if (!$fp) {
- throw new IOException("Could not open file for writing: ".$filename);
- }
- $result = $this->stream($fp);
- fclose($fp);
- return $result;
- }
- /**
- * Purge this Object from CDN Cache.
- * Example:
- * <code>
- * # ... authentication code excluded (see previous examples) ...
- * #
- * $conn = new CF_Authentication($auth);
- * $container = $conn->get_container("cdn_enabled");
- * $obj = $container->get_object("object");
- * $obj->purge_from_cdn("user@domain.com");
- * # or
- * $obj->purge_from_cdn();
- * # or
- * $obj->purge_from_cdn("user1@domain.com,user2@domain.com");
- * @returns boolean True if successful
- * @throws CDNNotEnabledException if CDN Is not enabled on this connection
- * @throws InvalidResponseException if the response expected is not returned
- */
- function purge_from_cdn($email=null)
- {
- if (!$this->container->cfs_http->getCDNMUrl())
- {
- throw new CDNNotEnabledException(
- "Authentication response did not indicate CDN availability");
- }
- $status = $this->container->cfs_http->purge_from_cdn($this->container->name . "/" . $this->name, $email);
- if ($status < 199 or $status > 299) {
- throw new InvalidResponseException(
- "Invalid response (".$status."): ".$this->container->cfs_http->get_error());
- }
- return True;
- }
-
- /**
- * Set Object's MD5 checksum
- *
- * Manually set the Object's ETag. Including the ETag is mandatory for
- * Cloud Files to perform end-to-end verification. Omitting the ETag forces
- * the user to handle any data integrity checks.
- *
- * @param string $etag MD5 checksum hexidecimal string
- */
- function set_etag($etag)
- {
- $this->etag = $etag;
- $this->_etag_override = True;
- }
-
- /**
- * Object's MD5 checksum
- *
- * Accessor method for reading Object's private ETag attribute.
- *
- * @return string MD5 checksum hexidecimal string
- */
- function getETag()
- {
- return $this->etag;
- }
-
- /**
- * Compute the MD5 checksum
- *
- * Calculate the MD5 checksum on either a PHP resource or data. The argument
- * may either be a local filename, open resource for reading, or a string.
- *
- * <b>WARNING:</b> if you are uploading a big file over a stream
- * it could get very slow to compute the md5 you probably want to
- * set the $verify parameter to False in the write() method and
- * compute yourself the md5 before if you have it.
- *
- * @param filename|obj|string $data filename, open resource, or string
- * @return string MD5 checksum hexidecimal string
- */
- function compute_md5sum(&$data)
- {
-
- if (function_exists("hash_init") && is_resource($data)) {
- $ctx = hash_init('md5');
- while (!feof($data)) {
- $buffer = fgets($data, 65536);
- hash_update($ctx, $buffer);
- }
- $md5 = hash_final($ctx, false);
- rewind($data);
- } elseif ((string)@is_file($data)) {
- $md5 = md5_file($data);
- } else {
- $md5 = md5($data);
- }
- return $md5;
- }
-
- /**
- * PRIVATE: fetch information about the remote Object if it exists
- */
- private function _initialize()
- {
- list($status, $reason, $etag, $last_modified, $content_type,
- $content_length, $metadata, $manifest, $headers) =
- $this->container->cfs_http->head_object($this);
- #if ($status == 401 && $this->_re_auth()) {
- # return $this->_initialize();
- #}
- if ($status == 404) {
- return False;
- }
- if ($status < 200 || $status > 299) {
- throw new InvalidResponseException("Invalid response (".$status."): "
- . $this->container->cfs_http->get_error());
- }
- $this->etag = $etag;
- $this->last_modified = $last_modified;
- $this->content_type = $content_type;
- $this->content_length = $content_length;
- $this->metadata = $metadata;
- $this->headers = $headers;
- $this->manifest = $manifest;
- return True;
- }
-
- #private function _re_auth()
- #{
- # $new_auth = new CF_Authentication(
- # $this->cfs_auth->username,
- # $this->cfs_auth->api_key,
- # $this->cfs_auth->auth_host,
- # $this->cfs_auth->account);
- # $new_auth->authenticate();
- # $this->container->cfs_auth = $new_auth;
- # $this->container->cfs_http->setCFAuth($this->cfs_auth);
- # return True;
- #}
-}
-
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-?>
diff --git a/3rdparty/php-cloudfiles/cloudfiles_exceptions.php b/3rdparty/php-cloudfiles/cloudfiles_exceptions.php
deleted file mode 100644
index 5624d6b8634..00000000000
--- a/3rdparty/php-cloudfiles/cloudfiles_exceptions.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-/**
- * Custom Exceptions for the CloudFiles API
- *
- * Requres PHP 5.x (for Exceptions and OO syntax)
- *
- * See COPYING for license information.
- *
- * @author Eric "EJ" Johnson <ej@racklabs.com>
- * @copyright Copyright (c) 2008, Rackspace US, Inc.
- * @package php-cloudfiles-exceptions
- */
-
-/**
- * Custom Exceptions for the CloudFiles API
- * @package php-cloudfiles-exceptions
- */
-class SyntaxException extends Exception { }
-class AuthenticationException extends Exception { }
-class InvalidResponseException extends Exception { }
-class NonEmptyContainerException extends Exception { }
-class NoSuchObjectException extends Exception { }
-class NoSuchContainerException extends Exception { }
-class NoSuchAccountException extends Exception { }
-class MisMatchedChecksumException extends Exception { }
-class IOException extends Exception { }
-class CDNNotEnabledException extends Exception { }
-class BadContentTypeException extends Exception { }
-class InvalidUTF8Exception extends Exception { }
-class ConnectionNotOpenException extends Exception { }
-
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-?>
diff --git a/3rdparty/php-cloudfiles/cloudfiles_http.php b/3rdparty/php-cloudfiles/cloudfiles_http.php
deleted file mode 100644
index 0e5d9717e81..00000000000
--- a/3rdparty/php-cloudfiles/cloudfiles_http.php
+++ /dev/null
@@ -1,1488 +0,0 @@
-<?php
-/**
- * This is an HTTP client class for Cloud Files. It uses PHP's cURL module
- * to handle the actual HTTP request/response. This is NOT a generic HTTP
- * client class and is only used to abstract out the HTTP communication for
- * the PHP Cloud Files API.
- *
- * This module was designed to re-use existing HTTP(S) connections between
- * subsequent operations. For example, performing multiple PUT operations
- * will re-use the same connection.
- *
- * This modules also provides support for streaming content into and out
- * of Cloud Files. The majority (all?) of the PHP HTTP client modules expect
- * to read the server's response into a string variable. This will not work
- * with large files without killing your server. Methods like,
- * get_object_to_stream() and put_object() take an open filehandle
- * argument for streaming data out of or into Cloud Files.
- *
- * Requres PHP 5.x (for Exceptions and OO syntax)
- *
- * See COPYING for license information.
- *
- * @author Eric "EJ" Johnson <ej@racklabs.com>
- * @copyright Copyright (c) 2008, Rackspace US, Inc.
- * @package php-cloudfiles-http
- */
-
-/**
- */
-require_once("cloudfiles_exceptions.php");
-
-define("PHP_CF_VERSION", "1.7.10");
-define("USER_AGENT", sprintf("PHP-CloudFiles/%s", PHP_CF_VERSION));
-define("MAX_HEADER_NAME_LEN", 128);
-define("MAX_HEADER_VALUE_LEN", 256);
-define("ACCOUNT_CONTAINER_COUNT", "X-Account-Container-Count");
-define("ACCOUNT_BYTES_USED", "X-Account-Bytes-Used");
-define("CONTAINER_OBJ_COUNT", "X-Container-Object-Count");
-define("CONTAINER_BYTES_USED", "X-Container-Bytes-Used");
-define("MANIFEST_HEADER", "X-Object-Manifest");
-define("METADATA_HEADER_PREFIX", "X-Object-Meta-");
-define("CONTENT_HEADER_PREFIX", "Content-");
-define("ACCESS_CONTROL_HEADER_PREFIX", "Access-Control-");
-define("ORIGIN_HEADER", "Origin");
-define("CDN_URI", "X-CDN-URI");
-define("CDN_SSL_URI", "X-CDN-SSL-URI");
-define("CDN_STREAMING_URI", "X-CDN-Streaming-URI");
-define("CDN_ENABLED", "X-CDN-Enabled");
-define("CDN_LOG_RETENTION", "X-Log-Retention");
-define("CDN_ACL_USER_AGENT", "X-User-Agent-ACL");
-define("CDN_ACL_REFERRER", "X-Referrer-ACL");
-define("CDN_TTL", "X-TTL");
-define("CDNM_URL", "X-CDN-Management-Url");
-define("STORAGE_URL", "X-Storage-Url");
-define("AUTH_TOKEN", "X-Auth-Token");
-define("AUTH_USER_HEADER", "X-Auth-User");
-define("AUTH_KEY_HEADER", "X-Auth-Key");
-define("AUTH_USER_HEADER_LEGACY", "X-Storage-User");
-define("AUTH_KEY_HEADER_LEGACY", "X-Storage-Pass");
-define("AUTH_TOKEN_LEGACY", "X-Storage-Token");
-define("CDN_EMAIL", "X-Purge-Email");
-define("DESTINATION", "Destination");
-define("ETAG_HEADER", "ETag");
-define("LAST_MODIFIED_HEADER", "Last-Modified");
-define("CONTENT_TYPE_HEADER", "Content-Type");
-define("CONTENT_LENGTH_HEADER", "Content-Length");
-define("USER_AGENT_HEADER", "User-Agent");
-
-/**
- * HTTP/cURL wrapper for Cloud Files
- *
- * This class should not be used directly. It's only purpose is to abstract
- * out the HTTP communication from the main API.
- *
- * @package php-cloudfiles-http
- */
-class CF_Http
-{
- private $error_str;
- private $dbug;
- private $cabundle_path;
- private $api_version;
-
- # Authentication instance variables
- #
- private $storage_url;
- private $cdnm_url;
- private $auth_token;
-
- # Request/response variables
- #
- private $response_status;
- private $response_reason;
- private $connections;
-
- # Variables used for content/header callbacks
- #
- private $_user_read_progress_callback_func;
- private $_user_write_progress_callback_func;
- private $_write_callback_type;
- private $_text_list;
- private $_account_container_count;
- private $_account_bytes_used;
- private $_container_object_count;
- private $_container_bytes_used;
- private $_obj_etag;
- private $_obj_last_modified;
- private $_obj_content_type;
- private $_obj_content_length;
- private $_obj_metadata;
- private $_obj_headers;
- private $_obj_manifest;
- private $_obj_write_resource;
- private $_obj_write_string;
- private $_cdn_enabled;
- private $_cdn_ssl_uri;
- private $_cdn_streaming_uri;
- private $_cdn_uri;
- private $_cdn_ttl;
- private $_cdn_log_retention;
- private $_cdn_acl_user_agent;
- private $_cdn_acl_referrer;
-
- function __construct($api_version)
- {
- $this->dbug = False;
- $this->cabundle_path = NULL;
- $this->api_version = $api_version;
- $this->error_str = NULL;
-
- $this->storage_url = NULL;
- $this->cdnm_url = NULL;
- $this->auth_token = NULL;
-
- $this->response_status = NULL;
- $this->response_reason = NULL;
-
- # Curl connections array - since there is no way to "re-set" the
- # connection paramaters for a cURL handle, we keep an array of
- # the unique use-cases and funnel all of those same type
- # requests through the appropriate curl connection.
- #
- $this->connections = array(
- "GET_CALL" => NULL, # GET objects/containers/lists
- "PUT_OBJ" => NULL, # PUT object
- "HEAD" => NULL, # HEAD requests
- "PUT_CONT" => NULL, # PUT container
- "DEL_POST" => NULL, # DELETE containers/objects, POST objects
- "COPY" => null, # COPY objects
- );
-
- $this->_user_read_progress_callback_func = NULL;
- $this->_user_write_progress_callback_func = NULL;
- $this->_write_callback_type = NULL;
- $this->_text_list = array();
- $this->_return_list = NULL;
- $this->_account_container_count = 0;
- $this->_account_bytes_used = 0;
- $this->_container_object_count = 0;
- $this->_container_bytes_used = 0;
- $this->_obj_write_resource = NULL;
- $this->_obj_write_string = "";
- $this->_obj_etag = NULL;
- $this->_obj_last_modified = NULL;
- $this->_obj_content_type = NULL;
- $this->_obj_content_length = NULL;
- $this->_obj_metadata = array();
- $this->_obj_manifest = NULL;
- $this->_obj_headers = NULL;
- $this->_cdn_enabled = NULL;
- $this->_cdn_ssl_uri = NULL;
- $this->_cdn_streaming_uri = NULL;
- $this->_cdn_uri = NULL;
- $this->_cdn_ttl = NULL;
- $this->_cdn_log_retention = NULL;
- $this->_cdn_acl_user_agent = NULL;
- $this->_cdn_acl_referrer = NULL;
-
- # The OS list with a PHP without an updated CA File for CURL to
- # connect to SSL Websites. It is the first 3 letters of the PHP_OS
- # variable.
- $OS_CAFILE_NONUPDATED=array(
- "win","dar"
- );
-
- if (in_array((strtolower (substr(PHP_OS, 0,3))), $OS_CAFILE_NONUPDATED))
- $this->ssl_use_cabundle();
-
- }
-
- function ssl_use_cabundle($path=NULL)
- {
- if ($path) {
- $this->cabundle_path = $path;
- } else {
- $this->cabundle_path = dirname(__FILE__) . "/share/cacert.pem";
- }
- if (!file_exists($this->cabundle_path)) {
- throw new IOException("Could not use CA bundle: "
- . $this->cabundle_path);
- }
- return;
- }
-
- # Uses separate cURL connection to authenticate
- #
- function authenticate($user, $pass, $acct=NULL, $host=NULL)
- {
- $path = array();
- if (isset($acct)){
- $headers = array(
- sprintf("%s: %s", AUTH_USER_HEADER_LEGACY, $user),
- sprintf("%s: %s", AUTH_KEY_HEADER_LEGACY, $pass),
- );
- $path[] = $host;
- $path[] = rawurlencode(sprintf("v%d",$this->api_version));
- $path[] = rawurlencode($acct);
- } else {
- $headers = array(
- sprintf("%s: %s", AUTH_USER_HEADER, $user),
- sprintf("%s: %s", AUTH_KEY_HEADER, $pass),
- );
- $path[] = $host;
- }
- $path[] = "v1.0";
- $url = implode("/", $path);
-
- $curl_ch = curl_init();
- if (!is_null($this->cabundle_path)) {
- curl_setopt($curl_ch, CURLOPT_SSL_VERIFYPEER, True);
- curl_setopt($curl_ch, CURLOPT_CAINFO, $this->cabundle_path);
- }
- curl_setopt($curl_ch, CURLOPT_VERBOSE, $this->dbug);
- curl_setopt($curl_ch, CURLOPT_FOLLOWLOCATION, 1);
- curl_setopt($curl_ch, CURLOPT_MAXREDIRS, 4);
- curl_setopt($curl_ch, CURLOPT_HEADER, 0);
- curl_setopt($curl_ch, CURLOPT_HTTPHEADER, $headers);
- curl_setopt($curl_ch, CURLOPT_USERAGENT, USER_AGENT);
- curl_setopt($curl_ch, CURLOPT_RETURNTRANSFER, TRUE);
- curl_setopt($curl_ch, CURLOPT_HEADERFUNCTION,array(&$this,'_auth_hdr_cb'));
- curl_setopt($curl_ch, CURLOPT_CONNECTTIMEOUT, 10);
- curl_setopt($curl_ch, CURLOPT_URL, $url);
- curl_exec($curl_ch);
- curl_close($curl_ch);
-
- return array($this->response_status, $this->response_reason,
- $this->storage_url, $this->cdnm_url, $this->auth_token);
- }
-
- # (CDN) GET /v1/Account
- #
- function list_cdn_containers($enabled_only)
- {
- $conn_type = "GET_CALL";
- $url_path = $this->_make_path("CDN");
-
- $this->_write_callback_type = "TEXT_LIST";
- if ($enabled_only)
- {
- $return_code = $this->_send_request($conn_type, $url_path .
- '/?enabled_only=true');
- }
- else
- {
- $return_code = $this->_send_request($conn_type, $url_path);
- }
- if (!$return_code) {
- $this->error_str .= ": Failed to obtain valid HTTP response.";
- return array(0,$this->error_str,array());
- }
- if ($return_code == 401) {
- return array($return_code,"Unauthorized",array());
- }
- if ($return_code == 404) {
- return array($return_code,"Account not found.",array());
- }
- if ($return_code == 204) {
- return array($return_code,"Account has no CDN enabled Containers.",
- array());
- }
- if ($return_code == 200) {
- $this->create_array();
- return array($return_code,$this->response_reason,$this->_text_list);
- }
- $this->error_str = "Unexpected HTTP response: ".$this->response_reason;
- return array($return_code,$this->error_str,array());
- }
-
- # (CDN) DELETE /v1/Account/Container or /v1/Account/Container/Object
- #
- function purge_from_cdn($path, $email=null)
- {
- if(!$path)
- throw new SyntaxException("Path not set");
- $url_path = $this->_make_path("CDN", NULL, $path);
- if($email)
- {
- $hdrs = array(CDN_EMAIL => $email);
- $return_code = $this->_send_request("DEL_POST",$url_path,$hdrs,"DELETE");
- }
- else
- $return_code = $this->_send_request("DEL_POST",$url_path,null,"DELETE");
- return $return_code;
- }
-
- # (CDN) POST /v1/Account/Container
- function update_cdn_container($container_name, $ttl=86400, $cdn_log_retention=False,
- $cdn_acl_user_agent="", $cdn_acl_referrer)
- {
- if ($container_name == "")
- throw new SyntaxException("Container name not set.");
-
- if ($container_name != "0" and !isset($container_name))
- throw new SyntaxException("Container name not set.");
-
- $url_path = $this->_make_path("CDN", $container_name);
- $hdrs = array(
- CDN_ENABLED => "True",
- CDN_TTL => $ttl,
- CDN_LOG_RETENTION => $cdn_log_retention ? "True" : "False",
- CDN_ACL_USER_AGENT => $cdn_acl_user_agent,
- CDN_ACL_REFERRER => $cdn_acl_referrer,
- );
- $return_code = $this->_send_request("DEL_POST",$url_path,$hdrs,"POST");
- if ($return_code == 401) {
- $this->error_str = "Unauthorized";
- return array($return_code, $this->error_str, NULL);
- }
- if ($return_code == 404) {
- $this->error_str = "Container not found.";
- return array($return_code, $this->error_str, NULL);
- }
- if ($return_code != 202) {
- $this->error_str="Unexpected HTTP response: ".$this->response_reason;
- return array($return_code, $this->error_str, NULL);
- }
- return array($return_code, "Accepted", $this->_cdn_uri, $this->_cdn_ssl_uri);
-
- }
-
- # (CDN) PUT /v1/Account/Container
- #
- function add_cdn_container($container_name, $ttl=86400)
- {
- if ($container_name == "")
- throw new SyntaxException("Container name not set.");
-
- if ($container_name != "0" and !isset($container_name))
- throw new SyntaxException("Container name not set.");
-
- $url_path = $this->_make_path("CDN", $container_name);
- $hdrs = array(
- CDN_ENABLED => "True",
- CDN_TTL => $ttl,
- );
- $return_code = $this->_send_request("PUT_CONT", $url_path, $hdrs);
- if ($return_code == 401) {
- $this->error_str = "Unauthorized";
- return array($return_code,$this->response_reason,False);
- }
- if (!in_array($return_code, array(201,202))) {
- $this->error_str="Unexpected HTTP response: ".$this->response_reason;
- return array($return_code,$this->response_reason,False);
- }
- return array($return_code,$this->response_reason,$this->_cdn_uri,
- $this->_cdn_ssl_uri);
- }
-
- # (CDN) POST /v1/Account/Container
- #
- function remove_cdn_container($container_name)
- {
- if ($container_name == "")
- throw new SyntaxException("Container name not set.");
-
- if ($container_name != "0" and !isset($container_name))
- throw new SyntaxException("Container name not set.");
-
- $url_path = $this->_make_path("CDN", $container_name);
- $hdrs = array(CDN_ENABLED => "False");
- $return_code = $this->_send_request("DEL_POST",$url_path,$hdrs,"POST");
- if ($return_code == 401) {
- $this->error_str = "Unauthorized";
- return array($return_code, $this->error_str);
- }
- if ($return_code == 404) {
- $this->error_str = "Container not found.";
- return array($return_code, $this->error_str);
- }
- if ($return_code != 202) {
- $this->error_str="Unexpected HTTP response: ".$this->response_reason;
- return array($return_code, $this->error_str);
- }
- return array($return_code, "Accepted");
- }
-
- # (CDN) HEAD /v1/Account
- #
- function head_cdn_container($container_name)
- {
- if ($container_name == "")
- throw new SyntaxException("Container name not set.");
-
- if ($container_name != "0" and !isset($container_name))
- throw new SyntaxException("Container name not set.");
-
- $conn_type = "HEAD";
- $url_path = $this->_make_path("CDN", $container_name);
- $return_code = $this->_send_request($conn_type, $url_path, NULL, "GET", True);
-
- if (!$return_code) {
- $this->error_str .= ": Failed to obtain valid HTTP response.";
- return array(0,$this->error_str,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
- }
- if ($return_code == 401) {
- return array($return_code,"Unauthorized",NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
- }
- if ($return_code == 404) {
- return array($return_code,"Account not found.",NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
- }
- if ($return_code == 204) {
- return array($return_code,$this->response_reason,
- $this->_cdn_enabled, $this->_cdn_ssl_uri,
- $this->_cdn_streaming_uri,
- $this->_cdn_uri, $this->_cdn_ttl,
- $this->_cdn_log_retention,
- $this->_cdn_acl_user_agent,
- $this->_cdn_acl_referrer
- );
- }
- return array($return_code,$this->response_reason,
- NULL,NULL,NULL,NULL,
- $this->_cdn_log_retention,
- $this->_cdn_acl_user_agent,
- $this->_cdn_acl_referrer,
- NULL
- );
- }
-
- # GET /v1/Account
- #
- function list_containers($limit=0, $marker=NULL)
- {
- $conn_type = "GET_CALL";
- $url_path = $this->_make_path();
-
- $limit = intval($limit);
- $params = array();
- if ($limit > 0) {
- $params[] = "limit=$limit";
- }
- if ($marker) {
- $params[] = "marker=".rawurlencode($marker);
- }
- if (!empty($params)) {
- $url_path .= "?" . implode("&", $params);
- }
-
- $this->_write_callback_type = "TEXT_LIST";
- $return_code = $this->_send_request($conn_type, $url_path);
-
- if (!$return_code) {
- $this->error_str .= ": Failed to obtain valid HTTP response.";
- return array(0,$this->error_str,array());
- }
- if ($return_code == 204) {
- return array($return_code, "Account has no containers.", array());
- }
- if ($return_code == 404) {
- $this->error_str = "Invalid account name for authentication token.";
- return array($return_code,$this->error_str,array());
- }
- if ($return_code == 200) {
- $this->create_array();
- return array($return_code, $this->response_reason, $this->_text_list);
- }
- $this->error_str = "Unexpected HTTP response: ".$this->response_reason;
- return array($return_code,$this->error_str,array());
- }
-
- # GET /v1/Account?format=json
- #
- function list_containers_info($limit=0, $marker=NULL)
- {
- $conn_type = "GET_CALL";
- $url_path = $this->_make_path() . "?format=json";
-
- $limit = intval($limit);
- $params = array();
- if ($limit > 0) {
- $params[] = "limit=$limit";
- }
- if ($marker) {
- $params[] = "marker=".rawurlencode($marker);
- }
- if (!empty($params)) {
- $url_path .= "&" . implode("&", $params);
- }
-
- $this->_write_callback_type = "OBJECT_STRING";
- $return_code = $this->_send_request($conn_type, $url_path);
-
- if (!$return_code) {
- $this->error_str .= ": Failed to obtain valid HTTP response.";
- return array(0,$this->error_str,array());
- }
- if ($return_code == 204) {
- return array($return_code, "Account has no containers.", array());
- }
- if ($return_code == 404) {
- $this->error_str = "Invalid account name for authentication token.";
- return array($return_code,$this->error_str,array());
- }
- if ($return_code == 200) {
- $json_body = json_decode($this->_obj_write_string, True);
- return array($return_code, $this->response_reason, $json_body);
- }
- $this->error_str = "Unexpected HTTP response: ".$this->response_reason;
- return array($return_code,$this->error_str,array());
- }
-
- # HEAD /v1/Account
- #
- function head_account()
- {
- $conn_type = "HEAD";
-
- $url_path = $this->_make_path();
- $return_code = $this->_send_request($conn_type,$url_path);
-
- if (!$return_code) {
- $this->error_str .= ": Failed to obtain valid HTTP response.";
- return array(0,$this->error_str,0,0);
- }
- if ($return_code == 404) {
- return array($return_code,"Account not found.",0,0);
- }
- if ($return_code == 204) {
- return array($return_code,$this->response_reason,
- $this->_account_container_count, $this->_account_bytes_used);
- }
- return array($return_code,$this->response_reason,0,0);
- }
-
- # PUT /v1/Account/Container
- #
- function create_container($container_name)
- {
- if ($container_name == "")
- throw new SyntaxException("Container name not set.");
-
- if ($container_name != "0" and !isset($container_name))
- throw new SyntaxException("Container name not set.");
-
- $url_path = $this->_make_path("STORAGE", $container_name);
- $return_code = $this->_send_request("PUT_CONT",$url_path);
-
- if (!$return_code) {
- $this->error_str .= ": Failed to obtain valid HTTP response.";
- return False;
- }
- return $return_code;
- }
-
- # DELETE /v1/Account/Container
- #
- function delete_container($container_name)
- {
- if ($container_name == "")
- throw new SyntaxException("Container name not set.");
-
- if ($container_name != "0" and !isset($container_name))
- throw new SyntaxException("Container name not set.");
-
- $url_path = $this->_make_path("STORAGE", $container_name);
- $return_code = $this->_send_request("DEL_POST",$url_path,array(),"DELETE");
-
- switch ($return_code) {
- case 204:
- break;
- case 0:
- $this->error_str .= ": Failed to obtain valid HTTP response.";;
- break;
- case 409:
- $this->error_str = "Container must be empty prior to removing it.";
- break;
- case 404:
- $this->error_str = "Specified container did not exist to delete.";
- break;
- default:
- $this->error_str = "Unexpected HTTP return code: $return_code.";
- }
- return $return_code;
- }
-
- # GET /v1/Account/Container
- #
- function list_objects($cname,$limit=0,$marker=NULL,$prefix=NULL,$path=NULL)
- {
- if (!$cname) {
- $this->error_str = "Container name not set.";
- return array(0, $this->error_str, array());
- }
-
- $url_path = $this->_make_path("STORAGE", $cname);
-
- $limit = intval($limit);
- $params = array();
- if ($limit > 0) {
- $params[] = "limit=$limit";
- }
- if ($marker) {
- $params[] = "marker=".rawurlencode($marker);
- }
- if ($prefix) {
- $params[] = "prefix=".rawurlencode($prefix);
- }
- if ($path) {
- $params[] = "path=".rawurlencode($path);
- }
- if (!empty($params)) {
- $url_path .= "?" . implode("&", $params);
- }
-
- $conn_type = "GET_CALL";
- $this->_write_callback_type = "TEXT_LIST";
- $return_code = $this->_send_request($conn_type,$url_path);
-
- if (!$return_code) {
- $this->error_str .= ": Failed to obtain valid HTTP response.";
- return array(0,$this->error_str,array());
- }
- if ($return_code == 204) {
- $this->error_str = "Container has no Objects.";
- return array($return_code,$this->error_str,array());
- }
- if ($return_code == 404) {
- $this->error_str = "Container has no Objects.";
- return array($return_code,$this->error_str,array());
- }
- if ($return_code == 200) {
- $this->create_array();
- return array($return_code,$this->response_reason, $this->_text_list);
- }
- $this->error_str = "Unexpected HTTP response code: $return_code";
- return array(0,$this->error_str,array());
- }
-
- # GET /v1/Account/Container?format=json
- #
- function get_objects($cname,$limit=0,$marker=NULL,$prefix=NULL,$path=NULL)
- {
- if (!$cname) {
- $this->error_str = "Container name not set.";
- return array(0, $this->error_str, array());
- }
-
- $url_path = $this->_make_path("STORAGE", $cname);
-
- $limit = intval($limit);
- $params = array();
- $params[] = "format=json";
- if ($limit > 0) {
- $params[] = "limit=$limit";
- }
- if ($marker) {
- $params[] = "marker=".rawurlencode($marker);
- }
- if ($prefix) {
- $params[] = "prefix=".rawurlencode($prefix);
- }
- if ($path) {
- $params[] = "path=".rawurlencode($path);
- }
- if (!empty($params)) {
- $url_path .= "?" . implode("&", $params);
- }
-
- $conn_type = "GET_CALL";
- $this->_write_callback_type = "OBJECT_STRING";
- $return_code = $this->_send_request($conn_type,$url_path);
-
- if (!$return_code) {
- $this->error_str .= ": Failed to obtain valid HTTP response.";
- return array(0,$this->error_str,array());
- }
- if ($return_code == 204) {
- $this->error_str = "Container has no Objects.";
- return array($return_code,$this->error_str,array());
- }
- if ($return_code == 404) {
- $this->error_str = "Container has no Objects.";
- return array($return_code,$this->error_str,array());
- }
- if ($return_code == 200) {
- $json_body = json_decode($this->_obj_write_string, True);
- return array($return_code,$this->response_reason, $json_body);
- }
- $this->error_str = "Unexpected HTTP response code: $return_code";
- return array(0,$this->error_str,array());
- }
-
-
- # HEAD /v1/Account/Container
- #
- function head_container($container_name)
- {
-
- if ($container_name == "") {
- $this->error_str = "Container name not set.";
- return False;
- }
-
- if ($container_name != "0" and !isset($container_name)) {
- $this->error_str = "Container name not set.";
- return False;
- }
-
- $conn_type = "HEAD";
-
- $url_path = $this->_make_path("STORAGE", $container_name);
- $return_code = $this->_send_request($conn_type,$url_path);
-
- if (!$return_code) {
- $this->error_str .= ": Failed to obtain valid HTTP response.";
- return array(0,$this->error_str,0,0);
- }
- if ($return_code == 404) {
- return array($return_code,"Container not found.",0,0);
- }
- if ($return_code == 204 || $return_code == 200) {
- return array($return_code,$this->response_reason,
- $this->_container_object_count, $this->_container_bytes_used);
- }
- return array($return_code,$this->response_reason,0,0);
- }
-
- # GET /v1/Account/Container/Object
- #
- function get_object_to_string(&$obj, $hdrs=array())
- {
- if (!is_object($obj) || get_class($obj) != "CF_Object") {
- throw new SyntaxException(
- "Method argument is not a valid CF_Object.");
- }
-
- $conn_type = "GET_CALL";
-
- $url_path = $this->_make_path("STORAGE", $obj->container->name,$obj->name);
- $this->_write_callback_type = "OBJECT_STRING";
- $return_code = $this->_send_request($conn_type,$url_path,$hdrs);
-
- if (!$return_code) {
- $this->error_str .= ": Failed to obtain valid HTTP response.";
- return array($return_code0,$this->error_str,NULL);
- }
- if ($return_code == 404) {
- $this->error_str = "Object not found.";
- return array($return_code0,$this->error_str,NULL);
- }
- if (($return_code < 200) || ($return_code > 299
- && $return_code != 412 && $return_code != 304)) {
- $this->error_str = "Unexpected HTTP return code: $return_code";
- return array($return_code,$this->error_str,NULL);
- }
- return array($return_code,$this->response_reason, $this->_obj_write_string);
- }
-
- # GET /v1/Account/Container/Object
- #
- function get_object_to_stream(&$obj, &$resource=NULL, $hdrs=array())
- {
- if (!is_object($obj) || get_class($obj) != "CF_Object") {
- throw new SyntaxException(
- "Method argument is not a valid CF_Object.");
- }
- if (!is_resource($resource)) {
- throw new SyntaxException(
- "Resource argument not a valid PHP resource.");
- }
-
- $conn_type = "GET_CALL";
-
- $url_path = $this->_make_path("STORAGE", $obj->container->name,$obj->name);
- $this->_obj_write_resource = $resource;
- $this->_write_callback_type = "OBJECT_STREAM";
- $return_code = $this->_send_request($conn_type,$url_path,$hdrs);
-
- if (!$return_code) {
- $this->error_str .= ": Failed to obtain valid HTTP response.";
- return array($return_code,$this->error_str);
- }
- if ($return_code == 404) {
- $this->error_str = "Object not found.";
- return array($return_code,$this->error_str);
- }
- if (($return_code < 200) || ($return_code > 299
- && $return_code != 412 && $return_code != 304)) {
- $this->error_str = "Unexpected HTTP return code: $return_code";
- return array($return_code,$this->error_str);
- }
- return array($return_code,$this->response_reason);
- }
-
- # PUT /v1/Account/Container/Object
- #
- function put_object(&$obj, &$fp)
- {
- if (!is_object($obj) || get_class($obj) != "CF_Object") {
- throw new SyntaxException(
- "Method argument is not a valid CF_Object.");
- }
- if (!is_resource($fp)) {
- throw new SyntaxException(
- "File pointer argument is not a valid resource.");
- }
-
- $conn_type = "PUT_OBJ";
- $url_path = $this->_make_path("STORAGE", $obj->container->name,$obj->name);
-
- $hdrs = $this->_headers($obj);
-
- $etag = $obj->getETag();
- if (isset($etag)) {
- $hdrs[] = "ETag: " . $etag;
- }
- if (!$obj->content_type) {
- $hdrs[] = "Content-Type: application/octet-stream";
- } else {
- $hdrs[] = "Content-Type: " . $obj->content_type;
- }
-
- $this->_init($conn_type);
- curl_setopt($this->connections[$conn_type],
- CURLOPT_INFILE, $fp);
- if (!$obj->content_length) {
- # We don''t know the Content-Length, so assumed "chunked" PUT
- #
- curl_setopt($this->connections[$conn_type], CURLOPT_UPLOAD, True);
- $hdrs[] = 'Transfer-Encoding: chunked';
- } else {
- # We know the Content-Length, so use regular transfer
- #
- curl_setopt($this->connections[$conn_type],
- CURLOPT_INFILESIZE, $obj->content_length);
- }
- $return_code = $this->_send_request($conn_type,$url_path,$hdrs);
-
- if (!$return_code) {
- $this->error_str .= ": Failed to obtain valid HTTP response.";
- return array(0,$this->error_str,NULL);
- }
- if ($return_code == 412) {
- $this->error_str = "Missing Content-Type header";
- return array($return_code,$this->error_str,NULL);
- }
- if ($return_code == 422) {
- $this->error_str = "Derived and computed checksums do not match.";
- return array($return_code,$this->error_str,NULL);
- }
- if ($return_code != 201) {
- $this->error_str = "Unexpected HTTP return code: $return_code";
- return array($return_code,$this->error_str,NULL);
- }
- return array($return_code,$this->response_reason,$this->_obj_etag);
- }
-
- # POST /v1/Account/Container/Object
- #
- function update_object(&$obj)
- {
- if (!is_object($obj) || get_class($obj) != "CF_Object") {
- throw new SyntaxException(
- "Method argument is not a valid CF_Object.");
- }
-
- # TODO: The is_array check isn't in sync with the error message
- if (!$obj->manifest && !(is_array($obj->metadata) || is_array($obj->headers))) {
- $this->error_str = "Metadata and headers arrays are empty.";
- return 0;
- }
-
- $url_path = $this->_make_path("STORAGE", $obj->container->name,$obj->name);
-
- $hdrs = $this->_headers($obj);
- $return_code = $this->_send_request("DEL_POST",$url_path,$hdrs,"POST");
- switch ($return_code) {
- case 202:
- break;
- case 0:
- $this->error_str .= ": Failed to obtain valid HTTP response.";
- $return_code = 0;
- break;
- case 404:
- $this->error_str = "Account, Container, or Object not found.";
- break;
- default:
- $this->error_str = "Unexpected HTTP return code: $return_code";
- break;
- }
- return $return_code;
- }
-
- # HEAD /v1/Account/Container/Object
- #
- function head_object(&$obj)
- {
- if (!is_object($obj) || get_class($obj) != "CF_Object") {
- throw new SyntaxException(
- "Method argument is not a valid CF_Object.");
- }
-
- $conn_type = "HEAD";
-
- $url_path = $this->_make_path("STORAGE", $obj->container->name,$obj->name);
- $return_code = $this->_send_request($conn_type,$url_path);
-
- if (!$return_code) {
- $this->error_str .= ": Failed to obtain valid HTTP response.";
- return array(0, $this->error_str." ".$this->response_reason,
- NULL, NULL, NULL, NULL, array(), NULL, array());
- }
-
- if ($return_code == 404) {
- return array($return_code, $this->response_reason,
- NULL, NULL, NULL, NULL, array(), NULL, array());
- }
- if ($return_code == 204 || $return_code == 200) {
- return array($return_code,$this->response_reason,
- $this->_obj_etag,
- $this->_obj_last_modified,
- $this->_obj_content_type,
- $this->_obj_content_length,
- $this->_obj_metadata,
- $this->_obj_manifest,
- $this->_obj_headers);
- }
- $this->error_str = "Unexpected HTTP return code: $return_code";
- return array($return_code, $this->error_str." ".$this->response_reason,
- NULL, NULL, NULL, NULL, array(), NULL, array());
- }
-
- # COPY /v1/Account/Container/Object
- #
- function copy_object($src_obj_name, $dest_obj_name, $container_name_source, $container_name_target, $metadata=NULL, $headers=NULL)
- {
- if (!$src_obj_name) {
- $this->error_str = "Object name not set.";
- return 0;
- }
-
- if ($container_name_source == "") {
- $this->error_str = "Container name source not set.";
- return 0;
- }
-
- if ($container_name_source != "0" and !isset($container_name_source)) {
- $this->error_str = "Container name source not set.";
- return 0;
- }
-
- if ($container_name_target == "") {
- $this->error_str = "Container name target not set.";
- return 0;
- }
-
- if ($container_name_target != "0" and !isset($container_name_target)) {
- $this->error_str = "Container name target not set.";
- return 0;
- }
-
- $conn_type = "COPY";
-
- $url_path = $this->_make_path("STORAGE", $container_name_source, rawurlencode($src_obj_name));
- $destination = rawurlencode($container_name_target."/".$dest_obj_name);
-
- $hdrs = self::_process_headers($metadata, $headers);
- $hdrs[DESTINATION] = $destination;
-
- $return_code = $this->_send_request($conn_type,$url_path,$hdrs,"COPY");
- switch ($return_code) {
- case 201:
- break;
- case 0:
- $this->error_str .= ": Failed to obtain valid HTTP response.";
- $return_code = 0;
- break;
- case 404:
- $this->error_str = "Specified container/object did not exist.";
- break;
- default:
- $this->error_str = "Unexpected HTTP return code: $return_code.";
- }
- return $return_code;
- }
-
- # DELETE /v1/Account/Container/Object
- #
- function delete_object($container_name, $object_name)
- {
- if ($container_name == "") {
- $this->error_str = "Container name not set.";
- return 0;
- }
-
- if ($container_name != "0" and !isset($container_name)) {
- $this->error_str = "Container name not set.";
- return 0;
- }
-
- if (!$object_name) {
- $this->error_str = "Object name not set.";
- return 0;
- }
-
- $url_path = $this->_make_path("STORAGE", $container_name,$object_name);
- $return_code = $this->_send_request("DEL_POST",$url_path,NULL,"DELETE");
- switch ($return_code) {
- case 204:
- break;
- case 0:
- $this->error_str .= ": Failed to obtain valid HTTP response.";
- $return_code = 0;
- break;
- case 404:
- $this->error_str = "Specified container did not exist to delete.";
- break;
- default:
- $this->error_str = "Unexpected HTTP return code: $return_code.";
- }
- return $return_code;
- }
-
- function get_error()
- {
- return $this->error_str;
- }
-
- function setDebug($bool)
- {
- $this->dbug = $bool;
- foreach ($this->connections as $k => $v) {
- if (!is_null($v)) {
- curl_setopt($this->connections[$k], CURLOPT_VERBOSE, $this->dbug);
- }
- }
- }
-
- function getCDNMUrl()
- {
- return $this->cdnm_url;
- }
-
- function getStorageUrl()
- {
- return $this->storage_url;
- }
-
- function getAuthToken()
- {
- return $this->auth_token;
- }
-
- function setCFAuth($cfs_auth, $servicenet=False)
- {
- if ($servicenet) {
- $this->storage_url = "https://snet-" . substr($cfs_auth->storage_url, 8);
- } else {
- $this->storage_url = $cfs_auth->storage_url;
- }
- $this->auth_token = $cfs_auth->auth_token;
- $this->cdnm_url = $cfs_auth->cdnm_url;
- }
-
- function setReadProgressFunc($func_name)
- {
- $this->_user_read_progress_callback_func = $func_name;
- }
-
- function setWriteProgressFunc($func_name)
- {
- $this->_user_write_progress_callback_func = $func_name;
- }
-
- private function _header_cb($ch, $header)
- {
- $header_len = strlen($header);
-
- if (preg_match("/^(HTTP\/1\.[01]) (\d{3}) (.*)/", $header, $matches)) {
- $this->response_status = $matches[2];
- $this->response_reason = $matches[3];
- return $header_len;
- }
-
- if (strpos($header, ":") === False)
- return $header_len;
- list($name, $value) = explode(":", $header, 2);
- $value = trim($value);
-
- switch (strtolower($name)) {
- case strtolower(CDN_ENABLED):
- $this->_cdn_enabled = strtolower($value) == "true";
- break;
- case strtolower(CDN_URI):
- $this->_cdn_uri = $value;
- break;
- case strtolower(CDN_SSL_URI):
- $this->_cdn_ssl_uri = $value;
- break;
- case strtolower(CDN_STREAMING_URI):
- $this->_cdn_streaming_uri = $value;
- break;
- case strtolower(CDN_TTL):
- $this->_cdn_ttl = $value;
- break;
- case strtolower(MANIFEST_HEADER):
- $this->_obj_manifest = $value;
- break;
- case strtolower(CDN_LOG_RETENTION):
- $this->_cdn_log_retention = strtolower($value) == "true";
- break;
- case strtolower(CDN_ACL_USER_AGENT):
- $this->_cdn_acl_user_agent = $value;
- break;
- case strtolower(CDN_ACL_REFERRER):
- $this->_cdn_acl_referrer = $value;
- break;
- case strtolower(ACCOUNT_CONTAINER_COUNT):
- $this->_account_container_count = (float)$value+0;
- break;
- case strtolower(ACCOUNT_BYTES_USED):
- $this->_account_bytes_used = (float)$value+0;
- break;
- case strtolower(CONTAINER_OBJ_COUNT):
- $this->_container_object_count = (float)$value+0;
- break;
- case strtolower(CONTAINER_BYTES_USED):
- $this->_container_bytes_used = (float)$value+0;
- break;
- case strtolower(ETAG_HEADER):
- $this->_obj_etag = $value;
- break;
- case strtolower(LAST_MODIFIED_HEADER):
- $this->_obj_last_modified = $value;
- break;
- case strtolower(CONTENT_TYPE_HEADER):
- $this->_obj_content_type = $value;
- break;
- case strtolower(CONTENT_LENGTH_HEADER):
- $this->_obj_content_length = (float)$value+0;
- break;
- case strtolower(ORIGIN_HEADER):
- $this->_obj_headers[ORIGIN_HEADER] = $value;
- break;
- default:
- if (strncasecmp($name, METADATA_HEADER_PREFIX, strlen(METADATA_HEADER_PREFIX)) == 0) {
- $name = substr($name, strlen(METADATA_HEADER_PREFIX));
- $this->_obj_metadata[$name] = $value;
- }
- elseif ((strncasecmp($name, CONTENT_HEADER_PREFIX, strlen(CONTENT_HEADER_PREFIX)) == 0) ||
- (strncasecmp($name, ACCESS_CONTROL_HEADER_PREFIX, strlen(ACCESS_CONTROL_HEADER_PREFIX)) == 0)) {
- $this->_obj_headers[$name] = $value;
- }
- }
- return $header_len;
- }
-
- private function _read_cb($ch, $fd, $length)
- {
- $data = fread($fd, $length);
- $len = strlen($data);
- if (isset($this->_user_write_progress_callback_func)) {
- call_user_func($this->_user_write_progress_callback_func, $len);
- }
- return $data;
- }
-
- private function _write_cb($ch, $data)
- {
- $dlen = strlen($data);
- switch ($this->_write_callback_type) {
- case "TEXT_LIST":
- $this->_return_list = $this->_return_list . $data;
- //= explode("\n",$data); # keep tab,space
- //his->_text_list[] = rtrim($data,"\n\r\x0B"); # keep tab,space
- break;
- case "OBJECT_STREAM":
- fwrite($this->_obj_write_resource, $data, $dlen);
- break;
- case "OBJECT_STRING":
- $this->_obj_write_string .= $data;
- break;
- }
- if (isset($this->_user_read_progress_callback_func)) {
- call_user_func($this->_user_read_progress_callback_func, $dlen);
- }
- return $dlen;
- }
-
- private function _auth_hdr_cb($ch, $header)
- {
- preg_match("/^HTTP\/1\.[01] (\d{3}) (.*)/", $header, $matches);
- if (isset($matches[1])) {
- $this->response_status = $matches[1];
- }
- if (isset($matches[2])) {
- $this->response_reason = $matches[2];
- }
- if (stripos($header, STORAGE_URL) === 0) {
- $this->storage_url = trim(substr($header, strlen(STORAGE_URL)+1));
- }
- if (stripos($header, CDNM_URL) === 0) {
- $this->cdnm_url = trim(substr($header, strlen(CDNM_URL)+1));
- }
- if (stripos($header, AUTH_TOKEN) === 0) {
- $this->auth_token = trim(substr($header, strlen(AUTH_TOKEN)+1));
- }
- if (stripos($header, AUTH_TOKEN_LEGACY) === 0) {
- $this->auth_token = trim(substr($header,strlen(AUTH_TOKEN_LEGACY)+1));
- }
- return strlen($header);
- }
-
- private function _make_headers($hdrs=NULL)
- {
- $new_headers = array();
- $has_stoken = False;
- $has_uagent = False;
- if (is_array($hdrs)) {
- foreach ($hdrs as $h => $v) {
- if (is_int($h)) {
- list($h, $v) = explode(":", $v, 2);
- }
-
- if (strncasecmp($h, AUTH_TOKEN, strlen(AUTH_TOKEN)) === 0) {
- $has_stoken = True;
- }
- if (strncasecmp($h, USER_AGENT_HEADER, strlen(USER_AGENT_HEADER)) === 0) {
- $has_uagent = True;
- }
- $new_headers[] = $h . ": " . trim($v);
- }
- }
- if (!$has_stoken) {
- $new_headers[] = AUTH_TOKEN . ": " . $this->auth_token;
- }
- if (!$has_uagent) {
- $new_headers[] = USER_AGENT_HEADER . ": " . USER_AGENT;
- }
- return $new_headers;
- }
-
- private function _init($conn_type, $force_new=False)
- {
- if (!array_key_exists($conn_type, $this->connections)) {
- $this->error_str = "Invalid CURL_XXX connection type";
- return False;
- }
-
- if (is_null($this->connections[$conn_type]) || $force_new) {
- $ch = curl_init();
- } else {
- return;
- }
-
- if ($this->dbug) { curl_setopt($ch, CURLOPT_VERBOSE, 1); }
-
- if (!is_null($this->cabundle_path)) {
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, True);
- curl_setopt($ch, CURLOPT_CAINFO, $this->cabundle_path);
- }
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, True);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
- curl_setopt($ch, CURLOPT_MAXREDIRS, 4);
- curl_setopt($ch, CURLOPT_HEADER, 0);
- curl_setopt($ch, CURLOPT_HEADERFUNCTION, array(&$this, '_header_cb'));
-
- if ($conn_type == "GET_CALL") {
- curl_setopt($ch, CURLOPT_WRITEFUNCTION, array(&$this, '_write_cb'));
- }
-
- if ($conn_type == "PUT_OBJ") {
- curl_setopt($ch, CURLOPT_PUT, 1);
- curl_setopt($ch, CURLOPT_READFUNCTION, array(&$this, '_read_cb'));
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- }
- if ($conn_type == "HEAD") {
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "HEAD");
- curl_setopt($ch, CURLOPT_NOBODY, 1);
- }
- if ($conn_type == "PUT_CONT") {
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
- curl_setopt($ch, CURLOPT_INFILESIZE, 0);
- curl_setopt($ch, CURLOPT_NOBODY, 1);
- }
- if ($conn_type == "DEL_POST") {
- curl_setopt($ch, CURLOPT_NOBODY, 1);
- }
- if ($conn_type == "COPY") {
- curl_setopt($ch, CURLOPT_NOBODY, 1);
- }
- $this->connections[$conn_type] = $ch;
- return;
- }
-
- private function _reset_callback_vars()
- {
- $this->_text_list = array();
- $this->_return_list = NULL;
- $this->_account_container_count = 0;
- $this->_account_bytes_used = 0;
- $this->_container_object_count = 0;
- $this->_container_bytes_used = 0;
- $this->_obj_etag = NULL;
- $this->_obj_last_modified = NULL;
- $this->_obj_content_type = NULL;
- $this->_obj_content_length = NULL;
- $this->_obj_metadata = array();
- $this->_obj_manifest = NULL;
- $this->_obj_headers = NULL;
- $this->_obj_write_string = "";
- $this->_cdn_streaming_uri = NULL;
- $this->_cdn_enabled = NULL;
- $this->_cdn_ssl_uri = NULL;
- $this->_cdn_uri = NULL;
- $this->_cdn_ttl = NULL;
- $this->response_status = 0;
- $this->response_reason = "";
- }
-
- private function _make_path($t="STORAGE",$c=NULL,$o=NULL)
- {
- $path = array();
- switch ($t) {
- case "STORAGE":
- $path[] = $this->storage_url; break;
- case "CDN":
- $path[] = $this->cdnm_url; break;
- }
- if ($c == "0")
- $path[] = rawurlencode($c);
-
- if ($c) {
- $path[] = rawurlencode($c);
- }
- if ($o) {
- # mimic Python''s urllib.quote() feature of a "safe" '/' character
- #
- $path[] = str_replace("%2F","/",rawurlencode($o));
- }
- return implode("/",$path);
- }
-
- private function _headers(&$obj)
- {
- $hdrs = self::_process_headers($obj->metadata, $obj->headers);
- if ($obj->manifest)
- $hdrs[MANIFEST_HEADER] = $obj->manifest;
-
- return $hdrs;
- }
-
- private function _process_headers($metadata=null, $headers=null)
- {
- $rules = array(
- array(
- 'prefix' => METADATA_HEADER_PREFIX,
- ),
- array(
- 'prefix' => '',
- 'filter' => array( # key order is important, first match decides
- CONTENT_TYPE_HEADER => false,
- CONTENT_LENGTH_HEADER => false,
- CONTENT_HEADER_PREFIX => true,
- ACCESS_CONTROL_HEADER_PREFIX => true,
- ORIGIN_HEADER => true,
- ),
- ),
- );
-
- $hdrs = array();
- $argc = func_num_args();
- $argv = func_get_args();
- for ($argi = 0; $argi < $argc; $argi++) {
- if(!is_array($argv[$argi])) continue;
-
- $rule = $rules[$argi];
- foreach ($argv[$argi] as $k => $v) {
- $k = trim($k);
- $v = trim($v);
- if (strpos($k, ":") !== False) throw new SyntaxException(
- "Header names cannot contain a ':' character.");
-
- if (array_key_exists('filter', $rule)) {
- $result = null;
- foreach ($rule['filter'] as $p => $f) {
- if (strncasecmp($k, $p, strlen($p)) == 0) {
- $result = $f;
- break;
- }
- }
- if (!$result) throw new SyntaxException(sprintf(
- "Header name %s is not allowed", $k));
- }
-
- $k = $rule['prefix'] . $k;
- if (strlen($k) > MAX_HEADER_NAME_LEN || strlen($v) > MAX_HEADER_VALUE_LEN)
- throw new SyntaxException(sprintf(
- "Header %s exceeds maximum length: %d/%d",
- $k, strlen($k), strlen($v)));
-
- $hdrs[$k] = $v;
- }
- }
-
- return $hdrs;
- }
-
- private function _send_request($conn_type, $url_path, $hdrs=NULL, $method="GET", $force_new=False)
- {
- $this->_init($conn_type, $force_new);
- $this->_reset_callback_vars();
- $headers = $this->_make_headers($hdrs);
-
- if (gettype($this->connections[$conn_type]) == "unknown type")
- throw new ConnectionNotOpenException (
- "Connection is not open."
- );
-
- switch ($method) {
- case "COPY":
- curl_setopt($this->connections[$conn_type],
- CURLOPT_CUSTOMREQUEST, "COPY");
- break;
- case "DELETE":
- curl_setopt($this->connections[$conn_type],
- CURLOPT_CUSTOMREQUEST, "DELETE");
- break;
- case "POST":
- curl_setopt($this->connections[$conn_type],
- CURLOPT_CUSTOMREQUEST, "POST");
- default:
- break;
- }
-
- curl_setopt($this->connections[$conn_type],
- CURLOPT_HTTPHEADER, $headers);
-
- curl_setopt($this->connections[$conn_type],
- CURLOPT_URL, $url_path);
-
- if (!curl_exec($this->connections[$conn_type]) && curl_errno($this->connections[$conn_type]) !== 0) {
- $this->error_str = "(curl error: "
- . curl_errno($this->connections[$conn_type]) . ") ";
- $this->error_str .= curl_error($this->connections[$conn_type]);
- return False;
- }
- return curl_getinfo($this->connections[$conn_type], CURLINFO_HTTP_CODE);
- }
-
- function close()
- {
- foreach ($this->connections as $cnx) {
- if (isset($cnx)) {
- curl_close($cnx);
- $this->connections[$cnx] = NULL;
- }
- }
- }
- private function create_array()
- {
- $this->_text_list = explode("\n",rtrim($this->_return_list,"\n\x0B"));
- return True;
- }
-
-}
-
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-?>
diff --git a/3rdparty/phpass/PasswordHash.php b/3rdparty/phpass/PasswordHash.php
deleted file mode 100644
index 84447b277df..00000000000
--- a/3rdparty/phpass/PasswordHash.php
+++ /dev/null
@@ -1,253 +0,0 @@
-<?php
-#
-# Portable PHP password hashing framework.
-#
-# Version 0.3 / genuine.
-#
-# Written by Solar Designer <solar at openwall.com> in 2004-2006 and placed in
-# the public domain. Revised in subsequent years, still public domain.
-#
-# There's absolutely no warranty.
-#
-# The homepage URL for this framework is:
-#
-# http://www.openwall.com/phpass/
-#
-# Please be sure to update the Version line if you edit this file in any way.
-# It is suggested that you leave the main version number intact, but indicate
-# your project name (after the slash) and add your own revision information.
-#
-# Please do not change the "private" password hashing method implemented in
-# here, thereby making your hashes incompatible. However, if you must, please
-# change the hash type identifier (the "$P$") to something different.
-#
-# Obviously, since this code is in the public domain, the above are not
-# requirements (there can be none), but merely suggestions.
-#
-class PasswordHash {
- var $itoa64;
- var $iteration_count_log2;
- var $portable_hashes;
- var $random_state;
-
- function PasswordHash($iteration_count_log2, $portable_hashes)
- {
- $this->itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
-
- if ($iteration_count_log2 < 4 || $iteration_count_log2 > 31)
- $iteration_count_log2 = 8;
- $this->iteration_count_log2 = $iteration_count_log2;
-
- $this->portable_hashes = $portable_hashes;
-
- $this->random_state = microtime();
- if (function_exists('getmypid'))
- $this->random_state .= getmypid();
- }
-
- function get_random_bytes($count)
- {
- $output = '';
- if (@is_readable('/dev/urandom') &&
- ($fh = @fopen('/dev/urandom', 'rb'))) {
- $output = fread($fh, $count);
- fclose($fh);
- }
-
- if (strlen($output) < $count) {
- $output = '';
- for ($i = 0; $i < $count; $i += 16) {
- $this->random_state =
- md5(microtime() . $this->random_state);
- $output .=
- pack('H*', md5($this->random_state));
- }
- $output = substr($output, 0, $count);
- }
-
- return $output;
- }
-
- function encode64($input, $count)
- {
- $output = '';
- $i = 0;
- do {
- $value = ord($input[$i++]);
- $output .= $this->itoa64[$value & 0x3f];
- if ($i < $count)
- $value |= ord($input[$i]) << 8;
- $output .= $this->itoa64[($value >> 6) & 0x3f];
- if ($i++ >= $count)
- break;
- if ($i < $count)
- $value |= ord($input[$i]) << 16;
- $output .= $this->itoa64[($value >> 12) & 0x3f];
- if ($i++ >= $count)
- break;
- $output .= $this->itoa64[($value >> 18) & 0x3f];
- } while ($i < $count);
-
- return $output;
- }
-
- function gensalt_private($input)
- {
- $output = '$P$';
- $output .= $this->itoa64[min($this->iteration_count_log2 +
- ((PHP_VERSION >= '5') ? 5 : 3), 30)];
- $output .= $this->encode64($input, 6);
-
- return $output;
- }
-
- function crypt_private($password, $setting)
- {
- $output = '*0';
- if (substr($setting, 0, 2) == $output)
- $output = '*1';
-
- $id = substr($setting, 0, 3);
- # We use "$P$", phpBB3 uses "$H$" for the same thing
- if ($id != '$P$' && $id != '$H$')
- return $output;
-
- $count_log2 = strpos($this->itoa64, $setting[3]);
- if ($count_log2 < 7 || $count_log2 > 30)
- return $output;
-
- $count = 1 << $count_log2;
-
- $salt = substr($setting, 4, 8);
- if (strlen($salt) != 8)
- return $output;
-
- # We're kind of forced to use MD5 here since it's the only
- # cryptographic primitive available in all versions of PHP
- # currently in use. To implement our own low-level crypto
- # in PHP would result in much worse performance and
- # consequently in lower iteration counts and hashes that are
- # quicker to crack (by non-PHP code).
- if (PHP_VERSION >= '5') {
- $hash = md5($salt . $password, TRUE);
- do {
- $hash = md5($hash . $password, TRUE);
- } while (--$count);
- } else {
- $hash = pack('H*', md5($salt . $password));
- do {
- $hash = pack('H*', md5($hash . $password));
- } while (--$count);
- }
-
- $output = substr($setting, 0, 12);
- $output .= $this->encode64($hash, 16);
-
- return $output;
- }
-
- function gensalt_extended($input)
- {
- $count_log2 = min($this->iteration_count_log2 + 8, 24);
- # This should be odd to not reveal weak DES keys, and the
- # maximum valid value is (2**24 - 1) which is odd anyway.
- $count = (1 << $count_log2) - 1;
-
- $output = '_';
- $output .= $this->itoa64[$count & 0x3f];
- $output .= $this->itoa64[($count >> 6) & 0x3f];
- $output .= $this->itoa64[($count >> 12) & 0x3f];
- $output .= $this->itoa64[($count >> 18) & 0x3f];
-
- $output .= $this->encode64($input, 3);
-
- return $output;
- }
-
- function gensalt_blowfish($input)
- {
- # This one needs to use a different order of characters and a
- # different encoding scheme from the one in encode64() above.
- # We care because the last character in our encoded string will
- # only represent 2 bits. While two known implementations of
- # bcrypt will happily accept and correct a salt string which
- # has the 4 unused bits set to non-zero, we do not want to take
- # chances and we also do not want to waste an additional byte
- # of entropy.
- $itoa64 = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
-
- $output = '$2a$';
- $output .= chr(ord('0') + $this->iteration_count_log2 / 10);
- $output .= chr(ord('0') + $this->iteration_count_log2 % 10);
- $output .= '$';
-
- $i = 0;
- do {
- $c1 = ord($input[$i++]);
- $output .= $itoa64[$c1 >> 2];
- $c1 = ($c1 & 0x03) << 4;
- if ($i >= 16) {
- $output .= $itoa64[$c1];
- break;
- }
-
- $c2 = ord($input[$i++]);
- $c1 |= $c2 >> 4;
- $output .= $itoa64[$c1];
- $c1 = ($c2 & 0x0f) << 2;
-
- $c2 = ord($input[$i++]);
- $c1 |= $c2 >> 6;
- $output .= $itoa64[$c1];
- $output .= $itoa64[$c2 & 0x3f];
- } while (1);
-
- return $output;
- }
-
- function HashPassword($password)
- {
- $random = '';
-
- if (CRYPT_BLOWFISH == 1 && !$this->portable_hashes) {
- $random = $this->get_random_bytes(16);
- $hash =
- crypt($password, $this->gensalt_blowfish($random));
- if (strlen($hash) == 60)
- return $hash;
- }
-
- if (CRYPT_EXT_DES == 1 && !$this->portable_hashes) {
- if (strlen($random) < 3)
- $random = $this->get_random_bytes(3);
- $hash =
- crypt($password, $this->gensalt_extended($random));
- if (strlen($hash) == 20)
- return $hash;
- }
-
- if (strlen($random) < 6)
- $random = $this->get_random_bytes(6);
- $hash =
- $this->crypt_private($password,
- $this->gensalt_private($random));
- if (strlen($hash) == 34)
- return $hash;
-
- # Returning '*' on error is safe here, but would _not_ be safe
- # in a crypt(3)-like function used _both_ for generating new
- # hashes and for validating passwords against existing hashes.
- return '*';
- }
-
- function CheckPassword($password, $stored_hash)
- {
- $hash = $this->crypt_private($password, $stored_hash);
- if ($hash[0] == '*')
- $hash = crypt($password, $stored_hash);
-
- return $hash == $stored_hash;
- }
-}
-
-?>
diff --git a/3rdparty/phpass/c/Makefile b/3rdparty/phpass/c/Makefile
deleted file mode 100644
index fe48917f7f5..00000000000
--- a/3rdparty/phpass/c/Makefile
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# Written by Solar Designer and placed in the public domain.
-# See crypt_private.c for more information.
-#
-CC = gcc
-LD = $(CC)
-RM = rm -f
-CFLAGS = -Wall -O2 -fomit-frame-pointer -funroll-loops
-LDFLAGS = -s
-LIBS = -lcrypto
-
-all: crypt_private-test
-
-crypt_private-test: crypt_private-test.o
- $(LD) $(LDFLAGS) $(LIBS) crypt_private-test.o -o $@
-
-crypt_private-test.o: crypt_private.c
- $(CC) -c $(CFLAGS) crypt_private.c -DTEST -o $@
-
-clean:
- $(RM) crypt_private-test*
diff --git a/3rdparty/phpass/c/crypt_private.c b/3rdparty/phpass/c/crypt_private.c
deleted file mode 100644
index 6abc05bc1de..00000000000
--- a/3rdparty/phpass/c/crypt_private.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * This code exists for the sole purpose to serve as another implementation
- * of the "private" password hashing method implemened in PasswordHash.php
- * and thus to confirm that these password hashes are indeed calculated as
- * intended.
- *
- * Other uses of this code are discouraged. There are much better password
- * hashing algorithms available to C programmers; one of those is bcrypt:
- *
- * http://www.openwall.com/crypt/
- *
- * Written by Solar Designer <solar at openwall.com> in 2005 and placed in
- * the public domain.
- *
- * There's absolutely no warranty.
- */
-
-#include <string.h>
-#include <openssl/md5.h>
-
-#ifdef TEST
-#include <stdio.h>
-#endif
-
-static char *itoa64 =
- "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
-
-static void encode64(char *dst, char *src, int count)
-{
- int i, value;
-
- i = 0;
- do {
- value = (unsigned char)src[i++];
- *dst++ = itoa64[value & 0x3f];
- if (i < count)
- value |= (unsigned char)src[i] << 8;
- *dst++ = itoa64[(value >> 6) & 0x3f];
- if (i++ >= count)
- break;
- if (i < count)
- value |= (unsigned char)src[i] << 16;
- *dst++ = itoa64[(value >> 12) & 0x3f];
- if (i++ >= count)
- break;
- *dst++ = itoa64[(value >> 18) & 0x3f];
- } while (i < count);
-}
-
-char *crypt_private(char *password, char *setting)
-{
- static char output[35];
- MD5_CTX ctx;
- char hash[MD5_DIGEST_LENGTH];
- char *p, *salt;
- int count_log2, length, count;
-
- strcpy(output, "*0");
- if (!strncmp(setting, output, 2))
- output[1] = '1';
-
- if (strncmp(setting, "$P$", 3))
- return output;
-
- p = strchr(itoa64, setting[3]);
- if (!p)
- return output;
- count_log2 = p - itoa64;
- if (count_log2 < 7 || count_log2 > 30)
- return output;
-
- salt = setting + 4;
- if (strlen(salt) < 8)
- return output;
-
- length = strlen(password);
-
- MD5_Init(&ctx);
- MD5_Update(&ctx, salt, 8);
- MD5_Update(&ctx, password, length);
- MD5_Final(hash, &ctx);
-
- count = 1 << count_log2;
- do {
- MD5_Init(&ctx);
- MD5_Update(&ctx, hash, MD5_DIGEST_LENGTH);
- MD5_Update(&ctx, password, length);
- MD5_Final(hash, &ctx);
- } while (--count);
-
- memcpy(output, setting, 12);
- encode64(&output[12], hash, MD5_DIGEST_LENGTH);
-
- return output;
-}
-
-#ifdef TEST
-int main(int argc, char **argv)
-{
- if (argc != 3) return 1;
-
- puts(crypt_private(argv[1], argv[2]));
-
- return 0;
-}
-#endif
diff --git a/3rdparty/phpass/test.php b/3rdparty/phpass/test.php
deleted file mode 100644
index 2f4a41c8c31..00000000000
--- a/3rdparty/phpass/test.php
+++ /dev/null
@@ -1,72 +0,0 @@
-<?php
-#
-# This is a test program for the portable PHP password hashing framework.
-#
-# Written by Solar Designer and placed in the public domain.
-# See PasswordHash.php for more information.
-#
-
-require 'PasswordHash.php';
-
-header('Content-type: text/plain');
-
-$ok = 0;
-
-# Try to use stronger but system-specific hashes, with a possible fallback to
-# the weaker portable hashes.
-$t_hasher = new PasswordHash(8, FALSE);
-
-$correct = 'test12345';
-$hash = $t_hasher->HashPassword($correct);
-
-print 'Hash: ' . $hash . "\n";
-
-$check = $t_hasher->CheckPassword($correct, $hash);
-if ($check) $ok++;
-print "Check correct: '" . $check . "' (should be '1')\n";
-
-$wrong = 'test12346';
-$check = $t_hasher->CheckPassword($wrong, $hash);
-if (!$check) $ok++;
-print "Check wrong: '" . $check . "' (should be '0' or '')\n";
-
-unset($t_hasher);
-
-# Force the use of weaker portable hashes.
-$t_hasher = new PasswordHash(8, TRUE);
-
-$hash = $t_hasher->HashPassword($correct);
-
-print 'Hash: ' . $hash . "\n";
-
-$check = $t_hasher->CheckPassword($correct, $hash);
-if ($check) $ok++;
-print "Check correct: '" . $check . "' (should be '1')\n";
-
-$check = $t_hasher->CheckPassword($wrong, $hash);
-if (!$check) $ok++;
-print "Check wrong: '" . $check . "' (should be '0' or '')\n";
-
-# A correct portable hash for 'test12345'.
-# Please note the use of single quotes to ensure that the dollar signs will
-# be interpreted literally. Of course, a real application making use of the
-# framework won't store password hashes within a PHP source file anyway.
-# We only do this for testing.
-$hash = '$P$9IQRaTwmfeRo7ud9Fh4E2PdI0S3r.L0';
-
-print 'Hash: ' . $hash . "\n";
-
-$check = $t_hasher->CheckPassword($correct, $hash);
-if ($check) $ok++;
-print "Check correct: '" . $check . "' (should be '1')\n";
-
-$check = $t_hasher->CheckPassword($wrong, $hash);
-if (!$check) $ok++;
-print "Check wrong: '" . $check . "' (should be '0' or '')\n";
-
-if ($ok == 6)
- print "All tests have PASSED\n";
-else
- print "Some tests have FAILED\n";
-
-?>
diff --git a/3rdparty/smb4php/smb.php b/3rdparty/smb4php/smb.php
deleted file mode 100644
index c080c1b590f..00000000000
--- a/3rdparty/smb4php/smb.php
+++ /dev/null
@@ -1,456 +0,0 @@
-<?php
-###################################################################
-# smb.php
-# This class implements a SMB stream wrapper based on 'smbclient'
-#
-# Date: lun oct 22 10:35:35 CEST 2007
-#
-# Homepage: http://www.phpclasses.org/smb4php
-#
-# Copyright (c) 2007 Victor M. Varela <vmvarela@gmail.com>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-###################################################################
-
-define ('SMB4PHP_VERSION', '0.8');
-
-###################################################################
-# CONFIGURATION SECTION - Change for your needs
-###################################################################
-
-define ('SMB4PHP_SMBCLIENT', 'smbclient');
-define ('SMB4PHP_SMBOPTIONS', 'TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE SO_RCVBUF=8192 SO_SNDBUF=8192');
-define ('SMB4PHP_AUTHMODE', 'arg'); # set to 'env' to use USER enviroment variable
-
-###################################################################
-# SMB - commands that does not need an instance
-###################################################################
-
-$GLOBALS['__smb_cache'] = array ('stat' => array (), 'dir' => array ());
-
-class smb {
-
- function parse_url ($url) {
- $pu = parse_url (trim($url));
- foreach (array ('domain', 'user', 'pass', 'host', 'port', 'path') as $i)
- if (! isset($pu[$i])) $pu[$i] = '';
- if (count ($userdomain = explode (';', urldecode ($pu['user']))) > 1)
- @list ($pu['domain'], $pu['user']) = $userdomain;
- $path = preg_replace (array ('/^\//', '/\/$/'), '', urldecode ($pu['path']));
- list ($pu['share'], $pu['path']) = (preg_match ('/^([^\/]+)\/(.*)/', $path, $regs))
- ? array ($regs[1], preg_replace ('/\//', '\\', $regs[2]))
- : array ($path, '');
- $pu['type'] = $pu['path'] ? 'path' : ($pu['share'] ? 'share' : ($pu['host'] ? 'host' : '**error**'));
- if (! ($pu['port'] = intval(@$pu['port']))) $pu['port'] = 139;
- return $pu;
- }
-
-
- function look ($purl) {
- return smb::client ('-L ' . escapeshellarg ($purl['host']), $purl);
- }
-
-
- function execute ($command, $purl) {
- return smb::client ('-d 0 '
- . escapeshellarg ('//' . $purl['host'] . '/' . $purl['share'])
- . ' -c ' . escapeshellarg ($command), $purl
- );
- }
-
- function client ($params, $purl) {
-
- static $regexp = array (
- '^added interface ip=(.*) bcast=(.*) nmask=(.*)$' => 'skip',
- 'Anonymous login successful' => 'skip',
- '^Domain=\[(.*)\] OS=\[(.*)\] Server=\[(.*)\]$' => 'skip',
- '^\tSharename[ ]+Type[ ]+Comment$' => 'shares',
- '^\t---------[ ]+----[ ]+-------$' => 'skip',
- '^\tServer [ ]+Comment$' => 'servers',
- '^\t---------[ ]+-------$' => 'skip',
- '^\tWorkgroup[ ]+Master$' => 'workg',
- '^\t(.*)[ ]+(Disk|IPC)[ ]+IPC.*$' => 'skip',
- '^\tIPC\\\$(.*)[ ]+IPC' => 'skip',
- '^\t(.*)[ ]+(Disk)[ ]+(.*)$' => 'share',
- '^\t(.*)[ ]+(Printer)[ ]+(.*)$' => 'skip',
- '([0-9]+) blocks of size ([0-9]+)\. ([0-9]+) blocks available' => 'skip',
- 'Got a positive name query response from ' => 'skip',
- '^(session setup failed): (.*)$' => 'error',
- '^(.*): ERRSRV - ERRbadpw' => 'error',
- '^Error returning browse list: (.*)$' => 'error',
- '^tree connect failed: (.*)$' => 'error',
- '^(Connection to .* failed)$' => 'error',
- '^NT_STATUS_(.*) ' => 'error',
- '^NT_STATUS_(.*)\$' => 'error',
- 'ERRDOS - ERRbadpath \((.*).\)' => 'error',
- 'cd (.*): (.*)$' => 'error',
- '^cd (.*): NT_STATUS_(.*)' => 'error',
- '^\t(.*)$' => 'srvorwg',
- '^([0-9]+)[ ]+([0-9]+)[ ]+(.*)$' => 'skip',
- '^Job ([0-9]+) cancelled' => 'skip',
- '^[ ]+(.*)[ ]+([0-9]+)[ ]+(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[ ](Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[ ]+([0-9]+)[ ]+([0-9]{2}:[0-9]{2}:[0-9]{2})[ ]([0-9]{4})$' => 'files',
- '^message start: ERRSRV - (ERRmsgoff)' => 'error'
- );
-
- if (SMB4PHP_AUTHMODE == 'env') {
- putenv("USER={$purl['user']}%{$purl['pass']}");
- $auth = '';
- } else {
- $auth = ($purl['user'] <> '' ? (' -U ' . escapeshellarg ($purl['user'] . '%' . $purl['pass'])) : '');
- }
- if ($purl['domain'] <> '') {
- $auth .= ' -W ' . escapeshellarg ($purl['domain']);
- }
- $port = ($purl['port'] <> 139 ? ' -p ' . escapeshellarg ($purl['port']) : '');
- $options = '-O ' . escapeshellarg(SMB4PHP_SMBOPTIONS);
- $output = popen (SMB4PHP_SMBCLIENT." -N {$auth} {$options} {$port} {$options} {$params} 2>/dev/null", 'r');
- $info = array ();
- $info['info']= array ();
- while ($line = fgets ($output, 4096)) {
- list ($tag, $regs, $i) = array ('skip', array (), array ());
- reset ($regexp);
- foreach ($regexp as $r => $t) if (preg_match ('/'.$r.'/', $line, $regs)) {
- $tag = $t;
- break;
- }
- switch ($tag) {
- case 'skip': continue;
- case 'shares': $mode = 'shares'; break;
- case 'servers': $mode = 'servers'; break;
- case 'workg': $mode = 'workgroups'; break;
- case 'share':
- list($name, $type) = array (
- trim(substr($line, 1, 15)),
- trim(strtolower(substr($line, 17, 10)))
- );
- $i = ($type <> 'disk' && preg_match('/^(.*) Disk/', $line, $regs))
- ? array(trim($regs[1]), 'disk')
- : array($name, 'disk');
- break;
- case 'srvorwg':
- list ($name, $master) = array (
- strtolower(trim(substr($line,1,21))),
- strtolower(trim(substr($line, 22)))
- );
- $i = ($mode == 'servers') ? array ($name, "server") : array ($name, "workgroup", $master);
- break;
- case 'files':
- list ($attr, $name) = preg_match ("/^(.*)[ ]+([D|A|H|S|R]+)$/", trim ($regs[1]), $regs2)
- ? array (trim ($regs2[2]), trim ($regs2[1]))
- : array ('', trim ($regs[1]));
- list ($his, $im) = array (
- explode(':', $regs[6]), 1 + strpos("JanFebMarAprMayJunJulAugSepOctNovDec", $regs[4]) / 3);
- $i = ($name <> '.' && $name <> '..')
- ? array (
- $name,
- (strpos($attr,'D') === FALSE) ? 'file' : 'folder',
- 'attr' => $attr,
- 'size' => intval($regs[2]),
- 'time' => mktime ($his[0], $his[1], $his[2], $im, $regs[5], $regs[7])
- )
- : array();
- break;
- case 'error':
- if(substr($regs[0],0,22)=='NT_STATUS_NO_SUCH_FILE'){
- return false;
- }elseif(substr($regs[0],0,31)=='NT_STATUS_OBJECT_NAME_COLLISION'){
- return false;
- }elseif(substr($regs[0],0,31)=='NT_STATUS_OBJECT_PATH_NOT_FOUND'){
- return false;
- }elseif(substr($regs[0],0,29)=='NT_STATUS_FILE_IS_A_DIRECTORY'){
- return false;
- }
- trigger_error($regs[0].' params('.$params.')', E_USER_ERROR);
- }
- if ($i) switch ($i[1]) {
- case 'file':
- case 'folder': $info['info'][$i[0]] = $i;
- case 'disk':
- case 'server':
- case 'workgroup': $info[$i[1]][] = $i[0];
- }
- }
- pclose($output);
- return $info;
- }
-
-
- # stats
-
- function url_stat ($url, $flags = STREAM_URL_STAT_LINK) {
- if ($s = smb::getstatcache($url)) { return $s; }
- list ($stat, $pu) = array (array (), smb::parse_url ($url));
- switch ($pu['type']) {
- case 'host':
- if ($o = smb::look ($pu))
- $stat = stat ("/tmp");
- else
- trigger_error ("url_stat(): list failed for host '{$host}'", E_USER_WARNING);
- break;
- case 'share':
- if ($o = smb::look ($pu)) {
- $found = FALSE;
- $lshare = strtolower ($pu['share']); # fix by Eric Leung
- foreach ($o['disk'] as $s) if ($lshare == strtolower($s)) {
- $found = TRUE;
- $stat = stat ("/tmp");
- break;
- }
- if (! $found)
- trigger_error ("url_stat(): disk resource '{$share}' not found in '{$host}'", E_USER_WARNING);
- }
- break;
- case 'path':
- if ($o = smb::execute ('dir "'.$pu['path'].'"', $pu)) {
- $p = explode('\\', $pu['path']);
- $name = $p[count($p)-1];
- if (isset ($o['info'][$name])) {
- $stat = smb::addstatcache ($url, $o['info'][$name]);
- } else {
- trigger_error ("url_stat(): path '{$pu['path']}' not found", E_USER_WARNING);
- }
- } else {
- return false;
-// trigger_error ("url_stat(): dir failed for path '{$pu['path']}'", E_USER_WARNING);
- }
- break;
- default: trigger_error ('error in URL', E_USER_ERROR);
- }
- return $stat;
- }
-
- function addstatcache ($url, $info) {
- $url = str_replace('//', '/', $url);
- $url = rtrim($url, '/');
- global $__smb_cache;
- $is_file = (strpos ($info['attr'],'D') === FALSE);
- $s = ($is_file) ? stat ('/etc/passwd') : stat ('/tmp');
- $s[7] = $s['size'] = $info['size'];
- $s[8] = $s[9] = $s[10] = $s['atime'] = $s['mtime'] = $s['ctime'] = $info['time'];
- return $__smb_cache['stat'][$url] = $s;
- }
-
- function getstatcache ($url) {
- $url = str_replace('//', '/', $url);
- $url = rtrim($url, '/');
- global $__smb_cache;
- return isset ($__smb_cache['stat'][$url]) ? $__smb_cache['stat'][$url] : FALSE;
- }
-
- function clearstatcache ($url='') {
- $url = str_replace('//', '/', $url);
- $url = rtrim($url, '/');
- global $__smb_cache;
- if ($url == '') $__smb_cache['stat'] = array (); else unset ($__smb_cache['stat'][$url]);
- }
-
-
- # commands
-
- function unlink ($url) {
- $pu = smb::parse_url($url);
- if ($pu['type'] <> 'path') trigger_error('unlink(): error in URL', E_USER_ERROR);
- smb::clearstatcache ($url);
- smb_stream_wrapper::cleardircache (dirname($url));
- return smb::execute ('del "'.$pu['path'].'"', $pu);
- }
-
- function rename ($url_from, $url_to) {
- list ($from, $to) = array (smb::parse_url($url_from), smb::parse_url($url_to));
- if ($from['host'] <> $to['host'] ||
- $from['share'] <> $to['share'] ||
- $from['user'] <> $to['user'] ||
- $from['pass'] <> $to['pass'] ||
- $from['domain'] <> $to['domain']) {
- trigger_error('rename(): FROM & TO must be in same server-share-user-pass-domain', E_USER_ERROR);
- }
- if ($from['type'] <> 'path' || $to['type'] <> 'path') {
- trigger_error('rename(): error in URL', E_USER_ERROR);
- }
- smb::clearstatcache ($url_from);
- return smb::execute ('rename "'.$from['path'].'" "'.$to['path'].'"', $to);
- }
-
- function mkdir ($url, $mode, $options) {
- $pu = smb::parse_url($url);
- if ($pu['type'] <> 'path') trigger_error('mkdir(): error in URL', E_USER_ERROR);
- return smb::execute ('mkdir "'.$pu['path'].'"', $pu)!==false;
- }
-
- function rmdir ($url) {
- $pu = smb::parse_url($url);
- if ($pu['type'] <> 'path') trigger_error('rmdir(): error in URL', E_USER_ERROR);
- smb::clearstatcache ($url);
- smb_stream_wrapper::cleardircache (dirname($url));
- return smb::execute ('rmdir "'.$pu['path'].'"', $pu)!==false;
- }
-
-}
-
-###################################################################
-# SMB_STREAM_WRAPPER - class to be registered for smb:// URLs
-###################################################################
-
-class smb_stream_wrapper extends smb {
-
- # variables
-
- private $stream, $url, $parsed_url = array (), $mode, $tmpfile;
- private $need_flush = FALSE;
- private $dir = array (), $dir_index = -1;
-
-
- # directories
-
- function dir_opendir ($url, $options) {
- if ($d = $this->getdircache ($url)) {
- $this->dir = $d;
- $this->dir_index = 0;
- return TRUE;
- }
- $pu = smb::parse_url ($url);
- switch ($pu['type']) {
- case 'host':
- if ($o = smb::look ($pu)) {
- $this->dir = $o['disk'];
- $this->dir_index = 0;
- } else {
- trigger_error ("dir_opendir(): list failed for host '{$pu['host']}'", E_USER_WARNING);
- return false;
- }
- break;
- case 'share':
- case 'path':
- if (is_array($o = smb::execute ('dir "'.$pu['path'].'\*"', $pu))) {
- $this->dir = array_keys($o['info']);
- $this->dir_index = 0;
- $this->adddircache ($url, $this->dir);
- if(substr($url,-1,1)=='/'){
- $url=substr($url,0,-1);
- }
- foreach ($o['info'] as $name => $info) {
- smb::addstatcache($url . '/' . $name, $info);
- }
- } else {
- trigger_error ("dir_opendir(): dir failed for path '".$pu['path']."'", E_USER_WARNING);
- return false;
- }
- break;
- default:
- trigger_error ('dir_opendir(): error in URL', E_USER_ERROR);
- return false;
- }
- return TRUE;
- }
-
- function dir_readdir () {
- return ($this->dir_index < count($this->dir)) ? $this->dir[$this->dir_index++] : FALSE;
- }
-
- function dir_rewinddir () { $this->dir_index = 0; }
-
- function dir_closedir () { $this->dir = array(); $this->dir_index = -1; return TRUE; }
-
-
- # cache
-
- function adddircache ($url, $content) {
- $url = str_replace('//', '/', $url);
- $url = rtrim($url, '/');
- global $__smb_cache;
- return $__smb_cache['dir'][$url] = $content;
- }
-
- function getdircache ($url) {
- $url = str_replace('//', '/', $url);
- $url = rtrim($url, '/');
- global $__smb_cache;
- return isset ($__smb_cache['dir'][$url]) ? $__smb_cache['dir'][$url] : FALSE;
- }
-
- function cleardircache ($url='') {
- $url = str_replace('//', '/', $url);
- $url = rtrim($url, '/');
- global $__smb_cache;
- if ($url == ''){
- $__smb_cache['dir'] = array ();
- }else{
- unset ($__smb_cache['dir'][$url]);
- }
- }
-
-
- # streams
-
- function stream_open ($url, $mode, $options, $opened_path) {
- $this->url = $url;
- $this->mode = $mode;
- $this->parsed_url = $pu = smb::parse_url($url);
- if ($pu['type'] <> 'path') trigger_error('stream_open(): error in URL', E_USER_ERROR);
- switch ($mode) {
- case 'r':
- case 'r+':
- case 'rb':
- case 'a':
- case 'a+': $this->tmpfile = tempnam('/tmp', 'smb.down.');
- smb::execute ('get "'.$pu['path'].'" "'.$this->tmpfile.'"', $pu);
- break;
- case 'w':
- case 'w+':
- case 'wb':
- case 'x':
- case 'x+': $this->cleardircache();
- $this->tmpfile = tempnam('/tmp', 'smb.up.');
- $this->need_flush=true;
- }
- $this->stream = fopen ($this->tmpfile, $mode);
- return TRUE;
- }
-
- function stream_close () { return fclose($this->stream); }
-
- function stream_read ($count) { return fread($this->stream, $count); }
-
- function stream_write ($data) { $this->need_flush = TRUE; return fwrite($this->stream, $data); }
-
- function stream_eof () { return feof($this->stream); }
-
- function stream_tell () { return ftell($this->stream); }
-
- function stream_seek ($offset, $whence=null) { return fseek($this->stream, $offset, $whence); }
-
- function stream_flush () {
- if ($this->mode <> 'r' && $this->need_flush) {
- smb::clearstatcache ($this->url);
- smb::execute ('put "'.$this->tmpfile.'" "'.$this->parsed_url['path'].'"', $this->parsed_url);
- $this->need_flush = FALSE;
- }
- }
-
- function stream_stat () { return smb::url_stat ($this->url); }
-
- function __destruct () {
- if ($this->tmpfile <> '') {
- if ($this->need_flush) $this->stream_flush ();
- unlink ($this->tmpfile);
-
- }
- }
-
-}
-
-###################################################################
-# Register 'smb' protocol !
-###################################################################
-
-stream_wrapper_register('smb', 'smb_stream_wrapper')
- or die ('Failed to register protocol');
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/Annotation/Route.php b/3rdparty/symfony/routing/Symfony/Component/Routing/Annotation/Route.php
deleted file mode 100644
index f60af463f2c..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/Annotation/Route.php
+++ /dev/null
@@ -1,103 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing\Annotation;
-
-/**
- * Annotation class for @Route().
- *
- * @Annotation
- *
- * @author Fabien Potencier <fabien@symfony.com>
- */
-class Route
-{
- private $pattern;
- private $name;
- private $requirements;
- private $options;
- private $defaults;
-
- /**
- * Constructor.
- *
- * @param array $data An array of key/value parameters.
- */
- public function __construct(array $data)
- {
- $this->requirements = array();
- $this->options = array();
- $this->defaults = array();
-
- if (isset($data['value'])) {
- $data['pattern'] = $data['value'];
- unset($data['value']);
- }
-
- foreach ($data as $key => $value) {
- $method = 'set'.$key;
- if (!method_exists($this, $method)) {
- throw new \BadMethodCallException(sprintf("Unknown property '%s' on annotation '%s'.", $key, get_class($this)));
- }
- $this->$method($value);
- }
- }
-
- public function setPattern($pattern)
- {
- $this->pattern = $pattern;
- }
-
- public function getPattern()
- {
- return $this->pattern;
- }
-
- public function setName($name)
- {
- $this->name = $name;
- }
-
- public function getName()
- {
- return $this->name;
- }
-
- public function setRequirements($requirements)
- {
- $this->requirements = $requirements;
- }
-
- public function getRequirements()
- {
- return $this->requirements;
- }
-
- public function setOptions($options)
- {
- $this->options = $options;
- }
-
- public function getOptions()
- {
- return $this->options;
- }
-
- public function setDefaults($defaults)
- {
- $this->defaults = $defaults;
- }
-
- public function getDefaults()
- {
- return $this->defaults;
- }
-}
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/CompiledRoute.php b/3rdparty/symfony/routing/Symfony/Component/Routing/CompiledRoute.php
deleted file mode 100644
index c86c9eca5b2..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/CompiledRoute.php
+++ /dev/null
@@ -1,134 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing;
-
-/**
- * CompiledRoutes are returned by the RouteCompiler class.
- *
- * @author Fabien Potencier <fabien@symfony.com>
- */
-class CompiledRoute
-{
- private $route;
- private $variables;
- private $tokens;
- private $staticPrefix;
- private $regex;
-
- /**
- * Constructor.
- *
- * @param Route $route A original Route instance
- * @param string $staticPrefix The static prefix of the compiled route
- * @param string $regex The regular expression to use to match this route
- * @param array $tokens An array of tokens to use to generate URL for this route
- * @param array $variables An array of variables
- */
- public function __construct(Route $route, $staticPrefix, $regex, array $tokens, array $variables)
- {
- $this->route = $route;
- $this->staticPrefix = $staticPrefix;
- $this->regex = $regex;
- $this->tokens = $tokens;
- $this->variables = $variables;
- }
-
- /**
- * Returns the Route instance.
- *
- * @return Route A Route instance
- */
- public function getRoute()
- {
- return $this->route;
- }
-
- /**
- * Returns the static prefix.
- *
- * @return string The static prefix
- */
- public function getStaticPrefix()
- {
- return $this->staticPrefix;
- }
-
- /**
- * Returns the regex.
- *
- * @return string The regex
- */
- public function getRegex()
- {
- return $this->regex;
- }
-
- /**
- * Returns the tokens.
- *
- * @return array The tokens
- */
- public function getTokens()
- {
- return $this->tokens;
- }
-
- /**
- * Returns the variables.
- *
- * @return array The variables
- */
- public function getVariables()
- {
- return $this->variables;
- }
-
- /**
- * Returns the pattern.
- *
- * @return string The pattern
- */
- public function getPattern()
- {
- return $this->route->getPattern();
- }
-
- /**
- * Returns the options.
- *
- * @return array The options
- */
- public function getOptions()
- {
- return $this->route->getOptions();
- }
-
- /**
- * Returns the defaults.
- *
- * @return array The defaults
- */
- public function getDefaults()
- {
- return $this->route->getDefaults();
- }
-
- /**
- * Returns the requirements.
- *
- * @return array The requirements
- */
- public function getRequirements()
- {
- return $this->route->getRequirements();
- }
-}
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/Exception/ExceptionInterface.php b/3rdparty/symfony/routing/Symfony/Component/Routing/Exception/ExceptionInterface.php
deleted file mode 100644
index 5289f525fcd..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/Exception/ExceptionInterface.php
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing\Exception;
-
-/**
- * ExceptionInterface
- *
- * @author Alexandre Salomé <alexandre.salome@gmail.com>
- *
- * @api
- */
-interface ExceptionInterface
-{
-}
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/Exception/InvalidParameterException.php b/3rdparty/symfony/routing/Symfony/Component/Routing/Exception/InvalidParameterException.php
deleted file mode 100644
index 4f12469529d..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/Exception/InvalidParameterException.php
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing\Exception;
-
-/**
- * Exception thrown when a parameter is not valid
- *
- * @author Alexandre Salomé <alexandre.salome@gmail.com>
- *
- * @api
- */
-class InvalidParameterException extends \InvalidArgumentException implements ExceptionInterface
-{
-}
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/Exception/MethodNotAllowedException.php b/3rdparty/symfony/routing/Symfony/Component/Routing/Exception/MethodNotAllowedException.php
deleted file mode 100644
index 470ce52216e..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/Exception/MethodNotAllowedException.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing\Exception;
-
-/**
- * The resource was found but the request method is not allowed.
- *
- * This exception should trigger an HTTP 405 response in your application code.
- *
- * @author Kris Wallsmith <kris@symfony.com>
- *
- * @api
- */
-class MethodNotAllowedException extends \RuntimeException implements ExceptionInterface
-{
- protected $allowedMethods;
-
- public function __construct(array $allowedMethods, $message = null, $code = 0, \Exception $previous = null)
- {
- $this->allowedMethods = array_map('strtoupper', $allowedMethods);
-
- parent::__construct($message, $code, $previous);
- }
-
- public function getAllowedMethods()
- {
- return $this->allowedMethods;
- }
-}
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/Exception/MissingMandatoryParametersException.php b/3rdparty/symfony/routing/Symfony/Component/Routing/Exception/MissingMandatoryParametersException.php
deleted file mode 100644
index 5a523fa5590..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/Exception/MissingMandatoryParametersException.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing\Exception;
-
-/**
- * Exception thrown when a route cannot be generated because of missing
- * mandatory parameters.
- *
- * @author Alexandre Salomé <alexandre.salome@gmail.com>
- *
- * @api
- */
-class MissingMandatoryParametersException extends \InvalidArgumentException implements ExceptionInterface
-{
-}
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/Exception/ResourceNotFoundException.php b/3rdparty/symfony/routing/Symfony/Component/Routing/Exception/ResourceNotFoundException.php
deleted file mode 100644
index 362a0d61f36..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/Exception/ResourceNotFoundException.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing\Exception;
-
-/**
- * The resource was not found.
- *
- * This exception should trigger an HTTP 404 response in your application code.
- *
- * @author Kris Wallsmith <kris@symfony.com>
- *
- * @api
- */
-class ResourceNotFoundException extends \RuntimeException implements ExceptionInterface
-{
-}
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/Exception/RouteNotFoundException.php b/3rdparty/symfony/routing/Symfony/Component/Routing/Exception/RouteNotFoundException.php
deleted file mode 100644
index 4d5f288e7ed..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/Exception/RouteNotFoundException.php
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing\Exception;
-
-/**
- * Exception thrown when a route does not exists
- *
- * @author Alexandre Salomé <alexandre.salome@gmail.com>
- *
- * @api
- */
-class RouteNotFoundException extends \InvalidArgumentException implements ExceptionInterface
-{
-}
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/Generator/Dumper/GeneratorDumper.php b/3rdparty/symfony/routing/Symfony/Component/Routing/Generator/Dumper/GeneratorDumper.php
deleted file mode 100644
index 1291bd12d0e..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/Generator/Dumper/GeneratorDumper.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing\Generator\Dumper;
-
-use Symfony\Component\Routing\RouteCollection;
-
-/**
- * GeneratorDumper is the base class for all built-in generator dumpers.
- *
- * @author Fabien Potencier <fabien@symfony.com>
- */
-abstract class GeneratorDumper implements GeneratorDumperInterface
-{
- private $routes;
-
- /**
- * Constructor.
- *
- * @param RouteCollection $routes The RouteCollection to dump
- */
- public function __construct(RouteCollection $routes)
- {
- $this->routes = $routes;
- }
-
- public function getRoutes()
- {
- return $this->routes;
- }
-}
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/Generator/Dumper/GeneratorDumperInterface.php b/3rdparty/symfony/routing/Symfony/Component/Routing/Generator/Dumper/GeneratorDumperInterface.php
deleted file mode 100644
index 6f5353caf26..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/Generator/Dumper/GeneratorDumperInterface.php
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing\Generator\Dumper;
-
-use Symfony\Component\Routing\RouteCollection;
-
-/**
- * GeneratorDumperInterface is the interface that all generator dumper classes must implement.
- *
- * @author Fabien Potencier <fabien@symfony.com>
- *
- * @api
- */
-interface GeneratorDumperInterface
-{
- /**
- * Dumps a set of routes to a PHP class.
- *
- * Available options:
- *
- * * class: The class name
- * * base_class: The base class name
- *
- * @param array $options An array of options
- *
- * @return string A PHP class representing the generator class
- */
- public function dump(array $options = array());
-
- /**
- * Gets the routes to dump.
- *
- * @return RouteCollection A RouteCollection instance
- */
- public function getRoutes();
-}
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/Generator/Dumper/PhpGeneratorDumper.php b/3rdparty/symfony/routing/Symfony/Component/Routing/Generator/Dumper/PhpGeneratorDumper.php
deleted file mode 100644
index 080dd3a2539..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/Generator/Dumper/PhpGeneratorDumper.php
+++ /dev/null
@@ -1,150 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing\Generator\Dumper;
-
-use Symfony\Component\Routing\Route;
-
-/**
- * PhpGeneratorDumper creates a PHP class able to generate URLs for a given set of routes.
- *
- * @author Fabien Potencier <fabien@symfony.com>
- *
- * @api
- */
-class PhpGeneratorDumper extends GeneratorDumper
-{
- /**
- * Dumps a set of routes to a PHP class.
- *
- * Available options:
- *
- * * class: The class name
- * * base_class: The base class name
- *
- * @param array $options An array of options
- *
- * @return string A PHP class representing the generator class
- *
- * @api
- */
- public function dump(array $options = array())
- {
- $options = array_merge(array(
- 'class' => 'ProjectUrlGenerator',
- 'base_class' => 'Symfony\\Component\\Routing\\Generator\\UrlGenerator',
- ), $options);
-
- return
- $this->startClass($options['class'], $options['base_class']).
- $this->addConstructor().
- $this->addGenerator().
- $this->endClass()
- ;
- }
-
- private function addGenerator()
- {
- $methods = array();
- foreach ($this->getRoutes()->all() as $name => $route) {
- $compiledRoute = $route->compile();
-
- $variables = str_replace("\n", '', var_export($compiledRoute->getVariables(), true));
- $defaults = str_replace("\n", '', var_export($compiledRoute->getDefaults(), true));
- $requirements = str_replace("\n", '', var_export($compiledRoute->getRequirements(), true));
- $tokens = str_replace("\n", '', var_export($compiledRoute->getTokens(), true));
-
- $escapedName = str_replace('.', '__', $name);
-
- $methods[] = <<<EOF
- private function get{$escapedName}RouteInfo()
- {
- return array($variables, $defaults, $requirements, $tokens);
- }
-
-EOF
- ;
- }
-
- $methods = implode("\n", $methods);
-
- return <<<EOF
-
- public function generate(\$name, \$parameters = array(), \$absolute = false)
- {
- if (!isset(self::\$declaredRouteNames[\$name])) {
- throw new RouteNotFoundException(sprintf('Route "%s" does not exist.', \$name));
- }
-
- \$escapedName = str_replace('.', '__', \$name);
-
- list(\$variables, \$defaults, \$requirements, \$tokens) = \$this->{'get'.\$escapedName.'RouteInfo'}();
-
- return \$this->doGenerate(\$variables, \$defaults, \$requirements, \$tokens, \$parameters, \$name, \$absolute);
- }
-
-$methods
-EOF;
- }
-
- private function startClass($class, $baseClass)
- {
- $routes = array();
- foreach ($this->getRoutes()->all() as $name => $route) {
- $routes[] = " '$name' => true,";
- }
- $routes = implode("\n", $routes);
-
- return <<<EOF
-<?php
-
-use Symfony\Component\Routing\RequestContext;
-use Symfony\Component\Routing\Exception\RouteNotFoundException;
-
-
-/**
- * $class
- *
- * This class has been auto-generated
- * by the Symfony Routing Component.
- */
-class $class extends $baseClass
-{
- static private \$declaredRouteNames = array(
-$routes
- );
-
-
-EOF;
- }
-
- private function addConstructor()
- {
- return <<<EOF
- /**
- * Constructor.
- */
- public function __construct(RequestContext \$context)
- {
- \$this->context = \$context;
- }
-
-EOF;
- }
-
- private function endClass()
- {
- return <<<EOF
-}
-
-EOF;
- }
-}
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/Generator/UrlGenerator.php b/3rdparty/symfony/routing/Symfony/Component/Routing/Generator/UrlGenerator.php
deleted file mode 100644
index 28aca47b389..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/Generator/UrlGenerator.php
+++ /dev/null
@@ -1,176 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing\Generator;
-
-use Symfony\Component\Routing\Route;
-use Symfony\Component\Routing\RouteCollection;
-use Symfony\Component\Routing\RequestContext;
-use Symfony\Component\Routing\Exception\InvalidParameterException;
-use Symfony\Component\Routing\Exception\RouteNotFoundException;
-use Symfony\Component\Routing\Exception\MissingMandatoryParametersException;
-
-/**
- * UrlGenerator generates URL based on a set of routes.
- *
- * @author Fabien Potencier <fabien@symfony.com>
- *
- * @api
- */
-class UrlGenerator implements UrlGeneratorInterface
-{
- protected $context;
- protected $decodedChars = array(
- // %2F is not valid in a URL, so we don't encode it (which is fine as the requirements explicitly allowed it)
- '%2F' => '/',
- );
-
- protected $routes;
- protected $cache;
-
- /**
- * Constructor.
- *
- * @param RouteCollection $routes A RouteCollection instance
- * @param RequestContext $context The context
- *
- * @api
- */
- public function __construct(RouteCollection $routes, RequestContext $context)
- {
- $this->routes = $routes;
- $this->context = $context;
- $this->cache = array();
- }
-
- /**
- * Sets the request context.
- *
- * @param RequestContext $context The context
- *
- * @api
- */
- public function setContext(RequestContext $context)
- {
- $this->context = $context;
- }
-
- /**
- * Gets the request context.
- *
- * @return RequestContext The context
- */
- public function getContext()
- {
- return $this->context;
- }
-
- /**
- * Generates a URL from the given parameters.
- *
- * @param string $name The name of the route
- * @param mixed $parameters An array of parameters
- * @param Boolean $absolute Whether to generate an absolute URL
- *
- * @return string The generated URL
- *
- * @throws Symfony\Component\Routing\Exception\RouteNotFoundException When route doesn't exist
- *
- * @api
- */
- public function generate($name, $parameters = array(), $absolute = false)
- {
- if (null === $route = $this->routes->get($name)) {
- throw new RouteNotFoundException(sprintf('Route "%s" does not exist.', $name));
- }
-
- if (!isset($this->cache[$name])) {
- $this->cache[$name] = $route->compile();
- }
-
- return $this->doGenerate($this->cache[$name]->getVariables(), $route->getDefaults(), $route->getRequirements(), $this->cache[$name]->getTokens(), $parameters, $name, $absolute);
- }
-
- /**
- * @throws Symfony\Component\Routing\Exception\MissingMandatoryParametersException When route has some missing mandatory parameters
- * @throws Symfony\Component\Routing\Exception\InvalidParameterException When a parameter value is not correct
- */
- protected function doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $absolute)
- {
- $variables = array_flip($variables);
-
- $originParameters = $parameters;
- $parameters = array_replace($this->context->getParameters(), $parameters);
- $tparams = array_replace($defaults, $parameters);
-
- // all params must be given
- if ($diff = array_diff_key($variables, $tparams)) {
- throw new MissingMandatoryParametersException(sprintf('The "%s" route has some missing mandatory parameters ("%s").', $name, implode('", "', array_keys($diff))));
- }
-
- $url = '';
- $optional = true;
- foreach ($tokens as $token) {
- if ('variable' === $token[0]) {
- if (false === $optional || !array_key_exists($token[3], $defaults) || (isset($parameters[$token[3]]) && (string) $parameters[$token[3]] != (string) $defaults[$token[3]])) {
- if (!$isEmpty = in_array($tparams[$token[3]], array(null, '', false), true)) {
- // check requirement
- if ($tparams[$token[3]] && !preg_match('#^'.$token[2].'$#', $tparams[$token[3]])) {
- throw new InvalidParameterException(sprintf('Parameter "%s" for route "%s" must match "%s" ("%s" given).', $token[3], $name, $token[2], $tparams[$token[3]]));
- }
- }
-
- if (!$isEmpty || !$optional) {
- $url = $token[1].strtr(rawurlencode($tparams[$token[3]]), $this->decodedChars).$url;
- }
-
- $optional = false;
- }
- } elseif ('text' === $token[0]) {
- $url = $token[1].$url;
- $optional = false;
- }
- }
-
- if (!$url) {
- $url = '/';
- }
-
- // add a query string if needed
- $extra = array_diff_key($originParameters, $variables, $defaults);
- if ($extra && $query = http_build_query($extra, '', '&')) {
- $url .= '?'.$query;
- }
-
- $url = $this->context->getBaseUrl().$url;
-
- if ($this->context->getHost()) {
- $scheme = $this->context->getScheme();
- if (isset($requirements['_scheme']) && ($req = strtolower($requirements['_scheme'])) && $scheme != $req) {
- $absolute = true;
- $scheme = $req;
- }
-
- if ($absolute) {
- $port = '';
- if ('http' === $scheme && 80 != $this->context->getHttpPort()) {
- $port = ':'.$this->context->getHttpPort();
- } elseif ('https' === $scheme && 443 != $this->context->getHttpsPort()) {
- $port = ':'.$this->context->getHttpsPort();
- }
-
- $url = $scheme.'://'.$this->context->getHost().$port.$url;
- }
- }
-
- return $url;
- }
-}
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/Generator/UrlGeneratorInterface.php b/3rdparty/symfony/routing/Symfony/Component/Routing/Generator/UrlGeneratorInterface.php
deleted file mode 100644
index 6f2800c27c1..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/Generator/UrlGeneratorInterface.php
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing\Generator;
-
-use Symfony\Component\Routing\RequestContextAwareInterface;
-
-/**
- * UrlGeneratorInterface is the interface that all URL generator classes must implements.
- *
- * @author Fabien Potencier <fabien@symfony.com>
- *
- * @api
- */
-interface UrlGeneratorInterface extends RequestContextAwareInterface
-{
- /**
- * Generates a URL from the given parameters.
- *
- * @param string $name The name of the route
- * @param mixed $parameters An array of parameters
- * @param Boolean $absolute Whether to generate an absolute URL
- *
- * @return string The generated URL
- *
- * @api
- */
- public function generate($name, $parameters = array(), $absolute = false);
-}
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/LICENSE b/3rdparty/symfony/routing/Symfony/Component/Routing/LICENSE
deleted file mode 100644
index cdffe7aebc0..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/LICENSE
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (c) 2004-2012 Fabien Potencier
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is furnished
-to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/Loader/AnnotationClassLoader.php b/3rdparty/symfony/routing/Symfony/Component/Routing/Loader/AnnotationClassLoader.php
deleted file mode 100644
index 5f292d4589e..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/Loader/AnnotationClassLoader.php
+++ /dev/null
@@ -1,213 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing\Loader;
-
-use Doctrine\Common\Annotations\Reader;
-use Symfony\Component\Config\Resource\FileResource;
-use Symfony\Component\Routing\Route;
-use Symfony\Component\Routing\RouteCollection;
-use Symfony\Component\Config\Loader\LoaderInterface;
-use Symfony\Component\Config\Loader\LoaderResolver;
-
-/**
- * AnnotationClassLoader loads routing information from a PHP class and its methods.
- *
- * You need to define an implementation for the getRouteDefaults() method. Most of the
- * time, this method should define some PHP callable to be called for the route
- * (a controller in MVC speak).
- *
- * The @Route annotation can be set on the class (for global parameters),
- * and on each method.
- *
- * The @Route annotation main value is the route pattern. The annotation also
- * recognizes three parameters: requirements, options, and name. The name parameter
- * is mandatory. Here is an example of how you should be able to use it:
- *
- * /**
- * * @Route("/Blog")
- * * /
- * class Blog
- * {
- * /**
- * * @Route("/", name="blog_index")
- * * /
- * public function index()
- * {
- * }
- *
- * /**
- * * @Route("/{id}", name="blog_post", requirements = {"id" = "\d+"})
- * * /
- * public function show()
- * {
- * }
- * }
- *
- * @author Fabien Potencier <fabien@symfony.com>
- */
-abstract class AnnotationClassLoader implements LoaderInterface
-{
- protected $reader;
- protected $routeAnnotationClass = 'Symfony\\Component\\Routing\\Annotation\\Route';
- protected $defaultRouteIndex;
-
- /**
- * Constructor.
- *
- * @param Reader $reader
- */
- public function __construct(Reader $reader)
- {
- $this->reader = $reader;
- }
-
- /**
- * Sets the annotation class to read route properties from.
- *
- * @param string $class A fully-qualified class name
- */
- public function setRouteAnnotationClass($class)
- {
- $this->routeAnnotationClass = $class;
- }
-
- /**
- * Loads from annotations from a class.
- *
- * @param string $class A class name
- * @param string $type The resource type
- *
- * @return RouteCollection A RouteCollection instance
- *
- * @throws \InvalidArgumentException When route can't be parsed
- */
- public function load($class, $type = null)
- {
- if (!class_exists($class)) {
- throw new \InvalidArgumentException(sprintf('Class "%s" does not exist.', $class));
- }
-
- $globals = array(
- 'pattern' => '',
- 'requirements' => array(),
- 'options' => array(),
- 'defaults' => array(),
- );
-
- $class = new \ReflectionClass($class);
- if ($class->isAbstract()) {
- throw new \InvalidArgumentException(sprintf('Annotations from class "%s" cannot be read as it is abstract.', $class));
- }
-
- if ($annot = $this->reader->getClassAnnotation($class, $this->routeAnnotationClass)) {
- if (null !== $annot->getPattern()) {
- $globals['pattern'] = $annot->getPattern();
- }
-
- if (null !== $annot->getRequirements()) {
- $globals['requirements'] = $annot->getRequirements();
- }
-
- if (null !== $annot->getOptions()) {
- $globals['options'] = $annot->getOptions();
- }
-
- if (null !== $annot->getDefaults()) {
- $globals['defaults'] = $annot->getDefaults();
- }
- }
-
- $collection = new RouteCollection();
- $collection->addResource(new FileResource($class->getFileName()));
-
- foreach ($class->getMethods() as $method) {
- $this->defaultRouteIndex = 0;
- foreach ($this->reader->getMethodAnnotations($method) as $annot) {
- if ($annot instanceof $this->routeAnnotationClass) {
- $this->addRoute($collection, $annot, $globals, $class, $method);
- }
- }
- }
-
- return $collection;
- }
-
- protected function addRoute(RouteCollection $collection, $annot, $globals, \ReflectionClass $class, \ReflectionMethod $method)
- {
- $name = $annot->getName();
- if (null === $name) {
- $name = $this->getDefaultRouteName($class, $method);
- }
-
- $defaults = array_merge($globals['defaults'], $annot->getDefaults());
- $requirements = array_merge($globals['requirements'], $annot->getRequirements());
- $options = array_merge($globals['options'], $annot->getOptions());
-
- $route = new Route($globals['pattern'].$annot->getPattern(), $defaults, $requirements, $options);
-
- $this->configureRoute($route, $class, $method, $annot);
-
- $collection->add($name, $route);
- }
-
- /**
- * Returns true if this class supports the given resource.
- *
- * @param mixed $resource A resource
- * @param string $type The resource type
- *
- * @return Boolean True if this class supports the given resource, false otherwise
- */
- public function supports($resource, $type = null)
- {
- return is_string($resource) && preg_match('/^(?:\\\\?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)+$/', $resource) && (!$type || 'annotation' === $type);
- }
-
- /**
- * Sets the loader resolver.
- *
- * @param LoaderResolver $resolver A LoaderResolver instance
- */
- public function setResolver(LoaderResolver $resolver)
- {
- }
-
- /**
- * Gets the loader resolver.
- *
- * @return LoaderResolver A LoaderResolver instance
- */
- public function getResolver()
- {
- }
-
- /**
- * Gets the default route name for a class method.
- *
- * @param \ReflectionClass $class
- * @param \ReflectionMethod $method
- *
- * @return string
- */
- protected function getDefaultRouteName(\ReflectionClass $class, \ReflectionMethod $method)
- {
- $name = strtolower(str_replace('\\', '_', $class->name).'_'.$method->name);
- if ($this->defaultRouteIndex > 0) {
- $name .= '_'.$this->defaultRouteIndex;
- }
- $this->defaultRouteIndex++;
-
- return $name;
- }
-
- abstract protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, $annot);
-}
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/Loader/AnnotationDirectoryLoader.php b/3rdparty/symfony/routing/Symfony/Component/Routing/Loader/AnnotationDirectoryLoader.php
deleted file mode 100644
index 8097cd67f96..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/Loader/AnnotationDirectoryLoader.php
+++ /dev/null
@@ -1,77 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing\Loader;
-
-use Symfony\Component\Routing\RouteCollection;
-use Symfony\Component\Config\Resource\DirectoryResource;
-
-/**
- * AnnotationDirectoryLoader loads routing information from annotations set
- * on PHP classes and methods.
- *
- * @author Fabien Potencier <fabien@symfony.com>
- */
-class AnnotationDirectoryLoader extends AnnotationFileLoader
-{
- /**
- * Loads from annotations from a directory.
- *
- * @param string $path A directory path
- * @param string $type The resource type
- *
- * @return RouteCollection A RouteCollection instance
- *
- * @throws \InvalidArgumentException When the directory does not exist or its routes cannot be parsed
- */
- public function load($path, $type = null)
- {
- $dir = $this->locator->locate($path);
-
- $collection = new RouteCollection();
- $collection->addResource(new DirectoryResource($dir, '/\.php$/'));
- foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dir), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) {
- if (!$file->isFile() || '.php' !== substr($file->getFilename(), -4)) {
- continue;
- }
-
- if ($class = $this->findClass($file)) {
- $refl = new \ReflectionClass($class);
- if ($refl->isAbstract()) {
- continue;
- }
-
- $collection->addCollection($this->loader->load($class, $type));
- }
- }
-
- return $collection;
- }
-
- /**
- * Returns true if this class supports the given resource.
- *
- * @param mixed $resource A resource
- * @param string $type The resource type
- *
- * @return Boolean True if this class supports the given resource, false otherwise
- */
- public function supports($resource, $type = null)
- {
- try {
- $path = $this->locator->locate($resource);
- } catch (\Exception $e) {
- return false;
- }
-
- return is_string($resource) && is_dir($path) && (!$type || 'annotation' === $type);
- }
-}
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/Loader/AnnotationFileLoader.php b/3rdparty/symfony/routing/Symfony/Component/Routing/Loader/AnnotationFileLoader.php
deleted file mode 100644
index 49e1cb2f775..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/Loader/AnnotationFileLoader.php
+++ /dev/null
@@ -1,125 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing\Loader;
-
-use Symfony\Component\Routing\RouteCollection;
-use Symfony\Component\Config\Resource\FileResource;
-use Symfony\Component\Config\Loader\FileLoader;
-use Symfony\Component\Config\FileLocator;
-
-/**
- * AnnotationFileLoader loads routing information from annotations set
- * on a PHP class and its methods.
- *
- * @author Fabien Potencier <fabien@symfony.com>
- */
-class AnnotationFileLoader extends FileLoader
-{
- protected $loader;
-
- /**
- * Constructor.
- *
- * @param FileLocator $locator A FileLocator instance
- * @param AnnotationClassLoader $loader An AnnotationClassLoader instance
- * @param string|array $paths A path or an array of paths where to look for resources
- */
- public function __construct(FileLocator $locator, AnnotationClassLoader $loader, $paths = array())
- {
- if (!function_exists('token_get_all')) {
- throw new \RuntimeException('The Tokenizer extension is required for the routing annotation loaders.');
- }
-
- parent::__construct($locator, $paths);
-
- $this->loader = $loader;
- }
-
- /**
- * Loads from annotations from a file.
- *
- * @param string $file A PHP file path
- * @param string $type The resource type
- *
- * @return RouteCollection A RouteCollection instance
- *
- * @throws \InvalidArgumentException When the file does not exist or its routes cannot be parsed
- */
- public function load($file, $type = null)
- {
- $path = $this->locator->locate($file);
-
- $collection = new RouteCollection();
- if ($class = $this->findClass($path)) {
- $collection->addResource(new FileResource($path));
- $collection->addCollection($this->loader->load($class, $type));
- }
-
- return $collection;
- }
-
- /**
- * Returns true if this class supports the given resource.
- *
- * @param mixed $resource A resource
- * @param string $type The resource type
- *
- * @return Boolean True if this class supports the given resource, false otherwise
- */
- public function supports($resource, $type = null)
- {
- return is_string($resource) && 'php' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'annotation' === $type);
- }
-
- /**
- * Returns the full class name for the first class in the file.
- *
- * @param string $file A PHP file path
- *
- * @return string|false Full class name if found, false otherwise
- */
- protected function findClass($file)
- {
- $class = false;
- $namespace = false;
- $tokens = token_get_all(file_get_contents($file));
- for ($i = 0, $count = count($tokens); $i < $count; $i++) {
- $token = $tokens[$i];
-
- if (!is_array($token)) {
- continue;
- }
-
- if (true === $class && T_STRING === $token[0]) {
- return $namespace.'\\'.$token[1];
- }
-
- if (true === $namespace && T_STRING === $token[0]) {
- $namespace = '';
- do {
- $namespace .= $token[1];
- $token = $tokens[++$i];
- } while ($i < $count && is_array($token) && in_array($token[0], array(T_NS_SEPARATOR, T_STRING)));
- }
-
- if (T_CLASS === $token[0]) {
- $class = true;
- }
-
- if (T_NAMESPACE === $token[0]) {
- $namespace = true;
- }
- }
-
- return false;
- }
-}
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/Loader/ClosureLoader.php b/3rdparty/symfony/routing/Symfony/Component/Routing/Loader/ClosureLoader.php
deleted file mode 100644
index ca49c8fa35a..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/Loader/ClosureLoader.php
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing\Loader;
-
-use Symfony\Component\Config\Loader\Loader;
-
-/**
- * ClosureLoader loads routes from a PHP closure.
- *
- * The Closure must return a RouteCollection instance.
- *
- * @author Fabien Potencier <fabien@symfony.com>
- *
- * @api
- */
-class ClosureLoader extends Loader
-{
- /**
- * Loads a Closure.
- *
- * @param \Closure $closure A Closure
- * @param string $type The resource type
- *
- * @api
- */
- public function load($closure, $type = null)
- {
- return call_user_func($closure);
- }
-
- /**
- * Returns true if this class supports the given resource.
- *
- * @param mixed $resource A resource
- * @param string $type The resource type
- *
- * @return Boolean True if this class supports the given resource, false otherwise
- *
- * @api
- */
- public function supports($resource, $type = null)
- {
- return $resource instanceof \Closure && (!$type || 'closure' === $type);
- }
-}
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/Loader/PhpFileLoader.php b/3rdparty/symfony/routing/Symfony/Component/Routing/Loader/PhpFileLoader.php
deleted file mode 100644
index ffd31f94442..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/Loader/PhpFileLoader.php
+++ /dev/null
@@ -1,64 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing\Loader;
-
-use Symfony\Component\Config\Resource\FileResource;
-use Symfony\Component\Config\Loader\FileLoader;
-
-/**
- * PhpFileLoader loads routes from a PHP file.
- *
- * The file must return a RouteCollection instance.
- *
- * @author Fabien Potencier <fabien@symfony.com>
- *
- * @api
- */
-class PhpFileLoader extends FileLoader
-{
- /**
- * Loads a PHP file.
- *
- * @param mixed $file A PHP file path
- * @param string $type The resource type
- *
- * @api
- */
- public function load($file, $type = null)
- {
- // the loader variable is exposed to the included file below
- $loader = $this;
-
- $path = $this->locator->locate($file);
- $this->setCurrentDir(dirname($path));
-
- $collection = include $path;
- $collection->addResource(new FileResource($path));
-
- return $collection;
- }
-
- /**
- * Returns true if this class supports the given resource.
- *
- * @param mixed $resource A resource
- * @param string $type The resource type
- *
- * @return Boolean True if this class supports the given resource, false otherwise
- *
- * @api
- */
- public function supports($resource, $type = null)
- {
- return is_string($resource) && 'php' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'php' === $type);
- }
-}
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/Loader/XmlFileLoader.php b/3rdparty/symfony/routing/Symfony/Component/Routing/Loader/XmlFileLoader.php
deleted file mode 100644
index 5dad9db3fae..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/Loader/XmlFileLoader.php
+++ /dev/null
@@ -1,224 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing\Loader;
-
-use Symfony\Component\Routing\RouteCollection;
-use Symfony\Component\Routing\Route;
-use Symfony\Component\Config\Resource\FileResource;
-use Symfony\Component\Config\Loader\FileLoader;
-
-/**
- * XmlFileLoader loads XML routing files.
- *
- * @author Fabien Potencier <fabien@symfony.com>
- *
- * @api
- */
-class XmlFileLoader extends FileLoader
-{
- /**
- * Loads an XML file.
- *
- * @param string $file An XML file path
- * @param string $type The resource type
- *
- * @return RouteCollection A RouteCollection instance
- *
- * @throws \InvalidArgumentException When a tag can't be parsed
- *
- * @api
- */
- public function load($file, $type = null)
- {
- $path = $this->locator->locate($file);
-
- $xml = $this->loadFile($path);
-
- $collection = new RouteCollection();
- $collection->addResource(new FileResource($path));
-
- // process routes and imports
- foreach ($xml->documentElement->childNodes as $node) {
- if (!$node instanceof \DOMElement) {
- continue;
- }
-
- $this->parseNode($collection, $node, $path, $file);
- }
-
- return $collection;
- }
-
- /**
- * Parses a node from a loaded XML file.
- *
- * @param RouteCollection $collection the collection to associate with the node
- * @param DOMElement $node the node to parse
- * @param string $path the path of the XML file being processed
- * @param string $file
- */
- protected function parseNode(RouteCollection $collection, \DOMElement $node, $path, $file)
- {
- switch ($node->tagName) {
- case 'route':
- $this->parseRoute($collection, $node, $path);
- break;
- case 'import':
- $resource = (string) $node->getAttribute('resource');
- $type = (string) $node->getAttribute('type');
- $prefix = (string) $node->getAttribute('prefix');
- $this->setCurrentDir(dirname($path));
- $collection->addCollection($this->import($resource, ('' !== $type ? $type : null), false, $file), $prefix);
- break;
- default:
- throw new \InvalidArgumentException(sprintf('Unable to parse tag "%s"', $node->tagName));
- }
- }
-
- /**
- * Returns true if this class supports the given resource.
- *
- * @param mixed $resource A resource
- * @param string $type The resource type
- *
- * @return Boolean True if this class supports the given resource, false otherwise
- *
- * @api
- */
- public function supports($resource, $type = null)
- {
- return is_string($resource) && 'xml' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'xml' === $type);
- }
-
- /**
- * Parses a route and adds it to the RouteCollection.
- *
- * @param RouteCollection $collection A RouteCollection instance
- * @param \DOMElement $definition Route definition
- * @param string $file An XML file path
- *
- * @throws \InvalidArgumentException When the definition cannot be parsed
- */
- protected function parseRoute(RouteCollection $collection, \DOMElement $definition, $file)
- {
- $defaults = array();
- $requirements = array();
- $options = array();
-
- foreach ($definition->childNodes as $node) {
- if (!$node instanceof \DOMElement) {
- continue;
- }
-
- switch ($node->tagName) {
- case 'default':
- $defaults[(string) $node->getAttribute('key')] = trim((string) $node->nodeValue);
- break;
- case 'option':
- $options[(string) $node->getAttribute('key')] = trim((string) $node->nodeValue);
- break;
- case 'requirement':
- $requirements[(string) $node->getAttribute('key')] = trim((string) $node->nodeValue);
- break;
- default:
- throw new \InvalidArgumentException(sprintf('Unable to parse tag "%s"', $node->tagName));
- }
- }
-
- $route = new Route((string) $definition->getAttribute('pattern'), $defaults, $requirements, $options);
-
- $collection->add((string) $definition->getAttribute('id'), $route);
- }
-
- /**
- * Loads an XML file.
- *
- * @param string $file An XML file path
- *
- * @return \DOMDocument
- *
- * @throws \InvalidArgumentException When loading of XML file returns error
- */
- protected function loadFile($file)
- {
- $internalErrors = libxml_use_internal_errors(true);
- $disableEntities = libxml_disable_entity_loader(true);
- libxml_clear_errors();
-
- $dom = new \DOMDocument();
- $dom->validateOnParse = true;
- if (!$dom->loadXML(file_get_contents($file), LIBXML_NONET | (defined('LIBXML_COMPACT') ? LIBXML_COMPACT : 0))) {
- libxml_disable_entity_loader($disableEntities);
-
- throw new \InvalidArgumentException(implode("\n", $this->getXmlErrors($internalErrors)));
- }
- $dom->normalizeDocument();
-
- libxml_use_internal_errors($internalErrors);
- libxml_disable_entity_loader($disableEntities);
-
- foreach ($dom->childNodes as $child) {
- if ($child->nodeType === XML_DOCUMENT_TYPE_NODE) {
- throw new \InvalidArgumentException('Document types are not allowed.');
- }
- }
-
- $this->validate($dom);
-
- return $dom;
- }
-
- /**
- * Validates a loaded XML file.
- *
- * @param \DOMDocument $dom A loaded XML file
- *
- * @throws \InvalidArgumentException When XML doesn't validate its XSD schema
- */
- protected function validate(\DOMDocument $dom)
- {
- $location = __DIR__.'/schema/routing/routing-1.0.xsd';
-
- $current = libxml_use_internal_errors(true);
- libxml_clear_errors();
-
- if (!$dom->schemaValidate($location)) {
- throw new \InvalidArgumentException(implode("\n", $this->getXmlErrors($current)));
- }
- libxml_use_internal_errors($current);
- }
-
- /**
- * Retrieves libxml errors and clears them.
- *
- * @return array An array of libxml error strings
- */
- private function getXmlErrors($internalErrors)
- {
- $errors = array();
- foreach (libxml_get_errors() as $error) {
- $errors[] = sprintf('[%s %s] %s (in %s - line %d, column %d)',
- LIBXML_ERR_WARNING == $error->level ? 'WARNING' : 'ERROR',
- $error->code,
- trim($error->message),
- $error->file ? $error->file : 'n/a',
- $error->line,
- $error->column
- );
- }
-
- libxml_clear_errors();
- libxml_use_internal_errors($internalErrors);
-
- return $errors;
- }
-}
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/Loader/YamlFileLoader.php b/3rdparty/symfony/routing/Symfony/Component/Routing/Loader/YamlFileLoader.php
deleted file mode 100644
index ee723834355..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/Loader/YamlFileLoader.php
+++ /dev/null
@@ -1,142 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing\Loader;
-
-use Symfony\Component\Routing\RouteCollection;
-use Symfony\Component\Routing\Route;
-use Symfony\Component\Config\Resource\FileResource;
-use Symfony\Component\Yaml\Yaml;
-use Symfony\Component\Config\Loader\FileLoader;
-
-/**
- * YamlFileLoader loads Yaml routing files.
- *
- * @author Fabien Potencier <fabien@symfony.com>
- *
- * @api
- */
-class YamlFileLoader extends FileLoader
-{
- private static $availableKeys = array(
- 'type', 'resource', 'prefix', 'pattern', 'options', 'defaults', 'requirements'
- );
-
- /**
- * Loads a Yaml file.
- *
- * @param string $file A Yaml file path
- * @param string $type The resource type
- *
- * @return RouteCollection A RouteCollection instance
- *
- * @throws \InvalidArgumentException When route can't be parsed
- *
- * @api
- */
- public function load($file, $type = null)
- {
- $path = $this->locator->locate($file);
-
- $config = Yaml::parse($path);
-
- $collection = new RouteCollection();
- $collection->addResource(new FileResource($path));
-
- // empty file
- if (null === $config) {
- $config = array();
- }
-
- // not an array
- if (!is_array($config)) {
- throw new \InvalidArgumentException(sprintf('The file "%s" must contain a YAML array.', $file));
- }
-
- foreach ($config as $name => $config) {
- $config = $this->normalizeRouteConfig($config);
-
- if (isset($config['resource'])) {
- $type = isset($config['type']) ? $config['type'] : null;
- $prefix = isset($config['prefix']) ? $config['prefix'] : null;
- $this->setCurrentDir(dirname($path));
- $collection->addCollection($this->import($config['resource'], $type, false, $file), $prefix);
- } else {
- $this->parseRoute($collection, $name, $config, $path);
- }
- }
-
- return $collection;
- }
-
- /**
- * Returns true if this class supports the given resource.
- *
- * @param mixed $resource A resource
- * @param string $type The resource type
- *
- * @return Boolean True if this class supports the given resource, false otherwise
- *
- * @api
- */
- public function supports($resource, $type = null)
- {
- return is_string($resource) && 'yml' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'yaml' === $type);
- }
-
- /**
- * Parses a route and adds it to the RouteCollection.
- *
- * @param RouteCollection $collection A RouteCollection instance
- * @param string $name Route name
- * @param array $config Route definition
- * @param string $file A Yaml file path
- *
- * @throws \InvalidArgumentException When config pattern is not defined for the given route
- */
- protected function parseRoute(RouteCollection $collection, $name, $config, $file)
- {
- $defaults = isset($config['defaults']) ? $config['defaults'] : array();
- $requirements = isset($config['requirements']) ? $config['requirements'] : array();
- $options = isset($config['options']) ? $config['options'] : array();
-
- if (!isset($config['pattern'])) {
- throw new \InvalidArgumentException(sprintf('You must define a "pattern" for the "%s" route.', $name));
- }
-
- $route = new Route($config['pattern'], $defaults, $requirements, $options);
-
- $collection->add($name, $route);
- }
-
- /**
- * Normalize route configuration.
- *
- * @param array $config A resource config
- *
- * @return array
- *
- * @throws InvalidArgumentException if one of the provided config keys is not supported
- */
- private function normalizeRouteConfig(array $config)
- {
- foreach ($config as $key => $value) {
- if (!in_array($key, self::$availableKeys)) {
- throw new \InvalidArgumentException(sprintf(
- 'Yaml routing loader does not support given key: "%s". Expected one of the (%s).',
- $key, implode(', ', self::$availableKeys)
- ));
- }
- }
-
- return $config;
- }
-}
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/Loader/schema/routing/routing-1.0.xsd b/3rdparty/symfony/routing/Symfony/Component/Routing/Loader/schema/routing/routing-1.0.xsd
deleted file mode 100644
index a9554e64df3..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/Loader/schema/routing/routing-1.0.xsd
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<xsd:schema xmlns="http://symfony.com/schema/routing"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://symfony.com/schema/routing"
- elementFormDefault="qualified">
-
- <xsd:element name="routes" type="routes" />
-
- <xsd:complexType name="routes">
- <xsd:choice maxOccurs="unbounded" minOccurs="0">
- <xsd:element name="import" type="import" />
- <xsd:element name="route" type="route" />
- </xsd:choice>
- </xsd:complexType>
-
- <xsd:complexType name="route">
- <xsd:sequence>
- <xsd:element name="default" type="element" minOccurs="0" maxOccurs="unbounded" />
- <xsd:element name="requirement" type="element" minOccurs="0" maxOccurs="unbounded" />
- <xsd:element name="option" type="element" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
-
- <xsd:attribute name="id" type="xsd:string" />
- <xsd:attribute name="pattern" type="xsd:string" />
- </xsd:complexType>
-
- <xsd:complexType name="import">
- <xsd:attribute name="resource" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="prefix" type="xsd:string" />
- <xsd:attribute name="class" type="xsd:string" />
- </xsd:complexType>
-
- <xsd:complexType name="element" mixed="true">
- <xsd:attribute name="key" type="xsd:string" />
- </xsd:complexType>
-</xsd:schema>
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/Matcher/ApacheUrlMatcher.php b/3rdparty/symfony/routing/Symfony/Component/Routing/Matcher/ApacheUrlMatcher.php
deleted file mode 100644
index 3003dfdebb0..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/Matcher/ApacheUrlMatcher.php
+++ /dev/null
@@ -1,76 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing\Matcher;
-
-use Symfony\Component\Routing\Exception\MethodNotAllowedException;
-
-/**
- * ApacheUrlMatcher matches URL based on Apache mod_rewrite matching (see ApacheMatcherDumper).
- *
- * @author Fabien Potencier <fabien@symfony.com>
- */
-class ApacheUrlMatcher extends UrlMatcher
-{
- /**
- * Tries to match a URL based on Apache mod_rewrite matching.
- *
- * Returns false if no route matches the URL.
- *
- * @param string $pathinfo The pathinfo to be parsed
- *
- * @return array An array of parameters
- *
- * @throws MethodNotAllowedException If the current method is not allowed
- */
- public function match($pathinfo)
- {
- $parameters = array();
- $defaults = array();
- $allow = array();
- $match = false;
-
- foreach ($_SERVER as $key => $value) {
- $name = $key;
-
- if (0 === strpos($name, 'REDIRECT_')) {
- $name = substr($name, 9);
- }
-
- if (0 === strpos($name, '_ROUTING_DEFAULTS_')) {
- $name = substr($name, 18);
- $defaults[$name] = $value;
- } elseif (0 === strpos($name, '_ROUTING_')) {
- $name = substr($name, 9);
- if ('_route' == $name) {
- $match = true;
- $parameters[$name] = $value;
- } elseif (0 === strpos($name, '_allow_')) {
- $allow[] = substr($name, 7);
- } else {
- $parameters[$name] = $value;
- }
- } else {
- continue;
- }
-
- unset($_SERVER[$key]);
- }
-
- if ($match) {
- return $this->mergeDefaults($parameters, $defaults);
- } elseif (0 < count($allow)) {
- throw new MethodNotAllowedException($allow);
- } else {
- return parent::match($pathinfo);
- }
- }
-}
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php b/3rdparty/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php
deleted file mode 100644
index 4f03b8d393b..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php
+++ /dev/null
@@ -1,155 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing\Matcher\Dumper;
-
-/**
- * Dumps a set of Apache mod_rewrite rules.
- *
- * @author Fabien Potencier <fabien@symfony.com>
- * @author Kris Wallsmith <kris@symfony.com>
- */
-class ApacheMatcherDumper extends MatcherDumper
-{
- /**
- * Dumps a set of Apache mod_rewrite rules.
- *
- * Available options:
- *
- * * script_name: The script name (app.php by default)
- * * base_uri: The base URI ("" by default)
- *
- * @param array $options An array of options
- *
- * @return string A string to be used as Apache rewrite rules
- *
- * @throws \LogicException When the route regex is invalid
- */
- public function dump(array $options = array())
- {
- $options = array_merge(array(
- 'script_name' => 'app.php',
- 'base_uri' => '',
- ), $options);
-
- $options['script_name'] = self::escape($options['script_name'], ' ', '\\');
-
- $rules = array("# skip \"real\" requests\nRewriteCond %{REQUEST_FILENAME} -f\nRewriteRule .* - [QSA,L]");
- $methodVars = array();
-
- foreach ($this->getRoutes()->all() as $name => $route) {
- $compiledRoute = $route->compile();
-
- // prepare the apache regex
- $regex = $compiledRoute->getRegex();
- $delimiter = $regex[0];
- $regexPatternEnd = strrpos($regex, $delimiter);
- if (strlen($regex) < 2 || 0 === $regexPatternEnd) {
- throw new \LogicException('The "%s" route regex "%s" is invalid', $name, $regex);
- }
- $regex = preg_replace('/\?P<.+?>/', '', substr($regex, 1, $regexPatternEnd - 1));
- $regex = '^'.self::escape(preg_quote($options['base_uri']).substr($regex, 1), ' ', '\\');
-
- $hasTrailingSlash = '/$' == substr($regex, -2) && '^/$' != $regex;
-
- $variables = array('E=_ROUTING__route:'.$name);
- foreach ($compiledRoute->getVariables() as $i => $variable) {
- $variables[] = 'E=_ROUTING_'.$variable.':%'.($i + 1);
- }
- foreach ($route->getDefaults() as $key => $value) {
- $variables[] = 'E=_ROUTING_DEFAULTS_'.$key.':'.strtr($value, array(
- ':' => '\\:',
- '=' => '\\=',
- '\\' => '\\\\',
- ' ' => '\\ ',
- ));
- }
- $variables = implode(',', $variables);
-
- $rule = array("# $name");
-
- // method mismatch
- if ($req = $route->getRequirement('_method')) {
- $methods = explode('|', strtoupper($req));
- // GET and HEAD are equivalent
- if (in_array('GET', $methods) && !in_array('HEAD', $methods)) {
- $methods[] = 'HEAD';
- }
- $allow = array();
- foreach ($methods as $method) {
- $methodVars[] = $method;
- $allow[] = 'E=_ROUTING__allow_'.$method.':1';
- }
-
- $rule[] = "RewriteCond %{REQUEST_URI} $regex";
- $rule[] = sprintf("RewriteCond %%{REQUEST_METHOD} !^(%s)$ [NC]", implode('|', $methods));
- $rule[] = sprintf('RewriteRule .* - [S=%d,%s]', $hasTrailingSlash ? 2 : 1, implode(',', $allow));
- }
-
- // redirect with trailing slash appended
- if ($hasTrailingSlash) {
- $rule[] = 'RewriteCond %{REQUEST_URI} '.substr($regex, 0, -2).'$';
- $rule[] = 'RewriteRule .* $0/ [QSA,L,R=301]';
- }
-
- // the main rule
- $rule[] = "RewriteCond %{REQUEST_URI} $regex";
- $rule[] = "RewriteRule .* {$options['script_name']} [QSA,L,$variables]";
-
- $rules[] = implode("\n", $rule);
- }
-
- if (0 < count($methodVars)) {
- $rule = array('# 405 Method Not Allowed');
- $methodVars = array_values(array_unique($methodVars));
- foreach ($methodVars as $i => $methodVar) {
- $rule[] = sprintf('RewriteCond %%{_ROUTING__allow_%s} !-z%s', $methodVar, isset($methodVars[$i + 1]) ? ' [OR]' : '');
- }
- $rule[] = sprintf('RewriteRule .* %s [QSA,L]', $options['script_name']);
-
- $rules[] = implode("\n", $rule);
- }
-
- return implode("\n\n", $rules)."\n";
- }
-
- /**
- * Escapes a string.
- *
- * @param string $string The string to be escaped
- * @param string $char The character to be escaped
- * @param string $with The character to be used for escaping
- *
- * @return string The escaped string
- */
- private static function escape($string, $char, $with)
- {
- $escaped = false;
- $output = '';
- foreach (str_split($string) as $symbol) {
- if ($escaped) {
- $output .= $symbol;
- $escaped = false;
- continue;
- }
- if ($symbol === $char) {
- $output .= $with.$char;
- continue;
- }
- if ($symbol === $with) {
- $escaped = true;
- }
- $output .= $symbol;
- }
-
- return $output;
- }
-}
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/MatcherDumper.php b/3rdparty/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/MatcherDumper.php
deleted file mode 100644
index 423368b57ed..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/MatcherDumper.php
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing\Matcher\Dumper;
-
-use Symfony\Component\Routing\RouteCollection;
-
-/**
- * MatcherDumper is the abstract class for all built-in matcher dumpers.
- *
- * @author Fabien Potencier <fabien@symfony.com>
- */
-abstract class MatcherDumper implements MatcherDumperInterface
-{
- private $routes;
-
- /**
- * Constructor.
- *
- * @param RouteCollection $routes The RouteCollection to dump
- */
- public function __construct(RouteCollection $routes)
- {
- $this->routes = $routes;
- }
-
- /**
- * Gets the routes to dump.
- *
- * @return RouteCollection A RouteCollection instance
- */
- public function getRoutes()
- {
- return $this->routes;
- }
-}
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/MatcherDumperInterface.php b/3rdparty/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/MatcherDumperInterface.php
deleted file mode 100644
index fe09e067d7c..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/MatcherDumperInterface.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing\Matcher\Dumper;
-
-/**
- * MatcherDumperInterface is the interface that all matcher dumper classes must implement.
- *
- * @author Fabien Potencier <fabien@symfony.com>
- */
-interface MatcherDumperInterface
-{
- /**
- * Dumps a set of routes to a PHP class.
- *
- * Available options:
- *
- * * class: The class name
- * * base_class: The base class name
- *
- * @param array $options An array of options
- *
- * @return string A PHP class representing the matcher class
- */
- public function dump(array $options = array());
-
- /**
- * Gets the routes to match.
- *
- * @return RouteCollection A RouteCollection instance
- */
- public function getRoutes();
-}
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php b/3rdparty/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php
deleted file mode 100644
index fdaad513a19..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php
+++ /dev/null
@@ -1,293 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing\Matcher\Dumper;
-
-use Symfony\Component\Routing\Route;
-use Symfony\Component\Routing\RouteCollection;
-
-/**
- * PhpMatcherDumper creates a PHP class able to match URLs for a given set of routes.
- *
- * @author Fabien Potencier <fabien@symfony.com>
- */
-class PhpMatcherDumper extends MatcherDumper
-{
- /**
- * Dumps a set of routes to a PHP class.
- *
- * Available options:
- *
- * * class: The class name
- * * base_class: The base class name
- *
- * @param array $options An array of options
- *
- * @return string A PHP class representing the matcher class
- */
- public function dump(array $options = array())
- {
- $options = array_merge(array(
- 'class' => 'ProjectUrlMatcher',
- 'base_class' => 'Symfony\\Component\\Routing\\Matcher\\UrlMatcher',
- ), $options);
-
- // trailing slash support is only enabled if we know how to redirect the user
- $interfaces = class_implements($options['base_class']);
- $supportsRedirections = isset($interfaces['Symfony\Component\Routing\Matcher\RedirectableUrlMatcherInterface']);
-
- return
- $this->startClass($options['class'], $options['base_class']).
- $this->addConstructor().
- $this->addMatcher($supportsRedirections).
- $this->endClass()
- ;
- }
-
- private function addMatcher($supportsRedirections)
- {
- // we need to deep clone the routes as we will modify the structure to optimize the dump
- $code = implode("\n", $this->compileRoutes(clone $this->getRoutes(), $supportsRedirections));
-
- return <<<EOF
-
- public function match(\$pathinfo)
- {
- \$allow = array();
- \$pathinfo = urldecode(\$pathinfo);
-
-$code
- throw 0 < count(\$allow) ? new MethodNotAllowedException(array_unique(\$allow)) : new ResourceNotFoundException();
- }
-
-EOF;
- }
-
- private function compileRoutes(RouteCollection $routes, $supportsRedirections, $parentPrefix = null)
- {
- $code = array();
-
- $routeIterator = $routes->getIterator();
- $keys = array_keys($routeIterator->getArrayCopy());
- $keysCount = count($keys);
-
- $i = 0;
- foreach ($routeIterator as $name => $route) {
- $i++;
-
- if ($route instanceof RouteCollection) {
- $prefix = $route->getPrefix();
- $optimizable = $prefix && count($route->all()) > 1 && false === strpos($route->getPrefix(), '{');
- $indent = '';
- if ($optimizable) {
- for ($j = $i; $j < $keysCount; $j++) {
- if ($keys[$j] === null) {
- continue;
- }
-
- $testRoute = $routeIterator->offsetGet($keys[$j]);
- $isCollection = ($testRoute instanceof RouteCollection);
-
- $testPrefix = $isCollection ? $testRoute->getPrefix() : $testRoute->getPattern();
-
- if (0 === strpos($testPrefix, $prefix)) {
- $routeIterator->offsetUnset($keys[$j]);
-
- if ($isCollection) {
- $route->addCollection($testRoute);
- } else {
- $route->add($keys[$j], $testRoute);
- }
-
- $i++;
- $keys[$j] = null;
- }
- }
-
- if ($prefix !== $parentPrefix) {
- $code[] = sprintf(" if (0 === strpos(\$pathinfo, %s)) {", var_export($prefix, true));
- $indent = ' ';
- }
- }
-
- foreach ($this->compileRoutes($route, $supportsRedirections, $prefix) as $line) {
- foreach (explode("\n", $line) as $l) {
- if ($l) {
- $code[] = $indent.$l;
- } else {
- $code[] = $l;
- }
- }
- }
-
- if ($optimizable && $prefix !== $parentPrefix) {
- $code[] = " }\n";
- }
- } else {
- foreach ($this->compileRoute($route, $name, $supportsRedirections, $parentPrefix) as $line) {
- $code[] = $line;
- }
- }
- }
-
- return $code;
- }
-
- private function compileRoute(Route $route, $name, $supportsRedirections, $parentPrefix = null)
- {
- $code = array();
- $compiledRoute = $route->compile();
- $conditions = array();
- $hasTrailingSlash = false;
- $matches = false;
- if (!count($compiledRoute->getVariables()) && false !== preg_match('#^(.)\^(?P<url>.*?)\$\1#', $compiledRoute->getRegex(), $m)) {
- if ($supportsRedirections && substr($m['url'], -1) === '/') {
- $conditions[] = sprintf("rtrim(\$pathinfo, '/') === %s", var_export(rtrim(str_replace('\\', '', $m['url']), '/'), true));
- $hasTrailingSlash = true;
- } else {
- $conditions[] = sprintf("\$pathinfo === %s", var_export(str_replace('\\', '', $m['url']), true));
- }
- } else {
- if ($compiledRoute->getStaticPrefix() && $compiledRoute->getStaticPrefix() != $parentPrefix) {
- $conditions[] = sprintf("0 === strpos(\$pathinfo, %s)", var_export($compiledRoute->getStaticPrefix(), true));
- }
-
- $regex = $compiledRoute->getRegex();
- if ($supportsRedirections && $pos = strpos($regex, '/$')) {
- $regex = substr($regex, 0, $pos).'/?$'.substr($regex, $pos + 2);
- $hasTrailingSlash = true;
- }
- $conditions[] = sprintf("preg_match(%s, \$pathinfo, \$matches)", var_export($regex, true));
-
- $matches = true;
- }
-
- $conditions = implode(' && ', $conditions);
-
- $gotoname = 'not_'.preg_replace('/[^A-Za-z0-9_]/', '', $name);
-
- $code[] = <<<EOF
- // $name
- if ($conditions) {
-EOF;
-
- if ($req = $route->getRequirement('_method')) {
- $methods = explode('|', strtoupper($req));
- // GET and HEAD are equivalent
- if (in_array('GET', $methods) && !in_array('HEAD', $methods)) {
- $methods[] = 'HEAD';
- }
- if (1 === count($methods)) {
- $code[] = <<<EOF
- if (\$this->context->getMethod() != '$methods[0]') {
- \$allow[] = '$methods[0]';
- goto $gotoname;
- }
-EOF;
- } else {
- $methods = implode('\', \'', $methods);
- $code[] = <<<EOF
- if (!in_array(\$this->context->getMethod(), array('$methods'))) {
- \$allow = array_merge(\$allow, array('$methods'));
- goto $gotoname;
- }
-EOF;
- }
- }
-
- if ($hasTrailingSlash) {
- $code[] = sprintf(<<<EOF
- if (substr(\$pathinfo, -1) !== '/') {
- return \$this->redirect(\$pathinfo.'/', '%s');
- }
-EOF
- , $name);
- }
-
- if ($scheme = $route->getRequirement('_scheme')) {
- if (!$supportsRedirections) {
- throw new \LogicException('The "_scheme" requirement is only supported for route dumper that implements RedirectableUrlMatcherInterface.');
- }
-
- $code[] = sprintf(<<<EOF
- if (\$this->context->getScheme() !== '$scheme') {
- return \$this->redirect(\$pathinfo, '%s', '$scheme');
- }
-EOF
- , $name);
- }
-
- // optimize parameters array
- if (true === $matches && $compiledRoute->getDefaults()) {
- $code[] = sprintf(" return array_merge(\$this->mergeDefaults(\$matches, %s), array('_route' => '%s'));"
- , str_replace("\n", '', var_export($compiledRoute->getDefaults(), true)), $name);
- } elseif (true === $matches) {
- $code[] = sprintf(" \$matches['_route'] = '%s';", $name);
- $code[] = sprintf(" return \$matches;", $name);
- } elseif ($compiledRoute->getDefaults()) {
- $code[] = sprintf(' return %s;', str_replace("\n", '', var_export(array_merge($compiledRoute->getDefaults(), array('_route' => $name)), true)));
- } else {
- $code[] = sprintf(" return array('_route' => '%s');", $name);
- }
- $code[] = " }";
-
- if ($req) {
- $code[] = " $gotoname:";
- }
-
- $code[] = '';
-
- return $code;
- }
-
- private function startClass($class, $baseClass)
- {
- return <<<EOF
-<?php
-
-use Symfony\Component\Routing\Exception\MethodNotAllowedException;
-use Symfony\Component\Routing\Exception\ResourceNotFoundException;
-use Symfony\Component\Routing\RequestContext;
-
-/**
- * $class
- *
- * This class has been auto-generated
- * by the Symfony Routing Component.
- */
-class $class extends $baseClass
-{
-
-EOF;
- }
-
- private function addConstructor()
- {
- return <<<EOF
- /**
- * Constructor.
- */
- public function __construct(RequestContext \$context)
- {
- \$this->context = \$context;
- }
-
-EOF;
- }
-
- private function endClass()
- {
- return <<<EOF
-}
-
-EOF;
- }
-}
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/Matcher/RedirectableUrlMatcher.php b/3rdparty/symfony/routing/Symfony/Component/Routing/Matcher/RedirectableUrlMatcher.php
deleted file mode 100644
index fcd588073b7..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/Matcher/RedirectableUrlMatcher.php
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing\Matcher;
-
-use Symfony\Component\Routing\Exception\ResourceNotFoundException;
-
-/**
- * @author Fabien Potencier <fabien@symfony.com>
- *
- * @api
- */
-abstract class RedirectableUrlMatcher extends UrlMatcher implements RedirectableUrlMatcherInterface
-{
- private $trailingSlashTest = false;
-
- /**
- * @see UrlMatcher::match()
- *
- * @api
- */
- public function match($pathinfo)
- {
- try {
- $parameters = parent::match($pathinfo);
- } catch (ResourceNotFoundException $e) {
- if ('/' === substr($pathinfo, -1)) {
- throw $e;
- }
-
- // try with a / at the end
- $this->trailingSlashTest = true;
-
- return $this->match($pathinfo.'/');
- }
-
- if ($this->trailingSlashTest) {
- $this->trailingSlashTest = false;
-
- return $this->redirect($pathinfo, null);
- }
-
- return $parameters;
- }
-}
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/Matcher/RedirectableUrlMatcherInterface.php b/3rdparty/symfony/routing/Symfony/Component/Routing/Matcher/RedirectableUrlMatcherInterface.php
deleted file mode 100644
index 929ae9cc78f..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/Matcher/RedirectableUrlMatcherInterface.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing\Matcher;
-
-/**
- * RedirectableUrlMatcherInterface knows how to redirect the user.
- *
- * @author Fabien Potencier <fabien@symfony.com>
- *
- * @api
- */
-interface RedirectableUrlMatcherInterface
-{
- /**
- * Redirects the user to another URL.
- *
- * @param string $path The path info to redirect to.
- * @param string $route The route that matched
- * @param string $scheme The URL scheme (null to keep the current one)
- *
- * @return array An array of parameters
- *
- * @api
- */
- public function redirect($path, $route, $scheme = null);
-}
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/Matcher/UrlMatcher.php b/3rdparty/symfony/routing/Symfony/Component/Routing/Matcher/UrlMatcher.php
deleted file mode 100644
index 5ff8070ea0c..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/Matcher/UrlMatcher.php
+++ /dev/null
@@ -1,151 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing\Matcher;
-
-use Symfony\Component\Routing\Exception\MethodNotAllowedException;
-use Symfony\Component\Routing\Exception\ResourceNotFoundException;
-use Symfony\Component\Routing\RouteCollection;
-use Symfony\Component\Routing\RequestContext;
-
-/**
- * UrlMatcher matches URL based on a set of routes.
- *
- * @author Fabien Potencier <fabien@symfony.com>
- *
- * @api
- */
-class UrlMatcher implements UrlMatcherInterface
-{
- protected $context;
- protected $allow;
-
- private $routes;
-
- /**
- * Constructor.
- *
- * @param RouteCollection $routes A RouteCollection instance
- * @param RequestContext $context The context
- *
- * @api
- */
- public function __construct(RouteCollection $routes, RequestContext $context)
- {
- $this->routes = $routes;
- $this->context = $context;
- }
-
- /**
- * Sets the request context.
- *
- * @param RequestContext $context The context
- *
- * @api
- */
- public function setContext(RequestContext $context)
- {
- $this->context = $context;
- }
-
- /**
- * Gets the request context.
- *
- * @return RequestContext The context
- */
- public function getContext()
- {
- return $this->context;
- }
-
- /**
- * Tries to match a URL with a set of routes.
- *
- * @param string $pathinfo The path info to be parsed
- *
- * @return array An array of parameters
- *
- * @throws ResourceNotFoundException If the resource could not be found
- * @throws MethodNotAllowedException If the resource was found but the request method is not allowed
- *
- * @api
- */
- public function match($pathinfo)
- {
- $this->allow = array();
-
- if ($ret = $this->matchCollection($pathinfo, $this->routes)) {
- return $ret;
- }
-
- throw 0 < count($this->allow)
- ? new MethodNotAllowedException(array_unique(array_map('strtoupper', $this->allow)))
- : new ResourceNotFoundException();
- }
-
- protected function matchCollection($pathinfo, RouteCollection $routes)
- {
- $pathinfo = urldecode($pathinfo);
-
- foreach ($routes as $name => $route) {
- if ($route instanceof RouteCollection) {
- if (false === strpos($route->getPrefix(), '{') && $route->getPrefix() !== substr($pathinfo, 0, strlen($route->getPrefix()))) {
- continue;
- }
-
- if (!$ret = $this->matchCollection($pathinfo, $route)) {
- continue;
- }
-
- return $ret;
- }
-
- $compiledRoute = $route->compile();
-
- // check the static prefix of the URL first. Only use the more expensive preg_match when it matches
- if ('' !== $compiledRoute->getStaticPrefix() && 0 !== strpos($pathinfo, $compiledRoute->getStaticPrefix())) {
- continue;
- }
-
- if (!preg_match($compiledRoute->getRegex(), $pathinfo, $matches)) {
- continue;
- }
-
- // check HTTP method requirement
- if ($req = $route->getRequirement('_method')) {
- // HEAD and GET are equivalent as per RFC
- if ('HEAD' === $method = $this->context->getMethod()) {
- $method = 'GET';
- }
-
- if (!in_array($method, $req = explode('|', strtoupper($req)))) {
- $this->allow = array_merge($this->allow, $req);
-
- continue;
- }
- }
-
- return array_merge($this->mergeDefaults($matches, $route->getDefaults()), array('_route' => $name));
- }
- }
-
- protected function mergeDefaults($params, $defaults)
- {
- $parameters = $defaults;
- foreach ($params as $key => $value) {
- if (!is_int($key)) {
- $parameters[$key] = rawurldecode($value);
- }
- }
-
- return $parameters;
- }
-}
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/Matcher/UrlMatcherInterface.php b/3rdparty/symfony/routing/Symfony/Component/Routing/Matcher/UrlMatcherInterface.php
deleted file mode 100644
index 5823d3201bc..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/Matcher/UrlMatcherInterface.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing\Matcher;
-
-use Symfony\Component\Routing\RequestContextAwareInterface;
-
-/**
- * UrlMatcherInterface is the interface that all URL matcher classes must implement.
- *
- * @author Fabien Potencier <fabien@symfony.com>
- *
- * @api
- */
-interface UrlMatcherInterface extends RequestContextAwareInterface
-{
- /**
- * Tries to match a URL with a set of routes.
- *
- * @param string $pathinfo The path info to be parsed
- *
- * @return array An array of parameters
- *
- * @throws ResourceNotFoundException If the resource could not be found
- * @throws MethodNotAllowedException If the resource was found but the request method is not allowed
- *
- * @api
- */
- public function match($pathinfo);
-}
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/README.md b/3rdparty/symfony/routing/Symfony/Component/Routing/README.md
deleted file mode 100644
index eb72334d2ea..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/README.md
+++ /dev/null
@@ -1,32 +0,0 @@
-Routing Component
-=================
-
-Routing associates a request with the code that will convert it to a response.
-
-The example below demonstrates how you can set up a fully working routing
-system:
-
- use Symfony\Component\HttpFoundation\Request;
- use Symfony\Component\Routing\Matcher\UrlMatcher;
- use Symfony\Component\Routing\RequestContext;
- use Symfony\Component\Routing\RouteCollection;
- use Symfony\Component\Routing\Route;
-
- $routes = new RouteCollection();
- $routes->add('hello', new Route('/hello', array('controller' => 'foo')));
-
- $context = new RequestContext();
-
- // this is optional and can be done without a Request instance
- $context->fromRequest(Request::createFromGlobals());
-
- $matcher = new UrlMatcher($routes, $context);
-
- $parameters = $matcher->match('/hello');
-
-Resources
----------
-
-Unit tests:
-
-https://github.com/symfony/symfony/tree/master/tests/Symfony/Tests/Component/Routing
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/RequestContext.php b/3rdparty/symfony/routing/Symfony/Component/Routing/RequestContext.php
deleted file mode 100644
index fef85b6bb34..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/RequestContext.php
+++ /dev/null
@@ -1,250 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing;
-
-/**
- * Holds information about the current request.
- *
- * @author Fabien Potencier <fabien@symfony.com>
- *
- * @api
- */
-class RequestContext
-{
- private $baseUrl;
- private $method;
- private $host;
- private $scheme;
- private $httpPort;
- private $httpsPort;
- private $parameters;
-
- /**
- * Constructor.
- *
- * @param string $baseUrl The base URL
- * @param string $method The HTTP method
- * @param string $host The HTTP host name
- * @param string $scheme The HTTP scheme
- * @param integer $httpPort The HTTP port
- * @param integer $httpsPort The HTTPS port
- *
- * @api
- */
- public function __construct($baseUrl = '', $method = 'GET', $host = 'localhost', $scheme = 'http', $httpPort = 80, $httpsPort = 443)
- {
- $this->baseUrl = $baseUrl;
- $this->method = strtoupper($method);
- $this->host = $host;
- $this->scheme = strtolower($scheme);
- $this->httpPort = $httpPort;
- $this->httpsPort = $httpsPort;
- $this->parameters = array();
- }
-
- /**
- * Gets the base URL.
- *
- * @return string The base URL
- */
- public function getBaseUrl()
- {
- return $this->baseUrl;
- }
-
- /**
- * Sets the base URL.
- *
- * @param string $baseUrl The base URL
- *
- * @api
- */
- public function setBaseUrl($baseUrl)
- {
- $this->baseUrl = $baseUrl;
- }
-
- /**
- * Gets the HTTP method.
- *
- * The method is always an uppercased string.
- *
- * @return string The HTTP method
- */
- public function getMethod()
- {
- return $this->method;
- }
-
- /**
- * Sets the HTTP method.
- *
- * @param string $method The HTTP method
- *
- * @api
- */
- public function setMethod($method)
- {
- $this->method = strtoupper($method);
- }
-
- /**
- * Gets the HTTP host.
- *
- * @return string The HTTP host
- */
- public function getHost()
- {
- return $this->host;
- }
-
- /**
- * Sets the HTTP host.
- *
- * @param string $host The HTTP host
- *
- * @api
- */
- public function setHost($host)
- {
- $this->host = $host;
- }
-
- /**
- * Gets the HTTP scheme.
- *
- * @return string The HTTP scheme
- */
- public function getScheme()
- {
- return $this->scheme;
- }
-
- /**
- * Sets the HTTP scheme.
- *
- * @param string $scheme The HTTP scheme
- *
- * @api
- */
- public function setScheme($scheme)
- {
- $this->scheme = strtolower($scheme);
- }
-
- /**
- * Gets the HTTP port.
- *
- * @return string The HTTP port
- */
- public function getHttpPort()
- {
- return $this->httpPort;
- }
-
- /**
- * Sets the HTTP port.
- *
- * @param string $httpPort The HTTP port
- *
- * @api
- */
- public function setHttpPort($httpPort)
- {
- $this->httpPort = $httpPort;
- }
-
- /**
- * Gets the HTTPS port.
- *
- * @return string The HTTPS port
- */
- public function getHttpsPort()
- {
- return $this->httpsPort;
- }
-
- /**
- * Sets the HTTPS port.
- *
- * @param string $httpsPort The HTTPS port
- *
- * @api
- */
- public function setHttpsPort($httpsPort)
- {
- $this->httpsPort = $httpsPort;
- }
-
- /**
- * Returns the parameters.
- *
- * @return array The parameters
- */
- public function getParameters()
- {
- return $this->parameters;
- }
-
- /**
- * Sets the parameters.
- *
- * This method implements a fluent interface.
- *
- * @param array $parameters The parameters
- *
- * @return Route The current Route instance
- */
- public function setParameters(array $parameters)
- {
- $this->parameters = $parameters;
-
- return $this;
- }
-
- /**
- * Gets a parameter value.
- *
- * @param string $name A parameter name
- *
- * @return mixed The parameter value
- */
- public function getParameter($name)
- {
- return isset($this->parameters[$name]) ? $this->parameters[$name] : null;
- }
-
- /**
- * Checks if a parameter value is set for the given parameter.
- *
- * @param string $name A parameter name
- *
- * @return Boolean true if the parameter value is set, false otherwise
- */
- public function hasParameter($name)
- {
- return array_key_exists($name, $this->parameters);
- }
-
- /**
- * Sets a parameter value.
- *
- * @param string $name A parameter name
- * @param mixed $parameter The parameter value
- *
- * @api
- */
- public function setParameter($name, $parameter)
- {
- $this->parameters[$name] = $parameter;
- }
-}
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/RequestContextAwareInterface.php b/3rdparty/symfony/routing/Symfony/Component/Routing/RequestContextAwareInterface.php
deleted file mode 100644
index 38443a88b7c..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/RequestContextAwareInterface.php
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing;
-
-/**
- * @api
- */
-interface RequestContextAwareInterface
-{
- /**
- * Sets the request context.
- *
- * @param RequestContext $context The context
- *
- * @api
- */
- public function setContext(RequestContext $context);
-}
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/Route.php b/3rdparty/symfony/routing/Symfony/Component/Routing/Route.php
deleted file mode 100644
index 548568334d1..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/Route.php
+++ /dev/null
@@ -1,312 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing;
-
-/**
- * A Route describes a route and its parameters.
- *
- * @author Fabien Potencier <fabien@symfony.com>
- *
- * @api
- */
-class Route
-{
- private $pattern;
- private $defaults;
- private $requirements;
- private $options;
- private $compiled;
-
- private static $compilers = array();
-
- /**
- * Constructor.
- *
- * Available options:
- *
- * * compiler_class: A class name able to compile this route instance (RouteCompiler by default)
- *
- * @param string $pattern The pattern to match
- * @param array $defaults An array of default parameter values
- * @param array $requirements An array of requirements for parameters (regexes)
- * @param array $options An array of options
- *
- * @api
- */
- public function __construct($pattern, array $defaults = array(), array $requirements = array(), array $options = array())
- {
- $this->setPattern($pattern);
- $this->setDefaults($defaults);
- $this->setRequirements($requirements);
- $this->setOptions($options);
- }
-
- public function __clone()
- {
- $this->compiled = null;
- }
-
- /**
- * Returns the pattern.
- *
- * @return string The pattern
- */
- public function getPattern()
- {
- return $this->pattern;
- }
-
- /**
- * Sets the pattern.
- *
- * This method implements a fluent interface.
- *
- * @param string $pattern The pattern
- *
- * @return Route The current Route instance
- */
- public function setPattern($pattern)
- {
- $this->pattern = trim($pattern);
-
- // a route must start with a slash
- if (empty($this->pattern) || '/' !== $this->pattern[0]) {
- $this->pattern = '/'.$this->pattern;
- }
-
- return $this;
- }
-
- /**
- * Returns the options.
- *
- * @return array The options
- */
- public function getOptions()
- {
- return $this->options;
- }
-
- /**
- * Sets the options.
- *
- * This method implements a fluent interface.
- *
- * @param array $options The options
- *
- * @return Route The current Route instance
- */
- public function setOptions(array $options)
- {
- $this->options = array_merge(array(
- 'compiler_class' => 'Symfony\\Component\\Routing\\RouteCompiler',
- ), $options);
-
- return $this;
- }
-
- /**
- * Sets an option value.
- *
- * This method implements a fluent interface.
- *
- * @param string $name An option name
- * @param mixed $value The option value
- *
- * @return Route The current Route instance
- *
- * @api
- */
- public function setOption($name, $value)
- {
- $this->options[$name] = $value;
-
- return $this;
- }
-
- /**
- * Get an option value.
- *
- * @param string $name An option name
- *
- * @return mixed The option value
- */
- public function getOption($name)
- {
- return isset($this->options[$name]) ? $this->options[$name] : null;
- }
-
- /**
- * Returns the defaults.
- *
- * @return array The defaults
- */
- public function getDefaults()
- {
- return $this->defaults;
- }
-
- /**
- * Sets the defaults.
- *
- * This method implements a fluent interface.
- *
- * @param array $defaults The defaults
- *
- * @return Route The current Route instance
- */
- public function setDefaults(array $defaults)
- {
- $this->defaults = array();
- foreach ($defaults as $name => $default) {
- $this->defaults[(string) $name] = $default;
- }
-
- return $this;
- }
-
- /**
- * Gets a default value.
- *
- * @param string $name A variable name
- *
- * @return mixed The default value
- */
- public function getDefault($name)
- {
- return isset($this->defaults[$name]) ? $this->defaults[$name] : null;
- }
-
- /**
- * Checks if a default value is set for the given variable.
- *
- * @param string $name A variable name
- *
- * @return Boolean true if the default value is set, false otherwise
- */
- public function hasDefault($name)
- {
- return array_key_exists($name, $this->defaults);
- }
-
- /**
- * Sets a default value.
- *
- * @param string $name A variable name
- * @param mixed $default The default value
- *
- * @return Route The current Route instance
- *
- * @api
- */
- public function setDefault($name, $default)
- {
- $this->defaults[(string) $name] = $default;
-
- return $this;
- }
-
- /**
- * Returns the requirements.
- *
- * @return array The requirements
- */
- public function getRequirements()
- {
- return $this->requirements;
- }
-
- /**
- * Sets the requirements.
- *
- * This method implements a fluent interface.
- *
- * @param array $requirements The requirements
- *
- * @return Route The current Route instance
- */
- public function setRequirements(array $requirements)
- {
- $this->requirements = array();
- foreach ($requirements as $key => $regex) {
- $this->requirements[$key] = $this->sanitizeRequirement($key, $regex);
- }
-
- return $this;
- }
-
- /**
- * Returns the requirement for the given key.
- *
- * @param string $key The key
- *
- * @return string The regex
- */
- public function getRequirement($key)
- {
- return isset($this->requirements[$key]) ? $this->requirements[$key] : null;
- }
-
- /**
- * Sets a requirement for the given key.
- *
- * @param string $key The key
- * @param string $regex The regex
- *
- * @return Route The current Route instance
- *
- * @api
- */
- public function setRequirement($key, $regex)
- {
- $this->requirements[$key] = $this->sanitizeRequirement($key, $regex);
-
- return $this;
- }
-
- /**
- * Compiles the route.
- *
- * @return CompiledRoute A CompiledRoute instance
- */
- public function compile()
- {
- if (null !== $this->compiled) {
- return $this->compiled;
- }
-
- $class = $this->getOption('compiler_class');
-
- if (!isset(self::$compilers[$class])) {
- self::$compilers[$class] = new $class;
- }
-
- return $this->compiled = self::$compilers[$class]->compile($this);
- }
-
- private function sanitizeRequirement($key, $regex)
- {
- if (is_array($regex)) {
- throw new \InvalidArgumentException(sprintf('Routing requirements must be a string, array given for "%s"', $key));
- }
-
- if ('^' == $regex[0]) {
- $regex = substr($regex, 1);
- }
-
- if ('$' == substr($regex, -1)) {
- $regex = substr($regex, 0, -1);
- }
-
- return $regex;
- }
-}
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/RouteCollection.php b/3rdparty/symfony/routing/Symfony/Component/Routing/RouteCollection.php
deleted file mode 100644
index b3289d337c4..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/RouteCollection.php
+++ /dev/null
@@ -1,259 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing;
-
-use Symfony\Component\Config\Resource\ResourceInterface;
-
-/**
- * A RouteCollection represents a set of Route instances.
- *
- * When adding a route, it overrides existing routes with the
- * same name defined in the instance or its children and parents.
- *
- * @author Fabien Potencier <fabien@symfony.com>
- *
- * @api
- */
-class RouteCollection implements \IteratorAggregate
-{
- private $routes;
- private $resources;
- private $prefix;
- private $parent;
-
- /**
- * Constructor.
- *
- * @api
- */
- public function __construct()
- {
- $this->routes = array();
- $this->resources = array();
- $this->prefix = '';
- }
-
- public function __clone()
- {
- foreach ($this->routes as $name => $route) {
- $this->routes[$name] = clone $route;
- if ($route instanceof RouteCollection) {
- $this->routes[$name]->setParent($this);
- }
- }
- }
-
- /**
- * Gets the parent RouteCollection.
- *
- * @return RouteCollection The parent RouteCollection
- */
- public function getParent()
- {
- return $this->parent;
- }
-
- /**
- * Sets the parent RouteCollection.
- *
- * @param RouteCollection $parent The parent RouteCollection
- */
- public function setParent(RouteCollection $parent)
- {
- $this->parent = $parent;
- }
-
- /**
- * Gets the current RouteCollection as an Iterator.
- *
- * @return \ArrayIterator An \ArrayIterator interface
- */
- public function getIterator()
- {
- return new \ArrayIterator($this->routes);
- }
-
- /**
- * Adds a route.
- *
- * @param string $name The route name
- * @param Route $route A Route instance
- *
- * @throws \InvalidArgumentException When route name contains non valid characters
- *
- * @api
- */
- public function add($name, Route $route)
- {
- if (!preg_match('/^[a-z0-9A-Z_.]+$/', $name)) {
- throw new \InvalidArgumentException(sprintf('The provided route name "%s" contains non valid characters. A route name must only contain digits (0-9), letters (a-z and A-Z), underscores (_) and dots (.).', $name));
- }
-
- $parent = $this;
- while ($parent->getParent()) {
- $parent = $parent->getParent();
- }
-
- if ($parent) {
- $parent->remove($name);
- }
-
- $this->routes[$name] = $route;
- }
-
- /**
- * Returns the array of routes.
- *
- * @return array An array of routes
- */
- public function all()
- {
- $routes = array();
- foreach ($this->routes as $name => $route) {
- if ($route instanceof RouteCollection) {
- $routes = array_merge($routes, $route->all());
- } else {
- $routes[$name] = $route;
- }
- }
-
- return $routes;
- }
-
- /**
- * Gets a route by name.
- *
- * @param string $name The route name
- *
- * @return Route $route A Route instance
- */
- public function get($name)
- {
- // get the latest defined route
- foreach (array_reverse($this->routes) as $routes) {
- if (!$routes instanceof RouteCollection) {
- continue;
- }
-
- if (null !== $route = $routes->get($name)) {
- return $route;
- }
- }
-
- if (isset($this->routes[$name])) {
- return $this->routes[$name];
- }
- }
-
- /**
- * Removes a route by name.
- *
- * @param string $name The route name
- */
- public function remove($name)
- {
- if (isset($this->routes[$name])) {
- unset($this->routes[$name]);
- }
-
- foreach ($this->routes as $routes) {
- if ($routes instanceof RouteCollection) {
- $routes->remove($name);
- }
- }
- }
-
- /**
- * Adds a route collection to the current set of routes (at the end of the current set).
- *
- * @param RouteCollection $collection A RouteCollection instance
- * @param string $prefix An optional prefix to add before each pattern of the route collection
- *
- * @api
- */
- public function addCollection(RouteCollection $collection, $prefix = '')
- {
- $collection->setParent($this);
- $collection->addPrefix($prefix);
-
- // remove all routes with the same name in all existing collections
- foreach (array_keys($collection->all()) as $name) {
- $this->remove($name);
- }
-
- $this->routes[] = $collection;
- }
-
- /**
- * Adds a prefix to all routes in the current set.
- *
- * @param string $prefix An optional prefix to add before each pattern of the route collection
- *
- * @api
- */
- public function addPrefix($prefix)
- {
- // a prefix must not end with a slash
- $prefix = rtrim($prefix, '/');
-
- if (!$prefix) {
- return;
- }
-
- // a prefix must start with a slash
- if ('/' !== $prefix[0]) {
- $prefix = '/'.$prefix;
- }
-
- $this->prefix = $prefix.$this->prefix;
-
- foreach ($this->routes as $name => $route) {
- if ($route instanceof RouteCollection) {
- $route->addPrefix($prefix);
- } else {
- $route->setPattern($prefix.$route->getPattern());
- }
- }
- }
-
- public function getPrefix()
- {
- return $this->prefix;
- }
-
- /**
- * Returns an array of resources loaded to build this collection.
- *
- * @return ResourceInterface[] An array of resources
- */
- public function getResources()
- {
- $resources = $this->resources;
- foreach ($this as $routes) {
- if ($routes instanceof RouteCollection) {
- $resources = array_merge($resources, $routes->getResources());
- }
- }
-
- return array_unique($resources);
- }
-
- /**
- * Adds a resource for this collection.
- *
- * @param ResourceInterface $resource A resource instance
- */
- public function addResource(ResourceInterface $resource)
- {
- $this->resources[] = $resource;
- }
-}
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/RouteCompiler.php b/3rdparty/symfony/routing/Symfony/Component/Routing/RouteCompiler.php
deleted file mode 100644
index 72ececc5caa..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/RouteCompiler.php
+++ /dev/null
@@ -1,128 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing;
-
-/**
- * RouteCompiler compiles Route instances to CompiledRoute instances.
- *
- * @author Fabien Potencier <fabien@symfony.com>
- */
-class RouteCompiler implements RouteCompilerInterface
-{
- /**
- * Compiles the current route instance.
- *
- * @param Route $route A Route instance
- *
- * @return CompiledRoute A CompiledRoute instance
- */
- public function compile(Route $route)
- {
- $pattern = $route->getPattern();
- $len = strlen($pattern);
- $tokens = array();
- $variables = array();
- $pos = 0;
- preg_match_all('#.\{([\w\d_]+)\}#', $pattern, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER);
- foreach ($matches as $match) {
- if ($text = substr($pattern, $pos, $match[0][1] - $pos)) {
- $tokens[] = array('text', $text);
- }
- $seps = array($pattern[$pos]);
- $pos = $match[0][1] + strlen($match[0][0]);
- $var = $match[1][0];
-
- if ($req = $route->getRequirement($var)) {
- $regexp = $req;
- } else {
- if ($pos !== $len) {
- $seps[] = $pattern[$pos];
- }
- $regexp = sprintf('[^%s]+?', preg_quote(implode('', array_unique($seps)), '#'));
- }
-
- $tokens[] = array('variable', $match[0][0][0], $regexp, $var);
-
- if (in_array($var, $variables)) {
- throw new \LogicException(sprintf('Route pattern "%s" cannot reference variable name "%s" more than once.', $route->getPattern(), $var));
- }
-
- $variables[] = $var;
- }
-
- if ($pos < $len) {
- $tokens[] = array('text', substr($pattern, $pos));
- }
-
- // find the first optional token
- $firstOptional = INF;
- for ($i = count($tokens) - 1; $i >= 0; $i--) {
- $token = $tokens[$i];
- if ('variable' === $token[0] && $route->hasDefault($token[3])) {
- $firstOptional = $i;
- } else {
- break;
- }
- }
-
- // compute the matching regexp
- $regexp = '';
- for ($i = 0, $nbToken = count($tokens); $i < $nbToken; $i++) {
- $regexp .= $this->computeRegexp($tokens, $i, $firstOptional);
- }
-
- return new CompiledRoute(
- $route,
- 'text' === $tokens[0][0] ? $tokens[0][1] : '',
- sprintf("#^%s$#s", $regexp),
- array_reverse($tokens),
- $variables
- );
- }
-
- /**
- * Computes the regexp used to match the token.
- *
- * @param array $tokens The route tokens
- * @param integer $index The index of the current token
- * @param integer $firstOptional The index of the first optional token
- *
- * @return string The regexp
- */
- private function computeRegexp(array $tokens, $index, $firstOptional)
- {
- $token = $tokens[$index];
- if ('text' === $token[0]) {
- // Text tokens
- return preg_quote($token[1], '#');
- } else {
- // Variable tokens
- if (0 === $index && 0 === $firstOptional && 1 == count($tokens)) {
- // When the only token is an optional variable token, the separator is required
- return sprintf('%s(?P<%s>%s)?', preg_quote($token[1], '#'), $token[3], $token[2]);
- } else {
- $nbTokens = count($tokens);
- $regexp = sprintf('%s(?P<%s>%s)', preg_quote($token[1], '#'), $token[3], $token[2]);
- if ($index >= $firstOptional) {
- // Enclose each optional tokens in a subpattern to make it optional
- $regexp = "(?:$regexp";
- if ($nbTokens - 1 == $index) {
- // Close the optional subpatterns
- $regexp .= str_repeat(")?", $nbTokens - $firstOptional);
- }
- }
-
- return $regexp;
- }
- }
- }
-}
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/RouteCompilerInterface.php b/3rdparty/symfony/routing/Symfony/Component/Routing/RouteCompilerInterface.php
deleted file mode 100644
index 5c988adafba..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/RouteCompilerInterface.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing;
-
-/**
- * RouteCompilerInterface is the interface that all RouteCompiler classes must implements.
- *
- * @author Fabien Potencier <fabien@symfony.com>
- */
-interface RouteCompilerInterface
-{
- /**
- * Compiles the current route instance.
- *
- * @param Route $route A Route instance
- *
- * @return CompiledRoute A CompiledRoute instance
- */
- public function compile(Route $route);
-}
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/Router.php b/3rdparty/symfony/routing/Symfony/Component/Routing/Router.php
deleted file mode 100644
index eadb2231e11..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/Router.php
+++ /dev/null
@@ -1,263 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing;
-
-use Symfony\Component\Config\Loader\LoaderInterface;
-use Symfony\Component\Config\ConfigCache;
-
-/**
- * The Router class is an example of the integration of all pieces of the
- * routing system for easier use.
- *
- * @author Fabien Potencier <fabien@symfony.com>
- */
-class Router implements RouterInterface
-{
- protected $matcher;
- protected $generator;
- protected $defaults;
- protected $context;
- protected $loader;
- protected $collection;
- protected $resource;
- protected $options;
-
- /**
- * Constructor.
- *
- * @param LoaderInterface $loader A LoaderInterface instance
- * @param mixed $resource The main resource to load
- * @param array $options An array of options
- * @param RequestContext $context The context
- * @param array $defaults The default values
- */
- public function __construct(LoaderInterface $loader, $resource, array $options = array(), RequestContext $context = null, array $defaults = array())
- {
- $this->loader = $loader;
- $this->resource = $resource;
- $this->context = null === $context ? new RequestContext() : $context;
- $this->defaults = $defaults;
- $this->setOptions($options);
- }
-
- /**
- * Sets options.
- *
- * Available options:
- *
- * * cache_dir: The cache directory (or null to disable caching)
- * * debug: Whether to enable debugging or not (false by default)
- * * resource_type: Type hint for the main resource (optional)
- *
- * @param array $options An array of options
- *
- * @throws \InvalidArgumentException When unsupported option is provided
- */
- public function setOptions(array $options)
- {
- $this->options = array(
- 'cache_dir' => null,
- 'debug' => false,
- 'generator_class' => 'Symfony\\Component\\Routing\\Generator\\UrlGenerator',
- 'generator_base_class' => 'Symfony\\Component\\Routing\\Generator\\UrlGenerator',
- 'generator_dumper_class' => 'Symfony\\Component\\Routing\\Generator\\Dumper\\PhpGeneratorDumper',
- 'generator_cache_class' => 'ProjectUrlGenerator',
- 'matcher_class' => 'Symfony\\Component\\Routing\\Matcher\\UrlMatcher',
- 'matcher_base_class' => 'Symfony\\Component\\Routing\\Matcher\\UrlMatcher',
- 'matcher_dumper_class' => 'Symfony\\Component\\Routing\\Matcher\\Dumper\\PhpMatcherDumper',
- 'matcher_cache_class' => 'ProjectUrlMatcher',
- 'resource_type' => null,
- );
-
- // check option names and live merge, if errors are encountered Exception will be thrown
- $invalid = array();
- $isInvalid = false;
- foreach ($options as $key => $value) {
- if (array_key_exists($key, $this->options)) {
- $this->options[$key] = $value;
- } else {
- $isInvalid = true;
- $invalid[] = $key;
- }
- }
-
- if ($isInvalid) {
- throw new \InvalidArgumentException(sprintf('The Router does not support the following options: "%s".', implode('\', \'', $invalid)));
- }
- }
-
- /**
- * Sets an option.
- *
- * @param string $key The key
- * @param mixed $value The value
- *
- * @throws \InvalidArgumentException
- */
- public function setOption($key, $value)
- {
- if (!array_key_exists($key, $this->options)) {
- throw new \InvalidArgumentException(sprintf('The Router does not support the "%s" option.', $key));
- }
-
- $this->options[$key] = $value;
- }
-
- /**
- * Gets an option value.
- *
- * @param string $key The key
- *
- * @return mixed The value
- *
- * @throws \InvalidArgumentException
- */
- public function getOption($key)
- {
- if (!array_key_exists($key, $this->options)) {
- throw new \InvalidArgumentException(sprintf('The Router does not support the "%s" option.', $key));
- }
-
- return $this->options[$key];
- }
-
- /**
- * Gets the RouteCollection instance associated with this Router.
- *
- * @return RouteCollection A RouteCollection instance
- */
- public function getRouteCollection()
- {
- if (null === $this->collection) {
- $this->collection = $this->loader->load($this->resource, $this->options['resource_type']);
- }
-
- return $this->collection;
- }
-
- /**
- * Sets the request context.
- *
- * @param RequestContext $context The context
- */
- public function setContext(RequestContext $context)
- {
- $this->context = $context;
-
- $this->getMatcher()->setContext($context);
- $this->getGenerator()->setContext($context);
- }
-
- /**
- * Gets the request context.
- *
- * @return RequestContext The context
- */
- public function getContext()
- {
- return $this->context;
- }
-
- /**
- * Generates a URL from the given parameters.
- *
- * @param string $name The name of the route
- * @param mixed $parameters An array of parameters
- * @param Boolean $absolute Whether to generate an absolute URL
- *
- * @return string The generated URL
- */
- public function generate($name, $parameters = array(), $absolute = false)
- {
- return $this->getGenerator()->generate($name, $parameters, $absolute);
- }
-
- /**
- * Tries to match a URL with a set of routes.
- *
- * Returns false if no route matches the URL.
- *
- * @param string $url URL to be parsed
- *
- * @return array|false An array of parameters or false if no route matches
- */
- public function match($url)
- {
- return $this->getMatcher()->match($url);
- }
-
- /**
- * Gets the UrlMatcher instance associated with this Router.
- *
- * @return UrlMatcherInterface A UrlMatcherInterface instance
- */
- public function getMatcher()
- {
- if (null !== $this->matcher) {
- return $this->matcher;
- }
-
- if (null === $this->options['cache_dir'] || null === $this->options['matcher_cache_class']) {
- return $this->matcher = new $this->options['matcher_class']($this->getRouteCollection(), $this->context, $this->defaults);
- }
-
- $class = $this->options['matcher_cache_class'];
- $cache = new ConfigCache($this->options['cache_dir'].'/'.$class.'.php', $this->options['debug']);
- if (!$cache->isFresh($class)) {
- $dumper = new $this->options['matcher_dumper_class']($this->getRouteCollection());
-
- $options = array(
- 'class' => $class,
- 'base_class' => $this->options['matcher_base_class'],
- );
-
- $cache->write($dumper->dump($options), $this->getRouteCollection()->getResources());
- }
-
- require_once $cache;
-
- return $this->matcher = new $class($this->context, $this->defaults);
- }
-
- /**
- * Gets the UrlGenerator instance associated with this Router.
- *
- * @return UrlGeneratorInterface A UrlGeneratorInterface instance
- */
- public function getGenerator()
- {
- if (null !== $this->generator) {
- return $this->generator;
- }
-
- if (null === $this->options['cache_dir'] || null === $this->options['generator_cache_class']) {
- return $this->generator = new $this->options['generator_class']($this->getRouteCollection(), $this->context, $this->defaults);
- }
-
- $class = $this->options['generator_cache_class'];
- $cache = new ConfigCache($this->options['cache_dir'].'/'.$class.'.php', $this->options['debug']);
- if (!$cache->isFresh($class)) {
- $dumper = new $this->options['generator_dumper_class']($this->getRouteCollection());
-
- $options = array(
- 'class' => $class,
- 'base_class' => $this->options['generator_base_class'],
- );
-
- $cache->write($dumper->dump($options), $this->getRouteCollection()->getResources());
- }
-
- require_once $cache;
-
- return $this->generator = new $class($this->context, $this->defaults);
- }
-}
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/RouterInterface.php b/3rdparty/symfony/routing/Symfony/Component/Routing/RouterInterface.php
deleted file mode 100644
index 961342bf09c..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/RouterInterface.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Routing;
-
-use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
-use Symfony\Component\Routing\Matcher\UrlMatcherInterface;
-
-/**
- * RouterInterface is the interface that all Router classes must implements.
- *
- * This interface is the concatenation of UrlMatcherInterface and UrlGeneratorInterface.
- *
- * @author Fabien Potencier <fabien@symfony.com>
- */
-interface RouterInterface extends UrlMatcherInterface, UrlGeneratorInterface
-{
-}
diff --git a/3rdparty/symfony/routing/Symfony/Component/Routing/composer.json b/3rdparty/symfony/routing/Symfony/Component/Routing/composer.json
deleted file mode 100644
index 8d29398b243..00000000000
--- a/3rdparty/symfony/routing/Symfony/Component/Routing/composer.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "name": "symfony/routing",
- "type": "library",
- "description": "Symfony Routing Component",
- "keywords": [],
- "homepage": "http://symfony.com",
- "license": "MIT",
- "authors": [
- {
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "http://symfony.com/contributors"
- }
- ],
- "require": {
- "php": ">=5.3.2"
- },
- "suggest": {
- "symfony/config": "self.version",
- "symfony/yaml": "self.version"
- },
- "autoload": {
- "psr-0": { "Symfony\\Component\\Routing": "" }
- },
- "target-dir": "Symfony/Component/Routing"
-}
diff --git a/3rdparty/timepicker/GPL-LICENSE.txt b/3rdparty/timepicker/GPL-LICENSE.txt
deleted file mode 100755
index 932f11115fe..00000000000
--- a/3rdparty/timepicker/GPL-LICENSE.txt
+++ /dev/null
@@ -1,278 +0,0 @@
-GNU GENERAL PUBLIC LICENSE
-Version 2, June 1991
-
-Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-Everyone is permitted to copy and distribute verbatim copies
-of this license document, but changing it is not allowed.
-
-Preamble
-
-The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
- the GNU Lesser General Public License instead.) You can apply it to
-your programs, too.
-
-When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
- this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
-To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
-For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
-We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
- distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
- that everyone understands that there is no warranty for this free
- software. If the software is modified by someone else and passed on, we
- want its recipients to know that what they have is not the original, so
- that any problems introduced by others will not reflect on the original
- authors' reputations.
-
- Finally, any free program is threatened constantly by software
- patents. We wish to avoid the danger that redistributors of a free
- program will individually obtain patent licenses, in effect making the
- program proprietary. To prevent this, we have made it clear that any
- patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
- modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
- a notice placed by the copyright holder saying it may be distributed
- under the terms of this General Public License. The "Program", below,
- refers to any such program or work, and a "work based on the Program"
- means either the Program or any derivative work under copyright law:
- that is to say, a work containing the Program or a portion of it,
- either verbatim or with modifications and/or translated into another
- language. (Hereinafter, translation is included without limitation in
- the term "modification".) Each licensee is addressed as "you".
-
- Activities other than copying, distribution and modification are not
- covered by this License; they are outside its scope. The act of
- running the Program is not restricted, and the output from the Program
- is covered only if its contents constitute a work based on the
- Program (independent of having been made by running the Program).
- Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
- source code as you receive it, in any medium, provided that you
- conspicuously and appropriately publish on each copy an appropriate
- copyright notice and disclaimer of warranty; keep intact all the
- notices that refer to this License and to the absence of any warranty;
- and give any other recipients of the Program a copy of this License
- along with the Program.
-
- You may charge a fee for the physical act of transferring a copy, and
- you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
- of it, thus forming a work based on the Program, and copy and
- distribute such modifications or work under the terms of Section 1
- above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
- These requirements apply to the modified work as a whole. If
- identifiable sections of that work are not derived from the Program,
- and can be reasonably considered independent and separate works in
- themselves, then this License, and its terms, do not apply to those
- sections when you distribute them as separate works. But when you
- distribute the same sections as part of a whole which is a work based
- on the Program, the distribution of the whole must be on the terms of
- this License, whose permissions for other licensees extend to the
- entire whole, and thus to each and every part regardless of who wrote it.
-
- Thus, it is not the intent of this section to claim rights or contest
- your rights to work written entirely by you; rather, the intent is to
- exercise the right to control the distribution of derivative or
- collective works based on the Program.
-
- In addition, mere aggregation of another work not based on the Program
- with the Program (or with a work based on the Program) on a volume of
- a storage or distribution medium does not bring the other work under
- the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
- under Section 2) in object code or executable form under the terms of
- Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
- The source code for a work means the preferred form of the work for
- making modifications to it. For an executable work, complete source
- code means all the source code for all modules it contains, plus any
- associated interface definition files, plus the scripts used to
- control compilation and installation of the executable. However, as a
- special exception, the source code distributed need not include
- anything that is normally distributed (in either source or binary
- form) with the major components (compiler, kernel, and so on) of the
- operating system on which the executable runs, unless that component
- itself accompanies the executable.
-
- If distribution of executable or object code is made by offering
- access to copy from a designated place, then offering equivalent
- access to copy the source code from the same place counts as
- distribution of the source code, even though third parties are not
- compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
- except as expressly provided under this License. Any attempt
- otherwise to copy, modify, sublicense or distribute the Program is
- void, and will automatically terminate your rights under this License.
- However, parties who have received copies, or rights, from you under
- this License will not have their licenses terminated so long as such
- parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
- signed it. However, nothing else grants you permission to modify or
- distribute the Program or its derivative works. These actions are
- prohibited by law if you do not accept this License. Therefore, by
- modifying or distributing the Program (or any work based on the
- Program), you indicate your acceptance of this License to do so, and
- all its terms and conditions for copying, distributing or modifying
- the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
- Program), the recipient automatically receives a license from the
- original licensor to copy, distribute or modify the Program subject to
- these terms and conditions. You may not impose any further
- restrictions on the recipients' exercise of the rights granted herein.
- You are not responsible for enforcing compliance by third parties to
- this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
- infringement or for any other reason (not limited to patent issues),
- conditions are imposed on you (whether by court order, agreement or
- otherwise) that contradict the conditions of this License, they do not
- excuse you from the conditions of this License. If you cannot
- distribute so as to satisfy simultaneously your obligations under this
- License and any other pertinent obligations, then as a consequence you
- may not distribute the Program at all. For example, if a patent
- license would not permit royalty-free redistribution of the Program by
- all those who receive copies directly or indirectly through you, then
- the only way you could satisfy both it and this License would be to
- refrain entirely from distribution of the Program.
-
- If any portion of this section is held invalid or unenforceable under
- any particular circumstance, the balance of the section is intended to
- apply and the section as a whole is intended to apply in other
- circumstances.
-
- It is not the purpose of this section to induce you to infringe any
- patents or other property right claims or to contest validity of any
- such claims; this section has the sole purpose of protecting the
- integrity of the free software distribution system, which is
- implemented by public license practices. Many people have made
- generous contributions to the wide range of software distributed
- through that system in reliance on consistent application of that
- system; it is up to the author/donor to decide if he or she is willing
- to distribute software through any other system and a licensee cannot
- impose that choice.
-
- This section is intended to make thoroughly clear what is believed to
- be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
- certain countries either by patents or by copyrighted interfaces, the
- original copyright holder who places the Program under this License
- may add an explicit geographical distribution limitation excluding
- those countries, so that distribution is permitted only in or among
- countries not thus excluded. In such case, this License incorporates
- the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
- of the General Public License from time to time. Such new versions will
- be similar in spirit to the present version, but may differ in detail to
- address new problems or concerns.
-
- Each version is given a distinguishing version number. If the Program
- specifies a version number of this License which applies to it and "any
- later version", you have the option of following the terms and conditions
- either of that version or of any later version published by the Free
- Software Foundation. If the Program does not specify a version number of
- this License, you may choose any version ever published by the Free Software
- Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
- programs whose distribution conditions are different, write to the author
- to ask for permission. For software which is copyrighted by the Free
- Software Foundation, write to the Free Software Foundation; we sometimes
- make exceptions for this. Our decision will be guided by the two goals
- of preserving the free status of all derivatives of our free software and
- of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
- FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
- OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
- PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
- OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
- TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
- PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
- REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
- WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
- REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
- INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
- OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
- TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
- YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
- PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGES.""''''''
diff --git a/3rdparty/timepicker/MIT-LICENSE.txt b/3rdparty/timepicker/MIT-LICENSE.txt
deleted file mode 100755
index 532704636b7..00000000000
--- a/3rdparty/timepicker/MIT-LICENSE.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (c) 2011 John Resig, http://jquery.com/
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/3rdparty/timepicker/css/include/images/ui-bg_diagonals-thick_18_b81900_40x40.png b/3rdparty/timepicker/css/include/images/ui-bg_diagonals-thick_18_b81900_40x40.png
deleted file mode 100755
index 954e22dbd99..00000000000
--- a/3rdparty/timepicker/css/include/images/ui-bg_diagonals-thick_18_b81900_40x40.png
+++ /dev/null
Binary files differ
diff --git a/3rdparty/timepicker/css/include/images/ui-bg_diagonals-thick_20_666666_40x40.png b/3rdparty/timepicker/css/include/images/ui-bg_diagonals-thick_20_666666_40x40.png
deleted file mode 100755
index 64ece5707d9..00000000000
--- a/3rdparty/timepicker/css/include/images/ui-bg_diagonals-thick_20_666666_40x40.png
+++ /dev/null
Binary files differ
diff --git a/3rdparty/timepicker/css/include/images/ui-bg_flat_10_000000_40x100.png b/3rdparty/timepicker/css/include/images/ui-bg_flat_10_000000_40x100.png
deleted file mode 100755
index abdc01082bf..00000000000
--- a/3rdparty/timepicker/css/include/images/ui-bg_flat_10_000000_40x100.png
+++ /dev/null
Binary files differ
diff --git a/3rdparty/timepicker/css/include/images/ui-bg_glass_100_f6f6f6_1x400.png b/3rdparty/timepicker/css/include/images/ui-bg_glass_100_f6f6f6_1x400.png
deleted file mode 100755
index 9b383f4d2ea..00000000000
--- a/3rdparty/timepicker/css/include/images/ui-bg_glass_100_f6f6f6_1x400.png
+++ /dev/null
Binary files differ
diff --git a/3rdparty/timepicker/css/include/images/ui-bg_glass_100_fdf5ce_1x400.png b/3rdparty/timepicker/css/include/images/ui-bg_glass_100_fdf5ce_1x400.png
deleted file mode 100755
index a23baad25b1..00000000000
--- a/3rdparty/timepicker/css/include/images/ui-bg_glass_100_fdf5ce_1x400.png
+++ /dev/null
Binary files differ
diff --git a/3rdparty/timepicker/css/include/images/ui-bg_glass_65_ffffff_1x400.png b/3rdparty/timepicker/css/include/images/ui-bg_glass_65_ffffff_1x400.png
deleted file mode 100755
index 42ccba269b6..00000000000
--- a/3rdparty/timepicker/css/include/images/ui-bg_glass_65_ffffff_1x400.png
+++ /dev/null
Binary files differ
diff --git a/3rdparty/timepicker/css/include/images/ui-bg_gloss-wave_35_f6a828_500x100.png b/3rdparty/timepicker/css/include/images/ui-bg_gloss-wave_35_f6a828_500x100.png
deleted file mode 100755
index 39d5824d6af..00000000000
--- a/3rdparty/timepicker/css/include/images/ui-bg_gloss-wave_35_f6a828_500x100.png
+++ /dev/null
Binary files differ
diff --git a/3rdparty/timepicker/css/include/images/ui-bg_highlight-soft_100_eeeeee_1x100.png b/3rdparty/timepicker/css/include/images/ui-bg_highlight-soft_100_eeeeee_1x100.png
deleted file mode 100755
index f1273672d25..00000000000
--- a/3rdparty/timepicker/css/include/images/ui-bg_highlight-soft_100_eeeeee_1x100.png
+++ /dev/null
Binary files differ
diff --git a/3rdparty/timepicker/css/include/images/ui-bg_highlight-soft_75_ffe45c_1x100.png b/3rdparty/timepicker/css/include/images/ui-bg_highlight-soft_75_ffe45c_1x100.png
deleted file mode 100755
index 359397acffd..00000000000
--- a/3rdparty/timepicker/css/include/images/ui-bg_highlight-soft_75_ffe45c_1x100.png
+++ /dev/null
Binary files differ
diff --git a/3rdparty/timepicker/css/include/images/ui-icons_222222_256x240.png b/3rdparty/timepicker/css/include/images/ui-icons_222222_256x240.png
deleted file mode 100755
index b273ff111d2..00000000000
--- a/3rdparty/timepicker/css/include/images/ui-icons_222222_256x240.png
+++ /dev/null
Binary files differ
diff --git a/3rdparty/timepicker/css/include/images/ui-icons_228ef1_256x240.png b/3rdparty/timepicker/css/include/images/ui-icons_228ef1_256x240.png
deleted file mode 100755
index a641a371afa..00000000000
--- a/3rdparty/timepicker/css/include/images/ui-icons_228ef1_256x240.png
+++ /dev/null
Binary files differ
diff --git a/3rdparty/timepicker/css/include/images/ui-icons_ef8c08_256x240.png b/3rdparty/timepicker/css/include/images/ui-icons_ef8c08_256x240.png
deleted file mode 100755
index 85e63e9f604..00000000000
--- a/3rdparty/timepicker/css/include/images/ui-icons_ef8c08_256x240.png
+++ /dev/null
Binary files differ
diff --git a/3rdparty/timepicker/css/include/images/ui-icons_ffd27a_256x240.png b/3rdparty/timepicker/css/include/images/ui-icons_ffd27a_256x240.png
deleted file mode 100755
index e117effa3dc..00000000000
--- a/3rdparty/timepicker/css/include/images/ui-icons_ffd27a_256x240.png
+++ /dev/null
Binary files differ
diff --git a/3rdparty/timepicker/css/include/images/ui-icons_ffffff_256x240.png b/3rdparty/timepicker/css/include/images/ui-icons_ffffff_256x240.png
deleted file mode 100755
index 42f8f992c72..00000000000
--- a/3rdparty/timepicker/css/include/images/ui-icons_ffffff_256x240.png
+++ /dev/null
Binary files differ
diff --git a/3rdparty/timepicker/css/include/jquery-1.5.1.min.js b/3rdparty/timepicker/css/include/jquery-1.5.1.min.js
deleted file mode 100755
index 6437874c699..00000000000
--- a/3rdparty/timepicker/css/include/jquery-1.5.1.min.js
+++ /dev/null
@@ -1,16 +0,0 @@
-/*!
- * jQuery JavaScript Library v1.5.1
- * http://jquery.com/
- *
- * Copyright 2011, John Resig
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * Includes Sizzle.js
- * http://sizzlejs.com/
- * Copyright 2011, The Dojo Foundation
- * Released under the MIT, BSD, and GPL Licenses.
- *
- * Date: Wed Feb 23 13:55:29 2011 -0500
- */
-(function(a,b){function cg(a){return d.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cd(a){if(!bZ[a]){var b=d("<"+a+">").appendTo("body"),c=b.css("display");b.remove();if(c==="none"||c==="")c="block";bZ[a]=c}return bZ[a]}function cc(a,b){var c={};d.each(cb.concat.apply([],cb.slice(0,b)),function(){c[this]=a});return c}function bY(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function bX(){try{return new a.XMLHttpRequest}catch(b){}}function bW(){d(a).unload(function(){for(var a in bU)bU[a](0,1)})}function bQ(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var e=a.dataTypes,f={},g,h,i=e.length,j,k=e[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h==="string"&&(f[h.toLowerCase()]=a.converters[h]);l=k,k=e[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=f[m]||f["* "+k];if(!n){p=b;for(o in f){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=f[j[1]+" "+k];if(p){o=f[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&d.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function bP(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function bO(a,b,c,e){if(d.isArray(b)&&b.length)d.each(b,function(b,f){c||bq.test(a)?e(a,f):bO(a+"["+(typeof f==="object"||d.isArray(f)?b:"")+"]",f,c,e)});else if(c||b==null||typeof b!=="object")e(a,b);else if(d.isArray(b)||d.isEmptyObject(b))e(a,"");else for(var f in b)bO(a+"["+f+"]",b[f],c,e)}function bN(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bH,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l==="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=bN(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=bN(a,c,d,e,"*",g));return l}function bM(a){return function(b,c){typeof b!=="string"&&(c=b,b="*");if(d.isFunction(c)){var e=b.toLowerCase().split(bB),f=0,g=e.length,h,i,j;for(;f<g;f++)h=e[f],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bo(a,b,c){var e=b==="width"?bi:bj,f=b==="width"?a.offsetWidth:a.offsetHeight;if(c==="border")return f;d.each(e,function(){c||(f-=parseFloat(d.css(a,"padding"+this))||0),c==="margin"?f+=parseFloat(d.css(a,"margin"+this))||0:f-=parseFloat(d.css(a,"border"+this+"Width"))||0});return f}function ba(a,b){b.src?d.ajax({url:b.src,async:!1,dataType:"script"}):d.globalEval(b.text||b.textContent||b.innerHTML||""),b.parentNode&&b.parentNode.removeChild(b)}function _(a){return"getElementsByTagName"in a?a.getElementsByTagName("*"):"querySelectorAll"in a?a.querySelectorAll("*"):[]}function $(a,b){if(b.nodeType===1){var c=b.nodeName.toLowerCase();b.clearAttributes(),b.mergeAttributes(a);if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(d.expando)}}function Z(a,b){if(b.nodeType===1&&d.hasData(a)){var c=d.expando,e=d.data(a),f=d.data(b,e);if(e=e[c]){var g=e.events;f=f[c]=d.extend({},e);if(g){delete f.handle,f.events={};for(var h in g)for(var i=0,j=g[h].length;i<j;i++)d.event.add(b,h+(g[h][i].namespace?".":"")+g[h][i].namespace,g[h][i],g[h][i].data)}}}}function Y(a,b){return d.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function O(a,b,c){if(d.isFunction(b))return d.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return d.grep(a,function(a,d){return a===b===c});if(typeof b==="string"){var e=d.grep(a,function(a){return a.nodeType===1});if(J.test(b))return d.filter(b,e,!c);b=d.filter(b,e)}return d.grep(a,function(a,e){return d.inArray(a,b)>=0===c})}function N(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function F(a,b){return(a&&a!=="*"?a+".":"")+b.replace(r,"`").replace(s,"&")}function E(a){var b,c,e,f,g,h,i,j,k,l,m,n,o,q=[],r=[],s=d._data(this,"events");if(a.liveFired!==this&&s&&s.live&&!a.target.disabled&&(!a.button||a.type!=="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var t=s.live.slice(0);for(i=0;i<t.length;i++)g=t[i],g.origType.replace(p,"")===a.type?r.push(g.selector):t.splice(i--,1);f=d(a.target).closest(r,a.currentTarget);for(j=0,k=f.length;j<k;j++){m=f[j];for(i=0;i<t.length;i++){g=t[i];if(m.selector===g.selector&&(!n||n.test(g.namespace))&&!m.elem.disabled){h=m.elem,e=null;if(g.preType==="mouseenter"||g.preType==="mouseleave")a.type=g.preType,e=d(a.relatedTarget).closest(g.selector)[0];(!e||e!==h)&&q.push({elem:h,handleObj:g,level:m.level})}}}for(j=0,k=q.length;j<k;j++){f=q[j];if(c&&f.level>c)break;a.currentTarget=f.elem,a.data=f.handleObj.data,a.handleObj=f.handleObj,o=f.handleObj.origHandler.apply(f.elem,arguments);if(o===!1||a.isPropagationStopped()){c=f.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function C(a,c,e){var f=d.extend({},e[0]);f.type=a,f.originalEvent={},f.liveFired=b,d.event.handle.call(c,f),f.isDefaultPrevented()&&e[0].preventDefault()}function w(){return!0}function v(){return!1}function g(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function f(a,c,f){if(f===b&&a.nodeType===1){f=a.getAttribute("data-"+c);if(typeof f==="string"){try{f=f==="true"?!0:f==="false"?!1:f==="null"?null:d.isNaN(f)?e.test(f)?d.parseJSON(f):f:parseFloat(f)}catch(g){}d.data(a,c,f)}else f=b}return f}var c=a.document,d=function(){function I(){if(!d.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(I,1);return}d.ready()}}var d=function(a,b){return new d.fn.init(a,b,g)},e=a.jQuery,f=a.$,g,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,i=/\S/,j=/^\s+/,k=/\s+$/,l=/\d/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=navigator.userAgent,w,x=!1,y,z="then done fail isResolved isRejected promise".split(" "),A,B=Object.prototype.toString,C=Object.prototype.hasOwnProperty,D=Array.prototype.push,E=Array.prototype.slice,F=String.prototype.trim,G=Array.prototype.indexOf,H={};d.fn=d.prototype={constructor:d,init:function(a,e,f){var g,i,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!e&&c.body){this.context=c,this[0]=c.body,this.selector="body",this.length=1;return this}if(typeof a==="string"){g=h.exec(a);if(!g||!g[1]&&e)return!e||e.jquery?(e||f).find(a):this.constructor(e).find(a);if(g[1]){e=e instanceof d?e[0]:e,k=e?e.ownerDocument||e:c,j=m.exec(a),j?d.isPlainObject(e)?(a=[c.createElement(j[1])],d.fn.attr.call(a,e,!0)):a=[k.createElement(j[1])]:(j=d.buildFragment([g[1]],[k]),a=(j.cacheable?d.clone(j.fragment):j.fragment).childNodes);return d.merge(this,a)}i=c.getElementById(g[2]);if(i&&i.parentNode){if(i.id!==g[2])return f.find(a);this.length=1,this[0]=i}this.context=c,this.selector=a;return this}if(d.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return d.makeArray(a,this)},selector:"",jquery:"1.5.1",length:0,size:function(){return this.length},toArray:function(){return E.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var e=this.constructor();d.isArray(a)?D.apply(e,a):d.merge(e,a),e.prevObject=this,e.context=this.context,b==="find"?e.selector=this.selector+(this.selector?" ":"")+c:b&&(e.selector=this.selector+"."+b+"("+c+")");return e},each:function(a,b){return d.each(this,a,b)},ready:function(a){d.bindReady(),y.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(E.apply(this,arguments),"slice",E.call(arguments).join(","))},map:function(a){return this.pushStack(d.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:D,sort:[].sort,splice:[].splice},d.fn.init.prototype=d.fn,d.extend=d.fn.extend=function(){var a,c,e,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i==="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!=="object"&&!d.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){e=i[c],f=a[c];if(i===f)continue;l&&f&&(d.isPlainObject(f)||(g=d.isArray(f)))?(g?(g=!1,h=e&&d.isArray(e)?e:[]):h=e&&d.isPlainObject(e)?e:{},i[c]=d.extend(l,h,f)):f!==b&&(i[c]=f)}return i},d.extend({noConflict:function(b){a.$=f,b&&(a.jQuery=e);return d},isReady:!1,readyWait:1,ready:function(a){a===!0&&d.readyWait--;if(!d.readyWait||a!==!0&&!d.isReady){if(!c.body)return setTimeout(d.ready,1);d.isReady=!0;if(a!==!0&&--d.readyWait>0)return;y.resolveWith(c,[d]),d.fn.trigger&&d(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!x){x=!0;if(c.readyState==="complete")return setTimeout(d.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",A,!1),a.addEventListener("load",d.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",A),a.attachEvent("onload",d.ready);var b=!1;try{b=a.frameElement==null}catch(e){}c.documentElement.doScroll&&b&&I()}}},isFunction:function(a){return d.type(a)==="function"},isArray:Array.isArray||function(a){return d.type(a)==="array"},isWindow:function(a){return a&&typeof a==="object"&&"setInterval"in a},isNaN:function(a){return a==null||!l.test(a)||isNaN(a)},type:function(a){return a==null?String(a):H[B.call(a)]||"object"},isPlainObject:function(a){if(!a||d.type(a)!=="object"||a.nodeType||d.isWindow(a))return!1;if(a.constructor&&!C.call(a,"constructor")&&!C.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a){}return c===b||C.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!=="string"||!b)return null;b=d.trim(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return a.JSON&&a.JSON.parse?a.JSON.parse(b):(new Function("return "+b))();d.error("Invalid JSON: "+b)},parseXML:function(b,c,e){a.DOMParser?(e=new DOMParser,c=e.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),e=c.documentElement,(!e||!e.nodeName||e.nodeName==="parsererror")&&d.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(a){if(a&&i.test(a)){var b=c.head||c.getElementsByTagName("head")[0]||c.documentElement,e=c.createElement("script");d.support.scriptEval()?e.appendChild(c.createTextNode(a)):e.text=a,b.insertBefore(e,b.firstChild),b.removeChild(e)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,e){var f,g=0,h=a.length,i=h===b||d.isFunction(a);if(e){if(i){for(f in a)if(c.apply(a[f],e)===!1)break}else for(;g<h;)if(c.apply(a[g++],e)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(var j=a[0];g<h&&c.call(j,g,j)!==!1;j=a[++g]){}return a},trim:F?function(a){return a==null?"":F.call(a)}:function(a){return a==null?"":(a+"").replace(j,"").replace(k,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var e=d.type(a);a.length==null||e==="string"||e==="function"||e==="regexp"||d.isWindow(a)?D.call(c,a):d.merge(c,a)}return c},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var c=0,d=b.length;c<d;c++)if(b[c]===a)return c;return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length==="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,b,c){var d=[],e;for(var f=0,g=a.length;f<g;f++)e=b(a[f],f,c),e!=null&&(d[d.length]=e);return d.concat.apply([],d)},guid:1,proxy:function(a,c,e){arguments.length===2&&(typeof c==="string"?(e=a,a=e[c],c=b):c&&!d.isFunction(c)&&(e=c,c=b)),!c&&a&&(c=function(){return a.apply(e||this,arguments)}),a&&(c.guid=a.guid=a.guid||c.guid||d.guid++);return c},access:function(a,c,e,f,g,h){var i=a.length;if(typeof c==="object"){for(var j in c)d.access(a,j,c[j],f,g,e);return a}if(e!==b){f=!h&&f&&d.isFunction(e);for(var k=0;k<i;k++)g(a[k],c,f?e.call(a[k],k,g(a[k],c)):e,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},_Deferred:function(){var a=[],b,c,e,f={done:function(){if(!e){var c=arguments,g,h,i,j,k;b&&(k=b,b=0);for(g=0,h=c.length;g<h;g++)i=c[g],j=d.type(i),j==="array"?f.done.apply(f,i):j==="function"&&a.push(i);k&&f.resolveWith(k[0],k[1])}return this},resolveWith:function(d,f){if(!e&&!b&&!c){c=1;try{while(a[0])a.shift().apply(d,f)}catch(g){throw g}finally{b=[d,f],c=0}}return this},resolve:function(){f.resolveWith(d.isFunction(this.promise)?this.promise():this,arguments);return this},isResolved:function(){return c||b},cancel:function(){e=1,a=[];return this}};return f},Deferred:function(a){var b=d._Deferred(),c=d._Deferred(),e;d.extend(b,{then:function(a,c){b.done(a).fail(c);return this},fail:c.done,rejectWith:c.resolveWith,reject:c.resolve,isRejected:c.isResolved,promise:function(a){if(a==null){if(e)return e;e=a={}}var c=z.length;while(c--)a[z[c]]=b[z[c]];return a}}),b.done(c.cancel).fail(b.cancel),delete b.cancel,a&&a.call(b,b);return b},when:function(a){var b=arguments.length,c=b<=1&&a&&d.isFunction(a.promise)?a:d.Deferred(),e=c.promise();if(b>1){var f=E.call(arguments,0),g=b,h=function(a){return function(b){f[a]=arguments.length>1?E.call(arguments,0):b,--g||c.resolveWith(e,f)}};while(b--)a=f[b],a&&d.isFunction(a.promise)?a.promise().then(h(b),c.reject):--g;g||c.resolveWith(e,f)}else c!==a&&c.resolve(a);return e},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}d.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.subclass=this.subclass,a.fn.init=function b(b,c){c&&c instanceof d&&!(c instanceof a)&&(c=a(c));return d.fn.init.call(this,b,c,e)},a.fn.init.prototype=a.fn;var e=a(c);return a},browser:{}}),y=d._Deferred(),d.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){H["[object "+b+"]"]=b.toLowerCase()}),w=d.uaMatch(v),w.browser&&(d.browser[w.browser]=!0,d.browser.version=w.version),d.browser.webkit&&(d.browser.safari=!0),G&&(d.inArray=function(a,b){return G.call(b,a)}),i.test(" ")&&(j=/^[\s\xA0]+/,k=/[\s\xA0]+$/),g=d(c),c.addEventListener?A=function(){c.removeEventListener("DOMContentLoaded",A,!1),d.ready()}:c.attachEvent&&(A=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",A),d.ready())});return d}();(function(){d.support={};var b=c.createElement("div");b.style.display="none",b.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var e=b.getElementsByTagName("*"),f=b.getElementsByTagName("a")[0],g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=b.getElementsByTagName("input")[0];if(e&&e.length&&f){d.support={leadingWhitespace:b.firstChild.nodeType===3,tbody:!b.getElementsByTagName("tbody").length,htmlSerialize:!!b.getElementsByTagName("link").length,style:/red/.test(f.getAttribute("style")),hrefNormalized:f.getAttribute("href")==="/a",opacity:/^0.55$/.test(f.style.opacity),cssFloat:!!f.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,deleteExpando:!0,optDisabled:!1,checkClone:!1,noCloneEvent:!0,noCloneChecked:!0,boxModel:null,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableHiddenOffsets:!0},i.checked=!0,d.support.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,d.support.optDisabled=!h.disabled;var j=null;d.support.scriptEval=function(){if(j===null){var b=c.documentElement,e=c.createElement("script"),f="script"+d.now();try{e.appendChild(c.createTextNode("window."+f+"=1;"))}catch(g){}b.insertBefore(e,b.firstChild),a[f]?(j=!0,delete a[f]):j=!1,b.removeChild(e),b=e=f=null}return j};try{delete b.test}catch(k){d.support.deleteExpando=!1}!b.addEventListener&&b.attachEvent&&b.fireEvent&&(b.attachEvent("onclick",function l(){d.support.noCloneEvent=!1,b.detachEvent("onclick",l)}),b.cloneNode(!0).fireEvent("onclick")),b=c.createElement("div"),b.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";var m=c.createDocumentFragment();m.appendChild(b.firstChild),d.support.checkClone=m.cloneNode(!0).cloneNode(!0).lastChild.checked,d(function(){var a=c.createElement("div"),b=c.getElementsByTagName("body")[0];if(b){a.style.width=a.style.paddingLeft="1px",b.appendChild(a),d.boxModel=d.support.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,d.support.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="<div style='width:4px;'></div>",d.support.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";var e=a.getElementsByTagName("td");d.support.reliableHiddenOffsets=e[0].offsetHeight===0,e[0].style.display="",e[1].style.display="none",d.support.reliableHiddenOffsets=d.support.reliableHiddenOffsets&&e[0].offsetHeight===0,a.innerHTML="",b.removeChild(a).style.display="none",a=e=null}});var n=function(a){var b=c.createElement("div");a="on"+a;if(!b.attachEvent)return!0;var d=a in b;d||(b.setAttribute(a,"return;"),d=typeof b[a]==="function"),b=null;return d};d.support.submitBubbles=n("submit"),d.support.changeBubbles=n("change"),b=e=f=null}})();var e=/^(?:\{.*\}|\[.*\])$/;d.extend({cache:{},uuid:0,expando:"jQuery"+(d.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?d.cache[a[d.expando]]:a[d.expando];return!!a&&!g(a)},data:function(a,c,e,f){if(d.acceptData(a)){var g=d.expando,h=typeof c==="string",i,j=a.nodeType,k=j?d.cache:a,l=j?a[d.expando]:a[d.expando]&&d.expando;if((!l||f&&l&&!k[l][g])&&h&&e===b)return;l||(j?a[d.expando]=l=++d.uuid:l=d.expando),k[l]||(k[l]={},j||(k[l].toJSON=d.noop));if(typeof c==="object"||typeof c==="function")f?k[l][g]=d.extend(k[l][g],c):k[l]=d.extend(k[l],c);i=k[l],f&&(i[g]||(i[g]={}),i=i[g]),e!==b&&(i[c]=e);if(c==="events"&&!i[c])return i[g]&&i[g].events;return h?i[c]:i}},removeData:function(b,c,e){if(d.acceptData(b)){var f=d.expando,h=b.nodeType,i=h?d.cache:b,j=h?b[d.expando]:d.expando;if(!i[j])return;if(c){var k=e?i[j][f]:i[j];if(k){delete k[c];if(!g(k))return}}if(e){delete i[j][f];if(!g(i[j]))return}var l=i[j][f];d.support.deleteExpando||i!=a?delete i[j]:i[j]=null,l?(i[j]={},h||(i[j].toJSON=d.noop),i[j][f]=l):h&&(d.support.deleteExpando?delete b[d.expando]:b.removeAttribute?b.removeAttribute(d.expando):b[d.expando]=null)}},_data:function(a,b,c){return d.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=d.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),d.fn.extend({data:function(a,c){var e=null;if(typeof a==="undefined"){if(this.length){e=d.data(this[0]);if(this[0].nodeType===1){var g=this[0].attributes,h;for(var i=0,j=g.length;i<j;i++)h=g[i].name,h.indexOf("data-")===0&&(h=h.substr(5),f(this[0],h,e[h]))}}return e}if(typeof a==="object")return this.each(function(){d.data(this,a)});var k=a.split(".");k[1]=k[1]?"."+k[1]:"";if(c===b){e=this.triggerHandler("getData"+k[1]+"!",[k[0]]),e===b&&this.length&&(e=d.data(this[0],a),e=f(this[0],a,e));return e===b&&k[1]?this.data(k[0]):e}return this.each(function(){var b=d(this),e=[k[0],c];b.triggerHandler("setData"+k[1]+"!",e),d.data(this,a,c),b.triggerHandler("changeData"+k[1]+"!",e)})},removeData:function(a){return this.each(function(){d.removeData(this,a)})}}),d.extend({queue:function(a,b,c){if(a){b=(b||"fx")+"queue";var e=d._data(a,b);if(!c)return e||[];!e||d.isArray(c)?e=d._data(a,b,d.makeArray(c)):e.push(c);return e}},dequeue:function(a,b){b=b||"fx";var c=d.queue(a,b),e=c.shift();e==="inprogress"&&(e=c.shift()),e&&(b==="fx"&&c.unshift("inprogress"),e.call(a,function(){d.dequeue(a,b)})),c.length||d.removeData(a,b+"queue",!0)}}),d.fn.extend({queue:function(a,c){typeof a!=="string"&&(c=a,a="fx");if(c===b)return d.queue(this[0],a);return this.each(function(b){var e=d.queue(this,a,c);a==="fx"&&e[0]!=="inprogress"&&d.dequeue(this,a)})},dequeue:function(a){return this.each(function(){d.dequeue(this,a)})},delay:function(a,b){a=d.fx?d.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(){var c=this;setTimeout(function(){d.dequeue(c,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var h=/[\n\t\r]/g,i=/\s+/,j=/\r/g,k=/^(?:href|src|style)$/,l=/^(?:button|input)$/i,m=/^(?:button|input|object|select|textarea)$/i,n=/^a(?:rea)?$/i,o=/^(?:radio|checkbox)$/i;d.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"},d.fn.extend({attr:function(a,b){return d.access(this,a,b,!0,d.attr)},removeAttr:function(a,b){return this.each(function(){d.attr(this,a,""),this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(d.isFunction(a))return this.each(function(b){var c=d(this);c.addClass(a.call(this,b,c.attr("class")))});if(a&&typeof a==="string"){var b=(a||"").split(i);for(var c=0,e=this.length;c<e;c++){var f=this[c];if(f.nodeType===1)if(f.className){var g=" "+f.className+" ",h=f.className;for(var j=0,k=b.length;j<k;j++)g.indexOf(" "+b[j]+" ")<0&&(h+=" "+b[j]);f.className=d.trim(h)}else f.className=a}}return this},removeClass:function(a){if(d.isFunction(a))return this.each(function(b){var c=d(this);c.removeClass(a.call(this,b,c.attr("class")))});if(a&&typeof a==="string"||a===b){var c=(a||"").split(i);for(var e=0,f=this.length;e<f;e++){var g=this[e];if(g.nodeType===1&&g.className)if(a){var j=(" "+g.className+" ").replace(h," ");for(var k=0,l=c.length;k<l;k++)j=j.replace(" "+c[k]+" "," ");g.className=d.trim(j)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,e=typeof b==="boolean";if(d.isFunction(a))return this.each(function(c){var e=d(this);e.toggleClass(a.call(this,c,e.attr("class"),b),b)});return this.each(function(){if(c==="string"){var f,g=0,h=d(this),j=b,k=a.split(i);while(f=k[g++])j=e?j:!h.hasClass(f),h[j?"addClass":"removeClass"](f)}else if(c==="undefined"||c==="boolean")this.className&&d._data(this,"__className__",this.className),this.className=this.className||a===!1?"":d._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ";for(var c=0,d=this.length;c<d;c++)if((" "+this[c].className+" ").replace(h," ").indexOf(b)>-1)return!0;return!1},val:function(a){if(!arguments.length){var c=this[0];if(c){if(d.nodeName(c,"option")){var e=c.attributes.value;return!e||e.specified?c.value:c.text}if(d.nodeName(c,"select")){var f=c.selectedIndex,g=[],h=c.options,i=c.type==="select-one";if(f<0)return null;for(var k=i?f:0,l=i?f+1:h.length;k<l;k++){var m=h[k];if(m.selected&&(d.support.optDisabled?!m.disabled:m.getAttribute("disabled")===null)&&(!m.parentNode.disabled||!d.nodeName(m.parentNode,"optgroup"))){a=d(m).val();if(i)return a;g.push(a)}}if(i&&!g.length&&h.length)return d(h[f]).val();return g}if(o.test(c.type)&&!d.support.checkOn)return c.getAttribute("value")===null?"on":c.value;return(c.value||"").replace(j,"")}return b}var n=d.isFunction(a);return this.each(function(b){var c=d(this),e=a;if(this.nodeType===1){n&&(e=a.call(this,b,c.val())),e==null?e="":typeof e==="number"?e+="":d.isArray(e)&&(e=d.map(e,function(a){return a==null?"":a+""}));if(d.isArray(e)&&o.test(this.type))this.checked=d.inArray(c.val(),e)>=0;else if(d.nodeName(this,"select")){var f=d.makeArray(e);d("option",this).each(function(){this.selected=d.inArray(d(this).val(),f)>=0}),f.length||(this.selectedIndex=-1)}else this.value=e}})}}),d.extend({attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,e,f){if(!a||a.nodeType===3||a.nodeType===8||a.nodeType===2)return b;if(f&&c in d.attrFn)return d(a)[c](e);var g=a.nodeType!==1||!d.isXMLDoc(a),h=e!==b;c=g&&d.props[c]||c;if(a.nodeType===1){var i=k.test(c);if(c==="selected"&&!d.support.optSelected){var j=a.parentNode;j&&(j.selectedIndex,j.parentNode&&j.parentNode.selectedIndex)}if((c in a||a[c]!==b)&&g&&!i){h&&(c==="type"&&l.test(a.nodeName)&&a.parentNode&&d.error("type property can't be changed"),e===null?a.nodeType===1&&a.removeAttribute(c):a[c]=e);if(d.nodeName(a,"form")&&a.getAttributeNode(c))return a.getAttributeNode(c).nodeValue;if(c==="tabIndex"){var o=a.getAttributeNode("tabIndex");return o&&o.specified?o.value:m.test(a.nodeName)||n.test(a.nodeName)&&a.href?0:b}return a[c]}if(!d.support.style&&g&&c==="style"){h&&(a.style.cssText=""+e);return a.style.cssText}h&&a.setAttribute(c,""+e);if(!a.attributes[c]&&(a.hasAttribute&&!a.hasAttribute(c)))return b;var p=!d.support.hrefNormalized&&g&&i?a.getAttribute(c,2):a.getAttribute(c);return p===null?b:p}h&&(a[c]=e);return a[c]}});var p=/\.(.*)$/,q=/^(?:textarea|input|select)$/i,r=/\./g,s=/ /g,t=/[^\w\s.|`]/g,u=function(a){return a.replace(t,"\\$&")};d.event={add:function(c,e,f,g){if(c.nodeType!==3&&c.nodeType!==8){try{d.isWindow(c)&&(c!==a&&!c.frameElement)&&(c=a)}catch(h){}if(f===!1)f=v;else if(!f)return;var i,j;f.handler&&(i=f,f=i.handler),f.guid||(f.guid=d.guid++);var k=d._data(c);if(!k)return;var l=k.events,m=k.handle;l||(k.events=l={}),m||(k.handle=m=function(){return typeof d!=="undefined"&&!d.event.triggered?d.event.handle.apply(m.elem,arguments):b}),m.elem=c,e=e.split(" ");var n,o=0,p;while(n=e[o++]){j=i?d.extend({},i):{handler:f,data:g},n.indexOf(".")>-1?(p=n.split("."),n=p.shift(),j.namespace=p.slice(0).sort().join(".")):(p=[],j.namespace=""),j.type=n,j.guid||(j.guid=f.guid);var q=l[n],r=d.event.special[n]||{};if(!q){q=l[n]=[];if(!r.setup||r.setup.call(c,g,p,m)===!1)c.addEventListener?c.addEventListener(n,m,!1):c.attachEvent&&c.attachEvent("on"+n,m)}r.add&&(r.add.call(c,j),j.handler.guid||(j.handler.guid=f.guid)),q.push(j),d.event.global[n]=!0}c=null}},global:{},remove:function(a,c,e,f){if(a.nodeType!==3&&a.nodeType!==8){e===!1&&(e=v);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=d.hasData(a)&&d._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(e=c.handler,c=c.type);if(!c||typeof c==="string"&&c.charAt(0)==="."){c=c||"";for(h in t)d.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+d.map(m.slice(0).sort(),u).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!e){for(j=0;j<p.length;j++){q=p[j];if(l||n.test(q.namespace))d.event.remove(a,r,q.handler,j),p.splice(j--,1)}continue}o=d.event.special[h]||{};for(j=f||0;j<p.length;j++){q=p[j];if(e.guid===q.guid){if(l||n.test(q.namespace))f==null&&p.splice(j--,1),o.remove&&o.remove.call(a,q);if(f!=null)break}}if(p.length===0||f!=null&&p.length===1)(!o.teardown||o.teardown.call(a,m)===!1)&&d.removeEvent(a,h,s.handle),g=null,delete t[h]}if(d.isEmptyObject(t)){var w=s.handle;w&&(w.elem=null),delete s.events,delete s.handle,d.isEmptyObject(s)&&d.removeData(a,b,!0)}}},trigger:function(a,c,e){var f=a.type||a,g=arguments[3];if(!g){a=typeof a==="object"?a[d.expando]?a:d.extend(d.Event(f),a):d.Event(f),f.indexOf("!")>=0&&(a.type=f=f.slice(0,-1),a.exclusive=!0),e||(a.stopPropagation(),d.event.global[f]&&d.each(d.cache,function(){var b=d.expando,e=this[b];e&&e.events&&e.events[f]&&d.event.trigger(a,c,e.handle.elem)}));if(!e||e.nodeType===3||e.nodeType===8)return b;a.result=b,a.target=e,c=d.makeArray(c),c.unshift(a)}a.currentTarget=e;var h=d._data(e,"handle");h&&h.apply(e,c);var i=e.parentNode||e.ownerDocument;try{e&&e.nodeName&&d.noData[e.nodeName.toLowerCase()]||e["on"+f]&&e["on"+f].apply(e,c)===!1&&(a.result=!1,a.preventDefault())}catch(j){}if(!a.isPropagationStopped()&&i)d.event.trigger(a,c,i,!0);else if(!a.isDefaultPrevented()){var k,l=a.target,m=f.replace(p,""),n=d.nodeName(l,"a")&&m==="click",o=d.event.special[m]||{};if((!o._default||o._default.call(e,a)===!1)&&!n&&!(l&&l.nodeName&&d.noData[l.nodeName.toLowerCase()])){try{l[m]&&(k=l["on"+m],k&&(l["on"+m]=null),d.event.triggered=!0,l[m]())}catch(q){}k&&(l["on"+m]=k),d.event.triggered=!1}}},handle:function(c){var e,f,g,h,i,j=[],k=d.makeArray(arguments);c=k[0]=d.event.fix(c||a.event),c.currentTarget=this,e=c.type.indexOf(".")<0&&!c.exclusive,e||(g=c.type.split("."),c.type=g.shift(),j=g.slice(0).sort(),h=new RegExp("(^|\\.)"+j.join("\\.(?:.*\\.)?")+"(\\.|$)")),c.namespace=c.namespace||j.join("."),i=d._data(this,"events"),f=(i||{})[c.type];if(i&&f){f=f.slice(0);for(var l=0,m=f.length;l<m;l++){var n=f[l];if(e||h.test(n.namespace)){c.handler=n.handler,c.data=n.data,c.handleObj=n;var o=n.handler.apply(this,k);o!==b&&(c.result=o,o===!1&&(c.preventDefault(),c.stopPropagation()));if(c.isImmediatePropagationStopped())break}}}return c.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(a){if(a[d.expando])return a;var e=a;a=d.Event(e);for(var f=this.props.length,g;f;)g=this.props[--f],a[g]=e[g];a.target||(a.target=a.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),!a.relatedTarget&&a.fromElement&&(a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement);if(a.pageX==null&&a.clientX!=null){var h=c.documentElement,i=c.body;a.pageX=a.clientX+(h&&h.scrollLeft||i&&i.scrollLeft||0)-(h&&h.clientLeft||i&&i.clientLeft||0),a.pageY=a.clientY+(h&&h.scrollTop||i&&i.scrollTop||0)-(h&&h.clientTop||i&&i.clientTop||0)}a.which==null&&(a.charCode!=null||a.keyCode!=null)&&(a.which=a.charCode!=null?a.charCode:a.keyCode),!a.metaKey&&a.ctrlKey&&(a.metaKey=a.ctrlKey),!a.which&&a.button!==b&&(a.which=a.button&1?1:a.button&2?3:a.button&4?2:0);return a},guid:1e8,proxy:d.proxy,special:{ready:{setup:d.bindReady,teardown:d.noop},live:{add:function(a){d.event.add(this,F(a.origType,a.selector),d.extend({},a,{handler:E,guid:a.handler.guid}))},remove:function(a){d.event.remove(this,F(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,c){d.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}}},d.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},d.Event=function(a){if(!this.preventDefault)return new d.Event(a);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?w:v):this.type=a,this.timeStamp=d.now(),this[d.expando]=!0},d.Event.prototype={preventDefault:function(){this.isDefaultPrevented=w;var a=this.originalEvent;a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=w;var a=this.originalEvent;a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=w,this.stopPropagation()},isDefaultPrevented:v,isPropagationStopped:v,isImmediatePropagationStopped:v};var x=function(a){var b=a.relatedTarget;try{if(b!==c&&!b.parentNode)return;while(b&&b!==this)b=b.parentNode;b!==this&&(a.type=a.data,d.event.handle.apply(this,arguments))}catch(e){}},y=function(a){a.type=a.data,d.event.handle.apply(this,arguments)};d.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){d.event.special[a]={setup:function(c){d.event.add(this,b,c&&c.selector?y:x,a)},teardown:function(a){d.event.remove(this,b,a&&a.selector?y:x)}}}),d.support.submitBubbles||(d.event.special.submit={setup:function(a,b){if(this.nodeName&&this.nodeName.toLowerCase()!=="form")d.event.add(this,"click.specialSubmit",function(a){var b=a.target,c=b.type;(c==="submit"||c==="image")&&d(b).closest("form").length&&C("submit",this,arguments)}),d.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,c=b.type;(c==="text"||c==="password")&&d(b).closest("form").length&&a.keyCode===13&&C("submit",this,arguments)});else return!1},teardown:function(a){d.event.remove(this,".specialSubmit")}});if(!d.support.changeBubbles){var z,A=function(a){var b=a.type,c=a.value;b==="radio"||b==="checkbox"?c=a.checked:b==="select-multiple"?c=a.selectedIndex>-1?d.map(a.options,function(a){return a.selected}).join("-"):"":a.nodeName.toLowerCase()==="select"&&(c=a.selectedIndex);return c},B=function B(a){var c=a.target,e,f;if(q.test(c.nodeName)&&!c.readOnly){e=d._data(c,"_change_data"),f=A(c),(a.type!=="focusout"||c.type!=="radio")&&d._data(c,"_change_data",f);if(e===b||f===e)return;if(e!=null||f)a.type="change",a.liveFired=b,d.event.trigger(a,arguments[1],c)}};d.event.special.change={filters:{focusout:B,beforedeactivate:B,click:function(a){var b=a.target,c=b.type;(c==="radio"||c==="checkbox"||b.nodeName.toLowerCase()==="select")&&B.call(this,a)},keydown:function(a){var b=a.target,c=b.type;(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&B.call(this,a)},beforeactivate:function(a){var b=a.target;d._data(b,"_change_data",A(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in z)d.event.add(this,c+".specialChange",z[c]);return q.test(this.nodeName)},teardown:function(a){d.event.remove(this,".specialChange");return q.test(this.nodeName)}},z=d.event.special.change.filters,z.focus=z.beforeactivate}c.addEventListener&&d.each({focus:"focusin",blur:"focusout"},function(a,b){function c(a){a=d.event.fix(a),a.type=b;return d.event.handle.call(this,a)}d.event.special[b]={setup:function(){this.addEventListener(a,c,!0)},teardown:function(){this.removeEventListener(a,c,!0)}}}),d.each(["bind","one"],function(a,c){d.fn[c]=function(a,e,f){if(typeof a==="object"){for(var g in a)this[c](g,e,a[g],f);return this}if(d.isFunction(e)||e===!1)f=e,e=b;var h=c==="one"?d.proxy(f,function(a){d(this).unbind(a,h);return f.apply(this,arguments)}):f;if(a==="unload"&&c!=="one")this.one(a,e,f);else for(var i=0,j=this.length;i<j;i++)d.event.add(this[i],a,h,e);return this}}),d.fn.extend({unbind:function(a,b){if(typeof a!=="object"||a.preventDefault)for(var e=0,f=this.length;e<f;e++)d.event.remove(this[e],a,b);else for(var c in a)this.unbind(c,a[c]);return this},delegate:function(a,b,c,d){return this.live(b,c,d,a)},undelegate:function(a,b,c){return arguments.length===0?this.unbind("live"):this.die(b,null,c,a)},trigger:function(a,b){return this.each(function(){d.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){var c=d.Event(a);c.preventDefault(),c.stopPropagation(),d.event.trigger(c,b,this[0]);return c.result}},toggle:function(a){var b=arguments,c=1;while(c<b.length)d.proxy(a,b[c++]);return this.click(d.proxy(a,function(e){var f=(d._data(this,"lastToggle"+a.guid)||0)%c;d._data(this,"lastToggle"+a.guid,f+1),e.preventDefault();return b[f].apply(this,arguments)||!1}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var D={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};d.each(["live","die"],function(a,c){d.fn[c]=function(a,e,f,g){var h,i=0,j,k,l,m=g||this.selector,n=g?this:d(this.context);if(typeof a==="object"&&!a.preventDefault){for(var o in a)n[c](o,e,a[o],m);return this}d.isFunction(e)&&(f=e,e=b),a=(a||"").split(" ");while((h=a[i++])!=null){j=p.exec(h),k="",j&&(k=j[0],h=h.replace(p,""));if(h==="hover"){a.push("mouseenter"+k,"mouseleave"+k);continue}l=h,h==="focus"||h==="blur"?(a.push(D[h]+k),h=h+k):h=(D[h]||h)+k;if(c==="live")for(var q=0,r=n.length;q<r;q++)d.event.add(n[q],"live."+F(h,m),{data:e,selector:m,handler:f,origType:h,origHandler:f,preType:l});else n.unbind("live."+F(h,m),f)}return this}}),d.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){d.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.bind(b,a,c):this.trigger(b)},d.attrFn&&(d.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}if(i.nodeType===1){f||(i.sizcache=c,i.sizset=g);if(typeof b!=="string"){if(i===b){j=!0;break}}else if(k.filter(b,[i]).length>0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}i.nodeType===1&&!f&&(i.sizcache=c,i.sizset=g);if(i.nodeName.toLowerCase()===b){j=i;break}i=i[a]}d[g]=j}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,e,g){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!=="string")return e;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(f.call(n)==="[object Array]")if(u)if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&e.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&e.push(j[t]);else e.push.apply(e,n);else p(n,e);o&&(k(o,h,e,g),k.uniqueSort(e));return e};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},k.matches=function(a,b){return k(a,null,null,b)},k.matchesSelector=function(a,b){return k(b,null,null,[a]).length>0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e<f;e++){var g,h=l.order[e];if(g=l.leftMatch[h].exec(a)){var j=g[1];g.splice(1,1);if(j.substr(j.length-1)!=="\\"){g[1]=(g[1]||"").replace(i,""),d=l.find[h](g,b,c);if(d!=null){a=a.replace(l.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!=="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},k.filter=function(a,c,d,e){var f,g,h=a,i=[],j=c,m=c&&c[0]&&k.isXML(c[0]);while(a&&c.length){for(var n in l.filter)if((f=l.leftMatch[n].exec(a))!=null&&f[2]){var o,p,q=l.filter[n],r=f[1];g=!1,f.splice(1,1);if(r.substr(r.length-1)==="\\")continue;j===i&&(i=[]);if(l.preFilter[n]){f=l.preFilter[n](f,j,d,i,e,m);if(f){if(f===!0)continue}else g=o=!0}if(f)for(var s=0;(p=j[s])!=null;s++)if(p){o=q(p,f,s,j);var t=e^!!o;d&&o!=null?t?g=!0:j[s]=!1:t&&(i.push(p),g=!0)}if(o!==b){d||(j=i),a=a.replace(l.match[n],"");if(!g)return[];break}}if(a===h)if(g==null)k.error(a);else break;h=a}return j},k.error=function(a){throw"Syntax error, unrecognized expression: "+a};var l=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b==="string",d=c&&!j.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1){}a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&k.filter(b,a,!0)},">":function(a,b){var c,d=typeof b==="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&k.filter(b,a,!0)}},"":function(a,b,c){var d,f=e++,g=u;typeof b==="string"&&!j.test(b)&&(b=b.toLowerCase(),d=b,g=t),g("parentNode",b,f,a,d,c)},"~":function(a,b,c){var d,f=e++,g=u;typeof b==="string"&&!j.test(b)&&(b=b.toLowerCase(),d=b,g=t),g("previousSibling",b,f,a,d,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!=="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!=="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!=="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(i,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){return"text"===a.getAttribute("type")},radio:function(a){return"radio"===a.type},checkbox:function(a){return"checkbox"===a.type},file:function(a){return"file"===a.type},password:function(a){return"password"===a.type},submit:function(a){return"submit"===a.type},image:function(a){return"image"===a.type},reset:function(a){return"reset"===a.type},button:function(a){return"button"===a.type||a.nodeName.toLowerCase()==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}k.error(e)},CHILD:function(a,b){var c=b[1],d=a;switch(c){case"only":case"first":while(d=d.previousSibling)if(d.nodeType===1)return!1;if(c==="first")return!0;d=a;case"last":while(d=d.nextSibling)if(d.nodeType===1)return!1;return!0;case"nth":var e=b[2],f=b[3];if(e===1&&f===0)return!0;var g=b[0],h=a.parentNode;if(h&&(h.sizcache!==g||!a.nodeIndex)){var i=0;for(d=h.firstChild;d;d=d.nextSibling)d.nodeType===1&&(d.nodeIndex=++i);h.sizcache=g}var j=a.nodeIndex-f;return e===0?j===0:j%e===0&&j/e>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(f.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length==="number")for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var r,s;c.documentElement.compareDocumentPosition?r=function(a,b){if(a===b){g=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(r=function(a,b){var c,d,e=[],f=[],h=a.parentNode,i=b.parentNode,j=h;if(a===b){g=!0;return 0}if(h===i)return s(a,b);if(!h)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return s(e[k],f[k]);return k===c?s(a,f[k],-1):s(e[k],b,1)},s=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),k.getText=function(a){var b="",c;for(var d=0;a[d];d++)c=a[d],c.nodeType===3||c.nodeType===4?b+=c.nodeValue:c.nodeType!==8&&(b+=k.getText(c.childNodes));return b},function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!=="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!=="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!=="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!=="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector,d=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(e){d=!0}b&&(k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(d||!l.match.PSEUDO.test(c)&&!/!=/.test(c))return b.call(a,c)}catch(e){}return k(c,null,null,[a]).length>0})}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!=="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g<h;g++)k(a,f[g],d);return k.filter(e,d)};d.find=k,d.expr=k.selectors,d.expr[":"]=d.expr.filters,d.unique=k.uniqueSort,d.text=k.getText,d.isXMLDoc=k.isXML,d.contains=k.contains}();var G=/Until$/,H=/^(?:parents|prevUntil|prevAll)/,I=/,/,J=/^.[^:#\[\.,]*$/,K=Array.prototype.slice,L=d.expr.match.POS,M={children:!0,contents:!0,next:!0,prev:!0};d.fn.extend({find:function(a){var b=this.pushStack("","find",a),c=0;for(var e=0,f=this.length;e<f;e++){c=b.length,d.find(a,this[e],b);if(e>0)for(var g=c;g<b.length;g++)for(var h=0;h<c;h++)if(b[h]===b[g]){b.splice(g--,1);break}}return b},has:function(a){var b=d(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(d.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(O(this,a,!1),"not",a)},filter:function(a){return this.pushStack(O(this,a,!0),"filter",a)},is:function(a){return!!a&&d.filter(a,this).length>0},closest:function(a,b){var c=[],e,f,g=this[0];if(d.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(e=0,f=a.length;e<f;e++)i=a[e],j[i]||(j[i]=d.expr.match.POS.test(i)?d(i,b||this.context):i);while(g&&g.ownerDocument&&g!==b){for(i in j)h=j[i],(h.jquery?h.index(g)>-1:d(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=L.test(a)?d(a,b||this.context):null;for(e=0,f=this.length;e<f;e++){g=this[e];while(g){if(l?l.index(g)>-1:d.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b)break}}c=c.length>1?d.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a||typeof a==="string")return d.inArray(this[0],a?d(a):this.parent().children());return d.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a==="string"?d(a,b):d.makeArray(a),e=d.merge(this.get(),c);return this.pushStack(N(c[0])||N(e[0])?e:d.unique(e))},andSelf:function(){return this.add(this.prevObject)}}),d.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return d.dir(a,"parentNode")},parentsUntil:function(a,b,c){return d.dir(a,"parentNode",c)},next:function(a){return d.nth(a,2,"nextSibling")},prev:function(a){return d.nth(a,2,"previousSibling")},nextAll:function(a){return d.dir(a,"nextSibling")},prevAll:function(a){return d.dir(a,"previousSibling")},nextUntil:function(a,b,c){return d.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return d.dir(a,"previousSibling",c)},siblings:function(a){return d.sibling(a.parentNode.firstChild,a)},children:function(a){return d.sibling(a.firstChild)},contents:function(a){return d.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:d.makeArray(a.childNodes)}},function(a,b){d.fn[a]=function(c,e){var f=d.map(this,b,c),g=K.call(arguments);G.test(a)||(e=c),e&&typeof e==="string"&&(f=d.filter(e,f)),f=this.length>1&&!M[a]?d.unique(f):f,(this.length>1||I.test(e))&&H.test(a)&&(f=f.reverse());return this.pushStack(f,a,g.join(","))}}),d.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?d.find.matchesSelector(b[0],a)?[b[0]]:[]:d.find.matches(a,b)},dir:function(a,c,e){var f=[],g=a[c];while(g&&g.nodeType!==9&&(e===b||g.nodeType!==1||!d(g).is(e)))g.nodeType===1&&f.push(g),g=g[c];return f},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var P=/ jQuery\d+="(?:\d+|null)"/g,Q=/^\s+/,R=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,S=/<([\w:]+)/,T=/<tbody/i,U=/<|&#?\w+;/,V=/<(?:script|object|embed|option|style)/i,W=/checked\s*(?:[^=]|=\s*.checked.)/i,X={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};X.optgroup=X.option,X.tbody=X.tfoot=X.colgroup=X.caption=X.thead,X.th=X.td,d.support.htmlSerialize||(X._default=[1,"div<div>","</div>"]),d.fn.extend({text:function(a){if(d.isFunction(a))return this.each(function(b){var c=d(this);c.text(a.call(this,b,c.text()))});if(typeof a!=="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return d.text(this)},wrapAll:function(a){if(d.isFunction(a))return this.each(function(b){d(this).wrapAll(a.call(this,b))});if(this[0]){var b=d(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(d.isFunction(a))return this.each(function(b){d(this).wrapInner(a.call(this,b))});return this.each(function(){var b=d(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){d(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){d.nodeName(this,"body")||d(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=d(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,d(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,e;(e=this[c])!=null;c++)if(!a||d.filter(a,[e]).length)!b&&e.nodeType===1&&(d.cleanData(e.getElementsByTagName("*")),d.cleanData([e])),e.parentNode&&e.parentNode.removeChild(e);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&d.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return d.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(P,""):null;if(typeof a!=="string"||V.test(a)||!d.support.leadingWhitespace&&Q.test(a)||X[(S.exec(a)||["",""])[1].toLowerCase()])d.isFunction(a)?this.each(function(b){var c=d(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);else{a=a.replace(R,"<$1></$2>");try{for(var c=0,e=this.length;c<e;c++)this[c].nodeType===1&&(d.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(f){this.empty().append(a)}}return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(d.isFunction(a))return this.each(function(b){var c=d(this),e=c.html();c.replaceWith(a.call(this,b,e))});typeof a!=="string"&&(a=d(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;d(this).remove(),b?d(b).before(a):d(c).append(a)})}return this.pushStack(d(d.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,e){var f,g,h,i,j=a[0],k=[];if(!d.support.checkClone&&arguments.length===3&&typeof j==="string"&&W.test(j))return this.each(function(){d(this).domManip(a,c,e,!0)});if(d.isFunction(j))return this.each(function(f){var g=d(this);a[0]=j.call(this,f,c?g.html():b),g.domManip(a,c,e)});if(this[0]){i=j&&j.parentNode,d.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?f={fragment:i}:f=d.buildFragment(a,this,k),h=f.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&d.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)e.call(c?Y(this[l],g):this[l],f.cacheable||m>1&&l<n?d.clone(h,!0,!0):h)}k.length&&d.each(k,ba)}return this}}),d.buildFragment=function(a,b,e){var f,g,h,i=b&&b[0]?b[0].ownerDocument||b[0]:c;a.length===1&&typeof a[0]==="string"&&a[0].length<512&&i===c&&a[0].charAt(0)==="<"&&!V.test(a[0])&&(d.support.checkClone||!W.test(a[0]))&&(g=!0,h=d.fragments[a[0]],h&&(h!==1&&(f=h))),f||(f=i.createDocumentFragment(),d.clean(a,i,f,e)),g&&(d.fragments[a[0]]=h?f:1);return{fragment:f,cacheable:g}},d.fragments={},d.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){d.fn[a]=function(c){var e=[],f=d(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&f.length===1){f[b](this[0]);return this}for(var h=0,i=f.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();d(f[h])[b](j),e=e.concat(j)}return this.pushStack(e,a,f.selector)}}),d.extend({clone:function(a,b,c){var e=a.cloneNode(!0),f,g,h;if((!d.support.noCloneEvent||!d.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!d.isXMLDoc(a)){$(a,e),f=_(a),g=_(e);for(h=0;f[h];++h)$(f[h],g[h])}if(b){Z(a,e);if(c){f=_(a),g=_(e);for(h=0;f[h];++h)Z(f[h],g[h])}}return e},clean:function(a,b,e,f){b=b||c,typeof b.createElement==="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var g=[];for(var h=0,i;(i=a[h])!=null;h++){typeof i==="number"&&(i+="");if(!i)continue;if(typeof i!=="string"||U.test(i)){if(typeof i==="string"){i=i.replace(R,"<$1></$2>");var j=(S.exec(i)||["",""])[1].toLowerCase(),k=X[j]||X._default,l=k[0],m=b.createElement("div");m.innerHTML=k[1]+i+k[2];while(l--)m=m.lastChild;if(!d.support.tbody){var n=T.test(i),o=j==="table"&&!n?m.firstChild&&m.firstChild.childNodes:k[1]==="<table>"&&!n?m.childNodes:[];for(var p=o.length-1;p>=0;--p)d.nodeName(o[p],"tbody")&&!o[p].childNodes.length&&o[p].parentNode.removeChild(o[p])}!d.support.leadingWhitespace&&Q.test(i)&&m.insertBefore(b.createTextNode(Q.exec(i)[0]),m.firstChild),i=m.childNodes}}else i=b.createTextNode(i);i.nodeType?g.push(i):g=d.merge(g,i)}if(e)for(h=0;g[h];h++)!f||!d.nodeName(g[h],"script")||g[h].type&&g[h].type.toLowerCase()!=="text/javascript"?(g[h].nodeType===1&&g.splice.apply(g,[h+1,0].concat(d.makeArray(g[h].getElementsByTagName("script")))),e.appendChild(g[h])):f.push(g[h].parentNode?g[h].parentNode.removeChild(g[h]):g[h]);return g},cleanData:function(a){var b,c,e=d.cache,f=d.expando,g=d.event.special,h=d.support.deleteExpando;for(var i=0,j;(j=a[i])!=null;i++){if(j.nodeName&&d.noData[j.nodeName.toLowerCase()])continue;c=j[d.expando];if(c){b=e[c]&&e[c][f];if(b&&b.events){for(var k in b.events)g[k]?d.event.remove(j,k):d.removeEvent(j,k,b.handle);b.handle&&(b.handle.elem=null)}h?delete j[d.expando]:j.removeAttribute&&j.removeAttribute(d.expando),delete e[c]}}}});var bb=/alpha\([^)]*\)/i,bc=/opacity=([^)]*)/,bd=/-([a-z])/ig,be=/([A-Z])/g,bf=/^-?\d+(?:px)?$/i,bg=/^-?\d/,bh={position:"absolute",visibility:"hidden",display:"block"},bi=["Left","Right"],bj=["Top","Bottom"],bk,bl,bm,bn=function(a,b){return b.toUpperCase()};d.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return d.access(this,a,c,!0,function(a,c,e){return e!==b?d.style(a,c,e):d.css(a,c)})},d.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bk(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{zIndex:!0,fontWeight:!0,opacity:!0,zoom:!0,lineHeight:!0},cssProps:{"float":d.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,e,f){if(a&&a.nodeType!==3&&a.nodeType!==8&&a.style){var g,h=d.camelCase(c),i=a.style,j=d.cssHooks[h];c=d.cssProps[h]||h;if(e===b){if(j&&"get"in j&&(g=j.get(a,!1,f))!==b)return g;return i[c]}if(typeof e==="number"&&isNaN(e)||e==null)return;typeof e==="number"&&!d.cssNumber[h]&&(e+="px");if(!j||!("set"in j)||(e=j.set(a,e))!==b)try{i[c]=e}catch(k){}}},css:function(a,c,e){var f,g=d.camelCase(c),h=d.cssHooks[g];c=d.cssProps[g]||g;if(h&&"get"in h&&(f=h.get(a,!0,e))!==b)return f;if(bk)return bk(a,c,g)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]},camelCase:function(a){return a.replace(bd,bn)}}),d.curCSS=d.css,d.each(["height","width"],function(a,b){d.cssHooks[b]={get:function(a,c,e){var f;if(c){a.offsetWidth!==0?f=bo(a,b,e):d.swap(a,bh,function(){f=bo(a,b,e)});if(f<=0){f=bk(a,b,b),f==="0px"&&bm&&(f=bm(a,b,b));if(f!=null)return f===""||f==="auto"?"0px":f}if(f<0||f==null){f=a.style[b];return f===""||f==="auto"?"0px":f}return typeof f==="string"?f:f+"px"}},set:function(a,b){if(!bf.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),d.support.opacity||(d.cssHooks.opacity={get:function(a,b){return bc.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style;c.zoom=1;var e=d.isNaN(b)?"":"alpha(opacity="+b*100+")",f=c.filter||"";c.filter=bb.test(f)?f.replace(bb,e):c.filter+" "+e}}),c.defaultView&&c.defaultView.getComputedStyle&&(bl=function(a,c,e){var f,g,h;e=e.replace(be,"-$1").toLowerCase();if(!(g=a.ownerDocument.defaultView))return b;if(h=g.getComputedStyle(a,null))f=h.getPropertyValue(e),f===""&&!d.contains(a.ownerDocument.documentElement,a)&&(f=d.style(a,e));return f}),c.documentElement.currentStyle&&(bm=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bf.test(d)&&bg.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bk=bl||bm,d.expr&&d.expr.filters&&(d.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!d.support.reliableHiddenOffsets&&(a.style.display||d.css(a,"display"))==="none"},d.expr.filters.visible=function(a){return!d.expr.filters.hidden(a)});var bp=/%20/g,bq=/\[\]$/,br=/\r?\n/g,bs=/#.*$/,bt=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bu=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bv=/(?:^file|^widget|\-extension):$/,bw=/^(?:GET|HEAD)$/,bx=/^\/\//,by=/\?/,bz=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bA=/^(?:select|textarea)/i,bB=/\s+/,bC=/([?&])_=[^&]*/,bD=/(^|\-)([a-z])/g,bE=function(a,b,c){return b+c.toUpperCase()},bF=/^([\w\+\.\-]+:)\/\/([^\/?#:]*)(?::(\d+))?/,bG=d.fn.load,bH={},bI={},bJ,bK;try{bJ=c.location.href}catch(bL){bJ=c.createElement("a"),bJ.href="",bJ=bJ.href}bK=bF.exec(bJ.toLowerCase()),d.fn.extend({load:function(a,c,e){if(typeof a!=="string"&&bG)return bG.apply(this,arguments);if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var g=a.slice(f,a.length);a=a.slice(0,f)}var h="GET";c&&(d.isFunction(c)?(e=c,c=b):typeof c==="object"&&(c=d.param(c,d.ajaxSettings.traditional),h="POST"));var i=this;d.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?d("<div>").append(c.replace(bz,"")).find(g):c)),e&&i.each(e,[c,b,a])}});return this},serialize:function(){return d.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?d.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bA.test(this.nodeName)||bu.test(this.type))}).map(function(a,b){var c=d(this).val();return c==null?null:d.isArray(c)?d.map(c,function(a,c){return{name:b.name,value:a.replace(br,"\r\n")}}):{name:b.name,value:c.replace(br,"\r\n")}}).get()}}),d.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){d.fn[b]=function(a){return this.bind(b,a)}}),d.each(["get","post"],function(a,c){d[c]=function(a,e,f,g){d.isFunction(e)&&(g=g||f,f=e,e=b);return d.ajax({type:c,url:a,data:e,success:f,dataType:g})}}),d.extend({getScript:function(a,c){return d.get(a,b,c,"script")},getJSON:function(a,b,c){return d.get(a,b,c,"json")},ajaxSetup:function(a,b){b?d.extend(!0,a,d.ajaxSettings,b):(b=a,a=d.extend(!0,d.ajaxSettings,b));for(var c in {context:1,url:1})c in b?a[c]=b[c]:c in d.ajaxSettings&&(a[c]=d.ajaxSettings[c]);return a},ajaxSettings:{url:bJ,isLocal:bv.test(bK[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":d.parseJSON,"text xml":d.parseXML}},ajaxPrefilter:bM(bH),ajaxTransport:bM(bI),ajax:function(a,c){function v(a,c,l,n){if(r!==2){r=2,p&&clearTimeout(p),o=b,m=n||"",u.readyState=a?4:0;var q,t,v,w=l?bP(e,u,l):b,x,y;if(a>=200&&a<300||a===304){if(e.ifModified){if(x=u.getResponseHeader("Last-Modified"))d.lastModified[k]=x;if(y=u.getResponseHeader("Etag"))d.etag[k]=y}if(a===304)c="notmodified",q=!0;else try{t=bQ(e,w),c="success",q=!0}catch(z){c="parsererror",v=z}}else{v=c;if(!c||a)c="error",a<0&&(a=0)}u.status=a,u.statusText=c,q?h.resolveWith(f,[t,c,u]):h.rejectWith(f,[u,c,v]),u.statusCode(j),j=b,s&&g.trigger("ajax"+(q?"Success":"Error"),[u,e,q?t:v]),i.resolveWith(f,[u,c]),s&&(g.trigger("ajaxComplete",[u,e]),--d.active||d.event.trigger("ajaxStop"))}}typeof a==="object"&&(c=a,a=b),c=c||{};var e=d.ajaxSetup({},c),f=e.context||e,g=f!==e&&(f.nodeType||f instanceof d)?d(f):d.event,h=d.Deferred(),i=d._Deferred(),j=e.statusCode||{},k,l={},m,n,o,p,q,r=0,s,t,u={readyState:0,setRequestHeader:function(a,b){r||(l[a.toLowerCase().replace(bD,bE)]=b);return this},getAllResponseHeaders:function(){return r===2?m:null},getResponseHeader:function(a){var c;if(r===2){if(!n){n={};while(c=bt.exec(m))n[c[1].toLowerCase()]=c[2]}c=n[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){r||(e.mimeType=a);return this},abort:function(a){a=a||"abort",o&&o.abort(a),v(0,a);return this}};h.promise(u),u.success=u.done,u.error=u.fail,u.complete=i.done,u.statusCode=function(a){if(a){var b;if(r<2)for(b in a)j[b]=[j[b],a[b]];else b=a[u.status],u.then(b,b)}return this},e.url=((a||e.url)+"").replace(bs,"").replace(bx,bK[1]+"//"),e.dataTypes=d.trim(e.dataType||"*").toLowerCase().split(bB),e.crossDomain||(q=bF.exec(e.url.toLowerCase()),e.crossDomain=q&&(q[1]!=bK[1]||q[2]!=bK[2]||(q[3]||(q[1]==="http:"?80:443))!=(bK[3]||(bK[1]==="http:"?80:443)))),e.data&&e.processData&&typeof e.data!=="string"&&(e.data=d.param(e.data,e.traditional)),bN(bH,e,c,u);if(r===2)return!1;s=e.global,e.type=e.type.toUpperCase(),e.hasContent=!bw.test(e.type),s&&d.active++===0&&d.event.trigger("ajaxStart");if(!e.hasContent){e.data&&(e.url+=(by.test(e.url)?"&":"?")+e.data),k=e.url;if(e.cache===!1){var w=d.now(),x=e.url.replace(bC,"$1_="+w);e.url=x+(x===e.url?(by.test(e.url)?"&":"?")+"_="+w:"")}}if(e.data&&e.hasContent&&e.contentType!==!1||c.contentType)l["Content-Type"]=e.contentType;e.ifModified&&(k=k||e.url,d.lastModified[k]&&(l["If-Modified-Since"]=d.lastModified[k]),d.etag[k]&&(l["If-None-Match"]=d.etag[k])),l.Accept=e.dataTypes[0]&&e.accepts[e.dataTypes[0]]?e.accepts[e.dataTypes[0]]+(e.dataTypes[0]!=="*"?", */*; q=0.01":""):e.accepts["*"];for(t in e.headers)u.setRequestHeader(t,e.headers[t]);if(e.beforeSend&&(e.beforeSend.call(f,u,e)===!1||r===2)){u.abort();return!1}for(t in {success:1,error:1,complete:1})u[t](e[t]);o=bN(bI,e,c,u);if(o){u.readyState=1,s&&g.trigger("ajaxSend",[u,e]),e.async&&e.timeout>0&&(p=setTimeout(function(){u.abort("timeout")},e.timeout));try{r=1,o.send(l,v)}catch(y){status<2?v(-1,y):d.error(y)}}else v(-1,"No Transport");return u},param:function(a,c){var e=[],f=function(a,b){b=d.isFunction(b)?b():b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=d.ajaxSettings.traditional);if(d.isArray(a)||a.jquery&&!d.isPlainObject(a))d.each(a,function(){f(this.name,this.value)});else for(var g in a)bO(g,a[g],c,f);return e.join("&").replace(bp,"+")}}),d.extend({active:0,lastModified:{},etag:{}});var bR=d.now(),bS=/(\=)\?(&|$)|()\?\?()/i;d.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return d.expando+"_"+bR++}}),d.ajaxPrefilter("json jsonp",function(b,c,e){var f=typeof b.data==="string";if(b.dataTypes[0]==="jsonp"||c.jsonpCallback||c.jsonp!=null||b.jsonp!==!1&&(bS.test(b.url)||f&&bS.test(b.data))){var g,h=b.jsonpCallback=d.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2",m=function(){a[h]=i,g&&d.isFunction(i)&&a[h](g[0])};b.jsonp!==!1&&(j=j.replace(bS,l),b.url===j&&(f&&(k=k.replace(bS,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},e.then(m,m),b.converters["script json"]=function(){g||d.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),d.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){d.globalEval(a);return a}}}),d.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),d.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var bT=d.now(),bU,bV;d.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&bX()||bY()}:bX,bV=d.ajaxSettings.xhr(),d.support.ajax=!!bV,d.support.cors=bV&&"withCredentials"in bV,bV=b,d.support.ajax&&d.ajaxTransport(function(a){if(!a.crossDomain||d.support.cors){var c;return{send:function(e,f){var g=a.xhr(),h,i;a.username?g.open(a.type,a.url,a.async,a.username,a.password):g.open(a.type,a.url,a.async);if(a.xhrFields)for(i in a.xhrFields)g[i]=a.xhrFields[i];a.mimeType&&g.overrideMimeType&&g.overrideMimeType(a.mimeType),(!a.crossDomain||a.hasContent)&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(i in e)g.setRequestHeader(i,e[i])}catch(j){}g.send(a.hasContent&&a.data||null),c=function(e,i){var j,k,l,m,n;try{if(c&&(i||g.readyState===4)){c=b,h&&(g.onreadystatechange=d.noop,delete bU[h]);if(i)g.readyState!==4&&g.abort();else{j=g.status,l=g.getAllResponseHeaders(),m={},n=g.responseXML,n&&n.documentElement&&(m.xml=n),m.text=g.responseText;try{k=g.statusText}catch(o){k=""}j||!a.isLocal||a.crossDomain?j===1223&&(j=204):j=m.text?200:404}}}catch(p){i||f(-1,p)}m&&f(j,k,m,l)},a.async&&g.readyState!==4?(bU||(bU={},bW()),h=bT++,g.onreadystatechange=bU[h]=c):c()},abort:function(){c&&c(0,1)}}}});var bZ={},b$=/^(?:toggle|show|hide)$/,b_=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,ca,cb=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];d.fn.extend({show:function(a,b,c){var e,f;if(a||a===0)return this.animate(cc("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)e=this[g],f=e.style.display,!d._data(e,"olddisplay")&&f==="none"&&(f=e.style.display=""),f===""&&d.css(e,"display")==="none"&&d._data(e,"olddisplay",cd(e.nodeName));for(g=0;g<h;g++){e=this[g],f=e.style.display;if(f===""||f==="none")e.style.display=d._data(e,"olddisplay")||""}return this},hide:function(a,b,c){if(a||a===0)return this.animate(cc("hide",3),a,b,c);for(var e=0,f=this.length;e<f;e++){var g=d.css(this[e],"display");g!=="none"&&!d._data(this[e],"olddisplay")&&d._data(this[e],"olddisplay",g)}for(e=0;e<f;e++)this[e].style.display="none";return this},_toggle:d.fn.toggle,toggle:function(a,b,c){var e=typeof a==="boolean";d.isFunction(a)&&d.isFunction(b)?this._toggle.apply(this,arguments):a==null||e?this.each(function(){var b=e?a:d(this).is(":hidden");d(this)[b?"show":"hide"]()}):this.animate(cc("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,e){var f=d.speed(b,c,e);if(d.isEmptyObject(a))return this.each(f.complete);return this[f.queue===!1?"each":"queue"](function(){var b=d.extend({},f),c,e=this.nodeType===1,g=e&&d(this).is(":hidden"),h=this;for(c in a){var i=d.camelCase(c);c!==i&&(a[i]=a[c],delete a[c],c=i);if(a[c]==="hide"&&g||a[c]==="show"&&!g)return b.complete.call(this);if(e&&(c==="height"||c==="width")){b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY];if(d.css(this,"display")==="inline"&&d.css(this,"float")==="none")if(d.support.inlineBlockNeedsLayout){var j=cd(this.nodeName);j==="inline"?this.style.display="inline-block":(this.style.display="inline",this.style.zoom=1)}else this.style.display="inline-block"}d.isArray(a[c])&&((b.specialEasing=b.specialEasing||{})[c]=a[c][1],a[c]=a[c][0])}b.overflow!=null&&(this.style.overflow="hidden"),b.curAnim=d.extend({},a),d.each(a,function(c,e){var f=new d.fx(h,b,c);if(b$.test(e))f[e==="toggle"?g?"show":"hide":e](a);else{var i=b_.exec(e),j=f.cur();if(i){var k=parseFloat(i[2]),l=i[3]||(d.cssNumber[c]?"":"px");l!=="px"&&(d.style(h,c,(k||1)+l),j=(k||1)/f.cur()*j,d.style(h,c,j+l)),i[1]&&(k=(i[1]==="-="?-1:1)*k+j),f.custom(j,k,l)}else f.custom(j,e,"")}});return!0})},stop:function(a,b){var c=d.timers;a&&this.queue([]),this.each(function(){for(var a=c.length-1;a>=0;a--)c[a].elem===this&&(b&&c[a](!0),c.splice(a,1))}),b||this.dequeue();return this}}),d.each({slideDown:cc("show",1),slideUp:cc("hide",1),slideToggle:cc("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){d.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),d.extend({speed:function(a,b,c){var e=a&&typeof a==="object"?d.extend({},a):{complete:c||!c&&b||d.isFunction(a)&&a,duration:a,easing:c&&b||b&&!d.isFunction(b)&&b};e.duration=d.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in d.fx.speeds?d.fx.speeds[e.duration]:d.fx.speeds._default,e.old=e.complete,e.complete=function(){e.queue!==!1&&d(this).dequeue(),d.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig||(b.orig={})}}),d.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(d.fx.step[this.prop]||d.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=d.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,b,c){function g(a){return e.step(a)}var e=this,f=d.fx;this.startTime=d.now(),this.start=a,this.end=b,this.unit=c||this.unit||(d.cssNumber[this.prop]?"":"px"),this.now=this.start,this.pos=this.state=0,g.elem=this.elem,g()&&d.timers.push(g)&&!ca&&(ca=setInterval(f.tick,f.interval))},show:function(){this.options.orig[this.prop]=d.style(this.elem,this.prop),this.options.show=!0,this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),d(this.elem).show()},hide:function(){this.options.orig[this.prop]=d.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b=d.now(),c=!0;if(a||b>=this.options.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),this.options.curAnim[this.prop]=!0;for(var e in this.options.curAnim)this.options.curAnim[e]!==!0&&(c=!1);if(c){if(this.options.overflow!=null&&!d.support.shrinkWrapBlocks){var f=this.elem,g=this.options;d.each(["","X","Y"],function(a,b){f.style["overflow"+b]=g.overflow[a]})}this.options.hide&&d(this.elem).hide();if(this.options.hide||this.options.show)for(var h in this.options.curAnim)d.style(this.elem,h,this.options.orig[h]);this.options.complete.call(this.elem)}return!1}var i=b-this.startTime;this.state=i/this.options.duration;var j=this.options.specialEasing&&this.options.specialEasing[this.prop],k=this.options.easing||(d.easing.swing?"swing":"linear");this.pos=d.easing[j||k](this.state,i,0,1,this.options.duration),this.now=this.start+(this.end-this.start)*this.pos,this.update();return!0}},d.extend(d.fx,{tick:function(){var a=d.timers;for(var b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||d.fx.stop()},interval:13,stop:function(){clearInterval(ca),ca=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){d.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit:a.elem[a.prop]=a.now}}}),d.expr&&d.expr.filters&&(d.expr.filters.animated=function(a){return d.grep(d.timers,function(b){return a===b.elem}).length});var ce=/^t(?:able|d|h)$/i,cf=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?d.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){d.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return d.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(e){}var f=b.ownerDocument,g=f.documentElement;if(!c||!d.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=f.body,i=cg(f),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||d.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||d.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:d.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){d.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return d.offset.bodyOffset(b);d.offset.initialize();var c,e=b.offsetParent,f=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(d.offset.supportsFixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===e&&(l+=b.offsetTop,m+=b.offsetLeft,d.offset.doesNotAddBorder&&(!d.offset.doesAddBorderForTableAndCells||!ce.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),f=e,e=b.offsetParent),d.offset.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;d.offset.supportsFixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},d.offset={initialize:function(){var a=c.body,b=c.createElement("div"),e,f,g,h,i=parseFloat(d.css(a,"marginTop"))||0,j="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";d.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),e=b.firstChild,f=e.firstChild,h=e.nextSibling.firstChild.firstChild,this.doesNotAddBorder=f.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,f.style.position="fixed",f.style.top="20px",this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15,f.style.position=f.style.top="",e.style.overflow="hidden",e.style.position="relative",this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),a=b=e=f=g=h=null,d.offset.initialize=d.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;d.offset.initialize(),d.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(d.css(a,"marginTop"))||0,c+=parseFloat(d.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var e=d.css(a,"position");e==="static"&&(a.style.position="relative");var f=d(a),g=f.offset(),h=d.css(a,"top"),i=d.css(a,"left"),j=e==="absolute"&&d.inArray("auto",[h,i])>-1,k={},l={},m,n;j&&(l=f.position()),m=j?l.top:parseInt(h,10)||0,n=j?l.left:parseInt(i,10)||0,d.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):f.css(k)}},d.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),e=cf.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(d.css(a,"marginTop"))||0,c.left-=parseFloat(d.css(a,"marginLeft"))||0,e.top+=parseFloat(d.css(b[0],"borderTopWidth"))||0,e.left+=parseFloat(d.css(b[0],"borderLeftWidth"))||0;return{top:c.top-e.top,left:c.left-e.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&(!cf.test(a.nodeName)&&d.css(a,"position")==="static"))a=a.offsetParent;return a})}}),d.each(["Left","Top"],function(a,c){var e="scroll"+c;d.fn[e]=function(c){var f=this[0],g;if(!f)return null;if(c!==b)return this.each(function(){g=cg(this),g?g.scrollTo(a?d(g).scrollLeft():c,a?c:d(g).scrollTop()):this[e]=c});g=cg(f);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:d.support.boxModel&&g.document.documentElement[e]||g.document.body[e]:f[e]}}),d.each(["Height","Width"],function(a,c){var e=c.toLowerCase();d.fn["inner"+c]=function(){return this[0]?parseFloat(d.css(this[0],e,"padding")):null},d.fn["outer"+c]=function(a){return this[0]?parseFloat(d.css(this[0],e,a?"margin":"border")):null},d.fn[e]=function(a){var f=this[0];if(!f)return a==null?null:this;if(d.isFunction(a))return this.each(function(b){var c=d(this);c[e](a.call(this,b,c[e]()))});if(d.isWindow(f)){var g=f.document.documentElement["client"+c];return f.document.compatMode==="CSS1Compat"&&g||f.document.body["client"+c]||g}if(f.nodeType===9)return Math.max(f.documentElement["client"+c],f.body["scroll"+c],f.documentElement["scroll"+c],f.body["offset"+c],f.documentElement["offset"+c]);if(a===b){var h=d.css(f,e),i=parseFloat(h);return d.isNaN(i)?h:i}return this.css(e,typeof a==="string"?a:a+"px")}}),a.jQuery=a.$=d})(window); \ No newline at end of file
diff --git a/3rdparty/timepicker/css/include/jquery-ui-1.8.14.custom.css b/3rdparty/timepicker/css/include/jquery-ui-1.8.14.custom.css
deleted file mode 100755
index fe310705756..00000000000
--- a/3rdparty/timepicker/css/include/jquery-ui-1.8.14.custom.css
+++ /dev/null
@@ -1,568 +0,0 @@
-/*
- * jQuery UI CSS Framework 1.8.14
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Theming/API
- */
-
-/* Layout helpers
-----------------------------------*/
-.ui-helper-hidden { display: none; }
-.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
-.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
-.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
-.ui-helper-clearfix { display: inline-block; }
-/* required comment for clearfix to work in Opera \*/
-* html .ui-helper-clearfix { height:1%; }
-.ui-helper-clearfix { display:block; }
-/* end clearfix */
-.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
-
-
-/* Interaction Cues
-----------------------------------*/
-.ui-state-disabled { cursor: default !important; }
-
-
-/* Icons
-----------------------------------*/
-
-/* states and images */
-.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
-
-
-/* Misc visuals
-----------------------------------*/
-
-/* Overlays */
-.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
-
-
-/*
- * jQuery UI CSS Framework 1.8.14
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Theming/API
- *
- * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Trebuchet%20MS,%20Tahoma,%20Verdana,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=f6a828&bgTextureHeader=12_gloss_wave.png&bgImgOpacityHeader=35&borderColorHeader=e78f08&fcHeader=ffffff&iconColorHeader=ffffff&bgColorContent=eeeeee&bgTextureContent=03_highlight_soft.png&bgImgOpacityContent=100&borderColorContent=dddddd&fcContent=333333&iconColorContent=222222&bgColorDefault=f6f6f6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=100&borderColorDefault=cccccc&fcDefault=1c94c4&iconColorDefault=ef8c08&bgColorHover=fdf5ce&bgTextureHover=02_glass.png&bgImgOpacityHover=100&borderColorHover=fbcb09&fcHover=c77405&iconColorHover=ef8c08&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=fbd850&fcActive=eb8f00&iconColorActive=ef8c08&bgColorHighlight=ffe45c&bgTextureHighlight=03_highlight_soft.png&bgImgOpacityHighlight=75&borderColorHighlight=fed22f&fcHighlight=363636&iconColorHighlight=228ef1&bgColorError=b81900&bgTextureError=08_diagonals_thick.png&bgImgOpacityError=18&borderColorError=cd0a0a&fcError=ffffff&iconColorError=ffd27a&bgColorOverlay=666666&bgTextureOverlay=08_diagonals_thick.png&bgImgOpacityOverlay=20&opacityOverlay=50&bgColorShadow=000000&bgTextureShadow=01_flat.png&bgImgOpacityShadow=10&opacityShadow=20&thicknessShadow=5px&offsetTopShadow=-5px&offsetLeftShadow=-5px&cornerRadiusShadow=5px
- */
-
-
-/* Component containers
-----------------------------------*/
-.ui-widget { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1.1em; }
-.ui-widget .ui-widget { font-size: 1em; }
-.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1em; }
-.ui-widget-content { border: 1px solid #dddddd; background: #eeeeee url(images/ui-bg_highlight-soft_100_eeeeee_1x100.png) 50% top repeat-x; color: #333333; }
-.ui-widget-content a { color: #333333; }
-.ui-widget-header { border: 1px solid #e78f08; background: #f6a828 url(images/ui-bg_gloss-wave_35_f6a828_500x100.png) 50% 50% repeat-x; color: #ffffff; font-weight: bold; }
-.ui-widget-header a { color: #ffffff; }
-
-/* Interaction states
-----------------------------------*/
-.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #cccccc; background: #f6f6f6 url(images/ui-bg_glass_100_f6f6f6_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #1c94c4; }
-.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #1c94c4; text-decoration: none; }
-.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #fbcb09; background: #fdf5ce url(images/ui-bg_glass_100_fdf5ce_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #c77405; }
-.ui-state-hover a, .ui-state-hover a:hover { color: #c77405; text-decoration: none; }
-.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #fbd850; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #eb8f00; }
-.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #eb8f00; text-decoration: none; }
-.ui-widget :active { outline: none; }
-
-/* Interaction Cues
-----------------------------------*/
-.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fed22f; background: #ffe45c url(images/ui-bg_highlight-soft_75_ffe45c_1x100.png) 50% top repeat-x; color: #363636; }
-.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
-.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #b81900 url(images/ui-bg_diagonals-thick_18_b81900_40x40.png) 50% 50% repeat; color: #ffffff; }
-.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #ffffff; }
-.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #ffffff; }
-.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
-.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
-.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
-
-/* Icons
-----------------------------------*/
-
-/* states and images */
-.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
-.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
-.ui-widget-header .ui-icon {background-image: url(images/ui-icons_ffffff_256x240.png); }
-.ui-state-default .ui-icon { background-image: url(images/ui-icons_ef8c08_256x240.png); }
-.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_ef8c08_256x240.png); }
-.ui-state-active .ui-icon {background-image: url(images/ui-icons_ef8c08_256x240.png); }
-.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_228ef1_256x240.png); }
-.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_ffd27a_256x240.png); }
-
-/* positioning */
-.ui-icon-carat-1-n { background-position: 0 0; }
-.ui-icon-carat-1-ne { background-position: -16px 0; }
-.ui-icon-carat-1-e { background-position: -32px 0; }
-.ui-icon-carat-1-se { background-position: -48px 0; }
-.ui-icon-carat-1-s { background-position: -64px 0; }
-.ui-icon-carat-1-sw { background-position: -80px 0; }
-.ui-icon-carat-1-w { background-position: -96px 0; }
-.ui-icon-carat-1-nw { background-position: -112px 0; }
-.ui-icon-carat-2-n-s { background-position: -128px 0; }
-.ui-icon-carat-2-e-w { background-position: -144px 0; }
-.ui-icon-triangle-1-n { background-position: 0 -16px; }
-.ui-icon-triangle-1-ne { background-position: -16px -16px; }
-.ui-icon-triangle-1-e { background-position: -32px -16px; }
-.ui-icon-triangle-1-se { background-position: -48px -16px; }
-.ui-icon-triangle-1-s { background-position: -64px -16px; }
-.ui-icon-triangle-1-sw { background-position: -80px -16px; }
-.ui-icon-triangle-1-w { background-position: -96px -16px; }
-.ui-icon-triangle-1-nw { background-position: -112px -16px; }
-.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
-.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
-.ui-icon-arrow-1-n { background-position: 0 -32px; }
-.ui-icon-arrow-1-ne { background-position: -16px -32px; }
-.ui-icon-arrow-1-e { background-position: -32px -32px; }
-.ui-icon-arrow-1-se { background-position: -48px -32px; }
-.ui-icon-arrow-1-s { background-position: -64px -32px; }
-.ui-icon-arrow-1-sw { background-position: -80px -32px; }
-.ui-icon-arrow-1-w { background-position: -96px -32px; }
-.ui-icon-arrow-1-nw { background-position: -112px -32px; }
-.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
-.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
-.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
-.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
-.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
-.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
-.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
-.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
-.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
-.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
-.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
-.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
-.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
-.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
-.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
-.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
-.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
-.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
-.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
-.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
-.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
-.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
-.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
-.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
-.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
-.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
-.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
-.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
-.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
-.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
-.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
-.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
-.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
-.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
-.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
-.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
-.ui-icon-arrow-4 { background-position: 0 -80px; }
-.ui-icon-arrow-4-diag { background-position: -16px -80px; }
-.ui-icon-extlink { background-position: -32px -80px; }
-.ui-icon-newwin { background-position: -48px -80px; }
-.ui-icon-refresh { background-position: -64px -80px; }
-.ui-icon-shuffle { background-position: -80px -80px; }
-.ui-icon-transfer-e-w { background-position: -96px -80px; }
-.ui-icon-transferthick-e-w { background-position: -112px -80px; }
-.ui-icon-folder-collapsed { background-position: 0 -96px; }
-.ui-icon-folder-open { background-position: -16px -96px; }
-.ui-icon-document { background-position: -32px -96px; }
-.ui-icon-document-b { background-position: -48px -96px; }
-.ui-icon-note { background-position: -64px -96px; }
-.ui-icon-mail-closed { background-position: -80px -96px; }
-.ui-icon-mail-open { background-position: -96px -96px; }
-.ui-icon-suitcase { background-position: -112px -96px; }
-.ui-icon-comment { background-position: -128px -96px; }
-.ui-icon-person { background-position: -144px -96px; }
-.ui-icon-print { background-position: -160px -96px; }
-.ui-icon-trash { background-position: -176px -96px; }
-.ui-icon-locked { background-position: -192px -96px; }
-.ui-icon-unlocked { background-position: -208px -96px; }
-.ui-icon-bookmark { background-position: -224px -96px; }
-.ui-icon-tag { background-position: -240px -96px; }
-.ui-icon-home { background-position: 0 -112px; }
-.ui-icon-flag { background-position: -16px -112px; }
-.ui-icon-calendar { background-position: -32px -112px; }
-.ui-icon-cart { background-position: -48px -112px; }
-.ui-icon-pencil { background-position: -64px -112px; }
-.ui-icon-clock { background-position: -80px -112px; }
-.ui-icon-disk { background-position: -96px -112px; }
-.ui-icon-calculator { background-position: -112px -112px; }
-.ui-icon-zoomin { background-position: -128px -112px; }
-.ui-icon-zoomout { background-position: -144px -112px; }
-.ui-icon-search { background-position: -160px -112px; }
-.ui-icon-wrench { background-position: -176px -112px; }
-.ui-icon-gear { background-position: -192px -112px; }
-.ui-icon-heart { background-position: -208px -112px; }
-.ui-icon-star { background-position: -224px -112px; }
-.ui-icon-link { background-position: -240px -112px; }
-.ui-icon-cancel { background-position: 0 -128px; }
-.ui-icon-plus { background-position: -16px -128px; }
-.ui-icon-plusthick { background-position: -32px -128px; }
-.ui-icon-minus { background-position: -48px -128px; }
-.ui-icon-minusthick { background-position: -64px -128px; }
-.ui-icon-close { background-position: -80px -128px; }
-.ui-icon-closethick { background-position: -96px -128px; }
-.ui-icon-key { background-position: -112px -128px; }
-.ui-icon-lightbulb { background-position: -128px -128px; }
-.ui-icon-scissors { background-position: -144px -128px; }
-.ui-icon-clipboard { background-position: -160px -128px; }
-.ui-icon-copy { background-position: -176px -128px; }
-.ui-icon-contact { background-position: -192px -128px; }
-.ui-icon-image { background-position: -208px -128px; }
-.ui-icon-video { background-position: -224px -128px; }
-.ui-icon-script { background-position: -240px -128px; }
-.ui-icon-alert { background-position: 0 -144px; }
-.ui-icon-info { background-position: -16px -144px; }
-.ui-icon-notice { background-position: -32px -144px; }
-.ui-icon-help { background-position: -48px -144px; }
-.ui-icon-check { background-position: -64px -144px; }
-.ui-icon-bullet { background-position: -80px -144px; }
-.ui-icon-radio-off { background-position: -96px -144px; }
-.ui-icon-radio-on { background-position: -112px -144px; }
-.ui-icon-pin-w { background-position: -128px -144px; }
-.ui-icon-pin-s { background-position: -144px -144px; }
-.ui-icon-play { background-position: 0 -160px; }
-.ui-icon-pause { background-position: -16px -160px; }
-.ui-icon-seek-next { background-position: -32px -160px; }
-.ui-icon-seek-prev { background-position: -48px -160px; }
-.ui-icon-seek-end { background-position: -64px -160px; }
-.ui-icon-seek-start { background-position: -80px -160px; }
-/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
-.ui-icon-seek-first { background-position: -80px -160px; }
-.ui-icon-stop { background-position: -96px -160px; }
-.ui-icon-eject { background-position: -112px -160px; }
-.ui-icon-volume-off { background-position: -128px -160px; }
-.ui-icon-volume-on { background-position: -144px -160px; }
-.ui-icon-power { background-position: 0 -176px; }
-.ui-icon-signal-diag { background-position: -16px -176px; }
-.ui-icon-signal { background-position: -32px -176px; }
-.ui-icon-battery-0 { background-position: -48px -176px; }
-.ui-icon-battery-1 { background-position: -64px -176px; }
-.ui-icon-battery-2 { background-position: -80px -176px; }
-.ui-icon-battery-3 { background-position: -96px -176px; }
-.ui-icon-circle-plus { background-position: 0 -192px; }
-.ui-icon-circle-minus { background-position: -16px -192px; }
-.ui-icon-circle-close { background-position: -32px -192px; }
-.ui-icon-circle-triangle-e { background-position: -48px -192px; }
-.ui-icon-circle-triangle-s { background-position: -64px -192px; }
-.ui-icon-circle-triangle-w { background-position: -80px -192px; }
-.ui-icon-circle-triangle-n { background-position: -96px -192px; }
-.ui-icon-circle-arrow-e { background-position: -112px -192px; }
-.ui-icon-circle-arrow-s { background-position: -128px -192px; }
-.ui-icon-circle-arrow-w { background-position: -144px -192px; }
-.ui-icon-circle-arrow-n { background-position: -160px -192px; }
-.ui-icon-circle-zoomin { background-position: -176px -192px; }
-.ui-icon-circle-zoomout { background-position: -192px -192px; }
-.ui-icon-circle-check { background-position: -208px -192px; }
-.ui-icon-circlesmall-plus { background-position: 0 -208px; }
-.ui-icon-circlesmall-minus { background-position: -16px -208px; }
-.ui-icon-circlesmall-close { background-position: -32px -208px; }
-.ui-icon-squaresmall-plus { background-position: -48px -208px; }
-.ui-icon-squaresmall-minus { background-position: -64px -208px; }
-.ui-icon-squaresmall-close { background-position: -80px -208px; }
-.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
-.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
-.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
-.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
-.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
-.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
-
-
-/* Misc visuals
-----------------------------------*/
-
-/* Corner radius */
-.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -khtml-border-top-left-radius: 4px; border-top-left-radius: 4px; }
-.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -khtml-border-top-right-radius: 4px; border-top-right-radius: 4px; }
-.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -khtml-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
-.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; -khtml-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
-
-/* Overlays */
-.ui-widget-overlay { background: #666666 url(images/ui-bg_diagonals-thick_20_666666_40x40.png) 50% 50% repeat; opacity: .50;filter:Alpha(Opacity=50); }
-.ui-widget-shadow { margin: -5px 0 0 -5px; padding: 5px; background: #000000 url(images/ui-bg_flat_10_000000_40x100.png) 50% 50% repeat-x; opacity: .20;filter:Alpha(Opacity=20); -moz-border-radius: 5px; -khtml-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; }/*
- * jQuery UI Resizable 1.8.14
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Resizable#theming
- */
-.ui-resizable { position: relative;}
-.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block; }
-.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
-.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
-.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
-.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
-.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
-.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
-.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
-.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
-.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/*
- * jQuery UI Selectable 1.8.14
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Selectable#theming
- */
-.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; }
-/*
- * jQuery UI Accordion 1.8.14
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Accordion#theming
- */
-/* IE/Win - Fix animation bug - #4615 */
-.ui-accordion { width: 100%; }
-.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
-.ui-accordion .ui-accordion-li-fix { display: inline; }
-.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
-.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; }
-.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; }
-.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
-.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }
-.ui-accordion .ui-accordion-content-active { display: block; }
-/*
- * jQuery UI Autocomplete 1.8.14
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Autocomplete#theming
- */
-.ui-autocomplete { position: absolute; cursor: default; }
-
-/* workarounds */
-* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
-
-/*
- * jQuery UI Menu 1.8.14
- *
- * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Menu#theming
- */
-.ui-menu {
- list-style:none;
- padding: 2px;
- margin: 0;
- display:block;
- float: left;
-}
-.ui-menu .ui-menu {
- margin-top: -3px;
-}
-.ui-menu .ui-menu-item {
- margin:0;
- padding: 0;
- zoom: 1;
- float: left;
- clear: left;
- width: 100%;
-}
-.ui-menu .ui-menu-item a {
- text-decoration:none;
- display:block;
- padding:.2em .4em;
- line-height:1.5;
- zoom:1;
-}
-.ui-menu .ui-menu-item a.ui-state-hover,
-.ui-menu .ui-menu-item a.ui-state-active {
- font-weight: normal;
- margin: -1px;
-}
-/*
- * jQuery UI Button 1.8.14
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Button#theming
- */
-.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
-.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
-button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
-.ui-button-icons-only { width: 3.4em; }
-button.ui-button-icons-only { width: 3.7em; }
-
-/*button text element */
-.ui-button .ui-button-text { display: block; line-height: 1.4; }
-.ui-button-text-only .ui-button-text { padding: .4em 1em; }
-.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
-.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
-.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }
-.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
-/* no icon support for input elements, provide padding by default */
-input.ui-button { padding: .4em 1em; }
-
-/*button icon element(s) */
-.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
-.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
-.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
-.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
-.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
-
-/*button sets*/
-.ui-buttonset { margin-right: 7px; }
-.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
-
-/* workarounds */
-button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
-/*
- * jQuery UI Dialog 1.8.14
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Dialog#theming
- */
-.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; }
-.ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; }
-.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; }
-.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
-.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
-.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
-.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
-.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
-.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; }
-.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; }
-.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
-.ui-draggable .ui-dialog-titlebar { cursor: move; }
-/*
- * jQuery UI Slider 1.8.14
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Slider#theming
- */
-.ui-slider { position: relative; text-align: left; }
-.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
-.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
-
-.ui-slider-horizontal { height: .8em; }
-.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
-.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
-.ui-slider-horizontal .ui-slider-range-min { left: 0; }
-.ui-slider-horizontal .ui-slider-range-max { right: 0; }
-
-.ui-slider-vertical { width: .8em; height: 100px; }
-.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
-.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
-.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
-.ui-slider-vertical .ui-slider-range-max { top: 0; }/*
- * jQuery UI Tabs 1.8.14
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Tabs#theming
- */
-.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
-.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }
-.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; }
-.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; }
-.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; }
-.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }
-.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
-.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }
-.ui-tabs .ui-tabs-hide { display: none !important; }
-/*
- * jQuery UI Datepicker 1.8.14
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Datepicker#theming
- */
-.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }
-.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
-.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
-.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
-.ui-datepicker .ui-datepicker-prev { left:2px; }
-.ui-datepicker .ui-datepicker-next { right:2px; }
-.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
-.ui-datepicker .ui-datepicker-next-hover { right:1px; }
-.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
-.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
-.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
-.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
-.ui-datepicker select.ui-datepicker-month,
-.ui-datepicker select.ui-datepicker-year { width: 49%;}
-.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
-.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
-.ui-datepicker td { border: 0; padding: 1px; }
-.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
-.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
-.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
-.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
-
-/* with multiple calendars */
-.ui-datepicker.ui-datepicker-multi { width:auto; }
-.ui-datepicker-multi .ui-datepicker-group { float:left; }
-.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
-.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
-.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
-.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
-.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
-.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
-.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
-.ui-datepicker-row-break { clear:both; width:100%; font-size:0em; }
-
-/* RTL support */
-.ui-datepicker-rtl { direction: rtl; }
-.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
-.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
-.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
-.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
-.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
-.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
-.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
-.ui-datepicker-rtl .ui-datepicker-group { float:right; }
-.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
-.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
-
-/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
-.ui-datepicker-cover {
- display: none; /*sorry for IE5*/
- display/**/: block; /*sorry for IE5*/
- position: absolute; /*must have*/
- z-index: -1; /*must have*/
- filter: mask(); /*must have*/
- top: -4px; /*must have*/
- left: -4px; /*must have*/
- width: 200px; /*must have*/
- height: 200px; /*must have*/
-}/*
- * jQuery UI Progressbar 1.8.14
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Progressbar#theming
- */
-.ui-progressbar { height:2em; text-align: left; }
-.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; } \ No newline at end of file
diff --git a/3rdparty/timepicker/css/include/jquery.ui.core.min.js b/3rdparty/timepicker/css/include/jquery.ui.core.min.js
deleted file mode 100755
index 577548e7882..00000000000
--- a/3rdparty/timepicker/css/include/jquery.ui.core.min.js
+++ /dev/null
@@ -1,17 +0,0 @@
-/*!
- * jQuery UI 1.8.14
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI
- */
-(function(c,j){function k(a,b){var d=a.nodeName.toLowerCase();if("area"===d){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&l(a)}return(/input|select|textarea|button|object/.test(d)?!a.disabled:"a"==d?a.href||b:b)&&l(a)}function l(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.14",
-keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=this;setTimeout(function(){c(d).focus();
-b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,
-"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",
-function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,m,n){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(m)g-=parseFloat(c.curCSS(f,"border"+this+"Width",true))||0;if(n)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,outerWidth:c.fn.outerWidth,
-outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c(this).css(h,d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){return k(a,!isNaN(c.attr(a,"tabindex")))},tabbable:function(a){var b=c.attr(a,"tabindex"),d=isNaN(b);
-return(d||b>=0)&&k(a,!d)}});c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&a.element[0].parentNode)for(var e=
-0;e<b.length;e++)a.options[b[e][0]]&&b[e][1].apply(a.element,d)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")==="hidden")return false;b=b&&b==="left"?"scrollLeft":"scrollTop";var d=false;if(a[b]>0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,h,i){return c.ui.isOverAxis(a,d,h)&&c.ui.isOverAxis(b,e,i)}})}})(jQuery);
diff --git a/3rdparty/timepicker/css/include/jquery.ui.position.min.js b/3rdparty/timepicker/css/include/jquery.ui.position.min.js
deleted file mode 100755
index 9f550be8e21..00000000000
--- a/3rdparty/timepicker/css/include/jquery.ui.position.min.js
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * jQuery UI Position 1.8.14
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Position
- */
-(function(c){c.ui=c.ui||{};var n=/left|center|right/,o=/top|center|bottom/,t=c.fn.position,u=c.fn.offset;c.fn.position=function(b){if(!b||!b.of)return t.apply(this,arguments);b=c.extend({},b);var a=c(b.of),d=a[0],g=(b.collision||"flip").split(" "),e=b.offset?b.offset.split(" "):[0,0],h,k,j;if(d.nodeType===9){h=a.width();k=a.height();j={top:0,left:0}}else if(d.setTimeout){h=a.width();k=a.height();j={top:a.scrollTop(),left:a.scrollLeft()}}else if(d.preventDefault){b.at="left top";h=k=0;j={top:b.of.pageY,
-left:b.of.pageX}}else{h=a.outerWidth();k=a.outerHeight();j=a.offset()}c.each(["my","at"],function(){var f=(b[this]||"").split(" ");if(f.length===1)f=n.test(f[0])?f.concat(["center"]):o.test(f[0])?["center"].concat(f):["center","center"];f[0]=n.test(f[0])?f[0]:"center";f[1]=o.test(f[1])?f[1]:"center";b[this]=f});if(g.length===1)g[1]=g[0];e[0]=parseInt(e[0],10)||0;if(e.length===1)e[1]=e[0];e[1]=parseInt(e[1],10)||0;if(b.at[0]==="right")j.left+=h;else if(b.at[0]==="center")j.left+=h/2;if(b.at[1]==="bottom")j.top+=
-k;else if(b.at[1]==="center")j.top+=k/2;j.left+=e[0];j.top+=e[1];return this.each(function(){var f=c(this),l=f.outerWidth(),m=f.outerHeight(),p=parseInt(c.curCSS(this,"marginLeft",true))||0,q=parseInt(c.curCSS(this,"marginTop",true))||0,v=l+p+(parseInt(c.curCSS(this,"marginRight",true))||0),w=m+q+(parseInt(c.curCSS(this,"marginBottom",true))||0),i=c.extend({},j),r;if(b.my[0]==="right")i.left-=l;else if(b.my[0]==="center")i.left-=l/2;if(b.my[1]==="bottom")i.top-=m;else if(b.my[1]==="center")i.top-=
-m/2;i.left=Math.round(i.left);i.top=Math.round(i.top);r={left:i.left-p,top:i.top-q};c.each(["left","top"],function(s,x){c.ui.position[g[s]]&&c.ui.position[g[s]][x](i,{targetWidth:h,targetHeight:k,elemWidth:l,elemHeight:m,collisionPosition:r,collisionWidth:v,collisionHeight:w,offset:e,my:b.my,at:b.at})});c.fn.bgiframe&&f.bgiframe();f.offset(c.extend(i,{using:b.using}))})};c.ui.position={fit:{left:function(b,a){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();b.left=
-d>0?b.left-d:Math.max(b.left-a.collisionPosition.left,b.left)},top:function(b,a){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();b.top=d>0?b.top-d:Math.max(b.top-a.collisionPosition.top,b.top)}},flip:{left:function(b,a){if(a.at[0]!=="center"){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();var g=a.my[0]==="left"?-a.elemWidth:a.my[0]==="right"?a.elemWidth:0,e=a.at[0]==="left"?a.targetWidth:-a.targetWidth,h=-2*a.offset[0];b.left+=
-a.collisionPosition.left<0?g+e+h:d>0?g+e+h:0}},top:function(b,a){if(a.at[1]!=="center"){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();var g=a.my[1]==="top"?-a.elemHeight:a.my[1]==="bottom"?a.elemHeight:0,e=a.at[1]==="top"?a.targetHeight:-a.targetHeight,h=-2*a.offset[1];b.top+=a.collisionPosition.top<0?g+e+h:d>0?g+e+h:0}}}};if(!c.offset.setOffset){c.offset.setOffset=function(b,a){if(/static/.test(c.curCSS(b,"position")))b.style.position="relative";var d=c(b),
-g=d.offset(),e=parseInt(c.curCSS(b,"top",true),10)||0,h=parseInt(c.curCSS(b,"left",true),10)||0;g={top:a.top-g.top+e,left:a.left-g.left+h};"using"in a?a.using.call(b,g):d.css(g)};c.fn.offset=function(b){var a=this[0];if(!a||!a.ownerDocument)return null;if(b)return this.each(function(){c.offset.setOffset(this,b)});return u.call(this)}}})(jQuery);
diff --git a/3rdparty/timepicker/css/include/jquery.ui.tabs.min.js b/3rdparty/timepicker/css/include/jquery.ui.tabs.min.js
deleted file mode 100755
index 11a67c144a6..00000000000
--- a/3rdparty/timepicker/css/include/jquery.ui.tabs.min.js
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * jQuery UI Tabs 1.8.14
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Tabs
- *
- * Depends:
- * jquery.ui.core.js
- * jquery.ui.widget.js
- */
-(function(d,p){function u(){return++v}function w(){return++x}var v=0,x=0;d.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:false,cookie:null,collapsible:false,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"<div></div>",remove:null,select:null,show:null,spinner:"<em>Loading&#8230;</em>",tabTemplate:"<li><a href='#{href}'><span>#{label}</span></a></li>"},_create:function(){this._tabify(true)},_setOption:function(b,e){if(b=="selected")this.options.collapsible&&
-e==this.options.selected||this.select(e);else{this.options[b]=e;this._tabify()}},_tabId:function(b){return b.title&&b.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+u()},_sanitizeSelector:function(b){return b.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+w());return d.cookie.apply(null,[b].concat(d.makeArray(arguments)))},_ui:function(b,e){return{tab:b,panel:e,index:this.anchors.index(b)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b=
-d(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(b){function e(g,f){g.css("display","");!d.support.opacity&&f.opacity&&g[0].style.removeAttribute("filter")}var a=this,c=this.options,h=/^#.+/;this.list=this.element.find("ol,ul").eq(0);this.lis=d(" > li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return d("a",this)[0]});this.panels=d([]);this.anchors.each(function(g,f){var i=d(f).attr("href"),l=i.split("#")[0],q;if(l&&(l===location.toString().split("#")[0]||
-(q=d("base")[0])&&l===q.href)){i=f.hash;f.href=i}if(h.test(i))a.panels=a.panels.add(a.element.find(a._sanitizeSelector(i)));else if(i&&i!=="#"){d.data(f,"href.tabs",i);d.data(f,"load.tabs",i.replace(/#.*$/,""));i=a._tabId(f);f.href="#"+i;f=a.element.find("#"+i);if(!f.length){f=d(c.panelTemplate).attr("id",i).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(a.panels[g-1]||a.list);f.data("destroy.tabs",true)}a.panels=a.panels.add(f)}else c.disabled.push(g)});if(b){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all");
-this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(c.selected===p){location.hash&&this.anchors.each(function(g,f){if(f.hash==location.hash){c.selected=g;return false}});if(typeof c.selected!=="number"&&c.cookie)c.selected=parseInt(a._cookie(),10);if(typeof c.selected!=="number"&&this.lis.filter(".ui-tabs-selected").length)c.selected=
-this.lis.index(this.lis.filter(".ui-tabs-selected"));c.selected=c.selected||(this.lis.length?0:-1)}else if(c.selected===null)c.selected=-1;c.selected=c.selected>=0&&this.anchors[c.selected]||c.selected<0?c.selected:0;c.disabled=d.unique(c.disabled.concat(d.map(this.lis.filter(".ui-state-disabled"),function(g){return a.lis.index(g)}))).sort();d.inArray(c.selected,c.disabled)!=-1&&c.disabled.splice(d.inArray(c.selected,c.disabled),1);this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active");
-if(c.selected>=0&&this.anchors.length){a.element.find(a._sanitizeSelector(a.anchors[c.selected].hash)).removeClass("ui-tabs-hide");this.lis.eq(c.selected).addClass("ui-tabs-selected ui-state-active");a.element.queue("tabs",function(){a._trigger("show",null,a._ui(a.anchors[c.selected],a.element.find(a._sanitizeSelector(a.anchors[c.selected].hash))[0]))});this.load(c.selected)}d(window).bind("unload",function(){a.lis.add(a.anchors).unbind(".tabs");a.lis=a.anchors=a.panels=null})}else c.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"));
-this.element[c.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");c.cookie&&this._cookie(c.selected,c.cookie);b=0;for(var j;j=this.lis[b];b++)d(j)[d.inArray(b,c.disabled)!=-1&&!d(j).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");c.cache===false&&this.anchors.removeData("cache.tabs");this.lis.add(this.anchors).unbind(".tabs");if(c.event!=="mouseover"){var k=function(g,f){f.is(":not(.ui-state-disabled)")&&f.addClass("ui-state-"+g)},n=function(g,f){f.removeClass("ui-state-"+
-g)};this.lis.bind("mouseover.tabs",function(){k("hover",d(this))});this.lis.bind("mouseout.tabs",function(){n("hover",d(this))});this.anchors.bind("focus.tabs",function(){k("focus",d(this).closest("li"))});this.anchors.bind("blur.tabs",function(){n("focus",d(this).closest("li"))})}var m,o;if(c.fx)if(d.isArray(c.fx)){m=c.fx[0];o=c.fx[1]}else m=o=c.fx;var r=o?function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.hide().removeClass("ui-tabs-hide").animate(o,o.duration||"normal",
-function(){e(f,o);a._trigger("show",null,a._ui(g,f[0]))})}:function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.removeClass("ui-tabs-hide");a._trigger("show",null,a._ui(g,f[0]))},s=m?function(g,f){f.animate(m,m.duration||"normal",function(){a.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");e(f,m);a.element.dequeue("tabs")})}:function(g,f){a.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");a.element.dequeue("tabs")};
-this.anchors.bind(c.event+".tabs",function(){var g=this,f=d(g).closest("li"),i=a.panels.filter(":not(.ui-tabs-hide)"),l=a.element.find(a._sanitizeSelector(g.hash));if(f.hasClass("ui-tabs-selected")&&!c.collapsible||f.hasClass("ui-state-disabled")||f.hasClass("ui-state-processing")||a.panels.filter(":animated").length||a._trigger("select",null,a._ui(this,l[0]))===false){this.blur();return false}c.selected=a.anchors.index(this);a.abort();if(c.collapsible)if(f.hasClass("ui-tabs-selected")){c.selected=
--1;c.cookie&&a._cookie(c.selected,c.cookie);a.element.queue("tabs",function(){s(g,i)}).dequeue("tabs");this.blur();return false}else if(!i.length){c.cookie&&a._cookie(c.selected,c.cookie);a.element.queue("tabs",function(){r(g,l)});a.load(a.anchors.index(this));this.blur();return false}c.cookie&&a._cookie(c.selected,c.cookie);if(l.length){i.length&&a.element.queue("tabs",function(){s(g,i)});a.element.queue("tabs",function(){r(g,l)});a.load(a.anchors.index(this))}else throw"jQuery UI Tabs: Mismatching fragment identifier.";
-d.browser.msie&&this.blur()});this.anchors.bind("click.tabs",function(){return false})},_getIndex:function(b){if(typeof b=="string")b=this.anchors.index(this.anchors.filter("[href$="+b+"]"));return b},destroy:function(){var b=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var e=
-d.data(this,"href.tabs");if(e)this.href=e;var a=d(this).unbind(".tabs");d.each(["href","load","cache"],function(c,h){a.removeData(h+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){d.data(this,"destroy.tabs")?d(this).remove():d(this).removeClass("ui-state-default ui-corner-top ui-tabs-selected ui-state-active ui-state-hover ui-state-focus ui-state-disabled ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide")});b.cookie&&this._cookie(null,b.cookie);return this},add:function(b,
-e,a){if(a===p)a=this.anchors.length;var c=this,h=this.options;e=d(h.tabTemplate.replace(/#\{href\}/g,b).replace(/#\{label\}/g,e));b=!b.indexOf("#")?b.replace("#",""):this._tabId(d("a",e)[0]);e.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var j=c.element.find("#"+b);j.length||(j=d(h.panelTemplate).attr("id",b).data("destroy.tabs",true));j.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(a>=this.lis.length){e.appendTo(this.list);j.appendTo(this.list[0].parentNode)}else{e.insertBefore(this.lis[a]);
-j.insertBefore(this.panels[a])}h.disabled=d.map(h.disabled,function(k){return k>=a?++k:k});this._tabify();if(this.anchors.length==1){h.selected=0;e.addClass("ui-tabs-selected ui-state-active");j.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){c._trigger("show",null,c._ui(c.anchors[0],c.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[a],this.panels[a]));return this},remove:function(b){b=this._getIndex(b);var e=this.options,a=this.lis.eq(b).remove(),c=this.panels.eq(b).remove();
-if(a.hasClass("ui-tabs-selected")&&this.anchors.length>1)this.select(b+(b+1<this.anchors.length?1:-1));e.disabled=d.map(d.grep(e.disabled,function(h){return h!=b}),function(h){return h>=b?--h:h});this._tabify();this._trigger("remove",null,this._ui(a.find("a")[0],c[0]));return this},enable:function(b){b=this._getIndex(b);var e=this.options;if(d.inArray(b,e.disabled)!=-1){this.lis.eq(b).removeClass("ui-state-disabled");e.disabled=d.grep(e.disabled,function(a){return a!=b});this._trigger("enable",null,
-this._ui(this.anchors[b],this.panels[b]));return this}},disable:function(b){b=this._getIndex(b);var e=this.options;if(b!=e.selected){this.lis.eq(b).addClass("ui-state-disabled");e.disabled.push(b);e.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[b],this.panels[b]))}return this},select:function(b){b=this._getIndex(b);if(b==-1)if(this.options.collapsible&&this.options.selected!=-1)b=this.options.selected;else return this;this.anchors.eq(b).trigger(this.options.event+".tabs");return this},
-load:function(b){b=this._getIndex(b);var e=this,a=this.options,c=this.anchors.eq(b)[0],h=d.data(c,"load.tabs");this.abort();if(!h||this.element.queue("tabs").length!==0&&d.data(c,"cache.tabs"))this.element.dequeue("tabs");else{this.lis.eq(b).addClass("ui-state-processing");if(a.spinner){var j=d("span",c);j.data("label.tabs",j.html()).html(a.spinner)}this.xhr=d.ajax(d.extend({},a.ajaxOptions,{url:h,success:function(k,n){e.element.find(e._sanitizeSelector(c.hash)).html(k);e._cleanup();a.cache&&d.data(c,
-"cache.tabs",true);e._trigger("load",null,e._ui(e.anchors[b],e.panels[b]));try{a.ajaxOptions.success(k,n)}catch(m){}},error:function(k,n){e._cleanup();e._trigger("load",null,e._ui(e.anchors[b],e.panels[b]));try{a.ajaxOptions.error(k,n,b,c)}catch(m){}}}));e.element.dequeue("tabs");return this}},abort:function(){this.element.queue([]);this.panels.stop(false,true);this.element.queue("tabs",this.element.queue("tabs").splice(-2,2));if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup();return this},
-url:function(b,e){this.anchors.eq(b).removeData("cache.tabs").data("load.tabs",e);return this},length:function(){return this.anchors.length}});d.extend(d.ui.tabs,{version:"1.8.14"});d.extend(d.ui.tabs.prototype,{rotation:null,rotate:function(b,e){var a=this,c=this.options,h=a._rotate||(a._rotate=function(j){clearTimeout(a.rotation);a.rotation=setTimeout(function(){var k=c.selected;a.select(++k<a.anchors.length?k:0)},b);j&&j.stopPropagation()});e=a._unrotate||(a._unrotate=!e?function(j){j.clientX&&
-a.rotate(null)}:function(){t=c.selected;h()});if(b){this.element.bind("tabsshow",h);this.anchors.bind(c.event+".tabs",e);h()}else{clearTimeout(a.rotation);this.element.unbind("tabsshow",h);this.anchors.unbind(c.event+".tabs",e);delete this._rotate;delete this._unrotate}return this}})})(jQuery);
diff --git a/3rdparty/timepicker/css/include/jquery.ui.widget.min.js b/3rdparty/timepicker/css/include/jquery.ui.widget.min.js
deleted file mode 100755
index 39ab91a0963..00000000000
--- a/3rdparty/timepicker/css/include/jquery.ui.widget.min.js
+++ /dev/null
@@ -1,15 +0,0 @@
-/*!
- * jQuery UI Widget 1.8.14
- *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://docs.jquery.com/UI/Widget
- */
-(function(b,j){if(b.cleanData){var k=b.cleanData;b.cleanData=function(a){for(var c=0,d;(d=a[c])!=null;c++)b(d).triggerHandler("remove");k(a)}}else{var l=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c)if(!a||b.filter(a,[this]).length)b("*",this).add([this]).each(function(){b(this).triggerHandler("remove")});return l.call(b(this),a,c)})}}b.widget=function(a,c,d){var e=a.split(".")[0],f;a=a.split(".")[1];f=e+"-"+a;if(!d){d=c;c=b.Widget}b.expr[":"][f]=function(h){return!!b.data(h,
-a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)};c=new c;c.options=b.extend(true,{},c.options);b[e][a].prototype=b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):d;if(e&&d.charAt(0)==="_")return h;
-e?this.each(function(){var g=b.data(this,a),i=g&&b.isFunction(g[d])?g[d].apply(g,f):g;if(i!==g&&i!==j){h=i;return false}}):this.each(function(){var g=b.data(this,a);g?g.option(d||{})._init():b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){b.data(c,this.widgetName,this);this.element=b(c);this.options=b.extend(true,{},this.options,
-this._getCreateOptions(),a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},
-widget:function(){return this.element},option:function(a,c){var d=a;if(arguments.length===0)return b.extend({},this.options);if(typeof a==="string"){if(c===j)return this.options[a];d={};d[a]=c}this._setOptions(d);return this},_setOptions:function(a){var c=this;b.each(a,function(d,e){c._setOption(d,e)});return this},_setOption:function(a,c){this.options[a]=c;if(a==="disabled")this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",c);return this},
-enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(a,c,d){var e=this.options[a];c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent){a=b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return!(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery);
diff --git a/3rdparty/timepicker/css/include/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png b/3rdparty/timepicker/css/include/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png
deleted file mode 100755
index 954e22dbd99..00000000000
--- a/3rdparty/timepicker/css/include/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png
+++ /dev/null
Binary files differ
diff --git a/3rdparty/timepicker/css/include/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png b/3rdparty/timepicker/css/include/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png
deleted file mode 100755
index 64ece5707d9..00000000000
--- a/3rdparty/timepicker/css/include/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png
+++ /dev/null
Binary files differ
diff --git a/3rdparty/timepicker/css/include/ui-lightness/images/ui-bg_flat_10_000000_40x100.png b/3rdparty/timepicker/css/include/ui-lightness/images/ui-bg_flat_10_000000_40x100.png
deleted file mode 100755
index abdc01082bf..00000000000
--- a/3rdparty/timepicker/css/include/ui-lightness/images/ui-bg_flat_10_000000_40x100.png
+++ /dev/null
Binary files differ
diff --git a/3rdparty/timepicker/css/include/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png b/3rdparty/timepicker/css/include/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png
deleted file mode 100755
index 9b383f4d2ea..00000000000
--- a/3rdparty/timepicker/css/include/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png
+++ /dev/null
Binary files differ
diff --git a/3rdparty/timepicker/css/include/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png b/3rdparty/timepicker/css/include/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png
deleted file mode 100755
index a23baad25b1..00000000000
--- a/3rdparty/timepicker/css/include/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png
+++ /dev/null
Binary files differ
diff --git a/3rdparty/timepicker/css/include/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png b/3rdparty/timepicker/css/include/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png
deleted file mode 100755
index 42ccba269b6..00000000000
--- a/3rdparty/timepicker/css/include/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png
+++ /dev/null
Binary files differ
diff --git a/3rdparty/timepicker/css/include/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png b/3rdparty/timepicker/css/include/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png
deleted file mode 100755
index 39d5824d6af..00000000000
--- a/3rdparty/timepicker/css/include/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png
+++ /dev/null
Binary files differ
diff --git a/3rdparty/timepicker/css/include/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png b/3rdparty/timepicker/css/include/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png
deleted file mode 100755
index f1273672d25..00000000000
--- a/3rdparty/timepicker/css/include/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png
+++ /dev/null
Binary files differ
diff --git a/3rdparty/timepicker/css/include/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png b/3rdparty/timepicker/css/include/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png
deleted file mode 100755
index 359397acffd..00000000000
--- a/3rdparty/timepicker/css/include/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png
+++ /dev/null
Binary files differ
diff --git a/3rdparty/timepicker/css/include/ui-lightness/images/ui-icons_222222_256x240.png b/3rdparty/timepicker/css/include/ui-lightness/images/ui-icons_222222_256x240.png
deleted file mode 100755
index b273ff111d2..00000000000
--- a/3rdparty/timepicker/css/include/ui-lightness/images/ui-icons_222222_256x240.png
+++ /dev/null
Binary files differ
diff --git a/3rdparty/timepicker/css/include/ui-lightness/images/ui-icons_228ef1_256x240.png b/3rdparty/timepicker/css/include/ui-lightness/images/ui-icons_228ef1_256x240.png
deleted file mode 100755
index a641a371afa..00000000000
--- a/3rdparty/timepicker/css/include/ui-lightness/images/ui-icons_228ef1_256x240.png
+++ /dev/null
Binary files differ
diff --git a/3rdparty/timepicker/css/include/ui-lightness/images/ui-icons_ef8c08_256x240.png b/3rdparty/timepicker/css/include/ui-lightness/images/ui-icons_ef8c08_256x240.png
deleted file mode 100755
index 85e63e9f604..00000000000
--- a/3rdparty/timepicker/css/include/ui-lightness/images/ui-icons_ef8c08_256x240.png
+++ /dev/null
Binary files differ
diff --git a/3rdparty/timepicker/css/include/ui-lightness/images/ui-icons_ffd27a_256x240.png b/3rdparty/timepicker/css/include/ui-lightness/images/ui-icons_ffd27a_256x240.png
deleted file mode 100755
index e117effa3dc..00000000000
--- a/3rdparty/timepicker/css/include/ui-lightness/images/ui-icons_ffd27a_256x240.png
+++ /dev/null
Binary files differ
diff --git a/3rdparty/timepicker/css/include/ui-lightness/images/ui-icons_ffffff_256x240.png b/3rdparty/timepicker/css/include/ui-lightness/images/ui-icons_ffffff_256x240.png
deleted file mode 100755
index 42f8f992c72..00000000000
--- a/3rdparty/timepicker/css/include/ui-lightness/images/ui-icons_ffffff_256x240.png
+++ /dev/null
Binary files differ
diff --git a/3rdparty/timepicker/css/jquery.ui.timepicker.css b/3rdparty/timepicker/css/jquery.ui.timepicker.css
deleted file mode 100755
index 1efbacb7c33..00000000000
--- a/3rdparty/timepicker/css/jquery.ui.timepicker.css
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Timepicker stylesheet
- * Highly inspired from datepicker
- * FG - Nov 2010 - Web3R
- *
- * version 0.0.3 : Fixed some settings, more dynamic
- * version 0.0.4 : Removed width:100% on tables
- * version 0.1.1 : set width 0 on tables to fix an ie6 bug
- */
-
-.ui-timepicker-inline { display: inline; }
-
-#ui-timepicker-div { padding: 0.2em; background-color: #fff; }
-.ui-timepicker-table { display: inline-table; width: 0; }
-.ui-timepicker-table table { margin:0.15em 0 0 0; border-collapse: collapse; }
-
-.ui-timepicker-hours, .ui-timepicker-minutes { padding: 0.2em; }
-
-.ui-timepicker-table .ui-timepicker-title { line-height: 1.8em; text-align: center; }
-.ui-timepicker-table td { padding: 0.1em; width: 2.2em; }
-.ui-timepicker-table th.periods { padding: 0.1em; width: 2.2em; }
-
-/* span for disabled cells */
-.ui-timepicker-table td span {
- display:block;
- padding:0.2em 0.3em 0.2em 0.5em;
- width: 1.2em;
-
- text-align:right;
- text-decoration:none;
-}
-/* anchors for clickable cells */
-.ui-timepicker-table td a {
- display:block;
- padding:0.2em 0.3em 0.2em 0.5em;
- width: 1.2em;
- cursor: pointer;
- text-align:right;
- text-decoration:none;
-}
-
-
-/* buttons and button pane styling */
-.ui-timepicker .ui-timepicker-buttonpane {
- background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0;
-}
-.ui-timepicker .ui-timepicker-buttonpane button { margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
-/* The close button */
-.ui-timepicker .ui-timepicker-close { float: right }
-
-/* the now button */
-.ui-timepicker .ui-timepicker-now { float: left; }
-
-/* the deselect button */
-.ui-timepicker .ui-timepicker-deselect { float: left; }
-
-
-/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
-.ui-timepicker-cover {
- display: none; /*sorry for IE5*/
- display/**/: block; /*sorry for IE5*/
- position: absolute; /*must have*/
- z-index: -1; /*must have*/
- filter: mask(); /*must have*/
- top: -4px; /*must have*/
- left: -4px; /*must have*/
- width: 200px; /*must have*/
- height: 200px; /*must have*/
-} \ No newline at end of file
diff --git a/3rdparty/timepicker/js/i18n/i18n.html b/3rdparty/timepicker/js/i18n/i18n.html
deleted file mode 100755
index 4ba56cf8a9e..00000000000
--- a/3rdparty/timepicker/js/i18n/i18n.html
+++ /dev/null
@@ -1,147 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <!-- Around the world, around the world -->
- <!-- Around the world, around the world -->
- <!-- Around the world, around the world -->
- <!-- Around the world, around the world -->
-
- <meta charset="utf-8">
- <title>Internationalisation page for the jquery ui timepicker</title>
-
- <script src="../include/jquery-1.5.1.min.js"></script>
- <script src="../include/jquery.ui.core.min.js"></script>
- <script src="../include/jquery.ui.widget.min.js"></script>
- <script src="../jquery.ui.timepicker.js"></script>
-
- <link rel="stylesheet" href="../include/jquery-ui-1.8.14.custom.css" />
- <link rel="stylesheet" href="../jquery.ui.timepicker.css" />
- <style>
- #timepicker { font-size: 10px }
- </style>
- <script src='jquery.ui.timepicker-cs.js'></script>
- <script src='jquery.ui.timepicker-de.js'></script>
- <script src='jquery.ui.timepicker-es.js'></script>
-
- <script src='jquery.ui.timepicker-fr.js'></script>
- <script src='jquery.ui.timepicker-hr.js'></script>
- <script src='jquery.ui.timepicker-it.js'></script>
- <script src='jquery.ui.timepicker-ja.js'></script>
- <script src='jquery.ui.timepicker-nl.js'></script>
- <script src='jquery.ui.timepicker-pl.js'></script>
- <script src='jquery.ui.timepicker-pt-BR.js'></script>
- <script src='jquery.ui.timepicker-sl.js'></script>
- <script src='jquery.ui.timepicker-sv.js'></script>
- <script src='jquery.ui.timepicker-tr.js'></script>
-</head>
-<body>
-
- <script type="text/javascript">
- $(document).ready(function() {
-
- $.timepicker.setDefaults( $.timepicker.regional[ "" ] );
-
- $('#timepicker').timepicker({
- showCloseButton: true,
- showNowButton: true,
- showDeselectButton: true
- });
-
- $('#locale').change(updateLocale).keyup(updateLocale);
-
- });
-
- function updateLocale()
- {
- $('#timepicker').timepicker( "option",
- $.timepicker.regional[ $( '#locale' ).val() ] );
- }
-
- </script>
-
- Select a localisation :
- <select id='locale'>
- <option>Select a localisation</option>
-
- <option value='hr'>Croatian/Bosnian</option>
- <option value='cs'>Czech</option>
- <option value='de'>German (Deutsch)</option>
- <option value='nl'>Dutch (Nederlands)</option>
- <option value='fr'>Fran&ccedil;ais</option>
- <option value='it'>Italian</option>
- <option value='ja'>Japanese</option>
- <option value='pl'>Polish</option>
- <option value="pt-BR">Portuguese/Brazilian</option>
- <option value='sl'>Slovenian</option>
- <option value='es'>Spanish</option>
- <option value='sv'>Swedish</option>
- <option value='tr'>Turkish</option>
- </select>
-
- <br>
-
- <div id="timepicker">
-
- </div>
-
- <br>
-
- List of localisations :
-<ul>
-
- <li>
- <a href="jquery.ui.timepicker-hr.js">Croatian/Bosnian (jquery.ui.timepicker.hr.js)</a>
- </li>
-
- <li>
- <a href="jquery.ui.timepicker-cs.js">Czech (jquery.ui.timepicker-cs.js</a>
- </li>
-
- <li>
- <a href="jquery.ui.timepicker-de.js">German (Deutsch) (jquery.ui.timepicker-de.js)</a>
- </li>
-
- <li>
- <a href="jquery.ui.timepicker-nl.js">Dutch (Nederlands) (jquery.ui.timepicker-nl.js)</a>
- </li>
-
- <li>
- <a href="jquery.ui.timepicker-fr.js">Fran&ccedil;ais (jquery.ui.timepicker-fr.js)</a>
- </li>
-
- <li>
- <a href="jquery.ui.timepicker-it.js">Italian (jquery.ui.timepicker-it.js)</a>
- </li>
-
- <li>
- <a href="jquery.ui.timepicker-ja.js">Japanese (jquery.ui.timepicker-ja.js)</a>
- </li>
-
- <li>
- <a href="jquery.ui.timepicker-pl.js">Polish (jquery.ui.timepicker-pl.js)</a>
- </li>
-
- <li>
- <a href="jquery.ui.timepicker-pt-BR.js">Portuguese/Brazilian (jquery.ui.timepicker-pt-BR.js)</a>
- </li>
-
- <li>
- <a href="jquery.ui.timepicker-sl.js">Slovenian (jquery.ui.timepicker-sl.js)</a>
- </li>
-
- <li>
- <a href="jquery.ui.timepicker-sv.js">Swedish (jquery.ui.timepicker-sv.js)</a>
- </li>
-
- <li>
- <a href="jquery.ui.timepicker-es.js">Spanish (jquery.ui.timepicker-es.js)</a>
- </li>
-
- <li>
- <a href="jquery.ui.timepicker-sv.js">Turkish (jquery.ui.timepicker-tr.js)</a>
- </li>
-
-</ul>
-
-</body>
-</html> \ No newline at end of file
diff --git a/3rdparty/timepicker/js/i18n/jquery.ui.timepicker-cs.js b/3rdparty/timepicker/js/i18n/jquery.ui.timepicker-cs.js
deleted file mode 100755
index 23a43444cf1..00000000000
--- a/3rdparty/timepicker/js/i18n/jquery.ui.timepicker-cs.js
+++ /dev/null
@@ -1,12 +0,0 @@
-/* Czech initialisation for the timepicker plugin */
-/* Written by David Spohr (spohr.david at gmail). */
-jQuery(function($){
- $.timepicker.regional['cs'] = {
- hourText: 'Hodiny',
- minuteText: 'Minuty',
- amPmText: ['AM', 'PM'] ,
- closeButtonText: 'Zavřít',
- nowButtonText: 'Nyní',
- deselectButtonText: 'Odoznačit' }
- $.timepicker.setDefaults($.timepicker.regional['cs']);
-}); \ No newline at end of file
diff --git a/3rdparty/timepicker/js/i18n/jquery.ui.timepicker-de.js b/3rdparty/timepicker/js/i18n/jquery.ui.timepicker-de.js
deleted file mode 100755
index e3bf859ee63..00000000000
--- a/3rdparty/timepicker/js/i18n/jquery.ui.timepicker-de.js
+++ /dev/null
@@ -1,12 +0,0 @@
-/* German initialisation for the timepicker plugin */
-/* Written by Lowie Hulzinga. */
-jQuery(function($){
- $.timepicker.regional['de'] = {
- hourText: 'Stunde',
- minuteText: 'Minuten',
- amPmText: ['AM', 'PM'] ,
- closeButtonText: 'Beenden',
- nowButtonText: 'Aktuelle Zeit',
- deselectButtonText: 'Wischen' }
- $.timepicker.setDefaults($.timepicker.regional['de']);
-});
diff --git a/3rdparty/timepicker/js/i18n/jquery.ui.timepicker-es.js b/3rdparty/timepicker/js/i18n/jquery.ui.timepicker-es.js
deleted file mode 100755
index b8bcbf859a1..00000000000
--- a/3rdparty/timepicker/js/i18n/jquery.ui.timepicker-es.js
+++ /dev/null
@@ -1,12 +0,0 @@
-/* Spanish initialisation for the jQuery time picker plugin. */
-/* Writen by Jandro González (agonzalezalves@gmail.com) */
-jQuery(function($){
- $.timepicker.regional['es'] = {
- hourText: 'Hora',
- minuteText: 'Minuto',
- amPmText: ['AM', 'PM'],
- closeButtonText: 'Aceptar',
- nowButtonText: 'Ahora',
- deselectButtonText: 'Deseleccionar' }
- $.timepicker.setDefaults($.timepicker.regional['es']);
-});
diff --git a/3rdparty/timepicker/js/i18n/jquery.ui.timepicker-fr.js b/3rdparty/timepicker/js/i18n/jquery.ui.timepicker-fr.js
deleted file mode 100755
index bd37d731c8d..00000000000
--- a/3rdparty/timepicker/js/i18n/jquery.ui.timepicker-fr.js
+++ /dev/null
@@ -1,13 +0,0 @@
-/* French initialisation for the jQuery time picker plugin. */
-/* Written by Bernd Plagge (bplagge@choicenet.ne.jp),
- Francois Gelinas (frank@fgelinas.com) */
-jQuery(function($){
- $.timepicker.regional['fr'] = {
- hourText: 'Heures',
- minuteText: 'Minutes',
- amPmText: ['AM', 'PM'],
- closeButtonText: 'Fermer',
- nowButtonText: 'Maintenant',
- deselectButtonText: 'Désélectionner' }
- $.timepicker.setDefaults($.timepicker.regional['fr']);
-}); \ No newline at end of file
diff --git a/3rdparty/timepicker/js/i18n/jquery.ui.timepicker-hr.js b/3rdparty/timepicker/js/i18n/jquery.ui.timepicker-hr.js
deleted file mode 100755
index 6950a169398..00000000000
--- a/3rdparty/timepicker/js/i18n/jquery.ui.timepicker-hr.js
+++ /dev/null
@@ -1,13 +0,0 @@
-/* Croatian/Bosnian initialisation for the timepicker plugin */
-/* Written by Rene Brakus (rene.brakus@infobip.com). */
-jQuery(function($){
- $.timepicker.regional['hr'] = {
- hourText: 'Sat',
- minuteText: 'Minuta',
- amPmText: ['Prijepodne', 'Poslijepodne'],
- closeButtonText: 'Zatvoriti',
- nowButtonText: 'Sada',
- deselectButtonText: 'Poništite'}
-
- $.timepicker.setDefaults($.timepicker.regional['hr']);
-}); \ No newline at end of file
diff --git a/3rdparty/timepicker/js/i18n/jquery.ui.timepicker-it.js b/3rdparty/timepicker/js/i18n/jquery.ui.timepicker-it.js
deleted file mode 100755
index ad20df30539..00000000000
--- a/3rdparty/timepicker/js/i18n/jquery.ui.timepicker-it.js
+++ /dev/null
@@ -1,12 +0,0 @@
-/* Italian initialisation for the jQuery time picker plugin. */
-/* Written by Serge Margarita (serge.margarita@gmail.com) */
-jQuery(function($){
- $.timepicker.regional['it'] = {
- hourText: 'Ore',
- minuteText: 'Minuti',
- amPmText: ['AM', 'PM'],
- closeButtonText: 'Chiudi',
- nowButtonText: 'Adesso',
- deselectButtonText: 'Svuota' }
- $.timepicker.setDefaults($.timepicker.regional['it']);
-}); \ No newline at end of file
diff --git a/3rdparty/timepicker/js/i18n/jquery.ui.timepicker-ja.js b/3rdparty/timepicker/js/i18n/jquery.ui.timepicker-ja.js
deleted file mode 100755
index b38cf6e5960..00000000000
--- a/3rdparty/timepicker/js/i18n/jquery.ui.timepicker-ja.js
+++ /dev/null
@@ -1,12 +0,0 @@
-/* Japanese initialisation for the jQuery time picker plugin. */
-/* Written by Bernd Plagge (bplagge@choicenet.ne.jp). */
-jQuery(function($){
- $.timepicker.regional['ja'] = {
- hourText: '時間',
- minuteText: '分',
- amPmText: ['午前', '午後'],
- closeButtonText: '閉じる',
- nowButtonText: '現時',
- deselectButtonText: '選択解除' }
- $.timepicker.setDefaults($.timepicker.regional['ja']);
-});
diff --git a/3rdparty/timepicker/js/i18n/jquery.ui.timepicker-nl.js b/3rdparty/timepicker/js/i18n/jquery.ui.timepicker-nl.js
deleted file mode 100755
index 945d55ea0ba..00000000000
--- a/3rdparty/timepicker/js/i18n/jquery.ui.timepicker-nl.js
+++ /dev/null
@@ -1,12 +0,0 @@
-/* Nederlands initialisation for the timepicker plugin */
-/* Written by Lowie Hulzinga. */
-jQuery(function($){
- $.timepicker.regional['nl'] = {
- hourText: 'Uren',
- minuteText: 'Minuten',
- amPmText: ['AM', 'PM'],
- closeButtonText: 'Sluiten',
- nowButtonText: 'Actuele tijd',
- deselectButtonText: 'Wissen' }
- $.timepicker.setDefaults($.timepicker.regional['nl']);
-}); \ No newline at end of file
diff --git a/3rdparty/timepicker/js/i18n/jquery.ui.timepicker-pl.js b/3rdparty/timepicker/js/i18n/jquery.ui.timepicker-pl.js
deleted file mode 100755
index 9f401c5ad15..00000000000
--- a/3rdparty/timepicker/js/i18n/jquery.ui.timepicker-pl.js
+++ /dev/null
@@ -1,12 +0,0 @@
-/* Polish initialisation for the timepicker plugin */
-/* Written by Mateusz Wadolkowski (mw@pcdoctor.pl). */
-jQuery(function($){
- $.timepicker.regional['pl'] = {
- hourText: 'Godziny',
- minuteText: 'Minuty',
- amPmText: ['', ''],
- closeButtonText: 'Zamknij',
- nowButtonText: 'Teraz',
- deselectButtonText: 'Odznacz'}
- $.timepicker.setDefaults($.timepicker.regional['pl']);
-}); \ No newline at end of file
diff --git a/3rdparty/timepicker/js/i18n/jquery.ui.timepicker-pt-BR.js b/3rdparty/timepicker/js/i18n/jquery.ui.timepicker-pt-BR.js
deleted file mode 100755
index 90273322689..00000000000
--- a/3rdparty/timepicker/js/i18n/jquery.ui.timepicker-pt-BR.js
+++ /dev/null
@@ -1,12 +0,0 @@
-/* Brazilan initialisation for the timepicker plugin */
-/* Written by Daniel Almeida (quantodaniel@gmail.com). */
-jQuery(function($){
- $.timepicker.regional['pt-BR'] = {
- hourText: 'Hora',
- minuteText: 'Minuto',
- amPmText: ['AM', 'PM'],
- closeButtonText: 'Fechar',
- nowButtonText: 'Agora',
- deselectButtonText: 'Limpar' }
- $.timepicker.setDefaults($.timepicker.regional['pt-BR']);
-}); \ No newline at end of file
diff --git a/3rdparty/timepicker/js/i18n/jquery.ui.timepicker-sl.js b/3rdparty/timepicker/js/i18n/jquery.ui.timepicker-sl.js
deleted file mode 100755
index 0b7d9c9f6c8..00000000000
--- a/3rdparty/timepicker/js/i18n/jquery.ui.timepicker-sl.js
+++ /dev/null
@@ -1,12 +0,0 @@
-/* Slovenian localization for the jQuery time picker plugin. */
-/* Written by Blaž Maležič (blaz@malezic.si) */
-jQuery(function($){
- $.timepicker.regional['sl'] = {
- hourText: 'Ure',
- minuteText: 'Minute',
- amPmText: ['AM', 'PM'],
- closeButtonText: 'Zapri',
- nowButtonText: 'Zdaj',
- deselectButtonText: 'Pobriši' }
- $.timepicker.setDefaults($.timepicker.regional['sl']);
-});
diff --git a/3rdparty/timepicker/js/i18n/jquery.ui.timepicker-sv.js b/3rdparty/timepicker/js/i18n/jquery.ui.timepicker-sv.js
deleted file mode 100755
index d6d798ef381..00000000000
--- a/3rdparty/timepicker/js/i18n/jquery.ui.timepicker-sv.js
+++ /dev/null
@@ -1,12 +0,0 @@
-/* Swedish initialisation for the timepicker plugin */
-/* Written by Björn Westlin (bjorn.westlin@su.se). */
-jQuery(function($){
- $.timepicker.regional['sv'] = {
- hourText: 'Timme',
- minuteText: 'Minut',
- amPmText: ['AM', 'PM'] ,
- closeButtonText: 'Stäng',
- nowButtonText: 'Nu',
- deselectButtonText: 'Rensa' }
- $.timepicker.setDefaults($.timepicker.regional['sv']);
-});
diff --git a/3rdparty/timepicker/js/i18n/jquery.ui.timepicker-tr.js b/3rdparty/timepicker/js/i18n/jquery.ui.timepicker-tr.js
deleted file mode 100755
index 4de447c4740..00000000000
--- a/3rdparty/timepicker/js/i18n/jquery.ui.timepicker-tr.js
+++ /dev/null
@@ -1,12 +0,0 @@
-/* Turkish initialisation for the jQuery time picker plugin. */
-/* Written by Mutlu Tevfik Koçak (mtkocak@gmail.com) */
-jQuery(function($){
- $.timepicker.regional['tr'] = {
- hourText: 'Saat',
- minuteText: 'Dakika',
- amPmText: ['AM', 'PM'],
- closeButtonText: 'Kapat',
- nowButtonText: 'Şu anda',
- deselectButtonText: 'Seçimi temizle' }
- $.timepicker.setDefaults($.timepicker.regional['tr']);
-}); \ No newline at end of file
diff --git a/3rdparty/timepicker/js/jquery.ui.timepicker.js b/3rdparty/timepicker/js/jquery.ui.timepicker.js
deleted file mode 100755
index 728841fa7ab..00000000000
--- a/3rdparty/timepicker/js/jquery.ui.timepicker.js
+++ /dev/null
@@ -1,1406 +0,0 @@
-/*
- * jQuery UI Timepicker 0.3.1
- *
- * Copyright 2010-2011, Francois Gelinas
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * http://fgelinas.com/code/timepicker
- *
- * Depends:
- * jquery.ui.core.js
- * jquery.ui.position.js (only if position settngs are used)
- *
- * Change version 0.1.0 - moved the t-rex up here
- *
- ____
- ___ .-~. /_"-._
- `-._~-. / /_ "~o\ :Y
- \ \ / : \~x. ` ')
- ] Y / | Y< ~-.__j
- / ! _.--~T : l l< /.-~
- / / ____.--~ . ` l /~\ \<|Y
- / / .-~~" /| . ',-~\ \L|
- / / / .^ \ Y~Y \.^>/l_ "--'
- / Y .-"( . l__ j_j l_/ /~_.-~ .
- Y l / \ ) ~~~." / `/"~ / \.__/l_
- | \ _.-" ~-{__ l : l._Z~-.___.--~
- | ~---~ / ~~"---\_ ' __[>
- l . _.^ ___ _>-y~
- \ \ . .-~ .-~ ~>--" /
- \ ~---" / ./ _.-'
- "-.,_____.,_ _.--~\ _.-~
- ~~ ( _} -Row
- `. ~(
- ) \
- /,`--'~\--'~\
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ->T-Rex<-
-*/
-
-(function ($) {
-
- $.extend($.ui, { timepicker: { version: "0.3.1"} });
-
- var PROP_NAME = 'timepicker',
- tpuuid = new Date().getTime();
-
- /* Time picker manager.
- Use the singleton instance of this class, $.timepicker, to interact with the time picker.
- Settings for (groups of) time pickers are maintained in an instance object,
- allowing multiple different settings on the same page. */
-
- function Timepicker() {
- this.debug = true; // Change this to true to start debugging
- this._curInst = null; // The current instance in use
- this._disabledInputs = []; // List of time picker inputs that have been disabled
- this._timepickerShowing = false; // True if the popup picker is showing , false if not
- this._inDialog = false; // True if showing within a "dialog", false if not
- this._dialogClass = 'ui-timepicker-dialog'; // The name of the dialog marker class
- this._mainDivId = 'ui-timepicker-div'; // The ID of the main timepicker division
- this._inlineClass = 'ui-timepicker-inline'; // The name of the inline marker class
- this._currentClass = 'ui-timepicker-current'; // The name of the current hour / minutes marker class
- this._dayOverClass = 'ui-timepicker-days-cell-over'; // The name of the day hover marker class
-
- this.regional = []; // Available regional settings, indexed by language code
- this.regional[''] = { // Default regional settings
- hourText: 'Hour', // Display text for hours section
- minuteText: 'Minute', // Display text for minutes link
- amPmText: ['AM', 'PM'], // Display text for AM PM
- closeButtonText: 'Done', // Text for the confirmation button (ok button)
- nowButtonText: 'Now', // Text for the now button
- deselectButtonText: 'Deselect' // Text for the deselect button
- };
- this._defaults = { // Global defaults for all the time picker instances
- showOn: 'focus', // 'focus' for popup on focus,
- // 'button' for trigger button, or 'both' for either (not yet implemented)
- button: null, // 'button' element that will trigger the timepicker
- showAnim: 'fadeIn', // Name of jQuery animation for popup
- showOptions: {}, // Options for enhanced animations
- appendText: '', // Display text following the input box, e.g. showing the format
-
- beforeShow: null, // Define a callback function executed before the timepicker is shown
- onSelect: null, // Define a callback function when a hour / minutes is selected
- onClose: null, // Define a callback function when the timepicker is closed
-
- timeSeparator: ':', // The character to use to separate hours and minutes.
- periodSeparator: ' ', // The character to use to separate the time from the time period.
- showPeriod: false, // Define whether or not to show AM/PM with selected time
- showPeriodLabels: true, // Show the AM/PM labels on the left of the time picker
- showLeadingZero: true, // Define whether or not to show a leading zero for hours < 10. [true/false]
- showMinutesLeadingZero: true, // Define whether or not to show a leading zero for minutes < 10.
- altField: '', // Selector for an alternate field to store selected time into
- defaultTime: 'now', // Used as default time when input field is empty or for inline timePicker
- // (set to 'now' for the current time, '' for no highlighted time)
- myPosition: 'left top', // Position of the dialog relative to the input.
- // see the position utility for more info : http://jqueryui.com/demos/position/
- atPosition: 'left bottom', // Position of the input element to match
- // Note : if the position utility is not loaded, the timepicker will attach left top to left bottom
- //NEW: 2011-02-03
- onHourShow: null, // callback for enabling / disabling on selectable hours ex : function(hour) { return true; }
- onMinuteShow: null, // callback for enabling / disabling on time selection ex : function(hour,minute) { return true; }
-
- hours: {
- starts: 0, // first displayed hour
- ends: 23 // last displayed hour
- },
- minutes: {
- starts: 0, // first displayed minute
- ends: 55, // last displayed minute
- interval: 5 // interval of displayed minutes
- },
- rows: 4, // number of rows for the input tables, minimum 2, makes more sense if you use multiple of 2
- // 2011-08-05 0.2.4
- showHours: true, // display the hours section of the dialog
- showMinutes: true, // display the minute section of the dialog
- optionalMinutes: false, // optionally parse inputs of whole hours with minutes omitted
-
- // buttons
- showCloseButton: false, // shows an OK button to confirm the edit
- showNowButton: false, // Shows the 'now' button
- showDeselectButton: false // Shows the deselect time button
-
- };
- $.extend(this._defaults, this.regional['']);
-
- this.tpDiv = $('<div id="' + this._mainDivId + '" class="ui-timepicker ui-widget ui-helper-clearfix ui-corner-all " style="display: none"></div>');
- }
-
- $.extend(Timepicker.prototype, {
- /* Class name added to elements to indicate already configured with a time picker. */
- markerClassName: 'hasTimepicker',
-
- /* Debug logging (if enabled). */
- log: function () {
- if (this.debug)
- console.log.apply('', arguments);
- },
-
- _widgetTimepicker: function () {
- return this.tpDiv;
- },
-
- /* Override the default settings for all instances of the time picker.
- @param settings object - the new settings to use as defaults (anonymous object)
- @return the manager object */
- setDefaults: function (settings) {
- extendRemove(this._defaults, settings || {});
- return this;
- },
-
- /* Attach the time picker to a jQuery selection.
- @param target element - the target input field or division or span
- @param settings object - the new settings to use for this time picker instance (anonymous) */
- _attachTimepicker: function (target, settings) {
- // check for settings on the control itself - in namespace 'time:'
- var inlineSettings = null;
- for (var attrName in this._defaults) {
- var attrValue = target.getAttribute('time:' + attrName);
- if (attrValue) {
- inlineSettings = inlineSettings || {};
- try {
- inlineSettings[attrName] = eval(attrValue);
- } catch (err) {
- inlineSettings[attrName] = attrValue;
- }
- }
- }
- var nodeName = target.nodeName.toLowerCase();
- var inline = (nodeName == 'div' || nodeName == 'span');
-
- if (!target.id) {
- this.uuid += 1;
- target.id = 'tp' + this.uuid;
- }
- var inst = this._newInst($(target), inline);
- inst.settings = $.extend({}, settings || {}, inlineSettings || {});
- if (nodeName == 'input') {
- this._connectTimepicker(target, inst);
- // init inst.hours and inst.minutes from the input value
- this._setTimeFromField(inst);
- } else if (inline) {
- this._inlineTimepicker(target, inst);
- }
-
-
- },
-
- /* Create a new instance object. */
- _newInst: function (target, inline) {
- var id = target[0].id.replace(/([^A-Za-z0-9_-])/g, '\\\\$1'); // escape jQuery meta chars
- return {
- id: id, input: target, // associated target
- inline: inline, // is timepicker inline or not :
- tpDiv: (!inline ? this.tpDiv : // presentation div
- $('<div class="' + this._inlineClass + ' ui-timepicker ui-widget ui-helper-clearfix"></div>'))
- };
- },
-
- /* Attach the time picker to an input field. */
- _connectTimepicker: function (target, inst) {
- var input = $(target);
- inst.append = $([]);
- inst.trigger = $([]);
- if (input.hasClass(this.markerClassName)) { return; }
- this._attachments(input, inst);
- input.addClass(this.markerClassName).
- keydown(this._doKeyDown).
- keyup(this._doKeyUp).
- bind("setData.timepicker", function (event, key, value) {
- inst.settings[key] = value;
- }).
- bind("getData.timepicker", function (event, key) {
- return this._get(inst, key);
- });
- $.data(target, PROP_NAME, inst);
- },
-
- /* Handle keystrokes. */
- _doKeyDown: function (event) {
- var inst = $.timepicker._getInst(event.target);
- var handled = true;
- inst._keyEvent = true;
- if ($.timepicker._timepickerShowing) {
- switch (event.keyCode) {
- case 9: $.timepicker._hideTimepicker();
- handled = false;
- break; // hide on tab out
- case 13:
- $.timepicker._updateSelectedValue(inst);
- $.timepicker._hideTimepicker();
-
- return false; // don't submit the form
- break; // select the value on enter
- case 27: $.timepicker._hideTimepicker();
- break; // hide on escape
- default: handled = false;
- }
- }
- else if (event.keyCode == 36 && event.ctrlKey) { // display the time picker on ctrl+home
- $.timepicker._showTimepicker(this);
- }
- else {
- handled = false;
- }
- if (handled) {
- event.preventDefault();
- event.stopPropagation();
- }
- },
-
- /* Update selected time on keyUp */
- /* Added verion 0.0.5 */
- _doKeyUp: function (event) {
- var inst = $.timepicker._getInst(event.target);
- $.timepicker._setTimeFromField(inst);
- $.timepicker._updateTimepicker(inst);
- },
-
- /* Make attachments based on settings. */
- _attachments: function (input, inst) {
- var appendText = this._get(inst, 'appendText');
- var isRTL = this._get(inst, 'isRTL');
- if (inst.append) { inst.append.remove(); }
- if (appendText) {
- inst.append = $('<span class="' + this._appendClass + '">' + appendText + '</span>');
- input[isRTL ? 'before' : 'after'](inst.append);
- }
- input.unbind('focus.timepicker', this._showTimepicker);
- input.unbind('click.timepicker', this._adjustZIndex);
-
- if (inst.trigger) { inst.trigger.remove(); }
-
- var showOn = this._get(inst, 'showOn');
- if (showOn == 'focus' || showOn == 'both') { // pop-up time picker when in the marked field
- input.bind("focus.timepicker", this._showTimepicker);
- input.bind("click.timepicker", this._adjustZIndex);
- }
- if (showOn == 'button' || showOn == 'both') { // pop-up time picker when 'button' element is clicked
- var button = this._get(inst, 'button');
- $(button).bind("click.timepicker", function () {
- if ($.timepicker._timepickerShowing && $.timepicker._lastInput == input[0]) {
- $.timepicker._hideTimepicker();
- } else if (!inst.input.is(':disabled')) {
- $.timepicker._showTimepicker(input[0]);
- }
- return false;
- });
-
- }
- },
-
-
- /* Attach an inline time picker to a div. */
- _inlineTimepicker: function(target, inst) {
- var divSpan = $(target);
- if (divSpan.hasClass(this.markerClassName))
- return;
- divSpan.addClass(this.markerClassName).append(inst.tpDiv).
- bind("setData.timepicker", function(event, key, value){
- inst.settings[key] = value;
- }).bind("getData.timepicker", function(event, key){
- return this._get(inst, key);
- });
- $.data(target, PROP_NAME, inst);
-
- this._setTimeFromField(inst);
- this._updateTimepicker(inst);
- inst.tpDiv.show();
- },
-
- _adjustZIndex: function(input) {
- input = input.target || input;
- var inst = $.timepicker._getInst(input);
- inst.tpDiv.css('zIndex', $.timepicker._getZIndex(input) +1);
- },
-
- /* Pop-up the time picker for a given input field.
- @param input element - the input field attached to the time picker or
- event - if triggered by focus */
- _showTimepicker: function (input) {
- input = input.target || input;
- if (input.nodeName.toLowerCase() != 'input') { input = $('input', input.parentNode)[0]; } // find from button/image trigger
-
- if ($.timepicker._isDisabledTimepicker(input) || $.timepicker._lastInput == input) { return; } // already here
-
- // fix v 0.0.8 - close current timepicker before showing another one
- $.timepicker._hideTimepicker();
-
- var inst = $.timepicker._getInst(input);
- if ($.timepicker._curInst && $.timepicker._curInst != inst) {
- $.timepicker._curInst.tpDiv.stop(true, true);
- }
- var beforeShow = $.timepicker._get(inst, 'beforeShow');
- extendRemove(inst.settings, (beforeShow ? beforeShow.apply(input, [input, inst]) : {}));
- inst.lastVal = null;
- $.timepicker._lastInput = input;
-
- $.timepicker._setTimeFromField(inst);
-
- // calculate default position
- if ($.timepicker._inDialog) { input.value = ''; } // hide cursor
- if (!$.timepicker._pos) { // position below input
- $.timepicker._pos = $.timepicker._findPos(input);
- $.timepicker._pos[1] += input.offsetHeight; // add the height
- }
- var isFixed = false;
- $(input).parents().each(function () {
- isFixed |= $(this).css('position') == 'fixed';
- return !isFixed;
- });
- if (isFixed && $.browser.opera) { // correction for Opera when fixed and scrolled
- $.timepicker._pos[0] -= document.documentElement.scrollLeft;
- $.timepicker._pos[1] -= document.documentElement.scrollTop;
- }
-
- var offset = { left: $.timepicker._pos[0], top: $.timepicker._pos[1] };
-
- $.timepicker._pos = null;
- // determine sizing offscreen
- inst.tpDiv.css({ position: 'absolute', display: 'block', top: '-1000px' });
- $.timepicker._updateTimepicker(inst);
-
-
- // position with the ui position utility, if loaded
- if ( ( ! inst.inline ) && ( typeof $.ui.position == 'object' ) ) {
- inst.tpDiv.position({
- of: inst.input,
- my: $.timepicker._get( inst, 'myPosition' ),
- at: $.timepicker._get( inst, 'atPosition' ),
- // offset: $( "#offset" ).val(),
- // using: using,
- collision: 'flip'
- });
- var offset = inst.tpDiv.offset();
- $.timepicker._pos = [offset.top, offset.left];
- }
-
-
- // reset clicked state
- inst._hoursClicked = false;
- inst._minutesClicked = false;
-
- // fix width for dynamic number of time pickers
- // and adjust position before showing
- offset = $.timepicker._checkOffset(inst, offset, isFixed);
- inst.tpDiv.css({ position: ($.timepicker._inDialog && $.blockUI ?
- 'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none',
- left: offset.left + 'px', top: offset.top + 'px'
- });
- if ( ! inst.inline ) {
- var showAnim = $.timepicker._get(inst, 'showAnim');
- var duration = $.timepicker._get(inst, 'duration');
-
- var postProcess = function () {
- $.timepicker._timepickerShowing = true;
- var borders = $.timepicker._getBorders(inst.tpDiv);
- inst.tpDiv.find('iframe.ui-timepicker-cover'). // IE6- only
- css({ left: -borders[0], top: -borders[1],
- width: inst.tpDiv.outerWidth(), height: inst.tpDiv.outerHeight()
- });
- };
-
- // Fixed the zIndex problem for real (I hope) - FG - v 0.2.9
- $.timepicker._adjustZIndex(input);
- //inst.tpDiv.css('zIndex', $.timepicker._getZIndex(input) +1);
-
- if ($.effects && $.effects[showAnim]) {
- inst.tpDiv.show(showAnim, $.timepicker._get(inst, 'showOptions'), duration, postProcess);
- }
- else {
- inst.tpDiv[showAnim || 'show']((showAnim ? duration : null), postProcess);
- }
- if (!showAnim || !duration) { postProcess(); }
- if (inst.input.is(':visible') && !inst.input.is(':disabled')) { inst.input.focus(); }
- $.timepicker._curInst = inst;
- }
- },
-
- // This is a copy of the zIndex function of UI core 1.8.??
- // Copied in the timepicker to stay backward compatible.
- _getZIndex: function (target) {
- var elem = $( target ), position, value;
- while ( elem.length && elem[ 0 ] !== document ) {
- position = elem.css( "position" );
- if ( position === "absolute" || position === "relative" || position === "fixed" ) {
- value = parseInt( elem.css( "zIndex" ), 10 );
- if ( !isNaN( value ) && value !== 0 ) {
- return value;
- }
- }
- elem = elem.parent();
- }
- },
-
- /* Refresh the time picker
- @param target element - The target input field or inline container element. */
- _refreshTimepicker: function(target) {
- var inst = this._getInst(target);
- if (inst) {
- this._updateTimepicker(inst);
- }
- },
-
-
- /* Generate the time picker content. */
- _updateTimepicker: function (inst) {
- inst.tpDiv.empty().append(this._generateHTML(inst));
- this._rebindDialogEvents(inst);
-
- },
-
- _rebindDialogEvents: function (inst) {
- var borders = $.timepicker._getBorders(inst.tpDiv),
- self = this;
- inst.tpDiv
- .find('iframe.ui-timepicker-cover') // IE6- only
- .css({ left: -borders[0], top: -borders[1],
- width: inst.tpDiv.outerWidth(), height: inst.tpDiv.outerHeight()
- })
- .end()
- // after the picker html is appended bind the click & double click events (faster in IE this way
- // then letting the browser interpret the inline events)
- // the binding for the minute cells also exists in _updateMinuteDisplay
- .find('.ui-timepicker-minute-cell')
- .unbind()
- .bind("click", { fromDoubleClick:false }, $.proxy($.timepicker.selectMinutes, this))
- .bind("dblclick", { fromDoubleClick:true }, $.proxy($.timepicker.selectMinutes, this))
- .end()
- .find('.ui-timepicker-hour-cell')
- .unbind()
- .bind("click", { fromDoubleClick:false }, $.proxy($.timepicker.selectHours, this))
- .bind("dblclick", { fromDoubleClick:true }, $.proxy($.timepicker.selectHours, this))
- .end()
- .find('.ui-timepicker td a')
- .unbind()
- .bind('mouseout', function () {
- $(this).removeClass('ui-state-hover');
- if (this.className.indexOf('ui-timepicker-prev') != -1) $(this).removeClass('ui-timepicker-prev-hover');
- if (this.className.indexOf('ui-timepicker-next') != -1) $(this).removeClass('ui-timepicker-next-hover');
- })
- .bind('mouseover', function () {
- if ( ! self._isDisabledTimepicker(inst.inline ? inst.tpDiv.parent()[0] : inst.input[0])) {
- $(this).parents('.ui-timepicker-calendar').find('a').removeClass('ui-state-hover');
- $(this).addClass('ui-state-hover');
- if (this.className.indexOf('ui-timepicker-prev') != -1) $(this).addClass('ui-timepicker-prev-hover');
- if (this.className.indexOf('ui-timepicker-next') != -1) $(this).addClass('ui-timepicker-next-hover');
- }
- })
- .end()
- .find('.' + this._dayOverClass + ' a')
- .trigger('mouseover')
- .end()
- .find('.ui-timepicker-now').bind("click", function(e) {
- $.timepicker.selectNow(e);
- }).end()
- .find('.ui-timepicker-deselect').bind("click",function(e) {
- $.timepicker.deselectTime(e);
- }).end()
- .find('.ui-timepicker-close').bind("click",function(e) {
- $.timepicker._hideTimepicker();
- }).end();
- },
-
- /* Generate the HTML for the current state of the time picker. */
- _generateHTML: function (inst) {
-
- var h, m, row, col, html, hoursHtml, minutesHtml = '',
- showPeriod = (this._get(inst, 'showPeriod') == true),
- showPeriodLabels = (this._get(inst, 'showPeriodLabels') == true),
- showLeadingZero = (this._get(inst, 'showLeadingZero') == true),
- showHours = (this._get(inst, 'showHours') == true),
- showMinutes = (this._get(inst, 'showMinutes') == true),
- amPmText = this._get(inst, 'amPmText'),
- rows = this._get(inst, 'rows'),
- amRows = 0,
- pmRows = 0,
- amItems = 0,
- pmItems = 0,
- amFirstRow = 0,
- pmFirstRow = 0,
- hours = Array(),
- hours_options = this._get(inst, 'hours'),
- hoursPerRow = null,
- hourCounter = 0,
- hourLabel = this._get(inst, 'hourText'),
- showCloseButton = this._get(inst, 'showCloseButton'),
- closeButtonText = this._get(inst, 'closeButtonText'),
- showNowButton = this._get(inst, 'showNowButton'),
- nowButtonText = this._get(inst, 'nowButtonText'),
- showDeselectButton = this._get(inst, 'showDeselectButton'),
- deselectButtonText = this._get(inst, 'deselectButtonText'),
- showButtonPanel = showCloseButton || showNowButton || showDeselectButton;
-
-
-
- // prepare all hours and minutes, makes it easier to distribute by rows
- for (h = hours_options.starts; h <= hours_options.ends; h++) {
- hours.push (h);
- }
- hoursPerRow = Math.ceil(hours.length / rows); // always round up
-
- if (showPeriodLabels) {
- for (hourCounter = 0; hourCounter < hours.length; hourCounter++) {
- if (hours[hourCounter] < 12) {
- amItems++;
- }
- else {
- pmItems++;
- }
- }
- hourCounter = 0;
-
- amRows = Math.floor(amItems / hours.length * rows);
- pmRows = Math.floor(pmItems / hours.length * rows);
-
- // assign the extra row to the period that is more densly populated
- if (rows != amRows + pmRows) {
- // Make sure: AM Has Items and either PM Does Not, AM has no rows yet, or AM is more dense
- if (amItems && (!pmItems || !amRows || (pmRows && amItems / amRows >= pmItems / pmRows))) {
- amRows++;
- } else {
- pmRows++;
- }
- }
- amFirstRow = Math.min(amRows, 1);
- pmFirstRow = amRows + 1;
- hoursPerRow = Math.ceil(Math.max(amItems / amRows, pmItems / pmRows));
- }
-
-
- html = '<table class="ui-timepicker-table ui-widget-content ui-corner-all"><tr>';
-
- if (showHours) {
-
- html += '<td class="ui-timepicker-hours">' +
- '<div class="ui-timepicker-title ui-widget-header ui-helper-clearfix ui-corner-all">' +
- hourLabel +
- '</div>' +
- '<table class="ui-timepicker">';
-
- for (row = 1; row <= rows; row++) {
- html += '<tr>';
- // AM
- if (row == amFirstRow && showPeriodLabels) {
- html += '<th rowspan="' + amRows.toString() + '" class="periods" scope="row">' + amPmText[0] + '</th>';
- }
- // PM
- if (row == pmFirstRow && showPeriodLabels) {
- html += '<th rowspan="' + pmRows.toString() + '" class="periods" scope="row">' + amPmText[1] + '</th>';
- }
- for (col = 1; col <= hoursPerRow; col++) {
- if (showPeriodLabels && row < pmFirstRow && hours[hourCounter] >= 12) {
- html += this._generateHTMLHourCell(inst, undefined, showPeriod, showLeadingZero);
- } else {
- html += this._generateHTMLHourCell(inst, hours[hourCounter], showPeriod, showLeadingZero);
- hourCounter++;
- }
- }
- html += '</tr>';
- }
- html += '</tr></table>' + // Close the hours cells table
- '</td>'; // Close the Hour td
- }
-
- if (showMinutes) {
- html += '<td class="ui-timepicker-minutes">';
- html += this._generateHTMLMinutes(inst);
- html += '</td>';
- }
-
- html += '</tr>';
-
-
- if (showButtonPanel) {
- var buttonPanel = '<tr><td colspan="3"><div class="ui-timepicker-buttonpane ui-widget-content">';
- if (showNowButton) {
- buttonPanel += '<button type="button" class="ui-timepicker-now ui-state-default ui-corner-all" '
- + ' data-timepicker-instance-id="#' + inst.id.replace(/\\\\/g,"\\") + '" >'
- + nowButtonText + '</button>';
- }
- if (showDeselectButton) {
- buttonPanel += '<button type="button" class="ui-timepicker-deselect ui-state-default ui-corner-all" '
- + ' data-timepicker-instance-id="#' + inst.id.replace(/\\\\/g,"\\") + '" >'
- + deselectButtonText + '</button>';
- }
- if (showCloseButton) {
- buttonPanel += '<button type="button" class="ui-timepicker-close ui-state-default ui-corner-all" '
- + ' data-timepicker-instance-id="#' + inst.id.replace(/\\\\/g,"\\") + '" >'
- + closeButtonText + '</button>';
- }
-
- html += buttonPanel + '</div></td></tr>';
- }
- html += '</table>';
-
- /* IE6 IFRAME FIX (taken from datepicker 1.5.3, fixed in 0.1.2 */
- html += ($.browser.msie && parseInt($.browser.version,10) < 7 && !inst.inline ?
- '<iframe src="javascript:false;" class="ui-timepicker-cover" frameborder="0"></iframe>' : '');
-
- return html;
- },
-
- /* Special function that update the minutes selection in currently visible timepicker
- * called on hour selection when onMinuteShow is defined */
- _updateMinuteDisplay: function (inst) {
- var newHtml = this._generateHTMLMinutes(inst);
- inst.tpDiv.find('td.ui-timepicker-minutes').html(newHtml);
- this._rebindDialogEvents(inst);
- // after the picker html is appended bind the click & double click events (faster in IE this way
- // then letting the browser interpret the inline events)
- // yes I know, duplicate code, sorry
-/* .find('.ui-timepicker-minute-cell')
- .bind("click", { fromDoubleClick:false }, $.proxy($.timepicker.selectMinutes, this))
- .bind("dblclick", { fromDoubleClick:true }, $.proxy($.timepicker.selectMinutes, this));
-*/
-
- },
-
- /*
- * Generate the minutes table
- * This is separated from the _generateHTML function because is can be called separately (when hours changes)
- */
- _generateHTMLMinutes: function (inst) {
-
- var m, row, html = '',
- rows = this._get(inst, 'rows'),
- minutes = Array(),
- minutes_options = this._get(inst, 'minutes'),
- minutesPerRow = null,
- minuteCounter = 0,
- showMinutesLeadingZero = (this._get(inst, 'showMinutesLeadingZero') == true),
- onMinuteShow = this._get(inst, 'onMinuteShow'),
- minuteLabel = this._get(inst, 'minuteText');
-
- if ( ! minutes_options.starts) {
- minutes_options.starts = 0;
- }
- if ( ! minutes_options.ends) {
- minutes_options.ends = 59;
- }
- for (m = minutes_options.starts; m <= minutes_options.ends; m += minutes_options.interval) {
- minutes.push(m);
- }
- minutesPerRow = Math.round(minutes.length / rows + 0.49); // always round up
-
- /*
- * The minutes table
- */
- // if currently selected minute is not enabled, we have a problem and need to select a new minute.
- if (onMinuteShow &&
- (onMinuteShow.apply((inst.input ? inst.input[0] : null), [inst.hours , inst.minutes]) == false) ) {
- // loop minutes and select first available
- for (minuteCounter = 0; minuteCounter < minutes.length; minuteCounter += 1) {
- m = minutes[minuteCounter];
- if (onMinuteShow.apply((inst.input ? inst.input[0] : null), [inst.hours, m])) {
- inst.minutes = m;
- break;
- }
- }
- }
-
-
-
- html += '<div class="ui-timepicker-title ui-widget-header ui-helper-clearfix ui-corner-all">' +
- minuteLabel +
- '</div>' +
- '<table class="ui-timepicker">';
-
- minuteCounter = 0;
- for (row = 1; row <= rows; row++) {
- html += '<tr>';
- while (minuteCounter < row * minutesPerRow) {
- var m = minutes[minuteCounter];
- var displayText = '';
- if (m !== undefined ) {
- displayText = (m < 10) && showMinutesLeadingZero ? "0" + m.toString() : m.toString();
- }
- html += this._generateHTMLMinuteCell(inst, m, displayText);
- minuteCounter++;
- }
- html += '</tr>';
- }
-
- html += '</table>';
-
- return html;
- },
-
- /* Generate the content of a "Hour" cell */
- _generateHTMLHourCell: function (inst, hour, showPeriod, showLeadingZero) {
-
- var displayHour = hour;
- if ((hour > 12) && showPeriod) {
- displayHour = hour - 12;
- }
- if ((displayHour == 0) && showPeriod) {
- displayHour = 12;
- }
- if ((displayHour < 10) && showLeadingZero) {
- displayHour = '0' + displayHour;
- }
-
- var html = "";
- var enabled = true;
- var onHourShow = this._get(inst, 'onHourShow'); //custom callback
-
- if (hour == undefined) {
- html = '<td><span class="ui-state-default ui-state-disabled">&nbsp;</span></td>';
- return html;
- }
-
- if (onHourShow) {
- enabled = onHourShow.apply((inst.input ? inst.input[0] : null), [hour]);
- }
-
- if (enabled) {
- html = '<td class="ui-timepicker-hour-cell" data-timepicker-instance-id="#' + inst.id.replace(/\\\\/g,"\\") + '" data-hour="' + hour.toString() + '">' +
- '<a class="ui-state-default ' +
- (hour == inst.hours ? 'ui-state-active' : '') +
- '">' +
- displayHour.toString() +
- '</a></td>';
- }
- else {
- html =
- '<td>' +
- '<span class="ui-state-default ui-state-disabled ' +
- (hour == inst.hours ? ' ui-state-active ' : ' ') +
- '">' +
- displayHour.toString() +
- '</span>' +
- '</td>';
- }
- return html;
- },
-
- /* Generate the content of a "Hour" cell */
- _generateHTMLMinuteCell: function (inst, minute, displayText) {
- var html = "";
- var enabled = true;
- var onMinuteShow = this._get(inst, 'onMinuteShow'); //custom callback
- if (onMinuteShow) {
- //NEW: 2011-02-03 we should give the hour as a parameter as well!
- enabled = onMinuteShow.apply((inst.input ? inst.input[0] : null), [inst.hours,minute]); //trigger callback
- }
-
- if (minute == undefined) {
- html = '<td><span class="ui-state-default ui-state-disabled">&nbsp;</span></td>';
- return html;
- }
-
- if (enabled) {
- html = '<td class="ui-timepicker-minute-cell" data-timepicker-instance-id="#' + inst.id.replace(/\\\\/g,"\\") + '" data-minute="' + minute.toString() + '" >' +
- '<a class="ui-state-default ' +
- (minute == inst.minutes ? 'ui-state-active' : '') +
- '" >' +
- displayText +
- '</a></td>';
- }
- else {
-
- html = '<td>' +
- '<span class="ui-state-default ui-state-disabled" >' +
- displayText +
- '</span>' +
- '</td>';
- }
- return html;
- },
-
-
- /* Detach a timepicker from its control.
- @param target element - the target input field or division or span */
- _destroyTimepicker: function(target) {
- var $target = $(target);
- var inst = $.data(target, PROP_NAME);
- if (!$target.hasClass(this.markerClassName)) {
- return;
- }
- var nodeName = target.nodeName.toLowerCase();
- $.removeData(target, PROP_NAME);
- if (nodeName == 'input') {
- inst.append.remove();
- inst.trigger.remove();
- $target.removeClass(this.markerClassName)
- .unbind('focus.timepicker', this._showTimepicker)
- .unbind('click.timepicker', this._adjustZIndex);
- } else if (nodeName == 'div' || nodeName == 'span')
- $target.removeClass(this.markerClassName).empty();
- },
-
- /* Enable the date picker to a jQuery selection.
- @param target element - the target input field or division or span */
- _enableTimepicker: function(target) {
- var $target = $(target),
- target_id = $target.attr('id'),
- inst = $.data(target, PROP_NAME);
-
- if (!$target.hasClass(this.markerClassName)) {
- return;
- }
- var nodeName = target.nodeName.toLowerCase();
- if (nodeName == 'input') {
- target.disabled = false;
- var button = this._get(inst, 'button');
- $(button).removeClass('ui-state-disabled').disabled = false;
- inst.trigger.filter('button').
- each(function() { this.disabled = false; }).end();
- }
- else if (nodeName == 'div' || nodeName == 'span') {
- var inline = $target.children('.' + this._inlineClass);
- inline.children().removeClass('ui-state-disabled');
- inline.find('button').each(
- function() { this.disabled = false }
- )
- }
- this._disabledInputs = $.map(this._disabledInputs,
- function(value) { return (value == target_id ? null : value); }); // delete entry
- },
-
- /* Disable the time picker to a jQuery selection.
- @param target element - the target input field or division or span */
- _disableTimepicker: function(target) {
- var $target = $(target);
- var inst = $.data(target, PROP_NAME);
- if (!$target.hasClass(this.markerClassName)) {
- return;
- }
- var nodeName = target.nodeName.toLowerCase();
- if (nodeName == 'input') {
- var button = this._get(inst, 'button');
-
- $(button).addClass('ui-state-disabled').disabled = true;
- target.disabled = true;
-
- inst.trigger.filter('button').
- each(function() { this.disabled = true; }).end();
-
- }
- else if (nodeName == 'div' || nodeName == 'span') {
- var inline = $target.children('.' + this._inlineClass);
- inline.children().addClass('ui-state-disabled');
- inline.find('button').each(
- function() { this.disabled = true }
- )
-
- }
- this._disabledInputs = $.map(this._disabledInputs,
- function(value) { return (value == target ? null : value); }); // delete entry
- this._disabledInputs[this._disabledInputs.length] = $target.attr('id');
- },
-
- /* Is the first field in a jQuery collection disabled as a timepicker?
- @param target_id element - the target input field or division or span
- @return boolean - true if disabled, false if enabled */
- _isDisabledTimepicker: function (target_id) {
- if ( ! target_id) { return false; }
- for (var i = 0; i < this._disabledInputs.length; i++) {
- if (this._disabledInputs[i] == target_id) { return true; }
- }
- return false;
- },
-
- /* Check positioning to remain on screen. */
- _checkOffset: function (inst, offset, isFixed) {
- var tpWidth = inst.tpDiv.outerWidth();
- var tpHeight = inst.tpDiv.outerHeight();
- var inputWidth = inst.input ? inst.input.outerWidth() : 0;
- var inputHeight = inst.input ? inst.input.outerHeight() : 0;
- var viewWidth = document.documentElement.clientWidth + $(document).scrollLeft();
- var viewHeight = document.documentElement.clientHeight + $(document).scrollTop();
-
- offset.left -= (this._get(inst, 'isRTL') ? (tpWidth - inputWidth) : 0);
- offset.left -= (isFixed && offset.left == inst.input.offset().left) ? $(document).scrollLeft() : 0;
- offset.top -= (isFixed && offset.top == (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0;
-
- // now check if datepicker is showing outside window viewport - move to a better place if so.
- offset.left -= Math.min(offset.left, (offset.left + tpWidth > viewWidth && viewWidth > tpWidth) ?
- Math.abs(offset.left + tpWidth - viewWidth) : 0);
- offset.top -= Math.min(offset.top, (offset.top + tpHeight > viewHeight && viewHeight > tpHeight) ?
- Math.abs(tpHeight + inputHeight) : 0);
-
- return offset;
- },
-
- /* Find an object's position on the screen. */
- _findPos: function (obj) {
- var inst = this._getInst(obj);
- var isRTL = this._get(inst, 'isRTL');
- while (obj && (obj.type == 'hidden' || obj.nodeType != 1)) {
- obj = obj[isRTL ? 'previousSibling' : 'nextSibling'];
- }
- var position = $(obj).offset();
- return [position.left, position.top];
- },
-
- /* Retrieve the size of left and top borders for an element.
- @param elem (jQuery object) the element of interest
- @return (number[2]) the left and top borders */
- _getBorders: function (elem) {
- var convert = function (value) {
- return { thin: 1, medium: 2, thick: 3}[value] || value;
- };
- return [parseFloat(convert(elem.css('border-left-width'))),
- parseFloat(convert(elem.css('border-top-width')))];
- },
-
-
- /* Close time picker if clicked elsewhere. */
- _checkExternalClick: function (event) {
- if (!$.timepicker._curInst) { return; }
- var $target = $(event.target);
- if ($target[0].id != $.timepicker._mainDivId &&
- $target.parents('#' + $.timepicker._mainDivId).length == 0 &&
- !$target.hasClass($.timepicker.markerClassName) &&
- !$target.hasClass($.timepicker._triggerClass) &&
- $.timepicker._timepickerShowing && !($.timepicker._inDialog && $.blockUI))
- $.timepicker._hideTimepicker();
- },
-
- /* Hide the time picker from view.
- @param input element - the input field attached to the time picker */
- _hideTimepicker: function (input) {
- var inst = this._curInst;
- if (!inst || (input && inst != $.data(input, PROP_NAME))) { return; }
- if (this._timepickerShowing) {
- var showAnim = this._get(inst, 'showAnim');
- var duration = this._get(inst, 'duration');
- var postProcess = function () {
- $.timepicker._tidyDialog(inst);
- this._curInst = null;
- };
- if ($.effects && $.effects[showAnim]) {
- inst.tpDiv.hide(showAnim, $.timepicker._get(inst, 'showOptions'), duration, postProcess);
- }
- else {
- inst.tpDiv[(showAnim == 'slideDown' ? 'slideUp' :
- (showAnim == 'fadeIn' ? 'fadeOut' : 'hide'))]((showAnim ? duration : null), postProcess);
- }
- if (!showAnim) { postProcess(); }
-
- this._timepickerShowing = false;
-
- this._lastInput = null;
- if (this._inDialog) {
- this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' });
- if ($.blockUI) {
- $.unblockUI();
- $('body').append(this.tpDiv);
- }
- }
- this._inDialog = false;
-
- var onClose = this._get(inst, 'onClose');
- if (onClose) {
- onClose.apply(
- (inst.input ? inst.input[0] : null),
- [(inst.input ? inst.input.val() : ''), inst]); // trigger custom callback
- }
-
- }
- },
-
-
-
- /* Tidy up after a dialog display. */
- _tidyDialog: function (inst) {
- inst.tpDiv.removeClass(this._dialogClass).unbind('.ui-timepicker');
- },
-
- /* Retrieve the instance data for the target control.
- @param target element - the target input field or division or span
- @return object - the associated instance data
- @throws error if a jQuery problem getting data */
- _getInst: function (target) {
- try {
- return $.data(target, PROP_NAME);
- }
- catch (err) {
- throw 'Missing instance data for this timepicker';
- }
- },
-
- /* Get a setting value, defaulting if necessary. */
- _get: function (inst, name) {
- return inst.settings[name] !== undefined ?
- inst.settings[name] : this._defaults[name];
- },
-
- /* Parse existing time and initialise time picker. */
- _setTimeFromField: function (inst) {
- if (inst.input.val() == inst.lastVal) { return; }
- var defaultTime = this._get(inst, 'defaultTime');
-
- var timeToParse = defaultTime == 'now' ? this._getCurrentTimeRounded(inst) : defaultTime;
- if ((inst.inline == false) && (inst.input.val() != '')) { timeToParse = inst.input.val() }
-
- if (timeToParse instanceof Date) {
- inst.hours = timeToParse.getHours();
- inst.minutes = timeToParse.getMinutes();
- } else {
- var timeVal = inst.lastVal = timeToParse;
- if (timeToParse == '') {
- inst.hours = -1;
- inst.minutes = -1;
- } else {
- var time = this.parseTime(inst, timeVal);
- inst.hours = time.hours;
- inst.minutes = time.minutes;
- }
- }
-
-
- $.timepicker._updateTimepicker(inst);
- },
-
- /* Update or retrieve the settings for an existing time picker.
- @param target element - the target input field or division or span
- @param name object - the new settings to update or
- string - the name of the setting to change or retrieve,
- when retrieving also 'all' for all instance settings or
- 'defaults' for all global defaults
- @param value any - the new value for the setting
- (omit if above is an object or to retrieve a value) */
- _optionTimepicker: function(target, name, value) {
- var inst = this._getInst(target);
- if (arguments.length == 2 && typeof name == 'string') {
- return (name == 'defaults' ? $.extend({}, $.timepicker._defaults) :
- (inst ? (name == 'all' ? $.extend({}, inst.settings) :
- this._get(inst, name)) : null));
- }
- var settings = name || {};
- if (typeof name == 'string') {
- settings = {};
- settings[name] = value;
- }
- if (inst) {
- if (this._curInst == inst) {
- this._hideTimepicker();
- }
- extendRemove(inst.settings, settings);
- this._updateTimepicker(inst);
- }
- },
-
-
- /* Set the time for a jQuery selection.
- @param target element - the target input field or division or span
- @param time String - the new time */
- _setTimeTimepicker: function(target, time) {
- var inst = this._getInst(target);
- if (inst) {
- this._setTime(inst, time);
- this._updateTimepicker(inst);
- this._updateAlternate(inst, time);
- }
- },
-
- /* Set the time directly. */
- _setTime: function(inst, time, noChange) {
- var origHours = inst.hours;
- var origMinutes = inst.minutes;
- var time = this.parseTime(inst, time);
- inst.hours = time.hours;
- inst.minutes = time.minutes;
-
- if ((origHours != inst.hours || origMinutes != inst.minuts) && !noChange) {
- inst.input.trigger('change');
- }
- this._updateTimepicker(inst);
- this._updateSelectedValue(inst);
- },
-
- /* Return the current time, ready to be parsed, rounded to the closest 5 minute */
- _getCurrentTimeRounded: function (inst) {
- var currentTime = new Date(),
- currentMinutes = currentTime.getMinutes(),
- // round to closest 5
- adjustedMinutes = Math.round( currentMinutes / 5 ) * 5;
- currentTime.setMinutes(adjustedMinutes);
- return currentTime;
- },
-
- /*
- * Parse a time string into hours and minutes
- */
- parseTime: function (inst, timeVal) {
- var retVal = new Object();
- retVal.hours = -1;
- retVal.minutes = -1;
-
- var timeSeparator = this._get(inst, 'timeSeparator'),
- amPmText = this._get(inst, 'amPmText'),
- showHours = this._get(inst, 'showHours'),
- showMinutes = this._get(inst, 'showMinutes'),
- optionalMinutes = this._get(inst, 'optionalMinutes'),
- showPeriod = (this._get(inst, 'showPeriod') == true),
- p = timeVal.indexOf(timeSeparator);
-
- // check if time separator found
- if (p != -1) {
- retVal.hours = parseInt(timeVal.substr(0, p), 10);
- retVal.minutes = parseInt(timeVal.substr(p + 1), 10);
- }
- // check for hours only
- else if ( (showHours) && ( !showMinutes || optionalMinutes ) ) {
- retVal.hours = parseInt(timeVal, 10);
- }
- // check for minutes only
- else if ( ( ! showHours) && (showMinutes) ) {
- retVal.minutes = parseInt(timeVal, 10);
- }
-
- if (showHours) {
- var timeValUpper = timeVal.toUpperCase();
- if ((retVal.hours < 12) && (showPeriod) && (timeValUpper.indexOf(amPmText[1].toUpperCase()) != -1)) {
- retVal.hours += 12;
- }
- // fix for 12 AM
- if ((retVal.hours == 12) && (showPeriod) && (timeValUpper.indexOf(amPmText[0].toUpperCase()) != -1)) {
- retVal.hours = 0;
- }
- }
-
- return retVal;
- },
-
- selectNow: function(event) {
- var id = $(event.target).attr("data-timepicker-instance-id"),
- $target = $(id),
- inst = this._getInst($target[0]);
- //if (!inst || (input && inst != $.data(input, PROP_NAME))) { return; }
- var currentTime = new Date();
- inst.hours = currentTime.getHours();
- inst.minutes = currentTime.getMinutes();
- this._updateSelectedValue(inst);
- this._updateTimepicker(inst);
- this._hideTimepicker();
- },
-
- deselectTime: function(event) {
- var id = $(event.target).attr("data-timepicker-instance-id"),
- $target = $(id),
- inst = this._getInst($target[0]);
- inst.hours = -1;
- inst.minutes = -1;
- this._updateSelectedValue(inst);
- this._hideTimepicker();
- },
-
-
- selectHours: function (event) {
- var $td = $(event.currentTarget),
- id = $td.attr("data-timepicker-instance-id"),
- newHours = parseInt($td.attr("data-hour")),
- fromDoubleClick = event.data.fromDoubleClick,
- $target = $(id),
- inst = this._getInst($target[0]),
- showMinutes = (this._get(inst, 'showMinutes') == true);
-
- // don't select if disabled
- if ( $.timepicker._isDisabledTimepicker($target.attr('id')) ) { return false }
-
- $td.parents('.ui-timepicker-hours:first').find('a').removeClass('ui-state-active');
- $td.children('a').addClass('ui-state-active');
- inst.hours = newHours;
-
- // added for onMinuteShow callback
- var onMinuteShow = this._get(inst, 'onMinuteShow');
- if (onMinuteShow) {
- // this will trigger a callback on selected hour to make sure selected minute is allowed.
- this._updateMinuteDisplay(inst);
- }
-
- this._updateSelectedValue(inst);
-
- inst._hoursClicked = true;
- if ((inst._minutesClicked) || (fromDoubleClick) || (showMinutes == false)) {
- $.timepicker._hideTimepicker();
- }
- // return false because if used inline, prevent the url to change to a hashtag
- return false;
- },
-
- selectMinutes: function (event) {
- var $td = $(event.currentTarget),
- id = $td.attr("data-timepicker-instance-id"),
- newMinutes = parseInt($td.attr("data-minute")),
- fromDoubleClick = event.data.fromDoubleClick,
- $target = $(id),
- inst = this._getInst($target[0]),
- showHours = (this._get(inst, 'showHours') == true);
-
- // don't select if disabled
- if ( $.timepicker._isDisabledTimepicker($target.attr('id')) ) { return false }
-
- $td.parents('.ui-timepicker-minutes:first').find('a').removeClass('ui-state-active');
- $td.children('a').addClass('ui-state-active');
-
- inst.minutes = newMinutes;
- this._updateSelectedValue(inst);
-
- inst._minutesClicked = true;
- if ((inst._hoursClicked) || (fromDoubleClick) || (showHours == false)) {
- $.timepicker._hideTimepicker();
- // return false because if used inline, prevent the url to change to a hashtag
- return false;
- }
-
- // return false because if used inline, prevent the url to change to a hashtag
- return false;
- },
-
- _updateSelectedValue: function (inst) {
- var newTime = this._getParsedTime(inst);
- if (inst.input) {
- inst.input.val(newTime);
- inst.input.trigger('change');
- }
- var onSelect = this._get(inst, 'onSelect');
- if (onSelect) { onSelect.apply((inst.input ? inst.input[0] : null), [newTime, inst]); } // trigger custom callback
- this._updateAlternate(inst, newTime);
- return newTime;
- },
-
- /* this function process selected time and return it parsed according to instance options */
- _getParsedTime: function(inst) {
-
- if (inst.hours == -1 && inst.minutes == -1) {
- return '';
- }
-
- // default to 0 AM if hours is not valid
- if ((inst.hours < inst.hours.starts) || (inst.hours > inst.hours.ends )) { inst.hours = 0; }
- // default to 0 minutes if minute is not valid
- if ((inst.minutes < inst.minutes.starts) || (inst.minutes > inst.minutes.ends)) { inst.minutes = 0; }
-
- var period = "",
- showPeriod = (this._get(inst, 'showPeriod') == true),
- showLeadingZero = (this._get(inst, 'showLeadingZero') == true),
- showHours = (this._get(inst, 'showHours') == true),
- showMinutes = (this._get(inst, 'showMinutes') == true),
- optionalMinutes = (this._get(inst, 'optionalMinutes') == true),
- amPmText = this._get(inst, 'amPmText'),
- selectedHours = inst.hours ? inst.hours : 0,
- selectedMinutes = inst.minutes ? inst.minutes : 0,
- displayHours = selectedHours ? selectedHours : 0,
- parsedTime = '';
-
- if (showPeriod) {
- if (inst.hours == 0) {
- displayHours = 12;
- }
- if (inst.hours < 12) {
- period = amPmText[0];
- }
- else {
- period = amPmText[1];
- if (displayHours > 12) {
- displayHours -= 12;
- }
- }
- }
-
- var h = displayHours.toString();
- if (showLeadingZero && (displayHours < 10)) { h = '0' + h; }
-
- var m = selectedMinutes.toString();
- if (selectedMinutes < 10) { m = '0' + m; }
-
- if (showHours) {
- parsedTime += h;
- }
- if (showHours && showMinutes && (!optionalMinutes || m != 0)) {
- parsedTime += this._get(inst, 'timeSeparator');
- }
- if (showMinutes && (!optionalMinutes || m != 0)) {
- parsedTime += m;
- }
- if (showHours) {
- if (period.length > 0) { parsedTime += this._get(inst, 'periodSeparator') + period; }
- }
-
- return parsedTime;
- },
-
- /* Update any alternate field to synchronise with the main field. */
- _updateAlternate: function(inst, newTime) {
- var altField = this._get(inst, 'altField');
- if (altField) { // update alternate field too
- $(altField).each(function(i,e) {
- $(e).val(newTime);
- });
- }
- },
-
- /* This might look unused but it's called by the $.fn.timepicker function with param getTime */
- /* added v 0.2.3 - gitHub issue #5 - Thanks edanuff */
- _getTimeTimepicker : function(input) {
- var inst = this._getInst(input);
- return this._getParsedTime(inst);
- },
- _getHourTimepicker: function(input) {
- var inst = this._getInst(input);
- if ( inst == undefined) { return -1; }
- return inst.hours;
- },
- _getMinuteTimepicker: function(input) {
- var inst= this._getInst(input);
- if ( inst == undefined) { return -1; }
- return inst.minutes;
- }
-
- });
-
-
-
- /* Invoke the timepicker functionality.
- @param options string - a command, optionally followed by additional parameters or
- Object - settings for attaching new timepicker functionality
- @return jQuery object */
- $.fn.timepicker = function (options) {
-
- /* Initialise the time picker. */
- if (!$.timepicker.initialized) {
- $(document).mousedown($.timepicker._checkExternalClick).
- find('body').append($.timepicker.tpDiv);
- $.timepicker.initialized = true;
- }
-
-
-
- var otherArgs = Array.prototype.slice.call(arguments, 1);
- if (typeof options == 'string' && (options == 'getTime' || options == 'getHour' || options == 'getMinute' ))
- return $.timepicker['_' + options + 'Timepicker'].
- apply($.timepicker, [this[0]].concat(otherArgs));
- if (options == 'option' && arguments.length == 2 && typeof arguments[1] == 'string')
- return $.timepicker['_' + options + 'Timepicker'].
- apply($.timepicker, [this[0]].concat(otherArgs));
- return this.each(function () {
- typeof options == 'string' ?
- $.timepicker['_' + options + 'Timepicker'].
- apply($.timepicker, [this].concat(otherArgs)) :
- $.timepicker._attachTimepicker(this, options);
- });
- };
-
- /* jQuery extend now ignores nulls! */
- function extendRemove(target, props) {
- $.extend(target, props);
- for (var name in props)
- if (props[name] == null || props[name] == undefined)
- target[name] = props[name];
- return target;
- };
-
- $.timepicker = new Timepicker(); // singleton instance
- $.timepicker.initialized = false;
- $.timepicker.uuid = new Date().getTime();
- $.timepicker.version = "0.3.1";
-
- // Workaround for #4055
- // Add another global to avoid noConflict issues with inline event handlers
- window['TP_jQuery_' + tpuuid] = $;
-
-})(jQuery);
diff --git a/3rdparty/timepicker/releases.txt b/3rdparty/timepicker/releases.txt
deleted file mode 100755
index 99ecbafdacb..00000000000
--- a/3rdparty/timepicker/releases.txt
+++ /dev/null
@@ -1,115 +0,0 @@
-Release 0.3.0 - 27 March 2012
-Fixed a zIndex problem in jQuery Dialog when the user clicked on the input while the timepicker was still visible.
-Added Czech translation, thanks David Spohr
-Added Swedish translation, thanks Björn Westlin
-Added Dutch translation, thanks Lowie Hulzinga
-Prevent showing the timepicker dialog with the button when disabled(Thanks ruhley. ref #38)
-Add ui-state-disabled class to button trigger when disabled.
-Fixed onClose function on first time passes the hours variable as string (Thanks Zanisimo, ref #39)
-Added "refresh" method $('selector').timepicker('refresh');
-
-Release 0.2.9 - November 13, 2011
-Fixed the zIndex problem and removed the zIndex option (Thanks everyone who reported the problem)
-Fix a bug where repeatedly clicking on hour cells made the timepicker very slow.
-Added Italian translation, thanks to Serge Margarita.
-
-Release 0.2.8 - November 5, 2011
-Updated "defaultTime" to allow for Date object (github issue #26)
-Fixed the now and deselect buttons in IE
-
-Release 0.2.7 - October 19, 2011
-Added option to omit minutes in parsed time when user select 0 for minutes. (Thanks tribalvibes, Github issue #23)
-Added support for internationalisation (fr, de and ja, Thanks Bernd Plagge).
-
-Release 0.2.6 - October 12, 2011
-Fixed a bug when input ID have more then one special char. (Thamks Jacqueline Krijnen)
-Fixed a bug when parsing hours only or minutes only time. (Thanks protron, <a href="https://github.com/fgelinas/timepicker/issues/20">github issue #20</a>)
-Added 'Now', 'Deselect' and 'Close' buttons. (Thanks Christian Grobmeier for the close button code, <a href="https://github.com/fgelinas/timepicker/issues/20">github issue #22</a>)
-
-Release 0.2.5 - September 13, 2011
-Added support for disable and enable. (Suggested by danielrex, github issue #17)
-Added an example for 2 timepicker to behave as a period selector (start time and end time). (Thanks Bill Pellowe)
-Renamed the stylesheet to jquery.ui.timepicker.css to be more consistent with jQuery UI file name convention.
-
-Release 0.2.4 - August 5, 2011
-Fixed the hand cursor in the css file. (Thanks Mike Neumegen)
-Added position option to use with the jquery ui position utility.
-Added option to display only hours or only minutes.
-
-Release 0.2.3 - July 11, 2011
-Fix github issue #3 : Bug when hours or minutes choices does not divide by number of rows (thanks wukimus)
-Changed default behavior of the defaultTime option, if set to '' and input is empty, there will be no highlighted time in the popup (Thanks Rasmus Schultz)
-Fix github issue #4 : Error when generating empty minute cell. (Thanks 123Haynes)
-Fix github issue #5 : Add functionality for "getTime" option. (Thanks edanuff)
-Added the periodSeparator option. (thanks jrchamp)
-Fixed "getTime" for inline timepickers. (thanks Mike Neumegen)
-Added "getHour" and "getMinute" to get individual values.
-
-Release 0.2.2 - June 16, 2011
-Fixed a "console.log" line that I forgot to remove before release 0.2.1
-
-Release 0.2.1 - June 12, 2011
-Timepicker does not give the focus back to the input any more after time selection. This is similar to the datepicker behaviour and is more natural to the user because it shows the dialog again when the user click on the input again, as expected.
-Added options to customize the hours and minutes ranges and interval for more customization.
-
-Release 0.2 - May 28, 2011
-So in the previous release I mixed up versions and lost some changes, I guess that's what happen when you drink and code.
-
-Release 0.1.2 - May 26, 2011
-Fixed a bug with inline timepickers that would append a #timepickr hashtag when selecting hours and minutes.
-Fixed z-index problem with IE6 (Thanks Graham Bentley)
-Added selection of highlighted text when enter is pressed on the input field (Thanks Glen Chiacchieri)
-Adjusted some focus problems, now the input gets the focus back when the used click on hours / minutes.
-
-Release 0.1.something aka the lost release - around April 11
-Fixed a bug for when input Id had a dot in it, it was getting double escaped when it should not. (Thanks Zdenek Machac)
-So in 0.1.1 I created a bug that made timepicker changes the location hash, well now it's fixed. (Thanks Lucas Falk)
-
-Release 0.1.1 - April 6, 2011
-Changed the cells click and dblclick binding for faster rendering in IE6/7 (Thanks Blair Parsons)
-Fixed a class naming bug created in 0.1.0 (Thanks Morlion Peter)
-
-Release 0.1.0 - March 23, 2011
-Fixed some bugs with release 0.0.9
-
-Release 0.0.9 - March 22, 2011
-Added zIndex option (Thanks Frank Enderle)
-Added option showPeriodLabels that defines if the AM/PM labels are displayed on the left (Thanks Frank Enderle)
-Added showOn ['focus'|'button'|'both'] and button options for alternate trigger method
-
-Release 0.0.8 - Fev 17, 2011
-Fixed close event not triggered when switching to another input with time picker (thanks Stuart Gregg)
-
-Release 0.0.7 - Fev 10, 2011
-Added function to set time after initialisation :$('#timepicker').timepicker('setTime',newTime);
-Added support for disabled period of time : onHourShow and onMinuteShow (thanks Rene Felgentr�ger)
-
-Release 0.0.6 - Jan 19, 2011
-Added standard "change" event being triggered on the input when the content changes. (Thanks Rasmus Schultz)
-Added support for inline timePicker, attached to div or span
-Added altField that receive the parsed time value when selected time changes
-Added defaultTime value to use when input field is missing (inline) or input value is empty
- if defaultTime is missing, current time is used
-
-Release 0.0.5 - Jan 18, 2011
-Now updating time picker selected value when manually typing in the text field (thanks Rasmus Schultz)
-Fixed : with showPeriod: true and showLeadingZero: true, PM hours did not show leading zeros (thanks Chandler May)
-Fixed : with showPeriod: true and showLeadingZero: true, Selecting 12 AM shows as 00 AM in the input field, also parsing 12AM did not work correctly (thanks Rasmus Schultz)
-
-Release 0.0.4 - jan 10, 2011
-changed showLeadingZero to affect only hours, added showMinutesLeadingZero for minutes display
-Removed width:100% for tables in css
-
-Release 0.0.3 - Jan 8, 2011
-Re-added a display:none on the main div (fix a small empty div visible at the bottom of the page before timepicker is called) (Thanks Gertjan van Roekel)
-Fixed a problem where the timepicker was never displayed with jquery ui 1.8.7 css,
- the problem was the class ui-helper-hidden-accessible, witch I removed.
- Thanks Alexander Fietz and StackOverflow : http://stackoverflow.com/questions/4522274/jquery-timepicker-and-jqueryui-1-8-7-conflict
-
-Release 0.0.2 - Jan 6, 2011
-Updated to include common display options for USA users
-Stephen Commisso - Jan 2011
-
-As it is a timepicker, I inspired most of the code from the datepicker
-Francois Gelinas - Nov 2010
-