| 168 | | foreach($curls as $cid => $curl) { |
| 169 | | //$rss = $cache->get($curl . MAGPIE_OUTPUT_ENCODING); |
| 170 | | // suppress warnings because Magpie is rather noisy |
| 171 | | $old_level = error_reporting(E_ERROR); |
| 172 | | $rss = fetch_rss( $curl ); |
| 173 | | //reset |
| 174 | | error_reporting($old_level); |
| 175 | | |
| 176 | | $cacheUrls[$cid]= array(); |
| 177 | | //echo "Feed: $cid\n"; |
| 178 | | if ($rss) { |
| 179 | | foreach($rss->items as $item) { |
| 180 | | // this comes from util.php:update() |
| 181 | | |
| 182 | | if (array_key_exists('link',$item) && $item['link'] != "") { |
| 183 | | $url = $item['link']; |
| 184 | | } elseif (array_key_exists('guid',$item) && $item['guid'] != "") { |
| 185 | | $url = $item['guid']; |
| 186 | | } else { |
| 187 | | // fall back to something basic |
| 188 | | $url = md5($item['title']); |
| 189 | | } |
| 190 | | $cacheUrls[$cid][] = htmlentities($url); |
| 191 | | //echo "in cache: $url\n"; |
| 192 | | } |
| 193 | | } |
| 194 | | } |
| | 168 | foreach($curls as $cid => $curl) { |
| | 169 | // suppress warnings because Magpie is rather noisy |
| | 170 | $old_level = error_reporting(E_ERROR); |
| | 171 | $rss = fetch_rss( $curl ); |
| | 172 | //reset |
| | 173 | error_reporting($old_level); |
| | 174 | |
| | 175 | $cacheUrls[$cid]= array(); |
| | 176 | //echo "Feed: $cid\n"; |
| | 177 | if ($rss) { |
| | 178 | foreach($rss->items as $item) { |
| | 179 | // this comes from util.php:update() |
| | 180 | |
| | 181 | if (array_key_exists('link',$item) && $item['link'] != "") { |
| | 182 | $url = $item['link']; |
| | 183 | } elseif (array_key_exists('guid',$item) && $item['guid'] != "") { |
| | 184 | $url = $item['guid']; |
| | 185 | } else { |
| | 186 | // fall back to something basic |
| | 187 | $url = md5($item['title']); |
| | 188 | } |
| | 189 | $cacheUrls[$cid][] = htmlentities($url); |
| | 190 | } |
| | 191 | } |
| | 192 | } |
| 197 | | // now, sort the ids to be deleted into two lists: in chache / to trash |
| 198 | | $in_cache = array(); |
| 199 | | $to_trash = array(); |
| 200 | | //var_dump($cacheUrls); |
| 201 | | foreach ($cids as $cid => $ids) { |
| 202 | | foreach ($ids as $arr) { |
| 203 | | list($iid,$iurl) = $arr; |
| 204 | | //echo "examining: $iid (cid $cid) -> $iurl ->"; |
| 205 | | if (array_search($iurl, $cacheUrls[$cid]) !== FALSE) { |
| 206 | | $in_cache[] = $iid; |
| 207 | | //echo " in cache!\n"; |
| 208 | | } else { |
| 209 | | $to_trash[] = $iid; |
| 210 | | //echo " not in cache!\n"; |
| 211 | | } |
| 212 | | } |
| 213 | | } |
| | 195 | // now, sort the ids to be deleted into two lists: in chache / to trash |
| | 196 | $in_cache = array(); |
| | 197 | $to_trash = array(); |
| | 198 | //var_dump($cacheUrls); |
| | 199 | foreach ($cids as $cid => $ids) { |
| | 200 | foreach ($ids as $arr) { |
| | 201 | list($iid,$iurl) = $arr; |
| | 202 | //echo "examining: $iid (cid $cid) -> $iurl ->"; |
| | 203 | if (array_search($iurl, $cacheUrls[$cid]) !== FALSE) { |
| | 204 | $in_cache[] = $iid; |
| | 205 | //echo " in cache!\n"; |
| | 206 | } else { |
| | 207 | $to_trash[] = $iid; |
| | 208 | //echo " not in cache!\n"; |
| | 209 | } |
| | 210 | } |
| | 211 | } |