Location: PHPKode > projects > TheoPlan > pm/language.inc
<?php
function Output($db, $pos, $text, $v1="", $v2="", $v3="", $v4="", $v5="", $v6="", $v7="", $v8="", $v9="", $v10="") {
	global $unum;
	global $language;
	$flag = false;

	if (!isset($db) || $db == -1) {
	   $db = OpenDB();
	   $flag = true;
	}

	if (!isset($unum) || $unum <= 0) {
	   $lang = $language;
	} else {
	   $query = "select mi_lang from mitarbeiter where mi_num = $unum";

	   if (!($result = QueryDB($db, $query)))
	      $lang = "ger";
	   else {
	      if (numrowsDB($result) > 0) {
	         $data = fetchDB($result, 0);
	         $lang = $data[0];
	      } else
	         $lang = $language;
	   }
	}

	$query = "select la_text from language where ";
	$query .= "la_tnum = $pos and la_lang = '$lang'";

	if (!($result = QueryDB($db, $query))) {
	   printf ($text, $v1, $v2, $v3, $v4, $v5, $v6, $v7, $v8, $v9, $v10);

	   if ($flag)
	      closeDB($db);

	   return;
	}

	if (numrowsDB($result) > 0) {
	   $data = fetchDB($result, 0);
	   printf ($data[0], $v1, $v2, $v3, $v4, $v5, $v6, $v7, $v8, $v9, $v10);
	} else
	   printf ($text, $v1, $v2, $v3, $v4, $v5, $v6, $v7, $v8, $v9, $v10);

	if ($flag)
	   closeDB($db);
}

function GetMessage($db, $pos, $text, $v1="", $v2="", $v3="", $v4="", $v5="", $v6="", $v7="", $v8="", $v9="", $v10="") {
	global $unum;
	global $language;
	$flag = false;

	if (!isset($db) || $db == -1) {
	   $db = OpenDB();
	   $flag = true;
	}

	if (!isset($unum) || $unum <= 0) {
	   $lang = $language;
	} else {
	   $query = "select mi_lang from mitarbeiter where mi_num = $unum";

	   if (!($result = QueryDB($db, $query)))
	      $lang = "ger";
	   else {
	      if (numrowsDB($result) > 0) {
	         $data = fetchDB($result, 0);
	         $lang = $data[0];
	      } else
	         $lang = $language;
	   }
	}

	$query = "select la_text from language where ";
	$query .= "la_tnum = $pos and la_lang = '$lang'";

	if (!($result = QueryDB($db, $query))) {
	   printf ($text, $v1, $v2, $v3, $v4, $v5, $v6, $v7, $v8, $v9, $v10);

	   if ($flag)
	      closeDB($db);

	   return sprintf ($text, $v1, $v2, $v3, $v4, $v5, $v6, $v7, $v8, $v9, $v10);
	}

	if (numrowsDB($result) > 0) {
	   $data = fetchDB($result, 0);
	   $out = sprintf ($data[0], $v1, $v2, $v3, $v4, $v5, $v6, $v7, $v8, $v9, $v10);
	} else
	   $out = sprintf ($text, $v1, $v2, $v3, $v4, $v5, $v6, $v7, $v8, $v9, $v10);

	if ($flag)
	   closeDB($db);

	return $out;
}

function GetMessageLang($db, $lang, $pos, $text, $v1="", $v2="", $v3="", $v4="", $v5="", $v6="", $v7="", $v8="", $v9="", $v10="") {
	global $unum;
	$flag = false;

	if (!isset($db) || $db == -1) {
	   $db = OpenDB();
	   $flag = true;
	}

	$query = "select la_text from language where ";
	$query .= "la_tnum = $pos and la_lang = '$lang'";

	if (!($result = QueryDB($db, $query))) {
	   printf ($text, $v1, $v2, $v3, $v4, $v5, $v6, $v7, $v8, $v9, $v10);

	   if ($flag)
	      closeDB($db);

	   return sprintf ($text, $v1, $v2, $v3, $v4, $v5, $v6, $v7, $v8, $v9, $v10);
	}

	if (numrowsDB($result) > 0) {
	   $data = fetchDB($result, 0);
	   $out = sprintf ($data[0], $v1, $v2, $v3, $v4, $v5, $v6, $v7, $v8, $v9, $v10);
	} else
	   $out = sprintf ($text, $v1, $v2, $v3, $v4, $v5, $v6, $v7, $v8, $v9, $v10);

	if ($flag)
	   closeDB($db);

	return $out;
}
?>
Return current item: TheoPlan