|
From: Ruediger H. <hae...@us...> - 2005-08-30 19:49:59
|
Update of /cvsroot/pn-commerce/pn-commerce In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7460 Modified Files: pnadmin.php Log Message: fix: make xml export working again Index: pnadmin.php =================================================================== RCS file: /cvsroot/pn-commerce/pn-commerce/pnadmin.php,v retrieving revision 1.268 retrieving revision 1.269 diff -C2 -d -r1.268 -r1.269 *** pnadmin.php 21 Aug 2005 13:28:04 -0000 1.268 --- pnadmin.php 30 Aug 2005 19:49:51 -0000 1.269 *************** *** 1812,1893 **** } ! function array2xml($items, $xml, $parent = '') { - $arrays = array(); ! // first process all elementary types, treat them as xml attributes, ! // not as xml tags. ! foreach($items as $key => $item) { ! if (is_array($item)) { ! // we need to remember arrays and process them at the end ! $arrays[$key] = $item; ! } ! else { - $item = str_replace( - array('&', '<', '>', '"'), - array('&', '<', '>', '"'), - $item); if (ereg('^[0-9]', $key)) { ! // Special case for arrays items indexed with integers: ! // xml attributenames must not start with a digit. ! // Make tags of them. ! $xml .= '>' . "\r\n" . '<' . $parent . '_row id="' . $key . '" value="' . $item . '" /'; } else { ! $xml .= $key . '="' . $item .'" '; } ! } ! } // foreach(elementary data types... ! $xml .= '>' . "\r\n"; ! ! // all elementary types have been processed, now continue with the ! // arrays: ! foreach($arrays as $key => $item) ! { ! if (ereg('^[0-9]', $key)) ! { ! // special case for arrays just indexed with integers: ! // xml tagnames must not start with a digit ! $startTag = '<' . $parent . '_row id="' . $key . '" '; ! $endTag = '</' . $parent . '_row>' . "\r\n"; ! } ! else ! { ! // named keys / associative arrays ! $startTag = '<' . $key . ' '; ! $endTag = '</' . $key . '>' . "\r\n"; ! } ! ! $xml .= $startTag; ! // recursively call this function ! array2xml($item, &$xml, $key); ! $xml .= $endTag; ! } // foeach(arrays... ! } // function array2xml ! ! ! if (!pnModAPILoad('pncommerce', 'admin')) ! { ! return showerrorpage("unable to load pnadminapi", __FILE__, __LINE__); ! } ! if (!pnModAPILoad('pncommerce', 'user')) ! { ! return showerrorpage("unable to load pnuserapi", __FILE__, __LINE__); ! } - /* - * export_table_send - * - */ - function pncommerce_admin_export_table_send() - { pncloadapi('admin', __FILE__, __LINE__); pncloadapi('user', __FILE__, __LINE__); ! if (!pnSecAuthAction(0, 'pncommerce::config', '::', ACCESS_ADMIN)) { --- 1812,1886 ---- } ! /* ! * export_table_send ! * ! */ ! function pncommerce_admin_export_table_send() { ! // local function, don't make it externally callable! ! function array2xml($items, $xml, $parent = '') { ! $arrays = array(); ! ! // first process all elementary types, treat them as xml attributes, ! // not as xml tags. ! foreach($items as $key => $item) { ! if (is_array($item)) ! { ! // we need to remember arrays and will process them at the end ! $arrays[$key] = $item; ! } ! else ! { ! $item = str_replace( ! array('&', '<', '>', '"'), ! array('&', '<', '>', '"'), ! $item); ! if (ereg('^[0-9]', $key)) ! { ! // Special case for array items indexed with integers: ! // xml attributenames must not start with a digit. ! // Make tags of them. ! $xml .= '>' . "\r\n" . '<' . $parent . '_row id="' . $key . '" value="' . $item . '" /'; ! } ! else ! { ! $xml .= $key . '="' . $item .'" '; ! } ! } ! } // foreach(elementary data types... ! $xml .= '>' . "\r\n"; ! ! // all elementary types have been processed, now continue with the ! // arrays: ! foreach($arrays as $key => $item) { if (ereg('^[0-9]', $key)) { ! // special case for arrays just indexed with integers: ! // xml tagnames must not start with a digit ! $startTag = '<' . $parent . '_row id="' . $key . '" '; ! $endTag = '</' . $parent . '_row>' . "\r\n"; } else { ! // named keys / associative arrays ! $startTag = '<' . $key . ' '; ! $endTag = '</' . $key . '>' . "\r\n"; } ! ! $xml .= $startTag; ! // recursively call this function ! array2xml($item, &$xml, $key); ! $xml .= $endTag; ! } // foeach(arrays... ! } // function array2xml ! pncloadapi('admin', __FILE__, __LINE__); pncloadapi('user', __FILE__, __LINE__); ! if (!pnSecAuthAction(0, 'pncommerce::config', '::', ACCESS_ADMIN)) { *************** *** 1968,1972 **** $col=$tablecolumnas[$k]; } ! // fix for incorrect serialized data $line[$k] = str_replace('\\"', '"', $line[$k]); // end of fix --- 1961,1965 ---- $col=$tablecolumnas[$k]; } ! // fix for incorrectly serialized data $line[$k] = str_replace('\\"', '"', $line[$k]); // end of fix *************** *** 1984,1988 **** else { ! // Array: just open tag, array items will be // added as attributes $dump_buffer .="<".$col . " "; --- 1977,1981 ---- else { ! // Array: just open tag, array items will be // added as attributes $dump_buffer .="<".$col . " "; *************** *** 1995,2000 **** $dump_buffer .="<".$col.">"; $line[$k] = str_replace( ! array('<', '>', '&' , '"'), ! array('<', '>', '&', '"'), $line[$k]); $dump_buffer .= $line[$k]; --- 1988,1993 ---- $dump_buffer .="<".$col.">"; $line[$k] = str_replace( ! array('<', '>', '&' , '"'), ! array('<', '>', '&', '"'), $line[$k]); $dump_buffer .= $line[$k]; |