From 140e2e7bf725f7b6f5a5a403e9693f30f50c4e57 Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Wed, 17 Sep 2014 10:01:41 -0400 Subject: [PATCH] Updated dependencies; simplified composer.json --- composer.json | 12 +- composer.lock | 59 +- vendor/autoload.php | 2 +- vendor/composer/autoload_real.php | 8 +- vendor/composer/include_paths.php | 6 +- vendor/composer/installed.json | 851 +++--- vendor/jasig/phpcas/composer.json | 6 +- vendor/jasig/phpcas/docs/index.html | 2 +- vendor/jasig/phpcas/source/CAS.php | 11 +- .../source/CAS/AuthenticationException.php | 3 +- vendor/jasig/phpcas/source/CAS/Client.php | 32 +- .../source/CAS/TypeMismatchException.php | 4 +- .../Archive_Tar/Archive/Tar.php | 2483 ++++++++++------- vendor/pear-pear.php.net/PEAR/bin/pear | 10 +- vendor/pear-pear.php.net/PEAR/bin/peardev | 10 +- vendor/pear-pear.php.net/PEAR/bin/pecl | 10 +- vendor/pear-pear.php.net/PEAR/pearcmd.php | 4 +- vendor/pear-pear.php.net/PEAR/peclcmd.php | 4 +- .../yaml/Symfony/Component/Yaml/Inline.php | 66 +- .../yaml/Symfony/Component/Yaml/Parser.php | 8 +- .../Yaml/Tests/Fixtures/sfComments.yml | 8 + .../Component/Yaml/Tests/InlineTest.php | 32 + .../Component/Yaml/Tests/ParserTest.php | 26 + 23 files changed, 2090 insertions(+), 1567 deletions(-) diff --git a/composer.json b/composer.json index bc2ffd3a045..6be40b36eab 100644 --- a/composer.json +++ b/composer.json @@ -17,14 +17,6 @@ "type": "pear", "url": "http://pear.php.net" }, - { - "type": "vcs", - "url": "https://github.com/summon/Summon.php" - }, - { - "type": "vcs", - "url": "https://github.com/Jasig/phpCAS" - }, { "type": "package", "package": { @@ -56,14 +48,14 @@ ], "require": { "aferrandini/phpqrcode": "1.0.1", - "jasig/phpCAS": "dev-master", + "jasig/phpcas": "*", "johnwohlers/sip2": "dev-master", "mobileesp/mdetect": "dev-master", "oyejorge/less.php": "*", "pear-pear.php.net/file_marc": "*", "pear-pear.php.net/pear": "*", "pear-pear.php.net/validate_ispn": "*", - "serialssolutions/summon": "dev-master", + "serialssolutions/summon": "*", "symfony/yaml": "*", "zendframework/zendframework": "2.2.7", "zendframework/zendrest": "2.*", diff --git a/composer.lock b/composer.lock index 295507f51bc..6d71cbeaa63 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "231b305c8c70b43d87f2685e50469688", + "hash": "fee460941507f1e403fd5c4b6d6b862f", "packages": [ { "name": "aferrandini/phpqrcode", @@ -52,16 +52,16 @@ }, { "name": "jasig/phpcas", - "version": "dev-master", + "version": "1.3.3", "source": { "type": "git", "url": "https://github.com/Jasig/phpCAS.git", - "reference": "83168b398e10defc384b740e104950a3fef83e51" + "reference": "b6f5d484735d3b0e80b068a87bd1eabac04b2cbe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Jasig/phpCAS/zipball/83168b398e10defc384b740e104950a3fef83e51", - "reference": "83168b398e10defc384b740e104950a3fef83e51", + "url": "https://api.github.com/repos/Jasig/phpCAS/zipball/b6f5d484735d3b0e80b068a87bd1eabac04b2cbe", + "reference": "b6f5d484735d3b0e80b068a87bd1eabac04b2cbe", "shasum": "" }, "require": { @@ -71,11 +71,17 @@ "phpunit/phpunit": "~3.7.10" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, "autoload": { "classmap": [ "source/" ] }, + "notification-url": "https://packagist.org/downloads/", "license": [ "Apache-2.0" ], @@ -95,11 +101,7 @@ "cas", "jasig" ], - "support": { - "source": "https://github.com/Jasig/phpCAS/tree/master", - "issues": "https://github.com/Jasig/phpCAS/issues" - }, - "time": "2014-07-02 15:38:35" + "time": "2014-07-24 20:29:29" }, { "name": "johnwohlers/sip2", @@ -194,10 +196,10 @@ }, { "name": "pear-pear.php.net/Archive_Tar", - "version": "1.3.11", + "version": "1.3.13", "dist": { "type": "file", - "url": "http://pear.php.net/get/Archive_Tar-1.3.11.tgz", + "url": "http://pear.php.net/get/Archive_Tar-1.3.13.tgz", "reference": null, "shasum": null }, @@ -205,7 +207,7 @@ "php": ">=4.3.0.0" }, "replace": { - "pear-pear/archive_tar": "== 1.3.11.0" + "pear-pear/archive_tar": "== 1.3.13.0" }, "type": "pear-library", "autoload": { @@ -414,7 +416,7 @@ }, { "name": "serialssolutions/summon", - "version": "dev-master", + "version": "v1.0.0", "source": { "type": "git", "url": "https://github.com/summon/Summon.php.git", @@ -432,6 +434,7 @@ "SerialsSolutions": "" } }, + "notification-url": "https://packagist.org/downloads/", "license": [ "GPL-2.0" ], @@ -442,25 +445,21 @@ } ], "description": "Library for interacting with Serials Solutions' Summon API.", - "support": { - "source": "https://github.com/summon/Summon.php/tree/master", - "issues": "https://github.com/summon/Summon.php/issues" - }, "time": "2013-11-13 19:07:09" }, { "name": "symfony/yaml", - "version": "v2.5.2", + "version": "v2.5.4", "target-dir": "Symfony/Component/Yaml", "source": { "type": "git", "url": "https://github.com/symfony/Yaml.git", - "reference": "f868ecdbcc0276b6158dfbf08b9e98ce07f014e1" + "reference": "01a7695bcfb013d0a15c6757e15aae120342986f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/f868ecdbcc0276b6158dfbf08b9e98ce07f014e1", - "reference": "f868ecdbcc0276b6158dfbf08b9e98ce07f014e1", + "url": "https://api.github.com/repos/symfony/Yaml/zipball/01a7695bcfb013d0a15c6757e15aae120342986f", + "reference": "01a7695bcfb013d0a15c6757e15aae120342986f", "shasum": "" }, "require": { @@ -482,20 +481,18 @@ "MIT" ], "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" - }, { "name": "Symfony Community", "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" } ], "description": "Symfony Yaml Component", "homepage": "http://symfony.com", - "time": "2014-07-09 09:05:48" + "time": "2014-08-31 03:22:04" }, { "name": "zendframework/zendframework", @@ -818,10 +815,8 @@ ], "minimum-stability": "stable", "stability-flags": { - "jasig/phpcas": 20, "johnwohlers/sip2": 20, - "mobileesp/mdetect": 20, - "serialssolutions/summon": 20 + "mobileesp/mdetect": 20 }, "prefer-stable": false, "platform": [ diff --git a/vendor/autoload.php b/vendor/autoload.php index b65f70f1cce..6686884c283 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer' . '/autoload_real.php'; -return ComposerAutoloaderInite187e8e8985b1108048a87b08c32b59c::getLoader(); +return ComposerAutoloaderInit328ec30d59afd86e26ec0bf54ac09443::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index ae133de9471..2c19f699aac 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInite187e8e8985b1108048a87b08c32b59c +class ComposerAutoloaderInit328ec30d59afd86e26ec0bf54ac09443 { private static $loader; @@ -19,9 +19,9 @@ class ComposerAutoloaderInite187e8e8985b1108048a87b08c32b59c return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInite187e8e8985b1108048a87b08c32b59c', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit328ec30d59afd86e26ec0bf54ac09443', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInite187e8e8985b1108048a87b08c32b59c', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit328ec30d59afd86e26ec0bf54ac09443', 'loadClassLoader')); $includePaths = require __DIR__ . '/include_paths.php'; array_push($includePaths, get_include_path()); @@ -48,7 +48,7 @@ class ComposerAutoloaderInite187e8e8985b1108048a87b08c32b59c } } -function composerRequiree187e8e8985b1108048a87b08c32b59c($file) +function composerRequire328ec30d59afd86e26ec0bf54ac09443($file) { require $file; } diff --git a/vendor/composer/include_paths.php b/vendor/composer/include_paths.php index 0492372701f..20869ac55f9 100644 --- a/vendor/composer/include_paths.php +++ b/vendor/composer/include_paths.php @@ -6,12 +6,12 @@ $vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( + $vendorDir . '/pear-pear.php.net/File_MARC', + $vendorDir . '/pear-pear.php.net/XML_Util', $vendorDir . '/pear-pear.php.net/Console_Getopt', $vendorDir . '/pear-pear.php.net/Structures_Graph', $vendorDir . '/pear-pear.php.net/Archive_Tar', + $vendorDir . '/pear-pear.php.net/PEAR', $vendorDir . '/pear-pear.php.net/Validate', $vendorDir . '/pear-pear.php.net/Validate_ISPN', - $vendorDir . '/pear-pear.php.net/File_MARC', - $vendorDir . '/pear-pear.php.net/XML_Util', - $vendorDir . '/pear-pear.php.net/PEAR', ); diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 7901c0fab01..4d6fef9e0f7 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -1,4 +1,105 @@ [ + { + "name": "aferrandini/phpqrcode", + "version": "1.0.1", + "version_normalized": "1.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/aferrandini/PHPQRCode.git", + "reference": "3c1c0454d43710ab5bbe19a51ad4cb41c22e3d46" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/aferrandini/PHPQRCode/zipball/3c1c0454d43710ab5bbe19a51ad4cb41c22e3d46", + "reference": "3c1c0454d43710ab5bbe19a51ad4cb41c22e3d46", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "time": "2013-07-08 09:39:08", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-0": { + "PHPQRCode": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ariel Ferrandini", + "email": "arielferrandini@gmail.com", + "homepage": "http://www.ferrandini.com/", + "role": "Developer" + } + ], + "description": "PHPQRCode porting and changed for PHP 5.3 compatibility", + "homepage": "https://github.com/aferrandini/PHPQRCode", + "keywords": [ + "barcode", + "php", + "qrcode" + ] + }, + { + "name": "jasig/phpcas", + "version": "1.3.3", + "version_normalized": "1.3.3.0", + "source": { + "type": "git", + "url": "https://github.com/Jasig/phpCAS.git", + "reference": "b6f5d484735d3b0e80b068a87bd1eabac04b2cbe" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Jasig/phpCAS/zipball/b6f5d484735d3b0e80b068a87bd1eabac04b2cbe", + "reference": "b6f5d484735d3b0e80b068a87bd1eabac04b2cbe", + "shasum": "" + }, + "require": { + "php": ">=5.0.0" + }, + "require-dev": { + "phpunit/phpunit": "~3.7.10" + }, + "time": "2014-07-24 20:29:29", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "classmap": [ + "source/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Joachim Fritschi", + "homepage": "https://wiki.jasig.org/display/~fritschi" + }, + { + "name": "Adam Franco", + "homepage": "https://wiki.jasig.org/display/~adamfranco" + } + ], + "description": "Provides a simple API for authenticating users against a CAS server", + "homepage": "https://wiki.jasig.org/display/CASC/phpCAS", + "keywords": [ + "cas", + "jasig" + ] + }, { "name": "johnwohlers/sip2", "version": "dev-master", @@ -18,48 +119,134 @@ } }, { - "name": "pear-pear.php.net/Console_Getopt", - "version": "1.3.1", - "version_normalized": "1.3.1.0", + "name": "mobileesp/mdetect", + "version": "dev-master", + "version_normalized": "9999999-dev", "dist": { "type": "file", - "url": "http://pear.php.net/get/Console_Getopt-1.3.1.tgz", + "url": "http://mobileesp.googlecode.com/svn/PHP/mdetect.php", "reference": null, "shasum": null }, - "require": { - "php": ">=4.3.0.0" + "type": "library", + "installation-source": "dist", + "autoload": { + "classmap": [ + "/" + ] + } + }, + { + "name": "serialssolutions/summon", + "version": "v1.0.0", + "version_normalized": "1.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/summon/Summon.php.git", + "reference": "ce26752adfded96aff2f4422991078eedfc740a5" }, - "replace": { - "pear-pear/console_getopt": "== 1.3.1.0" + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/summon/Summon.php/zipball/ce26752adfded96aff2f4422991078eedfc740a5", + "reference": "ce26752adfded96aff2f4422991078eedfc740a5", + "shasum": "" }, - "type": "pear-library", + "time": "2013-11-13 19:07:09", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-0": { + "SerialsSolutions": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0" + ], + "authors": [ + { + "name": "Demian Katz", + "email": "demian.katz@villanova.edu" + } + ], + "description": "Library for interacting with Serials Solutions' Summon API." + }, + { + "name": "oyejorge/less.php", + "version": "v1.7.0.2", + "version_normalized": "1.7.0.2", + "source": { + "type": "git", + "url": "https://github.com/oyejorge/less.php.git", + "reference": "82372b389386ae1edab55495eae4b400cca3c86c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/oyejorge/less.php/zipball/82372b389386ae1edab55495eae4b400cca3c86c", + "reference": "82372b389386ae1edab55495eae4b400cca3c86c", + "shasum": "" + }, + "require": { + "php": ">=5.2" + }, + "time": "2014-06-05 16:09:50", + "bin": [ + "bin/lessc" + ], + "type": "library", "installation-source": "dist", "autoload": { + "psr-0": { + "Less": "lib/" + }, "classmap": [ - "" + "lessc.inc.php" ] }, - "include-path": [ - "/" + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" ], - "description": "This is a PHP implementation of "getopt" supporting both\nshort and long options." + "authors": [ + { + "name": "Matt Agar", + "homepage": "https://github.com/agar" + }, + { + "name": "Martin JantoÅ¡oviÄ", + "homepage": "https://github.com/Mordred" + }, + { + "name": "Josh Schmidt", + "homepage": "https://github.com/oyejorge" + } + ], + "description": "PHP port of the Javascript version of LESS http://lesscss.org", + "homepage": "http://lessphp.gpeasy.com", + "keywords": [ + "css", + "less", + "less.js", + "lesscss", + "php", + "stylesheet" + ] }, { - "name": "pear-pear.php.net/Structures_Graph", - "version": "1.0.4", - "version_normalized": "1.0.4.0", + "name": "pear-pear.php.net/File_MARC", + "version": "1.1.1", + "version_normalized": "1.1.1.0", "dist": { "type": "file", - "url": "http://pear.php.net/get/Structures_Graph-1.0.4.tgz", + "url": "http://pear.php.net/get/File_MARC-1.1.1.tgz", "reference": null, "shasum": null }, "require": { - "php": ">=4.2.0.0" + "php": ">=5.3.0.0" }, "replace": { - "pear-pear/structures_graph": "== 1.0.4.0" + "pear-pear/file_marc": "== 1.1.1.0" }, "type": "pear-library", "installation-source": "dist", @@ -71,23 +258,24 @@ "include-path": [ "/" ], - "description": "Structures_Graph is a package for creating and manipulating graph datastructures. It allows building of directed\nand undirected graphs, with data and metadata stored in nodes. The library provides functions for graph traversing\nas well as for characteristic extraction from the graph topology." + "description": "The standard for machine-readable cataloging (MARC) records is documented at http://loc.gov/marc/. This package enables you to read existing MARC records from a file, string, or (using the YAZ extension), from a Z39.50 source. You can also use this package to create new MARC records.\n\nThis package is based on the PHP MARC package, originally called \"php-marc\", that is part of the Emilda Project (http://www.emilda.org). Christoffer Landtman generously agreed to make the \"php-marc\" code available under the GNU LGPL so it could be used as the basis of this PEAR package." }, { - "name": "pear-pear.php.net/Archive_Tar", - "version": "1.3.11", - "version_normalized": "1.3.11.0", + "name": "pear-pear.php.net/XML_Util", + "version": "1.2.3", + "version_normalized": "1.2.3.0", "dist": { "type": "file", - "url": "http://pear.php.net/get/Archive_Tar-1.3.11.tgz", + "url": "http://pear.php.net/get/XML_Util-1.2.3.tgz", "reference": null, "shasum": null }, "require": { + "ext-pcre": "*", "php": ">=4.3.0.0" }, "replace": { - "pear-pear/archive_tar": "== 1.3.11.0" + "pear-pear/xml_util": "== 1.2.3.0" }, "type": "pear-library", "installation-source": "dist", @@ -99,23 +287,23 @@ "include-path": [ "/" ], - "description": "This class provides handling of tar files in PHP.\nIt supports creating, listing, extracting and adding to tar files.\nGzip support is available if PHP has the zlib extension built-in or\nloaded. Bz2 compression is also supported with the bz2 extension loaded." + "description": "Selection of methods that are often needed when working with XML documents. Functionality includes creating of attribute lists from arrays, creation of tags, validation of XML names and more." }, { - "name": "pear-pear.php.net/Validate", - "version": "0.8.5", - "version_normalized": "0.8.5.0", + "name": "pear-pear.php.net/Console_Getopt", + "version": "1.3.1", + "version_normalized": "1.3.1.0", "dist": { "type": "file", - "url": "http://pear.php.net/get/Validate-0.8.5.tgz", + "url": "http://pear.php.net/get/Console_Getopt-1.3.1.tgz", "reference": null, "shasum": null }, "require": { - "php": ">=4.2.0.0" + "php": ">=4.3.0.0" }, "replace": { - "pear-pear/validate": "== 0.8.5.0" + "pear-pear/console_getopt": "== 1.3.1.0" }, "type": "pear-library", "installation-source": "dist", @@ -127,24 +315,23 @@ "include-path": [ "/" ], - "description": "Package to validate various datas. It includes :\n - numbers (min/max, decimal or not)\n - email (syntax, domain check, rfc822)\n - string (predifined type alpha upper and/or lowercase, numeric,...)\n - date (min, max, rfc822 compliant)\n - uri (RFC2396)\n - possibility valid multiple data with a single method call (::multiple)" + "description": "This is a PHP implementation of "getopt" supporting both\nshort and long options." }, { - "name": "pear-pear.php.net/Validate_ISPN", - "version": "0.6.1", - "version_normalized": "0.6.1.0", + "name": "pear-pear.php.net/Structures_Graph", + "version": "1.0.4", + "version_normalized": "1.0.4.0", "dist": { "type": "file", - "url": "http://pear.php.net/get/Validate_ISPN-0.6.1.tgz", + "url": "http://pear.php.net/get/Structures_Graph-1.0.4.tgz", "reference": null, "shasum": null }, "require": { - "pear-pear.php.net/validate": ">=0.5.0.0", - "php": ">=4.1.0.0" + "php": ">=4.2.0.0" }, "replace": { - "pear-pear/validate_ispn": "== 0.6.1.0" + "pear-pear/structures_graph": "== 1.0.4.0" }, "type": "pear-library", "installation-source": "dist", @@ -156,61 +343,61 @@ "include-path": [ "/" ], - "description": "Package containes ISPN (International Standard Product Numbers) validations such as:\n * ISSN\n * ISBN\n * ISMN\n * ISRC (International Standard Recording Code)\n * EAN8\n * EAN13\n * EAN14\n * UCC12\n * SSCC" + "description": "Structures_Graph is a package for creating and manipulating graph datastructures. It allows building of directed\nand undirected graphs, with data and metadata stored in nodes. The library provides functions for graph traversing\nas well as for characteristic extraction from the graph topology." }, { - "name": "serialssolutions/summon", - "version": "dev-master", - "version_normalized": "9999999-dev", - "source": { - "type": "git", - "url": "https://github.com/summon/Summon.php.git", - "reference": "ce26752adfded96aff2f4422991078eedfc740a5" - }, + "name": "pear-pear.php.net/Archive_Tar", + "version": "1.3.13", + "version_normalized": "1.3.13.0", "dist": { - "type": "zip", - "url": "https://api.github.com/repos/summon/Summon.php/zipball/ce26752adfded96aff2f4422991078eedfc740a5", - "reference": "ce26752adfded96aff2f4422991078eedfc740a5", - "shasum": "" + "type": "file", + "url": "http://pear.php.net/get/Archive_Tar-1.3.13.tgz", + "reference": null, + "shasum": null }, - "time": "2013-11-13 19:07:09", - "type": "library", - "installation-source": "source", + "require": { + "php": ">=4.3.0.0" + }, + "replace": { + "pear-pear/archive_tar": "== 1.3.13.0" + }, + "type": "pear-library", + "installation-source": "dist", "autoload": { - "psr-0": { - "SerialsSolutions": "" - } + "classmap": [ + "" + ] }, - "license": [ - "GPL-2.0" - ], - "authors": [ - { - "name": "Demian Katz", - "email": "demian.katz@villanova.edu" - } + "include-path": [ + "/" ], - "description": "Library for interacting with Serials Solutions' Summon API.", - "support": { - "source": "https://github.com/summon/Summon.php/tree/master", - "issues": "https://github.com/summon/Summon.php/issues" - } + "description": "This class provides handling of tar files in PHP.\nIt supports creating, listing, extracting and adding to tar files.\nGzip support is available if PHP has the zlib extension built-in or\nloaded. Bz2 compression is also supported with the bz2 extension loaded." }, { - "name": "pear-pear.php.net/File_MARC", - "version": "1.1.1", - "version_normalized": "1.1.1.0", + "name": "pear-pear.php.net/PEAR", + "version": "1.9.5", + "version_normalized": "1.9.5.0", "dist": { "type": "file", - "url": "http://pear.php.net/get/File_MARC-1.1.1.tgz", + "url": "http://pear.php.net/get/PEAR-1.9.5.tgz", "reference": null, "shasum": null }, "require": { - "php": ">=5.3.0.0" + "ext-pcre": "*", + "ext-xml": "*", + "pear-pear.php.net/archive_tar": ">=1.3.11.0", + "pear-pear.php.net/console_getopt": ">=1.2.0.0", + "pear-pear.php.net/structures_graph": ">=1.0.2.0", + "pear-pear.php.net/xml_util": ">=1.2.0.0", + "php": ">=4.4.0.0,!=5.0.0.0,!=5.1.0.0,!=5.1.1.0,!=5.1.2.0,!=5.1.3.0,!=5.1.4.0,!=5.1.5.0" + }, + "conflict": { + "pear-pear.php.net/pear_frontend_gtk": "<0.4.0.0", + "pear-pear.php.net/pear_frontend_web": "<=0.4.0.0" }, "replace": { - "pear-pear/file_marc": "== 1.1.1.0" + "pear-pear/pear": "== 1.9.5.0" }, "type": "pear-library", "installation-source": "dist", @@ -222,125 +409,95 @@ "include-path": [ "/" ], - "description": "The standard for machine-readable cataloging (MARC) records is documented at http://loc.gov/marc/. This package enables you to read existing MARC records from a file, string, or (using the YAZ extension), from a Z39.50 source. You can also use this package to create new MARC records.\n\nThis package is based on the PHP MARC package, originally called \"php-marc\", that is part of the Emilda Project (http://www.emilda.org). Christoffer Landtman generously agreed to make the \"php-marc\" code available under the GNU LGPL so it could be used as the basis of this PEAR package." + "description": "The PEAR package contains:\n * the PEAR installer, for creating, distributing\n and installing packages\n * the PEAR_Exception PHP5 error handling mechanism\n * the PEAR_ErrorStack advanced error handling mechanism\n * the PEAR_Error error handling mechanism\n * the OS_Guess class for retrieving info about the OS\n where PHP is running on\n * the System class for quick handling of common operations\n with files and directories\n * the PEAR base class\n Features in a nutshell:\n * full support for channels\n * pre-download dependency validation\n * new package.xml 2.0 format allows tremendous flexibility while maintaining BC\n * support for optional dependency groups and limited support for sub-packaging\n * robust dependency support\n * full dependency validation on uninstall\n * remote install for hosts with only ftp access - no more problems with\n restricted host installation\n * full support for mirroring\n * support for bundling several packages into a single tarball\n * support for static dependencies on a url-based package\n * support for custom file roles and installation tasks" }, { - "name": "zendframework/zendxml", - "version": "1.0.0", - "version_normalized": "1.0.0.0", - "source": { - "type": "git", - "url": "https://github.com/zendframework/ZendXml.git", - "reference": "559b34f426d33a11c3db118e00ce14bb8dc64e5f" - }, + "name": "pear-pear.php.net/Validate", + "version": "0.8.5", + "version_normalized": "0.8.5.0", "dist": { - "type": "zip", - "url": "https://packages.zendframework.com/composer/zendframework-zendxml-559b34f426d33a11c3db118e00ce14bb8dc64e5f-zip-6cf7a2.zip", - "reference": "1.0.0", - "shasum": "39abc614b5c26bcbf8102e203c52dee73c4460a8" + "type": "file", + "url": "http://pear.php.net/get/Validate-0.8.5.tgz", + "reference": null, + "shasum": null }, "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "fabpot/php-cs-fixer": "*@dev", - "phpunit/phpunit": "~3.7" + "php": ">=4.2.0.0" }, - "time": "2014-03-05 22:25:44", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } + "replace": { + "pear-pear/validate": "== 0.8.5.0" }, + "type": "pear-library", "installation-source": "dist", "autoload": { - "psr-0": { - "ZendXml": "library/" - } + "classmap": [ + "" + ] }, - "license": [ - "BSD-3-Clause" - ], - "description": "Utility library for XML usage, best practices, and security in PHP", - "homepage": "http://packages.zendframework.com/", - "keywords": [ - "security", - "xml", - "zf2" + "include-path": [ + "/" ], - "support": { - "source": "https://github.com/zendframework/ZendXml/tree/master", - "issues": "https://github.com/zendframework/ZendXml/issues" - } + "description": "Package to validate various datas. It includes :\n - numbers (min/max, decimal or not)\n - email (syntax, domain check, rfc822)\n - string (predifined type alpha upper and/or lowercase, numeric,...)\n - date (min, max, rfc822 compliant)\n - uri (RFC2396)\n - possibility valid multiple data with a single method call (::multiple)" }, { - "name": "zendframework/zendrest", - "version": "2.0.2", - "version_normalized": "2.0.2.0", - "source": { - "type": "git", - "url": "https://github.com/zendframework/ZendRest.git", - "reference": "7427d242b4546e5aef1206d2c97e402109d8843e" - }, + "name": "pear-pear.php.net/Validate_ISPN", + "version": "0.6.1", + "version_normalized": "0.6.1.0", "dist": { - "type": "zip", - "url": "https://packages.zendframework.com/composer/zendframework-zendrest-7427d242b4546e5aef1206d2c97e402109d8843e-zip-da96cc.zip", - "reference": "2.0.2", - "shasum": "cd304d9e2fccccbd98348bfbead7d42b102e565a" + "type": "file", + "url": "http://pear.php.net/get/Validate_ISPN-0.6.1.tgz", + "reference": null, + "shasum": null }, "require": { - "php": ">=5.3.3", - "zendframework/zend-http": "~2.0", - "zendframework/zend-uri": "~2.0", - "zendframework/zendxml": "~1.0-dev" + "pear-pear.php.net/validate": ">=0.5.0.0", + "php": ">=4.1.0.0" }, - "time": "2014-03-05 22:32:09", - "type": "library", + "replace": { + "pear-pear/validate_ispn": "== 0.6.1.0" + }, + "type": "pear-library", "installation-source": "dist", "autoload": { - "psr-0": { - "ZendRest": "library/" - } + "classmap": [ + "" + ] }, - "license": [ - "BSD-3-Clause" - ], - "description": " ", - "homepage": "http://packages.zendframework.com/", - "keywords": [ - "rest", - "zf2" + "include-path": [ + "/" ], - "support": { - "source": "https://github.com/zendframework/ZendRest/tree/release-2.0.2", - "issues": "https://github.com/zendframework/ZendRest/issues" - } + "description": "Package containes ISPN (International Standard Product Numbers) validations such as:\n * ISSN\n * ISBN\n * ISMN\n * ISRC (International Standard Recording Code)\n * EAN8\n * EAN13\n * EAN14\n * UCC12\n * SSCC" }, { - "name": "aferrandini/phpqrcode", - "version": "1.0.1", - "version_normalized": "1.0.1.0", + "name": "symfony/yaml", + "version": "v2.5.4", + "version_normalized": "2.5.4.0", + "target-dir": "Symfony/Component/Yaml", "source": { "type": "git", - "url": "https://github.com/aferrandini/PHPQRCode.git", - "reference": "3c1c0454d43710ab5bbe19a51ad4cb41c22e3d46" + "url": "https://github.com/symfony/Yaml.git", + "reference": "01a7695bcfb013d0a15c6757e15aae120342986f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aferrandini/PHPQRCode/zipball/3c1c0454d43710ab5bbe19a51ad4cb41c22e3d46", - "reference": "3c1c0454d43710ab5bbe19a51ad4cb41c22e3d46", + "url": "https://api.github.com/repos/symfony/Yaml/zipball/01a7695bcfb013d0a15c6757e15aae120342986f", + "reference": "01a7695bcfb013d0a15c6757e15aae120342986f", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=5.3.3" }, - "time": "2013-07-08 09:39:08", + "time": "2014-08-31 03:22:04", "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.5-dev" + } + }, "installation-source": "dist", "autoload": { "psr-0": { - "PHPQRCode": "lib/" + "Symfony\\Component\\Yaml\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -349,78 +506,65 @@ ], "authors": [ { - "name": "Ariel Ferrandini", - "email": "arielferrandini@gmail.com", - "homepage": "http://www.ferrandini.com/", - "role": "Developer" + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" } ], - "description": "PHPQRCode porting and changed for PHP 5.3 compatibility", - "homepage": "https://github.com/aferrandini/PHPQRCode", - "keywords": [ - "barcode", - "php", - "qrcode" - ] + "description": "Symfony Yaml Component", + "homepage": "http://symfony.com" }, { - "name": "zendframework/zendservice-amazon", - "version": "2.0.3", - "version_normalized": "2.0.3.0", + "name": "zendframework/zendxml", + "version": "1.0.0", + "version_normalized": "1.0.0.0", "source": { "type": "git", - "url": "https://github.com/zendframework/ZendService_Amazon.git", - "reference": "f3d44e3488908323c34bf040c045ee71e1196796" + "url": "https://github.com/zendframework/ZendXml.git", + "reference": "559b34f426d33a11c3db118e00ce14bb8dc64e5f" }, "dist": { "type": "zip", - "url": "https://packages.zendframework.com/composer/zendframework-zendservice-amazon-f3d44e3488908323c34bf040c045ee71e1196796-zip-31bbc0.zip", - "reference": "2.0.3", - "shasum": "b7f77cced220f6738248fc827952ab2c6604a08f" + "url": "https://packages.zendframework.com/composer/zendframework-zendxml-559b34f426d33a11c3db118e00ce14bb8dc64e5f-zip-6cf7a2.zip", + "reference": "1.0.0", + "shasum": "39abc614b5c26bcbf8102e203c52dee73c4460a8" }, "require": { - "php": ">=5.3.3", - "zendframework/zend-crypt": "~2.0", - "zendframework/zend-http": "~2.0", - "zendframework/zend-json": "~2.0", - "zendframework/zendrest": "~2.0", - "zendframework/zendxml": "~1.0-dev" + "php": ">=5.3.3" }, "require-dev": { - "zendframework/zend-i18n": "~2.0" - }, - "suggest": { - "zendframework/zend-uri": "Zend\\Uri component" + "fabpot/php-cs-fixer": "*@dev", + "phpunit/phpunit": "~3.7" }, - "time": "2014-03-05 22:37:42", + "time": "2014-03-05 22:25:44", "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "1.0-dev" } }, "installation-source": "dist", "autoload": { "psr-0": { - "ZendService\\Amazon\\": "library/" + "ZendXml": "library/" } }, "license": [ "BSD-3-Clause" ], - "description": "OOP wrapper for the Amazon web service", + "description": "Utility library for XML usage, best practices, and security in PHP", "homepage": "http://packages.zendframework.com/", "keywords": [ - "amazon", - "ec2", - "s3", - "simpledb", - "sqs", + "security", + "xml", "zf2" ], "support": { - "source": "https://github.com/zendframework/ZendService_Amazon/tree/master", - "issues": "https://github.com/zendframework/ZendService_Amazon/issues" + "source": "https://github.com/zendframework/ZendXml/tree/master", + "issues": "https://github.com/zendframework/ZendXml/issues" } }, { @@ -545,301 +689,154 @@ } }, { - "name": "zendframework/zendservice-recaptcha", - "version": "2.0.1", - "version_normalized": "2.0.1.0", + "name": "zendframework/zendrest", + "version": "2.0.2", + "version_normalized": "2.0.2.0", "source": { "type": "git", - "url": "https://github.com/zendframework/ZendService_ReCaptcha.git", - "reference": "4324cca8502d9f47b3b43a18acdd3fdbeb965536" + "url": "https://github.com/zendframework/ZendRest.git", + "reference": "7427d242b4546e5aef1206d2c97e402109d8843e" }, "dist": { "type": "zip", - "url": "https://packages.zendframework.com/composer/zendframework-zendservice-recaptcha-4324cca8502d9f47b3b43a18acdd3fdbeb965536-zip-8c45bf.zip", - "reference": "2.0.1", - "shasum": "fab92465cda889ff975c1ec79bb378d7e3f39081" + "url": "https://packages.zendframework.com/composer/zendframework-zendrest-7427d242b4546e5aef1206d2c97e402109d8843e-zip-da96cc.zip", + "reference": "2.0.2", + "shasum": "cd304d9e2fccccbd98348bfbead7d42b102e565a" }, "require": { "php": ">=5.3.3", - "zendframework/zend-http": ">=2.0.0", - "zendframework/zend-uri": ">=2.0.0", - "zendframework/zend-version": ">=2.0.0" + "zendframework/zend-http": "~2.0", + "zendframework/zend-uri": "~2.0", + "zendframework/zendxml": "~1.0-dev" }, - "time": "2012-09-24 15:18:29", + "time": "2014-03-05 22:32:09", "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, "installation-source": "dist", "autoload": { "psr-0": { - "ZendService": "library/" + "ZendRest": "library/" } }, "license": [ "BSD-3-Clause" ], - "description": "OOP wrapper for the ReCaptcha web service", + "description": " ", "homepage": "http://packages.zendframework.com/", "keywords": [ - "recaptcha", + "rest", "zf2" ], "support": { - "source": "https://github.com/zendframework/ZendService_ReCaptcha/tree/release-2.0.1", - "issues": "https://github.com/zendframework/ZendService_ReCaptcha/issues" + "source": "https://github.com/zendframework/ZendRest/tree/release-2.0.2", + "issues": "https://github.com/zendframework/ZendRest/issues" } }, { - "name": "pear-pear.php.net/XML_Util", - "version": "1.2.3", - "version_normalized": "1.2.3.0", - "dist": { - "type": "file", - "url": "http://pear.php.net/get/XML_Util-1.2.3.tgz", - "reference": null, - "shasum": null - }, - "require": { - "ext-pcre": "*", - "php": ">=4.3.0.0" - }, - "replace": { - "pear-pear/xml_util": "== 1.2.3.0" - }, - "type": "pear-library", - "installation-source": "dist", - "autoload": { - "classmap": [ - "" - ] - }, - "include-path": [ - "/" - ], - "description": "Selection of methods that are often needed when working with XML documents. Functionality includes creating of attribute lists from arrays, creation of tags, validation of XML names and more." - }, - { - "name": "jasig/phpcas", - "version": "dev-master", - "version_normalized": "9999999-dev", + "name": "zendframework/zendservice-amazon", + "version": "2.0.3", + "version_normalized": "2.0.3.0", "source": { "type": "git", - "url": "https://github.com/Jasig/phpCAS.git", - "reference": "83168b398e10defc384b740e104950a3fef83e51" + "url": "https://github.com/zendframework/ZendService_Amazon.git", + "reference": "f3d44e3488908323c34bf040c045ee71e1196796" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Jasig/phpCAS/zipball/83168b398e10defc384b740e104950a3fef83e51", - "reference": "83168b398e10defc384b740e104950a3fef83e51", - "shasum": "" + "url": "https://packages.zendframework.com/composer/zendframework-zendservice-amazon-f3d44e3488908323c34bf040c045ee71e1196796-zip-31bbc0.zip", + "reference": "2.0.3", + "shasum": "b7f77cced220f6738248fc827952ab2c6604a08f" }, "require": { - "php": ">=5.0.0" + "php": ">=5.3.3", + "zendframework/zend-crypt": "~2.0", + "zendframework/zend-http": "~2.0", + "zendframework/zend-json": "~2.0", + "zendframework/zendrest": "~2.0", + "zendframework/zendxml": "~1.0-dev" }, "require-dev": { - "phpunit/phpunit": "~3.7.10" + "zendframework/zend-i18n": "~2.0" }, - "time": "2014-07-02 15:38:35", - "type": "library", - "installation-source": "source", - "autoload": { - "classmap": [ - "source/" - ] + "suggest": { + "zendframework/zend-uri": "Zend\\Uri component" }, - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Joachim Fritschi", - "homepage": "https://wiki.jasig.org/display/~fritschi" - }, - { - "name": "Adam Franco", - "homepage": "https://wiki.jasig.org/display/~adamfranco" + "time": "2014-03-05 22:37:42", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" } - ], - "description": "Provides a simple API for authenticating users against a CAS server", - "homepage": "https://wiki.jasig.org/display/CASC/phpCAS", - "keywords": [ - "cas", - "jasig" - ], - "support": { - "source": "https://github.com/Jasig/phpCAS/tree/master", - "issues": "https://github.com/Jasig/phpCAS/issues" - } - }, - { - "name": "oyejorge/less.php", - "version": "v1.7.0.2", - "version_normalized": "1.7.0.2", - "source": { - "type": "git", - "url": "https://github.com/oyejorge/less.php.git", - "reference": "82372b389386ae1edab55495eae4b400cca3c86c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/oyejorge/less.php/zipball/82372b389386ae1edab55495eae4b400cca3c86c", - "reference": "82372b389386ae1edab55495eae4b400cca3c86c", - "shasum": "" }, - "require": { - "php": ">=5.2" - }, - "time": "2014-06-05 16:09:50", - "bin": [ - "bin/lessc" - ], - "type": "library", "installation-source": "dist", "autoload": { "psr-0": { - "Less": "lib/" - }, - "classmap": [ - "lessc.inc.php" - ] + "ZendService\\Amazon\\": "library/" + } }, - "notification-url": "https://packagist.org/downloads/", "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Matt Agar", - "homepage": "https://github.com/agar" - }, - { - "name": "Martin JantoÅ¡oviÄ", - "homepage": "https://github.com/Mordred" - }, - { - "name": "Josh Schmidt", - "homepage": "https://github.com/oyejorge" - } + "BSD-3-Clause" ], - "description": "PHP port of the Javascript version of LESS http://lesscss.org", - "homepage": "http://lessphp.gpeasy.com", + "description": "OOP wrapper for the Amazon web service", + "homepage": "http://packages.zendframework.com/", "keywords": [ - "css", - "less", - "less.js", - "lesscss", - "php", - "stylesheet" - ] - }, - { - "name": "mobileesp/mdetect", - "version": "dev-master", - "version_normalized": "9999999-dev", - "dist": { - "type": "file", - "url": "http://mobileesp.googlecode.com/svn/PHP/mdetect.php", - "reference": null, - "shasum": null - }, - "type": "library", - "installation-source": "dist", - "autoload": { - "classmap": [ - "/" - ] - } - }, - { - "name": "pear-pear.php.net/PEAR", - "version": "1.9.5", - "version_normalized": "1.9.5.0", - "dist": { - "type": "file", - "url": "http://pear.php.net/get/PEAR-1.9.5.tgz", - "reference": null, - "shasum": null - }, - "require": { - "ext-pcre": "*", - "ext-xml": "*", - "pear-pear.php.net/archive_tar": ">=1.3.11.0", - "pear-pear.php.net/console_getopt": ">=1.2.0.0", - "pear-pear.php.net/structures_graph": ">=1.0.2.0", - "pear-pear.php.net/xml_util": ">=1.2.0.0", - "php": ">=4.4.0.0,!=5.0.0.0,!=5.1.0.0,!=5.1.1.0,!=5.1.2.0,!=5.1.3.0,!=5.1.4.0,!=5.1.5.0" - }, - "conflict": { - "pear-pear.php.net/pear_frontend_gtk": "<0.4.0.0", - "pear-pear.php.net/pear_frontend_web": "<=0.4.0.0" - }, - "replace": { - "pear-pear/pear": "== 1.9.5.0" - }, - "type": "pear-library", - "installation-source": "dist", - "autoload": { - "classmap": [ - "" - ] - }, - "include-path": [ - "/" + "amazon", + "ec2", + "s3", + "simpledb", + "sqs", + "zf2" ], - "description": "The PEAR package contains:\n * the PEAR installer, for creating, distributing\n and installing packages\n * the PEAR_Exception PHP5 error handling mechanism\n * the PEAR_ErrorStack advanced error handling mechanism\n * the PEAR_Error error handling mechanism\n * the OS_Guess class for retrieving info about the OS\n where PHP is running on\n * the System class for quick handling of common operations\n with files and directories\n * the PEAR base class\n Features in a nutshell:\n * full support for channels\n * pre-download dependency validation\n * new package.xml 2.0 format allows tremendous flexibility while maintaining BC\n * support for optional dependency groups and limited support for sub-packaging\n * robust dependency support\n * full dependency validation on uninstall\n * remote install for hosts with only ftp access - no more problems with\n restricted host installation\n * full support for mirroring\n * support for bundling several packages into a single tarball\n * support for static dependencies on a url-based package\n * support for custom file roles and installation tasks" + "support": { + "source": "https://github.com/zendframework/ZendService_Amazon/tree/master", + "issues": "https://github.com/zendframework/ZendService_Amazon/issues" + } }, { - "name": "symfony/yaml", - "version": "v2.5.2", - "version_normalized": "2.5.2.0", - "target-dir": "Symfony/Component/Yaml", + "name": "zendframework/zendservice-recaptcha", + "version": "2.0.1", + "version_normalized": "2.0.1.0", "source": { "type": "git", - "url": "https://github.com/symfony/Yaml.git", - "reference": "f868ecdbcc0276b6158dfbf08b9e98ce07f014e1" + "url": "https://github.com/zendframework/ZendService_ReCaptcha.git", + "reference": "4324cca8502d9f47b3b43a18acdd3fdbeb965536" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/f868ecdbcc0276b6158dfbf08b9e98ce07f014e1", - "reference": "f868ecdbcc0276b6158dfbf08b9e98ce07f014e1", - "shasum": "" + "url": "https://packages.zendframework.com/composer/zendframework-zendservice-recaptcha-4324cca8502d9f47b3b43a18acdd3fdbeb965536-zip-8c45bf.zip", + "reference": "2.0.1", + "shasum": "fab92465cda889ff975c1ec79bb378d7e3f39081" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.3", + "zendframework/zend-http": ">=2.0.0", + "zendframework/zend-uri": ">=2.0.0", + "zendframework/zend-version": ">=2.0.0" }, - "time": "2014-07-09 09:05:48", + "time": "2012-09-24 15:18:29", "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5-dev" + "dev-master": "2.0.x-dev" } }, "installation-source": "dist", "autoload": { "psr-0": { - "Symfony\\Component\\Yaml\\": "" + "ZendService": "library/" } }, - "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" - }, - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - } + "description": "OOP wrapper for the ReCaptcha web service", + "homepage": "http://packages.zendframework.com/", + "keywords": [ + "recaptcha", + "zf2" ], - "description": "Symfony Yaml Component", - "homepage": "http://symfony.com" + "support": { + "source": "https://github.com/zendframework/ZendService_ReCaptcha/tree/release-2.0.1", + "issues": "https://github.com/zendframework/ZendService_ReCaptcha/issues" + } } ] diff --git a/vendor/jasig/phpcas/composer.json b/vendor/jasig/phpcas/composer.json index 4231168110a..38dddbe7cad 100644 --- a/vendor/jasig/phpcas/composer.json +++ b/vendor/jasig/phpcas/composer.json @@ -19,6 +19,10 @@ "classmap": [ "source/" ] + }, + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } } - } diff --git a/vendor/jasig/phpcas/docs/index.html b/vendor/jasig/phpcas/docs/index.html index f478f521899..ac14622f60e 100644 --- a/vendor/jasig/phpcas/docs/index.html +++ b/vendor/jasig/phpcas/docs/index.html @@ -10,7 +10,7 @@ <p>phpCAS documentation is hosted at <a href="https://wiki.jasig.org/display/CASC/phpCAS">https://wiki.jasig.org/display/CASC/phpCAS</a>.</p> <ul> <li><a href="examples">examples</a></li> - <li><a href="http://downloads.jasig.org/cas-clients/php/1.3.2/docs/api/">source documentation</a></li> + <li><a href="http://downloads.jasig.org/cas-clients/php/1.3.3/docs/api/">source documentation</a></li> </ul> <p><img src="images/esup-portail.png" width="182" height="68"/> <img src="images/jasig.png" width="169" height="87"/></p> <p> </p> diff --git a/vendor/jasig/phpcas/source/CAS.php b/vendor/jasig/phpcas/source/CAS.php index 5e489a110f8..a80023199cf 100644 --- a/vendor/jasig/phpcas/source/CAS.php +++ b/vendor/jasig/phpcas/source/CAS.php @@ -63,7 +63,7 @@ if (!defined('E_USER_DEPRECATED')) { /** * phpCAS version. accessible for the user by phpCAS::getVersion(). */ -define('PHPCAS_VERSION', '1.3.2+'); +define('PHPCAS_VERSION', '1.3.3'); /** * @addtogroup public @@ -78,6 +78,10 @@ define("CAS_VERSION_1_0", '1.0'); * CAS version 2.0 */ define("CAS_VERSION_2_0", '2.0'); +/** + * CAS version 3.0 + */ +define("CAS_VERSION_3_0", '3.0'); // ------------------------------------------------------------------------ // SAML defines @@ -1631,8 +1635,9 @@ class phpCAS phpCAS :: traceBegin(); phpCAS::_validateClientExists(); - if (self::$_PHPCAS_CLIENT->getServerVersion() !== CAS_VERSION_2_0) { - phpCAS :: error('this method can only be used with the cas 2.0 protool'); + if (self::$_PHPCAS_CLIENT->getServerVersion() !== CAS_VERSION_2_0 + && self::$_PHPCAS_CLIENT->getServerVersion() !== CAS_VERSION_3_0) { + phpCAS :: error('this method can only be used with the cas 2.0/3.0 protocols'); } self::$_PHPCAS_CLIENT->getAllowedProxyChains()->allowProxyChain($proxy_chain); phpCAS :: traceEnd(); diff --git a/vendor/jasig/phpcas/source/CAS/AuthenticationException.php b/vendor/jasig/phpcas/source/CAS/AuthenticationException.php index 801156e881c..a14154d4a35 100644 --- a/vendor/jasig/phpcas/source/CAS/AuthenticationException.php +++ b/vendor/jasig/phpcas/source/CAS/AuthenticationException.php @@ -74,7 +74,7 @@ implements CAS_Exception printf( $lang->getYouWereNotAuthenticated(), htmlentities($client->getURL()), - $_SERVER['SERVER_ADMIN'] + isset($_SERVER['SERVER_ADMIN']) ? $_SERVER['SERVER_ADMIN']:'' ); phpCAS::trace('CAS URL: '.$cas_url); phpCAS::trace('Authentication failure: '.$failure); @@ -89,6 +89,7 @@ implements CAS_Exception phpCAS::trace('Reason: CAS error'); break; case CAS_VERSION_2_0: + case CAS_VERSION_3_0: if ( empty($err_code) ) { phpCAS::trace('Reason: no CAS error'); } else { diff --git a/vendor/jasig/phpcas/source/CAS/Client.php b/vendor/jasig/phpcas/source/CAS/Client.php index 1523b7b7342..bfa993773c5 100755 --- a/vendor/jasig/phpcas/source/CAS/Client.php +++ b/vendor/jasig/phpcas/source/CAS/Client.php @@ -442,6 +442,10 @@ class CAS_Client $this->_server['service_validate_url'] = $this->_getServerBaseURL() .'serviceValidate'; break; + case CAS_VERSION_3_0: + $this->_server['service_validate_url'] = $this->_getServerBaseURL() + .'p3/serviceValidate'; + break; } } $url = $this->_buildQueryUrl( @@ -493,6 +497,9 @@ class CAS_Client case CAS_VERSION_2_0: $this->_server['proxy_validate_url'] = $this->_getServerBaseURL().'proxyValidate'; break; + case CAS_VERSION_3_0: + $this->_server['proxy_validate_url'] = $this->_getServerBaseURL().'p3/proxyValidate'; + break; } } $url = $this->_buildQueryUrl( @@ -518,6 +525,7 @@ class CAS_Client $this->_server['proxy_url'] = ''; break; case CAS_VERSION_2_0: + case CAS_VERSION_3_0: $this->_server['proxy_url'] = $this->_getServerBaseURL().'proxy'; break; } @@ -755,7 +763,7 @@ class CAS_Client * * @return void */ - private function ensureAuthenticationCalled() + private function _ensureAuthenticationCalled() { if (!$this->wasAuthenticationCalled()) { throw new CAS_OutOfSequenceBeforeAuthenticationCallException(); @@ -772,7 +780,7 @@ class CAS_Client */ public function wasAuthenticationCallSuccessful () { - $this->ensureAuthenticationCalled(); + $this->_ensureAuthenticationCalled(); return $this->_authentication_caller['result']; } @@ -787,7 +795,7 @@ class CAS_Client */ public function ensureAuthenticationCallSuccessful() { - $this->ensureAuthenticationCalled(); + $this->_ensureAuthenticationCalled(); if (!$this->_authentication_caller['result']) { throw new CAS_OutOfSequenceException( 'authentication was checked (by ' @@ -809,7 +817,7 @@ class CAS_Client */ public function getAuthenticationCallerFile () { - $this->ensureAuthenticationCalled(); + $this->_ensureAuthenticationCalled(); return $this->_authentication_caller['file']; } @@ -823,7 +831,7 @@ class CAS_Client */ public function getAuthenticationCallerLine () { - $this->ensureAuthenticationCalled(); + $this->_ensureAuthenticationCalled(); return $this->_authentication_caller['line']; } @@ -837,7 +845,7 @@ class CAS_Client */ public function getAuthenticationCallerMethod () { - $this->ensureAuthenticationCalled(); + $this->_ensureAuthenticationCalled(); return $this->_authentication_caller['method']; } @@ -881,7 +889,7 @@ class CAS_Client if (gettype($server_hostname) != 'string') throw new CAS_TypeMismatchException($server_hostname, '$server_hostname', 'string'); if (gettype($server_port) != 'integer') - throw new CAS_TypeMismatchException($server_port, '$server_port', 'integer'); + throw new CAS_raTypeMismatchException($server_port, '$server_port', 'integer'); if (gettype($server_uri) != 'string') throw new CAS_TypeMismatchException($server_uri, '$server_uri', 'string'); if (gettype($changeSessionID) != 'boolean') @@ -924,6 +932,7 @@ class CAS_Client } break; case CAS_VERSION_2_0: + case CAS_VERSION_3_0: break; case SAML_VERSION_1_1: break; @@ -1390,15 +1399,16 @@ class CAS_Client $logoutTicket = $this->getTicket(); break; case CAS_VERSION_2_0: + case CAS_VERSION_3_0: // if a Proxy Ticket was given, validate it phpCAS::trace( - 'CAS 2.0 ticket `'.$this->getTicket().'\' is present' + 'CAS '.$this->getServerVersion().' ticket `'.$this->getTicket().'\' is present' ); $this->validateCAS20( $validate_url, $text_response, $tree_response ); // note: if it fails, it halts phpCAS::trace( - 'CAS 2.0 ticket `'.$this->getTicket().'\' was validated' + 'CAS '.$this->getServerVersion().' ticket `'.$this->getTicket().'\' was validated' ); if ( $this->isProxy() ) { $this->_validatePGT( @@ -1639,7 +1649,6 @@ class CAS_Client $cas_url = $cas_url . $paramSeparator . "service=" . urlencode($params['service']); } - session_write_close(); header('Location: '.$cas_url); phpCAS::trace("Prepare redirect to : ".$cas_url); @@ -3513,7 +3522,7 @@ class CAS_Client } if ( isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) - && $_SERVER['HTTPS'] == 'on' + && $_SERVER['HTTPS'] != 'off' ) { return true; } else { @@ -3641,6 +3650,7 @@ class CAS_Client phpCAS::trace('Reason: CAS error'); break; case CAS_VERSION_2_0: + case CAS_VERSION_3_0: if ( empty($err_code) ) { phpCAS::trace('Reason: no CAS error'); } else { diff --git a/vendor/jasig/phpcas/source/CAS/TypeMismatchException.php b/vendor/jasig/phpcas/source/CAS/TypeMismatchException.php index f6f3d6bf1a1..4a13c2df45f 100644 --- a/vendor/jasig/phpcas/source/CAS/TypeMismatchException.php +++ b/vendor/jasig/phpcas/source/CAS/TypeMismatchException.php @@ -57,7 +57,7 @@ extends CAS_InvalidArgumentException if (is_object($argument)) { $foundType = get_class($argument).' object'; } else { - $foundType = gettype($lang); + $foundType = gettype($argument); } parent::__construct( @@ -67,4 +67,4 @@ extends CAS_InvalidArgumentException ); } } -?> \ No newline at end of file +?> diff --git a/vendor/pear-pear.php.net/Archive_Tar/Archive/Tar.php b/vendor/pear-pear.php.net/Archive_Tar/Archive/Tar.php index 9249a068645..5aa82013ed2 100644 --- a/vendor/pear-pear.php.net/Archive_Tar/Archive/Tar.php +++ b/vendor/pear-pear.php.net/Archive_Tar/Archive/Tar.php @@ -44,75 +44,98 @@ require_once 'PEAR.php'; define('ARCHIVE_TAR_ATT_SEPARATOR', 90001); define('ARCHIVE_TAR_END_BLOCK', pack("a512", '')); +if (!function_exists('gzopen') && function_exists('gzopen64')) { + function gzopen($filename, $mode, $use_include_path = 0) + { + return gzopen64($filename, $mode, $use_include_path); + } +} + +if (!function_exists('gztell') && function_exists('gztell64')) { + function gztell($zp) + { + return gztell64($zp); + } +} + +if (!function_exists('gzseek') && function_exists('gzseek64')) { + function gzseek($zp, $offset, $whence = SEEK_SET) + { + return gzseek64($zp, $offset, $whence); + } +} + /** -* 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$ -*/ + * 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$ + */ class Archive_Tar extends PEAR { /** - * @var string Name of the Tar - */ - var $_tarname=''; + * @var string Name of the Tar + */ + var $_tarname = ''; /** - * @var boolean if true, the Tar file will be gzipped - */ - var $_compress=false; + * @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 Type of compression : 'none', 'gz', 'bz2' or 'lzma2' + */ + var $_compress_type = 'none'; /** - * @var string Explode separator - */ - var $_separator=' '; + * @var string Explode separator + */ + var $_separator = ' '; /** - * @var file descriptor - */ - var $_file=0; + * @var file descriptor + */ + var $_file = 0; /** - * @var string Local Tar name of a remote Tar (http:// or ftp://) - */ - var $_temp_tarname=''; + * @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 string regular expression for ignoring files or directories + */ + var $_ignore_regexp = ''; /** * @var object PEAR_Error object */ - var $error_object=null; + 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 - */ + * 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', 'bz2' or 'lzma2'. This + * parameter indicates if gzip, bz2 or lzma2 compression + * is required. For compatibility reason the + * boolean value 'true' means 'gz'. + * + * @access public + */ function Archive_Tar($p_tarname, $p_compress = null) { - $this->PEAR(); + if (version_compare(PHP_VERSION, '5.0.0', '<')) { + $this->PEAR(); + } $this->_compress = false; $this->_compress_type = 'none'; if (($p_compress === null) || ($p_compress == '')) { @@ -128,6 +151,9 @@ class Archive_Tar extends PEAR } elseif ($data == "BZ") { $this->_compress = true; $this->_compress_type = 'bz2'; + } elseif (file_get_contents($p_tarname, false, null, 1, 4) == '7zXZ') { + $this->_compress = true; + $this->_compress_type = 'lzma2'; } } } else { @@ -137,42 +163,67 @@ class Archive_Tar extends PEAR $this->_compress = true; $this->_compress_type = 'gz'; } elseif ((substr($p_tarname, -3) == 'bz2') || - (substr($p_tarname, -2) == 'bz')) { + (substr($p_tarname, -2) == 'bz') + ) { $this->_compress = true; $this->_compress_type = 'bz2'; + } else { + if (substr($p_tarname, -2) == 'xz') { + $this->_compress = true; + $this->_compress_type = 'lzma2'; + } } } } 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; + if ($p_compress == 'bz2') { + $this->_compress = true; + $this->_compress_type = 'bz2'; + } else { + if ($p_compress == 'lzma2') { + $this->_compress = true; + $this->_compress_type = 'lzma2'; + } else { + $this->_error( + "Unsupported compression type '$p_compress'\n" . + "Supported types are 'gz', 'bz2' and 'lzma2'.\n" + ); + return false; + } + } } } $this->_tarname = $p_tarname; - if ($this->_compress) { // assert zlib or bz2 extension support - if ($this->_compress_type == 'gz') + if ($this->_compress) { // assert zlib or bz2 or xz extension support + if ($this->_compress_type == 'gz') { $extname = 'zlib'; - else if ($this->_compress_type == 'bz2') - $extname = 'bz2'; + } else { + if ($this->_compress_type == 'bz2') { + $extname = 'bz2'; + } else { + if ($this->_compress_type == 'lzma2') { + $extname = 'xz'; + } + } + } 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"); + $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 @@ -180,69 +231,82 @@ class Archive_Tar extends PEAR { $this->_close(); // ----- Look for a local copy to delete - if ($this->_temp_tarname != '') + if ($this->_temp_tarname != '') { @unlink($this->_temp_tarname); + } $this->_PEAR(); } + + // }}} + + // {{{ PHP5-compatible destructor + function __destruct() + { + $this->_Archive_Tar(); + } + // }}} // {{{ 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 - */ + * 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 - */ + * 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) + function extract($p_path = '', $p_preserve = false) { return $this->extractModify($p_path, '', $p_preserve); } + // }}} // {{{ listContent() @@ -260,58 +324,60 @@ class Archive_Tar extends PEAR 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='') + * 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()) + if (!$this->_openWrite()) { return false; + } if ($p_filelist != '') { - if (is_array($p_filelist)) + if (is_array($p_filelist)) { $v_list = $p_filelist; - elseif (is_string($p_filelist)) + } elseif (is_string($p_filelist)) { $v_list = explode($this->_separator, $p_filelist); - else { + } else { $this->_cleanFile(); $this->_error('Invalid file list'); return false; @@ -323,68 +389,73 @@ class Archive_Tar extends PEAR if ($v_result) { $this->_writeFooter(); $this->_close(); - } else + } 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='') + * 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)) + 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)) + } elseif (is_string($p_filelist)) { $v_list = explode($this->_separator, $p_filelist); - else { + } else { $this->_error('Invalid file list'); return false; } @@ -394,27 +465,45 @@ class Archive_Tar extends PEAR 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. - * @param int $p_datetime A custom date/time (unix timestamp) - * for the file (optional). - * - * @return true on success, false on error. - * @access public - */ - function addString($p_filename, $p_string, $p_datetime = false) + * 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. + * @param int $p_datetime A custom date/time (unix timestamp) + * for the file (optional). + * @param array $p_params An array of optional params: + * stamp => the datetime (replaces + * datetime above if it exists) + * mode => the permissions on the + * file (600 by default) + * type => is this a link? See the + * tar specification for details. + * (default = regular file) + * uid => the user ID of the file + * (default = 0 = root) + * gid => the group ID of the file + * (default = 0 = root) + * + * @return true on success, false on error. + * @access public + */ + function addString($p_filename, $p_string, $p_datetime = false, $p_params = array()) { + $p_stamp = @$p_params["stamp"] ? $p_params["stamp"] : ($p_datetime ? $p_datetime : time()); + $p_mode = @$p_params["mode"] ? $p_params["mode"] : 0600; + $p_type = @$p_params["type"] ? $p_params["type"] : ""; + $p_uid = @$p_params["uid"] ? $p_params["uid"] : ""; + $p_gid = @$p_params["gid"] ? $p_params["gid"] : ""; $v_result = true; if (!$this->_isArchive()) { @@ -424,11 +513,12 @@ class Archive_Tar extends PEAR $this->_close(); } - if (!$this->_openAppend()) + if (!$this->_openAppend()) { return false; + } // Need to check the get back to the temporary file ? .... - $v_result = $this->_addString($p_filename, $p_string, $p_datetime); + $v_result = $this->_addString($p_filename, $p_string, $p_datetime, $p_params); $this->_writeFooter(); @@ -436,69 +526,77 @@ class Archive_Tar extends PEAR 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) + * 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); + $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 - */ + * 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()) { @@ -510,65 +608,73 @@ class Archive_Tar extends PEAR 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) + * 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)) + if (is_array($p_filelist)) { $v_list = $p_filelist; - elseif (is_string($p_filelist)) + } elseif (is_string($p_filelist)) { $v_list = explode($this->_separator, $p_filelist); - else { + } 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); + $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 - */ + * 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; @@ -579,30 +685,32 @@ class Archive_Tar extends PEAR } // ----- Get the arguments - $v_att_list = &func_get_args(); + $v_att_list = & func_get_args(); // ----- Read the attributes - $i=0; - while ($i<$v_size) { + $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'); + 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]; + $this->_separator = $v_att_list[$i + 1]; $i++; - break; + break; default : - $this->_error('Unknow attribute code '.$v_att_list[$i].''); + $this->_error('Unknow attribute code ' . $v_att_list[$i] . ''); return false; } @@ -612,58 +720,63 @@ class Archive_Tar extends PEAR 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 - */ + * 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; + $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 - */ + * 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); + $regexp = str_replace(array('#', '.', '^', '$'), array('\#', '\.', '\^', '\$'), $list); + $regexp = '#/' . join('$|/', $list) . '#'; + $this->setIgnoreRegexp($regexp); } + // }}} // {{{ _error() function _error($p_message) { - $this->error_object = &$this->raiseError($p_message); + $this->error_object = & $this->raiseError($p_message); } + // }}} // {{{ _warning() function _warning($p_message) { - $this->error_object = &$this->raiseError($p_message); + $this->error_object = & $this->raiseError($p_message); } + // }}} // {{{ _isArchive() - function _isArchive($p_filename=null) + function _isArchive($p_filename = null) { if ($p_filename == null) { $p_filename = $this->_tarname; @@ -671,31 +784,45 @@ class Archive_Tar extends PEAR clearstatcache(); return @is_file($p_filename) && !@is_link($p_filename); } + // }}} // {{{ _openWrite() function _openWrite() { - if ($this->_compress_type == 'gz' && function_exists('gzopen')) + 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.')'); - return false; + } else { + if ($this->_compress_type == 'bz2' && function_exists('bzopen')) { + $this->_file = @bzopen($this->_tarname, "w"); + } else { + if ($this->_compress_type == 'lzma2' && function_exists('xzopen')) { + $this->_file = @xzopen($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 . ')' + ); + return false; + } + } + } } if ($this->_file == 0) { - $this->_error('Unable to open in write mode \'' - .$this->_tarname.'\''); + $this->_error( + 'Unable to open in write mode \'' + . $this->_tarname . '\'' + ); return false; } return true; } + // }}} // {{{ _openRead() @@ -703,80 +830,116 @@ class Archive_Tar extends PEAR { 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); - } + // ----- 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; + // ----- 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; + } else // ----- File to open if the normal Tar file + { + $v_filename = $this->_tarname; + } - if ($this->_compress_type == 'gz' && function_exists('gzopen')) + if ($this->_compress_type == 'gz' && function_exists('gzopen')) { $this->_file = @gzopen($v_filename, "rb"); - else if ($this->_compress_type == 'bz2' && function_exists('bzopen')) - $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.')'); - return false; + } else { + if ($this->_compress_type == 'bz2' && function_exists('bzopen')) { + $this->_file = @bzopen($v_filename, "r"); + } else { + if ($this->_compress_type == 'lzma2' && function_exists('xzopen')) { + $this->_file = @xzopen($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 . ')' + ); + return false; + } + } + } } if ($this->_file == 0) { - $this->_error('Unable to open in read mode \''.$v_filename.'\''); + $this->_error('Unable to open in read mode \'' . $v_filename . '\''); return false; } return true; } + // }}} // {{{ _openReadWrite() function _openReadWrite() { - if ($this->_compress_type == 'gz') + 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.')'); - return false; + } 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 == 'lzma2') { + $this->_error( + 'Unable to open lzma2 in read/write mode \'' + . $this->_tarname . '\' (limitation of lzma2 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 . ')' + ); + return false; + } + } + } } if ($this->_file == 0) { - $this->_error('Unable to open in read/write mode \'' - .$this->_tarname.'\''); + $this->_error( + 'Unable to open in read/write mode \'' + . $this->_tarname . '\'' + ); return false; } return true; } + // }}} // {{{ _close() @@ -784,15 +947,26 @@ class Archive_Tar extends PEAR { //if (isset($this->_file)) { if (is_resource($this->_file)) { - if ($this->_compress_type == 'gz') + 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.')'); + } else { + if ($this->_compress_type == 'bz2') { + @bzclose($this->_file); + } else { + if ($this->_compress_type == 'lzma2') { + @xzclose($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; } @@ -806,6 +980,7 @@ class Archive_Tar extends PEAR return true; } + // }}} // {{{ _cleanFile() @@ -826,276 +1001,367 @@ class Archive_Tar extends PEAR return true; } + // }}} // {{{ _writeBlock() - function _writeBlock($p_binary_data, $p_len=null) + 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; + 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 == 'lzma2') { + @xzwrite($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 == 'lzma2') { + @xzwrite($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; + $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 == 'lzma2') { + $v_block = @xzread($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) + 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; + 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 == 'lzma2') { + // ----- Replace missing xztell() and xzseek() + 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; + 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; - } + $v_result = true; + $v_header = array(); - if (sizeof($p_list) == 0) - return true; + // ----- Remove potential windows directory separator + $p_add_dir = $this->_translateWinPath($p_add_dir); + $p_remove_dir = $this->_translateWinPath($p_remove_dir, false); - foreach ($p_list as $v_filename) { - if (!$v_result) { - break; - } + if (!$this->_file) { + $this->_error('Invalid file descriptor'); + return false; + } - // ----- Skip the current tar name - if ($v_filename == $this->_tarname) - continue; + if (sizeof($p_list) == 0) { + return true; + } - if ($v_filename == '') - continue; + foreach ($p_list as $v_filename) { + if (!$v_result) { + break; + } - // ----- 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; - } + // ----- Skip the current tar name + if ($v_filename == $this->_tarname) { + continue; + } - if (!file_exists($v_filename) && !is_link($v_filename)) { - $this->_warning("File '$v_filename' does not exist"); - continue; - } + if ($v_filename == '') { + continue; + } - // ----- Add the file or directory header - if (!$this->_addFile($v_filename, $v_header, $p_add_dir, $p_remove_dir)) - return false; + // ----- 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 (@is_dir($v_filename) && !@is_link($v_filename)) { - if (!($p_hdir = opendir($v_filename))) { - $this->_warning("Directory '$v_filename' can not be read"); + if (!file_exists($v_filename) && !is_link($v_filename)) { + $this->_warning("File '$v_filename' does not exist"); 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); - } + + // ----- Add the file or directory header + if (!$this->_addFile($v_filename, $v_header, $p_add_dir, $p_remove_dir)) { + return false; } - unset($p_temp_list); - unset($p_hdir); - unset($p_hitem); + 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; + return $v_result; } + // }}} // {{{ _addFile() - function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir) + 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; - } - - // ----- 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; + if (!$this->_file) { + $this->_error('Invalid file descriptor'); + return false; + } + + if ($p_filename == '') { + $this->_error('Invalid file name'); + return false; + } + + 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, $p_datetime = false) + function _addString($p_filename, $p_string, $p_datetime = false, $p_params = array()) { - 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 datetime is not specified, set current time - if ($p_datetime === false) { - $p_datetime = time(); - } - - if (!$this->_writeHeaderBlock($p_filename, strlen($p_string), - $p_datetime, 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; + $p_stamp = @$p_params["stamp"] ? $p_params["stamp"] : ($p_datetime ? $p_datetime : time()); + $p_mode = @$p_params["mode"] ? $p_params["mode"] : 0600; + $p_type = @$p_params["type"] ? $p_params["type"] : ""; + $p_uid = @$p_params["uid"] ? $p_params["uid"] : 0; + $p_gid = @$p_params["gid"] ? $p_params["gid"] : 0; + 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 datetime is not specified, set current time + if ($p_datetime === false) { + $p_datetime = time(); + } + + if (!$this->_writeHeaderBlock( + $p_filename, + strlen($p_string), + $p_stamp, + $p_mode, + $p_type, + $p_uid, + $p_gid + ) + ) { + 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 == '') + 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; + if (!$this->_writeLongHeader($v_reduce_filename)) { + return false; + } } $v_info = lstat($p_filename); @@ -1108,34 +1374,31 @@ class Archive_Tar extends PEAR $v_linkname = ''; if (@is_link($p_filename)) { - $v_typeflag = '2'; - $v_linkname = readlink($p_filename); - $v_size = sprintf("%011s", DecOct(0)); + $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)); + $v_typeflag = "5"; + $v_size = sprintf("%011s", DecOct(0)); } else { - $v_typeflag = '0'; - clearstatcache(); - $v_size = sprintf("%011s", DecOct($v_info['size'])); + $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 = ''; + + 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 = ''; @@ -1144,25 +1407,43 @@ class Archive_Tar extends PEAR $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, ''); + $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)); + 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++) + 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)); + 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); @@ -1177,23 +1458,31 @@ class Archive_Tar extends PEAR return true; } + // }}} // {{{ _writeHeaderBlock() - function _writeHeaderBlock($p_filename, $p_size, $p_mtime=0, $p_perms=0, - $p_type='', $p_uid=0, $p_gid=0) - { + 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 (!$this->_writeLongHeader($p_filename)) { + return false; + } } if ($p_type == "5") { - $v_size = sprintf("%011s", DecOct(0)); + $v_size = sprintf("%011s", DecOct(0)); } else { - $v_size = sprintf("%011s", DecOct($p_size)); + $v_size = sprintf("%011s", DecOct($p_size)); } $v_uid = sprintf("%07s", DecOct($p_uid)); @@ -1208,45 +1497,60 @@ class Archive_Tar extends PEAR $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 = ''; + 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, ''); + $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)); + 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++) + 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)); + 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); @@ -1261,6 +1565,7 @@ class Archive_Tar extends PEAR return true; } + // }}} // {{{ _writeLongHeader() @@ -1286,24 +1591,43 @@ class Archive_Tar extends PEAR $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, ''); + $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)); + 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++) + 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)); + 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); @@ -1317,27 +1641,28 @@ class Archive_Tar extends PEAR $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)) != '') { + $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) { + 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)); + $this->_error('Invalid block size : ' . strlen($v_binary_data)); return false; } @@ -1347,23 +1672,26 @@ class Archive_Tar extends PEAR // ----- 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)); + 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++) + 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)); + for ($i = 156; $i < 512; $i++) { + $v_checksum += ord(substr($v_binary_data, $i, 1)); + } - if (version_compare(PHP_VERSION,"5.5.0-dev")<0) { + if (version_compare(PHP_VERSION, "5.5.0-dev") < 0) { $fmt = "a100filename/a8mode/a8uid/a8gid/a12size/a12mtime/" . - "a8checksum/a1typeflag/a100link/a6magic/a2version/" . - "a32uname/a32gname/a8devmajor/a8devminor/a131prefix"; + "a8checksum/a1typeflag/a100link/a6magic/a2version/" . + "a32uname/a32gname/a8devmajor/a8devminor/a131prefix"; } else { $fmt = "Z100filename/Z8mode/Z8uid/Z8gid/Z12size/Z12mtime/" . - "Z8checksum/Z1typeflag/Z100link/Z6magic/Z2version/" . - "Z32uname/Z32gname/Z8devmajor/Z8devminor/Z131prefix"; + "Z8checksum/Z1typeflag/Z100link/Z6magic/Z2version/" . + "Z32uname/Z32gname/Z8devmajor/Z8devminor/Z131prefix"; } $v_data = unpack($fmt, $v_binary_data); @@ -1377,20 +1705,25 @@ class Archive_Tar extends PEAR $v_header['filename'] = ''; // ----- Look for last block (empty block) - if (($v_checksum == 256) && ($v_header['checksum'] == 0)) + 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'); + $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'); + $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'])); @@ -1399,7 +1732,7 @@ class Archive_Tar extends PEAR $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['size'] = 0; } $v_header['link'] = trim($v_data['link']); /* ----- All these fields are removed form the header because @@ -1414,6 +1747,7 @@ class Archive_Tar extends PEAR return true; } + // }}} // {{{ _maliciousFilename() @@ -1435,369 +1769,431 @@ class Archive_Tar extends PEAR } 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 = ''; + $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; + $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'); + $this->_error( + 'Malicious .tar detected, file "' . $v_filename . + '" will not install in desired directory tree' + ); return false; - } + } - return true; + 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 - */ + * 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))); - } + 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" : + 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; - 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(); + $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); - while (strlen($v_binary_data = $this->_readBlock()) != 0) - { - $v_extract_file = FALSE; - $v_extraction_stopped = 0; + // ----- 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); - if (!$this->_readHeader($v_binary_data, $v_header)) - return false; + 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; + } - 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; + 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; } - } - - // ----- 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( $v_header['filename'] == '' ){ - continue; - } - } - 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'].'}'); + // ----- Look for long filename + if ($v_header['typeflag'] == 'L') { + if (!$this->_readLongHeader($v_header)) { 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']); + // ignore extended / pax headers + if ($v_header['typeflag'] == 'x' || $v_header['typeflag'] == 'g') { + $this->_jumpBlock(ceil(($v_header['size'] / 512))); + continue; } - // ----- 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); + 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; } - } - - // ----- 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); - */ + // ----- 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 ($v_header['filename'] == '') { + continue; + } + } + 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_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 = '/'; + 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); + } + } - $p_list_detail[$v_nb++] = $v_header; - if (is_array($p_file_list) && (count($p_list_detail) == count($p_file_list))) { - return true; + // ----- 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 (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\''); + 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 ($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"); + } elseif ($this->_compress_type == 'lzma2') { + $v_temp_tar = @xzopen($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); + $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); + @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) { @@ -1816,10 +2212,9 @@ class Archive_Tar extends PEAR } @gzclose($v_temp_tar); - } - elseif ($this->_compress_type == 'bz2') { + } 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++; @@ -1837,18 +2232,41 @@ class Archive_Tar extends PEAR } @bzclose($v_temp_tar); + } elseif ($this->_compress_type == 'lzma2') { + $end_blocks = 0; + + while (strlen($v_buffer = @xzread($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); + } + + @xzclose($v_temp_tar); } - if (!@unlink($this->_tarname.".tmp")) { - $this->_error('Error while deleting temporary file \'' - .$this->_tarname.'.tmp\''); + 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; + // one or two 512 bytes block + if (!$this->_openReadWrite()) { + return false; + } clearstatcache(); $v_size = filesize($this->_tarname); @@ -1859,29 +2277,32 @@ class Archive_Tar extends PEAR 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) { + } 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='') + function _append($p_filelist, $p_add_dir = '', $p_remove_dir = '') { - if (!$this->_openAppend()) + if (!$this->_openAppend()) { return false; + } - if ($this->_addList($p_filelist, $p_add_dir, $p_remove_dir)) - $this->_writeFooter(); + if ($this->_addList($p_filelist, $p_add_dir, $p_remove_dir)) { + $this->_writeFooter(); + } $this->_close(); return true; } + // }}} // {{{ _dirCheck() @@ -1897,15 +2318,18 @@ class Archive_Tar extends PEAR function _dirCheck($p_dir) { clearstatcache(); - if ((@is_dir($p_dir)) || ($p_dir == '')) + 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; + (!$this->_dirCheck($p_parent_dir)) + ) { + return false; + } if (!@mkdir($p_dir, 0777)) { $this->_error("Unable to create directory '$p_dir'"); @@ -1940,54 +2364,59 @@ class Archive_Tar extends PEAR $v_list = explode('/', $p_dir); // ----- Study directories from last to first - for ($i=sizeof($v_list)-1; $i>=0; $i--) { + 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 ($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) + 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; + 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/vendor/pear-pear.php.net/PEAR/bin/pear b/vendor/pear-pear.php.net/PEAR/bin/pear index cc53e66f464..458a02d37f2 100755 --- a/vendor/pear-pear.php.net/PEAR/bin/pear +++ b/vendor/pear-pear.php.net/PEAR/bin/pear @@ -4,10 +4,10 @@ if test "x$PHP_PEAR_PHP_BIN" != "x"; then PHP="$PHP_PEAR_PHP_BIN" else - if test "/usr/bin/env /stage/local/vufind/vendor/bin/composer-php" = '@'php_bin'@'; then + if test "/usr/bin/env /home/dkatz/vufind3/vendor/bin/composer-php" = '@'php_bin'@'; then PHP=php else - PHP="/usr/bin/env /stage/local/vufind/vendor/bin/composer-php" + PHP="/usr/bin/env /home/dkatz/vufind3/vendor/bin/composer-php" fi fi @@ -16,12 +16,12 @@ if test "x$PHP_PEAR_INSTALL_DIR" != "x"; then INCDIR=$PHP_PEAR_INSTALL_DIR INCARG="-d include_path=$PHP_PEAR_INSTALL_DIR" else - if test "/stage/local/vufind/vendor/pear-pear.php.net/PEAR" = '@'php_dir'@'; then + if test "/home/dkatz/vufind3/vendor/pear-pear.php.net/PEAR" = '@'php_dir'@'; then INCDIR=`dirname $0` INCARG="" else - INCDIR="/stage/local/vufind/vendor/pear-pear.php.net/PEAR" - INCARG="-d include_path=/stage/local/vufind/vendor/pear-pear.php.net/PEAR" + INCDIR="/home/dkatz/vufind3/vendor/pear-pear.php.net/PEAR" + INCARG="-d include_path=/home/dkatz/vufind3/vendor/pear-pear.php.net/PEAR" fi fi diff --git a/vendor/pear-pear.php.net/PEAR/bin/peardev b/vendor/pear-pear.php.net/PEAR/bin/peardev index ea88babffbb..8560ce332fe 100755 --- a/vendor/pear-pear.php.net/PEAR/bin/peardev +++ b/vendor/pear-pear.php.net/PEAR/bin/peardev @@ -4,10 +4,10 @@ if test "x$PHP_PEAR_PHP_BIN" != "x"; then PHP="$PHP_PEAR_PHP_BIN" else - if test "/usr/bin/env /stage/local/vufind/vendor/bin/composer-php" = '@'php_bin'@'; then + if test "/usr/bin/env /home/dkatz/vufind3/vendor/bin/composer-php" = '@'php_bin'@'; then PHP=php else - PHP="/usr/bin/env /stage/local/vufind/vendor/bin/composer-php" + PHP="/usr/bin/env /home/dkatz/vufind3/vendor/bin/composer-php" fi fi @@ -16,12 +16,12 @@ if test "x$PHP_PEAR_INSTALL_DIR" != "x"; then INCDIR=$PHP_PEAR_INSTALL_DIR INCARG="-d include_path=$PHP_PEAR_INSTALL_DIR" else - if test "/stage/local/vufind/vendor/pear-pear.php.net/PEAR" = '@'php_dir'@'; then + if test "/home/dkatz/vufind3/vendor/pear-pear.php.net/PEAR" = '@'php_dir'@'; then INCDIR=`dirname $0` INCARG="" else - INCDIR="/stage/local/vufind/vendor/pear-pear.php.net/PEAR" - INCARG="-d include_path=/stage/local/vufind/vendor/pear-pear.php.net/PEAR" + INCDIR="/home/dkatz/vufind3/vendor/pear-pear.php.net/PEAR" + INCARG="-d include_path=/home/dkatz/vufind3/vendor/pear-pear.php.net/PEAR" fi fi diff --git a/vendor/pear-pear.php.net/PEAR/bin/pecl b/vendor/pear-pear.php.net/PEAR/bin/pecl index 3839a784cbe..d84878917c6 100755 --- a/vendor/pear-pear.php.net/PEAR/bin/pecl +++ b/vendor/pear-pear.php.net/PEAR/bin/pecl @@ -4,10 +4,10 @@ if test "x$PHP_PEAR_PHP_BIN" != "x"; then PHP="$PHP_PEAR_PHP_BIN" else - if test "/usr/bin/env /stage/local/vufind/vendor/bin/composer-php" = '@'php_bin'@'; then + if test "/usr/bin/env /home/dkatz/vufind3/vendor/bin/composer-php" = '@'php_bin'@'; then PHP=php else - PHP="/usr/bin/env /stage/local/vufind/vendor/bin/composer-php" + PHP="/usr/bin/env /home/dkatz/vufind3/vendor/bin/composer-php" fi fi @@ -16,12 +16,12 @@ if test "x$PHP_PEAR_INSTALL_DIR" != "x"; then INCDIR=$PHP_PEAR_INSTALL_DIR INCARG="-d include_path=$PHP_PEAR_INSTALL_DIR" else - if test "/stage/local/vufind/vendor/pear-pear.php.net/PEAR" = '@'php_dir'@'; then + if test "/home/dkatz/vufind3/vendor/pear-pear.php.net/PEAR" = '@'php_dir'@'; then INCDIR=`dirname $0` INCARG="" else - INCDIR="/stage/local/vufind/vendor/pear-pear.php.net/PEAR" - INCARG="-d include_path=/stage/local/vufind/vendor/pear-pear.php.net/PEAR" + INCDIR="/home/dkatz/vufind3/vendor/pear-pear.php.net/PEAR" + INCARG="-d include_path=/home/dkatz/vufind3/vendor/pear-pear.php.net/PEAR" fi fi diff --git a/vendor/pear-pear.php.net/PEAR/pearcmd.php b/vendor/pear-pear.php.net/PEAR/pearcmd.php index 3f5ce93e627..e7abe92b70e 100644 --- a/vendor/pear-pear.php.net/PEAR/pearcmd.php +++ b/vendor/pear-pear.php.net/PEAR/pearcmd.php @@ -27,8 +27,8 @@ define('PEAR_IGNORE_BACKTRACE', 1); */ //the space is needed for windows include paths with trailing backslash // http://pear.php.net/bugs/bug.php?id=19482 -if ('/stage/local/vufind/vendor/pear-pear.php.net/PEAR ' != '@'.'include_path'.'@ ') { - ini_set('include_path', trim('/stage/local/vufind/vendor/pear-pear.php.net/PEAR ')); +if ('/home/dkatz/vufind3/vendor/pear-pear.php.net/PEAR ' != '@'.'include_path'.'@ ') { + ini_set('include_path', trim('/home/dkatz/vufind3/vendor/pear-pear.php.net/PEAR ')); $raw = false; } else { // this is a raw, uninstalled pear, either a cvs checkout, or php distro diff --git a/vendor/pear-pear.php.net/PEAR/peclcmd.php b/vendor/pear-pear.php.net/PEAR/peclcmd.php index 697d05c6d0d..d416a0747c2 100644 --- a/vendor/pear-pear.php.net/PEAR/peclcmd.php +++ b/vendor/pear-pear.php.net/PEAR/peclcmd.php @@ -21,8 +21,8 @@ */ //the space is needed for windows include paths with trailing backslash // http://pear.php.net/bugs/bug.php?id=19482 -if ('/stage/local/vufind/vendor/pear-pear.php.net/PEAR ' != '@'.'include_path'.'@ ') { - ini_set('include_path', trim('/stage/local/vufind/vendor/pear-pear.php.net/PEAR ')); +if ('/home/dkatz/vufind3/vendor/pear-pear.php.net/PEAR ' != '@'.'include_path'.'@ ') { + ini_set('include_path', trim('/home/dkatz/vufind3/vendor/pear-pear.php.net/PEAR ')); $raw = false; } else { // this is a raw, uninstalled pear, either a cvs checkout, or php distro diff --git a/vendor/symfony/yaml/Symfony/Component/Yaml/Inline.php b/vendor/symfony/yaml/Symfony/Component/Yaml/Inline.php index 2242d12c7be..b029e81377d 100644 --- a/vendor/symfony/yaml/Symfony/Component/Yaml/Inline.php +++ b/vendor/symfony/yaml/Symfony/Component/Yaml/Inline.php @@ -32,12 +32,13 @@ class Inline * @param string $value A YAML string * @param bool $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise * @param bool $objectSupport true if object support is enabled, false otherwise + * @param array $references Mapping of variable names to values * * @return array A PHP array representing the YAML string * * @throws ParseException */ - public static function parse($value, $exceptionOnInvalidType = false, $objectSupport = false) + public static function parse($value, $exceptionOnInvalidType = false, $objectSupport = false, $references = array()) { self::$exceptionOnInvalidType = $exceptionOnInvalidType; self::$objectSupport = $objectSupport; @@ -56,15 +57,15 @@ class Inline $i = 0; switch ($value[0]) { case '[': - $result = self::parseSequence($value, $i); + $result = self::parseSequence($value, $i, $references); ++$i; break; case '{': - $result = self::parseMapping($value, $i); + $result = self::parseMapping($value, $i, $references); ++$i; break; default: - $result = self::parseScalar($value, null, array('"', "'"), $i); + $result = self::parseScalar($value, null, array('"', "'"), $i, true, $references); } // some comments are allowed at the end @@ -184,14 +185,15 @@ class Inline * @param scalar $scalar * @param string $delimiters * @param array $stringDelimiters - * @param int &$i - * @param bool $evaluate + * @param int &$i + * @param bool $evaluate + * @param array $references * * @return string A YAML string * * @throws ParseException When malformed inline YAML string is parsed */ - public static function parseScalar($scalar, $delimiters = null, $stringDelimiters = array('"', "'"), &$i = 0, $evaluate = true) + public static function parseScalar($scalar, $delimiters = null, $stringDelimiters = array('"', "'"), &$i = 0, $evaluate = true, $references = array()) { if (in_array($scalar[$i], $stringDelimiters)) { // quoted scalar @@ -221,7 +223,7 @@ class Inline } if ($evaluate) { - $output = self::evaluateScalar($output); + $output = self::evaluateScalar($output, $references); } } @@ -262,13 +264,14 @@ class Inline * Parses a sequence to a YAML string. * * @param string $sequence - * @param int &$i + * @param int &$i + * @param array $references * * @return string A YAML string * * @throws ParseException When malformed inline YAML string is parsed */ - private static function parseSequence($sequence, &$i = 0) + private static function parseSequence($sequence, &$i = 0, $references = array()) { $output = array(); $len = strlen($sequence); @@ -279,11 +282,11 @@ class Inline switch ($sequence[$i]) { case '[': // nested sequence - $output[] = self::parseSequence($sequence, $i); + $output[] = self::parseSequence($sequence, $i, $references); break; case '{': // nested mapping - $output[] = self::parseMapping($sequence, $i); + $output[] = self::parseMapping($sequence, $i, $references); break; case ']': return $output; @@ -292,12 +295,14 @@ class Inline break; default: $isQuoted = in_array($sequence[$i], array('"', "'")); - $value = self::parseScalar($sequence, array(',', ']'), array('"', "'"), $i); + $value = self::parseScalar($sequence, array(',', ']'), array('"', "'"), $i, true, $references); - if (!$isQuoted && false !== strpos($value, ': ')) { + // the value can be an array if a reference has been resolved to an array var + if (!is_array($value) && !$isQuoted && false !== strpos($value, ': ')) { // embedded mapping? try { - $value = self::parseMapping('{'.$value.'}'); + $pos = 0; + $value = self::parseMapping('{'.$value.'}', $pos, $references); } catch (\InvalidArgumentException $e) { // no, it's not } @@ -318,13 +323,14 @@ class Inline * Parses a mapping to a YAML string. * * @param string $mapping - * @param int &$i + * @param int &$i + * @param array $references * * @return string A YAML string * * @throws ParseException When malformed inline YAML string is parsed */ - private static function parseMapping($mapping, &$i = 0) + private static function parseMapping($mapping, &$i = 0, $references = array()) { $output = array(); $len = strlen($mapping); @@ -350,7 +356,7 @@ class Inline switch ($mapping[$i]) { case '[': // nested sequence - $value = self::parseSequence($mapping, $i); + $value = self::parseSequence($mapping, $i, $references); // Spec: Keys MUST be unique; first one wins. // Parser cannot abort this mapping earlier, since lines // are processed sequentially. @@ -361,7 +367,7 @@ class Inline break; case '{': // nested mapping - $value = self::parseMapping($mapping, $i); + $value = self::parseMapping($mapping, $i, $references); // Spec: Keys MUST be unique; first one wins. // Parser cannot abort this mapping earlier, since lines // are processed sequentially. @@ -374,7 +380,7 @@ class Inline case ' ': break; default: - $value = self::parseScalar($mapping, array(',', '}'), array('"', "'"), $i); + $value = self::parseScalar($mapping, array(',', '}'), array('"', "'"), $i, true, $references); // Spec: Keys MUST be unique; first one wins. // Parser cannot abort this mapping earlier, since lines // are processed sequentially. @@ -400,13 +406,31 @@ class Inline * Evaluates scalars and replaces magic values. * * @param string $scalar + * @param array $references * * @return string A YAML string + * + * @throws ParseException when object parsing support was disabled and the parser detected a PHP object */ - private static function evaluateScalar($scalar) + private static function evaluateScalar($scalar, $references = array()) { $scalar = trim($scalar); $scalarLower = strtolower($scalar); + + if (0 === strpos($scalar, '*')) { + if (false !== $pos = strpos($scalar, '#')) { + $value = substr($scalar, 1, $pos - 2); + } else { + $value = substr($scalar, 1); + } + + if (!array_key_exists($value, $references)) { + throw new ParseException(sprintf('Reference "%s" does not exist.', $value)); + } + + return $references[$value]; + } + switch (true) { case 'null' === $scalarLower: case '' === $scalar: diff --git a/vendor/symfony/yaml/Symfony/Component/Yaml/Parser.php b/vendor/symfony/yaml/Symfony/Component/Yaml/Parser.php index 0577b5e8853..2204ffc4f57 100644 --- a/vendor/symfony/yaml/Symfony/Component/Yaml/Parser.php +++ b/vendor/symfony/yaml/Symfony/Component/Yaml/Parser.php @@ -115,14 +115,14 @@ class Parser $data[] = $this->parseValue($values['value'], $exceptionOnInvalidType, $objectSupport); } } - } elseif (preg_match('#^(?P<key>'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\[\{].*?) *\:(\s+(?P<value>.+?))?\s*$#u', $this->currentLine, $values) && false === strpos($values['key'],' #')) { + } elseif (preg_match('#^(?P<key>'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\[\{].*?) *\:(\s+(?P<value>.+?))?\s*$#u', $this->currentLine, $values) && (false === strpos($values['key'],' #') || in_array($values['key'][0], array('"', "'")))) { if ($context && 'sequence' == $context) { throw new ParseException('You cannot define a mapping item when in a sequence'); } $context = 'mapping'; // force correct settings - Inline::parse(null, $exceptionOnInvalidType, $objectSupport); + Inline::parse(null, $exceptionOnInvalidType, $objectSupport, $this->refs); try { $key = Inline::parseScalar($values['key']); } catch (ParseException $e) { @@ -232,7 +232,7 @@ class Parser $lineCount = count($this->lines); if (1 === $lineCount || (2 === $lineCount && empty($this->lines[1]))) { try { - $value = Inline::parse($this->lines[0], $exceptionOnInvalidType, $objectSupport); + $value = Inline::parse($this->lines[0], $exceptionOnInvalidType, $objectSupport, $this->refs); } catch (ParseException $e) { $e->setParsedLine($this->getRealCurrentLineNb() + 1); $e->setSnippet($this->currentLine); @@ -439,7 +439,7 @@ class Parser } try { - return Inline::parse($value, $exceptionOnInvalidType, $objectSupport); + return Inline::parse($value, $exceptionOnInvalidType, $objectSupport, $this->refs); } catch (ParseException $e) { $e->setParsedLine($this->getRealCurrentLineNb() + 1); $e->setSnippet($this->currentLine); diff --git a/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/sfComments.yml b/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/sfComments.yml index 46addfcd3da..6a7ffeca46f 100644 --- a/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/sfComments.yml +++ b/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/sfComments.yml @@ -63,3 +63,11 @@ brief: > yaml: 'foo#bar: baz' php: | array('foo#bar' => 'baz') +--- +test: 'Hash key ending with a space and a #' +brief: > + 'Hash key ending with a space and a #' +yaml: | + 'foo #': baz +php: | + array('foo #' => 'baz') diff --git a/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/InlineTest.php b/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/InlineTest.php index dc497ca21c7..affe4f9c23e 100644 --- a/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/InlineTest.php +++ b/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/InlineTest.php @@ -115,6 +115,38 @@ class InlineTest extends \PHPUnit_Framework_TestCase $this->assertSame($expect, Inline::parseScalar($value)); } + /** + * @dataProvider getDataForParseReferences + */ + public function testParseReferences($yaml, $expected) + { + $this->assertSame($expected, Inline::parse($yaml, false, false, array('var' => 'var-value'))); + } + + public function getDataForParseReferences() + { + return array( + 'scalar' => array('*var', 'var-value'), + 'list' => array('[ *var ]', array('var-value')), + 'list-in-list' => array('[[ *var ]]', array(array('var-value'))), + 'map-in-list' => array('[ { key: *var } ]', array(array('key' => 'var-value'))), + 'embedded-mapping-in-list' => array('[ key: *var ]', array(array('key' => 'var-value'))), + 'map' => array('{ key: *var }', array('key' => 'var-value')), + 'list-in-map' => array('{ key: [*var] }', array('key' => array('var-value'))), + 'map-in-map' => array('{ foo: { bar: *var } }', array('foo' => array('bar' => 'var-value'))), + ); + } + + public function testParseMapReferenceInSequence() + { + $foo = array( + 'a' => 'Steve', + 'b' => 'Clark', + 'c' => 'Brian', + ); + $this->assertSame(array($foo), Inline::parse('[*foo]', false, false, array('foo' => $foo))); + } + protected function getTestsForParse() { return array( diff --git a/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/ParserTest.php b/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/ParserTest.php index a4db960729e..9480a21f95a 100644 --- a/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/ParserTest.php +++ b/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/ParserTest.php @@ -649,6 +649,32 @@ EOT </body> footer # comment3 +EOF + )); + } + + public function testReferenceResolvingInInlineStrings() + { + $this->assertEquals(array( + 'var' => 'var-value', + 'scalar' => 'var-value', + 'list' => array('var-value'), + 'list_in_list' => array(array('var-value')), + 'map_in_list' => array(array('key' => 'var-value')), + 'embedded_mapping' => array(array('key' => 'var-value')), + 'map' => array('key' => 'var-value'), + 'list_in_map' => array('key' => array('var-value')), + 'map_in_map' => array('foo' => array('bar' => 'var-value')), + ), Yaml::parse(<<<EOF +var: &var var-value +scalar: *var +list: [ *var ] +list_in_list: [[ *var ]] +map_in_list: [ { key: *var } ] +embedded_mapping: [ key: *var ] +map: { key: *var } +list_in_map: { key: [*var] } +map_in_map: { foo: { bar: *var } } EOF )); } -- GitLab