summaryrefslogtreecommitdiffstats
path: root/common/index.php
diff options
context:
space:
mode:
authorDamien Lallement <dams@mageia.org>2012-08-13 10:45:23 +0000
committerDamien Lallement <dams@mageia.org>2012-08-13 10:45:23 +0000
commitff32e499745367b816d10f25e63ff3328214c32f (patch)
tree238d19398f5951d69d32c8ed9a460f5193446981 /common/index.php
parent5bed2fb79d7b554dd90d2eb58422cfa649aebe08 (diff)
downloadplanet-ff32e499745367b816d10f25e63ff3328214c32f.tar
planet-ff32e499745367b816d10f25e63ff3328214c32f.tar.gz
planet-ff32e499745367b816d10f25e63ff3328214c32f.tar.bz2
planet-ff32e499745367b816d10f25e63ff3328214c32f.tar.xz
planet-ff32e499745367b816d10f25e63ff3328214c32f.zip
- Import moonmoon
- Create repo per langs
Diffstat (limited to 'common/index.php')
-rwxr-xr-xcommon/index.php50
1 files changed, 50 insertions, 0 deletions
diff --git a/common/index.php b/common/index.php
new file mode 100755
index 0000000..60d5e77
--- /dev/null
+++ b/common/index.php
@@ -0,0 +1,50 @@
+<?php
+include_once(dirname(__FILE__).'/app/app.php');
+include_once(dirname(__FILE__).'/app/lib/Cache.php');
+
+//Installed ?
+if (!isset($Planet)) {
+ echo '<p>' . _g('You might want to <a href="install.php">install moonmoon</a>.') . '</p>';
+ 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'] . '/');
+
+if (isset($_GET['type']) && $_GET['type'] == 'atom10') {
+ /* XXX: Redirect old ATOM feeds to new url to make sure our users don't
+ * loose subscribers upon upgrading their moonmoon installation.
+ * Remove this check in a more distant future.
+ */
+ header('Status: 301 Moved Permanently', false, 301);
+ header('Location: atom.php');
+ exit;
+}
+
+//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();
+}
+
+echo "<!--";
+var_dump($Planet->errors);
+echo "-->";