[MODDB] simple syndication

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment!
Suggested Hosts
Locked
qdeped
Registered User
Posts: 605
Joined: Wed Oct 16, 2002 6:54 am

Re: [BETA] simple syndication

Post by qdeped »

can the author help me? how is this mod suppose to work? i put the link in the RSS reader i have installed on my website and it display the posts?

because when i visit /forum/syndication.php?count=50 it asks me to download the file in IE.....when in FIREFOX it shows 50 posts....

so im not sure whats up....will it work if i put the link /forum/syndication.php?count=50 in my rss reader?
awaiting investigation
wouterv
Registered User
Posts: 265
Joined: Wed Jan 02, 2008 10:22 am
Location: The Netherlands
Name: Wouter

Re: [BETA] simple syndication

Post by wouterv »

I guess you use IE 6, which indeed will return with the Open/Save/Cancel dialog (IE 6 by nature has no support for RSS).
FF and IE 7 should open the feed properly, at least the latest version posted here: http://www.phpbb.com/community/viewtopi ... 5#p3936755
It will for sure work with a RSS reader.
User avatar
themadhatterz
Registered User
Posts: 15
Joined: Sun Sep 30, 2007 9:07 pm

Re: [BETA] simple syndication

Post by themadhatterz »

Will this mod be released soon, I have been using this mod for some time and there is some problems with it, so im hoping a final version will be released so I can upgrade it..

It does not work properly with google API feed fetcher.. it often returns with error. Im using the version found on the first page 1.1b i think.

Also it returns error on the feed validator.
jimwillsher
Registered User
Posts: 51
Joined: Thu Mar 18, 2004 9:54 am

Re: [BETA] simple syndication

Post by jimwillsher »

Does it actually need to be formally released? Can't you just use the latest version from this thread, which validates correctly?

A formal release doesn't give any benefits, and the original author seems to have disappeared anyway.


Jim
wouterv
Registered User
Posts: 265
Joined: Wed Jan 02, 2008 10:22 am
Location: The Netherlands
Name: Wouter

Re: [BETA] simple syndication

Post by wouterv »

A formal relase is not a must, the version located here seems to work well including all options and validates under all conditions.
http://www.phpbb.com/community/viewtopi ... 5#p3936755
Since this 1.1.1f version was posted no more bugs are reported.
qdeped
Registered User
Posts: 605
Joined: Wed Oct 16, 2002 6:54 am

Re: [BETA] simple syndication

Post by qdeped »

actually now im using this with a great RSS reader thats opensource...

the reader also controlls the number of posts fetched and characters to trim...works really good even the emoticons are fetched without a problem

so i dont understand something, why is there a fetch posts mods (topics anywhere) and an rss reader? dont they both serve the same purpose? what am i missing? they both seem to load fast...i think the rss is a bit faster tooo...so i dont know can someone enlighten me on the difference ands whats better
awaiting investigation
User avatar
dpaanlka
Registered User
Posts: 286
Joined: Wed May 10, 2006 6:48 pm
Location: Chicago, USA
Contact:

Re: [BETA] simple syndication

Post by dpaanlka »

I downloaded the mode and replaced the php and xml files with the 1.1.1f version posted on page 14 of this thread. I'm getting an unexpected T_STRING error though.

I'm a little lost?

http://forums.info-mac.org/syndication.php
I am a Chicago trance DJ and in my humble opinion I play the best trance music in Chicago :D
jimwillsher
Registered User
Posts: 51
Joined: Thu Mar 18, 2004 9:54 am

Re: [BETA] simple syndication

Post by jimwillsher »

The error clearly shows that it's on line 42. So make a start by looking at line 42...


Jim
User avatar
dpaanlka
Registered User
Posts: 286
Joined: Wed May 10, 2006 6:48 pm
Location: Chicago, USA
Contact:

Re: [BETA] simple syndication

Post by dpaanlka »

Thanks... I looked plenty at line 42, and line 41, and don't see where this is coming from.
I am a Chicago trance DJ and in my humble opinion I play the best trance music in Chicago :D
jimwillsher
Registered User
Posts: 51
Joined: Thu Mar 18, 2004 9:54 am

Re: [BETA] simple syndication

Post by jimwillsher »

How about posting line 42 here, as my telepathic powers aren't working too well today ;)

Just make sure it's definitely line 42 (open it in notepad or something and gotot line 42)


Jim
User avatar
dpaanlka
Registered User
Posts: 286
Joined: Wed May 10, 2006 6:48 pm
Location: Chicago, USA
Contact:

