Location: PHPKode > projects > TVEz - Media Library > tvez-0.2.1/html/version/release_check.php
<?php
	require "../shared/session.php";
	require "../../config/config_file.php";	
	require "../locale/localize.php";
	$TRANSLATED_TEXT = get_translation("../locale");
	require "../themes/theme.php";
	$MYTHEME = get_theme();
	require "../shared/http_request.php";
?>

<HTML>
 <HEAD>
<?php
   echo "<link rel='stylesheet' type='text/css' href='../themes/theme.css.php?theme=".$MYTHEME."'>";
?>

 </HEAD>
 <BODY>
<center>
<?php
	# Get the current version
	$l = fopen("version.txt", "r");
	$version = fgets($l,80);
	fclose($l);
	$version = chop($version);
	// let's deal with warnings and errors ourselves
	$isError = false;
	function myErrorHandler($errno, $errstr, $errfile, $errline) {
		global $isError;
		if (! $isError) {
			echo "<b>".localize_string("Could not check for updates").".</b><br><br>";
			echo "<span class=\"warning\">".localize_string("The SourceForge webserver might be down")."...<br>";
			echo localize_string("or you do not have an active internet connection").".</span><br>";
			$isError = true;
		}
	}
	$old_error_handler = set_error_handler("myErrorHandler");
if ($CHECK_FOR_UPDATES) {
	$uaenc = urlencode($_SERVER['HTTP_USER_AGENT']);
	# Get the latest available version
	if ($h = http_request("tvez.sf.net",80,5,"/version/version.php?version=$version&ua=$uaenc")) {

		list($tvezVersion,$download,$update) = split("\n",$h);

		$newversion = preg_replace("/\./", "", $tvezVersion);
		$thisversion = preg_replace("/\./", "", $version);
		# Print the update info
		echo "<b>TVEz ".localize_string("Version")." $version</b><br><br>";
		if ($newversion > $thisversion) {
			echo localize_string("TVEz Version ==1== is available.", $tvezVersion);
			echo " <a href=\"$download\" target=_blank>".localize_string("Download")."</a>";
			echo "<br>$update";
		}
	}
	else {
		myErrorHandler("","","","");
	}
}
else {
        echo "<b>TVEz ".localize_string("Version")." $version</b>";
}
?>
 </center>
 </BODY>
</HTML>
Return current item: TVEz - Media Library