|
|
@ -94,7 +94,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
$zip = new $zipClass;
|
|
|
|
$zip = new $zipClass;
|
|
|
|
if ($zip->open($pFilename) === true) {
|
|
|
|
if ($zip->open($pFilename) === true) {
|
|
|
|
// check if it is an OOXML archive
|
|
|
|
// check if it is an OOXML archive
|
|
|
|
$rels = simplexml_load_string($this->_getFromZipArchive($zip, "_rels/.rels"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
|
|
|
$rels = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "_rels/.rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
|
|
|
if ($rels !== false) {
|
|
|
|
if ($rels !== false) {
|
|
|
|
foreach ($rels->Relationship as $rel) {
|
|
|
|
foreach ($rels->Relationship as $rel) {
|
|
|
|
switch ($rel["Type"]) {
|
|
|
|
switch ($rel["Type"]) {
|
|
|
@ -136,13 +136,13 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
|
|
|
|
|
|
|
|
// The files we're looking at here are small enough that simpleXML is more efficient than XMLReader
|
|
|
|
// The files we're looking at here are small enough that simpleXML is more efficient than XMLReader
|
|
|
|
$rels = simplexml_load_string(
|
|
|
|
$rels = simplexml_load_string(
|
|
|
|
$this->_getFromZipArchive($zip, "_rels/.rels", 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions())
|
|
|
|
$this->securityScan($this->_getFromZipArchive($zip, "_rels/.rels"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions())
|
|
|
|
); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
|
|
|
); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
|
|
|
foreach ($rels->Relationship as $rel) {
|
|
|
|
foreach ($rels->Relationship as $rel) {
|
|
|
|
switch ($rel["Type"]) {
|
|
|
|
switch ($rel["Type"]) {
|
|
|
|
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument":
|
|
|
|
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument":
|
|
|
|
$xmlWorkbook = simplexml_load_string(
|
|
|
|
$xmlWorkbook = simplexml_load_string(
|
|
|
|
$this->_getFromZipArchive($zip, "{$rel['Target']}", 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions())
|
|
|
|
$this->securityScan($this->_getFromZipArchive($zip, "{$rel['Target']}"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions())
|
|
|
|
); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
|
|
|
); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
|
|
|
|
|
|
|
|
|
|
|
if ($xmlWorkbook->sheets) {
|
|
|
|
if ($xmlWorkbook->sheets) {
|
|
|
@ -180,11 +180,11 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
$zip = new $zipClass;
|
|
|
|
$zip = new $zipClass;
|
|
|
|
$zip->open($pFilename);
|
|
|
|
$zip->open($pFilename);
|
|
|
|
|
|
|
|
|
|
|
|
$rels = simplexml_load_string($this->_getFromZipArchive($zip, "_rels/.rels"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
|
|
|
$rels = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "_rels/.rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
|
|
|
foreach ($rels->Relationship as $rel) {
|
|
|
|
foreach ($rels->Relationship as $rel) {
|
|
|
|
if ($rel["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument") {
|
|
|
|
if ($rel["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument") {
|
|
|
|
$dir = dirname($rel["Target"]);
|
|
|
|
$dir = dirname($rel["Target"]);
|
|
|
|
$relsWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/_rels/" . basename($rel["Target"]) . ".rels"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
|
|
|
$relsWorkbook = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "$dir/_rels/" . basename($rel["Target"]) . ".rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
|
|
|
$relsWorkbook->registerXPathNamespace("rel", "http://schemas.openxmlformats.org/package/2006/relationships");
|
|
|
|
$relsWorkbook->registerXPathNamespace("rel", "http://schemas.openxmlformats.org/package/2006/relationships");
|
|
|
|
|
|
|
|
|
|
|
|
$worksheets = array();
|
|
|
|
$worksheets = array();
|
|
|
@ -194,7 +194,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$xmlWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
|
|
|
$xmlWorkbook = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "{$rel['Target']}")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
|
|
|
if ($xmlWorkbook->sheets) {
|
|
|
|
if ($xmlWorkbook->sheets) {
|
|
|
|
$dir = dirname($rel["Target"]);
|
|
|
|
$dir = dirname($rel["Target"]);
|
|
|
|
foreach ($xmlWorkbook->sheets->sheet as $eleSheet) {
|
|
|
|
foreach ($xmlWorkbook->sheets->sheet as $eleSheet) {
|
|
|
@ -209,7 +209,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
$fileWorksheet = $worksheets[(string) self::array_item($eleSheet->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")];
|
|
|
|
$fileWorksheet = $worksheets[(string) self::array_item($eleSheet->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")];
|
|
|
|
|
|
|
|
|
|
|
|
$xml = new XMLReader();
|
|
|
|
$xml = new XMLReader();
|
|
|
|
$res = $xml->open('zip://'.PHPExcel_Shared_File::realpath($pFilename).'#'."$dir/$fileWorksheet", null, PHPExcel_Settings::getLibXmlLoaderOptions());
|
|
|
|
$res = $xml->xml($this->securityScanFile('zip://'.PHPExcel_Shared_File::realpath($pFilename).'#'."$dir/$fileWorksheet"), null, PHPExcel_Settings::getLibXmlLoaderOptions());
|
|
|
|
$xml->setParserProperty(2,true);
|
|
|
|
$xml->setParserProperty(2,true);
|
|
|
|
|
|
|
|
|
|
|
|
$currCells = 0;
|
|
|
|
$currCells = 0;
|
|
|
@ -362,14 +362,14 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
$zip->open($pFilename);
|
|
|
|
$zip->open($pFilename);
|
|
|
|
|
|
|
|
|
|
|
|
// Read the theme first, because we need the colour scheme when reading the styles
|
|
|
|
// Read the theme first, because we need the colour scheme when reading the styles
|
|
|
|
$wbRels = simplexml_load_string($this->_getFromZipArchive($zip, "xl/_rels/workbook.xml.rels"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
|
|
|
$wbRels = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "xl/_rels/workbook.xml.rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
|
|
|
foreach ($wbRels->Relationship as $rel) {
|
|
|
|
foreach ($wbRels->Relationship as $rel) {
|
|
|
|
switch ($rel["Type"]) {
|
|
|
|
switch ($rel["Type"]) {
|
|
|
|
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme":
|
|
|
|
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme":
|
|
|
|
$themeOrderArray = array('lt1','dk1','lt2','dk2');
|
|
|
|
$themeOrderArray = array('lt1','dk1','lt2','dk2');
|
|
|
|
$themeOrderAdditional = count($themeOrderArray);
|
|
|
|
$themeOrderAdditional = count($themeOrderArray);
|
|
|
|
|
|
|
|
|
|
|
|
$xmlTheme = simplexml_load_string($this->_getFromZipArchive($zip, "xl/{$rel['Target']}"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
|
|
|
$xmlTheme = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "xl/{$rel['Target']}")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
|
|
|
if (is_object($xmlTheme)) {
|
|
|
|
if (is_object($xmlTheme)) {
|
|
|
|
$xmlThemeName = $xmlTheme->attributes();
|
|
|
|
$xmlThemeName = $xmlTheme->attributes();
|
|
|
|
$xmlTheme = $xmlTheme->children("http://schemas.openxmlformats.org/drawingml/2006/main");
|
|
|
|
$xmlTheme = $xmlTheme->children("http://schemas.openxmlformats.org/drawingml/2006/main");
|
|
|
@ -399,11 +399,11 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$rels = simplexml_load_string($this->_getFromZipArchive($zip, "_rels/.rels"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
|
|
|
$rels = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "_rels/.rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
|
|
|
foreach ($rels->Relationship as $rel) {
|
|
|
|
foreach ($rels->Relationship as $rel) {
|
|
|
|
switch ($rel["Type"]) {
|
|
|
|
switch ($rel["Type"]) {
|
|
|
|
case "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties":
|
|
|
|
case "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties":
|
|
|
|
$xmlCore = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
|
|
|
$xmlCore = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "{$rel['Target']}")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
|
|
|
if (is_object($xmlCore)) {
|
|
|
|
if (is_object($xmlCore)) {
|
|
|
|
$xmlCore->registerXPathNamespace("dc", "http://purl.org/dc/elements/1.1/");
|
|
|
|
$xmlCore->registerXPathNamespace("dc", "http://purl.org/dc/elements/1.1/");
|
|
|
|
$xmlCore->registerXPathNamespace("dcterms", "http://purl.org/dc/terms/");
|
|
|
|
$xmlCore->registerXPathNamespace("dcterms", "http://purl.org/dc/terms/");
|
|
|
@ -422,7 +422,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties":
|
|
|
|
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties":
|
|
|
|
$xmlCore = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
|
|
|
$xmlCore = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "{$rel['Target']}")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
|
|
|
if (is_object($xmlCore)) {
|
|
|
|
if (is_object($xmlCore)) {
|
|
|
|
$docProps = $excel->getProperties();
|
|
|
|
$docProps = $excel->getProperties();
|
|
|
|
if (isset($xmlCore->Company))
|
|
|
|
if (isset($xmlCore->Company))
|
|
|
@ -433,7 +433,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties":
|
|
|
|
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties":
|
|
|
|
$xmlCore = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
|
|
|
$xmlCore = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "{$rel['Target']}")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
|
|
|
if (is_object($xmlCore)) {
|
|
|
|
if (is_object($xmlCore)) {
|
|
|
|
$docProps = $excel->getProperties();
|
|
|
|
$docProps = $excel->getProperties();
|
|
|
|
foreach ($xmlCore as $xmlProperty) {
|
|
|
|
foreach ($xmlCore as $xmlProperty) {
|
|
|
@ -459,12 +459,12 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument":
|
|
|
|
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument":
|
|
|
|
$dir = dirname($rel["Target"]);
|
|
|
|
$dir = dirname($rel["Target"]);
|
|
|
|
$relsWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/_rels/" . basename($rel["Target"]) . ".rels"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
|
|
|
$relsWorkbook = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "$dir/_rels/" . basename($rel["Target"]) . ".rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
|
|
|
$relsWorkbook->registerXPathNamespace("rel", "http://schemas.openxmlformats.org/package/2006/relationships");
|
|
|
|
$relsWorkbook->registerXPathNamespace("rel", "http://schemas.openxmlformats.org/package/2006/relationships");
|
|
|
|
|
|
|
|
|
|
|
|
$sharedStrings = array();
|
|
|
|
$sharedStrings = array();
|
|
|
|
$xpath = self::array_item($relsWorkbook->xpath("rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings']"));
|
|
|
|
$xpath = self::array_item($relsWorkbook->xpath("rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings']"));
|
|
|
|
$xmlStrings = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/$xpath[Target]"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
|
|
|
$xmlStrings = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "$dir/$xpath[Target]")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
|
|
|
if (isset($xmlStrings) && isset($xmlStrings->si)) {
|
|
|
|
if (isset($xmlStrings) && isset($xmlStrings->si)) {
|
|
|
|
foreach ($xmlStrings->si as $val) {
|
|
|
|
foreach ($xmlStrings->si as $val) {
|
|
|
|
if (isset($val->t)) {
|
|
|
|
if (isset($val->t)) {
|
|
|
@ -503,7 +503,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
$styles = array();
|
|
|
|
$styles = array();
|
|
|
|
$cellStyles = array();
|
|
|
|
$cellStyles = array();
|
|
|
|
$xpath = self::array_item($relsWorkbook->xpath("rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles']"));
|
|
|
|
$xpath = self::array_item($relsWorkbook->xpath("rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles']"));
|
|
|
|
$xmlStyles = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/$xpath[Target]"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
|
|
|
$xmlStyles = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "$dir/$xpath[Target]")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
|
|
|
$numFmts = null;
|
|
|
|
$numFmts = null;
|
|
|
|
if ($xmlStyles && $xmlStyles->numFmts[0]) {
|
|
|
|
if ($xmlStyles && $xmlStyles->numFmts[0]) {
|
|
|
|
$numFmts = $xmlStyles->numFmts[0];
|
|
|
|
$numFmts = $xmlStyles->numFmts[0];
|
|
|
@ -607,7 +607,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$xmlWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
|
|
|
$xmlWorkbook = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "{$rel['Target']}")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
|
|
|
|
|
|
|
|
|
|
|
// Set base date
|
|
|
|
// Set base date
|
|
|
|
if ($xmlWorkbook->workbookPr) {
|
|
|
|
if ($xmlWorkbook->workbookPr) {
|
|
|
@ -650,7 +650,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
// reverse
|
|
|
|
// reverse
|
|
|
|
$docSheet->setTitle((string) $eleSheet["name"],false);
|
|
|
|
$docSheet->setTitle((string) $eleSheet["name"],false);
|
|
|
|
$fileWorksheet = $worksheets[(string) self::array_item($eleSheet->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")];
|
|
|
|
$fileWorksheet = $worksheets[(string) self::array_item($eleSheet->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")];
|
|
|
|
$xmlSheet = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/$fileWorksheet"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
|
|
|
$xmlSheet = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "$dir/$fileWorksheet")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
|
|
|
|
|
|
|
|
|
|
|
$sharedFormulas = array();
|
|
|
|
$sharedFormulas = array();
|
|
|
|
|
|
|
|
|
|
|
@ -1239,7 +1239,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
if (!$this->_readDataOnly) {
|
|
|
|
if (!$this->_readDataOnly) {
|
|
|
|
// Locate hyperlink relations
|
|
|
|
// Locate hyperlink relations
|
|
|
|
if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) {
|
|
|
|
if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) {
|
|
|
|
$relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") , 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
|
|
|
$relsWorksheet = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
|
|
|
foreach ($relsWorksheet->Relationship as $ele) {
|
|
|
|
foreach ($relsWorksheet->Relationship as $ele) {
|
|
|
|
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink") {
|
|
|
|
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink") {
|
|
|
|
$hyperlinks[(string)$ele["Id"]] = (string)$ele["Target"];
|
|
|
|
$hyperlinks[(string)$ele["Id"]] = (string)$ele["Target"];
|
|
|
@ -1280,7 +1280,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
if (!$this->_readDataOnly) {
|
|
|
|
if (!$this->_readDataOnly) {
|
|
|
|
// Locate comment relations
|
|
|
|
// Locate comment relations
|
|
|
|
if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) {
|
|
|
|
if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) {
|
|
|
|
$relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") , 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
|
|
|
$relsWorksheet = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
|
|
|
foreach ($relsWorksheet->Relationship as $ele) {
|
|
|
|
foreach ($relsWorksheet->Relationship as $ele) {
|
|
|
|
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments") {
|
|
|
|
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments") {
|
|
|
|
$comments[(string)$ele["Id"]] = (string)$ele["Target"];
|
|
|
|
$comments[(string)$ele["Id"]] = (string)$ele["Target"];
|
|
|
@ -1295,7 +1295,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
foreach ($comments as $relName => $relPath) {
|
|
|
|
foreach ($comments as $relName => $relPath) {
|
|
|
|
// Load comments file
|
|
|
|
// Load comments file
|
|
|
|
$relPath = PHPExcel_Shared_File::realpath(dirname("$dir/$fileWorksheet") . "/" . $relPath);
|
|
|
|
$relPath = PHPExcel_Shared_File::realpath(dirname("$dir/$fileWorksheet") . "/" . $relPath);
|
|
|
|
$commentsFile = simplexml_load_string($this->_getFromZipArchive($zip, $relPath) , 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
|
|
|
$commentsFile = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, $relPath)), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
|
|
|
|
|
|
|
|
|
|
|
// Utility variables
|
|
|
|
// Utility variables
|
|
|
|
$authors = array();
|
|
|
|
$authors = array();
|
|
|
@ -1317,7 +1317,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
foreach ($vmlComments as $relName => $relPath) {
|
|
|
|
foreach ($vmlComments as $relName => $relPath) {
|
|
|
|
// Load VML comments file
|
|
|
|
// Load VML comments file
|
|
|
|
$relPath = PHPExcel_Shared_File::realpath(dirname("$dir/$fileWorksheet") . "/" . $relPath);
|
|
|
|
$relPath = PHPExcel_Shared_File::realpath(dirname("$dir/$fileWorksheet") . "/" . $relPath);
|
|
|
|
$vmlCommentsFile = simplexml_load_string( $this->_getFromZipArchive($zip, $relPath) , 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
|
|
|
$vmlCommentsFile = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, $relPath)), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
|
|
|
$vmlCommentsFile->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml');
|
|
|
|
$vmlCommentsFile->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml');
|
|
|
|
|
|
|
|
|
|
|
|
$shapes = $vmlCommentsFile->xpath('//v:shape');
|
|
|
|
$shapes = $vmlCommentsFile->xpath('//v:shape');
|
|
|
@ -1368,7 +1368,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
// Header/footer images
|
|
|
|
// Header/footer images
|
|
|
|
if ($xmlSheet && $xmlSheet->legacyDrawingHF && !$this->_readDataOnly) {
|
|
|
|
if ($xmlSheet && $xmlSheet->legacyDrawingHF && !$this->_readDataOnly) {
|
|
|
|
if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) {
|
|
|
|
if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) {
|
|
|
|
$relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") , 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
|
|
|
$relsWorksheet = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
|
|
|
$vmlRelationship = '';
|
|
|
|
$vmlRelationship = '';
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($relsWorksheet->Relationship as $ele) {
|
|
|
|
foreach ($relsWorksheet->Relationship as $ele) {
|
|
|
@ -1379,7 +1379,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
|
|
|
|
|
|
|
|
if ($vmlRelationship != '') {
|
|
|
|
if ($vmlRelationship != '') {
|
|
|
|
// Fetch linked images
|
|
|
|
// Fetch linked images
|
|
|
|
$relsVML = simplexml_load_string($this->_getFromZipArchive($zip, dirname($vmlRelationship) . '/_rels/' . basename($vmlRelationship) . '.rels' ), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
|
|
|
$relsVML = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, dirname($vmlRelationship) . '/_rels/' . basename($vmlRelationship) . '.rels')), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
|
|
|
$drawings = array();
|
|
|
|
$drawings = array();
|
|
|
|
foreach ($relsVML->Relationship as $ele) {
|
|
|
|
foreach ($relsVML->Relationship as $ele) {
|
|
|
|
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image") {
|
|
|
|
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image") {
|
|
|
@ -1388,7 +1388,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Fetch VML document
|
|
|
|
// Fetch VML document
|
|
|
|
$vmlDrawing = simplexml_load_string($this->_getFromZipArchive($zip, $vmlRelationship), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
|
|
|
$vmlDrawing = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, $vmlRelationship)), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
|
|
|
$vmlDrawing->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml');
|
|
|
|
$vmlDrawing->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml');
|
|
|
|
|
|
|
|
|
|
|
|
$hfImages = array();
|
|
|
|
$hfImages = array();
|
|
|
@ -1427,7 +1427,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: Autoshapes from twoCellAnchors!
|
|
|
|
// TODO: Autoshapes from twoCellAnchors!
|
|
|
|
if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) {
|
|
|
|
if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) {
|
|
|
|
$relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") , 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
|
|
|
$relsWorksheet = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
|
|
|
$drawings = array();
|
|
|
|
$drawings = array();
|
|
|
|
foreach ($relsWorksheet->Relationship as $ele) {
|
|
|
|
foreach ($relsWorksheet->Relationship as $ele) {
|
|
|
|
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing") {
|
|
|
|
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing") {
|
|
|
@ -1437,7 +1437,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
if ($xmlSheet->drawing && !$this->_readDataOnly) {
|
|
|
|
if ($xmlSheet->drawing && !$this->_readDataOnly) {
|
|
|
|
foreach ($xmlSheet->drawing as $drawing) {
|
|
|
|
foreach ($xmlSheet->drawing as $drawing) {
|
|
|
|
$fileDrawing = $drawings[(string) self::array_item($drawing->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")];
|
|
|
|
$fileDrawing = $drawings[(string) self::array_item($drawing->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")];
|
|
|
|
$relsDrawing = simplexml_load_string($this->_getFromZipArchive($zip, dirname($fileDrawing) . "/_rels/" . basename($fileDrawing) . ".rels") , 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
|
|
|
$relsDrawing = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, dirname($fileDrawing) . "/_rels/" . basename($fileDrawing) . ".rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
|
|
|
$images = array();
|
|
|
|
$images = array();
|
|
|
|
|
|
|
|
|
|
|
|
if ($relsDrawing && $relsDrawing->Relationship) {
|
|
|
|
if ($relsDrawing && $relsDrawing->Relationship) {
|
|
|
@ -1453,7 +1453,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$xmlDrawing = simplexml_load_string($this->_getFromZipArchive($zip, $fileDrawing), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions())->children("http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing");
|
|
|
|
$xmlDrawing = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, $fileDrawing)), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions())->children("http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing");
|
|
|
|
|
|
|
|
|
|
|
|
if ($xmlDrawing->oneCellAnchor) {
|
|
|
|
if ($xmlDrawing->oneCellAnchor) {
|
|
|
|
foreach ($xmlDrawing->oneCellAnchor as $oneCellAnchor) {
|
|
|
|
foreach ($xmlDrawing->oneCellAnchor as $oneCellAnchor) {
|
|
|
@ -1722,13 +1722,13 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!$this->_readDataOnly) {
|
|
|
|
if (!$this->_readDataOnly) {
|
|
|
|
$contentTypes = simplexml_load_string($this->_getFromZipArchive($zip, "[Content_Types].xml"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
|
|
|
$contentTypes = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "[Content_Types].xml")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
|
|
|
foreach ($contentTypes->Override as $contentType) {
|
|
|
|
foreach ($contentTypes->Override as $contentType) {
|
|
|
|
switch ($contentType["ContentType"]) {
|
|
|
|
switch ($contentType["ContentType"]) {
|
|
|
|
case "application/vnd.openxmlformats-officedocument.drawingml.chart+xml":
|
|
|
|
case "application/vnd.openxmlformats-officedocument.drawingml.chart+xml":
|
|
|
|
if ($this->_includeCharts) {
|
|
|
|
if ($this->_includeCharts) {
|
|
|
|
$chartEntryRef = ltrim($contentType['PartName'],'/');
|
|
|
|
$chartEntryRef = ltrim($contentType['PartName'],'/');
|
|
|
|
$chartElements = simplexml_load_string($this->_getFromZipArchive($zip, $chartEntryRef), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
|
|
|
$chartElements = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, $chartEntryRef)), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
|
|
|
$objChart = PHPExcel_Reader_Excel2007_Chart::readChart($chartElements,basename($chartEntryRef,'.xml'));
|
|
|
|
$objChart = PHPExcel_Reader_Excel2007_Chart::readChart($chartElements,basename($chartEntryRef,'.xml'));
|
|
|
|
|
|
|
|
|
|
|
|
// echo 'Chart ',$chartEntryRef,'<br />';
|
|
|
|
// echo 'Chart ',$chartEntryRef,'<br />';
|
|
|
@ -2005,7 +2005,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
$dataRels = $this->_getFromZipArchive($zip, $pathRels);
|
|
|
|
$dataRels = $this->_getFromZipArchive($zip, $pathRels);
|
|
|
|
if ($dataRels) {
|
|
|
|
if ($dataRels) {
|
|
|
|
// exists and not empty if the ribbon have some pictures (other than internal MSO)
|
|
|
|
// exists and not empty if the ribbon have some pictures (other than internal MSO)
|
|
|
|
$UIRels = simplexml_load_string($dataRels, 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
|
|
|
$UIRels = simplexml_load_string($this->securityScan($dataRels), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
|
|
|
if ($UIRels) {
|
|
|
|
if ($UIRels) {
|
|
|
|
// we need to save id and target to avoid parsing customUI.xml and "guess" if it's a pseudo callback who load the image
|
|
|
|
// we need to save id and target to avoid parsing customUI.xml and "guess" if it's a pseudo callback who load the image
|
|
|
|
foreach ($UIRels->Relationship as $ele) {
|
|
|
|
foreach ($UIRels->Relationship as $ele) {
|
|
|
|