diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/Minz/ModelPdo.php | 6 | ||||
| -rw-r--r-- | lib/lib_rss.php | 8 |
2 files changed, 11 insertions, 3 deletions
diff --git a/lib/Minz/ModelPdo.php b/lib/Minz/ModelPdo.php index 6eb4881dc..ed88d58d1 100644 --- a/lib/Minz/ModelPdo.php +++ b/lib/Minz/ModelPdo.php @@ -28,13 +28,13 @@ class Minz_ModelPdo { if ($currentUser === null) { $currentUser = Minz_Session::param('currentUser'); } - if ($currentUser == '') { - throw new Minz_PDOConnectionException('Current user must not be empty!', '', Minz_Exception::ERROR); - } if ($currentPdo != null) { $this->pdo = $currentPdo; return; } + if ($currentUser == '') { + throw new Minz_PDOConnectionException('Current user must not be empty!', '', Minz_Exception::ERROR); + } if (self::$usesSharedPdo && self::$sharedPdo != null && ($currentUser == '' || $currentUser === self::$sharedCurrentUser)) { $this->pdo = self::$sharedPdo; diff --git a/lib/lib_rss.php b/lib/lib_rss.php index f4b5c68e6..137c7f2d5 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -81,6 +81,14 @@ function safe_ascii($text) { return filter_var($text, FILTER_DEFAULT, FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH); } +if (function_exists('mb_convert_encoding')) { + function safe_utf8($text) { return mb_convert_encoding($text, 'UTF-8', 'UTF-8'); } +} elseif (function_exists('iconv')) { + function safe_utf8($text) { return iconv('UTF-8', 'UTF-8//IGNORE', $text); } +} else { + function safe_utf8($text) { return $text; } +} + function escapeToUnicodeAlternative($text, $extended = true) { $text = htmlspecialchars_decode($text, ENT_QUOTES); |
