You are missing our premiere tool bar navigation system! Register and use it for FREE!

NukeCops  
•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
Modules
· Home
· FAQ
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· PHP-Nuke HOWTO
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 37 guest(s) and 1 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
Nuke Cops :: View topic - Fix my RSS 2.0 script (code provided) [ ]
 Forum FAQ  •  Search  •   •  Memberlist  •  Usergroups   •  Register  •  Profile •    •  Log in to check your private messages  •  Log in

 
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
Author Message
r00tsec
Nuke Cadet
Nuke Cadet


Joined: Aug 07, 2005
Posts: 4


PostPosted: Fri Mar 30, 2007 1:27 pm Reply with quoteBack to top

I am trying to get an RSS feed to display the content out of the nuke_pages database since it is where I post a majority of my content. I am trying to use an RSS 2.0 feed script from this location:

http://www.truden.com/downloads/backend.txt

and the content module RSS feed from:

http://ravenphpscripts.com/postp78701.html

I came up with this mess.
Code:

<?php

/*********************************************/
/*   Save this as backend.php and upload in your root directory */
/********************************************/
/* PHP-NUKE: Advanced Content Management System                         */
/* ============================================                         */
/*                                                                      */
/* Copyright (c) 2002 by Francisco Burzi                                */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/*                                                                      */
/************************************************************************/
/* Additional security checking code 2003 by chatserv                   */
/* http://www.nukefixes.com -- http://www.nukeresources.com             */
/************************************************************************/
/* RSS/Atom feed created by Brennan Stehling (2004)                        */
/* http://brennan.offwhite.net/blog/ - http://portal.spiderlogic.com     */
/*   Adapted for phpNuke7.8 - 7.9 by Truden (http://www.truden.com) */
/************************************************************************/

include("mainfile.php");
global $prefix, $db, $nukeurl;
header("Content-Type: text/xml");

    /* entity to unicode decimal value */
function entity_to_decimal_value($string){
 
  $entity_to_decimal = array(
   '&nbsp;' => ' ',
   '&iexcl;' => '¡',
   '&cent;' => '¢',
   '&pound;' => '£',
   '&curren;' => '¤',
   '&yen;' => '¥',
   '&brvbar;' => '¦',
   '&sect;' => '§',
   '&uml;' => '¨',
   '&copy;' => '©',
   '&ordf;' => 'ª',
   '&laquo;' => '«',
   '&not;' => '¬',
   '&shy;' => '­',
   '&reg;' => '®',
   '&macr;' => '¯',
   '&deg;' => '°',
   '&plusmn;' => '±',
   '&sup2;' => '²',
   '&sup3;' => '³',
   '&acute;' => '´',
   '&micro;' => 'µ',
   '&para;' => '¶',
   '&middot;' => '·',
   '&cedil;' => '¸',
   '&sup1;' => '¹',
   '&ordm;' => 'º',
   '&raquo;' => '»',
   '&frac14;' => '¼',
   '&frac12;' => '½',
   '&frac34;' => '¾',
   '&iquest;' => '¿',
   '&Agrave;' => 'À',
   '&Aacute;' => 'Á',
   '&Acirc;' => 'Â',
   '&Atilde;' => 'Ã',
   '&Auml;' => 'Ä',
   '&Aring;' => 'Å',
   '&AElig;' => 'Æ',
   '&Ccedil;' => 'Ç',
   '&Egrave;' => 'È',
   '&Eacute;' => 'É',
   '&Ecirc;' => 'Ê',
   '&Euml;' => 'Ë',
   '&Igrave;' => 'Ì',
   '&Iacute;' => 'Í',
   '&Icirc;' => 'Î',
   '&Iuml;' => 'Ï',   
   '&ETH;' => 'Ð',
   '&Ntilde;' => 'Ñ',    
   '&Ograve;' => 'Ò',   
   '&Oacute;' => 'Ó',    
   '&Ocirc;' => 'Ô',
   '&Otilde;' => 'Õ',   
   '&Ouml;' => 'Ö',
   '&times;' => '×',   
   '&Oslash;' => 'Ø',   
   '&Ugrave;' => 'Ù',   
   '&Uacute;' => 'Ú',   
   '&Ucirc;' => 'Û',
   '&Uuml;' => 'Ü',
   '&Yacute;' => 'Ý',    
   '&THORN;' => 'Þ',
   '&szlig;' => 'ß',   
   '&agrave;' => 'à',   
   '&aacute;' => 'á',   
   '&acirc;' => 'â',
   '&atilde;' => 'ã',   
   '&auml;' => 'ä',    
   '&aring;' => 'å',   
   '&aelig;' => 'æ',   
   '&ccedil;' => 'ç',   
   '&egrave;' => 'è',   
   '&eacute;' => 'é',   
   '&ecirc;' => 'ê',
   '&euml;' => 'ë',
   '&igrave;' => 'ì',    
   '&iacute;' => 'í',   
   '&icirc;' => 'î',
   '&iuml;' => 'ï',
   '&eth;' => 'ð',
   '&ntilde;' => 'ñ',    
   '&ograve;' => 'ò',   
   '&oacute;' => 'ó',   
   '&ocirc;' => 'ô',
   '&otilde;' => 'õ',   
   '&ouml;' => 'ö',
   '&divide;' => '÷',    
   '&oslash;' => 'ø',   
   '&ugrave;' => 'ù',   
   '&uacute;' => 'ú',   
   '&ucirc;' => 'û',
   '&uuml;' => 'ü',
   '&yacute;' => 'ý',    
   '&thorn;' => 'þ',
   '&yuml;' => 'ÿ',
   '&fnof;' => 'ƒ',
   '&Alpha;' => 'Α',   
   '&Beta;' => 'Β',
   '&Gamma;' => 'Γ',   
   '&Delta;' => 'Δ',   
   '&Epsilon;' => 'Ε',    
   '&Zeta;' => 'Ζ',
   '&Eta;' => 'Η',
   '&Theta;' => 'Θ',    
   '&Iota;' => 'Ι',
   '&Kappa;' => 'Κ',   
   '&Lambda;' => 'Λ',   
   '&Mu;' => 'Μ',
   '&Nu;' => 'Ν',   
   '&Xi;' => 'Ξ',   
   '&Omicron;' => 'Ο',    
   '&Pi;' => 'Π',
   '&Rho;' => 'Ρ',   
   '&Sigma;' => 'Σ',    
   '&Tau;' => 'Τ',
   '&Upsilon;' => 'Υ',    
   '&Phi;' => 'Φ',
   '&Chi;' => 'Χ',
   '&Psi;' => 'Ψ',
   '&Omega;' => 'Ω',    
   '&alpha;' => 'α',   
   '&beta;' => 'β',
   '&gamma;' => 'γ',   
   '&delta;' => 'δ',   
   '&epsilon;' => 'ε',       
   '&zeta;' => 'ζ',
   '&eta;' => 'η',
   '&theta;' => 'θ',    
   '&iota;' => 'ι',   
   '&kappa;' => 'κ',    
   '&lambda;' => 'λ',   
   '&mu;' => 'μ',
   '&nu;' => 'ν',   
   '&xi;' => 'ξ',   
   '&omicron;' => 'ο',       
   '&pi;' => 'π',
   '&rho;' => 'ρ',    
   '&sigmaf;' => 'ς',       
   '&sigma;' => 'σ',   
   '&tau;' => 'τ',   
   '&upsilon;' => 'υ',       
   '&phi;' => 'φ',
   '&chi;' => 'χ',    
   '&psi;' => 'ψ',    
   '&omega;' => 'ω',    
   '&thetasym;' => 'ϑ',       
   '&upsih;' => 'ϒ',
   '&piv;' => 'ϖ',   
   '&bull;' => '•',    
   '&hellip;' => '…',       
   '&prime;' => '′',
   '&Prime;' => '″',   
   '&oline;' => '‾',   
   '&frasl;' => '⁄',   
   '&weierp;' => '℘',    
   '&image;' => 'ℑ',
   '&real;' => 'ℜ',   
   '&trade;' => '™',   
   '&alefsym;' => 'ℵ',       
   '&larr;' => '←',
   '&uarr;' => '↑',   
   '&rarr;' => '→',   
   '&darr;' => '↓',   
   '&harr;' => '↔',   
   '&crarr;' => '↵',   
   '&lArr;' => '⇐',   
   '&uArr;' => '⇑',   
   '&rArr;' => '⇒',   
   '&dArr;' => '⇓',   
   '&hArr;' => '⇔',   
   '&forall;' => '∀',       
   '&part;' => '∂',
   '&exist;' => '∃',   
   '&empty;' => '∅',   
   '&nabla;' => '∇',   
   '&isin;' => '∈',   
   '&notin;' => '∉',   
   '&ni;' => '∋',   
   '&prod;' => '∏',    
   '&sum;' => '∑',   
   '&minus;' => '−',    
   '&lowast;' => '∗',    
   '&radic;' => '√',
   '&prop;' => '∝',   
   '&infin;' => '∞',   
   '&ang;' => '∠',   
   '&and;' => '∧',    
   '&or;' => '∨',    
   '&cap;' => '∩',    
   '&cup;' => '∪',    
   '&int;' => '∫',    
   '&there4;' => '∴',       
   '&sim;' => '∼',
   '&cong;' => '≅',    
   '&asymp;' => '≈',   
   '&ne;' => '≠',   
   '&equiv;' => '≡',       
   '&le;' => '≤',   
   '&ge;' => '≥',    
   '&sub;' => '⊂',    
   '&sup;' => '⊃',    
   '&nsub;' => '⊄',    
   '&sube;' => '⊆',   
   '&supe;' => '⊇',   
   '&oplus;' => '⊕',   
   '&otimes;' => '⊗',    
   '&perp;' => '⊥',
   '&sdot;' => '⋅',   
   '&lceil;' => '⌈',   
   '&rceil;' => '⌉',   
   '&lfloor;' => '⌊',    
   '&rfloor;' => '⌋',    
   '&lang;' => '〈',
   '&rang;' => '〉',   
   '&loz;' => '◊',   
   '&spades;' => '♠',       
   '&clubs;' => '♣',
   '&hearts;' => '♥',    
   '&diams;' => '♦',
   '&quot;' => '"',   
   '&amp;' => '&',
   '&lt;' => '<',   
   '&gt;' => '>',   
   '&OElig;' => 'Œ',
   '&oelig;' => 'œ',   
   '&Scaron;' => 'Š',   
   '&scaron;' => 'š',   
   '&Yuml;' => 'Ÿ',   
   '&circ;' => 'ˆ',    
   '&tilde;' => '˜',    
   '&ensp;' => ' ',   
   '&emsp;' => ' ',   
   '&thinsp;' => ' ',       
   '&zwnj;' => '‌',
   '&zwj;' => '‍',
   '&lrm;' => '‎',   
   '&rlm;' => '‏',   
   '&ndash;' => '–',    
   '&mdash;' => '—',       
   '&lsquo;' => '‘',   
   '&rsquo;' => '’',   
   '&sbquo;' => '‚',   
   '&ldquo;' => '“',   
   '&rdquo;' => '”',   
   '&bdquo;' => '„',   
   '&dagger;' => '†',    
   '&Dagger;' => '‡',    
   '&permil;' => '‰',    
   '&lsaquo;' => '‹',
   '&rsaquo;' => '›',
   '&euro;' => '€');
   
  return preg_replace(
     "/&[A-Za-z]+;/",
   " ",
   strtr($string,$entity_to_decimal) );
   
}
$rssFeedLimit = 15; // Maximum lines in feed
$gmtdiff = date("O", time());
$gmtstr = substr($gmtdiff, 0, 3) . ":" . substr($gmtdiff, 3, 9);
$now = date("Y-m-d\TH:i:s", time());
$now = $now . $gmtstr;

echo "<?xml version=\"1.0\" encoding=\"windows-1251\"?>\n";
echo "<rss version=\"2.0\" \n";
echo "  xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n";
echo "  xmlns:sy=\"http://purl.org/rss/1.0/modules/syndication/\"\n";
echo "  xmlns:admin=\"http://webns.net/mvcb/\"\n";
echo "  xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n\n";
echo "<channel>\n";
echo "<title>".htmlspecialchars($sitename)."</title>\n";
echo "<link>".htmlspecialchars($nukeurl)."</link>\n";
echo "<description>".$slogan."</description>\n";
echo "<dc:language>".$backend_language."</dc:language>\n";
echo "<dc:creator>".$adminmail."</dc:creator>\n";
echo "<dc:date>".$now."</dc:date>\n\n";
echo "<sy:updatePeriod>hourly</sy:updatePeriod>\n";
echo "<sy:updateFrequency>1</sy:updateFrequency>\n";
echo "<sy:updateBase>".$now."</sy:updateBase>\n\n";

$result = $db->sql_query("SELECT text, pid, title, date FROM '.$user_prefix.'_pages WHERE active=1 ORDER BY date DESC LIMIT '.$rssFeedLimit");

while ($row = $db->sql_fetchrow($result)) {
    $rsid = intval($row['pid']);
    $title = $row['title'];
    $text = $row['text'];
    $time = $row['date'];

    // format: 2004-08-02T12:15:23-06:00
    $date = date("Y-m-d\TH:i:s", strtotime($time));
    $date = $date . $gmtstr;
   
    echo "<item>\n";
    echo "<title>".$title."</title>\n";
    echo "<link>$nukeurl/modules.php?name=News&amp;file=article&amp;sid=$rsid</link>\n";
    echo "<description>".$text."></description>\n";
    echo "<guid isPermaLink=\"false\">".$rsid."@".$nukeurl."</guid>\n";
    echo "<dc:subject>".$title."</dc:subject>\n";
    echo "<dc:date>".$date."</dc:date>\n";
    echo "<dc:creator>Posted by ".$adminmail."</dc:creator>\n";
    echo "</item>\n\n";
}

