blob: 75c1bc6c98aba7492bf64fcb962090929b752a72 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
<?php
include_once(__DIR__.'/app/app.php');
include_once(__DIR__.'/app/classes/Cache.php');
//Installed ?
if (!$PlanetConfig::isInstalled()) {
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($PlanetConfig->getOpmlFile())) {
$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($PlanetConfig->getCacheDir());
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(__DIR__.'/custom/views/'.$_GET['type'].'/index.tpl.php') ||
strpos($_GET['type'], DIRECTORY_SEPARATOR) || strpos($_GET['type'], '..')) {
$_GET['type'] = 'default';
}
if (!OutputCache::Start($_GET['type'], $cache_key, $cache_duration)) {
include_once(__DIR__.'/custom/views/'.$_GET['type'].'/index.tpl.php');
OutputCache::End();
}
if ($PlanetConfig->getDebug()) {
echo "<!-- \$Planet->errors:\n";
var_dump($Planet->errors);
echo "-->";
}
|