Skip to content

Commit

Permalink
Merge branch 'master' into add-zip-streamer
Browse files Browse the repository at this point in the history
Conflicts:
	autoload.php
	composer.json
	composer.lock
	composer/autoload_real.php
	composer/installed.json
  • Loading branch information
DeepDiver1975 committed Feb 24, 2014
2 parents e13a121 + 478de4b commit bbc3761
Show file tree
Hide file tree
Showing 19 changed files with 67 additions and 852 deletions.
2 changes: 2 additions & 0 deletions PHPExcel/Classes/PHPExcel/Reader/Excel2003XML.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ public function listWorksheetNames($pFilename)

$worksheetNames = array();

libxml_disable_entity_loader(true);
$xml = simplexml_load_file($pFilename);
$namespaces = $xml->getNamespaces(true);

Expand Down Expand Up @@ -165,6 +166,7 @@ public function listWorksheetInfo($pFilename)

$worksheetInfo = array();

libxml_disable_entity_loader(true);
$xml = simplexml_load_file($pFilename);
$namespaces = $xml->getNamespaces(true);

Expand Down
26 changes: 20 additions & 6 deletions PHPExcel/Classes/PHPExcel/Reader/Excel2007.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public function canRead($pFilename)
$zip = new ZipArchive;
if ($zip->open($pFilename) === true) {
// check if it is an OOXML archive
libxml_disable_entity_loader(true);
$rels = simplexml_load_string($this->_getFromZipArchive($zip, "_rels/.rels"));
if ($rels !== false) {
foreach ($rels->Relationship as $rel) {
Expand Down Expand Up @@ -131,12 +132,14 @@ public function listWorksheetNames($pFilename)
$zip->open($pFilename);

// The files we're looking at here are small enough that simpleXML is more efficient than XMLReader
libxml_disable_entity_loader(true);
$rels = simplexml_load_string(
$this->_getFromZipArchive($zip, "_rels/.rels")
); //~ http://schemas.openxmlformats.org/package/2006/relationships");
foreach ($rels->Relationship as $rel) {
switch ($rel["Type"]) {
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument":
libxml_disable_entity_loader(true);
$xmlWorkbook = simplexml_load_string(
$this->_getFromZipArchive($zip, "{$rel['Target']}")
); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
Expand Down Expand Up @@ -173,11 +176,12 @@ public function listWorksheetInfo($pFilename)

$zip = new ZipArchive;
$zip->open($pFilename);

libxml_disable_entity_loader(true);
$rels = simplexml_load_string($this->_getFromZipArchive($zip, "_rels/.rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships");
foreach ($rels->Relationship as $rel) {
if ($rel["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument") {
$dir = dirname($rel["Target"]);
libxml_disable_entity_loader(true);
$relsWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/_rels/" . basename($rel["Target"]) . ".rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships");
$relsWorkbook->registerXPathNamespace("rel", "http://schemas.openxmlformats.org/package/2006/relationships");

Expand All @@ -186,8 +190,8 @@ public function listWorksheetInfo($pFilename)
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet") {
$worksheets[(string) $ele["Id"]] = $ele["Target"];
}
}

}
libxml_disable_entity_loader(true);
$xmlWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
if ($xmlWorkbook->sheets) {
$dir = dirname($rel["Target"]);
Expand Down Expand Up @@ -354,13 +358,14 @@ public function load($pFilename)
$zip->open($pFilename);

// Read the theme first, because we need the colour scheme when reading the styles
libxml_disable_entity_loader(true);
$wbRels = simplexml_load_string($this->_getFromZipArchive($zip, "xl/_rels/workbook.xml.rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships");
foreach ($wbRels->Relationship as $rel) {
switch ($rel["Type"]) {
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme":
$themeOrderArray = array('lt1','dk1','lt2','dk2');
$themeOrderAdditional = count($themeOrderArray);

libxml_disable_entity_loader(true);
$xmlTheme = simplexml_load_string($this->_getFromZipArchive($zip, "xl/{$rel['Target']}"));
if (is_object($xmlTheme)) {
$xmlThemeName = $xmlTheme->attributes();
Expand Down Expand Up @@ -390,11 +395,12 @@ public function load($pFilename)
break;
}
}

libxml_disable_entity_loader(true);
$rels = simplexml_load_string($this->_getFromZipArchive($zip, "_rels/.rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships");
foreach ($rels->Relationship as $rel) {
switch ($rel["Type"]) {
case "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties":
libxml_disable_entity_loader(true);
$xmlCore = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}"));
if (is_object($xmlCore)) {
$xmlCore->registerXPathNamespace("dc", "http://purl.org/dc/elements/1.1/");
Expand All @@ -414,6 +420,7 @@ public function load($pFilename)
break;

case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties":
libxml_disable_entity_loader(true);
$xmlCore = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}"));
if (is_object($xmlCore)) {
$docProps = $excel->getProperties();
Expand All @@ -425,6 +432,7 @@ public function load($pFilename)
break;

case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties":
libxml_disable_entity_loader(true);
$xmlCore = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}"));
if (is_object($xmlCore)) {
$docProps = $excel->getProperties();
Expand All @@ -445,11 +453,13 @@ public function load($pFilename)

case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument":
$dir = dirname($rel["Target"]);
libxml_disable_entity_loader(true);
$relsWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/_rels/" . basename($rel["Target"]) . ".rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships");
$relsWorkbook->registerXPathNamespace("rel", "http://schemas.openxmlformats.org/package/2006/relationships");

$sharedStrings = array();
$xpath = self::array_item($relsWorkbook->xpath("rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings']"));
libxml_disable_entity_loader(true);
$xmlStrings = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/$xpath[Target]")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
if (isset($xmlStrings) && isset($xmlStrings->si)) {
foreach ($xmlStrings->si as $val) {
Expand All @@ -471,6 +481,7 @@ public function load($pFilename)
$styles = array();
$cellStyles = array();
$xpath = self::array_item($relsWorkbook->xpath("rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles']"));
libxml_disable_entity_loader(true);
$xmlStyles = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/$xpath[Target]")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
$numFmts = null;
if ($xmlStyles && $xmlStyles->numFmts[0]) {
Expand Down Expand Up @@ -568,7 +579,7 @@ public function load($pFilename)
}
}
}

libxml_disable_entity_loader(true);
$xmlWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");

// Set base date
Expand Down Expand Up @@ -612,6 +623,7 @@ public function load($pFilename)
// reverse
$docSheet->setTitle((string) $eleSheet["name"],false);
$fileWorksheet = $worksheets[(string) self::array_item($eleSheet->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")];
libxml_disable_entity_loader(true);
$xmlSheet = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/$fileWorksheet")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");

$sharedFormulas = array();
Expand Down Expand Up @@ -1194,6 +1206,7 @@ public function load($pFilename)
if (!$this->_readDataOnly) {
// Locate hyperlink relations
if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) {
libxml_disable_entity_loader(true);
$relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships");
foreach ($relsWorksheet->Relationship as $ele) {
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink") {
Expand Down Expand Up @@ -1235,6 +1248,7 @@ public function load($pFilename)
if (!$this->_readDataOnly) {
// Locate comment relations
if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) {
libxml_disable_entity_loader(true);
$relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships");
foreach ($relsWorksheet->Relationship as $ele) {
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments") {
Expand Down
1 change: 1 addition & 0 deletions PHPExcel/Classes/PHPExcel/Reader/Gnumeric.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
// echo htmlentities($gFileData,ENT_QUOTES,'UTF-8');
// echo '</pre><hr />';
//
libxml_disable_entity_loader(true);
$xml = simplexml_load_string($gFileData);
$namespacesMeta = $xml->getNamespaces(true);

Expand Down
3 changes: 3 additions & 0 deletions PHPExcel/Classes/PHPExcel/Reader/OOCalc.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public function canRead($pFilename)
if ($stat && ($stat['size'] <= 255)) {
$mimeType = $zip->getFromName($stat['name']);
} elseif($stat = $zip->statName('META-INF/manifest.xml')) {
libxml_disable_entity_loader(true);
$xml = simplexml_load_string($zip->getFromName('META-INF/manifest.xml'));
$namespacesContent = $xml->getNamespaces(true);
if (isset($namespacesContent['manifest'])) {
Expand Down Expand Up @@ -337,6 +338,7 @@ public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
}

// echo '<h1>Meta Information</h1>';
libxml_disable_entity_loader(true);
$xml = simplexml_load_string($zip->getFromName("meta.xml"));
$namespacesMeta = $xml->getNamespaces(true);
// echo '<pre>';
Expand Down Expand Up @@ -421,6 +423,7 @@ public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)


// echo '<h1>Workbook Content</h1>';
libxml_disable_entity_loader(true);
$xml = simplexml_load_string($zip->getFromName("content.xml"));
$namespacesContent = $xml->getNamespaces(true);
// echo '<pre>';
Expand Down
2 changes: 1 addition & 1 deletion autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

require_once __DIR__ . '/composer' . '/autoload_real.php';

return ComposerAutoloaderInit886d379e69082f768cd09e689a3fa8e6::getLoader();
return ComposerAutoloaderInit713de2d84a4eb6bdcb2d36cc7aa8f260::getLoader();
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions composer/autoload_real.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// autoload_real.php @generated by Composer

class ComposerAutoloaderInit886d379e69082f768cd09e689a3fa8e6
class ComposerAutoloaderInit713de2d84a4eb6bdcb2d36cc7aa8f260
{
private static $loader;

Expand All @@ -19,9 +19,9 @@ public static function getLoader()
return self::$loader;
}

spl_autoload_register(array('ComposerAutoloaderInit886d379e69082f768cd09e689a3fa8e6', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit713de2d84a4eb6bdcb2d36cc7aa8f260', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit886d379e69082f768cd09e689a3fa8e6', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit713de2d84a4eb6bdcb2d36cc7aa8f260', 'loadClassLoader'));

$vendorDir = dirname(__DIR__);
$baseDir = $vendorDir;
Expand All @@ -45,14 +45,14 @@ public static function getLoader()

$includeFiles = require __DIR__ . '/autoload_files.php';
foreach ($includeFiles as $file) {
composerRequire886d379e69082f768cd09e689a3fa8e6($file);
composerRequire713de2d84a4eb6bdcb2d36cc7aa8f260($file);
}

return $loader;
}
}

function composerRequire886d379e69082f768cd09e689a3fa8e6($file)
function composerRequire713de2d84a4eb6bdcb2d36cc7aa8f260($file)
{
require $file;
}
1 change: 1 addition & 0 deletions getid3/getid3.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@ public static function array_min($arraydata, $returnkey=false) {
public static function XML2array($XMLstring) {
if (function_exists('simplexml_load_string')) {
if (function_exists('get_object_vars')) {
libxml_disable_entity_loader(true);
$XMLobject = simplexml_load_string($XMLstring);
return self::SimpleXMLelement2array($XMLobject);
}
Expand Down
Loading

0 comments on commit bbc3761

Please sign in to comment.