load_class: error loading file "'.$filename.'"';
		die();
	}
	// The mu_sort function is used to sort a multi-dimensional array.
	// It looks like the code example is taken from the PHP manual http://ca2.php.net/manual/en/function.sort.php
	function mu_sort($array, $key_sort) {
		$n = 0;
		if (!is_array($array) || count($array)==0)
			return array();
		$key_sorta = explode(",", $key_sort);
		$keys = array_keys($array[0]);
		for($m=0; $m < count($key_sorta); $m++) {
			$nkeys[$m] = trim($key_sorta[$m]);
		}
		$n += count($key_sorta);
		for($i=0; $i < count($keys); $i++) {
			if(!in_array($keys[$i], $key_sorta)) {
				$nkeys[$n] = $keys[$i];
				$n += "1";
			}
		}
		for($u=0;$u 0)) {
			$value = str_replace(",",".",$value);
			return floatval($value);
		}
		return null;
	}
	function stripslashes_deep($value) {
	    $value = is_array($value) ?
                array_map('stripslashes_deep', $value) :
                stripslashes($value);
    	return $value;
	}
	function &getConnection() {
        if (!isset($GLOBALS["_MDB2_CONNECTION"])) {
        	require_once('MDB2.php');
        	$mdb2 = MDB2::connect(DSN);
			if (is_a($mdb2, 'PEAR_Error')) {
    			die($mdb2->getMessage());
			}
			$mdb2->setOption('debug', true);
			$mdb2->setFetchMode(MDB2_FETCHMODE_ASSOC);
			
   			$GLOBALS["_MDB2_CONNECTION"] = $mdb2;
    	}
      	return $GLOBALS["_MDB2_CONNECTION"];
	}
	function closeConnection() {
		if (isset($GLOBALS["_DB_CONNECTION"])) {
			$GLOBALS["_DB_CONNECTION"]->close();
			unset($GLOBALS["_DB_CONNECTION"]);
		}
	}
function time_to_decimal($a) {
  $tmp = explode(":", $a);
  if($tmp[1]{0}=="0") $tmp[1] = $tmp[1]{1};
  $m = round($tmp[1]*100/60);
  if($m<10) $m = "0".$m;
  $time = $tmp[0].".".$m;
  return $time;
}
function sec_to_time_fmt_hm($sec)
{
  return sprintf("%d:%02d", $sec / 3600, $sec % 3600 / 60);
}
function magic_quotes_off()
{
  // if (get_magic_quotes_gpc()) { // This check is now done before calling this function.
    $_POST = array_map('stripslashes_deep', $_POST);
    $_GET = array_map('stripslashes_deep', $_GET);
    $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
  // }
}
// check_extension checks whether a required PHP extension is loaded and dies if not so.
function check_extension($ext)
{
  if (!extension_loaded($ext))
    die("PHP extension '{$ext}' is required but is not loaded. Read Time Tracker Install Guide for help.");
}
// isTrue is a helper function to return correct false for older config.php values defined as a string 'false'.
function isTrue($val)
{
  return ($val == false || $val === 'false') ? false : true;
}
// ttValidString is used to check user input to validate a string.
function ttValidString($val, $emptyValid = false)
{
  $val = trim($val);
  if (strlen($val) == 0 && !$emptyValid)
    return false;
    
  // String must not be XSS evil (to insert JavaScript).
  if (stristr($val, '