diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | app/app.php | 17 | ||||
-rw-r--r-- | cron.php | 15 | ||||
-rw-r--r-- | index.php | 30 | ||||
-rw-r--r-- | postload.php | 13 |
5 files changed, 24 insertions, 52 deletions
@@ -1,2 +1,3 @@ custom/config.yml +custom/people.opml cache/* diff --git a/app/app.php b/app/app.php new file mode 100644 index 0000000..cd24c51 --- /dev/null +++ b/app/app.php @@ -0,0 +1,17 @@ +<?php + +//Debug ? +$debug = isset($_GET['debug']) ? $_GET['debug'] : 0; +if ($debug) { + error_reporting(E_ALL); +} else { + error_reporting(0); +} + +include_once(dirname(__FILE__).'/classes/Planet.class.php'); + +if (is_file(dirname(__FILE__).'/../custom/config.yml')){ + $conf = Spyc::YAMLLoad(dirname(__FILE__).'/../custom/config.yml'); + $PlanetConfig = new PlanetConfig($conf); + $Planet = new Planet($PlanetConfig); +} @@ -1,18 +1,5 @@ <?php
-include_once(dirname(__FILE__).'/app/classes/Planet.class.php');
-include_once(dirname(__FILE__).'/app/lib/Cache.php');
-include_once(dirname(__FILE__).'/app/lib/lib.http.php');
-
-//Load configuration
-if (is_file(dirname(__FILE__).'/custom/config.yml')){
- $conf = Spyc::YAMLLoad(dirname(__FILE__).'/custom/config.yml');
- $PlanetConfig = new PlanetConfig($conf);
-} else {
- die('Config file (custom/config.yml) is missing.');
-}
-
-//Instantiate app
-$Planet = new Planet($PlanetConfig);
+include_once(dirname(__FILE__).'/app/app.php');
//Load OPML
if (0 < $Planet->loadOpml(dirname(__FILE__).'/custom/people.opml')) {
@@ -1,28 +1,12 @@ <?php -$bench['start'] = microtime(true);
+include_once(dirname(__FILE__).'/app/app.php'); +include_once(dirname(__FILE__).'/app/lib/Cache.php'); -$debug = isset($_GET['debug']) ? $_GET['debug'] : 0;
-if ($debug) {
- error_reporting(E_ALL);
-} else {
- error_reporting(0);
-}
-
-include_once(dirname(__FILE__).'/app/classes/Planet.class.php');
-include_once(dirname(__FILE__).'/app/lib/Cache.php');
-
-//Load configuration
-if (is_file(dirname(__FILE__).'/custom/config.yml')){
- $conf = Spyc::YAMLLoad(dirname(__FILE__).'/custom/config.yml');
- $PlanetConfig = new PlanetConfig($conf);
-} else {
+//Installed ? +if (!isset($Planet)) {
echo '<p>You might want to <a href="install.php">install moonmoon</a>.</p>'; exit;
}
-
-//Instantiate app
-$Planet = new Planet($PlanetConfig);
-$bench['codeloaded'] = microtime(true);
//Load from cache $items = Array();
@@ -30,7 +14,6 @@ if (0 < $Planet->loadOpml(dirname(__FILE__).'/custom/people.opml')) { $Planet->loadFeeds();
$items = $Planet->getItems();
} -$bench['contentloaded'] = microtime(true);
//Prepare output cache Cache::$enabled = false;
@@ -51,11 +34,6 @@ if (!OutputCache::Start($_GET['type'], $cache_key, $cache_duration)) { OutputCache::End();
} -$bench['contentdisplayed'] = microtime(true); - -echo "<!-- Load code: ".($bench['codeloaded'] - $bench['start'])." -->"; -echo "<!-- Load content: ".($bench['contentloaded'] - $bench['codeloaded'])." -->"; -echo "<!-- Display: ".($bench['contentdisplayed'] - $bench['contentloaded'])." -->"; echo "<!--"; var_dump($Planet->errors); echo "-->";
\ No newline at end of file diff --git a/postload.php b/postload.php index de23799..281c4f7 100644 --- a/postload.php +++ b/postload.php @@ -1,9 +1,5 @@ <?php
-/**
- * Load one particular feed
- */
-error_reporting(0);
-include_once(dirname(__FILE__).'/app/classes/Planet.class.php');
+include_once(dirname(__FILE__).'/app/app.php'); function unhtmlspecialchars( $string ) { $string = str_replace ( '&', '&', $string ); @@ -15,13 +11,6 @@ function unhtmlspecialchars( $string ) { return $string; } -//Build config object
-//Use OPML title if no title defined in the config file
-$PlanetConfig = new PlanetConfig(array());
-
-//Instantiate app
-$Planet = new Planet($PlanetConfig);
-
$Planet->addPerson(
new PlanetPerson(
'',
|