X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Frss.inc.php;h=9d38d3150c6cfd2053219269f245db7c74da6586;hb=01c0448f918d513f314951b0a6ab97f6b7f939aa;hp=9dc4f86d6aeac812ba028c34cc75d515ab67d5f5;hpb=a7c29df3b9bf8f3c3b23fec0f1d2feb814cb61fe;p=platal.git diff --git a/include/rss.inc.php b/include/rss.inc.php index 9dc4f86..9d38d31 100644 --- a/include/rss.inc.php +++ b/include/rss.inc.php @@ -19,28 +19,11 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ -function _rss_encode_date($d) { - if (preg_match('/^\d{14}$/', $d)) { - $t = mktime(substr($d,8,2), substr($d,10,2), substr($d,12,2), substr($d,4,2), substr($d,6,2), substr($d,0,4)); - } else { - $t = strtotime($d); - } - return date('r', $t); -} - function init_rss($template, $alias, $hash, $require_uid = true) { - global $page; + $page =& Platal::page(); $page->changeTpl($template, NO_SKIN); - $page->register_modifier('rss_date', '_rss_encode_date'); - - $res = XDB::query( - 'SELECT a.id - FROM aliases AS a - INNER JOIN auth_user_quick AS q ON ( a.id = q.user_id AND q.core_rss_hash = {?} ) - WHERE a.alias = {?} AND a.type != "homonyme"', $hash, $alias); - $uid = $res->fetchOneCell(); - + $uid = Platal::session()->tokenAuth($alias, $hash); if (empty($uid)) { if ($require_uid) { exit; @@ -50,6 +33,7 @@ function init_rss($template, $alias, $hash, $require_uid = true) } if ($template) { + $page->assign('rss_hash', $hash); header('Content-Type: application/rss+xml; charset=utf8'); } return $uid;