From 993fc0ad9595dd1d5d46358c07b94578558d00c1 Mon Sep 17 00:00:00 2001
From: Jacek Kowalski <Jacek@jacekk.info>
Date: Sat, 13 Feb 2016 00:40:27 +0000
Subject: [PATCH] [mod_lotto] Usunięcie gry Joker i dodanie Ekstra Pensji

---
 modules/30_rss.php |   37 ++++++++++++++++++++++++++-----------
 1 files changed, 26 insertions(+), 11 deletions(-)

diff --git a/modules/30_rss.php b/modules/30_rss.php
index 0293399..2a97629 100644
--- a/modules/30_rss.php
+++ b/modules/30_rss.php
@@ -164,23 +164,38 @@
 			}
 		}
 		
-		$rss = @simplexml_load_file('./data/rss/'.$arg.'.rss');
+		$rss = @simplexml_load_string(file_get_contents('./data/rss/'.$arg.'.rss'));
 		if(!$rss) {
 			GGapi::putText('Błąd przy przetwarzaniu kanału, przepraszamy.');
 			return FALSE;
 		}
 		
-		GGapi::putRichText(self::p($rss->channel->title), TRUE);
-		if($rss->channel->copyright) {
-			GGapi::putRichText("\n".self::p($rss->channel->copyright));
+		if($rss->entry) {
+			GGapi::putRichText(self::p($rss->title), TRUE);
+			
+			foreach($rss->entry as $item) {
+				GGapi::putRichText("\n\n".self::p($item->title), TRUE);
+				GGapi::putRichText("\n".self::p($item->summary, ($arg=='bash'))."\n".self::p($item->link['href']));
+			
+				if(GGapi::getLength() > 1700) {
+					return;
+				}
+			}
 		}
-		
-		foreach($rss->channel->item as $item) {
-			GGapi::putRichText("\n\n".self::p($item->title), TRUE);
-			GGapi::putRichText("\n".self::p($item->description, ($arg=='bash'))."\n".self::p($item->link));
-		
-			if(GGapi::getLength() > 1700) {
-				return;
+		else
+		{
+			GGapi::putRichText(self::p($rss->channel->title), TRUE);
+			if($rss->channel->copyright) {
+				GGapi::putRichText("\n".self::p($rss->channel->copyright));
+			}
+			
+			foreach($rss->channel->item as $item) {
+				GGapi::putRichText("\n\n".self::p($item->title), TRUE);
+				GGapi::putRichText("\n".self::p($item->description, ($arg=='bash'))."\n".self::p($item->link));
+			
+				if(GGapi::getLength() > 1700) {
+					return;
+				}
 			}
 		}
 	}

--
Gitblit v1.9.1