1){ echo '

Error: There do not appear to be any entries in the specified range. Try the previous page.

'; }elseif(($entrynum==$displaynum or $page>1)){ echo '
'; if($page>2){echo ''.$firstlink.' - ';} //First page if($page>1){echo ''.$prevlink.'';} //Previous page if($entrynum==$displaynum and $page>1){echo ' - ';} //Divider between the two links if they're both displayed if($entrynum==$displaynum){echo ''.$nextlink.'';} //Next page echo '
'; } } } //Grab the RSS file from Warwick Blogs if(@$blogrss=file($wbrssurl) and $wbrssurl){ //A couple of variables to keep track of position in an entry $inentry=0; //Set to 1 when passing an and reset to 0 when passing an $indesc=0; //Set to 1 when "within" the entry's tags to just output the lines as is $entrynum=0; //To count entries to see if it's necessary to have a next page link $blogentries=array(); //Initialise the variable // // Go through each line // foreach($blogrss as $blogline){ //Identify if we're inside an entry if(strstr($blogline, "")){$inentry=1; $entrynum++; continue;} if(strstr($blogline, "")){$inentry=0; $tagnumber=0; continue;} //Extract details for entries and the blog itself if(!$inentry){ // // Blog // if(strstr($blogline, "")){$blogtitle=trim(strip_tags($blogline));} if(strstr($blogline, "<link>")){$bloglink=trim(strip_tags($blogline));} if(strstr($blogline, "<description>")){$blogdesc=trim(strip_tags($blogline));} }else{ // // Blog entries // if(strstr($blogline, "<title>")){$title=trim(strip_tags(str_replace("&", "&", str_replace(" by", "", $blogline)))); $blogentries["$title - $entrynum"]["title"]=str_replace(" _", " ", str_replace("_ ", " ", $title));} if(strstr($blogline, "")){$blogentries["$title - $entrynum"]["link"]=trim(strip_tags($blogline));} if(strstr($blogline, "")){$blogentries["$title - $entrynum"]["commenturl"]=trim(strip_tags($blogline));} if(strstr($blogline, "")){$blogentries["$title - $entrynum"]["guid"]=trim(strip_tags($blogline));} //Identify if in the description because it's not all on one line if(strstr($blogline, "")){$indesc=1;} if(strstr($blogline, "")){$indesc=2;} if($indesc){ $blogline=trim(strip_tags($blogline)); $blogline=str_replace("<", "<", $blogline); $blogline=str_replace(">", ">", $blogline); $blogline=str_replace("'", "'", $blogline); $blogline=str_replace(""", '"', $blogline); $blogline=str_replace("’", "'", $blogline); $blogline=str_replace("‘", "'", $blogline); $blogline=str_replace("“", '"', $blogline); $blogline=str_replace("”", '"', $blogline); $blogline=str_replace("…", "...", $blogline); $blogline=str_replace("–", "-", $blogline); $blogline=str_replace("&", "&", $blogline); $blogentries["$title - $entrynum"]["desc"].=$blogline; if($indesc==2){$indesc=0;} //Bodge because I realised - 12 years later - that it was missing the end off entries. Perhaps there used to be line breaks between the entry and the tags } if(strstr($blogline, "")){$blogentries["$title - $entrynum"]["time"]=strtotime(trim(strip_tags($blogline)));} if(strstr($blogline, "")){$blogentries["$title - $entrynum"]["author"]=trim(strip_tags($blogline));} if(strstr($blogline, "")){if(@($tagnumber)){$tagdelimiter=' ';}else{$tagdelimiter='';}$blogentries["$title - $entrynum"]["tags"].=$tagdelimiter.''; $tagnumber++;} if(strstr($blogline, "")){ $commentnum=trim(strip_tags($blogline)); if($commentnum=="0"){ $blogentries["$title - $entrynum"]["commentnum"]="No Comments"; }elseif($commentnum=="1"){ $blogentries["$title - $entrynum"]["commentnum"]="1 Comment"; }else{ $blogentries["$title - $entrynum"]["commentnum"]="$commentnum Comments"; } } } } if(@($blogsort==="title")){ //Sort the entries by title ksort($blogentries); }elseif(@($blogsort==="reverse")){ //Sort the entries in reverse order $blogentries=array_reverse($blogentries, true); }elseif(@($blogsort==="reverse title")){ //Sort the entries in reverse order by title krsort($blogentries); } // // Output the blog // if(!$wbmainfeed){ //Override blog details if the feed is not the main feed. if($zpagetitle){$blogtitle=$zpagetitle; $blogdesc=$zpagetitle;} $bloglink=explode("?", $wbrssurl); $bloglink=$bloglink[0]; } if($page>1){ //Append page number to main title for pages 2 and onwards $blogtitle.=' - Page '.$page.''; } if(@($blogdisplay=="custom")){ //Output nothing to allow external outputting }elseif(@($blogdisplay=="raw")){ //Dispay the "raw" $blogentries array echo '
$blogentries=array(
';
    foreach($blogentries as $arraytitle => $blogentry){
      echo '    '.$arraytitle.' => array(
';
      foreach($blogentry as $key => $value){
        echo '        '.$key.' => '.str_replace("<", "<", str_replace(">", ">", $value)).',
';
      }
      echo '    ),
';
    }
    echo ');
'; //End of "raw" display }elseif(@($blogdisplay=="list")){ //"List" display echo '
    '; foreach($blogentries as $blogentry){ echo '
  • '.$blogentry["title"].' - '.date("d M Y", $blogentry["time"]).'
  • '; } echo '
'; //End of "list" display }else{ //Default display echo '

'.$blogtitle.'

'; foreach($blogentries as $blogentry){ echo '

'.$blogentry["title"].'

'.$blogentry["desc"].'
Time: '.date("H:i:s", $blogentry["time"]).'
Date: '.date("D, d M Y", $blogentry["time"]).'
Tags: '.$blogentry["tags"].'
Comments: '.$blogentry["commentnum"].'
'; } blognextprev($entrynum, $page, $displaynum, $firstlink, $prevlink, $nextlink); //End of default display } } elseif(!$wbrssurl){ echo '

Error: The URL for an RSS feed has not been specified; cannot display feed.

'; } elseif(!@$blogrss=file($wbrssurl)){ echo '

Error: The RSS feed required to generate this page could not be accessed; it is possible that the remote server is down. Please try again later.

'; } else { echo '

Error: An unknown error has occured; the cause cannot be identified.

'; } //Copyright notice and WBG image if(@(!($blogdisplay=="custom"))){ echo '
Powered by Warwick Blogs Grabber
'; }else{ echo ' '; } //$variable=array( // key => "value", //); ?>