From 53e3158dfe697ea59da1fa0e401e8da75ae13030 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 28 Feb 2014 21:49:38 +0100 Subject: [add] cron to fetch content on imported entries --- cron.php | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 cron.php (limited to 'cron.php') diff --git a/cron.php b/cron.php new file mode 100644 index 00000000..cc137ca2 --- /dev/null +++ b/cron.php @@ -0,0 +1,53 @@ +getConfigUser($user_id); + +if ($token != $config['token']) { + die(_('Uh, there is a problem with the cron.')); +} + +$items = $store->retrieveUnfetchedEntries($user_id, $limit); + +foreach ($items as $item) { + $url = new Url(base64_encode($item['url'])); + $content = Tools::getPageContent($url); + + $title = ($content['rss']['channel']['item']['title'] != '') ? $content['rss']['channel']['item']['title'] : _('Untitled'); + $body = $content['rss']['channel']['item']['description']; + + // // clean content from prevent xss attack + // $config = HTMLPurifier_Config::createDefault(); + // $purifier = new HTMLPurifier($config); + // $title = $purifier->purify($title); + // $body = $purifier->purify($body); + + + $store->updateContentAndTitle($item['id'], $title, $body, $user_id); +} \ No newline at end of file -- cgit v1.2.3