Re: [BETA] simple syndication

Post by dpaanlka »

Line 42...

Code: Select all

$chars = 500; //Maximum
I am a Chicago trance DJ and in my humble opinion I play the best trance music in Chicago :D
jimwillsher
Registered User
Posts: 51
Joined: Thu Mar 18, 2004 9:54 am

Re: [BETA] simple syndication

Post by jimwillsher »

ok, post the whole thing....
User avatar
dpaanlka
Registered User
Posts: 286
Joined: Wed May 10, 2006 6:48 pm
Location: Chicago, USA
Contact:

Re: [BETA] simple syndication

Post by dpaanlka »

The entire script is this:

Code: Select all

<?php
/*
*
* @package phpBB3
* @version $Id: syndication.php,v 1.0 2006/11/27 22:29:16 angelside Exp $
* Modified by CK for holographyforum.org
* @copyright (c) Canver Software
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* Updated by several people: 2008-01-17 - Version 1.1.1f
*
*/

/**
*/
define('IN_PHPBB', true);
$phpbb_root_path = './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();

// Begin configuration
$CFG['exclude_forums'] = '';
$CFG['max_topics'] = '20';
// End configuration

// Requests
$fid = request_var('fid', '');
$count = request_var('count', 0);
$chars = request_var('chars', 200);
$type = request_var('type', '');
$topics_only = request_var('t', '');

// If not set, set the output count to max_topics
$count = ($count == 0) ? $CFG['max_topics'] : $count;

// maximum text char limit
if ($chars <0 || $chars > 500)
   $chars = 500; //Maximum

// Generate url
$board_url = generate_board_url();
$index_url = $board_url . '/index.' . $phpEx;
$viewtopic_url = $board_url . '/viewtopic.' . $phpEx;

// ==========================================================================================================================

function codebox($preg)
{
   return $preg[2];
}

// ==========================================================================================================================

function parse_message($row, $bbcode_options, $bbcode_uid, $bbcode_bitfield)
{
   global $board_url, $type;

   $row = generate_text_for_display($row, $bbcode_uid, $bbcode_bitfield, $bbcode_options);
   $row = preg_replace_callback("/\<dt\>(.*?)\<\/dt\>\<dd\>\<code\>(.*?)\<\/code\>\<\/dd\>/si", "codebox", $row);

   if ($type == 'atom')
   {
      $row = str_replace("&nbsp;", " ", $row);
   }
   else
   {
      $row = str_replace("\n", "\n<br />\n", $row);               // Do NOT user nl2br
      $row = htmlspecialchars($row);
   }

   return $row;
}

// ==========================================================================================================================

// Create a date according to correct RFC standard
function format_date($timestamp)
{
   global $type;

   if ($type == 'atom')
      return date('Y-m-d\TH:i:s\Z', $timestamp);            // RFC 3339 for ATOM
   else
      return date('D, d M Y H:i:s O', $timestamp);         // RFC 822 for RSS2
}

// ==========================================================================================================================


$sql_where = '';

// only topic first post
if ($topics_only == 1)
{
   $sql_where = 'AND p.post_id = t.topic_first_post_id';
   $sql_from = 'FROM ' . POSTS_TABLE . ' as p, ' . FORUMS_TABLE . ' as f, ' . USERS_TABLE . ' as u, ' . TOPICS_TABLE . ' as t';
}
else
{
   $sql_from = 'FROM ' . POSTS_TABLE . ' as p, ' . FORUMS_TABLE . ' as f, ' . USERS_TABLE . ' as u';
}

// Exclude forums
if ($CFG['exclude_forums'])
{
   $exclude_forums = explode(',', $CFG['exclude_forums']);
   foreach ($exclude_forums as $i => $id)
   {
      if ($id > 0)
      {
         $sql_where .= ' AND p.forum_id != ' . trim($id);
      }
   }
}

if ($fid != '')
{
   $select_forums = explode(',', $fid);
   $sql_where .= ( sizeof($select_forums)>0 ) ? ' AND f.forum_id IN (' . $fid . ')' : '';
}

// SQL posts table
$sql = 'SELECT p.post_id, p.poster_id, p.post_subject, p.post_text, p.bbcode_uid, p.bbcode_bitfield, p.topic_id, p.forum_id, p.post_time, f.forum_name, f.forum_desc_options, u.username
      ' . $sql_from . '
      WHERE (u.user_id = p.poster_id)
      AND p.post_approved = 1
      AND (f.forum_id = p.forum_id)
      ' . $sql_where . '
      ORDER BY post_time DESC';
