diff --git a/lib/settings.php b/lib/settings.php
index 98a107a..f9c5915 100644
--- a/lib/settings.php
+++ b/lib/settings.php
@@ -1,6 +1,6 @@
));
// Start a session if we haven't already
-if(!isset($_SESSION)) {session_start();}
+if(!isset($_SESSION)) {@session_start();}
// Logout if that's the action we're taking
if (isset($_GET['logout'])) {
@@ -63,18 +63,20 @@ function numClean($var) {
// returns a UTF8 based string with any UFT8 BOM removed
function toUTF8noBOM($string,$message) {
// Attempt to detect encoding
- $encType = mb_detect_encoding($string);
- // Get rid of any UTF-8 BOM
- $string = preg_replace('/\x{EF}\x{BB}\x{BF}/','',$string);
- // Test for any bad characters
- $teststring = $string;
- $teststringBroken = utf8_decode($teststring);
- $teststringConverted = iconv("UTF-8", "UTF-8//IGNORE", $teststringBroken);
- // If we have a matching length, UTF8 encode it
- if ($encType != "ASCII" && strlen($teststringConverted) == strlen($teststringBroken)) {
- $string = utf8_encode($string);
- if ($message) {
- echo "";
+ if (function_exists('mb_detect_encoding')) {
+ $encType = mb_detect_encoding($string);
+ // Get rid of any UTF-8 BOM
+ $string = preg_replace('/\x{EF}\x{BB}\x{BF}/','',$string);
+ // Test for any bad characters
+ $teststring = $string;
+ $teststringBroken = utf8_decode($teststring);
+ $teststringConverted = iconv("UTF-8", "UTF-8//IGNORE", $teststringBroken);
+ // If we have a matching length, UTF8 encode it
+ if ($encType != "ASCII" && strlen($teststringConverted) == strlen($teststringBroken)) {
+ $string = utf8_encode($string);
+ if ($message) {
+ echo "";
+ }
}
}
return $string;