Esempio n. 1
0
function get_new_feeds($feedlink, $md5 = '')
{
    if (!($feeds = c_get_external_file($feedlink))) {
        return FALSE;
    }
    $return = array();
    foreach ($feeds as $url => $content) {
        if (!empty($content)) {
            $new_md5 = md5($content);
            // if Feed has changed : parse it (otherwise, do nothing : no need)
            if ($md5 != $new_md5 or '' == $md5) {
                $data_array = feed2array($content, $url);
                if ($data_array !== FALSE) {
                    $return[$url] = $data_array;
                    $data_array['infos']['md5'] = $md5;
                    // update RSS last successfull update MD5
                    $GLOBALS['liste_flux'][$url]['checksum'] = $new_md5;
                    $GLOBALS['liste_flux'][$url]['iserror'] = 0;
                } else {
                    if (isset($GLOBALS['liste_flux'][$url])) {
                        // error on feed update (else would be on adding new feed)
                        $GLOBALS['liste_flux'][$url]['iserror'] += 1;
                    }
                }
            }
        }
    }
    if (!empty($return)) {
        return $return;
    }
    return FALSE;
}
Esempio n. 2
0
function get_new_feeds($feedlink, $md5 = '')
{
    if (!($feeds = c_get_external_file($feedlink, 15))) {
        return FALSE;
    }
    $return = array();
    foreach ($feeds as $url => $content) {
        if (!empty($content)) {
            $new_md5 = md5($content);
            // if Feed has changed : parse it (otherwise, do nothing : no need)
            if ($md5 != $new_md5 or $md5 == '') {
                $data_array = feed2array($content, $url);
                if ($data_array !== FALSE) {
                    $return[$url] = $data_array;
                    $data_array['infos']['md5'] = $md5;
                    // update RSS last successfull update MD5
                    $GLOBALS['liste_flux'][$url]['checksum'] = $new_md5;
                    $GLOBALS['liste_flux'][$url]['iserror'] = 0;
                } else {
                    //echo '<b>'.$url.'</b> - «'.htmlspecialchars(substr($content, 0, 120)).'»<br/>'; // debug
                    $GLOBALS['liste_flux'][$url]['iserror'] += 1;
                }
            }
        }
    }
    if (!empty($return)) {
        return $return;
    }
    return FALSE;
}