$result = $db->sql_query_limit($sql, $count);

while( ($row = $db->sql_fetchrow($result)) )
{

   if (!$auth->acl_get('f_list', $row['forum_id']))
   {
      // if the user does not have permissions to list this forum, skip everything until next branch
      continue;
   }

   if (empty($row['post_subject']))
   {
     $subj_sql = 'SELECT p.post_subject
     FROM ' . POSTS_TABLE . ' as p, ' . TOPICS_TABLE . ' as t
     WHERE (p.topic_id = '.$row['topic_id'] .')
     AND p.post_id = t.topic_first_post_id';

     $subj_result = $db->sql_query($subj_sql);
     $subj_row = $db->sql_fetchrow($subj_result);
     $row['post_subject'] = $subj_row['post_subject'];
   }

   $template->assign_block_vars('item', array(
      'AUTHOR'      => $row['username'],
      'TIME'         => format_date($row['post_time']),
      'LINK'         => "$board_url/viewtopic.$phpEx" ."?". 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']."&p=".$row['post_id']."#p".$row['post_id'],
      'IDENTIFIER'   => "$board_url/viewtopic.$phpEx" ."?". 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']."&p=".$row['post_id']."#p".$row['post_id'],
      'TITLE'         => $row['post_subject'],
      'TEXT'         => parse_message($row['post_text'], $row['forum_desc_options'], $row['bbcode_uid'], $row['bbcode_bitfield']),
      )
   );
}

$template->assign_var('FEED_LINK', generate_board_url(TRUE) . $_SERVER['SCRIPT_NAME'] . "?" . htmlspecialchars($_SERVER['QUERY_STRING']));

if ($type == 'atom')
{
   $content_type = 'application/atom+xml';
   $tpl = 'atom';
}
else
{
   $content_type = 'application/rss+xml';
   $tpl = 'rss2';
}

$template->set_filenames(array(
   'body' => 'syndication_' . $tpl . '.xml')
);

// get time, use current time
$last_build_date = mktime();

$template->assign_vars(array(
   'HEADER'      => '<?xml version="1.0" encoding="UTF-8"?>' . "\n", // workaround for remove_php_tags() removing this line from the template
   'TITLE'         => strip_tags($config['sitename']),
   'DESCRIPTION'   => strip_tags($config['site_desc']),
   'LINK'         => $board_url,
   'LAST_BUILD'   => format_date($last_build_date)
   )
);

// gzip compression
if ($config['gzip_compress'])
{
   if (@extension_loaded('zlib') && !headers_sent())
   {
      ob_start('ob_gzhandler');
   }
}

// Start output
header ('Content-Type: ' . $content_type . '; charset=UTF-8');

//header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
//header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
//header("Cache-Control: no-store, no-cache, must-revalidate");   // HTTP/1.1
//header("Cache-Control: post-check=0, pre-check=0", false);      // HTTP/1.1
//header("Pragma: no-cache");                              // HTTP/1.0

$template->display('body');
exit;
?>
Which also happens to be the same script posted here that everybody says works perfectly.
I am a Chicago trance DJ and in my humble opinion I play the best trance music in Chicago :D
jimwillsher
Registered User
Posts: 51
Joined: Thu Mar 18, 2004 9:54 am

Re: [BETA] simple syndication

Post by jimwillsher »

I actually think the error message is false, I think it's an erro in another PHP file or an error coming from your template.

I've just copied your entire script and replaced mine, and it worked fine.

http://www.bulkrenameutility.co.uk/foru ... cation.php

The only difference was that I didn't have the change for blank subjects (circa line 145), but other than that yours and mine were the same. Now they are identical, becasue i'm now running your copy, without any issues.



Jim
User avatar
dpaanlka
Registered User
Posts: 286
Joined: Wed May 10, 2006 6:48 pm
Location: Chicago, USA
Contact:

Re: [BETA] simple syndication

Post by dpaanlka »

Thanks, I figured it wasn't anything wrong with the script. But I'm not sure where to look for other problems? I have syndication.html in the templates folder, and I don't think I've modified any other php script that this script deals with.

In fact, I have a much older version of this same exact script installed (pre topics-only) and it works more or less, but the dates are wrong. I think the dates are wrong because I replaced that old version's syndication_rss2.xml file with the new 1.1.1f version.

http://forums.info-mac.org/rss.php

Any ideas where I should start looking?
I am a Chicago trance DJ and in my humble opinion I play the best trance music in Chicago :D
Locked

Return to “[3.0.x] MODs in Development”