************************
// ********** Knozall Software, Inc ***********************
// ********** NLMAuto and NLMAuto Professional ***********************
// ********** http://www.knozall.com/ww2g/nlmauto.php ***********************
// ********** 7/28/2007 10:46:59 PM ***********************
//
// rss2html.php RSS feed to HTML webpage script
//
// Copyright 2004-2006 NotePage, Inc.
// http://www.feedforall.com
//
// This script may be used and modified freely for business or personal use
// This script may not be resold in any form
// This script may only be redistributed in its original form
//
//
// $Id: rss2html.php,v 2.53 2006/09/22 20:21:55 housley Exp $
//
//
// ==========================================================================
// Configuration options
// ==========================================================================
//
// Set the following variable useFopenURL to one if you want/need to use
// fopen() instead of CURL
$useFopenURL = 0;
//
//
// *************************************************************************
// *************************************************************************
// *********< WebWizard www.webwizdirect.com >************************
// *********< by 2Geckos Consulting, LLC >**********************************
// *********< Please contact us with any questions or comments >************
// *********< webwizdirect@2geckos.com >***************************************
// *************************************************************************
// *************************************************************************
// $XMLfilename and $TEMPLATEfilename are the only parameters that require
// modification. DO NOT INCLUDE WWW in the pathname
// *************************************************************************
// *************************************************************************
$XMLfilename = "nlanlmautowwd.xml";
$TEMPLATEfilename = "knozallweb.html";
// *************************************************************************
// *************************************************************************
// *************************************************************************
// *************************************************************************
//
//
// If XLMFILE is passed as part of the URL, XMLFILE=, then it will be used
// otherwise the the file below is used.
// If TEMPLATE is passed as part of the URL. TEMPLATE=, then it will be used
// otherwise the the file below is used.
//
// Since some feeds may have titles or descriptins in the feed or items that
// are longer then want fits in your HTML page it is possible to trim them
// with the following 4 variables. A values of 0 (ZERO) displays the full
// length.
// CAUTION: Do not limit a title or description that has HTML in it, the
// will not produce a valid HTML page.
$limitFeedTitleLength = 0; // Not limited, in the URL as FeedTitleLength=
$limitFeedDescriptionLength = 0; // Not limited, in the URL as FeedDescriptionLength=
$limitItemTitleLength = 0; // Not limited, in the URL as ItemTitleLength=
$limitItemDescriptionLength = 0; // Not limited, in the URL as ItemDescriptionLength=
//
// date() function documented http://www.php.net/manual/en/function.date.php
$LongDateFormat = "F jS, Y"; // ie, "Jan 21st, 2004"
$ShortDateFormat = "m/d/Y"; // ie, "1/21/2004"
//$ShortDateFormat = "d/m/Y"; // ie, "21/1/2004"
$LongTimeFormat = "H:i:s T O"; // ie, "13:24:30 EDT -0400"
$ShortTimeFormat = "h:i A"; // ie, "1:24 PM"
//
// Timezone - If your server is not in the same timezone as you are the timezone
// of the times and dates produced in the above from can be controlled with the
// below code. Just uncomment the following line and change the desired time
// offset.
// putenv("TZ=+04:00");
//
// Registered user of FeedForAll and FeedForAll Mac product(s) have access
// to a caching module. This enables it's use if it is installed.
$allowCachingXMLFiles = 0;
//
// File access level: The variable $fileAccessLevel can be used limit what files
// and type of files (local or remote) can be used with rss2html.php
// -1 = Remote files are NOT allowed, only local files allowed for template
// and feed which have filenames ending in extensions in the
// $allowedTemplateExtensions and $allowedFeedExtensions lists below
// 0 = Remote files and any local files allowed for template and feed
// 1 = Remote files and only local files allowed for template and feed
// which have filenames ending in extensions in the
// $allowedTemplateExtensions and $allowedFeedExtensions lists below
// 2 = No local files allowed, remote files only.
$fileAccessLevel = 1;
//
// Allowed file extensions is a list of the allowable extensions for local for
// the template and the feed. New entries can be added by following the example
// below.
$allowedTemplateExtensions = Array(".html", ".htm", ".shtml");
$allowedFeedExtensions = Array(".xml", ".rss");
//
// Destination Encoding: By default rss2html.php converts all feeds to UTF-8
// and then produces webpages in UTF-8 because UTF-8 is capable of displaying
// all possible characters.
$destinationEncoding = "UTF-8";
//
// Missing Encoding Default: Some feeds do not specify the character set
// they are encoded in. The XML specification states that if there is no
// encoding specified the XML file, all RSS feeds are XML, must be encoded
// in UTF-8, but experience has show differently. This specifies the
// encoding that will be used for feeds that don't specify the encoding.
//$missingEncodingDefault = "UTF-8";
$missingEncodingDefault = "ISO-8859-1";
// ==========================================================================
// Below this point of the file there are no user editable options. Your
// are welcome to make any modifications that you wish to any of the code
// below, but that is not necessary for normal use.
// ==========================================================================
// $Log: rss2html.php,v $
// Revision 2.53 2006/09/22 20:21:55 housley
// Fix the problem of displaying an invalid date with an odd number of items
//
// Revision 2.51 2006/09/04 12:33:17 housley
// Exit after a parser error. The parser stopped, so should we.
//
// Revision 2.50 2006/08/29 18:58:38 housley
// Changes to handle when there are not string conversion modules
//
// Revision 2.49 2006/08/25 15:09:22 housley
// Add hooks for a new feature in rss2html-pro
//
// Revision 2.48 2006/08/25 11:36:37 housley
// * Add the capability to change the character set that feeds are converted to
// * Allow specifying the encoding to use for feeds that don't specify the encoding
//
// Revision 2.46 2006/08/24 20:23:56 housley
// Over come a well meaning, but very misguided ISP removing file:// from
// all scripts. Not only did the remove it in a place that was doing good,
// it was extremely simple to bypass.
//
// Revision 2.45 2006/08/21 20:19:32 housley
// Use special routines so that rss2html-pro will work with RSS fields that
// have quotes in them.
//
// Revision 2.43 2006/08/18 23:42:16 housley
// Add hooks for rss2html-pro post processing
//
// Revision 2.42 2006/08/11 17:15:45 housley
// Add the ability to restrict the use of the rss2html.php script.
//
// Revision 2.41 2006/08/09 23:57:35 housley
// If in items. If there are more then one To assist with the with the creation of properly encoded URLs for use with rss2html.php this tool has been created. Fill in the URLs or file paths for both the XML file and your template file in the boxes below and then click "Submit". The program will then return the URLs properly encoded in a string that calls rss2html.php. You can click on this link to test the results. The program will also indicate if it was unable to open either of the URLs it was given. Configuration setting prohibit using remote files Configuration setting prohibit using the specified feed file Configuration setting prohibit using local files The XML file $_POST[XML] could not be opened. The XML file $_POST[XML] could not be opened with the error $GLOBALS[ERRORSTRING]. The XML file $_POST[XML] was SUCCESSFULLY opened Configuration setting prohibit using remote files Configuration setting prohibit using the specified template file Configuration setting prohibit using local files The template file $_POST[TEMPLATE] could not be opened. The template file $_POST[TEMPLATE] could not be opened with the error $GLOBALS[ERRORSTRING]. The template file $_POST[TEMPLATE] was SUCCESSFULLY opened URL for the XML file properly encoded:
\n";
echo "xml_get_current_line_number() = ".xml_get_current_line_number($xml_parser)."
\n";
echo "xml_get_current_column_number() = ".xml_get_current_column_number($xml_parser)."
\n";
echo "xml_get_current_byte_index() = ".xml_get_current_byte_index($xml_parser)."
\n";
exit(-1);
}
xml_parser_free($xml_parser);
// make sure the channel contentEncoded is not blank
if ($rss_parser->FeedContentEncoded == "") {
$rss_parser->FeedContentEncoded = $rss_parser->FeedDescription;
}
$template = FeedForAll_rss2html_str_replace("~~~FeedXMLFilename~~~", $XMLfilename, $template);
$template = FeedForAll_rss2html_str_replace("~~~FeedTitle~~~", FeedForAll_rss2html_limitLength($rss_parser->FeedTitle, $limitFeedTitleLength), $template);
$template = FeedForAll_rss2html_str_replace("~~~FeedDescription~~~", FeedForAll_rss2html_limitLength($rss_parser->FeedDescription, $limitFeedDescriptionLength), $template);
$template = FeedForAll_rss2html_str_replace("~~~FeedContentEncoded~~~", $rss_parser->FeedContentEncoded, $template);
$template = FeedForAll_rss2html_str_replace("~~~FeedLink~~~", $rss_parser->FeedLink, $template);
$template = FeedForAll_rss2html_str_replace("~~~FeedPubDate~~~", $rss_parser->FeedPubDate, $template);
$template = FeedForAll_rss2html_str_replace("~~~FeedPubLongDate~~~", date($LongDateFormat, $rss_parser->FeedPubDate_t), $template);
$template = FeedForAll_rss2html_str_replace("~~~FeedPubShortDate~~~", date($ShortDateFormat, $rss_parser->FeedPubDate_t), $template);
$template = FeedForAll_rss2html_str_replace("~~~FeedPubLongTime~~~", date($LongTimeFormat, $rss_parser->FeedPubDate_t), $template);
$template = FeedForAll_rss2html_str_replace("~~~FeedPubShortTime~~~", date($ShortTimeFormat, $rss_parser->FeedPubDate_t), $template);
$template = FeedForAll_rss2html_str_replace("~~~FeedImageUrl~~~", $rss_parser->FeedImageURL, $template);
$template = FeedForAll_rss2html_str_replace("~~~FeedImageTitle~~~", $rss_parser->FeedImageTitle, $template);
$template = FeedForAll_rss2html_str_replace("~~~FeedImageLink~~~", $rss_parser->FeedImageLink, $template);
$template = FeedForAll_rss2html_str_replace("~~~FeedCreativeCommons~~~", $rss_parser->FeedCreateiveCommons, $template);
$match = NULL;
$template = str_replace("~~~NoFutureItems~~~", "", $template);
//
// Sort by PubDate if requested
if (strstr($template, "~~~SortByPubDate~~~")) {
$template = str_replace("~~~SortByPubDate~~~", "", $template);
for ($x = 0; $x < count($rss_parser->ItemTitle)-1; $x++)
{
for ($y = $x+1; $y < count($rss_parser->ItemTitle); $y++)
{
if ($rss_parser->ItemPubDate_t[$x] < $rss_parser->ItemPubDate_t[$y])
{
// Swap them
$swapTemp = $rss_parser->ItemTitle[$x]; $rss_parser->ItemTitle[$x] = $rss_parser->ItemTitle[$y]; $rss_parser->ItemTitle[$y] = $swapTemp;
$swapTemp = $rss_parser->ItemDescription[$x]; $rss_parser->ItemDescription[$x] = $rss_parser->ItemDescription[$y]; $rss_parser->ItemDescription[$y] = $swapTemp;
$swapTemp = $rss_parser->ItemContentEncoded[$x]; $rss_parser->ItemContentEncoded[$x] = $rss_parser->ItemContentEncoded[$y]; $rss_parser->ItemContentEncoded[$y] = $swapTemp;
$swapTemp = $rss_parser->ItemLink[$x]; $rss_parser->ItemLink[$x] = $rss_parser->ItemLink[$y]; $rss_parser->ItemLink[$y] = $swapTemp;
$swapTemp = $rss_parser->ItemGuid[$x]; $rss_parser->ItemGuid[$x] = $rss_parser->ItemGuid[$y]; $rss_parser->ItemGuid[$y] = $swapTemp;
$swapTemp = $rss_parser->ItemPubDate[$x]; $rss_parser->ItemPubDate[$x] = $rss_parser->ItemPubDate[$y]; $rss_parser->ItemPubDate[$y] = $swapTemp;
$swapTemp = $rss_parser->ItemPubDate_t[$x]; $rss_parser->ItemPubDate_t[$x] = $rss_parser->ItemPubDate_t[$y]; $rss_parser->ItemPubDate_t[$y] = $swapTemp;
$swapTemp = $rss_parser->ItemEnclosureURL[$x]; $rss_parser->ItemEnclosureURL[$x] = $rss_parser->ItemEnclosureURL[$y]; $rss_parser->ItemEnclosureURL[$y] = $swapTemp;
$swapTemp = $rss_parser->ItemEnclosureType[$x]; $rss_parser->ItemEnclosureType[$x] = $rss_parser->ItemEnclosureType[$y]; $rss_parser->ItemEnclosureType[$y] = $swapTemp;
$swapTemp = $rss_parser->ItemEnclosureLength[$x]; $rss_parser->ItemEnclosureLength[$x] = $rss_parser->ItemEnclosureLength[$y]; $rss_parser->ItemEnclosureLength[$y] = $swapTemp;
$swapTemp = $rss_parser->ItemAuthor[$x]; $rss_parser->ItemAuthor[$x] = $rss_parser->ItemAuthor[$y]; $rss_parser->ItemAuthor[$y] = $swapTemp;
$swapTemp = $rss_parser->ItemComments[$x]; $rss_parser->ItemComments[$x] = $rss_parser->ItemComments[$y]; $rss_parser->ItemComments[$y] = $swapTemp;
$swapTemp = $rss_parser->ItemCategoryArray[$x]; $rss_parser->ItemCategoryArray[$x] = $rss_parser->ItemCategoryArray[$y]; $rss_parser->ItemCategoryArray[$y] = $swapTemp;
$swapTemp = $rss_parser->ItemSource[$x]; $rss_parser->ItemSource[$x] = $rss_parser->ItemSource[$y]; $rss_parser->ItemSource[$y] = $swapTemp;
$swapTemp = $rss_parser->ItemSourceURL[$x]; $rss_parser->ItemSourceURL[$x] = $rss_parser->ItemSourceURL[$y]; $rss_parser->ItemSourceURL[$y] = $swapTemp;
$swapTemp = $rss_parser->ItemCreativeCommons[$x]; $rss_parser->ItemCreativeCommons[$x] = $rss_parser->ItemCreativeCommons[$y]; $rss_parser->ItemCreativeCommons[$y] = $swapTemp;
$swapTemp = $rss_parser->ItemRssMeshExtra[$x]; $rss_parser->ItemRssMeshExtra[$x] = $rss_parser->ItemRssMeshExtra[$y]; $rss_parser->ItemRssMeshExtra[$y] = $swapTemp;
}
}
}
}
// The the maximum items requested
if (strstr($template, "~~~FeedMaxItems=")) {
// Limit the maximun number of items displayed
if (preg_match("/~~~FeedMaxItems=([0-9-]*)~~~/", $template, $match) !== FALSE) {
if (($match[0] != "") && ($match[1] != "")) {
$FeedMaxItems = $match[1];
$template = str_replace("~~~FeedMaxItems=$match[1]~~~", "", $template);
if (abs($FeedMaxItems) > count($rss_parser->ItemTitle)) {
if ($FeedMaxItems > 0) {
$FeedMaxItems = count($rss_parser->ItemTitle);
} else {
$FeedMaxItems = -count($rss_parser->ItemTitle);
}
}
}
}
}
//
// Find the string, if it exists, between the ~~~EndItemsRecord~~~ and ~~~BeginItemsRecord~~~
//
while ((strstr($template, "~~~BeginItemsRecord~~~")) !== FALSE) {
$match = NULL;
$allitems = NULL;
$loop_limit = min(abs($FeedMaxItems), count($rss_parser->ItemTitle));
if (($parts = split("~~~BeginItemsRecord~~~", $template)) !== FALSE) {
if (($parts = split("~~~EndItemsRecord~~~", $parts[1])) !== FALSE) {
$WholeBlock = $parts[0];
//
// Check for ~~~BeginAlternateItemsRecord~~~
//
if (strstr($WholeBlock, "~~~BeginAlternateItemsRecord~~~")) {
$parts = split("~~~BeginAlternateItemsRecord~~~", $WholeBlock);
$block1 = $parts[0];
$block2 = $parts[1];
} else {
$block1 = $WholeBlock;
$block2 = $WholeBlock;
}
if ($FeedMaxItems < 0) {
for ($x = count($rss_parser->ItemTitle)-1; $x >= count($rss_parser->ItemTitle) + $FeedMaxItems; $x--) {
$item = FeedForAll_rss2html_str_replace("~~~ItemTitle~~~", FeedForAll_rss2html_limitLength($rss_parser->ItemTitle[$x], $limitItemTitleLength), $block1);
$item = FeedForAll_rss2html_str_replace("~~~ItemDescription~~~", FeedForAll_rss2html_limitLength($rss_parser->ItemDescription[$x], $limitItemDescriptionLength), $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemContentEncoded~~~", $rss_parser->ItemContentEncoded[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemLink~~~", $rss_parser->ItemLink[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemPubDate~~~", $rss_parser->ItemPubDate[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemGuid~~~", $rss_parser->ItemGuid[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemPubLongDate~~~", date($LongDateFormat, $rss_parser->ItemPubDate_t[$x]), $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemPubShortDate~~~", date($ShortDateFormat, $rss_parser->ItemPubDate_t[$x]), $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemPubLongTime~~~", date($LongTimeFormat, $rss_parser->ItemPubDate_t[$x]), $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemPubShortTime~~~", date($ShortTimeFormat, $rss_parser->ItemPubDate_t[$x]), $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemEnclosureUrl~~~", $rss_parser->ItemEnclosureURL[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemEnclosureType~~~", $rss_parser->ItemEnclosureType[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemEnclosureLength~~~", $rss_parser->ItemEnclosureLength[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemEnclosureLengthFormatted~~~", FeedForAll_rss2html_sizeToString($rss_parser->ItemEnclosureLength[$x]), $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemAuthor~~~", $rss_parser->ItemAuthor[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemComments~~~", $rss_parser->ItemComments[$x], $item);
if (count($rss_parser->ItemCategoryArray[$x])) {
$item = FeedForAll_rss2html_str_replace("~~~ItemCategory~~~", $rss_parser->ItemCategoryArray[$x][0]["Category"], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemCategoryDomain~~~", $rss_parser->ItemCategoryArray[$x][0]["Domain"], $item);
} else {
$item = FeedForAll_rss2html_str_replace("~~~ItemCategory~~~", "", $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemCategoryDomain~~~", "", $item);
}
$item = FeedForAll_rss2html_str_replace("~~~ItemSource~~~", $rss_parser->ItemSource[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemSourceURL~~~", $rss_parser->ItemSourceURL[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemCreativeCommons~~~", $rss_parser->ItemCreateiveCommons[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemRssMeshExtra~~~", $rss_parser->ItemRssMeshExtra[$x], $item);
$item = FeedForAll_rss2html_CreateUniqueLink($rss_parser->ItemTitle[$x], $rss_parser->ItemDescription[$x], $rss_parser->ItemLink[$x], $rss_parser->ItemGuid[$x], $XMLfilename, $item);
$allitems .= "".$item;
$x--;
if ($x >= count($rss_parser->ItemTitle) + $FeedMaxItems) {
//
// This is at least one more item so use the Alternate definition
//
$item = FeedForAll_rss2html_str_replace("~~~ItemTitle~~~", FeedForAll_rss2html_limitLength($rss_parser->ItemTitle[$x], $limitItemTitleLength), $block2);
$item = FeedForAll_rss2html_str_replace("~~~ItemDescription~~~", FeedForAll_rss2html_limitLength($rss_parser->ItemDescription[$x], $limitItemDescriptionLength), $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemContentEncoded~~~", $rss_parser->ItemContentEncoded[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemLink~~~", $rss_parser->ItemLink[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemPubDate~~~", $rss_parser->ItemPubDate[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemGuid~~~", $rss_parser->ItemGuid[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemPubLongDate~~~", date($LongDateFormat, $rss_parser->ItemPubDate_t[$x]), $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemPubShortDate~~~", date($ShortDateFormat, $rss_parser->ItemPubDate_t[$x]), $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemPubLongTime~~~", date($LongTimeFormat, $rss_parser->ItemPubDate_t[$x]), $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemPubShortTime~~~", date($ShortTimeFormat, $rss_parser->ItemPubDate_t[$x]), $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemEnclosureUrl~~~", $rss_parser->ItemEnclosureURL[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemEnclosureType~~~", $rss_parser->ItemEnclosureType[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemEnclosureLength~~~", $rss_parser->ItemEnclosureLength[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemEnclosureLengthFormatted~~~", FeedForAll_rss2html_sizeToString($rss_parser->ItemEnclosureLength[$x]), $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemAuthor~~~", $rss_parser->ItemAuthor[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemComments~~~", $rss_parser->ItemComments[$x], $item);
if (count($rss_parser->ItemCategoryArray[$x])) {
$item = FeedForAll_rss2html_str_replace("~~~ItemCategory~~~", $rss_parser->ItemCategoryArray[$x][0]["Category"], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemCategoryDomain~~~", $rss_parser->ItemCategoryArray[$x][0]["Domain"], $item);
} else {
$item = FeedForAll_rss2html_str_replace("~~~ItemCategory~~~", "", $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemCategoryDomain~~~", "", $item);
}
$item = FeedForAll_rss2html_str_replace("~~~ItemSource~~~", $rss_parser->ItemSource[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemSourceURL~~~", $rss_parser->ItemSourceURL[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemCreativeCommons~~~", $rss_parser->ItemCreateiveCommons[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemRssMeshExtra~~~", $rss_parser->ItemRssMeshExtra[$x], $item);
$item = FeedForAll_rss2html_CreateUniqueLink($rss_parser->ItemTitle[$x], $rss_parser->ItemDescription[$x], $rss_parser->ItemLink[$x], $rss_parser->ItemGuid[$x], $XMLfilename, $item);
$allitems .= "".$item;
}
}
} else {
for ($x = 0; $x < $loop_limit; $x++) {
$item = FeedForAll_rss2html_str_replace("~~~ItemTitle~~~", FeedForAll_rss2html_limitLength($rss_parser->ItemTitle[$x], $limitItemTitleLength), $block1);
$item = FeedForAll_rss2html_str_replace("~~~ItemDescription~~~", FeedForAll_rss2html_limitLength($rss_parser->ItemDescription[$x], $limitItemDescriptionLength), $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemContentEncoded~~~", $rss_parser->ItemContentEncoded[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemLink~~~", $rss_parser->ItemLink[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemPubDate~~~", $rss_parser->ItemPubDate[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemGuid~~~", $rss_parser->ItemGuid[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemPubLongDate~~~", date($LongDateFormat, $rss_parser->ItemPubDate_t[$x]), $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemPubShortDate~~~", date($ShortDateFormat, $rss_parser->ItemPubDate_t[$x]), $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemPubLongTime~~~", date($LongTimeFormat, $rss_parser->ItemPubDate_t[$x]), $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemPubShortTime~~~", date($ShortTimeFormat, $rss_parser->ItemPubDate_t[$x]), $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemEnclosureUrl~~~", $rss_parser->ItemEnclosureURL[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemEnclosureType~~~", $rss_parser->ItemEnclosureType[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemEnclosureLength~~~", $rss_parser->ItemEnclosureLength[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemEnclosureLengthFormatted~~~", FeedForAll_rss2html_sizeToString($rss_parser->ItemEnclosureLength[$x]), $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemAuthor~~~", $rss_parser->ItemAuthor[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemComments~~~", $rss_parser->ItemComments[$x], $item);
if (count($rss_parser->ItemCategoryArray[$x])) {
$item = FeedForAll_rss2html_str_replace("~~~ItemCategory~~~", $rss_parser->ItemCategoryArray[$x][0]["Category"], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemCategoryDomain~~~", $rss_parser->ItemCategoryArray[$x][0]["Domain"], $item);
} else {
$item = FeedForAll_rss2html_str_replace("~~~ItemCategory~~~", "", $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemCategoryDomain~~~", "", $item);
}
$item = FeedForAll_rss2html_str_replace("~~~ItemSource~~~", $rss_parser->ItemSource[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemSourceURL~~~", $rss_parser->ItemSourceURL[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemCreativeCommons~~~", $rss_parser->ItemCreateiveCommons[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemRssMeshExtra~~~", $rss_parser->ItemRssMeshExtra[$x], $item);
$item = FeedForAll_rss2html_CreateUniqueLink($rss_parser->ItemTitle[$x], $rss_parser->ItemDescription[$x], $rss_parser->ItemLink[$x], $rss_parser->ItemGuid[$x], $XMLfilename, $item);
$allitems .= "".$item;
$x++;
if ($x < $loop_limit) {
//
// This is at least one more item so use the Alternate definition
//
$item = FeedForAll_rss2html_str_replace("~~~ItemTitle~~~", FeedForAll_rss2html_limitLength($rss_parser->ItemTitle[$x], $limitItemTitleLength), $block2);
$item = FeedForAll_rss2html_str_replace("~~~ItemDescription~~~", FeedForAll_rss2html_limitLength($rss_parser->ItemDescription[$x], $limitItemDescriptionLength), $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemContentEncoded~~~", $rss_parser->ItemContentEncoded[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemLink~~~", $rss_parser->ItemLink[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemPubDate~~~", $rss_parser->ItemPubDate[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemGuid~~~", $rss_parser->ItemGuid[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemPubLongDate~~~", date($LongDateFormat, $rss_parser->ItemPubDate_t[$x]), $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemPubShortDate~~~", date($ShortDateFormat, $rss_parser->ItemPubDate_t[$x]), $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemPubLongTime~~~", date($LongTimeFormat, $rss_parser->ItemPubDate_t[$x]), $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemPubShortTime~~~", date($ShortTimeFormat, $rss_parser->ItemPubDate_t[$x]), $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemEnclosureUrl~~~", $rss_parser->ItemEnclosureURL[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemEnclosureType~~~", $rss_parser->ItemEnclosureType[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemEnclosureLength~~~", $rss_parser->ItemEnclosureLength[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemEnclosureLengthFormatted~~~", FeedForAll_rss2html_sizeToString($rss_parser->ItemEnclosureLength[$x]), $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemAuthor~~~", $rss_parser->ItemAuthor[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemComments~~~", $rss_parser->ItemComments[$x], $item);
if (count($rss_parser->ItemCategoryArray[$x])) {
$item = FeedForAll_rss2html_str_replace("~~~ItemCategory~~~", $rss_parser->ItemCategoryArray[$x][0]["Category"], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemCategoryDomain~~~", $rss_parser->ItemCategoryArray[$x][0]["Domain"], $item);
} else {
$item = FeedForAll_rss2html_str_replace("~~~ItemCategory~~~", "", $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemCategoryDomain~~~", "", $item);
}
$item = FeedForAll_rss2html_str_replace("~~~ItemSource~~~", $rss_parser->ItemSource[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemSourceURL~~~", $rss_parser->ItemSourceURL[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemCreativeCommons~~~", $rss_parser->ItemCreateiveCommons[$x], $item);
$item = FeedForAll_rss2html_str_replace("~~~ItemRssMeshExtra~~~", $rss_parser->ItemRssMeshExtra[$x], $item);
$item = FeedForAll_rss2html_CreateUniqueLink($rss_parser->ItemTitle[$x], $rss_parser->ItemDescription[$x], $rss_parser->ItemLink[$x], $rss_parser->ItemGuid[$x], $XMLfilename, $item);
$allitems .= "".$item;
}
}
}
$template = str_replace("~~~BeginItemsRecord~~~".$WholeBlock."~~~EndItemsRecord~~~", $allitems, $template);
}
}
}
// Since ' is not HTML, but is XML convert.
$template = str_replace("'", "'", $template);
if (!headers_sent()) {
// Send the Content-Type to force $destinationEncoding
header("Content-Type: text/html; charset=$destinationEncoding");
}
echo FeedForAll_rss2html_pro($template);
} else {
if (!headers_sent()) {
// Send the Content-Type to force $destinationEncoding
header("Content-Type: text/html; charset=$destinationEncoding");
}
echo "RSS2HTML.PHP LINK TOOL
\n";
$answer = "";
$ssi = "";
$xmlurl = "";
$templateurl = "";
if ((isset($_POST["XML"]) && $_POST["XML"] != "") || (isset($_POST["TEMPLATE"]) && $_POST["TEMPLATE"] != "")) {
$answer .= "http://$_SERVER[SERVER_NAME]$_SERVER[PHP_SELF]?";
}
if (isset($_POST["XML"]) && $_POST["XML"] != "") {
$answer .= "XMLFILE=".FeedForAll_rss2html_encodeURL($_POST["XML"]);
$ssi .= "XMLFILE=".FeedForAll_rss2html_encodeURL($_POST["XML"]);
$xmlurl = FeedForAll_rss2html_encodeURL($_POST["XML"]);
}
if ((isset($_POST["XML"]) && $_POST["XML"] != "") && (isset($_POST["TEMPLATE"]) && $_POST["TEMPLATE"] != "")) {
$answer .= "&";
$ssi .= "&";
}
if (isset($_POST["TEMPLATE"]) && $_POST["TEMPLATE"] != "") {
$answer .= "TEMPLATE=".FeedForAll_rss2html_encodeURL($_POST["TEMPLATE"]);
$ssi .= "TEMPLATE=".FeedForAll_rss2html_encodeURL($_POST["TEMPLATE"]);
$templateurl = FeedForAll_rss2html_encodeURL($_POST["TEMPLATE"]);
}
if (isset($_POST["MAXITEMS"]) && $_POST["MAXITEMS"] != "" && intval($_POST["MAXITEMS"] != 0)) {
$answer .= "&MAXITEMS=$_POST[MAXITEMS]";
$ssi .= "&MAXITEMS=$_POST[MAXITEMS]";
}
if (isset($_POST["NOFUTUREITEMS"]) && $_POST["NOFUTUREITEMS"] == "on") {
$answer .= "&NOFUTUREITEMS=1";
$ssi .= "&NOFUTUREITEMS=1";
}
echo "Results
\n";
if (isset($_POST["XML"]) && $_POST["XML"] != "") {
$XMLfilename = "";
if (stristr($_POST["XML"], "file"."://")) {
// Not allowed
;
}
elseif (stristr($_POST["XML"], "://")) {
if ($fileAccessLevel == -1) {
echo "$xmlurl
URL for the template file properly encoded:
$templateurl\n"; } echo "
Click on link to view results: $answer
\n"; echo "Server Side Include:
<!--#INCLUDE VIRTUAL="".basename($_SERVER["PHP_SELF"])."?$ssi" -->\n"; echo "
PHP Include:
<?php\ninclude("$answer");\n?>\n";
}
if ($xmlContents != "" || $templateContents != "") {
echo "$convertedXML
$templateContents