From c1a46151c9edc6fde4e662e1a3f644d34724eef5 Mon Sep 17 00:00:00 2001 From: CaMer0n Date: Thu, 10 Sep 2009 09:49:01 +0000 Subject: [PATCH] Export path mods --- e107_admin/db.php | 8 ++++++-- e107_handlers/xml_class.php | 25 ++++++++++++++++++++----- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/e107_admin/db.php b/e107_admin/db.php index 57322d1cf..9f776915e 100644 --- a/e107_admin/db.php +++ b/e107_admin/db.php @@ -9,8 +9,8 @@ * Administration - Database Utilities * * $Source: /cvs_backup/e107_0.8/e107_admin/db.php,v $ - * $Revision: 1.30 $ - * $Date: 2009-09-06 01:02:01 $ + * $Revision: 1.31 $ + * $Date: 2009-09-10 09:49:01 $ * $Author: e107coders $ * */ @@ -729,6 +729,10 @@ function exportXmlFile($prefs,$tables,$package=FALSE,$debug=FALSE) $xml->convertFilePaths = TRUE; $xml->filePathDestination = EXPORT_PATH; + $xml->filePathPrepend = array( + 'news_thumbnail' => "{e_IMAGE}newspost_images/" + ); + $desinationFolder = $tp->replaceConstants($xml->filePathDestination); diff --git a/e107_handlers/xml_class.php b/e107_handlers/xml_class.php index c0b8276ae..3c1f8045f 100644 --- a/e107_handlers/xml_class.php +++ b/e107_handlers/xml_class.php @@ -9,8 +9,8 @@ * Simple XML Parser * * $Source: /cvs_backup/e107_0.8/e107_handlers/xml_class.php,v $ - * $Revision: 1.23 $ - * $Date: 2009-09-06 01:02:01 $ + * $Revision: 1.24 $ + * $Date: 2009-09-10 09:49:01 $ * $Author: e107coders $ */ @@ -78,6 +78,10 @@ class xmlClass public $convertFileTypes = array("jpg","gif","png","jpeg"); + public $filePathPrepend = array(); + + public $filePathConvKeys = array(); + /** * Add root element to the result array @@ -144,8 +148,13 @@ class xmlClass * */ function __constructor() - { + { $this->reset(); + + if(count($this->filePathConversions)) + { + $this->filePathConvKeys = array_keys($this->filePathConversions); + } } /** @@ -563,10 +572,16 @@ class xmlClass /** * Process data values for XML file. If $this->convertFilePaths is TRUE, convert paths - see replaceFilePaths() * @param mixed $val + * @param string $key key for the current value. Used for exception processing. * @return mixed */ - private function e107ExportValue($val) + private function e107ExportValue($val,$key='') { + if($key && isset($this->filePathPrepend[$key])) + { + $val = $this->filePathPrepend[$key].$val; + } + if($this->convertFilePaths) { $types = implode("|",$this->convertFileTypes); @@ -633,7 +648,7 @@ class xmlClass $text .= "\t\t\n"; foreach($row as $key=>$val) { - $text .= "\t\t\t".$this->e107ExportValue($val)."\n"; + $text .= "\t\t\t".$this->e107ExportValue($val,$key)."\n"; } $text .= "\t\t\n";