thomascube
2008-12-24 230f944bf62f141f47c021dbfe6cc3d07b74a76d
program/include/rcube_shared.inc
@@ -37,7 +37,7 @@
  header("Expires: ".gmdate("D, d M Y H:i:s")." GMT");
  header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
  header("Cache-Control: private, no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
  header("Cache-Control: private, must-revalidate, post-check=0, pre-check=0");
  header("Pragma: no-cache");
  
  // We need to set the following headers to make downloads work using IE in HTTPS mode.
@@ -179,7 +179,7 @@
      return $brackets{0} . implode(',', $pairs) . $brackets{1};
    }
  }
  else if (is_numeric($var) && strval(intval($var)) === strval($var))
  else if (!is_string($var) && strval(intval($var)) === strval($var))
    return $var;
  else if (is_bool($var))
    return $var ? '1' : '0';
@@ -209,8 +209,9 @@
 */
function in_array_nocase($needle, $haystack)
{
  $needle = rc_strtolower($needle);
  foreach ($haystack as $value)
    if (strtolower($needle)===strtolower($value))
    if ($needle===rc_strtolower($value))
      return true;
  
  return false;
@@ -358,6 +359,17 @@
    return mb_strtolower($str);
  else
    return strtolower($str);
}
/**
 * Wrapper function for strtoupper
 */
function rc_strtoupper($str)
{
  if (function_exists('mb_strtoupper'))
    return mb_strtoupper($str);
  else
    return strtoupper($str);
}
/**
@@ -574,12 +586,12 @@
    // FIXME: the order is important, because sometimes 
    // iso string is detected as euc-jp and etc.
    $enc = array(
   'SJIS', 'BIG5', 'GB2312', 'UTF-8',
   'ISO-8859-1', 'ISO-8859-2', 'ISO-8859-3', 'ISO-8859-4',
   'ISO-8859-5', 'ISO-8859-6', 'ISO-8859-7', 'ISO-8859-8', 'ISO-8859-9',
   'ISO-8859-10', 'ISO-8859-13', 'ISO-8859-14', 'ISO-8859-15', 'ISO-8859-16',
   'WINDOWS-1252', 'WINDOWS-1251', 'EUC-JP', 'EUC-TW', 'KOI8-R',
   'ISO-2022-KR', 'ISO-2022-JP'
      'UTF-8', 'SJIS', 'BIG5', 'GB2312',
      'ISO-8859-1', 'ISO-8859-2', 'ISO-8859-3', 'ISO-8859-4',
      'ISO-8859-5', 'ISO-8859-6', 'ISO-8859-7', 'ISO-8859-8', 'ISO-8859-9',
      'ISO-8859-10', 'ISO-8859-13', 'ISO-8859-14', 'ISO-8859-15', 'ISO-8859-16',
      'WINDOWS-1252', 'WINDOWS-1251', 'EUC-JP', 'EUC-TW', 'KOI8-R',
      'ISO-2022-KR', 'ISO-2022-JP'
    );
    $result = mb_detect_encoding($string, join(',', $enc));