summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/app.php17
-rw-r--r--cron.php15
-rw-r--r--index.php21
-rw-r--r--postload.php13
4 files changed, 23 insertions, 43 deletions
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);
+}
diff --git a/cron.php b/cron.php
index 6ff46ae..1098e9b 100644
--- a/cron.php
+++ b/cron.php
@@ -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')) {
diff --git a/index.php b/index.php
index f88e518..cf23238 100644
--- a/index.php
+++ b/index.php
@@ -1,25 +1,12 @@
<?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');
+include_once(dirname(__FILE__).'/app/app.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);
//Load from cache
$items = Array();
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 ( '&amp;', '&', $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(
'',