<?php
/*---------------------------------------------------+
| PHP-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright © 2002 - 2006 Nick Jones
| http://www.php-fusion.co.uk/
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------+
| Modified by PHP-Fusion SF Group
| Copyright © 2007 by SF
| http://www.rus-phpfusion.com/
+----------------------------------------------------*/

if (!defined("IN_FUSION")) { header("Location:../index.php"); exit; }
include LOCALE.LOCALESET."admin/version.php";

function upFusion()
{
  $url = "http://www.rus-phpfusion.com/checkver/check.txt";
  $url_p = @parse_url($url);
  $host = $url_p['host'];
  $port = isset($url_p['port']) ? $url_p['port'] : 80;

  $fp = @fsockopen($url_p['host'], $port, $errno, $errstr, 5);
  if(!$fp) return false;

  @fputs($fp, 'GET '.$url_p['path'].' HTTP/1.1'.chr(10));
  @fputs($fp, 'HOST: '.$url_p['host'].chr(10));
  @fputs($fp, 'Connection: close'.chr(10).chr(10));

  $response = @fgets($fp, 1024);
  $content = @fread($fp,1024);
  $content = preg_replace("#(.*?)text/plain(.*?)$#is","$2",$content);
  @fclose ($fp);

  if(preg_match("#404#",$response)) return false;
  else return trim($content);
}

@define(FUSIONVER, $settings['version']);

opentable($locale['ver_1']." ".FUSIONVER);
    if(function_exists('fsockopen'))
    {
      $version_new = upFusion();
      if($version_new == FUSIONVER)
      {
	  	$ausgabe = "<table><tr><td align='center'><img src=\"images/version.gif\"></td></tr>";
        $ausgabe .= "<tr><td align='center'><span style=\"font-weight: bold; color: #1bdc16;\">".$locale['ver_4'].": ".FUSIONVER."</span></td></tr></table>";
        $ausgabe .= "";
      } else {
        if (!empty($version_new)) 
        {
	$ausgabe = "<table width='100%'><tr><td align='center'><img src=\"images/version_old.gif\"></td></tr><tr><td align='center'>";
	$ausgabe .= "<span style=\"font-weight: bold; color: red;\">".$locale['ver_2'].": ".FUSIONVER."</span><br />";
	$ausgabe .= "<span style=\"font-weight: bold; color: #1bdc16;\">".$locale['ver_3'].": ".$version_new."</span><br />";
	$ausgabe .= "<span style=\"font-weight: bold; \">".$locale['ver_5'].": </span><a href=\"http://www.rus-phpfusion.com/index.php\" target=\"_blank\" title=\"www.rus-phpfusion.com\"><span style=\"font-weight: bold; \">www.rus-phpfusion.com</span></a>";
	$ausgabe .= "</td></tr></table>";
       }
      }
    } 
	if (empty($version_new)) {
	$ausgabe .= "<br />".$locale['ver_7']."!<br />";
	$ausgabe .= $locale['ver_6']." <a href=\"http://www.rus-phpfusion.com/index.php\" target=\"_blank\" title=\"www.rus-phpfusion.com\"><span style=\"font-weight: bold; \">www.rus-phpfusion.com</span></a><br /><br />";
    }

echo "<div align='left' cellpadding='0' cellspacing='1' width='100%'>".$ausgabe."</div>";

closetable();

?>