[ABD] lastRSS autoposting bot MOD (0.1.4)

Any abandoned MODs will be moved to this forum.

WARNING: MODs in this forum are not currently being supported or maintained by the original MOD author. Proceed at your own risk.
Forum rules
IMPORTANT: MOD Development Forum rules

WARNING: MODs in this forum are not currently being supported nor updated by the original MOD author. Proceed at your own risk.
Locked
svennson
Registered User
Posts: 60
Joined: Wed Jun 01, 2005 4:54 pm
Location: Belguim
Contact:

Re: [DEV] lastRSS autoposting bot MOD (0.1.4)

Post by svennson »

I got this working on a few RSS's, however not on this one :
http://code.google.com/feeds/p/rhinounit/updates/basic
Could someone try this aswell, since im not sure everything is working fine, as it is localhost. thx, great mod btw ;)

// edit

I found it on the site of smix, code.google.com uses atom and not RSS, seems there is a difference in handling that. :cry:
soft2001
Registered User
Posts: 5
Joined: Fri Mar 13, 2009 6:33 pm

Re: [DEV] lastRSS autoposting bot MOD (0.1.4)

Post by soft2001 »

soft2001 wrote:
madmartyau wrote:What version of PHP is running on your server? This mod is written for PHP 5. If you have PHP 4 there is a fix earlier in this thread.
PHP 5.2.9

As I said, everything is working well first time.
The same address for RSS, all the same values in the table.There were no any changes (new mod, editing any file) but the problems occurred while loading index.php. Can't open...without any explanation what is the error, just blank white page.
In error log I found this:

Code: Select all

lastRSS error
» -
malformed
Did anyone know the solution?
RazerRazer
Registered User
Posts: 180
Joined: Thu Feb 26, 2009 4:56 pm

Re: [DEV] lastRSS autoposting bot MOD (0.1.4)

Post by RazerRazer »

kateland wrote: [*]Control the number of characters in the post subject (Razer)
[/list]
No, not in the subjects, but in the Post. Now the limit are ca. 400 symbols, than come a [...]. Can you help me?
Drugs wrote:
RazerRazer wrote:
RazerRazer wrote:Can I deactivate the limit of the symbols per post? Thanks, for help!
Help? :)
i don't know why you need to do that anyway.
Because i have a partnership with a news site, how write the news, but the site haven't a comment function. So, I will, that I see the complate news in my forum.

Thanks for help!
RazerRazer
Registered User
Posts: 180
Joined: Thu Feb 26, 2009 4:56 pm

Re: [DEV] lastRSS autoposting bot MOD (0.1.4)

Post by RazerRazer »

No help?
hohleweg
Registered User
Posts: 6
Joined: Thu Mar 05, 2009 4:41 pm

Re: [DEV] lastRSS autoposting bot MOD (0.1.4)

Post by hohleweg »

Hallo
Ich komme mit der installation nicht klar
kann mir einer (auf deutsch) bitte helfen??!
Danke.
Gruß Joachim
RazerRazer
Registered User
Posts: 180
Joined: Thu Feb 26, 2009 4:56 pm

Re: [DEV] lastRSS autoposting bot MOD (0.1.4)

Post by RazerRazer »

hohleweg wrote:Hallo
Ich komme mit der installation nicht klar
kann mir einer (auf deutsch) bitte helfen??!
Danke.
Gruß Joachim
Schon was von phpbb.de gehoert?

Was verstehst du denn nicht? Öffne die install.xml und folge der Anleitung, solltest auch ohne große Englischkenntnisse kapieren. ANsonsten, phpbb.de.
RazerRazer
Registered User
Posts: 180
Joined: Thu Feb 26, 2009 4:56 pm

Re: [DEV] lastRSS autoposting bot MOD (0.1.4)

Post by RazerRazer »

RazerRazer wrote:No help?
Really no help? :-(
User avatar
Tripp
Former Team Member
Posts: 1358
Joined: Sun May 20, 2007 5:14 am
Location: G'boro, North Carolina
Name: Tripp
Contact:

Re: [DEV] lastRSS autoposting bot MOD (0.1.4)

Post by Tripp »

RazerRazer wrote:
RazerRazer wrote:No help?
Really no help? :-(
Dude, I hate to be rude but you've asked the same thing 4-5 times. You seem to forget that this MOD is a development MOD, so I'm not sure why you seem to think someone is required to help you.
The box said 'You need Windows XP or better' .... so I installed linux.

Formerly Drugs
RazerRazer
Registered User
Posts: 180
Joined: Thu Feb 26, 2009 4:56 pm

Re: [DEV] lastRSS autoposting bot MOD (0.1.4)

Post by RazerRazer »

Drugs wrote:
RazerRazer wrote:
RazerRazer wrote:No help?
Really no help? :-(
Dude, I hate to be rude but you've asked the same thing 4-5 times. You seem to forget that this MOD is a development MOD, so I'm not sure why you seem to think someone is required to help you.
But I need it really, it's very important for me!
User avatar
camm15h
Former Team Member
Posts: 4981
Joined: Wed Jul 30, 2003 1:02 am
Location: Hull, UK
Name: Paul Cammish

Re: [DEV] lastRSS autoposting bot MOD (0.1.4)

Post by camm15h »

RazerRazer wrote:
hohleweg wrote:Hallo
Ich komme mit der installation nicht klar
kann mir einer (auf deutsch) bitte helfen??!
Danke.
Gruß Joachim
Schon was von phpbb.de gehoert?
Was verstehst du denn nicht? Öffne die install.xml und folge der Anleitung, solltest auch ohne große Englischkenntnisse kapieren. ANsonsten, phpbb.de.
If you can please - use english on the forums, thanks. :)
RazerRazer
Registered User
Posts: 180
Joined: Thu Feb 26, 2009 4:56 pm

Re: [DEV] lastRSS autoposting bot MOD (0.1.4)

Post by RazerRazer »

I think, this is the right file:

Code: Select all

<?php
/**
*
* @package includes
* @version $Id: $
* @copyright (c) 2007-2008 Jiri Smika (Smix) http://phpbb3.smika.net
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/ 

/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
   exit;
}

/**
*  Autopost functions
*  Get the next feed to check
*  return array $next_feed       
*/        
function get_next_feed_to_post()
{
  global $db;
  $sql = 'SELECT name, url, next_check, next_check_after, destination_id, enabled
            FROM ' . LASTRSS_AP_TABLE . '
            WHERE next_check < "' . time() . '" AND enabled = "1"
            ORDER BY next_check DESC 
          LIMIT 0,1';
  $result   = $db->sql_query($sql);
   $next_feed = $db->sql_fetchrow($result);
   $db->sql_freeresult($result);

  // feed was checked - do not check it again until ...
   $sql = 'UPDATE ' . LASTRSS_AP_TABLE . '
          SET next_check = "' . ( time() + $next_feed['next_check_after'] * 3600 ) . '"
          WHERE name = "' . $next_feed['name'] . '"';
  // for development reasons - do not update -> force to always load fresh data
  $db->sql_query($sql);
  return $next_feed;
} 

/**
*  Autopost functions
*  init lastRSS to get feed data and post the feed items! 
*  @param mixed $feed - including url for downloading and other data 
*/   
function autopost_init($feed)
{
  global $rss;
  // get the feed data
  $result = $rss->parse($feed);
  // return full data collection
  if($result['items_count'] > 0)
  {
    $result = array_merge($feed, $result);
    // ... and try to post them  
    autopost($result);
  }
}

/**
*  Autopost functions
*  approve topic/post tables after posting 
*  @param string $subject - subject which we want to approve 
*/
function autopost_approve($subject)
{            
  global $db;                        
  $sql = 'UPDATE ' . POSTS_TABLE . '
           SET post_approved = 1
           WHERE post_subject = "' . $db->sql_escape($subject) . '"';
  $db->sql_query($sql);
  $sql = 'UPDATE ' . TOPICS_TABLE . '
           SET topic_approved = 1
           WHERE topic_title = "' . $db->sql_escape($subject) . '"';
  $db->sql_query($sql);
}  

/**
*  Autopost functions
*  posts new topic in forum 
*  @param mixed $post_data - includes all data of feed  
*/  
function autopost($post_data)
{
   global $config, $user, $db, $phpbb_root_path, $phpEx;
  // require necessary functions for posting
   require($phpbb_root_path . 'includes/functions_posting.' . $phpEx);

   // prepare user data for lastRSS autopost bot
   $user_backup = $user->data;
   $sql = 'SELECT username, user_colour
            FROM ' . USERS_TABLE . '
            WHERE user_id = "' . $config['lastrss_ap_bot_id'] . '"';
   $result   = $db->sql_query($sql);
   $row = $db->sql_fetchrow($result);
   $db->sql_freeresult($result);
   
   // change poster ...
   $user->data = array_merge($user->data, array(
      'user_id'      => $config['lastrss_ap_bot_id'],
      'username'      => $row['username'],
      'user_colour'   => $row['user_colour'],
   ));

  // do this only once ...
  // prepare post_data
  $post_data['copyright'] = (isset($post_data['copyright']) && ($post_data['copyright'] != '')) ? '&copy; ' . $post_data['copyright'] : '';

  // get image data if possible
   if( isset($post_data['image_link']) && isset($post_data['image_url']) ) 
   {
    $image = '[url='.$post_data['image_link'].'][img]'.$post_data['image_url'].'[/img][/url]';
  }
  elseif( isset($post_data['image_url']))
  {
     $image = '[img]'.$post_data['image_url'].'[/img]';
  }
  else
  {
    $image = '';
  }

  // do the rest for every item in feed
  $count = (isset($post_data['items'])) ? count($post_data['items']) : 0;
  $i = $count-1;
  // backward posting (from the oldest to the newest)
  while($i >= 0)
  {
    // necessary vars 
    $uid = $bitfield = $options = $poll = ''; 
    
     // prepare data for posting
      $subject = truncate_string($post_data['name'] . ' | ' . $post_data['items'][$i]['title'], 255);
    generate_text_for_storage($subject, $uid, $bitfield, $options, false, false, false);
    
    // check if this topic is not already posted
     $sql = 'SELECT topic_title
              FROM ' . TOPICS_TABLE . '
              WHERE topic_title = "' . $db->sql_escape($subject) . '"';
     $result   = $db->sql_query($sql);
     $row = $db->sql_fetchrow($result);
     $db->sql_freeresult($result);       

     // Do we have a new item to post ?
     // TODO review later the comparing function
     if (strnatcasecmp($row['topic_title'], $subject))
     { 
       // necessary recoding/styling of message
       
       // do we have pubDate ? ... post will be posted with this time!
      $post_time = (sizeof($post_data['items'][$i]['pubDate']) > 0) ? strtotime($post_data['items'][$i]['pubDate']) : 0;
      
      $author = ( isset($post_data['items'][$i]['author']) && ($post_data['items'][$i]['author'] != '')) ? $post_data['items'][$i]['author'] : '';

      // this defines how the final post looks     
      // edit the $message if you wan´t to change it there
      $message = $image.'
                   [b]' . $post_data['items'][$i]['description'] . ' [/b] 
       
                   ' . $post_data['copyright'] . ' ' . $author . '
                   [url]' . $post_data['items'][$i]['link'] . '[/url]';
           
      // prepare post data
       generate_text_for_storage($message, $uid, $bitfield, $options, true, true, true);
       $data = array( 
         'forum_id'         => $post_data['destination_id'],
         'icon_id'         => false,
         'enable_bbcode'      => true,
         'enable_smilies'   => true,
         'enable_urls'      => true,
         'enable_sig'      => true,
         'message'         => $message,
         'message_md5'      => md5($message),
         'bbcode_bitfield'   => $bitfield,
         'bbcode_uid'      => $uid,
         'post_edit_locked'   => true,
         'topic_title'      => $subject,
         'notify_set'      => false,
         'notify'         => false,
         // make a post in original time ;)
         'post_time'       => $post_time,
         'forum_name'      => '',
         'enable_indexing'   => true,
         // this is not working, but let´s try it
         'rss_post_approved' => true,
       );
       // submit and approve the post!
       submit_post('post', $subject, '', POST_NORMAL, $poll, $data);
       //autopost_approve($subject);
    }
    // change $i to the next (ehm previous :D ) item
    $i--;
   }
   // reset user´s data after posting
   $user->data = array_merge($user->data, $user_backup);
}

// Smix requests you retain the full copyright notice below including the links
// to phpbb3.smika.net. This gives respect to the large amount of time given freely
// for creating this RSS autoposting bot MOD free for you to use. If you refuse
// to include even this then support from Smix may be affected.
// This language file change is the only visible credit for this mod. Thanks
// Notice : It may cause HTML code invalidity, because it´s xHTML valid ...

// if lastrss autopost bot is enabled 
if($config['lastrss_ap_enabled'])
{
  // init & setup lastrss
  // $rss can be already initiated by lastRSS agregator mod by SmiX
  if(!isset($rss))
  {
    require $phpbb_root_path . 'includes/class_lastrss.' . $phpEx; 
    $rss = new lastrss;   
  }
  // init/change settings for lastrss autopost bot
  $rss->cache_time = 0;                                         // not used in this mod
  $rss->items_limit = $config['lastrss_ap_items_limit'];        // default limit of items to post
  $rss->type = $config['lastrss_type'];                         // connection type (fopen / curl)

  // init lastRSS autopost MOD !
  // check if we have some feeds in database to check
  $sql = 'SELECT *
            FROM ' . LASTRSS_AP_TABLE . '
            WHERE next_check < "' . time() . '" AND enabled = "1"';
  $result   = $db->sql_query($sql);
   $row = $db->sql_fetchrow($result);
   $db->sql_freeresult($result);
  // so do we have some feeds to post ?
  if(sizeof($row) > 0)
  {
    // we are already sure, that at least one feed exists!
    $feed = get_next_feed_to_post(); 
  }

  // do we have some feed data ?
  if (isset($feed) && (sizeof($feed) > 0))
  {  
    // we are sure, we have feed info for checking the feed!
    autopost_init($feed);
  }
}
?>
But I don't find the right line...
User avatar
deanandeva
Registered User
Posts: 138
Joined: Fri May 30, 2008 12:11 pm
Location: Australia
Contact:

Re: [DEV] lastRSS autoposting bot MOD (0.1.4)

Post by deanandeva »

Hi Smix,Hope all is welll, I had stopped using the auto post mod, since my last issue viewtopic.php?f=70&t=829325&start=615#p8475265, I am keen to start using it again. Do you know how to resolve the issue where it doesnt work inside a Joomle wrapper?. Appreciate your help once again !
User avatar
Highway of Life
Former Team Member
Posts: 6048
Joined: Wed Feb 02, 2005 5:41 pm
Location: Seattle, WA
Name: David Lewis
Contact:

Re: [DEV] lastRSS autoposting bot MOD (0.1.4)

Post by Highway of Life »

RazerRazer wrote:But I need it really, it's very important for me!
I hope you realise this is a development MOD and is not intended for live usage, that means it should not be used on your board if it is live, but it is instead meant for testing purposes only.
Furthermore, Authors of a development MOD are not required to accommodate users by giving them support. If you plan on testing development status MODs, you really should not need to beg for support.
The phpBB Weekly Podcast - Discussing the developments of phpBB4 and beyond.

New to phpBB3? Want to learn about programing?
Visit phpBB Academy at StarTrekGuide to learn how.
RazerRazer
Registered User
Posts: 180
Joined: Thu Feb 26, 2009 4:56 pm

Re: [DEV] lastRSS autoposting bot MOD (0.1.4)

Post by RazerRazer »

Highway of Life wrote:
RazerRazer wrote:But I need it really, it's very important for me!
I hope you realise this is a development MOD and is not intended for live usage, that means it should not be used on your board if it is live, but it is instead meant for testing purposes only.
Furthermore, Authors of a development MOD are not required to accommodate users by giving them support. If you plan on testing development status MODs, you really should not need to beg for support.
I know that, but I think, it isn't very difficuld and I think I can become here a little but help. I know, this mod isn't for live boards, but I need this function. Without this, my forum can't start!
User avatar
Ger
Recognised Extension Developer
Posts: 1978
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100
Contact:

Re: [DEV] lastRSS autoposting bot MOD (0.1.4)

Post by Ger »

RazerRazer wrote:I know that, but I think, it isn't very difficuld and I think I can become here a little but help. I know, this mod isn't for live boards, but I need this function. Without this, my forum can't start!
First of all: HoL is right; you shouldn't use this on a life board, it's still too buggy. If your forum can't start without it, don't start your forum (or do not come back and complain about errors).

Second: the messagelength isn't limited by this MOD, it's limited by the RSS.
My extensions:
Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update, Modern Quote, Quoted Where (GDPR) and Autoresponder.
Newest: FAQ manager for 3.2

Like my work? Buy me a coffee to keep it coming. :ugeek:

-Don't PM me for support-
Locked

Return to “[3.0.x] Abandoned MODs”