Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 12-08-2007, 08:10 PM
ludachris ludachris is offline
 
Join Date: Feb 2002
Posts: 287
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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");

?>
Reply With Quote
  #2  
Old 12-09-2007, 05:54 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:49 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06016 seconds
  • Memory Usage 2,181KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (2)post_thanks_box
  • (2)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit_info
  • (2)postbit
  • (2)postbit_onlinestatus
  • (2)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete