vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Trying to get this RSS feed to work with vb rss manager (https://vborg.vbsupport.ru/showthread.php?t=164705)

ludachris 12-08-2007 08:10 PM

Trying to get this RSS feed to work with vb rss manager
 
I guess I need to modify this code so it will work with the vb rss manager. I was under the impression you could use any external rss feed with the rss feed manager. Anyway, this rss feed resides in a classifieds directory outside of the forums directory. It's a list of all new classified ads (posted in the photopost classifieds script). I'm trying to get it to post a new thread in a specified forum when there's a new classified ad posted. Here's the code:

Code:

<?php
//////////////////////////// COPYRIGHT NOTICE //////////////////////////////
// Script: RSS.PHP
// Developed by: Chuck Scannell & Michael Pierce
// http://www.photopost.com
//
// This script uses the feedcreator.class.php script avaiable from:
//
// http://www.bitfolge.de/rsscreator-en.html
//
// Copy this script and the feedcreator.class.php script to your Classifieds
// directory and then load the rss.php script in your browser. You will be
// prompted with a set of links to the actual feed pages which can then
// be used by your readers.
//
// This code is provided without warrenty and may be modified to suit your
// needs.
//////////////////////////// COPYRIGHT NOTICE //////////////////////////////

define( 'THIS_SCRIPT', "pprss" );

require "pp-inc.php";
include("feedcreator.class.php");

typecast($_REQUEST, array('cat' => STRING, 'type' => STRING));

authenticate();

$rss = new UniversalFeedCreator();
$rss->useCached();
$rss->title = $Globals['webname'];
$rss->description = null;

$rss->link = $Globals['maindir'];
$rss->feedURL = $Globals['maindir'].$PHP_SELF;

// If you wish to include an image as part of your feed, then you can uncomment and fill in the
// items for the variables below

//$image = new FeedImage();
//$image->title = $Globals['webname']. "logo";
//$image->url = "http://www.dailyphp.net/images/logo.gif";
//$image->link = $Globals['maindir'];
//$image->description = "Feed provided by {$Globals['webname']}. Click to visit.";
//$rss->image = $image;

$curcheck = ppmysql_query("SELECT symbol FROM {$Globals['pp_db_prefix']}currency WHERE code = '{$Globals['currency']}'", $link);
list( $csymbol ) = mysql_fetch_row($curcheck);

// Now lets grab our feed info...

$catcache = array();

if ( !empty( $cat ) ) {
$res = ppmysql_query("SELECT * FROM {$Globals['pp_db_prefix']}products WHERE cat='$cat' ORDER BY date DESC LIMIT 50", $link);
}
else {
$res = ppmysql_query("SELECT * FROM {$Globals['pp_db_prefix']}products ORDER BY date DESC LIMIT 50", $link);
}
while ($data = mysql_fetch_array($res)) {
    $thiscat = $data['cat'];
   
        if ( $CatPerms['ugview'][$thiscat] == 0 ) {
            if ( $catcache[$thiscat] == "" ) {
                $catcache[$thiscat] = is_image_private( $data['cat'] );
            }

            if ( $catcache[$thiscat] == "no" ) {
                $item = new FeedItem();
                $item->title = $data['title'];
                $item->link = "{$Globals['maindir']}/showproduct.php?product=". $data['id'];
               
                // Get the thumbnail
                $thumb = get_imagethumb( $data['bigimage'], $data['cat'], $data['userid'], 1 );
                $thumb = "<a href=\"{$Globals['maindir']}/showproduct.php?product={$data['id']}\" target=\"_blank\">$thumb</a>";
               
                // Add description?
                if ( !empty($data['description']) ) $data['description'] = "<br /><br />Description: ". $data['description'];
               
                // Add Price?
                if ( $data['price'] > 0 ) $data['description'] .= "<br /><br />Price: {$csymbol}{$data['price']}";

                // Add comments indicator?
                if ( $data['numcom'] > 1 ) $data['description'] .= "<br /><br />{$data['numcom']} comments";
                elseif ( $data['numcom'] == 1 ) $data['description'] .= "<br /><br />{$data['numcom']} comment";
               
                $item->description = "$thumb<br /><br />Posted by: ". $data['user'] . $data['description'];
                $item->date = (int)$data['date'];
                $item->source = $Globals['maindir'];
                list( $ruserid, $rusername ) = get_userinfo( $data['user'] );
                $item->author = $rusername;
               
                $rss->addItem($item);
            }
        }
}

// valid format strings are: RSS0.91, RSS1.0, RSS2.0, PIE0.1, MBOX, OPML, ATOM0.3, HTML, JS
if ( $type == "rss" ) $typestr = "RSS0.91";
elseif ( $type == "rss1" ) $typestr = "RSS1.0";
elseif ( $type == "rss2" ) $typestr = "RSS2.0";
elseif ( $type == "pie" ) $typestr = "PIE0.1";
elseif ( $type == "mbox" ) $typestr = "MBOX";
elseif ( $type == "opml" ) $typestr = "OPML";
elseif ( $type == "atom" ) $typestr = "ATOM0.3";
elseif ( $type == "html" ) $typestr = "HTML";
elseif ( $type == "js" ) $typestr = "JS";

if ( !isset($typestr) ) {
    diewell( "This gallery is capable of providing RSS feeds for those who wish to view this gallery with their RSS reader.<br /><br />
              Select from the types of feeds below or Copy Link to your reader:<br /><br />
              <a href=\"{$Globals['maindir']}/rss.php?type=rss&cat=$cat\">RSS0.91</a><br />
              <a href=\"{$Globals['maindir']}/rss.php?type=rss1&cat=$cat\">RSS1.0</a><br />
              <a href=\"{$Globals['maindir']}/rss.php?type=rss2&cat=$cat\">RSS2.0</a><br />
              <a href=\"{$Globals['maindir']}/rss.php?type=js&cat=$cat\">JavaScript</a><br />" );
}

echo $rss->saveFeed($typestr, "{$Globals['datafull']}feed.xml");

?>


Marco van Herwaarden 12-09-2007 05:54 AM

We could better help you if you posted the URL to the feed.


All times are GMT. The time now is 02:44 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03256 seconds
  • Memory Usage 1,734KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete