

Czy ktos moze mi powiedziec co jest nie tak z tym skryptem??
<?php $minutes = 30; //How often to update the feed. 0 indicates that feed updates every time it is cal
led (heavy strain on bandwidth & server) $filename = 'rssCache/'; $default_url = "http://www.aarondunlap.com/rss.php?mode=hl"; //URL for the RSS/XML feed you're subscribing to. $default_displayname = "|| aarondunlap.com ||"; //Title to appear before headlines. Should be feed-specific $default_number = 5; //How many headlines to display. If you set it higher than the ammount of headline
s, it will stop there $default_target = _blank; //Target for headline links. Options: "_self" and "_blank" $autoupdate = 0; $default_trunc = FALSE; $default_delim = FALSE; #XXXXXXXXXXXXXXXXXXXXXXXXXX # Everything below is functional code. # You should not change it unless you know what you're doing, # and even if you do know what you're doing, are you sure you're # awake enough to do it? Maybe take a nap, rethink things, try again. #XXXXXXXXXXXXXXXXXXXXXXXXXX $version = 1.482; //If these variables aren't declared already, use defaults. // if (!isset($displayname)) { $displayname = $default_displayname; } //In-URL definitions. Cannot be used for including, but it works great for testing. $basefile = $filename; $versionfile = $filename."updatelog.htm"; //File for update attempt log #========================== # Check the modify time of the htm file for this feed, and see if it's too new to reload the feed. # If the file is too new, it loads the htm file. This stops the script from cons
tantly pulling the feed. #========================== include $filename; //echo "<br><i><span class="updated">Updated $time minutes ago.</span></i>"; //Include "minutes ago" after output. echo "<br><i><span class="updated">Aktualizowane $time minut temu.</span></i>"; //Include "minutes ago" after output. #========================== # If we're down here, it means that the feed needs to be reloaded. #========================== } $rssData1=$rssData; #========================== # Feed parsing dla nazwy #========================== $tag = "channel"; $rssData1 = chop($rssData1); // Strip any whitespace from the end of the string $rssData1 = ereg_replace("[r,n]", "", $rssData1); //Clear line breaks $rssData1 = strstr($rssData1,"<channel>"); //Remove everything before <item>. #========================== # Wyciagamy nazwe kanalu #========================== $rssData1 = str_replace("<channel>","", $rssData1); //Remove <item> itself $rssData1 = str_replace("<title>","", $rssData1); //Remove <item> itself $rssData1 = urldecode($rssData1); //Replace any silly %20-type characters with their readable replacement. $rssData1 = str_replace(strstr($rssData1,"</title>"),"",$rssData1); // Remove </title> and anything after it $default_displayname = $rssData1; //jak nie zostala zdefiniowana inna nazwa to podstawiamy nazwe kanalu if (!isset($displayname)) { $displayname = $default_displayname; } #========================== # Feed parsing #========================== $tag = "item "; $rssData = preg_replace("/<" . $tag . "(.|s)*?>/","<item>",$rssData); $rssData = chop($rssData); // Strip any whitespace from the end of the string $rssData = ereg_replace("[r,n]", "", $rssData); //Clear line breaks $rssData = strstr($rssData,"<item>"); //Remove everything before <item>. #========================== # Strip specific tags and their content from the feed, to lighten the strain on
the processor. # Currently, only the <description></description> tags are stripped, we don't need them and sometimes # they are REALLY long, getting rid of them now makes it easier to parse later. #========================== $tags_and_content_to_strip = Array("description"); foreach ($tags_and_content_to_strip as $tag) { $rssData = preg_replace("/<" . $tag . ">(.|s)*?</" . $tag . ">/","",$rssData); } $rssData = str_replace("<item>","", $rssData); //Remove <item> itself $rssData = urldecode($rssData); //Replace any silly %20-type characters with their readable replacement. $rssData = str_replace(strstr("</channel>",$rssData),"",$rssData); $rssArray = explode("</item>",$rssData); //Creates an Array from all the headlines $title = array(); $link = array(); #========================== # This loop creates an array for links and another for titles. #========================== $x = 0; while($x < $number) { $link[$x] = strstr($rssArray[$x],"<link>"); //Remove everything before <link> $link[$x] = ereg_replace("<link>","",$link[$x]); $link[$x] = str_replace(strstr($link[$x],"</link>"),"",$link[$x]); $link[$x] = trim($link[$x]); $title[$x] = strstr($rssArray[$x],"<title>"); $title[$x] = ereg_replace("<title>","",$title[$x]); // Remove the leading <title> tags from the selected headline $title[$x] = str_replace(strstr($title[$x],"</title>"),"",$title[$x]); // Remove </title> and anything after it $title[$x] = trim($title[$x]); if ($trunc != FALSE) { $title[$x] = str_replace(substr($title[$x],$trunc),"",$title[$x]); } if ($delim != FALSE) { $title[$x] = str_replace(strstr($title[$x],$delim),"",$title[$x]); } if ($title[$x] == "") { $number = $x; break; } //If there are no more headlines, reset $number to the max. $x++; } #========================== # Writing the file #========================== $fp = fopen($filename, "w+"); $x=0; fwrite($fp,"<b><span class="displayname">$displayname</span></b> n"); //Write the displayname to the file while ($x < $number) { //This loop writes each line individualy. fwrite($fp,"<br>n-<a class="headlinellink" target="$target" href="$link[$x]">$title[$x]</a>"); $x++; } fclose($fp); include $filename; //wyswietlenie kanalu echo "<br><i><span class="updated">Live.</span></i>"; } else { # Error handling: echo "<b>Could not connect to $url. </b>"; }