<?php
	require_once( $GLOBALS["site_root"] . "/includes/widgets/Widget.inc.php" );

	class RSS extends Widget {
		protected $aChannel = array();
		protected $aItems = array();

		public function __construct( $id = "RSS" , $parent = null ) {
			$this->addMediaDirectory( $GLOBALS["site_root"] , $GLOBALS["site_www"] , "design/rp/","rss/");
			parent::__construct( $id , $parent );
			$this->setParam("language",$GLOBALS["language"]);

			$this->aChannel["name"]="RSS";
			$this->aChannel["self"]=sprintf( "http://%s%s" , $_SERVER["SERVER_NAME"] , $_SERVER["REQUEST_URI"] );
			$this->aChannel["link"]=sprintf( "http://%s/" , $_SERVER["SERVER_NAME"] );
			$this->aChannel["description"]="description";
			$this->aChannel["pubdate"]=time();
			$this->aChannel["lastbuilddate"]=time();
			switch ($GLOBALS["language"]) {
			case "hu":
				$g="fordit.hu";
				$l="hu-HU";
				break;
			case "en":
				$g="hungarian-translation.hu";
				$l="en-GB";
				break;
			}
			$this->aChannel["generator"]=$g;
			$this->aChannel["language"]=$l;
		}

		public function render() {
			if ($this->sRendered) return $this->sRendered;
			// ide jon az rss header
			header( "Content-Type: application/xml" );
			$this->setParam( "channel" , $this->aChannel );
			$this->setParam( "items" , $this->aItems );
			return parent::render();
		}
	}
?>
