<?php
//************************************************************************/
//*                    PHP-NUKE: Web Portal System                       */
//*       MAXIMUS ITALIA NEWS -  © Copyright 2006 PHPNVKEMAXIMVS         */
/*                block-Max_it_News.php - vert. - v.01                   */
/*     Copyright (c) 2005 by piermin - http://www.phpnukemaximus.it      */
/*************************************************************************/
/* For Php-Nuke v.7.7 and MAXIMUS CMS - This program is free software.   */
/* You can redistribute it and/or modify it under the terms of the GNU   */
/* General Public License as published by the Free Software Foundation.  */
/*************************************************************************/
defined('MAXIMUS') or die ('Access denied block Max It News MAXIMUS directly...');

    $url = "http://www.phpnukemaximus.it/maxit/backend_news_big.php";
	$rdf = parse_url($url);
	$fp = @fsockopen($rdf['host'], 80, $errno, $errstr, 15);
	if ($fp) {
	    fputs($fp, "GET " . $rdf['path'] . "?" . $rdf['query'] . " HTTP/1.0\r\n");
	    fputs($fp, "HOST: " . $rdf['host'] . "\r\n\r\n");
	    $string	= "";
		$content = "<Marquee Behavior=\"Scroll\" loop=\"-1\" Direction=\"up\" width=\"144\" Height=\"150\" bgcolor=\"#FBFFFB\" ScrollAmount=\"1\" ScrollDelay=\"50\" onMouseOver=\"this.stop()\" onMouseOut=\"this.start()\"><br />";
	    while(!feof($fp)) {
	    	$pagetext = fgets($fp,300);
	    	$string .= chop($pagetext);
	    }
	    fputs($fp,"Connection: close\r\n\r\n");
	    fclose($fp);
	    $items = explode("</item>",$string);
	    for ($i=0;$i<11;$i++) {
		$link = ereg_replace(".*<link>","",$items[$i]);
		$link = ereg_replace("</link>.*","",$link);
		$title2 = ereg_replace(".*<title>","",$items[$i]);
		$title2 = ereg_replace("</title>.*","",$title2);
		$title2 = stripslashes($title2);
		$description1 = ereg_replace(".*<description>","",$items[$i]);
		$description1 = ereg_replace("</description>.*","",$description1);
		$description1 = stripslashes($description1);
		$description1 = substr($description1, 37,-13);
		$pubDate = ereg_replace(".*<pubDate>","",$items[$i]);
		$pubDate = ereg_replace("</pubDate>.*","",$pubDate);
		$pubDateg =substr($pubDate,8,2);
		$pubDatem =substr($pubDate,4,4);
		$pubDatea =substr($pubDate,0,4);
		$pubDateo =substr($pubDate,11,5);
		$link2 = "$pubDateo&nbsp;$pubDateg$pubDatem$pubDatea";
		if (strcmp($link,$title2) AND $items[$i] != "") {
			$cont = 1;
			$content .= "&nbsp;<font color=\"#c00000\"><b>&#149;</b></font>&nbsp;<a href=\"$link\" target=\"_blank\" title=\"Leggi questo Articolo\">$link2<br /><b>$title2</b><br />$description1</a><hr size=\"1\"></hr>\n";
		}
	}
}
$siteurl = ereg_replace("http://","",$url);
$siteurl = explode("/",$siteurl);
if (($cont == 1) OR ($content != "")) {
	$content .= "</marquee><br />";
	$content .= "<table border=\"1\" cellpadding=\"0\" style=\"border-collapse: collapse\" id=\"table1\" width=\"100%\"><tr><td>";
	$content .= "<center><a href=\"http://www.phpnukemaximus.it\" target=\"_blank\" title=\"Fed RSS modified for PHPNVKEMAXIMVS by Piermin\">© PHP-NVKEMAXIMVS</a></center></td></tr></table>";
} elseif (($cont == 0) OR ($content == "")) {
	$content = "<div align=\"center\">Sito al momento<br />non operativo</div>";
}