Wrong parameter used or absent: ".$name.""; exit; } function debugexit_print( $var ) { echo "
";
	print_r( $var );
	echo "
"; exit; } function get_user_locale() { global $available_locales, $default_locale; if( isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ) { $requested_langs = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']); foreach( $requested_langs as $requested_lang) { if( strlen($requested_lang) > 2 ) $requested_lang = substr($requested_lang,0,2); if( in_array($requested_lang,$available_locales) ) return $requested_lang; } } if( in_array($default_locale,$available_locales) ) return $default_locale; return 'en'; } function get_locale() { global $available_locales; $locale = verifyparam("locale", "/^\w\w$/", ""); if( $locale && in_array($locale,$available_locales) ) { $_SESSION['locale'] = $locale; } else if( isset($_SESSION['locale']) ){ $locale = $_SESSION['locale']; } if( !$locale || !in_array($locale,$available_locales) ) $locale = get_user_locale(); return $locale; } function set_locale($locale) { global $current_locale, $available_locales; if( in_array($locale,$available_locales) ) $current_locale = $locale; } $current_locale = get_locale(); $messages = array(); function load_messages($locale) { global $messages; $hash = array(); $fp = fopen(dirname(__FILE__)."/../view/properties_$locale","r"); while (!feof($fp)) { $line = fgets($fp, 4096); $list = split("=", $line, 2 ); if( isset($list[1]) ) { $hash[$list[0]] = str_replace("\\n", "\n",trim($list[1])); } } fclose($fp); $messages[$locale] = $hash; } function getstring_($text,$locale) { global $messages; if(!isset($messages[$locale])) load_messages($locale); $localized = $messages[$locale]; if( isset($localized[$text]) ) return $localized[$text]; return "!".$text; } function getstring($text) { global $current_locale; return getstring_($text,$current_locale); } function getstring2_($text,$params,$locale) { $string = getstring_($text,$locale); for( $i = 0; $i < count($params); $i++ ) { $string = str_replace("{".$i."}", $params[$i], $string); } return $string; } function getstring2($text,$params) { global $current_locale; return getstring2_($text,$params,$current_locale); } function connect() { global $mysqlhost, $mysqllogin, $mysqlpass, $mysqldb, $dbencoding; $link = mysql_connect($mysqlhost,$mysqllogin ,$mysqlpass ) or die('Could not connect: ' . mysql_error()); mysql_select_db($mysqldb) or die('Could not select database'); mysql_query("SET character set $dbencoding", $link); return $link; } function perform_query($query,$link) { mysql_query($query,$link) or die(' Query failed: ' . mysql_error().": ".$query); } function select_one_row($query,$link) { $result = mysql_query($query,$link) or die(' Query failed: ' . mysql_error().": ".$query); $line = mysql_fetch_array($result, MYSQL_ASSOC); mysql_free_result($result); return $line; } function start_xml_output() { header("Cache-Control: no-store, no-cache, must-revalidate"); header("Content-type: text/xml"); echo ""; } function start_html_output() { global $output_charset; header("Cache-Control: no-store, no-cache, must-revalidate"); header("Content-type: text/html".(isset($output_charset)?"; charset=".$output_charset:"")); } function escape_with_cdata($text) { return "", "]]>]]>"; } function form_value($key) { global $page; if( isset($page) && isset($page["form$key"]) ) return $page["form$key"]; return ""; } function no_field($key) { return getstring2("errors.required",array(getstring($key))); } function get_popup($href,$message,$title,$wndName,$options) { return "$message"; } function get_image($href,$width,$height) { if( $width != 0 && $height != 0 ) return ""; return ""; } function get_gifimage_size($file) { if( function_exists('gd_info')) { $info = gd_info(); if( isset($info['GIF Read Support']) && $info['GIF Read Support'] ) { $img = @imagecreatefromgif($file); if($img) { $height = imagesy($img); $width = imagesx($img); imagedestroy($img); return array($width,$height); } } } return array(0,0); } function add_params($servlet, $params) { $infix = '?'; if( strstr($servlet,$infix) !== FALSE ) $infix = '&'; foreach($params as $k => $v) { $servlet .= $infix.$k."=".$v; $infix = '&'; } return $servlet; } function div($a,$b) { return ($a-($a % $b)) / $b; } ?>