From aadd0fb530594afad8d5a325b28d4ed13da412c9 Mon Sep 17 00:00:00 2001 From: pascalc Date: Mon, 25 Jun 2012 21:57:52 +0200 Subject: fix atom feed, there was some debug code still there + general simplification --- atom.php | 79 ++++++++++++++++++++++------------------------------------------ 1 file changed, 27 insertions(+), 52 deletions(-) (limited to 'atom.php') diff --git a/atom.php b/atom.php index 035d049..5122158 100644 --- a/atom.php +++ b/atom.php @@ -2,65 +2,40 @@ include_once(dirname(__FILE__).'/app/app.php'); include_once(dirname(__FILE__).'/app/lib/Cache.php'); -//Installed ? -if (!isset($Planet)) { - echo '

' . _g('You might want to install moonmoon.') . '

'; - exit; -} +if ($Planet->loadOpml(dirname(__FILE__).'/custom/people.opml') == 0) exit; -//Load from cache -$items = Array(); -if (0 < $Planet->loadOpml(dirname(__FILE__).'/custom/people.opml')) { - $Planet->loadFeeds(); - $items = $Planet->getItems(); -} - -//Prepare output cache -Cache::$enabled = false; -$cache_key = (count($items)) ? $items[0]->get_id() : ''; -$last_modified = (count($items)) ? $items[0]->get_date() : ''; -$cache_duration = $PlanetConfig->getOutputTimeout()*60; - -Cache::setStore(dirname(__FILE__) . '/' . $conf['cachedir'] . '/'); -//Go display -if (!isset($_GET['type']) || - !is_file(dirname(__FILE__).'/custom/views/'.$_GET['type'].'/index.tpl.php') || - strpos($_GET['type'], DIRECTORY_SEPARATOR)){ - $_GET['type'] = 'default'; -} - -if (!OutputCache::Start($_GET['type'], $cache_key, $cache_duration)) { - include_once(dirname(__FILE__).'/custom/views/'.$_GET['type'].'/index.tpl.php'); - OutputCache::End(); -} - -var_dump($PlanetConfig, $Planet); +$Planet->loadFeeds(); +$items = $Planet->getItems(); $limit = $PlanetConfig->getMaxDisplay(); $count = 0; header('Content-Type: application/atom+xml; charset=UTF-8'); echo ''; -?> - <?php echo htmlspecialchars($PlanetConfig->getName()); ?> - getName()); ?> - getUrl(); ?> - - - - Author +?> + + <?=htmlspecialchars($PlanetConfig->getName())?> + getName())?> + getUrl()?> + + + + getName())?> + + + - - - <?php echo htmlspecialchars($item->get_feed()->getName()); ?> : <?php echo htmlspecialchars($item->get_title());?> - get_permalink());?> - - get_date('Y-m-d\\TH:i:s+00:00'); ?> - get_date('Y-m-d\\TH:i:s+00:00'); ?> - get_author()? $item->get_author()->get_name() : 'anonymous'); ?> - - get_content();?>]]> + <?=htmlspecialchars($item->get_feed()->getName())?> : <?=htmlspecialchars($item->get_title())?> + get_permalink())?> + + get_date('Y-m-d\\TH:i:s+00:00')?> + get_date('Y-m-d\\TH:i:s+00:00')?> + get_author() ? $item->get_author()->get_name() : 'anonymous')?> + + get_content()?>]]> - - + + + + -- cgit v1.2.1