From 1d2d3003e920c9ef2c543436e9512ba78441d2ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Fri, 18 Jun 2010 10:23:02 +0000 Subject: [PATCH] Unflow Export enthaelt keine & mehr --- include/functions.inc.php | 21 +++++++++++++++++++++ vilesci/personen/uniflow.csv.php | 3 ++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/include/functions.inc.php b/include/functions.inc.php index e60ebef0b..88cd5c462 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -739,4 +739,25 @@ function isint( $mixed ) return ( preg_match( '/^\d*$/' , $mixed) == 1 ); } +/** + * Multibyte String Replace + * + * @param $needle + * @param $replacement + * @param $haystack + * @return string + */ +function mb_str_replace( $needle, $replacement, $haystack ) +{ + $needle_len = mb_strlen($needle); + $pos = mb_strpos( $haystack, $needle); + while (!($pos ===false)) + { + $front = mb_substr( $haystack, 0, $pos ); + $back = mb_substr( $haystack, $pos + $needle_len); + $haystack = $front.$replacement.$back; + $pos = mb_strpos( $haystack, $needle); + } + return $haystack; +} ?> diff --git a/vilesci/personen/uniflow.csv.php b/vilesci/personen/uniflow.csv.php index fbb530e1e..0b4171072 100644 --- a/vilesci/personen/uniflow.csv.php +++ b/vilesci/personen/uniflow.csv.php @@ -26,6 +26,7 @@ require_once('../../config/vilesci.config.inc.php'); require_once('../../include/basis_db.class.php'); +require_once('../../include/functions.inc.php'); header("Content-Type: text/csv"); header("Content-Disposition: attachment; filename=uniflow.csv"); @@ -62,7 +63,7 @@ if($result = $db->db_query($qry)) { while($row = $db->db_fetch_object($result)) { - echo "$row->uid;$row->oe_kurzbz;$row->organisationseinheittyp_kurzbz $row->bezeichnung;1\n"; + echo mb_str_replace('&','und',"$row->uid;$row->oe_kurzbz;$row->organisationseinheittyp_kurzbz $row->bezeichnung;1\n"); } }