Exemple #1
0
     $f->set_userpwd($D->newfeed_username . ':' . $D->newfeed_password);
     $auth = $f->check_if_requires_auth();
     if ($f->error || $auth) {
         $D->error = TRUE;
         $D->errmsg = 'st_rssfeeds_err_auth';
     } else {
         $f->read();
         if ($f->error) {
             $D->error = TRUE;
             $D->errmsg = 'st_rssfeeds_err_feed';
         }
     }
 }
 if (!$D->error && $f->is_read) {
     $f->fetch();
     $lastdate = $f->get_lastitem_date();
     if (!$lastdate) {
         $lastdate = time();
     }
     $title = $f->title;
     if (empty($title)) {
         $title = preg_replace('/^(http|https|ftp)\\:\\/\\//iu', '', $D->newfeed_url);
     }
     $title = $this->db2->e($title);
     $usrpwd = $D->newfeed_auth_req ? $D->newfeed_username . ':' . $D->newfeed_password : '';
     $usrpwd = $this->db2->e($usrpwd);
     $keywords = str_replace(', ', ',', $D->newfeed_filter);
     $keywords = $this->db2->e($keywords);
     $this->db2->query('SELECT id FROM users_rssfeeds WHERE is_deleted=0 AND user_id="' . $D->user->id . '" AND feed_url="' . $this->db2->e($D->newfeed_url) . '" AND feed_userpwd="' . $usrpwd . '" AND filter_keywords="' . $keywords . '" LIMIT 1');
     if (0 == $this->db2->num_rows()) {
         $this->db2->query('INSERT INTO users_rssfeeds SET is_deleted=0, user_id="' . $D->user->id . '", feed_url="' . $this->db2->e($D->newfeed_url) . '", feed_title="' . $title . '", feed_userpwd="' . $usrpwd . '", filter_keywords="' . $keywords . '", date_added="' . time() . '", date_last_post=0, date_last_crawl="' . time() . '", date_last_item="' . $lastdate . '" ');
Exemple #2
0
<?php

$new_rss_posts = 0;
$r = $db2->query('SELECT id, feed_url FROM pubsubhubbub_subscriptions WHERE parse_needed=1 AND status="subscribe" ORDER BY last_status_date ASC');
while ($tmp = $db2->fetch_object($r)) {
    $db2->query('UPDATE pubsubhubbub_subscriptions SET parse_needed=0 WHERE id="' . $tmp->id . '" LIMIT 1');
    $feed_url = stripslashes($tmp->feed_url);
    $f = null;
    $f = new rssfeed($feed_url, '');
    $f->fetch();
    if ($f->error) {
        continue;
    }
    $dt = $f->get_lastitem_date();
    if (!$dt) {
        continue;
    }
    $rr = $db2->query('SELECT * FROM groups_rssfeeds WHERE is_deleted=0 AND feed_url="' . $db2->e($feed_url) . '" ');
    while ($obj = $db2->fetch_object($rr)) {
        $db2->query('UPDATE groups_rssfeeds SET date_last_crawl="' . time() . '", date_last_item="' . $dt . '", hub_lastping="' . time() . '" WHERE id="' . $obj->id . '" LIMIT 1');
        $obj->feed_title = stripslashes($obj->feed_title);
        $obj->filter_keywords = stripslashes($obj->filter_keywords);
        if ($f->title != $obj->feed_title && !empty($f->title)) {
            $db2->query('UPDATE groups_rssfeeds SET feed_title="' . $db2->e($f->title) . '" WHERE id="' . $obj->id . '" LIMIT 1');
        }
        $items = $f->get_ordered_items($obj->date_last_item, $obj->filter_keywords);
        if (count($items) > 0) {
            $posts = 0;
            foreach ($items as $item) {
                $message = $item->source_title;
                if (empty($message) && !empty($item->source_description)) {