echo "</channel>\n";
echo "</rss>\n";

?>


I need it to work correctly, since I primarly use the content module for my site. I can pay through paypal immediatly.
Find all posts by r00tsecView user's profileSend private message
phpnuke-hosting
Support Mod
Support Mod


Joined: Oct 19, 2004
Posts: 1032

Location: UK

PostPosted: Mon Apr 02, 2007 6:57 am Reply with quoteBack to top

Is it just the scripts that raven did you want installing? or do you want an rss feed script from scratch?

_________________
www.phpnuke-hosting.com

The Internets Foremost PHP-Nuke Web Host.

Image

Click Here!
Find all posts by phpnuke-hostingView user's profileSend private messageVisit poster's website
r00tsec
Nuke Cadet
Nuke Cadet


Joined: Aug 07, 2005
Posts: 4


PostPosted: Wed Apr 04, 2007 5:57 am Reply with quoteBack to top

I can install the script just fine. I need the two scripts combined so that the RSS 2.0 script outputs ravens script that uses the content module output as opposed to the news or whatever the default RSS is. If I use ravens script it still uses RSS 0.92, and I would like it to instead by 2.0, but coming out of the content module.
Find all posts by r00tsecView user's profileSend private message
Display posts from previous:      
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Powered by phpBB © 2001, 2005 phpBB Group

Ported by Nuke Cops © 2003 www.nukecops.com
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::
Powered by · TOGETHER TEAM srl ITALY http://www.togetherteam.it · DONDELEO E-COMMERCE http://www.DonDeLeo.com
Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.518 Seconds - 459 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::