Jump to content

divadiva

Members
  • Posts

    171
  • Joined

  • Last visited

    Never

Everything posted by divadiva

  1. Changing the height of the text is a fairly simple question. Anyways thanks for replying.
  2. Experts, How to move the images/folder at the bottom of the page?I have Featured Item list which contains some image and is aligned at the top of the page. I want to move it to the bottom of the screen .How to do that? Below is my code.I just want to know how to change the height so featured Items can move down . <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link rel="stylesheet" type="text/css" href="style.css"> <script language="JavaScript" src="flash_link.js" type="text/javascript"></script> <TITLE>Website XYZ</TITLE> <META NAME="keywords" CONTENT="XYZ"> <META NAME="description" </head> <body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0" style="background-color: #FFFFFF" language="Javascript1.2"> <div align="center"> <table border="0" cellpadding="0" cellspacing="0" width="915"> <tr> <td width="212" height="31"> </td> <td width="15" height="31"> </td> <td width="700" height="31"> <div id="container"> <div id="header"> <div id="links"> <p align="right"></p> <p align="right"> </div> </div> </div> </td> </tr> <tr height="59"> <td class="main_color" height="59" align="right" valign="bottom" width="212"> <p align="center"><a title="Home Page" href="index.php"><img src="images/logo.gif" alt="Website XYZ" height="77" width="210" border="0"></a> </td> <td class="main_color" height="59" align="right" valign="bottom" width="15"> </td> <td class="main_color" align="center" valign="bottom" width="691" height="59"> <?//image?> <p align="center"><a onmouseover="var img=document['fpAnimswapImgFP13'];img.imgRolln=img.src;img.src=img.lowsrc?img.lowsrc:img.getAttribute?img.getAttribute('lowsrc'):img.src;" onmouseout="document['fpAnimswapImgFP13'].src=document['fpAnimswapImgFP13'].imgRolln" href="aboutus.php"><img alt="XYZ" border="0" src="images/aboutus.gif" width="115" height="35" hspace="3" id="fpAnimswapImgFP13" name="fpAnimswapImgFP13" dynamicanimation="fpAnimswapImgFP13" lowsrc="images/ag_menu_on_button_about.gif"></a><a title="Search" onmouseover="var img=document['fpAnimswapImgFP11'];img.imgRolln=img.src;img.src=img.lowsrc?img.lowsrc:img.getAttribute?img.getAttribute('lowsrc'):img.src;" onmouseout="document['fpAnimswapImgFP11'].src=document['fpAnimswapImgFP11'].imgRolln" href="Search.php"><img alt="XYZ" border="0" src="images/xyz.gif" width="115" height="35" hspace="3" id="fpAnimswapImgFP11" name="fpAnimswapImgFP11" dynamicanimation="fpAnimswapImgFP11" lowsrc="images/xyz.gif"></a><a onmouseover="var img=document['fpAnimswapImgFP12'];img.imgRolln=img.src;img.src=img.lowsrc?img.lowsrc:img.getAttribute?img.getAttribute('lowsrc'):img.src;" onmouseout="document['fpAnimswapImgFP12'].src=document['fpAnimswapImgFP12'].imgRolln" href="services.php"><img alt="XYZ" border="0" src="images/xyz.gif" width="115" height="35" hspace="3" id="fpAnimswapImgFP12" name="fpAnimswapImgFP12" dynamicanimation="fpAnimswapImgFP12" lowsrc="images/ag_menu_on_button_services.gif"></a><a onmouseover="var img=document['fpAnimswapImgFP14'];img.imgRolln=img.src;img.src=img.lowsrc?img.lowsrc:img.getAttribute?img.getAttribute('lowsrc'):img.src;" onmouseout="document['fpAnimswapImgFP14'].src=document['fpAnimswapImgFP14'].imgRolln" href="AboutCompany.php"><img alt="XYZ" border="0" src="images/ag_nav_button_about_xyz.gif" width="115" height="35" hspace="3" id="fpAnimswapImgFP14" name="fpAnimswapImgFP14" dynamicanimation="fpAnimswapImgFP14" lowsrc="images/ag_menu_on_button_about_semi.gif"></a><a onmouseover="var img=document['fpAnimswapImgFP15'];img.imgRolln=img.src;img.src=img.lowsrc?img.lowsrc:img.getAttribute?img.getAttribute('lowsrc'):img.src;" onmouseout="document['fpAnimswapImgFP15'].src=document['fpAnimswapImgFP15'].imgRolln" href="contact.php"><img alt="XYZ" border="0" src="images/ag_nav_button_contact.gif" width="115" height="35" hspace="3" id="fpAnimswapImgFP15" name="fpAnimswapImgFP15" dynamicanimation="fpAnimswapImgFP15" lowsrc="images/ag_menu_on_button_contact.gif"></a><br> <br> </td> </tr> <tr> <td class="main_color" align="center" valign="top" nowrap height="462" width="212" background="images/featured_bracket.gif"><br> <p><? include 'FeaturedItems.inc'; $FeaturedItemsHTMLBlock = FeaturedItems(1); ?> <br> <TABLE> <TR> <p>//I want to change the height Featured Items <div style="text-align: center;"><a title="Featured Items" href="http://xyz.com/feature.php" ><strong><font color="orange"><u>FEATURED ITEMS</strong></div></u> <br> <? shuffle($FeaturedItemsHTMLBlock); print $FeaturedItemsHTMLBlock[0]; print $FeaturedItemsHTMLBlock[1]; print $FeaturedItemsHTMLBlock[2]; print $FeaturedItemsHTMLBlock[3]; ?> </TABLE> </p> Thanks in advance.
  3. Thanks, it worked like a charm. I did urlencode before Manufacturer .It is working fine now.
  4. Experts, This time I have figured out the problem but stuck with the solution. I have this search page,when I enter Adjacent Technology in the search criteria.It gives me the right result.But when I click next to go to next page it trims Technology and the search criteria searches for only Adjacent(which doesnt exist). Here is the code: $MaxDisp = 50; //Set Maximum number of rows to be displayed //Fill in data table for ($RowsDisp =1; ($QueryResultRow= mysql_fetch_array($QueryResult)) AND $RowsDisp <= $MaxDisp; $RowsDisp++){ //print_r(mysql_fetch_array($QueryResult)); ?> <TR align="center" valign="top"> <TD align="middle" valign="center"> <? </TR> <? } ?></TABLE> <? if(!$skip) $skip=0; //set the value of skip to 0 if unset print("Total number".$QueryTotalRows); print "IF Passed ".($skip+$MaxDisp); if(($skip+$MaxDisp)< $QueryTotalRows){//if end is earlier then next skip value, set the end to # of rows print("Query Total Rows".$QueryTotalRows); $PageEnd = $skip+$MaxDisp; print "page end is".$PageEnd; } else { print "After else the total number of rows are". $QueryTotalRows; $PageEnd = $skip+$MaxDisp; print "Page end after else".$PageEnd; $PageEnd = $QueryTotalRows; } print "<p>Displaying records $skip - $PageEnd of $QueryTotalRows<p>"; //SKIP =0 and MAX DISP at this point is 50 if ($skip-$MaxDisp >=0){ //Go back a page print"Goback a page". $skip-$MaxDisp; print "<A HREF=EquipmentSearch.php?skip=".($skip-$MaxDisp)."&manufacturer=$manufacturer&process=$process&wafer=$wafer&search=$search>Prev </a>"; print "&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp"; } print "BEFORE if(forward)".$QueryTotalRows; print"skip+maxdisp".($skip+$MaxDisp); if ($skip+$MaxDisp <= $QueryTotalRows) { //Go forward a page print "<A HREF=EquipmentSearch.php?skip=".($skip+$MaxDisp)."&manufacturer=$manufacturer&process=$process&wafer=$wafer&search=$search>Next</a>"; } ?> Thanks in advance. Best, Divya
  5. Thank you fro replying. stylesheet is included.But It is messing the table width . I have to manually change the width and formatting.Any comments?
  6. Thank you all for replying I tried adding lower case.It still doesnt work. Also,I have added ? as earlier I had asp tags . here is my css file : html { margin:0px 0px 0px 0px; } body { color: black; font-family: Verdana, Arial; font-size: 12px; font-weight: normal; margin:0px 0px 0px 0px; background:url("backg1.gif"); } p,td,li { color: black; font-family: Verdana, Arial; font-size: 11px; } .maintable { background: url('backg.gif'); background-repeat:no-repeat; } .head { font-size:14px; font-family: Arial; font-weight:bold; color:#FFFFFF; } .red { color:#FF0000; } .blue { color:#0000FF; } .dtable { background-color:#027EC2; } .dtable TD { background-color:#FFFFFF; } .dtable TH { font-weight:bold; background-color:#B6DAF2; } .dtable2 TD { font-weight:bold; background-color:#B6DAF2; } .dtable3 TD { font-size: 9px; } .gtable { background-color:#BFBFBF; } .gtable TD { background-color:#FFFFFF; } .gtable TH { font-weight:bold; background-color:#B6DAF2; } .ntable { background-color:#FFFFFF; } .ntable TD { background-color:#FFFFFF; } .ntable TH { font-weight:bold; background-color:#FFFFFF; } .otable { background-color:#FFFFFF; border-collapse:collapse; } .otable TD { background-color:#FFFFFF; border-color:#027EC2; border-style:solid; border-width:1px; } .otable TH { font-weight:bold; background-color:#B6DAF2; border-color:#027EC2; border-style:solid; border-width:1px; } .otable1 TD { background-color:#EEEEEE; border-color:#027EC2; border-style:solid; border-width:1px; } .otable2 TD { background-color:#FFFFFF; border-width:0px; } A:link { color: #16629A; TEXT-DECORATION: none; } A:visited { color: #16629A; TEXT-DECORATION: none; } A:hover { color: #FF0000; TEXT-DECORATION: none; } .menu { color: #FFFFFF; } .menu A:link { color: #FFFFFF; TEXT-DECORATION: none; } .menu A:visited { color: #FFFFFF; TEXT-DECORATION: none; } .menu A:hover { color: #FFFF00; TEXT-DECORATION: none; } .hr { color: #027EC2; height: 1px; }
  7. For some reason css is not included in detail view. Here is the code: <HEAD> <TITLE>; Inventory Database > View Inventory</TITLE> <LINK REL="stylesheet" TYPE="text/css" HREF="style.css"> </HEAD> <FORM ACTION="view.php" METHOD="POST"> <? ********** CSS IS NOT INCLUDED IN NEXT PORTION*****is THERE A WAY TO INCLUDE IT? <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100?"> <TBODY> <TR> <TD ALIGN="CENTER"><A HREF="view.php">New Search</A></TD> </TR>
  8. thanks for sugegstions.I will change the tags to php .
  9. I am using PHP 5 which does have asp_tags = off
  10. This is my php.ini file register_globals = off allow_url_fopen = off expose_php = Off max_input_time = 60 variables_order = "EGPCS" extension_dir = ./ upload_tmp_dir = /tmp precision = 12 SMTP = relay-hosting.secureserver.net url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset=" [Zend] zend_extension=/usr/local/zo/ZendExtensionManager.so zend_extension=/usr/local/zo/4_3/ZendOptimizer.so If I add asp_tags, will this work? asp_tags = On Thanks in advance for suggestions. Best Diva
  11. I guess no suggestions /help tday??
  12. This is my second post on the same issue hoping that I might get a reply. Current scenario: The RSS feed is showing news till 5 feb 2009.ANy ideas why is it not showing current news? Here is the code: <font color="#eb8412"><strong><u>INDUSTRY N</strong></font><font color="#eb8412"><strong><u>EWS</u></strong></font><br> <?php $XMLFILE = "http://www.xyz.org/index.php?option=com_rd_rss&id=1"; $limitItemDescriptionLength = 175; $MAXITEMS = "3"; include("rss2html.php"); ?> <p></p> Here is rss2.html <?PHP if (($useFopenURL == -1) && !function_exists("fsockopen")) { $useFopenURL = 1; if (isset($debugLevel) && ($debugLevel >= 3)) { echo "DIAG: setting \$useFopenURL=1 because fsockopen() doesn't exist<br>\n"; } } if ($useFopenURL == 1) { ini_set("allow_url_fopen", "1"); ini_set("user_agent", "FeedForAll rss2html scripts v3"); } $FeedMaxItems = 10000; $NoFutureItems = FALSE; @include("FeedForAll_rss2html_pro.php"); if (function_exists("FeedForAll_rss2html_pro") === FALSE) { Function FeedForAll_rss2html_pro($source) { // // This is the place to do any processing that is desired return $source; } } if (function_exists("FeedForAll_parseExtensions") === FALSE) { Function FeedForAll_parseExtensions() { return FALSE; } } @include("FeedForAll_Scripts_CachingExtension.php"); @include_once("FeedForAll_XMLParser.inc.php"); if (function_exists("FeedForAll_rss2html_limitLength") === FALSE) { Function FeedForAll_rss2html_limitLength($initialValue, $limit = 0) { if (($limit == 0) || (strlen($initialValue) <= $limit )) { // ZERO is for not limited return $initialValue; } // Cut the text at the exact point, ignoring if it is in a word. $result = substr($initialValue, 0, $limit); // Check to see if there are any space we can trim at and if it is not // too far from where we are $lastSpace = strrchr($result,' '); if (($lastSpace !== FALSE) && (strlen($lastSpace) < 20)) { // lose any incomplete word at the end $result = substr($result, 0, -(strlen($lastSpace))); // Append elipses, ... , to show it was truncated $result .= " ..."; } return $result; } } if (function_exists("FeedForAll_rss2html_sizeToString") === FALSE) { Function FeedForAll_rss2html_sizeToString($filesize) { if ($filesize == "") { return ""; } elseif ($filesize >= 1073741824) { return number_format($filesize/1073741824, 1, ".", ",")." GBytes"; } elseif ($filesize >= 1048576) { return number_format($filesize/1048576, 1, ".", ",")." MBytes"; } elseif ($filesize >= 1024) { return number_format($filesize/1024, 1, ".", ",")." KBytes"; } else { return $filesize." Bytes"; } } } if (function_exists("FeedForAll_rss2html_isTemplate") === FALSE) { Function FeedForAll_rss2html_isTemplate($templateData) { if ((strstr($templateData, "~~~Feed") !== FALSE) || (strstr($templateData, "~~~Item") !== FALSE)) { return TRUE; } return FALSE; } } if (function_exists("FeedForAll_rss2html_validExtension") === FALSE) { Function FeedForAll_rss2html_validExtension($filename, $extensions) { $foundValid = FALSE; foreach ($extensions as $value) { if (strtolower($value) == strtolower(substr($filename, -strlen($value)))) { $foundValid = TRUE; break; } } return $foundValid; } } if (function_exists("FeedForAll_rss2html_str_replace") === FALSE) { Function FeedForAll_rss2html_str_replace($search, $replace, $subject) { return str_replace($search, $replace, $subject); } } if (function_exists("FeedForAll_rss2html_encodeURL") === FALSE) { Function FeedForAll_rss2html_encodeURL($URLstring, $includePND = 0) { $result = ""; for ($x = 0; $x < strlen($URLstring); $x++) { if ($URLstring[$x] == '%') { $result = $result."%25"; } elseif ($URLstring[$x] == '?') { $result = $result."%3f"; } elseif ($URLstring[$x] == '&') { $result = $result."%26"; } elseif ($URLstring[$x] == '=') { $result = $result."%3d"; } elseif ($URLstring[$x] == '+') { $result = $result."%2b"; } elseif ($URLstring[$x] == ' ') { $result = $result."%20"; } elseif ($includePND && ($URLstring[$x] == '#')) { $result = $result."%23"; }else { $result = $result.$URLstring[$x]; } } return $result; } } if (function_exists("FeedForAll_rss2html_CreateUniqueLink") === FALSE) { Function FeedForAll_rss2html_CreateUniqueLink($title, $description, $link, $guid, $XMLfilename, $itemTemplate) { GLOBAL $TEMPLATEfilename; $match = Array(); while (preg_match("/~~~ItemUniqueLinkWithTemplate=.*~~~/", $itemTemplate, $match) !== FALSE) { if ((count($match) == 0) || ($match[0] == "")) { // All done return $itemTemplate; } $replace = "http://$_SERVER[sERVER_NAME]$_SERVER[sCRIPT_NAME]?XMLFILE=".FeedForAll_rss2html_encodeURL($XMLfilename)."&TEMPLATE=".FeedForAll_rss2html_encodeURL($TEMPLATEfilename); $itemTemplate = FeedForAll_rss2html_str_replace($match[0], $replace, $itemTemplate); } if ($title); if ($description); if ($link); if ($guid); return $itemTemplate; } } if (function_exists("FeedForAll_rss2html_UseUniqueLink") === FALSE) { Function FeedForAll_rss2html_UseUniqueLink($title, $description, $link, $guid) { if ($title); if ($description); if ($link); if ($guid); return -1; } } if (function_exists("FeedForAll_rss2html_EscapeLink") === FALSE) { Function FeedForAll_rss2html_EscapeLink($link) { GLOBAL $escapeAmpInLinks; if ((strstr($link, "://") !== FALSE) && $escapeAmpInLinks) { // In HTML a link with an & must be converted to & // And for here without :// it is not a link, since relative // URLs are not allowed $link = str_replace("&", "&", $link); } return $link; } } if (function_exists("FeedForAll_rss2html_AddIdentity") === FALSE) { Function FeedForAll_rss2html_AddIdentity($itemString) { return "<!-- HTML generated from an RSS Feed by rss2html.php, http://www.FeedForAll.com/ a NotePage, Inc. product (http://www.notepage.com/) -->".$itemString; } } if (!isset($_REQUEST["buildURL"])) { // // Check variables that could be used if URL wrapper are disable or not working if (isset($GLOBALS["XMLFILE"])) { $XMLfilename = $GLOBALS["XMLFILE"]; } if (isset($GLOBALS["TEMPLATE"])) { $TEMPLATEfilename = $GLOBALS["TEMPLATE"]; } if (isset($GLOBALS["FeedTitleLength"])) { $limitFeedTitleLength = abs($GLOBALS["FeedTitleLength"]); } if (isset($GLOBALS["FeedDescriptionLength"])) { $limitFeedDescriptionLength = abs($GLOBALS["FeedDescriptionLength"]); } if (isset($GLOBALS["ItemTitleLength"])) { $limitItemTitleLength = abs($GLOBALS["ItemTitleLength"]); } if (isset($GLOBALS["ItemDescriptionLength"])) { $limitItemDescriptionLength = abs($GLOBALS["ItemDescriptionLength"]); } if (isset($GLOBALS["MAXITEMS"])) { $FeedMaxItems = $GLOBALS["MAXITEMS"]; } if (isset($GLOBALS["NOFUTUREITEMS"])) { $NoFutureItems = TRUE; } if (isset($_REQUEST["XMLFILE"])) { if (stristr($_REQUEST["XMLFILE"], "file"."://")) { // Not allowed ; } elseif (stristr($_REQUEST["XMLFILE"], "://")) { if ($fileAccessLevel == -1) { echo "Configuration setting prohibit using remote files, exiting\n"; return; } else { // URL files are allowed $XMLfilename = $_REQUEST["XMLFILE"]; } } else { if (($fileAccessLevel == 1) || ($fileAccessLevel == -1)) { if (FeedForAll_rss2html_validExtension(basename($_REQUEST["XMLFILE"]), $allowedFeedExtensions) === FALSE) { echo "Configuration setting prohibit using the specified feed file, exiting\n"; return; } $XMLfilename = basename($_REQUEST["XMLFILE"]); } elseif ($fileAccessLevel == 2) { echo "Configuration setting prohibit using local files, exiting\n"; return; } else { // It is local and must be in the same directory $XMLfilename = basename($_REQUEST["XMLFILE"]); } } } if (isset($_REQUEST["TEMPLATE"])) { if (stristr($_REQUEST["TEMPLATE"], "file"."://")) { // Not allowed ; } elseif (stristr($_REQUEST["TEMPLATE"], "://")) { if ($fileAccessLevel == -1) { echo "Configuration setting prohibit using remote files, exiting\n"; return; } else { // URL files are allowed $TEMPLATEfilename = $_REQUEST["TEMPLATE"]; } } else { if (($fileAccessLevel == 1) || ($fileAccessLevel == -1)) { if (FeedForAll_rss2html_validExtension(basename($_REQUEST["TEMPLATE"]), $allowedTemplateExtensions) === FALSE) { echo "Configuration setting prohibit using the specified template file, exiting\n"; return; } $TEMPLATEfilename = basename($_REQUEST["TEMPLATE"]); } elseif ($fileAccessLevel == 2) { echo "Configuration setting prohibit using local files, exiting\n"; return; } else { // It is local and must be in the same directory $TEMPLATEfilename = basename($_REQUEST["TEMPLATE"]); } } } if (isset($_REQUEST["FeedTitleLength"])) { $limitFeedTitleLength = abs($_REQUEST["FeedTitleLength"]); } if (isset($_REQUEST["FeedDescriptionLength"])) { $limitFeedDescriptionLength = abs($_REQUEST["FeedDescriptionLength"]); } if (isset($_REQUEST["ItemTitleLength"])) { $limitItemTitleLength = abs($_REQUEST["ItemTitleLength"]); } if (isset($_REQUEST["ItemDescriptionLength"])) { $limitItemDescriptionLength = abs($_REQUEST["ItemDescriptionLength"]); } // // Maximum number of items to be displayed // if (isset($_REQUEST["MAXITEMS"])) { $FeedMaxItems = $_REQUEST["MAXITEMS"]; } if (isset($_REQUEST["NOFUTUREITEMS"])) { $NoFutureItems = TRUE; } if (isset($outputCacheTTL) && function_exists("FeedForAll_scripts_readOutputCacheFile") && (($cacheContents = FeedForAll_scripts_readOutputCacheFile($XMLfilename, $TEMPLATEfilename)) !== FALSE)) { if (!headers_sent()) { // Send the Content-Type to force $destinationEncoding header("Content-Type: text/html; charset=$destinationEncoding"); } echo $cacheContents; } else { if (($template = FeedForAll_scripts_readFile($TEMPLATEfilename, $useFopenURL)) === FALSE) { if (!isset($hideErrors)) { if ($ReadErrorString == "") { echo "Unable to open template $TEMPLATEfilename, exiting\n"; } else { echo "Unable to open template $TEMPLATEfilename with error <b>$ReadErrorString</b>, exiting\n"; } } return; } if (FeedForAll_rss2html_isTemplate($template) === FALSE) { if (!isset($hideErrors)) { echo "$TEMPLATEfilename is not a valid rss2html.php template file, exiting\n"; } return; } if (strstr($template, "~~~NoFutureItems~~~")) { $NoFutureItems = TRUE; } if (($XML = FeedForAll_scripts_readFile($XMLfilename, $useFopenURL, $allowCachingXMLFiles)) === FALSE) { if (!isset($hideErrors)) { if ($ReadErrorString == "") { echo "Unable to open RSS Feed $XMLfilename, exiting\n"; } else { echo "Unable to open RSS Feed $XMLfilename with error <b>$ReadErrorString</b>, exiting\n"; } } return; } if (strstr(trim($XML), "<?xml") === FALSE) { $XML = "<?xml version=\"1.0\"?>\n$XML"; } $XML = strstr(trim($XML), "<?xml"); $XML = FeedForAll_preProcessXML($XML); if (($convertedXML = FeedForAll_scripts_convertEncoding($XML, $missingEncodingDefault, $destinationEncoding)) === FALSE) { // Conversions failed, probably becasue it was wrong or the routines were missing $convertedXML = $XML; $xml_parser = xml_parser_create(); } else { $xml_parser = xml_parser_create($destinationEncoding); } $rss_parser = new baseParserClass("rss2html"); $rss_parser->noFutureItems = $NoFutureItems; $rss_parser->wholeString = $convertedXML; xml_set_object($xml_parser, $rss_parser); xml_set_element_handler($xml_parser, "startElement", "endElement"); xml_set_character_data_handler($xml_parser, "characterData"); xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING,1); $parseResult = xml_parse($xml_parser, $convertedXML, TRUE); if ($parseResult == 0) { if (!isset($hideErrors)) { $errorCode = xml_get_error_code($xml_parser); echo "\$errorCode = $errorCode<br>\n"; echo "xml_error_string() = ".xml_error_string($errorCode)."<br>\n"; echo "xml_get_current_line_number() = ".xml_get_current_line_number($xml_parser)."<br>\n"; echo "xml_get_current_column_number() = ".xml_get_current_column_number($xml_parser)."<br>\n"; echo "xml_get_current_byte_index() = ".xml_get_current_byte_index($xml_parser)."<br>\n"; } } else { 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~~~", FeedForAll_rss2html_EscapeLink($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~~~", FeedForAll_rss2html_EscapeLink($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~~~", FeedForAll_rss2html_EscapeLink($rss_parser->FeedImageURL), $template); $template = FeedForAll_rss2html_str_replace("~~~FeedImageTitle~~~", $rss_parser->FeedImageTitle, $template); $template = FeedForAll_rss2html_str_replace("~~~FeedImageLink~~~", FeedForAll_rss2html_EscapeLink($rss_parser->FeedImageLink), $template); $template = FeedForAll_rss2html_str_replace("~~~FeedImageDescription~~~", $rss_parser->FeedImageDescription, $template); $template = FeedForAll_rss2html_str_replace("~~~FeedImageHeight~~~", $rss_parser->FeedImageWidth, $template); $template = FeedForAll_rss2html_str_replace("~~~FeedImageWidth~~~", $rss_parser->FeedImageWidth, $template); $template = FeedForAll_rss2html_str_replace("~~~FeedCreativeCommons~~~", FeedForAll_rss2html_EscapeLink($rss_parser->FeedCreativeCommons), $template); if (FeedForAll_parseExtensions() === TRUE) { $template = FeedForAll_parseExtensions_replaceInChannel($rss_parser, $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->Items)-1; $x++) { for ($y = $x+1; $y < count($rss_parser->Items); $y++) { if ($rss_parser->Items[$x]->pubDate_t < $rss_parser->Items[$y]->pubDate_t) { // Swap them $swapTemp = $rss_parser->Items[$x]; $rss_parser->Items[$x] = $rss_parser->Items[$y]; $rss_parser->Items[$y] = $swapTemp; } } } } if (isset($debugLevel) && ($debugLevel >= 3)) { echo "DIAG: adding to items, count=".count($rss_parser->Items)."<br>\n"; } // 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->Items)) { if ($FeedMaxItems > 0) { $FeedMaxItems = count($rss_parser->Items); } else { $FeedMaxItems = -count($rss_parser->Items); } } } } } if (!function_exists("FeedForALL_rss2html_replaceInItem")) { Function FeedForALL_rss2html_replaceInItem($source, $currentItem) { GLOBAL $limitFeedTitleLength; GLOBAL $limitFeedDescriptionLength; GLOBAL $limitItemTitleLength; GLOBAL $limitItemDescriptionLength; GLOBAL $LongDateFormat; GLOBAL $ShortDateFormat; GLOBAL $LongTimeFormat; GLOBAL $ShortTimeFormat; GLOBAL $XMLfilename; $item = FeedForAll_rss2html_str_replace("~~~ItemTitle~~~", FeedForAll_rss2html_limitLength($currentItem->title, $limitItemTitleLength), $source); $item = FeedForAll_rss2html_str_replace("~~~ItemDescription~~~", FeedForAll_rss2html_limitLength($currentItem->description, $limitItemDescriptionLength), $item); $item = FeedForAll_rss2html_str_replace("~~~ItemEnclosureLengthFormatted~~~", FeedForAll_rss2html_sizeToString($currentItem->enclosureLength), $item); $item = FeedForAll_rss2html_str_replace("~~~ItemPubLongDate~~~", date($LongDateFormat, $currentItem->pubDate_t), $item); $item = FeedForAll_rss2html_str_replace("~~~ItemPubShortDate~~~", date($ShortDateFormat, $currentItem->pubDate_t), $item); $item = FeedForAll_rss2html_str_replace("~~~ItemPubLongTime~~~", date($LongTimeFormat, $currentItem->pubDate_t), $item); $item = FeedForAll_rss2html_str_replace("~~~ItemPubShortTime~~~", date($ShortTimeFormat, $currentItem->pubDate_t), $item); $knownFields = $currentItem->getArrayOfFields(); foreach ($knownFields as $field) { $item = FeedForAll_rss2html_str_replace($field, $currentItem->getValueOf($field), $item); } $item = FeedForAll_rss2html_CreateUniqueLink($currentItem->title, $currentItem->description, $currentItem->link, $currentItem->guid, $XMLfilename, $item); if (FeedForAll_parseExtensions() === TRUE) { $item = FeedForAll_parseExtensions_replaceInItem($currentItem, $item); } return FeedForAll_rss2html_AddIdentity($item); } } // // Allow access to the number of times that will be processed in the feed $template = FeedForAll_rss2html_str_replace("~~~NumberOfFeedItems~~~", min(abs($FeedMaxItems), count($rss_parser->Items)), $template); // // 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->Items)); 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->Items)-1; $x >= count($rss_parser->Items) + $FeedMaxItems; $x--) { $allitems .= FeedForALL_rss2html_replaceInItem($block1, $rss_parser->Items[$x]); $x--; if ($x >= count($rss_parser->Items) + $FeedMaxItems) { // // This is at least one more item so use the Alternate definition // $allitems .= FeedForALL_rss2html_replaceInItem($block2, $rss_parser->Items[$x]); } } } else { for ($x = 0; $x < $loop_limit; $x++) { if (isset($debugLevel) && ($debugLevel >= 2)) { echo "DIAG: Doing item fillin, \$x = $x; \$loop_limit = $loop_limit<br>\n"; } $allitems .= FeedForALL_rss2html_replaceInItem($block1, $rss_parser->Items[$x]); $x++; if ($x < $loop_limit) { // // This is at least one more item so use the Alternate definition // if (isset($debugLevel) && ($debugLevel >= 2)) { echo "DIAG: Doing item fillin, \$x = $x; \$loop_limit = $loop_limit<br>\n"; } $allitems .= FeedForALL_rss2html_replaceInItem($block2, $rss_parser->Items[$x]); } } } $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"); } $resultHTML = FeedForAll_rss2html_pro($template); echo $resultHTML; if (isset($outputCacheTTL) && function_exists("FeedForAll_scripts_writeOutputCacheFile")) { FeedForAll_scripts_writeOutputCacheFile($XMLfilename, $TEMPLATEfilename, $resultHTML); } } } } else { if (!headers_sent()) { // Send the Content-Type to force $destinationEncoding header("Content-Type: text/html; charset=$destinationEncoding"); } echo "<html><head><title>rss2html.php URL tool</title><meta http-equiv=\"content-type\" content=\"text/html;charset=$destinationEncoding\"></head><body bgcolor=\"#EEEEFF\">\n"; // // We are in "buildURL" mode to help create properly encoded URLs to pass to rss2html.php $_xml = ""; if (isset($_POST["XML"])) { $_xml = $_POST["XML"]; } $_template = ""; if (isset($_POST["TEMPLATE"])) { $_template = $_POST["TEMPLATE"]; } $_maxitems = ""; if (isset($_POST["MAXITEMS"])) { $_maxitems = $_POST["MAXITEMS"]; } $_nofutureitems = ""; if (isset($_POST["NOFUTUREITEMS"])) { $_nofutureitems = $_POST["NOFUTUREITEMS"]; } if (function_exists("FeedForAll_scripts_contentOfCache")) { $_cacheTTL = ""; if (isset($_POST["XMLCACHETTL"])) { $_cacheTTL = $_POST["XMLCACHETTL"]; } $_allowCachingXMLFiles = ""; if (isset($_POST["ALLOWXMLCACHE"])) { $_allowCachingXMLFiles = $_POST["ALLOWXMLCACHE"]; } $_outputCacheTTL = ""; if (isset($_POST["OUTCACHETTL"])) { $_outputCacheTTL = $_POST["OUTCACHETTL"]; } $_outputCacheFileName = ""; if (isset($_POST["OUTCACHENAME"])) { $_outputCacheFileName = $_POST["OUTCACHENAME"]; } } // Display the entry form echo "<center><h1>RSS2HTML.PHP LINK TOOL</h1></center>\n"; echo "<p>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.</p>\n"; echo "<form action=\"$_SERVER[php_SELF]\" method=\"POST\">\n"; echo "<input type=\"hidden\" name=\"buildURL\" value=\"1\">\n"; echo "URL for the XML file: (ie. http://www.myserver.com/file.xml)<br><input type=\"text\" name=\"XML\" size=\"100\" value=\"$_xml\"><br>\n"; echo "URL for the template file: (ie. http://www.myserver.com/template.html)<br><input type=\"text\" name=\"TEMPLATE\" size=\"100\" value=\"$_template\"><br>\n"; echo "<b>Optional items:</b><br>\n"; echo "Maximum items: <input type=\"text\" name=\"MAXITEMS\" size=\"5\" value=\"$_maxitems\"> (Use negative numbers for the last X items)<br>\n"; echo "No future items: <input type=\"checkbox\" name=\"NOFUTUREITEMS\" "; if ($_nofutureitems == "on") { echo "CHECKED"; } echo "><br>\n"; if (function_exists("FeedForAll_scripts_contentOfCache")) { echo "<table cellpadding=\"2\" cellspacing=\"2\" width=\"100%\" border=\"1\"><tr><td>\n"; echo "<strong>XML (input) Cache Settings</strong><br>\n"; echo "Allow Caching of the feed: <input type=\"checkbox\" name=\"ALLOWXMLCACHE\" "; if ($_allowCachingXMLFiles == "on") { echo "CHECKED"; } echo "><br>\n"; echo "Cache Time: <input type=\"text\" name=\"XMLCACHETTL\" size=\"5\" value=\"$_cacheTTL\"> (The number of seconds a file may be cached for before being fetched again)<br>\n"; echo "<hr>\n"; echo "<strong>HTML (output) Cache Settings</strong><br>\n"; echo "Output Cache Time: <input type=\"text\" name=\"OUTCACHETTL\" size=\"5\" value=\"$_outputCacheTTL\"> (The number of seconds the output may be cached for before being recreated)<br>\n"; echo "Output Cache Name: <input type=\"text\" name=\"OUTCACHENAME\" size=\"40\" value=\"$_outputCacheFileName\"> (This should be a unique name to prevent conflicts)<br>\n"; echo "</td></tr></table>\n"; } echo "<input type=\"submit\" name=\"submit\" value=\"Submit\">\n"; echo "</form>\n"; $xmlContents = ""; $templateContents = ""; if (isset($_POST["submit"])) { if ($_SERVER["REQUEST_METHOD"] != "POST") { return; } echo "<hr>\n"; $answer = ""; $answerAlt = ""; $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"]); $answerAlt .= "\$XMLFILE = \"".str_replace("&", "&", $_POST["XML"])."\";<br>"; $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"]); $answerAlt .= "\$TEMPLATE = \"".str_replace("&", "&", $_POST["TEMPLATE"])."\";<br>"; $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]"; $answerAlt .= "\$MAXITEMS = \"$_POST[MAXITEMS]\";<br>\n"; $ssi .= "&MAXITEMS=$_POST[MAXITEMS]"; } if (isset($_POST["NOFUTUREITEMS"]) && $_POST["NOFUTUREITEMS"] == "on") { $answer .= "&NOFUTUREITEMS=1"; $answerAlt .= "\$NOFUTUREITEMS = \"1\";<br>\n"; $ssi .= "&NOFUTUREITEMS=1"; } if (function_exists("FeedForAll_scripts_contentOfCache")) { if (isset($_POST["ALLOWXMLCACHE"]) && $_POST["ALLOWXMLCACHE"] == "on") { $answerAlt .= "\$ALLOWXMLCACHE = \"1\";<br>\n"; } if (isset($_POST["XMLCACHETTL"]) && ($_POST["XMLCACHETTL"] != "") && (intval($_POST["XMLCACHETTL"]) != 0)) { $answerAlt .= "\$XMLCACHETTL = \"$_POST[xmlCACHETTL]\";<br>\n"; } if (isset($_POST["OUTCACHETTL"]) && isset($_POST["OUTCACHENAME"])) { if (($_POST["OUTCACHETTL"] != "") && (intval($_POST["OUTCACHETTL"]) != 0) && ($_POST["OUTCACHENAME"] != "")) { $answerAlt .= "\$OUTCACHETTL = \"$_POST[OUTCACHETTL]\";<br>\n"; $answerAlt .= "\$OUTCACHENAME = \"$_POST[OUTCACHENAME]\";<br>\n"; } } } echo "<h1>Results</h1>\n"; if (isset($_POST["XML"]) && $_POST["XML"] != "") { $XMLfilename = ""; if (stristr($_POST["XML"], "file"."://")) { // Not allowed ; } elseif (stristr($_POST["XML"], "://")) { if ($fileAccessLevel == -1) { echo "<p style=\"color: red;\">Configuration setting prohibit using remote files</p>\n"; } else { // URL files are allowed $XMLfilename = $_POST["XML"]; } } else { if (($fileAccessLevel == 1) || ($fileAccessLevel == -1)) { if (FeedForAll_rss2html_validExtension(basename($_POST["XML"]), $allowedFeedExtensions) === FALSE) { echo "<p style=\"color: red;\">Configuration setting prohibit using the specified feed file</p>\n"; } else { $XMLfilename = basename($_POST["XML"]); } } elseif ($fileAccessLevel == 2) { echo "<p style=\"color: red;\">Configuration setting prohibit using local files</p>\n"; } else { // It is local and must be in the same directory $XMLfilename = basename($_POST["XML"]); } } if ($XMLfilename != "") { if (($xmlContents = FeedForAll_scripts_readFile($XMLfilename, $useFopenURL)) === FALSE) { if ($ReadErrorString == "") { echo "<p>The XML file <b>$_POST[xml]</b> could not be opened.</p>\n"; } else { echo "<p>The XML file <b>$_POST[xml]</b> could not be opened with the error <b>$ReadErrorString</b>.</p>\n"; } } else { echo "<p>The XML file <b>$_POST[xml]</b> was SUCCESSFULLY opened</p>\n"; } } } if (isset($_POST["TEMPLATE"]) && $_POST["TEMPLATE"] != "") { $TEMPLATEfilename = ""; if (stristr($_POST["TEMPLATE"], "file"."://")) { // Not allowed ; } elseif (stristr($_POST["TEMPLATE"], "://")) { if ($fileAccessLevel == -1) { echo "<p style=\"color: red;\">Configuration setting prohibit using remote files</p>\n"; } else { // URL files are allowed $TEMPLATEfilename = $_POST["TEMPLATE"]; } } else { if (($fileAccessLevel == 1) || ($fileAccessLevel == -1)) { if (FeedForAll_rss2html_validExtension(basename($_POST["TEMPLATE"]), $allowedTemplateExtensions) === FALSE) { echo "<p style=\"color: red;\">Configuration setting prohibit using the specified template file</p>\n"; } else { $TEMPLATEfilename = basename($_POST["TEMPLATE"]); } } elseif ($fileAccessLevel == 2) { echo "<p style=\"color: red;\">Configuration setting prohibit using local files</p>\n"; } else { // It is local and must be in the same directory $TEMPLATEfilename = basename($_POST["TEMPLATE"]); } } if ($TEMPLATEfilename != "") { if (($templateContents = FeedForAll_scripts_readFile($TEMPLATEfilename, $useFopenURL)) === FALSE) { if ($ReadErrorString == "") { echo "<p>The template file <b>$_POST[TEMPLATE]</b> could not be opened.</p>\n"; } else { echo "<p>The template file <b>$_POST[TEMPLATE]</b> could not be opened with the error <b>$ReadErrorString</b>.</p>\n"; } } elseif (FeedForAll_rss2html_isTemplate($templateContents) === FALSE) { echo "$_POST[TEMPLATE] is not a valid rss2html.php template file\n"; $templateContents = ""; } else { echo "<p>The template file <b>$_POST[TEMPLATE]</b> was SUCCESSFULLY opened</p>\n"; } } } if ($xmlurl != "") { echo "<p>URL for the XML file properly encoded:<br><pre>$xmlurl</pre></p>\n"; } if ($templateurl != "") { echo "<p>URL for the template file properly encoded:<br><pre>$templateurl</pre></p>\n"; } echo "<h2>Test Link</h2>\n"; echo "<p>Click on link to view results: <a href=\"$answer\" target=\"_blank\">$answer</a></p>\n"; echo "<h2>Example Usage</h2>\n"; echo "<p>Server Side Include:<br><nobr style=\"font-weight: bolder; color: red;\">&lt!--#INCLUDE VIRTUAL="".basename($_SERVER["PHP_SELF"])."?$ssi" --></nobr></p>\n"; echo "<p>Prefered PHP Include:<br><nobr style=\"font-weight: bolder; color: red;\"><?php<br>$answerAlt\ninclude("".basename($_SERVER["PHP_SELF"])."");<br>?></nobr></p>\n"; echo "<p>PHP Include (Due to security concerns many ISP have configured their servers to prevent this from working):<br><nobr style=\"font-weight: bolder; color: red;\"><?php<br>include("$answer");<br>?></nobr></p>\n"; } if ($xmlContents != "" || $templateContents != "") { echo "<br><hr><br>\n"; if ($xmlContents != "") { echo "<h1>XML file</h1>\n"; if (($convertedXML = FeedForAll_scripts_convertEncoding($xmlContents, $missingEncodingDefault, $destinationEncoding)) === FALSE) { // Conversions failed, probably becasue it was wrong or the routines were missing $convertedXML = $xmlContents; } $convertedXML = str_replace("&", "&", $convertedXML); $convertedXML = str_replace("<", "<", $convertedXML); $convertedXML = str_replace(">", ">", $convertedXML); echo "<pre>$convertedXML</pre><br>\n"; } if ($templateContents != "") { echo "<h1>Template file</h1>\n"; $templateContents = str_replace("&", "&", $templateContents); $templateContents = str_replace("<", "<", $templateContents); $templateContents = str_replace(">", ">", $templateContents); echo "<pre>$templateContents</pre><br>\n"; } } } ?>
  13. This is the rss feed script. <?PHP if (($useFopenURL == 0) && !function_exists("curl_init")) { $useFopenURL = -1; if (isset($debugLevel) && ($debugLevel >= 3)) { echo "DIAG: setting \$useFopenURL=-1 because curl_init() doesn't exist<br>\n"; } } if (($useFopenURL == -1) && !function_exists("fsockopen")) { $useFopenURL = 1; if (isset($debugLevel) && ($debugLevel >= 3)) { echo "DIAG: setting \$useFopenURL=1 because fsockopen() doesn't exist<br>\n"; } } if ($useFopenURL == 1) { ini_set("allow_url_fopen", "1"); ini_set("user_agent", "FeedForAll rss2html scripts v3"); } $FeedMaxItems = 10000; $NoFutureItems = FALSE; @include("FeedForAll_rss2html_pro.php"); if (function_exists("FeedForAll_rss2html_pro") === FALSE) { Function FeedForAll_rss2html_pro($source) { // // This is the place to do any processing that is desired return $source; } } if (function_exists("FeedForAll_parseExtensions") === FALSE) { Function FeedForAll_parseExtensions() { return FALSE; } } @include("FeedForAll_Scripts_CachingExtension.php"); @include_once("FeedForAll_XMLParser.inc.php"); if (function_exists("FeedForAll_rss2html_limitLength") === FALSE) { Function FeedForAll_rss2html_limitLength($initialValue, $limit = 0) { if (($limit == 0) || (strlen($initialValue) <= $limit )) { // ZERO is for not limited return $initialValue; } // Cut the text at the exact point, ignoring if it is in a word. $result = substr($initialValue, 0, $limit); // Check to see if there are any space we can trim at and if it is not // too far from where we are $lastSpace = strrchr($result,' '); if (($lastSpace !== FALSE) && (strlen($lastSpace) < 20)) { // lose any incomplete word at the end $result = substr($result, 0, -(strlen($lastSpace))); // Append elipses, ... , to show it was truncated $result .= " ..."; } return $result; } } if (function_exists("FeedForAll_rss2html_sizeToString") === FALSE) { Function FeedForAll_rss2html_sizeToString($filesize) { if ($filesize == "") { return ""; } elseif ($filesize >= 1073741824) { return number_format($filesize/1073741824, 1, ".", ",")." GBytes"; } elseif ($filesize >= 1048576) { return number_format($filesize/1048576, 1, ".", ",")." MBytes"; } elseif ($filesize >= 1024) { return number_format($filesize/1024, 1, ".", ",")." KBytes"; } else { return $filesize." Bytes"; } } } if (function_exists("FeedForAll_rss2html_isTemplate") === FALSE) { Function FeedForAll_rss2html_isTemplate($templateData) { if ((strstr($templateData, "~~~Feed") !== FALSE) || (strstr($templateData, "~~~Item") !== FALSE)) { return TRUE; } return FALSE; } } if (function_exists("FeedForAll_rss2html_validExtension") === FALSE) { Function FeedForAll_rss2html_validExtension($filename, $extensions) { $foundValid = FALSE; foreach ($extensions as $value) { if (strtolower($value) == strtolower(substr($filename, -strlen($value)))) { $foundValid = TRUE; break; } } return $foundValid; } } if (function_exists("FeedForAll_rss2html_str_replace") === FALSE) { Function FeedForAll_rss2html_str_replace($search, $replace, $subject) { return str_replace($search, $replace, $subject); } } if (function_exists("FeedForAll_rss2html_encodeURL") === FALSE) { Function FeedForAll_rss2html_encodeURL($URLstring, $includePND = 0) { $result = ""; for ($x = 0; $x < strlen($URLstring); $x++) { if ($URLstring[$x] == '%') { $result = $result."%25"; } elseif ($URLstring[$x] == '?') { $result = $result."%3f"; } elseif ($URLstring[$x] == '&') { $result = $result."%26"; } elseif ($URLstring[$x] == '=') { $result = $result."%3d"; } elseif ($URLstring[$x] == '+') { $result = $result."%2b"; } elseif ($URLstring[$x] == ' ') { $result = $result."%20"; } elseif ($includePND && ($URLstring[$x] == '#')) { $result = $result."%23"; }else { $result = $result.$URLstring[$x]; } } return $result; } } if (function_exists("FeedForAll_rss2html_CreateUniqueLink") === FALSE) { Function FeedForAll_rss2html_CreateUniqueLink($title, $description, $link, $guid, $XMLfilename, $itemTemplate) { GLOBAL $TEMPLATEfilename; $match = Array(); while (preg_match("/~~~ItemUniqueLinkWithTemplate=.*~~~/", $itemTemplate, $match) !== FALSE) { if ((count($match) == 0) || ($match[0] == "")) { // All done return $itemTemplate; } $replace = "http://$_SERVER[sERVER_NAME]$_SERVER[sCRIPT_NAME]?XMLFILE=".FeedForAll_rss2html_encodeURL($XMLfilename)."&TEMPLATE=".FeedForAll_rss2html_encodeURL($TEMPLATEfilename); $itemTemplate = FeedForAll_rss2html_str_replace($match[0], $replace, $itemTemplate); } if ($title); if ($description); if ($link); if ($guid); return $itemTemplate; } } if (function_exists("FeedForAll_rss2html_UseUniqueLink") === FALSE) { Function FeedForAll_rss2html_UseUniqueLink($title, $description, $link, $guid) { if ($title); if ($description); if ($link); if ($guid); return -1; } } if (function_exists("FeedForAll_rss2html_EscapeLink") === FALSE) { Function FeedForAll_rss2html_EscapeLink($link) { GLOBAL $escapeAmpInLinks; if ((strstr($link, "://") !== FALSE) && $escapeAmpInLinks) { // In HTML a link with an & must be converted to & // And for here without :// it is not a link, since relative // URLs are not allowed $link = str_replace("&", "&", $link); } return $link; } } if (function_exists("FeedForAll_rss2html_AddIdentity") === FALSE) { Function FeedForAll_rss2html_AddIdentity($itemString) { return "<!-- HTML generated from an RSS Feed by rss2html.php, http://www.FeedForAll.com/ a NotePage, Inc. product (http://www.notepage.com/) -->".$itemString; } } if (!isset($_REQUEST["buildURL"])) { // // Check variables that could be used if URL wrapper are disable or not working if (isset($GLOBALS["XMLFILE"])) { $XMLfilename = $GLOBALS["XMLFILE"]; } if (isset($GLOBALS["TEMPLATE"])) { $TEMPLATEfilename = $GLOBALS["TEMPLATE"]; } if (isset($GLOBALS["FeedTitleLength"])) { $limitFeedTitleLength = abs($GLOBALS["FeedTitleLength"]); } if (isset($GLOBALS["FeedDescriptionLength"])) { $limitFeedDescriptionLength = abs($GLOBALS["FeedDescriptionLength"]); } if (isset($GLOBALS["ItemTitleLength"])) { $limitItemTitleLength = abs($GLOBALS["ItemTitleLength"]); } if (isset($GLOBALS["ItemDescriptionLength"])) { $limitItemDescriptionLength = abs($GLOBALS["ItemDescriptionLength"]); } if (isset($GLOBALS["MAXITEMS"])) { $FeedMaxItems = $GLOBALS["MAXITEMS"]; } if (isset($GLOBALS["NOFUTUREITEMS"])) { $NoFutureItems = TRUE; } if (isset($_REQUEST["XMLFILE"])) { if (stristr($_REQUEST["XMLFILE"], "file"."://")) { // Not allowed ; } elseif (stristr($_REQUEST["XMLFILE"], "://")) { if ($fileAccessLevel == -1) { echo "Configuration setting prohibit using remote files, exiting\n"; return; } else { // URL files are allowed $XMLfilename = $_REQUEST["XMLFILE"]; } } else { if (($fileAccessLevel == 1) || ($fileAccessLevel == -1)) { if (FeedForAll_rss2html_validExtension(basename($_REQUEST["XMLFILE"]), $allowedFeedExtensions) === FALSE) { echo "Configuration setting prohibit using the specified feed file, exiting\n"; return; } $XMLfilename = basename($_REQUEST["XMLFILE"]); } elseif ($fileAccessLevel == 2) { echo "Configuration setting prohibit using local files, exiting\n"; return; } else { // It is local and must be in the same directory $XMLfilename = basename($_REQUEST["XMLFILE"]); } } } if (isset($_REQUEST["TEMPLATE"])) { if (stristr($_REQUEST["TEMPLATE"], "file"."://")) { // Not allowed ; } elseif (stristr($_REQUEST["TEMPLATE"], "://")) { if ($fileAccessLevel == -1) { echo "Configuration setting prohibit using remote files, exiting\n"; return; } else { // URL files are allowed $TEMPLATEfilename = $_REQUEST["TEMPLATE"]; } } else { if (($fileAccessLevel == 1) || ($fileAccessLevel == -1)) { if (FeedForAll_rss2html_validExtension(basename($_REQUEST["TEMPLATE"]), $allowedTemplateExtensions) === FALSE) { echo "Configuration setting prohibit using the specified template file, exiting\n"; return; } $TEMPLATEfilename = basename($_REQUEST["TEMPLATE"]); } elseif ($fileAccessLevel == 2) { echo "Configuration setting prohibit using local files, exiting\n"; return; } else { // It is local and must be in the same directory $TEMPLATEfilename = basename($_REQUEST["TEMPLATE"]); } } } if (isset($_REQUEST["FeedTitleLength"])) { $limitFeedTitleLength = abs($_REQUEST["FeedTitleLength"]); } if (isset($_REQUEST["FeedDescriptionLength"])) { $limitFeedDescriptionLength = abs($_REQUEST["FeedDescriptionLength"]); } if (isset($_REQUEST["ItemTitleLength"])) { $limitItemTitleLength = abs($_REQUEST["ItemTitleLength"]); } if (isset($_REQUEST["ItemDescriptionLength"])) { $limitItemDescriptionLength = abs($_REQUEST["ItemDescriptionLength"]); } // // Maximum number of items to be displayed // if (isset($_REQUEST["MAXITEMS"])) { $FeedMaxItems = $_REQUEST["MAXITEMS"]; } if (isset($_REQUEST["NOFUTUREITEMS"])) { $NoFutureItems = TRUE; } if (isset($outputCacheTTL) && function_exists("FeedForAll_scripts_readOutputCacheFile") && (($cacheContents = FeedForAll_scripts_readOutputCacheFile($XMLfilename, $TEMPLATEfilename)) !== FALSE)) { if (!headers_sent()) { // Send the Content-Type to force $destinationEncoding header("Content-Type: text/html; charset=$destinationEncoding"); } echo $cacheContents; } else { if (($template = FeedForAll_scripts_readFile($TEMPLATEfilename, $useFopenURL)) === FALSE) { if (!isset($hideErrors)) { if ($ReadErrorString == "") { echo "Unable to open template $TEMPLATEfilename, exiting\n"; } else { echo "Unable to open template $TEMPLATEfilename with error <b>$ReadErrorString</b>, exiting\n"; } } return; } if (FeedForAll_rss2html_isTemplate($template) === FALSE) { if (!isset($hideErrors)) { echo "$TEMPLATEfilename is not a valid rss2html.php template file, exiting\n"; } return; } if (strstr($template, "~~~NoFutureItems~~~")) { $NoFutureItems = TRUE; } if (($XML = FeedForAll_scripts_readFile($XMLfilename, $useFopenURL, $allowCachingXMLFiles)) === FALSE) { if (!isset($hideErrors)) { if ($ReadErrorString == "") { echo "Unable to open RSS Feed $XMLfilename, exiting\n"; } else { echo "Unable to open RSS Feed $XMLfilename with error <b>$ReadErrorString</b>, exiting\n"; } } return; } if (strstr(trim($XML), "<?xml") === FALSE) { $XML = "<?xml version=\"1.0\"?>\n$XML"; } $XML = strstr(trim($XML), "<?xml"); $XML = FeedForAll_preProcessXML($XML); if (($convertedXML = FeedForAll_scripts_convertEncoding($XML, $missingEncodingDefault, $destinationEncoding)) === FALSE) { // Conversions failed, probably becasue it was wrong or the routines were missing $convertedXML = $XML; $xml_parser = xml_parser_create(); } else { $xml_parser = xml_parser_create($destinationEncoding); } $rss_parser = new baseParserClass("rss2html"); $rss_parser->noFutureItems = $NoFutureItems; $rss_parser->wholeString = $convertedXML; xml_set_object($xml_parser, $rss_parser); xml_set_element_handler($xml_parser, "startElement", "endElement"); xml_set_character_data_handler($xml_parser, "characterData"); xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING,1); $parseResult = xml_parse($xml_parser, $convertedXML, TRUE); if ($parseResult == 0) { if (!isset($hideErrors)) { $errorCode = xml_get_error_code($xml_parser); echo "\$errorCode = $errorCode<br>\n"; echo "xml_error_string() = ".xml_error_string($errorCode)."<br>\n"; echo "xml_get_current_line_number() = ".xml_get_current_line_number($xml_parser)."<br>\n"; echo "xml_get_current_column_number() = ".xml_get_current_column_number($xml_parser)."<br>\n"; echo "xml_get_current_byte_index() = ".xml_get_current_byte_index($xml_parser)."<br>\n"; } } else { 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~~~", FeedForAll_rss2html_EscapeLink($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~~~", FeedForAll_rss2html_EscapeLink($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~~~", FeedForAll_rss2html_EscapeLink($rss_parser->FeedImageURL), $template); $template = FeedForAll_rss2html_str_replace("~~~FeedImageTitle~~~", $rss_parser->FeedImageTitle, $template); $template = FeedForAll_rss2html_str_replace("~~~FeedImageLink~~~", FeedForAll_rss2html_EscapeLink($rss_parser->FeedImageLink), $template); $template = FeedForAll_rss2html_str_replace("~~~FeedImageDescription~~~", $rss_parser->FeedImageDescription, $template); $template = FeedForAll_rss2html_str_replace("~~~FeedImageHeight~~~", $rss_parser->FeedImageWidth, $template); $template = FeedForAll_rss2html_str_replace("~~~FeedImageWidth~~~", $rss_parser->FeedImageWidth, $template); $template = FeedForAll_rss2html_str_replace("~~~FeedCreativeCommons~~~", FeedForAll_rss2html_EscapeLink($rss_parser->FeedCreativeCommons), $template); if (FeedForAll_parseExtensions() === TRUE) { $template = FeedForAll_parseExtensions_replaceInChannel($rss_parser, $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->Items)-1; $x++) { for ($y = $x+1; $y < count($rss_parser->Items); $y++) { if ($rss_parser->Items[$x]->pubDate_t < $rss_parser->Items[$y]->pubDate_t) { // Swap them $swapTemp = $rss_parser->Items[$x]; $rss_parser->Items[$x] = $rss_parser->Items[$y]; $rss_parser->Items[$y] = $swapTemp; } } } } if (isset($debugLevel) && ($debugLevel >= 3)) { echo "DIAG: adding to items, count=".count($rss_parser->Items)."<br>\n"; } // 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->Items)) { if ($FeedMaxItems > 0) { $FeedMaxItems = count($rss_parser->Items); } else { $FeedMaxItems = -count($rss_parser->Items); } } } } } if (!function_exists("FeedForALL_rss2html_replaceInItem")) { Function FeedForALL_rss2html_replaceInItem($source, $currentItem) { GLOBAL $limitFeedTitleLength; GLOBAL $limitFeedDescriptionLength; GLOBAL $limitItemTitleLength; GLOBAL $limitItemDescriptionLength; GLOBAL $LongDateFormat; GLOBAL $ShortDateFormat; GLOBAL $LongTimeFormat; GLOBAL $ShortTimeFormat; GLOBAL $XMLfilename; $item = FeedForAll_rss2html_str_replace("~~~ItemTitle~~~", FeedForAll_rss2html_limitLength($currentItem->title, $limitItemTitleLength), $source); $item = FeedForAll_rss2html_str_replace("~~~ItemDescription~~~", FeedForAll_rss2html_limitLength($currentItem->description, $limitItemDescriptionLength), $item); $item = FeedForAll_rss2html_str_replace("~~~ItemEnclosureLengthFormatted~~~", FeedForAll_rss2html_sizeToString($currentItem->enclosureLength), $item); $item = FeedForAll_rss2html_str_replace("~~~ItemPubLongDate~~~", date($LongDateFormat, $currentItem->pubDate_t), $item); $item = FeedForAll_rss2html_str_replace("~~~ItemPubShortDate~~~", date($ShortDateFormat, $currentItem->pubDate_t), $item); $item = FeedForAll_rss2html_str_replace("~~~ItemPubLongTime~~~", date($LongTimeFormat, $currentItem->pubDate_t), $item); $item = FeedForAll_rss2html_str_replace("~~~ItemPubShortTime~~~", date($ShortTimeFormat, $currentItem->pubDate_t), $item); $knownFields = $currentItem->getArrayOfFields(); foreach ($knownFields as $field) { $item = FeedForAll_rss2html_str_replace($field, $currentItem->getValueOf($field), $item); } $item = FeedForAll_rss2html_CreateUniqueLink($currentItem->title, $currentItem->description, $currentItem->link, $currentItem->guid, $XMLfilename, $item); if (FeedForAll_parseExtensions() === TRUE) { $item = FeedForAll_parseExtensions_replaceInItem($currentItem, $item); } return FeedForAll_rss2html_AddIdentity($item); } } // // Allow access to the number of times that will be processed in the feed $template = FeedForAll_rss2html_str_replace("~~~NumberOfFeedItems~~~", min(abs($FeedMaxItems), count($rss_parser->Items)), $template); // // 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->Items)); 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->Items)-1; $x >= count($rss_parser->Items) + $FeedMaxItems; $x--) { $allitems .= FeedForALL_rss2html_replaceInItem($block1, $rss_parser->Items[$x]); $x--; if ($x >= count($rss_parser->Items) + $FeedMaxItems) { // // This is at least one more item so use the Alternate definition // $allitems .= FeedForALL_rss2html_replaceInItem($block2, $rss_parser->Items[$x]); } } } else { for ($x = 0; $x < $loop_limit; $x++) { if (isset($debugLevel) && ($debugLevel >= 2)) { echo "DIAG: Doing item fillin, \$x = $x; \$loop_limit = $loop_limit<br>\n"; } $allitems .= FeedForALL_rss2html_replaceInItem($block1, $rss_parser->Items[$x]); $x++; if ($x < $loop_limit) { // // This is at least one more item so use the Alternate definition // if (isset($debugLevel) && ($debugLevel >= 2)) { echo "DIAG: Doing item fillin, \$x = $x; \$loop_limit = $loop_limit<br>\n"; } $allitems .= FeedForALL_rss2html_replaceInItem($block2, $rss_parser->Items[$x]); } } } $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"); } $resultHTML = FeedForAll_rss2html_pro($template); echo $resultHTML; if (isset($outputCacheTTL) && function_exists("FeedForAll_scripts_writeOutputCacheFile")) { FeedForAll_scripts_writeOutputCacheFile($XMLfilename, $TEMPLATEfilename, $resultHTML); } } } } else { if (!headers_sent()) { // Send the Content-Type to force $destinationEncoding header("Content-Type: text/html; charset=$destinationEncoding"); } echo "<html><head><title>rss2html.php URL tool</title><meta http-equiv=\"content-type\" content=\"text/html;charset=$destinationEncoding\"></head><body bgcolor=\"#EEEEFF\">\n"; // // We are in "buildURL" mode to help create properly encoded URLs to pass to rss2html.php $_xml = ""; if (isset($_POST["XML"])) { $_xml = $_POST["XML"]; } $_template = ""; if (isset($_POST["TEMPLATE"])) { $_template = $_POST["TEMPLATE"]; } $_maxitems = ""; if (isset($_POST["MAXITEMS"])) { $_maxitems = $_POST["MAXITEMS"]; } $_nofutureitems = ""; if (isset($_POST["NOFUTUREITEMS"])) { $_nofutureitems = $_POST["NOFUTUREITEMS"]; } if (function_exists("FeedForAll_scripts_contentOfCache")) { $_cacheTTL = ""; if (isset($_POST["XMLCACHETTL"])) { $_cacheTTL = $_POST["XMLCACHETTL"]; } $_allowCachingXMLFiles = ""; if (isset($_POST["ALLOWXMLCACHE"])) { $_allowCachingXMLFiles = $_POST["ALLOWXMLCACHE"]; } $_outputCacheTTL = ""; if (isset($_POST["OUTCACHETTL"])) { $_outputCacheTTL = $_POST["OUTCACHETTL"]; } $_outputCacheFileName = ""; if (isset($_POST["OUTCACHENAME"])) { $_outputCacheFileName = $_POST["OUTCACHENAME"]; } } // Display the entry form echo "<center><h1>RSS2HTML.PHP LINK TOOL</h1></center>\n"; echo "<p>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.</p>\n"; echo "<form action=\"$_SERVER[php_SELF]\" method=\"POST\">\n"; echo "<input type=\"hidden\" name=\"buildURL\" value=\"1\">\n"; echo "URL for the XML file: (ie. http://www.myserver.com/file.xml)<br><input type=\"text\" name=\"XML\" size=\"100\" value=\"$_xml\"><br>\n"; echo "URL for the template file: (ie. http://www.myserver.com/template.html)<br><input type=\"text\" name=\"TEMPLATE\" size=\"100\" value=\"$_template\"><br>\n"; echo "<b>Optional items:</b><br>\n"; echo "Maximum items: <input type=\"text\" name=\"MAXITEMS\" size=\"5\" value=\"$_maxitems\"> (Use negative numbers for the last X items)<br>\n"; echo "No future items: <input type=\"checkbox\" name=\"NOFUTUREITEMS\" "; if ($_nofutureitems == "on") { echo "CHECKED"; } echo "><br>\n"; if (function_exists("FeedForAll_scripts_contentOfCache")) { echo "<table cellpadding=\"2\" cellspacing=\"2\" width=\"100%\" border=\"1\"><tr><td>\n"; echo "<strong>XML (input) Cache Settings</strong><br>\n"; echo "Allow Caching of the feed: <input type=\"checkbox\" name=\"ALLOWXMLCACHE\" "; if ($_allowCachingXMLFiles == "on") { echo "CHECKED"; } echo "><br>\n"; echo "Cache Time: <input type=\"text\" name=\"XMLCACHETTL\" size=\"5\" value=\"$_cacheTTL\"> (The number of seconds a file may be cached for before being fetched again)<br>\n"; echo "<hr>\n"; echo "<strong>HTML (output) Cache Settings</strong><br>\n"; echo "Output Cache Time: <input type=\"text\" name=\"OUTCACHETTL\" size=\"5\" value=\"$_outputCacheTTL\"> (The number of seconds the output may be cached for before being recreated)<br>\n"; echo "Output Cache Name: <input type=\"text\" name=\"OUTCACHENAME\" size=\"40\" value=\"$_outputCacheFileName\"> (This should be a unique name to prevent conflicts)<br>\n"; echo "</td></tr></table>\n"; } echo "<input type=\"submit\" name=\"submit\" value=\"Submit\">\n"; echo "</form>\n"; $xmlContents = ""; $templateContents = ""; if (isset($_POST["submit"])) { if ($_SERVER["REQUEST_METHOD"] != "POST") { return; } echo "<hr>\n"; $answer = ""; $answerAlt = ""; $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"]); $answerAlt .= "\$XMLFILE = \"".str_replace("&", "&", $_POST["XML"])."\";<br>"; $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"]); $answerAlt .= "\$TEMPLATE = \"".str_replace("&", "&", $_POST["TEMPLATE"])."\";<br>"; $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]"; $answerAlt .= "\$MAXITEMS = \"$_POST[MAXITEMS]\";<br>\n"; $ssi .= "&MAXITEMS=$_POST[MAXITEMS]"; } if (isset($_POST["NOFUTUREITEMS"]) && $_POST["NOFUTUREITEMS"] == "on") { $answer .= "&NOFUTUREITEMS=1"; $answerAlt .= "\$NOFUTUREITEMS = \"1\";<br>\n"; $ssi .= "&NOFUTUREITEMS=1"; } if (function_exists("FeedForAll_scripts_contentOfCache")) { if (isset($_POST["ALLOWXMLCACHE"]) && $_POST["ALLOWXMLCACHE"] == "on") { $answerAlt .= "\$ALLOWXMLCACHE = \"1\";<br>\n"; } if (isset($_POST["XMLCACHETTL"]) && ($_POST["XMLCACHETTL"] != "") && (intval($_POST["XMLCACHETTL"]) != 0)) { $answerAlt .= "\$XMLCACHETTL = \"$_POST[xmlCACHETTL]\";<br>\n"; } if (isset($_POST["OUTCACHETTL"]) && isset($_POST["OUTCACHENAME"])) { if (($_POST["OUTCACHETTL"] != "") && (intval($_POST["OUTCACHETTL"]) != 0) && ($_POST["OUTCACHENAME"] != "")) { $answerAlt .= "\$OUTCACHETTL = \"$_POST[OUTCACHETTL]\";<br>\n"; $answerAlt .= "\$OUTCACHENAME = \"$_POST[OUTCACHENAME]\";<br>\n"; } } } echo "<h1>Results</h1>\n"; if (isset($_POST["XML"]) && $_POST["XML"] != "") { $XMLfilename = ""; if (stristr($_POST["XML"], "file"."://")) { // Not allowed ; } elseif (stristr($_POST["XML"], "://")) { if ($fileAccessLevel == -1) { echo "<p style=\"color: red;\">Configuration setting prohibit using remote files</p>\n"; } else { // URL files are allowed $XMLfilename = $_POST["XML"]; } } else { if (($fileAccessLevel == 1) || ($fileAccessLevel == -1)) { if (FeedForAll_rss2html_validExtension(basename($_POST["XML"]), $allowedFeedExtensions) === FALSE) { echo "<p style=\"color: red;\">Configuration setting prohibit using the specified feed file</p>\n"; } else { $XMLfilename = basename($_POST["XML"]); } } elseif ($fileAccessLevel == 2) { echo "<p style=\"color: red;\">Configuration setting prohibit using local files</p>\n"; } else { // It is local and must be in the same directory $XMLfilename = basename($_POST["XML"]); } } if ($XMLfilename != "") { if (($xmlContents = FeedForAll_scripts_readFile($XMLfilename, $useFopenURL)) === FALSE) { if ($ReadErrorString == "") { echo "<p>The XML file <b>$_POST[xml]</b> could not be opened.</p>\n"; } else { echo "<p>The XML file <b>$_POST[xml]</b> could not be opened with the error <b>$ReadErrorString</b>.</p>\n"; } } else { echo "<p>The XML file <b>$_POST[xml]</b> was SUCCESSFULLY opened</p>\n"; } } } if (isset($_POST["TEMPLATE"]) && $_POST["TEMPLATE"] != "") { $TEMPLATEfilename = ""; if (stristr($_POST["TEMPLATE"], "file"."://")) { // Not allowed ; } elseif (stristr($_POST["TEMPLATE"], "://")) { if ($fileAccessLevel == -1) { echo "<p style=\"color: red;\">Configuration setting prohibit using remote files</p>\n"; } else { // URL files are allowed $TEMPLATEfilename = $_POST["TEMPLATE"]; } } else { if (($fileAccessLevel == 1) || ($fileAccessLevel == -1)) { if (FeedForAll_rss2html_validExtension(basename($_POST["TEMPLATE"]), $allowedTemplateExtensions) === FALSE) { echo "<p style=\"color: red;\">Configuration setting prohibit using the specified template file</p>\n"; } else { $TEMPLATEfilename = basename($_POST["TEMPLATE"]); } } elseif ($fileAccessLevel == 2) { echo "<p style=\"color: red;\">Configuration setting prohibit using local files</p>\n"; } else { // It is local and must be in the same directory $TEMPLATEfilename = basename($_POST["TEMPLATE"]); } } if ($TEMPLATEfilename != "") { if (($templateContents = FeedForAll_scripts_readFile($TEMPLATEfilename, $useFopenURL)) === FALSE) { if ($ReadErrorString == "") { echo "<p>The template file <b>$_POST[TEMPLATE]</b> could not be opened.</p>\n"; } else { echo "<p>The template file <b>$_POST[TEMPLATE]</b> could not be opened with the error <b>$ReadErrorString</b>.</p>\n"; } } elseif (FeedForAll_rss2html_isTemplate($templateContents) === FALSE) { echo "$_POST[TEMPLATE] is not a valid rss2html.php template file\n"; $templateContents = ""; } else { echo "<p>The template file <b>$_POST[TEMPLATE]</b> was SUCCESSFULLY opened</p>\n"; } } } if ($xmlurl != "") { echo "<p>URL for the XML file properly encoded:<br><pre>$xmlurl</pre></p>\n"; } if ($templateurl != "") { echo "<p>URL for the template file properly encoded:<br><pre>$templateurl</pre></p>\n"; } echo "<h2>Test Link</h2>\n"; echo "<p>Click on link to view results: <a href=\"$answer\" target=\"_blank\">$answer</a></p>\n"; echo "<h2>Example Usage</h2>\n"; echo "<p>Server Side Include:<br><nobr style=\"font-weight: bolder; color: red;\">&lt!--#INCLUDE VIRTUAL="".basename($_SERVER["PHP_SELF"])."?$ssi" --></nobr></p>\n"; echo "<p>Prefered PHP Include:<br><nobr style=\"font-weight: bolder; color: red;\"><?php<br>$answerAlt\ninclude("".basename($_SERVER["PHP_SELF"])."");<br>?></nobr></p>\n"; echo "<p>PHP Include (Due to security concerns many ISP have configured their servers to prevent this from working):<br><nobr style=\"font-weight: bolder; color: red;\"><?php<br>include("$answer");<br>?></nobr></p>\n"; } if ($xmlContents != "" || $templateContents != "") { echo "<br><hr><br>\n"; if ($xmlContents != "") { echo "<h1>XML file</h1>\n"; if (($convertedXML = FeedForAll_scripts_convertEncoding($xmlContents, $missingEncodingDefault, $destinationEncoding)) === FALSE) { // Conversions failed, probably becasue it was wrong or the routines were missing $convertedXML = $xmlContents; } $convertedXML = str_replace("&", "&", $convertedXML); $convertedXML = str_replace("<", "<", $convertedXML); $convertedXML = str_replace(">", ">", $convertedXML); echo "<pre>$convertedXML</pre><br>\n"; } if ($templateContents != "") { echo "<h1>Template file</h1>\n"; $templateContents = str_replace("&", "&", $templateContents); $templateContents = str_replace("<", "<", $templateContents); $templateContents = str_replace(">", ">", $templateContents); echo "<pre>$templateContents</pre><br>\n"; } } } ?>
  14. In the website I have "News" which comes from a website http://xyz.com/xyz-News?option=com_rd_rss&id=1 It is displaying the News till february but after february it is not updating anything.Could anyone guide me what problem it could be? Here the code : <br> <br> <font color="#eb8412"><strong><u>INDUSTRY N</strong></font><font color="#eb8412"><strong><u>EWS</u></strong></font><br> <?php $XMLFILE = "http://www.xyz.org/index.php?option=com_rd_rss&id=1"; $limitItemDescriptionLength = 175; $MAXITEMS = "3"; include("rss2html.php"); ?> <p></p> I can also post the otehr file which does parsing rss2htm. Thankyou in advance for help. Best, Diva
  15. How to get rid of this error: Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 262145 bytes) in /usr/home/agsemi/www/htdocs/agadmin/fpdf/fpdf.php on line 1220. It works fine in test but in production I get this error. Best Divya
  16. Experts, I am trying to use an if statement.Actually, some of the pdf files which I am using is password protected . I want to put an "if" statement in this scenario .If configurtaion_file(pdf) is password protected,then simply use: $pdf->Write($lh,$apath . $d_row['configuration_file'],$apath . $d_row['configuration_file']); If it is not password protected pdf file then use $pdf->Ln() ; $pdf->Ln() ; $pdf->Ln() ; $pagecount = $pdf->setSourceFile('../files/'.$d_row['configuration_file']); for($fpdipageindex=1; $fpdipageindex<=$pagecount; $fpdipageindex++) { $tplidx = $pdf->importPage($fpdipageindex); $pdf->addPage(); $pdf->useTemplate($tplidx, 20, 30, 150); } Here is my full code: if($d_row['configuration_file']) { $pdf->SetTextColor(0,0,255); $pdf->SetFont($ft,'U',$fs); //$pdf->Write($lh,$apath . $d_row['configuration_file'],$apath . $d_row['configuration_file']); $pdf->SetTextColor(0,0,0); $pdf->SetFont($ft,'',$fs); $pdf->Ln() ; $pdf->Ln() ; $pdf->Ln() ; $pdf->Ln() ; $pdf->Ln() ; $pagecount = $pdf->setSourceFile('../files/'.$d_row['configuration_file']); for($fpdipageindex=1; $fpdipageindex<=$pagecount; $fpdipageindex++) { $tplidx = $pdf->importPage($fpdipageindex); $pdf->addPage(); $pdf->useTemplate($tplidx, 20, 30, 150); } } }
  17. Thanks for replying. What about adding a check? Is it doable? If the pdf file has a password then genrate the old pdf else new one. I am not sure how should I go ahead with that? Best Divya
  18. Experts, Is there a way I can handle encrypted pdf files?I have created a pdf form which reads data from database and merges another pdf as well. It works well with non encryted files.But if the PDF is encrypted I get: FPDF error: File is encrypted! Here is the code that merges another file: $pdf->Ln() ; $pdf->Ln() ; $pdf->Ln() ; $pagecount = $pdf->setSourceFile('../files/'.$d_row['configuration_file']); //pdf file is encrypted for($fpdipageindex=1; $fpdipageindex<=$pagecount; $fpdipageindex++) { $tplidx = $pdf->importPage($fpdipageindex); $pdf->addPage(); $pdf->useTemplate($tplidx, 20, 30, 150); How to handle?Any suggestions? Thanks in advance.
  19. divadiva

    Pdf?

    I have been trying to figure this out for a while now.So , I thought of asking the experts. I have a code that generated pdf file from database. One of the field in the database stores the address of the field which is actually stored on the Server. In the code it acts as a link. But I want to merge that pdf in my existing pdf?Any ideas how. I am using fpdf+fpdi. Thanks in advance.
  20. Although, I didnt get any replies.But no problem. Incase, anyone comes across this error try using iniset to increase Memory location.
  21. Experts, The code I am working on at the moment uses thumbnails.Issue is that after 15 images it doesnt display anything.Is there a way to put batches or just restructure the code in a way so that all images should be displayed? Here is the code I am working on: <% include('functions.inc'); opendb(); $feat = mysql_query("SELECT * FROM `inventory` WHERE `featured`=1"); if(mysql_num_rows($feat)) { while( $a_row = mysql_fetch_array($feat) ) { $orig = '../files/' . $a_row['image1'] ; print '<br><b>' . $a_row['inventory_id'] . ' - ' . $a_row['tool_id'] . '</b><br>'; if( $a_row['image1'] && file_exists($orig) ) { print 'Original: ' . str_replace('../files/','',$orig) . '<br>'; $thmb = str_replace('.jpg','_th.jpg',$orig); $thmb = str_replace('.jpeg','_th.jpeg',$thmb); $thmb = str_replace('.JPG','_th.JPG',$thmb); $thmb = str_replace('.JPEG','_th.JPEG',$thmb); if(!file_exists($thmb)) { print 'Making: ' . str_replace('../files/','',$thmb) . '<br>'; // make new $thumbHeight = 120 ; $sourceImage = imagecreatefromjpeg("$orig"); $sourceWidth = imagesx($sourceImage); $sourceHeight = imagesy($sourceImage); $thumbWidth = floor( $thumbHeight * $sourceWidth / $sourceHeight ) ; $targetImage = imagecreatetruecolor($thumbWidth,$thumbHeight); imagecopyresampled($targetImage,$sourceImage,0,0,0,0,$thumbWidth,$thumbHeight,$sourceWidth,$sourceHeight); imagejpeg($targetImage, "$thmb", 75); // @chmod("$thmb", 0777); } else { print 'Exists: ' . str_replace('../files/','',$thmb) . '<br>'; } %> <IMG SRC="<%= $thmb ; %>"><br> <% } else { print 'No image file found<br>'; } } } %> Thankyou in advance.
  22. Experts , I am here again with my weird problem. All I want is to add a linebreak(sort of) from the data coming from mysql. So far I have : $pdf->SetFont(7,'Arial',3.5);//canot chnage this because it is a standard format. $pdf->Cell(70,$lh,nl2br($from_addr[0]),'0',0,'L',1); Tried line break(nl2br) I get this : Room XYZ Beverly Hills 100-107 Lockdown Road Where as I want Room XYZ Beverly Hills 100-107 Lockdown Road,california ( California is truncated) Ultimately I want my output like: Room XYZ Beverly Hills 100-107 Lockdown Road ,california(there should be a new line) Thanks in advance
  23. Experts, I have a pdf form.It doesnot display one field (from_address full data) right.It just displays part of it. Actuall address:Room XYZ Beverly Hills 100-107 Lockdown Road,california PDF is displaying:Room XYZ Beverly Hills 100-107 Lockdown Road(Its truncating california for some reason) Here is the code: $pdf=new PDF(); $pdf->AliasNbPages(); $pdf->AddPage(); $tmp=new PDF(); $tmp->AddPage(); // contact $from_addr = address5($q_row['from_addr']); $pdf->Ln(); $pdf->SetFillColor(213,234,249); $pdf->SetFont($ft,'B',$fs); $pdf->Cell(20,$lh,'Contact:',0,0,'L',1); $pdf->SetFont($ft,'',$fs); //from address $pdf->Cell(70,$lh,$from_addr[0],0,0,'L',1); $pdf->SetFont($ft,'B',$fs); //from address2 $pdf->Cell(70,$lh,$from_addr[1],0,0,'L',1); $pdf->SetFont($ft,'B',$fs); //from address2 if($from_addr[2]) { $pdf->Cell(20,$lh,'',0,0,'L',1); $pdf->Cell(70,$lh,$from_addr[2],0,1,'L',1); } //from address 3 if($from_addr[3]) { $pdf->Cell(20,$lh,'',0,0,'L',1); $pdf->Cell(70,$lh,$from_addr[3],0,1,'L',1); } //from address 4 if($from_addr[4]) { //from_address doesnt display right? $pdf->Cell(20,$lh,'',0,0,'L',1); $pdf->Cell(70,$lh,$from_addr[4],0,1,'L',1); } My guess is something is wrong with the length . Thanks in advance
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.