From 2d649c0ea4311df7fc4e3a72cf91684552b3e88b Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Tue, 26 Nov 2013 20:16:09 +0100 Subject: [PATCH] Fixed multiple issues --- .../system/exporter/IPB3xExporter.class.php | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/files/lib/system/exporter/IPB3xExporter.class.php b/files/lib/system/exporter/IPB3xExporter.class.php index 8b726ae..e611a9b 100644 --- a/files/lib/system/exporter/IPB3xExporter.class.php +++ b/files/lib/system/exporter/IPB3xExporter.class.php @@ -417,7 +417,7 @@ class IPB3xExporter extends AbstractExporter { 'objectID' => $row['status_member_id'], 'userID' => $row['status_author_id'], 'username' => $row['status_creator'], - 'message' => $row['status_content'], + 'message' => self::fixStatusUpdate($row['status_content']), 'time' => $row['status_date'] )); } @@ -452,7 +452,7 @@ class IPB3xExporter extends AbstractExporter { 'time' => $row['reply_date'], 'userID' => $row['reply_member_id'], 'username' => $row['name'], - 'message' => $row['reply_content'], + 'message' => self::fixStatusUpdate($row['reply_content']), )); } } @@ -693,12 +693,12 @@ class IPB3xExporter extends AbstractExporter { $sql = "SELECT topics.* FROM ".$this->databasePrefix."topics topics ".$conditionBuilder; - $statement = $this->database->prepareStatement($sql, $limit, $offset); + $statement = $this->database->prepareStatement($sql); $statement->execute($conditionBuilder->getParameters()); while ($row = $statement->fetchArray()) { $data = array( 'boardID' => $row['forum_id'], - 'topic' => $row['title'], + 'topic' => StringUtil::decodeHTML($row['title']), 'time' => $row['start_date'], 'userID' => $row['starter_id'], 'username' => $row['starter_name'], @@ -824,7 +824,7 @@ class IPB3xExporter extends AbstractExporter { 'question' => $data[1]['question'], 'time' => $row['start_date'], 'isPublic' => $row['poll_view_voters'], - 'maxVotes' => ($data[1]['multi'] ? count($data[1]['choice']) : 1), + 'maxVotes' => (!empty($data[1]['multi']) ? count($data[1]['choice']) : 1), 'votes' => $row['votes'] )); @@ -1010,18 +1010,18 @@ class IPB3xExporter extends AbstractExporter { $string = str_ireplace('', '[/s]', $string); // font face - $string = preg_replace_callback('~(.*?)~i', function ($matches) { + $string = preg_replace_callback('~(.*?)~is', function ($matches) { return "[font='".str_replace(";", '', str_replace("'", '', $matches[1]))."']".$matches[2]."[/font]"; }, $string); // font size - $string = preg_replace('~(.*?)~i', '[size=\\1]\\2[/size]', $string); + $string = preg_replace('~(.*?)~is', '[size=\\1]\\2[/size]', $string); // font color - $string = preg_replace('~(.*?)~i', '[color=\\1]\\2[/color]', $string); + $string = preg_replace('~(.*?)~is', '[color=\\1]\\2[/color]', $string); // align - $string = preg_replace('~

(.*?)

~i', '[align=\\1]\\2[/align]', $string); + $string = preg_replace('~

(.*?)

~is', '[align=\\1]\\2[/align]', $string); // list $string = str_ireplace('', '[/list]', $string); @@ -1057,4 +1057,15 @@ class IPB3xExporter extends AbstractExporter { return $string; } + + private static function fixStatusUpdate($string) { + //
to newline + $string = str_ireplace('
', "\n", $string); + $string = str_ireplace('
', "\n", $string); + + // decode html entities + $string = StringUtil::decodeHTML($string); + + return $string; + } } \ No newline at end of file -- 2.20.1